@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.
- package/lib/esm/contracts/index.mjs +30 -0
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +30 -0
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +30 -0
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +30 -0
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/theme-tokens/core.d.ts.map +1 -1
- package/lib/theme-tokens/core.js +29 -0
- package/lib/theme-tokens/core.js.map +1 -1
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -19248,6 +19248,7 @@ function resolveThemeTokens(input) {
|
|
|
19248
19248
|
return result;
|
|
19249
19249
|
};
|
|
19250
19250
|
for (const path of collected.keys()) resolveToken(path);
|
|
19251
|
+
assertBentoTokens(resolved);
|
|
19251
19252
|
const resolvedDocument = {};
|
|
19252
19253
|
for (const token of resolved.values()) {
|
|
19253
19254
|
const segments = token.path.split(".");
|
|
@@ -19360,6 +19361,35 @@ function assertMonkeysThemeTokensComplete(input) {
|
|
|
19360
19361
|
}
|
|
19361
19362
|
return resolved.document;
|
|
19362
19363
|
}
|
|
19364
|
+
function assertBentoTokens(tokens) {
|
|
19365
|
+
const fields = {
|
|
19366
|
+
background: "color",
|
|
19367
|
+
borderColor: "color",
|
|
19368
|
+
borderWidth: "dimension",
|
|
19369
|
+
borderStyle: "strokeStyle",
|
|
19370
|
+
radius: "dimension",
|
|
19371
|
+
shadow: "shadow",
|
|
19372
|
+
padding: "dimension",
|
|
19373
|
+
gap: "dimension"
|
|
19374
|
+
};
|
|
19375
|
+
for (const [path, token] of tokens) {
|
|
19376
|
+
if (!path.startsWith("semantic.bento.")) continue;
|
|
19377
|
+
const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
|
|
19378
|
+
const field = match?.[2];
|
|
19379
|
+
const axis = match?.[3];
|
|
19380
|
+
const expected = field && fields[field];
|
|
19381
|
+
const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
|
|
19382
|
+
if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
|
|
19383
|
+
throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
|
|
19384
|
+
}
|
|
19385
|
+
if (field === "borderStyle" && typeof token.value !== "string") {
|
|
19386
|
+
throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
|
|
19387
|
+
}
|
|
19388
|
+
if (token.type === "dimension" && token.value.value < 0) {
|
|
19389
|
+
throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
|
|
19390
|
+
}
|
|
19391
|
+
}
|
|
19392
|
+
}
|
|
19363
19393
|
|
|
19364
19394
|
// src/contracts/theme.ts
|
|
19365
19395
|
var ThemeTokenTypeSchema = z22.enum(THEME_TOKEN_TYPES);
|