@almadar/ui 2.60.2 → 2.60.4
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 +38 -36
- package/dist/avl/index.js +38 -36
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/runtime/ServerBridge.d.ts +6 -0
- package/dist/runtime/index.cjs +38 -36
- package/dist/runtime/index.js +38 -36
- package/package.json +4 -4
package/dist/avl/index.cjs
CHANGED
|
@@ -36416,7 +36416,7 @@ function VerifyModePanel({
|
|
|
36416
36416
|
serverCount,
|
|
36417
36417
|
localCount
|
|
36418
36418
|
}) {
|
|
36419
|
-
const [expanded, setExpanded] = React127__namespace.useState(
|
|
36419
|
+
const [expanded, setExpanded] = React127__namespace.useState(true);
|
|
36420
36420
|
const scrollRef = React127__namespace.useRef(null);
|
|
36421
36421
|
const prevCountRef = React127__namespace.useRef(0);
|
|
36422
36422
|
React127__namespace.useEffect(() => {
|
|
@@ -51675,19 +51675,18 @@ function ServerBridgeProvider({
|
|
|
51675
51675
|
error: result.error
|
|
51676
51676
|
};
|
|
51677
51677
|
if (result.success) {
|
|
51678
|
-
|
|
51679
|
-
|
|
51680
|
-
|
|
51681
|
-
|
|
51682
|
-
|
|
51683
|
-
|
|
51684
|
-
|
|
51685
|
-
|
|
51686
|
-
|
|
51687
|
-
|
|
51688
|
-
|
|
51689
|
-
|
|
51690
|
-
}
|
|
51678
|
+
const tagged = result.clientEffectsByTrait;
|
|
51679
|
+
const tuples = tagged ? tagged.map((entry) => ({ effect: entry.effect, traitName: entry.traitName })) : (result.clientEffects ?? []).map((eff) => ({ effect: eff }));
|
|
51680
|
+
for (const { effect, traitName } of tuples) {
|
|
51681
|
+
const effectType = effect[0];
|
|
51682
|
+
if (effectType === "render-ui") {
|
|
51683
|
+
const slot = effect[1];
|
|
51684
|
+
const pattern = effect[2];
|
|
51685
|
+
effects.push({ type: "render-ui", slot, pattern: pattern ?? void 0, traitName });
|
|
51686
|
+
} else if (effectType === "navigate") {
|
|
51687
|
+
effects.push({ type: "navigate", route: effect[1], params: effect[2], traitName });
|
|
51688
|
+
} else if (effectType === "notify") {
|
|
51689
|
+
effects.push({ type: "notify", message: effect[1], traitName });
|
|
51691
51690
|
}
|
|
51692
51691
|
}
|
|
51693
51692
|
if (result.emittedEvents) {
|
|
@@ -51853,9 +51852,30 @@ function SlotBridge() {
|
|
|
51853
51852
|
}, [slots, render, clear]);
|
|
51854
51853
|
return null;
|
|
51855
51854
|
}
|
|
51855
|
+
function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
51856
|
+
for (const eff of effects) {
|
|
51857
|
+
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51858
|
+
const patternRecord = eff.pattern;
|
|
51859
|
+
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
51860
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
51861
|
+
uiSlots.render({
|
|
51862
|
+
target: eff.slot,
|
|
51863
|
+
pattern: patternType,
|
|
51864
|
+
props: {
|
|
51865
|
+
...inlineProps,
|
|
51866
|
+
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
51867
|
+
},
|
|
51868
|
+
sourceTrait: eff.traitName ?? "server"
|
|
51869
|
+
});
|
|
51870
|
+
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
51871
|
+
onNavigate(eff.route, eff.params);
|
|
51872
|
+
}
|
|
51873
|
+
}
|
|
51874
|
+
}
|
|
51856
51875
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
|
|
51857
51876
|
const slotsActions = useSlotsActions();
|
|
51858
51877
|
const bridge = useServerBridge();
|
|
51878
|
+
const uiSlots = useUISlots();
|
|
51859
51879
|
const entityStore = useEntityStore();
|
|
51860
51880
|
const onEventProcessed = React127.useCallback(async (event, payload) => {
|
|
51861
51881
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
@@ -51870,19 +51890,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
51870
51890
|
}
|
|
51871
51891
|
}
|
|
51872
51892
|
}
|
|
51873
|
-
|
|
51874
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51875
|
-
slotsActions.setSlotPatterns(
|
|
51876
|
-
eff.slot,
|
|
51877
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
51878
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
51879
|
-
);
|
|
51880
|
-
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
51881
|
-
onNavigate(eff.route, eff.params);
|
|
51882
|
-
}
|
|
51883
|
-
}
|
|
51893
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
51884
51894
|
}
|
|
51885
|
-
}, [bridge.connected, bridge.sendEvent, orbitalNames,
|
|
51895
|
+
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
|
|
51886
51896
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
|
|
51887
51897
|
const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
|
|
51888
51898
|
const initSentRef = React127.useRef(false);
|
|
@@ -51930,18 +51940,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
51930
51940
|
}
|
|
51931
51941
|
}
|
|
51932
51942
|
}
|
|
51933
|
-
|
|
51934
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51935
|
-
slotsActions.setSlotPatterns(
|
|
51936
|
-
eff.slot,
|
|
51937
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
51938
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
51939
|
-
);
|
|
51940
|
-
}
|
|
51941
|
-
}
|
|
51943
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
51942
51944
|
}
|
|
51943
51945
|
})();
|
|
51944
|
-
}, [bridge.connected, orbitalNames, bridge.sendEvent,
|
|
51946
|
+
}, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
|
|
51945
51947
|
return null;
|
|
51946
51948
|
}
|
|
51947
51949
|
function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
|
package/dist/avl/index.js
CHANGED
|
@@ -36370,7 +36370,7 @@ function VerifyModePanel({
|
|
|
36370
36370
|
serverCount,
|
|
36371
36371
|
localCount
|
|
36372
36372
|
}) {
|
|
36373
|
-
const [expanded, setExpanded] = React127.useState(
|
|
36373
|
+
const [expanded, setExpanded] = React127.useState(true);
|
|
36374
36374
|
const scrollRef = React127.useRef(null);
|
|
36375
36375
|
const prevCountRef = React127.useRef(0);
|
|
36376
36376
|
React127.useEffect(() => {
|
|
@@ -51629,19 +51629,18 @@ function ServerBridgeProvider({
|
|
|
51629
51629
|
error: result.error
|
|
51630
51630
|
};
|
|
51631
51631
|
if (result.success) {
|
|
51632
|
-
|
|
51633
|
-
|
|
51634
|
-
|
|
51635
|
-
|
|
51636
|
-
|
|
51637
|
-
|
|
51638
|
-
|
|
51639
|
-
|
|
51640
|
-
|
|
51641
|
-
|
|
51642
|
-
|
|
51643
|
-
|
|
51644
|
-
}
|
|
51632
|
+
const tagged = result.clientEffectsByTrait;
|
|
51633
|
+
const tuples = tagged ? tagged.map((entry) => ({ effect: entry.effect, traitName: entry.traitName })) : (result.clientEffects ?? []).map((eff) => ({ effect: eff }));
|
|
51634
|
+
for (const { effect, traitName } of tuples) {
|
|
51635
|
+
const effectType = effect[0];
|
|
51636
|
+
if (effectType === "render-ui") {
|
|
51637
|
+
const slot = effect[1];
|
|
51638
|
+
const pattern = effect[2];
|
|
51639
|
+
effects.push({ type: "render-ui", slot, pattern: pattern ?? void 0, traitName });
|
|
51640
|
+
} else if (effectType === "navigate") {
|
|
51641
|
+
effects.push({ type: "navigate", route: effect[1], params: effect[2], traitName });
|
|
51642
|
+
} else if (effectType === "notify") {
|
|
51643
|
+
effects.push({ type: "notify", message: effect[1], traitName });
|
|
51645
51644
|
}
|
|
51646
51645
|
}
|
|
51647
51646
|
if (result.emittedEvents) {
|
|
@@ -51807,9 +51806,30 @@ function SlotBridge() {
|
|
|
51807
51806
|
}, [slots, render, clear]);
|
|
51808
51807
|
return null;
|
|
51809
51808
|
}
|
|
51809
|
+
function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
51810
|
+
for (const eff of effects) {
|
|
51811
|
+
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51812
|
+
const patternRecord = eff.pattern;
|
|
51813
|
+
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
51814
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
51815
|
+
uiSlots.render({
|
|
51816
|
+
target: eff.slot,
|
|
51817
|
+
pattern: patternType,
|
|
51818
|
+
props: {
|
|
51819
|
+
...inlineProps,
|
|
51820
|
+
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
51821
|
+
},
|
|
51822
|
+
sourceTrait: eff.traitName ?? "server"
|
|
51823
|
+
});
|
|
51824
|
+
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
51825
|
+
onNavigate(eff.route, eff.params);
|
|
51826
|
+
}
|
|
51827
|
+
}
|
|
51828
|
+
}
|
|
51810
51829
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
|
|
51811
51830
|
const slotsActions = useSlotsActions();
|
|
51812
51831
|
const bridge = useServerBridge();
|
|
51832
|
+
const uiSlots = useUISlots();
|
|
51813
51833
|
const entityStore = useEntityStore();
|
|
51814
51834
|
const onEventProcessed = useCallback(async (event, payload) => {
|
|
51815
51835
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
@@ -51824,19 +51844,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
51824
51844
|
}
|
|
51825
51845
|
}
|
|
51826
51846
|
}
|
|
51827
|
-
|
|
51828
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51829
|
-
slotsActions.setSlotPatterns(
|
|
51830
|
-
eff.slot,
|
|
51831
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
51832
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
51833
|
-
);
|
|
51834
|
-
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
51835
|
-
onNavigate(eff.route, eff.params);
|
|
51836
|
-
}
|
|
51837
|
-
}
|
|
51847
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
51838
51848
|
}
|
|
51839
|
-
}, [bridge.connected, bridge.sendEvent, orbitalNames,
|
|
51849
|
+
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
|
|
51840
51850
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
|
|
51841
51851
|
const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
|
|
51842
51852
|
const initSentRef = useRef(false);
|
|
@@ -51884,18 +51894,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
51884
51894
|
}
|
|
51885
51895
|
}
|
|
51886
51896
|
}
|
|
51887
|
-
|
|
51888
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
51889
|
-
slotsActions.setSlotPatterns(
|
|
51890
|
-
eff.slot,
|
|
51891
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
51892
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
51893
|
-
);
|
|
51894
|
-
}
|
|
51895
|
-
}
|
|
51897
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
51896
51898
|
}
|
|
51897
51899
|
})();
|
|
51898
|
-
}, [bridge.connected, orbitalNames, bridge.sendEvent,
|
|
51900
|
+
}, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
|
|
51899
51901
|
return null;
|
|
51900
51902
|
}
|
|
51901
51903
|
function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
|
|
@@ -32404,7 +32404,7 @@ function VerifyModePanel({
|
|
|
32404
32404
|
serverCount,
|
|
32405
32405
|
localCount
|
|
32406
32406
|
}) {
|
|
32407
|
-
const [expanded, setExpanded] = React110__namespace.useState(
|
|
32407
|
+
const [expanded, setExpanded] = React110__namespace.useState(true);
|
|
32408
32408
|
const scrollRef = React110__namespace.useRef(null);
|
|
32409
32409
|
const prevCountRef = React110__namespace.useRef(0);
|
|
32410
32410
|
React110__namespace.useEffect(() => {
|
package/dist/components/index.js
CHANGED
|
@@ -32359,7 +32359,7 @@ function VerifyModePanel({
|
|
|
32359
32359
|
serverCount,
|
|
32360
32360
|
localCount
|
|
32361
32361
|
}) {
|
|
32362
|
-
const [expanded, setExpanded] = React110.useState(
|
|
32362
|
+
const [expanded, setExpanded] = React110.useState(true);
|
|
32363
32363
|
const scrollRef = React110.useRef(null);
|
|
32364
32364
|
const prevCountRef = React110.useRef(0);
|
|
32365
32365
|
React110.useEffect(() => {
|
package/dist/providers/index.cjs
CHANGED
|
@@ -33214,7 +33214,7 @@ function VerifyModePanel({
|
|
|
33214
33214
|
serverCount,
|
|
33215
33215
|
localCount
|
|
33216
33216
|
}) {
|
|
33217
|
-
const [expanded, setExpanded] = React116__namespace.useState(
|
|
33217
|
+
const [expanded, setExpanded] = React116__namespace.useState(true);
|
|
33218
33218
|
const scrollRef = React116__namespace.useRef(null);
|
|
33219
33219
|
const prevCountRef = React116__namespace.useRef(0);
|
|
33220
33220
|
React116__namespace.useEffect(() => {
|
package/dist/providers/index.js
CHANGED
|
@@ -33169,7 +33169,7 @@ function VerifyModePanel({
|
|
|
33169
33169
|
serverCount,
|
|
33170
33170
|
localCount
|
|
33171
33171
|
}) {
|
|
33172
|
-
const [expanded, setExpanded] = React116.useState(
|
|
33172
|
+
const [expanded, setExpanded] = React116.useState(true);
|
|
33173
33173
|
const scrollRef = React116.useRef(null);
|
|
33174
33174
|
const prevCountRef = React116.useRef(0);
|
|
33175
33175
|
React116.useEffect(() => {
|
|
@@ -6,6 +6,12 @@ export interface ServerClientEffect {
|
|
|
6
6
|
route?: string;
|
|
7
7
|
params?: Record<string, unknown>;
|
|
8
8
|
message?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Trait that emitted this effect. Used by `<TraitFrame>` to resolve
|
|
11
|
+
* `@trait.X` bindings. Undefined when the server didn't tag the effect
|
|
12
|
+
* (older servers that pre-date the per-trait sidecar).
|
|
13
|
+
*/
|
|
14
|
+
traitName?: string;
|
|
9
15
|
}
|
|
10
16
|
/** Metadata about what the server returned, for debugger logging */
|
|
11
17
|
export interface ServerResponseMeta {
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -32787,7 +32787,7 @@ function VerifyModePanel({
|
|
|
32787
32787
|
serverCount,
|
|
32788
32788
|
localCount
|
|
32789
32789
|
}) {
|
|
32790
|
-
const [expanded, setExpanded] = React116__namespace.useState(
|
|
32790
|
+
const [expanded, setExpanded] = React116__namespace.useState(true);
|
|
32791
32791
|
const scrollRef = React116__namespace.useRef(null);
|
|
32792
32792
|
const prevCountRef = React116__namespace.useRef(0);
|
|
32793
32793
|
React116__namespace.useEffect(() => {
|
|
@@ -38451,19 +38451,18 @@ function ServerBridgeProvider({
|
|
|
38451
38451
|
error: result.error
|
|
38452
38452
|
};
|
|
38453
38453
|
if (result.success) {
|
|
38454
|
-
|
|
38455
|
-
|
|
38456
|
-
|
|
38457
|
-
|
|
38458
|
-
|
|
38459
|
-
|
|
38460
|
-
|
|
38461
|
-
|
|
38462
|
-
|
|
38463
|
-
|
|
38464
|
-
|
|
38465
|
-
|
|
38466
|
-
}
|
|
38454
|
+
const tagged = result.clientEffectsByTrait;
|
|
38455
|
+
const tuples = tagged ? tagged.map((entry) => ({ effect: entry.effect, traitName: entry.traitName })) : (result.clientEffects ?? []).map((eff) => ({ effect: eff }));
|
|
38456
|
+
for (const { effect, traitName } of tuples) {
|
|
38457
|
+
const effectType = effect[0];
|
|
38458
|
+
if (effectType === "render-ui") {
|
|
38459
|
+
const slot = effect[1];
|
|
38460
|
+
const pattern = effect[2];
|
|
38461
|
+
effects.push({ type: "render-ui", slot, pattern: pattern ?? void 0, traitName });
|
|
38462
|
+
} else if (effectType === "navigate") {
|
|
38463
|
+
effects.push({ type: "navigate", route: effect[1], params: effect[2], traitName });
|
|
38464
|
+
} else if (effectType === "notify") {
|
|
38465
|
+
effects.push({ type: "notify", message: effect[1], traitName });
|
|
38467
38466
|
}
|
|
38468
38467
|
}
|
|
38469
38468
|
if (result.emittedEvents) {
|
|
@@ -38628,9 +38627,30 @@ function SlotBridge() {
|
|
|
38628
38627
|
}, [slots, render, clear]);
|
|
38629
38628
|
return null;
|
|
38630
38629
|
}
|
|
38630
|
+
function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
38631
|
+
for (const eff of effects) {
|
|
38632
|
+
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38633
|
+
const patternRecord = eff.pattern;
|
|
38634
|
+
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
38635
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
38636
|
+
uiSlots.render({
|
|
38637
|
+
target: eff.slot,
|
|
38638
|
+
pattern: patternType,
|
|
38639
|
+
props: {
|
|
38640
|
+
...inlineProps,
|
|
38641
|
+
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
38642
|
+
},
|
|
38643
|
+
sourceTrait: eff.traitName ?? "server"
|
|
38644
|
+
});
|
|
38645
|
+
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
38646
|
+
onNavigate(eff.route, eff.params);
|
|
38647
|
+
}
|
|
38648
|
+
}
|
|
38649
|
+
}
|
|
38631
38650
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
|
|
38632
38651
|
const slotsActions = useSlotsActions();
|
|
38633
38652
|
const bridge = useServerBridge();
|
|
38653
|
+
const uiSlots = context.useUISlots();
|
|
38634
38654
|
const entityStore = providers.useEntityStore();
|
|
38635
38655
|
const onEventProcessed = React116.useCallback(async (event, payload) => {
|
|
38636
38656
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
@@ -38645,19 +38665,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
38645
38665
|
}
|
|
38646
38666
|
}
|
|
38647
38667
|
}
|
|
38648
|
-
|
|
38649
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38650
|
-
slotsActions.setSlotPatterns(
|
|
38651
|
-
eff.slot,
|
|
38652
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
38653
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
38654
|
-
);
|
|
38655
|
-
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
38656
|
-
onNavigate(eff.route, eff.params);
|
|
38657
|
-
}
|
|
38658
|
-
}
|
|
38668
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
38659
38669
|
}
|
|
38660
|
-
}, [bridge.connected, bridge.sendEvent, orbitalNames,
|
|
38670
|
+
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
|
|
38661
38671
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
|
|
38662
38672
|
const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
|
|
38663
38673
|
const initSentRef = React116.useRef(false);
|
|
@@ -38705,18 +38715,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
38705
38715
|
}
|
|
38706
38716
|
}
|
|
38707
38717
|
}
|
|
38708
|
-
|
|
38709
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38710
|
-
slotsActions.setSlotPatterns(
|
|
38711
|
-
eff.slot,
|
|
38712
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
38713
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
38714
|
-
);
|
|
38715
|
-
}
|
|
38716
|
-
}
|
|
38718
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
38717
38719
|
}
|
|
38718
38720
|
})();
|
|
38719
|
-
}, [bridge.connected, orbitalNames, bridge.sendEvent,
|
|
38721
|
+
}, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
|
|
38720
38722
|
return null;
|
|
38721
38723
|
}
|
|
38722
38724
|
function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
|
package/dist/runtime/index.js
CHANGED
|
@@ -32742,7 +32742,7 @@ function VerifyModePanel({
|
|
|
32742
32742
|
serverCount,
|
|
32743
32743
|
localCount
|
|
32744
32744
|
}) {
|
|
32745
|
-
const [expanded, setExpanded] = React116.useState(
|
|
32745
|
+
const [expanded, setExpanded] = React116.useState(true);
|
|
32746
32746
|
const scrollRef = React116.useRef(null);
|
|
32747
32747
|
const prevCountRef = React116.useRef(0);
|
|
32748
32748
|
React116.useEffect(() => {
|
|
@@ -38406,19 +38406,18 @@ function ServerBridgeProvider({
|
|
|
38406
38406
|
error: result.error
|
|
38407
38407
|
};
|
|
38408
38408
|
if (result.success) {
|
|
38409
|
-
|
|
38410
|
-
|
|
38411
|
-
|
|
38412
|
-
|
|
38413
|
-
|
|
38414
|
-
|
|
38415
|
-
|
|
38416
|
-
|
|
38417
|
-
|
|
38418
|
-
|
|
38419
|
-
|
|
38420
|
-
|
|
38421
|
-
}
|
|
38409
|
+
const tagged = result.clientEffectsByTrait;
|
|
38410
|
+
const tuples = tagged ? tagged.map((entry) => ({ effect: entry.effect, traitName: entry.traitName })) : (result.clientEffects ?? []).map((eff) => ({ effect: eff }));
|
|
38411
|
+
for (const { effect, traitName } of tuples) {
|
|
38412
|
+
const effectType = effect[0];
|
|
38413
|
+
if (effectType === "render-ui") {
|
|
38414
|
+
const slot = effect[1];
|
|
38415
|
+
const pattern = effect[2];
|
|
38416
|
+
effects.push({ type: "render-ui", slot, pattern: pattern ?? void 0, traitName });
|
|
38417
|
+
} else if (effectType === "navigate") {
|
|
38418
|
+
effects.push({ type: "navigate", route: effect[1], params: effect[2], traitName });
|
|
38419
|
+
} else if (effectType === "notify") {
|
|
38420
|
+
effects.push({ type: "notify", message: effect[1], traitName });
|
|
38422
38421
|
}
|
|
38423
38422
|
}
|
|
38424
38423
|
if (result.emittedEvents) {
|
|
@@ -38583,9 +38582,30 @@ function SlotBridge() {
|
|
|
38583
38582
|
}, [slots, render, clear]);
|
|
38584
38583
|
return null;
|
|
38585
38584
|
}
|
|
38585
|
+
function applyServerEffects(effects, uiSlots, onNavigate) {
|
|
38586
|
+
for (const eff of effects) {
|
|
38587
|
+
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38588
|
+
const patternRecord = eff.pattern;
|
|
38589
|
+
const { type: patternType, children, ...inlineProps } = patternRecord;
|
|
38590
|
+
const normalizedChildren = Array.isArray(children) ? children.map((c) => normalizeChild(c)) : children;
|
|
38591
|
+
uiSlots.render({
|
|
38592
|
+
target: eff.slot,
|
|
38593
|
+
pattern: patternType,
|
|
38594
|
+
props: {
|
|
38595
|
+
...inlineProps,
|
|
38596
|
+
...normalizedChildren !== void 0 ? { children: normalizedChildren } : {}
|
|
38597
|
+
},
|
|
38598
|
+
sourceTrait: eff.traitName ?? "server"
|
|
38599
|
+
});
|
|
38600
|
+
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
38601
|
+
onNavigate(eff.route, eff.params);
|
|
38602
|
+
}
|
|
38603
|
+
}
|
|
38604
|
+
}
|
|
38586
38605
|
function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
|
|
38587
38606
|
const slotsActions = useSlotsActions();
|
|
38588
38607
|
const bridge = useServerBridge();
|
|
38608
|
+
const uiSlots = useUISlots();
|
|
38589
38609
|
const entityStore = useEntityStore();
|
|
38590
38610
|
const onEventProcessed = useCallback(async (event, payload) => {
|
|
38591
38611
|
if (!bridge.connected || !orbitalNames?.length) return;
|
|
@@ -38600,19 +38620,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
38600
38620
|
}
|
|
38601
38621
|
}
|
|
38602
38622
|
}
|
|
38603
|
-
|
|
38604
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38605
|
-
slotsActions.setSlotPatterns(
|
|
38606
|
-
eff.slot,
|
|
38607
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
38608
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
38609
|
-
);
|
|
38610
|
-
} else if (eff.type === "navigate" && eff.route && onNavigate) {
|
|
38611
|
-
onNavigate(eff.route, eff.params);
|
|
38612
|
-
}
|
|
38613
|
-
}
|
|
38623
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
38614
38624
|
}
|
|
38615
|
-
}, [bridge.connected, bridge.sendEvent, orbitalNames,
|
|
38625
|
+
}, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
|
|
38616
38626
|
const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
|
|
38617
38627
|
const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
|
|
38618
38628
|
const initSentRef = useRef(false);
|
|
@@ -38660,18 +38670,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
|
|
|
38660
38670
|
}
|
|
38661
38671
|
}
|
|
38662
38672
|
}
|
|
38663
|
-
|
|
38664
|
-
if (eff.type === "render-ui" && eff.slot && eff.pattern) {
|
|
38665
|
-
slotsActions.setSlotPatterns(
|
|
38666
|
-
eff.slot,
|
|
38667
|
-
[{ pattern: eff.pattern, props: {} }],
|
|
38668
|
-
{ trait: "server", state: "server", transition: "server-effect" }
|
|
38669
|
-
);
|
|
38670
|
-
}
|
|
38671
|
-
}
|
|
38673
|
+
applyServerEffects(effects, uiSlots, onNavigate);
|
|
38672
38674
|
}
|
|
38673
38675
|
})();
|
|
38674
|
-
}, [bridge.connected, orbitalNames, bridge.sendEvent,
|
|
38676
|
+
}, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
|
|
38675
38677
|
return null;
|
|
38676
38678
|
}
|
|
38677
38679
|
function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "2.60.
|
|
3
|
+
"version": "2.60.4",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/components/index.js",
|
|
@@ -121,19 +121,19 @@
|
|
|
121
121
|
"@almadar/core": ">=4.8.2",
|
|
122
122
|
"@almadar/evaluator": ">=2.8.1",
|
|
123
123
|
"@almadar/patterns": ">=2.14.1",
|
|
124
|
+
"@almadar/runtime": ">=3.2.6",
|
|
124
125
|
"@almadar/std": ">=6.4.1",
|
|
125
126
|
"@almadar/syntax": ">=1.3.1",
|
|
126
|
-
"@almadar/runtime": ">=3.2.2",
|
|
127
127
|
"@xyflow/react": "12.10.1",
|
|
128
128
|
"clsx": "^2.1.0",
|
|
129
129
|
"elkjs": "0.11.1",
|
|
130
|
+
"hastscript": "^9.0.0",
|
|
130
131
|
"leaflet": "1.9.4",
|
|
131
132
|
"lucide-react": "^0.344.0",
|
|
133
|
+
"parse-entities": "^4.0.0",
|
|
132
134
|
"react-leaflet": "^4.2.1",
|
|
133
135
|
"react-markdown": "^9.0.0",
|
|
134
136
|
"react-syntax-highlighter": "^16.1.0",
|
|
135
|
-
"hastscript": "^9.0.0",
|
|
136
|
-
"parse-entities": "^4.0.0",
|
|
137
137
|
"refractor": "^5.0.0",
|
|
138
138
|
"rehype-katex": "^7.0.0",
|
|
139
139
|
"remark-gfm": "^4.0.0",
|