@almadar/ui 2.60.3 → 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.
@@ -51852,9 +51852,30 @@ function SlotBridge() {
51852
51852
  }, [slots, render, clear]);
51853
51853
  return null;
51854
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
+ }
51855
51875
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
51856
51876
  const slotsActions = useSlotsActions();
51857
51877
  const bridge = useServerBridge();
51878
+ const uiSlots = useUISlots();
51858
51879
  const entityStore = useEntityStore();
51859
51880
  const onEventProcessed = React127.useCallback(async (event, payload) => {
51860
51881
  if (!bridge.connected || !orbitalNames?.length) return;
@@ -51869,19 +51890,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51869
51890
  }
51870
51891
  }
51871
51892
  }
51872
- for (const eff of effects) {
51873
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
51874
- slotsActions.setSlotPatterns(
51875
- eff.slot,
51876
- [{ pattern: eff.pattern, props: {} }],
51877
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
51878
- );
51879
- } else if (eff.type === "navigate" && eff.route && onNavigate) {
51880
- onNavigate(eff.route, eff.params);
51881
- }
51882
- }
51893
+ applyServerEffects(effects, uiSlots, onNavigate);
51883
51894
  }
51884
- }, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate, entityStore]);
51895
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
51885
51896
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
51886
51897
  const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
51887
51898
  const initSentRef = React127.useRef(false);
@@ -51929,18 +51940,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51929
51940
  }
51930
51941
  }
51931
51942
  }
51932
- for (const eff of effects) {
51933
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
51934
- slotsActions.setSlotPatterns(
51935
- eff.slot,
51936
- [{ pattern: eff.pattern, props: {} }],
51937
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
51938
- );
51939
- }
51940
- }
51943
+ applyServerEffects(effects, uiSlots, onNavigate);
51941
51944
  }
51942
51945
  })();
51943
- }, [bridge.connected, orbitalNames, bridge.sendEvent, slotsActions]);
51946
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
51944
51947
  return null;
51945
51948
  }
51946
51949
  function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
package/dist/avl/index.js CHANGED
@@ -51806,9 +51806,30 @@ function SlotBridge() {
51806
51806
  }, [slots, render, clear]);
51807
51807
  return null;
51808
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
+ }
51809
51829
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
51810
51830
  const slotsActions = useSlotsActions();
51811
51831
  const bridge = useServerBridge();
51832
+ const uiSlots = useUISlots();
51812
51833
  const entityStore = useEntityStore();
51813
51834
  const onEventProcessed = useCallback(async (event, payload) => {
51814
51835
  if (!bridge.connected || !orbitalNames?.length) return;
@@ -51823,19 +51844,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51823
51844
  }
51824
51845
  }
51825
51846
  }
51826
- for (const eff of effects) {
51827
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
51828
- slotsActions.setSlotPatterns(
51829
- eff.slot,
51830
- [{ pattern: eff.pattern, props: {} }],
51831
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
51832
- );
51833
- } else if (eff.type === "navigate" && eff.route && onNavigate) {
51834
- onNavigate(eff.route, eff.params);
51835
- }
51836
- }
51847
+ applyServerEffects(effects, uiSlots, onNavigate);
51837
51848
  }
51838
- }, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate, entityStore]);
51849
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
51839
51850
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
51840
51851
  const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
51841
51852
  const initSentRef = useRef(false);
@@ -51883,18 +51894,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
51883
51894
  }
51884
51895
  }
51885
51896
  }
51886
- for (const eff of effects) {
51887
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
51888
- slotsActions.setSlotPatterns(
51889
- eff.slot,
51890
- [{ pattern: eff.pattern, props: {} }],
51891
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
51892
- );
51893
- }
51894
- }
51897
+ applyServerEffects(effects, uiSlots, onNavigate);
51895
51898
  }
51896
51899
  })();
51897
- }, [bridge.connected, orbitalNames, bridge.sendEvent, slotsActions]);
51900
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
51898
51901
  return null;
51899
51902
  }
51900
51903
  function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
@@ -38627,9 +38627,30 @@ function SlotBridge() {
38627
38627
  }, [slots, render, clear]);
38628
38628
  return null;
38629
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
+ }
38630
38650
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
38631
38651
  const slotsActions = useSlotsActions();
38632
38652
  const bridge = useServerBridge();
38653
+ const uiSlots = context.useUISlots();
38633
38654
  const entityStore = providers.useEntityStore();
38634
38655
  const onEventProcessed = React116.useCallback(async (event, payload) => {
38635
38656
  if (!bridge.connected || !orbitalNames?.length) return;
@@ -38644,19 +38665,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
38644
38665
  }
38645
38666
  }
38646
38667
  }
38647
- for (const eff of effects) {
38648
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
38649
- slotsActions.setSlotPatterns(
38650
- eff.slot,
38651
- [{ pattern: eff.pattern, props: {} }],
38652
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
38653
- );
38654
- } else if (eff.type === "navigate" && eff.route && onNavigate) {
38655
- onNavigate(eff.route, eff.params);
38656
- }
38657
- }
38668
+ applyServerEffects(effects, uiSlots, onNavigate);
38658
38669
  }
38659
- }, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate, entityStore]);
38670
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
38660
38671
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
38661
38672
  const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
38662
38673
  const initSentRef = React116.useRef(false);
@@ -38704,18 +38715,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
38704
38715
  }
38705
38716
  }
38706
38717
  }
38707
- for (const eff of effects) {
38708
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
38709
- slotsActions.setSlotPatterns(
38710
- eff.slot,
38711
- [{ pattern: eff.pattern, props: {} }],
38712
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
38713
- );
38714
- }
38715
- }
38718
+ applyServerEffects(effects, uiSlots, onNavigate);
38716
38719
  }
38717
38720
  })();
38718
- }, [bridge.connected, orbitalNames, bridge.sendEvent, slotsActions]);
38721
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
38719
38722
  return null;
38720
38723
  }
38721
38724
  function SchemaRunner({ schema, serverUrl, mockData, pageName, onNavigate, onLocalFallback }) {
@@ -38582,9 +38582,30 @@ function SlotBridge() {
38582
38582
  }, [slots, render, clear]);
38583
38583
  return null;
38584
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
+ }
38585
38605
  function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFallback }) {
38586
38606
  const slotsActions = useSlotsActions();
38587
38607
  const bridge = useServerBridge();
38608
+ const uiSlots = useUISlots();
38588
38609
  const entityStore = useEntityStore();
38589
38610
  const onEventProcessed = useCallback(async (event, payload) => {
38590
38611
  if (!bridge.connected || !orbitalNames?.length) return;
@@ -38599,19 +38620,9 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
38599
38620
  }
38600
38621
  }
38601
38622
  }
38602
- for (const eff of effects) {
38603
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
38604
- slotsActions.setSlotPatterns(
38605
- eff.slot,
38606
- [{ pattern: eff.pattern, props: {} }],
38607
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
38608
- );
38609
- } else if (eff.type === "navigate" && eff.route && onNavigate) {
38610
- onNavigate(eff.route, eff.params);
38611
- }
38612
- }
38623
+ applyServerEffects(effects, uiSlots, onNavigate);
38613
38624
  }
38614
- }, [bridge.connected, bridge.sendEvent, orbitalNames, slotsActions, onNavigate, entityStore]);
38625
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, entityStore]);
38615
38626
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate } : { navigate: onNavigate };
38616
38627
  const { sendEvent } = useTraitStateMachine(traits2, slotsActions, opts);
38617
38628
  const initSentRef = useRef(false);
@@ -38659,18 +38670,10 @@ function TraitInitializer({ traits: traits2, orbitalNames, onNavigate, onLocalFa
38659
38670
  }
38660
38671
  }
38661
38672
  }
38662
- for (const eff of effects) {
38663
- if (eff.type === "render-ui" && eff.slot && eff.pattern) {
38664
- slotsActions.setSlotPatterns(
38665
- eff.slot,
38666
- [{ pattern: eff.pattern, props: {} }],
38667
- { trait: eff.traitName ?? "server", state: "server", transition: "server-effect" }
38668
- );
38669
- }
38670
- }
38673
+ applyServerEffects(effects, uiSlots, onNavigate);
38671
38674
  }
38672
38675
  })();
38673
- }, [bridge.connected, orbitalNames, bridge.sendEvent, slotsActions]);
38676
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate]);
38674
38677
  return null;
38675
38678
  }
38676
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",
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,7 +121,7 @@
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.3",
124
+ "@almadar/runtime": ">=3.2.6",
125
125
  "@almadar/std": ">=6.4.1",
126
126
  "@almadar/syntax": ">=1.3.1",
127
127
  "@xyflow/react": "12.10.1",