create-widget 0.0.9 → 24.1.1-beta.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.
- package/index.cjs +7914 -7914
- package/package.json +9 -8
- package/template/env.d.ts +1 -1
- package/template/package.json +6 -6
- package/template/public/widget.json +1 -1
- package/template/src/App.vue +1 -1
- package/template/src/router/index.ts +4 -4
- package/template/src/widgets/clock/Clock.widget.ts +21 -20
- package/template/src/widgets/clock/ClockConfigView.vue +24 -24
- package/template/src/widgets/clock/ClockWidgetRoutes.ts +8 -8
- package/template/src/widgets/clock/ClockWidgetView.vue +13 -12
- package/template/src/widgets/clock/model/ClockModel.ts +2 -2
- package/template/src/widgets/widget-router.ts +6 -5
- package/template/tsconfig.app.json +5 -5
- package/template/tsconfig.json +2 -2
- package/template/tsconfig.node.json +8 -8
- package/template/vite.config.ts +6 -5
- package/template/widget.package.ts +3 -3
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-widget",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "24.1.1-beta.1",
|
|
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,9 +30,9 @@
|
|
|
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",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"ts-node": "^10.9.1",
|
|
41
41
|
"tsup": "^6.5.0",
|
|
42
42
|
"typescript": "^5.2.2",
|
|
43
|
-
"vitest": "^0.34.6"
|
|
43
|
+
"vitest": "^0.34.6",
|
|
44
|
+
"zx": "^7.2.3"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "zx ./scripts/build.mjs",
|
package/template/env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
// / <reference types="vite/client" />
|
package/template/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hello-widget",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"version": "0.0.0",
|
|
4
5
|
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "run-p type-check \"build-only {@}\" --",
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
"type-check": "vue-tsc --build --force"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@widget-js/core": "0.11.20",
|
|
14
15
|
"@widget-js/vite-plugin-widget": "^1.2.8",
|
|
16
|
+
"@widget-js/vue3": "0.11.21-rc.2",
|
|
15
17
|
"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"
|
|
18
|
+
"vue-router": "^4.2.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@tsconfig/node18": "^18.2.2",
|
|
22
22
|
"@types/node": "^18.19.3",
|
|
23
23
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
24
24
|
"@vue/tsconfig": "^0.5.0",
|
|
25
|
+
"@widget-js/vite-plugin-widget": "^1.2.8",
|
|
25
26
|
"npm-run-all2": "^6.1.1",
|
|
26
27
|
"typescript": "~5.3.0",
|
|
27
28
|
"vite": "^5.0.10",
|
|
28
|
-
"vue-tsc": "^1.8.25"
|
|
29
|
-
"@widget-js/vite-plugin-widget": "^1.2.8"
|
|
29
|
+
"vue-tsc": "^1.8.25"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/template/src/App.vue
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
2
|
+
import WidgetRouter from '../widgets/widget-router'
|
|
3
3
|
|
|
4
4
|
const router = createRouter({
|
|
5
5
|
history: createWebHashHistory(import.meta.env.BASE_URL),
|
|
6
6
|
routes: [
|
|
7
7
|
...WidgetRouter,
|
|
8
8
|
],
|
|
9
|
-
})
|
|
9
|
+
})
|
|
10
10
|
|
|
11
|
-
export default router
|
|
11
|
+
export default router
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { Widget, WidgetKeyword } from '@widget-js/core'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Widget, WidgetKeyword } from '@widget-js/core'
|
|
2
|
+
|
|
3
|
+
// TODO 修改组件信息,标题,描述,关键词
|
|
4
|
+
const name = 'cn.example.widget.clock'
|
|
5
|
+
// 组件标题
|
|
6
|
+
const title = { 'zh-CN': '时钟' }
|
|
7
|
+
// 组件描述
|
|
8
|
+
const description = { 'zh-CN': 'Hello world!' }
|
|
9
|
+
// 组件关键词
|
|
10
|
+
const keywords = [WidgetKeyword.RECOMMEND]
|
|
11
|
+
// 组件路由地址
|
|
12
|
+
const path = '/widget/clock'
|
|
13
|
+
// 配置页路由地址
|
|
14
|
+
const configPagePath = '/widget/config/clock'
|
|
15
|
+
// 组件关键词
|
|
15
16
|
const ClockWidget = new Widget({
|
|
16
|
-
name
|
|
17
|
-
title
|
|
18
|
-
description
|
|
19
|
-
keywords
|
|
17
|
+
name,
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
keywords,
|
|
20
21
|
lang: 'zh-CN',
|
|
21
22
|
width: 2,
|
|
22
23
|
height: 2,
|
|
@@ -27,6 +28,6 @@ const ClockWidget = new Widget({
|
|
|
27
28
|
previewImage: '/preview_clock.png',
|
|
28
29
|
path,
|
|
29
30
|
configPagePath,
|
|
30
|
-
})
|
|
31
|
+
})
|
|
31
32
|
|
|
32
|
-
export default ClockWidget
|
|
33
|
+
export default ClockWidget
|
|
@@ -1,38 +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
1
|
<script lang="ts" setup>
|
|
16
2
|
import {
|
|
17
|
-
useWidget,
|
|
18
3
|
WidgetConfigOption,
|
|
19
4
|
WidgetEditDialog,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import {
|
|
5
|
+
useWidget,
|
|
6
|
+
} from '@widget-js/vue3'
|
|
7
|
+
import { BrowserWindowApi } from '@widget-js/core'
|
|
8
|
+
import { ClockModel } from '@/widgets/clock/model/ClockModel'
|
|
23
9
|
|
|
24
|
-
const {widgetData, widgetParams, save} = useWidget(ClockModel)
|
|
25
|
-
BrowserWindowApi.setup({width: 600, height: 400})
|
|
26
|
-
|
|
10
|
+
const { widgetData, widgetParams, save } = useWidget(ClockModel)
|
|
11
|
+
BrowserWindowApi.setup({ width: 600, height: 400 })
|
|
12
|
+
// 修改成需要设置组件参数配置
|
|
27
13
|
const widgetConfigOption = new WidgetConfigOption({
|
|
28
|
-
title:'时钟设置',
|
|
14
|
+
title: '时钟设置',
|
|
29
15
|
theme: {
|
|
30
16
|
backgroundColor: true,
|
|
31
17
|
borderRadius: true,
|
|
32
|
-
}
|
|
33
|
-
})
|
|
18
|
+
},
|
|
19
|
+
})
|
|
34
20
|
</script>
|
|
35
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
36
|
<style scoped>
|
|
37
37
|
|
|
38
38
|
</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
-
import ClockWidget from './Clock.widget'
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
2
|
+
import ClockWidget from './Clock.widget'
|
|
3
3
|
|
|
4
|
-
const path = ClockWidget.path
|
|
5
|
-
const name = ClockWidget.name
|
|
4
|
+
const path = ClockWidget.path
|
|
5
|
+
const name = ClockWidget.name
|
|
6
6
|
|
|
7
|
-
const configPagePath = ClockWidget.configPagePath
|
|
7
|
+
const configPagePath = ClockWidget.configPagePath!
|
|
8
8
|
|
|
9
9
|
const ClockWidgetRoutes: RouteRecordRaw[] = [
|
|
10
10
|
{
|
|
11
|
-
path
|
|
11
|
+
path,
|
|
12
12
|
name: `${name}`,
|
|
13
13
|
component: () =>
|
|
14
14
|
import(
|
|
@@ -23,6 +23,6 @@ const ClockWidgetRoutes: RouteRecordRaw[] = [
|
|
|
23
23
|
/* webpackChunkName: "cn.test.widget.clock.config" */ './ClockConfigView.vue'
|
|
24
24
|
),
|
|
25
25
|
},
|
|
26
|
-
]
|
|
26
|
+
]
|
|
27
27
|
|
|
28
|
-
export default ClockWidgetRoutes
|
|
28
|
+
export default ClockWidgetRoutes
|
|
@@ -1,17 +1,9 @@
|
|
|
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
1
|
<script lang="ts" setup>
|
|
10
|
-
import {useWidget} from '@widget-js/vue3'
|
|
11
|
-
import {ref} from
|
|
12
|
-
import {ClockModel} from
|
|
2
|
+
import { useWidget } from '@widget-js/vue3'
|
|
3
|
+
import { ref } from 'vue'
|
|
4
|
+
import { ClockModel } from '@/widgets/clock/model/ClockModel'
|
|
13
5
|
|
|
14
|
-
const {widgetData} = useWidget(ClockModel)
|
|
6
|
+
const { widgetData } = useWidget(ClockModel)
|
|
15
7
|
|
|
16
8
|
const time = ref(new Date().toLocaleTimeString())
|
|
17
9
|
setInterval(() => {
|
|
@@ -19,6 +11,15 @@ setInterval(() => {
|
|
|
19
11
|
}, 1000)
|
|
20
12
|
</script>
|
|
21
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
|
+
|
|
22
23
|
<style scoped>
|
|
23
24
|
.clock {
|
|
24
25
|
font-size: 16px;
|
|
@@ -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
1
|
{
|
|
2
2
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
-
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
4
|
-
"exclude": ["src/**/__tests__/*"],
|
|
5
3
|
"compilerOptions": {
|
|
6
4
|
"composite": true,
|
|
7
|
-
"noEmit": true,
|
|
8
5
|
"baseUrl": ".",
|
|
9
6
|
"paths": {
|
|
10
7
|
"@/*": ["./src/*"]
|
|
11
|
-
}
|
|
12
|
-
|
|
8
|
+
},
|
|
9
|
+
"noEmit": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
12
|
+
"exclude": ["src/**/__tests__/*"]
|
|
13
13
|
}
|
package/template/tsconfig.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tsconfig/node18/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"noEmit": true
|
|
9
|
+
},
|
|
3
10
|
"include": [
|
|
4
11
|
"vite.config.*",
|
|
5
12
|
"vitest.config.*",
|
|
6
13
|
"cypress.config.*",
|
|
7
14
|
"nightwatch.conf.*",
|
|
8
15
|
"playwright.config.*"
|
|
9
|
-
]
|
|
10
|
-
"compilerOptions": {
|
|
11
|
-
"composite": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"module": "ESNext",
|
|
14
|
-
"moduleResolution": "Bundler",
|
|
15
|
-
"types": ["node"]
|
|
16
|
-
}
|
|
16
|
+
]
|
|
17
17
|
}
|
package/template/vite.config.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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'
|
|
3
6
|
|
|
4
|
-
import { defineConfig } from 'vite';
|
|
5
|
-
import vue from '@vitejs/plugin-vue';
|
|
6
7
|
// https://vitejs.dev/config/
|
|
7
8
|
export default defineConfig({
|
|
8
9
|
plugins: [vue(), widget()],
|
|
@@ -11,4 +12,4 @@ export default defineConfig({
|
|
|
11
12
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
|
-
})
|
|
15
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WidgetPackage } from '@widget-js/core'
|
|
1
|
+
import { WidgetPackage } from '@widget-js/core'
|
|
2
2
|
|
|
3
|
-
//TODO 完善组件包信息
|
|
3
|
+
// TODO 完善组件包信息
|
|
4
4
|
export default new WidgetPackage({
|
|
5
5
|
author: '修改成你的信息',
|
|
6
6
|
description: {
|
|
@@ -17,4 +17,4 @@ export default new WidgetPackage({
|
|
|
17
17
|
devOptions: {
|
|
18
18
|
folder: './src/widgets/',
|
|
19
19
|
},
|
|
20
|
-
})
|
|
20
|
+
})
|