create-widget 26.7.22 → 26.7.24

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/bin/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-widget",
3
- "version": "26.7.22",
3
+ "version": "26.7.24",
4
4
  "private": false,
5
5
  "description": "An easy way to start a Widget project",
6
6
  "author": "Neo Fu <rtugeek@gmail.com>",
@@ -20,12 +20,22 @@
20
20
  "engines": {
21
21
  "node": ">=v16.20.0"
22
22
  },
23
+ "scripts": {
24
+ "prebuild": "release --date-version",
25
+ "build": "tsup-node build src/index.ts",
26
+ "watch": "tsup-node src/index.ts --format cjs --watch",
27
+ "build:run": "npm run build && npm exec create-widget",
28
+ "test": "node index.cjs",
29
+ "update:version": "esno scripts/updateVersion.ts",
30
+ "pnpm:publish": "npm run build && pnpm publish --no-git-checks",
31
+ "link": "pnpm link --global",
32
+ "lint:fix": "eslint"
33
+ },
23
34
  "publishConfig": {
24
35
  "access": "public"
25
36
  },
26
37
  "dependencies": {
27
38
  "chalk": "^4.1.2",
28
- "create-widget": "link:",
29
39
  "fs-extra": "^11.2.0",
30
40
  "gradient-string": "^2.0.2",
31
41
  "minimist": "^1.2.8",
@@ -48,16 +58,5 @@
48
58
  "tsup": "^8.3.5",
49
59
  "typescript": "^5.2.2",
50
60
  "vitest": "^0.34.6"
51
- },
52
- "scripts": {
53
- "prebuild": "release --date-version",
54
- "build": "tsup-node build src/index.ts",
55
- "watch": "tsup-node src/index.ts --format cjs --watch",
56
- "build:run": "npm run build && npm exec create-widget",
57
- "test": "node index.cjs",
58
- "update:version": "esno scripts/updateVersion.ts",
59
- "pnpm:publish": "npm run build && pnpm publish --no-git-checks",
60
- "link": "pnpm link --global",
61
- "lint:fix": "eslint"
62
61
  }
63
- }
62
+ }
@@ -1,42 +1,42 @@
1
- {
2
- "name": "hello-widget",
3
- "type": "module",
4
- "version": "0.1.0",
5
- "private": true,
6
- "scripts": {
7
- "dev": "vite",
8
- "preview": "vite preview",
9
- "build": "vite build",
10
- "build:offline": "vite build --mode offline",
11
- "update:widgetjs": "widget dependencies -t remote"
12
- },
13
- "dependencies": {
14
- "@fontsource-variable/geist": "^5.3.0",
15
- "@widget-js/core": "latest",
16
- "@widget-js/react": "latest",
17
- "class-variance-authority": "^0.7.1",
18
- "clsx": "^2.1.1",
19
- "lucide-react": "^1.25.0",
20
- "radix-ui": "^1.6.3",
21
- "react": "^19.2.0",
22
- "react-dom": "^19.2.0",
23
- "react-router-dom": "^7.9.1",
24
- "shadcn": "^4.13.1",
25
- "styled-components": "^6.4.4",
26
- "tailwind-merge": "^3.6.0",
27
- "tw-animate-css": "^1.4.0",
28
- "zustand": "^5.0.14"
29
- },
30
- "devDependencies": {
31
- "@tailwindcss/vite": "^4.3.3",
32
- "@types/node": "latest",
33
- "@types/react": "^19.2.7",
34
- "@types/react-dom": "^19.2.3",
35
- "@vitejs/plugin-react": "^5.1.1",
36
- "@widget-js/cli": "latest",
37
- "@widget-js/vite-plugin-widget": "latest",
38
- "tailwindcss": "^4.3.3",
39
- "typescript": "latest",
40
- "vite": "latest"
41
- }
42
- }
1
+ {
2
+ "name": "hello-widget",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "preview": "vite preview",
9
+ "build": "vite build",
10
+ "build:offline": "vite build --mode offline",
11
+ "update:widgetjs": "widget dependencies -t remote"
12
+ },
13
+ "dependencies": {
14
+ "@fontsource-variable/geist": "^5.3.0",
15
+ "@widget-js/core": "^26.7.24",
16
+ "@widget-js/react": "^26.7.23",
17
+ "class-variance-authority": "^0.7.1",
18
+ "clsx": "^2.1.1",
19
+ "lucide-react": "^1.25.0",
20
+ "radix-ui": "^1.6.3",
21
+ "react": "^19.2.0",
22
+ "react-dom": "^19.2.0",
23
+ "react-router-dom": "^7.9.1",
24
+ "shadcn": "^4.13.1",
25
+ "styled-components": "^6.4.4",
26
+ "tailwind-merge": "^3.6.0",
27
+ "tw-animate-css": "^1.4.0",
28
+ "zustand": "^5.0.14"
29
+ },
30
+ "devDependencies": {
31
+ "@tailwindcss/vite": "^4.3.3",
32
+ "@types/node": "latest",
33
+ "@types/react": "^19.2.7",
34
+ "@types/react-dom": "^19.2.3",
35
+ "@vitejs/plugin-react": "^5.1.1",
36
+ "@widget-js/cli": "^26.7.22",
37
+ "@widget-js/vite-plugin-widget": "^26.7.25",
38
+ "tailwindcss": "^4.3.3",
39
+ "typescript": "latest",
40
+ "vite": "latest"
41
+ }
42
+ }
@@ -47,8 +47,16 @@
47
47
  "backgroundThrottling": true,
48
48
  "previewImage": "/preview_clock.png",
49
49
  "supportDeployMode": 17,
50
- "configPagePath": "/widget/config/clock?frame=true&transparent=false&width=600&height=700",
51
- "routes": []
50
+ "configPage": {
51
+ "path": "/widget/config/clock",
52
+ "frame": true,
53
+ "transparent": false,
54
+ "width": 700,
55
+ "height": 800,
56
+ "resizable": true,
57
+ "maximizable": true,
58
+ "alwaysOnTop": false
59
+ }
52
60
  }
53
61
  ],
54
62
  "pages": []
@@ -57,34 +57,6 @@ body {
57
57
  color: #f4f7fb;
58
58
  }
59
59
 
60
- button,
61
- input {
62
- font: inherit;
63
- }
64
-
65
- code {
66
- padding: 0.12rem 0.35rem;
67
- border: 1px solid rgba(255, 255, 255, 0.1);
68
- border-radius: 999px;
69
- background: rgba(255, 255, 255, 0.08);
70
- }
71
-
72
- a {
73
- color: inherit;
74
- text-decoration: none;
75
- }
76
-
77
- .toggle {
78
- display: flex;
79
- align-items: center;
80
- gap: 12px;
81
- }
82
-
83
- .toggle input {
84
- width: 18px;
85
- height: 18px;
86
- }
87
-
88
60
  .config-preview {
89
61
  display: grid;
90
62
  place-items: center;
@@ -1,5 +1,5 @@
1
1
  import type { WidgetThemeOption } from '@widget-js/react'
2
- import { useWidget, useWidgetStorage, useWidgetTheme, WidgetThemeForm, Window } from '@widget-js/react'
2
+ import { useWidgetStorage, useWidgetTheme, WidgetThemeForm, Window } from '@widget-js/react'
3
3
  import { Button } from '@/components/ui/button'
4
4
  import {
5
5
  Field,
@@ -21,7 +21,6 @@ const clockThemeOption: WidgetThemeOption = {
21
21
  } as const
22
22
 
23
23
  export default function ClockConfigView() {
24
- const { save } = useWidget()
25
24
  const { widgetTheme, setWidgetTheme } = useWidgetTheme()
26
25
  const [title, setTitle] = useWidgetStorage('title', 'Clock')
27
26
  const [use24Hour, setUse24Hour] = useWidgetStorage('use-24-hour', true)
@@ -32,10 +31,10 @@ export default function ClockConfigView() {
32
31
  title={title}
33
32
  footer={(
34
33
  <div className="flex flex-wrap justify-end gap-3">
35
- <Button type="button" variant="outline" onClick={() => save()}>
34
+ <Button type="button" variant="outline" onClick={() => window.close()}>
36
35
  应用
37
36
  </Button>
38
- <Button type="button" onClick={() => save({ closeWindow: true })}>
37
+ <Button type="button" onClick={() => window.close()}>
39
38
  保存并关闭
40
39
  </Button>
41
40
  </div>
@@ -1,13 +1,13 @@
1
1
  import type { RouteObject } from 'react-router-dom'
2
2
  import { createElement } from 'react'
3
- import ClockWidget from './Clock.widget'
4
- import ClockConfigView from './ClockConfigView'
5
- import ClockWidgetView from './ClockWidgetView'
3
+ import ClockConfigView from './clock-config-view'
4
+ import ClockWidgetView from './clock-widget-view'
5
+ import ClockWidget from './clock.widget'
6
6
 
7
7
  const path = ClockWidget.path
8
8
  const name = ClockWidget.name
9
9
 
10
- const configPagePath = ClockWidget.configPagePath!.split('?')[0]!
10
+ const configPagePath = ClockWidget.configPage!.path
11
11
 
12
12
  const ClockWidgetRoutes: RouteObject[] = [
13
13
  {
@@ -15,7 +15,16 @@ const ClockWidget = new Widget({
15
15
  maxHeight: 6,
16
16
  previewImage: '/preview_clock.png',
17
17
  path: '/widget/clock',
18
- configPagePath: '/widget/config/clock?frame=true&transparent=false&width=700&height=800',
18
+ configPage: {
19
+ path: '/widget/config/clock',
20
+ frame: true,
21
+ transparent: false,
22
+ width: 700,
23
+ height: 800,
24
+ resizable: true,
25
+ maximizable: true,
26
+ alwaysOnTop: false,
27
+ },
19
28
  })
20
29
 
21
30
  export default ClockWidget
@@ -1,11 +1,11 @@
1
- import type { RouteObject } from 'react-router-dom'
2
- import ClockWidget from './clock/Clock.widget'
3
- import ClockWidgetRoutes from './clock/ClockWidgetRoutes'
4
-
5
- export const widgets = [
6
- ClockWidget,
7
- ]
8
-
9
- export const widgetRoutes: RouteObject[] = [
10
- ...ClockWidgetRoutes,
11
- ]
1
+ import type { RouteObject } from 'react-router-dom'
2
+ import ClockWidgetRoutes from './clock/clock-widget-routes'
3
+ import ClockWidget from './clock/clock.widget'
4
+
5
+ export const widgets = [
6
+ ClockWidget,
7
+ ]
8
+
9
+ export const widgetRoutes: RouteObject[] = [
10
+ ...ClockWidgetRoutes,
11
+ ]
@@ -6,6 +6,7 @@ export default new WidgetPackage({
6
6
  description: {
7
7
  'zh-CN': '修改成你的组件描述',
8
8
  },
9
+ requiredAppVersion: '26.7.22',
9
10
  entry: '/',
10
11
  hash: true,
11
12
  remote: {