@agent-native/core 0.39.1 → 0.40.0

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 (208) hide show
  1. package/README.md +1 -1
  2. package/dist/action.js +12 -0
  3. package/dist/action.js.map +1 -1
  4. package/dist/cli/create.d.ts.map +1 -1
  5. package/dist/cli/create.js +5 -1
  6. package/dist/cli/create.js.map +1 -1
  7. package/dist/cli/index.js +1 -1
  8. package/dist/cli/index.js.map +1 -1
  9. package/dist/cli/skills.d.ts +6 -6
  10. package/dist/cli/skills.d.ts.map +1 -1
  11. package/dist/cli/skills.js +936 -1167
  12. package/dist/cli/skills.js.map +1 -1
  13. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  14. package/dist/client/MultiTabAssistantChat.js +2 -5
  15. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  16. package/dist/client/NewWorkspaceAppFlow.js +1 -1
  17. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  18. package/dist/client/blocks/AiEditableField.d.ts +8 -0
  19. package/dist/client/blocks/AiEditableField.d.ts.map +1 -0
  20. package/dist/client/blocks/AiEditableField.js +10 -0
  21. package/dist/client/blocks/AiEditableField.js.map +1 -0
  22. package/dist/client/blocks/BlockView.d.ts +3 -3
  23. package/dist/client/blocks/BlockView.d.ts.map +1 -1
  24. package/dist/client/blocks/BlockView.js +15 -3
  25. package/dist/client/blocks/BlockView.js.map +1 -1
  26. package/dist/client/blocks/SchemaBlockEditor.js +2 -2
  27. package/dist/client/blocks/SchemaBlockEditor.js.map +1 -1
  28. package/dist/client/blocks/index.d.ts +5 -2
  29. package/dist/client/blocks/index.d.ts.map +1 -1
  30. package/dist/client/blocks/index.js +6 -3
  31. package/dist/client/blocks/index.js.map +1 -1
  32. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
  33. package/dist/client/blocks/library/ApiEndpointBlock.js +20 -6
  34. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
  35. package/dist/client/blocks/library/DiffBlock.d.ts +29 -0
  36. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  37. package/dist/client/blocks/library/DiffBlock.js +190 -30
  38. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  39. package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -1
  40. package/dist/client/blocks/library/FileTreeBlock.js +46 -7
  41. package/dist/client/blocks/library/FileTreeBlock.js.map +1 -1
  42. package/dist/client/blocks/library/HighlightedCode.d.ts +10 -0
  43. package/dist/client/blocks/library/HighlightedCode.d.ts.map +1 -0
  44. package/dist/client/blocks/library/HighlightedCode.js +92 -0
  45. package/dist/client/blocks/library/HighlightedCode.js.map +1 -0
  46. package/dist/client/blocks/library/JsonExplorerBlock.d.ts +9 -4
  47. package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -1
  48. package/dist/client/blocks/library/JsonExplorerBlock.js +66 -30
  49. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -1
  50. package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -1
  51. package/dist/client/blocks/library/MermaidBlock.js +73 -44
  52. package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
  53. package/dist/client/blocks/library/OpenApiSpecBlock.d.ts.map +1 -1
  54. package/dist/client/blocks/library/OpenApiSpecBlock.js +3 -2
  55. package/dist/client/blocks/library/OpenApiSpecBlock.js.map +1 -1
  56. package/dist/client/blocks/library/checklist.d.ts.map +1 -1
  57. package/dist/client/blocks/library/checklist.js +1 -0
  58. package/dist/client/blocks/library/checklist.js.map +1 -1
  59. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -1
  60. package/dist/client/blocks/library/code-tabs.js +183 -102
  61. package/dist/client/blocks/library/code-tabs.js.map +1 -1
  62. package/dist/client/blocks/library/columns.config.d.ts +60 -0
  63. package/dist/client/blocks/library/columns.config.d.ts.map +1 -0
  64. package/dist/client/blocks/library/columns.config.js +37 -0
  65. package/dist/client/blocks/library/columns.config.js.map +1 -0
  66. package/dist/client/blocks/library/columns.d.ts +25 -0
  67. package/dist/client/blocks/library/columns.d.ts.map +1 -0
  68. package/dist/client/blocks/library/columns.js +199 -0
  69. package/dist/client/blocks/library/columns.js.map +1 -0
  70. package/dist/client/blocks/library/dev-doc-ui.d.ts +2 -1
  71. package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -1
  72. package/dist/client/blocks/library/dev-doc-ui.js +2 -1
  73. package/dist/client/blocks/library/dev-doc-ui.js.map +1 -1
  74. package/dist/client/blocks/library/html.d.ts +1 -1
  75. package/dist/client/blocks/library/html.d.ts.map +1 -1
  76. package/dist/client/blocks/library/html.js +34 -4
  77. package/dist/client/blocks/library/html.js.map +1 -1
  78. package/dist/client/blocks/library/json-explorer.config.d.ts +3 -1
  79. package/dist/client/blocks/library/json-explorer.config.d.ts.map +1 -1
  80. package/dist/client/blocks/library/json-explorer.config.js +30 -1
  81. package/dist/client/blocks/library/json-explorer.config.js.map +1 -1
  82. package/dist/client/blocks/library/server-specs.d.ts.map +1 -1
  83. package/dist/client/blocks/library/server-specs.js +13 -3
  84. package/dist/client/blocks/library/server-specs.js.map +1 -1
  85. package/dist/client/blocks/library/specs.d.ts +4 -4
  86. package/dist/client/blocks/library/specs.d.ts.map +1 -1
  87. package/dist/client/blocks/library/specs.js +21 -16
  88. package/dist/client/blocks/library/specs.js.map +1 -1
  89. package/dist/client/blocks/library/table.config.d.ts +3 -0
  90. package/dist/client/blocks/library/table.config.d.ts.map +1 -1
  91. package/dist/client/blocks/library/table.config.js +13 -1
  92. package/dist/client/blocks/library/table.config.js.map +1 -1
  93. package/dist/client/blocks/library/table.d.ts.map +1 -1
  94. package/dist/client/blocks/library/table.js +90 -9
  95. package/dist/client/blocks/library/table.js.map +1 -1
  96. package/dist/client/blocks/library/tabs.config.d.ts +16 -8
  97. package/dist/client/blocks/library/tabs.config.d.ts.map +1 -1
  98. package/dist/client/blocks/library/tabs.config.js +10 -4
  99. package/dist/client/blocks/library/tabs.config.js.map +1 -1
  100. package/dist/client/blocks/library/tabs.d.ts.map +1 -1
  101. package/dist/client/blocks/library/tabs.js +146 -21
  102. package/dist/client/blocks/library/tabs.js.map +1 -1
  103. package/dist/client/blocks/server.d.ts +2 -1
  104. package/dist/client/blocks/server.d.ts.map +1 -1
  105. package/dist/client/blocks/server.js +1 -0
  106. package/dist/client/blocks/server.js.map +1 -1
  107. package/dist/client/blocks/types.d.ts +99 -9
  108. package/dist/client/blocks/types.d.ts.map +1 -1
  109. package/dist/client/blocks/types.js.map +1 -1
  110. package/dist/client/index.d.ts +1 -1
  111. package/dist/client/index.d.ts.map +1 -1
  112. package/dist/client/index.js +2 -2
  113. package/dist/client/index.js.map +1 -1
  114. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -1
  115. package/dist/client/rich-markdown-editor/BubbleToolbar.js +13 -3
  116. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -1
  117. package/dist/client/rich-markdown-editor/DragHandle.d.ts +49 -4
  118. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -1
  119. package/dist/client/rich-markdown-editor/DragHandle.js +656 -88
  120. package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -1
  121. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +10 -1
  122. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
  123. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +180 -15
  124. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
  125. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +2 -1
  126. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
  127. package/dist/client/rich-markdown-editor/SharedRichEditor.js +3 -1
  128. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
  129. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +5 -0
  130. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -1
  131. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +33 -5
  132. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -1
  133. package/dist/client/rich-markdown-editor/index.d.ts +3 -3
  134. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
  135. package/dist/client/rich-markdown-editor/index.js +2 -2
  136. package/dist/client/rich-markdown-editor/index.js.map +1 -1
  137. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +14 -0
  138. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -1
  139. package/dist/client/rich-markdown-editor/registrySlashCommands.js +38 -0
  140. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -1
  141. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +1 -0
  142. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
  143. package/dist/client/rich-markdown-editor/useCollabReconcile.js +4 -0
  144. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
  145. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  146. package/dist/client/settings/SettingsPanel.js +11 -19
  147. package/dist/client/settings/SettingsPanel.js.map +1 -1
  148. package/dist/client/use-chat-models.d.ts.map +1 -1
  149. package/dist/client/use-chat-models.js +2 -5
  150. package/dist/client/use-chat-models.js.map +1 -1
  151. package/dist/db/client.d.ts.map +1 -1
  152. package/dist/db/client.js +17 -1
  153. package/dist/db/client.js.map +1 -1
  154. package/dist/deploy/build.d.ts.map +1 -1
  155. package/dist/deploy/build.js +2 -1
  156. package/dist/deploy/build.js.map +1 -1
  157. package/dist/deploy/route-discovery.d.ts +29 -0
  158. package/dist/deploy/route-discovery.d.ts.map +1 -1
  159. package/dist/deploy/route-discovery.js +158 -11
  160. package/dist/deploy/route-discovery.js.map +1 -1
  161. package/dist/server/auth.d.ts +2 -0
  162. package/dist/server/auth.d.ts.map +1 -1
  163. package/dist/server/auth.js +9 -0
  164. package/dist/server/auth.js.map +1 -1
  165. package/dist/sharing/access.d.ts +4 -2
  166. package/dist/sharing/access.d.ts.map +1 -1
  167. package/dist/sharing/access.js +8 -3
  168. package/dist/sharing/access.js.map +1 -1
  169. package/dist/sharing/actions/set-resource-visibility.d.ts.map +1 -1
  170. package/dist/sharing/actions/set-resource-visibility.js +2 -3
  171. package/dist/sharing/actions/set-resource-visibility.js.map +1 -1
  172. package/dist/sharing/registry.d.ts +13 -0
  173. package/dist/sharing/registry.d.ts.map +1 -1
  174. package/dist/sharing/registry.js.map +1 -1
  175. package/dist/styles/rich-markdown-editor.css +15 -0
  176. package/dist/templates/default/.agents/skills/actions/SKILL.md +96 -11
  177. package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +126 -26
  178. package/dist/templates/default/.agents/skills/capture-learnings/SKILL.md +56 -30
  179. package/dist/templates/default/.agents/skills/create-skill/SKILL.md +28 -0
  180. package/dist/templates/default/.agents/skills/delegate-to-agent/SKILL.md +75 -5
  181. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +17 -0
  182. package/dist/templates/default/.agents/skills/real-time-collab/SKILL.md +99 -124
  183. package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +43 -10
  184. package/dist/templates/default/.agents/skills/security/SKILL.md +162 -144
  185. package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +5 -3
  186. package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +15 -0
  187. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +116 -83
  188. package/dist/templates/default/DEVELOPING.md +10 -13
  189. package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +9 -0
  190. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +27 -0
  191. package/docs/content/template-plan.md +5 -3
  192. package/docs/content/visual-plans.md +5 -2
  193. package/package.json +16 -1
  194. package/src/templates/default/.agents/skills/actions/SKILL.md +96 -11
  195. package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +126 -26
  196. package/src/templates/default/.agents/skills/capture-learnings/SKILL.md +56 -30
  197. package/src/templates/default/.agents/skills/create-skill/SKILL.md +28 -0
  198. package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +75 -5
  199. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +17 -0
  200. package/src/templates/default/.agents/skills/real-time-collab/SKILL.md +99 -124
  201. package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +43 -10
  202. package/src/templates/default/.agents/skills/security/SKILL.md +162 -144
  203. package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +5 -3
  204. package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +15 -0
  205. package/src/templates/default/.agents/skills/storing-data/SKILL.md +116 -83
  206. package/src/templates/default/DEVELOPING.md +10 -13
  207. package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +9 -0
  208. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +27 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAoB;AACpB,OAAO,EACL,WAAW,GAUZ,MAAM,YAAY,CAAC;AAEpB,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,YAAY;AACZ,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,sBAAsB;AACtB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,+EAA+E;AAC/E,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB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AC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks` — the first-party block registry.\n *\n * A block registry unifies structured document blocks under one `defineBlock`\n * contract: a zod `schema` for the data, an `mdx` config for byte-stable MDX\n * round-trip, a `Read` renderer, an optional `Edit` (auto-generated from the\n * schema when omitted), and `placement` (top-level and/or inline). Apps create a\n * `BlockRegistry`, register the core standard library plus their own specs, and\n * render through `BlockView` inside a `BlockRegistryProvider`. The renderer\n * checks the registry first and falls back to legacy code for unregistered\n * types, so existing documents keep working unchanged.\n *\n * This entry includes the React surface. For server/agent code that must stay\n * React-free, import from `@agent-native/core/blocks/server`.\n */\n\n// Types + authoring\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type BlockRenderContext,\n type BlockReadProps,\n type BlockEditProps,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\n// Registry + provisioning\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\nexport {\n BlockRegistryProvider,\n useBlockRegistry,\n useOptionalBlockRegistry,\n} from \"./provider.js\";\n\n// Rendering\nexport { BlockView, blockEditSurface } from \"./BlockView.js\";\nexport { SchemaBlockEditor } from \"./SchemaBlockEditor.js\";\n\n// Schema-form helpers\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\n// MDX round-trip (registry-driven serialize/parse + shared encoder primitives)\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\n// Agent schema export\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration. Apps call `registerLibraryBlocks(registry)` to\n// register the whole standard library (the five pre-built specs + the eight\n// dev-doc specs) in one place, then register only their app-specific blocks on\n// top. `libraryBlockSpecs` is the underlying ordered array.\nexport {\n libraryBlockSpecs,\n registerLibraryBlocks,\n type LibraryBlockOverrides,\n} from \"./library/specs.js\";\n\n// Standard block library (React specs). Apps register these in their browser\n// registry alongside their own app-specific blocks.\nexport {\n checklistBlock,\n ChecklistBlock,\n ChecklistEditor,\n} from \"./library/checklist.js\";\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport { tableBlock } from \"./library/table.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport { codeTabsBlock } from \"./library/code-tabs.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport { htmlBlock, HtmlReadBlock, HtmlEditBlock } from \"./library/html.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport { tabsBlock, TabsBlockReader, TabsBlockEditor } from \"./library/tabs.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsTab,\n} from \"./library/tabs.config.js\";\n\n// Dev-doc block library (React `Read`/`Edit` renderers + their React-free\n// schema/MDX config). Apps register these alongside their own blocks, supplying\n// app-specific spec metadata (label/description/editSurface/empty) via\n// `defineBlock`. Mirrors the standard library above.\nexport { MermaidRead, MermaidEdit } from \"./library/MermaidBlock.js\";\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n ApiEndpointRead,\n ApiEndpointEdit,\n} from \"./library/ApiEndpointBlock.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport { DataModelRead, DataModelEdit } from \"./library/DataModelBlock.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport { DiffRead, DiffEdit } from \"./library/DiffBlock.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport { FileTreeRead, FileTreeEdit } from \"./library/FileTreeBlock.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n JsonExplorerRead,\n JsonExplorerEdit,\n} from \"./library/JsonExplorerBlock.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n AnnotatedCodeRead,\n AnnotatedCodeEdit,\n} from \"./library/AnnotatedCodeBlock.js\";\nexport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n type AnnotatedCodeAnnotation,\n} from \"./library/annotated-code.config.js\";\nexport {\n OpenApiSpecRead,\n OpenApiSpecEdit,\n} from \"./library/OpenApiSpecBlock.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAoB;AACpB,OAAO,EACL,WAAW,GAcZ,MAAM,YAAY,CAAC;AAEpB,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,YAAY;AACZ,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,sBAAsB;AACtB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,+EAA+E;AAC/E,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,sBAAsB;AACtB,OAAO,EACL,sBA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,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks` — the first-party block registry.\n *\n * A block registry unifies structured document blocks under one `defineBlock`\n * contract: a zod `schema` for the data, an `mdx` config for byte-stable MDX\n * round-trip, a `Read` renderer, an optional `Edit` (auto-generated from the\n * schema when omitted), and `placement` (top-level and/or inline). Apps create a\n * `BlockRegistry`, register the core standard library plus their own specs, and\n * render through `BlockView` inside a `BlockRegistryProvider`. The renderer\n * checks the registry first and falls back to legacy code for unregistered\n * types, so existing documents keep working unchanged.\n *\n * This entry includes the React surface. For server/agent code that must stay\n * React-free, import from `@agent-native/core/blocks/server`.\n */\n\n// Types + authoring\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type BlockRenderContext,\n type BlockReadProps,\n type BlockEditProps,\n type MdxAttrValue,\n type NestedBlock,\n type BlockAiFieldActionProps,\n type BlockContainerRegion,\n type BlockContainerSpec,\n type BlockDataChangeMeta,\n} from \"./types.js\";\n\n// Registry + provisioning\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\nexport {\n BlockRegistryProvider,\n useBlockRegistry,\n useOptionalBlockRegistry,\n} from \"./provider.js\";\n\n// Rendering\nexport { BlockView, blockEditSurface } from \"./BlockView.js\";\nexport { AiEditableFieldLabel } from \"./AiEditableField.js\";\nexport { SchemaBlockEditor } from \"./SchemaBlockEditor.js\";\n\n// Schema-form helpers\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\n// MDX round-trip (registry-driven serialize/parse + shared encoder primitives)\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\n// Agent schema export\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration. Apps call `registerLibraryBlocks(registry)` to\n// register the whole standard library (the pre-built specs + dev-doc specs) in\n// one place, then register only their app-specific blocks on top.\n// `libraryBlockSpecs` is the underlying ordered array.\nexport {\n libraryBlockSpecs,\n registerLibraryBlocks,\n type LibraryBlockOverrides,\n} from \"./library/specs.js\";\n\n// Standard block library (React specs). Apps register these in their browser\n// registry alongside their own app-specific blocks.\nexport {\n checklistBlock,\n ChecklistBlock,\n ChecklistEditor,\n} from \"./library/checklist.js\";\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport { tableBlock } from \"./library/table.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport { codeTabsBlock } from \"./library/code-tabs.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport { htmlBlock, HtmlReadBlock, HtmlEditBlock } from \"./library/html.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport { tabsBlock, TabsBlockReader, TabsBlockEditor } from \"./library/tabs.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsOrientation,\n type TabsTab,\n} from \"./library/tabs.config.js\";\nexport {\n columnsBlock,\n ColumnsBlockReader,\n ColumnsBlockEditor,\n} from \"./library/columns.js\";\nexport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./library/columns.config.js\";\n\n// Dev-doc block library (React `Read`/`Edit` renderers + their React-free\n// schema/MDX config). Apps register these alongside their own blocks, supplying\n// app-specific spec metadata (label/description/editSurface/empty) via\n// `defineBlock`. Mirrors the standard library above.\nexport { MermaidRead, MermaidEdit } from \"./library/MermaidBlock.js\";\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n ApiEndpointRead,\n ApiEndpointEdit,\n} from \"./library/ApiEndpointBlock.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport { DataModelRead, DataModelEdit } from \"./library/DataModelBlock.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport { DiffRead, DiffEdit } from \"./library/DiffBlock.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport { FileTreeRead, FileTreeEdit } from \"./library/FileTreeBlock.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n JsonExplorerRead,\n JsonExplorerEdit,\n} from \"./library/JsonExplorerBlock.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n AnnotatedCodeRead,\n AnnotatedCodeEdit,\n} from \"./library/AnnotatedCodeBlock.js\";\nexport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n type AnnotatedCodeAnnotation,\n} from \"./library/annotated-code.config.js\";\nexport {\n OpenApiSpecRead,\n OpenApiSpecEdit,\n} from \"./library/OpenApiSpecBlock.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiEndpointBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/ApiEndpointBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,0BAA0B,CAAC;AA+ElC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,OAAO,EACP,GAAG,GACJ,EAAE,cAAc,CAAC,eAAe,CAAC,2CAuNjC;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,CAAC,eAAe,CAAC,2CAsTjC"}
1
+ {"version":3,"file":"ApiEndpointBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/ApiEndpointBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,0BAA0B,CAAC;AAgHlC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,OAAO,EACP,GAAG,GACJ,EAAE,cAAc,CAAC,eAAe,CAAC,2CAqNjC;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE,cAAc,CAAC,eAAe,CAAC,2CAsTjC"}
@@ -3,7 +3,9 @@ import { useState } from "react";
3
3
  import { IconChevronRight, IconLock, IconPlus, IconTrash, } from "@tabler/icons-react";
4
4
  import { cn } from "../../utils.js";
5
5
  import { API_ENDPOINT_METHODS, API_PARAM_LOCATIONS, } from "./api-endpoint.config.js";
6
+ import { JsonExplorerSurface } from "./JsonExplorerBlock.js";
6
7
  import { DevBadge, DevInput, DevSwitch, DevTextarea, DevSelect, } from "./dev-doc-ui.js";
8
+ import { CodeSurface } from "./HighlightedCode.js";
7
9
  /**
8
10
  * Read + Edit renderers for an `api-endpoint` block — a Swagger / Stripe-style
9
11
  * API reference. Lives in core so any app can register the dev-doc block (no
@@ -55,11 +57,23 @@ function fenceLangForContentType(contentType) {
55
57
  return "yaml";
56
58
  return "json";
57
59
  }
58
- /** Wrap a raw example string in a fenced code block for `ctx.renderMarkdown`. */
59
- function fence(example, lang) {
60
- // Never let the example's own content break out of the fence.
61
- const safe = example.replace(/```/g, "ʼʼʼ");
62
- return `\`\`\`${lang}\n${safe.trim()}\n\`\`\``;
60
+ function shouldUseJsonExplorer(example, contentType) {
61
+ const ct = (contentType ?? "").toLowerCase();
62
+ if (contentType && !ct.includes("json"))
63
+ return false;
64
+ try {
65
+ JSON.parse(example);
66
+ return true;
67
+ }
68
+ catch {
69
+ return false;
70
+ }
71
+ }
72
+ function ApiExample({ example, contentType, className, }) {
73
+ if (shouldUseJsonExplorer(example, contentType)) {
74
+ return (_jsx(JsonExplorerSurface, { data: { json: example, collapsedDepth: 2 }, className: className }));
75
+ }
76
+ return (_jsx(CodeSurface, { code: example, language: fenceLangForContentType(contentType), className: className }));
63
77
  }
64
78
  /* ── Read (collapsed-by-default swagger row) ───────────────────────────────── */
65
79
  /**
@@ -80,7 +94,7 @@ export function ApiEndpointRead({ data, blockId, title, summary, ctx, }) {
80
94
  hasRequest ||
81
95
  responses.length > 0 ||
82
96
  Boolean(data.auth);
83
- return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsxs("div", { className: "overflow-hidden rounded-xl border border-plan-line bg-plan-block", children: [_jsxs("button", { type: "button", "data-plan-interactive": true, "aria-expanded": open, onClick: () => setOpen((value) => !value), className: cn("flex w-full items-center gap-3 px-4 py-3 text-left transition-colors", "hover:bg-accent/40"), children: [_jsx(IconChevronRight, { className: cn("size-4 shrink-0 text-plan-muted transition-transform", open && "rotate-90") }), _jsx("span", { className: cn("shrink-0 rounded-md px-2 py-1 font-mono text-xs font-bold uppercase tracking-wide", METHOD_PILL[data.method]), children: data.method }), _jsx("span", { className: cn("min-w-0 truncate font-mono text-sm font-semibold text-plan-text", data.deprecated && "text-plan-muted line-through"), children: data.path }), data.deprecated && (_jsx(DevBadge, { className: "shrink-0 border-amber-500/40 text-amber-600 dark:text-amber-300", children: "Deprecated" })), (data.summary || summary) && (_jsx("span", { className: "ml-1 min-w-0 flex-1 truncate text-sm text-plan-muted", children: data.summary || summary })), data.auth && (_jsx(IconLock, { className: "size-3.5 shrink-0 text-plan-muted", "aria-label": "Requires authentication" }))] }), open && hasBody && (_jsxs("div", { className: "border-t border-plan-line px-4 py-4", children: [data.auth && (_jsxs("div", { className: "mb-4 flex items-center gap-2 text-xs text-plan-muted", children: [_jsx(IconLock, { className: "size-3.5 shrink-0" }), _jsxs("span", { children: [_jsx("span", { className: "font-medium text-plan-text", children: "Auth:" }), " ", data.auth] })] })), data.description?.trim() && (_jsx("div", { className: "an-api-endpoint-desc", children: ctx.renderMarkdown?.(data.description) })), params.length > 0 && (_jsxs("div", { className: "mt-5", children: [_jsx("div", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Parameters" }), _jsx("div", { className: "mt-2 overflow-hidden rounded-lg border border-plan-line", children: _jsxs("table", { className: "w-full border-collapse text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-accent/30 text-left text-xs uppercase tracking-wide text-plan-muted", children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Name" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "In" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Type" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Required" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Description" })] }) }), _jsx("tbody", { children: params.map((param, index) => (_jsxs("tr", { className: "border-t border-plan-line align-top", children: [_jsx("td", { className: "px-3 py-2 font-mono text-xs font-semibold text-plan-text", children: param.name }), _jsx("td", { className: "px-3 py-2", children: _jsx("span", { className: cn("rounded px-1.5 py-0.5 font-mono text-[11px] font-semibold", PARAM_IN_BADGE[param.in]), children: param.in }) }), _jsx("td", { className: "px-3 py-2 font-mono text-xs text-plan-muted", children: param.type || "—" }), _jsx("td", { className: "px-3 py-2 text-xs", children: param.required ? (_jsx("span", { className: "font-medium text-red-600 dark:text-red-300", children: "required" })) : (_jsx("span", { className: "text-plan-muted", children: "optional" })) }), _jsx("td", { className: "px-3 py-2 text-xs text-plan-muted", children: param.description || "—" })] }, `${param.name}-${index}`))) })] }) })] })), hasRequest && (_jsxs("div", { className: "mt-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Request body" }), data.request?.contentType && (_jsx("span", { className: "rounded bg-accent/40 px-1.5 py-0.5 font-mono text-[11px] text-plan-muted", children: data.request.contentType }))] }), data.request?.example && (_jsx("div", { className: "mt-2 an-api-endpoint-example", children: ctx.renderMarkdown?.(fence(data.request.example, fenceLangForContentType(data.request.contentType))) }))] })), responses.length > 0 && (_jsxs("div", { className: "mt-5", children: [_jsx("div", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Responses" }), _jsx("div", { className: "mt-2 flex flex-col gap-3", children: responses.map((response, index) => (_jsxs("div", { className: "rounded-lg border border-plan-line", children: [_jsxs("div", { className: "flex items-center gap-2 px-3 py-2", children: [_jsx("span", { className: cn("rounded px-2 py-0.5 font-mono text-xs font-bold", statusPillClass(response.status)), children: response.status }), response.description && (_jsx("span", { className: "text-sm text-plan-muted", children: response.description }))] }), response.example && (_jsx("div", { className: "border-t border-plan-line px-3 pb-3 pt-1 an-api-endpoint-example", children: ctx.renderMarkdown?.(fence(response.example, "json")) }))] }, `${response.status}-${index}`))) })] }))] }))] })] }));
97
+ return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsxs("div", { className: "overflow-hidden rounded-xl border border-plan-line bg-plan-block", children: [_jsxs("button", { type: "button", "data-plan-interactive": true, "aria-expanded": open, onClick: () => setOpen((value) => !value), className: cn("flex w-full items-center gap-3 px-4 py-3 text-left transition-colors", "hover:bg-accent/40"), children: [_jsx(IconChevronRight, { className: cn("size-4 shrink-0 text-plan-muted transition-transform", open && "rotate-90") }), _jsx("span", { className: cn("shrink-0 rounded-md px-2 py-1 font-mono text-xs font-bold uppercase tracking-wide", METHOD_PILL[data.method]), children: data.method }), _jsx("span", { className: cn("min-w-0 truncate font-mono text-sm font-semibold text-plan-text", data.deprecated && "text-plan-muted line-through"), children: data.path }), data.deprecated && (_jsx(DevBadge, { className: "shrink-0 border-amber-500/40 text-amber-600 dark:text-amber-300", children: "Deprecated" })), (data.summary || summary) && (_jsx("span", { className: "ml-1 min-w-0 flex-1 truncate text-sm text-plan-muted", children: data.summary || summary })), data.auth && (_jsx(IconLock, { className: "size-3.5 shrink-0 text-plan-muted", "aria-label": "Requires authentication" }))] }), open && hasBody && (_jsxs("div", { className: "border-t border-plan-line px-4 py-4", children: [data.auth && (_jsxs("div", { className: "mb-4 flex items-center gap-2 text-xs text-plan-muted", children: [_jsx(IconLock, { className: "size-3.5 shrink-0" }), _jsxs("span", { children: [_jsx("span", { className: "font-medium text-plan-text", children: "Auth:" }), " ", data.auth] })] })), data.description?.trim() && (_jsx("div", { className: "an-api-endpoint-desc", children: ctx.renderMarkdown?.(data.description) })), params.length > 0 && (_jsxs("div", { className: "mt-5", children: [_jsx("div", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Parameters" }), _jsx("div", { className: "mt-2 overflow-hidden rounded-lg border border-plan-line", children: _jsxs("table", { className: "w-full border-collapse text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-accent/30 text-left text-xs uppercase tracking-wide text-plan-muted", children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Name" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "In" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Type" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Required" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Description" })] }) }), _jsx("tbody", { children: params.map((param, index) => (_jsxs("tr", { className: "border-t border-plan-line align-top", children: [_jsx("td", { className: "px-3 py-2 font-mono text-xs font-semibold text-plan-text", children: param.name }), _jsx("td", { className: "px-3 py-2", children: _jsx("span", { className: cn("rounded px-1.5 py-0.5 font-mono text-[11px] font-semibold", PARAM_IN_BADGE[param.in]), children: param.in }) }), _jsx("td", { className: "px-3 py-2 font-mono text-xs text-plan-muted", children: param.type || "—" }), _jsx("td", { className: "px-3 py-2 text-xs", children: param.required ? (_jsx("span", { className: "font-medium text-red-600 dark:text-red-300", children: "required" })) : (_jsx("span", { className: "text-plan-muted", children: "optional" })) }), _jsx("td", { className: "px-3 py-2 text-xs text-plan-muted", children: param.description || "—" })] }, `${param.name}-${index}`))) })] }) })] })), hasRequest && (_jsxs("div", { className: "mt-5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Request body" }), data.request?.contentType && (_jsx("span", { className: "rounded bg-accent/40 px-1.5 py-0.5 font-mono text-[11px] text-plan-muted", children: data.request.contentType }))] }), data.request?.example && (_jsx(ApiExample, { example: data.request.example, contentType: data.request.contentType, className: "mt-2 an-api-endpoint-example" }))] })), responses.length > 0 && (_jsxs("div", { className: "mt-5", children: [_jsx("div", { className: "text-xs font-semibold uppercase tracking-wide text-plan-muted", children: "Responses" }), _jsx("div", { className: "mt-2 flex flex-col gap-3", children: responses.map((response, index) => (_jsxs("div", { className: "rounded-lg border border-plan-line", children: [_jsxs("div", { className: "flex items-center gap-2 px-3 py-2", children: [_jsx("span", { className: cn("rounded px-2 py-0.5 font-mono text-xs font-bold", statusPillClass(response.status)), children: response.status }), response.description && (_jsx("span", { className: "text-sm text-plan-muted", children: response.description }))] }), response.example && (_jsx("div", { className: "border-t border-plan-line px-3 pb-3 pt-3 an-api-endpoint-example", children: _jsx(ApiExample, { example: response.example, className: "mt-0" }) }))] }, `${response.status}-${index}`))) })] }))] }))] })] }));
84
98
  }
85
99
  /* ── Edit (panel form) ─────────────────────────────────────────────────────── */
86
100
  const fieldLabelClass = "text-xs font-medium text-muted-foreground";
@@ -1 +1 @@
1
- {"version":3,"file":"ApiEndpointBlock.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/ApiEndpointBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR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C,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,CACV,IACG,EACN,KAAC,WAAW,IACV,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE,EAC7B,QAAQ,EAAE,CAAC,QAAQ,EACnB,WAAW,EAAC,gCAAgC,EAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,cAAc,CAAC,KAAK,EAAE;oCACpB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS;iCACzC,CAAC,GAEJ,KA9CG,KAAK,CA+CN,CACP,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from \"react\";\nimport {\n IconChevronRight,\n IconLock,\n IconPlus,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\nimport type { BlockEditProps, BlockReadProps } from \"../types.js\";\nimport type {\n ApiEndpointData,\n ApiEndpointMethod,\n ApiEndpointParam,\n ApiEndpointResponse,\n ApiParamLocation,\n} from \"./api-endpoint.config.js\";\nimport {\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n} from \"./api-endpoint.config.js\";\nimport {\n DevBadge,\n DevInput,\n DevSwitch,\n DevTextarea,\n DevSelect,\n} from \"./dev-doc-ui.js\";\n\n/**\n * Read + Edit renderers for an `api-endpoint` block — a Swagger / Stripe-style\n * API reference. Lives in core so any app can register the dev-doc block (no\n * shadcn import).\n */\n\n/* ── Theme-aware color tokens ──────────────────────────────────────────────── */\n\n/**\n * Method-pill palette. Tinted background + saturated text in BOTH modes (the\n * reference HTML hardcoded a dark-only palette — we deliberately avoid that).\n * Each entry keeps legible contrast against the plan surface under `.dark` and\n * light via Tailwind `dark:` variants.\n */\nconst METHOD_PILL: Record<ApiEndpointMethod, string> = {\n GET: \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\",\n POST: \"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300\",\n PUT: \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\",\n PATCH:\n \"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300\",\n DELETE: \"bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-300\",\n HEAD: \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\",\n OPTIONS:\n \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\",\n};\n\n/** Location-badge palette for the params table `in` column. */\nconst PARAM_IN_BADGE: Record<ApiParamLocation, string> = {\n path: \"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300\",\n query: \"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300\",\n header:\n \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\",\n body: \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\",\n};\n\n/** Status-pill palette keyed by the leading status digit (2xx/3xx/4xx/5xx). */\nfunction statusPillClass(status: string): string {\n const lead = status.trim().charAt(0);\n if (lead === \"2\")\n return \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\";\n if (lead === \"4\")\n return \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\";\n if (lead === \"5\")\n return \"bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-300\";\n // 3xx and everything else → neutral slate.\n return \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\";\n}\n\n/** Guess a fence language from a content type so examples highlight nicely. */\nfunction fenceLangForContentType(contentType?: string): string {\n const ct = (contentType ?? \"\").toLowerCase();\n if (ct.includes(\"json\")) return \"json\";\n if (ct.includes(\"xml\") || ct.includes(\"html\")) return \"html\";\n if (ct.includes(\"yaml\") || ct.includes(\"yml\")) return \"yaml\";\n return \"json\";\n}\n\n/** Wrap a raw example string in a fenced code block for `ctx.renderMarkdown`. */\nfunction fence(example: string, lang: string): string {\n // Never let the example's own content break out of the fence.\n const safe = example.replace(/```/g, \"ʼʼʼ\");\n return `\\`\\`\\`${lang}\\n${safe.trim()}\\n\\`\\`\\``;\n}\n\n/* ── Read (collapsed-by-default swagger row) ───────────────────────────────── */\n\n/**\n * Read-only renderer for an `api-endpoint` block. Collapsed by default: a single\n * row with a colored method pill, monospace path, muted summary, and a chevron.\n * Clicking the row expands the full reference (description, params table,\n * request body, responses) — the Swagger / Stripe house style. Every colored\n * element is theme-aware (`dark:` variants), so it reads correctly in both the\n * `.dark` plan theme and light mode.\n */\nexport function ApiEndpointRead({\n data,\n blockId,\n title,\n summary,\n ctx,\n}: BlockReadProps<ApiEndpointData>) {\n const [open, setOpen] = useState(false);\n\n const params = data.params ?? [];\n const responses = data.responses ?? [];\n const hasRequest = Boolean(\n data.request?.example || data.request?.contentType,\n );\n const hasBody =\n Boolean(data.description?.trim()) ||\n params.length > 0 ||\n hasRequest ||\n responses.length > 0 ||\n Boolean(data.auth);\n\n return (\n <section className=\"plan-block\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <div className=\"overflow-hidden rounded-xl border border-plan-line bg-plan-block\">\n {/* Collapsed summary row — the whole row toggles. */}\n <button\n type=\"button\"\n data-plan-interactive\n aria-expanded={open}\n onClick={() => setOpen((value) => !value)}\n className={cn(\n \"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors\",\n \"hover:bg-accent/40\",\n )}\n >\n <IconChevronRight\n className={cn(\n \"size-4 shrink-0 text-plan-muted transition-transform\",\n open && \"rotate-90\",\n )}\n />\n <span\n className={cn(\n \"shrink-0 rounded-md px-2 py-1 font-mono text-xs font-bold uppercase tracking-wide\",\n METHOD_PILL[data.method],\n )}\n >\n {data.method}\n </span>\n <span\n className={cn(\n \"min-w-0 truncate font-mono text-sm font-semibold text-plan-text\",\n data.deprecated && \"text-plan-muted line-through\",\n )}\n >\n {data.path}\n </span>\n {data.deprecated && (\n <DevBadge className=\"shrink-0 border-amber-500/40 text-amber-600 dark:text-amber-300\">\n Deprecated\n </DevBadge>\n )}\n {(data.summary || summary) && (\n <span className=\"ml-1 min-w-0 flex-1 truncate text-sm text-plan-muted\">\n {data.summary || summary}\n </span>\n )}\n {data.auth && (\n <IconLock\n className=\"size-3.5 shrink-0 text-plan-muted\"\n aria-label=\"Requires authentication\"\n />\n )}\n </button>\n\n {/* Expanded body. */}\n {open && hasBody && (\n <div className=\"border-t border-plan-line px-4 py-4\">\n {data.auth && (\n <div className=\"mb-4 flex items-center gap-2 text-xs text-plan-muted\">\n <IconLock className=\"size-3.5 shrink-0\" />\n <span>\n <span className=\"font-medium text-plan-text\">Auth:</span>{\" \"}\n {data.auth}\n </span>\n </div>\n )}\n\n {data.description?.trim() && (\n <div className=\"an-api-endpoint-desc\">\n {ctx.renderMarkdown?.(data.description)}\n </div>\n )}\n\n {params.length > 0 && (\n <div className=\"mt-5\">\n <div className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Parameters\n </div>\n <div className=\"mt-2 overflow-hidden rounded-lg border border-plan-line\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"bg-accent/30 text-left text-xs uppercase tracking-wide text-plan-muted\">\n <th className=\"px-3 py-2 font-medium\">Name</th>\n <th className=\"px-3 py-2 font-medium\">In</th>\n <th className=\"px-3 py-2 font-medium\">Type</th>\n <th className=\"px-3 py-2 font-medium\">Required</th>\n <th className=\"px-3 py-2 font-medium\">Description</th>\n </tr>\n </thead>\n <tbody>\n {params.map((param, index) => (\n <tr\n key={`${param.name}-${index}`}\n className=\"border-t border-plan-line align-top\"\n >\n <td className=\"px-3 py-2 font-mono text-xs font-semibold text-plan-text\">\n {param.name}\n </td>\n <td className=\"px-3 py-2\">\n <span\n className={cn(\n \"rounded px-1.5 py-0.5 font-mono text-[11px] font-semibold\",\n PARAM_IN_BADGE[param.in],\n )}\n >\n {param.in}\n </span>\n </td>\n <td className=\"px-3 py-2 font-mono text-xs text-plan-muted\">\n {param.type || \"—\"}\n </td>\n <td className=\"px-3 py-2 text-xs\">\n {param.required ? (\n <span className=\"font-medium text-red-600 dark:text-red-300\">\n required\n </span>\n ) : (\n <span className=\"text-plan-muted\">optional</span>\n )}\n </td>\n <td className=\"px-3 py-2 text-xs text-plan-muted\">\n {param.description || \"—\"}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )}\n\n {hasRequest && (\n <div className=\"mt-5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Request body\n </span>\n {data.request?.contentType && (\n <span className=\"rounded bg-accent/40 px-1.5 py-0.5 font-mono text-[11px] text-plan-muted\">\n {data.request.contentType}\n </span>\n )}\n </div>\n {data.request?.example && (\n <div className=\"mt-2 an-api-endpoint-example\">\n {ctx.renderMarkdown?.(\n fence(\n data.request.example,\n fenceLangForContentType(data.request.contentType),\n ),\n )}\n </div>\n )}\n </div>\n )}\n\n {responses.length > 0 && (\n <div className=\"mt-5\">\n <div className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Responses\n </div>\n <div className=\"mt-2 flex flex-col gap-3\">\n {responses.map((response, index) => (\n <div\n key={`${response.status}-${index}`}\n className=\"rounded-lg border border-plan-line\"\n >\n <div className=\"flex items-center gap-2 px-3 py-2\">\n <span\n className={cn(\n \"rounded px-2 py-0.5 font-mono text-xs font-bold\",\n statusPillClass(response.status),\n )}\n >\n {response.status}\n </span>\n {response.description && (\n <span className=\"text-sm text-plan-muted\">\n {response.description}\n </span>\n )}\n </div>\n {response.example && (\n <div className=\"border-t border-plan-line px-3 pb-3 pt-1 an-api-endpoint-example\">\n {ctx.renderMarkdown?.(\n fence(response.example, \"json\"),\n )}\n </div>\n )}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n </section>\n );\n}\n\n/* ── Edit (panel form) ─────────────────────────────────────────────────────── */\n\nconst fieldLabelClass = \"text-xs font-medium text-muted-foreground\";\n\n/**\n * Panel editor for an `api-endpoint` block. A property form: method (Select),\n * path/summary/auth (Input), description (Textarea), deprecated (Switch), plus\n * repeatable rows for params and responses (add/remove) and a request-body\n * textarea. Renders BARE content (no `<section>`); the registry's panel surface\n * supplies the popover chrome.\n */\nexport function ApiEndpointEdit({\n data,\n onChange,\n editable,\n}: BlockEditProps<ApiEndpointData>) {\n const params = data.params ?? [];\n const responses = data.responses ?? [];\n\n const patch = (next: Partial<ApiEndpointData>) =>\n onChange({ ...data, ...next });\n\n const updateParam = (index: number, next: Partial<ApiEndpointParam>) =>\n patch({\n params: params.map((param, i) =>\n i === index ? { ...param, ...next } : param,\n ),\n });\n\n const removeParam = (index: number) =>\n patch({ params: params.filter((_, i) => i !== index) });\n\n const addParam = () =>\n patch({\n params: [...params, { name: \"param\", in: \"query\" as ApiParamLocation }],\n });\n\n const updateResponse = (index: number, next: Partial<ApiEndpointResponse>) =>\n patch({\n responses: responses.map((response, i) =>\n i === index ? { ...response, ...next } : response,\n ),\n });\n\n const removeResponse = (index: number) =>\n patch({ responses: responses.filter((_, i) => i !== index) });\n\n const addResponse = () =>\n patch({ responses: [...responses, { status: \"200\" }] });\n\n const updateRequest = (next: Partial<ApiEndpointData[\"request\"]>) => {\n const merged = { ...(data.request ?? {}), ...next };\n const empty = !merged.contentType && !merged.example;\n patch({ request: empty ? undefined : merged });\n };\n\n return (\n <div className=\"flex flex-col gap-4\" data-plan-interactive>\n <div className=\"grid grid-cols-[120px_minmax(0,1fr)] gap-2\">\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Method</span>\n <DevSelect\n className=\"h-9\"\n value={data.method}\n disabled={!editable}\n onValueChange={(value) =>\n patch({ method: value as ApiEndpointMethod })\n }\n options={API_ENDPOINT_METHODS.map((method) => ({\n value: method,\n label: method,\n }))}\n />\n </label>\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Path</span>\n <DevInput\n className=\"h-9 font-mono\"\n value={data.path}\n disabled={!editable}\n placeholder=\"/api/resource\"\n onChange={(event) => patch({ path: event.target.value })}\n />\n </label>\n </div>\n\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Summary</span>\n <DevInput\n className=\"h-9\"\n value={data.summary ?? \"\"}\n disabled={!editable}\n placeholder=\"Short one-line description\"\n onChange={(event) =>\n patch({ summary: event.target.value || undefined })\n }\n />\n </label>\n\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Description (markdown)</span>\n <DevTextarea\n className=\"min-h-[80px]\"\n value={data.description ?? \"\"}\n disabled={!editable}\n placeholder=\"Longer description, rendered as markdown\"\n onChange={(event) =>\n patch({ description: event.target.value || undefined })\n }\n />\n </label>\n\n <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-end gap-3\">\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Auth</span>\n <DevInput\n className=\"h-9\"\n value={data.auth ?? \"\"}\n disabled={!editable}\n placeholder=\"e.g. Bearer token\"\n onChange={(event) =>\n patch({ auth: event.target.value || undefined })\n }\n />\n </label>\n <label className=\"flex items-center gap-2 pb-2\">\n <DevSwitch\n checked={Boolean(data.deprecated)}\n disabled={!editable}\n onCheckedChange={(checked) =>\n patch({ deprecated: checked || undefined })\n }\n />\n <span className={fieldLabelClass}>Deprecated</span>\n </label>\n </div>\n\n {/* Params */}\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className={fieldLabelClass}>Parameters</span>\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n className=\"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={addParam}\n >\n <IconPlus className=\"size-3.5\" />\n Add\n </button>\n )}\n </div>\n {params.map((param, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-input p-2\"\n >\n <div className=\"grid grid-cols-[minmax(0,1fr)_96px_auto] gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={param.name}\n disabled={!editable}\n placeholder=\"name\"\n onChange={(event) =>\n updateParam(index, { name: event.target.value })\n }\n />\n <DevSelect\n className=\"h-8\"\n value={param.in}\n disabled={!editable}\n onValueChange={(value) =>\n updateParam(index, { in: value as ApiParamLocation })\n }\n options={API_PARAM_LOCATIONS.map((location) => ({\n value: location,\n label: location,\n }))}\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Remove parameter\"\n className=\"flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={() => removeParam(index)}\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={param.type ?? \"\"}\n disabled={!editable}\n placeholder=\"type (e.g. string)\"\n onChange={(event) =>\n updateParam(index, { type: event.target.value || undefined })\n }\n />\n <label className=\"flex items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground\">\n <input\n type=\"checkbox\"\n className=\"size-3.5 cursor-pointer accent-primary\"\n checked={Boolean(param.required)}\n disabled={!editable}\n onChange={(event) =>\n updateParam(index, {\n required: event.target.checked || undefined,\n })\n }\n />\n Required\n </label>\n </div>\n <DevInput\n className=\"h-8 text-xs\"\n value={param.description ?? \"\"}\n disabled={!editable}\n placeholder=\"description\"\n onChange={(event) =>\n updateParam(index, {\n description: event.target.value || undefined,\n })\n }\n />\n </div>\n ))}\n </div>\n\n {/* Request body */}\n <div className=\"flex flex-col gap-2\">\n <span className={fieldLabelClass}>Request body</span>\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={data.request?.contentType ?? \"\"}\n disabled={!editable}\n placeholder=\"content type (e.g. application/json)\"\n onChange={(event) =>\n updateRequest({ contentType: event.target.value || undefined })\n }\n />\n <DevTextarea\n className=\"min-h-[80px] font-mono text-xs\"\n value={data.request?.example ?? \"\"}\n disabled={!editable}\n placeholder='{ \"example\": \"request body\" }'\n onChange={(event) =>\n updateRequest({ example: event.target.value || undefined })\n }\n />\n </div>\n\n {/* Responses */}\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className={fieldLabelClass}>Responses</span>\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n className=\"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={addResponse}\n >\n <IconPlus className=\"size-3.5\" />\n Add\n </button>\n )}\n </div>\n {responses.map((response, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-input p-2\"\n >\n <div className=\"grid grid-cols-[96px_minmax(0,1fr)_auto] gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={response.status}\n disabled={!editable}\n placeholder=\"200\"\n onChange={(event) =>\n updateResponse(index, { status: event.target.value })\n }\n />\n <DevInput\n className=\"h-8 text-xs\"\n value={response.description ?? \"\"}\n disabled={!editable}\n placeholder=\"description\"\n onChange={(event) =>\n updateResponse(index, {\n description: event.target.value || undefined,\n })\n }\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Remove response\"\n className=\"flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={() => removeResponse(index)}\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <DevTextarea\n className=\"min-h-[64px] font-mono text-xs\"\n value={response.example ?? \"\"}\n disabled={!editable}\n placeholder='{ \"example\": \"response body\" }'\n onChange={(event) =>\n updateResponse(index, {\n example: event.target.value || undefined,\n })\n }\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ApiEndpointBlock.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/ApiEndpointBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC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E,QAAQ,CAAC,MAAM,EACtB,QAAQ,EAAE,CAAC,QAAQ,EACnB,WAAW,EAAC,KAAK,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,cAAc,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAEvD,EACF,KAAC,QAAQ,IACP,SAAS,EAAC,aAAa,EACvB,KAAK,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE,EACjC,QAAQ,EAAE,CAAC,QAAQ,EACnB,WAAW,EAAC,aAAa,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,cAAc,CAAC,KAAK,EAAE;4CACpB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS;yCAC7C,CAAC,GAEJ,EACD,QAAQ,IAAI,CACX,iBACE,IAAI,EAAC,QAAQ,+CAEF,iBAAiB,EAC5B,SAAS,EAAC,mHAAmH,EAC7H,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,YAEpC,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,CACV,IACG,EACN,KAAC,WAAW,IACV,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE,QAAQ,CAAC,OAAO,IAAI,EAAE,EAC7B,QAAQ,EAAE,CAAC,QAAQ,EACnB,WAAW,EAAC,gCAAgC,EAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,cAAc,CAAC,KAAK,EAAE;oCACpB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS;iCACzC,CAAC,GAEJ,KA9CG,KAAK,CA+CN,CACP,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from \"react\";\nimport {\n IconChevronRight,\n IconLock,\n IconPlus,\n IconTrash,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\nimport type { BlockEditProps, BlockReadProps } from \"../types.js\";\nimport type {\n ApiEndpointData,\n ApiEndpointMethod,\n ApiEndpointParam,\n ApiEndpointResponse,\n ApiParamLocation,\n} from \"./api-endpoint.config.js\";\nimport {\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n} from \"./api-endpoint.config.js\";\nimport { JsonExplorerSurface } from \"./JsonExplorerBlock.js\";\nimport {\n DevBadge,\n DevInput,\n DevSwitch,\n DevTextarea,\n DevSelect,\n} from \"./dev-doc-ui.js\";\nimport { CodeSurface } from \"./HighlightedCode.js\";\n\n/**\n * Read + Edit renderers for an `api-endpoint` block — a Swagger / Stripe-style\n * API reference. Lives in core so any app can register the dev-doc block (no\n * shadcn import).\n */\n\n/* ── Theme-aware color tokens ──────────────────────────────────────────────── */\n\n/**\n * Method-pill palette. Tinted background + saturated text in BOTH modes (the\n * reference HTML hardcoded a dark-only palette — we deliberately avoid that).\n * Each entry keeps legible contrast against the plan surface under `.dark` and\n * light via Tailwind `dark:` variants.\n */\nconst METHOD_PILL: Record<ApiEndpointMethod, string> = {\n GET: \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\",\n POST: \"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300\",\n PUT: \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\",\n PATCH:\n \"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300\",\n DELETE: \"bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-300\",\n HEAD: \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\",\n OPTIONS:\n \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\",\n};\n\n/** Location-badge palette for the params table `in` column. */\nconst PARAM_IN_BADGE: Record<ApiParamLocation, string> = {\n path: \"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300\",\n query: \"bg-blue-100 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300\",\n header:\n \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\",\n body: \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\",\n};\n\n/** Status-pill palette keyed by the leading status digit (2xx/3xx/4xx/5xx). */\nfunction statusPillClass(status: string): string {\n const lead = status.trim().charAt(0);\n if (lead === \"2\")\n return \"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300\";\n if (lead === \"4\")\n return \"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300\";\n if (lead === \"5\")\n return \"bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-300\";\n // 3xx and everything else → neutral slate.\n return \"bg-slate-200 text-slate-700 dark:bg-slate-500/20 dark:text-slate-300\";\n}\n\n/** Guess a fence language from a content type so examples highlight nicely. */\nfunction fenceLangForContentType(contentType?: string): string {\n const ct = (contentType ?? \"\").toLowerCase();\n if (ct.includes(\"json\")) return \"json\";\n if (ct.includes(\"xml\") || ct.includes(\"html\")) return \"html\";\n if (ct.includes(\"yaml\") || ct.includes(\"yml\")) return \"yaml\";\n return \"json\";\n}\n\nfunction shouldUseJsonExplorer(example: string, contentType?: string): boolean {\n const ct = (contentType ?? \"\").toLowerCase();\n if (contentType && !ct.includes(\"json\")) return false;\n try {\n JSON.parse(example);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction ApiExample({\n example,\n contentType,\n className,\n}: {\n example: string;\n contentType?: string;\n className?: string;\n}) {\n if (shouldUseJsonExplorer(example, contentType)) {\n return (\n <JsonExplorerSurface\n data={{ json: example, collapsedDepth: 2 }}\n className={className}\n />\n );\n }\n\n return (\n <CodeSurface\n code={example}\n language={fenceLangForContentType(contentType)}\n className={className}\n />\n );\n}\n\n/* ── Read (collapsed-by-default swagger row) ───────────────────────────────── */\n\n/**\n * Read-only renderer for an `api-endpoint` block. Collapsed by default: a single\n * row with a colored method pill, monospace path, muted summary, and a chevron.\n * Clicking the row expands the full reference (description, params table,\n * request body, responses) — the Swagger / Stripe house style. Every colored\n * element is theme-aware (`dark:` variants), so it reads correctly in both the\n * `.dark` plan theme and light mode.\n */\nexport function ApiEndpointRead({\n data,\n blockId,\n title,\n summary,\n ctx,\n}: BlockReadProps<ApiEndpointData>) {\n const [open, setOpen] = useState(false);\n\n const params = data.params ?? [];\n const responses = data.responses ?? [];\n const hasRequest = Boolean(\n data.request?.example || data.request?.contentType,\n );\n const hasBody =\n Boolean(data.description?.trim()) ||\n params.length > 0 ||\n hasRequest ||\n responses.length > 0 ||\n Boolean(data.auth);\n\n return (\n <section className=\"plan-block\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <div className=\"overflow-hidden rounded-xl border border-plan-line bg-plan-block\">\n {/* Collapsed summary row — the whole row toggles. */}\n <button\n type=\"button\"\n data-plan-interactive\n aria-expanded={open}\n onClick={() => setOpen((value) => !value)}\n className={cn(\n \"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors\",\n \"hover:bg-accent/40\",\n )}\n >\n <IconChevronRight\n className={cn(\n \"size-4 shrink-0 text-plan-muted transition-transform\",\n open && \"rotate-90\",\n )}\n />\n <span\n className={cn(\n \"shrink-0 rounded-md px-2 py-1 font-mono text-xs font-bold uppercase tracking-wide\",\n METHOD_PILL[data.method],\n )}\n >\n {data.method}\n </span>\n <span\n className={cn(\n \"min-w-0 truncate font-mono text-sm font-semibold text-plan-text\",\n data.deprecated && \"text-plan-muted line-through\",\n )}\n >\n {data.path}\n </span>\n {data.deprecated && (\n <DevBadge className=\"shrink-0 border-amber-500/40 text-amber-600 dark:text-amber-300\">\n Deprecated\n </DevBadge>\n )}\n {(data.summary || summary) && (\n <span className=\"ml-1 min-w-0 flex-1 truncate text-sm text-plan-muted\">\n {data.summary || summary}\n </span>\n )}\n {data.auth && (\n <IconLock\n className=\"size-3.5 shrink-0 text-plan-muted\"\n aria-label=\"Requires authentication\"\n />\n )}\n </button>\n\n {/* Expanded body. */}\n {open && hasBody && (\n <div className=\"border-t border-plan-line px-4 py-4\">\n {data.auth && (\n <div className=\"mb-4 flex items-center gap-2 text-xs text-plan-muted\">\n <IconLock className=\"size-3.5 shrink-0\" />\n <span>\n <span className=\"font-medium text-plan-text\">Auth:</span>{\" \"}\n {data.auth}\n </span>\n </div>\n )}\n\n {data.description?.trim() && (\n <div className=\"an-api-endpoint-desc\">\n {ctx.renderMarkdown?.(data.description)}\n </div>\n )}\n\n {params.length > 0 && (\n <div className=\"mt-5\">\n <div className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Parameters\n </div>\n <div className=\"mt-2 overflow-hidden rounded-lg border border-plan-line\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"bg-accent/30 text-left text-xs uppercase tracking-wide text-plan-muted\">\n <th className=\"px-3 py-2 font-medium\">Name</th>\n <th className=\"px-3 py-2 font-medium\">In</th>\n <th className=\"px-3 py-2 font-medium\">Type</th>\n <th className=\"px-3 py-2 font-medium\">Required</th>\n <th className=\"px-3 py-2 font-medium\">Description</th>\n </tr>\n </thead>\n <tbody>\n {params.map((param, index) => (\n <tr\n key={`${param.name}-${index}`}\n className=\"border-t border-plan-line align-top\"\n >\n <td className=\"px-3 py-2 font-mono text-xs font-semibold text-plan-text\">\n {param.name}\n </td>\n <td className=\"px-3 py-2\">\n <span\n className={cn(\n \"rounded px-1.5 py-0.5 font-mono text-[11px] font-semibold\",\n PARAM_IN_BADGE[param.in],\n )}\n >\n {param.in}\n </span>\n </td>\n <td className=\"px-3 py-2 font-mono text-xs text-plan-muted\">\n {param.type || \"—\"}\n </td>\n <td className=\"px-3 py-2 text-xs\">\n {param.required ? (\n <span className=\"font-medium text-red-600 dark:text-red-300\">\n required\n </span>\n ) : (\n <span className=\"text-plan-muted\">optional</span>\n )}\n </td>\n <td className=\"px-3 py-2 text-xs text-plan-muted\">\n {param.description || \"—\"}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )}\n\n {hasRequest && (\n <div className=\"mt-5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Request body\n </span>\n {data.request?.contentType && (\n <span className=\"rounded bg-accent/40 px-1.5 py-0.5 font-mono text-[11px] text-plan-muted\">\n {data.request.contentType}\n </span>\n )}\n </div>\n {data.request?.example && (\n <ApiExample\n example={data.request.example}\n contentType={data.request.contentType}\n className=\"mt-2 an-api-endpoint-example\"\n />\n )}\n </div>\n )}\n\n {responses.length > 0 && (\n <div className=\"mt-5\">\n <div className=\"text-xs font-semibold uppercase tracking-wide text-plan-muted\">\n Responses\n </div>\n <div className=\"mt-2 flex flex-col gap-3\">\n {responses.map((response, index) => (\n <div\n key={`${response.status}-${index}`}\n className=\"rounded-lg border border-plan-line\"\n >\n <div className=\"flex items-center gap-2 px-3 py-2\">\n <span\n className={cn(\n \"rounded px-2 py-0.5 font-mono text-xs font-bold\",\n statusPillClass(response.status),\n )}\n >\n {response.status}\n </span>\n {response.description && (\n <span className=\"text-sm text-plan-muted\">\n {response.description}\n </span>\n )}\n </div>\n {response.example && (\n <div className=\"border-t border-plan-line px-3 pb-3 pt-3 an-api-endpoint-example\">\n <ApiExample\n example={response.example}\n className=\"mt-0\"\n />\n </div>\n )}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )}\n </div>\n </section>\n );\n}\n\n/* ── Edit (panel form) ─────────────────────────────────────────────────────── */\n\nconst fieldLabelClass = \"text-xs font-medium text-muted-foreground\";\n\n/**\n * Panel editor for an `api-endpoint` block. A property form: method (Select),\n * path/summary/auth (Input), description (Textarea), deprecated (Switch), plus\n * repeatable rows for params and responses (add/remove) and a request-body\n * textarea. Renders BARE content (no `<section>`); the registry's panel surface\n * supplies the popover chrome.\n */\nexport function ApiEndpointEdit({\n data,\n onChange,\n editable,\n}: BlockEditProps<ApiEndpointData>) {\n const params = data.params ?? [];\n const responses = data.responses ?? [];\n\n const patch = (next: Partial<ApiEndpointData>) =>\n onChange({ ...data, ...next });\n\n const updateParam = (index: number, next: Partial<ApiEndpointParam>) =>\n patch({\n params: params.map((param, i) =>\n i === index ? { ...param, ...next } : param,\n ),\n });\n\n const removeParam = (index: number) =>\n patch({ params: params.filter((_, i) => i !== index) });\n\n const addParam = () =>\n patch({\n params: [...params, { name: \"param\", in: \"query\" as ApiParamLocation }],\n });\n\n const updateResponse = (index: number, next: Partial<ApiEndpointResponse>) =>\n patch({\n responses: responses.map((response, i) =>\n i === index ? { ...response, ...next } : response,\n ),\n });\n\n const removeResponse = (index: number) =>\n patch({ responses: responses.filter((_, i) => i !== index) });\n\n const addResponse = () =>\n patch({ responses: [...responses, { status: \"200\" }] });\n\n const updateRequest = (next: Partial<ApiEndpointData[\"request\"]>) => {\n const merged = { ...(data.request ?? {}), ...next };\n const empty = !merged.contentType && !merged.example;\n patch({ request: empty ? undefined : merged });\n };\n\n return (\n <div className=\"flex flex-col gap-4\" data-plan-interactive>\n <div className=\"grid grid-cols-[120px_minmax(0,1fr)] gap-2\">\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Method</span>\n <DevSelect\n className=\"h-9\"\n value={data.method}\n disabled={!editable}\n onValueChange={(value) =>\n patch({ method: value as ApiEndpointMethod })\n }\n options={API_ENDPOINT_METHODS.map((method) => ({\n value: method,\n label: method,\n }))}\n />\n </label>\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Path</span>\n <DevInput\n className=\"h-9 font-mono\"\n value={data.path}\n disabled={!editable}\n placeholder=\"/api/resource\"\n onChange={(event) => patch({ path: event.target.value })}\n />\n </label>\n </div>\n\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Summary</span>\n <DevInput\n className=\"h-9\"\n value={data.summary ?? \"\"}\n disabled={!editable}\n placeholder=\"Short one-line description\"\n onChange={(event) =>\n patch({ summary: event.target.value || undefined })\n }\n />\n </label>\n\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Description (markdown)</span>\n <DevTextarea\n className=\"min-h-[80px]\"\n value={data.description ?? \"\"}\n disabled={!editable}\n placeholder=\"Longer description, rendered as markdown\"\n onChange={(event) =>\n patch({ description: event.target.value || undefined })\n }\n />\n </label>\n\n <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-end gap-3\">\n <label className=\"flex flex-col gap-1.5\">\n <span className={fieldLabelClass}>Auth</span>\n <DevInput\n className=\"h-9\"\n value={data.auth ?? \"\"}\n disabled={!editable}\n placeholder=\"e.g. Bearer token\"\n onChange={(event) =>\n patch({ auth: event.target.value || undefined })\n }\n />\n </label>\n <label className=\"flex items-center gap-2 pb-2\">\n <DevSwitch\n checked={Boolean(data.deprecated)}\n disabled={!editable}\n onCheckedChange={(checked) =>\n patch({ deprecated: checked || undefined })\n }\n />\n <span className={fieldLabelClass}>Deprecated</span>\n </label>\n </div>\n\n {/* Params */}\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className={fieldLabelClass}>Parameters</span>\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n className=\"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={addParam}\n >\n <IconPlus className=\"size-3.5\" />\n Add\n </button>\n )}\n </div>\n {params.map((param, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-input p-2\"\n >\n <div className=\"grid grid-cols-[minmax(0,1fr)_96px_auto] gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={param.name}\n disabled={!editable}\n placeholder=\"name\"\n onChange={(event) =>\n updateParam(index, { name: event.target.value })\n }\n />\n <DevSelect\n className=\"h-8\"\n value={param.in}\n disabled={!editable}\n onValueChange={(value) =>\n updateParam(index, { in: value as ApiParamLocation })\n }\n options={API_PARAM_LOCATIONS.map((location) => ({\n value: location,\n label: location,\n }))}\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Remove parameter\"\n className=\"flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={() => removeParam(index)}\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={param.type ?? \"\"}\n disabled={!editable}\n placeholder=\"type (e.g. string)\"\n onChange={(event) =>\n updateParam(index, { type: event.target.value || undefined })\n }\n />\n <label className=\"flex items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground\">\n <input\n type=\"checkbox\"\n className=\"size-3.5 cursor-pointer accent-primary\"\n checked={Boolean(param.required)}\n disabled={!editable}\n onChange={(event) =>\n updateParam(index, {\n required: event.target.checked || undefined,\n })\n }\n />\n Required\n </label>\n </div>\n <DevInput\n className=\"h-8 text-xs\"\n value={param.description ?? \"\"}\n disabled={!editable}\n placeholder=\"description\"\n onChange={(event) =>\n updateParam(index, {\n description: event.target.value || undefined,\n })\n }\n />\n </div>\n ))}\n </div>\n\n {/* Request body */}\n <div className=\"flex flex-col gap-2\">\n <span className={fieldLabelClass}>Request body</span>\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={data.request?.contentType ?? \"\"}\n disabled={!editable}\n placeholder=\"content type (e.g. application/json)\"\n onChange={(event) =>\n updateRequest({ contentType: event.target.value || undefined })\n }\n />\n <DevTextarea\n className=\"min-h-[80px] font-mono text-xs\"\n value={data.request?.example ?? \"\"}\n disabled={!editable}\n placeholder='{ \"example\": \"request body\" }'\n onChange={(event) =>\n updateRequest({ example: event.target.value || undefined })\n }\n />\n </div>\n\n {/* Responses */}\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center justify-between\">\n <span className={fieldLabelClass}>Responses</span>\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n className=\"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={addResponse}\n >\n <IconPlus className=\"size-3.5\" />\n Add\n </button>\n )}\n </div>\n {responses.map((response, index) => (\n <div\n key={index}\n className=\"flex flex-col gap-2 rounded-md border border-input p-2\"\n >\n <div className=\"grid grid-cols-[96px_minmax(0,1fr)_auto] gap-2\">\n <DevInput\n className=\"h-8 font-mono text-xs\"\n value={response.status}\n disabled={!editable}\n placeholder=\"200\"\n onChange={(event) =>\n updateResponse(index, { status: event.target.value })\n }\n />\n <DevInput\n className=\"h-8 text-xs\"\n value={response.description ?? \"\"}\n disabled={!editable}\n placeholder=\"description\"\n onChange={(event) =>\n updateResponse(index, {\n description: event.target.value || undefined,\n })\n }\n />\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Remove response\"\n className=\"flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n onClick={() => removeResponse(index)}\n >\n <IconTrash className=\"size-4\" />\n </button>\n )}\n </div>\n <DevTextarea\n className=\"min-h-[64px] font-mono text-xs\"\n value={response.example ?? \"\"}\n disabled={!editable}\n placeholder='{ \"example\": \"response body\" }'\n onChange={(event) =>\n updateResponse(index, {\n example: event.target.value || undefined,\n })\n }\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n"]}
@@ -1,5 +1,34 @@
1
1
  import type { BlockEditProps, BlockReadProps } from "../types.js";
2
2
  import type { DiffData } from "./diff.config.js";
3
+ /**
4
+ * GitHub-style before/after diff block. The read renderer computes a line-level
5
+ * diff, then renders it either unified (one column, `+`/`−` gutters) or split
6
+ * (side-by-side). Long unchanged runs collapse into an expandable "N unchanged
7
+ * lines" row (progressive disclosure). The read surface keeps the GitHub diff
8
+ * shape while using the framework Tailwind theme tokens, so it follows each
9
+ * host app's light/dark appearance instead of bringing its own palette.
10
+ *
11
+ * Lives in core so any app can register the dev-doc block. The line differ is
12
+ * inlined (a small LCS-based `diffLines`) rather than pulling the `diff` package
13
+ * into core; the output shape (`{ value, added, removed }` change records) is
14
+ * identical to what the read renderer consumed before.
15
+ *
16
+ * Editing is panel-driven (config-style, like the HTML block): two monospace
17
+ * textareas (Before / After) plus filename, language, and mode controls.
18
+ */
19
+ interface Change {
20
+ value: string;
21
+ added?: boolean;
22
+ removed?: boolean;
23
+ }
24
+ /**
25
+ * A minimal line-level diff producing jsdiff-compatible `Change[]` records
26
+ * (`{ value }` for context, `{ value, added: true }`, `{ value, removed: true }`).
27
+ * Uses a classic LCS table over line tokens; the inputs here are short code
28
+ * snippets so the O(n·m) table is fine. Removed lines are emitted before added
29
+ * lines within a change region, matching jsdiff's ordering.
30
+ */
31
+ export declare function diffLines(before: string, after: string): Change[];
3
32
  declare function DiffRead({ data, blockId, title, summary }: BlockReadProps<DiffData>): import("react/jsx-runtime").JSX.Element;
4
33
  declare function DiffEdit({ data, onChange, editable }: BlockEditProps<DiffData>): import("react/jsx-runtime").JSX.Element;
5
34
  export { DiffRead, DiffEdit };
@@ -1 +1 @@
1
- {"version":3,"file":"DiffBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/DiffBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,kBAAkB,CAAC;AAsP3D,iBAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CA4E5E;AA6ND,iBAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CA+EvE;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"DiffBlock.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/DiffBlock.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,kBAAkB,CAAC;AAG3D;;;;;;;;;;;;;;;GAeG;AAIH,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAqBD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAsEjE;AAwTD,iBAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAqH5E;AAmPD,iBAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,cAAc,CAAC,QAAQ,CAAC,2CA+EvE;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}