@almadar/ui 6.19.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.
- package/dist/{EntityBindingContext-Dglbi9ks.d.cts → EntityBindingContext-DoK8Xq71.d.cts} +13 -3
- package/dist/{EntityBindingContext-Dglbi9ks.d.ts → EntityBindingContext-DoK8Xq71.d.ts} +13 -3
- package/dist/avl/index.cjs +49 -29
- package/dist/avl/index.js +49 -29
- package/dist/components/index.cjs +50 -28
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +50 -28
- package/dist/providers/index.cjs +70 -30
- package/dist/providers/index.d.cts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +70 -30
- package/dist/runtime/index.cjs +49 -29
- package/dist/runtime/index.d.cts +25 -5
- package/dist/runtime/index.d.ts +25 -5
- package/dist/runtime/index.js +49 -29
- package/package.json +3 -3
package/dist/runtime/index.cjs
CHANGED
|
@@ -2176,6 +2176,36 @@ var init_Typography = __esm({
|
|
|
2176
2176
|
Typography.displayName = "Typography";
|
|
2177
2177
|
}
|
|
2178
2178
|
});
|
|
2179
|
+
|
|
2180
|
+
// lib/portalRoot.ts
|
|
2181
|
+
function lastThemedElement(selector, portalRoot) {
|
|
2182
|
+
const matches = Array.from(document.querySelectorAll(selector)).filter(
|
|
2183
|
+
(el) => el !== document.documentElement && el !== portalRoot
|
|
2184
|
+
);
|
|
2185
|
+
return matches[matches.length - 1] ?? null;
|
|
2186
|
+
}
|
|
2187
|
+
function getOrCreatePortalRoot() {
|
|
2188
|
+
let root = document.getElementById("ui-slot-portal-root");
|
|
2189
|
+
if (!root) {
|
|
2190
|
+
root = document.createElement("div");
|
|
2191
|
+
root.id = "ui-slot-portal-root";
|
|
2192
|
+
root.style.position = "relative";
|
|
2193
|
+
root.style.zIndex = "9999";
|
|
2194
|
+
document.body.appendChild(root);
|
|
2195
|
+
}
|
|
2196
|
+
const themed = lastThemedElement('[data-theme*="-"]', root) ?? lastThemedElement("[data-theme]", root);
|
|
2197
|
+
if (themed) {
|
|
2198
|
+
const theme = themed.getAttribute("data-theme");
|
|
2199
|
+
if (theme && root.getAttribute("data-theme") !== theme) {
|
|
2200
|
+
root.setAttribute("data-theme", theme);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
return root;
|
|
2204
|
+
}
|
|
2205
|
+
var init_portalRoot = __esm({
|
|
2206
|
+
"lib/portalRoot.ts"() {
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2179
2209
|
function isMotionEnabled() {
|
|
2180
2210
|
if (typeof document === "undefined") return true;
|
|
2181
2211
|
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
@@ -2256,6 +2286,7 @@ var init_Modal = __esm({
|
|
|
2256
2286
|
init_Dialog();
|
|
2257
2287
|
init_Typography();
|
|
2258
2288
|
init_cn();
|
|
2289
|
+
init_portalRoot();
|
|
2259
2290
|
init_useEventBus();
|
|
2260
2291
|
init_Presence();
|
|
2261
2292
|
sizeClasses2 = {
|
|
@@ -2466,7 +2497,7 @@ var init_Modal = __esm({
|
|
|
2466
2497
|
)
|
|
2467
2498
|
}
|
|
2468
2499
|
),
|
|
2469
|
-
|
|
2500
|
+
getOrCreatePortalRoot()
|
|
2470
2501
|
);
|
|
2471
2502
|
};
|
|
2472
2503
|
Modal.displayName = "Modal";
|
|
@@ -20532,6 +20563,7 @@ var init_StateMachineView = __esm({
|
|
|
20532
20563
|
init_Icon();
|
|
20533
20564
|
init_useEventBus();
|
|
20534
20565
|
init_cn();
|
|
20566
|
+
init_portalRoot();
|
|
20535
20567
|
StateNode2 = ({ state, config }) => {
|
|
20536
20568
|
const { t } = hooks.useTranslate();
|
|
20537
20569
|
const size = state.radius * 2;
|
|
@@ -21048,7 +21080,7 @@ var init_StateMachineView = __esm({
|
|
|
21048
21080
|
)
|
|
21049
21081
|
}
|
|
21050
21082
|
),
|
|
21051
|
-
|
|
21083
|
+
getOrCreatePortalRoot()
|
|
21052
21084
|
);
|
|
21053
21085
|
};
|
|
21054
21086
|
EntityBox = ({ entity, config }) => {
|
|
@@ -27608,7 +27640,7 @@ function SubMenu({
|
|
|
27608
27640
|
})
|
|
27609
27641
|
}
|
|
27610
27642
|
);
|
|
27611
|
-
return typeof document !== "undefined" ? reactDom.createPortal(panel,
|
|
27643
|
+
return typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel;
|
|
27612
27644
|
}
|
|
27613
27645
|
function MenuItemRow({
|
|
27614
27646
|
item,
|
|
@@ -27695,6 +27727,7 @@ var init_Menu = __esm({
|
|
|
27695
27727
|
init_Typography();
|
|
27696
27728
|
init_Badge();
|
|
27697
27729
|
init_cn();
|
|
27730
|
+
init_portalRoot();
|
|
27698
27731
|
init_useEventBus();
|
|
27699
27732
|
MENU_GAP = 4;
|
|
27700
27733
|
menuContainerStyles = cn(
|
|
@@ -27831,7 +27864,7 @@ var init_Menu = __esm({
|
|
|
27831
27864
|
) : null;
|
|
27832
27865
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
27833
27866
|
triggerElement,
|
|
27834
|
-
panel && typeof document !== "undefined" ? reactDom.createPortal(panel,
|
|
27867
|
+
panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
|
|
27835
27868
|
] });
|
|
27836
27869
|
};
|
|
27837
27870
|
Menu.displayName = "Menu";
|
|
@@ -31045,6 +31078,7 @@ var init_Popover = __esm({
|
|
|
31045
31078
|
init_Typography();
|
|
31046
31079
|
init_Presence();
|
|
31047
31080
|
init_cn();
|
|
31081
|
+
init_portalRoot();
|
|
31048
31082
|
init_useTapReveal();
|
|
31049
31083
|
arrowClasses = {
|
|
31050
31084
|
top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
|
|
@@ -31204,7 +31238,7 @@ var init_Popover = __esm({
|
|
|
31204
31238
|
) : null;
|
|
31205
31239
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
31206
31240
|
triggerElement,
|
|
31207
|
-
panel && typeof document !== "undefined" ? reactDom.createPortal(panel,
|
|
31241
|
+
panel && typeof document !== "undefined" ? reactDom.createPortal(panel, getOrCreatePortalRoot()) : panel
|
|
31208
31242
|
] });
|
|
31209
31243
|
};
|
|
31210
31244
|
Popover.displayName = "Popover";
|
|
@@ -31710,6 +31744,7 @@ var init_Tooltip = __esm({
|
|
|
31710
31744
|
"use client";
|
|
31711
31745
|
init_Typography();
|
|
31712
31746
|
init_cn();
|
|
31747
|
+
init_portalRoot();
|
|
31713
31748
|
init_useTapReveal();
|
|
31714
31749
|
TRIGGER_GAP2 = 8;
|
|
31715
31750
|
arrowClasses2 = {
|
|
@@ -31815,7 +31850,7 @@ var init_Tooltip = __esm({
|
|
|
31815
31850
|
) : null;
|
|
31816
31851
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
31817
31852
|
trigger,
|
|
31818
|
-
typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent,
|
|
31853
|
+
typeof window !== "undefined" && tooltipContent ? reactDom.createPortal(tooltipContent, getOrCreatePortalRoot()) : tooltipContent
|
|
31819
31854
|
] });
|
|
31820
31855
|
};
|
|
31821
31856
|
Tooltip.displayName = "Tooltip";
|
|
@@ -43097,6 +43132,7 @@ var init_GraphCanvas = __esm({
|
|
|
43097
43132
|
"components/core/molecules/GraphCanvas.tsx"() {
|
|
43098
43133
|
"use client";
|
|
43099
43134
|
init_cn();
|
|
43135
|
+
init_portalRoot();
|
|
43100
43136
|
init_atoms();
|
|
43101
43137
|
init_Stack();
|
|
43102
43138
|
init_LoadingState();
|
|
@@ -43808,7 +43844,7 @@ var init_GraphCanvas = __esm({
|
|
|
43808
43844
|
children: hoveredObj?.label
|
|
43809
43845
|
}
|
|
43810
43846
|
),
|
|
43811
|
-
|
|
43847
|
+
getOrCreatePortalRoot()
|
|
43812
43848
|
)
|
|
43813
43849
|
] }),
|
|
43814
43850
|
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: [
|
|
@@ -44969,6 +45005,7 @@ var init_DetailPanel = __esm({
|
|
|
44969
45005
|
init_ErrorState();
|
|
44970
45006
|
init_EmptyState();
|
|
44971
45007
|
init_cn();
|
|
45008
|
+
init_portalRoot();
|
|
44972
45009
|
init_format();
|
|
44973
45010
|
init_getNestedValue();
|
|
44974
45011
|
init_relationLabel();
|
|
@@ -45388,7 +45425,7 @@ var init_DetailPanel = __esm({
|
|
|
45388
45425
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, children: content });
|
|
45389
45426
|
}
|
|
45390
45427
|
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 });
|
|
45391
|
-
return typeof document === "undefined" ? panel : reactDom.createPortal(panel,
|
|
45428
|
+
return typeof document === "undefined" ? panel : reactDom.createPortal(panel, getOrCreatePortalRoot());
|
|
45392
45429
|
};
|
|
45393
45430
|
DetailPanel.displayName = "DetailPanel";
|
|
45394
45431
|
}
|
|
@@ -52298,24 +52335,6 @@ function UISlotComponentInner({
|
|
|
52298
52335
|
}
|
|
52299
52336
|
);
|
|
52300
52337
|
}
|
|
52301
|
-
function getOrCreatePortalRoot() {
|
|
52302
|
-
let root = document.getElementById("ui-slot-portal-root");
|
|
52303
|
-
if (!root) {
|
|
52304
|
-
root = document.createElement("div");
|
|
52305
|
-
root.id = "ui-slot-portal-root";
|
|
52306
|
-
root.style.position = "relative";
|
|
52307
|
-
root.style.zIndex = "9999";
|
|
52308
|
-
document.body.appendChild(root);
|
|
52309
|
-
}
|
|
52310
|
-
const themed = document.querySelector('[data-theme*="-"]') ?? document.querySelector("[data-theme]");
|
|
52311
|
-
if (themed) {
|
|
52312
|
-
const theme = themed.getAttribute("data-theme");
|
|
52313
|
-
if (theme && root.getAttribute("data-theme") !== theme) {
|
|
52314
|
-
root.setAttribute("data-theme", theme);
|
|
52315
|
-
}
|
|
52316
|
-
}
|
|
52317
|
-
return root;
|
|
52318
|
-
}
|
|
52319
52338
|
function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
52320
52339
|
const [portalRoot, setPortalRoot] = React87.useState(null);
|
|
52321
52340
|
const slotsBus = context.useUISlots();
|
|
@@ -52938,6 +52957,7 @@ var init_UISlotRenderer = __esm({
|
|
|
52938
52957
|
init_slot_types();
|
|
52939
52958
|
init_cn();
|
|
52940
52959
|
init_format();
|
|
52960
|
+
init_portalRoot();
|
|
52941
52961
|
init_ErrorBoundary();
|
|
52942
52962
|
init_Skeleton();
|
|
52943
52963
|
init_renderer();
|
|
@@ -54332,7 +54352,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
54332
54352
|
}
|
|
54333
54353
|
const relayPayload = targetTrait !== void 0 ? { ...payload ?? {}, _targetTrait: targetTrait } : payload;
|
|
54334
54354
|
const locallyEmitted = Array.from(emittedByTrait.values()).flat();
|
|
54335
|
-
void onEventProcessed(normalizedEvent, relayPayload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted);
|
|
54355
|
+
void onEventProcessed(normalizedEvent, relayPayload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait);
|
|
54336
54356
|
}
|
|
54337
54357
|
ui.perfEnd("processEvent:total", _perfT0);
|
|
54338
54358
|
ui.perfEnd(`event:${normalizedEvent}`, _perfT0);
|
|
@@ -54770,7 +54790,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
54770
54790
|
[serverActiveTraits]
|
|
54771
54791
|
);
|
|
54772
54792
|
const uiSlots = context.useUISlots();
|
|
54773
|
-
const onEventProcessed = React87.useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted) => {
|
|
54793
|
+
const onEventProcessed = React87.useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait) => {
|
|
54774
54794
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
54775
54795
|
const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
|
|
54776
54796
|
xOrbitalLog.debug("TraitInitializer:fanout", () => ({
|
|
@@ -54784,7 +54804,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
54784
54804
|
void bridge.sendEvent(name, event, withActiveTraits(payload), tick, sourceTrait);
|
|
54785
54805
|
continue;
|
|
54786
54806
|
}
|
|
54787
|
-
void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted).then(({ effects, meta }) => {
|
|
54807
|
+
void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait).then(({ effects, meta }) => {
|
|
54788
54808
|
recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
|
|
54789
54809
|
applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNames, onNavigateBack);
|
|
54790
54810
|
});
|
package/dist/runtime/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _almadar_core from '@almadar/core';
|
|
2
|
-
import { EventPayload, ServiceParams, ResolvedTraitBinding, ResolvedPage, ResolvedEntity, ResolvedTrait, ResolvedIR, OrbitalSchema, PatternConfig, ResolvedPatternProps, EventSource, SExpr, BusEventSource,
|
|
2
|
+
import { EventPayload, EntityRow, ServiceParams, ResolvedTraitBinding, ResolvedPage, ResolvedEntity, ResolvedTrait, ResolvedIR, OrbitalSchema, PatternConfig, ResolvedPatternProps, EventSource, SExpr, BusEventSource, EntityData } from '@almadar/core';
|
|
3
3
|
export { ResolvedEntity, ResolvedIR, ResolvedPage, ResolvedTrait, ResolvedTraitBinding } from '@almadar/core';
|
|
4
4
|
import * as _almadar_runtime from '@almadar/runtime';
|
|
5
|
-
import { TraitState, EffectHandlers } from '@almadar/runtime';
|
|
5
|
+
import { TraitState, TransitionResult, EffectHandlers } from '@almadar/runtime';
|
|
6
6
|
import { K as KeyCaptureTable } from '../useKeyboardRouter-CVn8lfiX.cjs';
|
|
7
7
|
import { c as useUISlots } from '../UISlotContext-BlRDbHDy.cjs';
|
|
8
|
-
import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-
|
|
9
|
-
export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-
|
|
8
|
+
import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-DoK8Xq71.cjs';
|
|
9
|
+
export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-DoK8Xq71.cjs';
|
|
10
10
|
import '../verificationRegistry-DTrKDRoa.cjs';
|
|
11
11
|
export { PERF_NAMESPACE, PerfEntry, PreparedPreviewSchema, adjustSchemaForMockData, buildMockData, clearPerf, perfEnd, perfStart, perfTime, prepareSchemaForPreview, wrapCallbackForEvent } from '@almadar/runtime/ui';
|
|
12
12
|
import React__default, { ReactNode } from 'react';
|
|
@@ -54,7 +54,27 @@ interface UseTraitStateMachineOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
tick?: string, sourceTrait?: string,
|
|
56
56
|
/** Every event name this dispatch's local effect execution emitted, one entry per emit (multiplicity matters — see `stampLocallyDeliveredEchoes`). */
|
|
57
|
-
locallyEmitted?: readonly string[]
|
|
57
|
+
locallyEmitted?: readonly string[],
|
|
58
|
+
/**
|
|
59
|
+
* Every trait whose LOCAL dispatch actually executed a transition
|
|
60
|
+
* for this event (Part G, stateless dual-execution) — always a
|
|
61
|
+
* subset of successfully-transitioned traits, never filtered
|
|
62
|
+
* further here. A stateless server consults this instead of
|
|
63
|
+
* rediscovering "which traits match this event" against its own
|
|
64
|
+
* shared state.
|
|
65
|
+
*/
|
|
66
|
+
results?: ReadonlyArray<{
|
|
67
|
+
traitName: string;
|
|
68
|
+
result: TransitionResult;
|
|
69
|
+
}>,
|
|
70
|
+
/**
|
|
71
|
+
* The client's own current entity snapshot per trait (built the
|
|
72
|
+
* same way as the `entityByTrait` already passed to
|
|
73
|
+
* `currentManager.sendEvent` above) — the input a stateless server
|
|
74
|
+
* needs for `[runtime]`-persistence entities, which have nowhere
|
|
75
|
+
* else to live.
|
|
76
|
+
*/
|
|
77
|
+
entityByTrait?: Readonly<Record<string, EntityRow>>) => void | Promise<void>;
|
|
58
78
|
/** Router navigate function for navigate effects. `crumb` labels the
|
|
59
79
|
* target page's navigation-stack entry (from the effect's options). */
|
|
60
80
|
navigate?: (path: string, params?: Record<string, string>, crumb?: string) => void;
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _almadar_core from '@almadar/core';
|
|
2
|
-
import { EventPayload, ServiceParams, ResolvedTraitBinding, ResolvedPage, ResolvedEntity, ResolvedTrait, ResolvedIR, OrbitalSchema, PatternConfig, ResolvedPatternProps, EventSource, SExpr, BusEventSource,
|
|
2
|
+
import { EventPayload, EntityRow, ServiceParams, ResolvedTraitBinding, ResolvedPage, ResolvedEntity, ResolvedTrait, ResolvedIR, OrbitalSchema, PatternConfig, ResolvedPatternProps, EventSource, SExpr, BusEventSource, EntityData } from '@almadar/core';
|
|
3
3
|
export { ResolvedEntity, ResolvedIR, ResolvedPage, ResolvedTrait, ResolvedTraitBinding } from '@almadar/core';
|
|
4
4
|
import * as _almadar_runtime from '@almadar/runtime';
|
|
5
|
-
import { TraitState, EffectHandlers } from '@almadar/runtime';
|
|
5
|
+
import { TraitState, TransitionResult, EffectHandlers } from '@almadar/runtime';
|
|
6
6
|
import { K as KeyCaptureTable } from '../useKeyboardRouter-B1pIi9jo.js';
|
|
7
7
|
import { c as useUISlots } from '../UISlotContext-CB89mv7N.js';
|
|
8
|
-
import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-
|
|
9
|
-
export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-
|
|
8
|
+
import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-DoK8Xq71.js';
|
|
9
|
+
export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-DoK8Xq71.js';
|
|
10
10
|
import '../verificationRegistry-Cwa52VyK.js';
|
|
11
11
|
export { PERF_NAMESPACE, PerfEntry, PreparedPreviewSchema, adjustSchemaForMockData, buildMockData, clearPerf, perfEnd, perfStart, perfTime, prepareSchemaForPreview, wrapCallbackForEvent } from '@almadar/runtime/ui';
|
|
12
12
|
import React__default, { ReactNode } from 'react';
|
|
@@ -54,7 +54,27 @@ interface UseTraitStateMachineOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
tick?: string, sourceTrait?: string,
|
|
56
56
|
/** Every event name this dispatch's local effect execution emitted, one entry per emit (multiplicity matters — see `stampLocallyDeliveredEchoes`). */
|
|
57
|
-
locallyEmitted?: readonly string[]
|
|
57
|
+
locallyEmitted?: readonly string[],
|
|
58
|
+
/**
|
|
59
|
+
* Every trait whose LOCAL dispatch actually executed a transition
|
|
60
|
+
* for this event (Part G, stateless dual-execution) — always a
|
|
61
|
+
* subset of successfully-transitioned traits, never filtered
|
|
62
|
+
* further here. A stateless server consults this instead of
|
|
63
|
+
* rediscovering "which traits match this event" against its own
|
|
64
|
+
* shared state.
|
|
65
|
+
*/
|
|
66
|
+
results?: ReadonlyArray<{
|
|
67
|
+
traitName: string;
|
|
68
|
+
result: TransitionResult;
|
|
69
|
+
}>,
|
|
70
|
+
/**
|
|
71
|
+
* The client's own current entity snapshot per trait (built the
|
|
72
|
+
* same way as the `entityByTrait` already passed to
|
|
73
|
+
* `currentManager.sendEvent` above) — the input a stateless server
|
|
74
|
+
* needs for `[runtime]`-persistence entities, which have nowhere
|
|
75
|
+
* else to live.
|
|
76
|
+
*/
|
|
77
|
+
entityByTrait?: Readonly<Record<string, EntityRow>>) => void | Promise<void>;
|
|
58
78
|
/** Router navigate function for navigate effects. `crumb` labels the
|
|
59
79
|
* target page's navigation-stack entry (from the effect's options). */
|
|
60
80
|
navigate?: (path: string, params?: Record<string, string>, crumb?: string) => void;
|
package/dist/runtime/index.js
CHANGED
|
@@ -2102,6 +2102,36 @@ var init_Typography = __esm({
|
|
|
2102
2102
|
Typography.displayName = "Typography";
|
|
2103
2103
|
}
|
|
2104
2104
|
});
|
|
2105
|
+
|
|
2106
|
+
// lib/portalRoot.ts
|
|
2107
|
+
function lastThemedElement(selector, portalRoot) {
|
|
2108
|
+
const matches = Array.from(document.querySelectorAll(selector)).filter(
|
|
2109
|
+
(el) => el !== document.documentElement && el !== portalRoot
|
|
2110
|
+
);
|
|
2111
|
+
return matches[matches.length - 1] ?? null;
|
|
2112
|
+
}
|
|
2113
|
+
function getOrCreatePortalRoot() {
|
|
2114
|
+
let root = document.getElementById("ui-slot-portal-root");
|
|
2115
|
+
if (!root) {
|
|
2116
|
+
root = document.createElement("div");
|
|
2117
|
+
root.id = "ui-slot-portal-root";
|
|
2118
|
+
root.style.position = "relative";
|
|
2119
|
+
root.style.zIndex = "9999";
|
|
2120
|
+
document.body.appendChild(root);
|
|
2121
|
+
}
|
|
2122
|
+
const themed = lastThemedElement('[data-theme*="-"]', root) ?? lastThemedElement("[data-theme]", root);
|
|
2123
|
+
if (themed) {
|
|
2124
|
+
const theme = themed.getAttribute("data-theme");
|
|
2125
|
+
if (theme && root.getAttribute("data-theme") !== theme) {
|
|
2126
|
+
root.setAttribute("data-theme", theme);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
return root;
|
|
2130
|
+
}
|
|
2131
|
+
var init_portalRoot = __esm({
|
|
2132
|
+
"lib/portalRoot.ts"() {
|
|
2133
|
+
}
|
|
2134
|
+
});
|
|
2105
2135
|
function isMotionEnabled() {
|
|
2106
2136
|
if (typeof document === "undefined") return true;
|
|
2107
2137
|
if (motionEnabledCache !== null) return motionEnabledCache;
|
|
@@ -2182,6 +2212,7 @@ var init_Modal = __esm({
|
|
|
2182
2212
|
init_Dialog();
|
|
2183
2213
|
init_Typography();
|
|
2184
2214
|
init_cn();
|
|
2215
|
+
init_portalRoot();
|
|
2185
2216
|
init_useEventBus();
|
|
2186
2217
|
init_Presence();
|
|
2187
2218
|
sizeClasses2 = {
|
|
@@ -2392,7 +2423,7 @@ var init_Modal = __esm({
|
|
|
2392
2423
|
)
|
|
2393
2424
|
}
|
|
2394
2425
|
),
|
|
2395
|
-
|
|
2426
|
+
getOrCreatePortalRoot()
|
|
2396
2427
|
);
|
|
2397
2428
|
};
|
|
2398
2429
|
Modal.displayName = "Modal";
|
|
@@ -20458,6 +20489,7 @@ var init_StateMachineView = __esm({
|
|
|
20458
20489
|
init_Icon();
|
|
20459
20490
|
init_useEventBus();
|
|
20460
20491
|
init_cn();
|
|
20492
|
+
init_portalRoot();
|
|
20461
20493
|
StateNode2 = ({ state, config }) => {
|
|
20462
20494
|
const { t } = useTranslate();
|
|
20463
20495
|
const size = state.radius * 2;
|
|
@@ -20974,7 +21006,7 @@ var init_StateMachineView = __esm({
|
|
|
20974
21006
|
)
|
|
20975
21007
|
}
|
|
20976
21008
|
),
|
|
20977
|
-
|
|
21009
|
+
getOrCreatePortalRoot()
|
|
20978
21010
|
);
|
|
20979
21011
|
};
|
|
20980
21012
|
EntityBox = ({ entity, config }) => {
|
|
@@ -27534,7 +27566,7 @@ function SubMenu({
|
|
|
27534
27566
|
})
|
|
27535
27567
|
}
|
|
27536
27568
|
);
|
|
27537
|
-
return typeof document !== "undefined" ? createPortal(panel,
|
|
27569
|
+
return typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel;
|
|
27538
27570
|
}
|
|
27539
27571
|
function MenuItemRow({
|
|
27540
27572
|
item,
|
|
@@ -27621,6 +27653,7 @@ var init_Menu = __esm({
|
|
|
27621
27653
|
init_Typography();
|
|
27622
27654
|
init_Badge();
|
|
27623
27655
|
init_cn();
|
|
27656
|
+
init_portalRoot();
|
|
27624
27657
|
init_useEventBus();
|
|
27625
27658
|
MENU_GAP = 4;
|
|
27626
27659
|
menuContainerStyles = cn(
|
|
@@ -27757,7 +27790,7 @@ var init_Menu = __esm({
|
|
|
27757
27790
|
) : null;
|
|
27758
27791
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27759
27792
|
triggerElement,
|
|
27760
|
-
panel && typeof document !== "undefined" ? createPortal(panel,
|
|
27793
|
+
panel && typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel
|
|
27761
27794
|
] });
|
|
27762
27795
|
};
|
|
27763
27796
|
Menu.displayName = "Menu";
|
|
@@ -30971,6 +31004,7 @@ var init_Popover = __esm({
|
|
|
30971
31004
|
init_Typography();
|
|
30972
31005
|
init_Presence();
|
|
30973
31006
|
init_cn();
|
|
31007
|
+
init_portalRoot();
|
|
30974
31008
|
init_useTapReveal();
|
|
30975
31009
|
arrowClasses = {
|
|
30976
31010
|
top: "top-full left-1/2 -translate-x-1/2 border-t-white border-l-transparent border-r-transparent border-b-transparent",
|
|
@@ -31130,7 +31164,7 @@ var init_Popover = __esm({
|
|
|
31130
31164
|
) : null;
|
|
31131
31165
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31132
31166
|
triggerElement,
|
|
31133
|
-
panel && typeof document !== "undefined" ? createPortal(panel,
|
|
31167
|
+
panel && typeof document !== "undefined" ? createPortal(panel, getOrCreatePortalRoot()) : panel
|
|
31134
31168
|
] });
|
|
31135
31169
|
};
|
|
31136
31170
|
Popover.displayName = "Popover";
|
|
@@ -31636,6 +31670,7 @@ var init_Tooltip = __esm({
|
|
|
31636
31670
|
"use client";
|
|
31637
31671
|
init_Typography();
|
|
31638
31672
|
init_cn();
|
|
31673
|
+
init_portalRoot();
|
|
31639
31674
|
init_useTapReveal();
|
|
31640
31675
|
TRIGGER_GAP2 = 8;
|
|
31641
31676
|
arrowClasses2 = {
|
|
@@ -31741,7 +31776,7 @@ var init_Tooltip = __esm({
|
|
|
31741
31776
|
) : null;
|
|
31742
31777
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31743
31778
|
trigger,
|
|
31744
|
-
typeof window !== "undefined" && tooltipContent ? createPortal(tooltipContent,
|
|
31779
|
+
typeof window !== "undefined" && tooltipContent ? createPortal(tooltipContent, getOrCreatePortalRoot()) : tooltipContent
|
|
31745
31780
|
] });
|
|
31746
31781
|
};
|
|
31747
31782
|
Tooltip.displayName = "Tooltip";
|
|
@@ -43023,6 +43058,7 @@ var init_GraphCanvas = __esm({
|
|
|
43023
43058
|
"components/core/molecules/GraphCanvas.tsx"() {
|
|
43024
43059
|
"use client";
|
|
43025
43060
|
init_cn();
|
|
43061
|
+
init_portalRoot();
|
|
43026
43062
|
init_atoms();
|
|
43027
43063
|
init_Stack();
|
|
43028
43064
|
init_LoadingState();
|
|
@@ -43734,7 +43770,7 @@ var init_GraphCanvas = __esm({
|
|
|
43734
43770
|
children: hoveredObj?.label
|
|
43735
43771
|
}
|
|
43736
43772
|
),
|
|
43737
|
-
|
|
43773
|
+
getOrCreatePortalRoot()
|
|
43738
43774
|
)
|
|
43739
43775
|
] }),
|
|
43740
43776
|
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: [
|
|
@@ -44895,6 +44931,7 @@ var init_DetailPanel = __esm({
|
|
|
44895
44931
|
init_ErrorState();
|
|
44896
44932
|
init_EmptyState();
|
|
44897
44933
|
init_cn();
|
|
44934
|
+
init_portalRoot();
|
|
44898
44935
|
init_format();
|
|
44899
44936
|
init_getNestedValue();
|
|
44900
44937
|
init_relationLabel();
|
|
@@ -45314,7 +45351,7 @@ var init_DetailPanel = __esm({
|
|
|
45314
45351
|
return /* @__PURE__ */ jsx(Box, { className, children: content });
|
|
45315
45352
|
}
|
|
45316
45353
|
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 });
|
|
45317
|
-
return typeof document === "undefined" ? panel : createPortal(panel,
|
|
45354
|
+
return typeof document === "undefined" ? panel : createPortal(panel, getOrCreatePortalRoot());
|
|
45318
45355
|
};
|
|
45319
45356
|
DetailPanel.displayName = "DetailPanel";
|
|
45320
45357
|
}
|
|
@@ -52224,24 +52261,6 @@ function UISlotComponentInner({
|
|
|
52224
52261
|
}
|
|
52225
52262
|
);
|
|
52226
52263
|
}
|
|
52227
|
-
function getOrCreatePortalRoot() {
|
|
52228
|
-
let root = document.getElementById("ui-slot-portal-root");
|
|
52229
|
-
if (!root) {
|
|
52230
|
-
root = document.createElement("div");
|
|
52231
|
-
root.id = "ui-slot-portal-root";
|
|
52232
|
-
root.style.position = "relative";
|
|
52233
|
-
root.style.zIndex = "9999";
|
|
52234
|
-
document.body.appendChild(root);
|
|
52235
|
-
}
|
|
52236
|
-
const themed = document.querySelector('[data-theme*="-"]') ?? document.querySelector("[data-theme]");
|
|
52237
|
-
if (themed) {
|
|
52238
|
-
const theme = themed.getAttribute("data-theme");
|
|
52239
|
-
if (theme && root.getAttribute("data-theme") !== theme) {
|
|
52240
|
-
root.setAttribute("data-theme", theme);
|
|
52241
|
-
}
|
|
52242
|
-
}
|
|
52243
|
-
return root;
|
|
52244
|
-
}
|
|
52245
52264
|
function CompiledPortal({ slot, className, pattern, sourceTrait, children }) {
|
|
52246
52265
|
const [portalRoot, setPortalRoot] = useState(null);
|
|
52247
52266
|
const slotsBus = useUISlots();
|
|
@@ -52864,6 +52883,7 @@ var init_UISlotRenderer = __esm({
|
|
|
52864
52883
|
init_slot_types();
|
|
52865
52884
|
init_cn();
|
|
52866
52885
|
init_format();
|
|
52886
|
+
init_portalRoot();
|
|
52867
52887
|
init_ErrorBoundary();
|
|
52868
52888
|
init_Skeleton();
|
|
52869
52889
|
init_renderer();
|
|
@@ -54258,7 +54278,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
54258
54278
|
}
|
|
54259
54279
|
const relayPayload = targetTrait !== void 0 ? { ...payload ?? {}, _targetTrait: targetTrait } : payload;
|
|
54260
54280
|
const locallyEmitted = Array.from(emittedByTrait.values()).flat();
|
|
54261
|
-
void onEventProcessed(normalizedEvent, relayPayload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted);
|
|
54281
|
+
void onEventProcessed(normalizedEvent, relayPayload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait);
|
|
54262
54282
|
}
|
|
54263
54283
|
perfEnd("processEvent:total", _perfT0);
|
|
54264
54284
|
perfEnd(`event:${normalizedEvent}`, _perfT0);
|
|
@@ -54696,7 +54716,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
54696
54716
|
[serverActiveTraits]
|
|
54697
54717
|
);
|
|
54698
54718
|
const uiSlots = useUISlots();
|
|
54699
|
-
const onEventProcessed = useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted) => {
|
|
54719
|
+
const onEventProcessed = useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait) => {
|
|
54700
54720
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
54701
54721
|
const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
|
|
54702
54722
|
xOrbitalLog.debug("TraitInitializer:fanout", () => ({
|
|
@@ -54710,7 +54730,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
|
|
|
54710
54730
|
void bridge.sendEvent(name, event, withActiveTraits(payload), tick, sourceTrait);
|
|
54711
54731
|
continue;
|
|
54712
54732
|
}
|
|
54713
|
-
void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted).then(({ effects, meta }) => {
|
|
54733
|
+
void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait).then(({ effects, meta }) => {
|
|
54714
54734
|
recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
|
|
54715
54735
|
applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNames, onNavigateBack);
|
|
54716
54736
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.21.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
"@almadar/core": "^10.92.0",
|
|
122
122
|
"@almadar/evaluator": "^2.45.0",
|
|
123
123
|
"@almadar/logger": "^1.12.0",
|
|
124
|
-
"@almadar/runtime": "^6.
|
|
125
|
-
"@almadar/std": "^16.
|
|
124
|
+
"@almadar/runtime": "^6.79.0",
|
|
125
|
+
"@almadar/std": "^16.217.0",
|
|
126
126
|
"@almadar/syntax": "^1.17.0",
|
|
127
127
|
"@dnd-kit/core": "^6.3.1",
|
|
128
128
|
"@dnd-kit/sortable": "^10.0.0",
|