@inf-monkeys-tech/monkeys-design 2.0.23 → 2.0.24

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.
@@ -2524,6 +2524,12 @@ var LAYOUT_MODE_CLASSES = {
2524
2524
  };
2525
2525
  var ALIGN_CLASSES = { start: "items-start", center: "items-center", end: "items-end", stretch: "items-stretch" };
2526
2526
  var JUSTIFY_CLASSES = { start: "justify-start", center: "justify-center", end: "justify-end", between: "justify-between", around: "justify-around" };
2527
+ var tokenPathToCssVariable = (value) => {
2528
+ const path = value.slice(1).trim();
2529
+ if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/i.test(path)) throw new TypeError(`Invalid Design Token path ${value}.`);
2530
+ return `var(--monkeys-${path.replace(/\./g, "-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()})`;
2531
+ };
2532
+ var resolveRenderNodeStyle = (style) => style ? Object.fromEntries(Object.entries(style).map(([property, value]) => [property, typeof value === "string" && value.startsWith("$") ? tokenPathToCssVariable(value) : value])) : void 0;
2527
2533
  var getRenderLayoutClassName = (layout) => cn(
2528
2534
  LAYOUT_MODE_CLASSES[layout.mode],
2529
2535
  layout.mode === "flex" && (layout.direction === "row" ? "flex-row" : "flex-col"),
@@ -2674,6 +2680,7 @@ var RenderNodeHost = react.forwardRef(function RenderNodeHost2({
2674
2680
  className: cn((!unframed || resolvedLayout.mode !== "contents") && getRenderLayoutClassName(resolvedLayout), className),
2675
2681
  style: {
2676
2682
  ...resolvedLayout.mode === "grid" && resolvedLayout.columns ? { gridTemplateColumns: `repeat(${resolvedLayout.columns}, minmax(0, 1fr))` } : {},
2683
+ ...resolveRenderNodeStyle(node.style),
2677
2684
  ...props.style
2678
2685
  },
2679
2686
  hidden: hidden || !policyState.visible || void 0,