@inf-monkeys-tech/monkeys 1.1.14 → 1.1.16
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 +6 -0
- package/lib/contracts/declarative-control-http.d.ts +340 -0
- package/lib/contracts/declarative-control-http.d.ts.map +1 -1
- package/lib/contracts/declarative-control.d.ts +42 -0
- package/lib/contracts/declarative-control.d.ts.map +1 -1
- package/lib/contracts/declarative-control.js +46 -2
- package/lib/contracts/declarative-control.js.map +1 -1
- package/lib/contracts/declarative-document-import.d.ts +50 -0
- package/lib/contracts/declarative-document-import.d.ts.map +1 -1
- package/lib/contracts/declarative-publication-job.d.ts +80 -0
- package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
- package/lib/esm/contracts/index.mjs +67 -0
- package/lib/esm/contracts/index.mjs.map +1 -1
- package/lib/esm/index.mjs +69 -0
- package/lib/esm/index.mjs.map +1 -1
- package/lib/esm/runtime/index.mjs +68 -0
- package/lib/esm/runtime/index.mjs.map +1 -1
- package/lib/esm/schemas/index.mjs +66 -0
- package/lib/esm/schemas/index.mjs.map +1 -1
- package/lib/json-schema/page-runtime-bundle.schema.json +77 -0
- package/lib/json-schema/page.schema.json +77 -0
- package/lib/runtime/declarative-control-compiler.d.ts.map +1 -1
- package/lib/runtime/declarative-control-compiler.js +2 -0
- package/lib/runtime/declarative-control-compiler.js.map +1 -1
- package/lib/schemas/index.d.ts +20 -0
- package/lib/schemas/index.d.ts.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
|
@@ -12167,6 +12167,34 @@ var PageNodeSchema = z15.lazy(
|
|
|
12167
12167
|
children: z15.array(PageNodeSchema).optional()
|
|
12168
12168
|
}).strict()
|
|
12169
12169
|
);
|
|
12170
|
+
var PageSharedStateBindingSchema = z15.object({
|
|
12171
|
+
bindingId: ContractIdentifierSchema,
|
|
12172
|
+
provider: z15.object({ id: ContractIdentifierSchema, version: z15.number().int().positive() }).strict(),
|
|
12173
|
+
states: z15.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length > 0 && Object.keys(value).length <= 32, "Map 1\u201332 state slots."),
|
|
12174
|
+
queries: z15.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length <= 16, "Map at most 16 query slots."),
|
|
12175
|
+
writeInteractions: z15.array(ContractIdentifierSchema).max(32)
|
|
12176
|
+
}).strict();
|
|
12177
|
+
var validateSharedStateBindings = (bindings, states, queryIds, interactions, context) => {
|
|
12178
|
+
const ids = /* @__PURE__ */ new Set();
|
|
12179
|
+
const owned = /* @__PURE__ */ new Set();
|
|
12180
|
+
for (const [index, binding] of (bindings ?? []).entries()) {
|
|
12181
|
+
const issue = (message) => context.addIssue({ code: "custom", path: ["sharedStateBindings", index], message });
|
|
12182
|
+
if (ids.has(binding.bindingId)) issue("Shared state binding ids must be unique.");
|
|
12183
|
+
ids.add(binding.bindingId);
|
|
12184
|
+
const mapped = Object.values(binding.states);
|
|
12185
|
+
for (const id of mapped) {
|
|
12186
|
+
if (owned.has(id)) issue("Shared state mappings must have one owner and distinct slots.");
|
|
12187
|
+
owned.add(id);
|
|
12188
|
+
if (!states.some((state) => state.stateId === id && !state.scopeNodeId)) issue(`Shared state ${id} must reference a declared root state.`);
|
|
12189
|
+
}
|
|
12190
|
+
for (const id of Object.values(binding.queries)) if (!queryIds.has(id)) issue(`Unknown shared state query ${id}.`);
|
|
12191
|
+
if (new Set(binding.writeInteractions).size !== binding.writeInteractions.length) issue("Shared state write interactions must be unique.");
|
|
12192
|
+
for (const id of binding.writeInteractions) {
|
|
12193
|
+
const interaction = interactions.find((entry) => entry.bindingId === id);
|
|
12194
|
+
if (!interaction || !mapped.includes(interaction.targetStateId)) issue(`Shared state write ${id} must target a mapped state.`);
|
|
12195
|
+
}
|
|
12196
|
+
}
|
|
12197
|
+
};
|
|
12170
12198
|
var PageSchema = z15.object({
|
|
12171
12199
|
contract: z15.literal("Page"),
|
|
12172
12200
|
schemaVersion: z15.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
|
|
@@ -12181,6 +12209,7 @@ var PageSchema = z15.object({
|
|
|
12181
12209
|
shell: ContractIdentifierSchema.optional(),
|
|
12182
12210
|
body: PageNodeSchema,
|
|
12183
12211
|
state: z15.array(PageStateSchema).optional(),
|
|
12212
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
12184
12213
|
entryTransitions: z15.array(PageEntrySchema).optional(),
|
|
12185
12214
|
access: AccessPolicySchema,
|
|
12186
12215
|
managementAccess: ManagementAccessSchema,
|
|
@@ -12193,6 +12222,7 @@ var PageSchema = z15.object({
|
|
|
12193
12222
|
const dataIds = /* @__PURE__ */ new Set();
|
|
12194
12223
|
const actionIds = /* @__PURE__ */ new Set();
|
|
12195
12224
|
const interactionIds = /* @__PURE__ */ new Set();
|
|
12225
|
+
const sharedInteractions = [];
|
|
12196
12226
|
const visit = (node, path) => {
|
|
12197
12227
|
if (ids.has(node.id))
|
|
12198
12228
|
context.addIssue({
|
|
@@ -12215,11 +12245,13 @@ var PageSchema = z15.object({
|
|
|
12215
12245
|
});
|
|
12216
12246
|
target.add(value.bindingId);
|
|
12217
12247
|
}
|
|
12248
|
+
sharedInteractions.push(...node.on ?? []);
|
|
12218
12249
|
(node.children ?? []).forEach(
|
|
12219
12250
|
(child, index) => visit(child, [...path, "children", index])
|
|
12220
12251
|
);
|
|
12221
12252
|
};
|
|
12222
12253
|
visit(page.body, ["body"]);
|
|
12254
|
+
validateSharedStateBindings(page.sharedStateBindings, page.state ?? [], dataIds, sharedInteractions, context);
|
|
12223
12255
|
const stateIds = (page.state ?? []).map((entry) => entry.stateId);
|
|
12224
12256
|
if (new Set(stateIds).size !== stateIds.length)
|
|
12225
12257
|
context.addIssue({
|
|
@@ -12249,6 +12281,7 @@ var ResolvedPageSchema = z15.object({
|
|
|
12249
12281
|
renderTree: RenderTreeSchema,
|
|
12250
12282
|
capabilityInstances: z15.array(CapabilityInstanceSchema).min(1),
|
|
12251
12283
|
stateDefinitions: z15.array(PageStateDefinitionSchema).optional(),
|
|
12284
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
12252
12285
|
entryTransitions: z15.array(PageEntryTransitionSchema).optional(),
|
|
12253
12286
|
interactionBindings: z15.array(InteractionBindingSchema).optional(),
|
|
12254
12287
|
ontologyBindings: z15.array(PersistedOntologyBindingSchema),
|
|
@@ -12291,6 +12324,7 @@ var ResolvedPageSchema = z15.object({
|
|
|
12291
12324
|
});
|
|
12292
12325
|
}
|
|
12293
12326
|
});
|
|
12327
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions ?? [], new Set([...value.queryBindings ?? [], ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings ?? [], context);
|
|
12294
12328
|
const stateDefinitions = value.stateDefinitions ?? [];
|
|
12295
12329
|
const entryTransitions = value.entryTransitions ?? [];
|
|
12296
12330
|
const interactionBindings = value.interactionBindings ?? [];
|
|
@@ -14047,6 +14081,7 @@ var CompatiblePageRuntimeBundleSchema = z15.object({
|
|
|
14047
14081
|
deniedCapabilityInstanceIds: z15.array(ContractIdentifierSchema).default([]),
|
|
14048
14082
|
capabilityAccessEvaluated: z15.literal(true).optional(),
|
|
14049
14083
|
stateDefinitions: z15.array(PageStateDefinitionSchema).default([]),
|
|
14084
|
+
sharedStateBindings: z15.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
14050
14085
|
entryTransitions: z15.array(ResolvedPageEntryTransitionSchema).default([]),
|
|
14051
14086
|
interactionBindings: z15.array(InteractionBindingSchema).default([]),
|
|
14052
14087
|
ontologyBindings: z15.array(PersistedOntologyBindingSchema),
|
|
@@ -14063,6 +14098,7 @@ var CompatiblePageRuntimeBundleSchema = z15.object({
|
|
|
14063
14098
|
"restricted"
|
|
14064
14099
|
])
|
|
14065
14100
|
}).strict().superRefine((value, context) => {
|
|
14101
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions, new Set([...value.queryBindings, ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings, context);
|
|
14066
14102
|
const instanceIds = new Set(
|
|
14067
14103
|
value.capabilityInstances.map((instance) => instance.instanceId)
|
|
14068
14104
|
);
|
|
@@ -19248,6 +19284,7 @@ function resolveThemeTokens(input) {
|
|
|
19248
19284
|
return result;
|
|
19249
19285
|
};
|
|
19250
19286
|
for (const path of collected.keys()) resolveToken(path);
|
|
19287
|
+
assertBentoTokens(resolved);
|
|
19251
19288
|
const resolvedDocument = {};
|
|
19252
19289
|
for (const token of resolved.values()) {
|
|
19253
19290
|
const segments = token.path.split(".");
|
|
@@ -19360,6 +19397,35 @@ function assertMonkeysThemeTokensComplete(input) {
|
|
|
19360
19397
|
}
|
|
19361
19398
|
return resolved.document;
|
|
19362
19399
|
}
|
|
19400
|
+
function assertBentoTokens(tokens) {
|
|
19401
|
+
const fields = {
|
|
19402
|
+
background: "color",
|
|
19403
|
+
borderColor: "color",
|
|
19404
|
+
borderWidth: "dimension",
|
|
19405
|
+
borderStyle: "strokeStyle",
|
|
19406
|
+
radius: "dimension",
|
|
19407
|
+
shadow: "shadow",
|
|
19408
|
+
padding: "dimension",
|
|
19409
|
+
gap: "dimension"
|
|
19410
|
+
};
|
|
19411
|
+
for (const [path, token] of tokens) {
|
|
19412
|
+
if (!path.startsWith("semantic.bento.")) continue;
|
|
19413
|
+
const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
|
|
19414
|
+
const field = match?.[2];
|
|
19415
|
+
const axis = match?.[3];
|
|
19416
|
+
const expected = field && fields[field];
|
|
19417
|
+
const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
|
|
19418
|
+
if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
|
|
19419
|
+
throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
|
|
19420
|
+
}
|
|
19421
|
+
if (field === "borderStyle" && typeof token.value !== "string") {
|
|
19422
|
+
throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
|
|
19423
|
+
}
|
|
19424
|
+
if (token.type === "dimension" && token.value.value < 0) {
|
|
19425
|
+
throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
|
|
19426
|
+
}
|
|
19427
|
+
}
|
|
19428
|
+
}
|
|
19363
19429
|
|
|
19364
19430
|
// src/contracts/theme.ts
|
|
19365
19431
|
var ThemeTokenTypeSchema = z22.enum(THEME_TOKEN_TYPES);
|
|
@@ -23464,6 +23530,7 @@ var resolvePage = (input) => {
|
|
|
23464
23530
|
},
|
|
23465
23531
|
capabilityInstances,
|
|
23466
23532
|
...stateDefinitions.length ? { stateDefinitions } : {},
|
|
23533
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
23467
23534
|
...page.entryTransitions ? {
|
|
23468
23535
|
entryTransitions: page.entryTransitions.map(
|
|
23469
23536
|
({ target, ...transition }, index) => {
|
|
@@ -24151,6 +24218,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
24151
24218
|
capabilityInstances: page.capabilityInstances,
|
|
24152
24219
|
deniedCapabilityInstanceIds: [],
|
|
24153
24220
|
stateDefinitions: page.stateDefinitions,
|
|
24221
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
24154
24222
|
entryTransitions,
|
|
24155
24223
|
interactionBindings: page.interactionBindings,
|
|
24156
24224
|
ontologyBindings: page.ontologyBindings,
|
|
@@ -27455,6 +27523,7 @@ export {
|
|
|
27455
27523
|
PageRuntimeDescriptorSchema,
|
|
27456
27524
|
PageRuntimeProjectionSchema,
|
|
27457
27525
|
PageSchema,
|
|
27526
|
+
PageSharedStateBindingSchema,
|
|
27458
27527
|
PageStateActivationSchema,
|
|
27459
27528
|
PageStateConditionSchema,
|
|
27460
27529
|
PageStateDefinitionSchema,
|