create-widget 0.0.9 → 24.1.1-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -27
- package/index.cjs +13 -14
- package/package.json +10 -8
- package/template/.vscode/extensions.json +3 -3
- package/template/README.md +40 -40
- package/template/env.d.ts +1 -1
- package/template/index.html +13 -13
- package/template/package.json +30 -31
- package/template/public/widget.json +50 -50
- package/template/src/App.vue +9 -9
- package/template/src/main.ts +12 -12
- package/template/src/router/index.ts +11 -11
- package/template/src/widgets/clock/Clock.widget.ts +21 -32
- package/template/src/widgets/clock/ClockConfigView.vue +38 -38
- package/template/src/widgets/clock/ClockWidgetRoutes.ts +28 -28
- package/template/src/widgets/clock/ClockWidgetView.vue +35 -34
- package/template/src/widgets/clock/model/ClockModel.ts +2 -2
- package/template/src/widgets/widget-router.ts +6 -5
- package/template/tsconfig.app.json +13 -13
- package/template/tsconfig.json +11 -11
- package/template/tsconfig.node.json +17 -17
- package/template/vite.config.ts +15 -14
- package/template/widget.package.ts +20 -20
package/LICENSE
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
# create-widget core license
|
|
2
|
-
|
|
3
|
-
create-widget is released under the MIT license:
|
|
4
|
-
|
|
5
|
-
MIT License
|
|
6
|
-
|
|
7
|
-
Copyright (c) 2023-present widgetjs
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
# create-widget core license
|
|
2
|
+
|
|
3
|
+
create-widget is released under the MIT license:
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023-present widgetjs
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
|
package/index.cjs
CHANGED
|
@@ -5551,9 +5551,9 @@ var require_minimist = __commonJS({
|
|
|
5551
5551
|
}
|
|
5552
5552
|
});
|
|
5553
5553
|
|
|
5554
|
-
// ../../../node_modules/.pnpm/universalify@2.0.
|
|
5554
|
+
// ../../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
|
|
5555
5555
|
var require_universalify = __commonJS({
|
|
5556
|
-
"../../../node_modules/.pnpm/universalify@2.0.
|
|
5556
|
+
"../../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports2) {
|
|
5557
5557
|
"use strict";
|
|
5558
5558
|
exports2.fromCallback = function(fn) {
|
|
5559
5559
|
return Object.defineProperty(function(...args) {
|
|
@@ -5561,11 +5561,8 @@ var require_universalify = __commonJS({
|
|
|
5561
5561
|
fn.apply(this, args);
|
|
5562
5562
|
else {
|
|
5563
5563
|
return new Promise((resolve2, reject) => {
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
...args,
|
|
5567
|
-
(err, res) => err != null ? reject(err) : resolve2(res)
|
|
5568
|
-
);
|
|
5564
|
+
args.push((err, res) => err != null ? reject(err) : resolve2(res));
|
|
5565
|
+
fn.apply(this, args);
|
|
5569
5566
|
});
|
|
5570
5567
|
}
|
|
5571
5568
|
}, "name", { value: fn.name });
|
|
@@ -5575,8 +5572,10 @@ var require_universalify = __commonJS({
|
|
|
5575
5572
|
const cb = args[args.length - 1];
|
|
5576
5573
|
if (typeof cb !== "function")
|
|
5577
5574
|
return fn.apply(this, args);
|
|
5578
|
-
else
|
|
5579
|
-
|
|
5575
|
+
else {
|
|
5576
|
+
args.pop();
|
|
5577
|
+
fn.apply(this, args).then((r) => cb(null, r), cb);
|
|
5578
|
+
}
|
|
5580
5579
|
}, "name", { value: fn.name });
|
|
5581
5580
|
};
|
|
5582
5581
|
}
|
|
@@ -7754,11 +7753,11 @@ var require_lib2 = __commonJS({
|
|
|
7754
7753
|
// src/index.ts
|
|
7755
7754
|
var import_node_fs = __toESM(require("fs"));
|
|
7756
7755
|
var process2 = __toESM(require("process"));
|
|
7756
|
+
var import_node_path = __toESM(require("path"));
|
|
7757
7757
|
var import_gradient_string = __toESM(require_gradient_string());
|
|
7758
7758
|
var import_prompts = __toESM(require_lib());
|
|
7759
7759
|
var import_minimist = __toESM(require_minimist());
|
|
7760
7760
|
var import_chalk = __toESM(require_source());
|
|
7761
|
-
var import_node_path = __toESM(require("path"));
|
|
7762
7761
|
|
|
7763
7762
|
// src/utils/directoryTraverse.ts
|
|
7764
7763
|
var fs = __toESM(require("fs"));
|
|
@@ -7840,7 +7839,7 @@ function emptyDir(dir) {
|
|
|
7840
7839
|
}
|
|
7841
7840
|
async function init() {
|
|
7842
7841
|
console.log();
|
|
7843
|
-
|
|
7842
|
+
const defaultBanner = "Widget.js - The Desktop Widget Framework";
|
|
7844
7843
|
const gradientBanner = (0, import_gradient_string.default)([
|
|
7845
7844
|
{ color: "#42d392", pos: 0 },
|
|
7846
7845
|
{ color: "#42d392", pos: 0.1 },
|
|
@@ -7850,9 +7849,9 @@ async function init() {
|
|
|
7850
7849
|
console.log();
|
|
7851
7850
|
const argv2 = (0, import_minimist.default)(process2.argv.slice(2), {
|
|
7852
7851
|
alias: {
|
|
7853
|
-
typescript: ["ts"],
|
|
7852
|
+
"typescript": ["ts"],
|
|
7854
7853
|
"with-tests": ["tests"],
|
|
7855
|
-
router: ["vue-router"]
|
|
7854
|
+
"router": ["vue-router"]
|
|
7856
7855
|
},
|
|
7857
7856
|
string: ["_"],
|
|
7858
7857
|
// all arguments are treated as booleans
|
|
@@ -7883,7 +7882,7 @@ async function init() {
|
|
|
7883
7882
|
],
|
|
7884
7883
|
{
|
|
7885
7884
|
onCancel: () => {
|
|
7886
|
-
throw new Error(import_chalk.default.red("\u2716")
|
|
7885
|
+
throw new Error(`${import_chalk.default.red("\u2716")} Operation cancelled`);
|
|
7887
7886
|
}
|
|
7888
7887
|
}
|
|
7889
7888
|
);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-widget",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "24.1.1-beta.15",
|
|
4
|
+
"private": false,
|
|
5
5
|
"description": "An easy way to start a Widget project",
|
|
6
6
|
"author": "Neo Fu <rtugeek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"
|
|
8
|
+
"main": "lib/index.js",
|
|
9
9
|
"bin": {
|
|
10
10
|
"create-widget": "index.cjs"
|
|
11
11
|
},
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"index.cjs",
|
|
14
14
|
"template"
|
|
15
15
|
],
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
16
|
"engines": {
|
|
20
17
|
"node": ">=v16.20.0"
|
|
21
18
|
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"chalk": "^4.1.2",
|
|
24
24
|
"consola": "^2.15.3",
|
|
@@ -30,17 +30,19 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tsconfig/node18": "^18.2.2",
|
|
33
|
-
"@types/gradient-string": "^1.1.2",
|
|
34
33
|
"@types/ejs": "latest",
|
|
35
34
|
"@types/fs-extra": "^11.0.4",
|
|
35
|
+
"@types/gradient-string": "^1.1.2",
|
|
36
36
|
"@types/minimist": "^1.2.5",
|
|
37
37
|
"@types/node": "^18.11.13",
|
|
38
38
|
"@types/prompts": "^2.4.9",
|
|
39
|
+
"esbuild": "^0.20.2",
|
|
39
40
|
"ts-loader": "^9.4.1",
|
|
40
41
|
"ts-node": "^10.9.1",
|
|
41
42
|
"tsup": "^6.5.0",
|
|
42
43
|
"typescript": "^5.2.2",
|
|
43
|
-
"vitest": "^0.34.6"
|
|
44
|
+
"vitest": "^0.34.6",
|
|
45
|
+
"zx": "^7.2.3"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"build": "zx ./scripts/build.mjs",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
|
|
3
|
+
}
|
package/template/README.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
# hello widget
|
|
2
|
-
|
|
3
|
-
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
-
|
|
5
|
-
## Recommended IDE Setup
|
|
6
|
-
|
|
7
|
-
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
|
8
|
-
|
|
9
|
-
## Type Support for `.vue` Imports in TS
|
|
10
|
-
|
|
11
|
-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
|
|
12
|
-
|
|
13
|
-
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
|
|
14
|
-
|
|
15
|
-
1. Disable the built-in TypeScript Extension
|
|
16
|
-
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
|
|
17
|
-
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
|
|
18
|
-
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
|
|
19
|
-
|
|
20
|
-
## Customize configuration
|
|
21
|
-
|
|
22
|
-
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
23
|
-
|
|
24
|
-
## Project Setup
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
npm install
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Compile and Hot-Reload for Development
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
npm run dev
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Type-Check, Compile and Minify for Production
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
npm run build
|
|
40
|
-
```
|
|
1
|
+
# hello widget
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
|
8
|
+
|
|
9
|
+
## Type Support for `.vue` Imports in TS
|
|
10
|
+
|
|
11
|
+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
|
|
12
|
+
|
|
13
|
+
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
|
|
14
|
+
|
|
15
|
+
1. Disable the built-in TypeScript Extension
|
|
16
|
+
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
|
|
17
|
+
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
|
|
18
|
+
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
|
|
19
|
+
|
|
20
|
+
## Customize configuration
|
|
21
|
+
|
|
22
|
+
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
23
|
+
|
|
24
|
+
## Project Setup
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Compile and Hot-Reload for Development
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npm run dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Type-Check, Compile and Minify for Production
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm run build
|
|
40
|
+
```
|
package/template/env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
// / <reference types="vite/client" />
|
package/template/index.html
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<link rel="icon" href="/favicon.ico">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Vite App</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.ts"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="icon" href="/favicon.ico">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/template/package.json
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hello-widget",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "run-p type-check \"build-only {@}\" --",
|
|
9
|
-
"preview": "vite preview",
|
|
10
|
-
"build-only": "vite build",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@tsconfig/node18": "^18.2.2",
|
|
22
|
-
"@types/node": "^18.19.3",
|
|
23
|
-
"@vitejs/plugin-vue": "^4.5.2",
|
|
24
|
-
"@vue/tsconfig": "^0.5.0",
|
|
25
|
-
"
|
|
26
|
-
"typescript": "~5.3.0",
|
|
27
|
-
"vite": "^5.0.10",
|
|
28
|
-
"vue-tsc": "^1.8.25"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "hello-widget",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "run-p type-check \"build-only {@}\" --",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"build-only": "vite build",
|
|
11
|
+
"update:widgetjs": "widget dependencies -t remote",
|
|
12
|
+
"type-check": "vue-tsc --build --force"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@widget-js/core": "0.11.20",
|
|
16
|
+
"@widget-js/vue3": "0.11.21-rc.2",
|
|
17
|
+
"vue": "^3.3.11",
|
|
18
|
+
"vue-router": "^4.2.5"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@tsconfig/node18": "^18.2.2",
|
|
22
|
+
"@types/node": "^18.19.3",
|
|
23
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
24
|
+
"@vue/tsconfig": "^0.5.0",
|
|
25
|
+
"@widget-js/vite-plugin-widget": "^1.2.8",
|
|
26
|
+
"typescript": "~5.3.0",
|
|
27
|
+
"vite": "^5.0.10",
|
|
28
|
+
"vue-tsc": "^1.8.25"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cn.test.widget",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"author": "修改成你的信息",
|
|
5
|
-
"homepage": "",
|
|
6
|
-
"title": {
|
|
7
|
-
"zh-CN": "修改成你的组件标题"
|
|
8
|
-
},
|
|
9
|
-
"description": {
|
|
10
|
-
"zh-CN": "修改成你的组件描述"
|
|
11
|
-
},
|
|
12
|
-
"entry": "/",
|
|
13
|
-
"hash": true,
|
|
14
|
-
"url": "",
|
|
15
|
-
"widgets": [
|
|
16
|
-
{
|
|
17
|
-
"name": "cn.test.widget.clock",
|
|
18
|
-
"title": {
|
|
19
|
-
"zh-CN": "时钟"
|
|
20
|
-
},
|
|
21
|
-
"description": {
|
|
22
|
-
"zh-CN": ""
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"recommend"
|
|
26
|
-
],
|
|
27
|
-
"security": false,
|
|
28
|
-
"permissions": [],
|
|
29
|
-
"lang": "zh-CN",
|
|
30
|
-
"width": 2,
|
|
31
|
-
"height": 2,
|
|
32
|
-
"maxWidth": 6,
|
|
33
|
-
"webviewTag": false,
|
|
34
|
-
"maxHeight": 6,
|
|
35
|
-
"minWidth": 2,
|
|
36
|
-
"minHeight": 2,
|
|
37
|
-
"movable": true,
|
|
38
|
-
"singleton": false,
|
|
39
|
-
"resizable": true,
|
|
40
|
-
"path": "/widget/clock",
|
|
41
|
-
"meta": {},
|
|
42
|
-
"backgroundThrottling": true,
|
|
43
|
-
"previewImage": "修改为组件预览图地址",
|
|
44
|
-
"supportDeployMode": 17,
|
|
45
|
-
"configPagePath": "/widget/config/clock",
|
|
46
|
-
"routes": []
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
"pages": []
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cn.test.widget",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "修改成你的信息",
|
|
5
|
+
"homepage": "",
|
|
6
|
+
"title": {
|
|
7
|
+
"zh-CN": "修改成你的组件标题"
|
|
8
|
+
},
|
|
9
|
+
"description": {
|
|
10
|
+
"zh-CN": "修改成你的组件描述"
|
|
11
|
+
},
|
|
12
|
+
"entry": "/",
|
|
13
|
+
"hash": true,
|
|
14
|
+
"url": "",
|
|
15
|
+
"widgets": [
|
|
16
|
+
{
|
|
17
|
+
"name": "cn.test.widget.clock",
|
|
18
|
+
"title": {
|
|
19
|
+
"zh-CN": "时钟"
|
|
20
|
+
},
|
|
21
|
+
"description": {
|
|
22
|
+
"zh-CN": ""
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"recommend"
|
|
26
|
+
],
|
|
27
|
+
"security": false,
|
|
28
|
+
"permissions": [],
|
|
29
|
+
"lang": "zh-CN",
|
|
30
|
+
"width": 2,
|
|
31
|
+
"height": 2,
|
|
32
|
+
"maxWidth": 6,
|
|
33
|
+
"webviewTag": false,
|
|
34
|
+
"maxHeight": 6,
|
|
35
|
+
"minWidth": 2,
|
|
36
|
+
"minHeight": 2,
|
|
37
|
+
"movable": true,
|
|
38
|
+
"singleton": false,
|
|
39
|
+
"resizable": true,
|
|
40
|
+
"path": "/widget/clock",
|
|
41
|
+
"meta": {},
|
|
42
|
+
"backgroundThrottling": true,
|
|
43
|
+
"previewImage": "修改为组件预览图地址",
|
|
44
|
+
"supportDeployMode": 17,
|
|
45
|
+
"configPagePath": "/widget/config/clock",
|
|
46
|
+
"routes": []
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"pages": []
|
|
50
|
+
}
|
package/template/src/App.vue
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {RouterView } from 'vue-router'
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<RouterView />
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<style scoped></style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { RouterView } from 'vue-router'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<RouterView />
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<style scoped></style>
|
package/template/src/main.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { WidgetJsPlugin } from '@widget-js/vue3'
|
|
2
|
-
import '@widget-js/vue3/dist/style.css'
|
|
3
|
-
import '@/assets/main.css'
|
|
4
|
-
import { createApp } from 'vue'
|
|
5
|
-
import App from './App.vue'
|
|
6
|
-
import router from './router'
|
|
7
|
-
|
|
8
|
-
const app = createApp(App)
|
|
9
|
-
|
|
10
|
-
app.use(router)
|
|
11
|
-
app.use(WidgetJsPlugin)
|
|
12
|
-
app.mount('#app')
|
|
1
|
+
import { WidgetJsPlugin } from '@widget-js/vue3'
|
|
2
|
+
import '@widget-js/vue3/dist/style.css'
|
|
3
|
+
import '@/assets/main.css'
|
|
4
|
+
import { createApp } from 'vue'
|
|
5
|
+
import App from './App.vue'
|
|
6
|
+
import router from './router'
|
|
7
|
+
|
|
8
|
+
const app = createApp(App)
|
|
9
|
+
|
|
10
|
+
app.use(router)
|
|
11
|
+
app.use(WidgetJsPlugin)
|
|
12
|
+
app.mount('#app')
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const router = createRouter({
|
|
5
|
-
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
6
|
-
routes: [
|
|
7
|
-
...WidgetRouter,
|
|
8
|
-
],
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
export default router
|
|
1
|
+
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
2
|
+
import WidgetRouter from '../widgets/widget-router'
|
|
3
|
+
|
|
4
|
+
const router = createRouter({
|
|
5
|
+
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
6
|
+
routes: [
|
|
7
|
+
...WidgetRouter,
|
|
8
|
+
],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export default router
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import { Widget, WidgetKeyword } from '@widget-js/core'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
height: 2,
|
|
23
|
-
minWidth: 2,
|
|
24
|
-
maxWidth: 6,
|
|
25
|
-
minHeight: 2,
|
|
26
|
-
maxHeight: 6,
|
|
27
|
-
previewImage: '/preview_clock.png',
|
|
28
|
-
path,
|
|
29
|
-
configPagePath,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export default ClockWidget;
|
|
1
|
+
import { Widget, WidgetKeyword } from '@widget-js/core'
|
|
2
|
+
|
|
3
|
+
// TODO 修改组件信息,标题,描述,关键词
|
|
4
|
+
const ClockWidget = new Widget({
|
|
5
|
+
name: 'cn.example.widget.clock',
|
|
6
|
+
title: { 'zh-CN': '时钟' },
|
|
7
|
+
description: { 'zh-CN': 'Hello world!' },
|
|
8
|
+
keywords: [WidgetKeyword.RECOMMEND],
|
|
9
|
+
lang: 'zh-CN',
|
|
10
|
+
width: 2,
|
|
11
|
+
height: 2,
|
|
12
|
+
minWidth: 2,
|
|
13
|
+
maxWidth: 6,
|
|
14
|
+
minHeight: 2,
|
|
15
|
+
maxHeight: 6,
|
|
16
|
+
previewImage: '/preview_clock.png',
|
|
17
|
+
path: '/widget/clock',
|
|
18
|
+
configPagePath: '/widget/config/clock',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export default ClockWidget
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</
|
|
35
|
-
|
|
36
|
-
<style scoped>
|
|
37
|
-
|
|
38
|
-
</style>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import {
|
|
3
|
+
WidgetConfigOption,
|
|
4
|
+
WidgetEditDialog,
|
|
5
|
+
useWidget,
|
|
6
|
+
} from '@widget-js/vue3'
|
|
7
|
+
import { BrowserWindowApi } from '@widget-js/core'
|
|
8
|
+
import { ClockModel } from '@/widgets/clock/model/ClockModel'
|
|
9
|
+
|
|
10
|
+
const { widgetData, widgetParams, save } = useWidget(ClockModel)
|
|
11
|
+
BrowserWindowApi.setup({ width: 600, height: 400 })
|
|
12
|
+
// 修改成需要设置组件参数配置
|
|
13
|
+
const widgetConfigOption = new WidgetConfigOption({
|
|
14
|
+
title: '时钟设置',
|
|
15
|
+
theme: {
|
|
16
|
+
backgroundColor: true,
|
|
17
|
+
borderRadius: true,
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<WidgetEditDialog
|
|
24
|
+
v-model="widgetData"
|
|
25
|
+
:widget-params="widgetParams"
|
|
26
|
+
:option="widgetConfigOption"
|
|
27
|
+
@apply="save()"
|
|
28
|
+
@confirm="save({ closeWindow: true })"
|
|
29
|
+
>
|
|
30
|
+
<template #custom>
|
|
31
|
+
标题 <input v-model="widgetData.title">
|
|
32
|
+
</template>
|
|
33
|
+
</WidgetEditDialog>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
|
|
38
|
+
</style>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import ClockWidget from './Clock.widget'
|
|
3
|
-
|
|
4
|
-
const path = ClockWidget.path
|
|
5
|
-
const name = ClockWidget.name
|
|
6
|
-
|
|
7
|
-
const configPagePath = ClockWidget.configPagePath
|
|
8
|
-
|
|
9
|
-
const ClockWidgetRoutes: RouteRecordRaw[] = [
|
|
10
|
-
{
|
|
11
|
-
path
|
|
12
|
-
name: `${name}`,
|
|
13
|
-
component: () =>
|
|
14
|
-
import(
|
|
15
|
-
/* webpackChunkName: "cn.test.widget.clock" */ './ClockWidgetView.vue'
|
|
16
|
-
),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
path: configPagePath,
|
|
20
|
-
name: `${name}.config`,
|
|
21
|
-
component: () =>
|
|
22
|
-
import(
|
|
23
|
-
/* webpackChunkName: "cn.test.widget.clock.config" */ './ClockConfigView.vue'
|
|
24
|
-
),
|
|
25
|
-
},
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
export default ClockWidgetRoutes
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import ClockWidget from './Clock.widget'
|
|
3
|
+
|
|
4
|
+
const path = ClockWidget.path
|
|
5
|
+
const name = ClockWidget.name
|
|
6
|
+
|
|
7
|
+
const configPagePath = ClockWidget.configPagePath!
|
|
8
|
+
|
|
9
|
+
const ClockWidgetRoutes: RouteRecordRaw[] = [
|
|
10
|
+
{
|
|
11
|
+
path,
|
|
12
|
+
name: `${name}`,
|
|
13
|
+
component: () =>
|
|
14
|
+
import(
|
|
15
|
+
/* webpackChunkName: "cn.test.widget.clock" */ './ClockWidgetView.vue'
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: configPagePath,
|
|
20
|
+
name: `${name}.config`,
|
|
21
|
+
component: () =>
|
|
22
|
+
import(
|
|
23
|
+
/* webpackChunkName: "cn.test.widget.clock.config" */ './ClockConfigView.vue'
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
export default ClockWidgetRoutes
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
font-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useWidget } from '@widget-js/vue3'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
import { ClockModel } from '@/widgets/clock/model/ClockModel'
|
|
5
|
+
|
|
6
|
+
const { widgetData } = useWidget(ClockModel)
|
|
7
|
+
|
|
8
|
+
const time = ref(new Date().toLocaleTimeString())
|
|
9
|
+
setInterval(() => {
|
|
10
|
+
time.value = new Date().toLocaleTimeString()
|
|
11
|
+
}, 1000)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<widget-wrapper>
|
|
16
|
+
<div class="clock">
|
|
17
|
+
<span>{{ widgetData.title }}</span>
|
|
18
|
+
<span>{{ time }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</widget-wrapper>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.clock {
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
background-color: var(--widget-background-color);
|
|
31
|
+
border-radius: var(--widget-border-radius);
|
|
32
|
+
color: var(--widget-color);
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import ClockWidgetRoutes from
|
|
3
|
-
|
|
2
|
+
import ClockWidgetRoutes from './clock/ClockWidgetRoutes'
|
|
3
|
+
|
|
4
|
+
// FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
|
|
4
5
|
const WidgetRouter: RouteRecordRaw[] = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
]
|
|
6
|
+
...ClockWidgetRoutes,
|
|
7
|
+
// FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
|
|
8
|
+
]
|
|
8
9
|
export default WidgetRouter
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": ["./src/*"]
|
|
8
|
+
},
|
|
9
|
+
"noEmit": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
12
|
+
"exclude": ["src/**/__tests__/*"]
|
|
13
|
+
}
|
package/template/tsconfig.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"references": [
|
|
3
|
+
{
|
|
4
|
+
"path": "./tsconfig.node.json"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"path": "./tsconfig.app.json"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"files": []
|
|
11
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsconfig/node18/tsconfig.json",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/node18/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"noEmit": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"vite.config.*",
|
|
12
|
+
"vitest.config.*",
|
|
13
|
+
"cypress.config.*",
|
|
14
|
+
"nightwatch.conf.*",
|
|
15
|
+
"playwright.config.*"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/template/vite.config.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { defineConfig } from 'vite'
|
|
5
|
-
import vue from '@vitejs/plugin-vue'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
1
|
+
import { URL, fileURLToPath } from 'node:url'
|
|
2
|
+
import widget from '@widget-js/vite-plugin-widget'
|
|
3
|
+
|
|
4
|
+
import { defineConfig } from 'vite'
|
|
5
|
+
import vue from '@vitejs/plugin-vue'
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [vue(), widget()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
})
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { WidgetPackage } from '@widget-js/core'
|
|
2
|
-
|
|
3
|
-
//TODO 完善组件包信息
|
|
4
|
-
export default new WidgetPackage({
|
|
5
|
-
author: '修改成你的信息',
|
|
6
|
-
description: {
|
|
7
|
-
'zh-CN': '修改成你的组件描述',
|
|
8
|
-
},
|
|
9
|
-
entry: '/',
|
|
10
|
-
hash: true,
|
|
11
|
-
homepage: '',
|
|
12
|
-
name: 'cn.example.widget',
|
|
13
|
-
title: {
|
|
14
|
-
'zh-CN': '修改成你的组件标题',
|
|
15
|
-
},
|
|
16
|
-
version: '1.0.0',
|
|
17
|
-
devOptions: {
|
|
18
|
-
folder: './src/widgets/',
|
|
19
|
-
},
|
|
20
|
-
})
|
|
1
|
+
import { WidgetPackage } from '@widget-js/core'
|
|
2
|
+
|
|
3
|
+
// TODO 完善组件包信息
|
|
4
|
+
export default new WidgetPackage({
|
|
5
|
+
author: '修改成你的信息',
|
|
6
|
+
description: {
|
|
7
|
+
'zh-CN': '修改成你的组件描述',
|
|
8
|
+
},
|
|
9
|
+
entry: '/',
|
|
10
|
+
hash: true,
|
|
11
|
+
homepage: '',
|
|
12
|
+
name: 'cn.example.widget',
|
|
13
|
+
title: {
|
|
14
|
+
'zh-CN': '修改成你的组件标题',
|
|
15
|
+
},
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
devOptions: {
|
|
18
|
+
folder: './src/widgets/',
|
|
19
|
+
},
|
|
20
|
+
})
|