@inf-monkeys-tech/monkeys 1.1.13 → 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/README.md +1 -1
- package/lib/esm/contracts/index.mjs +30 -0
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +45 -3
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +45 -3
- 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/runtime/declarative-runtime-contract.d.ts.map +1 -1
- package/lib/runtime/declarative-runtime-contract.js +17 -4
- package/lib/runtime/declarative-runtime-contract.js.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);
|
|
@@ -26147,7 +26177,6 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
|
|
|
26147
26177
|
}
|
|
26148
26178
|
const manifestContract = (entry) => ({
|
|
26149
26179
|
kind: entry.manifest.kind,
|
|
26150
|
-
ports: entry.manifest.ports,
|
|
26151
26180
|
runtime: { ...entry.manifest.runtime, providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({ ...binding, providerRef: { ...binding.providerRef, version: void 0 } })) },
|
|
26152
26181
|
placement: entry.manifest.placement,
|
|
26153
26182
|
accessibility: entry.manifest.accessibility
|
|
@@ -26174,7 +26203,15 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
|
|
|
26174
26203
|
for (const direction of ["inputPorts", "outputPorts"]) {
|
|
26175
26204
|
const oldPorts = oldRegistration[direction];
|
|
26176
26205
|
const newPorts = newRegistration[direction];
|
|
26177
|
-
|
|
26206
|
+
const oldManifestPorts = previous.manifest.ports?.[direction === "inputPorts" ? "inputs" : "outputs"] ?? [];
|
|
26207
|
+
const newManifestPorts = next.manifest.ports?.[direction === "inputPorts" ? "inputs" : "outputs"] ?? [];
|
|
26208
|
+
for (const port of oldManifestPorts) {
|
|
26209
|
+
const replacement = newManifestPorts.find((candidate) => candidate.name === port.name);
|
|
26210
|
+
if (!replacement || canonicalContentHash(port) !== canonicalContentHash(replacement)) throw new TypeError("Published runtime port semantics changed.");
|
|
26211
|
+
}
|
|
26212
|
+
if (newManifestPorts.some((port) => port.required && !oldManifestPorts.some((previousPort) => previousPort.name === port.name)) || newPorts.some((port) => port.required && !oldPorts.some((previousPort) => previousPort.name === port.name))) {
|
|
26213
|
+
throw new TypeError("New runtime ports must be optional for published declarations.");
|
|
26214
|
+
}
|
|
26178
26215
|
for (const port of oldPorts) {
|
|
26179
26216
|
const replacement = newPorts.find((candidate) => candidate.name === port.name);
|
|
26180
26217
|
if (!replacement || port.required !== replacement.required || port.multiple !== replacement.multiple) throw new TypeError("Public runtime port cardinality changed.");
|
|
@@ -26188,7 +26225,12 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
|
|
|
26188
26225
|
if (canonicalContentHash(requirements(oldRegistration)) !== canonicalContentHash(requirements(newRegistration))) {
|
|
26189
26226
|
throw new TypeError("Runtime Ontology access requirements changed.");
|
|
26190
26227
|
}
|
|
26191
|
-
|
|
26228
|
+
const existingOutputs = new Set(oldRegistration.outputPorts.map((port) => port.name));
|
|
26229
|
+
const existingActions = newRegistration.actionRequirements.filter((requirement) => existingOutputs.has(requirement.outputPort));
|
|
26230
|
+
if (canonicalContentHash(oldRegistration.actionRequirements) !== canonicalContentHash(existingActions)) {
|
|
26231
|
+
throw new TypeError("Published output action and permission requirements changed.");
|
|
26232
|
+
}
|
|
26233
|
+
for (const key of ["allowedSideEffects", "allowedSlots", "supportedSurfaces", "allowedParentCapabilityRefs", "allowedChildCapabilityRefs"]) {
|
|
26192
26234
|
if (canonicalContentHash(oldRegistration[key]) !== canonicalContentHash(newRegistration[key])) throw new TypeError(`Runtime contract ${key} changed.`);
|
|
26193
26235
|
}
|
|
26194
26236
|
};
|