@almadar/ui 6.20.0 → 6.21.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();
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();
@@ -6505,6 +6505,36 @@ var init_resolve_render_bindings = __esm({
6505
6505
  evaluatorResolvedData = /* @__PURE__ */ new WeakSet();
6506
6506
  }
6507
6507
  });
6508
+
6509
+ // lib/portalRoot.ts
6510
+ function lastThemedElement(selector, portalRoot) {
6511
+ const matches = Array.from(document.querySelectorAll(selector)).filter(
6512
+ (el) => el !== document.documentElement && el !== portalRoot
6513
+ );
6514
+ return matches[matches.length - 1] ?? null;
6515
+ }
6516
+ function getOrCreatePortalRoot() {
6517
+ let root = document.getElementById("ui-slot-portal-root");
6518
+ if (!root) {
6519
+ root = document.createElement("div");
6520
+ root.id = "ui-slot-portal-root";
6521
+ root.style.position = "relative";
6522
+ root.style.zIndex = "9999";
6523
+ document.body.appendChild(root);
6524
+ }
6525
+ const themed = lastThemedElement('[data-theme*="-"]', root) ?? lastThemedElement("[data-theme]", root);
6526
+ if (themed) {
6527
+ const theme = themed.getAttribute("data-theme");
6528
+ if (theme && root.getAttribute("data-theme") !== theme) {
6529
+ root.setAttribute("data-theme", theme);
6530
+ }
6531
+ }
6532
+ return root;
6533
+ }
6534
+ var init_portalRoot = __esm({
6535
+ "lib/portalRoot.ts"() {
6536
+ }
6537
+ });
6508
6538
  var sizeClasses6, minWidthClasses, lookStyles2; exports.Modal = void 0;
6509
6539
  var init_Modal = __esm({
6510
6540
  "components/core/molecules/Modal.tsx"() {
@@ -6514,6 +6544,7 @@ var init_Modal = __esm({
6514
6544
  init_Dialog();
6515
6545
  init_Typography();
6516
6546
  init_cn();
6547
+ init_portalRoot();
6517
6548
  init_useEventBus();
6518
6549
  init_Presence();
6519
6550
  sizeClasses6 = {
@@ -6724,7 +6755,7 @@ var init_Modal = __esm({
6724
6755
  )
6725
6756
  }
6726
6757
  ),
6727
- document.body
6758
+ getOrCreatePortalRoot()
6728
6759
  );
6729
6760
  };
6730
6761
  exports.Modal.displayName = "Modal";
@@ -16298,6 +16329,7 @@ var init_StateMachineView = __esm({
16298
16329
  init_Icon();
16299
16330
  init_useEventBus();
16300
16331
  init_cn();
16332
+ init_portalRoot();
16301
16333
  StateNode = ({ state, config }) => {
16302
16334
  const { t } = hooks.useTranslate();
16303
16335
  const size = state.radius * 2;
@@ -16814,7 +16846,7 @@ var init_StateMachineView = __esm({
16814
16846
  )
16815
16847
  }
16816
16848
  ),
16817
- document.body
16849
+ getOrCreatePortalRoot()
16818
16850
  );
16819
16851
  };
16820
16852
  EntityBox = ({ entity, config }) => {
@@ -25293,7 +25325,7 @@ function SubMenu({
25293
25325
  })
25294
25326
  }
25295
25327
  );
25296
- return typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel;
25328
+ return typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel;
25297
25329
  }
25298
25330
  function MenuItemRow({
25299
25331
  item,
@@ -25380,6 +25412,7 @@ var init_Menu = __esm({
25380
25412
  init_Typography();
25381
25413
  init_Badge();
25382
25414
  init_cn();
25415
+ init_portalRoot();
25383
25416
  init_useEventBus();
25384
25417
  MENU_GAP = 4;
25385
25418
  menuContainerStyles = cn(
@@ -25516,7 +25549,7 @@ var init_Menu = __esm({
25516
25549
  ) : null;
25517
25550
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
25518
25551
  triggerElement,
25519
- panel && typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel
25552
+ panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
25520
25553
  ] });
25521
25554
  };
25522
25555
  exports.Menu.displayName = "Menu";
@@ -29571,6 +29604,7 @@ var init_Popover = __esm({
29571
29604
  init_Typography();
29572
29605
  init_Presence();
29573
29606
  init_cn();
29607
+ init_portalRoot();
29574
29608
  init_useTapReveal();
29575
29609
  arrowClasses = {
29576
29610
  top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
@@ -29730,7 +29764,7 @@ var init_Popover = __esm({
29730
29764
  ) : null;
29731
29765
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
29732
29766
  triggerElement,
29733
- panel && typeof document !== "undefined" ? reactDom.createPortal(panel, document.body) : panel
29767
+ panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
29734
29768
  ] });
29735
29769
  };
29736
29770
  exports.Popover.displayName = "Popover";
@@ -29811,6 +29845,7 @@ var init_Coachmark = __esm({
29811
29845
  init_Button();
29812
29846
  init_Icon();
29813
29847
  init_cn();
29848
+ init_portalRoot();
29814
29849
  GAP = 10;
29815
29850
  EDGE = 8;
29816
29851
  exports.Coachmark = ({
@@ -29913,7 +29948,7 @@ var init_Coachmark = __esm({
29913
29948
  beacon,
29914
29949
  card
29915
29950
  ] }),
29916
- document.body
29951
+ getOrCreatePortalRoot()
29917
29952
  );
29918
29953
  };
29919
29954
  exports.Coachmark.displayName = "Coachmark";
@@ -29925,6 +29960,7 @@ var init_OnboardingSpotlight = __esm({
29925
29960
  "use client";
29926
29961
  init_Coachmark();
29927
29962
  init_cn();
29963
+ init_portalRoot();
29928
29964
  DIM = "fixed z-[45] bg-black/60";
29929
29965
  exports.OnboardingSpotlight = ({
29930
29966
  steps,
@@ -29952,7 +29988,7 @@ var init_OnboardingSpotlight = __esm({
29952
29988
  ] });
29953
29989
  })() : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(DIM, "inset-0") });
29954
29990
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
29955
- reactDom.createPortal(backdrop, document.body),
29991
+ reactDom.createPortal(backdrop, getOrCreatePortalRoot()),
29956
29992
  /* @__PURE__ */ jsxRuntime.jsxs(
29957
29993
  exports.Coachmark,
29958
29994
  {
@@ -30486,6 +30522,7 @@ var init_Tooltip = __esm({
30486
30522
  "use client";
30487
30523
  init_Typography();
30488
30524
  init_cn();
30525
+ init_portalRoot();
30489
30526
  init_useTapReveal();
30490
30527
  TRIGGER_GAP2 = 8;
30491
30528
  arrowClasses2 = {
@@ -30591,7 +30628,7 @@ var init_Tooltip = __esm({
30591
30628
  ) : null;
30592
30629
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30593
30630
  trigger,
30594
- typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent, document.body) : tooltipContent
30631
+ typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent, getOrCreatePortalRoot()) : tooltipContent
30595
30632
  ] });
30596
30633
  };
30597
30634
  exports.Tooltip.displayName = "Tooltip";
@@ -44508,6 +44545,7 @@ var init_GraphCanvas = __esm({
44508
44545
  "components/core/molecules/GraphCanvas.tsx"() {
44509
44546
  "use client";
44510
44547
  init_cn();
44548
+ init_portalRoot();
44511
44549
  init_atoms();
44512
44550
  init_Stack();
44513
44551
  init_LoadingState();
@@ -45219,7 +45257,7 @@ var init_GraphCanvas = __esm({
45219
45257
  children: hoveredObj?.label
45220
45258
  }
45221
45259
  ),
45222
- document.body
45260
+ getOrCreatePortalRoot()
45223
45261
  )
45224
45262
  ] }),
45225
45263
  groups.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "md", className: "px-4 py-2 border-t border-border", wrap: true, children: groups.map((group, idx) => /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", align: "center", children: [
@@ -46609,6 +46647,7 @@ var init_DetailPanel = __esm({
46609
46647
  init_ErrorState();
46610
46648
  init_EmptyState();
46611
46649
  init_cn();
46650
+ init_portalRoot();
46612
46651
  init_format();
46613
46652
  init_getNestedValue();
46614
46653
  init_relationLabel();
@@ -47028,7 +47067,7 @@ var init_DetailPanel = __esm({
47028
47067
  return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className, children: content });
47029
47068
  }
47030
47069
  const panel = /* @__PURE__ */ jsxRuntime.jsx(exports.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 });
47031
- return typeof document === "undefined" ? panel : reactDom.createPortal(panel, document.body);
47070
+ return typeof document === "undefined" ? panel : reactDom.createPortal(panel, getOrCreatePortalRoot());
47032
47071
  };
47033
47072
  exports.DetailPanel.displayName = "DetailPanel";
47034
47073
  }
@@ -53919,24 +53958,6 @@ function UISlotComponentInner({
53919
53958
  }
53920
53959
  );
53921
53960
  }
53922
- function getOrCreatePortalRoot() {
53923
- let root = document.getElementById("ui-slot-portal-root");
53924
- if (!root) {
53925
- root = document.createElement("div");
53926
- root.id = "ui-slot-portal-root";
53927
- root.style.position = "relative";
53928
- root.style.zIndex = "9999";
53929
- document.body.appendChild(root);
53930
- }
53931
- const themed = document.querySelector('[data-theme*="-"]') ?? document.querySelector("[data-theme]");
53932
- if (themed) {
53933
- const theme = themed.getAttribute("data-theme");
53934
- if (theme && root.getAttribute("data-theme") !== theme) {
53935
- root.setAttribute("data-theme", theme);
53936
- }
53937
- }
53938
- return root;
53939
- }
53940
53961
  function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
53941
53962
  const [portalRoot, setPortalRoot] = React79.useState(null);
53942
53963
  const slotsBus = context.useUISlots();
@@ -54559,6 +54580,7 @@ var init_UISlotRenderer = __esm({
54559
54580
  init_slot_types();
54560
54581
  init_cn();
54561
54582
  init_format();
54583
+ init_portalRoot();
54562
54584
  init_ErrorBoundary();
54563
54585
  init_Skeleton();
54564
54586
  init_renderer();
@@ -4965,7 +4965,7 @@ declare const Popover: React__default.FC<PopoverProps>;
4965
4965
  * Popover (uncontrolled, wraps its own trigger), a Coachmark is driven by
4966
4966
  * `open` and points at an element it does not own — a tab button, the persona
4967
4967
  * menu, a canvas node — resolved from a ref, a CSS selector, or a DOMRect.
4968
- * Portals to document.body so it escapes the canvas/preview transform contexts.
4968
+ * Portals into the shared portal root so it escapes the canvas/preview transform contexts.
4969
4969
  */
4970
4970
 
4971
4971
  type CoachmarkPlacement = "top" | "bottom" | "left" | "right";
@@ -4965,7 +4965,7 @@ declare const Popover: React__default.FC<PopoverProps>;
4965
4965
  * Popover (uncontrolled, wraps its own trigger), a Coachmark is driven by
4966
4966
  * `open` and points at an element it does not own — a tab button, the persona
4967
4967
  * menu, a canvas node — resolved from a ref, a CSS selector, or a DOMRect.
4968
- * Portals to document.body so it escapes the canvas/preview transform contexts.
4968
+ * Portals into the shared portal root so it escapes the canvas/preview transform contexts.
4969
4969
  */
4970
4970
 
4971
4971
  type CoachmarkPlacement = "top" | "bottom" | "left" | "right";