@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
|
@@ -18387,6 +18387,7 @@ function resolveThemeTokens(input) {
|
|
|
18387
18387
|
return result;
|
|
18388
18388
|
};
|
|
18389
18389
|
for (const path of collected.keys()) resolveToken(path);
|
|
18390
|
+
assertBentoTokens(resolved);
|
|
18390
18391
|
const resolvedDocument = {};
|
|
18391
18392
|
for (const token of resolved.values()) {
|
|
18392
18393
|
const segments = token.path.split(".");
|
|
@@ -18466,6 +18467,35 @@ var MONKEYS_REQUIRED_THEME_TOKEN_PATHS = Object.freeze({
|
|
|
18466
18467
|
"semantic.spacing.global.comfortable": "dimension",
|
|
18467
18468
|
"semantic.font.body": "fontFamily"
|
|
18468
18469
|
});
|
|
18470
|
+
function assertBentoTokens(tokens) {
|
|
18471
|
+
const fields = {
|
|
18472
|
+
background: "color",
|
|
18473
|
+
borderColor: "color",
|
|
18474
|
+
borderWidth: "dimension",
|
|
18475
|
+
borderStyle: "strokeStyle",
|
|
18476
|
+
radius: "dimension",
|
|
18477
|
+
shadow: "shadow",
|
|
18478
|
+
padding: "dimension",
|
|
18479
|
+
gap: "dimension"
|
|
18480
|
+
};
|
|
18481
|
+
for (const [path, token] of tokens) {
|
|
18482
|
+
if (!path.startsWith("semantic.bento.")) continue;
|
|
18483
|
+
const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
|
|
18484
|
+
const field = match?.[2];
|
|
18485
|
+
const axis = match?.[3];
|
|
18486
|
+
const expected = field && fields[field];
|
|
18487
|
+
const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
|
|
18488
|
+
if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
|
|
18489
|
+
throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
|
|
18490
|
+
}
|
|
18491
|
+
if (field === "borderStyle" && typeof token.value !== "string") {
|
|
18492
|
+
throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
|
|
18493
|
+
}
|
|
18494
|
+
if (token.type === "dimension" && token.value.value < 0) {
|
|
18495
|
+
throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
|
|
18496
|
+
}
|
|
18497
|
+
}
|
|
18498
|
+
}
|
|
18469
18499
|
|
|
18470
18500
|
// src/contracts/theme.ts
|
|
18471
18501
|
var ThemeTokenTypeSchema = z22.enum(THEME_TOKEN_TYPES);
|