create-widget 24.1.1-beta.9 → 26.7.22
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/bin/index.js +216 -0
- package/eslint/eslint.config.js +12 -0
- package/package.json +24 -15
- package/readme.md +80 -0
- package/template/react/README.md +41 -0
- package/template/react/components.json +25 -0
- package/template/react/env.d.ts +1 -0
- package/template/react/index.html +13 -0
- package/template/react/package.json +42 -0
- package/template/react/public/apple-touch-icon.png +0 -0
- package/template/react/public/favicon-96x96.png +0 -0
- package/template/react/public/favicon.ico +0 -0
- package/template/react/public/favicon.svg +3 -0
- package/template/react/public/logo.png +0 -0
- package/template/react/public/site.webmanifest +21 -0
- package/template/react/public/web-app-manifest-192x192.png +0 -0
- package/template/react/public/web-app-manifest-512x512.png +0 -0
- package/template/{public → react/public}/widget.json +55 -50
- package/template/react/src/App.tsx +17 -0
- package/template/react/src/assets/main.css +221 -0
- package/template/react/src/components/ui/button.tsx +67 -0
- package/template/react/src/components/ui/card.tsx +103 -0
- package/template/react/src/components/ui/color-picker.tsx +171 -0
- package/template/react/src/components/ui/field.tsx +238 -0
- package/template/react/src/components/ui/input.tsx +19 -0
- package/template/react/src/components/ui/label.tsx +22 -0
- package/template/react/src/components/ui/separator.tsx +28 -0
- package/template/react/src/components/ui/slider.tsx +57 -0
- package/template/react/src/components/ui/switch.tsx +31 -0
- package/template/react/src/components/ui/tabs.tsx +88 -0
- package/template/react/src/lib/utils.ts +7 -0
- package/template/react/src/main.tsx +20 -0
- package/template/react/src/pages/home-page.tsx +66 -0
- package/template/react/src/widgets/clock/Clock.widget.ts +21 -0
- package/template/react/src/widgets/clock/ClockConfigView.tsx +112 -0
- package/template/react/src/widgets/clock/ClockWidgetRoutes.ts +25 -0
- package/template/react/src/widgets/clock/ClockWidgetView.tsx +104 -0
- package/template/react/src/widgets/widget-router.ts +11 -0
- package/template/react/tsconfig.app.json +26 -0
- package/template/react/tsconfig.json +17 -0
- package/template/react/tsconfig.node.json +23 -0
- package/template/react/vite.config.ts +27 -0
- package/template/{widget.package.ts → react/widget.package.ts} +5 -1
- package/template/{.vscode → vue/.vscode}/extensions.json +3 -3
- package/template/vue/README.md +34 -0
- package/template/{env.d.ts → vue/env.d.ts} +1 -1
- package/template/{index.html → vue/index.html} +13 -13
- package/template/vue/package.json +34 -0
- package/template/vue/public/apple-touch-icon.png +0 -0
- package/template/vue/public/favicon-96x96.png +0 -0
- package/template/vue/public/favicon.ico +0 -0
- package/template/vue/public/favicon.svg +3 -0
- package/template/vue/public/logo.png +0 -0
- package/template/vue/public/preview_clock.png +0 -0
- package/template/vue/public/site.webmanifest +21 -0
- package/template/vue/public/web-app-manifest-192x192.png +0 -0
- package/template/vue/public/web-app-manifest-512x512.png +0 -0
- package/template/{src → vue/src}/App.vue +9 -9
- package/template/vue/src/Home.vue +10 -0
- package/template/{src → vue/src}/main.ts +13 -12
- package/template/{src → vue/src}/router/index.ts +4 -0
- package/template/{src → vue/src}/widgets/clock/Clock.widget.ts +21 -21
- package/template/{src → vue/src}/widgets/clock/ClockConfigView.vue +37 -38
- package/template/{src → vue/src}/widgets/clock/ClockWidgetRoutes.ts +28 -28
- package/template/{src → vue/src}/widgets/clock/ClockWidgetView.vue +38 -35
- package/template/{src → vue/src}/widgets/widget-router.ts +3 -3
- package/template/{tsconfig.app.json → vue/tsconfig.app.json} +13 -13
- package/template/{tsconfig.json → vue/tsconfig.json} +11 -11
- package/template/{tsconfig.node.json → vue/tsconfig.node.json} +17 -17
- package/template/vue/vite.config.ts +29 -0
- package/template/vue/widget.package.ts +24 -0
- package/unocss/src/main.ts +13 -0
- package/unocss/uno.config.ts +5 -0
- package/unocss/vite.config.ts +31 -0
- package/index.cjs +0 -7913
- package/template/README.md +0 -40
- package/template/package.json +0 -29
- package/template/public/favicon.ico +0 -0
- package/template/src/widgets/clock/model/ClockModel.ts +0 -5
- package/template/vite.config.ts +0 -15
- /package/template/{public → react/public}/preview_clock.png +0 -0
- /package/template/{src → vue/src}/assets/main.css +0 -0
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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>{{
|
|
18
|
-
<span>{{ time }}</span>
|
|
19
|
-
</div>
|
|
20
|
-
</widget-wrapper>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<style scoped>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useStorage } from '@vueuse/core'
|
|
3
|
+
import { useWidget } from '@widget-js/vue3'
|
|
4
|
+
import { ref } from 'vue'
|
|
5
|
+
|
|
6
|
+
useWidget({})
|
|
7
|
+
const title = useStorage('title', 'Clock')
|
|
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>{{ title }}</span>
|
|
18
|
+
<span>{{ time }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</widget-wrapper>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
*{
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
.clock {
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
display: flex;
|
|
31
|
+
height: 100%;
|
|
32
|
+
gap: 0.5rem;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: center;
|
|
35
|
+
color: var(--widget-color);
|
|
36
|
+
justify-content: center;
|
|
37
|
+
}
|
|
38
|
+
</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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import widget from '@widget-js/vite-plugin-widget'
|
|
4
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
5
|
+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
6
|
+
import Components from 'unplugin-vue-components/vite'
|
|
7
|
+
import { defineConfig } from 'vite'
|
|
8
|
+
|
|
9
|
+
export default defineConfig((config) => {
|
|
10
|
+
const offlineMode = config.mode === 'offline'
|
|
11
|
+
const base = offlineMode ? './' : '/clock'
|
|
12
|
+
return {
|
|
13
|
+
base,
|
|
14
|
+
plugins: [
|
|
15
|
+
vue(),
|
|
16
|
+
widget({
|
|
17
|
+
zipName: 'test-widget',
|
|
18
|
+
generateZip: offlineMode,
|
|
19
|
+
}),
|
|
20
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
21
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
22
|
+
],
|
|
23
|
+
resolve: {
|
|
24
|
+
alias: {
|
|
25
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
remote: {
|
|
12
|
+
base: '/',
|
|
13
|
+
hostname: '修改成你的域名',
|
|
14
|
+
hash: true,
|
|
15
|
+
},
|
|
16
|
+
homepage: '',
|
|
17
|
+
name: 'cn.example.widget',
|
|
18
|
+
title: {
|
|
19
|
+
'zh-CN': '修改成你的组件标题',
|
|
20
|
+
},
|
|
21
|
+
devOptions: {
|
|
22
|
+
folder: './src/widgets/',
|
|
23
|
+
},
|
|
24
|
+
})
|
|
@@ -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,31 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import widget from '@widget-js/vite-plugin-widget'
|
|
4
|
+
import UnoCSS from 'unocss/vite'
|
|
5
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
6
|
+
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
7
|
+
import Components from 'unplugin-vue-components/vite'
|
|
8
|
+
import { defineConfig } from 'vite'
|
|
9
|
+
|
|
10
|
+
export default defineConfig((config) => {
|
|
11
|
+
const offlineMode = config.mode === 'offline'
|
|
12
|
+
const base = offlineMode ? './' : '/clock'
|
|
13
|
+
return {
|
|
14
|
+
base,
|
|
15
|
+
plugins: [
|
|
16
|
+
vue(),
|
|
17
|
+
UnoCSS(),
|
|
18
|
+
widget({
|
|
19
|
+
zipName: 'test-widget',
|
|
20
|
+
generateZip: offlineMode,
|
|
21
|
+
}),
|
|
22
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
23
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
24
|
+
],
|
|
25
|
+
resolve: {
|
|
26
|
+
alias: {
|
|
27
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
})
|