@inf-monkeys-tech/monkeys 1.1.62 → 1.1.63

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.
Files changed (45) hide show
  1. package/lib/contracts/declarative-control-http.d.ts +4401 -48
  2. package/lib/contracts/declarative-control-http.d.ts.map +1 -1
  3. package/lib/contracts/declarative-control.d.ts +370 -0
  4. package/lib/contracts/declarative-control.d.ts.map +1 -1
  5. package/lib/contracts/declarative-publication-job.d.ts +912 -16
  6. package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
  7. package/lib/contracts/render.d.ts +297 -0
  8. package/lib/contracts/render.d.ts.map +1 -1
  9. package/lib/contracts/render.js +60 -5
  10. package/lib/contracts/render.js.map +1 -1
  11. package/lib/esm/{chunk-EFVODA3P.mjs → chunk-766TRFRH.mjs} +46 -4
  12. package/lib/esm/chunk-766TRFRH.mjs.map +1 -0
  13. package/lib/esm/{chunk-MAZ3HUFS.mjs → chunk-BTJGKWPM.mjs} +178 -4
  14. package/lib/esm/chunk-BTJGKWPM.mjs.map +1 -0
  15. package/lib/esm/{chunk-RWTW74VC.mjs → chunk-MP4OJWJ3.mjs} +2 -2
  16. package/lib/esm/{chunk-UPCRRS4I.mjs → chunk-SDA2NWFB.mjs} +2 -2
  17. package/lib/esm/chunk-SDA2NWFB.mjs.map +1 -0
  18. package/lib/esm/contracts/index.mjs +6 -2
  19. package/lib/esm/index.mjs +12 -4
  20. package/lib/esm/index.mjs.map +1 -1
  21. package/lib/esm/runtime/index.mjs +7 -3
  22. package/lib/esm/schemas/index.mjs +2 -2
  23. package/lib/json-schema/overlay-node.schema.json +1092 -49
  24. package/lib/json-schema/page-runtime-bundle.schema.json +1996 -424
  25. package/lib/json-schema/page.schema.json +24 -0
  26. package/lib/json-schema/render-node.schema.json +1317 -274
  27. package/lib/json-schema/render-tree.schema.json +1686 -114
  28. package/lib/runtime/bento-render-tree.d.ts +22 -0
  29. package/lib/runtime/bento-render-tree.d.ts.map +1 -0
  30. package/lib/runtime/bento-render-tree.js +194 -0
  31. package/lib/runtime/bento-render-tree.js.map +1 -0
  32. package/lib/runtime/index.d.ts +1 -0
  33. package/lib/runtime/index.d.ts.map +1 -1
  34. package/lib/runtime/index.js +1 -0
  35. package/lib/runtime/index.js.map +1 -1
  36. package/lib/runtime/runtime-definition-wire.d.ts +456 -8
  37. package/lib/runtime/runtime-definition-wire.d.ts.map +1 -1
  38. package/lib/schemas/index.d.ts +1541 -3072
  39. package/lib/schemas/index.d.ts.map +1 -1
  40. package/lib/schemas/index.js.map +1 -1
  41. package/package.json +2 -2
  42. package/lib/esm/chunk-EFVODA3P.mjs.map +0 -1
  43. package/lib/esm/chunk-MAZ3HUFS.mjs.map +0 -1
  44. package/lib/esm/chunk-UPCRRS4I.mjs.map +0 -1
  45. /package/lib/esm/{chunk-RWTW74VC.mjs.map → chunk-MP4OJWJ3.mjs.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  PAGE_STREAM_MAX_FRAME_BYTES,
5
5
  PageStreamDescriptorSchema,
6
6
  PageStreamEventSchema
7
- } from "./chunk-RWTW74VC.mjs";
7
+ } from "./chunk-MP4OJWJ3.mjs";
8
8
  import {
9
9
  AccessPolicySchema,
10
10
  ActionProgramDefinitionSchema,
@@ -13,6 +13,7 @@ import {
13
13
  ApplicationHandoffSchema,
14
14
  ArtifactProfileSchema,
15
15
  ArtifactViewSchema,
16
+ BENTO_GRID_COLUMNS,
16
17
  CapabilityManifestSchema,
17
18
  CapabilityRegistryDocumentSchema,
18
19
  CapabilityRegistrySourceSchema,
@@ -119,7 +120,7 @@ import {
119
120
  require_validation,
120
121
  require_validation_error,
121
122
  resolveThemeTokens
122
- } from "./chunk-EFVODA3P.mjs";
123
+ } from "./chunk-766TRFRH.mjs";
123
124
  import {
124
125
  __commonJS,
125
126
  __toESM
@@ -7975,6 +7976,177 @@ function attenuateViewCapabilities(parentCapabilities, requestedCapabilities) {
7975
7976
  );
7976
7977
  }
7977
7978
 
7979
+ // src/runtime/bento-render-tree.ts
7980
+ function mapContainerLayout(node) {
7981
+ const gap = typeof node.gap === "number" ? node.gap : void 0;
7982
+ if (node.layout === "grid") {
7983
+ return {
7984
+ mode: "grid",
7985
+ columns: node.columns ?? BENTO_GRID_COLUMNS,
7986
+ ...typeof node.rowHeight === "number" ? { rowHeight: node.rowHeight } : {},
7987
+ ...gap !== void 0 ? { gap } : {}
7988
+ };
7989
+ }
7990
+ if (node.layout === "split") {
7991
+ return {
7992
+ mode: "split",
7993
+ direction: node.direction === "vertical" ? "column" : "row",
7994
+ ...gap !== void 0 ? { gap } : {}
7995
+ };
7996
+ }
7997
+ if (node.layout === "tabs") {
7998
+ return {
7999
+ mode: "tabs",
8000
+ ...gap !== void 0 ? { gap } : {}
8001
+ };
8002
+ }
8003
+ return {
8004
+ mode: "flex",
8005
+ direction: node.direction === "horizontal" ? "row" : "column",
8006
+ ...gap !== void 0 ? { gap } : {}
8007
+ };
8008
+ }
8009
+ function buildPlacementStyle(node) {
8010
+ const style = {};
8011
+ const grid = node.placement?.grid;
8012
+ if (grid) {
8013
+ style.gridColumn = `${grid.x + 1} / span ${grid.w}`;
8014
+ style.gridRow = `${grid.y + 1} / span ${grid.h}`;
8015
+ }
8016
+ const split = node.placement?.split;
8017
+ if (split?.size !== void 0) {
8018
+ style.flex = typeof split.size === "number" ? `0 0 ${split.size}%` : `0 0 ${split.size}`;
8019
+ }
8020
+ if (split?.minSize !== void 0) {
8021
+ style.minWidth = typeof split.minSize === "number" ? `${split.minSize}px` : split.minSize;
8022
+ }
8023
+ if (split?.maxSize !== void 0) {
8024
+ style.maxWidth = typeof split.maxSize === "number" ? `${split.maxSize}px` : split.maxSize;
8025
+ }
8026
+ return Object.keys(style).length > 0 ? style : void 0;
8027
+ }
8028
+ function mapLeafDataBinding(node, data) {
8029
+ const source = node.block.dataSource;
8030
+ if (!source || source.kind === "static") return void 0;
8031
+ if (source.kind === "statement") {
8032
+ const inlineStatement = data?.statements?.[source.statementId];
8033
+ return inlineStatement ?? { kind: "statement", statementId: source.statementId };
8034
+ }
8035
+ return void 0;
8036
+ }
8037
+ function compileBentoNodeToRenderTree(root, options) {
8038
+ const product = options.product ?? "studio";
8039
+ const ownerRepo = options.ownerRepo ?? "monkeys-sdk";
8040
+ const pageId = options.pageId ?? options.treeId;
8041
+ const nodes = [];
8042
+ const visit = (node, parentNodeId, inheritedData) => {
8043
+ const effectiveData = node.kind === "container" && node.data ? node.data : inheritedData;
8044
+ const chrome = node.chrome ?? (node.kind === "leaf" ? "panel" : "none");
8045
+ const style = buildPlacementStyle(node);
8046
+ const common = {
8047
+ contract: "RenderNode",
8048
+ nodeId: node.id,
8049
+ version: 1,
8050
+ ownerRepo,
8051
+ ...parentNodeId ? { parentNodeId } : {},
8052
+ pageRef: { kind: "page", id: pageId },
8053
+ capabilityRef: {
8054
+ kind: "capability",
8055
+ id: node.kind === "leaf" ? `monkeys.bento.block.${node.block.customType ?? node.block.type}` : `monkeys.bento.container.${node.layout}`,
8056
+ version: 1,
8057
+ ownerRepo
8058
+ },
8059
+ surface: {
8060
+ frameOwner: chrome === "none" ? "none" : "host",
8061
+ density: "default",
8062
+ ...chrome !== "none" ? { bento: { chrome } } : {}
8063
+ },
8064
+ scroll: {
8065
+ owner: "surface",
8066
+ axis: "none",
8067
+ virtualizationBoundary: false
8068
+ },
8069
+ activation: {
8070
+ activationId: node.id,
8071
+ mode: "inline"
8072
+ },
8073
+ lifecycle: {
8074
+ mountPolicy: "always",
8075
+ queryPolicy: "always",
8076
+ retainOnDeactivate: true,
8077
+ deepLink: false,
8078
+ focusReturn: false
8079
+ },
8080
+ ...node.placement ? { placement: node.placement } : {},
8081
+ ...style ? { style } : {},
8082
+ responsive: [],
8083
+ state: "idle"
8084
+ };
8085
+ if (node.kind === "container") {
8086
+ nodes.push({
8087
+ ...common,
8088
+ kind: parentNodeId ? "view" : "page",
8089
+ children: node.children.map((child) => child.id),
8090
+ layout: mapContainerLayout(node),
8091
+ renderModel: {
8092
+ bentoKind: "container",
8093
+ layout: node.layout,
8094
+ ...node.direction ? { direction: node.direction } : {},
8095
+ ...node.title ? { title: node.title } : {},
8096
+ ...node.description ? { description: node.description } : {},
8097
+ ...node.wiring ? { wiring: node.wiring } : {}
8098
+ }
8099
+ });
8100
+ for (const child of node.children) {
8101
+ visit(child, node.id, effectiveData);
8102
+ }
8103
+ return;
8104
+ }
8105
+ const dataBinding = mapLeafDataBinding(node, effectiveData);
8106
+ const moduleId = node.block.customType ?? node.block.type;
8107
+ nodes.push({
8108
+ ...common,
8109
+ kind: "view",
8110
+ children: [],
8111
+ layout: { mode: "block" },
8112
+ ...dataBinding ? { dataBinding } : {},
8113
+ module: {
8114
+ id: moduleId,
8115
+ granularity: "atomic",
8116
+ ...node.block.title ? { title: node.block.title } : {},
8117
+ ...node.block.config ? { props: node.block.config } : {}
8118
+ },
8119
+ renderModel: {
8120
+ bentoKind: "leaf",
8121
+ blockType: node.block.type,
8122
+ ...node.block.customType ? { customType: node.block.customType } : {},
8123
+ ...node.block.title ? { title: node.block.title } : {},
8124
+ ...node.block.dataSource ? { dataSource: node.block.dataSource } : {},
8125
+ ...node.block.actionStatementIds ? { actionStatementIds: node.block.actionStatementIds } : {},
8126
+ ...node.block.config ? { config: node.block.config } : {}
8127
+ }
8128
+ });
8129
+ };
8130
+ visit(root, void 0, options.data);
8131
+ return RenderTreeSchema.parse({
8132
+ contract: "RenderTree",
8133
+ treeId: options.treeId,
8134
+ product,
8135
+ rootNodeId: root.id,
8136
+ ...options.data ? { data: options.data } : {},
8137
+ nodes
8138
+ });
8139
+ }
8140
+ function compileViewRecordToRenderTree(record2, options) {
8141
+ return compileBentoNodeToRenderTree(record2.root, {
8142
+ treeId: record2.viewId,
8143
+ pageId: record2.viewId,
8144
+ product: options?.product ?? "studio",
8145
+ ownerRepo: options?.ownerRepo ?? "monkeys-sdk",
8146
+ data: record2.data
8147
+ });
8148
+ }
8149
+
7978
8150
  export {
7979
8151
  extractOpenApiCapabilityManifests,
7980
8152
  createCapabilityRegistrySource,
@@ -8124,6 +8296,8 @@ export {
8124
8296
  createSingleBlockViewRecord,
8125
8297
  createSelectionShareViewRecord,
8126
8298
  createWorkflowViewRecord,
8127
- attenuateViewCapabilities
8299
+ attenuateViewCapabilities,
8300
+ compileBentoNodeToRenderTree,
8301
+ compileViewRecordToRenderTree
8128
8302
  };
8129
- //# sourceMappingURL=chunk-MAZ3HUFS.mjs.map
8303
+ //# sourceMappingURL=chunk-BTJGKWPM.mjs.map