@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.
@@ -2502,6 +2502,12 @@ var LAYOUT_MODE_CLASSES = {
2502
2502
  };
2503
2503
  var ALIGN_CLASSES = { start: "items-start", center: "items-center", end: "items-end", stretch: "items-stretch" };
2504
2504
  var JUSTIFY_CLASSES = { start: "justify-start", center: "justify-center", end: "justify-end", between: "justify-between", around: "justify-around" };
2505
+ var tokenPathToCssVariable = (value) => {
2506
+ const path = value.slice(1).trim();
2507
+ if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/i.test(path)) throw new TypeError(`Invalid Design Token path ${value}.`);
2508
+ return `var(--monkeys-${path.replace(/\./g, "-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()})`;
2509
+ };
2510
+ var resolveRenderNodeStyle = (style) => style ? Object.fromEntries(Object.entries(style).map(([property, value]) => [property, typeof value === "string" && value.startsWith("$") ? tokenPathToCssVariable(value) : value])) : void 0;
2505
2511
  var getRenderLayoutClassName = (layout) => cn(
2506
2512
  LAYOUT_MODE_CLASSES[layout.mode],
2507
2513
  layout.mode === "flex" && (layout.direction === "row" ? "flex-row" : "flex-col"),
@@ -2652,6 +2658,7 @@ var RenderNodeHost = forwardRef(function RenderNodeHost2({
2652
2658
  className: cn((!unframed || resolvedLayout.mode !== "contents") && getRenderLayoutClassName(resolvedLayout), className),
2653
2659
  style: {
2654
2660
  ...resolvedLayout.mode === "grid" && resolvedLayout.columns ? { gridTemplateColumns: `repeat(${resolvedLayout.columns}, minmax(0, 1fr))` } : {},
2661
+ ...resolveRenderNodeStyle(node.style),
2655
2662
  ...props.style
2656
2663
  },
2657
2664
  hidden: hidden || !policyState.visible || void 0,