@inf-monkeys-tech/monkeys 1.1.14 → 1.1.15

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.
@@ -23591,6 +23591,7 @@ function resolveThemeTokens(input) {
23591
23591
  return result;
23592
23592
  };
23593
23593
  for (const path of collected.keys()) resolveToken(path);
23594
+ assertBentoTokens(resolved);
23594
23595
  const resolvedDocument = {};
23595
23596
  for (const token of resolved.values()) {
23596
23597
  const segments = token.path.split(".");
@@ -23703,6 +23704,35 @@ function assertMonkeysThemeTokensComplete(input) {
23703
23704
  }
23704
23705
  return resolved.document;
23705
23706
  }
23707
+ function assertBentoTokens(tokens) {
23708
+ const fields = {
23709
+ background: "color",
23710
+ borderColor: "color",
23711
+ borderWidth: "dimension",
23712
+ borderStyle: "strokeStyle",
23713
+ radius: "dimension",
23714
+ shadow: "shadow",
23715
+ padding: "dimension",
23716
+ gap: "dimension"
23717
+ };
23718
+ for (const [path, token] of tokens) {
23719
+ if (!path.startsWith("semantic.bento.")) continue;
23720
+ const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
23721
+ const field = match?.[2];
23722
+ const axis = match?.[3];
23723
+ const expected = field && fields[field];
23724
+ const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
23725
+ if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
23726
+ throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
23727
+ }
23728
+ if (field === "borderStyle" && typeof token.value !== "string") {
23729
+ throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
23730
+ }
23731
+ if (token.type === "dimension" && token.value.value < 0) {
23732
+ throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
23733
+ }
23734
+ }
23735
+ }
23706
23736
 
23707
23737
  // src/contracts/theme.ts
23708
23738
  var ThemeTokenTypeSchema = z16.enum(THEME_TOKEN_TYPES);