@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.
@@ -18122,6 +18122,7 @@ function resolveThemeTokens(input) {
18122
18122
  return result;
18123
18123
  };
18124
18124
  for (const path of collected.keys()) resolveToken(path);
18125
+ assertBentoTokens(resolved);
18125
18126
  const resolvedDocument = {};
18126
18127
  for (const token of resolved.values()) {
18127
18128
  const segments = token.path.split(".");
@@ -18201,6 +18202,35 @@ var MONKEYS_REQUIRED_THEME_TOKEN_PATHS = Object.freeze({
18201
18202
  "semantic.spacing.global.comfortable": "dimension",
18202
18203
  "semantic.font.body": "fontFamily"
18203
18204
  });
18205
+ function assertBentoTokens(tokens) {
18206
+ const fields = {
18207
+ background: "color",
18208
+ borderColor: "color",
18209
+ borderWidth: "dimension",
18210
+ borderStyle: "strokeStyle",
18211
+ radius: "dimension",
18212
+ shadow: "shadow",
18213
+ padding: "dimension",
18214
+ gap: "dimension"
18215
+ };
18216
+ for (const [path, token] of tokens) {
18217
+ if (!path.startsWith("semantic.bento.")) continue;
18218
+ const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
18219
+ const field = match?.[2];
18220
+ const axis = match?.[3];
18221
+ const expected = field && fields[field];
18222
+ const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
18223
+ if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
18224
+ throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
18225
+ }
18226
+ if (field === "borderStyle" && typeof token.value !== "string") {
18227
+ throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
18228
+ }
18229
+ if (token.type === "dimension" && token.value.value < 0) {
18230
+ throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
18231
+ }
18232
+ }
18233
+ }
18204
18234
 
18205
18235
  // src/contracts/theme.ts
18206
18236
  var ThemeTokenTypeSchema = z20.enum(THEME_TOKEN_TYPES);