create-widget 0.0.1 → 0.0.3
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/package.json +6 -2
- package/.editorconfig +0 -13
- package/.idea/create-widget.iml +0 -9
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jpa-buddy.xml +0 -6
- package/.idea/misc.xml +0 -8
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/src/index.ts +0 -144
- package/src/utils/FileUtils.ts +0 -33
- package/src/utils/deepMerge.ts +0 -26
- package/src/utils/directoryTraverse.ts +0 -35
- package/src/utils/getCommand.ts +0 -13
- package/src/utils/renderTemplate.ts +0 -88
- package/src/utils/sortDependencies.ts +0 -22
- package/test/index.test.ts +0 -24
- package/tsconfig.json +0 -12
- package/tsup.config.ts +0 -6
- package/widget-test/.vscode/extensions.json +0 -3
- package/widget-test/README.md +0 -40
- package/widget-test/env.d.ts +0 -1
- package/widget-test/index.html +0 -13
- package/widget-test/package.json +0 -30
- package/widget-test/public/favicon.ico +0 -0
- package/widget-test/public/preview_clock.png +0 -0
- package/widget-test/public/widget.json +0 -50
- package/widget-test/src/App.vue +0 -9
- package/widget-test/src/assets/main.css +0 -3
- package/widget-test/src/main.ts +0 -12
- package/widget-test/src/router/index.ts +0 -11
- package/widget-test/src/widgets/clock/Clock.widget.ts +0 -32
- package/widget-test/src/widgets/clock/ClockConfigView.vue +0 -38
- package/widget-test/src/widgets/clock/ClockWidgetRoutes.ts +0 -28
- package/widget-test/src/widgets/clock/ClockWidgetView.vue +0 -34
- package/widget-test/src/widgets/clock/model/ClockModel.ts +0 -5
- package/widget-test/src/widgets/widget-router.ts +0 -8
- package/widget-test/tsconfig.app.json +0 -13
- package/widget-test/tsconfig.json +0 -11
- package/widget-test/tsconfig.node.json +0 -17
- package/widget-test/vite.config.ts +0 -14
- package/widget-test/widget.package.ts +0 -20
- package/widget-test/yarn.lock +0 -1399
package/widget-test/src/main.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,38 +0,0 @@
|
|
|
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>
|
|
@@ -1,28 +0,0 @@
|
|
|
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;
|
|
@@ -1,34 +0,0 @@
|
|
|
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>
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
});
|