@synopackageland/ui 0.9.5 → 0.9.7
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/CHANGELOG.md +44 -0
- package/README.md +28 -1
- package/dist/components/composite/data-table/DataTable.vue.d.ts +2 -2
- package/dist/components/composite/form/Form.vue.d.ts +1 -1
- package/dist/components/composite/form-actions/FormActions.vue.d.ts +1 -1
- package/dist/components/composite/scroll-edges/ScrollEdges.vue.d.ts +18 -0
- package/dist/components/composite/table-cell/CellText.vue.d.ts +13 -3
- package/dist/components/containers/card-grid/CardGrid.vue.d.ts +2 -1
- package/dist/components/containers/card-grid/cardGrid.d.ts +12 -0
- package/dist/components/primitives/input-group/InputGroup.vue.d.ts +13 -0
- package/dist/components/primitives/space/Space.vue.d.ts +4 -1
- package/dist/components/primitives/space/space.d.ts +1 -0
- package/dist/composables/scrollEdges.d.ts +8 -0
- package/dist/composables/stickyRoom.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4583 -4437
- package/dist/json/catalog.d.ts +84 -0
- package/dist/json/registry.d.ts +3355 -39
- package/dist/json-ai-prompt.md +5 -1
- package/dist/json-catalog.schema.json +260 -0
- package/dist/json-preview/preview.js +5321 -5037
- package/dist/json.js +449 -412
- package/dist/lib/floatingDialog.d.ts +7 -0
- package/dist/reka-runtime.json +1 -1
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/docs/layout-rules.md +7 -1
- package/package.json +63 -1
package/dist/json.js
CHANGED
|
@@ -1,326 +1,359 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
import { z as
|
|
1
|
+
import { z as t } from "zod";
|
|
2
|
+
import { z as vt } from "zod";
|
|
3
3
|
import { defineCatalog as z } from "@json-render/core";
|
|
4
|
-
import { createStateStore as
|
|
4
|
+
import { createStateStore as St, defineCatalog as jt } from "@json-render/core";
|
|
5
5
|
import { defineRegistry as B, useBoundProp as b, JSONUIProvider as M, Renderer as W } from "@json-render/vue";
|
|
6
|
-
import { ActionProvider as
|
|
6
|
+
import { ActionProvider as Ot, JSONUIProvider as At, Renderer as Pt, StateProvider as kt, ValidationProvider as Ct, VisibilityProvider as It, defineRegistry as Rt, useActions as Kt, useBoundProp as Lt, useStateStore as Ut } from "@json-render/vue";
|
|
7
7
|
import { schema as H } from "@json-render/vue/schema";
|
|
8
|
-
import { schema as
|
|
8
|
+
import { schema as Tt } from "@json-render/vue/schema";
|
|
9
9
|
import { h as d, defineComponent as G, openBlock as X, createBlock as Y, unref as j, withCtx as Q, createVNode as Z } from "vue";
|
|
10
|
-
import { LoadingArea as ee, DataTable as
|
|
11
|
-
const
|
|
12
|
-
key:
|
|
13
|
-
label:
|
|
14
|
-
icon:
|
|
15
|
-
badge:
|
|
16
|
-
disabled:
|
|
17
|
-
selectable:
|
|
18
|
-
children:
|
|
19
|
-
})), k =
|
|
20
|
-
label:
|
|
21
|
-
value:
|
|
22
|
-
disabled:
|
|
23
|
-
}),
|
|
24
|
-
description:
|
|
25
|
-
}),
|
|
26
|
-
key:
|
|
27
|
-
label:
|
|
28
|
-
width:
|
|
29
|
-
align:
|
|
30
|
-
}),
|
|
10
|
+
import { LoadingArea as ee, InputGroup as te, ListItem as oe, CellStatus as ne, CellText as ie, DataTable as K, Dialog as se, Badge as ae, Progress as re, EmptyState as le, Callout as ce, Card as de, Surface as pe, SettingsRow as ue, SettingsSection as me, FormItem as he, Form as fe, RadioGroup as ge, Switch as be, Checkbox as ye, Select as we, Input as ve, Button as $e, SectionTabs as Se, AppSidebar as je, AppToolbar as xe, PageHeader as Oe, PageContent as Ae, ResponsiveView as Pe, AppLayout as ke, AppRoot as Ce, getRegisteredIcon as Ie } from "./index.js";
|
|
11
|
+
const J = t.lazy(() => t.object({
|
|
12
|
+
key: t.string(),
|
|
13
|
+
label: t.string(),
|
|
14
|
+
icon: t.string().optional(),
|
|
15
|
+
badge: t.union([t.string(), t.number()]).optional(),
|
|
16
|
+
disabled: t.boolean().optional(),
|
|
17
|
+
selectable: t.boolean().optional(),
|
|
18
|
+
children: t.array(J).optional()
|
|
19
|
+
})), k = t.object({
|
|
20
|
+
label: t.string(),
|
|
21
|
+
value: t.string(),
|
|
22
|
+
disabled: t.boolean().optional()
|
|
23
|
+
}), Re = k.extend({
|
|
24
|
+
description: t.string().optional()
|
|
25
|
+
}), L = t.object({
|
|
26
|
+
key: t.string(),
|
|
27
|
+
label: t.string(),
|
|
28
|
+
width: t.string().optional(),
|
|
29
|
+
align: t.enum(["left", "center", "right"]).optional()
|
|
30
|
+
}), V = {
|
|
31
31
|
AppRoot: {
|
|
32
|
-
props:
|
|
33
|
-
modalScope:
|
|
32
|
+
props: t.object({
|
|
33
|
+
modalScope: t.enum(["document", "app"]).optional()
|
|
34
34
|
}),
|
|
35
35
|
slots: ["default"],
|
|
36
36
|
description: 'Root of a DSM application. Use once around the application shell. Dialogs stay inside the app by default (modalScope "app"); "document" is only for full-page web/Portal apps.'
|
|
37
37
|
},
|
|
38
38
|
AppShell: {
|
|
39
|
-
props:
|
|
40
|
-
sidebarWidth:
|
|
41
|
-
minHeight:
|
|
42
|
-
responsive:
|
|
43
|
-
wideLayout:
|
|
39
|
+
props: t.object({
|
|
40
|
+
sidebarWidth: t.string().optional(),
|
|
41
|
+
minHeight: t.string().optional(),
|
|
42
|
+
responsive: t.boolean().optional(),
|
|
43
|
+
wideLayout: t.enum(["window", "web"]).optional()
|
|
44
44
|
}),
|
|
45
45
|
slots: ["default", "sidebar", "toolbar", "footer"],
|
|
46
46
|
description: 'DSM application interior with optional sidebar, toolbar, main content and footer regions. Set wideLayout "web" only for a standalone Portal page; DSM windows keep the default "window" at every width.'
|
|
47
47
|
},
|
|
48
48
|
ResponsiveView: {
|
|
49
|
-
props:
|
|
49
|
+
props: t.object({ mode: t.enum(["auto", "mobile", "window", "web"]).optional() }),
|
|
50
50
|
slots: ["default", "mobile", "window", "web"],
|
|
51
51
|
description: 'Optionally replace a specialized element with a phone-friendly alternative. mobile/window/web slots follow AppShell container width (web only with AppShell wideLayout "web"); default is always the fallback.'
|
|
52
52
|
},
|
|
53
53
|
Page: {
|
|
54
|
-
props:
|
|
55
|
-
width:
|
|
56
|
-
surface:
|
|
54
|
+
props: t.object({
|
|
55
|
+
width: t.string().optional(),
|
|
56
|
+
surface: t.enum(["auto", "flat", "card"]).optional()
|
|
57
57
|
}),
|
|
58
58
|
slots: ["default"],
|
|
59
59
|
description: 'Page content area. Use width "fill" for data-heavy screens and "readable" for forms/settings.'
|
|
60
60
|
},
|
|
61
61
|
PageHeader: {
|
|
62
|
-
props:
|
|
63
|
-
title:
|
|
64
|
-
description:
|
|
62
|
+
props: t.object({
|
|
63
|
+
title: t.string(),
|
|
64
|
+
description: t.string().optional()
|
|
65
65
|
}),
|
|
66
66
|
slots: ["actions", "meta"],
|
|
67
67
|
description: "Page heading with optional description and page-level actions. The meta slot sits on the title line, for a small chip such as when the data was read."
|
|
68
68
|
},
|
|
69
69
|
Toolbar: {
|
|
70
|
-
props:
|
|
70
|
+
props: t.object({ height: t.string().optional() }),
|
|
71
71
|
slots: ["default", "leading", "actions"],
|
|
72
72
|
description: "Application toolbar. Put primary page-independent actions in the actions slot."
|
|
73
73
|
},
|
|
74
74
|
SidebarNav: {
|
|
75
|
-
props:
|
|
76
|
-
value:
|
|
77
|
-
groups:
|
|
78
|
-
label:
|
|
79
|
-
items:
|
|
75
|
+
props: t.object({
|
|
76
|
+
value: t.string().optional(),
|
|
77
|
+
groups: t.array(t.object({
|
|
78
|
+
label: t.string().optional(),
|
|
79
|
+
items: t.array(J)
|
|
80
80
|
})),
|
|
81
|
-
searchable:
|
|
82
|
-
collapsible:
|
|
83
|
-
searchPlaceholder:
|
|
81
|
+
searchable: t.boolean().optional(),
|
|
82
|
+
collapsible: t.boolean().optional(),
|
|
83
|
+
searchPlaceholder: t.string().optional()
|
|
84
84
|
}),
|
|
85
85
|
events: ["change"],
|
|
86
86
|
description: "DSM sidebar navigation. Icon values are names registered by the host application."
|
|
87
87
|
},
|
|
88
88
|
Tabs: {
|
|
89
|
-
props:
|
|
90
|
-
value:
|
|
91
|
-
items:
|
|
92
|
-
ariaLabel:
|
|
89
|
+
props: t.object({
|
|
90
|
+
value: t.string(),
|
|
91
|
+
items: t.array(k),
|
|
92
|
+
ariaLabel: t.string().optional()
|
|
93
93
|
}),
|
|
94
94
|
events: ["change"],
|
|
95
95
|
description: "Section tabs for switching a local mode or filter. Bind value to state for two-way updates."
|
|
96
96
|
},
|
|
97
97
|
Stack: {
|
|
98
|
-
props:
|
|
99
|
-
direction:
|
|
100
|
-
gap:
|
|
101
|
-
align:
|
|
102
|
-
justify:
|
|
103
|
-
wrap:
|
|
98
|
+
props: t.object({
|
|
99
|
+
direction: t.enum(["row", "column"]).optional(),
|
|
100
|
+
gap: t.enum(["none", "xs", "sm", "md", "lg"]).optional(),
|
|
101
|
+
align: t.enum(["start", "center", "end", "stretch"]).optional(),
|
|
102
|
+
justify: t.enum(["start", "center", "end", "between"]).optional(),
|
|
103
|
+
wrap: t.boolean().optional()
|
|
104
104
|
}),
|
|
105
105
|
slots: ["default"],
|
|
106
106
|
description: "Simple layout composition. Prefer semantic components first and use Stack only for local arrangement."
|
|
107
107
|
},
|
|
108
108
|
Text: {
|
|
109
|
-
props:
|
|
110
|
-
text:
|
|
111
|
-
variant:
|
|
109
|
+
props: t.object({
|
|
110
|
+
text: t.string(),
|
|
111
|
+
variant: t.enum(["body", "muted", "caption", "heading", "mono"]).optional()
|
|
112
112
|
}),
|
|
113
113
|
description: "Short application text. Do not use it when a semantic component already owns the label/description."
|
|
114
114
|
},
|
|
115
115
|
Button: {
|
|
116
|
-
props:
|
|
117
|
-
label:
|
|
118
|
-
variant:
|
|
119
|
-
size:
|
|
120
|
-
disabled:
|
|
121
|
-
loading:
|
|
122
|
-
icon:
|
|
116
|
+
props: t.object({
|
|
117
|
+
label: t.string(),
|
|
118
|
+
variant: t.enum(["primary", "secondary", "ghost", "danger"]).optional(),
|
|
119
|
+
size: t.enum(["sm", "md", "lg"]).optional(),
|
|
120
|
+
disabled: t.boolean().optional(),
|
|
121
|
+
loading: t.boolean().optional(),
|
|
122
|
+
icon: t.string().optional()
|
|
123
123
|
}),
|
|
124
124
|
events: ["press"],
|
|
125
125
|
description: "User action. Use one primary action per local task when possible. Icon is an optional host-registered icon name."
|
|
126
126
|
},
|
|
127
127
|
Input: {
|
|
128
|
-
props:
|
|
129
|
-
value:
|
|
130
|
-
type:
|
|
131
|
-
placeholder:
|
|
132
|
-
disabled:
|
|
133
|
-
readonly:
|
|
134
|
-
invalid:
|
|
135
|
-
size:
|
|
136
|
-
ariaLabel:
|
|
128
|
+
props: t.object({
|
|
129
|
+
value: t.union([t.string(), t.number()]).optional(),
|
|
130
|
+
type: t.string().optional(),
|
|
131
|
+
placeholder: t.string().optional(),
|
|
132
|
+
disabled: t.boolean().optional(),
|
|
133
|
+
readonly: t.boolean().optional(),
|
|
134
|
+
invalid: t.boolean().optional(),
|
|
135
|
+
size: t.enum(["sm", "md", "lg"]).optional(),
|
|
136
|
+
ariaLabel: t.string().optional()
|
|
137
137
|
}),
|
|
138
138
|
events: ["change"],
|
|
139
139
|
description: "Single-line input. Use $bindState/$bindItem on value for editable state."
|
|
140
140
|
},
|
|
141
141
|
Select: {
|
|
142
|
-
props:
|
|
143
|
-
value:
|
|
144
|
-
options:
|
|
145
|
-
placeholder:
|
|
146
|
-
disabled:
|
|
147
|
-
search:
|
|
142
|
+
props: t.object({
|
|
143
|
+
value: t.string().optional(),
|
|
144
|
+
options: t.array(k),
|
|
145
|
+
placeholder: t.string().optional(),
|
|
146
|
+
disabled: t.boolean().optional(),
|
|
147
|
+
search: t.boolean().optional()
|
|
148
148
|
}),
|
|
149
149
|
events: ["change"],
|
|
150
150
|
description: "Single-choice select. Use $bindState/$bindItem on value."
|
|
151
151
|
},
|
|
152
152
|
Checkbox: {
|
|
153
|
-
props:
|
|
154
|
-
checked:
|
|
155
|
-
label:
|
|
156
|
-
description:
|
|
157
|
-
disabled:
|
|
153
|
+
props: t.object({
|
|
154
|
+
checked: t.boolean().optional(),
|
|
155
|
+
label: t.string().optional(),
|
|
156
|
+
description: t.string().optional(),
|
|
157
|
+
disabled: t.boolean().optional()
|
|
158
158
|
}),
|
|
159
159
|
events: ["change"],
|
|
160
160
|
description: "Boolean choice. Use $bindState/$bindItem on checked."
|
|
161
161
|
},
|
|
162
162
|
Switch: {
|
|
163
|
-
props:
|
|
164
|
-
checked:
|
|
165
|
-
label:
|
|
166
|
-
disabled:
|
|
163
|
+
props: t.object({
|
|
164
|
+
checked: t.boolean().optional(),
|
|
165
|
+
label: t.string().optional(),
|
|
166
|
+
disabled: t.boolean().optional()
|
|
167
167
|
}),
|
|
168
168
|
events: ["change"],
|
|
169
169
|
description: "Immediate on/off setting. Use $bindState/$bindItem on checked."
|
|
170
170
|
},
|
|
171
171
|
RadioGroup: {
|
|
172
|
-
props:
|
|
173
|
-
value:
|
|
174
|
-
options:
|
|
175
|
-
orientation:
|
|
176
|
-
disabled:
|
|
172
|
+
props: t.object({
|
|
173
|
+
value: t.string().optional(),
|
|
174
|
+
options: t.array(Re),
|
|
175
|
+
orientation: t.enum(["vertical", "horizontal"]).optional(),
|
|
176
|
+
disabled: t.boolean().optional()
|
|
177
177
|
}),
|
|
178
178
|
events: ["change"],
|
|
179
179
|
description: "Choose one of a small visible set of mutually-exclusive options."
|
|
180
180
|
},
|
|
181
181
|
Form: {
|
|
182
|
-
props:
|
|
183
|
-
direction:
|
|
184
|
-
fieldWidth:
|
|
182
|
+
props: t.object({
|
|
183
|
+
direction: t.enum(["auto", "horizontal", "vertical"]).optional(),
|
|
184
|
+
fieldWidth: t.string().optional()
|
|
185
185
|
}),
|
|
186
186
|
slots: ["default"],
|
|
187
187
|
events: ["submit"],
|
|
188
188
|
description: "Form container. Put Field components inside and bind controls to state."
|
|
189
189
|
},
|
|
190
190
|
Field: {
|
|
191
|
-
props:
|
|
192
|
-
label:
|
|
193
|
-
description:
|
|
194
|
-
help:
|
|
195
|
-
required:
|
|
196
|
-
fieldWidth:
|
|
197
|
-
direction:
|
|
191
|
+
props: t.object({
|
|
192
|
+
label: t.string(),
|
|
193
|
+
description: t.string().optional(),
|
|
194
|
+
help: t.string().optional(),
|
|
195
|
+
required: t.boolean().optional(),
|
|
196
|
+
fieldWidth: t.string().optional(),
|
|
197
|
+
direction: t.enum(["auto", "horizontal", "vertical"]).optional()
|
|
198
198
|
}),
|
|
199
199
|
slots: ["default"],
|
|
200
200
|
description: "Labeled form field for create/edit dialogs and forms."
|
|
201
201
|
},
|
|
202
202
|
SettingsSection: {
|
|
203
|
-
props:
|
|
204
|
-
title:
|
|
205
|
-
collapsible:
|
|
206
|
-
open:
|
|
203
|
+
props: t.object({
|
|
204
|
+
title: t.string(),
|
|
205
|
+
collapsible: t.boolean().optional(),
|
|
206
|
+
open: t.boolean().optional()
|
|
207
207
|
}),
|
|
208
208
|
slots: ["default", "actions"],
|
|
209
209
|
events: ["openChange"],
|
|
210
210
|
description: "Section of related settings. Prefer this plus SettingsField for DSM settings pages."
|
|
211
211
|
},
|
|
212
212
|
SettingsField: {
|
|
213
|
-
props:
|
|
214
|
-
label:
|
|
215
|
-
description:
|
|
216
|
-
required:
|
|
217
|
-
fieldWidth:
|
|
218
|
-
align:
|
|
213
|
+
props: t.object({
|
|
214
|
+
label: t.string(),
|
|
215
|
+
description: t.string().optional(),
|
|
216
|
+
required: t.boolean().optional(),
|
|
217
|
+
fieldWidth: t.string().optional(),
|
|
218
|
+
align: t.enum(["start", "center"]).optional()
|
|
219
219
|
}),
|
|
220
220
|
slots: ["default"],
|
|
221
221
|
description: "DSM settings row with label, description and one control/content region."
|
|
222
222
|
},
|
|
223
223
|
Surface: {
|
|
224
|
-
props:
|
|
225
|
-
padding:
|
|
226
|
-
border:
|
|
227
|
-
raised:
|
|
224
|
+
props: t.object({
|
|
225
|
+
padding: t.enum(["none", "sm", "md", "lg"]).optional(),
|
|
226
|
+
border: t.boolean().optional(),
|
|
227
|
+
raised: t.boolean().optional()
|
|
228
228
|
}),
|
|
229
229
|
slots: ["default"],
|
|
230
230
|
description: "Neutral bordered/raised content surface when Card semantics are not needed."
|
|
231
231
|
},
|
|
232
232
|
Card: {
|
|
233
|
-
props:
|
|
234
|
-
title:
|
|
235
|
-
layoutType:
|
|
236
|
-
expandable:
|
|
237
|
-
expanded:
|
|
238
|
-
footerAlign:
|
|
233
|
+
props: t.object({
|
|
234
|
+
title: t.string().optional(),
|
|
235
|
+
layoutType: t.enum(["regular", "compact"]).optional(),
|
|
236
|
+
expandable: t.boolean().optional(),
|
|
237
|
+
expanded: t.boolean().optional(),
|
|
238
|
+
footerAlign: t.enum(["start", "end", "between"]).optional()
|
|
239
239
|
}),
|
|
240
240
|
slots: ["default", "header-actions", "footer"],
|
|
241
241
|
events: ["expandedChange"],
|
|
242
242
|
description: "Grouped content with optional header/actions/footer. Do not use a Card just to add spacing."
|
|
243
243
|
},
|
|
244
244
|
Callout: {
|
|
245
|
-
props:
|
|
246
|
-
tone:
|
|
247
|
-
title:
|
|
248
|
-
closable:
|
|
249
|
-
code:
|
|
245
|
+
props: t.object({
|
|
246
|
+
tone: t.enum(["info", "success", "warning", "danger"]).optional(),
|
|
247
|
+
title: t.string().optional(),
|
|
248
|
+
closable: t.boolean().optional(),
|
|
249
|
+
code: t.string().optional()
|
|
250
250
|
}),
|
|
251
251
|
slots: ["default", "actions"],
|
|
252
252
|
events: ["close"],
|
|
253
253
|
description: "Inline information, success, warning or error message. Put a machine error code in `code`, not in the text."
|
|
254
254
|
},
|
|
255
255
|
EmptyState: {
|
|
256
|
-
props:
|
|
257
|
-
title:
|
|
258
|
-
description:
|
|
259
|
-
icon:
|
|
256
|
+
props: t.object({
|
|
257
|
+
title: t.string(),
|
|
258
|
+
description: t.string().optional(),
|
|
259
|
+
icon: t.string().optional()
|
|
260
260
|
}),
|
|
261
261
|
slots: ["actions"],
|
|
262
262
|
description: "Empty/no-results state with optional recovery or create actions."
|
|
263
263
|
},
|
|
264
264
|
Progress: {
|
|
265
|
-
props:
|
|
266
|
-
value:
|
|
267
|
-
max:
|
|
268
|
-
label:
|
|
269
|
-
valueLabel:
|
|
270
|
-
tone:
|
|
265
|
+
props: t.object({
|
|
266
|
+
value: t.number().optional(),
|
|
267
|
+
max: t.number().optional(),
|
|
268
|
+
label: t.string().optional(),
|
|
269
|
+
valueLabel: t.string().optional(),
|
|
270
|
+
tone: t.enum(["primary", "success", "warning", "danger"]).optional()
|
|
271
271
|
}),
|
|
272
272
|
description: "Linear determinate progress. Domain-specific progress visualizations should be custom components."
|
|
273
273
|
},
|
|
274
274
|
Badge: {
|
|
275
|
-
props:
|
|
276
|
-
text:
|
|
277
|
-
tone:
|
|
275
|
+
props: t.object({
|
|
276
|
+
text: t.string(),
|
|
277
|
+
tone: t.enum(["neutral", "info", "success", "warning", "danger"]).optional()
|
|
278
278
|
}),
|
|
279
279
|
description: "Short status/category badge."
|
|
280
280
|
},
|
|
281
281
|
Dialog: {
|
|
282
|
-
props:
|
|
283
|
-
open:
|
|
284
|
-
title:
|
|
285
|
-
description:
|
|
286
|
-
width:
|
|
287
|
-
showClose:
|
|
282
|
+
props: t.object({
|
|
283
|
+
open: t.boolean().optional(),
|
|
284
|
+
title: t.string().optional(),
|
|
285
|
+
description: t.string().optional(),
|
|
286
|
+
width: t.string().optional(),
|
|
287
|
+
showClose: t.boolean().optional()
|
|
288
288
|
}),
|
|
289
289
|
slots: ["default", "footer"],
|
|
290
290
|
events: ["openChange"],
|
|
291
291
|
description: "Modal task/dialog. Bind open to state. Put confirmation or form actions in footer."
|
|
292
292
|
},
|
|
293
293
|
DataTable: {
|
|
294
|
-
props:
|
|
295
|
-
columns:
|
|
296
|
-
rows:
|
|
297
|
-
rowKey:
|
|
298
|
-
emptyText:
|
|
299
|
-
compact:
|
|
300
|
-
mobileView:
|
|
294
|
+
props: t.object({
|
|
295
|
+
columns: t.array(L),
|
|
296
|
+
rows: t.array(t.record(t.string(), t.unknown())),
|
|
297
|
+
rowKey: t.string().optional(),
|
|
298
|
+
emptyText: t.string().optional(),
|
|
299
|
+
compact: t.boolean().optional(),
|
|
300
|
+
mobileView: t.enum(["auto", "cards", "table"]).optional()
|
|
301
301
|
}),
|
|
302
302
|
description: "Simple resource table where cells display scalar row fields. Use an app extension component for rich/custom cells and row actions."
|
|
303
303
|
},
|
|
304
304
|
ResourceList: {
|
|
305
|
-
props:
|
|
306
|
-
columns:
|
|
307
|
-
rows:
|
|
308
|
-
rowKey:
|
|
309
|
-
emptyText:
|
|
310
|
-
compact:
|
|
311
|
-
mobileView:
|
|
305
|
+
props: t.object({
|
|
306
|
+
columns: t.array(L),
|
|
307
|
+
rows: t.array(t.record(t.string(), t.unknown())),
|
|
308
|
+
rowKey: t.string().optional(),
|
|
309
|
+
emptyText: t.string().optional(),
|
|
310
|
+
compact: t.boolean().optional(),
|
|
311
|
+
mobileView: t.enum(["auto", "cards", "table"]).optional()
|
|
312
312
|
}),
|
|
313
313
|
slots: ["toolbar"],
|
|
314
314
|
description: "Common resource collection pattern: optional toolbar plus a simple table. For domain-specific row rendering, extend the catalog with a custom list/table component."
|
|
315
315
|
},
|
|
316
|
+
CellText: {
|
|
317
|
+
props: t.object({
|
|
318
|
+
text: t.string(),
|
|
319
|
+
secondary: t.string().optional(),
|
|
320
|
+
layout: t.enum(["stacked", "inline"]).optional(),
|
|
321
|
+
openLabel: t.string().optional(),
|
|
322
|
+
openDisabled: t.boolean().optional()
|
|
323
|
+
}),
|
|
324
|
+
events: ["open"],
|
|
325
|
+
description: 'Main text with secondary information (size, time, path), truncated with a tooltip. With openLabel the main text is a link-styled button that emits open, e.g. "Open in File Station".'
|
|
326
|
+
},
|
|
327
|
+
CellStatus: {
|
|
328
|
+
props: t.object({
|
|
329
|
+
label: t.string(),
|
|
330
|
+
tone: t.enum(["neutral", "info", "success", "warning", "danger"]).optional(),
|
|
331
|
+
progress: t.number().optional(),
|
|
332
|
+
detail: t.string().optional()
|
|
333
|
+
}),
|
|
334
|
+
description: "Task status: a toned dot and label, a bar while progress (0–100) is running, and a detail such as speed or a reason."
|
|
335
|
+
},
|
|
336
|
+
ListItem: {
|
|
337
|
+
props: t.object({
|
|
338
|
+
title: t.string().optional(),
|
|
339
|
+
description: t.string().optional()
|
|
340
|
+
}),
|
|
341
|
+
slots: ["default", "actions"],
|
|
342
|
+
description: "One entry of a list (an extension, a tool, a rule): title, description, content and actions on the right. Consecutive entries are split by a hairline."
|
|
343
|
+
},
|
|
344
|
+
InputGroup: {
|
|
345
|
+
props: t.object({}),
|
|
346
|
+
slots: ["default"],
|
|
347
|
+
description: "A field and the buttons acting on it on one line, such as a URL and its Install button. The first child takes the room left."
|
|
348
|
+
},
|
|
316
349
|
Loading: {
|
|
317
|
-
props:
|
|
350
|
+
props: t.object({ text: t.string().optional() }),
|
|
318
351
|
description: "Centered loading state for a page or bounded region."
|
|
319
352
|
}
|
|
320
353
|
}, A = z(H, {
|
|
321
|
-
components:
|
|
354
|
+
components: V,
|
|
322
355
|
actions: {}
|
|
323
|
-
}),
|
|
356
|
+
}), Ke = [
|
|
324
357
|
"Prefer AppRoot > AppShell > Page as the normal DSM application hierarchy.",
|
|
325
358
|
"Prefer SettingsSection and SettingsField for settings; prefer ResourceList/DataTable for ordinary scalar resource collections.",
|
|
326
359
|
"Keep state in the spec and use $bindState/$bindItem for editable controls; do not invent JavaScript in props.",
|
|
@@ -329,53 +362,53 @@ const V = o.lazy(() => o.object({
|
|
|
329
362
|
"AppShell adapts to its actual DSM window width: phone (<=600px), desktop window (601–1199px), and wide web/Portal (>=1200px). Never assume browser viewport width.",
|
|
330
363
|
"For a phone-unfriendly custom view, use ResponsiveView slots: mobile alternative and default full view. Keep essential actions accessible on mobile.",
|
|
331
364
|
"Use low-level Stack/Text only when a semantic component does not already express the layout."
|
|
332
|
-
],
|
|
333
|
-
function
|
|
334
|
-
return `${A.prompt({ customRules:
|
|
365
|
+
], Le = '## Self-check workflow\n\nInstall `@synopackageland/ui` first. Without a local install, use\n`npx -y -p @synopackageland/ui syno-pkg-land-ui <command>` (pin the package version for reproducibility).\n\n1. List components with `npx --no syno-pkg-land-ui catalog`; read props with `npx --no syno-pkg-land-ui describe <Component>`.\n2. Write the spec as JSON: {"root", "elements", "state"}. Seed every state path you bind or read.\n3. Run `npx --no syno-pkg-land-ui validate ui.json --json` (add --actions, --functions, --state, --messages for host-provided names).\n Fix every error at its JSON Pointer `path` using its `hint`, then validate again until it passes.\n4. Run `npx --no syno-pkg-land-ui render ui.json --out shots` to screenshot phone, DSM window and wide widths and to\n report layout overflow; fix reported elements and repeat.\n5. Hand over the spec only when validate and render both exit 0.';
|
|
366
|
+
function pt() {
|
|
367
|
+
return `${A.prompt({ customRules: Ke })}
|
|
335
368
|
|
|
336
|
-
${
|
|
369
|
+
${Le}
|
|
337
370
|
`;
|
|
338
371
|
}
|
|
339
|
-
const
|
|
372
|
+
const Ue = {
|
|
340
373
|
none: "0",
|
|
341
374
|
xs: "var(--ui-space-1)",
|
|
342
375
|
sm: "var(--ui-space-2)",
|
|
343
376
|
md: "var(--ui-space-3)",
|
|
344
377
|
lg: "var(--ui-space-4)"
|
|
345
|
-
},
|
|
346
|
-
function
|
|
378
|
+
}, De = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch" }, Te = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
379
|
+
function Ee(e) {
|
|
347
380
|
return { default: () => e };
|
|
348
381
|
}
|
|
349
382
|
function C(e) {
|
|
350
|
-
return e ?
|
|
383
|
+
return e ? Ie(e) : void 0;
|
|
351
384
|
}
|
|
352
|
-
function
|
|
385
|
+
function _(e) {
|
|
353
386
|
return {
|
|
354
387
|
...e,
|
|
355
388
|
icon: C(e.icon),
|
|
356
|
-
children: e.children?.map(
|
|
389
|
+
children: e.children?.map(_)
|
|
357
390
|
};
|
|
358
391
|
}
|
|
359
|
-
function
|
|
360
|
-
return e.map((
|
|
392
|
+
function Ne(e) {
|
|
393
|
+
return e.map((o) => ({ ...o, items: o.items.map(_) }));
|
|
361
394
|
}
|
|
362
|
-
const
|
|
363
|
-
AppRoot: ({ props: e, slots:
|
|
364
|
-
AppShell: ({ props: e, slots:
|
|
395
|
+
const Je = {
|
|
396
|
+
AppRoot: ({ props: e, slots: o }) => d(Ce, { modalScope: e.modalScope }, o),
|
|
397
|
+
AppShell: ({ props: e, slots: o }) => d(ke, {
|
|
365
398
|
sidebarWidth: e.sidebarWidth,
|
|
366
399
|
minHeight: e.minHeight,
|
|
367
400
|
responsive: e.responsive,
|
|
368
401
|
wideLayout: e.wideLayout
|
|
369
|
-
},
|
|
370
|
-
ResponsiveView: ({ props: e, slots:
|
|
371
|
-
Page: ({ props: e, slots:
|
|
372
|
-
PageHeader: ({ props: e, slots:
|
|
373
|
-
Toolbar: ({ props: e, slots:
|
|
374
|
-
SidebarNav: ({ props: e, bindings:
|
|
375
|
-
const [s, i] = b(e.value,
|
|
376
|
-
return d(
|
|
402
|
+
}, o),
|
|
403
|
+
ResponsiveView: ({ props: e, slots: o }) => d(Pe, { mode: e.mode }, o),
|
|
404
|
+
Page: ({ props: e, slots: o }) => d(Ae, { width: e.width ?? "fill", surface: e.surface }, o),
|
|
405
|
+
PageHeader: ({ props: e, slots: o }) => d(Oe, e, o),
|
|
406
|
+
Toolbar: ({ props: e, slots: o }) => d(xe, e, o),
|
|
407
|
+
SidebarNav: ({ props: e, bindings: o, emit: n }) => {
|
|
408
|
+
const [s, i] = b(e.value, o?.value);
|
|
409
|
+
return d(je, {
|
|
377
410
|
modelValue: s,
|
|
378
|
-
groups:
|
|
411
|
+
groups: Ne(e.groups),
|
|
379
412
|
searchable: e.searchable,
|
|
380
413
|
collapsible: e.collapsible,
|
|
381
414
|
searchPlaceholder: e.searchPlaceholder,
|
|
@@ -384,9 +417,9 @@ const Le = {
|
|
|
384
417
|
}
|
|
385
418
|
});
|
|
386
419
|
},
|
|
387
|
-
Tabs: ({ props: e, bindings:
|
|
388
|
-
const [s, i] = b(e.value,
|
|
389
|
-
return d(
|
|
420
|
+
Tabs: ({ props: e, bindings: o, emit: n }) => {
|
|
421
|
+
const [s, i] = b(e.value, o?.value);
|
|
422
|
+
return d(Se, {
|
|
390
423
|
modelValue: s ?? "",
|
|
391
424
|
items: e.items,
|
|
392
425
|
ariaLabel: e.ariaLabel,
|
|
@@ -395,36 +428,36 @@ const Le = {
|
|
|
395
428
|
}
|
|
396
429
|
});
|
|
397
430
|
},
|
|
398
|
-
Stack: ({ props: e, children:
|
|
431
|
+
Stack: ({ props: e, children: o }) => d("div", {
|
|
399
432
|
"data-syno-pkg-land-ui": "",
|
|
400
433
|
style: {
|
|
401
434
|
display: "flex",
|
|
402
435
|
flexDirection: e.direction ?? "column",
|
|
403
|
-
gap:
|
|
404
|
-
alignItems:
|
|
405
|
-
justifyContent:
|
|
436
|
+
gap: Ue[e.gap ?? "md"],
|
|
437
|
+
alignItems: De[e.align ?? "stretch"],
|
|
438
|
+
justifyContent: Te[e.justify ?? "start"],
|
|
406
439
|
flexWrap: e.wrap ? "wrap" : "nowrap"
|
|
407
440
|
}
|
|
408
|
-
},
|
|
441
|
+
}, o),
|
|
409
442
|
Text: ({ props: e }) => {
|
|
410
|
-
const
|
|
411
|
-
return d(
|
|
443
|
+
const o = e.variant ?? "body";
|
|
444
|
+
return d(o === "heading" ? "h2" : o === "mono" ? "code" : "span", { class: o === "muted" ? "text-[13px] text-[var(--ui-text-muted)]" : o === "caption" ? "text-[12px] text-[var(--ui-text-muted)]" : o === "heading" ? "text-[16px] font-semibold text-[var(--ui-text)]" : o === "mono" ? "font-mono text-[12px] text-[var(--ui-text)]" : "text-[13px] text-[var(--ui-text)]", "data-syno-pkg-land-ui": "" }, e.text);
|
|
412
445
|
},
|
|
413
|
-
Button: ({ props: e, emit:
|
|
446
|
+
Button: ({ props: e, emit: o }) => {
|
|
414
447
|
const n = C(e.icon);
|
|
415
|
-
return d(
|
|
448
|
+
return d($e, {
|
|
416
449
|
variant: e.variant,
|
|
417
450
|
size: e.size,
|
|
418
451
|
disabled: e.disabled,
|
|
419
452
|
loading: e.loading,
|
|
420
|
-
onClick: () =>
|
|
453
|
+
onClick: () => o("press")
|
|
421
454
|
}, {
|
|
422
455
|
default: () => [n ? d(n, { class: "size-4", "aria-hidden": "true" }) : null, e.label]
|
|
423
456
|
});
|
|
424
457
|
},
|
|
425
|
-
Input: ({ props: e, bindings:
|
|
426
|
-
const [s, i] = b(e.value,
|
|
427
|
-
return d(
|
|
458
|
+
Input: ({ props: e, bindings: o, emit: n }) => {
|
|
459
|
+
const [s, i] = b(e.value, o?.value);
|
|
460
|
+
return d(ve, {
|
|
428
461
|
modelValue: s,
|
|
429
462
|
type: e.type,
|
|
430
463
|
placeholder: e.placeholder,
|
|
@@ -438,9 +471,9 @@ const Le = {
|
|
|
438
471
|
}
|
|
439
472
|
});
|
|
440
473
|
},
|
|
441
|
-
Select: ({ props: e, bindings:
|
|
442
|
-
const [s, i] = b(e.value,
|
|
443
|
-
return d(
|
|
474
|
+
Select: ({ props: e, bindings: o, emit: n }) => {
|
|
475
|
+
const [s, i] = b(e.value, o?.value);
|
|
476
|
+
return d(we, {
|
|
444
477
|
modelValue: s,
|
|
445
478
|
options: e.options,
|
|
446
479
|
placeholder: e.placeholder,
|
|
@@ -451,9 +484,9 @@ const Le = {
|
|
|
451
484
|
}
|
|
452
485
|
});
|
|
453
486
|
},
|
|
454
|
-
Checkbox: ({ props: e, bindings:
|
|
455
|
-
const [s, i] = b(e.checked,
|
|
456
|
-
return d(
|
|
487
|
+
Checkbox: ({ props: e, bindings: o, emit: n }) => {
|
|
488
|
+
const [s, i] = b(e.checked, o?.checked);
|
|
489
|
+
return d(ye, {
|
|
457
490
|
modelValue: s ?? !1,
|
|
458
491
|
label: e.label,
|
|
459
492
|
description: e.description,
|
|
@@ -463,9 +496,9 @@ const Le = {
|
|
|
463
496
|
}
|
|
464
497
|
});
|
|
465
498
|
},
|
|
466
|
-
Switch: ({ props: e, bindings:
|
|
467
|
-
const [s, i] = b(e.checked,
|
|
468
|
-
return d(
|
|
499
|
+
Switch: ({ props: e, bindings: o, emit: n }) => {
|
|
500
|
+
const [s, i] = b(e.checked, o?.checked);
|
|
501
|
+
return d(be, {
|
|
469
502
|
modelValue: s ?? !1,
|
|
470
503
|
label: e.label,
|
|
471
504
|
disabled: e.disabled,
|
|
@@ -474,9 +507,9 @@ const Le = {
|
|
|
474
507
|
}
|
|
475
508
|
});
|
|
476
509
|
},
|
|
477
|
-
RadioGroup: ({ props: e, bindings:
|
|
478
|
-
const [s, i] = b(e.value,
|
|
479
|
-
return d(
|
|
510
|
+
RadioGroup: ({ props: e, bindings: o, emit: n }) => {
|
|
511
|
+
const [s, i] = b(e.value, o?.value);
|
|
512
|
+
return d(ge, {
|
|
480
513
|
modelValue: s,
|
|
481
514
|
options: e.options,
|
|
482
515
|
orientation: e.orientation,
|
|
@@ -486,22 +519,22 @@ const Le = {
|
|
|
486
519
|
}
|
|
487
520
|
});
|
|
488
521
|
},
|
|
489
|
-
Form: ({ props: e, slots:
|
|
522
|
+
Form: ({ props: e, slots: o, emit: n }) => d(fe, {
|
|
490
523
|
direction: e.direction,
|
|
491
524
|
fieldWidth: e.fieldWidth,
|
|
492
525
|
onSubmit: () => n("submit")
|
|
493
|
-
},
|
|
494
|
-
Field: ({ props: e, slots:
|
|
526
|
+
}, o),
|
|
527
|
+
Field: ({ props: e, slots: o }) => d(he, {
|
|
495
528
|
label: e.label,
|
|
496
529
|
description: e.description,
|
|
497
530
|
help: e.help,
|
|
498
531
|
requiredMark: e.required,
|
|
499
532
|
fieldWidth: e.fieldWidth,
|
|
500
533
|
direction: e.direction
|
|
501
|
-
},
|
|
502
|
-
SettingsSection: ({ props: e, bindings:
|
|
503
|
-
const [i, a] = b(e.open,
|
|
504
|
-
return d(
|
|
534
|
+
}, o),
|
|
535
|
+
SettingsSection: ({ props: e, bindings: o, slots: n, emit: s }) => {
|
|
536
|
+
const [i, a] = b(e.open, o?.open);
|
|
537
|
+
return d(me, {
|
|
505
538
|
title: e.title,
|
|
506
539
|
collapsible: e.collapsible,
|
|
507
540
|
open: i,
|
|
@@ -510,17 +543,17 @@ const Le = {
|
|
|
510
543
|
}
|
|
511
544
|
}, n);
|
|
512
545
|
},
|
|
513
|
-
SettingsField: ({ props: e, slots:
|
|
546
|
+
SettingsField: ({ props: e, slots: o }) => d(ue, {
|
|
514
547
|
label: e.label,
|
|
515
548
|
description: e.description,
|
|
516
549
|
required: e.required,
|
|
517
550
|
fieldWidth: e.fieldWidth,
|
|
518
551
|
align: e.align
|
|
519
|
-
},
|
|
520
|
-
Surface: ({ props: e, slots:
|
|
521
|
-
Card: ({ props: e, bindings:
|
|
522
|
-
const [i, a] = b(e.expanded,
|
|
523
|
-
return d(
|
|
552
|
+
}, o),
|
|
553
|
+
Surface: ({ props: e, slots: o }) => d(pe, e, o),
|
|
554
|
+
Card: ({ props: e, bindings: o, slots: n, emit: s }) => {
|
|
555
|
+
const [i, a] = b(e.expanded, o?.expanded);
|
|
556
|
+
return d(de, {
|
|
524
557
|
title: e.title,
|
|
525
558
|
layoutType: e.layoutType,
|
|
526
559
|
expandable: e.expandable,
|
|
@@ -531,23 +564,23 @@ const Le = {
|
|
|
531
564
|
}
|
|
532
565
|
}, n);
|
|
533
566
|
},
|
|
534
|
-
Callout: ({ props: e, slots:
|
|
567
|
+
Callout: ({ props: e, slots: o, emit: n }) => d(ce, {
|
|
535
568
|
tone: e.tone,
|
|
536
569
|
title: e.title,
|
|
537
570
|
closable: e.closable,
|
|
538
571
|
code: e.code,
|
|
539
572
|
onClose: () => n("close")
|
|
540
|
-
},
|
|
541
|
-
EmptyState: ({ props: e, slots:
|
|
573
|
+
}, o),
|
|
574
|
+
EmptyState: ({ props: e, slots: o }) => d(le, {
|
|
542
575
|
title: e.title,
|
|
543
576
|
description: e.description,
|
|
544
577
|
icon: C(e.icon)
|
|
545
|
-
},
|
|
546
|
-
Progress: ({ props: e }) => d(
|
|
547
|
-
Badge: ({ props: e }) => d(
|
|
548
|
-
Dialog: ({ props: e, bindings:
|
|
549
|
-
const [i, a] = b(e.open,
|
|
550
|
-
return d(
|
|
578
|
+
}, o),
|
|
579
|
+
Progress: ({ props: e }) => d(re, e),
|
|
580
|
+
Badge: ({ props: e }) => d(ae, { tone: e.tone }, Ee(e.text)),
|
|
581
|
+
Dialog: ({ props: e, bindings: o, slots: n, emit: s }) => {
|
|
582
|
+
const [i, a] = b(e.open, o?.open);
|
|
583
|
+
return d(se, {
|
|
551
584
|
open: i ?? !1,
|
|
552
585
|
title: e.title,
|
|
553
586
|
description: e.description,
|
|
@@ -558,15 +591,19 @@ const Le = {
|
|
|
558
591
|
}
|
|
559
592
|
}, n);
|
|
560
593
|
},
|
|
561
|
-
DataTable: ({ props: e }) => d(
|
|
562
|
-
ResourceList: ({ props: e, slots:
|
|
563
|
-
|
|
564
|
-
d(
|
|
594
|
+
DataTable: ({ props: e }) => d(K, e),
|
|
595
|
+
ResourceList: ({ props: e, slots: o }) => d("section", { class: "min-w-0", "data-syno-pkg-land-ui": "", "data-ui-resource-list": "" }, [
|
|
596
|
+
o.toolbar ? d("div", { class: "mb-3 flex flex-wrap items-center gap-2" }, o.toolbar()) : null,
|
|
597
|
+
d(K, e)
|
|
565
598
|
]),
|
|
599
|
+
CellText: ({ props: e, emit: o }) => d(ie, { ...e, onOpen: () => o("open") }),
|
|
600
|
+
CellStatus: ({ props: e }) => d(ne, e),
|
|
601
|
+
ListItem: ({ props: e, slots: o }) => d(oe, e, o),
|
|
602
|
+
InputGroup: ({ slots: e }) => d(te, null, e),
|
|
566
603
|
Loading: ({ props: e }) => d(ee, { text: e.text })
|
|
567
|
-
}, { registry:
|
|
568
|
-
components:
|
|
569
|
-
}),
|
|
604
|
+
}, { registry: U } = B(A, {
|
|
605
|
+
components: Je
|
|
606
|
+
}), ut = /* @__PURE__ */ G({
|
|
570
607
|
__name: "SynoJsonRenderer",
|
|
571
608
|
props: {
|
|
572
609
|
spec: {},
|
|
@@ -582,8 +619,8 @@ const Le = {
|
|
|
582
619
|
fallback: {}
|
|
583
620
|
},
|
|
584
621
|
setup(e) {
|
|
585
|
-
return (
|
|
586
|
-
registry: j(
|
|
622
|
+
return (o, n) => (X(), Y(j(M), {
|
|
623
|
+
registry: j(U),
|
|
587
624
|
store: e.store,
|
|
588
625
|
"initial-state": e.state ?? e.spec?.state ?? {},
|
|
589
626
|
handlers: e.handlers,
|
|
@@ -596,7 +633,7 @@ const Le = {
|
|
|
596
633
|
default: Q(() => [
|
|
597
634
|
Z(j(W), {
|
|
598
635
|
spec: e.spec,
|
|
599
|
-
registry: j(
|
|
636
|
+
registry: j(U),
|
|
600
637
|
loading: e.loading,
|
|
601
638
|
fallback: e.fallback
|
|
602
639
|
}, null, 8, ["spec", "registry", "loading", "fallback"])
|
|
@@ -604,56 +641,56 @@ const Le = {
|
|
|
604
641
|
_: 1
|
|
605
642
|
}, 8, ["registry", "store", "initial-state", "handlers", "navigate", "functions", "directives", "validation-functions", "on-state-change"]));
|
|
606
643
|
}
|
|
607
|
-
}),
|
|
608
|
-
function q(e,
|
|
609
|
-
return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, s]) => m(s) ? q(s, `${
|
|
644
|
+
}), Ve = ["label", "title", "description", "text", "placeholder", "emptyText", "help", "ariaLabel", "valueLabel", "searchPlaceholder"];
|
|
645
|
+
function q(e, o = "") {
|
|
646
|
+
return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, s]) => m(s) ? q(s, `${o}${n}.`) : [`${o}${n}`]);
|
|
610
647
|
}
|
|
611
|
-
const m = (e) => typeof e == "object" && e !== null && !Array.isArray(e), u = (...e) => e.map((
|
|
612
|
-
function
|
|
613
|
-
const n = Array.from({ length:
|
|
648
|
+
const m = (e) => typeof e == "object" && e !== null && !Array.isArray(e), u = (...e) => e.map((o) => "/" + String(o).replaceAll("~", "~0").replaceAll("/", "~1")).join("");
|
|
649
|
+
function _e(e, o) {
|
|
650
|
+
const n = Array.from({ length: o.length + 1 }, (s, i) => i);
|
|
614
651
|
for (let s = 1; s <= e.length; s++) {
|
|
615
652
|
let i = n[0];
|
|
616
653
|
n[0] = s;
|
|
617
|
-
for (let a = 1; a <=
|
|
654
|
+
for (let a = 1; a <= o.length; a++) {
|
|
618
655
|
const r = n[a];
|
|
619
|
-
n[a] = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[s - 1].toLowerCase() ===
|
|
656
|
+
n[a] = Math.min(n[a] + 1, n[a - 1] + 1, i + (e[s - 1].toLowerCase() === o[a - 1].toLowerCase() ? 0 : 1)), i = r;
|
|
620
657
|
}
|
|
621
658
|
}
|
|
622
|
-
return n[
|
|
659
|
+
return n[o.length];
|
|
623
660
|
}
|
|
624
|
-
function y(e,
|
|
661
|
+
function y(e, o) {
|
|
625
662
|
let n, s = 1 / 0;
|
|
626
|
-
for (const i of
|
|
627
|
-
const a =
|
|
663
|
+
for (const i of o) {
|
|
664
|
+
const a = _e(e, i);
|
|
628
665
|
a < s && ([n, s] = [i, a]);
|
|
629
666
|
}
|
|
630
667
|
return n !== void 0 && s <= Math.max(2, Math.floor(e.length / 3)) ? n : void 0;
|
|
631
668
|
}
|
|
632
|
-
const
|
|
669
|
+
const qe = ["$state", "$item", "$index", "$bindState", "$bindItem", "$cond", "$computed", "$template"], Fe = (e) => m(e) && qe.some((o) => Object.hasOwn(e, o)), I = (e) => Fe(e) || (Array.isArray(e) ? e.some(I) : m(e) && Object.values(e).some(I));
|
|
633
670
|
function P(e) {
|
|
634
|
-
const
|
|
635
|
-
return m(
|
|
671
|
+
const o = e.props?.shape;
|
|
672
|
+
return m(o) ? o : void 0;
|
|
636
673
|
}
|
|
637
|
-
const
|
|
638
|
-
function
|
|
639
|
-
if (e.code === "invalid_value") return `Use one of: ${e.values.map((
|
|
674
|
+
const R = (e) => e.safeParse(void 0).success;
|
|
675
|
+
function ze(e) {
|
|
676
|
+
if (e.code === "invalid_value") return `Use one of: ${e.values.map((o) => JSON.stringify(o)).join(", ")}.`;
|
|
640
677
|
if (e.code === "invalid_type") return `Expected ${e.expected}.`;
|
|
641
678
|
}
|
|
642
|
-
const v = (e,
|
|
643
|
-
class
|
|
679
|
+
const v = (e, o) => `${e}: ${o.join(", ")}`;
|
|
680
|
+
class Be {
|
|
644
681
|
errors = [];
|
|
645
682
|
warnings = [];
|
|
646
|
-
error(
|
|
647
|
-
this.errors.push({ severity: "error", ...
|
|
683
|
+
error(o) {
|
|
684
|
+
this.errors.push({ severity: "error", ...o });
|
|
648
685
|
}
|
|
649
|
-
warn(
|
|
650
|
-
this.warnings.push({ severity: "warning", ...
|
|
686
|
+
warn(o) {
|
|
687
|
+
this.warnings.push({ severity: "warning", ...o });
|
|
651
688
|
}
|
|
652
689
|
}
|
|
653
|
-
function
|
|
654
|
-
const n =
|
|
690
|
+
function mt(e, o = {}) {
|
|
691
|
+
const n = o.catalog ?? A, s = n.data.components, i = new Be();
|
|
655
692
|
if (!m(e))
|
|
656
|
-
return i.error({ code: "invalid_spec", path: "", message: "A spec must be a JSON object.", hint: 'Return {"root": "<key>", "elements": {...}, "state": {...}}.' }),
|
|
693
|
+
return i.error({ code: "invalid_spec", path: "", message: "A spec must be a JSON object.", hint: 'Return {"root": "<key>", "elements": {...}, "state": {...}}.' }), T(i);
|
|
657
694
|
const a = m(e.elements) ? e.elements : void 0;
|
|
658
695
|
a || i.error({ code: "invalid_elements", path: "/elements", message: '"elements" must be an object keyed by element id.', hint: 'Use a flat map: {"elements": {"root": {"type": "AppRoot", "props": {}, "children": []}}}.' });
|
|
659
696
|
const r = Object.keys(a ?? {});
|
|
@@ -676,27 +713,27 @@ function ct(e, t = {}) {
|
|
|
676
713
|
});
|
|
677
714
|
continue;
|
|
678
715
|
}
|
|
679
|
-
|
|
716
|
+
Me(i, p, h, s[h], f.props), We(i, p, h, s[h], f, a);
|
|
680
717
|
}
|
|
681
|
-
const c =
|
|
718
|
+
const c = o.messages && q(o.messages), l = {
|
|
682
719
|
issues: i,
|
|
683
720
|
components: s,
|
|
684
721
|
actions: [
|
|
685
722
|
...(n.schema?.builtInActions ?? []).map((p) => p.name),
|
|
686
723
|
...Object.keys(n.data.actions ?? {}),
|
|
687
|
-
...
|
|
724
|
+
...o.actions ?? []
|
|
688
725
|
],
|
|
689
|
-
state: { ...
|
|
726
|
+
state: { ...o.state, ...m(e.state) ? e.state : {} },
|
|
690
727
|
// A message catalog implies the host registers the `t` function.
|
|
691
|
-
functions:
|
|
728
|
+
functions: o.functions || c ? [...o.functions ?? [], ...c ? ["t"] : []] : void 0,
|
|
692
729
|
messageKeys: c
|
|
693
730
|
};
|
|
694
|
-
return a && typeof e.root == "string" && Object.hasOwn(a, e.root) &&
|
|
731
|
+
return a && typeof e.root == "string" && Object.hasOwn(a, e.root) && He(l, e.root, a), T(i);
|
|
695
732
|
}
|
|
696
|
-
function
|
|
697
|
-
const a = (...l) => u("elements",
|
|
733
|
+
function Me(e, o, n, s, i) {
|
|
734
|
+
const a = (...l) => u("elements", o, "props", ...l);
|
|
698
735
|
if (!m(i)) {
|
|
699
|
-
e.error({ code: "invalid_props", path: a(), elementKey:
|
|
736
|
+
e.error({ code: "invalid_props", path: a(), elementKey: o, message: '"props" must be an object.', hint: 'Use "props": {} when the component needs none.' });
|
|
700
737
|
return;
|
|
701
738
|
}
|
|
702
739
|
const r = P(s);
|
|
@@ -709,82 +746,82 @@ function qe(e, t, n, s, i) {
|
|
|
709
746
|
e.error({
|
|
710
747
|
code: "unknown_prop",
|
|
711
748
|
path: a(l),
|
|
712
|
-
elementKey:
|
|
749
|
+
elementKey: o,
|
|
713
750
|
message: `${n} has no prop "${l}".`,
|
|
714
751
|
hint: h ? `Did you mean "${h}"? Run "syno-pkg-land-ui describe ${n}".` : v(`${n} props`, c)
|
|
715
752
|
});
|
|
716
753
|
continue;
|
|
717
754
|
}
|
|
718
|
-
if (
|
|
755
|
+
if (I(p)) continue;
|
|
719
756
|
const w = f.safeParse(p);
|
|
720
757
|
if (!w.success)
|
|
721
758
|
for (const h of w.error.issues)
|
|
722
759
|
e.error({
|
|
723
760
|
code: "invalid_prop",
|
|
724
761
|
path: a(l, ...h.path.map((g) => String(g))),
|
|
725
|
-
elementKey:
|
|
762
|
+
elementKey: o,
|
|
726
763
|
message: `${n}.${l}: ${h.message}`,
|
|
727
|
-
hint:
|
|
764
|
+
hint: ze(h)
|
|
728
765
|
});
|
|
729
766
|
}
|
|
730
767
|
for (const l of c)
|
|
731
|
-
!Object.hasOwn(i, l) && !
|
|
768
|
+
!Object.hasOwn(i, l) && !R(r[l]) && e.error({ code: "missing_prop", path: a(l), elementKey: o, message: `${n} requires prop "${l}".`, hint: `Run "syno-pkg-land-ui describe ${n}" for its type.` });
|
|
732
769
|
}
|
|
733
|
-
function F(e,
|
|
770
|
+
function F(e, o) {
|
|
734
771
|
const n = [];
|
|
735
|
-
if (Array.isArray(
|
|
772
|
+
if (Array.isArray(o.children) && o.children.forEach((s, i) => {
|
|
736
773
|
typeof s == "string" && n.push({ child: s, path: u("elements", e, "children", i) });
|
|
737
|
-
}), m(
|
|
738
|
-
for (const [s, i] of Object.entries(
|
|
774
|
+
}), m(o.slots))
|
|
775
|
+
for (const [s, i] of Object.entries(o.slots))
|
|
739
776
|
Array.isArray(i) && i.forEach((a, r) => {
|
|
740
777
|
typeof a == "string" && n.push({ child: a, path: u("elements", e, "slots", s, r) });
|
|
741
778
|
});
|
|
742
779
|
return n;
|
|
743
780
|
}
|
|
744
|
-
function
|
|
781
|
+
function We(e, o, n, s, i, a) {
|
|
745
782
|
const r = s.slots ?? [], { children: c } = i;
|
|
746
|
-
if (c !== void 0 && !(Array.isArray(c) && c.every((l) => typeof l == "string")) ? e.error({ code: "invalid_children", path: u("elements",
|
|
783
|
+
if (c !== void 0 && !(Array.isArray(c) && c.every((l) => typeof l == "string")) ? e.error({ code: "invalid_children", path: u("elements", o, "children"), elementKey: o, message: '"children" must be an array of element keys.' }) : c?.length && !r.includes("default") && e.error({
|
|
747
784
|
code: "children_not_allowed",
|
|
748
|
-
path: u("elements",
|
|
749
|
-
elementKey:
|
|
785
|
+
path: u("elements", o, "children"),
|
|
786
|
+
elementKey: o,
|
|
750
787
|
message: `${n} does not render children.`,
|
|
751
788
|
hint: r.length ? v(`Put them in a named slot of ${n}`, r) : 'Use "children": [] and put the content in a sibling or parent container.'
|
|
752
789
|
}), i.slots !== void 0)
|
|
753
790
|
if (!m(i.slots))
|
|
754
|
-
e.error({ code: "invalid_slots", path: u("elements",
|
|
791
|
+
e.error({ code: "invalid_slots", path: u("elements", o, "slots"), elementKey: o, message: '"slots" must map slot names to arrays of element keys.' });
|
|
755
792
|
else
|
|
756
793
|
for (const [l, p] of Object.entries(i.slots))
|
|
757
794
|
if (r.includes(l))
|
|
758
|
-
Array.isArray(p) || e.error({ code: "invalid_slots", path: u("elements",
|
|
795
|
+
Array.isArray(p) || e.error({ code: "invalid_slots", path: u("elements", o, "slots", l), elementKey: o, message: `Slot "${l}" must be an array of element keys.` });
|
|
759
796
|
else {
|
|
760
797
|
const f = y(l, r);
|
|
761
798
|
e.error({
|
|
762
799
|
code: "unknown_slot",
|
|
763
|
-
path: u("elements",
|
|
764
|
-
elementKey:
|
|
800
|
+
path: u("elements", o, "slots", l),
|
|
801
|
+
elementKey: o,
|
|
765
802
|
message: `${n} has no slot "${l}".`,
|
|
766
803
|
hint: f ? `Did you mean "${f}"?` : r.length ? v(`${n} slots`, r) : `${n} has no slots.`
|
|
767
804
|
});
|
|
768
805
|
}
|
|
769
|
-
for (const l of F(
|
|
806
|
+
for (const l of F(o, i))
|
|
770
807
|
if (!Object.hasOwn(a, l.child)) {
|
|
771
808
|
const p = y(l.child, Object.keys(a));
|
|
772
809
|
e.error({
|
|
773
810
|
code: "missing_child",
|
|
774
811
|
path: l.path,
|
|
775
|
-
elementKey:
|
|
812
|
+
elementKey: o,
|
|
776
813
|
message: `"${l.child}" is not in "elements".`,
|
|
777
814
|
hint: p ? `Did you mean "${p}"? Otherwise add the element.` : "Add the element or remove the reference."
|
|
778
815
|
});
|
|
779
816
|
}
|
|
780
817
|
}
|
|
781
|
-
function
|
|
818
|
+
function He(e, o, n) {
|
|
782
819
|
const { issues: s } = e, i = /* @__PURE__ */ new Set(), a = (r, c, l, p) => {
|
|
783
820
|
const f = n[r];
|
|
784
821
|
if (!m(f)) return;
|
|
785
822
|
i.add(r);
|
|
786
823
|
const w = m(f.repeat);
|
|
787
|
-
|
|
824
|
+
Qe(e, r, f, p || w);
|
|
788
825
|
const h = f.type === "AppRoot";
|
|
789
826
|
h && l && s.error({ code: "nested_app_root", path: u("elements", r), elementKey: r, message: "AppRoot cannot be nested inside another AppRoot.", hint: "Use a single AppRoot at the top of the spec." });
|
|
790
827
|
for (const g of F(r, f))
|
|
@@ -796,13 +833,13 @@ function ze(e, t, n) {
|
|
|
796
833
|
a(g.child, [...c, g.child], l || h, p || w);
|
|
797
834
|
}
|
|
798
835
|
};
|
|
799
|
-
a(
|
|
836
|
+
a(o, [o], !1, !1);
|
|
800
837
|
for (const r of Object.keys(n))
|
|
801
838
|
i.has(r) || s.warn({ code: "orphaned_element", path: u("elements", r), elementKey: r, message: `"${r}" is not reachable from the root.`, hint: "Reference it from a parent or delete it." });
|
|
802
839
|
}
|
|
803
|
-
function
|
|
840
|
+
function Ge(e, o) {
|
|
804
841
|
let n = e;
|
|
805
|
-
for (const s of
|
|
842
|
+
for (const s of o.split("/").slice(1)) {
|
|
806
843
|
const i = s.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
807
844
|
if (Array.isArray(n) && /^\d+$/.test(i)) n = n[Number(i)];
|
|
808
845
|
else if (m(n) && Object.hasOwn(n, i)) n = n[i];
|
|
@@ -810,56 +847,56 @@ function Be(e, t) {
|
|
|
810
847
|
}
|
|
811
848
|
return { found: !0, value: n };
|
|
812
849
|
}
|
|
813
|
-
function $(e,
|
|
850
|
+
function $(e, o, n, s, { mustExist: i }) {
|
|
814
851
|
if (typeof n != "string" || !n.startsWith("/")) {
|
|
815
852
|
e.issues.error({
|
|
816
853
|
code: "invalid_state_path",
|
|
817
854
|
path: s,
|
|
818
|
-
elementKey:
|
|
855
|
+
elementKey: o,
|
|
819
856
|
message: `State paths are JSON Pointers; got ${JSON.stringify(n)}.`,
|
|
820
857
|
hint: typeof n == "string" ? `Use "/${n.replace(/^\.?\/?/, "").replaceAll(".", "/")}".` : 'Use a string such as "/settings/enabled".'
|
|
821
858
|
});
|
|
822
859
|
return;
|
|
823
860
|
}
|
|
824
|
-
i && !
|
|
861
|
+
i && !Ge(e.state, n).found && e.issues.warn({
|
|
825
862
|
code: "state_path_missing",
|
|
826
863
|
path: s,
|
|
827
|
-
elementKey:
|
|
864
|
+
elementKey: o,
|
|
828
865
|
message: `State "${n}" has no initial value.`,
|
|
829
866
|
hint: `Seed it in the spec's "state", or pass the host state with --state, so the first render has a value.`
|
|
830
867
|
});
|
|
831
868
|
}
|
|
832
|
-
function S(e,
|
|
869
|
+
function S(e, o, n, s, i) {
|
|
833
870
|
if (Array.isArray(n)) {
|
|
834
|
-
n.forEach((a, r) => S(e,
|
|
871
|
+
n.forEach((a, r) => S(e, o, a, s + u(r), i));
|
|
835
872
|
return;
|
|
836
873
|
}
|
|
837
874
|
if (m(n)) {
|
|
838
875
|
for (const a of ["$state", "$bindState"])
|
|
839
|
-
Object.hasOwn(n, a) && $(e,
|
|
876
|
+
Object.hasOwn(n, a) && $(e, o, n[a], s + u(a), { mustExist: !0 });
|
|
840
877
|
for (const a of ["$item", "$bindItem", "$index"])
|
|
841
878
|
Object.hasOwn(n, a) && !i && e.issues.error({
|
|
842
879
|
code: "item_outside_repeat",
|
|
843
880
|
path: s + u(a),
|
|
844
|
-
elementKey:
|
|
881
|
+
elementKey: o,
|
|
845
882
|
message: `${a} only works inside an element with "repeat" or its descendants.`,
|
|
846
883
|
hint: 'Add "repeat": {"statePath": "/list"} to an ancestor, or read the value with $state.'
|
|
847
884
|
});
|
|
848
885
|
if (typeof n.$template == "string")
|
|
849
886
|
for (const a of n.$template.matchAll(/\$\{([^}]*)\}/g))
|
|
850
|
-
$(e,
|
|
851
|
-
typeof n.$computed == "string" &&
|
|
887
|
+
$(e, o, a[1], s + u("$template"), { mustExist: !0 });
|
|
888
|
+
typeof n.$computed == "string" && Xe(e, o, n, s);
|
|
852
889
|
for (const [a, r] of Object.entries(n))
|
|
853
|
-
["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(a) || S(e,
|
|
890
|
+
["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(a) || S(e, o, r, s + u(a), i);
|
|
854
891
|
}
|
|
855
892
|
}
|
|
856
|
-
function
|
|
893
|
+
function Xe(e, o, n, s) {
|
|
857
894
|
const i = n.$computed;
|
|
858
895
|
if (!e.functions)
|
|
859
896
|
e.issues.warn({
|
|
860
897
|
code: "unverified_function",
|
|
861
898
|
path: s + u("$computed"),
|
|
862
|
-
elementKey:
|
|
899
|
+
elementKey: o,
|
|
863
900
|
message: `$computed "${i}" must be registered by the host.`,
|
|
864
901
|
hint: `Pass the host function names with --functions ${i} to verify it.`
|
|
865
902
|
});
|
|
@@ -868,7 +905,7 @@ function Me(e, t, n, s) {
|
|
|
868
905
|
e.issues.error({
|
|
869
906
|
code: "unknown_function",
|
|
870
907
|
path: s + u("$computed"),
|
|
871
|
-
elementKey:
|
|
908
|
+
elementKey: o,
|
|
872
909
|
message: `$computed "${i}" is not a host function.`,
|
|
873
910
|
hint: `${r ? `Did you mean "${r}"? ` : ""}${v("Host functions", e.functions)}`
|
|
874
911
|
});
|
|
@@ -880,27 +917,27 @@ function Me(e, t, n, s) {
|
|
|
880
917
|
e.issues.error({
|
|
881
918
|
code: "missing_i18n_key",
|
|
882
919
|
path: s + u("args", "key"),
|
|
883
|
-
elementKey:
|
|
920
|
+
elementKey: o,
|
|
884
921
|
message: `Message key ${JSON.stringify(a)} is not in the message catalog.`,
|
|
885
922
|
hint: r ? `Did you mean "${r}"? Otherwise add the key to every locale.` : "Add the key to every locale, or use an existing key."
|
|
886
923
|
});
|
|
887
924
|
}
|
|
888
925
|
}
|
|
889
|
-
const
|
|
890
|
-
function
|
|
891
|
-
const i = (...c) => u("elements",
|
|
892
|
-
if (S(e,
|
|
893
|
-
for (const c of
|
|
926
|
+
const Ye = ["statePath", "clearStatePath"];
|
|
927
|
+
function Qe(e, o, n, s) {
|
|
928
|
+
const i = (...c) => u("elements", o, ...c);
|
|
929
|
+
if (S(e, o, n.props, i("props"), s), e.messageKeys && m(n.props))
|
|
930
|
+
for (const c of Ve) {
|
|
894
931
|
const l = n.props[c];
|
|
895
932
|
typeof l == "string" && l.trim() && e.issues.warn({
|
|
896
933
|
code: "literal_text",
|
|
897
934
|
path: i("props", c),
|
|
898
|
-
elementKey:
|
|
935
|
+
elementKey: o,
|
|
899
936
|
message: `Literal text ${JSON.stringify(l)} is not localized.`,
|
|
900
937
|
hint: 'Use {"$computed": "t", "args": {"key": "<message key>"}}.'
|
|
901
938
|
});
|
|
902
939
|
}
|
|
903
|
-
n.visible !== void 0 && S(e,
|
|
940
|
+
n.visible !== void 0 && S(e, o, n.visible, i("visible"), s), m(n.repeat) && $(e, o, n.repeat.statePath, i("repeat", "statePath"), { mustExist: !0 });
|
|
904
941
|
const a = typeof n.type == "string" ? n.type : "", r = e.components[a]?.events ?? [];
|
|
905
942
|
if (m(n.on))
|
|
906
943
|
for (const [c, l] of Object.entries(n.on)) {
|
|
@@ -909,22 +946,22 @@ function He(e, t, n, s) {
|
|
|
909
946
|
e.issues.error({
|
|
910
947
|
code: "unknown_event",
|
|
911
948
|
path: i("on", c),
|
|
912
|
-
elementKey:
|
|
949
|
+
elementKey: o,
|
|
913
950
|
message: `${a} does not emit "${c}".`,
|
|
914
951
|
hint: p ? `Did you mean "${p}"?` : r.length ? v(`${a} events`, r) : `${a} emits no events.`
|
|
915
952
|
});
|
|
916
953
|
}
|
|
917
|
-
|
|
954
|
+
D(e, o, l, i("on", c), s);
|
|
918
955
|
}
|
|
919
956
|
if (m(n.watch))
|
|
920
957
|
for (const [c, l] of Object.entries(n.watch))
|
|
921
|
-
$(e,
|
|
958
|
+
$(e, o, c, i("watch", c), { mustExist: !1 }), D(e, o, l, i("watch", c), s);
|
|
922
959
|
}
|
|
923
|
-
function
|
|
960
|
+
function D(e, o, n, s, i) {
|
|
924
961
|
(Array.isArray(n) ? n : [n]).forEach((r, c) => {
|
|
925
962
|
const l = Array.isArray(n) ? s + u(c) : s;
|
|
926
963
|
if (!m(r) || typeof r.action != "string") {
|
|
927
|
-
e.issues.error({ code: "invalid_action_binding", path: l, elementKey:
|
|
964
|
+
e.issues.error({ code: "invalid_action_binding", path: l, elementKey: o, message: 'An action binding is {"action": "<name>", "params": {...}}.' });
|
|
928
965
|
return;
|
|
929
966
|
}
|
|
930
967
|
if (!e.actions.includes(r.action)) {
|
|
@@ -932,27 +969,27 @@ function L(e, t, n, s, i) {
|
|
|
932
969
|
e.issues.error({
|
|
933
970
|
code: "unknown_action",
|
|
934
971
|
path: l + u("action"),
|
|
935
|
-
elementKey:
|
|
972
|
+
elementKey: o,
|
|
936
973
|
message: `Action "${r.action}" is not declared.`,
|
|
937
974
|
hint: `${p ? `Did you mean "${p}"? ` : ""}Declare it in the app catalog, or pass host handlers with --actions ${r.action}. ${v("Known actions", e.actions)}`
|
|
938
975
|
});
|
|
939
976
|
}
|
|
940
977
|
if (m(r.params)) {
|
|
941
|
-
for (const p of
|
|
942
|
-
Object.hasOwn(r.params, p) && $(e,
|
|
943
|
-
S(e,
|
|
978
|
+
for (const p of Ye)
|
|
979
|
+
Object.hasOwn(r.params, p) && $(e, o, r.params[p], l + u("params", p), { mustExist: !1 });
|
|
980
|
+
S(e, o, r.params, l + u("params"), i);
|
|
944
981
|
}
|
|
945
982
|
});
|
|
946
983
|
}
|
|
947
|
-
function
|
|
984
|
+
function T(e) {
|
|
948
985
|
return { valid: e.errors.length === 0, errors: e.errors, warnings: e.warnings };
|
|
949
986
|
}
|
|
950
|
-
const
|
|
951
|
-
function
|
|
952
|
-
const
|
|
953
|
-
return delete
|
|
987
|
+
const x = V;
|
|
988
|
+
function Ze(e) {
|
|
989
|
+
const o = t.toJSONSchema(e);
|
|
990
|
+
return delete o.$schema, o;
|
|
954
991
|
}
|
|
955
|
-
function
|
|
992
|
+
function et(e) {
|
|
956
993
|
if (Array.isArray(e.enum)) return e.enum[0];
|
|
957
994
|
switch (e.type) {
|
|
958
995
|
case "string":
|
|
@@ -968,42 +1005,42 @@ function Xe(e) {
|
|
|
968
1005
|
return {};
|
|
969
1006
|
}
|
|
970
1007
|
}
|
|
971
|
-
function
|
|
972
|
-
return Object.entries(
|
|
1008
|
+
function ht() {
|
|
1009
|
+
return Object.entries(x).map(([e, o]) => ({
|
|
973
1010
|
name: e,
|
|
974
|
-
description:
|
|
975
|
-
required: Object.entries(P(
|
|
976
|
-
slots:
|
|
977
|
-
events:
|
|
1011
|
+
description: o.description,
|
|
1012
|
+
required: Object.entries(P(o) ?? {}).filter(([, n]) => !R(n)).map(([n]) => n),
|
|
1013
|
+
slots: o.slots ?? [],
|
|
1014
|
+
events: o.events ?? []
|
|
978
1015
|
}));
|
|
979
1016
|
}
|
|
980
|
-
function
|
|
981
|
-
return y(e, Object.keys(
|
|
1017
|
+
function ft(e) {
|
|
1018
|
+
return y(e, Object.keys(x));
|
|
982
1019
|
}
|
|
983
|
-
function
|
|
984
|
-
if (!Object.hasOwn(
|
|
985
|
-
const
|
|
1020
|
+
function gt(e) {
|
|
1021
|
+
if (!Object.hasOwn(x, e)) return;
|
|
1022
|
+
const o = x[e], n = Object.fromEntries(Object.entries(P(o) ?? {}).map(([s, i]) => [
|
|
986
1023
|
s,
|
|
987
|
-
{ required: !
|
|
1024
|
+
{ required: !R(i), schema: Ze(i) }
|
|
988
1025
|
]));
|
|
989
1026
|
return {
|
|
990
1027
|
name: e,
|
|
991
|
-
description:
|
|
1028
|
+
description: o.description,
|
|
992
1029
|
props: n,
|
|
993
|
-
slots:
|
|
994
|
-
events:
|
|
1030
|
+
slots: o.slots ?? [],
|
|
1031
|
+
events: o.events ?? [],
|
|
995
1032
|
example: {
|
|
996
1033
|
type: e,
|
|
997
|
-
props: Object.fromEntries(Object.entries(n).filter(([, s]) => s.required).map(([s, { schema: i }]) => [s,
|
|
1034
|
+
props: Object.fromEntries(Object.entries(n).filter(([, s]) => s.required).map(([s, { schema: i }]) => [s, et(i)])),
|
|
998
1035
|
children: []
|
|
999
1036
|
}
|
|
1000
1037
|
};
|
|
1001
1038
|
}
|
|
1002
|
-
const
|
|
1039
|
+
const O = { type: "string", pattern: "^/" }, tt = {
|
|
1003
1040
|
description: "A json-render expression resolved at render time.",
|
|
1004
1041
|
anyOf: [
|
|
1005
|
-
{ type: "object", required: ["$state"], properties: { $state:
|
|
1006
|
-
{ type: "object", required: ["$bindState"], properties: { $bindState:
|
|
1042
|
+
{ type: "object", required: ["$state"], properties: { $state: O } },
|
|
1043
|
+
{ type: "object", required: ["$bindState"], properties: { $bindState: O } },
|
|
1007
1044
|
{ type: "object", required: ["$item"], properties: { $item: { type: "string" } } },
|
|
1008
1045
|
{ type: "object", required: ["$bindItem"], properties: { $bindItem: { type: "string" } } },
|
|
1009
1046
|
{ type: "object", required: ["$index"], properties: { $index: { const: !0 } } },
|
|
@@ -1011,7 +1048,7 @@ const x = { type: "string", pattern: "^/" }, Ye = {
|
|
|
1011
1048
|
{ type: "object", required: ["$computed"], properties: { $computed: { type: "string" }, args: { type: "object" } } },
|
|
1012
1049
|
{ type: "object", required: ["$cond", "$then", "$else"], properties: { $cond: {}, $then: {}, $else: {} } }
|
|
1013
1050
|
]
|
|
1014
|
-
},
|
|
1051
|
+
}, ot = {
|
|
1015
1052
|
type: "object",
|
|
1016
1053
|
required: ["action"],
|
|
1017
1054
|
properties: {
|
|
@@ -1023,21 +1060,21 @@ const x = { type: "string", pattern: "^/" }, Ye = {
|
|
|
1023
1060
|
preventDefault: { type: "boolean" }
|
|
1024
1061
|
},
|
|
1025
1062
|
additionalProperties: !1
|
|
1026
|
-
},
|
|
1027
|
-
function
|
|
1063
|
+
}, E = { anyOf: [{ $ref: "#/$defs/actionBinding" }, { type: "array", items: { $ref: "#/$defs/actionBinding" } }] }, N = { type: "array", items: { type: "string" } };
|
|
1064
|
+
function nt(e, o, n) {
|
|
1028
1065
|
const s = (r) => Array.isArray(r) ? r.map(s) : !r || typeof r != "object" ? r : Object.fromEntries(Object.entries(r).map(([c, l]) => [
|
|
1029
1066
|
c,
|
|
1030
|
-
c === "$ref" && typeof l == "string" ? l.replace("#/$defs/", `#/$defs/${
|
|
1067
|
+
c === "$ref" && typeof l == "string" ? l.replace("#/$defs/", `#/$defs/${o}`) : s(l)
|
|
1031
1068
|
])), { $defs: i, ...a } = e;
|
|
1032
1069
|
delete a.$schema;
|
|
1033
|
-
for (const [r, c] of Object.entries(i ?? {})) n[
|
|
1070
|
+
for (const [r, c] of Object.entries(i ?? {})) n[o + r] = s(c);
|
|
1034
1071
|
return s(a);
|
|
1035
1072
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const s = P(
|
|
1073
|
+
function it(e, o, n) {
|
|
1074
|
+
const s = P(o), i = o.slots ?? [];
|
|
1038
1075
|
let a = { type: "object" };
|
|
1039
1076
|
if (s) {
|
|
1040
|
-
const r =
|
|
1077
|
+
const r = nt(t.toJSONSchema(t.object(s)), `${e}__`, n), c = r.properties;
|
|
1041
1078
|
a = {
|
|
1042
1079
|
...r,
|
|
1043
1080
|
properties: Object.fromEntries(Object.entries(c).map(([l, p]) => [
|
|
@@ -1049,30 +1086,30 @@ function et(e, t, n) {
|
|
|
1049
1086
|
return {
|
|
1050
1087
|
if: { properties: { type: { const: e } } },
|
|
1051
1088
|
then: {
|
|
1052
|
-
...
|
|
1089
|
+
...o.description ? { description: o.description } : {},
|
|
1053
1090
|
properties: {
|
|
1054
1091
|
props: a,
|
|
1055
1092
|
...i.includes("default") ? {} : { children: { maxItems: 0 } },
|
|
1056
1093
|
slots: { propertyNames: { enum: i.filter((r) => r !== "default") } },
|
|
1057
|
-
on: { propertyNames: { enum:
|
|
1094
|
+
on: { propertyNames: { enum: o.events ?? [] } }
|
|
1058
1095
|
}
|
|
1059
1096
|
}
|
|
1060
1097
|
};
|
|
1061
1098
|
}
|
|
1062
|
-
function
|
|
1063
|
-
const
|
|
1099
|
+
function bt(e = A) {
|
|
1100
|
+
const o = e.data.components, n = { expression: tt, actionBinding: ot }, s = Object.entries(o).map(([i, a]) => it(i, a, n));
|
|
1064
1101
|
return n.element = {
|
|
1065
1102
|
type: "object",
|
|
1066
1103
|
required: ["type", "props"],
|
|
1067
1104
|
properties: {
|
|
1068
|
-
type: { enum: Object.keys(
|
|
1105
|
+
type: { enum: Object.keys(o) },
|
|
1069
1106
|
props: { type: "object" },
|
|
1070
|
-
children:
|
|
1071
|
-
slots: { type: "object", additionalProperties:
|
|
1107
|
+
children: N,
|
|
1108
|
+
slots: { type: "object", additionalProperties: N },
|
|
1072
1109
|
visible: {},
|
|
1073
|
-
on: { type: "object", additionalProperties:
|
|
1074
|
-
watch: { type: "object", propertyNames:
|
|
1075
|
-
repeat: { type: "object", required: ["statePath"], properties: { statePath:
|
|
1110
|
+
on: { type: "object", additionalProperties: E },
|
|
1111
|
+
watch: { type: "object", propertyNames: O, additionalProperties: E },
|
|
1112
|
+
repeat: { type: "object", required: ["statePath"], properties: { statePath: O, key: { type: "string" } }, additionalProperties: !1 }
|
|
1076
1113
|
},
|
|
1077
1114
|
additionalProperties: !1,
|
|
1078
1115
|
allOf: s
|
|
@@ -1091,30 +1128,30 @@ function mt(e = A) {
|
|
|
1091
1128
|
};
|
|
1092
1129
|
}
|
|
1093
1130
|
export {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1131
|
+
Ot as ActionProvider,
|
|
1132
|
+
At as JSONUIProvider,
|
|
1133
|
+
Pt as Renderer,
|
|
1134
|
+
kt as StateProvider,
|
|
1135
|
+
ut as SynoJsonRenderer,
|
|
1136
|
+
Ct as ValidationProvider,
|
|
1137
|
+
It as VisibilityProvider,
|
|
1138
|
+
ft as closestSynoJsonComponent,
|
|
1139
|
+
St as createStateStore,
|
|
1140
|
+
jt as defineCatalog,
|
|
1141
|
+
Rt as defineRegistry,
|
|
1142
|
+
gt as describeSynoJsonComponent,
|
|
1143
|
+
Tt as jsonRenderVueSchema,
|
|
1144
|
+
ht as listSynoJsonComponents,
|
|
1145
|
+
pt as synoJsonAiPrompt,
|
|
1146
|
+
Ke as synoJsonAiRules,
|
|
1110
1147
|
A as synoJsonCatalog,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1148
|
+
V as synoJsonComponentDefinitions,
|
|
1149
|
+
U as synoJsonRegistry,
|
|
1150
|
+
Je as synoJsonRenderers,
|
|
1151
|
+
bt as synoJsonSchema,
|
|
1152
|
+
Kt as useActions,
|
|
1153
|
+
Lt as useBoundProp,
|
|
1154
|
+
Ut as useStateStore,
|
|
1155
|
+
mt as validateSynoJsonSpec,
|
|
1156
|
+
vt as z
|
|
1120
1157
|
};
|