@cratis/stage.runtime 4.205.0 → 4.207.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.
package/dist/src/index.js CHANGED
@@ -3,8 +3,8 @@ import { t as e } from "../stageDarkSelector-DAwb43-P.js";
3
3
  import { createContext as t, createElement as n, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
4
4
  import { ColorScheme as u, DestinationKind as d, FormGenerationMode as f, FormWidthUnit as p, InteractionTriggerKind as m, LogoKind as h, PackageKind as g, componentIconLibrary as _ } from "@cratis/scene.model";
5
5
  import { ShellDiagnosticCode as v, ShellOrigin as y, createBindingResolver as b, hostProfilePackages as x, resolveArgumentSource as S, resolveBehaviors as C, resolveStringsInElement as w, resolveStringsValue as ee, runBindings as te, validateBindingExpression as ne } from "@cratis/scene.engine";
6
- import { CoreSliceDialog as T, CoreToolbarItem as E, IconAdapterProvider as re, InteractionScope as ie, SceneElementView as D, SceneNavigationContextInternal as O, SliceCommandFieldsProvider as ae, SliceDialogView as oe, SliceInvokerProvider as se, attachmentFor as ce, componentRegistryKey as le, coreComponents as k, createBrowserDispatcher as ue, createBrowserSceneHistory as de, createHashSceneHistory as A, createIconAdapterRegistry as fe, sliceDialogParameters as pe, useInteractionScope as me, useOptionalSceneNavigation as he, useSceneNavigation as ge, useSceneOutlets as _e, useSceneTheme as ve } from "@cratis/scene.react";
7
- import { ApplicationHost as ye, ColorScheme as be, ComponentName as j, KanbanBoard as xe, LayoutThemeProvider as Se, SlotName as M, blueprintPackageCatalog as Ce, composeApplicationScreen as we, defaultBlueprintComponents as Te, defaultBlueprintName as Ee, defaultBlueprintThemes as De, effectiveShellOf as Oe, externalComponent as N, galleryScreenTemplates as P, layoutModes as ke, menuThemes as Ae, navigationElement as je, previewComponents as Me, previewProfile as Ne, useLayoutConfig as Pe } from "@cratis/scene.blueprint.default";
6
+ import { CoreSliceDialog as T, CoreToolbarItem as E, IconAdapterProvider as re, InteractionScope as ie, SceneElementView as ae, SceneNavigationContextInternal as D, SliceCommandFieldsProvider as oe, SliceDialogView as se, SliceInvokerProvider as ce, attachmentFor as le, componentRegistryKey as ue, coreComponents as O, createBrowserDispatcher as de, createBrowserSceneHistory as fe, createHashSceneHistory as k, createIconAdapterRegistry as pe, sliceDialogParameters as me, useInteractionScope as he, useOptionalSceneNavigation as ge, useSceneNavigation as _e, useSceneOutlets as ve, useSceneTheme as ye } from "@cratis/scene.react";
7
+ import { ApplicationHost as be, ColorScheme as A, ComponentName as j, KanbanBoard as xe, LayoutThemeProvider as Se, SlotName as M, blueprintPackageCatalog as Ce, composeApplicationScreen as we, defaultBlueprintComponents as Te, defaultBlueprintName as Ee, defaultBlueprintThemes as N, effectiveShellOf as De, externalComponent as P, galleryScreenTemplates as Oe, layoutModes as ke, menuThemes as Ae, navigationElement as je, previewComponents as Me, previewProfile as Ne, useLayoutConfig as Pe } from "@cratis/scene.blueprint.default";
8
8
  import "@cratis/components/tokens";
9
9
  import "@cratis/components/CommandForm/styles";
10
10
  import "@cratis/components/Dropdown/styles";
@@ -258,7 +258,7 @@ var Bt = "cratis.stage.data-changed", Vt = t({
258
258
  3e3
259
259
  ], Ut = {};
260
260
  function Wt({ routes: e, routesReady: t = !0, parameters: n = Ut, locale: i, locales: o, screen: u, children: d }) {
261
- let [f, p] = l({}), [m, h] = l(0), [g, _] = l({}), [v, y] = l(), [x, C] = l({}), [w, ee] = l({}), [te, T] = l({}), [E, re] = l({ version: 0 }), ie = s(() => Xt(te), [te]), D = r((e, t) => {
261
+ let [f, p] = l({}), [m, h] = l(0), [g, _] = l({}), [v, y] = l(), [x, C] = l({}), [w, ee] = l({}), [te, T] = l({}), [E, re] = l({ version: 0 }), ie = s(() => Xt(te), [te]), ae = r((e, t) => {
262
262
  p((n) => {
263
263
  if (!t) {
264
264
  let { [e]: t, ...r } = n;
@@ -269,27 +269,27 @@ function Wt({ routes: e, routesReady: t = !0, parameters: n = Ut, locale: i, loc
269
269
  [e]: t
270
270
  };
271
271
  });
272
- }, []), O = n, ae = s(() => zt(), [m]), oe = s(() => ({
272
+ }, []), D = n, oe = s(() => zt(), [m]), se = s(() => ({
273
273
  name: u,
274
274
  keys: {
275
- ...ae,
275
+ ...oe,
276
276
  ...n
277
277
  }
278
278
  }), [
279
279
  n,
280
280
  u,
281
- ae
282
- ]), se = r((e, t) => {
281
+ oe
282
+ ]), ce = r((e, t) => {
283
283
  _((n) => ({
284
284
  ...n,
285
285
  [e]: t
286
286
  })), y(t ? e : (t) => t === e ? void 0 : t);
287
- }, []), ce = r((e) => {
287
+ }, []), le = r((e) => {
288
288
  _((t) => ({
289
289
  ...t,
290
290
  [e]: void 0
291
291
  })), y((t) => t === e ? void 0 : t);
292
- }, []), le = r((e, t, n) => {
292
+ }, []), ue = r((e, t, n) => {
293
293
  ee((r) => {
294
294
  let i = H(r[e]) ? r[e] : {};
295
295
  return {
@@ -297,28 +297,28 @@ function Wt({ routes: e, routesReady: t = !0, parameters: n = Ut, locale: i, loc
297
297
  [e]: Yt(i, t.split(".").filter(Boolean), n)
298
298
  };
299
299
  });
300
- }, []), k = r((e) => re((t) => ({
300
+ }, []), O = r((e) => re((t) => ({
301
301
  query: e,
302
302
  version: t.version + 1
303
- })), []), ue = c([]), de = r(() => {
304
- h((e) => e + 1), k();
305
- for (let e of Ht) ue.current.push(setTimeout(() => k(), e));
306
- }, [k]);
307
- a(() => () => ue.current.forEach(clearTimeout), []), a(() => {
308
- let e = () => k(), t = (e) => k(e.detail?.query);
303
+ })), []), de = c([]), fe = r(() => {
304
+ h((e) => e + 1), O();
305
+ for (let e of Ht) de.current.push(setTimeout(() => O(), e));
306
+ }, [O]);
307
+ a(() => () => de.current.forEach(clearTimeout), []), a(() => {
308
+ let e = () => O(), t = (e) => O(e.detail?.query);
309
309
  return globalThis.addEventListener(Bt, e), globalThis.addEventListener("cratis.scene.refresh", t), () => {
310
310
  globalThis.removeEventListener(Bt, e), globalThis.removeEventListener("cratis.scene.refresh", t);
311
311
  };
312
- }, [k]);
313
- let A = v ? g[v] : void 0, fe = r((e) => {
312
+ }, [O]);
313
+ let k = v ? g[v] : void 0, pe = r((e) => {
314
314
  if (e === void 0 || typeof e != "string" && e.path === "$guard") return;
315
- if (typeof e == "string") return Zt(e, A, g, f, x, O, oe, i, o);
316
- let t = Kt(A, f, x, {
315
+ if (typeof e == "string") return Zt(e, k, g, f, x, D, se, i, o);
316
+ let t = Kt(k, f, x, {
317
317
  ...ie,
318
318
  ...w
319
319
  }, g);
320
320
  if (!e.kind && e.path.startsWith("component.")) return S(e.path, t);
321
- if (!e.kind) return Zt(e.path, A, g, f, x, O, oe, i, o);
321
+ if (!e.kind) return Zt(e.path, k, g, f, x, D, se, i, o);
322
322
  let n = ne(e, t);
323
323
  return n.length > 0 && console.warn(`Scene binding could not be resolved: ${n.map((e) => `${e.code}:${e.message}`).join("; ")}`), b(t)(e);
324
324
  }, [
@@ -326,13 +326,13 @@ function Wt({ routes: e, routesReady: t = !0, parameters: n = Ut, locale: i, loc
326
326
  i,
327
327
  o,
328
328
  x,
329
- O,
329
+ D,
330
330
  ie,
331
331
  f,
332
- oe,
333
- A,
332
+ se,
333
+ k,
334
334
  g
335
- ]), pe = r((e) => e ? S(e, Kt(A, f, x, {
335
+ ]), me = r((e) => e ? S(e, Kt(k, f, x, {
336
336
  ...ie,
337
337
  ...w
338
338
  }, g)) : void 0, [
@@ -340,67 +340,67 @@ function Wt({ routes: e, routesReady: t = !0, parameters: n = Ut, locale: i, loc
340
340
  x,
341
341
  ie,
342
342
  f,
343
- A,
343
+ k,
344
344
  g
345
- ]), me = r((e, t) => T((n) => ({
345
+ ]), he = r((e, t) => T((n) => ({
346
346
  ...n,
347
347
  [e]: t
348
- })), []), he = r((e) => T((t) => {
348
+ })), []), ge = r((e) => T((t) => {
349
349
  if (!Object.prototype.hasOwnProperty.call(t, e)) return t;
350
350
  let n = { ...t };
351
351
  return delete n[e], n;
352
- }), []), ge = s(() => Kt(void 0, f, {}, {}, {}).queryResults, [f]), _e = s(() => ({
352
+ }), []), _e = s(() => Kt(void 0, f, {}, {}, {}).queryResults, [f]), ve = s(() => ({
353
353
  locale: i,
354
354
  locales: o,
355
355
  screen: u,
356
356
  routes: e,
357
357
  routesReady: t,
358
- parameters: O,
359
- session: ae,
358
+ parameters: D,
359
+ session: oe,
360
360
  queries: f,
361
- selected: A,
361
+ selected: k,
362
362
  selections: g,
363
- selectRow: se,
364
- clearSelection: ce,
363
+ selectRow: ce,
364
+ clearSelection: le,
365
365
  setState: (e, t) => C((n) => Yt(n, e.split(".").filter(Boolean), t)),
366
- setComponentOutput: le,
367
- publishComponentOutputs: me,
368
- withdrawComponentOutputs: he,
369
- queryResults: ge,
370
- refreshQuery: k,
371
- refreshAfterCommand: de,
372
- resolveBinding: fe,
373
- resolveArgument: pe,
374
- registerQueryResult: D,
366
+ setComponentOutput: ue,
367
+ publishComponentOutputs: he,
368
+ withdrawComponentOutputs: ge,
369
+ queryResults: _e,
370
+ refreshQuery: O,
371
+ refreshAfterCommand: fe,
372
+ resolveBinding: pe,
373
+ resolveArgument: me,
374
+ registerQueryResult: ae,
375
375
  refreshVersion: E.version,
376
376
  refreshQueryName: E.query
377
377
  }), [
378
- ce,
378
+ le,
379
379
  i,
380
380
  o,
381
381
  f,
382
- de,
383
- k,
382
+ fe,
383
+ O,
384
384
  E.query,
385
385
  E.version,
386
- D,
387
- me,
386
+ ae,
388
387
  he,
389
388
  ge,
389
+ _e,
390
+ me,
390
391
  pe,
391
- fe,
392
392
  e,
393
393
  t,
394
- O,
395
- ae,
394
+ D,
395
+ oe,
396
396
  u,
397
- se,
398
- A,
397
+ ce,
398
+ k,
399
399
  g,
400
- le
400
+ ue
401
401
  ]);
402
402
  return /* @__PURE__ */ F(Vt.Provider, {
403
- value: _e,
403
+ value: ve,
404
404
  children: d
405
405
  });
406
406
  }
@@ -1443,7 +1443,7 @@ function Or({ element: e, interactions: t }) {
1443
1443
  });
1444
1444
  }
1445
1445
  function kr(e) {
1446
- let t = me(), n = c(void 0), i = s(() => C(ce(e.id, e.behaviors), m.DoubleClick), [e.behaviors, e.id]);
1446
+ let t = he(), n = c(void 0), i = s(() => C(le(e.id, e.behaviors), m.DoubleClick), [e.behaviors, e.id]);
1447
1447
  a(() => () => clearTimeout(n.current), []);
1448
1448
  let o = r((e) => {
1449
1449
  if (clearTimeout(n.current), n.current = void 0, !t) return;
@@ -1470,7 +1470,7 @@ function Mr(e, t) {
1470
1470
  let n = new Set(t.map((e) => e.name));
1471
1471
  return e.map((t) => {
1472
1472
  if (t.screenTemplate !== jr || n.has(jr)) return t;
1473
- let r = Nr(t), i = e.find((e) => e.name !== t.name)?.name, a = N(`confirm-dialog-${t.name}`, Ar, {
1473
+ let r = Nr(t), i = e.find((e) => e.name !== t.name)?.name, a = P(`confirm-dialog-${t.name}`, Ar, {
1474
1474
  title: t.name,
1475
1475
  decisions: r,
1476
1476
  home: i
@@ -1622,7 +1622,7 @@ function Wr(e, t) {
1622
1622
  return (n) => n.path === "$guard" ? Pt(n.value, e.item) : n.path === "value" ? e.value : n.path === "previous" ? e.previous : n.path?.startsWith("item.") ? Ft(n.path, e.item) : t(n);
1623
1623
  }
1624
1624
  function Gr(e, t) {
1625
- let n = me(), i = z(), { element: a, rowsProperty: o, idField: u, valueField: d } = e, f = s(() => C(ce(a.id, a.behaviors), m.Change), [a.behaviors, a.id]), p = c(void 0), h = c(!1), [g, _] = l(0), v = c({
1625
+ let n = he(), i = z(), { element: a, rowsProperty: o, idField: u, valueField: d } = e, f = s(() => C(le(a.id, a.behaviors), m.Change), [a.behaviors, a.id]), p = c(void 0), h = c(!1), [g, _] = l(0), v = c({
1626
1626
  scope: n,
1627
1627
  data: i,
1628
1628
  element: a,
@@ -1689,7 +1689,7 @@ function Kr(e) {
1689
1689
  bindingOutputs: r.outputs
1690
1690
  }, r.revision) : /* @__PURE__ */ F(i, { ...e });
1691
1691
  }
1692
- var qr = le(Ee, j.KanbanBoard), Jr = "Stage:commandForm";
1692
+ var qr = ue(Ee, j.KanbanBoard), Jr = "Stage:commandForm";
1693
1693
  function Yr(e, t, n = {}) {
1694
1694
  return {
1695
1695
  id: e,
@@ -1911,11 +1911,11 @@ function oi({ element: e, label: t }) {
1911
1911
  });
1912
1912
  }
1913
1913
  function si(e) {
1914
- let t = e.element ?? Yr("slice-dialog", {}), n = he(), { routes: i, parameters: a } = z(), o = pe(n?.currentDialogParameters), c = Z(t, "command") || o?.command || Z(t, "slice") || "", u = Z(t, "title") || o?.title || c, d = i?.commandSchemas?.[c], f = s(() => G(d ?? ""), [d]), { selectableRows: p, selectedRows: m } = In(), h = r(() => n?.closeDialog(), [n]), [g, _] = l(null), v = (e) => e.identifier && e.required && Qn(e, p) && Zn(e, m) !== void 0;
1914
+ let t = e.element ?? Yr("slice-dialog", {}), n = ge(), { routes: i, parameters: a } = z(), o = me(n?.currentDialogParameters), c = Z(t, "command") || o?.command || Z(t, "slice") || "", u = Z(t, "title") || o?.title || c, d = i?.commandSchemas?.[c], f = s(() => G(d ?? ""), [d]), { selectableRows: p, selectedRows: m } = In(), h = r(() => n?.closeDialog(), [n]), [g, _] = l(null), v = (e) => e.identifier && e.required && Qn(e, p) && Zn(e, m) !== void 0;
1915
1915
  if (!d || !(f.some((e) => e.options || e.members || e.item) || f.some(v))) return e.element ? /* @__PURE__ */ F(T, {
1916
1916
  element: e.element,
1917
1917
  slots: e.slots ?? {}
1918
- }) : /* @__PURE__ */ F(oe, {});
1918
+ }) : /* @__PURE__ */ F(se, {});
1919
1919
  let y = f.filter((e) => !Yn(e, a) && !v(e)), b = Yr(`slice-dialog-${c}`, {
1920
1920
  command: c,
1921
1921
  label: u,
@@ -2015,7 +2015,7 @@ function ui(e) {
2015
2015
  });
2016
2016
  }
2017
2017
  var di = {
2018
- ...k,
2018
+ ...O,
2019
2019
  "core:table": $r,
2020
2020
  "core:action": ni,
2021
2021
  "core:toolbarItem": ci,
@@ -2170,12 +2170,33 @@ function Si({ element: e }) {
2170
2170
  let t = s(() => vi(e), [e]), n = s(() => yi(e), [e]);
2171
2171
  return /* @__PURE__ */ I(Ve, { children: [t.map((e) => /* @__PURE__ */ F(xi, { name: e }, e)), n.map((e) => /* @__PURE__ */ F(bi, { source: e }, e.typeName))] });
2172
2172
  }
2173
- function Ci(e) {
2173
+ // src/stageThemeChoice.ts
2174
+ var Ci = "cratis.stage.theme";
2175
+ function wi() {
2176
+ try {
2177
+ return globalThis.localStorage ?? null;
2178
+ } catch {
2179
+ return null;
2180
+ }
2181
+ }
2182
+ function Ti() {
2183
+ try {
2184
+ return wi()?.getItem("cratis.stage.theme") || void 0;
2185
+ } catch {
2186
+ return;
2187
+ }
2188
+ }
2189
+ function Ei(e) {
2190
+ try {
2191
+ wi()?.setItem(Ci, e);
2192
+ } catch {}
2193
+ }
2194
+ function Di(e) {
2174
2195
  let t = /* @__PURE__ */ new Set(), n = [];
2175
2196
  for (let r of e.flatMap((e) => e.contributions ?? [])) {
2176
- let e = Ti(r);
2197
+ let e = ki(r);
2177
2198
  if (!e) continue;
2178
- let i = Ei(e);
2199
+ let i = ji(e);
2179
2200
  t.has(i) || (t.add(i), n.push(e));
2180
2201
  }
2181
2202
  return n.map((e, t) => ({
@@ -2183,44 +2204,47 @@ function Ci(e) {
2183
2204
  index: t
2184
2205
  })).sort((e, t) => (e.entry.order ?? 2 ** 53 - 1) - (t.entry.order ?? 2 ** 53 - 1) || e.index - t.index).map(({ entry: e }) => e);
2185
2206
  }
2186
- function wi(e) {
2207
+ function Oi(e) {
2187
2208
  let t = {
2188
2209
  label: "",
2189
2210
  children: []
2190
2211
  };
2191
2212
  for (let n of e) {
2192
- let e = n.hierarchy.reduce((e, t) => Di(e, t, !1), t);
2193
- (n.group ? Di(e, n.group, !0) : e).children.push(Oi(n));
2213
+ let e = n.hierarchy.reduce((e, t) => Mi(e, t, !1), t);
2214
+ (n.group ? Mi(e, n.group, !0) : e).children.push(Ni(n));
2194
2215
  }
2195
2216
  return t.children;
2196
2217
  }
2197
- function Ti(e) {
2218
+ function ki(e) {
2198
2219
  if (e.contributionPointName !== "Navigation") return;
2199
2220
  let t = e.content?.properties ?? {}, n = t.label, r = t.targetScreen;
2200
2221
  if (typeof n != "string" || typeof r != "string") return;
2201
- let i = Array.isArray(t.hierarchy) ? t.hierarchy.filter((e) => typeof e == "string") : [], a = e.order ?? (typeof t.order == "number" ? t.order : void 0), o = t.destination;
2222
+ let i = Ai(t), a = e.order ?? (typeof t.order == "number" ? t.order : void 0), o = t.destination;
2202
2223
  return {
2203
2224
  label: n,
2204
2225
  targetScreen: r,
2205
2226
  hierarchy: i,
2206
2227
  order: a,
2207
- ...Ai({
2208
- id: ki(t.id),
2209
- group: ki(t.group),
2210
- icon: ki(t.icon),
2211
- presentation: ki(t.presentation),
2212
- destination: Mi(o) && Ni(o) ? o : void 0
2228
+ ...Fi({
2229
+ id: Pi(t.id),
2230
+ group: Pi(t.group),
2231
+ icon: Pi(t.icon),
2232
+ presentation: Pi(t.presentation),
2233
+ destination: Li(o) && Ri(o) ? o : void 0
2213
2234
  })
2214
2235
  };
2215
2236
  }
2216
- function Ei(e) {
2237
+ function Ai(e) {
2238
+ return Array.isArray(e.hierarchy) ? e.hierarchy.filter((e) => typeof e == "string") : [];
2239
+ }
2240
+ function ji(e) {
2217
2241
  return e.id === void 0 ? JSON.stringify([
2218
2242
  e.hierarchy,
2219
2243
  e.targetScreen,
2220
2244
  e.label
2221
2245
  ]) : JSON.stringify(["id", e.id]);
2222
2246
  }
2223
- function Di(e, t, n) {
2247
+ function Mi(e, t, n) {
2224
2248
  let r = e.children.find((e) => e.screen === void 0 && e.section === !0 === n && e.label === t);
2225
2249
  if (r) return r;
2226
2250
  let i = n ? {
@@ -2233,12 +2257,12 @@ function Di(e, t, n) {
2233
2257
  };
2234
2258
  return e.children.push(i), i;
2235
2259
  }
2236
- function Oi(e) {
2260
+ function Ni(e) {
2237
2261
  return {
2238
2262
  label: e.label,
2239
- ...Ai({ id: e.id || void 0 }),
2263
+ ...Fi({ id: e.id || void 0 }),
2240
2264
  screen: e.targetScreen,
2241
- ...Ai({
2265
+ ...Fi({
2242
2266
  icon: e.icon || void 0,
2243
2267
  presentation: e.presentation || void 0,
2244
2268
  destination: e.destination
@@ -2246,27 +2270,27 @@ function Oi(e) {
2246
2270
  children: []
2247
2271
  };
2248
2272
  }
2249
- function ki(e) {
2273
+ function Pi(e) {
2250
2274
  return typeof e == "string" ? e : void 0;
2251
2275
  }
2252
- function Ai(e) {
2276
+ function Fi(e) {
2253
2277
  return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
2254
2278
  }
2255
- function ji(e, t) {
2279
+ function Ii(e, t) {
2256
2280
  for (let n of e) {
2257
2281
  if (n.screen === t) return [n.label];
2258
- let e = ji(n.children, t);
2282
+ let e = Ii(n.children, t);
2259
2283
  if (e.length > 0) return n.section ? e : [n.label, ...e];
2260
2284
  }
2261
2285
  return [];
2262
2286
  }
2263
- function Mi(e) {
2287
+ function Li(e) {
2264
2288
  return typeof e == "object" && !!e && !Array.isArray(e);
2265
2289
  }
2266
- function Ni(e) {
2290
+ function Ri(e) {
2267
2291
  return e.outlet !== void 0 || e.dialog !== void 0 || e.kind === "external" || e.kind === "dialog";
2268
2292
  }
2269
- function Pi(e, t, n) {
2293
+ function zi(e, t, n) {
2270
2294
  return e.filter((e) => !t.has(e.name)).map((e) => ({
2271
2295
  label: e.name,
2272
2296
  targetScreen: e.name,
@@ -2274,35 +2298,35 @@ function Pi(e, t, n) {
2274
2298
  }));
2275
2299
  }
2276
2300
  // src/blueprint.ts
2277
- var Fi = "Stage:locale", Ii = "Stage:themeToggle", Li = "Cratis.Components", Ri = "PrimeReact", zi = /* @__PURE__ */ new Map();
2278
- function Bi(e) {
2279
- return Ne(e).packages.includes(Ri);
2301
+ var Bi = "Stage:locale", Vi = "Stage:themeToggle", Hi = "Cratis.Components", Ui = "PrimeReact", Wi = /* @__PURE__ */ new Map();
2302
+ function Gi(e) {
2303
+ return Ne(e).packages.includes(Ui);
2280
2304
  }
2281
- function Vi(e, t) {
2282
- zi.set(e, t);
2305
+ function Ki(e, t) {
2306
+ Wi.set(e, t);
2283
2307
  }
2284
- function Hi(e) {
2308
+ function qi(e) {
2285
2309
  let t = Ne(e);
2286
2310
  return {
2287
2311
  ...t,
2288
2312
  name: e?.length ? t.name : "Stage",
2289
2313
  packages: x(t.packages, {
2290
- baseline: Li,
2314
+ baseline: Hi,
2291
2315
  catalog: { [Ee]: g.Blueprint }
2292
2316
  })
2293
2317
  };
2294
2318
  }
2295
- var Ui = {
2319
+ var Ji = {
2296
2320
  ...Ce,
2297
- [Li]: rt.components
2321
+ [Hi]: rt.components
2298
2322
  };
2299
- function Wi(e) {
2300
- let t = [...zi.values()].reduce((e, t) => ({
2323
+ function Yi(e) {
2324
+ let t = [...Wi.values()].reduce((e, t) => ({
2301
2325
  ...e,
2302
2326
  ...t.components
2303
2327
  }), {});
2304
2328
  return {
2305
- ...k,
2329
+ ...O,
2306
2330
  ...nt,
2307
2331
  ...t,
2308
2332
  ...Te,
@@ -2310,18 +2334,18 @@ function Wi(e) {
2310
2334
  ...e
2311
2335
  };
2312
2336
  }
2313
- function Gi(e) {
2314
- let t = Object.fromEntries([...zi].map(([e, t]) => [e, t.declared]));
2337
+ function Xi(e) {
2338
+ let t = Object.fromEntries([...Wi].map(([e, t]) => [e, t.declared]));
2315
2339
  return {
2316
2340
  ...e,
2317
- ...Ui,
2341
+ ...Ji,
2318
2342
  ...t
2319
2343
  };
2320
2344
  }
2321
- var Ki = "Stage:navigationTree";
2322
- function qi(e, t, n) {
2345
+ var Zi = "Stage:navigationTree";
2346
+ function Qi(e, t, n) {
2323
2347
  let r = t?.title ?? "Cratis Stage";
2324
- return N(e, j.Logo, {
2348
+ return P(e, j.Logo, {
2325
2349
  label: r,
2326
2350
  initials: r.slice(0, 1).toUpperCase() || "S",
2327
2351
  targetScreen: n,
@@ -2330,40 +2354,40 @@ function qi(e, t, n) {
2330
2354
  ...t?.showName === void 0 ? {} : { showName: t.showName }
2331
2355
  });
2332
2356
  }
2333
- function Ji(e, t, n, r, i, a = !1, o = !0) {
2334
- let s = e[0]?.name ?? "", c = i?.title ?? "Cratis Stage", l = Ci(e), u = Pi(e, new Set(l.map((e) => e.targetScreen)), "Other screens"), d = wi([...l, ...l.length > 0 ? u : []]), f = e.map((e, n) => je({
2357
+ function $i(e, t, n, r, i, a = !1, o = !0) {
2358
+ let s = e[0]?.name ?? "", c = i?.title ?? "Cratis Stage", l = Di(e), u = zi(e, new Set(l.map((e) => e.targetScreen)), "Other screens"), d = Oi([...l, ...l.length > 0 ? u : []]), f = e.map((e, n) => je({
2335
2359
  label: e.name,
2336
2360
  targetScreen: e.name,
2337
2361
  icon: "pi pi-table",
2338
2362
  group: "Screens",
2339
2363
  order: n
2340
- }, t)), p = ji(wi(l), t), m = e.find((e) => e.name === t)?.path?.length ? ji(d, t) : [], h = p.length > 0 ? p : m, g = l.length > 0 ? N("menu-hierarchy", Ki, {
2364
+ }, t)), p = Ii(Oi(l), t), m = e.find((e) => e.name === t)?.path?.length ? Ii(d, t) : [], h = p.length > 0 ? p : m, g = l.length > 0 ? P("menu-hierarchy", Zi, {
2341
2365
  nodes: d,
2342
2366
  activeScreen: t
2343
- }) : N("menu-screens", j.Menu, {
2367
+ }) : P("menu-screens", j.Menu, {
2344
2368
  title: "Screens",
2345
2369
  label: "Screens"
2346
2370
  }, { items: f }), _ = [];
2347
- n.length > 1 && _.push(N("topbar-locale", Fi, {
2371
+ n.length > 1 && _.push(P("topbar-locale", Bi, {
2348
2372
  locales: n,
2349
2373
  locale: r
2350
- })), _.push(N("topbar-theme", Ii, {}));
2374
+ })), _.push(P("topbar-theme", Vi, {}));
2351
2375
  let v = { regionNavigation: a };
2352
2376
  return {
2353
- [M.Topbar]: [N("topbar", j.Topbar, v, {
2354
- logo: [qi("topbar-logo", i, s)],
2377
+ [M.Topbar]: [P("topbar", j.Topbar, v, {
2378
+ logo: [Qi("topbar-logo", i, s)],
2355
2379
  end: _
2356
2380
  })],
2357
- [M.Sidebar]: [N("sidebar", j.Sidebar, v, { logo: [qi("sidebar-logo", i, s)] })],
2381
+ [M.Sidebar]: [P("sidebar", j.Sidebar, v, { logo: [Qi("sidebar-logo", i, s)] })],
2358
2382
  ...a ? {} : { [M.Menu]: [g] },
2359
- [M.Breadcrumb]: [N("breadcrumb", j.Breadcrumb, {
2383
+ [M.Breadcrumb]: [P("breadcrumb", j.Breadcrumb, {
2360
2384
  homeTargetScreen: s,
2361
2385
  items: (h.length > 0 ? h : [t]).map((e) => ({ label: e }))
2362
2386
  })],
2363
- ...o ? { [M.Footer]: [N("footer", j.Footer, { text: `${c} · rendered from your model` })] } : {},
2364
- [M.ConfigPanel]: [N(j.ConfigPanel, j.ConfigPanel, {
2387
+ ...o ? { [M.Footer]: [P("footer", j.Footer, { text: `${c} · rendered from your model` })] } : {},
2388
+ [M.ConfigPanel]: [P(j.ConfigPanel, j.ConfigPanel, {
2365
2389
  title: "Settings",
2366
- themes: De.map((e) => ({
2390
+ themes: N.map((e) => ({
2367
2391
  name: e.name,
2368
2392
  label: e.name,
2369
2393
  isDark: e.isDark ?? !1
@@ -2371,11 +2395,11 @@ function Ji(e, t, n, r, i, a = !1, o = !0) {
2371
2395
  })]
2372
2396
  };
2373
2397
  }
2374
- function Yi(e) {
2398
+ function ea(e) {
2375
2399
  return `#/${encodeURIComponent(e)}`;
2376
2400
  }
2377
2401
  // src/externalRouteHref.ts
2378
- function Xi(e) {
2402
+ function ta(e) {
2379
2403
  try {
2380
2404
  let t = new URL(e ?? "");
2381
2405
  return t.protocol === "http:" || t.protocol === "https:" ? e : void 0;
@@ -2384,21 +2408,21 @@ function Xi(e) {
2384
2408
  }
2385
2409
  }
2386
2410
  // src/StageChrome.tsx
2387
- var Zi = t({
2411
+ var na = t({
2388
2412
  locales: [],
2389
2413
  locale: "",
2390
2414
  setLocale: () => void 0,
2391
2415
  activity: ""
2392
2416
  });
2393
- function Qi({ state: e, children: t }) {
2394
- return /* @__PURE__ */ F(Zi.Provider, {
2417
+ function ra({ state: e, children: t }) {
2418
+ return /* @__PURE__ */ F(na.Provider, {
2395
2419
  value: e,
2396
2420
  children: t
2397
2421
  });
2398
2422
  }
2399
- var $i = "Stage:activity";
2400
- function ea() {
2401
- let { locales: e, locale: t, setLocale: n } = i(Zi);
2423
+ var ia = "Stage:activity";
2424
+ function aa() {
2425
+ let { locales: e, locale: t, setLocale: n } = i(na);
2402
2426
  return e.length < 2 ? null : /* @__PURE__ */ F("select", {
2403
2427
  className: "stage-locale",
2404
2428
  "aria-label": "Locale",
@@ -2410,8 +2434,8 @@ function ea() {
2410
2434
  }, e))
2411
2435
  });
2412
2436
  }
2413
- function ta({ element: e }) {
2414
- let { config: t, setThemeName: n, setColorScheme: r } = Pe(), i = De.find((e) => e.name === t.themeName)?.isDark ?? t.colorScheme === be.Dark, a = De.find((e) => (e.isDark ?? !1) !== i);
2437
+ function oa({ element: e }) {
2438
+ let { config: t, setThemeName: n, setColorScheme: r } = Pe(), i = N.find((e) => e.name === t.themeName)?.isDark ?? t.colorScheme === A.Dark, a = N.find((e) => (e.isDark ?? !1) !== i);
2415
2439
  if (!a) return null;
2416
2440
  let o = i ? "Switch to a light theme" : "Switch to a dark theme";
2417
2441
  return /* @__PURE__ */ F("div", {
@@ -2423,7 +2447,7 @@ function ta({ element: e }) {
2423
2447
  "aria-label": o,
2424
2448
  title: o,
2425
2449
  onClick: () => {
2426
- n(a.name), r(a.isDark ? be.Dark : be.Light);
2450
+ Ei(a.name), n(a.name), r(a.isDark ? A.Dark : A.Light);
2427
2451
  },
2428
2452
  children: /* @__PURE__ */ F("svg", {
2429
2453
  width: "18",
@@ -2444,19 +2468,19 @@ function ta({ element: e }) {
2444
2468
  })
2445
2469
  });
2446
2470
  }
2447
- function na({ element: e }) {
2471
+ function sa({ element: e }) {
2448
2472
  let t = e.properties ?? {};
2449
2473
  return /* @__PURE__ */ F("nav", {
2450
2474
  className: "stage-navigation-tree",
2451
2475
  "aria-label": "Navigation",
2452
2476
  "data-scene-id": e.id,
2453
- children: /* @__PURE__ */ F(ra, {
2477
+ children: /* @__PURE__ */ F(ca, {
2454
2478
  nodes: t.nodes ?? [],
2455
2479
  activeScreen: t.activeScreen
2456
2480
  })
2457
2481
  });
2458
2482
  }
2459
- function ra({ nodes: e, activeScreen: t }) {
2483
+ function ca({ nodes: e, activeScreen: t }) {
2460
2484
  return /* @__PURE__ */ F("ul", {
2461
2485
  role: "tree",
2462
2486
  children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ I("li", {
@@ -2465,13 +2489,13 @@ function ra({ nodes: e, activeScreen: t }) {
2465
2489
  children: [/* @__PURE__ */ F("span", {
2466
2490
  className: "stage-navigation-group",
2467
2491
  children: e.label
2468
- }), /* @__PURE__ */ F(ra, {
2492
+ }), /* @__PURE__ */ F(ca, {
2469
2493
  nodes: e.children,
2470
2494
  activeScreen: t
2471
2495
  })]
2472
2496
  }, e.label) : /* @__PURE__ */ F("li", {
2473
2497
  role: "treeitem",
2474
- children: /* @__PURE__ */ F(ia, {
2498
+ children: /* @__PURE__ */ F(la, {
2475
2499
  node: e,
2476
2500
  screen: e.screen,
2477
2501
  activeScreen: t
@@ -2479,10 +2503,10 @@ function ra({ nodes: e, activeScreen: t }) {
2479
2503
  }, `${e.screen}:${e.label}`))
2480
2504
  });
2481
2505
  }
2482
- function ia({ node: e, screen: t, activeScreen: n }) {
2483
- let r = i(O), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external", c = o && r && !s && Ni(o) ? (e) => {
2506
+ function la({ node: e, screen: t, activeScreen: n }) {
2507
+ let r = i(D), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external", c = o && r && !s && Ri(o) ? (e) => {
2484
2508
  e.preventDefault(), r.navigate(o);
2485
- } : void 0, l = s ? Xi(o.route) : Yi(t), u = s && l === void 0;
2509
+ } : void 0, l = s ? ta(o.route) : ea(t), u = s && l === void 0;
2486
2510
  return /* @__PURE__ */ I("a", {
2487
2511
  href: l,
2488
2512
  rel: s && !u ? "noreferrer" : void 0,
@@ -2499,8 +2523,8 @@ function ia({ node: e, screen: t, activeScreen: n }) {
2499
2523
  }), a !== "icon" && e.label]
2500
2524
  });
2501
2525
  }
2502
- function aa({ element: e }) {
2503
- let t = typeof e.properties.name == "string" ? e.properties.name : "", n = i(O), r = _e(), a = z(), o = n?.outlets[t], s = o && r ? r.screens[o] : void 0, c = e.properties.closable === !0;
2526
+ function ua({ element: e }) {
2527
+ let t = typeof e.properties.name == "string" ? e.properties.name : "", n = i(D), r = ve(), a = z(), o = n?.outlets[t], s = o && r ? r.screens[o] : void 0, c = e.properties.closable === !0;
2504
2528
  return /* @__PURE__ */ I("div", {
2505
2529
  "data-scene-outlet": t,
2506
2530
  "data-scene-outlet-screen": o,
@@ -2515,7 +2539,7 @@ function aa({ element: e }) {
2515
2539
  })
2516
2540
  }), s && r && /* @__PURE__ */ F(Pn, {
2517
2541
  element: s,
2518
- children: /* @__PURE__ */ F(D, {
2542
+ children: /* @__PURE__ */ F(ae, {
2519
2543
  element: s,
2520
2544
  registry: r.registry,
2521
2545
  resolveBinding: a.resolveBinding
@@ -2523,16 +2547,16 @@ function aa({ element: e }) {
2523
2547
  })]
2524
2548
  });
2525
2549
  }
2526
- function oa() {
2527
- let { activity: e } = i(Zi);
2550
+ function da() {
2551
+ let { activity: e } = i(na);
2528
2552
  return e ? /* @__PURE__ */ F("p", {
2529
2553
  className: "stage-activity",
2530
2554
  role: "status",
2531
2555
  children: e
2532
2556
  }) : null;
2533
2557
  }
2534
- function sa() {
2535
- let e = ve(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
2558
+ function fa() {
2559
+ let e = ye(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
2536
2560
  return a(() => {
2537
2561
  let r = e?.isDark ? "dark" : "light";
2538
2562
  document.documentElement.setAttribute("data-scene-color-scheme", r), document.body.setAttribute("data-scene-color-scheme", r), document.body.style.backgroundColor = t ?? "", document.body.style.color = n ?? "";
@@ -2542,24 +2566,24 @@ function sa() {
2542
2566
  n
2543
2567
  ]), null;
2544
2568
  }
2545
- var ca = {
2546
- [Fi]: ea,
2547
- [Ii]: ta,
2548
- [Ki]: na,
2549
- [$i]: oa,
2550
- "core:outlet": aa
2551
- }, la = [
2569
+ var pa = {
2570
+ [Bi]: aa,
2571
+ [Vi]: oa,
2572
+ [Zi]: sa,
2573
+ [ia]: da,
2574
+ "core:outlet": ua
2575
+ }, ma = [
2552
2576
  "navigationMode",
2553
2577
  "menuTheme",
2554
2578
  "showFooter"
2555
- ], ua = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2556
- function da(e, t, n = !1) {
2579
+ ], ha = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2580
+ function ga(e, t, n = !1) {
2557
2581
  let r = [], i = t.options ?? {}, a = {
2558
2582
  showFooter: !0,
2559
2583
  followsSystem: !1,
2560
2584
  problems: r
2561
2585
  };
2562
- for (let [e, n] of Object.entries(i)) if (!la.includes(e)) r.push(`The shell '${t.name}' has no option '${e}'; the options it understands are ${la.join(", ")}.`);
2586
+ for (let [e, n] of Object.entries(i)) if (!ma.includes(e)) r.push(`The shell '${t.name}' has no option '${e}'; the options it understands are ${ma.join(", ")}.`);
2563
2587
  else if (e === "navigationMode") {
2564
2588
  let e = ke.find((e) => e === n);
2565
2589
  e ? a.mode = e : r.push(`Option 'navigationMode' is '${String(n)}'; expected one of ${ke.join(", ")}.`);
@@ -2571,11 +2595,11 @@ function da(e, t, n = !1) {
2571
2595
  if (o?.colorScheme !== void 0) {
2572
2596
  a.followsSystem = o.colorScheme === u.System;
2573
2597
  let e = a.followsSystem ? n : o.colorScheme === u.Dark;
2574
- a.colorScheme = e ? be.Dark : be.Light, a.themeName = De.find((t) => (t.isDark ?? !1) === e)?.name;
2598
+ a.colorScheme = e ? A.Dark : A.Light, a.themeName = N.find((t) => (t.isDark ?? !1) === e)?.name;
2575
2599
  }
2576
- return o?.accent !== void 0 && (ua.test(o.accent) ? a.accent = o.accent : r.push(`The accent '${o.accent}' is not a colour written as #rgb or #rrggbb.`)), a;
2600
+ return o?.accent !== void 0 && (ha.test(o.accent) ? a.accent = o.accent : r.push(`The accent '${o.accent}' is not a colour written as #rgb or #rrggbb.`)), a;
2577
2601
  }
2578
- function fa(e, t) {
2602
+ function _a(e, t) {
2579
2603
  if (e?.root === void 0) return [];
2580
2604
  let n = /* @__PURE__ */ new Set([
2581
2605
  v.RootTemplateUnknown,
@@ -2587,7 +2611,7 @@ function fa(e, t) {
2587
2611
  ]), r = t.diagnostics.filter((e) => n.has(e.code)).map((e) => e.message);
2588
2612
  return r.length === 0 && t.origin !== y.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;
2589
2613
  }
2590
- function pa(e) {
2614
+ function va(e) {
2591
2615
  let t = e.length === 4 ? [...e.slice(1)].map((e) => e + e).join("") : e.slice(1), [n, r, i] = [
2592
2616
  0,
2593
2617
  2,
@@ -2595,7 +2619,7 @@ function pa(e) {
2595
2619
  ].map((e) => parseInt(t.slice(e, e + 2), 16));
2596
2620
  return (n * 299 + r * 587 + i * 114) / 1e3 >= 150 ? "#111827" : "#ffffff";
2597
2621
  }
2598
- function ma(e, t) {
2622
+ function ya(e, t) {
2599
2623
  if (t === void 0) return e;
2600
2624
  let n = t.length === 4 ? [...t.slice(1)].map((e) => e + e).join("") : t.slice(1), [r, i, a] = [
2601
2625
  0,
@@ -2607,23 +2631,25 @@ function ma(e, t) {
2607
2631
  tokens: {
2608
2632
  ...e.tokens,
2609
2633
  "primary.color": t,
2610
- "primary.contrastColor": pa(t),
2634
+ "primary.contrastColor": va(t),
2611
2635
  "focus.ring": `0 0 0 2px rgb(${r} ${i} ${a} / 0.4)`
2612
2636
  }
2613
2637
  }));
2614
2638
  }
2615
2639
  // src/StageShellSettings.tsx
2616
- var ha = "(prefers-color-scheme: dark)";
2617
- function ga() {
2640
+ var ba = "(prefers-color-scheme: dark)";
2641
+ function xa() {
2618
2642
  return globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
2619
2643
  }
2620
- function _a({ settings: e, onSystemSchemeChange: t }) {
2644
+ function Sa({ settings: e, onSystemSchemeChange: t }) {
2621
2645
  let n = c(Pe());
2622
2646
  n.current = Pe();
2623
2647
  let { mode: r, menuTheme: i, colorScheme: o, themeName: s } = e;
2624
2648
  return a(() => {
2625
2649
  let { setMode: e, setMenuTheme: t, setColorScheme: a, setThemeName: c } = n.current;
2626
- r !== void 0 && e(r), i !== void 0 && t(i), o !== void 0 && a(o), s !== void 0 && c(s);
2650
+ r !== void 0 && e(r), i !== void 0 && t(i);
2651
+ let l = N.find((e) => e.name === Ti());
2652
+ l ? (c(l.name), a(l.isDark ? A.Dark : A.Light)) : (o !== void 0 && a(o), s !== void 0 && c(s));
2627
2653
  }, [
2628
2654
  r,
2629
2655
  i,
@@ -2631,15 +2657,15 @@ function _a({ settings: e, onSystemSchemeChange: t }) {
2631
2657
  s
2632
2658
  ]), a(() => {
2633
2659
  if (!e.followsSystem || !globalThis.matchMedia || !t) return;
2634
- let n = globalThis.matchMedia(ha), r = (e) => t(e.matches);
2660
+ let n = globalThis.matchMedia(ba), r = (e) => t(e.matches);
2635
2661
  return n.addEventListener("change", r), () => n.removeEventListener("change", r);
2636
2662
  }, [e.followsSystem, t]), null;
2637
2663
  }
2638
2664
  // src/stageNavigationModel.ts
2639
- function va(e) {
2665
+ function Ca(e) {
2640
2666
  return (e?.application.regions.length ?? 0) > 0 || (e?.modules.length ?? 0) > 0;
2641
2667
  }
2642
- function ya(e) {
2668
+ function wa(e) {
2643
2669
  let t = /* @__PURE__ */ new Map();
2644
2670
  for (let n of e) {
2645
2671
  let e = (n.path ?? []).join(".");
@@ -2652,38 +2678,38 @@ function ya(e) {
2652
2678
  return t.get(r) ?? i ?? (e.some((e) => e.name === r) ? r : void 0);
2653
2679
  };
2654
2680
  }
2655
- function ba(e) {
2681
+ function Ta(e) {
2656
2682
  return (t) => e.find((e) => e.name === t)?.path?.[0];
2657
2683
  }
2658
- function xa(e, t, n) {
2684
+ function Ea(e, t, n) {
2659
2685
  let r = e.navigation ?? {
2660
2686
  application: { regions: [] },
2661
2687
  modules: []
2662
2688
  };
2663
2689
  return {
2664
2690
  structure: e.structure ?? { modules: [] },
2665
- navigation: n ? Sa(r, n) : r,
2666
- screenFor: ya(e.screens),
2667
- moduleOf: ba(e.screens),
2691
+ navigation: n ? Da(r, n) : r,
2692
+ screenFor: wa(e.screens),
2693
+ moduleOf: Ta(e.screens),
2668
2694
  ...t ? { isVisible: t } : {}
2669
2695
  };
2670
2696
  }
2671
- function Sa(e, t) {
2672
- return typeof e == "string" ? ee(e, t) : Array.isArray(e) ? e.map((e) => Sa(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Sa(n, t)])) : e;
2697
+ function Da(e, t) {
2698
+ return typeof e == "string" ? ee(e, t) : Array.isArray(e) ? e.map((e) => Da(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Da(n, t)])) : e;
2673
2699
  }
2674
2700
  // src/stageSlices.ts
2675
- function Ca(e) {
2701
+ function Oa(e) {
2676
2702
  return (t) => G(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0 && !e.members && !e.item).map((e) => ({
2677
2703
  name: e.name,
2678
2704
  type: e.type === "text" || e.type === void 0 ? "string" : e.type,
2679
- label: wa(e.name),
2705
+ label: ka(e.name),
2680
2706
  required: e.required
2681
2707
  }));
2682
2708
  }
2683
- function wa(e) {
2709
+ function ka(e) {
2684
2710
  return e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
2685
2711
  }
2686
- function Ta(e, t, n) {
2712
+ function Aa(e, t, n) {
2687
2713
  return { invoke: async (r, i, a) => {
2688
2714
  let o = a ?? r.slice(r.lastIndexOf(".") + 1);
2689
2715
  if (!U(o)) return {
@@ -2703,7 +2729,7 @@ function Ta(e, t, n) {
2703
2729
  } };
2704
2730
  }
2705
2731
  // src/withoutSeededSlots.ts
2706
- function Ea(e, t) {
2732
+ function ja(e, t) {
2707
2733
  let n = /* @__PURE__ */ new Map();
2708
2734
  for (let e of t) n.has(e.name) || n.set(e.name, e.slots.map((e) => e.name));
2709
2735
  return e.map((e) => {
@@ -2720,7 +2746,7 @@ function Ea(e, t) {
2720
2746
  });
2721
2747
  }
2722
2748
  // src/stageIcons.ts
2723
- var Da = /* @__PURE__ */ new Map([
2749
+ var Ma = /* @__PURE__ */ new Map([
2724
2750
  ["chart", "chart-column"],
2725
2751
  ["add", "plus"],
2726
2752
  ["dollar", "dollar-sign"],
@@ -2728,23 +2754,23 @@ var Da = /* @__PURE__ */ new Map([
2728
2754
  ["refresh", "refresh-cw"],
2729
2755
  ["invoice", "receipt-text"],
2730
2756
  ["batch", "layers"]
2731
- ]), Oa = (e) => e.trim().replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9]+)/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), ka = fe([{
2757
+ ]), Na = (e) => e.trim().replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9]+)/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), Pa = pe([{
2732
2758
  library: _,
2733
2759
  loadGlyph: async ({ key: e }) => {
2734
- let t = Oa(e), n = Da.get(t) ?? t;
2760
+ let t = Na(e), n = Ma.get(t) ?? t;
2735
2761
  if (Object.hasOwn(it, n)) return (await it[n]())?.default;
2736
2762
  }
2737
2763
  }]);
2738
2764
  // src/App.tsx
2739
- function Aa(e = {}) {
2740
- return Wi({
2765
+ function Fa(e = {}) {
2766
+ return Yi({
2741
2767
  ...e,
2742
2768
  ...di,
2743
- ...ca
2769
+ ...pa
2744
2770
  });
2745
2771
  }
2746
- function ja(e, t) {
2747
- return N(`form-${e}-${t.name}`, Jr, {
2772
+ function Ia(e, t) {
2773
+ return P(`form-${e}-${t.name}`, Jr, {
2748
2774
  command: t.forCommand,
2749
2775
  label: t.name,
2750
2776
  generationMode: t.generationMode,
@@ -2752,36 +2778,36 @@ function ja(e, t) {
2752
2778
  fields: t.fields
2753
2779
  });
2754
2780
  }
2755
- function Ma(e, t) {
2781
+ function La(e, t) {
2756
2782
  let n = e.screens[0];
2757
- return Oe(e, n, {
2758
- profile: Hi(e.uiProfiles),
2759
- blueprintTemplates: t?.length ? [...P, ...t] : P
2783
+ return De(e, n, {
2784
+ profile: qi(e.uiProfiles),
2785
+ blueprintTemplates: t?.length ? [...Oe, ...t] : Oe
2760
2786
  });
2761
2787
  }
2762
- function Na(e, t, n, r, i, a, o = !0) {
2763
- let s = va(e.navigation), c = Pa(e);
2788
+ function Ra(e, t, n, r, i, a, o = !0) {
2789
+ let s = Ca(e.navigation), c = za(e);
2764
2790
  return {
2765
- profile: Hi(e.uiProfiles),
2766
- catalog: Gi(r),
2767
- blueprintTemplates: a?.length ? [...P, ...a] : P,
2791
+ profile: qi(e.uiProfiles),
2792
+ catalog: Xi(r),
2793
+ blueprintTemplates: a?.length ? [...Oe, ...a] : Oe,
2768
2794
  namedTemplateOnly: !0,
2769
- chrome: (r, i) => i === j.FullPageShell ? { [M.ConfigPanel]: Ji(e.screens, r.name, t, n, c, s, o)[M.ConfigPanel] } : Ji(e.screens, r.name, t, n, c, s, o),
2770
- form: ja,
2771
- trailing: [N("activity", $i)],
2795
+ chrome: (r, i) => i === j.FullPageShell ? { [M.ConfigPanel]: $i(e.screens, r.name, t, n, c, s, o)[M.ConfigPanel] } : $i(e.screens, r.name, t, n, c, s, o),
2796
+ form: Ia,
2797
+ trailing: [P("activity", ia)],
2772
2798
  decorate: (e) => {
2773
2799
  let t = mi(e);
2774
2800
  return i ? w(t, i) : t;
2775
2801
  }
2776
2802
  };
2777
2803
  }
2778
- function Pa(e) {
2804
+ function za(e) {
2779
2805
  let t = e.navigation?.application.logo;
2780
2806
  if (t) return {
2781
2807
  title: t.title,
2782
2808
  image: t.image || void 0
2783
2809
  };
2784
- let n = Hi(e.uiProfiles).identity;
2810
+ let n = qi(e.uiProfiles).identity;
2785
2811
  if (!n?.name) return;
2786
2812
  let r = n.logo;
2787
2813
  return {
@@ -2791,22 +2817,22 @@ function Pa(e) {
2791
2817
  showName: n.showName
2792
2818
  };
2793
2819
  }
2794
- function Fa(e, t, n, r, i, a) {
2795
- let [o] = Mr([t], Ia(e));
2796
- return we(e, o, Na(e, n, r, i, void 0, a)).element;
2820
+ function Ba(e, t, n, r, i, a) {
2821
+ let [o] = Mr([t], Va(e));
2822
+ return we(e, o, Ra(e, n, r, i, void 0, a)).element;
2797
2823
  }
2798
- function Ia(e) {
2824
+ function Va(e) {
2799
2825
  return [...e.screenTemplates ?? [], ...e.dialogTemplates ?? []];
2800
2826
  }
2801
- function La() {
2827
+ function Ha() {
2802
2828
  try {
2803
2829
  return globalThis.localStorage ?? null;
2804
2830
  } catch {
2805
2831
  return null;
2806
2832
  }
2807
2833
  }
2808
- function Ra({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: i, routing: o = "hash" } = {}) {
2809
- let c = lt(), [u, d] = l(), [f, p] = l(""), m = s(() => Aa(e), [e, u]), h = ut(), g = fi();
2834
+ function Ua({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: i, routing: o = "hash" } = {}) {
2835
+ let c = lt(), [u, d] = l(), [f, p] = l(""), m = s(() => Fa(e), [e, u]), h = ut(), g = fi();
2810
2836
  return a(() => {
2811
2837
  let e = new AbortController();
2812
2838
  return c.scene(e.signal).then((e) => d(r?.length ? {
@@ -2818,7 +2844,7 @@ function Ra({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2818
2844
  }, [c, r]), f ? /* @__PURE__ */ I("main", {
2819
2845
  className: "stage-message",
2820
2846
  children: [/* @__PURE__ */ F("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ F("p", { children: f })]
2821
- }) : u ? /* @__PURE__ */ F(za, {
2847
+ }) : u ? /* @__PURE__ */ F(Wa, {
2822
2848
  scene: u,
2823
2849
  registry: m,
2824
2850
  routing: o,
@@ -2832,20 +2858,20 @@ function Ra({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2832
2858
  children: /* @__PURE__ */ F("h1", { children: "Preparing the Stage" })
2833
2859
  });
2834
2860
  }
2835
- function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: c, isVisible: u }) {
2861
+ function Wa({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: c, isVisible: u }) {
2836
2862
  let d = s(() => {
2837
- if (dn(n), n === "hash") return A();
2863
+ if (dn(n), n === "hash") return k();
2838
2864
  let e = /^#\/(.+)$/.exec(globalThis.location.hash);
2839
- return e && globalThis.history.replaceState(null, "", `/${e[1]}`), de(window, "/");
2840
- }, [n]), [f, p] = l(ga), m = e.screens[0]?.name ?? "", h = s(() => Hi(e.uiProfiles), [e]), g = s(() => m ? Ma(e, c) : void 0, [
2865
+ return e && globalThis.history.replaceState(null, "", `/${e[1]}`), fe(window, "/");
2866
+ }, [n]), [f, p] = l(xa), m = e.screens[0]?.name ?? "", h = s(() => qi(e.uiProfiles), [e]), g = s(() => m ? La(e, c) : void 0, [
2841
2867
  e,
2842
2868
  c,
2843
2869
  m
2844
- ]), _ = s(() => g ? fa(h, g) : [], [h, g]), v = s(() => g ? da(h, g, f) : void 0, [
2870
+ ]), _ = s(() => g ? _a(h, g) : [], [h, g]), v = s(() => g ? ga(h, g, f) : void 0, [
2845
2871
  h,
2846
2872
  g,
2847
2873
  f
2848
- ]), y = s(() => ma(De, v?.accent), [v?.accent]), b = v?.showFooter ?? !0, x = s(() => Na(e, a.locales, a.locale, o, a.dictionary, c, b), [
2874
+ ]), y = s(() => ya(N, v?.accent), [v?.accent]), b = v?.showFooter ?? !0, x = s(() => Ra(e, a.locales, a.locale, o, a.dictionary, c, b), [
2849
2875
  e,
2850
2876
  a.locales,
2851
2877
  a.locale,
@@ -2853,18 +2879,18 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2853
2879
  o,
2854
2880
  c,
2855
2881
  b
2856
- ]), S = r((e) => p(e), []), C = s(() => xa(e, u, a.dictionary), [
2882
+ ]), S = r((e) => p(e), []), C = s(() => Ea(e, u, a.dictionary), [
2857
2883
  e,
2858
2884
  u,
2859
2885
  a.dictionary
2860
2886
  ]), w = s(() => ({
2861
2887
  ...e,
2862
- screens: Mr(Ea(e.screens, [
2888
+ screens: Mr(ja(e.screens, [
2863
2889
  ...e.screenTemplates,
2864
2890
  ...e.dialogTemplates ?? [],
2865
- ...P,
2891
+ ...Oe,
2866
2892
  ...c ?? []
2867
- ]), Ia(e))
2893
+ ]), Va(e))
2868
2894
  }), [e, c]);
2869
2895
  return m ? _.length > 0 ? /* @__PURE__ */ I("main", {
2870
2896
  className: "stage-message",
@@ -2875,15 +2901,15 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2875
2901
  /* @__PURE__ */ F("p", { children: "The ui profile's root template cannot be the application's shell." }),
2876
2902
  /* @__PURE__ */ F("ul", { children: _.map((e) => /* @__PURE__ */ F("li", { children: e }, e)) })
2877
2903
  ]
2878
- }) : /* @__PURE__ */ F(ye, {
2904
+ }) : /* @__PURE__ */ F(be, {
2879
2905
  application: w,
2880
2906
  composition: x,
2881
2907
  navigationModel: C,
2882
2908
  registry: t,
2883
2909
  initialScreen: m,
2884
2910
  history: d,
2885
- layoutConfigStorage: La(),
2886
- scope: (t, n) => /* @__PURE__ */ F(Ba, {
2911
+ layoutConfigStorage: Ha(),
2912
+ scope: (t, n) => /* @__PURE__ */ F(Ga, {
2887
2913
  scene: e,
2888
2914
  routeState: i,
2889
2915
  strings: a,
@@ -2893,13 +2919,13 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2893
2919
  onSystemSchemeChange: S,
2894
2920
  children: n
2895
2921
  }),
2896
- renderScreen: (e, n) => /* @__PURE__ */ F(Ha, {
2922
+ renderScreen: (e, n) => /* @__PURE__ */ F(qa, {
2897
2923
  element: e,
2898
2924
  configuration: n,
2899
2925
  registry: t
2900
2926
  }),
2901
2927
  renderDialog: () => /* @__PURE__ */ F(si, {}),
2902
- renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(Ua, {
2928
+ renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(Ja, {
2903
2929
  template: e,
2904
2930
  content: n,
2905
2931
  registry: t,
@@ -2911,7 +2937,7 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2911
2937
  children: [/* @__PURE__ */ F("h1", { children: "Nothing to show yet" }), /* @__PURE__ */ F("p", { children: "This model has no slice carrying a command or a read model, so there is no screen to render." })]
2912
2938
  });
2913
2939
  }
2914
- function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
2940
+ function Ga({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
2915
2941
  let [u, f] = l(""), { navigate: p } = r;
2916
2942
  return a(() => f(""), [r.currentScreen, r.currentDialog]), a(() => {
2917
2943
  let e = (e) => {
@@ -2929,15 +2955,15 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2929
2955
  };
2930
2956
  return globalThis.addEventListener("cratis.scene.navigate", t), () => globalThis.removeEventListener("cratis.scene.navigate", t);
2931
2957
  }, [p, e]), /* @__PURE__ */ F(re, {
2932
- registry: ka,
2958
+ registry: Pa,
2933
2959
  children: /* @__PURE__ */ I(Se, {
2934
2960
  themes: i,
2935
2961
  children: [
2936
- o && /* @__PURE__ */ F(_a, {
2962
+ o && /* @__PURE__ */ F(Sa, {
2937
2963
  settings: o,
2938
2964
  onSystemSchemeChange: s
2939
2965
  }),
2940
- /* @__PURE__ */ F(sa, {}),
2966
+ /* @__PURE__ */ F(fa, {}),
2941
2967
  /* @__PURE__ */ F(Wt, {
2942
2968
  routes: t.routes,
2943
2969
  routesReady: t.ready,
@@ -2945,7 +2971,7 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2945
2971
  locale: n.locale,
2946
2972
  locales: n.locales,
2947
2973
  screen: r.primaryScreen ?? e.screens[0]?.name ?? "",
2948
- children: /* @__PURE__ */ F(Va, {
2974
+ children: /* @__PURE__ */ F(Ka, {
2949
2975
  activity: u,
2950
2976
  routesReady: t.ready,
2951
2977
  scene: e,
@@ -2958,12 +2984,12 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2958
2984
  })
2959
2985
  });
2960
2986
  }
2961
- function Va({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: a }) {
2962
- let o = z(), c = ge(), l = cn(), u = s(() => Ta(l, t, o.refreshAfterCommand), [
2987
+ function Ka({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: a }) {
2988
+ let o = z(), c = _e(), l = cn(), u = s(() => Aa(l, t, o.refreshAfterCommand), [
2963
2989
  l,
2964
2990
  t,
2965
2991
  o.refreshAfterCommand
2966
- ]), f = s(() => Ca(n.commandSchemas), [n.commandSchemas]), p = ue({
2992
+ ]), f = s(() => Oa(n.commandSchemas), [n.commandSchemas]), p = de({
2967
2993
  executeCommand: async (e, n) => {
2968
2994
  let i = U(e);
2969
2995
  if (!i && !t) return r(`The modeled command “${e}” is waiting for Stage routes.`), {
@@ -2999,16 +3025,16 @@ function Va({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
2999
3025
  refreshQuery: async (e) => o.refreshQuery(e),
3000
3026
  raise: async (e) => r(`The modeled trigger “${e}” is not available in this Stage runtime.`)
3001
3027
  });
3002
- return /* @__PURE__ */ F(Qi, {
3028
+ return /* @__PURE__ */ F(ra, {
3003
3029
  state: {
3004
3030
  locales: i.locales,
3005
3031
  locale: i.locale,
3006
3032
  setLocale: i.setLocale,
3007
3033
  activity: e
3008
3034
  },
3009
- children: /* @__PURE__ */ F(se, {
3035
+ children: /* @__PURE__ */ F(ce, {
3010
3036
  invoker: u,
3011
- children: /* @__PURE__ */ F(ae, {
3037
+ children: /* @__PURE__ */ F(oe, {
3012
3038
  fieldsFor: f,
3013
3039
  children: /* @__PURE__ */ F(ie, {
3014
3040
  dispatcher: p,
@@ -3024,11 +3050,11 @@ function Va({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3024
3050
  })
3025
3051
  });
3026
3052
  }
3027
- function Ha({ element: e, configuration: t, registry: n }) {
3053
+ function qa({ element: e, configuration: t, registry: n }) {
3028
3054
  let r = z(), i = nn();
3029
3055
  return /* @__PURE__ */ I(Pn, {
3030
3056
  element: e,
3031
- children: [/* @__PURE__ */ F(Si, { element: e }), /* @__PURE__ */ F(D, {
3057
+ children: [/* @__PURE__ */ F(Si, { element: e }), /* @__PURE__ */ F(ae, {
3032
3058
  element: e,
3033
3059
  registry: n,
3034
3060
  resolveBinding: r.resolveBinding,
@@ -3038,7 +3064,7 @@ function Ha({ element: e, configuration: t, registry: n }) {
3038
3064
  })]
3039
3065
  });
3040
3066
  }
3041
- function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3067
+ function Ja({ template: e, content: t, registry: n, strings: r, close: i }) {
3042
3068
  let o = z(), s = nn(), c = w(t, r.dictionary);
3043
3069
  return a(() => {
3044
3070
  let e = (e) => {
@@ -3058,7 +3084,7 @@ function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3058
3084
  children: "Close"
3059
3085
  }), /* @__PURE__ */ F(Pn, {
3060
3086
  element: c,
3061
- children: /* @__PURE__ */ F(D, {
3087
+ children: /* @__PURE__ */ F(ae, {
3062
3088
  element: c,
3063
3089
  registry: n,
3064
3090
  resolveBinding: o.resolveBinding,
@@ -3069,4 +3095,4 @@ function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3069
3095
  })
3070
3096
  });
3071
3097
  }
3072
- export { Ra as App, Ra as StageApplication, zn as StageCommandForm, Wt as StageDataProvider, Or as StageGuardedAction, ct as StageSourceProvider, Fa as composeStageScreen, Ta as createStageSliceInvoker, Gt as dataChanged, on as executeRegisteredCommand, ht as hostedBasePath, Bi as listsPrimeReact, St as performQuery, vt as registerQueryRouteResolver, Vi as registerStageLibrary, U as registeredCommand, yt as registeredQuery, Ca as sliceFieldsFrom, Aa as stageApplicationRegistry, Na as stageComposition, e as stageDarkSelector, ot as stageEndpoints, Ma as stageShellOf, at as staticStageSource, Ct as subscribeQuery, cn as useStageCommandExecutor, z as useStageData, B as useStageQuery, lt as useStageSource };
3098
+ export { Ua as App, Ua as StageApplication, zn as StageCommandForm, Wt as StageDataProvider, Or as StageGuardedAction, ct as StageSourceProvider, Ba as composeStageScreen, Aa as createStageSliceInvoker, Gt as dataChanged, on as executeRegisteredCommand, ht as hostedBasePath, Gi as listsPrimeReact, St as performQuery, vt as registerQueryRouteResolver, Ki as registerStageLibrary, U as registeredCommand, yt as registeredQuery, Oa as sliceFieldsFrom, Fa as stageApplicationRegistry, Ra as stageComposition, e as stageDarkSelector, ot as stageEndpoints, La as stageShellOf, at as staticStageSource, Ct as subscribeQuery, cn as useStageCommandExecutor, z as useStageData, B as useStageQuery, lt as useStageSource };
@@ -0,0 +1,6 @@
1
+ /** The browser storage key the user's theme choice lives under, so it survives a refresh. */
2
+ export declare const stageThemeChoiceKey = "cratis.stage.theme";
3
+ /** The theme the user chose with the toggle, or undefined when they never did or the browser refuses storage. */
4
+ export declare function readThemeChoice(): string | undefined;
5
+ /** Remembers the user's theme choice in the browser. */
6
+ export declare function writeThemeChoice(themeName: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/stage.runtime",
3
- "version": "4.205.0",
3
+ "version": "4.207.0",
4
4
  "description": "The Cratis Stage application runtime for Arc and Scene",
5
5
  "author": "Cratis",
6
6
  "type": "module",