@cratis/stage.runtime 4.206.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.
Files changed (2) hide show
  1. package/dist/src/index.js +149 -146
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -2196,7 +2196,7 @@ function Di(e) {
2196
2196
  for (let r of e.flatMap((e) => e.contributions ?? [])) {
2197
2197
  let e = ki(r);
2198
2198
  if (!e) continue;
2199
- let i = Ai(e);
2199
+ let i = ji(e);
2200
2200
  t.has(i) || (t.add(i), n.push(e));
2201
2201
  }
2202
2202
  return n.map((e, t) => ({
@@ -2210,8 +2210,8 @@ function Oi(e) {
2210
2210
  children: []
2211
2211
  };
2212
2212
  for (let n of e) {
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));
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));
2215
2215
  }
2216
2216
  return t.children;
2217
2217
  }
@@ -2219,29 +2219,32 @@ function ki(e) {
2219
2219
  if (e.contributionPointName !== "Navigation") return;
2220
2220
  let t = e.content?.properties ?? {}, n = t.label, r = t.targetScreen;
2221
2221
  if (typeof n != "string" || typeof r != "string") return;
2222
- 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;
2223
2223
  return {
2224
2224
  label: n,
2225
2225
  targetScreen: r,
2226
2226
  hierarchy: i,
2227
2227
  order: a,
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
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
2234
2234
  })
2235
2235
  };
2236
2236
  }
2237
2237
  function Ai(e) {
2238
+ return Array.isArray(e.hierarchy) ? e.hierarchy.filter((e) => typeof e == "string") : [];
2239
+ }
2240
+ function ji(e) {
2238
2241
  return e.id === void 0 ? JSON.stringify([
2239
2242
  e.hierarchy,
2240
2243
  e.targetScreen,
2241
2244
  e.label
2242
2245
  ]) : JSON.stringify(["id", e.id]);
2243
2246
  }
2244
- function ji(e, t, n) {
2247
+ function Mi(e, t, n) {
2245
2248
  let r = e.children.find((e) => e.screen === void 0 && e.section === !0 === n && e.label === t);
2246
2249
  if (r) return r;
2247
2250
  let i = n ? {
@@ -2254,12 +2257,12 @@ function ji(e, t, n) {
2254
2257
  };
2255
2258
  return e.children.push(i), i;
2256
2259
  }
2257
- function Mi(e) {
2260
+ function Ni(e) {
2258
2261
  return {
2259
2262
  label: e.label,
2260
- ...Pi({ id: e.id || void 0 }),
2263
+ ...Fi({ id: e.id || void 0 }),
2261
2264
  screen: e.targetScreen,
2262
- ...Pi({
2265
+ ...Fi({
2263
2266
  icon: e.icon || void 0,
2264
2267
  presentation: e.presentation || void 0,
2265
2268
  destination: e.destination
@@ -2267,27 +2270,27 @@ function Mi(e) {
2267
2270
  children: []
2268
2271
  };
2269
2272
  }
2270
- function Ni(e) {
2273
+ function Pi(e) {
2271
2274
  return typeof e == "string" ? e : void 0;
2272
2275
  }
2273
- function Pi(e) {
2276
+ function Fi(e) {
2274
2277
  return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
2275
2278
  }
2276
- function Fi(e, t) {
2279
+ function Ii(e, t) {
2277
2280
  for (let n of e) {
2278
2281
  if (n.screen === t) return [n.label];
2279
- let e = Fi(n.children, t);
2282
+ let e = Ii(n.children, t);
2280
2283
  if (e.length > 0) return n.section ? e : [n.label, ...e];
2281
2284
  }
2282
2285
  return [];
2283
2286
  }
2284
- function Ii(e) {
2287
+ function Li(e) {
2285
2288
  return typeof e == "object" && !!e && !Array.isArray(e);
2286
2289
  }
2287
- function Li(e) {
2290
+ function Ri(e) {
2288
2291
  return e.outlet !== void 0 || e.dialog !== void 0 || e.kind === "external" || e.kind === "dialog";
2289
2292
  }
2290
- function Ri(e, t, n) {
2293
+ function zi(e, t, n) {
2291
2294
  return e.filter((e) => !t.has(e.name)).map((e) => ({
2292
2295
  label: e.name,
2293
2296
  targetScreen: e.name,
@@ -2295,30 +2298,30 @@ function Ri(e, t, n) {
2295
2298
  }));
2296
2299
  }
2297
2300
  // src/blueprint.ts
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);
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);
2301
2304
  }
2302
- function Gi(e, t) {
2303
- Ui.set(e, t);
2305
+ function Ki(e, t) {
2306
+ Wi.set(e, t);
2304
2307
  }
2305
- function Ki(e) {
2308
+ function qi(e) {
2306
2309
  let t = Ne(e);
2307
2310
  return {
2308
2311
  ...t,
2309
2312
  name: e?.length ? t.name : "Stage",
2310
2313
  packages: x(t.packages, {
2311
- baseline: Vi,
2314
+ baseline: Hi,
2312
2315
  catalog: { [Ee]: g.Blueprint }
2313
2316
  })
2314
2317
  };
2315
2318
  }
2316
- var qi = {
2319
+ var Ji = {
2317
2320
  ...Ce,
2318
- [Vi]: rt.components
2321
+ [Hi]: rt.components
2319
2322
  };
2320
- function Ji(e) {
2321
- let t = [...Ui.values()].reduce((e, t) => ({
2323
+ function Yi(e) {
2324
+ let t = [...Wi.values()].reduce((e, t) => ({
2322
2325
  ...e,
2323
2326
  ...t.components
2324
2327
  }), {});
@@ -2331,16 +2334,16 @@ function Ji(e) {
2331
2334
  ...e
2332
2335
  };
2333
2336
  }
2334
- function Yi(e) {
2335
- let t = Object.fromEntries([...Ui].map(([e, t]) => [e, t.declared]));
2337
+ function Xi(e) {
2338
+ let t = Object.fromEntries([...Wi].map(([e, t]) => [e, t.declared]));
2336
2339
  return {
2337
2340
  ...e,
2338
- ...qi,
2341
+ ...Ji,
2339
2342
  ...t
2340
2343
  };
2341
2344
  }
2342
- var Xi = "Stage:navigationTree";
2343
- function Zi(e, t, n) {
2345
+ var Zi = "Stage:navigationTree";
2346
+ function Qi(e, t, n) {
2344
2347
  let r = t?.title ?? "Cratis Stage";
2345
2348
  return P(e, j.Logo, {
2346
2349
  label: r,
@@ -2351,31 +2354,31 @@ function Zi(e, t, n) {
2351
2354
  ...t?.showName === void 0 ? {} : { showName: t.showName }
2352
2355
  });
2353
2356
  }
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({
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({
2356
2359
  label: e.name,
2357
2360
  targetScreen: e.name,
2358
2361
  icon: "pi pi-table",
2359
2362
  group: "Screens",
2360
2363
  order: n
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, {
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, {
2362
2365
  nodes: d,
2363
2366
  activeScreen: t
2364
2367
  }) : P("menu-screens", j.Menu, {
2365
2368
  title: "Screens",
2366
2369
  label: "Screens"
2367
2370
  }, { items: f }), _ = [];
2368
- n.length > 1 && _.push(P("topbar-locale", zi, {
2371
+ n.length > 1 && _.push(P("topbar-locale", Bi, {
2369
2372
  locales: n,
2370
2373
  locale: r
2371
- })), _.push(P("topbar-theme", Bi, {}));
2374
+ })), _.push(P("topbar-theme", Vi, {}));
2372
2375
  let v = { regionNavigation: a };
2373
2376
  return {
2374
2377
  [M.Topbar]: [P("topbar", j.Topbar, v, {
2375
- logo: [Zi("topbar-logo", i, s)],
2378
+ logo: [Qi("topbar-logo", i, s)],
2376
2379
  end: _
2377
2380
  })],
2378
- [M.Sidebar]: [P("sidebar", j.Sidebar, v, { logo: [Zi("sidebar-logo", i, s)] })],
2381
+ [M.Sidebar]: [P("sidebar", j.Sidebar, v, { logo: [Qi("sidebar-logo", i, s)] })],
2379
2382
  ...a ? {} : { [M.Menu]: [g] },
2380
2383
  [M.Breadcrumb]: [P("breadcrumb", j.Breadcrumb, {
2381
2384
  homeTargetScreen: s,
@@ -2392,11 +2395,11 @@ function Qi(e, t, n, r, i, a = !1, o = !0) {
2392
2395
  })]
2393
2396
  };
2394
2397
  }
2395
- function $i(e) {
2398
+ function ea(e) {
2396
2399
  return `#/${encodeURIComponent(e)}`;
2397
2400
  }
2398
2401
  // src/externalRouteHref.ts
2399
- function ea(e) {
2402
+ function ta(e) {
2400
2403
  try {
2401
2404
  let t = new URL(e ?? "");
2402
2405
  return t.protocol === "http:" || t.protocol === "https:" ? e : void 0;
@@ -2405,21 +2408,21 @@ function ea(e) {
2405
2408
  }
2406
2409
  }
2407
2410
  // src/StageChrome.tsx
2408
- var ta = t({
2411
+ var na = t({
2409
2412
  locales: [],
2410
2413
  locale: "",
2411
2414
  setLocale: () => void 0,
2412
2415
  activity: ""
2413
2416
  });
2414
- function na({ state: e, children: t }) {
2415
- return /* @__PURE__ */ F(ta.Provider, {
2417
+ function ra({ state: e, children: t }) {
2418
+ return /* @__PURE__ */ F(na.Provider, {
2416
2419
  value: e,
2417
2420
  children: t
2418
2421
  });
2419
2422
  }
2420
- var ra = "Stage:activity";
2421
- function ia() {
2422
- let { locales: e, locale: t, setLocale: n } = i(ta);
2423
+ var ia = "Stage:activity";
2424
+ function aa() {
2425
+ let { locales: e, locale: t, setLocale: n } = i(na);
2423
2426
  return e.length < 2 ? null : /* @__PURE__ */ F("select", {
2424
2427
  className: "stage-locale",
2425
2428
  "aria-label": "Locale",
@@ -2431,7 +2434,7 @@ function ia() {
2431
2434
  }, e))
2432
2435
  });
2433
2436
  }
2434
- function aa({ element: e }) {
2437
+ function oa({ element: e }) {
2435
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);
2436
2439
  if (!a) return null;
2437
2440
  let o = i ? "Switch to a light theme" : "Switch to a dark theme";
@@ -2465,19 +2468,19 @@ function aa({ element: e }) {
2465
2468
  })
2466
2469
  });
2467
2470
  }
2468
- function oa({ element: e }) {
2471
+ function sa({ element: e }) {
2469
2472
  let t = e.properties ?? {};
2470
2473
  return /* @__PURE__ */ F("nav", {
2471
2474
  className: "stage-navigation-tree",
2472
2475
  "aria-label": "Navigation",
2473
2476
  "data-scene-id": e.id,
2474
- children: /* @__PURE__ */ F(sa, {
2477
+ children: /* @__PURE__ */ F(ca, {
2475
2478
  nodes: t.nodes ?? [],
2476
2479
  activeScreen: t.activeScreen
2477
2480
  })
2478
2481
  });
2479
2482
  }
2480
- function sa({ nodes: e, activeScreen: t }) {
2483
+ function ca({ nodes: e, activeScreen: t }) {
2481
2484
  return /* @__PURE__ */ F("ul", {
2482
2485
  role: "tree",
2483
2486
  children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ I("li", {
@@ -2486,13 +2489,13 @@ function sa({ nodes: e, activeScreen: t }) {
2486
2489
  children: [/* @__PURE__ */ F("span", {
2487
2490
  className: "stage-navigation-group",
2488
2491
  children: e.label
2489
- }), /* @__PURE__ */ F(sa, {
2492
+ }), /* @__PURE__ */ F(ca, {
2490
2493
  nodes: e.children,
2491
2494
  activeScreen: t
2492
2495
  })]
2493
2496
  }, e.label) : /* @__PURE__ */ F("li", {
2494
2497
  role: "treeitem",
2495
- children: /* @__PURE__ */ F(ca, {
2498
+ children: /* @__PURE__ */ F(la, {
2496
2499
  node: e,
2497
2500
  screen: e.screen,
2498
2501
  activeScreen: t
@@ -2500,10 +2503,10 @@ function sa({ nodes: e, activeScreen: t }) {
2500
2503
  }, `${e.screen}:${e.label}`))
2501
2504
  });
2502
2505
  }
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) => {
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) => {
2505
2508
  e.preventDefault(), r.navigate(o);
2506
- } : void 0, l = s ? ea(o.route) : $i(t), u = s && l === void 0;
2509
+ } : void 0, l = s ? ta(o.route) : ea(t), u = s && l === void 0;
2507
2510
  return /* @__PURE__ */ I("a", {
2508
2511
  href: l,
2509
2512
  rel: s && !u ? "noreferrer" : void 0,
@@ -2520,7 +2523,7 @@ function ca({ node: e, screen: t, activeScreen: n }) {
2520
2523
  }), a !== "icon" && e.label]
2521
2524
  });
2522
2525
  }
2523
- function la({ element: e }) {
2526
+ function ua({ element: e }) {
2524
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;
2525
2528
  return /* @__PURE__ */ I("div", {
2526
2529
  "data-scene-outlet": t,
@@ -2544,15 +2547,15 @@ function la({ element: e }) {
2544
2547
  })]
2545
2548
  });
2546
2549
  }
2547
- function ua() {
2548
- let { activity: e } = i(ta);
2550
+ function da() {
2551
+ let { activity: e } = i(na);
2549
2552
  return e ? /* @__PURE__ */ F("p", {
2550
2553
  className: "stage-activity",
2551
2554
  role: "status",
2552
2555
  children: e
2553
2556
  }) : null;
2554
2557
  }
2555
- function da() {
2558
+ function fa() {
2556
2559
  let e = ye(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
2557
2560
  return a(() => {
2558
2561
  let r = e?.isDark ? "dark" : "light";
@@ -2563,24 +2566,24 @@ function da() {
2563
2566
  n
2564
2567
  ]), null;
2565
2568
  }
2566
- var fa = {
2567
- [zi]: ia,
2569
+ var pa = {
2568
2570
  [Bi]: aa,
2569
- [Xi]: oa,
2570
- [ra]: ua,
2571
- "core:outlet": la
2572
- }, pa = [
2571
+ [Vi]: oa,
2572
+ [Zi]: sa,
2573
+ [ia]: da,
2574
+ "core:outlet": ua
2575
+ }, ma = [
2573
2576
  "navigationMode",
2574
2577
  "menuTheme",
2575
2578
  "showFooter"
2576
- ], ma = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2577
- function ha(e, t, n = !1) {
2579
+ ], ha = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
2580
+ function ga(e, t, n = !1) {
2578
2581
  let r = [], i = t.options ?? {}, a = {
2579
2582
  showFooter: !0,
2580
2583
  followsSystem: !1,
2581
2584
  problems: r
2582
2585
  };
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(", ")}.`);
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(", ")}.`);
2584
2587
  else if (e === "navigationMode") {
2585
2588
  let e = ke.find((e) => e === n);
2586
2589
  e ? a.mode = e : r.push(`Option 'navigationMode' is '${String(n)}'; expected one of ${ke.join(", ")}.`);
@@ -2594,9 +2597,9 @@ function ha(e, t, n = !1) {
2594
2597
  let e = a.followsSystem ? n : o.colorScheme === u.Dark;
2595
2598
  a.colorScheme = e ? A.Dark : A.Light, a.themeName = N.find((t) => (t.isDark ?? !1) === e)?.name;
2596
2599
  }
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;
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;
2598
2601
  }
2599
- function ga(e, t) {
2602
+ function _a(e, t) {
2600
2603
  if (e?.root === void 0) return [];
2601
2604
  let n = /* @__PURE__ */ new Set([
2602
2605
  v.RootTemplateUnknown,
@@ -2608,7 +2611,7 @@ function ga(e, t) {
2608
2611
  ]), r = t.diagnostics.filter((e) => n.has(e.code)).map((e) => e.message);
2609
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;
2610
2613
  }
2611
- function _a(e) {
2614
+ function va(e) {
2612
2615
  let t = e.length === 4 ? [...e.slice(1)].map((e) => e + e).join("") : e.slice(1), [n, r, i] = [
2613
2616
  0,
2614
2617
  2,
@@ -2616,7 +2619,7 @@ function _a(e) {
2616
2619
  ].map((e) => parseInt(t.slice(e, e + 2), 16));
2617
2620
  return (n * 299 + r * 587 + i * 114) / 1e3 >= 150 ? "#111827" : "#ffffff";
2618
2621
  }
2619
- function va(e, t) {
2622
+ function ya(e, t) {
2620
2623
  if (t === void 0) return e;
2621
2624
  let n = t.length === 4 ? [...t.slice(1)].map((e) => e + e).join("") : t.slice(1), [r, i, a] = [
2622
2625
  0,
@@ -2628,17 +2631,17 @@ function va(e, t) {
2628
2631
  tokens: {
2629
2632
  ...e.tokens,
2630
2633
  "primary.color": t,
2631
- "primary.contrastColor": _a(t),
2634
+ "primary.contrastColor": va(t),
2632
2635
  "focus.ring": `0 0 0 2px rgb(${r} ${i} ${a} / 0.4)`
2633
2636
  }
2634
2637
  }));
2635
2638
  }
2636
2639
  // src/StageShellSettings.tsx
2637
- var ya = "(prefers-color-scheme: dark)";
2638
- function ba() {
2640
+ var ba = "(prefers-color-scheme: dark)";
2641
+ function xa() {
2639
2642
  return globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
2640
2643
  }
2641
- function xa({ settings: e, onSystemSchemeChange: t }) {
2644
+ function Sa({ settings: e, onSystemSchemeChange: t }) {
2642
2645
  let n = c(Pe());
2643
2646
  n.current = Pe();
2644
2647
  let { mode: r, menuTheme: i, colorScheme: o, themeName: s } = e;
@@ -2654,15 +2657,15 @@ function xa({ settings: e, onSystemSchemeChange: t }) {
2654
2657
  s
2655
2658
  ]), a(() => {
2656
2659
  if (!e.followsSystem || !globalThis.matchMedia || !t) return;
2657
- let n = globalThis.matchMedia(ya), r = (e) => t(e.matches);
2660
+ let n = globalThis.matchMedia(ba), r = (e) => t(e.matches);
2658
2661
  return n.addEventListener("change", r), () => n.removeEventListener("change", r);
2659
2662
  }, [e.followsSystem, t]), null;
2660
2663
  }
2661
2664
  // src/stageNavigationModel.ts
2662
- function Sa(e) {
2665
+ function Ca(e) {
2663
2666
  return (e?.application.regions.length ?? 0) > 0 || (e?.modules.length ?? 0) > 0;
2664
2667
  }
2665
- function Ca(e) {
2668
+ function wa(e) {
2666
2669
  let t = /* @__PURE__ */ new Map();
2667
2670
  for (let n of e) {
2668
2671
  let e = (n.path ?? []).join(".");
@@ -2675,38 +2678,38 @@ function Ca(e) {
2675
2678
  return t.get(r) ?? i ?? (e.some((e) => e.name === r) ? r : void 0);
2676
2679
  };
2677
2680
  }
2678
- function wa(e) {
2681
+ function Ta(e) {
2679
2682
  return (t) => e.find((e) => e.name === t)?.path?.[0];
2680
2683
  }
2681
- function Ta(e, t, n) {
2684
+ function Ea(e, t, n) {
2682
2685
  let r = e.navigation ?? {
2683
2686
  application: { regions: [] },
2684
2687
  modules: []
2685
2688
  };
2686
2689
  return {
2687
2690
  structure: e.structure ?? { modules: [] },
2688
- navigation: n ? Ea(r, n) : r,
2689
- screenFor: Ca(e.screens),
2690
- moduleOf: wa(e.screens),
2691
+ navigation: n ? Da(r, n) : r,
2692
+ screenFor: wa(e.screens),
2693
+ moduleOf: Ta(e.screens),
2691
2694
  ...t ? { isVisible: t } : {}
2692
2695
  };
2693
2696
  }
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;
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;
2696
2699
  }
2697
2700
  // src/stageSlices.ts
2698
- function Da(e) {
2701
+ function Oa(e) {
2699
2702
  return (t) => G(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0 && !e.members && !e.item).map((e) => ({
2700
2703
  name: e.name,
2701
2704
  type: e.type === "text" || e.type === void 0 ? "string" : e.type,
2702
- label: Oa(e.name),
2705
+ label: ka(e.name),
2703
2706
  required: e.required
2704
2707
  }));
2705
2708
  }
2706
- function Oa(e) {
2709
+ function ka(e) {
2707
2710
  return e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
2708
2711
  }
2709
- function ka(e, t, n) {
2712
+ function Aa(e, t, n) {
2710
2713
  return { invoke: async (r, i, a) => {
2711
2714
  let o = a ?? r.slice(r.lastIndexOf(".") + 1);
2712
2715
  if (!U(o)) return {
@@ -2726,7 +2729,7 @@ function ka(e, t, n) {
2726
2729
  } };
2727
2730
  }
2728
2731
  // src/withoutSeededSlots.ts
2729
- function Aa(e, t) {
2732
+ function ja(e, t) {
2730
2733
  let n = /* @__PURE__ */ new Map();
2731
2734
  for (let e of t) n.has(e.name) || n.set(e.name, e.slots.map((e) => e.name));
2732
2735
  return e.map((e) => {
@@ -2743,7 +2746,7 @@ function Aa(e, t) {
2743
2746
  });
2744
2747
  }
2745
2748
  // src/stageIcons.ts
2746
- var ja = /* @__PURE__ */ new Map([
2749
+ var Ma = /* @__PURE__ */ new Map([
2747
2750
  ["chart", "chart-column"],
2748
2751
  ["add", "plus"],
2749
2752
  ["dollar", "dollar-sign"],
@@ -2751,22 +2754,22 @@ var ja = /* @__PURE__ */ new Map([
2751
2754
  ["refresh", "refresh-cw"],
2752
2755
  ["invoice", "receipt-text"],
2753
2756
  ["batch", "layers"]
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([{
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([{
2755
2758
  library: _,
2756
2759
  loadGlyph: async ({ key: e }) => {
2757
- let t = Ma(e), n = ja.get(t) ?? t;
2760
+ let t = Na(e), n = Ma.get(t) ?? t;
2758
2761
  if (Object.hasOwn(it, n)) return (await it[n]())?.default;
2759
2762
  }
2760
2763
  }]);
2761
2764
  // src/App.tsx
2762
- function Pa(e = {}) {
2763
- return Ji({
2765
+ function Fa(e = {}) {
2766
+ return Yi({
2764
2767
  ...e,
2765
2768
  ...di,
2766
- ...fa
2769
+ ...pa
2767
2770
  });
2768
2771
  }
2769
- function Fa(e, t) {
2772
+ function Ia(e, t) {
2770
2773
  return P(`form-${e}-${t.name}`, Jr, {
2771
2774
  command: t.forCommand,
2772
2775
  label: t.name,
@@ -2775,36 +2778,36 @@ function Fa(e, t) {
2775
2778
  fields: t.fields
2776
2779
  });
2777
2780
  }
2778
- function Ia(e, t) {
2781
+ function La(e, t) {
2779
2782
  let n = e.screens[0];
2780
2783
  return De(e, n, {
2781
- profile: Ki(e.uiProfiles),
2784
+ profile: qi(e.uiProfiles),
2782
2785
  blueprintTemplates: t?.length ? [...Oe, ...t] : Oe
2783
2786
  });
2784
2787
  }
2785
- function La(e, t, n, r, i, a, o = !0) {
2786
- let s = Sa(e.navigation), c = Ra(e);
2788
+ function Ra(e, t, n, r, i, a, o = !0) {
2789
+ let s = Ca(e.navigation), c = za(e);
2787
2790
  return {
2788
- profile: Ki(e.uiProfiles),
2789
- catalog: Yi(r),
2791
+ profile: qi(e.uiProfiles),
2792
+ catalog: Xi(r),
2790
2793
  blueprintTemplates: a?.length ? [...Oe, ...a] : Oe,
2791
2794
  namedTemplateOnly: !0,
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)],
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)],
2795
2798
  decorate: (e) => {
2796
2799
  let t = mi(e);
2797
2800
  return i ? w(t, i) : t;
2798
2801
  }
2799
2802
  };
2800
2803
  }
2801
- function Ra(e) {
2804
+ function za(e) {
2802
2805
  let t = e.navigation?.application.logo;
2803
2806
  if (t) return {
2804
2807
  title: t.title,
2805
2808
  image: t.image || void 0
2806
2809
  };
2807
- let n = Ki(e.uiProfiles).identity;
2810
+ let n = qi(e.uiProfiles).identity;
2808
2811
  if (!n?.name) return;
2809
2812
  let r = n.logo;
2810
2813
  return {
@@ -2814,22 +2817,22 @@ function Ra(e) {
2814
2817
  showName: n.showName
2815
2818
  };
2816
2819
  }
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;
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;
2820
2823
  }
2821
- function Ba(e) {
2824
+ function Va(e) {
2822
2825
  return [...e.screenTemplates ?? [], ...e.dialogTemplates ?? []];
2823
2826
  }
2824
- function Va() {
2827
+ function Ha() {
2825
2828
  try {
2826
2829
  return globalThis.localStorage ?? null;
2827
2830
  } catch {
2828
2831
  return null;
2829
2832
  }
2830
2833
  }
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();
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();
2833
2836
  return a(() => {
2834
2837
  let e = new AbortController();
2835
2838
  return c.scene(e.signal).then((e) => d(r?.length ? {
@@ -2841,7 +2844,7 @@ function Ha({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2841
2844
  }, [c, r]), f ? /* @__PURE__ */ I("main", {
2842
2845
  className: "stage-message",
2843
2846
  children: [/* @__PURE__ */ F("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ F("p", { children: f })]
2844
- }) : u ? /* @__PURE__ */ F(Ua, {
2847
+ }) : u ? /* @__PURE__ */ F(Wa, {
2845
2848
  scene: u,
2846
2849
  registry: m,
2847
2850
  routing: o,
@@ -2855,20 +2858,20 @@ function Ha({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
2855
2858
  children: /* @__PURE__ */ F("h1", { children: "Preparing the Stage" })
2856
2859
  });
2857
2860
  }
2858
- function Ua({ 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 }) {
2859
2862
  let d = s(() => {
2860
2863
  if (dn(n), n === "hash") return k();
2861
2864
  let e = /^#\/(.+)$/.exec(globalThis.location.hash);
2862
2865
  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, [
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, [
2864
2867
  e,
2865
2868
  c,
2866
2869
  m
2867
- ]), _ = s(() => g ? ga(h, g) : [], [h, g]), v = s(() => g ? ha(h, g, f) : void 0, [
2870
+ ]), _ = s(() => g ? _a(h, g) : [], [h, g]), v = s(() => g ? ga(h, g, f) : void 0, [
2868
2871
  h,
2869
2872
  g,
2870
2873
  f
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), [
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), [
2872
2875
  e,
2873
2876
  a.locales,
2874
2877
  a.locale,
@@ -2876,18 +2879,18 @@ function Ua({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2876
2879
  o,
2877
2880
  c,
2878
2881
  b
2879
- ]), S = r((e) => p(e), []), C = s(() => Ta(e, u, a.dictionary), [
2882
+ ]), S = r((e) => p(e), []), C = s(() => Ea(e, u, a.dictionary), [
2880
2883
  e,
2881
2884
  u,
2882
2885
  a.dictionary
2883
2886
  ]), w = s(() => ({
2884
2887
  ...e,
2885
- screens: Mr(Aa(e.screens, [
2888
+ screens: Mr(ja(e.screens, [
2886
2889
  ...e.screenTemplates,
2887
2890
  ...e.dialogTemplates ?? [],
2888
2891
  ...Oe,
2889
2892
  ...c ?? []
2890
- ]), Ba(e))
2893
+ ]), Va(e))
2891
2894
  }), [e, c]);
2892
2895
  return m ? _.length > 0 ? /* @__PURE__ */ I("main", {
2893
2896
  className: "stage-message",
@@ -2905,8 +2908,8 @@ function Ua({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2905
2908
  registry: t,
2906
2909
  initialScreen: m,
2907
2910
  history: d,
2908
- layoutConfigStorage: Va(),
2909
- scope: (t, n) => /* @__PURE__ */ F(Wa, {
2911
+ layoutConfigStorage: Ha(),
2912
+ scope: (t, n) => /* @__PURE__ */ F(Ga, {
2910
2913
  scene: e,
2911
2914
  routeState: i,
2912
2915
  strings: a,
@@ -2916,13 +2919,13 @@ function Ua({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2916
2919
  onSystemSchemeChange: S,
2917
2920
  children: n
2918
2921
  }),
2919
- renderScreen: (e, n) => /* @__PURE__ */ F(Ka, {
2922
+ renderScreen: (e, n) => /* @__PURE__ */ F(qa, {
2920
2923
  element: e,
2921
2924
  configuration: n,
2922
2925
  registry: t
2923
2926
  }),
2924
2927
  renderDialog: () => /* @__PURE__ */ F(si, {}),
2925
- renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(qa, {
2928
+ renderDialogTemplate: (e, n, r) => /* @__PURE__ */ F(Ja, {
2926
2929
  template: e,
2927
2930
  content: n,
2928
2931
  registry: t,
@@ -2934,7 +2937,7 @@ function Ua({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
2934
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." })]
2935
2938
  });
2936
2939
  }
2937
- function Wa({ 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 }) {
2938
2941
  let [u, f] = l(""), { navigate: p } = r;
2939
2942
  return a(() => f(""), [r.currentScreen, r.currentDialog]), a(() => {
2940
2943
  let e = (e) => {
@@ -2952,15 +2955,15 @@ function Wa({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2952
2955
  };
2953
2956
  return globalThis.addEventListener("cratis.scene.navigate", t), () => globalThis.removeEventListener("cratis.scene.navigate", t);
2954
2957
  }, [p, e]), /* @__PURE__ */ F(re, {
2955
- registry: Na,
2958
+ registry: Pa,
2956
2959
  children: /* @__PURE__ */ I(Se, {
2957
2960
  themes: i,
2958
2961
  children: [
2959
- o && /* @__PURE__ */ F(xa, {
2962
+ o && /* @__PURE__ */ F(Sa, {
2960
2963
  settings: o,
2961
2964
  onSystemSchemeChange: s
2962
2965
  }),
2963
- /* @__PURE__ */ F(da, {}),
2966
+ /* @__PURE__ */ F(fa, {}),
2964
2967
  /* @__PURE__ */ F(Wt, {
2965
2968
  routes: t.routes,
2966
2969
  routesReady: t.ready,
@@ -2968,7 +2971,7 @@ function Wa({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2968
2971
  locale: n.locale,
2969
2972
  locales: n.locales,
2970
2973
  screen: r.primaryScreen ?? e.screens[0]?.name ?? "",
2971
- children: /* @__PURE__ */ F(Ga, {
2974
+ children: /* @__PURE__ */ F(Ka, {
2972
2975
  activity: u,
2973
2976
  routesReady: t.ready,
2974
2977
  scene: e,
@@ -2981,12 +2984,12 @@ function Wa({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
2981
2984
  })
2982
2985
  });
2983
2986
  }
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), [
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), [
2986
2989
  l,
2987
2990
  t,
2988
2991
  o.refreshAfterCommand
2989
- ]), f = s(() => Da(n.commandSchemas), [n.commandSchemas]), p = de({
2992
+ ]), f = s(() => Oa(n.commandSchemas), [n.commandSchemas]), p = de({
2990
2993
  executeCommand: async (e, n) => {
2991
2994
  let i = U(e);
2992
2995
  if (!i && !t) return r(`The modeled command “${e}” is waiting for Stage routes.`), {
@@ -3022,7 +3025,7 @@ function Ga({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3022
3025
  refreshQuery: async (e) => o.refreshQuery(e),
3023
3026
  raise: async (e) => r(`The modeled trigger “${e}” is not available in this Stage runtime.`)
3024
3027
  });
3025
- return /* @__PURE__ */ F(na, {
3028
+ return /* @__PURE__ */ F(ra, {
3026
3029
  state: {
3027
3030
  locales: i.locales,
3028
3031
  locale: i.locale,
@@ -3047,7 +3050,7 @@ function Ga({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3047
3050
  })
3048
3051
  });
3049
3052
  }
3050
- function Ka({ element: e, configuration: t, registry: n }) {
3053
+ function qa({ element: e, configuration: t, registry: n }) {
3051
3054
  let r = z(), i = nn();
3052
3055
  return /* @__PURE__ */ I(Pn, {
3053
3056
  element: e,
@@ -3061,7 +3064,7 @@ function Ka({ element: e, configuration: t, registry: n }) {
3061
3064
  })]
3062
3065
  });
3063
3066
  }
3064
- function qa({ template: e, content: t, registry: n, strings: r, close: i }) {
3067
+ function Ja({ template: e, content: t, registry: n, strings: r, close: i }) {
3065
3068
  let o = z(), s = nn(), c = w(t, r.dictionary);
3066
3069
  return a(() => {
3067
3070
  let e = (e) => {
@@ -3092,4 +3095,4 @@ function qa({ template: e, content: t, registry: n, strings: r, close: i }) {
3092
3095
  })
3093
3096
  });
3094
3097
  }
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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/stage.runtime",
3
- "version": "4.206.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",