@almadar/ui 6.54.0 → 6.55.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 (113) hide show
  1. package/dist/{AwaitingSkeletonContext-Bh399p1x.d.ts → AwaitingSkeletonContext-DPgW__WV.d.ts} +3 -1
  2. package/dist/{Canvas3DHost-B-y2TNij.d.ts → Canvas3DHost-DfAhg6EH.d.ts} +2 -0
  3. package/dist/Typography-7PDT62PG.js +5 -0
  4. package/dist/{UISlotRenderer-QUEG6WFM.js → UISlotRenderer-QTHFT6Z4.js} +6 -6
  5. package/dist/avl/index.cjs +3385 -1883
  6. package/dist/avl/index.js +45 -737
  7. package/dist/{chunk-ERXIHZW3.js → chunk-D2E44ODB.js} +29 -15
  8. package/dist/{chunk-FJDS4SVD.js → chunk-F4ZTPKZL.js} +3 -3
  9. package/dist/{chunk-U3CGKPOK.js → chunk-FQM37C56.js} +136 -107
  10. package/dist/{chunk-4UP6BZ4R.js → chunk-HCSJHRC4.js} +1 -1
  11. package/dist/{chunk-N2V4LHFQ.js → chunk-HRCR53OW.js} +10 -1
  12. package/dist/{chunk-O7OLVVBR.js → chunk-Q47ZN2DW.js} +24 -22
  13. package/dist/{chunk-4HC5HRHB.js → chunk-QGH4NAQO.js} +2 -2
  14. package/dist/{chunk-MCKFWPT2.js → chunk-RNY5LJXJ.js} +1 -1
  15. package/dist/{chunk-Z7JWXIRE.js → chunk-SGJHVPHC.js} +2 -2
  16. package/dist/{chunk-6O37FCX4.js → chunk-V3FGTQUE.js} +37 -2
  17. package/dist/{chunk-U2FGMHQP.js → chunk-XZKGRSIO.js} +3334 -1796
  18. package/dist/{chunk-Z5IYJU44.js → chunk-Y53Q55H5.js} +521 -24
  19. package/dist/components/index.cjs +5194 -3008
  20. package/dist/components/index.d.ts +117 -52
  21. package/dist/components/index.js +12 -12
  22. package/dist/context/index.cjs +36 -1
  23. package/dist/context/index.d.ts +1 -1
  24. package/dist/context/index.js +1 -1
  25. package/dist/design-classes/index.cjs +29 -15
  26. package/dist/design-classes/index.d.cts +1 -0
  27. package/dist/design-classes/index.d.ts +1 -0
  28. package/dist/design-classes/index.js +29 -15
  29. package/dist/hooks/index.cjs +10 -1
  30. package/dist/hooks/index.js +3 -3
  31. package/dist/lib/drawable/three/index.cjs +442 -82
  32. package/dist/lib/drawable/three/index.d.ts +2 -2
  33. package/dist/lib/drawable/three/index.js +28 -24
  34. package/dist/lib/index.cjs +52 -3
  35. package/dist/lib/index.d.ts +1 -1
  36. package/dist/lib/index.js +4 -4
  37. package/dist/locales/index.cjs +30 -3
  38. package/dist/locales/index.js +21 -3
  39. package/dist/providers/index.cjs +5330 -3091
  40. package/dist/providers/index.d.ts +1 -1
  41. package/dist/providers/index.js +12 -9
  42. package/dist/runtime/index.cjs +5400 -3182
  43. package/dist/runtime/index.d.ts +7 -3
  44. package/dist/runtime/index.js +8 -8
  45. package/dist/ssr/index.cjs +24 -8
  46. package/dist/ssr/index.js +24 -8
  47. package/dist/{themeTokens-Ccu7EmGY.d.ts → themeTokens-D6MFwKrC.d.ts} +6 -2
  48. package/locales/ar.json +10 -1
  49. package/locales/en.json +10 -1
  50. package/locales/sl.json +10 -1
  51. package/package.json +6 -6
  52. package/scripts/theme-contrast-audit.mjs +20 -1
  53. package/themes/_base.css +61 -0
  54. package/themes/_contract.md +37 -0
  55. package/themes/almadar-heritage.css +82 -0
  56. package/themes/almadar-website.css +82 -0
  57. package/themes/almadar.css +82 -0
  58. package/themes/aqua.css +82 -0
  59. package/themes/arabesque.css +82 -0
  60. package/themes/art-deco.css +82 -0
  61. package/themes/art-nouveau.css +82 -0
  62. package/themes/atelier.css +82 -0
  63. package/themes/bauhaus.css +82 -0
  64. package/themes/bloomberg-dense.css +83 -1
  65. package/themes/blueprint.css +84 -0
  66. package/themes/clay.css +82 -0
  67. package/themes/comic.css +82 -0
  68. package/themes/constructivist.css +82 -0
  69. package/themes/corporate.css +82 -0
  70. package/themes/cyberpunk.css +82 -0
  71. package/themes/frutiger-aero.css +83 -0
  72. package/themes/game-adventure.css +15 -0
  73. package/themes/game-rpg.css +16 -0
  74. package/themes/game-sci-fi.css +15 -0
  75. package/themes/game-ui-pack.css +15 -0
  76. package/themes/gazette.css +82 -0
  77. package/themes/glass.css +82 -0
  78. package/themes/gothic.css +82 -0
  79. package/themes/ink-wash.css +82 -0
  80. package/themes/kawaii.css +82 -0
  81. package/themes/kiosk.css +82 -0
  82. package/themes/linear-clean.css +82 -0
  83. package/themes/luxury.css +82 -0
  84. package/themes/mac-classic.css +90 -8
  85. package/themes/material.css +82 -0
  86. package/themes/memphis.css +82 -0
  87. package/themes/mid-century.css +82 -0
  88. package/themes/minimalist.css +82 -0
  89. package/themes/mudcloth.css +82 -0
  90. package/themes/neon.css +83 -0
  91. package/themes/neumorphic.css +82 -0
  92. package/themes/newsprint.css +82 -0
  93. package/themes/notion-editorial.css +82 -0
  94. package/themes/orb.css +82 -0
  95. package/themes/pixel.css +82 -0
  96. package/themes/prism.css +82 -0
  97. package/themes/retro.css +83 -0
  98. package/themes/risograph.css +82 -0
  99. package/themes/scandi.css +82 -0
  100. package/themes/sketch.css +82 -0
  101. package/themes/solarpunk.css +82 -0
  102. package/themes/steampunk.css +82 -0
  103. package/themes/swiss.css +82 -0
  104. package/themes/terminal.css +84 -1
  105. package/themes/trait-wars.css +82 -0
  106. package/themes/ukiyo-e.css +82 -0
  107. package/themes/vaporwave.css +82 -0
  108. package/themes/victorian.css +82 -0
  109. package/themes/wabi-sabi.css +82 -0
  110. package/themes/win95.css +84 -0
  111. package/themes/wireframe.css +82 -0
  112. package/themes/zine.css +82 -0
  113. package/dist/Typography-CFI7JUVE.js +0 -5
@@ -313,23 +313,37 @@ function tokenOfDesignClass(className) {
313
313
  function isArbitraryClass(className) {
314
314
  return /^[a-z0-9:@/-]*-\[[^\]\s]+\]$/i.test(className);
315
315
  }
316
- function arbitraryClassesOf(schema) {
317
- const found = /* @__PURE__ */ new Set();
318
- const visit = (value) => {
319
- if (Array.isArray(value)) {
320
- value.forEach(visit);
321
- return;
316
+ function collectClasses(value, found) {
317
+ if (Array.isArray(value)) {
318
+ for (const item of value) collectClasses(item, found);
319
+ return;
320
+ }
321
+ if (value === null || typeof value !== "object") return;
322
+ for (const [key, child] of Object.entries(value)) {
323
+ if (key === "className" && typeof child === "string") {
324
+ for (const cls of child.split(/\s+/)) if (cls && isArbitraryClass(cls)) found.add(cls);
325
+ } else {
326
+ collectClasses(child, found);
322
327
  }
323
- if (value === null || typeof value !== "object") return;
324
- for (const [key, child] of Object.entries(value)) {
325
- if (key === "className" && typeof child === "string") {
326
- for (const cls of child.split(/\s+/)) if (cls && isArbitraryClass(cls)) found.add(cls);
327
- } else {
328
- visit(child);
329
- }
328
+ }
329
+ }
330
+ function classesOfPart(part) {
331
+ const found = /* @__PURE__ */ new Set();
332
+ collectClasses(JSON.parse(JSON.stringify(part)), found);
333
+ return [...found];
334
+ }
335
+ var classesByOrbital = /* @__PURE__ */ new WeakMap();
336
+ function arbitraryClassesOf(schema) {
337
+ const { orbitals, _metadata: _provenance, ledger: _identities, ...rest } = schema;
338
+ const found = new Set(classesOfPart(rest));
339
+ for (const orbital of orbitals ?? []) {
340
+ let classes = classesByOrbital.get(orbital);
341
+ if (!classes) {
342
+ classes = classesOfPart(orbital);
343
+ classesByOrbital.set(orbital, classes);
330
344
  }
331
- };
332
- visit(JSON.parse(JSON.stringify(schema)));
345
+ for (const cls of classes) found.add(cls);
346
+ }
333
347
  return [...found].sort();
334
348
  }
335
349
 
@@ -1,6 +1,6 @@
1
- import { Icon, Button, Switch, Input } from './chunk-U2FGMHQP.js';
2
- import { VStack, HStack } from './chunk-Z5IYJU44.js';
3
- import { Typography } from './chunk-4UP6BZ4R.js';
1
+ import { Icon, Button, Switch, Input } from './chunk-XZKGRSIO.js';
2
+ import { VStack, HStack } from './chunk-Y53Q55H5.js';
3
+ import { Typography } from './chunk-HCSJHRC4.js';
4
4
  import { cn } from './chunk-64WACXM7.js';
5
5
  import React from 'react';
6
6
  import { useTranslate } from '@almadar/ui/hooks';
@@ -1,18 +1,18 @@
1
- import { useTranslate, useRenderI18n, runTickFrame } from './chunk-4HC5HRHB.js';
1
+ import { useTranslate, useRenderI18n, runTickFrame } from './chunk-QGH4NAQO.js';
2
2
  import { ALL_SLOTS } from './chunk-VHTJRS2N.js';
3
- import { LoadingState, ErrorState, UISlotRenderer } from './chunk-U2FGMHQP.js';
4
- import { Box } from './chunk-Z5IYJU44.js';
5
- import { Typography } from './chunk-4UP6BZ4R.js';
3
+ import { LoadingState, ErrorState, UISlotRenderer } from './chunk-XZKGRSIO.js';
4
+ import { Box } from './chunk-Y53Q55H5.js';
5
+ import { Typography } from './chunk-HCSJHRC4.js';
6
6
  import { beginPending, endPending } from './chunk-JRW33U35.js';
7
7
  import { useEventBus } from './chunk-6EV3OEBQ.js';
8
8
  import { registerTrait, unregisterTrait, perfTimeAsync } from './chunk-KQXXO42S.js';
9
- import { bindTraitStateGetter, registerTraitSnapshot, recordTransition, recordingTransport, recordServerResponse } from './chunk-O7OLVVBR.js';
9
+ import { bindTraitStateGetter, registerTraitSnapshot, recordTransition, recordingTransport, recordServerResponse } from './chunk-Q47ZN2DW.js';
10
10
  import { isNotificationSlot } from './chunk-PEST66PN.js';
11
11
  import React, { useState, useMemo, useEffect, useRef, useCallback, useSyncExternalStore } from 'react';
12
12
  import { schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, traitsEmbeddedByEvent, traitReferencesCallsitePayload, configReferencesCallsitePayload, TRAIT_MOUNT_ERROR_TESTID, traitsEmbeddedByEffects, applyListenPayloadMapping, buildResolvedTraitConfigs, collectCallsiteCaptureChildren, orbitalInlineEntities, storesRowsInBrowser, walkSExpr, isRenderBindingMarker, containsEntityBinding, isSExpr, isEventPayloadValue, RENDER_BINDING_MARKER } from '@almadar/core';
13
13
  import { createLogger } from '@almadar/logger';
14
14
  import { collectListenerTargets, LIFECYCLE_EVENTS, TraitMountError, InMemoryPersistence, loadLazyPage, createInProcessTransport, buildTraitIndex, createMemoryCircuitStore, createLocalStoreTransport, createResidenceTransport, createClientKernel, createTickScheduler, isValidCronExpression, parseDurationString, UNMOUNT_EVENT, createClientEffectHandlers, EffectExecutor, isSExpression, collectDeclaredConfigDefaults, createContextFromBindings, openBrowserStore, browserStoreName, normalizeCallSiteConfigToValues } from '@almadar/runtime';
15
- import { useUser, useArbitraryClassStyles, getAllPages, matchPathAmong, CurrentPagePathProvider, NavStackProvider, OrbitalProvider, useNavStack, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, ServerBridgeProvider, useServerBridge, EntityBindingContext, AwaitingSkeletonContext } from '@almadar/ui/providers';
15
+ import { useUser, useHasServerBridge, useArbitraryClassStyles, getAllPages, matchPathAmong, CurrentPagePathProvider, NavStackProvider, OrbitalProvider, ServerBridgeProvider, useNavStack, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge, EntityBindingContext, AwaitingSkeletonContext } from '@almadar/ui/providers';
16
16
  import { evaluateListenPayloadExpr, evaluate, createMinimalContext, evaluateGuard, executeEffects } from '@almadar/evaluator';
17
17
  import { getPatternDefinition } from '@almadar/core/patterns';
18
18
  import { isKnownStdOperator } from '@almadar/std/registry';
@@ -186,10 +186,12 @@ function restrictTraitIndex(full, activeNames) {
186
186
  return { byName, allEntities: full.allEntities, orbitals: full.orbitals };
187
187
  }
188
188
  function useCircuitKernel(traitBindings, options) {
189
+ const hostRunsProgram = options.transport?.hostsBrowserStore === true;
189
190
  const fullTraitIndex = useMemo(
190
- () => buildTraitIndex(options.orbitals, options.traitConfigsByName),
191
- [options.orbitals, options.traitConfigsByName]
191
+ () => buildTraitIndex(options.orbitals, options.traitConfigsByName, { hostRunsProgram }),
192
+ [options.orbitals, options.traitConfigsByName, hostRunsProgram]
192
193
  );
194
+ const appTraitNames = useMemo(() => new Set(fullTraitIndex.byName.keys()), [fullTraitIndex]);
193
195
  const activeTraitKey = traitBindings.map((b) => b.trait.name).filter((n) => !!n).sort().join("\0");
194
196
  const traitIndex = useMemo(
195
197
  () => restrictTraitIndex(fullTraitIndex, new Set(activeTraitKey === "" ? [] : activeTraitKey.split("\0"))),
@@ -332,18 +334,19 @@ function useCircuitKernel(traitBindings, options) {
332
334
  store: rawKernel.store,
333
335
  dispatch: (request, hooks) => rawKernel.dispatch(stamp(request), hooks),
334
336
  dispatchMount: (seeds, hooks, base = {}) => rawKernel.dispatchMount(seeds, hooks, stamp(base)),
335
- dispatchProgress: (request) => rawKernel.dispatchProgress(stamp(request))
337
+ dispatchProgress: (request) => rawKernel.dispatchProgress(stamp(request)),
338
+ foldHostDispatch: (request, response) => rawKernel.foldHostDispatch(request, response)
336
339
  };
337
340
  }, [rawKernel, locale]);
338
- return { kernel, store, traitIndex, transport: effectiveTransport };
341
+ return { kernel, store, traitIndex, appTraitNames, transport: effectiveTransport };
339
342
  }
340
343
  var log2 = createLogger("almadar:ui:circuit:bus-ingress");
341
- function useBusIngress(traitBindings, traitIndex, settle, eventBus) {
344
+ function useBusIngress(traitBindings, traitIndex, settle, eventBus, appTraitNames) {
342
345
  useEffect(() => {
343
346
  const unsubscribes = [];
344
347
  const subscribedQualified = /* @__PURE__ */ new Set();
345
348
  const subscribedBare = /* @__PURE__ */ new Set();
346
- const deliveredHere = (source) => source?.dispatched === true && source.trait !== void 0 && traitIndex.byName.has(source.trait);
349
+ const deliveredHere = (source) => source?.dispatched === true && source.trait !== void 0 && (traitIndex.byName.has(source.trait) || appTraitNames.has(source.trait));
347
350
  const claims = /* @__PURE__ */ new WeakMap();
348
351
  const claim = (source, traitName, eventKey) => {
349
352
  if (source === void 0) return true;
@@ -440,7 +443,7 @@ function useBusIngress(traitBindings, traitIndex, settle, eventBus) {
440
443
  return () => {
441
444
  for (const unsub of unsubscribes) unsub();
442
445
  };
443
- }, [traitBindings, traitIndex, settle, eventBus]);
446
+ }, [traitBindings, traitIndex, settle, eventBus, appTraitNames]);
444
447
  }
445
448
  var lambdaLog = createLogger("almadar:ui:fn-form-lambda");
446
449
  function patternPropsSchema(patternType) {
@@ -515,7 +518,7 @@ function resolveLambdaBindings(body, params, item, index) {
515
518
  return body;
516
519
  }
517
520
  var LazySlotContentRenderer = React.lazy(
518
- () => import('./UISlotRenderer-QUEG6WFM.js').then((m) => ({ default: m.SlotContentRenderer }))
521
+ () => import('./UISlotRenderer-QTHFT6Z4.js').then((m) => ({ default: m.SlotContentRenderer }))
519
522
  );
520
523
  function deferLambdaEntityExprs(value) {
521
524
  if (typeof value === "string") {
@@ -1167,7 +1170,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1167
1170
  const { t } = useTranslate();
1168
1171
  const userContext = options.user ?? contextViewer ?? void 0;
1169
1172
  const observer = useMemo(() => createCircuitVerificationObserver(), []);
1170
- const { kernel, store, traitIndex, transport } = useCircuitKernel(traitBindings, {
1173
+ const { kernel, store, traitIndex, appTraitNames, transport } = useCircuitKernel(traitBindings, {
1171
1174
  orbitals: options.orbitals,
1172
1175
  ...options.traitConfigsByName !== void 0 ? { traitConfigsByName: options.traitConfigsByName } : {},
1173
1176
  ...options.transport !== void 0 ? { transport: options.transport } : {},
@@ -1331,6 +1334,15 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1331
1334
  }
1332
1335
  }, { clientId: getTabClientId() });
1333
1336
  }, [transport, traitIndex, progressAndSettle, dispatchAndSettle]);
1337
+ useEffect(() => {
1338
+ if (!transport?.subscribeHostDispatches) return;
1339
+ return transport.subscribeHostDispatches((_orbitalName, request, response) => {
1340
+ const traitName = request.targetTrait;
1341
+ if (traitName === void 0 || !traitIndex.byName.has(traitName)) return;
1342
+ const composedBefore = new Map(store.callsitePayloads);
1343
+ void kernel.foldHostDispatch(request, response).then((outcome) => settleOutcome(traitName, request.event, request.payload, outcome, composedBefore));
1344
+ });
1345
+ }, [transport, traitIndex, kernel, store, settleOutcome]);
1334
1346
  const mountAndSettle = useCallback(async (seeds, payload) => {
1335
1347
  const composedBefore = new Map(store.callsitePayloads);
1336
1348
  let beforeLocalPaint;
@@ -1364,7 +1376,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
1364
1376
  await afterSettle(seed.trait, seed.event, payload, seed.local.transitioned, [...seed.local.clientEffectsByTrait ?? [], ...serverRepaints], composedBefore);
1365
1377
  }
1366
1378
  }, [kernel, slotFlush, traitIndex, store, eventBus, options.navigate, options.navigateBack, afterSettle]);
1367
- useBusIngress(traitBindings, traitIndex, dispatchAndSettle, eventBus);
1379
+ useBusIngress(traitBindings, traitIndex, dispatchAndSettle, eventBus, appTraitNames);
1368
1380
  const sendEvent = useCallback((eventKey, payload) => {
1369
1381
  const normalized = normalizeEventKey(eventKey);
1370
1382
  for (const [traitName] of traitIndex.byName) {
@@ -1547,6 +1559,7 @@ function TraitInitializer({ traits, routeParams, mountKey, orbitals, onNavigate,
1547
1559
  return /* @__PURE__ */ jsx(EntityBindingContext.Provider, { value: entityBindingSource, children: /* @__PURE__ */ jsx(AwaitingSkeletonContext.Provider, { value: awaitingSkeletonSource, children }) });
1548
1560
  }
1549
1561
  var CONTENT_STAGE_WIDTH = 480;
1562
+ var NO_ORBITALS = [];
1550
1563
  function FitToBox({ children, mode = "box" }) {
1551
1564
  const outerRef = useRef(null);
1552
1565
  const innerRef = useRef(null);
@@ -1729,7 +1742,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
1729
1742
  }, [schema, pageName]);
1730
1743
  const activeOrbitalTheme = useMemo(() => resolvePreviewTheme(schema, pageName), [schema, pageName]);
1731
1744
  const { locale } = useTranslate$1();
1732
- const browserStore = useBrowserStore(schema.name ?? "app", schema.orbitals, locale);
1745
+ const browserStore = useBrowserStore(schema.name ?? "app", transport?.hostsBrowserStore === true ? NO_ORBITALS : schema.orbitals, locale);
1733
1746
  const inner = /* @__PURE__ */ jsx(VerificationProvider, { enabled: true, children: /* @__PURE__ */ jsx(
1734
1747
  EntitySchemaProvider,
1735
1748
  {
@@ -1762,9 +1775,6 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
1762
1775
  if (browserStore.status === "failed") {
1763
1776
  return /* @__PURE__ */ jsx(ErrorState, { "data-testid": "browser-store-error", message: browserStore.error.message });
1764
1777
  }
1765
- if (serverUrl || transport) {
1766
- return /* @__PURE__ */ jsx(ServerBridgeProvider, { schema, serverUrl, transport, getAccessToken, children: inner });
1767
- }
1768
1778
  return inner;
1769
1779
  }
1770
1780
  function resolvePreviewTheme(schema, pageName) {
@@ -1811,6 +1821,7 @@ function OrbPreview({
1811
1821
  if (localFallback) return;
1812
1822
  setLocalFallback(true);
1813
1823
  }, [localFallback]);
1824
+ const hasOuterBridge = useHasServerBridge();
1814
1825
  const parseResult = useMemo(() => {
1815
1826
  let parsed;
1816
1827
  if (typeof schema === "string") {
@@ -2011,91 +2022,96 @@ function OrbPreview({
2011
2022
  navLog.info("interceptor:installed", { pageCount: pages.length, paths: pages.map((p) => p.page.path) });
2012
2023
  return () => el.removeEventListener("click", handler, true);
2013
2024
  }, [pages, handleNavigate, isolated, hostHrefBase]);
2025
+ const withBridge = (node) => (serverUrl || transport) && !hasOuterBridge ? /* @__PURE__ */ jsx(ServerBridgeProvider, { schema: parseResult.schema, serverUrl, transport, getAccessToken, children: node }) : node;
2014
2026
  if (lazyRoute) {
2015
- return /* @__PURE__ */ jsxs(Box, { ref: containerRef, className: `overflow-auto ${className ?? ""}`, style: { height }, children: [
2016
- lazyLoad.status === "loading" && /* @__PURE__ */ jsx(LoadingState, {}),
2017
- lazyLoad.status === "error" && /* @__PURE__ */ jsx(ErrorState, { "data-testid": "lazy-page-error", message: lazyLoad.error }),
2018
- lazyLoad.status === "ready" && /* @__PURE__ */ jsx(
2019
- OrbPreview,
2020
- {
2021
- schema: lazyLoad.schema,
2022
- autoMock,
2023
- height: "100%",
2024
- className: "border-0",
2025
- serverUrl,
2026
- transport,
2027
- getAccessToken,
2028
- initialPagePath: lazyRoute.path,
2029
- user,
2030
- isolated,
2031
- fit,
2032
- onPageChange: announcePage,
2033
- themeOverride,
2034
- lazyLoader,
2035
- onUnmatchedNavigate: handleNavigate
2036
- },
2037
- lazyRoute.page.orbRef
2038
- )
2039
- ] });
2040
- }
2041
- return /* @__PURE__ */ jsxs(
2042
- Box,
2043
- {
2044
- ref: containerRef,
2045
- className: `${fit ? "overflow-hidden" : "overflow-auto"} border border-[var(--color-border)] rounded-[var(--radius-md)] ${className ?? ""}`,
2046
- style: { height },
2047
- children: [
2048
- localFallback && /* @__PURE__ */ jsx(Box, { className: "px-3 py-2 bg-[var(--color-warning)] bg-opacity-10 border-b border-[var(--color-warning)] flex items-center gap-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-[var(--color-warning-foreground)] flex-1", children: t("orbPreview.serverUnreachable") }) }),
2049
- inHostRouter ? /* @__PURE__ */ jsx(HostHrefBaseProbe, { onBase: setHostHrefBase }) : null,
2050
- /* @__PURE__ */ jsx(CurrentPagePathProvider, { value: currentPagePath, children: /* @__PURE__ */ jsxs(
2051
- NavStackProvider,
2027
+ return withBridge(
2028
+ /* @__PURE__ */ jsxs(Box, { ref: containerRef, className: `overflow-auto ${className ?? ""}`, style: { height }, children: [
2029
+ lazyLoad.status === "loading" && /* @__PURE__ */ jsx(LoadingState, {}),
2030
+ lazyLoad.status === "error" && /* @__PURE__ */ jsx(ErrorState, { "data-testid": "lazy-page-error", message: lazyLoad.error }),
2031
+ lazyLoad.status === "ready" && /* @__PURE__ */ jsx(
2032
+ OrbPreview,
2052
2033
  {
2053
- pages: navPages,
2054
- currentPath: concreteCurrentPath,
2055
- navigate: handleNavigate,
2056
- storageKey: `almadar:navstack:${parseResult.schema.name ?? "preview"}`,
2057
- children: [
2058
- /* @__PURE__ */ jsx(NavStackRefBridge, { apiRef: navStackRef }),
2059
- /* @__PURE__ */ jsx(OrbitalProvider, { initialData: effectiveMockData, skipTheme: true, verification: true, isolated, user, children: /* @__PURE__ */ jsx(UISlotProvider, { children: fit ? /* @__PURE__ */ jsx(FitToBox, { mode: fit === "content" ? "content" : "box", children: /* @__PURE__ */ jsx(
2060
- SchemaRunner,
2061
- {
2062
- schema: parseResult.schema,
2063
- serverUrl,
2064
- transport,
2065
- getAccessToken,
2066
- mockData: effectiveMockData,
2067
- pageName: currentPage,
2068
- routeParams,
2069
- onNavigate: handleNavigateEffect,
2070
- onNavigateBack: handleNavigateBack,
2071
- onLocalFallback: handleLocalFallback,
2072
- localFallbackTimeoutMs,
2073
- persistence,
2074
- themeOverride
2075
- }
2076
- ) }) : /* @__PURE__ */ jsx(
2077
- SchemaRunner,
2078
- {
2079
- schema: parseResult.schema,
2080
- serverUrl,
2081
- transport,
2082
- getAccessToken,
2083
- mockData: effectiveMockData,
2084
- pageName: currentPage,
2085
- routeParams,
2086
- onNavigate: handleNavigateEffect,
2087
- onNavigateBack: handleNavigateBack,
2088
- onLocalFallback: handleLocalFallback,
2089
- localFallbackTimeoutMs,
2090
- persistence,
2091
- themeOverride
2092
- }
2093
- ) }) })
2094
- ]
2095
- }
2096
- ) })
2097
- ]
2098
- }
2034
+ schema: lazyLoad.schema,
2035
+ autoMock,
2036
+ height: "100%",
2037
+ className: "border-0",
2038
+ serverUrl,
2039
+ transport,
2040
+ getAccessToken,
2041
+ initialPagePath: lazyRoute.path,
2042
+ user,
2043
+ isolated,
2044
+ fit,
2045
+ onPageChange: announcePage,
2046
+ themeOverride,
2047
+ lazyLoader,
2048
+ onUnmatchedNavigate: handleNavigate
2049
+ },
2050
+ lazyRoute.page.orbRef
2051
+ )
2052
+ ] })
2053
+ );
2054
+ }
2055
+ return withBridge(
2056
+ /* @__PURE__ */ jsxs(
2057
+ Box,
2058
+ {
2059
+ ref: containerRef,
2060
+ className: `${fit ? "overflow-hidden" : "overflow-auto"} border border-[var(--color-border)] rounded-[var(--radius-md)] ${className ?? ""}`,
2061
+ style: { height },
2062
+ children: [
2063
+ localFallback && /* @__PURE__ */ jsx(Box, { className: "px-3 py-2 bg-[var(--color-warning)] bg-opacity-10 border-b border-[var(--color-warning)] flex items-center gap-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-[var(--color-warning-foreground)] flex-1", children: t("orbPreview.serverUnreachable") }) }),
2064
+ inHostRouter ? /* @__PURE__ */ jsx(HostHrefBaseProbe, { onBase: setHostHrefBase }) : null,
2065
+ /* @__PURE__ */ jsx(CurrentPagePathProvider, { value: currentPagePath, children: /* @__PURE__ */ jsxs(
2066
+ NavStackProvider,
2067
+ {
2068
+ pages: navPages,
2069
+ currentPath: concreteCurrentPath,
2070
+ navigate: handleNavigate,
2071
+ storageKey: `almadar:navstack:${parseResult.schema.name ?? "preview"}`,
2072
+ children: [
2073
+ /* @__PURE__ */ jsx(NavStackRefBridge, { apiRef: navStackRef }),
2074
+ /* @__PURE__ */ jsx(OrbitalProvider, { initialData: effectiveMockData, skipTheme: true, verification: true, isolated, user, children: /* @__PURE__ */ jsx(UISlotProvider, { children: fit ? /* @__PURE__ */ jsx(FitToBox, { mode: fit === "content" ? "content" : "box", children: /* @__PURE__ */ jsx(
2075
+ SchemaRunner,
2076
+ {
2077
+ schema: parseResult.schema,
2078
+ serverUrl,
2079
+ transport,
2080
+ getAccessToken,
2081
+ mockData: effectiveMockData,
2082
+ pageName: currentPage,
2083
+ routeParams,
2084
+ onNavigate: handleNavigateEffect,
2085
+ onNavigateBack: handleNavigateBack,
2086
+ onLocalFallback: handleLocalFallback,
2087
+ localFallbackTimeoutMs,
2088
+ persistence,
2089
+ themeOverride
2090
+ }
2091
+ ) }) : /* @__PURE__ */ jsx(
2092
+ SchemaRunner,
2093
+ {
2094
+ schema: parseResult.schema,
2095
+ serverUrl,
2096
+ transport,
2097
+ getAccessToken,
2098
+ mockData: effectiveMockData,
2099
+ pageName: currentPage,
2100
+ routeParams,
2101
+ onNavigate: handleNavigateEffect,
2102
+ onNavigateBack: handleNavigateBack,
2103
+ onLocalFallback: handleLocalFallback,
2104
+ localFallbackTimeoutMs,
2105
+ persistence,
2106
+ themeOverride
2107
+ }
2108
+ ) }) })
2109
+ ]
2110
+ }
2111
+ ) })
2112
+ ]
2113
+ }
2114
+ )
2099
2115
  );
2100
2116
  }
2101
2117
  OrbPreview.displayName = "OrbPreview";
@@ -2111,7 +2127,9 @@ function BrowserPlayground({
2111
2127
  onPageChange,
2112
2128
  viewer,
2113
2129
  messages,
2114
- locale
2130
+ locale,
2131
+ lazyLoader,
2132
+ schemaPath
2115
2133
  }) {
2116
2134
  const [runtime] = useState(
2117
2135
  () => new OrbitalServerRuntime({ mode, debug: false, ...viewer !== void 0 ? { defaultUser: viewer } : {} })
@@ -2127,10 +2145,18 @@ function BrowserPlayground({
2127
2145
  const registrationReady = useMemo(() => {
2128
2146
  const orbitalNames = schema.orbitals.map((o) => o.name);
2129
2147
  playgroundLog.debug("register:start", { schema: schema.name, orbitalNames });
2130
- return runtime.register(schema, messages !== void 0 ? { messages } : {}).then(() => {
2148
+ const lazyPages = schema.lazyPages ?? [];
2149
+ const lazy = lazyPages.length > 0 && lazyLoader !== void 0 ? Promise.all(lazyPages.map(async (page) => {
2150
+ const loaded = await loadLazyPage(lazyLoader, page, schemaPath);
2151
+ if (!loaded.success) throw new Error(loaded.error);
2152
+ return loaded.data;
2153
+ })) : Promise.resolve([]);
2154
+ return lazy.then(
2155
+ (lazySchemas) => runtime.register(schema, { ...messages !== void 0 ? { messages } : {}, lazy: lazySchemas })
2156
+ ).then(() => {
2131
2157
  playgroundLog.debug("register:done", { schema: schema.name, orbitalNames });
2132
2158
  });
2133
- }, [runtime, schema, messages]);
2159
+ }, [runtime, schema, messages, lazyLoader, schemaPath]);
2134
2160
  const teardownTimerRef = useRef(null);
2135
2161
  useEffect(() => {
2136
2162
  if (teardownTimerRef.current !== null) {
@@ -2152,7 +2178,8 @@ function BrowserPlayground({
2152
2178
  return runtime.processOrbitalEvent(orbitalName, request);
2153
2179
  },
2154
2180
  {
2155
- onRegister: (s) => runtime.register(s),
2181
+ // The program (lazy behaviors included) is registered above; the bridge only waits for it.
2182
+ onRegister: () => registrationReady,
2156
2183
  onUnregister: () => {
2157
2184
  runtime.unregisterAll();
2158
2185
  }
@@ -2177,6 +2204,8 @@ function BrowserPlayground({
2177
2204
  fit,
2178
2205
  onPageChange,
2179
2206
  user: viewer ?? null,
2207
+ lazyLoader,
2208
+ schemaPath,
2180
2209
  isolated: true
2181
2210
  }
2182
2211
  );
@@ -1,5 +1,5 @@
1
1
  import { cn, domPassthrough } from './chunk-64WACXM7.js';
2
- import { formatValue } from './chunk-MCKFWPT2.js';
2
+ import { formatValue } from './chunk-RNY5LJXJ.js';
3
3
  import React from 'react';
4
4
  import { useFormatContext } from '@almadar/ui/hooks';
5
5
 
@@ -188,6 +188,7 @@ var en_default = {
188
188
  "template.ourTeam": "Our Team",
189
189
  "template.caseStudies": "Case Studies",
190
190
  "versionDiff.compare": "Compare",
191
+ "versionDiff.changes": "Changes",
191
192
  "versionDiff.to": "to",
192
193
  "versionDiff.beforeRevision": "Before revision",
193
194
  "versionDiff.afterRevision": "After revision",
@@ -914,6 +915,7 @@ var en_default = {
914
915
  "gridPicker.moreRefine": "+{{count}} more \u2014 refine your search",
915
916
  "graphCanvas.noNodes": "No nodes to display.",
916
917
  "codeBlock.noCode": "No code to display.",
918
+ "codeBlock.region": "Code",
917
919
  "fab.action": "Action",
918
920
  "fab.closeActions": "Close actions",
919
921
  "fab.openActions": "Open actions",
@@ -1230,7 +1232,14 @@ var en_default = {
1230
1232
  "agentActivity.earlierConversations": "Earlier conversations ({{count}})",
1231
1233
  "agentActivity.earlierActivity": "Earlier activity",
1232
1234
  "tabs.scrollStart": "Scroll tabs back",
1233
- "tabs.scrollEnd": "Scroll tabs forward"
1235
+ "tabs.scrollEnd": "Scroll tabs forward",
1236
+ "agentChat.workedThrough": "Worked through {{count}} steps",
1237
+ "agentChat.newMessages": "New messages",
1238
+ "agentChat.copy": "Copy reply",
1239
+ "agentChat.copied": "Copied",
1240
+ "agentChat.today": "Today",
1241
+ "agentChat.yesterday": "Yesterday",
1242
+ "agentChat.emptyDescription": "Ask in your own words \u2014 the assistant can look things up and make changes for you."
1234
1243
  };
1235
1244
 
1236
1245
  export { en_default };
@@ -1,5 +1,25 @@
1
1
  import { createLogger } from '@almadar/logger';
2
2
 
3
+ // lib/keyMapEvent.ts
4
+ function isEditableTarget(target) {
5
+ if (!(target instanceof HTMLElement)) return false;
6
+ const tag = target.tagName;
7
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
8
+ if (target.isContentEditable || target.contentEditable === "true") return true;
9
+ const attr = target.getAttribute("contenteditable");
10
+ return attr === "" || attr === "true" || attr === "plaintext-only";
11
+ }
12
+ function keyMapCode(e) {
13
+ let code = e.code;
14
+ if (e.altKey) code = `Alt+${code}`;
15
+ if (e.shiftKey) code = `Shift+${code}`;
16
+ if (e.metaKey || e.ctrlKey) code = `Mod+${code}`;
17
+ return code;
18
+ }
19
+ function resolveKeyMapEvent(map, e) {
20
+ if (!map || isEditableTarget(e.target)) return void 0;
21
+ return map[keyMapCode(e)] ?? map[e.code];
22
+ }
3
23
  var log = createLogger("almadar:bridge");
4
24
  var MAX_TRANSITIONS = 500;
5
25
  function getState() {
@@ -174,7 +194,9 @@ function recordOrbitalResponse(orbitalName, request, response) {
174
194
  }
175
195
  function recordingTransport(transport) {
176
196
  const subscribe = transport.subscribe?.bind(transport);
197
+ const subscribeHostDispatches = transport.subscribeHostDispatches?.bind(transport);
177
198
  return {
199
+ ...transport.hostsBrowserStore !== void 0 ? { hostsBrowserStore: transport.hostsBrowserStore } : {},
178
200
  register: (schema) => transport.register(schema),
179
201
  unregister: () => transport.unregister(),
180
202
  send: async (orbitalName, request) => {
@@ -182,7 +204,8 @@ function recordingTransport(transport) {
182
204
  recordOrbitalResponse(orbitalName, request, response);
183
205
  return response;
184
206
  },
185
- ...subscribe !== void 0 ? { subscribe } : {}
207
+ ...subscribe !== void 0 ? { subscribe } : {},
208
+ ...subscribeHostDispatches !== void 0 ? { subscribeHostDispatches } : {}
186
209
  };
187
210
  }
188
211
  function updateBridgeHealth(health) {
@@ -388,25 +411,4 @@ function clearVerification() {
388
411
  }
389
412
  exposeOnWindow();
390
413
 
391
- // lib/keyMapEvent.ts
392
- function isEditableTarget(target) {
393
- if (!(target instanceof HTMLElement)) return false;
394
- const tag = target.tagName;
395
- if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
396
- if (target.isContentEditable || target.contentEditable === "true") return true;
397
- const attr = target.getAttribute("contenteditable");
398
- return attr === "" || attr === "true" || attr === "plaintext-only";
399
- }
400
- function keyMapCode(e) {
401
- let code = e.code;
402
- if (e.altKey) code = `Alt+${code}`;
403
- if (e.shiftKey) code = `Shift+${code}`;
404
- if (e.metaKey || e.ctrlKey) code = `Mod+${code}`;
405
- return code;
406
- }
407
- function resolveKeyMapEvent(map, e) {
408
- if (!map || isEditableTarget(e.target)) return void 0;
409
- return map[keyMapCode(e)] ?? map[e.code];
410
- }
411
-
412
414
  export { bindCanvasCapture, bindEventBus, bindLastDrawables, bindTraitStateGetter, clearVerification, getAllChecks, getBridgeHealth, getSnapshot, getSummary, getTraitSnapshots, getTransitions, getTransitionsForTrait, isEditableTarget, keyMapCode, recordOrbitalResponse, recordServerResponse, recordTransition, recordingTransport, registerCheck, registerTraitSnapshot, resolveKeyMapEvent, serverEffectTraces, subscribeToVerification, updateAssetStatus, updateBridgeHealth, updateCheck, waitForTransition };
@@ -1,5 +1,5 @@
1
- import { DEFAULT_CURRENCY } from './chunk-MCKFWPT2.js';
2
- import { en_default } from './chunk-N2V4LHFQ.js';
1
+ import { DEFAULT_CURRENCY } from './chunk-RNY5LJXJ.js';
2
+ import { en_default } from './chunk-HRCR53OW.js';
3
3
  import React, { createContext, useEffect, useContext, useMemo, useRef, useSyncExternalStore } from 'react';
4
4
  import { mergeEntityFrame } from '@almadar/core';
5
5
  import { createLogger } from '@almadar/logger';
@@ -1,4 +1,4 @@
1
- import { en_default } from './chunk-N2V4LHFQ.js';
1
+ import { en_default } from './chunk-HRCR53OW.js';
2
2
 
3
3
  // lib/format.ts
4
4
  var { $meta: _meta, ...coreMessages } = en_default;
@@ -1,5 +1,5 @@
1
- import { avlBlend, AVL_INK, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, avlTint, Box, VStack, effectCategoryOf } from './chunk-Z5IYJU44.js';
2
- import { Typography } from './chunk-4UP6BZ4R.js';
1
+ import { avlBlend, AVL_INK, EFFECT_CATEGORY_COLORS, OPERATOR_CATEGORY_COLORS, avlTint, Box, VStack, effectCategoryOf } from './chunk-Y53Q55H5.js';
2
+ import { Typography } from './chunk-HCSJHRC4.js';
3
3
  import { Vector3, QuadraticBezierCurve3, MathUtils, Quaternion } from 'three';
4
4
  import { EntityPersistenceSchema } from '@almadar/core';
5
5
  import { getStdOperatorMeta } from '@almadar/std/registry';
@@ -133,7 +133,38 @@ var SURFACE_VARS = [
133
133
  { cssVar: "--surface-backdrop", key: "backdrop" },
134
134
  { cssVar: "--surface-card-image", key: "cardImage" },
135
135
  { cssVar: "--surface-page-image", key: "pageImage" },
136
- { cssVar: "--surface-page-image-size", key: "pageImageSize" }
136
+ { cssVar: "--surface-page-image-size", key: "pageImageSize" },
137
+ { cssVar: "--surface-diagram", key: "diagram" }
138
+ ];
139
+ var DIAGRAM_VARS = [
140
+ { cssVar: "--diagram-stroke-thin", key: "strokeThin" },
141
+ { cssVar: "--diagram-stroke-normal", key: "strokeNormal" },
142
+ { cssVar: "--diagram-stroke-bold", key: "strokeBold" },
143
+ { cssVar: "--diagram-line-cap", key: "lineCap" },
144
+ { cssVar: "--diagram-line-join", key: "lineJoin" },
145
+ { cssVar: "--diagram-dash", key: "dash" },
146
+ { cssVar: "--diagram-dot", key: "dot" },
147
+ { cssVar: "--diagram-fill-style", key: "fillStyle" },
148
+ { cssVar: "--diagram-fill-opacity", key: "fillOpacity" },
149
+ { cssVar: "--diagram-roughness", key: "roughness" },
150
+ { cssVar: "--diagram-glow", key: "glow" },
151
+ { cssVar: "--diagram-shadow", key: "shadow" },
152
+ { cssVar: "--diagram-marker", key: "marker" },
153
+ { cssVar: "--diagram-label-font", key: "labelFont" },
154
+ { cssVar: "--diagram-label-size", key: "labelSize" },
155
+ { cssVar: "--diagram-label-weight", key: "labelWeight" },
156
+ { cssVar: "--diagram-label-case", key: "labelCase" },
157
+ { cssVar: "--diagram-corner", key: "corner" }
158
+ ];
159
+ var SCENE_VARS = [
160
+ { cssVar: "--material-roughness", key: "materialRoughness" },
161
+ { cssVar: "--material-metalness", key: "materialMetalness" },
162
+ { cssVar: "--material-flat", key: "materialFlat" },
163
+ { cssVar: "--material-outline", key: "materialOutline" },
164
+ { cssVar: "--light-ambient", key: "lightAmbient" },
165
+ { cssVar: "--light-key", key: "lightKey" },
166
+ { cssVar: "--light-key-color", key: "lightKeyColor" },
167
+ { cssVar: "--scene-fog", key: "fog" }
137
168
  ];
138
169
  var LEGACY_PREFIXES = {
139
170
  colors: "--color-",
@@ -194,6 +225,10 @@ function themeTokensToCssVars(tokens, mode = "light", darkVariant) {
194
225
  emitGeometry(pickGeometry, vars);
195
226
  const pickSurface = isDark && darkVariant?.surface ? darkVariant.surface : tokens.surface;
196
227
  applyFlat(pickSurface, SURFACE_VARS, vars);
228
+ const pickDiagram = isDark && darkVariant?.diagram ? darkVariant.diagram : tokens.diagram;
229
+ applyFlat(pickDiagram, DIAGRAM_VARS, vars);
230
+ const pickScene = isDark && darkVariant?.scene ? darkVariant.scene : tokens.scene;
231
+ applyFlat(pickScene, SCENE_VARS, vars);
197
232
  return vars;
198
233
  }
199
234
  function emitDensity(density, vars) {
@@ -287,4 +322,4 @@ function resolveThemeForRuntime(theme) {
287
322
  return theme;
288
323
  }
289
324
 
290
- export { DENSITY_ELEMENT_VARS, DENSITY_SPACING_VARS, ELEVATION_VARS, GEOMETRY_VARS, ICONOGRAPHY_VARS, LEGACY_PREFIXES, MOTION_DURATION_KEYS, MOTION_EASING_KEYS, MOTION_INTENT_VARS, MOTION_SHAPE_VARS, SURFACE_VARS, TYPE_FAMILY_VARS, TYPE_HEADING_VARS, TYPE_INTENT_VARS, TYPE_SIZE_KEYS, enterKeyframe, resolveThemeForRuntime, themeTokensToCssVars };
325
+ export { DENSITY_ELEMENT_VARS, DENSITY_SPACING_VARS, DIAGRAM_VARS, ELEVATION_VARS, GEOMETRY_VARS, ICONOGRAPHY_VARS, LEGACY_PREFIXES, MOTION_DURATION_KEYS, MOTION_EASING_KEYS, MOTION_INTENT_VARS, MOTION_SHAPE_VARS, SCENE_VARS, SURFACE_VARS, TYPE_FAMILY_VARS, TYPE_HEADING_VARS, TYPE_INTENT_VARS, TYPE_SIZE_KEYS, enterKeyframe, resolveThemeForRuntime, themeTokensToCssVars };