@almadar/ui 6.20.0 → 6.22.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.
@@ -5398,6 +5398,36 @@ var init_Dialog = __esm({
5398
5398
  Dialog.displayName = "Dialog";
5399
5399
  }
5400
5400
  });
5401
+
5402
+ // lib/portalRoot.ts
5403
+ function lastThemedElement(selector, portalRoot) {
5404
+ const matches = Array.from(document.querySelectorAll(selector)).filter(
5405
+ (el) => el !== document.documentElement && el !== portalRoot
5406
+ );
5407
+ return matches[matches.length - 1] ?? null;
5408
+ }
5409
+ function getOrCreatePortalRoot() {
5410
+ let root = document.getElementById("ui-slot-portal-root");
5411
+ if (!root) {
5412
+ root = document.createElement("div");
5413
+ root.id = "ui-slot-portal-root";
5414
+ root.style.position = "relative";
5415
+ root.style.zIndex = "9999";
5416
+ document.body.appendChild(root);
5417
+ }
5418
+ const themed = lastThemedElement('[data-theme*="-"]', root) ?? lastThemedElement("[data-theme]", root);
5419
+ if (themed) {
5420
+ const theme = themed.getAttribute("data-theme");
5421
+ if (theme && root.getAttribute("data-theme") !== theme) {
5422
+ root.setAttribute("data-theme", theme);
5423
+ }
5424
+ }
5425
+ return root;
5426
+ }
5427
+ var init_portalRoot = __esm({
5428
+ "lib/portalRoot.ts"() {
5429
+ }
5430
+ });
5401
5431
  function isMotionEnabled() {
5402
5432
  if (typeof document === "undefined") return true;
5403
5433
  if (motionEnabledCache !== null) return motionEnabledCache;
@@ -5478,6 +5508,7 @@ var init_Modal = __esm({
5478
5508
  init_Dialog();
5479
5509
  init_Typography();
5480
5510
  init_cn();
5511
+ init_portalRoot();
5481
5512
  init_useEventBus();
5482
5513
  init_Presence();
5483
5514
  sizeClasses2 = {
@@ -5688,7 +5719,7 @@ var init_Modal = __esm({
5688
5719
  )
5689
5720
  }
5690
5721
  ),
5691
- document.body
5722
+ getOrCreatePortalRoot()
5692
5723
  );
5693
5724
  };
5694
5725
  Modal.displayName = "Modal";
@@ -23054,6 +23085,7 @@ var init_StateMachineView = __esm({
23054
23085
  init_Icon();
23055
23086
  init_useEventBus();
23056
23087
  init_cn();
23088
+ init_portalRoot();
23057
23089
  StateNode2 = ({ state, config }) => {
23058
23090
  const { t } = hooks.useTranslate();
23059
23091
  const size = state.radius * 2;
@@ -23570,7 +23602,7 @@ var init_StateMachineView = __esm({
23570
23602
  )
23571
23603
  }
23572
23604
  ),
23573
- document.body
23605
+ getOrCreatePortalRoot()
23574
23606
  );
23575
23607
  };
23576
23608
  EntityBox = ({ entity, config }) => {
@@ -30211,7 +30243,7 @@ function SubMenu({
30211
30243
  })
30212
30244
  }
30213
30245
  );
30214
- return typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel;
30246
+ return typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel;
30215
30247
  }
30216
30248
  function MenuItemRow({
30217
30249
  item,
@@ -30298,6 +30330,7 @@ var init_Menu = __esm({
30298
30330
  init_Typography();
30299
30331
  init_Badge();
30300
30332
  init_cn();
30333
+ init_portalRoot();
30301
30334
  init_useEventBus();
30302
30335
  MENU_GAP = 4;
30303
30336
  menuContainerStyles = cn(
@@ -30434,7 +30467,7 @@ var init_Menu = __esm({
30434
30467
  ) : null;
30435
30468
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30436
30469
  triggerElement,
30437
- panel && typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel
30470
+ panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
30438
30471
  ] });
30439
30472
  };
30440
30473
  Menu.displayName = "Menu";
@@ -33818,6 +33851,7 @@ var init_Popover = __esm({
33818
33851
  init_Typography();
33819
33852
  init_Presence();
33820
33853
  init_cn();
33854
+ init_portalRoot();
33821
33855
  init_useTapReveal();
33822
33856
  arrowClasses = {
33823
33857
  top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
@@ -33977,7 +34011,7 @@ var init_Popover = __esm({
33977
34011
  ) : null;
33978
34012
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
33979
34013
  triggerElement,
33980
- panel && typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel
34014
+ panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
33981
34015
  ] });
33982
34016
  };
33983
34017
  Popover.displayName = "Popover";
@@ -34483,6 +34517,7 @@ var init_Tooltip = __esm({
34483
34517
  "use client";
34484
34518
  init_Typography();
34485
34519
  init_cn();
34520
+ init_portalRoot();
34486
34521
  init_useTapReveal();
34487
34522
  TRIGGER_GAP2 = 8;
34488
34523
  arrowClasses2 = {
@@ -34588,7 +34623,7 @@ var init_Tooltip = __esm({
34588
34623
  ) : null;
34589
34624
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
34590
34625
  trigger,
34591
- typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent, document.body) : tooltipContent
34626
+ typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent, getOrCreatePortalRoot()) : tooltipContent
34592
34627
  ] });
34593
34628
  };
34594
34629
  Tooltip.displayName = "Tooltip";
@@ -45599,6 +45634,7 @@ var init_GraphCanvas = __esm({
45599
45634
  "components/core/molecules/GraphCanvas.tsx"() {
45600
45635
  "use client";
45601
45636
  init_cn();
45637
+ init_portalRoot();
45602
45638
  init_atoms();
45603
45639
  init_Stack();
45604
45640
  init_LoadingState();
@@ -46310,7 +46346,7 @@ var init_GraphCanvas = __esm({
46310
46346
  children: hoveredObj?.label
46311
46347
  }
46312
46348
  ),
46313
- document.body
46349
+ getOrCreatePortalRoot()
46314
46350
  )
46315
46351
  ] }),
46316
46352
  groups.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "md", className: "px-4 py-2 border-t border-border", wrap: true, children: groups.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", children: [
@@ -47471,6 +47507,7 @@ var init_DetailPanel = __esm({
47471
47507
  init_ErrorState();
47472
47508
  init_EmptyState();
47473
47509
  init_cn();
47510
+ init_portalRoot();
47474
47511
  init_format();
47475
47512
  init_getNestedValue();
47476
47513
  init_relationLabel();
@@ -47890,7 +47927,7 @@ var init_DetailPanel = __esm({
47890
47927
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, children: content });
47891
47928
  }
47892
47929
  const panel = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("fixed inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
47893
- return typeof document === "undefined" ? panel : reactDom.createPortal(panel, document.body);
47930
+ return typeof document === "undefined" ? panel : reactDom.createPortal(panel, getOrCreatePortalRoot());
47894
47931
  };
47895
47932
  DetailPanel.displayName = "DetailPanel";
47896
47933
  }
@@ -54800,24 +54837,6 @@ function UISlotComponentInner({
54800
54837
  }
54801
54838
  );
54802
54839
  }
54803
- function getOrCreatePortalRoot() {
54804
- let root = document.getElementById("ui-slot-portal-root");
54805
- if (!root) {
54806
- root = document.createElement("div");
54807
- root.id = "ui-slot-portal-root";
54808
- root.style.position = "relative";
54809
- root.style.zIndex = "9999";
54810
- document.body.appendChild(root);
54811
- }
54812
- const themed = document.querySelector('[data-theme*="-"]') ?? document.querySelector("[data-theme]");
54813
- if (themed) {
54814
- const theme = themed.getAttribute("data-theme");
54815
- if (theme && root.getAttribute("data-theme") !== theme) {
54816
- root.setAttribute("data-theme", theme);
54817
- }
54818
- }
54819
- return root;
54820
- }
54821
54840
  function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
54822
54841
  const [portalRoot, setPortalRoot] = React96.useState(null);
54823
54842
  const slotsBus = context.useUISlots();
@@ -55440,6 +55459,7 @@ var init_UISlotRenderer = __esm({
55440
55459
  init_slot_types();
55441
55460
  init_cn();
55442
55461
  init_format();
55462
+ init_portalRoot();
55443
55463
  init_ErrorBoundary();
55444
55464
  init_Skeleton();
55445
55465
  init_renderer();
@@ -60529,7 +60549,7 @@ function NavStackRefBridge({ apiRef }) {
60529
60549
  }, [api, apiRef]);
60530
60550
  return null;
60531
60551
  }
60532
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
60552
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
60533
60553
  const bridge = providers.useServerBridge();
60534
60554
  const activeTraitNames = React96.useMemo(
60535
60555
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -60596,9 +60616,9 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60596
60616
  sendEvent("INIT", routeParams);
60597
60617
  onLocalFallback?.();
60598
60618
  }
60599
- }, 5e3);
60619
+ }, localFallbackTimeoutMs ?? 5e3);
60600
60620
  return () => clearTimeout(fallback);
60601
- }, [traits2, orbitalNames, sendEvent, onLocalFallback, routeParams]);
60621
+ }, [traits2, orbitalNames, sendEvent, onLocalFallback, localFallbackTimeoutMs, routeParams]);
60602
60622
  React96.useEffect(() => {
60603
60623
  if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
60604
60624
  initSentRef.current = true;
@@ -60652,7 +60672,7 @@ function FitToBox({ children }) {
60652
60672
  }, []);
60653
60673
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: outerRef, className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: innerRef, style: { transform: `scale(${scale})`, transformOrigin: "top left", width: "fit-content" }, children }) });
60654
60674
  }
60655
- function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, persistence }) {
60675
+ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence }) {
60656
60676
  const { traits: traits2, allEntities, allTraits, ir } = useResolvedSchema(schema, pageName);
60657
60677
  const allPageTraits = React96.useMemo(() => {
60658
60678
  let base;
@@ -60815,6 +60835,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
60815
60835
  onNavigate,
60816
60836
  onNavigateBack,
60817
60837
  onLocalFallback,
60838
+ localFallbackTimeoutMs,
60818
60839
  persistence,
60819
60840
  children: /* @__PURE__ */ jsxRuntime.jsx(providers.OrbitalThemeProvider, { theme: activeOrbitalTheme, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "h-full min-h-full overflow-auto p-4", children: /* @__PURE__ */ jsxRuntime.jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) }) })
60820
60841
  }
@@ -60838,7 +60859,8 @@ function OrbPreview({
60838
60859
  initialPagePath,
60839
60860
  isolated = false,
60840
60861
  fit = false,
60841
- user = null
60862
+ user = null,
60863
+ localFallbackTimeoutMs
60842
60864
  }) {
60843
60865
  if (serverUrl && transport) {
60844
60866
  throw new Error("OrbPreview accepts serverUrl OR transport, not both");
@@ -61020,6 +61042,7 @@ function OrbPreview({
61020
61042
  onNavigate: handleNavigateEffect,
61021
61043
  onNavigateBack: handleNavigateBack,
61022
61044
  onLocalFallback: handleLocalFallback,
61045
+ localFallbackTimeoutMs,
61023
61046
  persistence
61024
61047
  }
61025
61048
  ) }) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -61035,6 +61058,7 @@ function OrbPreview({
61035
61058
  onNavigate: handleNavigateEffect,
61036
61059
  onNavigateBack: handleNavigateBack,
61037
61060
  onLocalFallback: handleLocalFallback,
61061
+ localFallbackTimeoutMs,
61038
61062
  persistence
61039
61063
  }
61040
61064
  ) }) })
package/dist/avl/index.js CHANGED
@@ -5322,6 +5322,36 @@ var init_Dialog = __esm({
5322
5322
  Dialog.displayName = "Dialog";
5323
5323
  }
5324
5324
  });
5325
+
5326
+ // lib/portalRoot.ts
5327
+ function lastThemedElement(selector, portalRoot) {
5328
+ const matches = Array.from(document.querySelectorAll(selector)).filter(
5329
+ (el) => el !== document.documentElement && el !== portalRoot
5330
+ );
5331
+ return matches[matches.length - 1] ?? null;
5332
+ }
5333
+ function getOrCreatePortalRoot() {
5334
+ let root = document.getElementById("ui-slot-portal-root");
5335
+ if (!root) {
5336
+ root = document.createElement("div");
5337
+ root.id = "ui-slot-portal-root";
5338
+ root.style.position = "relative";
5339
+ root.style.zIndex = "9999";
5340
+ document.body.appendChild(root);
5341
+ }
5342
+ const themed = lastThemedElement('[data-theme*="-"]', root) ?? lastThemedElement("[data-theme]", root);
5343
+ if (themed) {
5344
+ const theme = themed.getAttribute("data-theme");
5345
+ if (theme && root.getAttribute("data-theme") !== theme) {
5346
+ root.setAttribute("data-theme", theme);
5347
+ }
5348
+ }
5349
+ return root;
5350
+ }
5351
+ var init_portalRoot = __esm({
5352
+ "lib/portalRoot.ts"() {
5353
+ }
5354
+ });
5325
5355
  function isMotionEnabled() {
5326
5356
  if (typeof document === "undefined") return true;
5327
5357
  if (motionEnabledCache !== null) return motionEnabledCache;
@@ -5402,6 +5432,7 @@ var init_Modal = __esm({
5402
5432
  init_Dialog();
5403
5433
  init_Typography();
5404
5434
  init_cn();
5435
+ init_portalRoot();
5405
5436
  init_useEventBus();
5406
5437
  init_Presence();
5407
5438
  sizeClasses2 = {
@@ -5612,7 +5643,7 @@ var init_Modal = __esm({
5612
5643
  )
5613
5644
  }
5614
5645
  ),
5615
- document.body
5646
+ getOrCreatePortalRoot()
5616
5647
  );
5617
5648
  };
5618
5649
  Modal.displayName = "Modal";
@@ -22978,6 +23009,7 @@ var init_StateMachineView = __esm({
22978
23009
  init_Icon();
22979
23010
  init_useEventBus();
22980
23011
  init_cn();
23012
+ init_portalRoot();
22981
23013
  StateNode2 = ({ state, config }) => {
22982
23014
  const { t } = useTranslate();
22983
23015
  const size = state.radius * 2;
@@ -23494,7 +23526,7 @@ var init_StateMachineView = __esm({
23494
23526
  )
23495
23527
  }
23496
23528
  ),
23497
- document.body
23529
+ getOrCreatePortalRoot()
23498
23530
  );
23499
23531
  };
23500
23532
  EntityBox = ({ entity, config }) => {
@@ -30135,7 +30167,7 @@ function SubMenu({
30135
30167
  })
30136
30168
  }
30137
30169
  );
30138
- return typeof document !== "undefined" ? createPortal(panel, document.body) : panel;
30170
+ return typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel;
30139
30171
  }
30140
30172
  function MenuItemRow({
30141
30173
  item,
@@ -30222,6 +30254,7 @@ var init_Menu = __esm({
30222
30254
  init_Typography();
30223
30255
  init_Badge();
30224
30256
  init_cn();
30257
+ init_portalRoot();
30225
30258
  init_useEventBus();
30226
30259
  MENU_GAP = 4;
30227
30260
  menuContainerStyles = cn(
@@ -30358,7 +30391,7 @@ var init_Menu = __esm({
30358
30391
  ) : null;
30359
30392
  return /* @__PURE__ */ jsxs(Fragment, { children: [
30360
30393
  triggerElement,
30361
- panel && typeof document !== "undefined" ? createPortal(panel, document.body) : panel
30394
+ panel && typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel
30362
30395
  ] });
30363
30396
  };
30364
30397
  Menu.displayName = "Menu";
@@ -33742,6 +33775,7 @@ var init_Popover = __esm({
33742
33775
  init_Typography();
33743
33776
  init_Presence();
33744
33777
  init_cn();
33778
+ init_portalRoot();
33745
33779
  init_useTapReveal();
33746
33780
  arrowClasses = {
33747
33781
  top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
@@ -33901,7 +33935,7 @@ var init_Popover = __esm({
33901
33935
  ) : null;
33902
33936
  return /* @__PURE__ */ jsxs(Fragment, { children: [
33903
33937
  triggerElement,
33904
- panel && typeof document !== "undefined" ? createPortal(panel, document.body) : panel
33938
+ panel && typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel
33905
33939
  ] });
33906
33940
  };
33907
33941
  Popover.displayName = "Popover";
@@ -34407,6 +34441,7 @@ var init_Tooltip = __esm({
34407
34441
  "use client";
34408
34442
  init_Typography();
34409
34443
  init_cn();
34444
+ init_portalRoot();
34410
34445
  init_useTapReveal();
34411
34446
  TRIGGER_GAP2 = 8;
34412
34447
  arrowClasses2 = {
@@ -34512,7 +34547,7 @@ var init_Tooltip = __esm({
34512
34547
  ) : null;
34513
34548
  return /* @__PURE__ */ jsxs(Fragment, { children: [
34514
34549
  trigger,
34515
- typeof window !== "undefined" && tooltipContent ? createPortal(tooltipContent, document.body) : tooltipContent
34550
+ typeof window !== "undefined" && tooltipContent ? createPortal(tooltipContent, getOrCreatePortalRoot()) : tooltipContent
34516
34551
  ] });
34517
34552
  };
34518
34553
  Tooltip.displayName = "Tooltip";
@@ -45523,6 +45558,7 @@ var init_GraphCanvas = __esm({
45523
45558
  "components/core/molecules/GraphCanvas.tsx"() {
45524
45559
  "use client";
45525
45560
  init_cn();
45561
+ init_portalRoot();
45526
45562
  init_atoms();
45527
45563
  init_Stack();
45528
45564
  init_LoadingState();
@@ -46234,7 +46270,7 @@ var init_GraphCanvas = __esm({
46234
46270
  children: hoveredObj?.label
46235
46271
  }
46236
46272
  ),
46237
- document.body
46273
+ getOrCreatePortalRoot()
46238
46274
  )
46239
46275
  ] }),
46240
46276
  groups.length > 1 && /* @__PURE__ */ jsx(HStack, { gap: "md", className: "px-4 py-2 border-t border-border", wrap: true, children: groups.map((group, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
@@ -47395,6 +47431,7 @@ var init_DetailPanel = __esm({
47395
47431
  init_ErrorState();
47396
47432
  init_EmptyState();
47397
47433
  init_cn();
47434
+ init_portalRoot();
47398
47435
  init_format();
47399
47436
  init_getNestedValue();
47400
47437
  init_relationLabel();
@@ -47814,7 +47851,7 @@ var init_DetailPanel = __esm({
47814
47851
  return /* @__PURE__ */ jsx(Box, { className, children: content });
47815
47852
  }
47816
47853
  const panel = /* @__PURE__ */ jsx(Box, { className: cn("fixed inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
47817
- return typeof document === "undefined" ? panel : createPortal(panel, document.body);
47854
+ return typeof document === "undefined" ? panel : createPortal(panel, getOrCreatePortalRoot());
47818
47855
  };
47819
47856
  DetailPanel.displayName = "DetailPanel";
47820
47857
  }
@@ -54724,24 +54761,6 @@ function UISlotComponentInner({
54724
54761
  }
54725
54762
  );
54726
54763
  }
54727
- function getOrCreatePortalRoot() {
54728
- let root = document.getElementById("ui-slot-portal-root");
54729
- if (!root) {
54730
- root = document.createElement("div");
54731
- root.id = "ui-slot-portal-root";
54732
- root.style.position = "relative";
54733
- root.style.zIndex = "9999";
54734
- document.body.appendChild(root);
54735
- }
54736
- const themed = document.querySelector('[data-theme*="-"]') ?? document.querySelector("[data-theme]");
54737
- if (themed) {
54738
- const theme = themed.getAttribute("data-theme");
54739
- if (theme && root.getAttribute("data-theme") !== theme) {
54740
- root.setAttribute("data-theme", theme);
54741
- }
54742
- }
54743
- return root;
54744
- }
54745
54764
  function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
54746
54765
  const [portalRoot, setPortalRoot] = useState(null);
54747
54766
  const slotsBus = useUISlots();
@@ -55364,6 +55383,7 @@ var init_UISlotRenderer = __esm({
55364
55383
  init_slot_types();
55365
55384
  init_cn();
55366
55385
  init_format();
55386
+ init_portalRoot();
55367
55387
  init_ErrorBoundary();
55368
55388
  init_Skeleton();
55369
55389
  init_renderer();
@@ -60453,7 +60473,7 @@ function NavStackRefBridge({ apiRef }) {
60453
60473
  }, [api, apiRef]);
60454
60474
  return null;
60455
60475
  }
60456
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
60476
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
60457
60477
  const bridge = useServerBridge();
60458
60478
  const activeTraitNames = useMemo(
60459
60479
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -60520,9 +60540,9 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
60520
60540
  sendEvent("INIT", routeParams);
60521
60541
  onLocalFallback?.();
60522
60542
  }
60523
- }, 5e3);
60543
+ }, localFallbackTimeoutMs ?? 5e3);
60524
60544
  return () => clearTimeout(fallback);
60525
- }, [traits2, orbitalNames, sendEvent, onLocalFallback, routeParams]);
60545
+ }, [traits2, orbitalNames, sendEvent, onLocalFallback, localFallbackTimeoutMs, routeParams]);
60526
60546
  useEffect(() => {
60527
60547
  if (!bridge.connected || !orbitalNames?.length || initSentRef.current) return;
60528
60548
  initSentRef.current = true;
@@ -60576,7 +60596,7 @@ function FitToBox({ children }) {
60576
60596
  }, []);
60577
60597
  return /* @__PURE__ */ jsx("div", { ref: outerRef, className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { ref: innerRef, style: { transform: `scale(${scale})`, transformOrigin: "top left", width: "fit-content" }, children }) });
60578
60598
  }
60579
- function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, persistence }) {
60599
+ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence }) {
60580
60600
  const { traits: traits2, allEntities, allTraits, ir } = useResolvedSchema(schema, pageName);
60581
60601
  const allPageTraits = useMemo(() => {
60582
60602
  let base;
@@ -60739,6 +60759,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
60739
60759
  onNavigate,
60740
60760
  onNavigateBack,
60741
60761
  onLocalFallback,
60762
+ localFallbackTimeoutMs,
60742
60763
  persistence,
60743
60764
  children: /* @__PURE__ */ jsx(OrbitalThemeProvider, { theme: activeOrbitalTheme, children: /* @__PURE__ */ jsx(Box, { className: "h-full min-h-full overflow-auto p-4", children: /* @__PURE__ */ jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) }) })
60744
60765
  }
@@ -60762,7 +60783,8 @@ function OrbPreview({
60762
60783
  initialPagePath,
60763
60784
  isolated = false,
60764
60785
  fit = false,
60765
- user = null
60786
+ user = null,
60787
+ localFallbackTimeoutMs
60766
60788
  }) {
60767
60789
  if (serverUrl && transport) {
60768
60790
  throw new Error("OrbPreview accepts serverUrl OR transport, not both");
@@ -60944,6 +60966,7 @@ function OrbPreview({
60944
60966
  onNavigate: handleNavigateEffect,
60945
60967
  onNavigateBack: handleNavigateBack,
60946
60968
  onLocalFallback: handleLocalFallback,
60969
+ localFallbackTimeoutMs,
60947
60970
  persistence
60948
60971
  }
60949
60972
  ) }) : /* @__PURE__ */ jsx(
@@ -60959,6 +60982,7 @@ function OrbPreview({
60959
60982
  onNavigate: handleNavigateEffect,
60960
60983
  onNavigateBack: handleNavigateBack,
60961
60984
  onLocalFallback: handleLocalFallback,
60985
+ localFallbackTimeoutMs,
60962
60986
  persistence
60963
60987
  }
60964
60988
  ) }) })