@almadar/ui 4.24.0 → 4.25.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.
@@ -47023,7 +47023,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47023
47023
  if (!child || typeof child !== "object") return null;
47024
47024
  const childId = `${parentId}-${index}`;
47025
47025
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
47026
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
47026
+ const childAsRecord = child;
47027
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
47027
47028
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
47028
47029
  if (_childChildren !== void 0 && nestedProps === void 0) {
47029
47030
  resolvedProps.children = _childChildren;
@@ -47051,7 +47052,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47051
47052
  });
47052
47053
  }
47053
47054
  function isPatternConfig(value) {
47054
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
47055
+ if (value === null || value === void 0) return false;
47056
+ if (typeof value !== "object") return false;
47057
+ if (Array.isArray(value)) return false;
47058
+ if (React127__namespace.default.isValidElement(value)) return false;
47059
+ if (value instanceof Date) return false;
47060
+ if (typeof value === "function") return false;
47061
+ const record = value;
47062
+ return "type" in record && typeof record.type === "string";
47063
+ }
47064
+ function isPlainConfigObject(value) {
47065
+ if (React127__namespace.default.isValidElement(value)) return false;
47066
+ if (value instanceof Date) return false;
47067
+ const proto = Object.getPrototypeOf(value);
47068
+ return proto === Object.prototype || proto === null;
47069
+ }
47070
+ function substituteTraitRefsDeep(value, pathKey) {
47071
+ if (typeof value === "string") {
47072
+ const match = TRAIT_BINDING_RE.exec(value);
47073
+ if (match) {
47074
+ const traitName = match[1];
47075
+ return /* @__PURE__ */ jsxRuntime.jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
47076
+ }
47077
+ return value;
47078
+ }
47079
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
47080
+ return value;
47081
+ }
47082
+ if (Array.isArray(value)) {
47083
+ return value.map(
47084
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
47085
+ );
47086
+ }
47087
+ if (typeof value === "object" && isPlainConfigObject(value)) {
47088
+ const out = {};
47089
+ for (const [k, v] of Object.entries(value)) {
47090
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
47091
+ }
47092
+ return out;
47093
+ }
47094
+ return value;
47055
47095
  }
47056
47096
  function renderPatternProps(props, onDismiss) {
47057
47097
  const rendered = {};
@@ -47059,17 +47099,19 @@ function renderPatternProps(props, onDismiss) {
47059
47099
  if (key === "children") {
47060
47100
  rendered[key] = value;
47061
47101
  } else if (isPatternConfig(value)) {
47102
+ const nestedProps = {};
47103
+ for (const [k, v] of Object.entries(value)) {
47104
+ if (k !== "type") nestedProps[k] = v;
47105
+ }
47062
47106
  const childContent = {
47063
47107
  id: `prop-${key}`,
47064
47108
  pattern: value.type,
47065
- props: Object.fromEntries(
47066
- Object.entries(value).filter(([k]) => k !== "type")
47067
- ),
47109
+ props: nestedProps,
47068
47110
  priority: 0
47069
47111
  };
47070
47112
  rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
47071
47113
  } else {
47072
- rendered[key] = value;
47114
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
47073
47115
  }
47074
47116
  }
47075
47117
  return rendered;
@@ -51680,7 +51722,7 @@ function resolveLambdaBindings(body, argName, arg) {
51680
51722
  let cur = arg;
51681
51723
  for (const seg of path.split(".")) {
51682
51724
  if (cur === null || cur === void 0) return void 0;
51683
- if (typeof cur !== "object") return void 0;
51725
+ if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
51684
51726
  cur = cur[seg];
51685
51727
  }
51686
51728
  return cur;
@@ -51696,7 +51738,7 @@ function resolveLambdaBindings(body, argName, arg) {
51696
51738
  if (Array.isArray(body)) {
51697
51739
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
51698
51740
  }
51699
- if (body !== null && typeof body === "object") {
51741
+ if (body !== null && typeof body === "object" && !React127__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
51700
51742
  const out = {};
51701
51743
  for (const [k, v] of Object.entries(body)) {
51702
51744
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -51715,7 +51757,7 @@ function getSlotContentRenderer2() {
51715
51757
  function makeLambdaFn(argName, lambdaBody, callerKey) {
51716
51758
  return (item, index) => {
51717
51759
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
51718
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
51760
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React127__namespace.default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
51719
51761
  return null;
51720
51762
  }
51721
51763
  const record = resolvedBody;
@@ -51723,12 +51765,14 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
51723
51765
  return null;
51724
51766
  }
51725
51767
  const SlotContentRenderer2 = getSlotContentRenderer2();
51768
+ const childProps = {};
51769
+ for (const [k, v] of Object.entries(record)) {
51770
+ if (k !== "type") childProps[k] = v;
51771
+ }
51726
51772
  const childContent = {
51727
51773
  id: `lambda-${callerKey}-${index}`,
51728
51774
  pattern: record.type,
51729
- props: Object.fromEntries(
51730
- Object.entries(record).filter(([k]) => k !== "type")
51731
- ),
51775
+ props: childProps,
51732
51776
  priority: 0
51733
51777
  };
51734
51778
  return React127__namespace.default.createElement(SlotContentRenderer2, { content: childContent });
@@ -51741,15 +51785,16 @@ function convertNode(node, callerKey) {
51741
51785
  const [, argName, body] = node;
51742
51786
  return makeLambdaFn(argName, body, callerKey);
51743
51787
  }
51788
+ const arr = node;
51744
51789
  let anyChanged = false;
51745
- const mapped = node.map((item, i) => {
51790
+ const mapped = arr.map((item, i) => {
51746
51791
  const next = convertNode(item, `${callerKey}[${i}]`);
51747
51792
  if (next !== item) anyChanged = true;
51748
51793
  return next;
51749
51794
  });
51750
51795
  return anyChanged ? mapped : node;
51751
51796
  }
51752
- if (typeof node === "object") {
51797
+ if (typeof node === "object" && !React127__namespace.default.isValidElement(node) && !(node instanceof Date)) {
51753
51798
  return convertObjectProps(node);
51754
51799
  }
51755
51800
  return node;
package/dist/avl/index.js CHANGED
@@ -46977,7 +46977,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46977
46977
  if (!child || typeof child !== "object") return null;
46978
46978
  const childId = `${parentId}-${index}`;
46979
46979
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
46980
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
46980
+ const childAsRecord = child;
46981
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
46981
46982
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46982
46983
  if (_childChildren !== void 0 && nestedProps === void 0) {
46983
46984
  resolvedProps.children = _childChildren;
@@ -47005,7 +47006,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47005
47006
  });
47006
47007
  }
47007
47008
  function isPatternConfig(value) {
47008
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
47009
+ if (value === null || value === void 0) return false;
47010
+ if (typeof value !== "object") return false;
47011
+ if (Array.isArray(value)) return false;
47012
+ if (React127__default.isValidElement(value)) return false;
47013
+ if (value instanceof Date) return false;
47014
+ if (typeof value === "function") return false;
47015
+ const record = value;
47016
+ return "type" in record && typeof record.type === "string";
47017
+ }
47018
+ function isPlainConfigObject(value) {
47019
+ if (React127__default.isValidElement(value)) return false;
47020
+ if (value instanceof Date) return false;
47021
+ const proto = Object.getPrototypeOf(value);
47022
+ return proto === Object.prototype || proto === null;
47023
+ }
47024
+ function substituteTraitRefsDeep(value, pathKey) {
47025
+ if (typeof value === "string") {
47026
+ const match = TRAIT_BINDING_RE.exec(value);
47027
+ if (match) {
47028
+ const traitName = match[1];
47029
+ return /* @__PURE__ */ jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
47030
+ }
47031
+ return value;
47032
+ }
47033
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
47034
+ return value;
47035
+ }
47036
+ if (Array.isArray(value)) {
47037
+ return value.map(
47038
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
47039
+ );
47040
+ }
47041
+ if (typeof value === "object" && isPlainConfigObject(value)) {
47042
+ const out = {};
47043
+ for (const [k, v] of Object.entries(value)) {
47044
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
47045
+ }
47046
+ return out;
47047
+ }
47048
+ return value;
47009
47049
  }
47010
47050
  function renderPatternProps(props, onDismiss) {
47011
47051
  const rendered = {};
@@ -47013,17 +47053,19 @@ function renderPatternProps(props, onDismiss) {
47013
47053
  if (key === "children") {
47014
47054
  rendered[key] = value;
47015
47055
  } else if (isPatternConfig(value)) {
47056
+ const nestedProps = {};
47057
+ for (const [k, v] of Object.entries(value)) {
47058
+ if (k !== "type") nestedProps[k] = v;
47059
+ }
47016
47060
  const childContent = {
47017
47061
  id: `prop-${key}`,
47018
47062
  pattern: value.type,
47019
- props: Object.fromEntries(
47020
- Object.entries(value).filter(([k]) => k !== "type")
47021
- ),
47063
+ props: nestedProps,
47022
47064
  priority: 0
47023
47065
  };
47024
47066
  rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
47025
47067
  } else {
47026
- rendered[key] = value;
47068
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
47027
47069
  }
47028
47070
  }
47029
47071
  return rendered;
@@ -51634,7 +51676,7 @@ function resolveLambdaBindings(body, argName, arg) {
51634
51676
  let cur = arg;
51635
51677
  for (const seg of path.split(".")) {
51636
51678
  if (cur === null || cur === void 0) return void 0;
51637
- if (typeof cur !== "object") return void 0;
51679
+ if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
51638
51680
  cur = cur[seg];
51639
51681
  }
51640
51682
  return cur;
@@ -51650,7 +51692,7 @@ function resolveLambdaBindings(body, argName, arg) {
51650
51692
  if (Array.isArray(body)) {
51651
51693
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
51652
51694
  }
51653
- if (body !== null && typeof body === "object") {
51695
+ if (body !== null && typeof body === "object" && !React127__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
51654
51696
  const out = {};
51655
51697
  for (const [k, v] of Object.entries(body)) {
51656
51698
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -51669,7 +51711,7 @@ function getSlotContentRenderer2() {
51669
51711
  function makeLambdaFn(argName, lambdaBody, callerKey) {
51670
51712
  return (item, index) => {
51671
51713
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
51672
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
51714
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React127__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
51673
51715
  return null;
51674
51716
  }
51675
51717
  const record = resolvedBody;
@@ -51677,12 +51719,14 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
51677
51719
  return null;
51678
51720
  }
51679
51721
  const SlotContentRenderer2 = getSlotContentRenderer2();
51722
+ const childProps = {};
51723
+ for (const [k, v] of Object.entries(record)) {
51724
+ if (k !== "type") childProps[k] = v;
51725
+ }
51680
51726
  const childContent = {
51681
51727
  id: `lambda-${callerKey}-${index}`,
51682
51728
  pattern: record.type,
51683
- props: Object.fromEntries(
51684
- Object.entries(record).filter(([k]) => k !== "type")
51685
- ),
51729
+ props: childProps,
51686
51730
  priority: 0
51687
51731
  };
51688
51732
  return React127__default.createElement(SlotContentRenderer2, { content: childContent });
@@ -51695,15 +51739,16 @@ function convertNode(node, callerKey) {
51695
51739
  const [, argName, body] = node;
51696
51740
  return makeLambdaFn(argName, body, callerKey);
51697
51741
  }
51742
+ const arr = node;
51698
51743
  let anyChanged = false;
51699
- const mapped = node.map((item, i) => {
51744
+ const mapped = arr.map((item, i) => {
51700
51745
  const next = convertNode(item, `${callerKey}[${i}]`);
51701
51746
  if (next !== item) anyChanged = true;
51702
51747
  return next;
51703
51748
  });
51704
51749
  return anyChanged ? mapped : node;
51705
51750
  }
51706
- if (typeof node === "object") {
51751
+ if (typeof node === "object" && !React127__default.isValidElement(node) && !(node instanceof Date)) {
51707
51752
  return convertObjectProps(node);
51708
51753
  }
51709
51754
  return node;
@@ -37769,7 +37769,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37769
37769
  if (!child || typeof child !== "object") return null;
37770
37770
  const childId = `${parentId}-${index}`;
37771
37771
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
37772
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
37772
+ const childAsRecord = child;
37773
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
37773
37774
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
37774
37775
  if (_childChildren !== void 0 && nestedProps === void 0) {
37775
37776
  resolvedProps.children = _childChildren;
@@ -37797,7 +37798,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37797
37798
  });
37798
37799
  }
37799
37800
  function isPatternConfig(value) {
37800
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
37801
+ if (value === null || value === void 0) return false;
37802
+ if (typeof value !== "object") return false;
37803
+ if (Array.isArray(value)) return false;
37804
+ if (React110__namespace.default.isValidElement(value)) return false;
37805
+ if (value instanceof Date) return false;
37806
+ if (typeof value === "function") return false;
37807
+ const record = value;
37808
+ return "type" in record && typeof record.type === "string";
37809
+ }
37810
+ function isPlainConfigObject(value) {
37811
+ if (React110__namespace.default.isValidElement(value)) return false;
37812
+ if (value instanceof Date) return false;
37813
+ const proto = Object.getPrototypeOf(value);
37814
+ return proto === Object.prototype || proto === null;
37815
+ }
37816
+ function substituteTraitRefsDeep(value, pathKey) {
37817
+ if (typeof value === "string") {
37818
+ const match = TRAIT_BINDING_RE.exec(value);
37819
+ if (match) {
37820
+ const traitName = match[1];
37821
+ return /* @__PURE__ */ jsxRuntime.jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
37822
+ }
37823
+ return value;
37824
+ }
37825
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
37826
+ return value;
37827
+ }
37828
+ if (Array.isArray(value)) {
37829
+ return value.map(
37830
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
37831
+ );
37832
+ }
37833
+ if (typeof value === "object" && isPlainConfigObject(value)) {
37834
+ const out = {};
37835
+ for (const [k, v] of Object.entries(value)) {
37836
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
37837
+ }
37838
+ return out;
37839
+ }
37840
+ return value;
37801
37841
  }
37802
37842
  function renderPatternProps(props, onDismiss) {
37803
37843
  const rendered = {};
@@ -37805,17 +37845,19 @@ function renderPatternProps(props, onDismiss) {
37805
37845
  if (key === "children") {
37806
37846
  rendered[key] = value;
37807
37847
  } else if (isPatternConfig(value)) {
37848
+ const nestedProps = {};
37849
+ for (const [k, v] of Object.entries(value)) {
37850
+ if (k !== "type") nestedProps[k] = v;
37851
+ }
37808
37852
  const childContent = {
37809
37853
  id: `prop-${key}`,
37810
37854
  pattern: value.type,
37811
- props: Object.fromEntries(
37812
- Object.entries(value).filter(([k]) => k !== "type")
37813
- ),
37855
+ props: nestedProps,
37814
37856
  priority: 0
37815
37857
  };
37816
37858
  rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
37817
37859
  } else {
37818
- rendered[key] = value;
37860
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
37819
37861
  }
37820
37862
  }
37821
37863
  return rendered;
@@ -37724,7 +37724,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37724
37724
  if (!child || typeof child !== "object") return null;
37725
37725
  const childId = `${parentId}-${index}`;
37726
37726
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
37727
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
37727
+ const childAsRecord = child;
37728
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
37728
37729
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
37729
37730
  if (_childChildren !== void 0 && nestedProps === void 0) {
37730
37731
  resolvedProps.children = _childChildren;
@@ -37752,7 +37753,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37752
37753
  });
37753
37754
  }
37754
37755
  function isPatternConfig(value) {
37755
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
37756
+ if (value === null || value === void 0) return false;
37757
+ if (typeof value !== "object") return false;
37758
+ if (Array.isArray(value)) return false;
37759
+ if (React110__default.isValidElement(value)) return false;
37760
+ if (value instanceof Date) return false;
37761
+ if (typeof value === "function") return false;
37762
+ const record = value;
37763
+ return "type" in record && typeof record.type === "string";
37764
+ }
37765
+ function isPlainConfigObject(value) {
37766
+ if (React110__default.isValidElement(value)) return false;
37767
+ if (value instanceof Date) return false;
37768
+ const proto = Object.getPrototypeOf(value);
37769
+ return proto === Object.prototype || proto === null;
37770
+ }
37771
+ function substituteTraitRefsDeep(value, pathKey) {
37772
+ if (typeof value === "string") {
37773
+ const match = TRAIT_BINDING_RE.exec(value);
37774
+ if (match) {
37775
+ const traitName = match[1];
37776
+ return /* @__PURE__ */ jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
37777
+ }
37778
+ return value;
37779
+ }
37780
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
37781
+ return value;
37782
+ }
37783
+ if (Array.isArray(value)) {
37784
+ return value.map(
37785
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
37786
+ );
37787
+ }
37788
+ if (typeof value === "object" && isPlainConfigObject(value)) {
37789
+ const out = {};
37790
+ for (const [k, v] of Object.entries(value)) {
37791
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
37792
+ }
37793
+ return out;
37794
+ }
37795
+ return value;
37756
37796
  }
37757
37797
  function renderPatternProps(props, onDismiss) {
37758
37798
  const rendered = {};
@@ -37760,17 +37800,19 @@ function renderPatternProps(props, onDismiss) {
37760
37800
  if (key === "children") {
37761
37801
  rendered[key] = value;
37762
37802
  } else if (isPatternConfig(value)) {
37803
+ const nestedProps = {};
37804
+ for (const [k, v] of Object.entries(value)) {
37805
+ if (k !== "type") nestedProps[k] = v;
37806
+ }
37763
37807
  const childContent = {
37764
37808
  id: `prop-${key}`,
37765
37809
  pattern: value.type,
37766
- props: Object.fromEntries(
37767
- Object.entries(value).filter(([k]) => k !== "type")
37768
- ),
37810
+ props: nestedProps,
37769
37811
  priority: 0
37770
37812
  };
37771
37813
  rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
37772
37814
  } else {
37773
- rendered[key] = value;
37815
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
37774
37816
  }
37775
37817
  }
37776
37818
  return rendered;
@@ -19,7 +19,7 @@
19
19
  * @packageDocumentation
20
20
  */
21
21
  import React from 'react';
22
- import { type UISlotManager, type UISlot, type SlotContent, type RenderUIConfig, type SlotAnimation, type SlotChangeCallback } from '../hooks/useUISlots';
22
+ import { type UISlotManager, type UISlot, type SlotContent, type SlotProps, type SlotPropValue, type SlotCallback, type RenderUIConfig, type SlotAnimation, type SlotChangeCallback } from '../hooks/useUISlots';
23
23
  /**
24
24
  * Context for the UI Slot Manager
25
25
  */
@@ -72,4 +72,4 @@ export declare function useSlotContent(slot: UISlot): SlotContent | null;
72
72
  * Hook to check if a slot has content.
73
73
  */
74
74
  export declare function useSlotHasContent(slot: UISlot): boolean;
75
- export { UISlotContext, type UISlotManager, type UISlot, type SlotContent, type RenderUIConfig, type SlotAnimation, type SlotChangeCallback, };
75
+ export { UISlotContext, type UISlotManager, type UISlot, type SlotContent, type SlotProps, type SlotPropValue, type SlotCallback, type RenderUIConfig, type SlotAnimation, type SlotChangeCallback, };
@@ -1,4 +1,36 @@
1
- import type { EventPayload } from '@almadar/core';
1
+ /**
2
+ * useUISlots Hook
3
+ *
4
+ * Core hook for managing UI slot rendering in the trait-driven architecture.
5
+ * Traits use render_ui effects to dynamically render content into slots.
6
+ *
7
+ * Slots:
8
+ * - main: Primary content area
9
+ * - sidebar: Left/right sidebar
10
+ * - modal: Modal overlay
11
+ * - drawer: Slide-in drawer
12
+ * - overlay: Full-screen overlay
13
+ * - center: Centered popup
14
+ * - toast: Toast notifications
15
+ * - hud-top: Game HUD top bar
16
+ * - hud-bottom: Game HUD bottom bar
17
+ * - floating: Draggable floating panel
18
+ *
19
+ * Multi-source model (2026-04-24):
20
+ * A slot can receive renders from multiple source traits across independent
21
+ * batches (e.g. in the playground, ProbeCreate renders "main" on INIT, then
22
+ * later ProbePersistor cascades a render into "main" too). Prior code stored
23
+ * a single SlotContent per slot and last-writer-wins silently dropped
24
+ * earlier traits' frames. Internally the manager now holds a
25
+ * `Record<UISlot, Record<sourceKey, SlotContent>>` map and consumers see an
26
+ * aggregated view: a single SlotContent for single-source slots, or a
27
+ * synthetic `stack` wrapper when 2+ sources are active simultaneously.
28
+ * This mirrors the compiled-path page layout's VStack-of-trait-views.
29
+ *
30
+ * @packageDocumentation
31
+ */
32
+ import type React from 'react';
33
+ import type { EventPayloadValue, RenderItemLambda } from '@almadar/core';
2
34
  /**
3
35
  * Valid UI slot names
4
36
  */
@@ -8,13 +40,39 @@ export type UISlot = 'main' | 'sidebar' | 'modal' | 'drawer' | 'overlay' | 'cent
8
40
  */
9
41
  export type SlotAnimation = 'fade' | 'slide' | 'scale' | 'none';
10
42
  /**
11
- * Pattern-specific props carried by a rendered slot. Pattern authors decide
12
- * the concrete shape; the slot manager treats this as an opaque record of
13
- * field-like values sourced from the event-bus payload vocabulary so the
14
- * same types round-trip through render-ui useUISlots UISlotRenderer
15
- * without a private re-coercion boundary.
43
+ * Render-prop callback after fn-form-lambda conversion or
44
+ * `wrapCallbackForEvent` wrapping. Pattern components consume these as
45
+ * `renderItem` / `onTabChange` / `onClick` / etc. The arg list is
46
+ * contravariant (`never[]` accepts any caller shape event handlers,
47
+ * 2-arg `(item, index)` render-props, etc.); the return is the union of
48
+ * shapes seen at this layer. Pattern-level prop types narrow the
49
+ * signature for each consumer downstream.
50
+ */
51
+ export type SlotCallback = (...args: never[]) => void | React.ReactNode | EventPayloadValue;
52
+ /**
53
+ * Render-ui prop value: any leaf flowing from a `(render-ui slot {...})`
54
+ * effect into a React pattern component. The union enumerates every
55
+ * shape the renderer can receive — no `unknown` escape hatch.
56
+ *
57
+ * - JSON primitives (`string`, `number`, `boolean`, `Date`, `null`,
58
+ * `undefined`) come through `BindingResolver`.
59
+ * - `RenderItemLambda` is the unconverted tuple form `["fn", arg, body]`;
60
+ * `SlotCallback` is the post-conversion callable form.
61
+ * - `React.ReactNode` covers substituted `<TraitFrame>` elements.
62
+ * - The recursive array + object branches mirror the `EventPayloadValue`
63
+ * shape but with `SlotPropValue` leaves so functions and React nodes
64
+ * can appear at any depth (e.g. `tabs[].content: "@trait.X"` surviving
65
+ * substitution into a `ReactElement`).
66
+ */
67
+ export type SlotPropValue = string | number | boolean | Date | null | undefined | RenderItemLambda | SlotCallback | React.ReactElement | ReadonlyArray<SlotPropValue> | {
68
+ readonly [key: string]: SlotPropValue;
69
+ };
70
+ /**
71
+ * Pattern-specific props carried by a rendered slot. The slot manager
72
+ * routes these from `(render-ui slot {...})` effects to React pattern
73
+ * components without coercion.
16
74
  */
17
- export type SlotProps = Record<string, EventPayload[string] | unknown>;
75
+ export type SlotProps = Record<string, SlotPropValue>;
18
76
  /**
19
77
  * Content rendered in a slot
20
78
  */
@@ -38289,7 +38289,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
38289
38289
  if (!child || typeof child !== "object") return null;
38290
38290
  const childId = `${parentId}-${index}`;
38291
38291
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
38292
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
38292
+ const childAsRecord = child;
38293
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
38293
38294
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
38294
38295
  if (_childChildren !== void 0 && nestedProps === void 0) {
38295
38296
  resolvedProps.children = _childChildren;
@@ -38317,7 +38318,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
38317
38318
  });
38318
38319
  }
38319
38320
  function isPatternConfig(value) {
38320
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
38321
+ if (value === null || value === void 0) return false;
38322
+ if (typeof value !== "object") return false;
38323
+ if (Array.isArray(value)) return false;
38324
+ if (React115__namespace.default.isValidElement(value)) return false;
38325
+ if (value instanceof Date) return false;
38326
+ if (typeof value === "function") return false;
38327
+ const record = value;
38328
+ return "type" in record && typeof record.type === "string";
38329
+ }
38330
+ function isPlainConfigObject(value) {
38331
+ if (React115__namespace.default.isValidElement(value)) return false;
38332
+ if (value instanceof Date) return false;
38333
+ const proto = Object.getPrototypeOf(value);
38334
+ return proto === Object.prototype || proto === null;
38335
+ }
38336
+ function substituteTraitRefsDeep(value, pathKey) {
38337
+ if (typeof value === "string") {
38338
+ const match = TRAIT_BINDING_RE.exec(value);
38339
+ if (match) {
38340
+ const traitName = match[1];
38341
+ return /* @__PURE__ */ jsxRuntime.jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
38342
+ }
38343
+ return value;
38344
+ }
38345
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
38346
+ return value;
38347
+ }
38348
+ if (Array.isArray(value)) {
38349
+ return value.map(
38350
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
38351
+ );
38352
+ }
38353
+ if (typeof value === "object" && isPlainConfigObject(value)) {
38354
+ const out = {};
38355
+ for (const [k, v] of Object.entries(value)) {
38356
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
38357
+ }
38358
+ return out;
38359
+ }
38360
+ return value;
38321
38361
  }
38322
38362
  function renderPatternProps(props, onDismiss) {
38323
38363
  const rendered = {};
@@ -38325,17 +38365,19 @@ function renderPatternProps(props, onDismiss) {
38325
38365
  if (key === "children") {
38326
38366
  rendered[key] = value;
38327
38367
  } else if (isPatternConfig(value)) {
38368
+ const nestedProps = {};
38369
+ for (const [k, v] of Object.entries(value)) {
38370
+ if (k !== "type") nestedProps[k] = v;
38371
+ }
38328
38372
  const childContent = {
38329
38373
  id: `prop-${key}`,
38330
38374
  pattern: value.type,
38331
- props: Object.fromEntries(
38332
- Object.entries(value).filter(([k]) => k !== "type")
38333
- ),
38375
+ props: nestedProps,
38334
38376
  priority: 0
38335
38377
  };
38336
38378
  rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
38337
38379
  } else {
38338
- rendered[key] = value;
38380
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
38339
38381
  }
38340
38382
  }
38341
38383
  return rendered;
@@ -38244,7 +38244,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
38244
38244
  if (!child || typeof child !== "object") return null;
38245
38245
  const childId = `${parentId}-${index}`;
38246
38246
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
38247
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
38247
+ const childAsRecord = child;
38248
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
38248
38249
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
38249
38250
  if (_childChildren !== void 0 && nestedProps === void 0) {
38250
38251
  resolvedProps.children = _childChildren;
@@ -38272,7 +38273,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
38272
38273
  });
38273
38274
  }
38274
38275
  function isPatternConfig(value) {
38275
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
38276
+ if (value === null || value === void 0) return false;
38277
+ if (typeof value !== "object") return false;
38278
+ if (Array.isArray(value)) return false;
38279
+ if (React115__default.isValidElement(value)) return false;
38280
+ if (value instanceof Date) return false;
38281
+ if (typeof value === "function") return false;
38282
+ const record = value;
38283
+ return "type" in record && typeof record.type === "string";
38284
+ }
38285
+ function isPlainConfigObject(value) {
38286
+ if (React115__default.isValidElement(value)) return false;
38287
+ if (value instanceof Date) return false;
38288
+ const proto = Object.getPrototypeOf(value);
38289
+ return proto === Object.prototype || proto === null;
38290
+ }
38291
+ function substituteTraitRefsDeep(value, pathKey) {
38292
+ if (typeof value === "string") {
38293
+ const match = TRAIT_BINDING_RE.exec(value);
38294
+ if (match) {
38295
+ const traitName = match[1];
38296
+ return /* @__PURE__ */ jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
38297
+ }
38298
+ return value;
38299
+ }
38300
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
38301
+ return value;
38302
+ }
38303
+ if (Array.isArray(value)) {
38304
+ return value.map(
38305
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
38306
+ );
38307
+ }
38308
+ if (typeof value === "object" && isPlainConfigObject(value)) {
38309
+ const out = {};
38310
+ for (const [k, v] of Object.entries(value)) {
38311
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
38312
+ }
38313
+ return out;
38314
+ }
38315
+ return value;
38276
38316
  }
38277
38317
  function renderPatternProps(props, onDismiss) {
38278
38318
  const rendered = {};
@@ -38280,17 +38320,19 @@ function renderPatternProps(props, onDismiss) {
38280
38320
  if (key === "children") {
38281
38321
  rendered[key] = value;
38282
38322
  } else if (isPatternConfig(value)) {
38323
+ const nestedProps = {};
38324
+ for (const [k, v] of Object.entries(value)) {
38325
+ if (k !== "type") nestedProps[k] = v;
38326
+ }
38283
38327
  const childContent = {
38284
38328
  id: `prop-${key}`,
38285
38329
  pattern: value.type,
38286
- props: Object.fromEntries(
38287
- Object.entries(value).filter(([k]) => k !== "type")
38288
- ),
38330
+ props: nestedProps,
38289
38331
  priority: 0
38290
38332
  };
38291
38333
  rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
38292
38334
  } else {
38293
- rendered[key] = value;
38335
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
38294
38336
  }
38295
38337
  }
38296
38338
  return rendered;
@@ -10,17 +10,18 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  import type { EntityRow, RenderItemLambda } from "@almadar/core";
13
- export declare function isFnFormLambda(value: unknown): value is RenderItemLambda;
13
+ import type { SlotProps, SlotPropValue } from "../hooks/useUISlots";
14
+ export declare function isFnFormLambda(value: SlotPropValue): value is RenderItemLambda;
14
15
  /**
15
16
  * Walk a pattern body replacing every `@<argName>.path` string with the
16
17
  * value at `path` of `arg`. Mirrors the compiler's inline substitution
17
18
  * for `renderItem` lambda bodies.
18
19
  */
19
- export declare function resolveLambdaBindings(body: unknown, argName: string, arg: EntityRow): unknown;
20
+ export declare function resolveLambdaBindings(body: SlotPropValue, argName: string, arg: EntityRow): SlotPropValue;
20
21
  /**
21
22
  * Walk a pattern's props (and recursively their nested children),
22
23
  * converting every fn-form lambda value into a React render-prop
23
24
  * function. Pure on inputs without lambdas: returns the props object
24
25
  * unchanged by reference.
25
26
  */
26
- export declare function convertFnFormLambdasInProps(props: Record<string, unknown>): Record<string, unknown>;
27
+ export declare function convertFnFormLambdasInProps(props: SlotProps): SlotProps;
@@ -37882,7 +37882,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37882
37882
  if (!child || typeof child !== "object") return null;
37883
37883
  const childId = `${parentId}-${index}`;
37884
37884
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
37885
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
37885
+ const childAsRecord = child;
37886
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
37886
37887
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
37887
37888
  if (_childChildren !== void 0 && nestedProps === void 0) {
37888
37889
  resolvedProps.children = _childChildren;
@@ -37910,7 +37911,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37910
37911
  });
37911
37912
  }
37912
37913
  function isPatternConfig(value) {
37913
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
37914
+ if (value === null || value === void 0) return false;
37915
+ if (typeof value !== "object") return false;
37916
+ if (Array.isArray(value)) return false;
37917
+ if (React113__namespace.default.isValidElement(value)) return false;
37918
+ if (value instanceof Date) return false;
37919
+ if (typeof value === "function") return false;
37920
+ const record = value;
37921
+ return "type" in record && typeof record.type === "string";
37922
+ }
37923
+ function isPlainConfigObject(value) {
37924
+ if (React113__namespace.default.isValidElement(value)) return false;
37925
+ if (value instanceof Date) return false;
37926
+ const proto = Object.getPrototypeOf(value);
37927
+ return proto === Object.prototype || proto === null;
37928
+ }
37929
+ function substituteTraitRefsDeep(value, pathKey) {
37930
+ if (typeof value === "string") {
37931
+ const match = TRAIT_BINDING_RE.exec(value);
37932
+ if (match) {
37933
+ const traitName = match[1];
37934
+ return /* @__PURE__ */ jsxRuntime.jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
37935
+ }
37936
+ return value;
37937
+ }
37938
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
37939
+ return value;
37940
+ }
37941
+ if (Array.isArray(value)) {
37942
+ return value.map(
37943
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
37944
+ );
37945
+ }
37946
+ if (typeof value === "object" && isPlainConfigObject(value)) {
37947
+ const out = {};
37948
+ for (const [k, v] of Object.entries(value)) {
37949
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
37950
+ }
37951
+ return out;
37952
+ }
37953
+ return value;
37914
37954
  }
37915
37955
  function renderPatternProps(props, onDismiss) {
37916
37956
  const rendered = {};
@@ -37918,17 +37958,19 @@ function renderPatternProps(props, onDismiss) {
37918
37958
  if (key === "children") {
37919
37959
  rendered[key] = value;
37920
37960
  } else if (isPatternConfig(value)) {
37961
+ const nestedProps = {};
37962
+ for (const [k, v] of Object.entries(value)) {
37963
+ if (k !== "type") nestedProps[k] = v;
37964
+ }
37921
37965
  const childContent = {
37922
37966
  id: `prop-${key}`,
37923
37967
  pattern: value.type,
37924
- props: Object.fromEntries(
37925
- Object.entries(value).filter(([k]) => k !== "type")
37926
- ),
37968
+ props: nestedProps,
37927
37969
  priority: 0
37928
37970
  };
37929
37971
  rendered[key] = /* @__PURE__ */ jsxRuntime.jsx(SlotContentRenderer, { content: childContent, onDismiss });
37930
37972
  } else {
37931
- rendered[key] = value;
37973
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
37932
37974
  }
37933
37975
  }
37934
37976
  return rendered;
@@ -38271,7 +38313,7 @@ function resolveLambdaBindings(body, argName, arg) {
38271
38313
  let cur = arg;
38272
38314
  for (const seg of path.split(".")) {
38273
38315
  if (cur === null || cur === void 0) return void 0;
38274
- if (typeof cur !== "object") return void 0;
38316
+ if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
38275
38317
  cur = cur[seg];
38276
38318
  }
38277
38319
  return cur;
@@ -38287,7 +38329,7 @@ function resolveLambdaBindings(body, argName, arg) {
38287
38329
  if (Array.isArray(body)) {
38288
38330
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
38289
38331
  }
38290
- if (body !== null && typeof body === "object") {
38332
+ if (body !== null && typeof body === "object" && !React113__namespace.default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
38291
38333
  const out = {};
38292
38334
  for (const [k, v] of Object.entries(body)) {
38293
38335
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -38306,7 +38348,7 @@ function getSlotContentRenderer2() {
38306
38348
  function makeLambdaFn(argName, lambdaBody, callerKey) {
38307
38349
  return (item, index) => {
38308
38350
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
38309
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
38351
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React113__namespace.default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
38310
38352
  return null;
38311
38353
  }
38312
38354
  const record = resolvedBody;
@@ -38314,12 +38356,14 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
38314
38356
  return null;
38315
38357
  }
38316
38358
  const SlotContentRenderer2 = getSlotContentRenderer2();
38359
+ const childProps = {};
38360
+ for (const [k, v] of Object.entries(record)) {
38361
+ if (k !== "type") childProps[k] = v;
38362
+ }
38317
38363
  const childContent = {
38318
38364
  id: `lambda-${callerKey}-${index}`,
38319
38365
  pattern: record.type,
38320
- props: Object.fromEntries(
38321
- Object.entries(record).filter(([k]) => k !== "type")
38322
- ),
38366
+ props: childProps,
38323
38367
  priority: 0
38324
38368
  };
38325
38369
  return React113__namespace.default.createElement(SlotContentRenderer2, { content: childContent });
@@ -38332,15 +38376,16 @@ function convertNode(node, callerKey) {
38332
38376
  const [, argName, body] = node;
38333
38377
  return makeLambdaFn(argName, body, callerKey);
38334
38378
  }
38379
+ const arr = node;
38335
38380
  let anyChanged = false;
38336
- const mapped = node.map((item, i) => {
38381
+ const mapped = arr.map((item, i) => {
38337
38382
  const next = convertNode(item, `${callerKey}[${i}]`);
38338
38383
  if (next !== item) anyChanged = true;
38339
38384
  return next;
38340
38385
  });
38341
38386
  return anyChanged ? mapped : node;
38342
38387
  }
38343
- if (typeof node === "object") {
38388
+ if (typeof node === "object" && !React113__namespace.default.isValidElement(node) && !(node instanceof Date)) {
38344
38389
  return convertObjectProps(node);
38345
38390
  }
38346
38391
  return node;
@@ -37837,7 +37837,8 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37837
37837
  if (!child || typeof child !== "object") return null;
37838
37838
  const childId = `${parentId}-${index}`;
37839
37839
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
37840
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = child;
37840
+ const childAsRecord = child;
37841
+ const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
37841
37842
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
37842
37843
  if (_childChildren !== void 0 && nestedProps === void 0) {
37843
37844
  resolvedProps.children = _childChildren;
@@ -37865,7 +37866,46 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
37865
37866
  });
37866
37867
  }
37867
37868
  function isPatternConfig(value) {
37868
- return value !== null && typeof value === "object" && !Array.isArray(value) && "type" in value && typeof value.type === "string";
37869
+ if (value === null || value === void 0) return false;
37870
+ if (typeof value !== "object") return false;
37871
+ if (Array.isArray(value)) return false;
37872
+ if (React113__default.isValidElement(value)) return false;
37873
+ if (value instanceof Date) return false;
37874
+ if (typeof value === "function") return false;
37875
+ const record = value;
37876
+ return "type" in record && typeof record.type === "string";
37877
+ }
37878
+ function isPlainConfigObject(value) {
37879
+ if (React113__default.isValidElement(value)) return false;
37880
+ if (value instanceof Date) return false;
37881
+ const proto = Object.getPrototypeOf(value);
37882
+ return proto === Object.prototype || proto === null;
37883
+ }
37884
+ function substituteTraitRefsDeep(value, pathKey) {
37885
+ if (typeof value === "string") {
37886
+ const match = TRAIT_BINDING_RE.exec(value);
37887
+ if (match) {
37888
+ const traitName = match[1];
37889
+ return /* @__PURE__ */ jsx(TraitFrame, { traitName }, `${pathKey}:${traitName}`);
37890
+ }
37891
+ return value;
37892
+ }
37893
+ if (typeof value === "number" || typeof value === "boolean" || value === null || value === void 0 || typeof value === "function") {
37894
+ return value;
37895
+ }
37896
+ if (Array.isArray(value)) {
37897
+ return value.map(
37898
+ (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
37899
+ );
37900
+ }
37901
+ if (typeof value === "object" && isPlainConfigObject(value)) {
37902
+ const out = {};
37903
+ for (const [k, v] of Object.entries(value)) {
37904
+ out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
37905
+ }
37906
+ return out;
37907
+ }
37908
+ return value;
37869
37909
  }
37870
37910
  function renderPatternProps(props, onDismiss) {
37871
37911
  const rendered = {};
@@ -37873,17 +37913,19 @@ function renderPatternProps(props, onDismiss) {
37873
37913
  if (key === "children") {
37874
37914
  rendered[key] = value;
37875
37915
  } else if (isPatternConfig(value)) {
37916
+ const nestedProps = {};
37917
+ for (const [k, v] of Object.entries(value)) {
37918
+ if (k !== "type") nestedProps[k] = v;
37919
+ }
37876
37920
  const childContent = {
37877
37921
  id: `prop-${key}`,
37878
37922
  pattern: value.type,
37879
- props: Object.fromEntries(
37880
- Object.entries(value).filter(([k]) => k !== "type")
37881
- ),
37923
+ props: nestedProps,
37882
37924
  priority: 0
37883
37925
  };
37884
37926
  rendered[key] = /* @__PURE__ */ jsx(SlotContentRenderer, { content: childContent, onDismiss });
37885
37927
  } else {
37886
- rendered[key] = value;
37928
+ rendered[key] = substituteTraitRefsDeep(value, `prop:${key}`);
37887
37929
  }
37888
37930
  }
37889
37931
  return rendered;
@@ -38226,7 +38268,7 @@ function resolveLambdaBindings(body, argName, arg) {
38226
38268
  let cur = arg;
38227
38269
  for (const seg of path.split(".")) {
38228
38270
  if (cur === null || cur === void 0) return void 0;
38229
- if (typeof cur !== "object") return void 0;
38271
+ if (typeof cur !== "object" || Array.isArray(cur)) return void 0;
38230
38272
  cur = cur[seg];
38231
38273
  }
38232
38274
  return cur;
@@ -38242,7 +38284,7 @@ function resolveLambdaBindings(body, argName, arg) {
38242
38284
  if (Array.isArray(body)) {
38243
38285
  return body.map((b) => resolveLambdaBindings(b, argName, arg));
38244
38286
  }
38245
- if (body !== null && typeof body === "object") {
38287
+ if (body !== null && typeof body === "object" && !React113__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
38246
38288
  const out = {};
38247
38289
  for (const [k, v] of Object.entries(body)) {
38248
38290
  out[k] = resolveLambdaBindings(v, argName, arg);
@@ -38261,7 +38303,7 @@ function getSlotContentRenderer2() {
38261
38303
  function makeLambdaFn(argName, lambdaBody, callerKey) {
38262
38304
  return (item, index) => {
38263
38305
  const resolvedBody = resolveLambdaBindings(lambdaBody, argName, item);
38264
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody)) {
38306
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React113__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
38265
38307
  return null;
38266
38308
  }
38267
38309
  const record = resolvedBody;
@@ -38269,12 +38311,14 @@ function makeLambdaFn(argName, lambdaBody, callerKey) {
38269
38311
  return null;
38270
38312
  }
38271
38313
  const SlotContentRenderer2 = getSlotContentRenderer2();
38314
+ const childProps = {};
38315
+ for (const [k, v] of Object.entries(record)) {
38316
+ if (k !== "type") childProps[k] = v;
38317
+ }
38272
38318
  const childContent = {
38273
38319
  id: `lambda-${callerKey}-${index}`,
38274
38320
  pattern: record.type,
38275
- props: Object.fromEntries(
38276
- Object.entries(record).filter(([k]) => k !== "type")
38277
- ),
38321
+ props: childProps,
38278
38322
  priority: 0
38279
38323
  };
38280
38324
  return React113__default.createElement(SlotContentRenderer2, { content: childContent });
@@ -38287,15 +38331,16 @@ function convertNode(node, callerKey) {
38287
38331
  const [, argName, body] = node;
38288
38332
  return makeLambdaFn(argName, body, callerKey);
38289
38333
  }
38334
+ const arr = node;
38290
38335
  let anyChanged = false;
38291
- const mapped = node.map((item, i) => {
38336
+ const mapped = arr.map((item, i) => {
38292
38337
  const next = convertNode(item, `${callerKey}[${i}]`);
38293
38338
  if (next !== item) anyChanged = true;
38294
38339
  return next;
38295
38340
  });
38296
38341
  return anyChanged ? mapped : node;
38297
38342
  }
38298
- if (typeof node === "object") {
38343
+ if (typeof node === "object" && !React113__default.isValidElement(node) && !(node instanceof Date)) {
38299
38344
  return convertObjectProps(node);
38300
38345
  }
38301
38346
  return node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.24.0",
3
+ "version": "4.25.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -118,7 +118,7 @@
118
118
  "access": "public"
119
119
  },
120
120
  "dependencies": {
121
- "@almadar/core": "^7.10.0",
121
+ "@almadar/core": ">=7.12.0",
122
122
  "@almadar/evaluator": ">=2.9.2",
123
123
  "@almadar/patterns": "^2.20.2",
124
124
  "@almadar/runtime": "^6.0.0",