-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zhi-lib-device): add device libiary
- Loading branch information
Showing
32 changed files
with
1,356 additions
and
112 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
...rwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/package.json
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...er/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/index.d.ts
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...rwer/Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/index.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.../Documents/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/index.js.map
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ments/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/core/zhi.d.ts
This file was deleted.
Oops, something went wrong.
73 changes: 0 additions & 73 deletions
73
...cuments/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/core/zhi.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...nts/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/core/zhi.js.map
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ments/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/zhi-core.d.ts
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...cuments/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/zhi-core.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...nts/mydocs/SiYuanWorkspace/public/conf/appearance/themes/zhi/core/src/lib/zhi-core.js.map
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@siyuan-community/zhi-core", | ||
"name": "@zhi/zhi-core", | ||
"version": "0.1.0", | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# zhi-lib-device | ||
|
||
auto check environment whether in browser, browser extension, electron, node and more | ||
|
||
## Usage | ||
|
||
```js | ||
import { DeviceDetection, BrowserUtil } from "@siyuan-community/zhi-device" | ||
|
||
console.log("isInBrowser=>", BrowserUtil.isInBrowser) | ||
|
||
const deviceType = DeviceDetection.getDevice() | ||
console.log("deviceType=>", deviceType) | ||
|
||
// supported platforms | ||
// Mobile | ||
// Siyuan_Widget | ||
// Siyuan_NewWindow | ||
// Siyuan_MainWindow | ||
// Chrome_Extension | ||
// Chrome_Browser | ||
// Node | ||
``` | ||
|
||
## Deps | ||
|
||
``` | ||
## Congregations! zhi-lib-device need no deps, it is just pure js code 🎉 | ||
``` | ||
|
||
## Dev | ||
|
||
```bash | ||
nx dev zhi-lib-device | ||
``` | ||
|
||
## Build | ||
|
||
```bash | ||
nx build zhi-lib-device | ||
``` | ||
|
||
## Test | ||
|
||
Execute the unit tests via [vitest](https://vitest.dev) | ||
|
||
```bash | ||
nx test zhi-lib-device | ||
``` | ||
|
||
## Publish | ||
|
||
```bash | ||
nx publish zhi-lib-device --ver=0.0.1 --tag=latest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@siyuan-community/zhi-device", | ||
"version": "0.2.2", | ||
"type": "module", | ||
"description": "auto check environment whether in browser, browser extension, electron, node and more", | ||
"main": "./index.js", | ||
"typings": "./index.d.ts", | ||
"repository": "terwer/zhi", | ||
"homepage": "https://github.com/terwer/zhi/tree/main/apps/zhi-device", | ||
"author": "terwer", | ||
"license": "GPL", | ||
"keywords": [ | ||
"zhi", | ||
"device", | ||
"browser", | ||
"node", | ||
"electron" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "zhi-lib-device", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/zhi-lib-device/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/vite:build", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/packages/zhi-lib-device", | ||
"assets": ["packages/zhi-core/*.md"] | ||
} | ||
}, | ||
"publish": { | ||
"command": "node tools/scripts/publish.mjs zhi-lib-device {args.ver} {args.tag}", | ||
"dependsOn": ["build"] | ||
}, | ||
"test": { | ||
"executor": "@nx/vite:test", | ||
"outputs": ["coverage/packages/zhi-lib-device"], | ||
"options": { | ||
"passWithNoTests": true, | ||
"reportsDirectory": "../../coverage/packages/zhi-lib-device" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["packages/zhi-lib-device/**/*.ts"] | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
export * from "./lib/zhi-lib-device" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2023, Terwer . All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Terwer designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Terwer in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com | ||
* or visit www.terwer.space if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
/** | ||
* 基本路径枚举 | ||
* | ||
* @public | ||
* @author terwer | ||
* @version 0.1.0 | ||
* @since 0.1.0 | ||
*/ | ||
enum BasePathTypeEnum { | ||
/** | ||
* Appearance | ||
*/ | ||
BasePathType_Appearance = "Appearance", | ||
|
||
/** | ||
* Data | ||
*/ | ||
BasePathType_Data = "Data", | ||
|
||
/** | ||
* Themes | ||
*/ | ||
BasePathType_Themes = "Themes", | ||
|
||
/** | ||
* Zhi 主题目录 | ||
*/ | ||
BasePathType_ZhiTheme = "ZhiTheme", | ||
|
||
/** | ||
* 未设置 | ||
*/ | ||
BasePathType_None = "None", | ||
} | ||
|
||
export default BasePathTypeEnum |
Oops, something went wrong.