@assistant-ui/react-generative-ui 0.0.19 → 0.0.21

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 (137) hide show
  1. package/dist/JSONGenerativeUI.client.d.ts +14 -15
  2. package/dist/JSONGenerativeUI.client.d.ts.map +1 -1
  3. package/dist/JSONGenerativeUI.client.js +28 -8
  4. package/dist/JSONGenerativeUI.client.js.map +1 -1
  5. package/dist/JSONGenerativeUI.server.d.ts +5 -7
  6. package/dist/JSONGenerativeUI.server.d.ts.map +1 -1
  7. package/dist/JSONGenerativeUI.shared.d.ts +35 -36
  8. package/dist/JSONGenerativeUI.shared.d.ts.map +1 -1
  9. package/dist/a2ui/convert.d.ts +7 -7
  10. package/dist/a2ui/convert.d.ts.map +1 -1
  11. package/dist/a2ui/convert.js +148 -28
  12. package/dist/a2ui/convert.js.map +1 -1
  13. package/dist/a2ui/reducer.d.ts +1 -3
  14. package/dist/a2ui/reducer.d.ts.map +1 -1
  15. package/dist/a2ui/reducer.js +8 -0
  16. package/dist/a2ui/reducer.js.map +1 -1
  17. package/dist/a2ui/snapshot.d.ts +3 -0
  18. package/dist/a2ui/snapshot.d.ts.map +1 -0
  19. package/dist/a2ui/snapshot.js +33 -0
  20. package/dist/a2ui/snapshot.js.map +1 -0
  21. package/dist/a2ui/types.d.ts +50 -40
  22. package/dist/a2ui/types.d.ts.map +1 -1
  23. package/dist/a2ui/types.js.map +1 -1
  24. package/dist/a2ui.d.ts +5 -4
  25. package/dist/a2ui.d.ts.map +1 -0
  26. package/dist/a2ui.js +2 -1
  27. package/dist/actionRegistry.d.ts +12 -14
  28. package/dist/actionRegistry.d.ts.map +1 -1
  29. package/dist/actionRegistry.js.map +1 -1
  30. package/dist/buildPresentParameters.d.ts +2 -4
  31. package/dist/buildPresentParameters.d.ts.map +1 -1
  32. package/dist/buildPresentParameters.js +16 -4
  33. package/dist/buildPresentParameters.js.map +1 -1
  34. package/dist/constants.d.ts +0 -2
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/convert/boundSpec.d.ts +0 -2
  37. package/dist/convert/boundSpec.d.ts.map +1 -1
  38. package/dist/convert/copyBounded.d.ts +2 -4
  39. package/dist/convert/copyBounded.d.ts.map +1 -1
  40. package/dist/convert/isElement.d.ts +1 -3
  41. package/dist/convert/isElement.d.ts.map +1 -1
  42. package/dist/convert/takeRun.d.ts +3 -5
  43. package/dist/convert/takeRun.d.ts.map +1 -1
  44. package/dist/defineGenerativeComponents.d.ts +1 -3
  45. package/dist/defineGenerativeComponents.d.ts.map +1 -1
  46. package/dist/generativeUIToJSX.d.ts +4 -6
  47. package/dist/generativeUIToJSX.d.ts.map +1 -1
  48. package/dist/index.d.ts +3 -13
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.server.d.ts +3 -13
  51. package/dist/index.server.d.ts.map +1 -0
  52. package/dist/index.shared.d.ts +15 -11
  53. package/dist/index.shared.d.ts.map +1 -0
  54. package/dist/ir.d.ts +17 -19
  55. package/dist/ir.d.ts.map +1 -1
  56. package/dist/renderGenerativeUI.d.ts +2 -4
  57. package/dist/renderGenerativeUI.d.ts.map +1 -1
  58. package/dist/scopeSchema.d.ts +6 -0
  59. package/dist/scopeSchema.d.ts.map +1 -0
  60. package/dist/scopeSchema.js +56 -0
  61. package/dist/scopeSchema.js.map +1 -0
  62. package/dist/slack/constants.d.ts +8 -9
  63. package/dist/slack/constants.d.ts.map +1 -1
  64. package/dist/slack/decodeBlockAction.d.ts +1 -3
  65. package/dist/slack/decodeBlockAction.d.ts.map +1 -1
  66. package/dist/slack/fromSlackBlocks.d.ts +1 -3
  67. package/dist/slack/fromSlackBlocks.d.ts.map +1 -1
  68. package/dist/slack/toSlackBlocks.d.ts +1 -3
  69. package/dist/slack/toSlackBlocks.d.ts.map +1 -1
  70. package/dist/slack/toSlackBlocks.js +1 -1
  71. package/dist/slack/types.d.ts +78 -80
  72. package/dist/slack/types.d.ts.map +1 -1
  73. package/dist/slack.d.ts +5 -5
  74. package/dist/slack.d.ts.map +1 -0
  75. package/dist/teams/constants.d.ts +1 -3
  76. package/dist/teams/constants.d.ts.map +1 -1
  77. package/dist/teams/decodeSubmitData.d.ts +1 -3
  78. package/dist/teams/decodeSubmitData.d.ts.map +1 -1
  79. package/dist/teams/toAdaptiveCard.d.ts +4 -6
  80. package/dist/teams/toAdaptiveCard.d.ts.map +1 -1
  81. package/dist/teams/toTeamsAttachments.d.ts +1 -3
  82. package/dist/teams/toTeamsAttachments.d.ts.map +1 -1
  83. package/dist/teams/types.d.ts +108 -109
  84. package/dist/teams/types.d.ts.map +1 -1
  85. package/dist/teams.d.ts +5 -5
  86. package/dist/teams.d.ts.map +1 -0
  87. package/dist/types.d.ts +36 -37
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/vocabulary/alert.d.ts +21 -23
  90. package/dist/vocabulary/alert.d.ts.map +1 -1
  91. package/dist/vocabulary/collectFormValues.d.ts +8 -10
  92. package/dist/vocabulary/collectFormValues.d.ts.map +1 -1
  93. package/dist/vocabulary/data.d.ts +45 -47
  94. package/dist/vocabulary/data.d.ts.map +1 -1
  95. package/dist/vocabulary/dispatch.d.ts +2 -4
  96. package/dist/vocabulary/dispatch.d.ts.map +1 -1
  97. package/dist/vocabulary/fact.d.ts +8 -10
  98. package/dist/vocabulary/fact.d.ts.map +1 -1
  99. package/dist/vocabulary/form.d.ts +7 -9
  100. package/dist/vocabulary/form.d.ts.map +1 -1
  101. package/dist/vocabulary/icon.d.ts +37 -39
  102. package/dist/vocabulary/icon.d.ts.map +1 -1
  103. package/dist/vocabulary/index.d.ts +1 -3
  104. package/dist/vocabulary/index.d.ts.map +1 -1
  105. package/dist/vocabulary/interactive.d.ts +87 -86
  106. package/dist/vocabulary/interactive.d.ts.map +1 -1
  107. package/dist/vocabulary/interactive.js +4 -4
  108. package/dist/vocabulary/interactive.js.map +1 -1
  109. package/dist/vocabulary/layout.d.ts +75 -77
  110. package/dist/vocabulary/layout.d.ts.map +1 -1
  111. package/dist/vocabulary/list.d.ts +10 -12
  112. package/dist/vocabulary/list.d.ts.map +1 -1
  113. package/dist/vocabulary/media.d.ts +21 -23
  114. package/dist/vocabulary/media.d.ts.map +1 -1
  115. package/dist/vocabulary/text.d.ts +53 -55
  116. package/dist/vocabulary/text.d.ts.map +1 -1
  117. package/dist/vocabulary/toTextContent.d.ts +0 -2
  118. package/dist/vocabulary/toTextContent.d.ts.map +1 -1
  119. package/package.json +4 -4
  120. package/src/JSONGenerativeUI.client.tsx +57 -15
  121. package/src/JSONGenerativeUI.test.tsx +298 -4
  122. package/src/a2ui/convert.test.ts +717 -0
  123. package/src/a2ui/convert.ts +229 -41
  124. package/src/a2ui/reducer.test.ts +18 -0
  125. package/src/a2ui/reducer.ts +16 -0
  126. package/src/a2ui/snapshot.test.ts +52 -0
  127. package/src/a2ui/snapshot.ts +52 -0
  128. package/src/a2ui/types.ts +16 -0
  129. package/src/a2ui.ts +2 -0
  130. package/src/actionRegistry.ts +5 -5
  131. package/src/buildPresentParameters.test.ts +246 -0
  132. package/src/buildPresentParameters.ts +18 -3
  133. package/src/scopeSchema.test.ts +72 -0
  134. package/src/scopeSchema.ts +71 -0
  135. package/src/vocabulary/interactive.dispatch.test.tsx +17 -3
  136. package/src/vocabulary/interactive.test.tsx +19 -0
  137. package/src/vocabulary/interactive.tsx +4 -1
@@ -1,4 +1,5 @@
1
1
  import { TYPE_KEY } from "./constants.js";
2
+ import { scopeSchema } from "./scopeSchema.js";
2
3
  import { toJSONSchema } from "assistant-stream";
3
4
  //#region src/buildPresentParameters.ts
4
5
  /**
@@ -22,15 +23,25 @@ function buildPresentParameters(library) {
22
23
  const names = Object.keys(library);
23
24
  const props = /* @__PURE__ */ new Map();
24
25
  const propOwners = /* @__PURE__ */ new Map();
25
- for (const name of names) {
26
- const propsSchema = toJSONSchema(library[name].properties);
26
+ const componentSchemas = {};
27
+ for (const [index, name] of names.entries()) {
28
+ const definition = `component${index}`;
29
+ const { schema: propsSchema, referenced } = scopeSchema(toJSONSchema(library[name].properties), `#/$defs/${definition}`);
27
30
  if (propsSchema.type !== "object") throw new Error(`[@assistant-ui/react-generative-ui] Component "${name}": \`properties\` must be an object schema (e.g. \`z.object({ ... })\`).`);
31
+ let merged = false;
28
32
  for (const [key, schema] of Object.entries(propsSchema.properties ?? {})) {
29
33
  if (key.startsWith("$") || key === "children") continue;
30
34
  if (key === "__proto__") continue;
31
- if (!props.has(key)) props.set(key, schema);
35
+ if (!props.has(key)) {
36
+ props.set(key, schema);
37
+ merged = true;
38
+ }
32
39
  propOwners.set(key, [...propOwners.get(key) ?? [], name]);
33
40
  }
41
+ if (referenced && merged) {
42
+ const { $schema: _, $id: _id, ...embedded } = propsSchema;
43
+ componentSchemas[definition] = embedded;
44
+ }
34
45
  }
35
46
  if (process.env["NODE_ENV"] !== "production") for (const [key, owners] of propOwners) {
36
47
  if (owners.length < 2) continue;
@@ -69,7 +80,8 @@ function buildPresentParameters(library) {
69
80
  ...node,
70
81
  $defs: {
71
82
  node,
72
- children
83
+ children,
84
+ ...componentSchemas
73
85
  }
74
86
  };
75
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildPresentParameters.js","names":[],"sources":["../src/buildPresentParameters.ts"],"sourcesContent":["import { toJSONSchema } from \"assistant-stream\";\nimport type { JSONSchema7, JSONSchema7Definition } from \"json-schema\";\nimport { TYPE_KEY } from \"./constants\";\nimport type { GenerativeUILibrary } from \"./types\";\n\n/**\n * Builds the JSON schema for the `present` tool from a {@link GenerativeUILibrary}.\n *\n * The model produces a node `{ $type, $key?, ...props }` where `$type` selects\n * a component, the optional `$key` pins a stable identity for list items that\n * may reorder, and the rest are its props. The schema is a flat object: `$type`\n * is an enum of the component names, every component's props are merged into\n * one optional bag, and `children` recurses via `$defs` so the tree can nest.\n *\n * It is intentionally flat rather than a per-`$type` discriminated union. Tool /\n * function-call schemas (OpenAI and others) require the top-level parameters to\n * be a plain object and reject a top-level `oneOf`/`anyOf`/`enum`. So props can't\n * be refined per `$type` at the root; the model is guided instead by `$type`'s\n * description (which lists each component) and each prop's own description. The\n * renderer validates nothing here — an unknown `$type` or stray prop is handled\n * at render time — so a looser schema only costs the model a hint, not safety.\n */\nexport function buildPresentParameters(\n library: GenerativeUILibrary,\n): JSONSchema7 {\n const names = Object.keys(library);\n\n // Merge every component's props into one optional bag. `$`-prefixed keys and\n // `children` are framework-reserved (see ir.ts), so drop any author-declared\n // copies. On a name clash the first component's schema wins — props are an\n // advisory hint here, not a strict per-component contract.\n const props = new Map<string, JSONSchema7Definition>();\n const propOwners = new Map<string, string[]>();\n for (const name of names) {\n const propsSchema = toJSONSchema(library[name]!.properties);\n if (propsSchema.type !== \"object\") {\n throw new Error(\n `[@assistant-ui/react-generative-ui] Component \"${name}\": ` +\n \"`properties` must be an object schema (e.g. `z.object({ ... })`).\",\n );\n }\n for (const [key, schema] of Object.entries(propsSchema.properties ?? {})) {\n if (key.startsWith(\"$\") || key === \"children\") continue;\n // secure-json-parse rejects the whole tool-argument payload on this key,\n // so advertising it would cost the model the node rather than one prop.\n if (key === \"__proto__\") continue;\n if (!props.has(key)) {\n props.set(key, schema);\n }\n propOwners.set(key, [...(propOwners.get(key) ?? []), name]);\n }\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n for (const [key, owners] of propOwners) {\n if (owners.length < 2) continue;\n // eslint-disable-next-line no-console\n console.warn(\n `[@assistant-ui/react-generative-ui] Prop \"${key}\" is declared by ` +\n `${formatComponentList(owners)}; keeping \"${owners[0]}\"'s schema. ` +\n \"Rename or align the prop type to avoid an ambiguous schema.\",\n );\n }\n }\n\n // Carry each component's description on the `$type` enum, since there are no\n // per-branch schemas to hang them on anymore.\n const typeDescription =\n names.length > 0\n ? `The component to render. ${names\n .map((name) => `\"${name}\": ${library[name]!.description}`)\n .join(\"; \")}`\n : \"The component to render.\";\n\n const node: JSONSchema7 = {\n type: \"object\",\n properties: {\n [TYPE_KEY]: { type: \"string\", enum: names, description: typeDescription },\n $key: {\n description:\n \"Stable identity for this UI node. Use it for list items that may reorder.\",\n anyOf: [{ type: \"string\" }, { type: \"number\" }],\n },\n ...Object.fromEntries(props),\n children: { $ref: \"#/$defs/children\" },\n },\n required: [TYPE_KEY],\n };\n\n const children: JSONSchema7 = {\n description: \"Nested generative UI rendered inside this component.\",\n anyOf: [\n { type: \"string\" },\n { $ref: \"#/$defs/node\" },\n {\n type: \"array\",\n items: { anyOf: [{ type: \"string\" }, { $ref: \"#/$defs/node\" }] },\n },\n ],\n };\n\n return {\n ...node,\n $defs: { node, children },\n };\n}\n\nfunction formatComponentList(names: string[]) {\n if (names.length <= 2) return names.map((name) => `\"${name}\"`).join(\" and \");\n\n return `${names\n .slice(0, -1)\n .map((name) => `\"${name}\"`)\n .join(\", \")}, and \"${names[names.length - 1]}\"`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,uBACd,SACa;CACb,MAAM,QAAQ,OAAO,KAAK,OAAO;CAMjC,MAAM,wBAAQ,IAAI,IAAmC;CACrD,MAAM,6BAAa,IAAI,IAAsB;CAC7C,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,cAAc,aAAa,QAAQ,KAAK,CAAE,UAAU;EAC1D,IAAI,YAAY,SAAS,UACvB,MAAM,IAAI,MACR,kDAAkD,KAAK,yEAEzD;EAEF,KAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,YAAY,cAAc,CAAC,CAAC,GAAG;GACxE,IAAI,IAAI,WAAW,GAAG,KAAK,QAAQ,YAAY;GAG/C,IAAI,QAAQ,aAAa;GACzB,IAAI,CAAC,MAAM,IAAI,GAAG,GAChB,MAAM,IAAI,KAAK,MAAM;GAEvB,WAAW,IAAI,KAAK,CAAC,GAAI,WAAW,IAAI,GAAG,KAAK,CAAC,GAAI,IAAI,CAAC;EAC5D;CACF;CAEA,IAAI,QAAQ,IAAI,gBAAgB,cAC9B,KAAK,MAAM,CAAC,KAAK,WAAW,YAAY;EACtC,IAAI,OAAO,SAAS,GAAG;EAEvB,QAAQ,KACN,6CAA6C,IAAI,mBAC5C,oBAAoB,MAAM,EAAE,aAAa,OAAO,GAAG,wEAE1D;CACF;CAKF,MAAM,kBACJ,MAAM,SAAS,IACX,4BAA4B,MACzB,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,KAAK,CAAE,aAAa,CAAC,CACzD,KAAK,IAAI,MACZ;CAEN,MAAM,OAAoB;EACxB,MAAM;EACN,YAAY;IACT,WAAW;IAAE,MAAM;IAAU,MAAM;IAAO,aAAa;GAAgB;GACxE,MAAM;IACJ,aACE;IACF,OAAO,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,SAAS,CAAC;GAChD;GACA,GAAG,OAAO,YAAY,KAAK;GAC3B,UAAU,EAAE,MAAM,mBAAmB;EACvC;EACA,UAAU,CAAC,QAAQ;CACrB;CAEA,MAAM,WAAwB;EAC5B,aAAa;EACb,OAAO;GACL,EAAE,MAAM,SAAS;GACjB,EAAE,MAAM,eAAe;GACvB;IACE,MAAM;IACN,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,eAAe,CAAC,EAAE;GACjE;EACF;CACF;CAEA,OAAO;EACL,GAAG;EACH,OAAO;GAAE;GAAM;EAAS;CAC1B;AACF;AAEA,SAAS,oBAAoB,OAAiB;CAC5C,IAAI,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,OAAO;CAE3E,OAAO,GAAG,MACP,MAAM,GAAG,EAAE,CAAC,CACZ,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAC1B,KAAK,IAAI,EAAE,SAAS,MAAM,MAAM,SAAS,GAAG;AACjD"}
1
+ {"version":3,"file":"buildPresentParameters.js","names":[],"sources":["../src/buildPresentParameters.ts"],"sourcesContent":["import { toJSONSchema } from \"assistant-stream\";\nimport type { JSONSchema7, JSONSchema7Definition } from \"json-schema\";\nimport { TYPE_KEY } from \"./constants\";\nimport type { GenerativeUILibrary } from \"./types\";\nimport { scopeSchema } from \"./scopeSchema\";\n\n/**\n * Builds the JSON schema for the `present` tool from a {@link GenerativeUILibrary}.\n *\n * The model produces a node `{ $type, $key?, ...props }` where `$type` selects\n * a component, the optional `$key` pins a stable identity for list items that\n * may reorder, and the rest are its props. The schema is a flat object: `$type`\n * is an enum of the component names, every component's props are merged into\n * one optional bag, and `children` recurses via `$defs` so the tree can nest.\n *\n * It is intentionally flat rather than a per-`$type` discriminated union. Tool /\n * function-call schemas (OpenAI and others) require the top-level parameters to\n * be a plain object and reject a top-level `oneOf`/`anyOf`/`enum`. So props can't\n * be refined per `$type` at the root; the model is guided instead by `$type`'s\n * description (which lists each component) and each prop's own description. The\n * renderer validates nothing here — an unknown `$type` or stray prop is handled\n * at render time — so a looser schema only costs the model a hint, not safety.\n */\nexport function buildPresentParameters(\n library: GenerativeUILibrary,\n): JSONSchema7 {\n const names = Object.keys(library);\n\n // Merge every component's props into one optional bag. `$`-prefixed keys and\n // `children` are framework-reserved (see ir.ts), so drop any author-declared\n // copies. On a name clash the first component's schema wins — props are an\n // advisory hint here, not a strict per-component contract.\n const props = new Map<string, JSONSchema7Definition>();\n const propOwners = new Map<string, string[]>();\n const componentSchemas: Record<string, JSONSchema7> = {};\n for (const [index, name] of names.entries()) {\n const definition = `component${index}`;\n const { schema: propsSchema, referenced } = scopeSchema(\n toJSONSchema(library[name]!.properties),\n `#/$defs/${definition}`,\n );\n if (propsSchema.type !== \"object\") {\n throw new Error(\n `[@assistant-ui/react-generative-ui] Component \"${name}\": ` +\n \"`properties` must be an object schema (e.g. `z.object({ ... })`).\",\n );\n }\n let merged = false;\n for (const [key, schema] of Object.entries(propsSchema.properties ?? {})) {\n if (key.startsWith(\"$\") || key === \"children\") continue;\n // secure-json-parse rejects the whole tool-argument payload on this key,\n // so advertising it would cost the model the node rather than one prop.\n if (key === \"__proto__\") continue;\n if (!props.has(key)) {\n props.set(key, schema);\n merged = true;\n }\n propOwners.set(key, [...(propOwners.get(key) ?? []), name]);\n }\n if (referenced && merged) {\n // `$schema` is only valid at a schema-resource root, and an embedded\n // `$id` would both collide across components and re-base the pointers\n // scopeSchema just rewrote to be document-root relative.\n const { $schema: _, $id: _id, ...embedded } = propsSchema;\n componentSchemas[definition] = embedded;\n }\n }\n\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n for (const [key, owners] of propOwners) {\n if (owners.length < 2) continue;\n // eslint-disable-next-line no-console\n console.warn(\n `[@assistant-ui/react-generative-ui] Prop \"${key}\" is declared by ` +\n `${formatComponentList(owners)}; keeping \"${owners[0]}\"'s schema. ` +\n \"Rename or align the prop type to avoid an ambiguous schema.\",\n );\n }\n }\n\n // Carry each component's description on the `$type` enum, since there are no\n // per-branch schemas to hang them on anymore.\n const typeDescription =\n names.length > 0\n ? `The component to render. ${names\n .map((name) => `\"${name}\": ${library[name]!.description}`)\n .join(\"; \")}`\n : \"The component to render.\";\n\n const node: JSONSchema7 = {\n type: \"object\",\n properties: {\n [TYPE_KEY]: { type: \"string\", enum: names, description: typeDescription },\n $key: {\n description:\n \"Stable identity for this UI node. Use it for list items that may reorder.\",\n anyOf: [{ type: \"string\" }, { type: \"number\" }],\n },\n ...Object.fromEntries(props),\n children: { $ref: \"#/$defs/children\" },\n },\n required: [TYPE_KEY],\n };\n\n const children: JSONSchema7 = {\n description: \"Nested generative UI rendered inside this component.\",\n anyOf: [\n { type: \"string\" },\n { $ref: \"#/$defs/node\" },\n {\n type: \"array\",\n items: { anyOf: [{ type: \"string\" }, { $ref: \"#/$defs/node\" }] },\n },\n ],\n };\n\n return {\n ...node,\n $defs: { node, children, ...componentSchemas },\n };\n}\n\nfunction formatComponentList(names: string[]) {\n if (names.length <= 2) return names.map((name) => `\"${name}\"`).join(\" and \");\n\n return `${names\n .slice(0, -1)\n .map((name) => `\"${name}\"`)\n .join(\", \")}, and \"${names[names.length - 1]}\"`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,SAAg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T,WAAW;IAAE,MAAM;IAAU,MAAM;IAAO,aAAa;GAAgB;GACxE,MAAM;IACJ,aACE;IACF,OAAO,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,SAAS,CAAC;GAChD;GACA,GAAG,OAAO,YAAY,KAAK;GAC3B,UAAU,EAAE,MAAM,mBAAmB;EACvC;EACA,UAAU,CAAC,QAAQ;CACrB;CAEA,MAAM,WAAwB;EAC5B,aAAa;EACb,OAAO;GACL,EAAE,MAAM,SAAS;GACjB,EAAE,MAAM,eAAe;GACvB;IACE,MAAM;IACN,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,SAAS,GAAG,EAAE,MAAM,eAAe,CAAC,EAAE;GACjE;EACF;CACF;CAEA,OAAO;EACL,GAAG;EACH,OAAO;GAAE;GAAM;GAAU,GAAG;EAAiB;CAC/C;AACF;AAEA,SAAS,oBAAoB,OAAiB;CAC5C,IAAI,MAAM,UAAU,GAAG,OAAO,MAAM,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,OAAO;CAE3E,OAAO,GAAG,MACP,MAAM,GAAG,EAAE,CAAC,CACZ,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAC1B,KAAK,IAAI,EAAE,SAAS,MAAM,MAAM,SAAS,GAAG;AACjD"}
@@ -1,4 +1,3 @@
1
- //#region src/constants.d.ts
2
1
  /**
3
2
  * The wire key naming the component to render.
4
3
  *
@@ -10,5 +9,4 @@
10
9
  */
11
10
  export declare const TYPE_KEY = "$type";
12
11
  export declare const GENERATED_NAME_ATTR = "data-aui-generated-name";
13
- //#endregion
14
12
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;;;;;;qBASa;qBAEA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,UAAU,CAAC;AAEhC,eAAO,MAAM,mBAAmB,4BAA4B,CAAC"}
@@ -1,4 +1,3 @@
1
- //#region src/convert/boundSpec.d.ts
2
1
  /** The maximum traversal depth, counted in visited values, not tree levels. */
3
2
  export declare const MAX_TRAVERSAL_DEPTH = 64;
4
3
  /**
@@ -46,5 +45,4 @@ export declare function clampReasonDetail(reason: ClampReason): string;
46
45
  * exponentially, and a node that is its own ancestor is cut to `null`.
47
46
  */
48
47
  export declare function boundSpec(spec: unknown, onClamp: (reason: ClampReason) => void): unknown;
49
- //#endregion
50
48
  //# sourceMappingURL=boundSpec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boundSpec.d.ts","names":[],"sources":["../../src/convert/boundSpec.ts"],"mappings":";;qBAGa;;;;;;;qBAQA;;;;;;;;qBASA;;;;;;;;qBASA;YAED;;wBAGI,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;wBAwF1B,UACd,eACA,UAAU,QAAQ"}
1
+ {"version":3,"file":"boundSpec.d.ts","sourceRoot":"","sources":["../../src/convert/boundSpec.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAA0B,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpE,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAS7D;AA6DD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GACrC,OAAO,CAQT"}
@@ -1,4 +1,3 @@
1
- //#region src/convert/copyBounded.d.ts
2
1
  /**
3
2
  * Copies at most `cap` entries out of `value` by index.
4
3
  *
@@ -20,8 +19,7 @@
20
19
  * on a second conversion cannot separate the warning from the bound.
21
20
  */
22
21
  export declare const copyBounded: <T>(value: readonly T[], cap: number) => {
23
- readonly items: T[];
24
- readonly truncated: boolean;
22
+ readonly items: T[];
23
+ readonly truncated: boolean;
25
24
  };
26
- //#endregion
27
25
  //# sourceMappingURL=copyBounded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copyBounded.d.ts","names":[],"sources":["../../src/convert/copyBounded.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAoBa,cAAe,GAC1B,gBAAgB,KAChB;WACY,OAAO;WAAc"}
1
+ {"version":3,"file":"copyBounded.d.ts","sourceRoot":"","sources":["../../src/convert/copyBounded.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAC3B,OAAO,SAAS,CAAC,EAAE,EACnB,KAAK,MAAM,KACV;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAcpD,CAAC"}
@@ -1,5 +1,3 @@
1
- import { NormalizedUIElement, NormalizedUINode } from "../ir.js";
2
- //#region src/convert/isElement.d.ts
1
+ import type { NormalizedUIElement, NormalizedUINode } from "../ir.js";
3
2
  export declare const isElement: (node: NormalizedUINode) => node is NormalizedUIElement;
4
- //#endregion
5
3
  //# sourceMappingURL=isElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isElement.d.ts","names":[],"sources":["../../src/convert/isElement.ts"],"mappings":";;qBAEa,YACX,MAAM,qBACL,QAAQ"}
1
+ {"version":3,"file":"isElement.d.ts","sourceRoot":"","sources":["../../src/convert/isElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAc;AAEnE,eAAO,MAAM,SAAS,GACpB,MAAM,gBAAgB,KACrB,IAAI,IAAI,mBACwD,CAAC"}
@@ -1,8 +1,6 @@
1
- import { NormalizedUIElement, NormalizedUINode } from "../ir.js";
2
- //#region src/convert/takeRun.d.ts
1
+ import type { NormalizedUIElement, NormalizedUINode } from "../ir.js";
3
2
  export declare function takeRun(nodes: readonly (NormalizedUINode | undefined)[], index: number, matches: (element: NormalizedUIElement) => boolean): {
4
- run: NormalizedUIElement[];
5
- next: number;
3
+ run: NormalizedUIElement[];
4
+ next: number;
6
5
  };
7
- //#endregion
8
6
  //# sourceMappingURL=takeRun.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"takeRun.d.ts","names":[],"sources":["../../src/convert/takeRun.ts"],"mappings":";;wBAGgB,QACd,iBAAiB,iCACjB,eACA,UAAU,SAAS;EAChB,KAAK;EAAuB"}
1
+ {"version":3,"file":"takeRun.d.ts","sourceRoot":"","sources":["../../src/convert/takeRun.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAc;AAGnE,wBAAgB,OAAO,CACrB,KAAK,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAC,EAAE,EAChD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,GACjD;IAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAW9C"}
@@ -1,5 +1,4 @@
1
- import { GenerativeUILibrary } from "./types.js";
2
- //#region src/defineGenerativeComponents.d.ts
1
+ import type { GenerativeUILibrary } from "./types.js";
3
2
  /**
4
3
  * Authoring helper for a `"use generative"` generative-UI library — the set of
5
4
  * components the model may render. Each component colocates its `properties`
@@ -27,5 +26,4 @@ import { GenerativeUILibrary } from "./types.js";
27
26
  * rather than shipping client `render` code to the server.
28
27
  */
29
28
  export declare function defineGenerativeComponents(_library: GenerativeUILibrary): GenerativeUILibrary;
30
- //#endregion
31
29
  //# sourceMappingURL=defineGenerativeComponents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineGenerativeComponents.d.ts","names":[],"sources":["../src/defineGenerativeComponents.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,2BACd,UAAU,sBACT"}
1
+ {"version":3,"file":"defineGenerativeComponents.d.ts","sourceRoot":"","sources":["../src/defineGenerativeComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAgB;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,mBAAmB,GAC5B,mBAAmB,CAOrB"}
@@ -1,10 +1,9 @@
1
- //#region src/generativeUIToJSX.d.ts
2
1
  /** Options for {@link generativeUIToJSX}. */
3
2
  export interface GenerativeUIToJSXOptions {
4
- /** Escape string children so the output is safe to paste back into a JSX file. Defaults to `false`. */
5
- escape?: boolean;
6
- /** Pretty-print nested element trees with two-space indentation. Defaults to `false`. */
7
- pretty?: boolean;
3
+ /** Escape string children so the output is safe to paste back into a JSX file. Defaults to `false`. */
4
+ escape?: boolean;
5
+ /** Pretty-print nested element trees with two-space indentation. Defaults to `false`. */
6
+ pretty?: boolean;
8
7
  }
9
8
  /**
10
9
  * Serializes a generative-UI node to a JSX-like string for display: the "view source" of a model-produced tree. The wire form `{ $type: "Weather", id: "x" }` becomes `<Weather id="x" />`, and nested `children` render between tags: `<Card title="Hi"><Text>hello</Text></Card>`. A model-provided `$key` becomes the JSX `key` attribute.
@@ -16,5 +15,4 @@ export interface GenerativeUIToJSXOptions {
16
15
  * Pass `{ pretty: true }` to pretty-print nested element trees with two-space indentation, while pure text children stay on one line.
17
16
  */
18
17
  export declare function generativeUIToJSX(node: unknown, options?: GenerativeUIToJSXOptions): string;
19
- //#endregion
20
18
  //# sourceMappingURL=generativeUIToJSX.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generativeUIToJSX.d.ts","names":[],"sources":["../src/generativeUIToJSX.ts"],"mappings":";;iBAGiB;;EAEf;;EAEA;;;;;;;;;;;wBAYc,kBACd,eACA,UAAU"}
1
+ {"version":3,"file":"generativeUIToJSX.d.ts","sourceRoot":"","sources":["../src/generativeUIToJSX.ts"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,uGAAuG;IACvG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CAER"}
package/dist/index.d.ts CHANGED
@@ -1,13 +1,3 @@
1
- import { ALERT_TONES, ALIGNS, Action, AlertTone, Align, BUTTON_STYLES, ButtonStyle, COLORS, Color, ICON_NAMES, IMAGE_SIZE_TOKENS, IconName, ImageSize, JUSTIFIES, Justify, LegacyComponentNode, NormalizedUIElement, NormalizedUINode, TEXT_SIZES, TextSize, UIChildren, UIElement, UINode, UISpec, WEIGHTS, Weight, normalizeSpec, normalizeUINode } from "./ir.js";
2
- import { ActionDispatchContext, ActionHandler, ActionRegistry, createActionRegistry, emptyActionRegistry } from "./actionRegistry.js";
3
- import { GenerativeUIAction, GenerativeUIComponent, GenerativeUIDispatch, GenerativeUIElement, GenerativeUILibrary, GenerativeUINode, GenerativeUIProps, GenerativeUIRenderContext, GenerativeUIStatus } from "./types.js";
4
- import { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserTool } from "./JSONGenerativeUI.shared.js";
5
- import { JSONGenerativeUI } from "./JSONGenerativeUI.client.js";
6
- import { buildPresentParameters } from "./buildPresentParameters.js";
7
- import { TYPE_KEY } from "./constants.js";
8
- import { defineGenerativeComponents } from "./defineGenerativeComponents.js";
9
- import { GenerativeUIToJSXOptions, generativeUIToJSX } from "./generativeUIToJSX.js";
10
- import { renderGenerativeUI } from "./renderGenerativeUI.js";
11
- import { defaultGenerativeUILibrary } from "./vocabulary/index.js";
12
- import "./index.shared.js";
13
- export { ALERT_TONES, ALIGNS, type Action, type ActionDispatchContext, type ActionHandler, type ActionRegistry, type AlertTone, type Align, BUTTON_STYLES, type ButtonStyle, COLORS, type Color, type GenerativeUIAction, type GenerativeUIComponent, type GenerativeUIDispatch, type GenerativeUIElement, type GenerativeUILibrary, type GenerativeUINode, type GenerativeUIProps, type GenerativeUIRenderContext, type GenerativeUIStatus, type GenerativeUIToJSXOptions, ICON_NAMES, IMAGE_SIZE_TOKENS, type IconName, type ImageSize, JSONGenerativeUI, type JSONGenerativeUIOptions, JUSTIFIES, type Justify, type LegacyComponentNode, type NormalizedUIElement, type NormalizedUINode, type PresentTool, type PresentToolOptions, type PromptUserTool, TEXT_SIZES, TYPE_KEY, type TextSize, type UIChildren, type UIElement, type UINode, type UISpec, WEIGHTS, type Weight, buildPresentParameters, createActionRegistry, defaultGenerativeUILibrary, defineGenerativeComponents, emptyActionRegistry, generativeUIToJSX, normalizeSpec, normalizeUINode, renderGenerativeUI };
1
+ export { JSONGenerativeUI } from "./JSONGenerativeUI.client.js";
2
+ export * from "./index.shared.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qCAAkC;AAC7D,kCAA+B"}
@@ -1,13 +1,3 @@
1
- import { ALERT_TONES, ALIGNS, Action, AlertTone, Align, BUTTON_STYLES, ButtonStyle, COLORS, Color, ICON_NAMES, IMAGE_SIZE_TOKENS, IconName, ImageSize, JUSTIFIES, Justify, LegacyComponentNode, NormalizedUIElement, NormalizedUINode, TEXT_SIZES, TextSize, UIChildren, UIElement, UINode, UISpec, WEIGHTS, Weight, normalizeSpec, normalizeUINode } from "./ir.js";
2
- import { ActionDispatchContext, ActionHandler, ActionRegistry, createActionRegistry, emptyActionRegistry } from "./actionRegistry.js";
3
- import { GenerativeUIAction, GenerativeUIComponent, GenerativeUIDispatch, GenerativeUIElement, GenerativeUILibrary, GenerativeUINode, GenerativeUIProps, GenerativeUIRenderContext, GenerativeUIStatus } from "./types.js";
4
- import { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserTool } from "./JSONGenerativeUI.shared.js";
5
- import { JSONGenerativeUI } from "./JSONGenerativeUI.server.js";
6
- import { buildPresentParameters } from "./buildPresentParameters.js";
7
- import { TYPE_KEY } from "./constants.js";
8
- import { defineGenerativeComponents } from "./defineGenerativeComponents.js";
9
- import { GenerativeUIToJSXOptions, generativeUIToJSX } from "./generativeUIToJSX.js";
10
- import { renderGenerativeUI } from "./renderGenerativeUI.js";
11
- import { defaultGenerativeUILibrary } from "./vocabulary/index.js";
12
- import "./index.shared.js";
13
- export { ALERT_TONES, ALIGNS, type Action, type ActionDispatchContext, type ActionHandler, type ActionRegistry, type AlertTone, type Align, BUTTON_STYLES, type ButtonStyle, COLORS, type Color, type GenerativeUIAction, type GenerativeUIComponent, type GenerativeUIDispatch, type GenerativeUIElement, type GenerativeUILibrary, type GenerativeUINode, type GenerativeUIProps, type GenerativeUIRenderContext, type GenerativeUIStatus, type GenerativeUIToJSXOptions, ICON_NAMES, IMAGE_SIZE_TOKENS, type IconName, type ImageSize, JSONGenerativeUI, type JSONGenerativeUIOptions, JUSTIFIES, type Justify, type LegacyComponentNode, type NormalizedUIElement, type NormalizedUINode, type PresentTool, type PresentToolOptions, type PromptUserTool, TEXT_SIZES, TYPE_KEY, type TextSize, type UIChildren, type UIElement, type UINode, type UISpec, WEIGHTS, type Weight, buildPresentParameters, createActionRegistry, defaultGenerativeUILibrary, defineGenerativeComponents, emptyActionRegistry, generativeUIToJSX, normalizeSpec, normalizeUINode, renderGenerativeUI };
1
+ export { JSONGenerativeUI } from "./JSONGenerativeUI.server.js";
2
+ export * from "./index.shared.js";
3
+ //# sourceMappingURL=index.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qCAAkC;AAC7D,kCAA+B"}
@@ -1,11 +1,15 @@
1
- import { ALERT_TONES, ALIGNS, Action, AlertTone, Align, BUTTON_STYLES, ButtonStyle, COLORS, Color, ICON_NAMES, IMAGE_SIZE_TOKENS, IconName, ImageSize, JUSTIFIES, Justify, LegacyComponentNode, NormalizedUIElement, NormalizedUINode, TEXT_SIZES, TextSize, UIChildren, UIElement, UINode, UISpec, WEIGHTS, Weight, normalizeSpec, normalizeUINode } from "./ir.js";
2
- import { ActionDispatchContext, ActionHandler, ActionRegistry, createActionRegistry, emptyActionRegistry } from "./actionRegistry.js";
3
- import { GenerativeUIAction, GenerativeUIComponent, GenerativeUIDispatch, GenerativeUIElement, GenerativeUILibrary, GenerativeUINode, GenerativeUIProps, GenerativeUIRenderContext, GenerativeUIStatus } from "./types.js";
4
- import { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserTool } from "./JSONGenerativeUI.shared.js";
5
- import { buildPresentParameters } from "./buildPresentParameters.js";
6
- import { TYPE_KEY } from "./constants.js";
7
- import { defineGenerativeComponents } from "./defineGenerativeComponents.js";
8
- import { GenerativeUIToJSXOptions, generativeUIToJSX } from "./generativeUIToJSX.js";
9
- import { renderGenerativeUI } from "./renderGenerativeUI.js";
10
- import { defaultGenerativeUILibrary } from "./vocabulary/index.js";
11
- export { ALERT_TONES, ALIGNS, type Action, type ActionDispatchContext, type ActionHandler, type ActionRegistry, type AlertTone, type Align, BUTTON_STYLES, type ButtonStyle, COLORS, type Color, type GenerativeUIAction, type GenerativeUIComponent, type GenerativeUIDispatch, type GenerativeUIElement, type GenerativeUILibrary, type GenerativeUINode, type GenerativeUIProps, type GenerativeUIRenderContext, type GenerativeUIStatus, type GenerativeUIToJSXOptions, ICON_NAMES, IMAGE_SIZE_TOKENS, type IconName, type ImageSize, type JSONGenerativeUIOptions, JUSTIFIES, type Justify, type LegacyComponentNode, type NormalizedUIElement, type NormalizedUINode, type PresentTool, type PresentToolOptions, type PromptUserTool, TEXT_SIZES, TYPE_KEY, type TextSize, type UIChildren, type UIElement, type UINode, type UISpec, WEIGHTS, type Weight, buildPresentParameters, createActionRegistry, defaultGenerativeUILibrary, defineGenerativeComponents, emptyActionRegistry, generativeUIToJSX, normalizeSpec, normalizeUINode, renderGenerativeUI };
1
+ export { renderGenerativeUI } from "./renderGenerativeUI.js";
2
+ export { generativeUIToJSX } from "./generativeUIToJSX.js";
3
+ export type { GenerativeUIToJSXOptions } from "./generativeUIToJSX.js";
4
+ export { buildPresentParameters } from "./buildPresentParameters.js";
5
+ export { defineGenerativeComponents } from "./defineGenerativeComponents.js";
6
+ export { TYPE_KEY } from "./constants.js";
7
+ export { normalizeUINode, normalizeSpec } from "./ir.js";
8
+ export { TEXT_SIZES, IMAGE_SIZE_TOKENS, WEIGHTS, COLORS, ALIGNS, JUSTIFIES, BUTTON_STYLES, ALERT_TONES, ICON_NAMES, } from "./ir.js";
9
+ export { defaultGenerativeUILibrary } from "./vocabulary/index.js";
10
+ export { createActionRegistry, emptyActionRegistry } from "./actionRegistry.js";
11
+ export type { ActionHandler, ActionRegistry, ActionDispatchContext, } from "./actionRegistry.js";
12
+ export type { JSONGenerativeUIOptions, PresentTool, PresentToolOptions, PromptUserTool, } from "./JSONGenerativeUI.shared.js";
13
+ export type { GenerativeUILibrary, GenerativeUIComponent, GenerativeUIElement, GenerativeUIProps, GenerativeUINode, GenerativeUIStatus, GenerativeUIRenderContext, GenerativeUIAction, GenerativeUIDispatch, } from "./types.js";
14
+ export type { UINode, UIElement, UIChildren, LegacyComponentNode, Action, UISpec, NormalizedUINode, NormalizedUIElement, TextSize, ImageSize, Weight, Color, Align, Justify, ButtonStyle, AlertTone, IconName, } from "./ir.js";
15
+ //# sourceMappingURL=index.shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.shared.d.ts","sourceRoot":"","sources":["../src/index.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gCAA6B;AAC1D,OAAO,EAAE,iBAAiB,EAAE,+BAA4B;AACxD,YAAY,EAAE,wBAAwB,EAAE,+BAA4B;AACpE,OAAO,EAAE,sBAAsB,EAAE,oCAAiC;AAClE,OAAO,EAAE,0BAA0B,EAAE,wCAAqC;AAC1E,OAAO,EAAE,QAAQ,EAAE,uBAAoB;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAa;AACtD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,MAAM,EACN,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,UAAU,GACX,gBAAa;AACd,OAAO,EAAE,0BAA0B,EAAE,8BAAqB;AAC1D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,4BAAyB;AAC7E,YAAY,EACV,aAAa,EACb,cAAc,EACd,qBAAqB,GACtB,4BAAyB;AAC1B,YAAY,EACV,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,cAAc,GACf,qCAAkC;AACnC,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,GACrB,mBAAgB;AACjB,YAAY,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACV,mBAAmB,EACnB,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,KAAK,EACL,KAAK,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,QAAQ,GACT,gBAAa"}
package/dist/ir.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/ir.d.ts
2
1
  /**
3
2
  * The generative-ui intermediate representation: a model-emitted, cross-platform
4
3
  * UI tree. React-free, so converters and non-web runtimes consume it without
@@ -39,8 +38,8 @@ export type IconName = (typeof ICON_NAMES)[number];
39
38
  * Behavior payload carried by an interactive node. `type` is resolved by the host's action registry, not the renderer; keeping behavior as data keeps the tree serializable, so the same node renders on web while converters may bind the type to a native action id on other platforms.
40
39
  */
41
40
  export interface Action {
42
- readonly type: string;
43
- readonly [payload: string]: unknown;
41
+ readonly type: string;
42
+ readonly [payload: string]: unknown;
44
43
  }
45
44
  /**
46
45
  * Anything renderable as generative UI, as the model emits it. The renderer
@@ -54,11 +53,11 @@ export type UIChildren = UINode | readonly UINode[];
54
53
  * model to emit, instead of a nested `{ type, props }` bag. Reserved keys are
55
54
  * stripped before props reach the component (see the module header). */
56
55
  export interface UIElement {
57
- readonly $type: string;
58
- readonly $key?: string | number;
59
- readonly children?: UIChildren;
60
- readonly $action?: Action;
61
- readonly [prop: string]: unknown;
56
+ readonly $type: string;
57
+ readonly $key?: string | number;
58
+ readonly children?: UIChildren;
59
+ readonly $action?: Action;
60
+ readonly [prop: string]: unknown;
62
61
  }
63
62
  /**
64
63
  * The legacy node shape: a `component` name plus a nested `props` bag. Kept
@@ -66,10 +65,10 @@ export interface UIElement {
66
65
  * shape instead.
67
66
  */
68
67
  export interface LegacyComponentNode {
69
- readonly component: string;
70
- readonly props?: Record<string, unknown>;
71
- readonly children?: UIChildren;
72
- readonly key?: string;
68
+ readonly component: string;
69
+ readonly props?: Record<string, unknown>;
70
+ readonly children?: UIChildren;
71
+ readonly key?: string;
73
72
  }
74
73
  export type UISpec = UINode | readonly UINode[];
75
74
  /**
@@ -81,11 +80,11 @@ export type UISpec = UINode | readonly UINode[];
81
80
  * into component props.
82
81
  */
83
82
  export interface NormalizedUIElement {
84
- readonly type: string;
85
- readonly props: Readonly<Record<string, unknown>>;
86
- readonly children?: NormalizedUINode | undefined;
87
- readonly key?: string | number | undefined;
88
- readonly action?: Action | undefined;
83
+ readonly type: string;
84
+ readonly props: Readonly<Record<string, unknown>>;
85
+ readonly children?: NormalizedUINode | undefined;
86
+ readonly key?: string | number | undefined;
87
+ readonly action?: Action | undefined;
89
88
  }
90
89
  export type NormalizedUINode = string | number | readonly NormalizedUINode[] | NormalizedUIElement | null;
91
90
  /**
@@ -108,7 +107,6 @@ export declare function normalizeUINode(node: unknown, partialPath?: readonly st
108
107
  * single node or a list.
109
108
  */
110
109
  export declare function normalizeSpec(spec: UISpec): {
111
- readonly root: NormalizedUINode | readonly NormalizedUINode[];
110
+ readonly root: NormalizedUINode | readonly NormalizedUINode[];
112
111
  };
113
- //#endregion
114
112
  //# sourceMappingURL=ir.d.ts.map
package/dist/ir.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ir.d.ts","names":[],"sources":["../src/ir.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAmBa;YACD,mBAAmB;qBAElB;YACD,oBAAoB;qBAEnB;YACD,iBAAiB;qBAEhB;YAQD,gBAAgB;qBAEf;YACD,gBAAgB;qBAEf;YACD,kBAAkB;qBAEjB;YAOD,sBAAsB;qBAErB;;YAED,oBAAoB;qBAEnB;;YA2BD,mBAAmB;;;;iBAKd;WACN;YACC;;;;;;;;YASA,2BAA2B,YAAY;YAEvC,aAAa,kBAAkB;;;;iBAK1B;WACN;WACA;WACA,WAAW;WACX,UAAU;YACT;;;;;;;iBAQK;WACN;WACA,QAAQ;WACR,WAAW;WACX;;YAGC,SAAS,kBAAkB;;;;;;;;;iBAUtB;WACN;WACA,OAAO,SAAS;WAChB,WAAW;WACX;WACA,SAAS;;YAGR,8CAGC,qBACT;;;;;;;;;;;;;;;wBA6CY,gBACd,eACA,6CACA,iBACC;;;;;wBAuEa,cAAc,MAAM;WACzB,MAAM,4BAA4B"}
1
+ {"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,eAAO,MAAM,UAAU,iDAAkD,CAAC;AAC1E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AgB,EAAE,GAC3B,mBAAmB,GACnB,IAAI,CAAC;AA8BT;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC3C,KAAK,SAAI,GACR,gBAAgB,CA2ClB;AAwBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAC3C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,gBAAgB,EAAE,CAAC;CAC/D,CAOA"}
@@ -1,6 +1,5 @@
1
- import { GenerativeUILibrary, GenerativeUIRenderContext } from "./types.js";
2
- import { ReactNode } from "react";
3
- //#region src/renderGenerativeUI.d.ts
1
+ import { type ReactNode } from "react";
2
+ import type { GenerativeUILibrary, GenerativeUIRenderContext } from "./types.js";
4
3
  /**
5
4
  * Renders a generative-ui tree against a {@link GenerativeUILibrary}.
6
5
  *
@@ -12,5 +11,4 @@ import { ReactNode } from "react";
12
11
  * can nest.
13
12
  */
14
13
  export declare function renderGenerativeUI(node: unknown, library: GenerativeUILibrary, context?: GenerativeUIRenderContext): ReactNode;
15
- //#endregion
16
14
  //# sourceMappingURL=renderGenerativeUI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderGenerativeUI.d.ts","names":[],"sources":["../src/renderGenerativeUI.tsx"],"mappings":";;;;;;;;;;;;;wBAwBgB,mBACd,eACA,SAAS,qBACT,UAAS,4BACR"}
1
+ {"version":3,"file":"renderGenerativeUI.d.ts","sourceRoot":"","sources":["../src/renderGenerativeUI.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,mBAAgB;AAO9E;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,mBAAmB,EAC5B,OAAO,GAAE,yBAA2C,GACnD,SAAS,CAOX"}
@@ -0,0 +1,6 @@
1
+ import type { JSONSchema7 } from "json-schema";
2
+ export declare function scopeSchema(schema: JSONSchema7, path: string): {
3
+ schema: JSONSchema7;
4
+ referenced: boolean;
5
+ };
6
+ //# sourceMappingURL=scopeSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeSchema.d.ts","sourceRoot":"","sources":["../src/scopeSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,aAAa,CAAC;AAYtE,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;;;EA0D5D"}
@@ -0,0 +1,56 @@
1
+ //#region src/scopeSchema.ts
2
+ function scopeSchema(schema, path) {
3
+ let referenced = false;
4
+ const visit = (definition) => {
5
+ if (typeof definition === "boolean") return definition;
6
+ const schema = definition;
7
+ const result = { ...schema };
8
+ if (schema.$ref === "#" || schema.$ref?.startsWith("#/")) {
9
+ referenced = true;
10
+ result.$ref = path + schema.$ref.slice(1);
11
+ }
12
+ for (const key of [
13
+ "properties",
14
+ "patternProperties",
15
+ "definitions",
16
+ "$defs",
17
+ "dependentSchemas"
18
+ ]) {
19
+ const entries = schema[key];
20
+ if (entries) result[key] = Object.fromEntries(Object.entries(entries).map(([name, value]) => [name, visit(value)]));
21
+ }
22
+ for (const key of [
23
+ "allOf",
24
+ "anyOf",
25
+ "oneOf",
26
+ "prefixItems"
27
+ ]) if (schema[key]) result[key] = schema[key].map(visit);
28
+ for (const key of [
29
+ "additionalProperties",
30
+ "additionalItems",
31
+ "unevaluatedProperties",
32
+ "unevaluatedItems",
33
+ "contentSchema",
34
+ "contains",
35
+ "propertyNames",
36
+ "not",
37
+ "if",
38
+ "then",
39
+ "else"
40
+ ]) {
41
+ const value = schema[key];
42
+ if (value !== void 0) result[key] = visit(value);
43
+ }
44
+ if (schema.items !== void 0) result.items = Array.isArray(schema.items) ? schema.items.map(visit) : visit(schema.items);
45
+ if (schema.dependencies) result.dependencies = Object.fromEntries(Object.entries(schema.dependencies).map(([name, value]) => [name, Array.isArray(value) ? value : visit(value)]));
46
+ return result;
47
+ };
48
+ return {
49
+ schema: visit(schema),
50
+ referenced
51
+ };
52
+ }
53
+ //#endregion
54
+ export { scopeSchema };
55
+
56
+ //# sourceMappingURL=scopeSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeSchema.js","names":[],"sources":["../src/scopeSchema.ts"],"sourcesContent":["import type { JSONSchema7, JSONSchema7Definition } from \"json-schema\";\n\n// The converter does not pin a JSON Schema draft, so the 2020-12 applicators\n// missing from the JSONSchema7 typings must be traversed as well.\ntype TraversableSchema = JSONSchema7 & {\n prefixItems?: JSONSchema7Definition[];\n dependentSchemas?: { [key: string]: JSONSchema7Definition };\n unevaluatedItems?: JSONSchema7Definition;\n unevaluatedProperties?: JSONSchema7Definition;\n contentSchema?: JSONSchema7Definition;\n};\n\nexport function scopeSchema(schema: JSONSchema7, path: string) {\n let referenced = false;\n const visit = (definition: JSONSchema7Definition): JSONSchema7Definition => {\n if (typeof definition === \"boolean\") return definition;\n const schema = definition as TraversableSchema;\n const result = { ...schema };\n if (schema.$ref === \"#\" || schema.$ref?.startsWith(\"#/\")) {\n referenced = true;\n result.$ref = path + schema.$ref.slice(1);\n }\n // Only schema-bearing keywords are traversed; defaults and examples are data.\n for (const key of [\n \"properties\",\n \"patternProperties\",\n \"definitions\",\n \"$defs\",\n \"dependentSchemas\",\n ] as const) {\n const entries = schema[key];\n if (entries)\n result[key] = Object.fromEntries(\n Object.entries(entries).map(([name, value]) => [name, visit(value)]),\n );\n }\n for (const key of [\"allOf\", \"anyOf\", \"oneOf\", \"prefixItems\"] as const) {\n if (schema[key]) result[key] = schema[key].map(visit);\n }\n for (const key of [\n \"additionalProperties\",\n \"additionalItems\",\n \"unevaluatedProperties\",\n \"unevaluatedItems\",\n \"contentSchema\",\n \"contains\",\n \"propertyNames\",\n \"not\",\n \"if\",\n \"then\",\n \"else\",\n ] as const) {\n const value = schema[key];\n if (value !== undefined) result[key] = visit(value);\n }\n if (schema.items !== undefined)\n result.items = Array.isArray(schema.items)\n ? schema.items.map(visit)\n : visit(schema.items);\n if (schema.dependencies)\n result.dependencies = Object.fromEntries(\n Object.entries(schema.dependencies).map(([name, value]) => [\n name,\n Array.isArray(value) ? value : visit(value),\n ]),\n );\n return result;\n };\n const scoped = visit(schema) as JSONSchema7;\n return { schema: scoped, referenced };\n}\n"],"mappings":";AAYA,SAAgB,YAAY,QAAqB,MAAc;CAC7D,IAAI,aAAa;CACjB,MAAM,SAAS,eAA6D;EAC1E,IAAI,OAAO,eAAe,WAAW,OAAO;EAC5C,MAAM,SAAS;EACf,MAAM,SAAS,EAAE,GAAG,OAAO;EAC3B,IAAI,OAAO,SAAS,OAAO,OAAO,MAAM,WAAW,IAAI,GAAG;GACxD,aAAa;GACb,OAAO,OAAO,OAAO,OAAO,KAAK,MAAM,CAAC;EAC1C;EAEA,KAAK,MAAM,OAAO;GAChB;GACA;GACA;GACA;GACA;EACF,GAAY;GACV,MAAM,UAAU,OAAO;GACvB,IAAI,SACF,OAAO,OAAO,OAAO,YACnB,OAAO,QAAQ,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC,CACrE;EACJ;EACA,KAAK,MAAM,OAAO;GAAC;GAAS;GAAS;GAAS;EAAa,GACzD,IAAI,OAAO,MAAM,OAAO,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK;EAEtD,KAAK,MAAM,OAAO;GAChB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,GAAY;GACV,MAAM,QAAQ,OAAO;GACrB,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,MAAM,KAAK;EACpD;EACA,IAAI,OAAO,UAAU,KAAA,GACnB,OAAO,QAAQ,MAAM,QAAQ,OAAO,KAAK,IACrC,OAAO,MAAM,IAAI,KAAK,IACtB,MAAM,OAAO,KAAK;EACxB,IAAI,OAAO,cACT,OAAO,eAAe,OAAO,YAC3B,OAAO,QAAQ,OAAO,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CACzD,MACA,MAAM,QAAQ,KAAK,IAAI,QAAQ,MAAM,KAAK,CAC5C,CAAC,CACH;EACF,OAAO;CACT;CAEA,OAAO;EAAE,QADM,MAAM,MACC;EAAG;CAAW;AACtC"}
@@ -1,5 +1,4 @@
1
- import { SlackAlertBlock, SlackButtonElement, SlackCardBlock, SlackCarouselBlock, SlackContextBlock, SlackDataTableBlock, SlackDataTableCell, SlackImageBlock, SlackSectionBlock, SlackTextObject } from "./types.js";
2
- //#region src/slack/constants.d.ts
1
+ import type { SlackAlertBlock, SlackButtonElement, SlackCardBlock, SlackCarouselBlock, SlackContextBlock, SlackDataTableBlock, SlackDataTableCell, SlackImageBlock, SlackSectionBlock, SlackTextObject } from "./types.js";
3
2
  /** The block limit for a Slack message. */
4
3
  export declare const MESSAGE_BLOCK_CAP = 50;
5
4
  /** The block limit for a Slack modal. */
@@ -73,12 +72,12 @@ export declare function buildAlertFallback(title: string, description: string, t
73
72
  /** Builds a 2026 Slack modal-only alert block, mapping `tone` to its `level`. */
74
73
  export declare function buildAlertBlock(text: string, tone: "info" | "success" | "warning" | "danger"): SlackAlertBlock;
75
74
  type CardBlockFields = {
76
- readonly heroImage?: SlackImageBlock;
77
- readonly title?: SlackTextObject;
78
- readonly subtitle?: SlackTextObject;
79
- readonly body?: SlackTextObject;
80
- readonly subtext?: SlackTextObject;
81
- readonly actions?: readonly SlackButtonElement[];
75
+ readonly heroImage?: SlackImageBlock;
76
+ readonly title?: SlackTextObject;
77
+ readonly subtitle?: SlackTextObject;
78
+ readonly body?: SlackTextObject;
79
+ readonly subtext?: SlackTextObject;
80
+ readonly actions?: readonly SlackButtonElement[];
82
81
  };
83
82
  /** Builds a 2026 Slack card block from its already-clamped fields. */
84
83
  export declare function buildCardBlock(fields: CardBlockFields): SlackCardBlock;
@@ -88,5 +87,5 @@ export declare function buildCarouselBlock(elements: readonly SlackCardBlock[]):
88
87
  export declare function buildDataTableBlock(rows: readonly (readonly SlackDataTableCell[])[]): SlackDataTableBlock;
89
88
  /** Builds the final note used when a surface block budget is exceeded. */
90
89
  export declare function buildBlockBudgetNote(omitted: number): SlackContextBlock;
91
- //#endregion
90
+ export {};
92
91
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/slack/constants.ts"],"mappings":";;;qBAca;;qBAGA;;;;;;qBAOA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;;;;qBAMA;;qBAGA;;;;;qBAMA;;qBAGA;;qBAGA;;wBAGG,mBACd,eACA,qBACA,4DACW,mBAAmB;;wBAmBhB,gBACd,cACA,kDACC;KAKE;WACM,YAAY;WACZ,QAAQ;WACR,WAAW;WACX,OAAO;WACP,UAAU;WACV,mBAAmB;;;wBAId,eAAe,QAAQ,kBAAkB;;wBAczC,mBACd,mBAAmB,mBAClB;;wBAKa,oBACd,yBAAyB,0BACxB;;wBAKa,qBAAqB,kBAAkB"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/slack/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,mBAAgB;AAEjB,2CAA2C;AAC3C,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,yCAAyC;AACzC,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;GA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O,EAAE,MAAM,GAAG,iBAAiB,CAUvE"}
@@ -1,10 +1,8 @@
1
- import { Action } from "../ir.js";
2
- //#region src/slack/decodeBlockAction.d.ts
1
+ import type { Action } from "../ir.js";
3
2
  /**
4
3
  * Decodes one structural entry from a Slack `block_actions` payload.
5
4
  * `$input` is reserved for the runtime selection: a `$input` key inside the
6
5
  * button's JSON `value` payload is dropped rather than spread into the result.
7
6
  */
8
7
  export declare function decodeBlockAction(action: unknown): Action | undefined;
9
- //#endregion
10
8
  //# sourceMappingURL=decodeBlockAction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decodeBlockAction.d.ts","names":[],"sources":["../../src/slack/decodeBlockAction.ts"],"mappings":";;;;;;;wBAegB,kBAAkB,kBAAkB"}
1
+ {"version":3,"file":"decodeBlockAction.d.ts","sourceRoot":"","sources":["../../src/slack/decodeBlockAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAc;AAUpC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAkDrE"}
@@ -1,5 +1,4 @@
1
- import { FromSlackBlocksResult } from "./types.js";
2
- //#region src/slack/fromSlackBlocks.d.ts
1
+ import type { FromSlackBlocksResult } from "./types.js";
3
2
  /**
4
3
  * Converts Slack Block Kit JSON back into a generative-ui IR tree, inverting
5
4
  * {@link toSlackBlocks}. Accepts a blocks array or a `{ blocks }` wrapper;
@@ -25,5 +24,4 @@ import { FromSlackBlocksResult } from "./types.js";
25
24
  * Slack shape does not distinguish a boolean from ordinary text.
26
25
  */
27
26
  export declare function fromSlackBlocks(blocks: unknown): FromSlackBlocksResult;
28
- //#endregion
29
27
  //# sourceMappingURL=fromSlackBlocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fromSlackBlocks.d.ts","names":[],"sources":["../../src/slack/fromSlackBlocks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;wBA+pBgB,gBAAgB,kBAAkB"}
1
+ {"version":3,"file":"fromSlackBlocks.d.ts","sourceRoot":"","sources":["../../src/slack/fromSlackBlocks.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAA0B,mBAAgB;AAynB7E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,qBAAqB,CAqCtE"}
@@ -1,6 +1,4 @@
1
- import { SlackBlocksResult, ToSlackBlocksOptions } from "./types.js";
2
- //#region src/slack/toSlackBlocks.d.ts
1
+ import type { SlackBlocksResult, ToSlackBlocksOptions } from "./types.js";
3
2
  /** Converts a generative-UI tree into Slack Block Kit JSON and downgrade warnings. */
4
3
  export declare function toSlackBlocks(node: unknown, options?: ToSlackBlocksOptions): SlackBlocksResult;
5
- //#endregion
6
4
  //# sourceMappingURL=toSlackBlocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toSlackBlocks.d.ts","names":[],"sources":["../../src/slack/toSlackBlocks.ts"],"mappings":";;;wBAqzCgB,cACd,eACA,UAAU,uBACT"}
1
+ {"version":3,"file":"toSlackBlocks.d.ts","sourceRoot":"","sources":["../../src/slack/toSlackBlocks.ts"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAWV,iBAAiB,EACjB,oBAAoB,EACrB,mBAAgB;AAuvCjB,sFAAsF;AACtF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,iBAAiB,CA2CnB"}
@@ -1,9 +1,9 @@
1
1
  import { normalizeSpec } from "../ir.js";
2
2
  import { copyBounded } from "../convert/copyBounded.js";
3
- import { CONTEXT_TEXT_CAP, DATA_TABLE_CHAR_BUDGET, FACT_FIELD_TEXT_CAP, INPUT_LABEL_CAP, MARKDOWN_TEXT_BUDGET, SECTION_TEXT_CAP, buildAlertBlock, buildAlertFallback, buildBlockBudgetNote, buildCardBlock, buildCarouselBlock, buildDataTableBlock } from "./constants.js";
4
3
  import { boundSpec, clampReasonDetail } from "../convert/boundSpec.js";
5
4
  import { isElement } from "../convert/isElement.js";
6
5
  import { takeRun } from "../convert/takeRun.js";
6
+ import { CONTEXT_TEXT_CAP, DATA_TABLE_CHAR_BUDGET, FACT_FIELD_TEXT_CAP, INPUT_LABEL_CAP, MARKDOWN_TEXT_BUDGET, SECTION_TEXT_CAP, buildAlertBlock, buildAlertFallback, buildBlockBudgetNote, buildCardBlock, buildCarouselBlock, buildDataTableBlock } from "./constants.js";
7
7
  //#region src/slack/toSlackBlocks.ts
8
8
  const INTERACTIVE_TYPES = /* @__PURE__ */ new Set([
9
9
  "Button",