Skip to content

Commit 125c4d7

Browse files
committed
更新依赖
1 parent 6ea1fd7 commit 125c4d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1428
-203
lines changed

.storybook/main.js

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ module.exports = {
1818
use: ['style-loader', 'css-loader', 'sass-loader'],
1919
include: path.resolve(__dirname, '../'),
2020
});
21+
config.module.rules.push( {
22+
test: /\.txt$/i,
23+
use: 'raw-loader',
24+
});
2125
config.resolve.plugins = [
2226
...(config.resolve.plugins || []),
2327
new TsconfigPathsPlugin({

.storybook/preview.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import {MINIMAL_VIEWPORTS} from '@storybook/addon-viewport';
2-
2+
import {app} from '@storybook/vue3';
33
import 'animate.css'
44
import '@widget-js/vue3/dist/mingcute_icon/font/Mingcute.css';
5+
import 'element-plus/dist/index.css'
6+
7+
import ElementPlus from 'element-plus'
8+
import {createPinia} from "pinia";
9+
import '../src/common/dayjs-extend';
510

11+
app.use(ElementPlus).use(createPinia());
612
const customViewports = {
713
widget1x1: {
814
name: '组件1x1',

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pnpm storybook
5454

5555
### 创建自己的组件
5656
```shell
57-
pnpm widget
57+
pnpm widget create
5858
```
5959

6060
### 组件列表

components.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ export {}
77

88
declare module '@vue/runtime-core' {
99
export interface GlobalComponents {
10+
ElButton: typeof import('element-plus/es')['ElButton']
11+
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
12+
ElForm: typeof import('element-plus/es')['ElForm']
13+
ElFormItem: typeof import('element-plus/es')['ElFormItem']
14+
ElInput: typeof import('element-plus/es')['ElInput']
15+
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
16+
ElRadio: typeof import('element-plus/es')['ElRadio']
17+
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
18+
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
19+
ElTable: typeof import('element-plus/es')['ElTable']
20+
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
1021
RouterLink: typeof import('vue-router')['RouterLink']
1122
RouterView: typeof import('vue-router')['RouterView']
1223
}

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"dependencies": {
2929
"@vueuse/core": "^9.4.0",
3030
"@vueuse/integrations": "^9.6.0",
31-
"@widget-js/core": "^0.1.14",
31+
"@widget-js/core": "^0.1.15",
3232
"@widget-js/vue3": "^0.0.11",
3333
"animate.css": "^4.1.1",
3434
"axios": "^1.1.3",
@@ -40,6 +40,8 @@
4040
"element-plus": "^2.2.26",
4141
"lodash": "^4.17.21",
4242
"lunar-typescript": "^1.2.23",
43+
"lyric-resolver": "^0.1.6",
44+
"pinia": "^2.0.23",
4345
"vue": "^3.2.30",
4446
"vue-i18n": "^9.2.2",
4547
"vue-router": "^4.0.3"
@@ -70,7 +72,8 @@
7072
"@vue/cli-service": "~5.0.0",
7173
"@vue/compiler-sfc": "^3.2.45",
7274
"@vue/eslint-config-typescript": "^9.1.0",
73-
"@widget-js/cli": "^1.0.4",
75+
"@widget-js/cli": "^1.0.5",
76+
"@widget-js/webpack-plugin": "^1.0.1",
7477
"archiver": "^5.3.1",
7578
"babel-loader": "^8.3.0",
7679
"css-loader": "^6.7.2",

public/audio/hangup.m4a

4.86 KB
Binary file not shown.

public/audio/ringtone.m4a

42.6 KB
Binary file not shown.

public/audio/voice_squidward.m4a

603 KB
Binary file not shown.

script/registerWidgetPackage.js

-22
This file was deleted.

script/requireWidgets.js

-33
This file was deleted.

script/widget.ts

-14
This file was deleted.

script/widgetPackage.js

-6
This file was deleted.

script/widgetWebpackPlugin.js

-40
This file was deleted.

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'animate.css';
55
import {WidgetJsPlugin} from "@widget-js/vue3";
66
import '@widget-js/vue3/dist/style.css'
77
import '@widget-js/vue3/dist/mingcute_icon/font/Mingcute.css'
8+
import {createPinia} from "pinia";
89

9-
createApp(App).use(WidgetJsPlugin).use(router).mount('#app')
10+
createApp(App).use(WidgetJsPlugin).use(router).use(createPinia()).mount('#app')
1011

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {Widget, WidgetKeyword} from "@widget-js/core";
2+
//TODO 修改组件信息,标题,描述,关键词
3+
const name = "cn.widgetjs.widgets.dynamic_island";
4+
//组件标题
5+
const title = {"zh": "灵动岛"};
6+
//组件描述
7+
const description = {"zh": ""};
8+
//组件关键词
9+
const keywords = [WidgetKeyword.RECOMMEND];
10+
//组件路由地址
11+
const url = "/widget/dynamic_island";
12+
//配置页路由地址
13+
const configUrl = "/widget/config/dynamic_island";
14+
//组件关键词
15+
const DynamicIslandWidgetDefine = new Widget({
16+
name: name,
17+
title: title,
18+
description: description,
19+
keywords: keywords,
20+
lang: "zh",
21+
url: url,
22+
configUrl: configUrl,
23+
width: 4,
24+
height: 4,
25+
minWidth: 4,
26+
maxWidth: 4,
27+
minHeight: 4,
28+
maxHeight: 4
29+
})
30+
31+
export default DynamicIslandWidgetDefine;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<template>
2+
3+
<widget-edit-dialog :widget-params="widgetParams" :option="widgetConfigOption"
4+
:widget-data="widgetData"
5+
@confirm="onSaveClick()">
6+
<template v-slot:widget>
7+
<!-- 组件配置内容 -->
8+
<dynamic-island-widget :style="{
9+
width:`${widgetParams.widthPx}px`,
10+
height:`${widgetParams.heightPx}px`
11+
}" :background-color="widgetData.backgroundColor"></dynamic-island-widget>
12+
</template>
13+
<template v-slot:form>
14+
<!-- TODO 这里写自定义表单内容 -->
15+
</template>
16+
</widget-edit-dialog>
17+
</template>
18+
19+
<script lang="ts">
20+
21+
import DynamicIslandWidget from "./DynamicIslandWidget.vue";
22+
import {useWidget, WidgetConfigOption, WidgetEditDialog} from "@widget-js/vue3";
23+
import {WidgetData, WidgetDataRepository} from "@widget-js/core";
24+
import {reactive} from "vue";
25+
26+
export default {
27+
name: "",
28+
components: {DynamicIslandWidget, WidgetEditDialog},
29+
setup() {
30+
const {widgetData, widgetParams} = useWidget(WidgetData)
31+
32+
//修改成需要设置组件参数配置
33+
const widgetConfigOption = reactive(new WidgetConfigOption({
34+
custom: true,
35+
backgroundColor: true,
36+
borderRadius: true
37+
}));
38+
39+
return {widgetData, widgetParams, widgetConfigOption}
40+
},
41+
methods: {
42+
async onSaveClick() {
43+
await WidgetDataRepository.save(this.widgetData);
44+
window.close();
45+
}
46+
}
47+
}
48+
</script>
49+
50+
<style scoped>
51+
52+
</style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import DynamicIslandWidget from './DynamicIslandWidget.vue';
2+
import dayjs from "dayjs";
3+
4+
export default {
5+
title: 'Widget/DynamicIsland',
6+
component: DynamicIslandWidget,
7+
argTypes: {
8+
size: {control: 'select', options: ['small', 'default', 'large']},
9+
targetTime: {control: 'date'},
10+
type: {
11+
control: 'select',
12+
options: ['call', 'countdown', 'advance-countdown', 'error', 'success', 'warning', 'info'],
13+
}
14+
},
15+
};
16+
17+
const Template = (args: any) => ({
18+
components: {DynamicIslandWidget},
19+
setup() {
20+
return {args};
21+
},
22+
template: '<dynamic-island-widget v-bind="args"></dynamic-island-widget>',
23+
});
24+
25+
export const MessageError = Template.bind({})
26+
// @ts-ignore
27+
MessageError.args = {
28+
show: true,
29+
type: 'error',
30+
size: 'small',
31+
message: "错误信息"
32+
}
33+
export const MessageInfo = Template.bind({})
34+
// @ts-ignore
35+
MessageInfo.args = {
36+
show: true,
37+
type: 'info',
38+
size: 'small',
39+
message: "Hello World"
40+
}
41+
export const MessageSuccess = Template.bind({})
42+
// @ts-ignore
43+
MessageSuccess.args = {
44+
show: true,
45+
type: 'success',
46+
size: 'small',
47+
message: "Hello World"
48+
}
49+
50+
export const MessageWarning = Template.bind({})
51+
// @ts-ignore
52+
MessageWarning.args = {
53+
show: true,
54+
type: 'warning',
55+
size: 'small',
56+
message: "警告信息"
57+
}
58+
59+
export const Countdown = Template.bind({})
60+
const date = dayjs('2023-01-01');
61+
62+
// @ts-ignore
63+
Countdown.args = {
64+
show: true,
65+
type: 'countdown',
66+
size: 'small',
67+
message: '新年倒计时',
68+
targetTime: date.toISOString(),
69+
}
70+
71+
export const CountdownAdvance = Template.bind({})
72+
// @ts-ignore
73+
CountdownAdvance.args = {
74+
show: true,
75+
type: 'advance-countdown',
76+
size: 'default',
77+
message: '恭喜发财',
78+
title: '新年倒计时',
79+
targetTime: date.toISOString(),
80+
}
81+
82+
export const Call = Template.bind({})
83+
// @ts-ignore
84+
Call.args = {
85+
show: true,
86+
type: 'call',
87+
size: 'default',
88+
message: '下班提醒',
89+
title: '章鱼哥',
90+
}
91+
92+
93+
export const Alert = Template.bind({})
94+
// @ts-ignore
95+
Alert.args = {
96+
show: true,
97+
type: 'alert',
98+
size: 'large',
99+
message: '您已经连续使用电脑45分钟',
100+
title: '久坐提醒',
101+
}

0 commit comments

Comments
 (0)