@inf-monkeys-tech/monkeys 1.1.62 → 1.1.64

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 (57) hide show
  1. package/lib/contracts/bento-block.d.ts +491 -0
  2. package/lib/contracts/bento-block.d.ts.map +1 -1
  3. package/lib/contracts/bento-block.js +158 -12
  4. package/lib/contracts/bento-block.js.map +1 -1
  5. package/lib/contracts/declarative-control-http.d.ts +6735 -279
  6. package/lib/contracts/declarative-control-http.d.ts.map +1 -1
  7. package/lib/contracts/declarative-control.d.ts +563 -19
  8. package/lib/contracts/declarative-control.d.ts.map +1 -1
  9. package/lib/contracts/declarative-publication-job.d.ts +1408 -72
  10. package/lib/contracts/declarative-publication-job.d.ts.map +1 -1
  11. package/lib/contracts/page.d.ts +1 -1
  12. package/lib/contracts/render.d.ts +413 -28
  13. package/lib/contracts/render.d.ts.map +1 -1
  14. package/lib/contracts/render.js +65 -5
  15. package/lib/contracts/render.js.map +1 -1
  16. package/lib/contracts/tenant.d.ts +7 -7
  17. package/lib/contracts/unified-view.d.ts +87 -0
  18. package/lib/contracts/unified-view.d.ts.map +1 -1
  19. package/lib/contracts/workflow-column.d.ts +2 -2
  20. package/lib/esm/{chunk-UPCRRS4I.mjs → chunk-AOAJSAI7.mjs} +2 -2
  21. package/lib/esm/chunk-AOAJSAI7.mjs.map +1 -0
  22. package/lib/esm/{chunk-EFVODA3P.mjs → chunk-BFGFPBEU.mjs} +187 -15
  23. package/lib/esm/chunk-BFGFPBEU.mjs.map +1 -0
  24. package/lib/esm/{chunk-MAZ3HUFS.mjs → chunk-E6UOE6OP.mjs} +181 -4
  25. package/lib/esm/chunk-E6UOE6OP.mjs.map +1 -0
  26. package/lib/esm/{chunk-RWTW74VC.mjs → chunk-WC65QK2H.mjs} +2 -2
  27. package/lib/esm/contracts/index.mjs +28 -2
  28. package/lib/esm/index.mjs +34 -4
  29. package/lib/esm/index.mjs.map +1 -1
  30. package/lib/esm/runtime/index.mjs +7 -3
  31. package/lib/esm/schemas/index.mjs +26 -2
  32. package/lib/json-schema/bento-node.schema.json +425 -1
  33. package/lib/json-schema/overlay-node.schema.json +1514 -49
  34. package/lib/json-schema/page-runtime-bundle.schema.json +2837 -547
  35. package/lib/json-schema/page.schema.json +24 -0
  36. package/lib/json-schema/render-node.schema.json +2077 -612
  37. package/lib/json-schema/render-tree.schema.json +2752 -462
  38. package/lib/json-schema/view-ontology-record.schema.json +722 -2
  39. package/lib/runtime/bento-render-tree.d.ts +22 -0
  40. package/lib/runtime/bento-render-tree.d.ts.map +1 -0
  41. package/lib/runtime/bento-render-tree.js +197 -0
  42. package/lib/runtime/bento-render-tree.js.map +1 -0
  43. package/lib/runtime/index.d.ts +1 -0
  44. package/lib/runtime/index.d.ts.map +1 -1
  45. package/lib/runtime/index.js +1 -0
  46. package/lib/runtime/index.js.map +1 -1
  47. package/lib/runtime/runtime-definition-wire.d.ts +704 -36
  48. package/lib/runtime/runtime-definition-wire.d.ts.map +1 -1
  49. package/lib/schemas/index.d.ts +1670 -3027
  50. package/lib/schemas/index.d.ts.map +1 -1
  51. package/lib/schemas/index.js +16 -3
  52. package/lib/schemas/index.js.map +1 -1
  53. package/package.json +2 -2
  54. package/lib/esm/chunk-EFVODA3P.mjs.map +0 -1
  55. package/lib/esm/chunk-MAZ3HUFS.mjs.map +0 -1
  56. package/lib/esm/chunk-UPCRRS4I.mjs.map +0 -1
  57. /package/lib/esm/{chunk-RWTW74VC.mjs.map → chunk-WC65QK2H.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-WC65QK2H.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-BFGFPBEU.mjs";
123
124
  import {
124
125
  __commonJS,
125
126
  __toESM
@@ -7975,6 +7976,180 @@ 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
+ if (source.kind === "ontology-relation" || source.kind === "ontology-action") {
8036
+ return source;
8037
+ }
8038
+ return void 0;
8039
+ }
8040
+ function compileBentoNodeToRenderTree(root, options) {
8041
+ const product = options.product ?? "studio";
8042
+ const ownerRepo = options.ownerRepo ?? "monkeys-sdk";
8043
+ const pageId = options.pageId ?? options.treeId;
8044
+ const nodes = [];
8045
+ const visit = (node, parentNodeId, inheritedData) => {
8046
+ const effectiveData = node.kind === "container" && node.data ? node.data : inheritedData;
8047
+ const chrome = node.chrome ?? (node.kind === "leaf" ? "panel" : "none");
8048
+ const style = buildPlacementStyle(node);
8049
+ const common = {
8050
+ contract: "RenderNode",
8051
+ nodeId: node.id,
8052
+ version: 1,
8053
+ ownerRepo,
8054
+ ...parentNodeId ? { parentNodeId } : {},
8055
+ pageRef: { kind: "page", id: pageId },
8056
+ capabilityRef: {
8057
+ kind: "capability",
8058
+ id: node.kind === "leaf" ? `monkeys.bento.block.${node.block.customType ?? node.block.type}` : `monkeys.bento.container.${node.layout}`,
8059
+ version: 1,
8060
+ ownerRepo
8061
+ },
8062
+ surface: {
8063
+ frameOwner: chrome === "none" ? "none" : "host",
8064
+ density: "default",
8065
+ ...chrome !== "none" ? { bento: { chrome } } : {}
8066
+ },
8067
+ scroll: {
8068
+ owner: "surface",
8069
+ axis: "none",
8070
+ virtualizationBoundary: false
8071
+ },
8072
+ activation: {
8073
+ activationId: node.id,
8074
+ mode: "inline"
8075
+ },
8076
+ lifecycle: {
8077
+ mountPolicy: "always",
8078
+ queryPolicy: "always",
8079
+ retainOnDeactivate: true,
8080
+ deepLink: false,
8081
+ focusReturn: false
8082
+ },
8083
+ ...node.placement ? { placement: node.placement } : {},
8084
+ ...style ? { style } : {},
8085
+ responsive: [],
8086
+ state: "idle"
8087
+ };
8088
+ if (node.kind === "container") {
8089
+ nodes.push({
8090
+ ...common,
8091
+ kind: parentNodeId ? "view" : "page",
8092
+ children: node.children.map((child) => child.id),
8093
+ layout: mapContainerLayout(node),
8094
+ renderModel: {
8095
+ bentoKind: "container",
8096
+ layout: node.layout,
8097
+ ...node.direction ? { direction: node.direction } : {},
8098
+ ...node.title ? { title: node.title } : {},
8099
+ ...node.description ? { description: node.description } : {},
8100
+ ...node.wiring ? { wiring: node.wiring } : {}
8101
+ }
8102
+ });
8103
+ for (const child of node.children) {
8104
+ visit(child, node.id, effectiveData);
8105
+ }
8106
+ return;
8107
+ }
8108
+ const dataBinding = mapLeafDataBinding(node, effectiveData);
8109
+ const moduleId = node.block.customType ?? node.block.type;
8110
+ nodes.push({
8111
+ ...common,
8112
+ kind: "view",
8113
+ children: [],
8114
+ layout: { mode: "block" },
8115
+ ...dataBinding ? { dataBinding } : {},
8116
+ module: {
8117
+ id: moduleId,
8118
+ granularity: "atomic",
8119
+ ...node.block.title ? { title: node.block.title } : {},
8120
+ ...node.block.config ? { props: node.block.config } : {}
8121
+ },
8122
+ renderModel: {
8123
+ bentoKind: "leaf",
8124
+ blockType: node.block.type,
8125
+ ...node.block.customType ? { customType: node.block.customType } : {},
8126
+ ...node.block.title ? { title: node.block.title } : {},
8127
+ ...node.block.dataSource ? { dataSource: node.block.dataSource } : {},
8128
+ ...node.block.actionStatementIds ? { actionStatementIds: node.block.actionStatementIds } : {},
8129
+ ...node.block.config ? { config: node.block.config } : {}
8130
+ }
8131
+ });
8132
+ };
8133
+ visit(root, void 0, options.data);
8134
+ return RenderTreeSchema.parse({
8135
+ contract: "RenderTree",
8136
+ treeId: options.treeId,
8137
+ product,
8138
+ rootNodeId: root.id,
8139
+ ...options.data ? { data: options.data } : {},
8140
+ nodes
8141
+ });
8142
+ }
8143
+ function compileViewRecordToRenderTree(record2, options) {
8144
+ return compileBentoNodeToRenderTree(record2.root, {
8145
+ treeId: record2.viewId,
8146
+ pageId: record2.viewId,
8147
+ product: options?.product ?? "studio",
8148
+ ownerRepo: options?.ownerRepo ?? "monkeys-sdk",
8149
+ data: record2.data
8150
+ });
8151
+ }
8152
+
7978
8153
  export {
7979
8154
  extractOpenApiCapabilityManifests,
7980
8155
  createCapabilityRegistrySource,
@@ -8124,6 +8299,8 @@ export {
8124
8299
  createSingleBlockViewRecord,
8125
8300
  createSelectionShareViewRecord,
8126
8301
  createWorkflowViewRecord,
8127
- attenuateViewCapabilities
8302
+ attenuateViewCapabilities,
8303
+ compileBentoNodeToRenderTree,
8304
+ compileViewRecordToRenderTree
8128
8305
  };
8129
- //# sourceMappingURL=chunk-MAZ3HUFS.mjs.map
8306
+ //# sourceMappingURL=chunk-E6UOE6OP.mjs.map