@cratis/stage.runtime 4.182.0 → 4.183.0

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.
@@ -3,6 +3,12 @@ import { Command, type ICommandResult } from '@cratis/arc/commands';
3
3
  import type { StageCommandOutcome } from './StageCommandOutcome';
4
4
  /** Resolves only native Arc command proxies; unrelated registry entries cannot execute. */
5
5
  export declare function registeredCommand(name: string, typeName?: string, route?: string): (new () => Command) | undefined;
6
+ /**
7
+ * The path the page is served under, without a trailing slash: empty at the root of a host, `/api/play/{id}` when a
8
+ * reverse proxy (Studio's Play) hangs the Stage off a prefix. Registered command routes start with `/`, so without this
9
+ * they would be posted to the root of the proxy's host instead of to the Stage.
10
+ */
11
+ export declare function hostedBasePath(): string;
6
12
  /** Executes the registered proxy with the same host configuration as Arc's useCommand. */
7
13
  export declare function executeRegisteredCommand(name: string, values: Record<string, unknown>, arc: ArcConfiguration): Promise<StageCommandOutcome>;
8
14
  /** Maps Arc's typed result without treating a rejection or authorization failure as success. */
package/dist/src/index.js CHANGED
@@ -483,7 +483,16 @@ function W(e, t, n) {
483
483
  function _t(e) {
484
484
  return typeof e == "function" && e.prototype instanceof De;
485
485
  }
486
- async function vt(e, t, n) {
486
+ function vt() {
487
+ let e = globalThis.document?.baseURI ?? globalThis.location?.href;
488
+ if (!e) return "";
489
+ try {
490
+ return new URL(".", e).pathname.replace(/\/+$/, "");
491
+ } catch {
492
+ return "";
493
+ }
494
+ }
495
+ async function yt(e, t, n) {
487
496
  let r = W(e);
488
497
  if (!r) return {
489
498
  isSuccess: !1,
@@ -491,11 +500,11 @@ async function vt(e, t, n) {
491
500
  messages: [`The modeled command “${e}” is not registered by this Stage.`]
492
501
  };
493
502
  let i = new r();
494
- i.setMicroservice(n.microservice), i.setApiBasePath(n.apiBasePath ?? ""), i.setOrigin(n.origin ?? ""), i.setHttpHeadersCallback(n.httpHeadersCallback ?? (() => ({})));
503
+ i.setMicroservice(n.microservice), i.setApiBasePath(n.apiBasePath ?? vt()), i.setOrigin(n.origin ?? ""), i.setHttpHeadersCallback(n.httpHeadersCallback ?? (() => ({})));
495
504
  for (let e of i.propertyDescriptors) Object.prototype.hasOwnProperty.call(t, e.name) && Reflect.set(i, e.name, t[e.name]);
496
- return yt(e, await i.execute());
505
+ return bt(e, await i.execute());
497
506
  }
498
- function yt(e, t) {
507
+ function bt(e, t) {
499
508
  let n = t.isSuccess && t.isAuthorized && t.isValid && !t.hasExceptions, r = t.isValid ? [] : t.validationResults.flatMap((e) => (e.members.length > 0 ? e.members : [""]).map((t) => ({
500
509
  member: t,
501
510
  message: e.message
@@ -511,22 +520,22 @@ function yt(e, t) {
511
520
  messages: n || i.length > 0 ? i : [`“${e}” was not accepted.`]
512
521
  };
513
522
  }
514
- function bt() {
523
+ function xt() {
515
524
  let e = r(Ee);
516
- return n((t, n) => vt(t, n, e), [e]);
525
+ return n((t, n) => yt(t, n, e), [e]);
517
526
  }
518
527
  //#endregion
519
528
  //#region src/StageCommandForm.tsx
520
- function xt({ element: e }) {
521
- let t = V(), n = a(() => Ct(e), [e]), r = a(() => zt(e), [e]), i = typeof e.properties.schema == "string", o = a(() => n ? wt(n, r) : [], [n, r]), c = n ? W(n.command, K(e, "typeName"), K(e, "route")) : void 0, l = Ot(e, o, t.resolveArgument), u = a(() => Dt(o, t.parameters), [o, t.parameters]), d = a(() => n ? Tt(n, o, r) : void 0, [
529
+ function St({ element: e }) {
530
+ let t = V(), n = a(() => wt(e), [e]), r = a(() => Bt(e), [e]), i = typeof e.properties.schema == "string", o = a(() => n ? Tt(n, r) : [], [n, r]), c = n ? W(n.command, K(e, "typeName"), K(e, "route")) : void 0, l = kt(e, o, t.resolveArgument), u = a(() => Ot(o, t.parameters), [o, t.parameters]), d = a(() => n ? Et(n, o, r) : void 0, [
522
531
  n,
523
532
  o,
524
533
  r
525
- ]), f = a(() => n ? Lt(o, r) : [], [
534
+ ]), f = a(() => n ? Rt(o, r) : [], [
526
535
  n,
527
536
  o,
528
537
  r
529
- ]), p = a(() => n ? Rt(n.layout, o) : [], [n, o]), [m, h] = s([]);
538
+ ]), p = a(() => n ? zt(n.layout, o) : [], [n, o]), [m, h] = s([]);
530
539
  return n ? !c && !t.routesReady ? /* @__PURE__ */ F("p", {
531
540
  className: "stage-note",
532
541
  children: [
@@ -534,10 +543,10 @@ function xt({ element: e }) {
534
543
  n.command,
535
544
  "” is waiting for Stage routes."
536
545
  ]
537
- }) : c ? o.length === 0 && !i && e.properties.parameterless !== !0 ? /* @__PURE__ */ P(St, {
546
+ }) : c ? o.length === 0 && !i && e.properties.parameterless !== !0 ? /* @__PURE__ */ P(Ct, {
538
547
  form: n,
539
548
  messages: [`The modeled command “${n.command}” has no form fields or schema metadata, so Stage will not submit an empty command body.`]
540
- }) : f.length > 0 ? /* @__PURE__ */ P(St, {
549
+ }) : f.length > 0 ? /* @__PURE__ */ P(Ct, {
541
550
  form: n,
542
551
  messages: f
543
552
  }) : /* @__PURE__ */ P("section", {
@@ -550,10 +559,10 @@ function xt({ element: e }) {
550
559
  currentValues: l,
551
560
  validateOn: "both",
552
561
  validateAllFieldsOnChange: !0,
553
- onFieldValidate: (e, t, n, i) => It(o, r, t, i),
562
+ onFieldValidate: (e, t, n, i) => Lt(o, r, t, i),
554
563
  onValidationFailure: (e) => h(e.map((e) => e.message)),
555
564
  onException: (e) => h(e),
556
- onFailed: (e) => h(yt(n.command, e).messages),
565
+ onFailed: (e) => h(bt(n.command, e).messages),
557
566
  onSuccess: () => {
558
567
  h([]), t.refreshAfterCommand();
559
568
  },
@@ -587,7 +596,7 @@ function xt({ element: e }) {
587
596
  children: "This form is missing its command metadata."
588
597
  });
589
598
  }
590
- function St({ form: e, messages: t }) {
599
+ function Ct({ form: e, messages: t }) {
591
600
  return /* @__PURE__ */ P("section", {
592
601
  className: "stage-command-form",
593
602
  "data-command": e.command,
@@ -599,7 +608,7 @@ function St({ form: e, messages: t }) {
599
608
  }, e))
600
609
  });
601
610
  }
602
- function Ct(e) {
611
+ function wt(e) {
603
612
  let t = K(e, "command");
604
613
  if (!t) return;
605
614
  let n = Array.isArray(e.properties.fields) ? e.properties.fields.filter(q) : [];
@@ -607,21 +616,21 @@ function Ct(e) {
607
616
  command: t,
608
617
  label: K(e, "label", t),
609
618
  fields: n,
610
- generationMode: At(e.properties.generationMode),
611
- layout: jt(e.properties.layout)
619
+ generationMode: jt(e.properties.generationMode),
620
+ layout: Mt(e.properties.layout)
612
621
  };
613
622
  }
614
- function wt(e, t) {
623
+ function Tt(e, t) {
615
624
  return e.generationMode === u.Manual || e.fields.length > 0 ? e.fields : t.filter((e) => !e.unsupportedReason).map((e) => ({
616
625
  name: e.name,
617
626
  label: e.name
618
627
  }));
619
628
  }
620
- function Tt(e, t, n) {
621
- let r = e.layout, i = r ? Mt(r, t) : [];
622
- if (!r || r.columns.length === 0 && i.length === 0) return t.map((e) => Et(e, n));
623
- let a = new Map(t.map((e) => [e.name, e])), o = Nt(r, i), s = {
624
- gridTemplateColumns: Array.from({ length: o }, (e, t) => Pt(t + 1, r.columns)).join(" "),
629
+ function Et(e, t, n) {
630
+ let r = e.layout, i = r ? Nt(r, t) : [];
631
+ if (!r || r.columns.length === 0 && i.length === 0) return t.map((e) => Dt(e, n));
632
+ let a = new Map(t.map((e) => [e.name, e])), o = Pt(r, i), s = {
633
+ gridTemplateColumns: Array.from({ length: o }, (e, t) => Ft(t + 1, r.columns)).join(" "),
625
634
  columnGap: G(r.columnGap),
626
635
  rowGap: G(r.rowGap)
627
636
  }, c = /* @__PURE__ */ new Set();
@@ -630,11 +639,11 @@ function Tt(e, t, n) {
630
639
  style: s,
631
640
  children: [i.map((e) => {
632
641
  let t = a.get(e.field);
633
- return t ? (c.add(t.name), Et(t, n, e)) : null;
634
- }), t.filter((e) => !c.has(e.name)).map((e) => Et(e, n))]
642
+ return t ? (c.add(t.name), Dt(t, n, e)) : null;
643
+ }), t.filter((e) => !c.has(e.name)).map((e) => Dt(e, n))]
635
644
  });
636
645
  }
637
- function Et(e, t, n) {
646
+ function Dt(e, t, n) {
638
647
  let r = e.sourceProperty ?? e.name, i = t.find((e) => e.name === r), a = e.label ?? e.name, o = (e) => e[r], s = i?.required ?? !0, c = (() => {
639
648
  switch (i?.type ?? "text") {
640
649
  case "number": return /* @__PURE__ */ P(Ne, {
@@ -663,7 +672,7 @@ function Et(e, t, n) {
663
672
  required: s
664
673
  });
665
674
  }
666
- })(), l = Ft(n);
675
+ })(), l = It(n);
667
676
  return /* @__PURE__ */ P("span", {
668
677
  className: "stage-command-form__field",
669
678
  "data-field": e.name,
@@ -674,7 +683,7 @@ function Et(e, t, n) {
674
683
  children: c
675
684
  }, e.name);
676
685
  }
677
- function Dt(e, t) {
686
+ function Ot(e, t) {
678
687
  let n = {};
679
688
  for (let r of e) {
680
689
  let e = r.sourceProperty ?? r.name, i = t[e];
@@ -682,45 +691,45 @@ function Dt(e, t) {
682
691
  }
683
692
  return n;
684
693
  }
685
- function Ot(e, t, n) {
686
- let r = a(() => kt(e, t), [e, t]), i = r.map((e) => n(e.source)), o = JSON.stringify(i);
694
+ function kt(e, t, n) {
695
+ let r = a(() => At(e, t), [e, t]), i = r.map((e) => n(e.source)), o = JSON.stringify(i);
687
696
  return a(() => {
688
697
  let e = Object.fromEntries(r.map((e, t) => [e.name, i[t]]).filter(([, e]) => e != null && e !== ""));
689
698
  return Object.keys(e).length > 0 ? e : void 0;
690
699
  }, [r, o]);
691
700
  }
692
- function kt(e, t) {
701
+ function At(e, t) {
693
702
  let n = e.properties.arguments;
694
703
  if (!Array.isArray(n)) return [];
695
704
  let r = new Set(t.map((e) => e.sourceProperty ?? e.name));
696
705
  return n.filter((e) => typeof e == "object" && !!e && typeof e.name == "string" && typeof e.source == "string" && r.has(e.name));
697
706
  }
698
- function At(e) {
707
+ function jt(e) {
699
708
  return e === u.Manual ? u.Manual : u.Auto;
700
709
  }
701
- function jt(e) {
710
+ function Mt(e) {
702
711
  if (!q(e)) return;
703
712
  let t = e;
704
713
  return {
705
- columns: Array.isArray(t.columns) ? t.columns.filter(Ht) : [],
706
- placements: Array.isArray(t.placements) ? t.placements.filter(Ut) : [],
707
- columnGap: Wt(t.columnGap) ? t.columnGap : void 0,
708
- rowGap: Wt(t.rowGap) ? t.rowGap : void 0
714
+ columns: Array.isArray(t.columns) ? t.columns.filter(Ut) : [],
715
+ placements: Array.isArray(t.placements) ? t.placements.filter(Wt) : [],
716
+ columnGap: Gt(t.columnGap) ? t.columnGap : void 0,
717
+ rowGap: Gt(t.rowGap) ? t.rowGap : void 0
709
718
  };
710
719
  }
711
- function Mt(e, t) {
720
+ function Nt(e, t) {
712
721
  let n = new Map(e.placements.map((e) => [e.field, e]));
713
- for (let e of t) !n.has(e.name) && Ut(e.placement) && n.set(e.name, e.placement);
722
+ for (let e of t) !n.has(e.name) && Wt(e.placement) && n.set(e.name, e.placement);
714
723
  return [...n.values()].sort((e, t) => e.row - t.row || e.column - t.column || e.field.localeCompare(t.field));
715
724
  }
716
- function Nt(e, t) {
725
+ function Pt(e, t) {
717
726
  return Math.max(1, ...e.columns.map((e) => e.index), ...t.map((e) => e.column + (e.columnSpan ?? 1) - 1));
718
727
  }
719
- function Pt(e, t) {
728
+ function Ft(e, t) {
720
729
  let n = t.find((t) => t.index === e), r = G(n?.width), i = G(n?.minWidth), a = G(n?.maxWidth);
721
730
  return n?.width?.unit === d.Fraction && a ? `minmax(${i ?? "0"}, ${r ?? "1fr"})` : i || a ? `minmax(${i ?? "0"}, ${a && r ? `min(${r}, ${a})` : a ?? r ?? "1fr"})` : r ?? "1fr";
722
731
  }
723
- function Ft(e) {
732
+ function It(e) {
724
733
  if (e) return {
725
734
  gridColumn: `${e.column} / span ${e.columnSpan ?? 1}`,
726
735
  gridRow: `${e.row} / span ${e.rowSpan ?? 1}`,
@@ -735,31 +744,31 @@ function G(e) {
735
744
  case d.Auto: return "auto";
736
745
  }
737
746
  }
738
- function It(e, t, n, r) {
747
+ function Lt(e, t, n, r) {
739
748
  let i = e.find((e) => (e.sourceProperty ?? e.name) === n);
740
749
  if ((t.find((e) => e.name === n)?.required ?? !0) && (r == null || r === "")) return `${i?.label ?? n} is required`;
741
750
  }
742
- function Lt(e, t) {
751
+ function Rt(e, t) {
743
752
  let n = new Map(t.map((e) => [e.name, e]));
744
753
  return e.flatMap((e) => {
745
754
  let t = n.get(e.sourceProperty ?? e.name);
746
755
  return t?.unsupportedReason ? [`The field “${e.label ?? e.name}” uses unsupported schema metadata: ${t.unsupportedReason}.`] : [];
747
756
  });
748
757
  }
749
- function Rt(e, t) {
758
+ function zt(e, t) {
750
759
  if (!e) return [];
751
- let n = Mt(e, t).filter((e) => e.width?.unit === d.Fraction).map((e) => `The field “${e.field}” uses a fractional field width, which cannot be applied to an individual form control.`), r = e.columns.filter((e) => e.width?.unit === d.Fraction && !!e.maxWidth).map((e) => `Column ${e.index} combines a fractional width with maxWidth; Stage keeps the fractional track and ignores maxWidth for that column.`);
760
+ let n = Nt(e, t).filter((e) => e.width?.unit === d.Fraction).map((e) => `The field “${e.field}” uses a fractional field width, which cannot be applied to an individual form control.`), r = e.columns.filter((e) => e.width?.unit === d.Fraction && !!e.maxWidth).map((e) => `Column ${e.index} combines a fractional width with maxWidth; Stage keeps the fractional track and ignores maxWidth for that column.`);
752
761
  return [...n, ...r];
753
762
  }
754
- function zt(e) {
755
- return Bt(K(e, "schema"));
756
- }
757
763
  function Bt(e) {
764
+ return Vt(K(e, "schema"));
765
+ }
766
+ function Vt(e) {
758
767
  if (!e) return [];
759
768
  try {
760
769
  let t = JSON.parse(e), n = Object.prototype.hasOwnProperty.call(t, "required"), r = Array.isArray(t.required) ? new Set(t.required.filter((e) => typeof e == "string")) : /* @__PURE__ */ new Set();
761
770
  return Object.entries(t.properties ?? {}).map(([e, t]) => {
762
- let i = Vt(t);
771
+ let i = Ht(t);
763
772
  return {
764
773
  name: e,
765
774
  type: i.type,
@@ -771,11 +780,11 @@ function Bt(e) {
771
780
  return [];
772
781
  }
773
782
  }
774
- function Vt(e) {
783
+ function Ht(e) {
775
784
  let t = e?.type;
776
785
  if (Array.isArray(t)) {
777
786
  let n = t.filter((e) => e !== "null");
778
- return n.length === 1 ? Vt({
787
+ return n.length === 1 ? Ht({
779
788
  ...e,
780
789
  type: n[0]
781
790
  }) : { unsupportedReason: `union type ${JSON.stringify(t)}` };
@@ -786,13 +795,13 @@ function K(e, t, n = "") {
786
795
  let r = e.properties[t];
787
796
  return typeof r == "string" ? r : n;
788
797
  }
789
- function Ht(e) {
798
+ function Ut(e) {
790
799
  return q(e) && typeof e.index == "number" && Number.isInteger(e.index) && e.index > 0;
791
800
  }
792
- function Ut(e) {
801
+ function Wt(e) {
793
802
  return q(e) && typeof e.field == "string" && typeof e.row == "number" && typeof e.column == "number" && e.row > 0 && e.column > 0;
794
803
  }
795
- function Wt(e) {
804
+ function Gt(e) {
796
805
  return q(e) && Object.values(d).includes(e.unit);
797
806
  }
798
807
  function q(e) {
@@ -800,34 +809,34 @@ function q(e) {
800
809
  }
801
810
  //#endregion
802
811
  //#region src/stageNavigation.ts
803
- function Gt(e, t = {}) {
812
+ function Kt(e, t = {}) {
804
813
  let n = new URLSearchParams(Object.entries(t).filter(([, e]) => e !== "")).toString();
805
814
  return n ? `#/${encodeURIComponent(e)}?${n}` : `#/${encodeURIComponent(e)}`;
806
815
  }
807
816
  function J(e, t = {}) {
808
817
  if (!globalThis.location) return;
809
- let n = Gt(e, t);
818
+ let n = Kt(e, t);
810
819
  globalThis.location.hash !== n && (globalThis.location.hash = n);
811
820
  }
812
- function Kt(e) {
821
+ function qt(e) {
813
822
  return Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null && e !== "" && typeof e != "object").map(([e, t]) => [e, String(t)]));
814
823
  }
815
824
  //#endregion
816
825
  //#region src/StageGuardedAction.tsx
817
- function qt(e) {
826
+ function Jt(e) {
818
827
  return typeof e == "object" && !!e && !Array.isArray(e);
819
828
  }
820
829
  function Y(e, t) {
821
830
  let n = e.properties[t];
822
831
  return typeof n == "string" ? n : "";
823
832
  }
824
- function Jt(e) {
833
+ function Yt(e) {
825
834
  return e.componentName === "core:action" && (Array.isArray(e.properties.alternatives) || e.properties.otherwise !== void 0);
826
835
  }
827
- function Yt(e) {
828
- let t = V(), n = Y(e, "itemQuery"), r = (n ? t.routes?.queries[n] : void 0) ?? Y(e, "itemRoute"), i = qt(e.properties.itemArguments) ? e.properties.itemArguments : {}, a = {}, o = !0;
836
+ function Xt(e) {
837
+ let t = V(), n = Y(e, "itemQuery"), r = (n ? t.routes?.queries[n] : void 0) ?? Y(e, "itemRoute"), i = Jt(e.properties.itemArguments) ? e.properties.itemArguments : {}, a = {}, o = !0;
829
838
  for (let [e, n] of Object.entries(i)) {
830
- let r = qt(n) ? t.resolveBinding(n) : n;
839
+ let r = Jt(n) ? t.resolveBinding(n) : n;
831
840
  a[e] = r, (r == null || r === "") && (o = !1);
832
841
  }
833
842
  let s = tt({
@@ -843,11 +852,11 @@ function Yt(e) {
843
852
  item: s.rows.length === 1 ? s.rows[0] : void 0
844
853
  };
845
854
  }
846
- function Xt(e, t) {
855
+ function Zt(e, t) {
847
856
  return Object.fromEntries(Object.entries(e.arguments ?? {}).map(([e, n]) => [e, B(Be(n) ?? "", t)]));
848
857
  }
849
- function Zt({ element: e, interactions: t }) {
850
- let n = V(), r = Yt(e), i = bt(), [o, c] = s([]), [l, u] = s(!1), d = Y(e, "label"), f = a(() => Array.isArray(e.properties.alternatives) ? e.properties.alternatives : [], [e]), p = qt(e.properties.otherwise) ? e.properties.otherwise : void 0, m = f.map((e) => e.condition), h = !p || p.outcome === "Hidden" || p.outcome === "Execute" && !!p.command;
858
+ function Qt({ element: e, interactions: t }) {
859
+ let n = V(), r = Xt(e), i = xt(), [o, c] = s([]), [l, u] = s(!1), d = Y(e, "label"), f = a(() => Array.isArray(e.properties.alternatives) ? e.properties.alternatives : [], [e]), p = Jt(e.properties.otherwise) ? e.properties.otherwise : void 0, m = f.map((e) => e.condition), h = !p || p.outcome === "Hidden" || p.outcome === "Execute" && !!p.command;
851
860
  if (!qe(m) || !h || !r.hasSource) {
852
861
  let n = r.hasSource ? `${Ve}: “${d}” has a guard this Stage cannot evaluate, so it stays unavailable.` : `${Ve}: “${d}” has no data subject to evaluate its guard against.`;
853
862
  return /* @__PURE__ */ F("div", {
@@ -872,7 +881,7 @@ function Zt({ element: e, interactions: t }) {
872
881
  let v = _.command, y = W(v), b = r.item, x = async () => {
873
882
  if (!y) return;
874
883
  u(!0);
875
- let t = await i(v, Xt(_, b));
884
+ let t = await i(v, Zt(_, b));
876
885
  if (u(!1), c(t.messages), !t.isSuccess) return;
877
886
  n.refreshAfterCommand();
878
887
  let r = Y(e, "navigateToScreen"), a = Y(e, "navigateByParameter"), o = a ? B(`item.${a}`, b) : void 0;
@@ -896,7 +905,7 @@ function Zt({ element: e, interactions: t }) {
896
905
  }, e))]
897
906
  });
898
907
  }
899
- function Qt(e) {
908
+ function $t(e) {
900
909
  let t = O(), r = o(void 0), s = a(() => _(te(e.id, e.behaviors), f.DoubleClick), [e.behaviors, e.id]);
901
910
  i(() => () => clearTimeout(r.current), []);
902
911
  let c = n((e) => {
@@ -924,8 +933,8 @@ function Qt(e) {
924
933
  }
925
934
  //#endregion
926
935
  //#region src/stageComponents.tsx
927
- var $t = "Stage:commandForm";
928
- function en(e, t, n = {}) {
936
+ var en = "Stage:commandForm";
937
+ function tn(e, t, n = {}) {
929
938
  return {
930
939
  id: e,
931
940
  componentName: "",
@@ -937,15 +946,15 @@ function X(e, t, n = "") {
937
946
  let r = e.properties[t];
938
947
  return typeof r == "string" ? r : n;
939
948
  }
940
- function tn(e, t) {
949
+ function nn(e, t) {
941
950
  let n = e.properties.queryArguments;
942
- if (!on(n)) return {
951
+ if (!sn(n)) return {
943
952
  values: {},
944
953
  ready: !0
945
954
  };
946
955
  let r = {}, i = !0;
947
956
  for (let [e, a] of Object.entries(n)) {
948
- let n = an(a) ? t.resolveBinding(a) : a;
957
+ let n = on(a) ? t.resolveBinding(a) : a;
949
958
  r[e] = n, (n == null || n === "") && (i = !1);
950
959
  }
951
960
  return {
@@ -953,7 +962,7 @@ function tn(e, t) {
953
962
  ready: i
954
963
  };
955
964
  }
956
- function nn(e, t) {
965
+ function rn(e, t) {
957
966
  let n = (e.slots.columns ?? []).map((e) => {
958
967
  let t = e.properties;
959
968
  return {
@@ -969,14 +978,14 @@ function nn(e, t) {
969
978
  function Z(e, t) {
970
979
  return e[t] ?? e.id ?? e.key;
971
980
  }
972
- function rn({ element: e, slots: t }) {
973
- let n = V(), r = X(e, "query", X(e, "typeName", e.id)), o = (X(e, "query") ? n.routes?.queries[X(e, "query")] : void 0) ?? X(e, "route"), s = a(() => tn(e, n), [n, e]), { rows: c, error: l, loading: u } = tt({
981
+ function an({ element: e, slots: t }) {
982
+ let n = V(), r = X(e, "query", X(e, "typeName", e.id)), o = (X(e, "query") ? n.routes?.queries[X(e, "query")] : void 0) ?? X(e, "route"), s = a(() => nn(e, n), [n, e]), { rows: c, error: l, loading: u } = tt({
974
983
  scope: e.id,
975
984
  name: r,
976
985
  route: o || void 0,
977
986
  arguments: s.values,
978
987
  ready: s.ready
979
- }), d = nn(e, c), f = X(e, "navigateOnRowClickToScreen"), p = X(e, "navigateOnRowClickByParameter"), m = X(e, "dataKey") || p || "id", h = n.selections[e.id], g = p ? n.parameters[p] : void 0, _ = Qt(e);
988
+ }), d = rn(e, c), f = X(e, "navigateOnRowClickToScreen"), p = X(e, "navigateOnRowClickByParameter"), m = X(e, "dataKey") || p || "id", h = n.selections[e.id], g = p ? n.parameters[p] : void 0, _ = $t(e);
980
989
  i(() => {
981
990
  if (!h) return;
982
991
  let t = Z(h, m), r = t === void 0 ? void 0 : c.find((e) => Z(e, m) === t);
@@ -1027,14 +1036,14 @@ function rn({ element: e, slots: t }) {
1027
1036
  "data-scene-id": e.id,
1028
1037
  children: [
1029
1038
  u && /* @__PURE__ */ P(Ce, {
1030
- element: en(`${e.id}-loading`, {
1039
+ element: tn(`${e.id}-loading`, {
1031
1040
  severity: "info",
1032
1041
  text: "Loading…"
1033
1042
  }),
1034
1043
  slots: {}
1035
1044
  }),
1036
1045
  l && /* @__PURE__ */ P(Ce, {
1037
- element: en(`${e.id}-error`, {
1046
+ element: tn(`${e.id}-error`, {
1038
1047
  severity: "error",
1039
1048
  text: l
1040
1049
  }),
@@ -1083,23 +1092,23 @@ function rn({ element: e, slots: t }) {
1083
1092
  }), t.columns]
1084
1093
  });
1085
1094
  }
1086
- function an(e) {
1087
- return on(e) && (typeof e.path == "string" || typeof e.kind == "string");
1088
- }
1089
1095
  function on(e) {
1096
+ return sn(e) && (typeof e.path == "string" || typeof e.kind == "string");
1097
+ }
1098
+ function sn(e) {
1090
1099
  return typeof e == "object" && !!e && !Array.isArray(e);
1091
1100
  }
1092
- function sn({ element: e, interactions: t, slots: n }) {
1093
- return Jt(e) ? /* @__PURE__ */ P(Zt, {
1101
+ function cn({ element: e, interactions: t, slots: n }) {
1102
+ return Yt(e) ? /* @__PURE__ */ P(Qt, {
1094
1103
  element: e,
1095
1104
  interactions: t
1096
- }) : /* @__PURE__ */ P(cn, {
1105
+ }) : /* @__PURE__ */ P(ln, {
1097
1106
  element: e,
1098
1107
  interactions: t,
1099
1108
  slots: n
1100
1109
  });
1101
1110
  }
1102
- function cn({ element: e, interactions: t }) {
1111
+ function ln({ element: e, interactions: t }) {
1103
1112
  let n = X(e, "label", X(e, "command"));
1104
1113
  if (!W(X(e, "command"), X(e, "typeName"), X(e, "route"))) return /* @__PURE__ */ P(I, {
1105
1114
  type: "button",
@@ -1109,12 +1118,12 @@ function cn({ element: e, interactions: t }) {
1109
1118
  ...t,
1110
1119
  children: n
1111
1120
  });
1112
- let r = /* @__PURE__ */ P(xt, { element: e });
1121
+ let r = /* @__PURE__ */ P(St, { element: e });
1113
1122
  return /* @__PURE__ */ P("div", {
1114
1123
  className: "stage-action",
1115
1124
  "data-scene-id": e.id,
1116
1125
  children: /* @__PURE__ */ P(Se, {
1117
- element: en(e.id, {
1126
+ element: tn(e.id, {
1118
1127
  visible: !1,
1119
1128
  header: n,
1120
1129
  triggerLabel: n
@@ -1123,7 +1132,7 @@ function cn({ element: e, interactions: t }) {
1123
1132
  })
1124
1133
  });
1125
1134
  }
1126
- function ln(e) {
1135
+ function un(e) {
1127
1136
  let { element: t } = e;
1128
1137
  if (X(t, "kind").toLowerCase() !== "action" || X(t, "slice") !== "") return /* @__PURE__ */ P(x, { ...e });
1129
1138
  let n = X(t, "name", t.id), r = {
@@ -1137,23 +1146,23 @@ function ln(e) {
1137
1146
  return /* @__PURE__ */ P("span", {
1138
1147
  className: "stage-toolbar-action",
1139
1148
  "data-scene-toolbar-item": n,
1140
- children: /* @__PURE__ */ P(sn, {
1149
+ children: /* @__PURE__ */ P(cn, {
1141
1150
  element: r,
1142
1151
  interactions: e.interactions,
1143
1152
  slots: e.slots
1144
1153
  })
1145
1154
  });
1146
1155
  }
1147
- var un = {
1156
+ var dn = {
1148
1157
  ...E,
1149
- "core:table": rn,
1150
- "core:action": sn,
1151
- "core:toolbarItem": ln,
1152
- [$t]: xt
1158
+ "core:table": an,
1159
+ "core:action": cn,
1160
+ "core:toolbarItem": un,
1161
+ [en]: St
1153
1162
  };
1154
1163
  //#endregion
1155
1164
  //#region src/useStrings.ts
1156
- function dn() {
1165
+ function fn() {
1157
1166
  let e = L(), [t, n] = s([]), [r, a] = s(""), [o, c] = s({});
1158
1167
  return i(() => {
1159
1168
  let t = new AbortController();
@@ -1171,7 +1180,7 @@ function dn() {
1171
1180
  dictionary: o
1172
1181
  };
1173
1182
  }
1174
- function fn(e) {
1183
+ function pn(e) {
1175
1184
  let t = /* @__PURE__ */ new Set(), n = [];
1176
1185
  for (let r of e) for (let e of r.contributions ?? []) {
1177
1186
  if (e.contributionPointName !== "Navigation") continue;
@@ -1184,7 +1193,7 @@ function fn(e) {
1184
1193
  ]);
1185
1194
  if (t.has(s)) continue;
1186
1195
  t.add(s);
1187
- let c = e.order ?? (typeof r.order == "number" ? r.order : void 0), l = hn(r.destination) ? r.destination : void 0;
1196
+ let c = e.order ?? (typeof r.order == "number" ? r.order : void 0), l = gn(r.destination) ? r.destination : void 0;
1188
1197
  n.push({
1189
1198
  label: i,
1190
1199
  targetScreen: a,
@@ -1192,7 +1201,7 @@ function fn(e) {
1192
1201
  order: c,
1193
1202
  ...typeof r.icon == "string" ? { icon: r.icon } : {},
1194
1203
  ...typeof r.presentation == "string" ? { presentation: r.presentation } : {},
1195
- ...l && gn(l) ? { destination: l } : {}
1204
+ ...l && _n(l) ? { destination: l } : {}
1196
1205
  });
1197
1206
  }
1198
1207
  return n.map((e, t) => ({
@@ -1200,7 +1209,7 @@ function fn(e) {
1200
1209
  index: t
1201
1210
  })).sort((e, t) => (e.entry.order ?? 2 ** 53 - 1) - (t.entry.order ?? 2 ** 53 - 1) || e.index - t.index).map(({ entry: e }) => e);
1202
1211
  }
1203
- function pn(e) {
1212
+ function mn(e) {
1204
1213
  let t = {
1205
1214
  label: "",
1206
1215
  children: []
@@ -1225,21 +1234,21 @@ function pn(e) {
1225
1234
  }
1226
1235
  return t.children;
1227
1236
  }
1228
- function mn(e, t) {
1237
+ function hn(e, t) {
1229
1238
  for (let n of e) {
1230
1239
  if (n.screen === t) return [n.label];
1231
- let e = mn(n.children, t);
1240
+ let e = hn(n.children, t);
1232
1241
  if (e.length > 0) return [n.label, ...e];
1233
1242
  }
1234
1243
  return [];
1235
1244
  }
1236
- function hn(e) {
1245
+ function gn(e) {
1237
1246
  return typeof e == "object" && !!e && !Array.isArray(e);
1238
1247
  }
1239
- function gn(e) {
1248
+ function _n(e) {
1240
1249
  return e.outlet !== void 0 || e.dialog !== void 0 || e.kind === "external" || e.kind === "dialog";
1241
1250
  }
1242
- function _n(e, t, n) {
1251
+ function vn(e, t, n) {
1243
1252
  return e.filter((e) => !t.has(e.name)).map((e) => ({
1244
1253
  label: e.name,
1245
1254
  targetScreen: e.name,
@@ -1248,8 +1257,8 @@ function _n(e, t, n) {
1248
1257
  }
1249
1258
  //#endregion
1250
1259
  //#region src/blueprint.ts
1251
- var vn = "Stage:locale";
1252
- function yn(e) {
1260
+ var yn = "Stage:locale";
1261
+ function bn(e) {
1253
1262
  let t = ve(e), n = t.packages.filter((e) => e !== "PrimeReact");
1254
1263
  return n.splice(Math.max(n.indexOf(ue), 0), 0, "PrimeReact"), {
1255
1264
  ...t,
@@ -1257,11 +1266,11 @@ function yn(e) {
1257
1266
  packages: n
1258
1267
  };
1259
1268
  }
1260
- var bn = {
1269
+ var xn = {
1261
1270
  ...se,
1262
1271
  PrimeReact: Te.components
1263
1272
  };
1264
- function xn(e) {
1273
+ function Sn(e) {
1265
1274
  return {
1266
1275
  ...E,
1267
1276
  ...we,
@@ -1270,14 +1279,14 @@ function xn(e) {
1270
1279
  ...e
1271
1280
  };
1272
1281
  }
1273
- function Sn(e) {
1282
+ function Cn(e) {
1274
1283
  return e ? {
1275
1284
  ...e,
1276
- ...bn
1277
- } : bn;
1285
+ ...xn
1286
+ } : xn;
1278
1287
  }
1279
- var Cn = "Stage:navigationTree";
1280
- function wn(e, t, n) {
1288
+ var wn = "Stage:navigationTree";
1289
+ function Tn(e, t, n) {
1281
1290
  return N(e, j.Logo, {
1282
1291
  label: t,
1283
1292
  initials: t.slice(0, 1).toUpperCase() || "S",
@@ -1285,31 +1294,31 @@ function wn(e, t, n) {
1285
1294
  ...n ? { lightImageUrl: n } : {}
1286
1295
  });
1287
1296
  }
1288
- function Tn(e, t, n, r, i, a = !1, o = !0) {
1289
- let s = e[0]?.name ?? "", c = i?.title ?? "Cratis Stage", l = fn(e), u = _n(e, new Set(l.map((e) => e.targetScreen)), "Other screens"), d = pn([...l, ...l.length > 0 ? u : []]), f = e.map((e, n) => ge({
1297
+ function En(e, t, n, r, i, a = !1, o = !0) {
1298
+ let s = e[0]?.name ?? "", c = i?.title ?? "Cratis Stage", l = pn(e), u = vn(e, new Set(l.map((e) => e.targetScreen)), "Other screens"), d = mn([...l, ...l.length > 0 ? u : []]), f = e.map((e, n) => ge({
1290
1299
  label: e.name,
1291
1300
  targetScreen: e.name,
1292
1301
  icon: "pi pi-table",
1293
1302
  group: "Screens",
1294
1303
  order: n
1295
- }, t)), p = mn(pn(l), t), m = e.find((e) => e.name === t)?.path?.length ? mn(d, t) : [], h = p.length > 0 ? p : m, g = l.length > 0 ? N("menu-hierarchy", Cn, {
1304
+ }, t)), p = hn(mn(l), t), m = e.find((e) => e.name === t)?.path?.length ? hn(d, t) : [], h = p.length > 0 ? p : m, g = l.length > 0 ? N("menu-hierarchy", wn, {
1296
1305
  nodes: d,
1297
1306
  activeScreen: t
1298
1307
  }) : N("menu-screens", j.Menu, {
1299
1308
  title: "Screens",
1300
1309
  label: "Screens"
1301
1310
  }, { items: f }), _ = [];
1302
- n.length > 1 && _.push(N("topbar-locale", vn, {
1311
+ n.length > 1 && _.push(N("topbar-locale", yn, {
1303
1312
  locales: n,
1304
1313
  locale: r
1305
1314
  })), _.push(N("topbar-theme", j.ThemeSwitcher, { label: "Theme" }));
1306
1315
  let v = { regionNavigation: a };
1307
1316
  return {
1308
1317
  [M.Topbar]: [N("topbar", j.Topbar, v, {
1309
- logo: [wn("topbar-logo", c, i?.image)],
1318
+ logo: [Tn("topbar-logo", c, i?.image)],
1310
1319
  end: _
1311
1320
  })],
1312
- [M.Sidebar]: [N("sidebar", j.Sidebar, v, { logo: [wn("sidebar-logo", c, i?.image)] })],
1321
+ [M.Sidebar]: [N("sidebar", j.Sidebar, v, { logo: [Tn("sidebar-logo", c, i?.image)] })],
1313
1322
  ...a ? {} : { [M.Menu]: [g] },
1314
1323
  [M.Breadcrumb]: [N("breadcrumb", j.Breadcrumb, {
1315
1324
  homeTargetScreen: s,
@@ -1326,26 +1335,26 @@ function Tn(e, t, n, r, i, a = !1, o = !0) {
1326
1335
  })]
1327
1336
  };
1328
1337
  }
1329
- function En(e) {
1338
+ function Dn(e) {
1330
1339
  return `#/${encodeURIComponent(e)}`;
1331
1340
  }
1332
1341
  //#endregion
1333
1342
  //#region src/StageChrome.tsx
1334
- var Dn = e({
1343
+ var On = e({
1335
1344
  locales: [],
1336
1345
  locale: "",
1337
1346
  setLocale: () => void 0,
1338
1347
  activity: ""
1339
1348
  });
1340
- function On({ state: e, children: t }) {
1341
- return /* @__PURE__ */ P(Dn.Provider, {
1349
+ function kn({ state: e, children: t }) {
1350
+ return /* @__PURE__ */ P(On.Provider, {
1342
1351
  value: e,
1343
1352
  children: t
1344
1353
  });
1345
1354
  }
1346
- var kn = "Stage:activity";
1347
- function An() {
1348
- let { locales: e, locale: t, setLocale: n } = r(Dn);
1355
+ var An = "Stage:activity";
1356
+ function jn() {
1357
+ let { locales: e, locale: t, setLocale: n } = r(On);
1349
1358
  return e.length < 2 ? null : /* @__PURE__ */ P("select", {
1350
1359
  className: "stage-locale",
1351
1360
  "aria-label": "Locale",
@@ -1357,19 +1366,19 @@ function An() {
1357
1366
  }, e))
1358
1367
  });
1359
1368
  }
1360
- function jn({ element: e }) {
1369
+ function Mn({ element: e }) {
1361
1370
  let t = e.properties ?? {};
1362
1371
  return /* @__PURE__ */ P("nav", {
1363
1372
  className: "stage-navigation-tree",
1364
1373
  "aria-label": "Navigation",
1365
1374
  "data-scene-id": e.id,
1366
- children: /* @__PURE__ */ P(Mn, {
1375
+ children: /* @__PURE__ */ P(Nn, {
1367
1376
  nodes: t.nodes ?? [],
1368
1377
  activeScreen: t.activeScreen
1369
1378
  })
1370
1379
  });
1371
1380
  }
1372
- function Mn({ nodes: e, activeScreen: t }) {
1381
+ function Nn({ nodes: e, activeScreen: t }) {
1373
1382
  return /* @__PURE__ */ P("ul", {
1374
1383
  role: "tree",
1375
1384
  children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ F("li", {
@@ -1378,13 +1387,13 @@ function Mn({ nodes: e, activeScreen: t }) {
1378
1387
  children: [/* @__PURE__ */ P("span", {
1379
1388
  className: "stage-navigation-group",
1380
1389
  children: e.label
1381
- }), /* @__PURE__ */ P(Mn, {
1390
+ }), /* @__PURE__ */ P(Nn, {
1382
1391
  nodes: e.children,
1383
1392
  activeScreen: t
1384
1393
  })]
1385
1394
  }, e.label) : /* @__PURE__ */ P("li", {
1386
1395
  role: "treeitem",
1387
- children: /* @__PURE__ */ P(Nn, {
1396
+ children: /* @__PURE__ */ P(Pn, {
1388
1397
  node: e,
1389
1398
  screen: e.screen,
1390
1399
  activeScreen: t
@@ -1392,12 +1401,12 @@ function Mn({ nodes: e, activeScreen: t }) {
1392
1401
  }, `${e.screen}:${e.label}`))
1393
1402
  });
1394
1403
  }
1395
- function Nn({ node: e, screen: t, activeScreen: n }) {
1396
- let i = r(w), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external" && o.route !== void 0, c = o && i && !s && gn(o) ? (e) => {
1404
+ function Pn({ node: e, screen: t, activeScreen: n }) {
1405
+ let i = r(w), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external" && o.route !== void 0, c = o && i && !s && _n(o) ? (e) => {
1397
1406
  e.preventDefault(), i.navigate(o);
1398
1407
  } : void 0;
1399
1408
  return /* @__PURE__ */ F("a", {
1400
- href: s ? o.route : En(t),
1409
+ href: s ? o.route : Dn(t),
1401
1410
  rel: s ? "noreferrer" : void 0,
1402
1411
  "aria-current": t === n ? "page" : void 0,
1403
1412
  "aria-label": a === "icon" ? e.label : void 0,
@@ -1411,7 +1420,7 @@ function Nn({ node: e, screen: t, activeScreen: n }) {
1411
1420
  }), a !== "icon" && e.label]
1412
1421
  });
1413
1422
  }
1414
- function Pn({ element: e }) {
1423
+ function Fn({ element: e }) {
1415
1424
  let t = typeof e.properties.name == "string" ? e.properties.name : "", n = r(w), i = ie(), a = V(), o = n?.outlets[t], s = o && i ? i.screens[o] : void 0, c = e.properties.closable === !0;
1416
1425
  return /* @__PURE__ */ F("div", {
1417
1426
  "data-scene-outlet": t,
@@ -1432,15 +1441,15 @@ function Pn({ element: e }) {
1432
1441
  })]
1433
1442
  });
1434
1443
  }
1435
- function Fn() {
1436
- let { activity: e } = r(Dn);
1444
+ function In() {
1445
+ let { activity: e } = r(On);
1437
1446
  return e ? /* @__PURE__ */ P("p", {
1438
1447
  className: "stage-activity",
1439
1448
  role: "status",
1440
1449
  children: e
1441
1450
  }) : null;
1442
1451
  }
1443
- function In() {
1452
+ function Ln() {
1444
1453
  let e = k(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
1445
1454
  return i(() => {
1446
1455
  let r = e?.isDark ? "dark" : "light";
@@ -1451,25 +1460,25 @@ function In() {
1451
1460
  n
1452
1461
  ]), null;
1453
1462
  }
1454
- var Ln = {
1455
- [vn]: An,
1456
- [Cn]: jn,
1457
- [kn]: Fn,
1458
- "core:outlet": Pn
1459
- }, Rn = [
1463
+ var Rn = {
1464
+ [yn]: jn,
1465
+ [wn]: Mn,
1466
+ [An]: In,
1467
+ "core:outlet": Fn
1468
+ }, zn = [
1460
1469
  "navigationMode",
1461
1470
  "menuTheme",
1462
1471
  "showFooter"
1463
- ], zn = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
1464
- function Bn(e, t, n = !1) {
1472
+ ], Bn = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
1473
+ function Vn(e, t, n = !1) {
1465
1474
  let r = [], i = t.options ?? {}, a = {
1466
1475
  showFooter: !0,
1467
1476
  followsSystem: !1,
1468
1477
  problems: r
1469
1478
  };
1470
1479
  for (let [e, n] of Object.entries(i)) {
1471
- if (!Rn.includes(e)) {
1472
- r.push(`The shell '${t.name}' has no option '${e}'; the options it understands are ${Rn.join(", ")}.`);
1480
+ if (!zn.includes(e)) {
1481
+ r.push(`The shell '${t.name}' has no option '${e}'; the options it understands are ${zn.join(", ")}.`);
1473
1482
  continue;
1474
1483
  }
1475
1484
  if (e === "navigationMode") {
@@ -1486,9 +1495,9 @@ function Bn(e, t, n = !1) {
1486
1495
  let e = a.followsSystem ? n : o.colorScheme === c.Dark;
1487
1496
  a.colorScheme = e ? A.Dark : A.Light, a.themeName = de.find((t) => (t.isDark ?? !1) === e)?.name;
1488
1497
  }
1489
- return o?.accent !== void 0 && (zn.test(o.accent) ? a.accent = o.accent : r.push(`The accent '${o.accent}' is not a colour written as #rgb or #rrggbb.`)), a;
1498
+ return o?.accent !== void 0 && (Bn.test(o.accent) ? a.accent = o.accent : r.push(`The accent '${o.accent}' is not a colour written as #rgb or #rrggbb.`)), a;
1490
1499
  }
1491
- function Vn(e, t) {
1500
+ function Hn(e, t) {
1492
1501
  if (e?.root === void 0) return [];
1493
1502
  let n = /* @__PURE__ */ new Set([
1494
1503
  p.RootTemplateUnknown,
@@ -1500,7 +1509,7 @@ function Vn(e, t) {
1500
1509
  ]), r = t.diagnostics.filter((e) => n.has(e.code)).map((e) => e.message);
1501
1510
  return r.length === 0 && t.origin !== m.Root && r.push(`The root template '${e.root.template.id}' did not resolve, so the application would not start in the shell it names.`), r;
1502
1511
  }
1503
- function Hn(e) {
1512
+ function Un(e) {
1504
1513
  let t = e.length === 4 ? [...e.slice(1)].map((e) => e + e).join("") : e.slice(1), [n, r, i] = [
1505
1514
  0,
1506
1515
  2,
@@ -1508,7 +1517,7 @@ function Hn(e) {
1508
1517
  ].map((e) => parseInt(t.slice(e, e + 2), 16));
1509
1518
  return (n * 299 + r * 587 + i * 114) / 1e3 >= 150 ? "#111827" : "#ffffff";
1510
1519
  }
1511
- function Un(e, t) {
1520
+ function Wn(e, t) {
1512
1521
  if (t === void 0) return e;
1513
1522
  let n = t.length === 4 ? [...t.slice(1)].map((e) => e + e).join("") : t.slice(1), [r, i, a] = [
1514
1523
  0,
@@ -1520,18 +1529,18 @@ function Un(e, t) {
1520
1529
  tokens: {
1521
1530
  ...e.tokens,
1522
1531
  "primary.color": t,
1523
- "primary.contrastColor": Hn(t),
1532
+ "primary.contrastColor": Un(t),
1524
1533
  "focus.ring": `0 0 0 2px rgb(${r} ${i} ${a} / 0.4)`
1525
1534
  }
1526
1535
  }));
1527
1536
  }
1528
1537
  //#endregion
1529
1538
  //#region src/StageShellSettings.tsx
1530
- var Wn = "(prefers-color-scheme: dark)";
1531
- function Gn() {
1539
+ var Gn = "(prefers-color-scheme: dark)";
1540
+ function Kn() {
1532
1541
  return globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
1533
1542
  }
1534
- function Kn({ settings: e, onSystemSchemeChange: t }) {
1543
+ function qn({ settings: e, onSystemSchemeChange: t }) {
1535
1544
  let n = o(ye());
1536
1545
  n.current = ye();
1537
1546
  let { mode: r, menuTheme: a, colorScheme: s, themeName: c } = e;
@@ -1545,16 +1554,16 @@ function Kn({ settings: e, onSystemSchemeChange: t }) {
1545
1554
  c
1546
1555
  ]), i(() => {
1547
1556
  if (!e.followsSystem || !globalThis.matchMedia || !t) return;
1548
- let n = globalThis.matchMedia(Wn), r = (e) => t(e.matches);
1557
+ let n = globalThis.matchMedia(Gn), r = (e) => t(e.matches);
1549
1558
  return n.addEventListener("change", r), () => n.removeEventListener("change", r);
1550
1559
  }, [e.followsSystem, t]), null;
1551
1560
  }
1552
1561
  //#endregion
1553
1562
  //#region src/stageNavigationModel.ts
1554
- function qn(e) {
1563
+ function Jn(e) {
1555
1564
  return (e?.application.regions.length ?? 0) > 0 || (e?.modules.length ?? 0) > 0;
1556
1565
  }
1557
- function Jn(e) {
1566
+ function Yn(e) {
1558
1567
  let t = /* @__PURE__ */ new Map();
1559
1568
  for (let n of e) {
1560
1569
  let e = (n.path ?? []).join(".");
@@ -1567,26 +1576,26 @@ function Jn(e) {
1567
1576
  return t.get(r) ?? i ?? (e.some((e) => e.name === r) ? r : void 0);
1568
1577
  };
1569
1578
  }
1570
- function Yn(e) {
1579
+ function Xn(e) {
1571
1580
  return (t) => e.find((e) => e.name === t)?.path?.[0];
1572
1581
  }
1573
- function Xn(e, t) {
1582
+ function Zn(e, t) {
1574
1583
  return {
1575
1584
  structure: e.structure ?? { modules: [] },
1576
1585
  navigation: e.navigation ?? {
1577
1586
  application: { regions: [] },
1578
1587
  modules: []
1579
1588
  },
1580
- screenFor: Jn(e.screens),
1581
- moduleOf: Yn(e.screens),
1589
+ screenFor: Yn(e.screens),
1590
+ moduleOf: Xn(e.screens),
1582
1591
  ...t ? { isVisible: t } : {}
1583
1592
  };
1584
1593
  }
1585
- var Zn = /* @__PURE__ */ new Set(["core:table"]);
1586
- function Qn(e) {
1587
- return $n(e, /* @__PURE__ */ new Map(), void 0);
1594
+ var Qn = /* @__PURE__ */ new Set(["core:table"]);
1595
+ function $n(e) {
1596
+ return er(e, /* @__PURE__ */ new Map(), void 0);
1588
1597
  }
1589
- function $n(e, t, n) {
1598
+ function er(e, t, n) {
1590
1599
  let r = e;
1591
1600
  if (!r.slots) return e;
1592
1601
  let i = !1, a = {};
@@ -1595,7 +1604,7 @@ function $n(e, t, n) {
1595
1604
  a[e] = o.map((e) => {
1596
1605
  let t = e, n = Q(t, "typeName");
1597
1606
  t.componentName === "core:data" && n && (r.set(n, t), s = t);
1598
- let a = $n(tr(er(t, r), s), r, s);
1607
+ let a = er(nr(tr(t, r), s), r, s);
1599
1608
  return a !== e && (i = !0), a;
1600
1609
  });
1601
1610
  }
@@ -1604,8 +1613,8 @@ function $n(e, t, n) {
1604
1613
  slots: a
1605
1614
  } : e;
1606
1615
  }
1607
- function er(e, t) {
1608
- if (!Zn.has(e.componentName)) return e;
1616
+ function tr(e, t) {
1617
+ if (!Qn.has(e.componentName)) return e;
1609
1618
  let n = Q(e, "typeName"), r = n ? t.get(n) : void 0;
1610
1619
  if (!r || e.properties.queryArguments !== void 0) return e;
1611
1620
  let i = Q(r, "by"), a = { ...e.properties }, o = Q(r, "query");
@@ -1614,7 +1623,7 @@ function er(e, t) {
1614
1623
  properties: a
1615
1624
  };
1616
1625
  }
1617
- function tr(e, t) {
1626
+ function nr(e, t) {
1618
1627
  if (e.componentName !== "core:action" || !Array.isArray(e.properties?.alternatives) || !t || t.properties?.isCollection === !0 || e.properties.itemQuery !== void 0) return e;
1619
1628
  let n = { ...e.properties }, r = Q(t, "query"), i = Q(t, "by");
1620
1629
  return r && (n.itemQuery = r), Q(t, "route") && (n.itemRoute = t.properties.route), n.itemArguments = i ? { [i]: { path: `parameters.${i}` } } : {}, {
@@ -1628,18 +1637,18 @@ function Q(e, t) {
1628
1637
  }
1629
1638
  //#endregion
1630
1639
  //#region src/stageSlices.ts
1631
- function nr(e) {
1632
- return (t) => Bt(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0).map((e) => ({
1640
+ function rr(e) {
1641
+ return (t) => Vt(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0).map((e) => ({
1633
1642
  name: e.name,
1634
1643
  type: e.type === "text" || e.type === void 0 ? "string" : e.type,
1635
- label: rr(e.name),
1644
+ label: ir(e.name),
1636
1645
  required: e.required
1637
1646
  }));
1638
1647
  }
1639
- function rr(e) {
1648
+ function ir(e) {
1640
1649
  return e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
1641
1650
  }
1642
- function ir(e, t, n) {
1651
+ function ar(e, t, n) {
1643
1652
  return { invoke: async (r, i, a) => {
1644
1653
  let o = a ?? r.slice(r.lastIndexOf(".") + 1);
1645
1654
  if (!W(o)) return {
@@ -1660,15 +1669,15 @@ function ir(e, t, n) {
1660
1669
  }
1661
1670
  //#endregion
1662
1671
  //#region src/App.tsx
1663
- function ar(e = {}) {
1664
- return xn({
1672
+ function or(e = {}) {
1673
+ return Sn({
1665
1674
  ...e,
1666
- ...un,
1667
- ...Ln
1675
+ ...dn,
1676
+ ...Rn
1668
1677
  });
1669
1678
  }
1670
- function or(e, t) {
1671
- return N(`form-${e}-${t.name}`, $t, {
1679
+ function sr(e, t) {
1680
+ return N(`form-${e}-${t.name}`, en, {
1672
1681
  command: t.forCommand,
1673
1682
  label: t.name,
1674
1683
  generationMode: t.generationMode,
@@ -1676,43 +1685,43 @@ function or(e, t) {
1676
1685
  fields: t.fields
1677
1686
  });
1678
1687
  }
1679
- function sr(e, t) {
1688
+ function cr(e, t) {
1680
1689
  let n = e.screens[0];
1681
1690
  return fe(e, n, {
1682
- profile: yn(e.uiProfiles),
1691
+ profile: bn(e.uiProfiles),
1683
1692
  blueprintTemplates: t?.length ? [...pe, ...t] : void 0
1684
1693
  });
1685
1694
  }
1686
1695
  function $(e, t, n, r, i, a, o = !0) {
1687
- let s = qn(e.navigation), c = e.navigation?.application.logo ? {
1696
+ let s = Jn(e.navigation), c = e.navigation?.application.logo ? {
1688
1697
  title: e.navigation.application.logo.title,
1689
1698
  image: e.navigation.application.logo.image || void 0
1690
1699
  } : void 0;
1691
1700
  return {
1692
- profile: yn(e.uiProfiles),
1693
- catalog: Sn(r),
1701
+ profile: bn(e.uiProfiles),
1702
+ catalog: Cn(r),
1694
1703
  blueprintTemplates: a?.length ? [...pe, ...a] : void 0,
1695
- chrome: (r, i) => i === j.FullPageShell ? { [M.ConfigPanel]: Tn(e.screens, r.name, t, n, c, s, o)[M.ConfigPanel] } : Tn(e.screens, r.name, t, n, c, s, o),
1696
- form: or,
1697
- trailing: [N("activity", kn)],
1704
+ chrome: (r, i) => i === j.FullPageShell ? { [M.ConfigPanel]: En(e.screens, r.name, t, n, c, s, o)[M.ConfigPanel] } : En(e.screens, r.name, t, n, c, s, o),
1705
+ form: sr,
1706
+ trailing: [N("activity", An)],
1698
1707
  decorate: (e) => {
1699
- let t = Qn(e);
1708
+ let t = $n(e);
1700
1709
  return i ? v(t, i) : t;
1701
1710
  }
1702
1711
  };
1703
1712
  }
1704
- function cr(e, t, n, r, i, a) {
1713
+ function lr(e, t, n, r, i, a) {
1705
1714
  return ce(e, t, $(e, n, r, i, void 0, a)).element;
1706
1715
  }
1707
- function lr() {
1716
+ function ur() {
1708
1717
  try {
1709
1718
  return globalThis.localStorage ?? null;
1710
1719
  } catch {
1711
1720
  return null;
1712
1721
  }
1713
1722
  }
1714
- function ur({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: o } = {}) {
1715
- let c = L(), l = a(() => ar(e), [e]), [u, d] = s(), [f, p] = s(""), m = ze(), h = dn();
1723
+ function dr({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: o } = {}) {
1724
+ let c = L(), l = a(() => or(e), [e]), [u, d] = s(), [f, p] = s(""), m = ze(), h = fn();
1716
1725
  return i(() => {
1717
1726
  let e = new AbortController();
1718
1727
  return c.scene(e.signal).then((e) => d(r?.length ? {
@@ -1724,7 +1733,7 @@ function ur({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
1724
1733
  }, [c, r]), f ? /* @__PURE__ */ F("main", {
1725
1734
  className: "stage-message",
1726
1735
  children: [/* @__PURE__ */ P("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ P("p", { children: f })]
1727
- }) : u ? /* @__PURE__ */ P(dr, {
1736
+ }) : u ? /* @__PURE__ */ P(fr, {
1728
1737
  scene: u,
1729
1738
  registry: l,
1730
1739
  routeState: m,
@@ -1737,16 +1746,16 @@ function ur({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
1737
1746
  children: /* @__PURE__ */ P("h1", { children: "Preparing the Stage" })
1738
1747
  });
1739
1748
  }
1740
- function dr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog: o, screenTemplates: c, isVisible: l }) {
1741
- let u = a(() => ne(), []), [d, f] = s(Gn), p = e.screens[0]?.name ?? "", m = a(() => yn(e.uiProfiles), [e]), h = a(() => p ? sr(e, c) : void 0, [
1749
+ function fr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog: o, screenTemplates: c, isVisible: l }) {
1750
+ let u = a(() => ne(), []), [d, f] = s(Kn), p = e.screens[0]?.name ?? "", m = a(() => bn(e.uiProfiles), [e]), h = a(() => p ? cr(e, c) : void 0, [
1742
1751
  e,
1743
1752
  c,
1744
1753
  p
1745
- ]), g = a(() => h ? Vn(m, h) : [], [m, h]), _ = a(() => h ? Bn(m, h, d) : void 0, [
1754
+ ]), g = a(() => h ? Hn(m, h) : [], [m, h]), _ = a(() => h ? Vn(m, h, d) : void 0, [
1746
1755
  m,
1747
1756
  h,
1748
1757
  d
1749
- ]), v = a(() => Un(de, _?.accent), [_?.accent]), y = _?.showFooter ?? !0, b = a(() => $(e, i.locales, i.locale, o, i.dictionary, c, y), [
1758
+ ]), v = a(() => Wn(de, _?.accent), [_?.accent]), y = _?.showFooter ?? !0, b = a(() => $(e, i.locales, i.locale, o, i.dictionary, c, y), [
1750
1759
  e,
1751
1760
  i.locales,
1752
1761
  i.locale,
@@ -1754,7 +1763,7 @@ function dr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog:
1754
1763
  o,
1755
1764
  c,
1756
1765
  y
1757
- ]), x = n((e) => f(e), []), S = a(() => Xn(e, l), [e, l]), C = e;
1766
+ ]), x = n((e) => f(e), []), S = a(() => Zn(e, l), [e, l]), C = e;
1758
1767
  return p ? g.length > 0 ? /* @__PURE__ */ F("main", {
1759
1768
  className: "stage-message",
1760
1769
  role: "alert",
@@ -1771,8 +1780,8 @@ function dr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog:
1771
1780
  registry: t,
1772
1781
  initialScreen: p,
1773
1782
  history: u,
1774
- layoutConfigStorage: lr(),
1775
- scope: (t, n) => /* @__PURE__ */ P(fr, {
1783
+ layoutConfigStorage: ur(),
1784
+ scope: (t, n) => /* @__PURE__ */ P(pr, {
1776
1785
  scene: e,
1777
1786
  routeState: r,
1778
1787
  strings: i,
@@ -1782,12 +1791,12 @@ function dr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog:
1782
1791
  onSystemSchemeChange: x,
1783
1792
  children: n
1784
1793
  }),
1785
- renderScreen: (e, n) => /* @__PURE__ */ P(mr, {
1794
+ renderScreen: (e, n) => /* @__PURE__ */ P(hr, {
1786
1795
  element: e,
1787
1796
  configuration: n,
1788
1797
  registry: t
1789
1798
  }),
1790
- renderDialogTemplate: (e, n, r) => /* @__PURE__ */ P(hr, {
1799
+ renderDialogTemplate: (e, n, r) => /* @__PURE__ */ P(gr, {
1791
1800
  template: e,
1792
1801
  content: n,
1793
1802
  registry: t,
@@ -1799,7 +1808,7 @@ function dr({ scene: e, registry: t, routeState: r, strings: i, packageCatalog:
1799
1808
  children: [/* @__PURE__ */ P("h1", { children: "Nothing to show yet" }), /* @__PURE__ */ P("p", { children: "This model has no slice carrying a command or a read model, so there is no screen to render." })]
1800
1809
  });
1801
1810
  }
1802
- function fr({ scene: e, routeState: t, strings: n, navigation: r, themes: a, shellSettings: o, onSystemSchemeChange: c, children: u }) {
1811
+ function pr({ scene: e, routeState: t, strings: n, navigation: r, themes: a, shellSettings: o, onSystemSchemeChange: c, children: u }) {
1803
1812
  let [d, f] = s(""), { navigate: p } = r;
1804
1813
  return i(() => f(""), [r.currentScreen, r.currentDialog]), i(() => {
1805
1814
  let e = (e) => {
@@ -1819,11 +1828,11 @@ function fr({ scene: e, routeState: t, strings: n, navigation: r, themes: a, she
1819
1828
  }, [p, e]), /* @__PURE__ */ F(oe, {
1820
1829
  themes: a,
1821
1830
  children: [
1822
- o && /* @__PURE__ */ P(Kn, {
1831
+ o && /* @__PURE__ */ P(qn, {
1823
1832
  settings: o,
1824
1833
  onSystemSchemeChange: c
1825
1834
  }),
1826
- /* @__PURE__ */ P(In, {}),
1835
+ /* @__PURE__ */ P(Ln, {}),
1827
1836
  /* @__PURE__ */ P(et, {
1828
1837
  routes: t.routes,
1829
1838
  routesReady: t.ready,
@@ -1831,7 +1840,7 @@ function fr({ scene: e, routeState: t, strings: n, navigation: r, themes: a, she
1831
1840
  locale: n.locale,
1832
1841
  locales: n.locales,
1833
1842
  screen: r.primaryScreen ?? e.screens[0]?.name ?? "",
1834
- children: /* @__PURE__ */ P(pr, {
1843
+ children: /* @__PURE__ */ P(mr, {
1835
1844
  activity: d,
1836
1845
  routesReady: t.ready,
1837
1846
  scene: e,
@@ -1843,12 +1852,12 @@ function fr({ scene: e, routeState: t, strings: n, navigation: r, themes: a, she
1843
1852
  ]
1844
1853
  });
1845
1854
  }
1846
- function pr({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: o }) {
1847
- let s = V(), c = re(), u = bt(), d = a(() => ir(u, t, s.refreshAfterCommand), [
1855
+ function mr({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: o }) {
1856
+ let s = V(), c = re(), u = xt(), d = a(() => ar(u, t, s.refreshAfterCommand), [
1848
1857
  u,
1849
1858
  t,
1850
1859
  s.refreshAfterCommand
1851
- ]), f = a(() => nr(n.commandSchemas), [n.commandSchemas]), p = D({
1860
+ ]), f = a(() => rr(n.commandSchemas), [n.commandSchemas]), p = D({
1852
1861
  executeCommand: async (e, n) => {
1853
1862
  let i = W(e);
1854
1863
  if (!i && !t) return r(`The modeled command “${e}” is waiting for Stage routes.`), {
@@ -1867,7 +1876,7 @@ function pr({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
1867
1876
  };
1868
1877
  },
1869
1878
  navigate: (e, t) => {
1870
- n.screens.some((t) => t.name === e) ? J(e, Kt(t)) : r(`The modeled screen “${e}” is not available.`);
1879
+ n.screens.some((t) => t.name === e) ? J(e, qt(t)) : r(`The modeled screen “${e}” is not available.`);
1871
1880
  },
1872
1881
  navigateBack: () => globalThis.history?.back(),
1873
1882
  openDialog: async (e) => {
@@ -1884,7 +1893,7 @@ function pr({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
1884
1893
  refreshQuery: async (e) => s.refreshQuery(e),
1885
1894
  raise: async (e) => r(`The modeled trigger “${e}” is not available in this Stage runtime.`)
1886
1895
  });
1887
- return /* @__PURE__ */ P(On, {
1896
+ return /* @__PURE__ */ P(kn, {
1888
1897
  state: {
1889
1898
  locales: i.locales,
1890
1899
  locale: i.locale,
@@ -1909,7 +1918,7 @@ function pr({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
1909
1918
  })
1910
1919
  });
1911
1920
  }
1912
- function mr({ element: e, configuration: t, registry: n }) {
1921
+ function hr({ element: e, configuration: t, registry: n }) {
1913
1922
  let r = V();
1914
1923
  return /* @__PURE__ */ P(C, {
1915
1924
  element: e,
@@ -1918,7 +1927,7 @@ function mr({ element: e, configuration: t, registry: n }) {
1918
1927
  configuration: t
1919
1928
  });
1920
1929
  }
1921
- function hr({ template: e, content: t, registry: n, strings: r, close: a }) {
1930
+ function gr({ template: e, content: t, registry: n, strings: r, close: a }) {
1922
1931
  let o = V(), s = v(t, r.dictionary);
1923
1932
  return i(() => {
1924
1933
  let e = (e) => {
@@ -1946,9 +1955,9 @@ function hr({ template: e, content: t, registry: n, strings: r, close: a }) {
1946
1955
  }
1947
1956
  //#endregion
1948
1957
  //#region src/stageTheme.ts
1949
- var gr = "[data-scene-color-scheme='dark']", _r = {
1958
+ var _r = "[data-scene-color-scheme='dark']", vr = {
1950
1959
  preset: Pe,
1951
- options: { darkModeSelector: gr }
1960
+ options: { darkModeSelector: _r }
1952
1961
  };
1953
1962
  //#endregion
1954
- export { ur as App, ur as StageApplication, xt as StageCommandForm, et as StageDataProvider, Zt as StageGuardedAction, Re as StageSourceProvider, cr as composeStageScreen, ir as createStageSliceInvoker, nt as dataChanged, vt as executeRegisteredCommand, W as registeredCommand, nr as sliceFieldsFrom, ar as stageApplicationRegistry, $ as stageComposition, gr as stageDarkSelector, Ie as stageEndpoints, sr as stageShellOf, _r as stageTheme, Fe as staticStageSource, bt as useStageCommandExecutor, V as useStageData, tt as useStageQuery, L as useStageSource };
1963
+ export { dr as App, dr as StageApplication, St as StageCommandForm, et as StageDataProvider, Qt as StageGuardedAction, Re as StageSourceProvider, lr as composeStageScreen, ar as createStageSliceInvoker, nt as dataChanged, yt as executeRegisteredCommand, W as registeredCommand, rr as sliceFieldsFrom, or as stageApplicationRegistry, $ as stageComposition, _r as stageDarkSelector, Ie as stageEndpoints, cr as stageShellOf, vr as stageTheme, Fe as staticStageSource, xt as useStageCommandExecutor, V as useStageData, tt as useStageQuery, L as useStageSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/stage.runtime",
3
- "version": "4.182.0",
3
+ "version": "4.183.0",
4
4
  "description": "The Cratis Stage application runtime for Arc and Scene",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  "@cratis/arc": "22.112.1",
40
40
  "@cratis/arc.react": "22.112.1",
41
41
  "@cratis/components": "4.29.0",
42
- "@cratis/scene.blueprint.default": "4.70.1",
43
- "@cratis/scene.components": "4.70.1",
44
- "@cratis/scene.engine": "4.70.1",
45
- "@cratis/scene.model": "4.70.1",
46
- "@cratis/scene.primereact": "4.70.1",
47
- "@cratis/scene.react": "4.70.1",
42
+ "@cratis/scene.blueprint.default": "4.75.0",
43
+ "@cratis/scene.components": "4.75.0",
44
+ "@cratis/scene.engine": "4.75.0",
45
+ "@cratis/scene.model": "4.75.0",
46
+ "@cratis/scene.primereact": "4.75.0",
47
+ "@cratis/scene.react": "4.75.0",
48
48
  "@primereact/ui": "11.2.0",
49
49
  "@primeuix/themes": "3.0.1",
50
50
  "primereact": "11.2.0",