@almadar/ui 3.5.1 → 3.5.3

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.
@@ -12098,6 +12098,20 @@ function bindTraitStateGetter(getter) {
12098
12098
  window.__orbitalVerification.getTraitState = getter;
12099
12099
  }
12100
12100
  }
12101
+ function registerTraitSnapshot(traitName, getter) {
12102
+ if (typeof window === "undefined") return () => {
12103
+ };
12104
+ getState().traitSnapshots.set(traitName, getter);
12105
+ exposeOnWindow();
12106
+ notifyListeners();
12107
+ return () => {
12108
+ const s = getState();
12109
+ if (s.traitSnapshots.get(traitName) === getter) {
12110
+ s.traitSnapshots.delete(traitName);
12111
+ notifyListeners();
12112
+ }
12113
+ };
12114
+ }
12101
12115
  function bindCanvasCapture(captureFn) {
12102
12116
  if (typeof window === "undefined") return;
12103
12117
  exposeOnWindow();
@@ -46172,11 +46186,13 @@ function enrichFormFields(fields, entityDef) {
46172
46186
  }
46173
46187
  function renderContainedPortal(slot, content, onDismiss) {
46174
46188
  const slotContent = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
46189
+ const slotId = `slot-${slot}`;
46175
46190
  switch (slot) {
46176
46191
  case "modal":
46177
46192
  return /* @__PURE__ */ jsxRuntime.jsx(
46178
46193
  Box,
46179
46194
  {
46195
+ id: slotId,
46180
46196
  className: "absolute inset-0 z-50 flex items-start justify-center overflow-auto",
46181
46197
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)", paddingTop: "10%" },
46182
46198
  onClick: onDismiss,
@@ -46213,6 +46229,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46213
46229
  return /* @__PURE__ */ jsxRuntime.jsx(
46214
46230
  Box,
46215
46231
  {
46232
+ id: slotId,
46216
46233
  className: "absolute inset-0 z-50 overflow-hidden",
46217
46234
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
46218
46235
  onClick: onDismiss,
@@ -46245,7 +46262,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46245
46262
  }
46246
46263
  );
46247
46264
  case "toast":
46248
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
46265
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
46249
46266
  Toast,
46250
46267
  {
46251
46268
  variant: content.props.variant ?? "info",
@@ -46258,6 +46275,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46258
46275
  return /* @__PURE__ */ jsxRuntime.jsx(
46259
46276
  Box,
46260
46277
  {
46278
+ id: slotId,
46261
46279
  className: "absolute inset-0 z-50 flex items-center justify-center overflow-auto",
46262
46280
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
46263
46281
  onClick: onDismiss,
@@ -46265,9 +46283,9 @@ function renderContainedPortal(slot, content, onDismiss) {
46265
46283
  }
46266
46284
  );
46267
46285
  case "center":
46268
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
46286
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
46269
46287
  default:
46270
- return slotContent;
46288
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, children: slotContent });
46271
46289
  }
46272
46290
  }
46273
46291
  function UISlotComponent({
@@ -46386,12 +46404,14 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46386
46404
  eventBus.clear(slot);
46387
46405
  };
46388
46406
  if (!portalRoot) return null;
46407
+ const slotId = `slot-${slot}`;
46389
46408
  let wrapper;
46390
46409
  switch (slot) {
46391
46410
  case "modal":
46392
46411
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsxRuntime.jsx(
46393
46412
  Box,
46394
46413
  {
46414
+ id: slotId,
46395
46415
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46396
46416
  "data-pattern": pattern,
46397
46417
  "data-source-trait": sourceTrait,
@@ -46403,6 +46423,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46403
46423
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(Drawer, { isOpen: true, onClose: handleDismiss, position: "right", children: /* @__PURE__ */ jsxRuntime.jsx(
46404
46424
  Box,
46405
46425
  {
46426
+ id: slotId,
46406
46427
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46407
46428
  "data-pattern": pattern,
46408
46429
  "data-source-trait": sourceTrait,
@@ -46414,6 +46435,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46414
46435
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "fixed top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
46415
46436
  Box,
46416
46437
  {
46438
+ id: slotId,
46417
46439
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46418
46440
  "data-pattern": pattern,
46419
46441
  "data-source-trait": sourceTrait,
@@ -46425,6 +46447,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46425
46447
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(
46426
46448
  Box,
46427
46449
  {
46450
+ id: slotId,
46428
46451
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46429
46452
  "data-pattern": pattern,
46430
46453
  "data-source-trait": sourceTrait,
@@ -46448,6 +46471,8 @@ function SlotPortal({
46448
46471
  if (portalRoot) getOrCreatePortalRoot();
46449
46472
  });
46450
46473
  if (!portalRoot) return null;
46474
+ const slotId = `slot-${slot}`;
46475
+ const slotContent = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
46451
46476
  let wrapper;
46452
46477
  switch (slot) {
46453
46478
  case "modal":
@@ -46458,7 +46483,7 @@ function SlotPortal({
46458
46483
  onClose: onDismiss,
46459
46484
  title: content.props.title,
46460
46485
  size: content.props.size,
46461
- children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss })
46486
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, children: slotContent })
46462
46487
  }
46463
46488
  );
46464
46489
  break;
@@ -46471,12 +46496,12 @@ function SlotPortal({
46471
46496
  title: content.props.title,
46472
46497
  position: content.props.position ?? "right",
46473
46498
  width: content.props.width,
46474
- children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss })
46499
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, children: slotContent })
46475
46500
  }
46476
46501
  );
46477
46502
  break;
46478
46503
  case "toast":
46479
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsxRuntime.jsx(
46504
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsxRuntime.jsx(
46480
46505
  Toast,
46481
46506
  {
46482
46507
  variant: content.props.variant ?? "info",
@@ -46490,17 +46515,18 @@ function SlotPortal({
46490
46515
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(
46491
46516
  Box,
46492
46517
  {
46518
+ id: slotId,
46493
46519
  className: "fixed inset-0 z-50 bg-foreground/50 flex items-center justify-center",
46494
46520
  onClick: onDismiss,
46495
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss }) })
46521
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { onClick: (e) => e.stopPropagation(), children: slotContent })
46496
46522
  }
46497
46523
  );
46498
46524
  break;
46499
46525
  case "center":
46500
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "pointer-events-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss }) }) });
46526
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "pointer-events-auto", children: slotContent }) });
46501
46527
  break;
46502
46528
  default:
46503
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
46529
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(Box, { id: slotId, children: slotContent });
46504
46530
  }
46505
46531
  return reactDom.createPortal(wrapper, portalRoot);
46506
46532
  }
@@ -51178,10 +51204,30 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51178
51204
  const state = newManager.getState(traitName);
51179
51205
  return typeof state === "string" ? state : void 0;
51180
51206
  });
51207
+ const snapshotUnregs = [];
51208
+ for (const binding of traitBindingsRef.current) {
51209
+ const traitName = binding.trait.name;
51210
+ const unreg = registerTraitSnapshot(traitName, () => {
51211
+ const managerState = managerRef.current.getState(traitName);
51212
+ const currentState = managerState?.currentState ?? binding.trait.states[0]?.name ?? "unknown";
51213
+ return {
51214
+ traitName,
51215
+ currentState,
51216
+ states: binding.trait.states.map((s) => s.name),
51217
+ events: binding.trait.events.map((e) => e.key),
51218
+ data: {},
51219
+ cascadeReceived: []
51220
+ };
51221
+ });
51222
+ snapshotUnregs.push(unreg);
51223
+ }
51181
51224
  console.log(
51182
51225
  "[TraitStateMachine] Reset states for page navigation:",
51183
51226
  Array.from(newManager.getAllStates().keys()).join(", ")
51184
51227
  );
51228
+ return () => {
51229
+ for (const unreg of snapshotUnregs) unreg();
51230
+ };
51185
51231
  }, [traitBindings]);
51186
51232
  const runTickEffects = React126.useCallback((tick, binding) => {
51187
51233
  const actions = slotsActionsRef.current;
package/dist/avl/index.js CHANGED
@@ -12052,6 +12052,20 @@ function bindTraitStateGetter(getter) {
12052
12052
  window.__orbitalVerification.getTraitState = getter;
12053
12053
  }
12054
12054
  }
12055
+ function registerTraitSnapshot(traitName, getter) {
12056
+ if (typeof window === "undefined") return () => {
12057
+ };
12058
+ getState().traitSnapshots.set(traitName, getter);
12059
+ exposeOnWindow();
12060
+ notifyListeners();
12061
+ return () => {
12062
+ const s = getState();
12063
+ if (s.traitSnapshots.get(traitName) === getter) {
12064
+ s.traitSnapshots.delete(traitName);
12065
+ notifyListeners();
12066
+ }
12067
+ };
12068
+ }
12055
12069
  function bindCanvasCapture(captureFn) {
12056
12070
  if (typeof window === "undefined") return;
12057
12071
  exposeOnWindow();
@@ -46126,11 +46140,13 @@ function enrichFormFields(fields, entityDef) {
46126
46140
  }
46127
46141
  function renderContainedPortal(slot, content, onDismiss) {
46128
46142
  const slotContent = /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss });
46143
+ const slotId = `slot-${slot}`;
46129
46144
  switch (slot) {
46130
46145
  case "modal":
46131
46146
  return /* @__PURE__ */ jsx(
46132
46147
  Box,
46133
46148
  {
46149
+ id: slotId,
46134
46150
  className: "absolute inset-0 z-50 flex items-start justify-center overflow-auto",
46135
46151
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)", paddingTop: "10%" },
46136
46152
  onClick: onDismiss,
@@ -46167,6 +46183,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46167
46183
  return /* @__PURE__ */ jsx(
46168
46184
  Box,
46169
46185
  {
46186
+ id: slotId,
46170
46187
  className: "absolute inset-0 z-50 overflow-hidden",
46171
46188
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
46172
46189
  onClick: onDismiss,
@@ -46199,7 +46216,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46199
46216
  }
46200
46217
  );
46201
46218
  case "toast":
46202
- return /* @__PURE__ */ jsx(Box, { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
46219
+ return /* @__PURE__ */ jsx(Box, { id: slotId, className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
46203
46220
  Toast,
46204
46221
  {
46205
46222
  variant: content.props.variant ?? "info",
@@ -46212,6 +46229,7 @@ function renderContainedPortal(slot, content, onDismiss) {
46212
46229
  return /* @__PURE__ */ jsx(
46213
46230
  Box,
46214
46231
  {
46232
+ id: slotId,
46215
46233
  className: "absolute inset-0 z-50 flex items-center justify-center overflow-auto",
46216
46234
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
46217
46235
  onClick: onDismiss,
@@ -46219,9 +46237,9 @@ function renderContainedPortal(slot, content, onDismiss) {
46219
46237
  }
46220
46238
  );
46221
46239
  case "center":
46222
- return /* @__PURE__ */ jsx(Box, { className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsx(Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
46240
+ return /* @__PURE__ */ jsx(Box, { id: slotId, className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsx(Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
46223
46241
  default:
46224
- return slotContent;
46242
+ return /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent });
46225
46243
  }
46226
46244
  }
46227
46245
  function UISlotComponent({
@@ -46340,12 +46358,14 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46340
46358
  eventBus.clear(slot);
46341
46359
  };
46342
46360
  if (!portalRoot) return null;
46361
+ const slotId = `slot-${slot}`;
46343
46362
  let wrapper;
46344
46363
  switch (slot) {
46345
46364
  case "modal":
46346
46365
  wrapper = /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsx(
46347
46366
  Box,
46348
46367
  {
46368
+ id: slotId,
46349
46369
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46350
46370
  "data-pattern": pattern,
46351
46371
  "data-source-trait": sourceTrait,
@@ -46357,6 +46377,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46357
46377
  wrapper = /* @__PURE__ */ jsx(Drawer, { isOpen: true, onClose: handleDismiss, position: "right", children: /* @__PURE__ */ jsx(
46358
46378
  Box,
46359
46379
  {
46380
+ id: slotId,
46360
46381
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46361
46382
  "data-pattern": pattern,
46362
46383
  "data-source-trait": sourceTrait,
@@ -46368,6 +46389,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46368
46389
  wrapper = /* @__PURE__ */ jsx(Box, { className: "fixed top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
46369
46390
  Box,
46370
46391
  {
46392
+ id: slotId,
46371
46393
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46372
46394
  "data-pattern": pattern,
46373
46395
  "data-source-trait": sourceTrait,
@@ -46379,6 +46401,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
46379
46401
  wrapper = /* @__PURE__ */ jsx(
46380
46402
  Box,
46381
46403
  {
46404
+ id: slotId,
46382
46405
  className: cn("ui-slot", `ui-slot-${slot}`, className),
46383
46406
  "data-pattern": pattern,
46384
46407
  "data-source-trait": sourceTrait,
@@ -46402,6 +46425,8 @@ function SlotPortal({
46402
46425
  if (portalRoot) getOrCreatePortalRoot();
46403
46426
  });
46404
46427
  if (!portalRoot) return null;
46428
+ const slotId = `slot-${slot}`;
46429
+ const slotContent = /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss });
46405
46430
  let wrapper;
46406
46431
  switch (slot) {
46407
46432
  case "modal":
@@ -46412,7 +46437,7 @@ function SlotPortal({
46412
46437
  onClose: onDismiss,
46413
46438
  title: content.props.title,
46414
46439
  size: content.props.size,
46415
- children: /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss })
46440
+ children: /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent })
46416
46441
  }
46417
46442
  );
46418
46443
  break;
@@ -46425,12 +46450,12 @@ function SlotPortal({
46425
46450
  title: content.props.title,
46426
46451
  position: content.props.position ?? "right",
46427
46452
  width: content.props.width,
46428
- children: /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss })
46453
+ children: /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent })
46429
46454
  }
46430
46455
  );
46431
46456
  break;
46432
46457
  case "toast":
46433
- wrapper = /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsx(
46458
+ wrapper = /* @__PURE__ */ jsx(Box, { id: slotId, className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsx(
46434
46459
  Toast,
46435
46460
  {
46436
46461
  variant: content.props.variant ?? "info",
@@ -46444,17 +46469,18 @@ function SlotPortal({
46444
46469
  wrapper = /* @__PURE__ */ jsx(
46445
46470
  Box,
46446
46471
  {
46472
+ id: slotId,
46447
46473
  className: "fixed inset-0 z-50 bg-foreground/50 flex items-center justify-center",
46448
46474
  onClick: onDismiss,
46449
- children: /* @__PURE__ */ jsx(Box, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss }) })
46475
+ children: /* @__PURE__ */ jsx(Box, { onClick: (e) => e.stopPropagation(), children: slotContent })
46450
46476
  }
46451
46477
  );
46452
46478
  break;
46453
46479
  case "center":
46454
- wrapper = /* @__PURE__ */ jsx(Box, { className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsx(Box, { className: "pointer-events-auto", children: /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss }) }) });
46480
+ wrapper = /* @__PURE__ */ jsx(Box, { id: slotId, className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsx(Box, { className: "pointer-events-auto", children: slotContent }) });
46455
46481
  break;
46456
46482
  default:
46457
- wrapper = /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss });
46483
+ wrapper = /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent });
46458
46484
  }
46459
46485
  return createPortal(wrapper, portalRoot);
46460
46486
  }
@@ -51132,10 +51158,30 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51132
51158
  const state = newManager.getState(traitName);
51133
51159
  return typeof state === "string" ? state : void 0;
51134
51160
  });
51161
+ const snapshotUnregs = [];
51162
+ for (const binding of traitBindingsRef.current) {
51163
+ const traitName = binding.trait.name;
51164
+ const unreg = registerTraitSnapshot(traitName, () => {
51165
+ const managerState = managerRef.current.getState(traitName);
51166
+ const currentState = managerState?.currentState ?? binding.trait.states[0]?.name ?? "unknown";
51167
+ return {
51168
+ traitName,
51169
+ currentState,
51170
+ states: binding.trait.states.map((s) => s.name),
51171
+ events: binding.trait.events.map((e) => e.key),
51172
+ data: {},
51173
+ cascadeReceived: []
51174
+ };
51175
+ });
51176
+ snapshotUnregs.push(unreg);
51177
+ }
51135
51178
  console.log(
51136
51179
  "[TraitStateMachine] Reset states for page navigation:",
51137
51180
  Array.from(newManager.getAllStates().keys()).join(", ")
51138
51181
  );
51182
+ return () => {
51183
+ for (const unreg of snapshotUnregs) unreg();
51184
+ };
51139
51185
  }, [traitBindings]);
51140
51186
  const runTickEffects = useCallback((tick, binding) => {
51141
51187
  const actions = slotsActionsRef.current;
@@ -37136,11 +37136,13 @@ function enrichFormFields(fields, entityDef) {
37136
37136
  }
37137
37137
  function renderContainedPortal(slot, content, onDismiss) {
37138
37138
  const slotContent = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
37139
+ const slotId = `slot-${slot}`;
37139
37140
  switch (slot) {
37140
37141
  case "modal":
37141
37142
  return /* @__PURE__ */ jsxRuntime.jsx(
37142
37143
  exports.Box,
37143
37144
  {
37145
+ id: slotId,
37144
37146
  className: "absolute inset-0 z-50 flex items-start justify-center overflow-auto",
37145
37147
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)", paddingTop: "10%" },
37146
37148
  onClick: onDismiss,
@@ -37177,6 +37179,7 @@ function renderContainedPortal(slot, content, onDismiss) {
37177
37179
  return /* @__PURE__ */ jsxRuntime.jsx(
37178
37180
  exports.Box,
37179
37181
  {
37182
+ id: slotId,
37180
37183
  className: "absolute inset-0 z-50 overflow-hidden",
37181
37184
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
37182
37185
  onClick: onDismiss,
@@ -37209,7 +37212,7 @@ function renderContainedPortal(slot, content, onDismiss) {
37209
37212
  }
37210
37213
  );
37211
37214
  case "toast":
37212
- return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
37215
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
37213
37216
  exports.Toast,
37214
37217
  {
37215
37218
  variant: content.props.variant ?? "info",
@@ -37222,6 +37225,7 @@ function renderContainedPortal(slot, content, onDismiss) {
37222
37225
  return /* @__PURE__ */ jsxRuntime.jsx(
37223
37226
  exports.Box,
37224
37227
  {
37228
+ id: slotId,
37225
37229
  className: "absolute inset-0 z-50 flex items-center justify-center overflow-auto",
37226
37230
  style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
37227
37231
  onClick: onDismiss,
@@ -37229,9 +37233,9 @@ function renderContainedPortal(slot, content, onDismiss) {
37229
37233
  }
37230
37234
  );
37231
37235
  case "center":
37232
- return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
37236
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, className: "absolute inset-0 z-50 flex items-center justify-center pointer-events-none overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "pointer-events-auto max-h-full overflow-auto", children: slotContent }) });
37233
37237
  default:
37234
- return slotContent;
37238
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, children: slotContent });
37235
37239
  }
37236
37240
  }
37237
37241
  function UISlotComponent({
@@ -37350,12 +37354,14 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
37350
37354
  eventBus.clear(slot);
37351
37355
  };
37352
37356
  if (!portalRoot) return null;
37357
+ const slotId = `slot-${slot}`;
37353
37358
  let wrapper;
37354
37359
  switch (slot) {
37355
37360
  case "modal":
37356
37361
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsxRuntime.jsx(
37357
37362
  exports.Box,
37358
37363
  {
37364
+ id: slotId,
37359
37365
  className: cn("ui-slot", `ui-slot-${slot}`, className),
37360
37366
  "data-pattern": pattern,
37361
37367
  "data-source-trait": sourceTrait,
@@ -37367,6 +37373,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
37367
37373
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Drawer, { isOpen: true, onClose: handleDismiss, position: "right", children: /* @__PURE__ */ jsxRuntime.jsx(
37368
37374
  exports.Box,
37369
37375
  {
37376
+ id: slotId,
37370
37377
  className: cn("ui-slot", `ui-slot-${slot}`, className),
37371
37378
  "data-pattern": pattern,
37372
37379
  "data-source-trait": sourceTrait,
@@ -37378,6 +37385,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
37378
37385
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "fixed top-4 right-4 z-50", children: /* @__PURE__ */ jsxRuntime.jsx(
37379
37386
  exports.Box,
37380
37387
  {
37388
+ id: slotId,
37381
37389
  className: cn("ui-slot", `ui-slot-${slot}`, className),
37382
37390
  "data-pattern": pattern,
37383
37391
  "data-source-trait": sourceTrait,
@@ -37389,6 +37397,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
37389
37397
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(
37390
37398
  exports.Box,
37391
37399
  {
37400
+ id: slotId,
37392
37401
  className: cn("ui-slot", `ui-slot-${slot}`, className),
37393
37402
  "data-pattern": pattern,
37394
37403
  "data-source-trait": sourceTrait,
@@ -37412,6 +37421,8 @@ function SlotPortal({
37412
37421
  if (portalRoot) getOrCreatePortalRoot();
37413
37422
  });
37414
37423
  if (!portalRoot) return null;
37424
+ const slotId = `slot-${slot}`;
37425
+ const slotContent = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
37415
37426
  let wrapper;
37416
37427
  switch (slot) {
37417
37428
  case "modal":
@@ -37422,7 +37433,7 @@ function SlotPortal({
37422
37433
  onClose: onDismiss,
37423
37434
  title: content.props.title,
37424
37435
  size: content.props.size,
37425
- children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss })
37436
+ children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, children: slotContent })
37426
37437
  }
37427
37438
  );
37428
37439
  break;
@@ -37435,12 +37446,12 @@ function SlotPortal({
37435
37446
  title: content.props.title,
37436
37447
  position: content.props.position ?? "right",
37437
37448
  width: content.props.width,
37438
- children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss })
37449
+ children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, children: slotContent })
37439
37450
  }
37440
37451
  );
37441
37452
  break;
37442
37453
  case "toast":
37443
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsxRuntime.jsx(
37454
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsxRuntime.jsx(
37444
37455
  exports.Toast,
37445
37456
  {
37446
37457
  variant: content.props.variant ?? "info",
@@ -37454,17 +37465,18 @@ function SlotPortal({
37454
37465
  wrapper = /* @__PURE__ */ jsxRuntime.jsx(
37455
37466
  exports.Box,
37456
37467
  {
37468
+ id: slotId,
37457
37469
  className: "fixed inset-0 z-50 bg-foreground/50 flex items-center justify-center",
37458
37470
  onClick: onDismiss,
37459
- children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss }) })
37471
+ children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { onClick: (e) => e.stopPropagation(), children: slotContent })
37460
37472
  }
37461
37473
  );
37462
37474
  break;
37463
37475
  case "center":
37464
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "pointer-events-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss }) }) });
37476
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, className: "fixed inset-0 z-50 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "pointer-events-auto", children: slotContent }) });
37465
37477
  break;
37466
37478
  default:
37467
- wrapper = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content, onDismiss });
37479
+ wrapper = /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { id: slotId, children: slotContent });
37468
37480
  }
37469
37481
  return reactDom.createPortal(wrapper, portalRoot);
37470
37482
  }