@synopackageland/ui 0.12.5 → 0.13.1
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 +36 -0
- package/README.md +25 -0
- package/dist/components/advanced-panel/AdvancePanelGrid.vue.d.ts +5 -5
- package/dist/components/app/app-layout/AppLayout.vue.d.ts +8 -1
- package/dist/components/app/app-sidebar/AppTopNavItems.vue.d.ts +12 -0
- package/dist/components/composite/about-dialog/AboutDialog.vue.d.ts +5 -4
- package/dist/components/composite/about-dialog/types.d.ts +3 -2
- package/dist/components/composite/connection-topology/ConnectionTopology.vue.d.ts +3 -0
- package/dist/components/composite/data-grid/DataGrid.vue.d.ts +1 -1
- package/dist/components/composite/data-table/DataTable.vue.d.ts +6 -3
- package/dist/components/composite/overflow-toolbar/overflow.d.ts +3 -1
- package/dist/components/composite/scroll-edges/ScrollEdges.vue.d.ts +8 -1
- package/dist/components/composite/tree-view/TreeView.vue.d.ts +7 -5
- package/dist/components/composite/virtual-list/VirtualList.vue.d.ts +2 -0
- package/dist/components/containers/card-grid/cardGrid.d.ts +2 -2
- package/dist/components/containers/expandable-item/ExpandableItem.vue.d.ts +7 -7
- package/dist/components/primitives/color-picker/ColorPicker.vue.d.ts +4 -4
- package/dist/components/primitives/context-menu/ContextMenu.vue.d.ts +2 -2
- package/dist/components/primitives/context-menu/ContextMenuItems.vue.d.ts +5 -1
- package/dist/components/primitives/dropdown-menu/DropdownMenu.vue.d.ts +3 -0
- package/dist/components/primitives/dropdown-menu/DropdownMenuItems.vue.d.ts +3 -0
- package/dist/components/primitives/pagination/Pagination.vue.d.ts +3 -0
- package/dist/components/primitives/segment-control/SegmentItem.vue.d.ts +1 -1
- package/dist/components/primitives/spinner/Spinner.vue.d.ts +3 -0
- package/dist/components/primitives/tooltip/OverflowTooltip.vue.d.ts +3 -0
- package/dist/components/primitives/tooltip/Tooltip.vue.d.ts +5 -2
- package/dist/components/primitives/tooltip/tooltipStyle.d.ts +1 -1
- package/dist/components/primitives/typography/TypoHeader.vue.d.ts +3 -0
- package/dist/composables/formControl.d.ts +1 -0
- package/dist/composables/scrollEdges.d.ts +8 -4
- package/dist/i18n/text.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18248 -22043
- package/dist/json/catalog.d.ts +18 -10
- package/dist/json/registry.d.ts +306 -170
- package/dist/json-ai-prompt.md +1 -1
- package/dist/json-catalog.schema.json +15 -1
- package/dist/json-preview/preview.js +11770 -10312
- package/dist/json.js +319 -335
- package/dist/lib/adaptiveLayout.d.ts +4 -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/adaptive-layout.md +5 -0
- package/docs/json-ui.md +2 -0
- package/docs/theme-hooks.md +142 -0
- package/package.json +3 -2
package/dist/json.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
import { z as
|
|
3
|
-
import { defineCatalog as
|
|
4
|
-
import { createStateStore as
|
|
5
|
-
import { defineRegistry as
|
|
6
|
-
import { ActionProvider as
|
|
7
|
-
import { schema as
|
|
8
|
-
import { schema as
|
|
9
|
-
import { h as d, defineComponent as
|
|
10
|
-
import { LoadingArea as
|
|
2
|
+
import { z as vt } from "zod";
|
|
3
|
+
import { defineCatalog as F } from "@json-render/core";
|
|
4
|
+
import { createStateStore as $t, defineCatalog as jt } from "@json-render/core";
|
|
5
|
+
import { defineRegistry as M, useBoundProp as b, JSONUIProvider as W, Renderer as B } from "@json-render/vue";
|
|
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 Dt } from "@json-render/vue";
|
|
7
|
+
import { schema as H } from "@json-render/vue/schema";
|
|
8
|
+
import { schema as Nt } from "@json-render/vue/schema";
|
|
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, InputGroup as te, ListItem as oe, CellStatus as ne, CellText as ie, DataTable as K, Dialog as ae, Badge as se, 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 Se, SectionTabs as $e, 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
11
|
const J = t.lazy(() => t.object({
|
|
12
12
|
key: t.string(),
|
|
13
13
|
label: t.string(),
|
|
@@ -16,20 +16,20 @@ const J = t.lazy(() => t.object({
|
|
|
16
16
|
disabled: t.boolean().optional(),
|
|
17
17
|
selectable: t.boolean().optional(),
|
|
18
18
|
children: t.array(J).optional()
|
|
19
|
-
})),
|
|
19
|
+
})), k = t.object({
|
|
20
20
|
label: t.string(),
|
|
21
21
|
value: t.string(),
|
|
22
22
|
disabled: t.boolean().optional()
|
|
23
|
-
}),
|
|
23
|
+
}), Re = k.extend({
|
|
24
24
|
description: t.string().optional()
|
|
25
|
-
}),
|
|
25
|
+
}), L = t.object({
|
|
26
26
|
key: t.string(),
|
|
27
27
|
label: t.string(),
|
|
28
28
|
width: t.string().optional(),
|
|
29
29
|
/** Sets the alignment: DSM keeps every column left; number and date digits get one width. */
|
|
30
30
|
type: t.enum(["text", "number", "date", "actions"]).optional(),
|
|
31
31
|
align: t.enum(["left", "center", "right"]).optional()
|
|
32
|
-
}),
|
|
32
|
+
}), V = {
|
|
33
33
|
AppRoot: {
|
|
34
34
|
props: t.object({
|
|
35
35
|
modalScope: t.enum(["document", "app"]).optional()
|
|
@@ -42,10 +42,11 @@ const J = t.lazy(() => t.object({
|
|
|
42
42
|
sidebarWidth: t.string().optional(),
|
|
43
43
|
minHeight: t.string().optional(),
|
|
44
44
|
responsive: t.boolean().optional(),
|
|
45
|
-
wideLayout: t.enum(["window", "web"]).optional()
|
|
45
|
+
wideLayout: t.enum(["window", "web"]).optional(),
|
|
46
|
+
navigation: t.enum(["sidebar", "top"]).optional()
|
|
46
47
|
}),
|
|
47
48
|
slots: ["default", "sidebar", "toolbar", "footer"],
|
|
48
|
-
description:
|
|
49
|
+
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. navigation "top" shows the sidebar slot's SidebarNav as one bar above the page (phones keep the drawer).`
|
|
49
50
|
},
|
|
50
51
|
ResponsiveView: {
|
|
51
52
|
props: t.object({ mode: t.enum(["auto", "mobile", "window", "web"]).optional() }),
|
|
@@ -90,7 +91,7 @@ const J = t.lazy(() => t.object({
|
|
|
90
91
|
Tabs: {
|
|
91
92
|
props: t.object({
|
|
92
93
|
value: t.string(),
|
|
93
|
-
items: t.array(
|
|
94
|
+
items: t.array(k),
|
|
94
95
|
ariaLabel: t.string().optional()
|
|
95
96
|
}),
|
|
96
97
|
events: ["change"],
|
|
@@ -143,7 +144,7 @@ const J = t.lazy(() => t.object({
|
|
|
143
144
|
Select: {
|
|
144
145
|
props: t.object({
|
|
145
146
|
value: t.string().optional(),
|
|
146
|
-
options: t.array(
|
|
147
|
+
options: t.array(k),
|
|
147
148
|
placeholder: t.string().optional(),
|
|
148
149
|
disabled: t.boolean().optional(),
|
|
149
150
|
search: t.boolean().optional()
|
|
@@ -173,7 +174,7 @@ const J = t.lazy(() => t.object({
|
|
|
173
174
|
RadioGroup: {
|
|
174
175
|
props: t.object({
|
|
175
176
|
value: t.string().optional(),
|
|
176
|
-
options: t.array(
|
|
177
|
+
options: t.array(Re),
|
|
177
178
|
orientation: t.enum(["vertical", "horizontal"]).optional(),
|
|
178
179
|
disabled: t.boolean().optional()
|
|
179
180
|
}),
|
|
@@ -295,7 +296,7 @@ const J = t.lazy(() => t.object({
|
|
|
295
296
|
},
|
|
296
297
|
DataTable: {
|
|
297
298
|
props: t.object({
|
|
298
|
-
columns: t.array(
|
|
299
|
+
columns: t.array(L),
|
|
299
300
|
rows: t.array(t.record(t.string(), t.unknown())),
|
|
300
301
|
rowKey: t.string().optional(),
|
|
301
302
|
emptyText: t.string().optional(),
|
|
@@ -306,7 +307,7 @@ const J = t.lazy(() => t.object({
|
|
|
306
307
|
},
|
|
307
308
|
ResourceList: {
|
|
308
309
|
props: t.object({
|
|
309
|
-
columns: t.array(
|
|
310
|
+
columns: t.array(L),
|
|
310
311
|
rows: t.array(t.record(t.string(), t.unknown())),
|
|
311
312
|
rowKey: t.string().optional(),
|
|
312
313
|
emptyText: t.string().optional(),
|
|
@@ -355,10 +356,10 @@ const J = t.lazy(() => t.object({
|
|
|
355
356
|
props: t.object({ text: t.string().optional() }),
|
|
356
357
|
description: "Centered loading state for a page or bounded region."
|
|
357
358
|
}
|
|
358
|
-
},
|
|
359
|
-
components:
|
|
359
|
+
}, A = F(H, {
|
|
360
|
+
components: V,
|
|
360
361
|
actions: {}
|
|
361
|
-
}),
|
|
362
|
+
}), Ke = [
|
|
362
363
|
"Prefer AppRoot > AppShell > Page as the normal DSM application hierarchy.",
|
|
363
364
|
"Prefer SettingsSection and SettingsField for settings; prefer ResourceList/DataTable for ordinary scalar resource collections.",
|
|
364
365
|
"Keep state in the spec and use $bindState/$bindItem for editable controls; do not invent JavaScript in props.",
|
|
@@ -367,69 +368,70 @@ const J = t.lazy(() => t.object({
|
|
|
367
368
|
"AppShell adapts to its actual DSM window width: phone (<=600px), desktop window (601–1199px), and wide web/Portal (>=1200px). Never assume browser viewport width.",
|
|
368
369
|
"For a phone-unfriendly custom view, use ResponsiveView slots: mobile alternative and default full view. Keep essential actions accessible on mobile.",
|
|
369
370
|
"Use low-level Stack/Text only when a semantic component does not already express the layout."
|
|
370
|
-
],
|
|
371
|
-
function
|
|
372
|
-
return `${
|
|
371
|
+
], 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.';
|
|
372
|
+
function pt() {
|
|
373
|
+
return `${A.prompt({ customRules: Ke })}
|
|
373
374
|
|
|
374
|
-
${
|
|
375
|
+
${Le}
|
|
375
376
|
`;
|
|
376
377
|
}
|
|
377
|
-
const
|
|
378
|
+
const De = {
|
|
378
379
|
none: "0",
|
|
379
380
|
xs: "var(--ui-space-1)",
|
|
380
381
|
sm: "var(--ui-space-2)",
|
|
381
382
|
md: "var(--ui-space-3)",
|
|
382
383
|
lg: "var(--ui-space-4)"
|
|
383
|
-
},
|
|
384
|
-
function
|
|
384
|
+
}, Ue = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch" }, Ne = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
385
|
+
function Te(e) {
|
|
385
386
|
return { default: () => e };
|
|
386
387
|
}
|
|
387
|
-
function
|
|
388
|
-
return e ?
|
|
388
|
+
function C(e) {
|
|
389
|
+
return e ? Ie(e) : void 0;
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
+
function _(e) {
|
|
391
392
|
return {
|
|
392
393
|
...e,
|
|
393
|
-
icon:
|
|
394
|
-
children: e.children?.map(
|
|
394
|
+
icon: C(e.icon),
|
|
395
|
+
children: e.children?.map(_)
|
|
395
396
|
};
|
|
396
397
|
}
|
|
397
|
-
function
|
|
398
|
-
return e.map((o) => ({ ...o, items: o.items.map(
|
|
398
|
+
function Ee(e) {
|
|
399
|
+
return e.map((o) => ({ ...o, items: o.items.map(_) }));
|
|
399
400
|
}
|
|
400
401
|
const Je = {
|
|
401
|
-
AppRoot: ({ props: e, slots: o }) => d(
|
|
402
|
-
AppShell: ({ props: e, slots: o }) => d(
|
|
402
|
+
AppRoot: ({ props: e, slots: o }) => d(Ce, { modalScope: e.modalScope }, o),
|
|
403
|
+
AppShell: ({ props: e, slots: o }) => d(ke, {
|
|
403
404
|
sidebarWidth: e.sidebarWidth,
|
|
404
405
|
minHeight: e.minHeight,
|
|
405
406
|
responsive: e.responsive,
|
|
406
|
-
wideLayout: e.wideLayout
|
|
407
|
+
wideLayout: e.wideLayout,
|
|
408
|
+
navigation: e.navigation
|
|
407
409
|
}, o),
|
|
408
|
-
ResponsiveView: ({ props: e, slots: o }) => d(
|
|
409
|
-
Page: ({ props: e, slots: o }) => d(
|
|
410
|
-
PageHeader: ({ props: e, slots: o }) => d(
|
|
411
|
-
Toolbar: ({ props: e, slots: o }) => d(
|
|
410
|
+
ResponsiveView: ({ props: e, slots: o }) => d(Pe, { mode: e.mode }, o),
|
|
411
|
+
Page: ({ props: e, slots: o }) => d(Ae, { width: e.width ?? "fill", surface: e.surface }, o),
|
|
412
|
+
PageHeader: ({ props: e, slots: o }) => d(Oe, e, o),
|
|
413
|
+
Toolbar: ({ props: e, slots: o }) => d(xe, e, o),
|
|
412
414
|
SidebarNav: ({ props: e, bindings: o, emit: n }) => {
|
|
413
|
-
const [
|
|
414
|
-
return d(
|
|
415
|
-
modelValue:
|
|
416
|
-
groups:
|
|
415
|
+
const [a, i] = b(e.value, o?.value);
|
|
416
|
+
return d(je, {
|
|
417
|
+
modelValue: a,
|
|
418
|
+
groups: Ee(e.groups),
|
|
417
419
|
searchable: e.searchable,
|
|
418
420
|
collapsible: e.collapsible,
|
|
419
421
|
searchPlaceholder: e.searchPlaceholder,
|
|
420
|
-
"onUpdate:modelValue": (
|
|
421
|
-
i(
|
|
422
|
+
"onUpdate:modelValue": (s) => {
|
|
423
|
+
i(s), n("change");
|
|
422
424
|
}
|
|
423
425
|
});
|
|
424
426
|
},
|
|
425
427
|
Tabs: ({ props: e, bindings: o, emit: n }) => {
|
|
426
|
-
const [
|
|
427
|
-
return d(
|
|
428
|
-
modelValue:
|
|
428
|
+
const [a, i] = b(e.value, o?.value);
|
|
429
|
+
return d($e, {
|
|
430
|
+
modelValue: a ?? "",
|
|
429
431
|
items: e.items,
|
|
430
432
|
ariaLabel: e.ariaLabel,
|
|
431
|
-
"onUpdate:modelValue": (
|
|
432
|
-
i(
|
|
433
|
+
"onUpdate:modelValue": (s) => {
|
|
434
|
+
i(s), n("change");
|
|
433
435
|
}
|
|
434
436
|
});
|
|
435
437
|
},
|
|
@@ -438,9 +440,9 @@ const Je = {
|
|
|
438
440
|
style: {
|
|
439
441
|
display: "flex",
|
|
440
442
|
flexDirection: e.direction ?? "column",
|
|
441
|
-
gap:
|
|
442
|
-
alignItems:
|
|
443
|
-
justifyContent:
|
|
443
|
+
gap: De[e.gap ?? "md"],
|
|
444
|
+
alignItems: Ue[e.align ?? "stretch"],
|
|
445
|
+
justifyContent: Ne[e.justify ?? "start"],
|
|
444
446
|
flexWrap: e.wrap ? "wrap" : "nowrap"
|
|
445
447
|
}
|
|
446
448
|
}, o),
|
|
@@ -449,8 +451,8 @@ const Je = {
|
|
|
449
451
|
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);
|
|
450
452
|
},
|
|
451
453
|
Button: ({ props: e, emit: o }) => {
|
|
452
|
-
const n =
|
|
453
|
-
return d(
|
|
454
|
+
const n = C(e.icon);
|
|
455
|
+
return d(Se, {
|
|
454
456
|
variant: e.variant,
|
|
455
457
|
size: e.size,
|
|
456
458
|
disabled: e.disabled,
|
|
@@ -461,9 +463,9 @@ const Je = {
|
|
|
461
463
|
});
|
|
462
464
|
},
|
|
463
465
|
Input: ({ props: e, bindings: o, emit: n }) => {
|
|
464
|
-
const [
|
|
465
|
-
return d(
|
|
466
|
-
modelValue:
|
|
466
|
+
const [a, i] = b(e.value, o?.value);
|
|
467
|
+
return d(ve, {
|
|
468
|
+
modelValue: a,
|
|
467
469
|
type: e.type,
|
|
468
470
|
placeholder: e.placeholder,
|
|
469
471
|
disabled: e.disabled,
|
|
@@ -471,65 +473,65 @@ const Je = {
|
|
|
471
473
|
invalid: e.invalid,
|
|
472
474
|
size: e.size,
|
|
473
475
|
ariaLabel: e.ariaLabel,
|
|
474
|
-
"onUpdate:modelValue": (
|
|
475
|
-
i(e.type === "number" &&
|
|
476
|
+
"onUpdate:modelValue": (s) => {
|
|
477
|
+
i(e.type === "number" && s !== "" ? Number(s) : s), n("change");
|
|
476
478
|
}
|
|
477
479
|
});
|
|
478
480
|
},
|
|
479
481
|
Select: ({ props: e, bindings: o, emit: n }) => {
|
|
480
|
-
const [
|
|
481
|
-
return d(
|
|
482
|
-
modelValue:
|
|
482
|
+
const [a, i] = b(e.value, o?.value);
|
|
483
|
+
return d(we, {
|
|
484
|
+
modelValue: a,
|
|
483
485
|
options: e.options,
|
|
484
486
|
placeholder: e.placeholder,
|
|
485
487
|
disabled: e.disabled,
|
|
486
488
|
search: e.search,
|
|
487
|
-
"onUpdate:modelValue": (
|
|
488
|
-
i(
|
|
489
|
+
"onUpdate:modelValue": (s) => {
|
|
490
|
+
i(s), n("change");
|
|
489
491
|
}
|
|
490
492
|
});
|
|
491
493
|
},
|
|
492
494
|
Checkbox: ({ props: e, bindings: o, emit: n }) => {
|
|
493
|
-
const [
|
|
494
|
-
return d(
|
|
495
|
-
modelValue:
|
|
495
|
+
const [a, i] = b(e.checked, o?.checked);
|
|
496
|
+
return d(ye, {
|
|
497
|
+
modelValue: a ?? !1,
|
|
496
498
|
label: e.label,
|
|
497
499
|
description: e.description,
|
|
498
500
|
disabled: e.disabled,
|
|
499
|
-
"onUpdate:modelValue": (
|
|
500
|
-
i(
|
|
501
|
+
"onUpdate:modelValue": (s) => {
|
|
502
|
+
i(s), n("change");
|
|
501
503
|
}
|
|
502
504
|
});
|
|
503
505
|
},
|
|
504
506
|
Switch: ({ props: e, bindings: o, emit: n }) => {
|
|
505
|
-
const [
|
|
506
|
-
return d(
|
|
507
|
-
modelValue:
|
|
507
|
+
const [a, i] = b(e.checked, o?.checked);
|
|
508
|
+
return d(be, {
|
|
509
|
+
modelValue: a ?? !1,
|
|
508
510
|
label: e.label,
|
|
509
511
|
disabled: e.disabled,
|
|
510
|
-
"onUpdate:modelValue": (
|
|
511
|
-
i(
|
|
512
|
+
"onUpdate:modelValue": (s) => {
|
|
513
|
+
i(s), n("change");
|
|
512
514
|
}
|
|
513
515
|
});
|
|
514
516
|
},
|
|
515
517
|
RadioGroup: ({ props: e, bindings: o, emit: n }) => {
|
|
516
|
-
const [
|
|
517
|
-
return d(
|
|
518
|
-
modelValue:
|
|
518
|
+
const [a, i] = b(e.value, o?.value);
|
|
519
|
+
return d(ge, {
|
|
520
|
+
modelValue: a,
|
|
519
521
|
options: e.options,
|
|
520
522
|
orientation: e.orientation,
|
|
521
523
|
disabled: e.disabled,
|
|
522
|
-
"onUpdate:modelValue": (
|
|
523
|
-
i(
|
|
524
|
+
"onUpdate:modelValue": (s) => {
|
|
525
|
+
i(s), n("change");
|
|
524
526
|
}
|
|
525
527
|
});
|
|
526
528
|
},
|
|
527
|
-
Form: ({ props: e, slots: o, emit: n }) => d(
|
|
529
|
+
Form: ({ props: e, slots: o, emit: n }) => d(fe, {
|
|
528
530
|
direction: e.direction,
|
|
529
531
|
fieldWidth: e.fieldWidth,
|
|
530
532
|
onSubmit: () => n("submit")
|
|
531
533
|
}, o),
|
|
532
|
-
Field: ({ props: e, slots: o }) => d(
|
|
534
|
+
Field: ({ props: e, slots: o }) => d(he, {
|
|
533
535
|
label: e.label,
|
|
534
536
|
description: e.description,
|
|
535
537
|
help: e.help,
|
|
@@ -537,55 +539,55 @@ const Je = {
|
|
|
537
539
|
fieldWidth: e.fieldWidth,
|
|
538
540
|
direction: e.direction
|
|
539
541
|
}, o),
|
|
540
|
-
SettingsSection: ({ props: e, bindings: o, slots: n, emit:
|
|
541
|
-
const [i,
|
|
542
|
-
return d(
|
|
542
|
+
SettingsSection: ({ props: e, bindings: o, slots: n, emit: a }) => {
|
|
543
|
+
const [i, s] = b(e.open, o?.open);
|
|
544
|
+
return d(me, {
|
|
543
545
|
title: e.title,
|
|
544
546
|
collapsible: e.collapsible,
|
|
545
547
|
open: i,
|
|
546
548
|
"onUpdate:open": (r) => {
|
|
547
|
-
|
|
549
|
+
s(r), a("openChange");
|
|
548
550
|
}
|
|
549
551
|
}, n);
|
|
550
552
|
},
|
|
551
|
-
SettingsField: ({ props: e, slots: o }) => d(
|
|
553
|
+
SettingsField: ({ props: e, slots: o }) => d(ue, {
|
|
552
554
|
label: e.label,
|
|
553
555
|
description: e.description,
|
|
554
556
|
required: e.required,
|
|
555
557
|
fieldWidth: e.fieldWidth,
|
|
556
558
|
align: e.align
|
|
557
559
|
}, o),
|
|
558
|
-
Surface: ({ props: e, slots: o }) => d(
|
|
559
|
-
Card: ({ props: e, bindings: o, slots: n, emit:
|
|
560
|
-
const [i,
|
|
561
|
-
return d(
|
|
560
|
+
Surface: ({ props: e, slots: o }) => d(pe, e, o),
|
|
561
|
+
Card: ({ props: e, bindings: o, slots: n, emit: a }) => {
|
|
562
|
+
const [i, s] = b(e.expanded, o?.expanded);
|
|
563
|
+
return d(de, {
|
|
562
564
|
title: e.title,
|
|
563
565
|
layoutType: e.layoutType,
|
|
564
566
|
expandable: e.expandable,
|
|
565
567
|
expanded: i,
|
|
566
568
|
footerAlign: e.footerAlign,
|
|
567
569
|
"onUpdate:expanded": (r) => {
|
|
568
|
-
|
|
570
|
+
s(r), a("expandedChange");
|
|
569
571
|
}
|
|
570
572
|
}, n);
|
|
571
573
|
},
|
|
572
|
-
Callout: ({ props: e, slots: o, emit: n }) => d(
|
|
574
|
+
Callout: ({ props: e, slots: o, emit: n }) => d(ce, {
|
|
573
575
|
tone: e.tone,
|
|
574
576
|
title: e.title,
|
|
575
577
|
closable: e.closable,
|
|
576
578
|
code: e.code,
|
|
577
579
|
onClose: () => n("close")
|
|
578
580
|
}, o),
|
|
579
|
-
EmptyState: ({ props: e, slots: o }) => d(
|
|
581
|
+
EmptyState: ({ props: e, slots: o }) => d(le, {
|
|
580
582
|
title: e.title,
|
|
581
583
|
description: e.description,
|
|
582
|
-
icon:
|
|
584
|
+
icon: C(e.icon)
|
|
583
585
|
}, o),
|
|
584
|
-
Progress: ({ props: e }) => d(
|
|
585
|
-
Badge: ({ props: e }) => d(
|
|
586
|
-
Dialog: ({ props: e, bindings: o, slots: n, emit:
|
|
587
|
-
const [i,
|
|
588
|
-
return d(
|
|
586
|
+
Progress: ({ props: e }) => d(re, e),
|
|
587
|
+
Badge: ({ props: e }) => d(se, { tone: e.tone }, Te(e.text)),
|
|
588
|
+
Dialog: ({ props: e, bindings: o, slots: n, emit: a }) => {
|
|
589
|
+
const [i, s] = b(e.open, o?.open);
|
|
590
|
+
return d(ae, {
|
|
589
591
|
open: i ?? !1,
|
|
590
592
|
title: e.title,
|
|
591
593
|
description: e.description,
|
|
@@ -593,115 +595,97 @@ const Je = {
|
|
|
593
595
|
width: e.width,
|
|
594
596
|
showClose: e.showClose,
|
|
595
597
|
"onUpdate:open": (r) => {
|
|
596
|
-
|
|
598
|
+
s(r), a("openChange");
|
|
597
599
|
}
|
|
598
600
|
}, n);
|
|
599
601
|
},
|
|
600
|
-
DataTable: ({ props: e }) => d(
|
|
602
|
+
DataTable: ({ props: e }) => d(K, e),
|
|
601
603
|
ResourceList: ({ props: e, slots: o }) => d("section", { class: "min-w-0", "data-syno-pkg-land-ui": "", "data-ui-resource-list": "" }, [
|
|
602
604
|
o.toolbar ? d("div", { class: "mb-3 flex flex-wrap items-center gap-2" }, o.toolbar()) : null,
|
|
603
|
-
d(
|
|
605
|
+
d(K, e)
|
|
604
606
|
]),
|
|
605
|
-
CellText: ({ props: e, emit: o }) => d(
|
|
606
|
-
CellStatus: ({ props: e }) => d(
|
|
607
|
-
ListItem: ({ props: e, slots: o }) => d(
|
|
608
|
-
InputGroup: ({ slots: e }) => d(
|
|
609
|
-
Loading: ({ props: e }) => d(
|
|
610
|
-
}, { registry:
|
|
607
|
+
CellText: ({ props: e, emit: o }) => d(ie, { ...e, onOpen: () => o("open") }),
|
|
608
|
+
CellStatus: ({ props: e }) => d(ne, e),
|
|
609
|
+
ListItem: ({ props: e, slots: o }) => d(oe, e, o),
|
|
610
|
+
InputGroup: ({ slots: e }) => d(te, null, e),
|
|
611
|
+
Loading: ({ props: e }) => d(ee, { text: e.text })
|
|
612
|
+
}, { registry: D } = M(A, {
|
|
611
613
|
components: Je
|
|
612
|
-
}),
|
|
614
|
+
}), ut = /* @__PURE__ */ G({
|
|
613
615
|
__name: "SynoJsonRenderer",
|
|
614
616
|
props: {
|
|
615
|
-
spec: {
|
|
616
|
-
store: {
|
|
617
|
-
state: {
|
|
618
|
-
handlers: {
|
|
619
|
-
navigate: { type: Function
|
|
620
|
-
functions: {
|
|
621
|
-
directives: {
|
|
622
|
-
validationFunctions: {
|
|
623
|
-
onStateChange: { type: Function
|
|
624
|
-
loading: { type: Boolean
|
|
625
|
-
fallback: {
|
|
617
|
+
spec: {},
|
|
618
|
+
store: {},
|
|
619
|
+
state: {},
|
|
620
|
+
handlers: {},
|
|
621
|
+
navigate: { type: Function },
|
|
622
|
+
functions: {},
|
|
623
|
+
directives: {},
|
|
624
|
+
validationFunctions: {},
|
|
625
|
+
onStateChange: { type: Function },
|
|
626
|
+
loading: { type: Boolean },
|
|
627
|
+
fallback: {}
|
|
626
628
|
},
|
|
627
|
-
setup(e
|
|
628
|
-
o()
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
629
|
+
setup(e) {
|
|
630
|
+
return (o, n) => (X(), Y(j(W), {
|
|
631
|
+
registry: j(D),
|
|
632
|
+
store: e.store,
|
|
633
|
+
"initial-state": e.state ?? e.spec?.state ?? {},
|
|
634
|
+
handlers: e.handlers,
|
|
635
|
+
navigate: e.navigate,
|
|
636
|
+
functions: e.functions,
|
|
637
|
+
directives: e.directives,
|
|
638
|
+
"validation-functions": e.validationFunctions,
|
|
639
|
+
"on-state-change": e.onStateChange
|
|
640
|
+
}, {
|
|
641
|
+
default: Q(() => [
|
|
642
|
+
Z(j(B), {
|
|
643
|
+
spec: e.spec,
|
|
644
|
+
registry: j(D),
|
|
645
|
+
loading: e.loading,
|
|
646
|
+
fallback: e.fallback
|
|
647
|
+
}, null, 8, ["spec", "registry", "loading", "fallback"])
|
|
648
|
+
]),
|
|
649
|
+
_: 1
|
|
650
|
+
}, 8, ["registry", "store", "initial-state", "handlers", "navigate", "functions", "directives", "validation-functions", "on-state-change"]));
|
|
637
651
|
}
|
|
638
|
-
}),
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
n[s] = i;
|
|
642
|
-
return n;
|
|
643
|
-
};
|
|
644
|
-
function Ee(e, o, n, s, i, a) {
|
|
645
|
-
return H(), G(s.JSONUIProvider, {
|
|
646
|
-
registry: s.synoJsonRegistry,
|
|
647
|
-
store: n.store,
|
|
648
|
-
"initial-state": n.state ?? n.spec?.state ?? {},
|
|
649
|
-
handlers: n.handlers,
|
|
650
|
-
navigate: n.navigate,
|
|
651
|
-
functions: n.functions,
|
|
652
|
-
directives: n.directives,
|
|
653
|
-
"validation-functions": n.validationFunctions,
|
|
654
|
-
"on-state-change": n.onStateChange
|
|
655
|
-
}, {
|
|
656
|
-
default: X(() => [
|
|
657
|
-
Y(s.Renderer, {
|
|
658
|
-
spec: n.spec,
|
|
659
|
-
registry: s.synoJsonRegistry,
|
|
660
|
-
loading: n.loading,
|
|
661
|
-
fallback: n.fallback
|
|
662
|
-
}, null, 8, ["spec", "registry", "loading", "fallback"])
|
|
663
|
-
]),
|
|
664
|
-
_: 1
|
|
665
|
-
/* STABLE */
|
|
666
|
-
}, 8, ["registry", "store", "initial-state", "handlers", "navigate", "functions", "directives", "validation-functions", "on-state-change"]);
|
|
667
|
-
}
|
|
668
|
-
const ht = /* @__PURE__ */ Te(Ne, [["render", Ee], ["__file", "/private/tmp/ui-pub-0125/src/json/SynoJsonRenderer.vue"]]), Ve = ["label", "title", "description", "text", "placeholder", "emptyText", "help", "ariaLabel", "valueLabel", "searchPlaceholder"];
|
|
669
|
-
function T(e, o = "") {
|
|
670
|
-
return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, s]) => m(s) ? T(s, `${o}${n}.`) : [`${o}${n}`]);
|
|
652
|
+
}), Ve = ["label", "title", "description", "text", "placeholder", "emptyText", "help", "ariaLabel", "valueLabel", "searchPlaceholder"];
|
|
653
|
+
function z(e, o = "") {
|
|
654
|
+
return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, a]) => m(a) ? z(a, `${o}${n}.`) : [`${o}${n}`]);
|
|
671
655
|
}
|
|
672
656
|
const m = (e) => typeof e == "object" && e !== null && !Array.isArray(e), u = (...e) => e.map((o) => "/" + String(o).replaceAll("~", "~0").replaceAll("/", "~1")).join("");
|
|
673
|
-
function
|
|
674
|
-
const n = Array.from({ length: o.length + 1 }, (
|
|
675
|
-
for (let
|
|
657
|
+
function _e(e, o) {
|
|
658
|
+
const n = Array.from({ length: o.length + 1 }, (a, i) => i);
|
|
659
|
+
for (let a = 1; a <= e.length; a++) {
|
|
676
660
|
let i = n[0];
|
|
677
|
-
n[0] =
|
|
678
|
-
for (let
|
|
679
|
-
const r = n[
|
|
680
|
-
n[
|
|
661
|
+
n[0] = a;
|
|
662
|
+
for (let s = 1; s <= o.length; s++) {
|
|
663
|
+
const r = n[s];
|
|
664
|
+
n[s] = Math.min(n[s] + 1, n[s - 1] + 1, i + (e[a - 1].toLowerCase() === o[s - 1].toLowerCase() ? 0 : 1)), i = r;
|
|
681
665
|
}
|
|
682
666
|
}
|
|
683
667
|
return n[o.length];
|
|
684
668
|
}
|
|
685
669
|
function y(e, o) {
|
|
686
|
-
let n,
|
|
670
|
+
let n, a = 1 / 0;
|
|
687
671
|
for (const i of o) {
|
|
688
|
-
const
|
|
689
|
-
|
|
672
|
+
const s = _e(e, i);
|
|
673
|
+
s < a && ([n, a] = [i, s]);
|
|
690
674
|
}
|
|
691
|
-
return n !== void 0 &&
|
|
675
|
+
return n !== void 0 && a <= Math.max(2, Math.floor(e.length / 3)) ? n : void 0;
|
|
692
676
|
}
|
|
693
|
-
const
|
|
694
|
-
function
|
|
677
|
+
const ze = ["$state", "$item", "$index", "$bindState", "$bindItem", "$cond", "$computed", "$template"], qe = (e) => m(e) && ze.some((o) => Object.hasOwn(e, o)), I = (e) => qe(e) || (Array.isArray(e) ? e.some(I) : m(e) && Object.values(e).some(I));
|
|
678
|
+
function P(e) {
|
|
695
679
|
const o = e.props?.shape;
|
|
696
680
|
return m(o) ? o : void 0;
|
|
697
681
|
}
|
|
698
|
-
const
|
|
699
|
-
function
|
|
682
|
+
const R = (e) => e.safeParse(void 0).success;
|
|
683
|
+
function Fe(e) {
|
|
700
684
|
if (e.code === "invalid_value") return `Use one of: ${e.values.map((o) => JSON.stringify(o)).join(", ")}.`;
|
|
701
685
|
if (e.code === "invalid_type") return `Expected ${e.expected}.`;
|
|
702
686
|
}
|
|
703
687
|
const v = (e, o) => `${e}: ${o.join(", ")}`;
|
|
704
|
-
class
|
|
688
|
+
class Me {
|
|
705
689
|
errors = [];
|
|
706
690
|
warnings = [];
|
|
707
691
|
error(o) {
|
|
@@ -711,23 +695,23 @@ class Be {
|
|
|
711
695
|
this.warnings.push({ severity: "warning", ...o });
|
|
712
696
|
}
|
|
713
697
|
}
|
|
714
|
-
function
|
|
715
|
-
const n = o.catalog ??
|
|
698
|
+
function mt(e, o = {}) {
|
|
699
|
+
const n = o.catalog ?? A, a = n.data.components, i = new Me();
|
|
716
700
|
if (!m(e))
|
|
717
|
-
return i.error({ code: "invalid_spec", path: "", message: "A spec must be a JSON object.", hint: 'Return {"root": "<key>", "elements": {...}, "state": {...}}.' }),
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
const r = Object.keys(
|
|
721
|
-
typeof e.root != "string" || e.root === "" ? i.error({ code: "missing_root", path: "/root", message: '"root" must name the top element.', hint: r.length ? v('Set "root" to one of', r) : 'Add "root" and the element it names.' }) :
|
|
722
|
-
for (const [p, f] of Object.entries(
|
|
701
|
+
return i.error({ code: "invalid_spec", path: "", message: "A spec must be a JSON object.", hint: 'Return {"root": "<key>", "elements": {...}, "state": {...}}.' }), N(i);
|
|
702
|
+
const s = m(e.elements) ? e.elements : void 0;
|
|
703
|
+
s || 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": []}}}.' });
|
|
704
|
+
const r = Object.keys(s ?? {});
|
|
705
|
+
typeof e.root != "string" || e.root === "" ? i.error({ code: "missing_root", path: "/root", message: '"root" must name the top element.', hint: r.length ? v('Set "root" to one of', r) : 'Add "root" and the element it names.' }) : s && !Object.hasOwn(s, e.root) && i.error({ code: "root_not_found", path: "/root", message: `Root "${e.root}" is not in "elements".`, hint: v("Existing element keys", r) });
|
|
706
|
+
for (const [p, f] of Object.entries(s ?? {})) {
|
|
723
707
|
const w = (...g) => u("elements", p, ...g);
|
|
724
708
|
if (!m(f)) {
|
|
725
709
|
i.error({ code: "invalid_element", path: w(), elementKey: p, message: 'An element must be an object with "type", "props" and "children".' });
|
|
726
710
|
continue;
|
|
727
711
|
}
|
|
728
712
|
const h = f.type;
|
|
729
|
-
if (typeof h != "string" || !Object.hasOwn(
|
|
730
|
-
const g = typeof h == "string" ? y(h, Object.keys(
|
|
713
|
+
if (typeof h != "string" || !Object.hasOwn(a, h)) {
|
|
714
|
+
const g = typeof h == "string" ? y(h, Object.keys(a)) : void 0;
|
|
731
715
|
i.error({
|
|
732
716
|
code: "unknown_component",
|
|
733
717
|
path: w("type"),
|
|
@@ -737,11 +721,11 @@ function ft(e, o = {}) {
|
|
|
737
721
|
});
|
|
738
722
|
continue;
|
|
739
723
|
}
|
|
740
|
-
|
|
724
|
+
We(i, p, h, a[h], f.props), Be(i, p, h, a[h], f, s);
|
|
741
725
|
}
|
|
742
|
-
const c = o.messages &&
|
|
726
|
+
const c = o.messages && z(o.messages), l = {
|
|
743
727
|
issues: i,
|
|
744
|
-
components:
|
|
728
|
+
components: a,
|
|
745
729
|
actions: [
|
|
746
730
|
...(n.schema?.builtInActions ?? []).map((p) => p.name),
|
|
747
731
|
...Object.keys(n.data.actions ?? {}),
|
|
@@ -752,15 +736,15 @@ function ft(e, o = {}) {
|
|
|
752
736
|
functions: o.functions || c ? [...o.functions ?? [], ...c ? ["t"] : []] : void 0,
|
|
753
737
|
messageKeys: c
|
|
754
738
|
};
|
|
755
|
-
return
|
|
739
|
+
return s && typeof e.root == "string" && Object.hasOwn(s, e.root) && He(l, e.root, s), N(i);
|
|
756
740
|
}
|
|
757
|
-
function
|
|
758
|
-
const
|
|
741
|
+
function We(e, o, n, a, i) {
|
|
742
|
+
const s = (...l) => u("elements", o, "props", ...l);
|
|
759
743
|
if (!m(i)) {
|
|
760
|
-
e.error({ code: "invalid_props", path:
|
|
744
|
+
e.error({ code: "invalid_props", path: s(), elementKey: o, message: '"props" must be an object.', hint: 'Use "props": {} when the component needs none.' });
|
|
761
745
|
return;
|
|
762
746
|
}
|
|
763
|
-
const r =
|
|
747
|
+
const r = P(a);
|
|
764
748
|
if (!r) return;
|
|
765
749
|
const c = Object.keys(r);
|
|
766
750
|
for (const [l, p] of Object.entries(i)) {
|
|
@@ -769,41 +753,41 @@ function He(e, o, n, s, i) {
|
|
|
769
753
|
const h = y(l, c);
|
|
770
754
|
e.error({
|
|
771
755
|
code: "unknown_prop",
|
|
772
|
-
path:
|
|
756
|
+
path: s(l),
|
|
773
757
|
elementKey: o,
|
|
774
758
|
message: `${n} has no prop "${l}".`,
|
|
775
759
|
hint: h ? `Did you mean "${h}"? Run "syno-pkg-land-ui describe ${n}".` : v(`${n} props`, c)
|
|
776
760
|
});
|
|
777
761
|
continue;
|
|
778
762
|
}
|
|
779
|
-
if (
|
|
763
|
+
if (I(p)) continue;
|
|
780
764
|
const w = f.safeParse(p);
|
|
781
765
|
if (!w.success)
|
|
782
766
|
for (const h of w.error.issues)
|
|
783
767
|
e.error({
|
|
784
768
|
code: "invalid_prop",
|
|
785
|
-
path:
|
|
769
|
+
path: s(l, ...h.path.map((g) => String(g))),
|
|
786
770
|
elementKey: o,
|
|
787
771
|
message: `${n}.${l}: ${h.message}`,
|
|
788
|
-
hint:
|
|
772
|
+
hint: Fe(h)
|
|
789
773
|
});
|
|
790
774
|
}
|
|
791
775
|
for (const l of c)
|
|
792
|
-
!Object.hasOwn(i, l) && !
|
|
776
|
+
!Object.hasOwn(i, l) && !R(r[l]) && e.error({ code: "missing_prop", path: s(l), elementKey: o, message: `${n} requires prop "${l}".`, hint: `Run "syno-pkg-land-ui describe ${n}" for its type.` });
|
|
793
777
|
}
|
|
794
|
-
function
|
|
778
|
+
function q(e, o) {
|
|
795
779
|
const n = [];
|
|
796
|
-
if (Array.isArray(o.children) && o.children.forEach((
|
|
797
|
-
typeof
|
|
780
|
+
if (Array.isArray(o.children) && o.children.forEach((a, i) => {
|
|
781
|
+
typeof a == "string" && n.push({ child: a, path: u("elements", e, "children", i) });
|
|
798
782
|
}), m(o.slots))
|
|
799
|
-
for (const [
|
|
800
|
-
Array.isArray(i) && i.forEach((
|
|
801
|
-
typeof
|
|
783
|
+
for (const [a, i] of Object.entries(o.slots))
|
|
784
|
+
Array.isArray(i) && i.forEach((s, r) => {
|
|
785
|
+
typeof s == "string" && n.push({ child: s, path: u("elements", e, "slots", a, r) });
|
|
802
786
|
});
|
|
803
787
|
return n;
|
|
804
788
|
}
|
|
805
|
-
function
|
|
806
|
-
const r =
|
|
789
|
+
function Be(e, o, n, a, i, s) {
|
|
790
|
+
const r = a.slots ?? [], { children: c } = i;
|
|
807
791
|
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({
|
|
808
792
|
code: "children_not_allowed",
|
|
809
793
|
path: u("elements", o, "children"),
|
|
@@ -827,9 +811,9 @@ function Ge(e, o, n, s, i, a) {
|
|
|
827
811
|
hint: f ? `Did you mean "${f}"?` : r.length ? v(`${n} slots`, r) : `${n} has no slots.`
|
|
828
812
|
});
|
|
829
813
|
}
|
|
830
|
-
for (const l of
|
|
831
|
-
if (!Object.hasOwn(
|
|
832
|
-
const p = y(l.child, Object.keys(
|
|
814
|
+
for (const l of q(o, i))
|
|
815
|
+
if (!Object.hasOwn(s, l.child)) {
|
|
816
|
+
const p = y(l.child, Object.keys(s));
|
|
833
817
|
e.error({
|
|
834
818
|
code: "missing_child",
|
|
835
819
|
path: l.path,
|
|
@@ -839,87 +823,87 @@ function Ge(e, o, n, s, i, a) {
|
|
|
839
823
|
});
|
|
840
824
|
}
|
|
841
825
|
}
|
|
842
|
-
function
|
|
843
|
-
const { issues:
|
|
826
|
+
function He(e, o, n) {
|
|
827
|
+
const { issues: a } = e, i = /* @__PURE__ */ new Set(), s = (r, c, l, p) => {
|
|
844
828
|
const f = n[r];
|
|
845
829
|
if (!m(f)) return;
|
|
846
830
|
i.add(r);
|
|
847
831
|
const w = m(f.repeat);
|
|
848
|
-
|
|
832
|
+
Qe(e, r, f, p || w);
|
|
849
833
|
const h = f.type === "AppRoot";
|
|
850
|
-
h && l &&
|
|
851
|
-
for (const g of
|
|
834
|
+
h && l && a.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." });
|
|
835
|
+
for (const g of q(r, f))
|
|
852
836
|
if (Object.hasOwn(n, g.child)) {
|
|
853
837
|
if (c.includes(g.child)) {
|
|
854
|
-
|
|
838
|
+
a.error({ code: "cycle", path: g.path, elementKey: r, message: `"${g.child}" is its own ancestor.`, hint: "Element references must form a tree." });
|
|
855
839
|
continue;
|
|
856
840
|
}
|
|
857
|
-
|
|
841
|
+
s(g.child, [...c, g.child], l || h, p || w);
|
|
858
842
|
}
|
|
859
843
|
};
|
|
860
|
-
|
|
844
|
+
s(o, [o], !1, !1);
|
|
861
845
|
for (const r of Object.keys(n))
|
|
862
|
-
i.has(r) ||
|
|
846
|
+
i.has(r) || a.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." });
|
|
863
847
|
}
|
|
864
|
-
function
|
|
848
|
+
function Ge(e, o) {
|
|
865
849
|
let n = e;
|
|
866
|
-
for (const
|
|
867
|
-
const i =
|
|
850
|
+
for (const a of o.split("/").slice(1)) {
|
|
851
|
+
const i = a.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
868
852
|
if (Array.isArray(n) && /^\d+$/.test(i)) n = n[Number(i)];
|
|
869
853
|
else if (m(n) && Object.hasOwn(n, i)) n = n[i];
|
|
870
854
|
else return { found: !1 };
|
|
871
855
|
}
|
|
872
856
|
return { found: !0, value: n };
|
|
873
857
|
}
|
|
874
|
-
function S(e, o, n,
|
|
858
|
+
function S(e, o, n, a, { mustExist: i }) {
|
|
875
859
|
if (typeof n != "string" || !n.startsWith("/")) {
|
|
876
860
|
e.issues.error({
|
|
877
861
|
code: "invalid_state_path",
|
|
878
|
-
path:
|
|
862
|
+
path: a,
|
|
879
863
|
elementKey: o,
|
|
880
864
|
message: `State paths are JSON Pointers; got ${JSON.stringify(n)}.`,
|
|
881
865
|
hint: typeof n == "string" ? `Use "/${n.replace(/^\.?\/?/, "").replaceAll(".", "/")}".` : 'Use a string such as "/settings/enabled".'
|
|
882
866
|
});
|
|
883
867
|
return;
|
|
884
868
|
}
|
|
885
|
-
i && !
|
|
869
|
+
i && !Ge(e.state, n).found && e.issues.warn({
|
|
886
870
|
code: "state_path_missing",
|
|
887
|
-
path:
|
|
871
|
+
path: a,
|
|
888
872
|
elementKey: o,
|
|
889
873
|
message: `State "${n}" has no initial value.`,
|
|
890
874
|
hint: `Seed it in the spec's "state", or pass the host state with --state, so the first render has a value.`
|
|
891
875
|
});
|
|
892
876
|
}
|
|
893
|
-
function
|
|
877
|
+
function $(e, o, n, a, i) {
|
|
894
878
|
if (Array.isArray(n)) {
|
|
895
|
-
n.forEach((
|
|
879
|
+
n.forEach((s, r) => $(e, o, s, a + u(r), i));
|
|
896
880
|
return;
|
|
897
881
|
}
|
|
898
882
|
if (m(n)) {
|
|
899
|
-
for (const
|
|
900
|
-
Object.hasOwn(n,
|
|
901
|
-
for (const
|
|
902
|
-
Object.hasOwn(n,
|
|
883
|
+
for (const s of ["$state", "$bindState"])
|
|
884
|
+
Object.hasOwn(n, s) && S(e, o, n[s], a + u(s), { mustExist: !0 });
|
|
885
|
+
for (const s of ["$item", "$bindItem", "$index"])
|
|
886
|
+
Object.hasOwn(n, s) && !i && e.issues.error({
|
|
903
887
|
code: "item_outside_repeat",
|
|
904
|
-
path:
|
|
888
|
+
path: a + u(s),
|
|
905
889
|
elementKey: o,
|
|
906
|
-
message: `${
|
|
890
|
+
message: `${s} only works inside an element with "repeat" or its descendants.`,
|
|
907
891
|
hint: 'Add "repeat": {"statePath": "/list"} to an ancestor, or read the value with $state.'
|
|
908
892
|
});
|
|
909
893
|
if (typeof n.$template == "string")
|
|
910
|
-
for (const
|
|
911
|
-
S(e, o,
|
|
912
|
-
typeof n.$computed == "string" &&
|
|
913
|
-
for (const [
|
|
914
|
-
["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(
|
|
894
|
+
for (const s of n.$template.matchAll(/\$\{([^}]*)\}/g))
|
|
895
|
+
S(e, o, s[1], a + u("$template"), { mustExist: !0 });
|
|
896
|
+
typeof n.$computed == "string" && Xe(e, o, n, a);
|
|
897
|
+
for (const [s, r] of Object.entries(n))
|
|
898
|
+
["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(s) || $(e, o, r, a + u(s), i);
|
|
915
899
|
}
|
|
916
900
|
}
|
|
917
|
-
function
|
|
901
|
+
function Xe(e, o, n, a) {
|
|
918
902
|
const i = n.$computed;
|
|
919
903
|
if (!e.functions)
|
|
920
904
|
e.issues.warn({
|
|
921
905
|
code: "unverified_function",
|
|
922
|
-
path:
|
|
906
|
+
path: a + u("$computed"),
|
|
923
907
|
elementKey: o,
|
|
924
908
|
message: `$computed "${i}" must be registered by the host.`,
|
|
925
909
|
hint: `Pass the host function names with --functions ${i} to verify it.`
|
|
@@ -928,29 +912,29 @@ function Qe(e, o, n, s) {
|
|
|
928
912
|
const r = y(i, e.functions);
|
|
929
913
|
e.issues.error({
|
|
930
914
|
code: "unknown_function",
|
|
931
|
-
path:
|
|
915
|
+
path: a + u("$computed"),
|
|
932
916
|
elementKey: o,
|
|
933
917
|
message: `$computed "${i}" is not a host function.`,
|
|
934
918
|
hint: `${r ? `Did you mean "${r}"? ` : ""}${v("Host functions", e.functions)}`
|
|
935
919
|
});
|
|
936
920
|
}
|
|
937
921
|
if (i !== "t" || !e.messageKeys) return;
|
|
938
|
-
const
|
|
939
|
-
if (typeof
|
|
940
|
-
const r = typeof
|
|
922
|
+
const s = m(n.args) ? n.args.key : void 0;
|
|
923
|
+
if (typeof s != "string" || !e.messageKeys.includes(s)) {
|
|
924
|
+
const r = typeof s == "string" ? y(s, e.messageKeys) : void 0;
|
|
941
925
|
e.issues.error({
|
|
942
926
|
code: "missing_i18n_key",
|
|
943
|
-
path:
|
|
927
|
+
path: a + u("args", "key"),
|
|
944
928
|
elementKey: o,
|
|
945
|
-
message: `Message key ${JSON.stringify(
|
|
929
|
+
message: `Message key ${JSON.stringify(s)} is not in the message catalog.`,
|
|
946
930
|
hint: r ? `Did you mean "${r}"? Otherwise add the key to every locale.` : "Add the key to every locale, or use an existing key."
|
|
947
931
|
});
|
|
948
932
|
}
|
|
949
933
|
}
|
|
950
|
-
const
|
|
951
|
-
function
|
|
934
|
+
const Ye = ["statePath", "clearStatePath"];
|
|
935
|
+
function Qe(e, o, n, a) {
|
|
952
936
|
const i = (...c) => u("elements", o, ...c);
|
|
953
|
-
if (
|
|
937
|
+
if ($(e, o, n.props, i("props"), a), e.messageKeys && m(n.props))
|
|
954
938
|
for (const c of Ve) {
|
|
955
939
|
const l = n.props[c];
|
|
956
940
|
typeof l == "string" && l.trim() && e.issues.warn({
|
|
@@ -961,8 +945,8 @@ function et(e, o, n, s) {
|
|
|
961
945
|
hint: 'Use {"$computed": "t", "args": {"key": "<message key>"}}.'
|
|
962
946
|
});
|
|
963
947
|
}
|
|
964
|
-
n.visible !== void 0 &&
|
|
965
|
-
const
|
|
948
|
+
n.visible !== void 0 && $(e, o, n.visible, i("visible"), a), m(n.repeat) && S(e, o, n.repeat.statePath, i("repeat", "statePath"), { mustExist: !0 });
|
|
949
|
+
const s = typeof n.type == "string" ? n.type : "", r = e.components[s]?.events ?? [];
|
|
966
950
|
if (m(n.on))
|
|
967
951
|
for (const [c, l] of Object.entries(n.on)) {
|
|
968
952
|
if (!r.includes(c)) {
|
|
@@ -971,19 +955,19 @@ function et(e, o, n, s) {
|
|
|
971
955
|
code: "unknown_event",
|
|
972
956
|
path: i("on", c),
|
|
973
957
|
elementKey: o,
|
|
974
|
-
message: `${
|
|
975
|
-
hint: p ? `Did you mean "${p}"?` : r.length ? v(`${
|
|
958
|
+
message: `${s} does not emit "${c}".`,
|
|
959
|
+
hint: p ? `Did you mean "${p}"?` : r.length ? v(`${s} events`, r) : `${s} emits no events.`
|
|
976
960
|
});
|
|
977
961
|
}
|
|
978
|
-
|
|
962
|
+
U(e, o, l, i("on", c), a);
|
|
979
963
|
}
|
|
980
964
|
if (m(n.watch))
|
|
981
965
|
for (const [c, l] of Object.entries(n.watch))
|
|
982
|
-
S(e, o, c, i("watch", c), { mustExist: !1 }),
|
|
966
|
+
S(e, o, c, i("watch", c), { mustExist: !1 }), U(e, o, l, i("watch", c), a);
|
|
983
967
|
}
|
|
984
|
-
function
|
|
968
|
+
function U(e, o, n, a, i) {
|
|
985
969
|
(Array.isArray(n) ? n : [n]).forEach((r, c) => {
|
|
986
|
-
const l = Array.isArray(n) ?
|
|
970
|
+
const l = Array.isArray(n) ? a + u(c) : a;
|
|
987
971
|
if (!m(r) || typeof r.action != "string") {
|
|
988
972
|
e.issues.error({ code: "invalid_action_binding", path: l, elementKey: o, message: 'An action binding is {"action": "<name>", "params": {...}}.' });
|
|
989
973
|
return;
|
|
@@ -999,21 +983,21 @@ function K(e, o, n, s, i) {
|
|
|
999
983
|
});
|
|
1000
984
|
}
|
|
1001
985
|
if (m(r.params)) {
|
|
1002
|
-
for (const p of
|
|
986
|
+
for (const p of Ye)
|
|
1003
987
|
Object.hasOwn(r.params, p) && S(e, o, r.params[p], l + u("params", p), { mustExist: !1 });
|
|
1004
|
-
|
|
988
|
+
$(e, o, r.params, l + u("params"), i);
|
|
1005
989
|
}
|
|
1006
990
|
});
|
|
1007
991
|
}
|
|
1008
|
-
function
|
|
992
|
+
function N(e) {
|
|
1009
993
|
return { valid: e.errors.length === 0, errors: e.errors, warnings: e.warnings };
|
|
1010
994
|
}
|
|
1011
|
-
const
|
|
1012
|
-
function
|
|
995
|
+
const x = V;
|
|
996
|
+
function Ze(e) {
|
|
1013
997
|
const o = t.toJSONSchema(e);
|
|
1014
998
|
return delete o.$schema, o;
|
|
1015
999
|
}
|
|
1016
|
-
function
|
|
1000
|
+
function et(e) {
|
|
1017
1001
|
if (Array.isArray(e.enum)) return e.enum[0];
|
|
1018
1002
|
switch (e.type) {
|
|
1019
1003
|
case "string":
|
|
@@ -1029,23 +1013,23 @@ function ot(e) {
|
|
|
1029
1013
|
return {};
|
|
1030
1014
|
}
|
|
1031
1015
|
}
|
|
1032
|
-
function
|
|
1033
|
-
return Object.entries(
|
|
1016
|
+
function ht() {
|
|
1017
|
+
return Object.entries(x).map(([e, o]) => ({
|
|
1034
1018
|
name: e,
|
|
1035
1019
|
description: o.description,
|
|
1036
|
-
required: Object.entries(
|
|
1020
|
+
required: Object.entries(P(o) ?? {}).filter(([, n]) => !R(n)).map(([n]) => n),
|
|
1037
1021
|
slots: o.slots ?? [],
|
|
1038
1022
|
events: o.events ?? []
|
|
1039
1023
|
}));
|
|
1040
1024
|
}
|
|
1041
|
-
function
|
|
1042
|
-
return y(e, Object.keys(
|
|
1025
|
+
function ft(e) {
|
|
1026
|
+
return y(e, Object.keys(x));
|
|
1043
1027
|
}
|
|
1044
|
-
function
|
|
1045
|
-
if (!Object.hasOwn(
|
|
1046
|
-
const o =
|
|
1047
|
-
|
|
1048
|
-
{ required: !
|
|
1028
|
+
function gt(e) {
|
|
1029
|
+
if (!Object.hasOwn(x, e)) return;
|
|
1030
|
+
const o = x[e], n = Object.fromEntries(Object.entries(P(o) ?? {}).map(([a, i]) => [
|
|
1031
|
+
a,
|
|
1032
|
+
{ required: !R(i), schema: Ze(i) }
|
|
1049
1033
|
]));
|
|
1050
1034
|
return {
|
|
1051
1035
|
name: e,
|
|
@@ -1055,16 +1039,16 @@ function yt(e) {
|
|
|
1055
1039
|
events: o.events ?? [],
|
|
1056
1040
|
example: {
|
|
1057
1041
|
type: e,
|
|
1058
|
-
props: Object.fromEntries(Object.entries(n).filter(([,
|
|
1042
|
+
props: Object.fromEntries(Object.entries(n).filter(([, a]) => a.required).map(([a, { schema: i }]) => [a, et(i)])),
|
|
1059
1043
|
children: []
|
|
1060
1044
|
}
|
|
1061
1045
|
};
|
|
1062
1046
|
}
|
|
1063
|
-
const
|
|
1047
|
+
const O = { type: "string", pattern: "^/" }, tt = {
|
|
1064
1048
|
description: "A json-render expression resolved at render time.",
|
|
1065
1049
|
anyOf: [
|
|
1066
|
-
{ type: "object", required: ["$state"], properties: { $state:
|
|
1067
|
-
{ type: "object", required: ["$bindState"], properties: { $bindState:
|
|
1050
|
+
{ type: "object", required: ["$state"], properties: { $state: O } },
|
|
1051
|
+
{ type: "object", required: ["$bindState"], properties: { $bindState: O } },
|
|
1068
1052
|
{ type: "object", required: ["$item"], properties: { $item: { type: "string" } } },
|
|
1069
1053
|
{ type: "object", required: ["$bindItem"], properties: { $bindItem: { type: "string" } } },
|
|
1070
1054
|
{ type: "object", required: ["$index"], properties: { $index: { const: !0 } } },
|
|
@@ -1072,7 +1056,7 @@ const x = { type: "string", pattern: "^/" }, nt = {
|
|
|
1072
1056
|
{ type: "object", required: ["$computed"], properties: { $computed: { type: "string" }, args: { type: "object" } } },
|
|
1073
1057
|
{ type: "object", required: ["$cond", "$then", "$else"], properties: { $cond: {}, $then: {}, $else: {} } }
|
|
1074
1058
|
]
|
|
1075
|
-
},
|
|
1059
|
+
}, ot = {
|
|
1076
1060
|
type: "object",
|
|
1077
1061
|
required: ["action"],
|
|
1078
1062
|
properties: {
|
|
@@ -1084,35 +1068,35 @@ const x = { type: "string", pattern: "^/" }, nt = {
|
|
|
1084
1068
|
preventDefault: { type: "boolean" }
|
|
1085
1069
|
},
|
|
1086
1070
|
additionalProperties: !1
|
|
1087
|
-
},
|
|
1088
|
-
function
|
|
1089
|
-
const
|
|
1071
|
+
}, T = { anyOf: [{ $ref: "#/$defs/actionBinding" }, { type: "array", items: { $ref: "#/$defs/actionBinding" } }] }, E = { type: "array", items: { type: "string" } };
|
|
1072
|
+
function nt(e, o, n) {
|
|
1073
|
+
const a = (r) => Array.isArray(r) ? r.map(a) : !r || typeof r != "object" ? r : Object.fromEntries(Object.entries(r).map(([c, l]) => [
|
|
1090
1074
|
c,
|
|
1091
|
-
c === "$ref" && typeof l == "string" ? l.replace("#/$defs/", `#/$defs/${o}`) :
|
|
1092
|
-
])), { $defs: i, ...
|
|
1093
|
-
delete
|
|
1094
|
-
for (const [r, c] of Object.entries(i ?? {})) n[o + r] =
|
|
1095
|
-
return s
|
|
1075
|
+
c === "$ref" && typeof l == "string" ? l.replace("#/$defs/", `#/$defs/${o}`) : a(l)
|
|
1076
|
+
])), { $defs: i, ...s } = e;
|
|
1077
|
+
delete s.$schema;
|
|
1078
|
+
for (const [r, c] of Object.entries(i ?? {})) n[o + r] = a(c);
|
|
1079
|
+
return a(s);
|
|
1096
1080
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
-
const r =
|
|
1102
|
-
|
|
1081
|
+
function it(e, o, n) {
|
|
1082
|
+
const a = P(o), i = o.slots ?? [];
|
|
1083
|
+
let s = { type: "object" };
|
|
1084
|
+
if (a) {
|
|
1085
|
+
const r = nt(t.toJSONSchema(t.object(a)), `${e}__`, n), c = r.properties;
|
|
1086
|
+
s = {
|
|
1103
1087
|
...r,
|
|
1104
1088
|
properties: Object.fromEntries(Object.entries(c).map(([l, p]) => [
|
|
1105
1089
|
l,
|
|
1106
1090
|
{ anyOf: [p, { $ref: "#/$defs/expression" }] }
|
|
1107
1091
|
]))
|
|
1108
|
-
}, r.required?.length || delete
|
|
1092
|
+
}, r.required?.length || delete s.required;
|
|
1109
1093
|
}
|
|
1110
1094
|
return {
|
|
1111
1095
|
if: { properties: { type: { const: e } } },
|
|
1112
1096
|
then: {
|
|
1113
1097
|
...o.description ? { description: o.description } : {},
|
|
1114
1098
|
properties: {
|
|
1115
|
-
props:
|
|
1099
|
+
props: s,
|
|
1116
1100
|
...i.includes("default") ? {} : { children: { maxItems: 0 } },
|
|
1117
1101
|
slots: { propertyNames: { enum: i.filter((r) => r !== "default") } },
|
|
1118
1102
|
on: { propertyNames: { enum: o.events ?? [] } }
|
|
@@ -1120,23 +1104,23 @@ function at(e, o, n) {
|
|
|
1120
1104
|
}
|
|
1121
1105
|
};
|
|
1122
1106
|
}
|
|
1123
|
-
function
|
|
1124
|
-
const o = e.data.components, n = { expression:
|
|
1107
|
+
function bt(e = A) {
|
|
1108
|
+
const o = e.data.components, n = { expression: tt, actionBinding: ot }, a = Object.entries(o).map(([i, s]) => it(i, s, n));
|
|
1125
1109
|
return n.element = {
|
|
1126
1110
|
type: "object",
|
|
1127
1111
|
required: ["type", "props"],
|
|
1128
1112
|
properties: {
|
|
1129
1113
|
type: { enum: Object.keys(o) },
|
|
1130
1114
|
props: { type: "object" },
|
|
1131
|
-
children:
|
|
1132
|
-
slots: { type: "object", additionalProperties:
|
|
1115
|
+
children: E,
|
|
1116
|
+
slots: { type: "object", additionalProperties: E },
|
|
1133
1117
|
visible: {},
|
|
1134
|
-
on: { type: "object", additionalProperties:
|
|
1135
|
-
watch: { type: "object", propertyNames:
|
|
1136
|
-
repeat: { type: "object", required: ["statePath"], properties: { statePath:
|
|
1118
|
+
on: { type: "object", additionalProperties: T },
|
|
1119
|
+
watch: { type: "object", propertyNames: O, additionalProperties: T },
|
|
1120
|
+
repeat: { type: "object", required: ["statePath"], properties: { statePath: O, key: { type: "string" } }, additionalProperties: !1 }
|
|
1137
1121
|
},
|
|
1138
1122
|
additionalProperties: !1,
|
|
1139
|
-
allOf:
|
|
1123
|
+
allOf: a
|
|
1140
1124
|
}, {
|
|
1141
1125
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
1142
1126
|
title: "Synology Package Land JSON UI spec",
|
|
@@ -1152,30 +1136,30 @@ function wt(e = O) {
|
|
|
1152
1136
|
};
|
|
1153
1137
|
}
|
|
1154
1138
|
export {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1139
|
+
Ot as ActionProvider,
|
|
1140
|
+
At as JSONUIProvider,
|
|
1141
|
+
Pt as Renderer,
|
|
1142
|
+
kt as StateProvider,
|
|
1143
|
+
ut as SynoJsonRenderer,
|
|
1144
|
+
Ct as ValidationProvider,
|
|
1161
1145
|
It as VisibilityProvider,
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1146
|
+
ft as closestSynoJsonComponent,
|
|
1147
|
+
$t as createStateStore,
|
|
1148
|
+
jt as defineCatalog,
|
|
1149
|
+
Rt as defineRegistry,
|
|
1150
|
+
gt as describeSynoJsonComponent,
|
|
1151
|
+
Nt as jsonRenderVueSchema,
|
|
1152
|
+
ht as listSynoJsonComponents,
|
|
1153
|
+
pt as synoJsonAiPrompt,
|
|
1154
|
+
Ke as synoJsonAiRules,
|
|
1155
|
+
A as synoJsonCatalog,
|
|
1156
|
+
V as synoJsonComponentDefinitions,
|
|
1157
|
+
D as synoJsonRegistry,
|
|
1174
1158
|
Je as synoJsonRenderers,
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1159
|
+
bt as synoJsonSchema,
|
|
1160
|
+
Kt as useActions,
|
|
1161
|
+
Lt as useBoundProp,
|
|
1178
1162
|
Dt as useStateStore,
|
|
1179
|
-
|
|
1180
|
-
|
|
1163
|
+
mt as validateSynoJsonSpec,
|
|
1164
|
+
vt as z
|
|
1181
1165
|
};
|