@cratis/stage.runtime 4.205.0 → 4.206.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 = Ai(e);
2179
2200
  t.has(i) || (t.add(i), n.push(e));
2180
2201
  }
2181
2202
  return n.map((e, t) => ({
@@ -2183,18 +2204,18 @@ 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) => ji(e, t, !1), t);
2214
+ (n.group ? ji(e, n.group, !0) : e).children.push(Mi(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;
@@ -2204,23 +2225,23 @@ function Ti(e) {
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
+ ...Pi({
2229
+ id: Ni(t.id),
2230
+ group: Ni(t.group),
2231
+ icon: Ni(t.icon),
2232
+ presentation: Ni(t.presentation),
2233
+ destination: Ii(o) && Li(o) ? o : void 0
2213
2234
  })
2214
2235
  };
2215
2236
  }
2216
- function Ei(e) {
2237
+ function Ai(e) {
2217
2238
  return e.id === void 0 ? JSON.stringify([
2218
2239
  e.hierarchy,
2219
2240
  e.targetScreen,
2220
2241
  e.label
2221
2242
  ]) : JSON.stringify(["id", e.id]);
2222
2243
  }
2223
- function Di(e, t, n) {
2244
+ function ji(e, t, n) {
2224
2245
  let r = e.children.find((e) => e.screen === void 0 && e.section === !0 === n && e.label === t);
2225
2246
  if (r) return r;
2226
2247
  let i = n ? {
@@ -2233,12 +2254,12 @@ function Di(e, t, n) {
2233
2254
  };
2234
2255
  return e.children.push(i), i;
2235
2256
  }
2236
- function Oi(e) {
2257
+ function Mi(e) {
2237
2258
  return {
2238
2259
  label: e.label,
2239
- ...Ai({ id: e.id || void 0 }),
2260
+ ...Pi({ id: e.id || void 0 }),
2240
2261
  screen: e.targetScreen,
2241
- ...Ai({
2262
+ ...Pi({
2242
2263
  icon: e.icon || void 0,
2243
2264
  presentation: e.presentation || void 0,
2244
2265
  destination: e.destination
@@ -2246,27 +2267,27 @@ function Oi(e) {
2246
2267
  children: []
2247
2268
  };
2248
2269
  }
2249
- function ki(e) {
2270
+ function Ni(e) {
2250
2271
  return typeof e == "string" ? e : void 0;
2251
2272
  }
2252
- function Ai(e) {
2273
+ function Pi(e) {
2253
2274
  return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
2254
2275
  }
2255
- function ji(e, t) {
2276
+ function Fi(e, t) {
2256
2277
  for (let n of e) {
2257
2278
  if (n.screen === t) return [n.label];
2258
- let e = ji(n.children, t);
2279
+ let e = Fi(n.children, t);
2259
2280
  if (e.length > 0) return n.section ? e : [n.label, ...e];
2260
2281
  }
2261
2282
  return [];
2262
2283
  }
2263
- function Mi(e) {
2284
+ function Ii(e) {
2264
2285
  return typeof e == "object" && !!e && !Array.isArray(e);
2265
2286
  }
2266
- function Ni(e) {
2287
+ function Li(e) {
2267
2288
  return e.outlet !== void 0 || e.dialog !== void 0 || e.kind === "external" || e.kind === "dialog";
2268
2289
  }
2269
- function Pi(e, t, n) {
2290
+ function Ri(e, t, n) {
2270
2291
  return e.filter((e) => !t.has(e.name)).map((e) => ({
2271
2292
  label: e.name,
2272
2293
  targetScreen: e.name,
@@ -2274,35 +2295,35 @@ function Pi(e, t, n) {
2274
2295
  }));
2275
2296
  }
2276
2297
  // 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);
2298
+ var zi = "Stage:locale", Bi = "Stage:themeToggle", Vi = "Cratis.Components", Hi = "PrimeReact", Ui = /* @__PURE__ */ new Map();
2299
+ function Wi(e) {
2300
+ return Ne(e).packages.includes(Hi);
2280
2301
  }
2281
- function Vi(e, t) {
2282
- zi.set(e, t);
2302
+ function Gi(e, t) {
2303
+ Ui.set(e, t);
2283
2304
  }
2284
- function Hi(e) {
2305
+ function Ki(e) {
2285
2306
  let t = Ne(e);
2286
2307
  return {
2287
2308
  ...t,
2288
2309
  name: e?.length ? t.name : "Stage",
2289
2310
  packages: x(t.packages, {
2290
- baseline: Li,
2311
+ baseline: Vi,
2291
2312
  catalog: { [Ee]: g.Blueprint }
2292
2313
  })
2293
2314
  };
2294
2315
  }
2295
- var Ui = {
2316
+ var qi = {
2296
2317
  ...Ce,
2297
- [Li]: rt.components
2318
+ [Vi]: rt.components
2298
2319
  };
2299
- function Wi(e) {
2300
- let t = [...zi.values()].reduce((e, t) => ({
2320
+ function Ji(e) {
2321
+ let t = [...Ui.values()].reduce((e, t) => ({
2301
2322
  ...e,
2302
2323
  ...t.components
2303
2324
  }), {});
2304
2325
  return {
2305
- ...k,
2326
+ ...O,
2306
2327
  ...nt,
2307
2328
  ...t,
2308
2329
  ...Te,
@@ -2310,18 +2331,18 @@ function Wi(e) {
2310
2331
  ...e
2311
2332
  };
2312
2333
  }
2313
- function Gi(e) {
2314
- let t = Object.fromEntries([...zi].map(([e, t]) => [e, t.declared]));
2334
+ function Yi(e) {
2335
+ let t = Object.fromEntries([...Ui].map(([e, t]) => [e, t.declared]));
2315
2336
  return {
2316
2337
  ...e,
2317
- ...Ui,
2338
+ ...qi,
2318
2339
  ...t
2319
2340
  };
2320
2341
  }
2321
- var Ki = "Stage:navigationTree";
2322
- function qi(e, t, n) {
2342
+ var Xi = "Stage:navigationTree";
2343
+ function Zi(e, t, n) {
2323
2344
  let r = t?.title ?? "Cratis Stage";
2324
- return N(e, j.Logo, {
2345
+ return P(e, j.Logo, {
2325
2346
  label: r,
2326
2347
  initials: r.slice(0, 1).toUpperCase() || "S",
2327
2348
  targetScreen: n,
@@ -2330,40 +2351,40 @@ function qi(e, t, n) {
2330
2351
  ...t?.showName === void 0 ? {} : { showName: t.showName }
2331
2352
  });
2332
2353
  }
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({
2354
+ function Qi(e, t, n, r, i, a = !1, o = !0) {
2355
+ let s = e[0]?.name ?? "", c = i?.title ?? "Cratis Stage", l = Di(e), u = Ri(e, new Set(l.map((e) => e.targetScreen)), "Other screens"), d = Oi([...l, ...l.length > 0 ? u : []]), f = e.map((e, n) => je({
2335
2356
  label: e.name,
2336
2357
  targetScreen: e.name,
2337
2358
  icon: "pi pi-table",
2338
2359
  group: "Screens",
2339
2360
  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, {
2361
+ }, t)), p = Fi(Oi(l), t), m = e.find((e) => e.name === t)?.path?.length ? Fi(d, t) : [], h = p.length > 0 ? p : m, g = l.length > 0 ? P("menu-hierarchy", Xi, {
2341
2362
  nodes: d,
2342
2363
  activeScreen: t
2343
- }) : N("menu-screens", j.Menu, {
2364
+ }) : P("menu-screens", j.Menu, {
2344
2365
  title: "Screens",
2345
2366
  label: "Screens"
2346
2367
  }, { items: f }), _ = [];
2347
- n.length > 1 && _.push(N("topbar-locale", Fi, {
2368
+ n.length > 1 && _.push(P("topbar-locale", zi, {
2348
2369
  locales: n,
2349
2370
  locale: r
2350
- })), _.push(N("topbar-theme", Ii, {}));
2371
+ })), _.push(P("topbar-theme", Bi, {}));
2351
2372
  let v = { regionNavigation: a };
2352
2373
  return {
2353
- [M.Topbar]: [N("topbar", j.Topbar, v, {
2354
- logo: [qi("topbar-logo", i, s)],
2374
+ [M.Topbar]: [P("topbar", j.Topbar, v, {
2375
+ logo: [Zi("topbar-logo", i, s)],
2355
2376
  end: _
2356
2377
  })],
2357
- [M.Sidebar]: [N("sidebar", j.Sidebar, v, { logo: [qi("sidebar-logo", i, s)] })],
2378
+ [M.Sidebar]: [P("sidebar", j.Sidebar, v, { logo: [Zi("sidebar-logo", i, s)] })],
2358
2379
  ...a ? {} : { [M.Menu]: [g] },
2359
- [M.Breadcrumb]: [N("breadcrumb", j.Breadcrumb, {
2380
+ [M.Breadcrumb]: [P("breadcrumb", j.Breadcrumb, {
2360
2381
  homeTargetScreen: s,
2361
2382
  items: (h.length > 0 ? h : [t]).map((e) => ({ label: e }))
2362
2383
  })],
2363
- ...o ? { [M.Footer]: [N("footer", j.Footer, { text: `${c} · rendered from your model` })] } : {},
2364
- [M.ConfigPanel]: [N(j.ConfigPanel, j.ConfigPanel, {
2384
+ ...o ? { [M.Footer]: [P("footer", j.Footer, { text: `${c} · rendered from your model` })] } : {},
2385
+ [M.ConfigPanel]: [P(j.ConfigPanel, j.ConfigPanel, {
2365
2386
  title: "Settings",
2366
- themes: De.map((e) => ({
2387
+ themes: N.map((e) => ({
2367
2388
  name: e.name,
2368
2389
  label: e.name,
2369
2390
  isDark: e.isDark ?? !1
@@ -2371,11 +2392,11 @@ function Ji(e, t, n, r, i, a = !1, o = !0) {
2371
2392
  })]
2372
2393
  };
2373
2394
  }
2374
- function Yi(e) {
2395
+ function $i(e) {
2375
2396
  return `#/${encodeURIComponent(e)}`;
2376
2397
  }
2377
2398
  // src/externalRouteHref.ts
2378
- function Xi(e) {
2399
+ function ea(e) {
2379
2400
  try {
2380
2401
  let t = new URL(e ?? "");
2381
2402
  return t.protocol === "http:" || t.protocol === "https:" ? e : void 0;
@@ -2384,21 +2405,21 @@ function Xi(e) {
2384
2405
  }
2385
2406
  }
2386
2407
  // src/StageChrome.tsx
2387
- var Zi = t({
2408
+ var ta = t({
2388
2409
  locales: [],
2389
2410
  locale: "",
2390
2411
  setLocale: () => void 0,
2391
2412
  activity: ""
2392
2413
  });
2393
- function Qi({ state: e, children: t }) {
2394
- return /* @__PURE__ */ F(Zi.Provider, {
2414
+ function na({ state: e, children: t }) {
2415
+ return /* @__PURE__ */ F(ta.Provider, {
2395
2416
  value: e,
2396
2417
  children: t
2397
2418
  });
2398
2419
  }
2399
- var $i = "Stage:activity";
2400
- function ea() {
2401
- let { locales: e, locale: t, setLocale: n } = i(Zi);
2420
+ var ra = "Stage:activity";
2421
+ function ia() {
2422
+ let { locales: e, locale: t, setLocale: n } = i(ta);
2402
2423
  return e.length < 2 ? null : /* @__PURE__ */ F("select", {
2403
2424
  className: "stage-locale",
2404
2425
  "aria-label": "Locale",
@@ -2410,8 +2431,8 @@ function ea() {
2410
2431
  }, e))
2411
2432
  });
2412
2433
  }
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);
2434
+ function aa({ element: e }) {
2435
+ 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
2436
  if (!a) return null;
2416
2437
  let o = i ? "Switch to a light theme" : "Switch to a dark theme";
2417
2438
  return /* @__PURE__ */ F("div", {
@@ -2423,7 +2444,7 @@ function ta({ element: e }) {
2423
2444
  "aria-label": o,
2424
2445
  title: o,
2425
2446
  onClick: () => {
2426
- n(a.name), r(a.isDark ? be.Dark : be.Light);
2447
+ Ei(a.name), n(a.name), r(a.isDark ? A.Dark : A.Light);
2427
2448
  },
2428
2449
  children: /* @__PURE__ */ F("svg", {
2429
2450
  width: "18",
@@ -2444,19 +2465,19 @@ function ta({ element: e }) {
2444
2465
  })
2445
2466
  });
2446
2467
  }
2447
- function na({ element: e }) {
2468
+ function oa({ element: e }) {
2448
2469
  let t = e.properties ?? {};
2449
2470
  return /* @__PURE__ */ F("nav", {
2450
2471
  className: "stage-navigation-tree",
2451
2472
  "aria-label": "Navigation",
2452
2473
  "data-scene-id": e.id,
2453
- children: /* @__PURE__ */ F(ra, {
2474
+ children: /* @__PURE__ */ F(sa, {
2454
2475
  nodes: t.nodes ?? [],
2455
2476
  activeScreen: t.activeScreen
2456
2477
  })
2457
2478
  });
2458
2479
  }
2459
- function ra({ nodes: e, activeScreen: t }) {
2480
+ function sa({ nodes: e, activeScreen: t }) {
2460
2481
  return /* @__PURE__ */ F("ul", {
2461
2482
  role: "tree",
2462
2483
  children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ I("li", {
@@ -2465,13 +2486,13 @@ function ra({ nodes: e, activeScreen: t }) {
2465
2486
  children: [/* @__PURE__ */ F("span", {
2466
2487
  className: "stage-navigation-group",
2467
2488
  children: e.label
2468
- }), /* @__PURE__ */ F(ra, {
2489
+ }), /* @__PURE__ */ F(sa, {
2469
2490
  nodes: e.children,
2470
2491
  activeScreen: t
2471
2492
  })]
2472
2493
  }, e.label) : /* @__PURE__ */ F("li", {
2473
2494
  role: "treeitem",
2474
- children: /* @__PURE__ */ F(ia, {
2495
+ children: /* @__PURE__ */ F(ca, {
2475
2496
  node: e,
2476
2497
  screen: e.screen,
2477
2498
  activeScreen: t
@@ -2479,10 +2500,10 @@ function ra({ nodes: e, activeScreen: t }) {
2479
2500
  }, `${e.screen}:${e.label}`))
2480
2501
  });
2481
2502
  }
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) => {
2503
+ function ca({ node: e, screen: t, activeScreen: n }) {
2504
+ 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 && Li(o) ? (e) => {
2484
2505
  e.preventDefault(), r.navigate(o);
2485
- } : void 0, l = s ? Xi(o.route) : Yi(t), u = s && l === void 0;
2506
+ } : void 0, l = s ? ea(o.route) : $i(t), u = s && l === void 0;
2486
2507
  return /* @__PURE__ */ I("a", {
2487
2508
  href: l,
2488
2509
  rel: s && !u ? "noreferrer" : void 0,
@@ -2499,8 +2520,8 @@ function ia({ node: e, screen: t, activeScreen: n }) {
2499
2520
  }), a !== "icon" && e.label]
2500
2521
  });
2501
2522
  }
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;
2523
+ function la({ element: e }) {
2524
+ 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
2525
  return /* @__PURE__ */ I("div", {
2505
2526
  "data-scene-outlet": t,
2506
2527
  "data-scene-outlet-screen": o,
@@ -2515,7 +2536,7 @@ function aa({ element: e }) {
2515
2536
  })
2516
2537
  }), s && r && /* @__PURE__ */ F(Pn, {
2517
2538
  element: s,
2518
- children: /* @__PURE__ */ F(D, {
2539
+ children: /* @__PURE__ */ F(ae, {
2519
2540
  element: s,
2520
2541
  registry: r.registry,
2521
2542
  resolveBinding: a.resolveBinding
@@ -2523,16 +2544,16 @@ function aa({ element: e }) {
2523
2544
  })]
2524
2545
  });
2525
2546
  }
2526
- function oa() {
2527
- let { activity: e } = i(Zi);
2547
+ function ua() {
2548
+ let { activity: e } = i(ta);
2528
2549
  return e ? /* @__PURE__ */ F("p", {
2529
2550
  className: "stage-activity",
2530
2551
  role: "status",
2531
2552
  children: e
2532
2553
  }) : null;
2533
2554
  }
2534
- function sa() {
2535
- let e = ve(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
2555
+ function da() {
2556
+ let e = ye(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
2536
2557
  return a(() => {
2537
2558
  let r = e?.isDark ? "dark" : "light";
2538
2559
  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 +2563,24 @@ function sa() {
2542
2563
  n
2543
2564
  ]), null;
2544
2565
  }
2545
- var ca = {
2546
- [Fi]: ea,
2547
- [Ii]: ta,
2548
- [Ki]: na,
2549
- [$i]: oa,
2550
- "core:outlet": aa
2551
- }, la = [
2566
+ var fa = {
2567
+ [zi]: ia,
2568
+ [Bi]: aa,
2569
+ [Xi]: oa,
2570
+ [ra]: ua,
2571
+ "core:outlet": la
2572
+ }, pa = [
2552
2573
  "navigationMode",
2553
2574
  "menuTheme",
2554
2575
  "showFooter"
2555
- ], ua = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2556
- function da(e, t, n = !1) {
2576
+ ], ma = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2577
+ function ha(e, t, n = !1) {
2557
2578
  let r = [], i = t.options ?? {}, a = {
2558
2579
  showFooter: !0,
2559
2580
  followsSystem: !1,
2560
2581
  problems: r
2561
2582
  };
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(", ")}.`);
2583
+ for (let [e, n] of Object.entries(i)) if (!pa.includes(e)) r.push(`The shell '${t.name}' has no option '${e}'; the options it understands are ${pa.join(", ")}.`);
2563
2584
  else if (e === "navigationMode") {
2564
2585
  let e = ke.find((e) => e === n);
2565
2586
  e ? a.mode = e : r.push(`Option 'navigationMode' is '${String(n)}'; expected one of ${ke.join(", ")}.`);
@@ -2571,11 +2592,11 @@ function da(e, t, n = !1) {
2571
2592
  if (o?.colorScheme !== void 0) {
2572
2593
  a.followsSystem = o.colorScheme === u.System;
2573
2594
  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;
2595
+ a.colorScheme = e ? A.Dark : A.Light, a.themeName = N.find((t) => (t.isDark ?? !1) === e)?.name;
2575
2596
  }
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;
2597
+ return o?.accent !== void 0 && (ma.test(o.accent) ? a.accent = o.accent : r.push(`The accent '${o.accent}' is not a colour written as #rgb or #rrggbb.`)), a;
2577
2598
  }
2578
- function fa(e, t) {
2599
+ function ga(e, t) {
2579
2600
  if (e?.root === void 0) return [];
2580
2601
  let n = /* @__PURE__ */ new Set([
2581
2602
  v.RootTemplateUnknown,
@@ -2587,7 +2608,7 @@ function fa(e, t) {
2587
2608
  ]), r = t.diagnostics.filter((e) => n.has(e.code)).map((e) => e.message);
2588
2609
  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
2610
  }
2590
- function pa(e) {
2611
+ function _a(e) {
2591
2612
  let t = e.length === 4 ? [...e.slice(1)].map((e) => e + e).join("") : e.slice(1), [n, r, i] = [
2592
2613
  0,
2593
2614
  2,
@@ -2595,7 +2616,7 @@ function pa(e) {
2595
2616
  ].map((e) => parseInt(t.slice(e, e + 2), 16));
2596
2617
  return (n * 299 + r * 587 + i * 114) / 1e3 >= 150 ? "#111827" : "#ffffff";
2597
2618
  }
2598
- function ma(e, t) {
2619
+ function va(e, t) {
2599
2620
  if (t === void 0) return e;
2600
2621
  let n = t.length === 4 ? [...t.slice(1)].map((e) => e + e).join("") : t.slice(1), [r, i, a] = [
2601
2622
  0,
@@ -2607,23 +2628,25 @@ function ma(e, t) {
2607
2628
  tokens: {
2608
2629
  ...e.tokens,
2609
2630
  "primary.color": t,
2610
- "primary.contrastColor": pa(t),
2631
+ "primary.contrastColor": _a(t),
2611
2632
  "focus.ring": `0 0 0 2px rgb(${r} ${i} ${a} / 0.4)`
2612
2633
  }
2613
2634
  }));
2614
2635
  }
2615
2636
  // src/StageShellSettings.tsx
2616
- var ha = "(prefers-color-scheme: dark)";
2617
- function ga() {
2637
+ var ya = "(prefers-color-scheme: dark)";
2638
+ function ba() {
2618
2639
  return globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
2619
2640
  }
2620
- function _a({ settings: e, onSystemSchemeChange: t }) {
2641
+ function xa({ settings: e, onSystemSchemeChange: t }) {
2621
2642
  let n = c(Pe());
2622
2643
  n.current = Pe();
2623
2644
  let { mode: r, menuTheme: i, colorScheme: o, themeName: s } = e;
2624
2645
  return a(() => {
2625
2646
  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);
2647
+ r !== void 0 && e(r), i !== void 0 && t(i);
2648
+ let l = N.find((e) => e.name === Ti());
2649
+ l ? (c(l.name), a(l.isDark ? A.Dark : A.Light)) : (o !== void 0 && a(o), s !== void 0 && c(s));
2627
2650
  }, [
2628
2651
  r,
2629
2652
  i,
@@ -2631,15 +2654,15 @@ function _a({ settings: e, onSystemSchemeChange: t }) {
2631
2654
  s
2632
2655
  ]), a(() => {
2633
2656
  if (!e.followsSystem || !globalThis.matchMedia || !t) return;
2634
- let n = globalThis.matchMedia(ha), r = (e) => t(e.matches);
2657
+ let n = globalThis.matchMedia(ya), r = (e) => t(e.matches);
2635
2658
  return n.addEventListener("change", r), () => n.removeEventListener("change", r);
2636
2659
  }, [e.followsSystem, t]), null;
2637
2660
  }
2638
2661
  // src/stageNavigationModel.ts
2639
- function va(e) {
2662
+ function Sa(e) {
2640
2663
  return (e?.application.regions.length ?? 0) > 0 || (e?.modules.length ?? 0) > 0;
2641
2664
  }
2642
- function ya(e) {
2665
+ function Ca(e) {
2643
2666
  let t = /* @__PURE__ */ new Map();
2644
2667
  for (let n of e) {
2645
2668
  let e = (n.path ?? []).join(".");
@@ -2652,38 +2675,38 @@ function ya(e) {
2652
2675
  return t.get(r) ?? i ?? (e.some((e) => e.name === r) ? r : void 0);
2653
2676
  };
2654
2677
  }
2655
- function ba(e) {
2678
+ function wa(e) {
2656
2679
  return (t) => e.find((e) => e.name === t)?.path?.[0];
2657
2680
  }
2658
- function xa(e, t, n) {
2681
+ function Ta(e, t, n) {
2659
2682
  let r = e.navigation ?? {
2660
2683
  application: { regions: [] },
2661
2684
  modules: []
2662
2685
  };
2663
2686
  return {
2664
2687
  structure: e.structure ?? { modules: [] },
2665
- navigation: n ? Sa(r, n) : r,
2666
- screenFor: ya(e.screens),
2667
- moduleOf: ba(e.screens),
2688
+ navigation: n ? Ea(r, n) : r,
2689
+ screenFor: Ca(e.screens),
2690
+ moduleOf: wa(e.screens),
2668
2691
  ...t ? { isVisible: t } : {}
2669
2692
  };
2670
2693
  }
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;
2694
+ function Ea(e, t) {
2695
+ return typeof e == "string" ? ee(e, t) : Array.isArray(e) ? e.map((e) => Ea(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Ea(n, t)])) : e;
2673
2696
  }
2674
2697
  // src/stageSlices.ts
2675
- function Ca(e) {
2698
+ function Da(e) {
2676
2699
  return (t) => G(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0 && !e.members && !e.item).map((e) => ({
2677
2700
  name: e.name,
2678
2701
  type: e.type === "text" || e.type === void 0 ? "string" : e.type,
2679
- label: wa(e.name),
2702
+ label: Oa(e.name),
2680
2703
  required: e.required
2681
2704
  }));
2682
2705
  }
2683
- function wa(e) {
2706
+ function Oa(e) {
2684
2707
  return e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
2685
2708
  }
2686
- function Ta(e, t, n) {
2709
+ function ka(e, t, n) {
2687
2710
  return { invoke: async (r, i, a) => {
2688
2711
  let o = a ?? r.slice(r.lastIndexOf(".") + 1);
2689
2712
  if (!U(o)) return {
@@ -2703,7 +2726,7 @@ function Ta(e, t, n) {
2703
2726
  } };
2704
2727
  }
2705
2728
  // src/withoutSeededSlots.ts
2706
- function Ea(e, t) {
2729
+ function Aa(e, t) {
2707
2730
  let n = /* @__PURE__ */ new Map();
2708
2731
  for (let e of t) n.has(e.name) || n.set(e.name, e.slots.map((e) => e.name));
2709
2732
  return e.map((e) => {
@@ -2720,7 +2743,7 @@ function Ea(e, t) {
2720
2743
  });
2721
2744
  }
2722
2745
  // src/stageIcons.ts
2723
- var Da = /* @__PURE__ */ new Map([
2746
+ var ja = /* @__PURE__ */ new Map([
2724
2747
  ["chart", "chart-column"],
2725
2748
  ["add", "plus"],
2726
2749
  ["dollar", "dollar-sign"],
@@ -2728,23 +2751,23 @@ var Da = /* @__PURE__ */ new Map([
2728
2751
  ["refresh", "refresh-cw"],
2729
2752
  ["invoice", "receipt-text"],
2730
2753
  ["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([{
2754
+ ]), Ma = (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(), Na = pe([{
2732
2755
  library: _,
2733
2756
  loadGlyph: async ({ key: e }) => {
2734
- let t = Oa(e), n = Da.get(t) ?? t;
2757
+ let t = Ma(e), n = ja.get(t) ?? t;
2735
2758
  if (Object.hasOwn(it, n)) return (await it[n]())?.default;
2736
2759
  }
2737
2760
  }]);
2738
2761
  // src/App.tsx
2739
- function Aa(e = {}) {
2740
- return Wi({
2762
+ function Pa(e = {}) {
2763
+ return Ji({
2741
2764
  ...e,
2742
2765
  ...di,
2743
- ...ca
2766
+ ...fa
2744
2767
  });
2745
2768
  }
2746
- function ja(e, t) {
2747
- return N(`form-${e}-${t.name}`, Jr, {
2769
+ function Fa(e, t) {
2770
+ return P(`form-${e}-${t.name}`, Jr, {
2748
2771
  command: t.forCommand,
2749
2772
  label: t.name,
2750
2773
  generationMode: t.generationMode,
@@ -2752,36 +2775,36 @@ function ja(e, t) {
2752
2775
  fields: t.fields
2753
2776
  });
2754
2777
  }
2755
- function Ma(e, t) {
2778
+ function Ia(e, t) {
2756
2779
  let n = e.screens[0];
2757
- return Oe(e, n, {
2758
- profile: Hi(e.uiProfiles),
2759
- blueprintTemplates: t?.length ? [...P, ...t] : P
2780
+ return De(e, n, {
2781
+ profile: Ki(e.uiProfiles),
2782
+ blueprintTemplates: t?.length ? [...Oe, ...t] : Oe
2760
2783
  });
2761
2784
  }
2762
- function Na(e, t, n, r, i, a, o = !0) {
2763
- let s = va(e.navigation), c = Pa(e);
2785
+ function La(e, t, n, r, i, a, o = !0) {
2786
+ let s = Sa(e.navigation), c = Ra(e);
2764
2787
  return {
2765
- profile: Hi(e.uiProfiles),
2766
- catalog: Gi(r),
2767
- blueprintTemplates: a?.length ? [...P, ...a] : P,
2788
+ profile: Ki(e.uiProfiles),
2789
+ catalog: Yi(r),
2790
+ blueprintTemplates: a?.length ? [...Oe, ...a] : Oe,
2768
2791
  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)],
2792
+ chrome: (r, i) => i === j.FullPageShell ? { [M.ConfigPanel]: Qi(e.screens, r.name, t, n, c, s, o)[M.ConfigPanel] } : Qi(e.screens, r.name, t, n, c, s, o),
2793
+ form: Fa,
2794
+ trailing: [P("activity", ra)],
2772
2795
  decorate: (e) => {
2773
2796
  let t = mi(e);
2774
2797
  return i ? w(t, i) : t;
2775
2798
  }
2776
2799
  };
2777
2800
  }
2778
- function Pa(e) {
2801
+ function Ra(e) {
2779
2802
  let t = e.navigation?.application.logo;
2780
2803
  if (t) return {
2781
2804
  title: t.title,
2782
2805
  image: t.image || void 0
2783
2806
  };
2784
- let n = Hi(e.uiProfiles).identity;
2807
+ let n = Ki(e.uiProfiles).identity;
2785
2808
  if (!n?.name) return;
2786
2809
  let r = n.logo;
2787
2810
  return {
@@ -2791,22 +2814,22 @@ function Pa(e) {
2791
2814
  showName: n.showName
2792
2815
  };
2793
2816
  }
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;
2817
+ function za(e, t, n, r, i, a) {
2818
+ let [o] = Mr([t], Ba(e));
2819
+ return we(e, o, La(e, n, r, i, void 0, a)).element;
2797
2820
  }
2798
- function Ia(e) {
2821
+ function Ba(e) {
2799
2822
  return [...e.screenTemplates ?? [], ...e.dialogTemplates ?? []];
2800
2823
  }
2801
- function La() {
2824
+ function Va() {
2802
2825
  try {
2803
2826
  return globalThis.localStorage ?? null;
2804
2827
  } catch {
2805
2828
  return null;
2806
2829
  }
2807
2830
  }
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();
2831
+ function Ha({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: i, routing: o = "hash" } = {}) {
2832
+ let c = lt(), [u, d] = l(), [f, p] = l(""), m = s(() => Pa(e), [e, u]), h = ut(), g = fi();
2810
2833
  return a(() => {
2811
2834
  let e = new AbortController();
2812
2835
  return c.scene(e.signal).then((e) => d(r?.length ? {
@@ -2818,7 +2841,7 @@ function Ra({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2818
2841
  }, [c, r]), f ? /* @__PURE__ */ I("main", {
2819
2842
  className: "stage-message",
2820
2843
  children: [/* @__PURE__ */ F("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ F("p", { children: f })]
2821
- }) : u ? /* @__PURE__ */ F(za, {
2844
+ }) : u ? /* @__PURE__ */ F(Ua, {
2822
2845
  scene: u,
2823
2846
  registry: m,
2824
2847
  routing: o,
@@ -2832,20 +2855,20 @@ function Ra({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2832
2855
  children: /* @__PURE__ */ F("h1", { children: "Preparing the Stage" })
2833
2856
  });
2834
2857
  }
2835
- function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: c, isVisible: u }) {
2858
+ function Ua({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: c, isVisible: u }) {
2836
2859
  let d = s(() => {
2837
- if (dn(n), n === "hash") return A();
2860
+ if (dn(n), n === "hash") return k();
2838
2861
  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, [
2862
+ return e && globalThis.history.replaceState(null, "", `/${e[1]}`), fe(window, "/");
2863
+ }, [n]), [f, p] = l(ba), m = e.screens[0]?.name ?? "", h = s(() => Ki(e.uiProfiles), [e]), g = s(() => m ? Ia(e, c) : void 0, [
2841
2864
  e,
2842
2865
  c,
2843
2866
  m
2844
- ]), _ = s(() => g ? fa(h, g) : [], [h, g]), v = s(() => g ? da(h, g, f) : void 0, [
2867
+ ]), _ = s(() => g ? ga(h, g) : [], [h, g]), v = s(() => g ? ha(h, g, f) : void 0, [
2845
2868
  h,
2846
2869
  g,
2847
2870
  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), [
2871
+ ]), y = s(() => va(N, v?.accent), [v?.accent]), b = v?.showFooter ?? !0, x = s(() => La(e, a.locales, a.locale, o, a.dictionary, c, b), [
2849
2872
  e,
2850
2873
  a.locales,
2851
2874
  a.locale,
@@ -2853,18 +2876,18 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2853
2876
  o,
2854
2877
  c,
2855
2878
  b
2856
- ]), S = r((e) => p(e), []), C = s(() => xa(e, u, a.dictionary), [
2879
+ ]), S = r((e) => p(e), []), C = s(() => Ta(e, u, a.dictionary), [
2857
2880
  e,
2858
2881
  u,
2859
2882
  a.dictionary
2860
2883
  ]), w = s(() => ({
2861
2884
  ...e,
2862
- screens: Mr(Ea(e.screens, [
2885
+ screens: Mr(Aa(e.screens, [
2863
2886
  ...e.screenTemplates,
2864
2887
  ...e.dialogTemplates ?? [],
2865
- ...P,
2888
+ ...Oe,
2866
2889
  ...c ?? []
2867
- ]), Ia(e))
2890
+ ]), Ba(e))
2868
2891
  }), [e, c]);
2869
2892
  return m ? _.length > 0 ? /* @__PURE__ */ I("main", {
2870
2893
  className: "stage-message",
@@ -2875,15 +2898,15 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2875
2898
  /* @__PURE__ */ F("p", { children: "The ui profile's root template cannot be the application's shell." }),
2876
2899
  /* @__PURE__ */ F("ul", { children: _.map((e) => /* @__PURE__ */ F("li", { children: e }, e)) })
2877
2900
  ]
2878
- }) : /* @__PURE__ */ F(ye, {
2901
+ }) : /* @__PURE__ */ F(be, {
2879
2902
  application: w,
2880
2903
  composition: x,
2881
2904
  navigationModel: C,
2882
2905
  registry: t,
2883
2906
  initialScreen: m,
2884
2907
  history: d,
2885
- layoutConfigStorage: La(),
2886
- scope: (t, n) => /* @__PURE__ */ F(Ba, {
2908
+ layoutConfigStorage: Va(),
2909
+ scope: (t, n) => /* @__PURE__ */ F(Wa, {
2887
2910
  scene: e,
2888
2911
  routeState: i,
2889
2912
  strings: a,
@@ -2893,13 +2916,13 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2893
2916
  onSystemSchemeChange: S,
2894
2917
  children: n
2895
2918
  }),
2896
- renderScreen: (e, n) => /* @__PURE__ */ F(Ha, {
2919
+ renderScreen: (e, n) => /* @__PURE__ */ F(Ka, {
2897
2920
  element: e,
2898
2921
  configuration: n,
2899
2922
  registry: t
2900
2923
  }),
2901
2924
  renderDialog: () => /* @__PURE__ */ F(si, {}),
2902
- renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(Ua, {
2925
+ renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(qa, {
2903
2926
  template: e,
2904
2927
  content: n,
2905
2928
  registry: t,
@@ -2911,7 +2934,7 @@ function za({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2911
2934
  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
2935
  });
2913
2936
  }
2914
- function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
2937
+ function Wa({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
2915
2938
  let [u, f] = l(""), { navigate: p } = r;
2916
2939
  return a(() => f(""), [r.currentScreen, r.currentDialog]), a(() => {
2917
2940
  let e = (e) => {
@@ -2929,15 +2952,15 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2929
2952
  };
2930
2953
  return globalThis.addEventListener("cratis.scene.navigate", t), () => globalThis.removeEventListener("cratis.scene.navigate", t);
2931
2954
  }, [p, e]), /* @__PURE__ */ F(re, {
2932
- registry: ka,
2955
+ registry: Na,
2933
2956
  children: /* @__PURE__ */ I(Se, {
2934
2957
  themes: i,
2935
2958
  children: [
2936
- o && /* @__PURE__ */ F(_a, {
2959
+ o && /* @__PURE__ */ F(xa, {
2937
2960
  settings: o,
2938
2961
  onSystemSchemeChange: s
2939
2962
  }),
2940
- /* @__PURE__ */ F(sa, {}),
2963
+ /* @__PURE__ */ F(da, {}),
2941
2964
  /* @__PURE__ */ F(Wt, {
2942
2965
  routes: t.routes,
2943
2966
  routesReady: t.ready,
@@ -2945,7 +2968,7 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2945
2968
  locale: n.locale,
2946
2969
  locales: n.locales,
2947
2970
  screen: r.primaryScreen ?? e.screens[0]?.name ?? "",
2948
- children: /* @__PURE__ */ F(Va, {
2971
+ children: /* @__PURE__ */ F(Ga, {
2949
2972
  activity: u,
2950
2973
  routesReady: t.ready,
2951
2974
  scene: e,
@@ -2958,12 +2981,12 @@ function Ba({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2958
2981
  })
2959
2982
  });
2960
2983
  }
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), [
2984
+ function Ga({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: a }) {
2985
+ let o = z(), c = _e(), l = cn(), u = s(() => ka(l, t, o.refreshAfterCommand), [
2963
2986
  l,
2964
2987
  t,
2965
2988
  o.refreshAfterCommand
2966
- ]), f = s(() => Ca(n.commandSchemas), [n.commandSchemas]), p = ue({
2989
+ ]), f = s(() => Da(n.commandSchemas), [n.commandSchemas]), p = de({
2967
2990
  executeCommand: async (e, n) => {
2968
2991
  let i = U(e);
2969
2992
  if (!i && !t) return r(`The modeled command “${e}” is waiting for Stage routes.`), {
@@ -2999,16 +3022,16 @@ function Va({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
2999
3022
  refreshQuery: async (e) => o.refreshQuery(e),
3000
3023
  raise: async (e) => r(`The modeled trigger “${e}” is not available in this Stage runtime.`)
3001
3024
  });
3002
- return /* @__PURE__ */ F(Qi, {
3025
+ return /* @__PURE__ */ F(na, {
3003
3026
  state: {
3004
3027
  locales: i.locales,
3005
3028
  locale: i.locale,
3006
3029
  setLocale: i.setLocale,
3007
3030
  activity: e
3008
3031
  },
3009
- children: /* @__PURE__ */ F(se, {
3032
+ children: /* @__PURE__ */ F(ce, {
3010
3033
  invoker: u,
3011
- children: /* @__PURE__ */ F(ae, {
3034
+ children: /* @__PURE__ */ F(oe, {
3012
3035
  fieldsFor: f,
3013
3036
  children: /* @__PURE__ */ F(ie, {
3014
3037
  dispatcher: p,
@@ -3024,11 +3047,11 @@ function Va({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3024
3047
  })
3025
3048
  });
3026
3049
  }
3027
- function Ha({ element: e, configuration: t, registry: n }) {
3050
+ function Ka({ element: e, configuration: t, registry: n }) {
3028
3051
  let r = z(), i = nn();
3029
3052
  return /* @__PURE__ */ I(Pn, {
3030
3053
  element: e,
3031
- children: [/* @__PURE__ */ F(Si, { element: e }), /* @__PURE__ */ F(D, {
3054
+ children: [/* @__PURE__ */ F(Si, { element: e }), /* @__PURE__ */ F(ae, {
3032
3055
  element: e,
3033
3056
  registry: n,
3034
3057
  resolveBinding: r.resolveBinding,
@@ -3038,7 +3061,7 @@ function Ha({ element: e, configuration: t, registry: n }) {
3038
3061
  })]
3039
3062
  });
3040
3063
  }
3041
- function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3064
+ function qa({ template: e, content: t, registry: n, strings: r, close: i }) {
3042
3065
  let o = z(), s = nn(), c = w(t, r.dictionary);
3043
3066
  return a(() => {
3044
3067
  let e = (e) => {
@@ -3058,7 +3081,7 @@ function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3058
3081
  children: "Close"
3059
3082
  }), /* @__PURE__ */ F(Pn, {
3060
3083
  element: c,
3061
- children: /* @__PURE__ */ F(D, {
3084
+ children: /* @__PURE__ */ F(ae, {
3062
3085
  element: c,
3063
3086
  registry: n,
3064
3087
  resolveBinding: o.resolveBinding,
@@ -3069,4 +3092,4 @@ function Ua({ template: e, content: t, registry: n, strings: r, close: i }) {
3069
3092
  })
3070
3093
  });
3071
3094
  }
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 };
3095
+ export { Ha as App, Ha as StageApplication, zn as StageCommandForm, Wt as StageDataProvider, Or as StageGuardedAction, ct as StageSourceProvider, za as composeStageScreen, ka as createStageSliceInvoker, Gt as dataChanged, on as executeRegisteredCommand, ht as hostedBasePath, Wi as listsPrimeReact, St as performQuery, vt as registerQueryRouteResolver, Gi as registerStageLibrary, U as registeredCommand, yt as registeredQuery, Da as sliceFieldsFrom, Pa as stageApplicationRegistry, La as stageComposition, e as stageDarkSelector, ot as stageEndpoints, Ia 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.206.0",
4
4
  "description": "The Cratis Stage application runtime for Arc and Scene",
5
5
  "author": "Cratis",
6
6
  "type": "module",