@agent-native/core 0.37.3 → 0.39.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.
- package/README.md +19 -6
- package/dist/action.d.ts +60 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +6 -2
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +12 -6
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +161 -11
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/catalog.json +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +15 -0
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +8 -1
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +10 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/plan-publish-store.d.ts +52 -0
- package/dist/cli/plan-publish-store.d.ts.map +1 -0
- package/dist/cli/plan-publish-store.js +103 -0
- package/dist/cli/plan-publish-store.js.map +1 -0
- package/dist/cli/skills.d.ts +30 -4
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +1240 -339
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/templates-meta.js +12 -12
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +3 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +65 -15
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +20 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +12 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-engine-key.d.ts +24 -0
- package/dist/client/agent-engine-key.d.ts.map +1 -0
- package/dist/client/agent-engine-key.js +49 -0
- package/dist/client/agent-engine-key.js.map +1 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +34 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/blocks/BlockView.d.ts +35 -0
- package/dist/client/blocks/BlockView.d.ts.map +1 -0
- package/dist/client/blocks/BlockView.js +45 -0
- package/dist/client/blocks/BlockView.js.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
- package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
- package/dist/client/blocks/SchemaBlockEditor.js +165 -0
- package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
- package/dist/client/blocks/agent.d.ts +30 -0
- package/dist/client/blocks/agent.d.ts.map +1 -0
- package/dist/client/blocks/agent.js +61 -0
- package/dist/client/blocks/agent.js.map +1 -0
- package/dist/client/blocks/index.d.ts +51 -0
- package/dist/client/blocks/index.d.ts.map +1 -0
- package/dist/client/blocks/index.js +67 -0
- package/dist/client/blocks/index.js.map +1 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +6 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +135 -0
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -0
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts +20 -0
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/ApiEndpointBlock.js +131 -0
- package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -0
- package/dist/client/blocks/library/DataModelBlock.d.ts +28 -0
- package/dist/client/blocks/library/DataModelBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/DataModelBlock.js +222 -0
- package/dist/client/blocks/library/DataModelBlock.js.map +1 -0
- package/dist/client/blocks/library/DiffBlock.d.ts +6 -0
- package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/DiffBlock.js +293 -0
- package/dist/client/blocks/library/DiffBlock.js.map +1 -0
- package/dist/client/blocks/library/FileTreeBlock.d.ts +23 -0
- package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/FileTreeBlock.js +225 -0
- package/dist/client/blocks/library/FileTreeBlock.js.map +1 -0
- package/dist/client/blocks/library/JsonExplorerBlock.d.ts +19 -0
- package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/JsonExplorerBlock.js +171 -0
- package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -0
- package/dist/client/blocks/library/MermaidBlock.d.ts +17 -0
- package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/MermaidBlock.js +131 -0
- package/dist/client/blocks/library/MermaidBlock.js.map +1 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.d.ts +19 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.d.ts.map +1 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.js +494 -0
- package/dist/client/blocks/library/OpenApiSpecBlock.js.map +1 -0
- package/dist/client/blocks/library/annotated-code.config.d.ts +58 -0
- package/dist/client/blocks/library/annotated-code.config.d.ts.map +1 -0
- package/dist/client/blocks/library/annotated-code.config.js +53 -0
- package/dist/client/blocks/library/annotated-code.config.js.map +1 -0
- package/dist/client/blocks/library/api-endpoint.config.d.ts +71 -0
- package/dist/client/blocks/library/api-endpoint.config.d.ts.map +1 -0
- package/dist/client/blocks/library/api-endpoint.config.js +91 -0
- package/dist/client/blocks/library/api-endpoint.config.js.map +1 -0
- package/dist/client/blocks/library/checklist.config.d.ts +36 -0
- package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.config.js +25 -0
- package/dist/client/blocks/library/checklist.config.js.map +1 -0
- package/dist/client/blocks/library/checklist.d.ts +26 -0
- package/dist/client/blocks/library/checklist.d.ts.map +1 -0
- package/dist/client/blocks/library/checklist.js +78 -0
- package/dist/client/blocks/library/checklist.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
- package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.config.js +30 -0
- package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
- package/dist/client/blocks/library/code-tabs.d.ts +3 -0
- package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/code-tabs.js +165 -0
- package/dist/client/blocks/library/code-tabs.js.map +1 -0
- package/dist/client/blocks/library/data-model.config.d.ts +72 -0
- package/dist/client/blocks/library/data-model.config.d.ts.map +1 -0
- package/dist/client/blocks/library/data-model.config.js +59 -0
- package/dist/client/blocks/library/data-model.config.js.map +1 -0
- package/dist/client/blocks/library/dev-doc-ui.d.ts +49 -0
- package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -0
- package/dist/client/blocks/library/dev-doc-ui.js +50 -0
- package/dist/client/blocks/library/dev-doc-ui.js.map +1 -0
- package/dist/client/blocks/library/diff.config.d.ts +41 -0
- package/dist/client/blocks/library/diff.config.d.ts.map +1 -0
- package/dist/client/blocks/library/diff.config.js +34 -0
- package/dist/client/blocks/library/diff.config.js.map +1 -0
- package/dist/client/blocks/library/file-tree.config.d.ts +59 -0
- package/dist/client/blocks/library/file-tree.config.d.ts.map +1 -0
- package/dist/client/blocks/library/file-tree.config.js +45 -0
- package/dist/client/blocks/library/file-tree.config.js.map +1 -0
- package/dist/client/blocks/library/html.config.d.ts +37 -0
- package/dist/client/blocks/library/html.config.d.ts.map +1 -0
- package/dist/client/blocks/library/html.config.js +46 -0
- package/dist/client/blocks/library/html.config.js.map +1 -0
- package/dist/client/blocks/library/html.d.ts +21 -0
- package/dist/client/blocks/library/html.d.ts.map +1 -0
- package/dist/client/blocks/library/html.js +72 -0
- package/dist/client/blocks/library/html.js.map +1 -0
- package/dist/client/blocks/library/json-explorer.config.d.ts +46 -0
- package/dist/client/blocks/library/json-explorer.config.d.ts.map +1 -0
- package/dist/client/blocks/library/json-explorer.config.js +28 -0
- package/dist/client/blocks/library/json-explorer.config.js.map +1 -0
- package/dist/client/blocks/library/mermaid.config.d.ts +32 -0
- package/dist/client/blocks/library/mermaid.config.d.ts.map +1 -0
- package/dist/client/blocks/library/mermaid.config.js +24 -0
- package/dist/client/blocks/library/mermaid.config.js.map +1 -0
- package/dist/client/blocks/library/openapi-spec.config.d.ts +49 -0
- package/dist/client/blocks/library/openapi-spec.config.d.ts.map +1 -0
- package/dist/client/blocks/library/openapi-spec.config.js +24 -0
- package/dist/client/blocks/library/openapi-spec.config.js.map +1 -0
- package/dist/client/blocks/library/server-specs.d.ts +35 -0
- package/dist/client/blocks/library/server-specs.d.ts.map +1 -0
- package/dist/client/blocks/library/server-specs.js +171 -0
- package/dist/client/blocks/library/server-specs.js.map +1 -0
- package/dist/client/blocks/library/specs.d.ts +29 -0
- package/dist/client/blocks/library/specs.d.ts.map +1 -0
- package/dist/client/blocks/library/specs.js +229 -0
- package/dist/client/blocks/library/specs.js.map +1 -0
- package/dist/client/blocks/library/table.config.d.ts +30 -0
- package/dist/client/blocks/library/table.config.d.ts.map +1 -0
- package/dist/client/blocks/library/table.config.js +22 -0
- package/dist/client/blocks/library/table.config.js.map +1 -0
- package/dist/client/blocks/library/table.d.ts +8 -0
- package/dist/client/blocks/library/table.d.ts.map +1 -0
- package/dist/client/blocks/library/table.js +109 -0
- package/dist/client/blocks/library/table.js.map +1 -0
- package/dist/client/blocks/library/tabs.config.d.ts +56 -0
- package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.config.js +36 -0
- package/dist/client/blocks/library/tabs.config.js.map +1 -0
- package/dist/client/blocks/library/tabs.d.ts +20 -0
- package/dist/client/blocks/library/tabs.d.ts.map +1 -0
- package/dist/client/blocks/library/tabs.js +123 -0
- package/dist/client/blocks/library/tabs.js.map +1 -0
- package/dist/client/blocks/mdx.d.ts +74 -0
- package/dist/client/blocks/mdx.d.ts.map +1 -0
- package/dist/client/blocks/mdx.js +205 -0
- package/dist/client/blocks/mdx.js.map +1 -0
- package/dist/client/blocks/provider.d.ts +25 -0
- package/dist/client/blocks/provider.d.ts.map +1 -0
- package/dist/client/blocks/provider.js +19 -0
- package/dist/client/blocks/provider.js.map +1 -0
- package/dist/client/blocks/registry.d.ts +32 -0
- package/dist/client/blocks/registry.d.ts.map +1 -0
- package/dist/client/blocks/registry.js +65 -0
- package/dist/client/blocks/registry.js.map +1 -0
- package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
- package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
- package/dist/client/blocks/schema-form/introspect.js +164 -0
- package/dist/client/blocks/schema-form/introspect.js.map +1 -0
- package/dist/client/blocks/server.d.ts +31 -0
- package/dist/client/blocks/server.d.ts.map +1 -0
- package/dist/client/blocks/server.js +41 -0
- package/dist/client/blocks/server.js.map +1 -0
- package/dist/client/blocks/types.d.ts +252 -0
- package/dist/client/blocks/types.d.ts.map +1 -0
- package/dist/client/blocks/types.js +5 -0
- package/dist/client/blocks/types.js.map +1 -0
- package/dist/client/composer/ComposerPlusMenu.js +10 -1
- package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/client/guided-questions.d.ts +68 -0
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +158 -3
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +24 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
- package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
- package/dist/client/rich-markdown-editor/DragHandle.d.ts +52 -0
- package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/DragHandle.js +403 -0
- package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
- package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
- package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +97 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +214 -0
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
- package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/RunId.d.ts +28 -0
- package/dist/client/rich-markdown-editor/RunId.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/RunId.js +60 -0
- package/dist/client/rich-markdown-editor/RunId.js.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +85 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +130 -0
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
- package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
- package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/extensions.js +222 -0
- package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts +24 -0
- package/dist/client/rich-markdown-editor/gfmDoc.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/gfmDoc.js +83 -0
- package/dist/client/rich-markdown-editor/gfmDoc.js.map +1 -0
- package/dist/client/rich-markdown-editor/index.d.ts +14 -0
- package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/index.js +14 -0
- package/dist/client/rich-markdown-editor/index.js.map +1 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +46 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.js +13 -0
- package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +375 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
- package/dist/client/track.d.ts +25 -0
- package/dist/client/track.d.ts.map +1 -0
- package/dist/client/track.js +53 -0
- package/dist/client/track.js.map +1 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +6 -0
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-session.d.ts +3 -2
- package/dist/client/use-session.d.ts.map +1 -1
- package/dist/client/use-session.js +3 -2
- package/dist/client/use-session.js.map +1 -1
- package/dist/deploy/build.d.ts +5 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +67 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/extensions/schema.d.ts +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +9 -2
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +35 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/provider-api/index.d.ts +1 -1
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/scripts/docs/search.d.ts.map +1 -1
- package/dist/scripts/docs/search.js +5 -2
- package/dist/scripts/docs/search.js.map +1 -1
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +16 -3
- package/dist/scripts/runner.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +2 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +30 -4
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +65 -19
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +8 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/agents-bundle.d.ts +27 -1
- package/dist/server/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +41 -3
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +76 -3
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +60 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +160 -22
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/sentry.d.ts.map +1 -1
- package/dist/server/sentry.js +6 -0
- package/dist/server/sentry.js.map +1 -1
- package/dist/server/social-og-image.d.ts +2 -1
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +24 -4
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/sharing/schema.d.ts +1 -1
- package/dist/styles/agent-native.css +1 -0
- package/dist/styles/rich-markdown-editor.css +439 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/DEVELOPING.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/dist/templates/workspace-core/AGENTS.md +5 -1
- package/dist/templates/workspace-root/AGENTS.md +5 -2
- package/dist/tracking/route.d.ts +43 -0
- package/dist/tracking/route.d.ts.map +1 -0
- package/dist/tracking/route.js +85 -0
- package/dist/tracking/route.js.map +1 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +15 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +18 -4
- package/docs/content/actions.md +87 -0
- package/docs/content/agent-mentions.md +2 -1
- package/docs/content/authentication.md +2 -1
- package/docs/content/client.md +64 -13
- package/docs/content/cloneable-saas.md +1 -1
- package/docs/content/code-agents-ui.md +17 -11
- package/docs/content/context-awareness.md +23 -28
- package/docs/content/creating-templates.md +1 -1
- package/docs/content/drop-in-agent.md +2 -0
- package/docs/content/getting-started.md +2 -2
- package/docs/content/key-concepts.md +2 -2
- package/docs/content/messaging.md +57 -15
- package/docs/content/migration-workbench.md +1 -1
- package/docs/content/multi-app-workspace.md +1 -1
- package/docs/content/multi-tenancy.md +17 -15
- package/docs/content/real-time-collaboration.md +1 -1
- package/docs/content/recurring-jobs.md +1 -1
- package/docs/content/security.md +2 -2
- package/docs/content/server.md +4 -4
- package/docs/content/skills-guide.md +30 -0
- package/docs/content/template-analytics.md +2 -2
- package/docs/content/template-assets.md +17 -1
- package/docs/content/template-brain.md +2 -2
- package/docs/content/template-calendar.md +1 -1
- package/docs/content/template-clips.md +3 -3
- package/docs/content/template-content.md +2 -2
- package/docs/content/template-design.md +2 -2
- package/docs/content/template-dispatch.md +3 -3
- package/docs/content/template-forms.md +14 -2
- package/docs/content/template-mail.md +1 -3
- package/docs/content/template-plan.md +133 -0
- package/docs/content/template-slides.md +5 -4
- package/docs/content/template-starter.md +4 -4
- package/docs/content/template-videos.md +6 -11
- package/docs/content/tracking.md +21 -1
- package/docs/content/visual-plans.md +74 -0
- package/docs/content/workspace.md +9 -9
- package/package.json +26 -11
- package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
- package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
- package/src/templates/default/AGENTS.md +1 -0
- package/src/templates/default/DEVELOPING.md +2 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
- package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
- package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
- package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
- package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
- package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
- package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
- package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
- package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
- package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
- package/src/templates/workspace-core/AGENTS.md +5 -1
- package/src/templates/workspace-root/AGENTS.md +5 -2
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { defineBlock } from "../types.js";
|
|
2
|
+
import { registerBlocks } from "../registry.js";
|
|
3
|
+
// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).
|
|
4
|
+
import { checklistBlock } from "./checklist.js";
|
|
5
|
+
import { tableBlock } from "./table.js";
|
|
6
|
+
import { codeTabsBlock } from "./code-tabs.js";
|
|
7
|
+
import { htmlBlock } from "./html.js";
|
|
8
|
+
import { tabsBlock } from "./tabs.js";
|
|
9
|
+
// Dev-doc blocks: React-free schema + MDX config paired with the shared React
|
|
10
|
+
// Read/Edit renderers. Composed into full specs below with canonical metadata.
|
|
11
|
+
import { mermaidSchema, mermaidMdx, } from "./mermaid.config.js";
|
|
12
|
+
import { MermaidRead, MermaidEdit } from "./MermaidBlock.js";
|
|
13
|
+
import { apiEndpointSchema, apiEndpointMdx, } from "./api-endpoint.config.js";
|
|
14
|
+
import { ApiEndpointRead, ApiEndpointEdit } from "./ApiEndpointBlock.js";
|
|
15
|
+
import { openApiSpecSchema, openApiSpecMdx, } from "./openapi-spec.config.js";
|
|
16
|
+
import { OpenApiSpecRead, OpenApiSpecEdit } from "./OpenApiSpecBlock.js";
|
|
17
|
+
import { dataModelSchema, dataModelMdx, } from "./data-model.config.js";
|
|
18
|
+
import { DataModelRead, DataModelEdit } from "./DataModelBlock.js";
|
|
19
|
+
import { diffSchema, diffMdx } from "./diff.config.js";
|
|
20
|
+
import { DiffRead, DiffEdit } from "./DiffBlock.js";
|
|
21
|
+
import { fileTreeSchema, fileTreeMdx, } from "./file-tree.config.js";
|
|
22
|
+
import { FileTreeRead, FileTreeEdit } from "./FileTreeBlock.js";
|
|
23
|
+
import { jsonExplorerSchema, jsonExplorerMdx, } from "./json-explorer.config.js";
|
|
24
|
+
import { JsonExplorerRead, JsonExplorerEdit } from "./JsonExplorerBlock.js";
|
|
25
|
+
import { annotatedCodeSchema, annotatedCodeMdx, } from "./annotated-code.config.js";
|
|
26
|
+
import { AnnotatedCodeRead, AnnotatedCodeEdit } from "./AnnotatedCodeBlock.js";
|
|
27
|
+
/**
|
|
28
|
+
* Canonical specs for the standard library's dev-doc blocks (Mermaid, API
|
|
29
|
+
* endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer, annotated
|
|
30
|
+
* code). Each pairs the shared React-free schema/MDX config with the shared
|
|
31
|
+
* React `Read`/`Edit` renderers and the canonical label/description/editSurface/
|
|
32
|
+
* empty metadata. Apps that need a slightly different label/description/empty for
|
|
33
|
+
* a block pass an override to {@link registerLibraryBlocks} rather than
|
|
34
|
+
* re-authoring the whole spec.
|
|
35
|
+
*
|
|
36
|
+
* The five fully pre-built standard specs (checklist, table, code-tabs, html,
|
|
37
|
+
* tabs) already bundle their metadata in their own modules, so they are appended
|
|
38
|
+
* by {@link libraryBlockSpecs} rather than re-declared here.
|
|
39
|
+
*/
|
|
40
|
+
// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic
|
|
41
|
+
// data types coexist in one array — mirroring `registerBlocks`' own signature,
|
|
42
|
+
// where `childrenField: keyof TData` would otherwise collapse to `never`.
|
|
43
|
+
const devDocBlockSpecs = [
|
|
44
|
+
defineBlock({
|
|
45
|
+
type: "mermaid",
|
|
46
|
+
schema: mermaidSchema,
|
|
47
|
+
mdx: mermaidMdx,
|
|
48
|
+
Read: MermaidRead,
|
|
49
|
+
Edit: MermaidEdit,
|
|
50
|
+
placement: ["block"],
|
|
51
|
+
editSurface: "panel",
|
|
52
|
+
label: "Diagram (Mermaid)",
|
|
53
|
+
description: "A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.",
|
|
54
|
+
empty: () => ({
|
|
55
|
+
source: "flowchart TD\n A[Start] --> B{Decision}\n B -->|Yes| C[Do it]\n B -->|No| D[Skip]",
|
|
56
|
+
}),
|
|
57
|
+
}),
|
|
58
|
+
defineBlock({
|
|
59
|
+
type: "api-endpoint",
|
|
60
|
+
schema: apiEndpointSchema,
|
|
61
|
+
mdx: apiEndpointMdx,
|
|
62
|
+
Read: ApiEndpointRead,
|
|
63
|
+
Edit: ApiEndpointEdit,
|
|
64
|
+
placement: ["block"],
|
|
65
|
+
editSurface: "panel",
|
|
66
|
+
label: "API endpoint",
|
|
67
|
+
description: "A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.",
|
|
68
|
+
empty: () => ({ method: "GET", path: "/api/resource" }),
|
|
69
|
+
}),
|
|
70
|
+
defineBlock({
|
|
71
|
+
type: "openapi-spec",
|
|
72
|
+
schema: openApiSpecSchema,
|
|
73
|
+
mdx: openApiSpecMdx,
|
|
74
|
+
Read: OpenApiSpecRead,
|
|
75
|
+
Edit: OpenApiSpecEdit,
|
|
76
|
+
placement: ["block"],
|
|
77
|
+
editSurface: "panel",
|
|
78
|
+
label: "OpenAPI spec",
|
|
79
|
+
description: "A whole-document Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.",
|
|
80
|
+
empty: () => ({
|
|
81
|
+
spec: JSON.stringify({
|
|
82
|
+
openapi: "3.0.0",
|
|
83
|
+
info: { title: "Example API", version: "1.0.0" },
|
|
84
|
+
tags: [{ name: "widgets", description: "Manage widgets" }],
|
|
85
|
+
paths: {
|
|
86
|
+
"/widgets": {
|
|
87
|
+
get: {
|
|
88
|
+
tags: ["widgets"],
|
|
89
|
+
summary: "List widgets",
|
|
90
|
+
responses: { "200": { description: "OK" } },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}, null, 2),
|
|
95
|
+
}),
|
|
96
|
+
}),
|
|
97
|
+
defineBlock({
|
|
98
|
+
type: "data-model",
|
|
99
|
+
schema: dataModelSchema,
|
|
100
|
+
mdx: dataModelMdx,
|
|
101
|
+
Read: DataModelRead,
|
|
102
|
+
Edit: DataModelEdit,
|
|
103
|
+
placement: ["block"],
|
|
104
|
+
editSurface: "panel",
|
|
105
|
+
label: "Data model",
|
|
106
|
+
description: "An ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.",
|
|
107
|
+
empty: () => ({
|
|
108
|
+
entities: [
|
|
109
|
+
{
|
|
110
|
+
id: "e_user",
|
|
111
|
+
name: "User",
|
|
112
|
+
fields: [
|
|
113
|
+
{ name: "id", type: "uuid", pk: true },
|
|
114
|
+
{ name: "email", type: "text" },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
}),
|
|
119
|
+
}),
|
|
120
|
+
defineBlock({
|
|
121
|
+
type: "diff",
|
|
122
|
+
schema: diffSchema,
|
|
123
|
+
mdx: diffMdx,
|
|
124
|
+
Read: DiffRead,
|
|
125
|
+
Edit: DiffEdit,
|
|
126
|
+
placement: ["block"],
|
|
127
|
+
editSurface: "panel",
|
|
128
|
+
label: "Diff",
|
|
129
|
+
description: "A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.",
|
|
130
|
+
empty: () => ({
|
|
131
|
+
before: "function add(a, b) {\n return a + b;\n}",
|
|
132
|
+
after: "function add(a: number, b: number): number {\n return a + b;\n}",
|
|
133
|
+
language: "ts",
|
|
134
|
+
}),
|
|
135
|
+
}),
|
|
136
|
+
defineBlock({
|
|
137
|
+
type: "file-tree",
|
|
138
|
+
schema: fileTreeSchema,
|
|
139
|
+
mdx: fileTreeMdx,
|
|
140
|
+
Read: FileTreeRead,
|
|
141
|
+
Edit: FileTreeEdit,
|
|
142
|
+
placement: ["block"],
|
|
143
|
+
editSurface: "panel",
|
|
144
|
+
label: "File tree",
|
|
145
|
+
description: "A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.",
|
|
146
|
+
empty: () => ({
|
|
147
|
+
entries: [
|
|
148
|
+
{
|
|
149
|
+
path: "src/index.ts",
|
|
150
|
+
change: "modified",
|
|
151
|
+
note: "Wire the new route here.",
|
|
152
|
+
},
|
|
153
|
+
{ path: "src/routes/git.ts", change: "added" },
|
|
154
|
+
],
|
|
155
|
+
}),
|
|
156
|
+
}),
|
|
157
|
+
defineBlock({
|
|
158
|
+
type: "json-explorer",
|
|
159
|
+
schema: jsonExplorerSchema,
|
|
160
|
+
mdx: jsonExplorerMdx,
|
|
161
|
+
Read: JsonExplorerRead,
|
|
162
|
+
Edit: JsonExplorerEdit,
|
|
163
|
+
placement: ["block"],
|
|
164
|
+
editSurface: "panel",
|
|
165
|
+
label: "JSON explorer",
|
|
166
|
+
description: "A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.",
|
|
167
|
+
empty: () => ({
|
|
168
|
+
json: JSON.stringify({
|
|
169
|
+
id: "abc123",
|
|
170
|
+
active: true,
|
|
171
|
+
tags: ["alpha", "beta"],
|
|
172
|
+
meta: { count: 2, owner: null },
|
|
173
|
+
}, null, 2),
|
|
174
|
+
}),
|
|
175
|
+
}),
|
|
176
|
+
defineBlock({
|
|
177
|
+
type: "annotated-code",
|
|
178
|
+
schema: annotatedCodeSchema,
|
|
179
|
+
mdx: annotatedCodeMdx,
|
|
180
|
+
Read: AnnotatedCodeRead,
|
|
181
|
+
Edit: AnnotatedCodeEdit,
|
|
182
|
+
placement: ["block"],
|
|
183
|
+
editSurface: "panel",
|
|
184
|
+
label: "Annotated code",
|
|
185
|
+
description: "A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph 'explain this code' style).",
|
|
186
|
+
empty: () => ({
|
|
187
|
+
language: "ts",
|
|
188
|
+
code: "export function resolveAuth(provider: string) {\n const cfg = providers[provider];\n return cfg.token;\n}",
|
|
189
|
+
annotations: [
|
|
190
|
+
{
|
|
191
|
+
lines: "2",
|
|
192
|
+
label: "Lookup",
|
|
193
|
+
note: "Resolves the provider config by key.",
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
}),
|
|
197
|
+
}),
|
|
198
|
+
];
|
|
199
|
+
/**
|
|
200
|
+
* The full standard library spec set, in registration order: the five fully
|
|
201
|
+
* pre-built specs (checklist, table, code-tabs, html, tabs) followed by the
|
|
202
|
+
* eight dev-doc specs. This is the single list both the plan and content browser
|
|
203
|
+
* registries register — adding a 14th library block here lands in both apps.
|
|
204
|
+
*/
|
|
205
|
+
export const libraryBlockSpecs = [
|
|
206
|
+
checklistBlock,
|
|
207
|
+
tableBlock,
|
|
208
|
+
codeTabsBlock,
|
|
209
|
+
htmlBlock,
|
|
210
|
+
tabsBlock,
|
|
211
|
+
...devDocBlockSpecs,
|
|
212
|
+
];
|
|
213
|
+
/**
|
|
214
|
+
* Register the standard library block specs into a {@link BlockRegistry}. Both
|
|
215
|
+
* the plan and content browser registries call this, then register only their
|
|
216
|
+
* own app-specific blocks on top — so the shared library lives in exactly one
|
|
217
|
+
* place. Pass `overrides` (keyed by canonical `type`) for the small per-app
|
|
218
|
+
* differences (content re-types `table` → `table-block`; each app phrases the
|
|
219
|
+
* Mermaid description and seeds the OpenAPI example a little differently).
|
|
220
|
+
*/
|
|
221
|
+
export function registerLibraryBlocks(registry, options = {}) {
|
|
222
|
+
const overrides = options.overrides ?? {};
|
|
223
|
+
const specs = libraryBlockSpecs.map((spec) => {
|
|
224
|
+
const override = overrides[spec.type];
|
|
225
|
+
return override ? { ...spec, ...override } : spec;
|
|
226
|
+
});
|
|
227
|
+
registerBlocks(registry, specs);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,iFAAiF;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,8EAA8E;AAC9E,+EAA+E;AAC/E,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,eAAe,EAA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ACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD,cAAc;IACd,UAAU;IACV,aAAa;IACb,SAAS;IACT,SAAS;IACT,GAAG,gBAAgB;CACpB,CAAC;AAcF;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAuB,EACvB,UAAiD,EAAE;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).\nimport { checklistBlock } from \"./checklist.js\";\nimport { tableBlock } from \"./table.js\";\nimport { codeTabsBlock } from \"./code-tabs.js\";\nimport { htmlBlock } from \"./html.js\";\nimport { tabsBlock } from \"./tabs.js\";\n\n// Dev-doc blocks: React-free schema + MDX config paired with the shared React\n// Read/Edit renderers. Composed into full specs below with canonical metadata.\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport { MermaidRead, MermaidEdit } from \"./MermaidBlock.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport { ApiEndpointRead, ApiEndpointEdit } from \"./ApiEndpointBlock.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport { OpenApiSpecRead, OpenApiSpecEdit } from \"./OpenApiSpecBlock.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { DataModelRead, DataModelEdit } from \"./DataModelBlock.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport { DiffRead, DiffEdit } from \"./DiffBlock.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport { FileTreeRead, FileTreeEdit } from \"./FileTreeBlock.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport { JsonExplorerRead, JsonExplorerEdit } from \"./JsonExplorerBlock.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\nimport { AnnotatedCodeRead, AnnotatedCodeEdit } from \"./AnnotatedCodeBlock.js\";\n\n/**\n * Canonical specs for the standard library's dev-doc blocks (Mermaid, API\n * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer, annotated\n * code). Each pairs the shared React-free schema/MDX config with the shared\n * React `Read`/`Edit` renderers and the canonical label/description/editSurface/\n * empty metadata. Apps that need a slightly different label/description/empty for\n * a block pass an override to {@link registerLibraryBlocks} rather than\n * re-authoring the whole spec.\n *\n * The five fully pre-built standard specs (checklist, table, code-tabs, html,\n * tabs) already bundle their metadata in their own modules, so they are appended\n * by {@link libraryBlockSpecs} rather than re-declared here.\n */\n// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic\n// data types coexist in one array — mirroring `registerBlocks`' own signature,\n// where `childrenField: keyof TData` would otherwise collapse to `never`.\nconst devDocBlockSpecs: BlockSpec<any>[] = [\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: MermaidRead,\n Edit: MermaidEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n empty: () => ({\n source:\n \"flowchart TD\\n A[Start] --> B{Decision}\\n B -->|Yes| C[Do it]\\n B -->|No| D[Skip]\",\n }),\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ApiEndpointRead,\n Edit: ApiEndpointEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n empty: () => ({ method: \"GET\", path: \"/api/resource\" }),\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: OpenApiSpecRead,\n Edit: OpenApiSpecEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"OpenAPI spec\",\n description:\n \"A whole-document Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.\",\n empty: () => ({\n spec: JSON.stringify(\n {\n openapi: \"3.0.0\",\n info: { title: \"Example API\", version: \"1.0.0\" },\n tags: [{ name: \"widgets\", description: \"Manage widgets\" }],\n paths: {\n \"/widgets\": {\n get: {\n tags: [\"widgets\"],\n summary: \"List widgets\",\n responses: { \"200\": { description: \"OK\" } },\n },\n },\n },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: DataModelRead,\n Edit: DataModelEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Data model\",\n description:\n \"An ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n empty: () => ({\n entities: [\n {\n id: \"e_user\",\n name: \"User\",\n fields: [\n { name: \"id\", type: \"uuid\", pk: true },\n { name: \"email\", type: \"text\" },\n ],\n },\n ],\n }),\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: DiffRead,\n Edit: DiffEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.\",\n empty: () => ({\n before: \"function add(a, b) {\\n return a + b;\\n}\",\n after: \"function add(a: number, b: number): number {\\n return a + b;\\n}\",\n language: \"ts\",\n }),\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: FileTreeRead,\n Edit: FileTreeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.\",\n empty: () => ({\n entries: [\n {\n path: \"src/index.ts\",\n change: \"modified\",\n note: \"Wire the new route here.\",\n },\n { path: \"src/routes/git.ts\", change: \"added\" },\n ],\n }),\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: JsonExplorerRead,\n Edit: JsonExplorerEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n empty: () => ({\n json: JSON.stringify(\n {\n id: \"abc123\",\n active: true,\n tags: [\"alpha\", \"beta\"],\n meta: { count: 2, owner: null },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: AnnotatedCodeRead,\n Edit: AnnotatedCodeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph 'explain this code' style).\",\n empty: () => ({\n language: \"ts\",\n code: \"export function resolveAuth(provider: string) {\\n const cfg = providers[provider];\\n return cfg.token;\\n}\",\n annotations: [\n {\n lines: \"2\",\n label: \"Lookup\",\n note: \"Resolves the provider config by key.\",\n },\n ],\n }),\n }),\n];\n\n/**\n * The full standard library spec set, in registration order: the five fully\n * pre-built specs (checklist, table, code-tabs, html, tabs) followed by the\n * eight dev-doc specs. This is the single list both the plan and content browser\n * registries register — adding a 14th library block here lands in both apps.\n */\nexport const libraryBlockSpecs: BlockSpec<any>[] = [\n checklistBlock,\n tableBlock,\n codeTabsBlock,\n htmlBlock,\n tabsBlock,\n ...devDocBlockSpecs,\n];\n\n/**\n * Per-block metadata overrides for {@link registerLibraryBlocks}, keyed by the\n * canonical block `type`. Lets an app tweak the few fields that legitimately\n * differ (a `type` rename, a tweaked `description` or `empty` seed) without\n * re-authoring the spec. Anything omitted keeps the canonical value, so the\n * schema / MDX config and the React `Read`/`Edit` renderers always stay shared.\n */\nexport type LibraryBlockOverrides = Record<\n string,\n Partial<Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"empty\">>\n>;\n\n/**\n * Register the standard library block specs into a {@link BlockRegistry}. Both\n * the plan and content browser registries call this, then register only their\n * own app-specific blocks on top — so the shared library lives in exactly one\n * place. Pass `overrides` (keyed by canonical `type`) for the small per-app\n * differences (content re-types `table` → `table-block`; each app phrases the\n * Mermaid description and seeds the OpenAPI example a little differently).\n */\nexport function registerLibraryBlocks(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockSpecs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the standard `table` block: its data schema and MDX
|
|
5
|
+
* round-trip config. Shared by the server MDX adapter (the plan
|
|
6
|
+
* `plan-block-registry.ts` → `plan-mdx.ts`) and the client spec
|
|
7
|
+
* (`table.tsx`). Keeping it React-free means a server module that imports it
|
|
8
|
+
* never pulls React into the Nitro/SSR bundle.
|
|
9
|
+
*
|
|
10
|
+
* The schema MUST stay data-compatible with the legacy `table` branch of the
|
|
11
|
+
* plan `planBlockSchema` (`{ columns: string[]; rows: string[][] }`), and the
|
|
12
|
+
* MDX `tag` + attribute shape MUST match the legacy self-closing
|
|
13
|
+
* `<Table … columns={…} rows={…} />` encoding (`plan-mdx.ts`
|
|
14
|
+
* `serializeBlock`/`parseBlock`) so stored `.mdx` round-trips byte-compatibly.
|
|
15
|
+
*/
|
|
16
|
+
export interface TableData {
|
|
17
|
+
columns: string[];
|
|
18
|
+
rows: string[][];
|
|
19
|
+
}
|
|
20
|
+
export declare const tableSchema: z.ZodType<TableData>;
|
|
21
|
+
/**
|
|
22
|
+
* MDX config: `columns` and `rows` are JSON attributes (no children) — exactly
|
|
23
|
+
* the legacy self-closing `<Table id title summary editable columns={…} rows={…} />`
|
|
24
|
+
* form. The legacy serializer emits `columns` before `rows`; `toAttrs` returns
|
|
25
|
+
* the keys in that exact insertion order because `serializeSpecBlock` preserves
|
|
26
|
+
* `Object.entries` order. `fromAttrs` mirrors the legacy parser's `?? []`
|
|
27
|
+
* defaults so partial/older nodes stay tolerant.
|
|
28
|
+
*/
|
|
29
|
+
export declare const tableMdx: BlockMdxConfig<TableData>;
|
|
30
|
+
//# sourceMappingURL=table.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/table.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,EAGP,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,cAAc,CAAC,SAAS,CAO9C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const tableSchema = z.object({
|
|
3
|
+
columns: z.array(z.string()),
|
|
4
|
+
rows: z.array(z.array(z.string())),
|
|
5
|
+
});
|
|
6
|
+
/**
|
|
7
|
+
* MDX config: `columns` and `rows` are JSON attributes (no children) — exactly
|
|
8
|
+
* the legacy self-closing `<Table id title summary editable columns={…} rows={…} />`
|
|
9
|
+
* form. The legacy serializer emits `columns` before `rows`; `toAttrs` returns
|
|
10
|
+
* the keys in that exact insertion order because `serializeSpecBlock` preserves
|
|
11
|
+
* `Object.entries` order. `fromAttrs` mirrors the legacy parser's `?? []`
|
|
12
|
+
* defaults so partial/older nodes stay tolerant.
|
|
13
|
+
*/
|
|
14
|
+
export const tableMdx = {
|
|
15
|
+
tag: "Table",
|
|
16
|
+
toAttrs: (data) => ({ columns: data.columns, rows: data.rows }),
|
|
17
|
+
fromAttrs: (attrs) => ({
|
|
18
|
+
columns: attrs.array("columns") ?? [],
|
|
19
|
+
rows: attrs.array("rows") ?? [],
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=table.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/table.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CACnC,CAAoC,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA8B;IACjD,GAAG,EAAE,OAAO;IACZ,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/D,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAS,SAAS,CAAC,IAAI,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,KAAK,CAAW,MAAM,CAAC,IAAI,EAAE;KAC1C,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the standard `table` block: its data schema and MDX\n * round-trip config. Shared by the server MDX adapter (the plan\n * `plan-block-registry.ts` → `plan-mdx.ts`) and the client spec\n * (`table.tsx`). Keeping it React-free means a server module that imports it\n * never pulls React into the Nitro/SSR bundle.\n *\n * The schema MUST stay data-compatible with the legacy `table` branch of the\n * plan `planBlockSchema` (`{ columns: string[]; rows: string[][] }`), and the\n * MDX `tag` + attribute shape MUST match the legacy self-closing\n * `<Table … columns={…} rows={…} />` encoding (`plan-mdx.ts`\n * `serializeBlock`/`parseBlock`) so stored `.mdx` round-trips byte-compatibly.\n */\n\nexport interface TableData {\n columns: string[];\n rows: string[][];\n}\n\nexport const tableSchema = z.object({\n columns: z.array(z.string()),\n rows: z.array(z.array(z.string())),\n}) as unknown as z.ZodType<TableData>;\n\n/**\n * MDX config: `columns` and `rows` are JSON attributes (no children) — exactly\n * the legacy self-closing `<Table id title summary editable columns={…} rows={…} />`\n * form. The legacy serializer emits `columns` before `rows`; `toAttrs` returns\n * the keys in that exact insertion order because `serializeSpecBlock` preserves\n * `Object.entries` order. `fromAttrs` mirrors the legacy parser's `?? []`\n * defaults so partial/older nodes stay tolerant.\n */\nexport const tableMdx: BlockMdxConfig<TableData> = {\n tag: \"Table\",\n toAttrs: (data) => ({ columns: data.columns, rows: data.rows }),\n fromAttrs: (attrs) => ({\n columns: attrs.array<string>(\"columns\") ?? [],\n rows: attrs.array<string[]>(\"rows\") ?? [],\n }),\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TableData } from "./table.config.js";
|
|
2
|
+
/**
|
|
3
|
+
* The full standard `table` `BlockSpec`. Pairs the React-free
|
|
4
|
+
* {@link tableSchema}/{@link tableMdx} config (also used by the server registry)
|
|
5
|
+
* with the React `Read`/`Edit`. `empty()` seeds a 2×2 grid for slash insertion.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tableBlock: import("../types.js").BlockSpec<TableData>;
|
|
8
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/table.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAyO1E;;;;GAIG;AACH,eAAO,MAAM,UAAU,4CAsBrB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconColumnInsertRight, IconPlus, IconRowInsertBottom, IconTable, IconTrash, IconX, } from "@tabler/icons-react";
|
|
3
|
+
import { defineBlock } from "../types.js";
|
|
4
|
+
import { tableMdx, tableSchema } from "./table.config.js";
|
|
5
|
+
/**
|
|
6
|
+
* Standard `table` block — a simple grid of header columns and string rows.
|
|
7
|
+
* STANDARD library block: lives in core (`@agent-native/core/blocks`) so any
|
|
8
|
+
* app can register it. The plan app's registries (server + client) import
|
|
9
|
+
* {@link tableBlock} (browser) and the React-free {@link tableMdx}/
|
|
10
|
+
* {@link tableSchema} config (server) so its render + MDX round-trip move out
|
|
11
|
+
* of the plan `PlanBlockView` switch / `serializeBlock` into the registry,
|
|
12
|
+
* while the legacy branch stays as a backward-compatible fallback for
|
|
13
|
+
* unregistered renderers.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read-only renderer. Mirrors the legacy plan `PlanBlockView` table branch
|
|
17
|
+
* markup byte-for-byte (same `plan-block overflow-x-auto` section + title +
|
|
18
|
+
* `plan-line`/`plan-muted` table) so converting the block to the registry does
|
|
19
|
+
* not change the rendered output. The `plan-*` class names are styled by the
|
|
20
|
+
* consuming app's CSS — core only emits the markup, exactly like the existing
|
|
21
|
+
* `CalloutBlock` read renderer.
|
|
22
|
+
*/
|
|
23
|
+
function TableBlockRead({ data, blockId, title }) {
|
|
24
|
+
return (_jsxs("section", { className: "plan-block overflow-x-auto", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsxs("table", { className: "w-full min-w-[640px] border-collapse text-left", children: [_jsx("thead", { children: _jsx("tr", { className: "border-b border-plan-line text-sm text-plan-muted", children: data.columns.map((column) => (_jsx("th", { className: "py-3 pr-4 font-semibold", children: column }, column))) }) }), _jsx("tbody", { children: data.rows.map((row, index) => (_jsx("tr", { className: "border-b border-plan-line", children: row.map((cell, cellIndex) => (_jsx("td", { className: "py-4 pr-4 text-plan-muted", children: cell }, cellIndex))) }, index))) })] })] }));
|
|
25
|
+
}
|
|
26
|
+
const editInputClass = "h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";
|
|
27
|
+
const iconButtonClass = "inline-flex size-7 items-center justify-center rounded-md border border-input text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50";
|
|
28
|
+
const addButtonClass = "inline-flex items-center gap-1.5 rounded-md border border-input bg-transparent px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50";
|
|
29
|
+
/**
|
|
30
|
+
* Editable grid. The schema's `columns: string[]` / `rows: string[][]` are
|
|
31
|
+
* positional/structured, which the schema auto-editor intentionally cannot
|
|
32
|
+
* render, so this block supplies its own `Edit`: an editable header row plus a
|
|
33
|
+
* body grid, with add/remove controls for both columns and rows. Every change
|
|
34
|
+
* commits a full new `{ columns, rows }` value (re-validated upstream by the
|
|
35
|
+
* registry), keeping rows rectangular with the column count.
|
|
36
|
+
*/
|
|
37
|
+
function TableBlockEdit({ data, onChange, editable, }) {
|
|
38
|
+
const columns = data.columns ?? [];
|
|
39
|
+
const rows = data.rows ?? [];
|
|
40
|
+
const columnCount = columns.length;
|
|
41
|
+
const commit = (next) => onChange(next);
|
|
42
|
+
const setColumn = (index, value) => {
|
|
43
|
+
commit({
|
|
44
|
+
columns: columns.map((c, i) => (i === index ? value : c)),
|
|
45
|
+
rows,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const setCell = (rowIndex, cellIndex, value) => {
|
|
49
|
+
commit({
|
|
50
|
+
columns,
|
|
51
|
+
rows: rows.map((row, i) => i === rowIndex
|
|
52
|
+
? row.map((cell, j) => (j === cellIndex ? value : cell))
|
|
53
|
+
: row),
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const addColumn = () => {
|
|
57
|
+
commit({
|
|
58
|
+
columns: [...columns, `Column ${columnCount + 1}`],
|
|
59
|
+
// Keep rows rectangular: append an empty cell to every row.
|
|
60
|
+
rows: rows.map((row) => [...row, ""]),
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const removeColumn = (index) => {
|
|
64
|
+
commit({
|
|
65
|
+
columns: columns.filter((_, i) => i !== index),
|
|
66
|
+
rows: rows.map((row) => row.filter((_, i) => i !== index)),
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const addRow = () => {
|
|
70
|
+
commit({
|
|
71
|
+
columns,
|
|
72
|
+
// New row matches the current column count.
|
|
73
|
+
rows: [
|
|
74
|
+
...rows,
|
|
75
|
+
Array.from({ length: Math.max(columnCount, 1) }, () => ""),
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const removeRow = (index) => {
|
|
80
|
+
commit({ columns, rows: rows.filter((_, i) => i !== index) });
|
|
81
|
+
};
|
|
82
|
+
return (_jsxs("div", { className: "an-table-block-editor flex flex-col gap-3", children: [_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full min-w-[480px] border-collapse text-left", children: [_jsx("thead", { children: _jsxs("tr", { children: [columns.map((column, index) => (_jsx("th", { className: "p-1 align-top", children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("input", { type: "text", "data-plan-interactive": true, "aria-label": `Column ${index + 1} header`, className: editInputClass, value: column, disabled: !editable, onChange: (event) => setColumn(index, event.target.value) }), _jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": `Remove column ${index + 1}`, className: iconButtonClass, disabled: !editable, onClick: () => removeColumn(index), children: _jsx(IconX, { size: 14 }) })] }) }, index))), _jsx("th", { className: "p-1 align-top", children: _jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": "Add column", className: iconButtonClass, disabled: !editable, onClick: addColumn, children: _jsx(IconColumnInsertRight, { size: 16 }) }) })] }) }), _jsx("tbody", { children: rows.map((row, rowIndex) => (_jsxs("tr", { children: [Array.from({ length: columnCount }).map((_, cellIndex) => (_jsx("td", { className: "p-1 align-top", children: _jsx("input", { type: "text", "data-plan-interactive": true, "aria-label": `Row ${rowIndex + 1}, column ${cellIndex + 1}`, className: editInputClass, value: row[cellIndex] ?? "", disabled: !editable, onChange: (event) => setCell(rowIndex, cellIndex, event.target.value) }) }, cellIndex))), _jsx("td", { className: "p-1 align-top", children: _jsx("button", { type: "button", "data-plan-interactive": true, "aria-label": `Remove row ${rowIndex + 1}`, className: iconButtonClass, disabled: !editable, onClick: () => removeRow(rowIndex), children: _jsx(IconTrash, { size: 14 }) }) })] }, rowIndex))) })] }) }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", "data-plan-interactive": true, className: addButtonClass, disabled: !editable, onClick: addRow, children: [_jsx(IconRowInsertBottom, { size: 16 }), "Add row"] }), _jsxs("button", { type: "button", "data-plan-interactive": true, className: addButtonClass, disabled: !editable, onClick: addColumn, children: [_jsx(IconPlus, { size: 16 }), "Add column"] })] })] }));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The full standard `table` `BlockSpec`. Pairs the React-free
|
|
86
|
+
* {@link tableSchema}/{@link tableMdx} config (also used by the server registry)
|
|
87
|
+
* with the React `Read`/`Edit`. `empty()` seeds a 2×2 grid for slash insertion.
|
|
88
|
+
*/
|
|
89
|
+
export const tableBlock = defineBlock({
|
|
90
|
+
type: "table",
|
|
91
|
+
schema: tableSchema,
|
|
92
|
+
mdx: tableMdx,
|
|
93
|
+
Read: TableBlockRead,
|
|
94
|
+
Edit: TableBlockEdit,
|
|
95
|
+
placement: ["block"],
|
|
96
|
+
// A simple grid maps to an NFM table, so it round-trips to Notion.
|
|
97
|
+
notionCompatible: true,
|
|
98
|
+
label: "Table",
|
|
99
|
+
icon: ({ size, className }) => (_jsx(IconTable, { size: size, className: className })),
|
|
100
|
+
description: "A simple grid with header columns and string rows for comparisons, parameters, or structured lists.",
|
|
101
|
+
empty: () => ({
|
|
102
|
+
columns: ["Column 1", "Column 2"],
|
|
103
|
+
rows: [
|
|
104
|
+
["", ""],
|
|
105
|
+
["", ""],
|
|
106
|
+
],
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAA6B;IACzE,OAAO,CACL,mBAAS,SAAS,EAAC,4BAA4B,mBAAgB,OAAO,aACnE,KAAK,IAAI,cAAK,SAAS,EAAC,kBAAkB,YAAE,KAAK,GAAO,EACzD,iBAAO,SAAS,EAAC,gDAAgD,aAC/D,0BACE,aAAI,SAAS,EAAC,mDAAmD,YAC9D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,aAAiB,SAAS,EAAC,yBAAyB,YACjD,MAAM,IADA,MAAM,CAEV,CACN,CAAC,GACC,GACC,EACR,0BACG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7B,aAAgB,SAAS,EAAC,2BAA2B,YAClD,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAC5B,aAAoB,SAAS,EAAC,2BAA2B,YACtD,IAAI,IADE,SAAS,CAEb,CACN,CAAC,IALK,KAAK,CAMT,CACN,CAAC,GACI,IACF,IACA,CACX,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAClB,kQAAkQ,CAAC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AC;IACpB,mEAAmE;IACnE,gBAAgB,EAAE,IAAI;IACtB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAC7B,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,CAChD;IACD,WAAW,EACT,qGAAqG;IACvG,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QACZ,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;QACjC,IAAI,EAAE;YACJ,CAAC,EAAE,EAAE,EAAE,CAAC;YACR,CAAC,EAAE,EAAE,EAAE,CAAC;SACT;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n IconColumnInsertRight,\n IconPlus,\n IconRowInsertBottom,\n IconTable,\n IconTrash,\n IconX,\n} from \"@tabler/icons-react\";\nimport { defineBlock } from \"../types.js\";\nimport type { BlockEditProps, BlockReadProps } from \"../types.js\";\nimport { tableMdx, tableSchema, type TableData } from \"./table.config.js\";\n\n/**\n * Standard `table` block — a simple grid of header columns and string rows.\n * STANDARD library block: lives in core (`@agent-native/core/blocks`) so any\n * app can register it. The plan app's registries (server + client) import\n * {@link tableBlock} (browser) and the React-free {@link tableMdx}/\n * {@link tableSchema} config (server) so its render + MDX round-trip move out\n * of the plan `PlanBlockView` switch / `serializeBlock` into the registry,\n * while the legacy branch stays as a backward-compatible fallback for\n * unregistered renderers.\n */\n\n/**\n * Read-only renderer. Mirrors the legacy plan `PlanBlockView` table branch\n * markup byte-for-byte (same `plan-block overflow-x-auto` section + title +\n * `plan-line`/`plan-muted` table) so converting the block to the registry does\n * not change the rendered output. The `plan-*` class names are styled by the\n * consuming app's CSS — core only emits the markup, exactly like the existing\n * `CalloutBlock` read renderer.\n */\nfunction TableBlockRead({ data, blockId, title }: BlockReadProps<TableData>) {\n return (\n <section className=\"plan-block overflow-x-auto\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <table className=\"w-full min-w-[640px] border-collapse text-left\">\n <thead>\n <tr className=\"border-b border-plan-line text-sm text-plan-muted\">\n {data.columns.map((column) => (\n <th key={column} className=\"py-3 pr-4 font-semibold\">\n {column}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.rows.map((row, index) => (\n <tr key={index} className=\"border-b border-plan-line\">\n {row.map((cell, cellIndex) => (\n <td key={cellIndex} className=\"py-4 pr-4 text-plan-muted\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </section>\n );\n}\n\nconst editInputClass =\n \"h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50\";\n\nconst iconButtonClass =\n \"inline-flex size-7 items-center justify-center rounded-md border border-input text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\";\n\nconst addButtonClass =\n \"inline-flex items-center gap-1.5 rounded-md border border-input bg-transparent px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\";\n\n/**\n * Editable grid. The schema's `columns: string[]` / `rows: string[][]` are\n * positional/structured, which the schema auto-editor intentionally cannot\n * render, so this block supplies its own `Edit`: an editable header row plus a\n * body grid, with add/remove controls for both columns and rows. Every change\n * commits a full new `{ columns, rows }` value (re-validated upstream by the\n * registry), keeping rows rectangular with the column count.\n */\nfunction TableBlockEdit({\n data,\n onChange,\n editable,\n}: BlockEditProps<TableData>) {\n const columns = data.columns ?? [];\n const rows = data.rows ?? [];\n const columnCount = columns.length;\n\n const commit = (next: TableData) => onChange(next);\n\n const setColumn = (index: number, value: string) => {\n commit({\n columns: columns.map((c, i) => (i === index ? value : c)),\n rows,\n });\n };\n\n const setCell = (rowIndex: number, cellIndex: number, value: string) => {\n commit({\n columns,\n rows: rows.map((row, i) =>\n i === rowIndex\n ? row.map((cell, j) => (j === cellIndex ? value : cell))\n : row,\n ),\n });\n };\n\n const addColumn = () => {\n commit({\n columns: [...columns, `Column ${columnCount + 1}`],\n // Keep rows rectangular: append an empty cell to every row.\n rows: rows.map((row) => [...row, \"\"]),\n });\n };\n\n const removeColumn = (index: number) => {\n commit({\n columns: columns.filter((_, i) => i !== index),\n rows: rows.map((row) => row.filter((_, i) => i !== index)),\n });\n };\n\n const addRow = () => {\n commit({\n columns,\n // New row matches the current column count.\n rows: [\n ...rows,\n Array.from({ length: Math.max(columnCount, 1) }, () => \"\"),\n ],\n });\n };\n\n const removeRow = (index: number) => {\n commit({ columns, rows: rows.filter((_, i) => i !== index) });\n };\n\n return (\n <div className=\"an-table-block-editor flex flex-col gap-3\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full min-w-[480px] border-collapse text-left\">\n <thead>\n <tr>\n {columns.map((column, index) => (\n <th key={index} className=\"p-1 align-top\">\n <div className=\"flex items-center gap-1\">\n <input\n type=\"text\"\n data-plan-interactive\n aria-label={`Column ${index + 1} header`}\n className={editInputClass}\n value={column}\n disabled={!editable}\n onChange={(event) => setColumn(index, event.target.value)}\n />\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Remove column ${index + 1}`}\n className={iconButtonClass}\n disabled={!editable}\n onClick={() => removeColumn(index)}\n >\n <IconX size={14} />\n </button>\n </div>\n </th>\n ))}\n <th className=\"p-1 align-top\">\n <button\n type=\"button\"\n data-plan-interactive\n aria-label=\"Add column\"\n className={iconButtonClass}\n disabled={!editable}\n onClick={addColumn}\n >\n <IconColumnInsertRight size={16} />\n </button>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {Array.from({ length: columnCount }).map((_, cellIndex) => (\n <td key={cellIndex} className=\"p-1 align-top\">\n <input\n type=\"text\"\n data-plan-interactive\n aria-label={`Row ${rowIndex + 1}, column ${cellIndex + 1}`}\n className={editInputClass}\n value={row[cellIndex] ?? \"\"}\n disabled={!editable}\n onChange={(event) =>\n setCell(rowIndex, cellIndex, event.target.value)\n }\n />\n </td>\n ))}\n <td className=\"p-1 align-top\">\n <button\n type=\"button\"\n data-plan-interactive\n aria-label={`Remove row ${rowIndex + 1}`}\n className={iconButtonClass}\n disabled={!editable}\n onClick={() => removeRow(rowIndex)}\n >\n <IconTrash size={14} />\n </button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n data-plan-interactive\n className={addButtonClass}\n disabled={!editable}\n onClick={addRow}\n >\n <IconRowInsertBottom size={16} />\n Add row\n </button>\n <button\n type=\"button\"\n data-plan-interactive\n className={addButtonClass}\n disabled={!editable}\n onClick={addColumn}\n >\n <IconPlus size={16} />\n Add column\n </button>\n </div>\n </div>\n );\n}\n\n/**\n * The full standard `table` `BlockSpec`. Pairs the React-free\n * {@link tableSchema}/{@link tableMdx} config (also used by the server registry)\n * with the React `Read`/`Edit`. `empty()` seeds a 2×2 grid for slash insertion.\n */\nexport const tableBlock = defineBlock<TableData>({\n type: \"table\",\n schema: tableSchema,\n mdx: tableMdx,\n Read: TableBlockRead,\n Edit: TableBlockEdit,\n placement: [\"block\"],\n // A simple grid maps to an NFM table, so it round-trips to Notion.\n notionCompatible: true,\n label: \"Table\",\n icon: ({ size, className }) => (\n <IconTable size={size} className={className} />\n ),\n description:\n \"A simple grid with header columns and string rows for comparisons, parameters, or structured lists.\",\n empty: () => ({\n columns: [\"Column 1\", \"Column 2\"],\n rows: [\n [\"\", \"\"],\n [\"\", \"\"],\n ],\n }),\n});\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
import type { NestedBlock } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Pure (React-free) part of the standard `tabs` block: its data schema and MDX
|
|
6
|
+
* round-trip config. Shared by the server MDX adapter (a plan/content app
|
|
7
|
+
* registers it via `@agent-native/core/blocks/server`) and the full client spec
|
|
8
|
+
* (`tabs.tsx`). Keeping this React-free means importing it into a server module
|
|
9
|
+
* never pulls React into the Nitro/SSR bundle.
|
|
10
|
+
*
|
|
11
|
+
* `tabs` is a STANDARD library block: a horizontal pill-tab container where each
|
|
12
|
+
* tab holds a list of child blocks. The children are rendered RECURSIVELY
|
|
13
|
+
* through the app's own block dispatcher (`ctx.renderBlock`), so registered
|
|
14
|
+
* children render via their spec and unconverted children still fall through the
|
|
15
|
+
* app's legacy switch — the coexistence seam.
|
|
16
|
+
*
|
|
17
|
+
* Its schema MUST stay data-compatible with the legacy plan `tabs` branch of
|
|
18
|
+
* `planBlockSchema` (`tabs[]` of `{ id, label, blocks: Block[] }`), and the MDX
|
|
19
|
+
* `tag` + attribute shape MUST match the legacy
|
|
20
|
+
* `<TabsBlock … tabs={[…]} />` encoding — the WHOLE `tabs` array (including
|
|
21
|
+
* nested child blocks) encoded as one JSON prop, NOT nested MDX
|
|
22
|
+
* (`plan-mdx.ts` `serializeBlock` L349 / `parseBlock` L705) — so stored `.mdx`
|
|
23
|
+
* round-trips byte-compatibly.
|
|
24
|
+
*/
|
|
25
|
+
/** One tab: a label and the child blocks it contains. */
|
|
26
|
+
export interface TabsTab {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
/**
|
|
30
|
+
* Child blocks. Typed loosely as {@link NestedBlock} because the app owns the
|
|
31
|
+
* authoritative recursive block union (`planBlockSchema`); the tabs spec only
|
|
32
|
+
* validates the tab envelope (`id`/`label`) and passes children through.
|
|
33
|
+
*/
|
|
34
|
+
blocks: NestedBlock[];
|
|
35
|
+
}
|
|
36
|
+
export interface TabsData {
|
|
37
|
+
tabs: TabsTab[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Child blocks are validated by the app's own recursive `planBlockSchema` when
|
|
41
|
+
* the plan persists; here they pass through untyped (`z.any()`) so core never
|
|
42
|
+
* needs to import an app-specific block union. The tab envelope (`id`/`label`)
|
|
43
|
+
* mirrors the plan tabs schema bounds (`plan-content.ts` L1051) exactly.
|
|
44
|
+
*/
|
|
45
|
+
export declare const tabsSchema: z.ZodType<TabsData>;
|
|
46
|
+
/**
|
|
47
|
+
* MDX config: `tabs` is a single JSON-encoded attribute and the block is
|
|
48
|
+
* self-closing — exactly the legacy `<TabsBlock id … tabs={[…]} />` form. The
|
|
49
|
+
* entire `tabs` array (labels + nested child blocks) is one JSON prop; child
|
|
50
|
+
* blocks are NOT serialized as nested MDX, which preserves the current byte
|
|
51
|
+
* output. `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array
|
|
52
|
+
* (defaulting to `[]` for backward-compat with malformed/empty stored blocks,
|
|
53
|
+
* mirroring the legacy `arrayAttr(node, "tabs") ?? []`).
|
|
54
|
+
*/
|
|
55
|
+
export declare const tabsMdx: BlockMdxConfig<TabsData>;
|
|
56
|
+
//# sourceMappingURL=tabs.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/tabs.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,yDAAyD;AACzD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAKD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAWN,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,QAAQ,CAM5C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Matches the plan `idSchema` (`z.string().trim().min(1).max(120)`). */
|
|
3
|
+
const tabIdSchema = z.string().trim().min(1).max(120);
|
|
4
|
+
/**
|
|
5
|
+
* Child blocks are validated by the app's own recursive `planBlockSchema` when
|
|
6
|
+
* the plan persists; here they pass through untyped (`z.any()`) so core never
|
|
7
|
+
* needs to import an app-specific block union. The tab envelope (`id`/`label`)
|
|
8
|
+
* mirrors the plan tabs schema bounds (`plan-content.ts` L1051) exactly.
|
|
9
|
+
*/
|
|
10
|
+
export const tabsSchema = z.object({
|
|
11
|
+
tabs: z
|
|
12
|
+
.array(z.object({
|
|
13
|
+
id: tabIdSchema,
|
|
14
|
+
label: z.string().trim().min(1).max(120),
|
|
15
|
+
blocks: z.array(z.any()).max(40),
|
|
16
|
+
}))
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(12),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* MDX config: `tabs` is a single JSON-encoded attribute and the block is
|
|
22
|
+
* self-closing — exactly the legacy `<TabsBlock id … tabs={[…]} />` form. The
|
|
23
|
+
* entire `tabs` array (labels + nested child blocks) is one JSON prop; child
|
|
24
|
+
* blocks are NOT serialized as nested MDX, which preserves the current byte
|
|
25
|
+
* output. `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array
|
|
26
|
+
* (defaulting to `[]` for backward-compat with malformed/empty stored blocks,
|
|
27
|
+
* mirroring the legacy `arrayAttr(node, "tabs") ?? []`).
|
|
28
|
+
*/
|
|
29
|
+
export const tabsMdx = {
|
|
30
|
+
tag: "TabsBlock",
|
|
31
|
+
toAttrs: (data) => ({ tabs: data.tabs }),
|
|
32
|
+
fromAttrs: (attrs) => ({
|
|
33
|
+
tabs: (attrs.array("tabs") ?? []),
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=tabs.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/tabs.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0CxB,yEAAyE;AACzE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC;SACJ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;QACxC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;KACjC,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;CACX,CAAmC,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAA6B;IAC/C,GAAG,EAAE,WAAW;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACxC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAU,MAAM,CAAC,IAAI,EAAE,CAAc;KACxD,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\nimport type { NestedBlock } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the standard `tabs` block: its data schema and MDX\n * round-trip config. Shared by the server MDX adapter (a plan/content app\n * registers it via `@agent-native/core/blocks/server`) and the full client spec\n * (`tabs.tsx`). Keeping this React-free means importing it into a server module\n * never pulls React into the Nitro/SSR bundle.\n *\n * `tabs` is a STANDARD library block: a horizontal pill-tab container where each\n * tab holds a list of child blocks. The children are rendered RECURSIVELY\n * through the app's own block dispatcher (`ctx.renderBlock`), so registered\n * children render via their spec and unconverted children still fall through the\n * app's legacy switch — the coexistence seam.\n *\n * Its schema MUST stay data-compatible with the legacy plan `tabs` branch of\n * `planBlockSchema` (`tabs[]` of `{ id, label, blocks: Block[] }`), and the MDX\n * `tag` + attribute shape MUST match the legacy\n * `<TabsBlock … tabs={[…]} />` encoding — the WHOLE `tabs` array (including\n * nested child blocks) encoded as one JSON prop, NOT nested MDX\n * (`plan-mdx.ts` `serializeBlock` L349 / `parseBlock` L705) — so stored `.mdx`\n * round-trips byte-compatibly.\n */\n\n/** One tab: a label and the child blocks it contains. */\nexport interface TabsTab {\n id: string;\n label: string;\n /**\n * Child blocks. Typed loosely as {@link NestedBlock} because the app owns the\n * authoritative recursive block union (`planBlockSchema`); the tabs spec only\n * validates the tab envelope (`id`/`label`) and passes children through.\n */\n blocks: NestedBlock[];\n}\n\nexport interface TabsData {\n tabs: TabsTab[];\n}\n\n/** Matches the plan `idSchema` (`z.string().trim().min(1).max(120)`). */\nconst tabIdSchema = z.string().trim().min(1).max(120);\n\n/**\n * Child blocks are validated by the app's own recursive `planBlockSchema` when\n * the plan persists; here they pass through untyped (`z.any()`) so core never\n * needs to import an app-specific block union. The tab envelope (`id`/`label`)\n * mirrors the plan tabs schema bounds (`plan-content.ts` L1051) exactly.\n */\nexport const tabsSchema = z.object({\n tabs: z\n .array(\n z.object({\n id: tabIdSchema,\n label: z.string().trim().min(1).max(120),\n blocks: z.array(z.any()).max(40),\n }),\n )\n .min(1)\n .max(12),\n}) as unknown as z.ZodType<TabsData>;\n\n/**\n * MDX config: `tabs` is a single JSON-encoded attribute and the block is\n * self-closing — exactly the legacy `<TabsBlock id … tabs={[…]} />` form. The\n * entire `tabs` array (labels + nested child blocks) is one JSON prop; child\n * blocks are NOT serialized as nested MDX, which preserves the current byte\n * output. `toAttrs` returns only `tabs`; `fromAttrs` reads the `tabs` array\n * (defaulting to `[]` for backward-compat with malformed/empty stored blocks,\n * mirroring the legacy `arrayAttr(node, \"tabs\") ?? []`).\n */\nexport const tabsMdx: BlockMdxConfig<TabsData> = {\n tag: \"TabsBlock\",\n toAttrs: (data) => ({ tabs: data.tabs }),\n fromAttrs: (attrs) => ({\n tabs: (attrs.array<TabsTab>(\"tabs\") ?? []) as TabsTab[],\n }),\n};\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BlockReadProps, BlockEditProps } from "../types.js";
|
|
2
|
+
import { type TabsData } from "./tabs.config.js";
|
|
3
|
+
/** Read renderer: pill tabs, child blocks rendered read-only via the app. */
|
|
4
|
+
export declare function TabsBlockReader({ data, blockId, title, ctx, }: BlockReadProps<TabsData>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Editor: pill tabs plus tab management (add/remove/rename), with child blocks
|
|
7
|
+
* rendered editable in place through the app dispatcher. A child change updates
|
|
8
|
+
* that child within its tab and commits the whole tabs block — mirroring the
|
|
9
|
+
* legacy `TabsBlock` onChange bubbling so the plan's recursive `updateBlocks`/
|
|
10
|
+
* `findBlock` (`PlanContentRenderer`) keeps working unchanged.
|
|
11
|
+
*/
|
|
12
|
+
export declare function TabsBlockEditor({ data, onChange, editable, blockId, title, ctx, }: BlockEditProps<TabsData>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The standard tabs block spec (with React `Read`/`Edit`). Apps register this in
|
|
15
|
+
* their browser registry. The schema + MDX config come from `./tabs.config.ts`,
|
|
16
|
+
* the exact same object server / agent code registers, so rendering and source
|
|
17
|
+
* round-trip never drift.
|
|
18
|
+
*/
|
|
19
|
+
export declare const tabsBlock: import("../types.js").BlockSpec<TabsData>;
|
|
20
|
+
//# sourceMappingURL=tabs.d.ts.map
|