create-widget 24.1.1-beta.4 → 24.1.1-beta.41
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 +59 -5
- package/package.json +9 -5
- 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 +33 -29
- 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 -21
- 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 -35
- package/template/src/widgets/widget-router.ts +3 -3
- 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 +22 -15
- package/template/widget.package.ts +0 -1
- package/unocss/src/main.ts +13 -0
- package/unocss/uno.config.ts +5 -0
- package/unocss/vite.config.ts +24 -0
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
|
@@ -7804,7 +7804,7 @@ var FileUtils = class {
|
|
|
7804
7804
|
if (stats.isDirectory()) {
|
|
7805
7805
|
await this.copyFolderRecursive(srcPath, destPath);
|
|
7806
7806
|
} else {
|
|
7807
|
-
await (0, import_fs_extra.copy)(srcPath, destPath);
|
|
7807
|
+
await (0, import_fs_extra.copy)(srcPath, destPath, { overwrite: true });
|
|
7808
7808
|
}
|
|
7809
7809
|
}
|
|
7810
7810
|
} catch (error) {
|
|
@@ -7845,7 +7845,9 @@ async function init() {
|
|
|
7845
7845
|
{ color: "#42d392", pos: 0.1 },
|
|
7846
7846
|
{ color: "#647eff", pos: 1 }
|
|
7847
7847
|
])(defaultBanner);
|
|
7848
|
-
console.log(
|
|
7848
|
+
console.log(
|
|
7849
|
+
process2.stdout.isTTY && process2.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
7850
|
+
);
|
|
7849
7851
|
console.log();
|
|
7850
7852
|
const argv2 = (0, import_minimist.default)(process2.argv.slice(2), {
|
|
7851
7853
|
alias: {
|
|
@@ -7860,6 +7862,9 @@ async function init() {
|
|
|
7860
7862
|
let targetDir = argv2._[0];
|
|
7861
7863
|
const defaultProjectName = !targetDir ? "widget-project" : targetDir;
|
|
7862
7864
|
const forceOverwrite = argv2.force;
|
|
7865
|
+
const unocss = argv2.unocss;
|
|
7866
|
+
const vueuse = argv2.vueuse;
|
|
7867
|
+
const iconpark = argv2.iconpark;
|
|
7863
7868
|
const cwd2 = process2.cwd();
|
|
7864
7869
|
let result = {};
|
|
7865
7870
|
result = await (0, import_prompts.default)(
|
|
@@ -7878,6 +7883,27 @@ async function init() {
|
|
|
7878
7883
|
const dirForPrompt = targetDir === "." ? "Current directory" : `Target directory "${targetDir}"`;
|
|
7879
7884
|
return `${dirForPrompt} is not empty. Remove existing files and continue?`;
|
|
7880
7885
|
}
|
|
7886
|
+
},
|
|
7887
|
+
{
|
|
7888
|
+
name: "useVueUse",
|
|
7889
|
+
type: () => vueuse ? null : "confirm",
|
|
7890
|
+
message: () => {
|
|
7891
|
+
return `Use VueUse (Collection of Essential Vue Composition Utilities)?`;
|
|
7892
|
+
}
|
|
7893
|
+
},
|
|
7894
|
+
{
|
|
7895
|
+
name: "useUnoCss",
|
|
7896
|
+
type: () => unocss ? null : "confirm",
|
|
7897
|
+
message: () => {
|
|
7898
|
+
return `Use Unocss(Atomic CSS Engine)?`;
|
|
7899
|
+
}
|
|
7900
|
+
},
|
|
7901
|
+
{
|
|
7902
|
+
name: "useIconPark",
|
|
7903
|
+
type: () => iconpark ? null : "confirm",
|
|
7904
|
+
message: () => {
|
|
7905
|
+
return `Use IconPark (2000+ high-quality icons)?`;
|
|
7906
|
+
}
|
|
7881
7907
|
}
|
|
7882
7908
|
],
|
|
7883
7909
|
{
|
|
@@ -7886,7 +7912,13 @@ async function init() {
|
|
|
7886
7912
|
}
|
|
7887
7913
|
}
|
|
7888
7914
|
);
|
|
7889
|
-
const {
|
|
7915
|
+
const {
|
|
7916
|
+
projectName,
|
|
7917
|
+
shouldOverwrite = argv2.force,
|
|
7918
|
+
useVueUse = argv2.vueuse,
|
|
7919
|
+
useUnoCss = argv2.unocss,
|
|
7920
|
+
useIconPark = argv2.iconpark
|
|
7921
|
+
} = result;
|
|
7890
7922
|
const root = import_node_path.default.join(cwd2, targetDir);
|
|
7891
7923
|
if (import_node_fs.default.existsSync(root) && shouldOverwrite) {
|
|
7892
7924
|
emptyDir(root);
|
|
@@ -7897,6 +7929,20 @@ async function init() {
|
|
|
7897
7929
|
Scaffolding project in ${root}...`);
|
|
7898
7930
|
const templateRoot = import_node_path.default.join(__dirname, "./template");
|
|
7899
7931
|
await FileUtils.copyFolderRecursive(templateRoot, root);
|
|
7932
|
+
const packageJsonPath = import_node_path.default.resolve(`${root}/package.json`);
|
|
7933
|
+
const packageJson = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath).toString());
|
|
7934
|
+
if (useVueUse) {
|
|
7935
|
+
packageJson.dependencies["@vueuse/core"] = "latest";
|
|
7936
|
+
}
|
|
7937
|
+
if (useUnoCss) {
|
|
7938
|
+
packageJson.devDependencies.unocss = "latest";
|
|
7939
|
+
const unocssTemplateRoot = import_node_path.default.join(__dirname, "./unocss");
|
|
7940
|
+
await FileUtils.copyFolderRecursive(unocssTemplateRoot, root);
|
|
7941
|
+
}
|
|
7942
|
+
if (useIconPark) {
|
|
7943
|
+
packageJson.dependencies["@icon-park/vue-next"] = "latest";
|
|
7944
|
+
}
|
|
7945
|
+
import_node_fs.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
7900
7946
|
const userAgent = process2.env.npm_config_user_agent ?? "";
|
|
7901
7947
|
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npm";
|
|
7902
7948
|
console.log(`
|
|
@@ -7904,9 +7950,17 @@ Done. Now run:
|
|
|
7904
7950
|
`);
|
|
7905
7951
|
if (root !== cwd2) {
|
|
7906
7952
|
const cdProjectName = import_node_path.default.relative(cwd2, root);
|
|
7907
|
-
console.log(
|
|
7953
|
+
console.log(
|
|
7954
|
+
` ${import_chalk.default.bold(
|
|
7955
|
+
import_chalk.default.green(
|
|
7956
|
+
`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`
|
|
7957
|
+
)
|
|
7958
|
+
)}`
|
|
7959
|
+
);
|
|
7908
7960
|
}
|
|
7909
|
-
console.log(
|
|
7961
|
+
console.log(
|
|
7962
|
+
` ${import_chalk.default.bold(import_chalk.default.green(getCommand(packageManager, "install")))}`
|
|
7963
|
+
);
|
|
7910
7964
|
}
|
|
7911
7965
|
init().catch((e) => {
|
|
7912
7966
|
console.error(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-widget",
|
|
3
|
-
"version": "24.1.1-beta.
|
|
3
|
+
"version": "24.1.1-beta.41",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An easy way to start a Widget project",
|
|
6
6
|
"author": "Neo Fu <rtugeek@gmail.com>",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"index.cjs",
|
|
14
|
-
"template"
|
|
14
|
+
"template",
|
|
15
|
+
"unocss"
|
|
15
16
|
],
|
|
16
17
|
"engines": {
|
|
17
18
|
"node": ">=v16.20.0"
|
|
@@ -21,8 +22,6 @@
|
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"chalk": "^4.1.2",
|
|
24
|
-
"consola": "^2.15.3",
|
|
25
|
-
"ejs": "^3.1.8",
|
|
26
25
|
"fs-extra": "^11.2.0",
|
|
27
26
|
"gradient-string": "^2.0.2",
|
|
28
27
|
"minimist": "^1.2.8",
|
|
@@ -37,6 +36,9 @@
|
|
|
37
36
|
"@types/node": "^18.11.13",
|
|
38
37
|
"@types/prompts": "^2.4.9",
|
|
39
38
|
"esbuild": "^0.20.2",
|
|
39
|
+
"eslint": "8.48.0",
|
|
40
|
+
"ora": "^6.2.0",
|
|
41
|
+
"package-json": "^10.0.1",
|
|
40
42
|
"ts-loader": "^9.4.1",
|
|
41
43
|
"ts-node": "^10.9.1",
|
|
42
44
|
"tsup": "^6.5.0",
|
|
@@ -46,9 +48,11 @@
|
|
|
46
48
|
},
|
|
47
49
|
"scripts": {
|
|
48
50
|
"build": "zx ./scripts/build.mjs",
|
|
51
|
+
"build:only": "zx ./scripts/build.mjs",
|
|
49
52
|
"watch": "tsup-node src/index.ts --format cjs --watch",
|
|
50
|
-
"build:run": "npm run build && npm
|
|
53
|
+
"build:run": "npm run build && npm exec create-widget",
|
|
51
54
|
"test": "node index.cjs",
|
|
55
|
+
"update:version": "esno scripts/updateVersion.ts",
|
|
52
56
|
"pnpm:publish": "npm run build && pnpm publish --no-git-checks"
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -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
|
-
// / <reference types="vite/client" />
|
|
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,29 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hello-widget",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"@widget-js/core": "
|
|
15
|
-
"@widget-js/vue3": "
|
|
16
|
-
"vue": "^3.3.11",
|
|
17
|
-
"vue-router": "^4.2.5"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@vue
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "hello-widget",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"update:widgetjs": "widget dependencies -t remote"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@vueuse/core": "^11.0.1",
|
|
14
|
+
"@widget-js/core": "latest",
|
|
15
|
+
"@widget-js/vue3": "latest",
|
|
16
|
+
"vue": "^3.3.11",
|
|
17
|
+
"vue-router": "^4.2.5",
|
|
18
|
+
"element-plus": "^2.8.1"
|
|
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
|
+
"unplugin-auto-import": "^0.11.4",
|
|
26
|
+
"unplugin-vue-components": "^0.22.9",
|
|
27
|
+
"@widget-js/vite-plugin-widget": "latest",
|
|
28
|
+
"@widget-js/cli": "latest",
|
|
29
|
+
"typescript": "~5.3.0",
|
|
30
|
+
"vite": "^5.0.10",
|
|
31
|
+
"vue-tsc": "^1.8.25"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -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 { 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
|
+
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,21 +1,21 @@
|
|
|
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
|
+
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
|
-
<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
|
+
<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,35 +1,35 @@
|
|
|
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
|
+
<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,9 +1,9 @@
|
|
|
1
1
|
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import ClockWidgetRoutes from './clock/ClockWidgetRoutes'
|
|
3
|
-
|
|
2
|
+
import ClockWidgetRoutes from './clock/ClockWidgetRoutes'
|
|
3
|
+
|
|
4
4
|
// FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
|
|
5
5
|
const WidgetRouter: RouteRecordRaw[] = [
|
|
6
|
-
...ClockWidgetRoutes,
|
|
6
|
+
...ClockWidgetRoutes,
|
|
7
7
|
// FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
|
|
8
8
|
]
|
|
9
9
|
export default WidgetRouter
|
|
@@ -1,13 +1,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
|
-
}
|
|
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
|
-
"references": [
|
|
3
|
-
{
|
|
4
|
-
"path": "./tsconfig.node.json"
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"path": "./tsconfig.app.json"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
"files": []
|
|
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
|
-
"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
|
-
}
|
|
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,15 +1,22 @@
|
|
|
1
|
-
import { URL, fileURLToPath } from
|
|
2
|
-
import widget from
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})
|
|
1
|
+
import { URL, fileURLToPath } from "node:url";
|
|
2
|
+
import widget from "@widget-js/vite-plugin-widget";
|
|
3
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
import vue from "@vitejs/plugin-vue";
|
|
7
|
+
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
8
|
+
|
|
9
|
+
// https://vitejs.dev/config/
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [
|
|
12
|
+
vue(),
|
|
13
|
+
widget(),
|
|
14
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
15
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
16
|
+
],
|
|
17
|
+
resolve: {
|
|
18
|
+
alias: {
|
|
19
|
+
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'virtual:uno.css'
|
|
2
|
+
import { WidgetJsPlugin } from '@widget-js/vue3'
|
|
3
|
+
import '@widget-js/vue3/dist/style.css'
|
|
4
|
+
import '@/assets/main.css'
|
|
5
|
+
import { createApp } from 'vue'
|
|
6
|
+
import App from './App.vue'
|
|
7
|
+
import router from './router'
|
|
8
|
+
|
|
9
|
+
const app = createApp(App)
|
|
10
|
+
|
|
11
|
+
app.use(router)
|
|
12
|
+
app.use(WidgetJsPlugin)
|
|
13
|
+
app.mount('#app')
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { URL, fileURLToPath } from "node:url";
|
|
2
|
+
import widget from "@widget-js/vite-plugin-widget";
|
|
3
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import UnoCSS from 'unocss/vite'
|
|
6
|
+
import { defineConfig } from "vite";
|
|
7
|
+
import vue from "@vitejs/plugin-vue";
|
|
8
|
+
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
9
|
+
|
|
10
|
+
// https://vitejs.dev/config/
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
plugins: [
|
|
13
|
+
vue(),
|
|
14
|
+
UnoCSS(),
|
|
15
|
+
widget(),
|
|
16
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
17
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
18
|
+
],
|
|
19
|
+
resolve: {
|
|
20
|
+
alias: {
|
|
21
|
+
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|