@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
|
@@ -12928,6 +12928,34 @@ var PageNodeSchema = z13.lazy(
|
|
|
12928
12928
|
children: z13.array(PageNodeSchema).optional()
|
|
12929
12929
|
}).strict()
|
|
12930
12930
|
);
|
|
12931
|
+
var PageSharedStateBindingSchema = z13.object({
|
|
12932
|
+
bindingId: ContractIdentifierSchema,
|
|
12933
|
+
provider: z13.object({ id: ContractIdentifierSchema, version: z13.number().int().positive() }).strict(),
|
|
12934
|
+
states: z13.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length > 0 && Object.keys(value).length <= 32, "Map 1\u201332 state slots."),
|
|
12935
|
+
queries: z13.record(ContractIdentifierSchema, ContractIdentifierSchema).refine((value) => Object.keys(value).length <= 16, "Map at most 16 query slots."),
|
|
12936
|
+
writeInteractions: z13.array(ContractIdentifierSchema).max(32)
|
|
12937
|
+
}).strict();
|
|
12938
|
+
var validateSharedStateBindings = (bindings, states, queryIds, interactions, context) => {
|
|
12939
|
+
const ids = /* @__PURE__ */ new Set();
|
|
12940
|
+
const owned = /* @__PURE__ */ new Set();
|
|
12941
|
+
for (const [index, binding] of (bindings ?? []).entries()) {
|
|
12942
|
+
const issue = (message) => context.addIssue({ code: "custom", path: ["sharedStateBindings", index], message });
|
|
12943
|
+
if (ids.has(binding.bindingId)) issue("Shared state binding ids must be unique.");
|
|
12944
|
+
ids.add(binding.bindingId);
|
|
12945
|
+
const mapped = Object.values(binding.states);
|
|
12946
|
+
for (const id of mapped) {
|
|
12947
|
+
if (owned.has(id)) issue("Shared state mappings must have one owner and distinct slots.");
|
|
12948
|
+
owned.add(id);
|
|
12949
|
+
if (!states.some((state) => state.stateId === id && !state.scopeNodeId)) issue(`Shared state ${id} must reference a declared root state.`);
|
|
12950
|
+
}
|
|
12951
|
+
for (const id of Object.values(binding.queries)) if (!queryIds.has(id)) issue(`Unknown shared state query ${id}.`);
|
|
12952
|
+
if (new Set(binding.writeInteractions).size !== binding.writeInteractions.length) issue("Shared state write interactions must be unique.");
|
|
12953
|
+
for (const id of binding.writeInteractions) {
|
|
12954
|
+
const interaction = interactions.find((entry) => entry.bindingId === id);
|
|
12955
|
+
if (!interaction || !mapped.includes(interaction.targetStateId)) issue(`Shared state write ${id} must target a mapped state.`);
|
|
12956
|
+
}
|
|
12957
|
+
}
|
|
12958
|
+
};
|
|
12931
12959
|
var PageSchema = z13.object({
|
|
12932
12960
|
contract: z13.literal("Page"),
|
|
12933
12961
|
schemaVersion: z13.literal(DECLARATIVE_CONTROL_SCHEMA_VERSION),
|
|
@@ -12942,6 +12970,7 @@ var PageSchema = z13.object({
|
|
|
12942
12970
|
shell: ContractIdentifierSchema.optional(),
|
|
12943
12971
|
body: PageNodeSchema,
|
|
12944
12972
|
state: z13.array(PageStateSchema).optional(),
|
|
12973
|
+
sharedStateBindings: z13.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
12945
12974
|
entryTransitions: z13.array(PageEntrySchema).optional(),
|
|
12946
12975
|
access: AccessPolicySchema,
|
|
12947
12976
|
managementAccess: ManagementAccessSchema,
|
|
@@ -12954,6 +12983,7 @@ var PageSchema = z13.object({
|
|
|
12954
12983
|
const dataIds = /* @__PURE__ */ new Set();
|
|
12955
12984
|
const actionIds = /* @__PURE__ */ new Set();
|
|
12956
12985
|
const interactionIds = /* @__PURE__ */ new Set();
|
|
12986
|
+
const sharedInteractions = [];
|
|
12957
12987
|
const visit = (node, path) => {
|
|
12958
12988
|
if (ids.has(node.id))
|
|
12959
12989
|
context.addIssue({
|
|
@@ -12976,11 +13006,13 @@ var PageSchema = z13.object({
|
|
|
12976
13006
|
});
|
|
12977
13007
|
target.add(value.bindingId);
|
|
12978
13008
|
}
|
|
13009
|
+
sharedInteractions.push(...node.on ?? []);
|
|
12979
13010
|
(node.children ?? []).forEach(
|
|
12980
13011
|
(child, index) => visit(child, [...path, "children", index])
|
|
12981
13012
|
);
|
|
12982
13013
|
};
|
|
12983
13014
|
visit(page.body, ["body"]);
|
|
13015
|
+
validateSharedStateBindings(page.sharedStateBindings, page.state ?? [], dataIds, sharedInteractions, context);
|
|
12984
13016
|
const stateIds = (page.state ?? []).map((entry) => entry.stateId);
|
|
12985
13017
|
if (new Set(stateIds).size !== stateIds.length)
|
|
12986
13018
|
context.addIssue({
|
|
@@ -13010,6 +13042,7 @@ var ResolvedPageSchema = z13.object({
|
|
|
13010
13042
|
renderTree: RenderTreeSchema,
|
|
13011
13043
|
capabilityInstances: z13.array(CapabilityInstanceSchema).min(1),
|
|
13012
13044
|
stateDefinitions: z13.array(PageStateDefinitionSchema).optional(),
|
|
13045
|
+
sharedStateBindings: z13.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
13013
13046
|
entryTransitions: z13.array(PageEntryTransitionSchema).optional(),
|
|
13014
13047
|
interactionBindings: z13.array(InteractionBindingSchema).optional(),
|
|
13015
13048
|
ontologyBindings: z13.array(PersistedOntologyBindingSchema),
|
|
@@ -13052,6 +13085,7 @@ var ResolvedPageSchema = z13.object({
|
|
|
13052
13085
|
});
|
|
13053
13086
|
}
|
|
13054
13087
|
});
|
|
13088
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions ?? [], new Set([...value.queryBindings ?? [], ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings ?? [], context);
|
|
13055
13089
|
const stateDefinitions = value.stateDefinitions ?? [];
|
|
13056
13090
|
const entryTransitions = value.entryTransitions ?? [];
|
|
13057
13091
|
const interactionBindings = value.interactionBindings ?? [];
|
|
@@ -14808,6 +14842,7 @@ var CompatiblePageRuntimeBundleSchema = z13.object({
|
|
|
14808
14842
|
deniedCapabilityInstanceIds: z13.array(ContractIdentifierSchema).default([]),
|
|
14809
14843
|
capabilityAccessEvaluated: z13.literal(true).optional(),
|
|
14810
14844
|
stateDefinitions: z13.array(PageStateDefinitionSchema).default([]),
|
|
14845
|
+
sharedStateBindings: z13.array(PageSharedStateBindingSchema).max(16).optional(),
|
|
14811
14846
|
entryTransitions: z13.array(ResolvedPageEntryTransitionSchema).default([]),
|
|
14812
14847
|
interactionBindings: z13.array(InteractionBindingSchema).default([]),
|
|
14813
14848
|
ontologyBindings: z13.array(PersistedOntologyBindingSchema),
|
|
@@ -14824,6 +14859,7 @@ var CompatiblePageRuntimeBundleSchema = z13.object({
|
|
|
14824
14859
|
"restricted"
|
|
14825
14860
|
])
|
|
14826
14861
|
}).strict().superRefine((value, context) => {
|
|
14862
|
+
validateSharedStateBindings(value.sharedStateBindings, value.stateDefinitions, new Set([...value.queryBindings, ...value.ontologyBindings].map((binding) => binding.bindingId)), value.interactionBindings, context);
|
|
14827
14863
|
const instanceIds = new Set(
|
|
14828
14864
|
value.capabilityInstances.map((instance) => instance.instanceId)
|
|
14829
14865
|
);
|
|
@@ -18963,6 +18999,7 @@ var resolvePage = (input) => {
|
|
|
18963
18999
|
},
|
|
18964
19000
|
capabilityInstances,
|
|
18965
19001
|
...stateDefinitions.length ? { stateDefinitions } : {},
|
|
19002
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
18966
19003
|
...page.entryTransitions ? {
|
|
18967
19004
|
entryTransitions: page.entryTransitions.map(
|
|
18968
19005
|
({ target, ...transition }, index) => {
|
|
@@ -19650,6 +19687,7 @@ var compilePageRuntimeBundleInternal = (input, legacy) => {
|
|
|
19650
19687
|
capabilityInstances: page.capabilityInstances,
|
|
19651
19688
|
deniedCapabilityInstanceIds: [],
|
|
19652
19689
|
stateDefinitions: page.stateDefinitions,
|
|
19690
|
+
...page.sharedStateBindings ? { sharedStateBindings: page.sharedStateBindings } : {},
|
|
19653
19691
|
entryTransitions,
|
|
19654
19692
|
interactionBindings: page.interactionBindings,
|
|
19655
19693
|
ontologyBindings: page.ontologyBindings,
|
|
@@ -23591,6 +23629,7 @@ function resolveThemeTokens(input) {
|
|
|
23591
23629
|
return result;
|
|
23592
23630
|
};
|
|
23593
23631
|
for (const path of collected.keys()) resolveToken(path);
|
|
23632
|
+
assertBentoTokens(resolved);
|
|
23594
23633
|
const resolvedDocument = {};
|
|
23595
23634
|
for (const token of resolved.values()) {
|
|
23596
23635
|
const segments = token.path.split(".");
|
|
@@ -23703,6 +23742,35 @@ function assertMonkeysThemeTokensComplete(input) {
|
|
|
23703
23742
|
}
|
|
23704
23743
|
return resolved.document;
|
|
23705
23744
|
}
|
|
23745
|
+
function assertBentoTokens(tokens) {
|
|
23746
|
+
const fields = {
|
|
23747
|
+
background: "color",
|
|
23748
|
+
borderColor: "color",
|
|
23749
|
+
borderWidth: "dimension",
|
|
23750
|
+
borderStyle: "strokeStyle",
|
|
23751
|
+
radius: "dimension",
|
|
23752
|
+
shadow: "shadow",
|
|
23753
|
+
padding: "dimension",
|
|
23754
|
+
gap: "dimension"
|
|
23755
|
+
};
|
|
23756
|
+
for (const [path, token] of tokens) {
|
|
23757
|
+
if (!path.startsWith("semantic.bento.")) continue;
|
|
23758
|
+
const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
|
|
23759
|
+
const field = match?.[2];
|
|
23760
|
+
const axis = match?.[3];
|
|
23761
|
+
const expected = field && fields[field];
|
|
23762
|
+
const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
|
|
23763
|
+
if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
|
|
23764
|
+
throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
|
|
23765
|
+
}
|
|
23766
|
+
if (field === "borderStyle" && typeof token.value !== "string") {
|
|
23767
|
+
throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
|
|
23768
|
+
}
|
|
23769
|
+
if (token.type === "dimension" && token.value.value < 0) {
|
|
23770
|
+
throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
|
|
23771
|
+
}
|
|
23772
|
+
}
|
|
23773
|
+
}
|
|
23706
23774
|
|
|
23707
23775
|
// src/contracts/theme.ts
|
|
23708
23776
|
var ThemeTokenTypeSchema = z16.enum(THEME_TOKEN_TYPES);
|