@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.
- package/dist/avl/index.cjs +55 -9
- package/dist/avl/index.js +55 -9
- package/dist/components/index.cjs +21 -9
- package/dist/components/index.js +21 -9
- package/dist/providers/index.cjs +21 -9
- package/dist/providers/index.js +21 -9
- package/dist/runtime/index.cjs +55 -9
- package/dist/runtime/index.js +55 -9
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -1003,6 +1003,20 @@ function bindTraitStateGetter(getter) {
|
|
|
1003
1003
|
window.__orbitalVerification.getTraitState = getter;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
|
+
function registerTraitSnapshot(traitName, getter) {
|
|
1007
|
+
if (typeof window === "undefined") return () => {
|
|
1008
|
+
};
|
|
1009
|
+
getState().traitSnapshots.set(traitName, getter);
|
|
1010
|
+
exposeOnWindow();
|
|
1011
|
+
notifyListeners2();
|
|
1012
|
+
return () => {
|
|
1013
|
+
const s = getState();
|
|
1014
|
+
if (s.traitSnapshots.get(traitName) === getter) {
|
|
1015
|
+
s.traitSnapshots.delete(traitName);
|
|
1016
|
+
notifyListeners2();
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1006
1020
|
function bindCanvasCapture(captureFn) {
|
|
1007
1021
|
if (typeof window === "undefined") return;
|
|
1008
1022
|
exposeOnWindow();
|
|
@@ -37172,11 +37186,13 @@ function enrichFormFields(fields, entityDef) {
|
|
|
37172
37186
|
}
|
|
37173
37187
|
function renderContainedPortal(slot, content, onDismiss) {
|
|
37174
37188
|
const slotContent = /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss });
|
|
37189
|
+
const slotId = `slot-${slot}`;
|
|
37175
37190
|
switch (slot) {
|
|
37176
37191
|
case "modal":
|
|
37177
37192
|
return /* @__PURE__ */ jsx(
|
|
37178
37193
|
Box,
|
|
37179
37194
|
{
|
|
37195
|
+
id: slotId,
|
|
37180
37196
|
className: "absolute inset-0 z-50 flex items-start justify-center overflow-auto",
|
|
37181
37197
|
style: { backgroundColor: "rgba(0, 0, 0, 0.5)", paddingTop: "10%" },
|
|
37182
37198
|
onClick: onDismiss,
|
|
@@ -37213,6 +37229,7 @@ function renderContainedPortal(slot, content, onDismiss) {
|
|
|
37213
37229
|
return /* @__PURE__ */ jsx(
|
|
37214
37230
|
Box,
|
|
37215
37231
|
{
|
|
37232
|
+
id: slotId,
|
|
37216
37233
|
className: "absolute inset-0 z-50 overflow-hidden",
|
|
37217
37234
|
style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
|
|
37218
37235
|
onClick: onDismiss,
|
|
@@ -37245,7 +37262,7 @@ function renderContainedPortal(slot, content, onDismiss) {
|
|
|
37245
37262
|
}
|
|
37246
37263
|
);
|
|
37247
37264
|
case "toast":
|
|
37248
|
-
return /* @__PURE__ */ jsx(Box, { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
|
|
37265
|
+
return /* @__PURE__ */ jsx(Box, { id: slotId, className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
|
|
37249
37266
|
Toast,
|
|
37250
37267
|
{
|
|
37251
37268
|
variant: content.props.variant ?? "info",
|
|
@@ -37258,6 +37275,7 @@ function renderContainedPortal(slot, content, onDismiss) {
|
|
|
37258
37275
|
return /* @__PURE__ */ jsx(
|
|
37259
37276
|
Box,
|
|
37260
37277
|
{
|
|
37278
|
+
id: slotId,
|
|
37261
37279
|
className: "absolute inset-0 z-50 flex items-center justify-center overflow-auto",
|
|
37262
37280
|
style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
|
|
37263
37281
|
onClick: onDismiss,
|
|
@@ -37265,9 +37283,9 @@ function renderContainedPortal(slot, content, onDismiss) {
|
|
|
37265
37283
|
}
|
|
37266
37284
|
);
|
|
37267
37285
|
case "center":
|
|
37268
|
-
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 }) });
|
|
37286
|
+
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 }) });
|
|
37269
37287
|
default:
|
|
37270
|
-
return slotContent;
|
|
37288
|
+
return /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent });
|
|
37271
37289
|
}
|
|
37272
37290
|
}
|
|
37273
37291
|
function UISlotComponent({
|
|
@@ -37386,12 +37404,14 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
|
37386
37404
|
eventBus.clear(slot);
|
|
37387
37405
|
};
|
|
37388
37406
|
if (!portalRoot) return null;
|
|
37407
|
+
const slotId = `slot-${slot}`;
|
|
37389
37408
|
let wrapper;
|
|
37390
37409
|
switch (slot) {
|
|
37391
37410
|
case "modal":
|
|
37392
37411
|
wrapper = /* @__PURE__ */ jsx(Modal, { isOpen: true, onClose: handleDismiss, showCloseButton: true, size: "lg", children: /* @__PURE__ */ jsx(
|
|
37393
37412
|
Box,
|
|
37394
37413
|
{
|
|
37414
|
+
id: slotId,
|
|
37395
37415
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37396
37416
|
"data-pattern": pattern,
|
|
37397
37417
|
"data-source-trait": sourceTrait,
|
|
@@ -37403,6 +37423,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
|
37403
37423
|
wrapper = /* @__PURE__ */ jsx(Drawer, { isOpen: true, onClose: handleDismiss, position: "right", children: /* @__PURE__ */ jsx(
|
|
37404
37424
|
Box,
|
|
37405
37425
|
{
|
|
37426
|
+
id: slotId,
|
|
37406
37427
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37407
37428
|
"data-pattern": pattern,
|
|
37408
37429
|
"data-source-trait": sourceTrait,
|
|
@@ -37414,6 +37435,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
|
37414
37435
|
wrapper = /* @__PURE__ */ jsx(Box, { className: "fixed top-4 right-4 z-50", children: /* @__PURE__ */ jsx(
|
|
37415
37436
|
Box,
|
|
37416
37437
|
{
|
|
37438
|
+
id: slotId,
|
|
37417
37439
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37418
37440
|
"data-pattern": pattern,
|
|
37419
37441
|
"data-source-trait": sourceTrait,
|
|
@@ -37425,6 +37447,7 @@ function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
|
37425
37447
|
wrapper = /* @__PURE__ */ jsx(
|
|
37426
37448
|
Box,
|
|
37427
37449
|
{
|
|
37450
|
+
id: slotId,
|
|
37428
37451
|
className: cn("ui-slot", `ui-slot-${slot}`, className),
|
|
37429
37452
|
"data-pattern": pattern,
|
|
37430
37453
|
"data-source-trait": sourceTrait,
|
|
@@ -37448,6 +37471,8 @@ function SlotPortal({
|
|
|
37448
37471
|
if (portalRoot) getOrCreatePortalRoot();
|
|
37449
37472
|
});
|
|
37450
37473
|
if (!portalRoot) return null;
|
|
37474
|
+
const slotId = `slot-${slot}`;
|
|
37475
|
+
const slotContent = /* @__PURE__ */ jsx(SlotContentRenderer, { content, onDismiss });
|
|
37451
37476
|
let wrapper;
|
|
37452
37477
|
switch (slot) {
|
|
37453
37478
|
case "modal":
|
|
@@ -37458,7 +37483,7 @@ function SlotPortal({
|
|
|
37458
37483
|
onClose: onDismiss,
|
|
37459
37484
|
title: content.props.title,
|
|
37460
37485
|
size: content.props.size,
|
|
37461
|
-
children: /* @__PURE__ */ jsx(
|
|
37486
|
+
children: /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent })
|
|
37462
37487
|
}
|
|
37463
37488
|
);
|
|
37464
37489
|
break;
|
|
@@ -37471,12 +37496,12 @@ function SlotPortal({
|
|
|
37471
37496
|
title: content.props.title,
|
|
37472
37497
|
position: content.props.position ?? "right",
|
|
37473
37498
|
width: content.props.width,
|
|
37474
|
-
children: /* @__PURE__ */ jsx(
|
|
37499
|
+
children: /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent })
|
|
37475
37500
|
}
|
|
37476
37501
|
);
|
|
37477
37502
|
break;
|
|
37478
37503
|
case "toast":
|
|
37479
|
-
wrapper = /* @__PURE__ */ jsx(Box, { className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsx(
|
|
37504
|
+
wrapper = /* @__PURE__ */ jsx(Box, { id: slotId, className: cn("fixed z-50", getToastPosition(position)), children: /* @__PURE__ */ jsx(
|
|
37480
37505
|
Toast,
|
|
37481
37506
|
{
|
|
37482
37507
|
variant: content.props.variant ?? "info",
|
|
@@ -37490,17 +37515,18 @@ function SlotPortal({
|
|
|
37490
37515
|
wrapper = /* @__PURE__ */ jsx(
|
|
37491
37516
|
Box,
|
|
37492
37517
|
{
|
|
37518
|
+
id: slotId,
|
|
37493
37519
|
className: "fixed inset-0 z-50 bg-foreground/50 flex items-center justify-center",
|
|
37494
37520
|
onClick: onDismiss,
|
|
37495
|
-
children: /* @__PURE__ */ jsx(Box, { onClick: (e) => e.stopPropagation(), children:
|
|
37521
|
+
children: /* @__PURE__ */ jsx(Box, { onClick: (e) => e.stopPropagation(), children: slotContent })
|
|
37496
37522
|
}
|
|
37497
37523
|
);
|
|
37498
37524
|
break;
|
|
37499
37525
|
case "center":
|
|
37500
|
-
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:
|
|
37526
|
+
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 }) });
|
|
37501
37527
|
break;
|
|
37502
37528
|
default:
|
|
37503
|
-
wrapper = /* @__PURE__ */ jsx(
|
|
37529
|
+
wrapper = /* @__PURE__ */ jsx(Box, { id: slotId, children: slotContent });
|
|
37504
37530
|
}
|
|
37505
37531
|
return createPortal(wrapper, portalRoot);
|
|
37506
37532
|
}
|
|
@@ -37929,10 +37955,30 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
37929
37955
|
const state = newManager.getState(traitName);
|
|
37930
37956
|
return typeof state === "string" ? state : void 0;
|
|
37931
37957
|
});
|
|
37958
|
+
const snapshotUnregs = [];
|
|
37959
|
+
for (const binding of traitBindingsRef.current) {
|
|
37960
|
+
const traitName = binding.trait.name;
|
|
37961
|
+
const unreg = registerTraitSnapshot(traitName, () => {
|
|
37962
|
+
const managerState = managerRef.current.getState(traitName);
|
|
37963
|
+
const currentState = managerState?.currentState ?? binding.trait.states[0]?.name ?? "unknown";
|
|
37964
|
+
return {
|
|
37965
|
+
traitName,
|
|
37966
|
+
currentState,
|
|
37967
|
+
states: binding.trait.states.map((s) => s.name),
|
|
37968
|
+
events: binding.trait.events.map((e) => e.key),
|
|
37969
|
+
data: {},
|
|
37970
|
+
cascadeReceived: []
|
|
37971
|
+
};
|
|
37972
|
+
});
|
|
37973
|
+
snapshotUnregs.push(unreg);
|
|
37974
|
+
}
|
|
37932
37975
|
console.log(
|
|
37933
37976
|
"[TraitStateMachine] Reset states for page navigation:",
|
|
37934
37977
|
Array.from(newManager.getAllStates().keys()).join(", ")
|
|
37935
37978
|
);
|
|
37979
|
+
return () => {
|
|
37980
|
+
for (const unreg of snapshotUnregs) unreg();
|
|
37981
|
+
};
|
|
37936
37982
|
}, [traitBindings]);
|
|
37937
37983
|
const runTickEffects = useCallback((tick, binding) => {
|
|
37938
37984
|
const actions = slotsActionsRef.current;
|