create-widget 0.0.1

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.
Files changed (67) hide show
  1. package/.editorconfig +13 -0
  2. package/.idea/create-widget.iml +9 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/jpa-buddy.xml +6 -0
  5. package/.idea/misc.xml +8 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/prettier.xml +6 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/lib/index.js +166 -0
  10. package/package.json +48 -0
  11. package/src/index.ts +144 -0
  12. package/src/utils/FileUtils.ts +33 -0
  13. package/src/utils/deepMerge.ts +26 -0
  14. package/src/utils/directoryTraverse.ts +35 -0
  15. package/src/utils/getCommand.ts +13 -0
  16. package/src/utils/renderTemplate.ts +88 -0
  17. package/src/utils/sortDependencies.ts +22 -0
  18. package/template/.vscode/extensions.json +3 -0
  19. package/template/README.md +40 -0
  20. package/template/env.d.ts +1 -0
  21. package/template/index.html +13 -0
  22. package/template/package.json +31 -0
  23. package/template/public/favicon.ico +0 -0
  24. package/template/public/preview_clock.png +0 -0
  25. package/template/public/widget.json +50 -0
  26. package/template/src/App.vue +9 -0
  27. package/template/src/assets/main.css +3 -0
  28. package/template/src/main.ts +12 -0
  29. package/template/src/router/index.ts +11 -0
  30. package/template/src/widgets/clock/Clock.widget.ts +32 -0
  31. package/template/src/widgets/clock/ClockConfigView.vue +38 -0
  32. package/template/src/widgets/clock/ClockWidgetRoutes.ts +28 -0
  33. package/template/src/widgets/clock/ClockWidgetView.vue +34 -0
  34. package/template/src/widgets/clock/model/ClockModel.ts +5 -0
  35. package/template/src/widgets/widget-router.ts +8 -0
  36. package/template/tsconfig.app.json +13 -0
  37. package/template/tsconfig.json +11 -0
  38. package/template/tsconfig.node.json +17 -0
  39. package/template/vite.config.ts +14 -0
  40. package/template/widget.package.ts +20 -0
  41. package/test/index.test.ts +24 -0
  42. package/tsconfig.json +12 -0
  43. package/tsup.config.ts +6 -0
  44. package/widget-test/.vscode/extensions.json +3 -0
  45. package/widget-test/README.md +40 -0
  46. package/widget-test/env.d.ts +1 -0
  47. package/widget-test/index.html +13 -0
  48. package/widget-test/package.json +30 -0
  49. package/widget-test/public/favicon.ico +0 -0
  50. package/widget-test/public/preview_clock.png +0 -0
  51. package/widget-test/public/widget.json +50 -0
  52. package/widget-test/src/App.vue +9 -0
  53. package/widget-test/src/assets/main.css +3 -0
  54. package/widget-test/src/main.ts +12 -0
  55. package/widget-test/src/router/index.ts +11 -0
  56. package/widget-test/src/widgets/clock/Clock.widget.ts +32 -0
  57. package/widget-test/src/widgets/clock/ClockConfigView.vue +38 -0
  58. package/widget-test/src/widgets/clock/ClockWidgetRoutes.ts +28 -0
  59. package/widget-test/src/widgets/clock/ClockWidgetView.vue +34 -0
  60. package/widget-test/src/widgets/clock/model/ClockModel.ts +5 -0
  61. package/widget-test/src/widgets/widget-router.ts +8 -0
  62. package/widget-test/tsconfig.app.json +13 -0
  63. package/widget-test/tsconfig.json +11 -0
  64. package/widget-test/tsconfig.node.json +17 -0
  65. package/widget-test/vite.config.ts +14 -0
  66. package/widget-test/widget.package.ts +20 -0
  67. package/widget-test/yarn.lock +1399 -0
@@ -0,0 +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
+ ```
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +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>
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "hello-widget",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "run-p type-check \"build-only {@}\" --",
9
+ "preview": "vite preview",
10
+ "build-only": "vite build",
11
+ "type-check": "vue-tsc --build --force"
12
+ },
13
+ "dependencies": {
14
+ "@widget-js/vite-plugin-widget": "^1.2.8",
15
+ "vue": "^3.3.11",
16
+ "vue-router": "^4.2.5",
17
+ "@widget-js/core": "0.11.20",
18
+ "@widget-js/vue3": "0.11.21-rc.2"
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
+ "npm-run-all2": "^6.1.1",
26
+ "typescript": "~5.3.0",
27
+ "vite": "^5.0.10",
28
+ "vue-tsc": "^1.8.25",
29
+ "@widget-js/vite-plugin-widget": "^1.2.8"
30
+ }
31
+ }
Binary file
@@ -0,0 +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
+ }
@@ -0,0 +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>
@@ -0,0 +1,3 @@
1
+ body{
2
+ margin: 0;
3
+ }
@@ -0,0 +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')
@@ -0,0 +1,11 @@
1
+ import WidgetRouter from '../widgets/widget-router';
2
+ import {createRouter, createWebHashHistory} from 'vue-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;
@@ -0,0 +1,32 @@
1
+ import { Widget, WidgetKeyword } from '@widget-js/core';
2
+ //TODO 修改组件信息,标题,描述,关键词
3
+ const name = 'cn.test.widget.clock';
4
+ //组件标题
5
+ const title = { 'zh-CN': '时钟' };
6
+ //组件描述
7
+ const description = { 'zh-CN': 'Hello world!' };
8
+ //组件关键词
9
+ const keywords = [WidgetKeyword.RECOMMEND];
10
+ //组件路由地址
11
+ const path = '/widget/clock';
12
+ //配置页路由地址
13
+ const configPagePath = '/widget/config/clock';
14
+ //组件关键词
15
+ const ClockWidget = new Widget({
16
+ name: name,
17
+ title: title,
18
+ description: description,
19
+ keywords: keywords,
20
+ lang: 'zh-CN',
21
+ width: 2,
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;
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <widget-edit-dialog
3
+ :widget-params="widgetParams"
4
+ :option="widgetConfigOption"
5
+ v-model="widgetData"
6
+ @apply="save()"
7
+ @confirm="save({ closeWindow: true })"
8
+ >
9
+ <template #custom>
10
+ 标题 <input v-model="widgetData.title"/>
11
+ </template>
12
+ </widget-edit-dialog>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import {
17
+ useWidget,
18
+ WidgetConfigOption,
19
+ WidgetEditDialog,
20
+ } from '@widget-js/vue3';
21
+ import {BrowserWindowApi} from '@widget-js/core';
22
+ import {ClockModel} from "@/widgets/clock/model/ClockModel";
23
+
24
+ const {widgetData, widgetParams, save} = useWidget(ClockModel);
25
+ BrowserWindowApi.setup({width: 600, height: 400});
26
+ //修改成需要设置组件参数配置
27
+ const widgetConfigOption = new WidgetConfigOption({
28
+ title:'时钟设置',
29
+ theme: {
30
+ backgroundColor: true,
31
+ borderRadius: true,
32
+ }
33
+ });
34
+ </script>
35
+
36
+ <style scoped>
37
+
38
+ </style>
@@ -0,0 +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: 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;
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <widget-wrapper>
3
+ <div class="clock">
4
+ <span>{{ widgetData.title }}</span>
5
+ <span>{{ time }}</span>
6
+ </div>
7
+ </widget-wrapper>
8
+ </template>
9
+ <script lang="ts" setup>
10
+ import {useWidget} from '@widget-js/vue3';
11
+ import {ref} from "vue";
12
+ import {ClockModel} from "@/widgets/clock/model/ClockModel";
13
+
14
+ const {widgetData} = useWidget(ClockModel);
15
+
16
+ const time = ref(new Date().toLocaleTimeString())
17
+ setInterval(() => {
18
+ time.value = new Date().toLocaleTimeString()
19
+ }, 1000)
20
+ </script>
21
+
22
+ <style scoped>
23
+ .clock {
24
+ font-size: 16px;
25
+ font-weight: bold;
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ background-color: var(--widget-background-color);
30
+ border-radius: var(--widget-border-radius);
31
+ color: var(--widget-color);
32
+ justify-content: center;
33
+ }
34
+ </style>
@@ -0,0 +1,5 @@
1
+ import {WidgetData} from "@widget-js/core";
2
+
3
+ export class ClockModel extends WidgetData {
4
+ title: string = 'Hello world!';
5
+ }
@@ -0,0 +1,8 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import ClockWidgetRoutes from "./clock/ClockWidgetRoutes";
3
+ //FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
4
+ const WidgetRouter: RouteRecordRaw[] = [
5
+ ...ClockWidgetRoutes,
6
+ //FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
7
+ ];
8
+ export default WidgetRouter
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
+ "exclude": ["src/**/__tests__/*"],
5
+ "compilerOptions": {
6
+ "composite": true,
7
+ "noEmit": true,
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@/*": ["./src/*"]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.node.json"
6
+ },
7
+ {
8
+ "path": "./tsconfig.app.json"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "@tsconfig/node18/tsconfig.json",
3
+ "include": [
4
+ "vite.config.*",
5
+ "vitest.config.*",
6
+ "cypress.config.*",
7
+ "nightwatch.conf.*",
8
+ "playwright.config.*"
9
+ ],
10
+ "compilerOptions": {
11
+ "composite": true,
12
+ "noEmit": true,
13
+ "module": "ESNext",
14
+ "moduleResolution": "Bundler",
15
+ "types": ["node"]
16
+ }
17
+ }
@@ -0,0 +1,14 @@
1
+ import widget from '@widget-js/vite-plugin-widget';
2
+ import { fileURLToPath, URL } from 'node:url';
3
+
4
+ import { defineConfig } from 'vite';
5
+ import vue from '@vitejs/plugin-vue';
6
+ // https://vitejs.dev/config/
7
+ export default defineConfig({
8
+ plugins: [vue(), widget()],
9
+ resolve: {
10
+ alias: {
11
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
12
+ },
13
+ },
14
+ });
@@ -0,0 +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
+ });
@@ -0,0 +1,24 @@
1
+ import {expect, test} from "vitest";
2
+ import {minimatch} from "minimatch";
3
+ import path from "path";
4
+ import gradient from "gradient-string"
5
+
6
+ test('minimatch',()=>{
7
+ let fileName = path.basename('C:\\Users\\rtuge\\Desktop\\github\\widgetjs\\packages\\@widget-js\\cli\\template\\Widget.ejs');
8
+ expect(minimatch(fileName,'*.ejs')).toBeTruthy()
9
+ expect(minimatch(fileName,'*.ts')).toBeFalsy()
10
+ })
11
+
12
+
13
+ test('gradient brand',()=>{
14
+ console.log(gradient([
15
+ { color: '#42d392', pos: 0 },
16
+ { color: '#42d392', pos: 0.1 },
17
+ { color: '#647eff', pos: 1 }
18
+ ])('Widget.js - The Desktop Widget Framework'))
19
+ console.log(gradient([
20
+ {color: '#42d392', pos: 0},
21
+ {color: '#42d392', pos: 0.1},
22
+ {color: '#647eff', pos: 1}
23
+ ])('Widget.js - The Desktop Widget Framework'));
24
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@tsconfig/node18/tsconfig.json",
3
+ "include": [
4
+ "index.ts",
5
+ "utils/**/*"
6
+ ],
7
+ "compilerOptions": {
8
+ "strict": false,
9
+ "resolveJsonModule": true,
10
+ "moduleResolution": "Node16"
11
+ }
12
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ outDir: 'lib',
5
+ format: 'js'
6
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3
+ }
@@ -0,0 +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
+ ```
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +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>
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "hello-widget",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "run-p type-check \"build-only {@}\" --",
9
+ "preview": "vite preview",
10
+ "build-only": "vite build",
11
+ "type-check": "vue-tsc --build --force"
12
+ },
13
+ "dependencies": {
14
+ "vue": "^3.3.11",
15
+ "vue-router": "^4.2.5",
16
+ "@widget-js/core": "0.11.20",
17
+ "@widget-js/vue3": "0.11.21-rc.2"
18
+ },
19
+ "devDependencies": {
20
+ "@tsconfig/node18": "^18.2.2",
21
+ "@types/node": "^18.19.3",
22
+ "@vitejs/plugin-vue": "^4.5.2",
23
+ "@vue/tsconfig": "^0.5.0",
24
+ "npm-run-all2": "^6.1.1",
25
+ "typescript": "~5.3.0",
26
+ "vite": "^5.0.10",
27
+ "vue-tsc": "^1.8.25",
28
+ "@widget-js/vite-plugin-widget": "^1.2.8"
29
+ }
30
+ }
Binary file
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "cn.example.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": "Hello world!"
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": "/preview_clock.png",
44
+ "supportDeployMode": 17,
45
+ "configPagePath": "/widget/config/clock",
46
+ "routes": []
47
+ }
48
+ ],
49
+ "pages": []
50
+ }
@@ -0,0 +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>
@@ -0,0 +1,3 @@
1
+ body{
2
+ margin: 0;
3
+ }
@@ -0,0 +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')
@@ -0,0 +1,11 @@
1
+ import WidgetRouter from '../widgets/widget-router';
2
+ import {createRouter, createWebHashHistory} from 'vue-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;