@synopackageland/ui 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/json.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { z as t } from "zod";
2
2
  import { z as vt } from "zod";
3
- import { defineCatalog as z } from "@json-render/core";
4
- import { createStateStore as St, defineCatalog as jt } from "@json-render/core";
5
- import { defineRegistry as B, useBoundProp as b, JSONUIProvider as M, Renderer as W } 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 Ut } from "@json-render/vue";
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
7
  import { schema as H } from "@json-render/vue/schema";
8
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, 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";
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 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(),
@@ -283,12 +283,13 @@ const J = t.lazy(() => t.object({
283
283
  open: t.boolean().optional(),
284
284
  title: t.string().optional(),
285
285
  description: t.string().optional(),
286
+ size: t.enum(["sm", "md", "lg", "xl"]).optional(),
286
287
  width: t.string().optional(),
287
288
  showClose: t.boolean().optional()
288
289
  }),
289
290
  slots: ["default", "footer"],
290
291
  events: ["openChange"],
291
- description: "Modal task/dialog. Bind open to state. Put confirmation or form actions in footer."
292
+ description: "Modal task/dialog. Bind open to state. Put confirmation or form actions in footer. Without size it sizes to its content; size picks a DSM dialog width: sm one field, md a form with a text area, lg a wide form, xl tabs of settings."
292
293
  },
293
294
  DataTable: {
294
295
  props: t.object({
@@ -351,7 +352,7 @@ const J = t.lazy(() => t.object({
351
352
  props: t.object({ text: t.string().optional() }),
352
353
  description: "Centered loading state for a page or bounded region."
353
354
  }
354
- }, A = z(H, {
355
+ }, A = F(H, {
355
356
  components: V,
356
357
  actions: {}
357
358
  }), Ke = [
@@ -370,13 +371,13 @@ function pt() {
370
371
  ${Le}
371
372
  `;
372
373
  }
373
- const Ue = {
374
+ const De = {
374
375
  none: "0",
375
376
  xs: "var(--ui-space-1)",
376
377
  sm: "var(--ui-space-2)",
377
378
  md: "var(--ui-space-3)",
378
379
  lg: "var(--ui-space-4)"
379
- }, De = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch" }, Te = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
380
+ }, Ue = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch" }, Te = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
380
381
  function Ee(e) {
381
382
  return { default: () => e };
382
383
  }
@@ -420,7 +421,7 @@ const Je = {
420
421
  },
421
422
  Tabs: ({ props: e, bindings: o, emit: n }) => {
422
423
  const [s, i] = b(e.value, o?.value);
423
- return d(Se, {
424
+ return d($e, {
424
425
  modelValue: s ?? "",
425
426
  items: e.items,
426
427
  ariaLabel: e.ariaLabel,
@@ -434,8 +435,8 @@ const Je = {
434
435
  style: {
435
436
  display: "flex",
436
437
  flexDirection: e.direction ?? "column",
437
- gap: Ue[e.gap ?? "md"],
438
- alignItems: De[e.align ?? "stretch"],
438
+ gap: De[e.gap ?? "md"],
439
+ alignItems: Ue[e.align ?? "stretch"],
439
440
  justifyContent: Te[e.justify ?? "start"],
440
441
  flexWrap: e.wrap ? "wrap" : "nowrap"
441
442
  }
@@ -446,7 +447,7 @@ const Je = {
446
447
  },
447
448
  Button: ({ props: e, emit: o }) => {
448
449
  const n = C(e.icon);
449
- return d($e, {
450
+ return d(Se, {
450
451
  variant: e.variant,
451
452
  size: e.size,
452
453
  disabled: e.disabled,
@@ -585,6 +586,7 @@ const Je = {
585
586
  open: i ?? !1,
586
587
  title: e.title,
587
588
  description: e.description,
589
+ size: e.size,
588
590
  width: e.width,
589
591
  showClose: e.showClose,
590
592
  "onUpdate:open": (r) => {
@@ -602,7 +604,7 @@ const Je = {
602
604
  ListItem: ({ props: e, slots: o }) => d(oe, e, o),
603
605
  InputGroup: ({ slots: e }) => d(te, null, e),
604
606
  Loading: ({ props: e }) => d(ee, { text: e.text })
605
- }, { registry: U } = B(A, {
607
+ }, { registry: D } = M(A, {
606
608
  components: Je
607
609
  }), ut = /* @__PURE__ */ G({
608
610
  __name: "SynoJsonRenderer",
@@ -620,8 +622,8 @@ const Je = {
620
622
  fallback: {}
621
623
  },
622
624
  setup(e) {
623
- return (o, n) => (X(), Y(j(M), {
624
- registry: j(U),
625
+ return (o, n) => (X(), Y(j(W), {
626
+ registry: j(D),
625
627
  store: e.store,
626
628
  "initial-state": e.state ?? e.spec?.state ?? {},
627
629
  handlers: e.handlers,
@@ -632,9 +634,9 @@ const Je = {
632
634
  "on-state-change": e.onStateChange
633
635
  }, {
634
636
  default: Q(() => [
635
- Z(j(W), {
637
+ Z(j(B), {
636
638
  spec: e.spec,
637
- registry: j(U),
639
+ registry: j(D),
638
640
  loading: e.loading,
639
641
  fallback: e.fallback
640
642
  }, null, 8, ["spec", "registry", "loading", "fallback"])
@@ -643,8 +645,8 @@ const Je = {
643
645
  }, 8, ["registry", "store", "initial-state", "handlers", "navigate", "functions", "directives", "validation-functions", "on-state-change"]));
644
646
  }
645
647
  }), Ve = ["label", "title", "description", "text", "placeholder", "emptyText", "help", "ariaLabel", "valueLabel", "searchPlaceholder"];
646
- function q(e, o = "") {
647
- return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, s]) => m(s) ? q(s, `${o}${n}.`) : [`${o}${n}`]);
648
+ function z(e, o = "") {
649
+ return Array.isArray(e) ? e : Object.entries(e).flatMap(([n, s]) => m(s) ? z(s, `${o}${n}.`) : [`${o}${n}`]);
648
650
  }
649
651
  const m = (e) => typeof e == "object" && e !== null && !Array.isArray(e), u = (...e) => e.map((o) => "/" + String(o).replaceAll("~", "~0").replaceAll("/", "~1")).join("");
650
652
  function _e(e, o) {
@@ -667,18 +669,18 @@ function y(e, o) {
667
669
  }
668
670
  return n !== void 0 && s <= Math.max(2, Math.floor(e.length / 3)) ? n : void 0;
669
671
  }
670
- 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));
672
+ 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));
671
673
  function P(e) {
672
674
  const o = e.props?.shape;
673
675
  return m(o) ? o : void 0;
674
676
  }
675
677
  const R = (e) => e.safeParse(void 0).success;
676
- function ze(e) {
678
+ function Fe(e) {
677
679
  if (e.code === "invalid_value") return `Use one of: ${e.values.map((o) => JSON.stringify(o)).join(", ")}.`;
678
680
  if (e.code === "invalid_type") return `Expected ${e.expected}.`;
679
681
  }
680
682
  const v = (e, o) => `${e}: ${o.join(", ")}`;
681
- class Be {
683
+ class Me {
682
684
  errors = [];
683
685
  warnings = [];
684
686
  error(o) {
@@ -689,7 +691,7 @@ class Be {
689
691
  }
690
692
  }
691
693
  function mt(e, o = {}) {
692
- const n = o.catalog ?? A, s = n.data.components, i = new Be();
694
+ const n = o.catalog ?? A, s = n.data.components, i = new Me();
693
695
  if (!m(e))
694
696
  return i.error({ code: "invalid_spec", path: "", message: "A spec must be a JSON object.", hint: 'Return {"root": "<key>", "elements": {...}, "state": {...}}.' }), T(i);
695
697
  const a = m(e.elements) ? e.elements : void 0;
@@ -714,9 +716,9 @@ function mt(e, o = {}) {
714
716
  });
715
717
  continue;
716
718
  }
717
- Me(i, p, h, s[h], f.props), We(i, p, h, s[h], f, a);
719
+ We(i, p, h, s[h], f.props), Be(i, p, h, s[h], f, a);
718
720
  }
719
- const c = o.messages && q(o.messages), l = {
721
+ const c = o.messages && z(o.messages), l = {
720
722
  issues: i,
721
723
  components: s,
722
724
  actions: [
@@ -731,7 +733,7 @@ function mt(e, o = {}) {
731
733
  };
732
734
  return a && typeof e.root == "string" && Object.hasOwn(a, e.root) && He(l, e.root, a), T(i);
733
735
  }
734
- function Me(e, o, n, s, i) {
736
+ function We(e, o, n, s, i) {
735
737
  const a = (...l) => u("elements", o, "props", ...l);
736
738
  if (!m(i)) {
737
739
  e.error({ code: "invalid_props", path: a(), elementKey: o, message: '"props" must be an object.', hint: 'Use "props": {} when the component needs none.' });
@@ -762,13 +764,13 @@ function Me(e, o, n, s, i) {
762
764
  path: a(l, ...h.path.map((g) => String(g))),
763
765
  elementKey: o,
764
766
  message: `${n}.${l}: ${h.message}`,
765
- hint: ze(h)
767
+ hint: Fe(h)
766
768
  });
767
769
  }
768
770
  for (const l of c)
769
771
  !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.` });
770
772
  }
771
- function F(e, o) {
773
+ function q(e, o) {
772
774
  const n = [];
773
775
  if (Array.isArray(o.children) && o.children.forEach((s, i) => {
774
776
  typeof s == "string" && n.push({ child: s, path: u("elements", e, "children", i) });
@@ -779,7 +781,7 @@ function F(e, o) {
779
781
  });
780
782
  return n;
781
783
  }
782
- function We(e, o, n, s, i, a) {
784
+ function Be(e, o, n, s, i, a) {
783
785
  const r = s.slots ?? [], { children: c } = i;
784
786
  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({
785
787
  code: "children_not_allowed",
@@ -804,7 +806,7 @@ function We(e, o, n, s, i, a) {
804
806
  hint: f ? `Did you mean "${f}"?` : r.length ? v(`${n} slots`, r) : `${n} has no slots.`
805
807
  });
806
808
  }
807
- for (const l of F(o, i))
809
+ for (const l of q(o, i))
808
810
  if (!Object.hasOwn(a, l.child)) {
809
811
  const p = y(l.child, Object.keys(a));
810
812
  e.error({
@@ -825,7 +827,7 @@ function He(e, o, n) {
825
827
  Qe(e, r, f, p || w);
826
828
  const h = f.type === "AppRoot";
827
829
  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." });
828
- for (const g of F(r, f))
830
+ for (const g of q(r, f))
829
831
  if (Object.hasOwn(n, g.child)) {
830
832
  if (c.includes(g.child)) {
831
833
  s.error({ code: "cycle", path: g.path, elementKey: r, message: `"${g.child}" is its own ancestor.`, hint: "Element references must form a tree." });
@@ -848,7 +850,7 @@ function Ge(e, o) {
848
850
  }
849
851
  return { found: !0, value: n };
850
852
  }
851
- function $(e, o, n, s, { mustExist: i }) {
853
+ function S(e, o, n, s, { mustExist: i }) {
852
854
  if (typeof n != "string" || !n.startsWith("/")) {
853
855
  e.issues.error({
854
856
  code: "invalid_state_path",
@@ -867,14 +869,14 @@ function $(e, o, n, s, { mustExist: i }) {
867
869
  hint: `Seed it in the spec's "state", or pass the host state with --state, so the first render has a value.`
868
870
  });
869
871
  }
870
- function S(e, o, n, s, i) {
872
+ function $(e, o, n, s, i) {
871
873
  if (Array.isArray(n)) {
872
- n.forEach((a, r) => S(e, o, a, s + u(r), i));
874
+ n.forEach((a, r) => $(e, o, a, s + u(r), i));
873
875
  return;
874
876
  }
875
877
  if (m(n)) {
876
878
  for (const a of ["$state", "$bindState"])
877
- Object.hasOwn(n, a) && $(e, o, n[a], s + u(a), { mustExist: !0 });
879
+ Object.hasOwn(n, a) && S(e, o, n[a], s + u(a), { mustExist: !0 });
878
880
  for (const a of ["$item", "$bindItem", "$index"])
879
881
  Object.hasOwn(n, a) && !i && e.issues.error({
880
882
  code: "item_outside_repeat",
@@ -885,10 +887,10 @@ function S(e, o, n, s, i) {
885
887
  });
886
888
  if (typeof n.$template == "string")
887
889
  for (const a of n.$template.matchAll(/\$\{([^}]*)\}/g))
888
- $(e, o, a[1], s + u("$template"), { mustExist: !0 });
890
+ S(e, o, a[1], s + u("$template"), { mustExist: !0 });
889
891
  typeof n.$computed == "string" && Xe(e, o, n, s);
890
892
  for (const [a, r] of Object.entries(n))
891
- ["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(a) || S(e, o, r, s + u(a), i);
893
+ ["$state", "$bindState", "$item", "$bindItem", "$index", "$template"].includes(a) || $(e, o, r, s + u(a), i);
892
894
  }
893
895
  }
894
896
  function Xe(e, o, n, s) {
@@ -927,7 +929,7 @@ function Xe(e, o, n, s) {
927
929
  const Ye = ["statePath", "clearStatePath"];
928
930
  function Qe(e, o, n, s) {
929
931
  const i = (...c) => u("elements", o, ...c);
930
- if (S(e, o, n.props, i("props"), s), e.messageKeys && m(n.props))
932
+ if ($(e, o, n.props, i("props"), s), e.messageKeys && m(n.props))
931
933
  for (const c of Ve) {
932
934
  const l = n.props[c];
933
935
  typeof l == "string" && l.trim() && e.issues.warn({
@@ -938,7 +940,7 @@ function Qe(e, o, n, s) {
938
940
  hint: 'Use {"$computed": "t", "args": {"key": "<message key>"}}.'
939
941
  });
940
942
  }
941
- 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 });
943
+ n.visible !== void 0 && $(e, o, n.visible, i("visible"), s), m(n.repeat) && S(e, o, n.repeat.statePath, i("repeat", "statePath"), { mustExist: !0 });
942
944
  const a = typeof n.type == "string" ? n.type : "", r = e.components[a]?.events ?? [];
943
945
  if (m(n.on))
944
946
  for (const [c, l] of Object.entries(n.on)) {
@@ -952,13 +954,13 @@ function Qe(e, o, n, s) {
952
954
  hint: p ? `Did you mean "${p}"?` : r.length ? v(`${a} events`, r) : `${a} emits no events.`
953
955
  });
954
956
  }
955
- D(e, o, l, i("on", c), s);
957
+ U(e, o, l, i("on", c), s);
956
958
  }
957
959
  if (m(n.watch))
958
960
  for (const [c, l] of Object.entries(n.watch))
959
- $(e, o, c, i("watch", c), { mustExist: !1 }), D(e, o, l, i("watch", c), s);
961
+ S(e, o, c, i("watch", c), { mustExist: !1 }), U(e, o, l, i("watch", c), s);
960
962
  }
961
- function D(e, o, n, s, i) {
963
+ function U(e, o, n, s, i) {
962
964
  (Array.isArray(n) ? n : [n]).forEach((r, c) => {
963
965
  const l = Array.isArray(n) ? s + u(c) : s;
964
966
  if (!m(r) || typeof r.action != "string") {
@@ -977,8 +979,8 @@ function D(e, o, n, s, i) {
977
979
  }
978
980
  if (m(r.params)) {
979
981
  for (const p of Ye)
980
- Object.hasOwn(r.params, p) && $(e, o, r.params[p], l + u("params", p), { mustExist: !1 });
981
- S(e, o, r.params, l + u("params"), i);
982
+ Object.hasOwn(r.params, p) && S(e, o, r.params[p], l + u("params", p), { mustExist: !1 });
983
+ $(e, o, r.params, l + u("params"), i);
982
984
  }
983
985
  });
984
986
  }
@@ -1137,7 +1139,7 @@ export {
1137
1139
  Ct as ValidationProvider,
1138
1140
  It as VisibilityProvider,
1139
1141
  ft as closestSynoJsonComponent,
1140
- St as createStateStore,
1142
+ $t as createStateStore,
1141
1143
  jt as defineCatalog,
1142
1144
  Rt as defineRegistry,
1143
1145
  gt as describeSynoJsonComponent,
@@ -1147,12 +1149,12 @@ export {
1147
1149
  Ke as synoJsonAiRules,
1148
1150
  A as synoJsonCatalog,
1149
1151
  V as synoJsonComponentDefinitions,
1150
- U as synoJsonRegistry,
1152
+ D as synoJsonRegistry,
1151
1153
  Je as synoJsonRenderers,
1152
1154
  bt as synoJsonSchema,
1153
1155
  Kt as useActions,
1154
1156
  Lt as useBoundProp,
1155
- Ut as useStateStore,
1157
+ Dt as useStateStore,
1156
1158
  mt as validateSynoJsonSpec,
1157
1159
  vt as z
1158
1160
  };
@@ -3,7 +3,7 @@
3
3
  "version": "2.10.5",
4
4
  "delivery": "bundled-patched-esm",
5
5
  "patchManifestSha256": "14f10159b60d48ac7a0686f58faf7a30e99898dc267b3c032cf2bdd6052dc52b",
6
- "bundleSha256": "ef1ab7a52fdfa29d14fd7275c4d0bf31ad962842c9916e2eeb7d13a9ac752b81",
6
+ "bundleSha256": "2cb054097ed06334eda3c61e1945d5fc449262323813862782e2037e3f88cba7",
7
7
  "sourceHashes": {
8
8
  "shared/useBodyScrollLock.js": "657592f283cb6fd25454abd284a0024af21936cb56e05b762ff0d22b6a979d32",
9
9
  "DismissableLayer/DismissableLayer.js": "da05ca544d9822a8e2b71057e78c0e1ef59423aa3893534338fb58e1ecbd1a8d",