@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,49 @@
|
|
|
1
|
+
import type { ComponentProps, InputHTMLAttributes, LabelHTMLAttributes, ReactNode, TextareaHTMLAttributes } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal, app-agnostic form primitives for the core "dev-doc" block library
|
|
4
|
+
* (mermaid / api-endpoint / data-model / diff / file-tree / json-explorer /
|
|
5
|
+
* annotated-code). These blocks previously imported the plan app's shadcn/ui
|
|
6
|
+
* components (`@/components/ui/*`); core blocks must stay portable, so these are
|
|
7
|
+
* plain styled elements that reproduce the SAME shadcn Tailwind classes byte-for
|
|
8
|
+
* -byte. They resolve against whatever shadcn token theme (`border-input`,
|
|
9
|
+
* `bg-background`, `ring-ring`, …) the host app ships, so the rendered look is
|
|
10
|
+
* unchanged across apps.
|
|
11
|
+
*
|
|
12
|
+
* The Select is intentionally a NATIVE `<select>` styled to match the shadcn
|
|
13
|
+
* trigger rather than a Radix popover: it keeps core dependency-free and behaves
|
|
14
|
+
* identically for the simple enum pickers these editors use (method, change,
|
|
15
|
+
* param location, diff mode).
|
|
16
|
+
*/
|
|
17
|
+
export declare const DevInput: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
|
|
18
|
+
export declare const DevLabel: import("react").ForwardRefExoticComponent<LabelHTMLAttributes<HTMLLabelElement> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
19
|
+
export declare const DevTextarea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
20
|
+
/** Only the `outline` badge variant is used by these blocks. */
|
|
21
|
+
export declare function DevBadge({ className, ...props }: ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* A native-checkbox toggle styled to read like the shadcn Switch. `onCheckedChange`
|
|
24
|
+
* mirrors the shadcn/Radix API so call sites stay identical.
|
|
25
|
+
*/
|
|
26
|
+
export declare function DevSwitch({ checked, onCheckedChange, disabled, className, ...props }: {
|
|
27
|
+
checked: boolean;
|
|
28
|
+
onCheckedChange: (checked: boolean) => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
} & Omit<InputHTMLAttributes<HTMLButtonElement>, "onChange" | "checked" | "type">): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export interface DevSelectOption {
|
|
33
|
+
value: string;
|
|
34
|
+
label: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A native `<select>` styled to match the shadcn SelectTrigger. Drop-in for the
|
|
38
|
+
* simple enum pickers the dev-doc editors use. `onValueChange` mirrors the shadcn
|
|
39
|
+
* API. The chevron is positioned over the native control.
|
|
40
|
+
*/
|
|
41
|
+
export declare function DevSelect({ value, onValueChange, options, disabled, className, "aria-label": ariaLabel, }: {
|
|
42
|
+
value: string;
|
|
43
|
+
onValueChange: (value: string) => void;
|
|
44
|
+
options: DevSelectOption[];
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
className?: string;
|
|
47
|
+
"aria-label"?: string;
|
|
48
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
//# sourceMappingURL=dev-doc-ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-doc-ui.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/dev-doc-ui.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,sBAAsB,EACvB,MAAM,OAAO,CAAC;AAIf;;;;;;;;;;;;;;GAcG;AAIH,eAAO,MAAM,QAAQ,oIAanB,CAAC;AAKH,eAAO,MAAM,QAAQ,oIAYnB,CAAC;AAKH,eAAO,MAAM,WAAW,6IAYtB,CAAC;AAKH,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,2CAUvE;AAID;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CACN,mBAAmB,CAAC,iBAAiB,CAAC,EACtC,UAAU,GAAG,SAAS,GAAG,MAAM,CAChC,2CAwBA;AAID,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EAAE,SAAS,GACxB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,2CAsBA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { IconChevronDown } from "@tabler/icons-react";
|
|
4
|
+
import { cn } from "../../utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Minimal, app-agnostic form primitives for the core "dev-doc" block library
|
|
7
|
+
* (mermaid / api-endpoint / data-model / diff / file-tree / json-explorer /
|
|
8
|
+
* annotated-code). These blocks previously imported the plan app's shadcn/ui
|
|
9
|
+
* components (`@/components/ui/*`); core blocks must stay portable, so these are
|
|
10
|
+
* plain styled elements that reproduce the SAME shadcn Tailwind classes byte-for
|
|
11
|
+
* -byte. They resolve against whatever shadcn token theme (`border-input`,
|
|
12
|
+
* `bg-background`, `ring-ring`, …) the host app ships, so the rendered look is
|
|
13
|
+
* unchanged across apps.
|
|
14
|
+
*
|
|
15
|
+
* The Select is intentionally a NATIVE `<select>` styled to match the shadcn
|
|
16
|
+
* trigger rather than a Radix popover: it keeps core dependency-free and behaves
|
|
17
|
+
* identically for the simple enum pickers these editors use (method, change,
|
|
18
|
+
* param location, diff mode).
|
|
19
|
+
*/
|
|
20
|
+
/* ── Input ─────────────────────────────────────────────────────────────────── */
|
|
21
|
+
export const DevInput = forwardRef(({ className, type, ...props }, ref) => (_jsx("input", { ref: ref, type: type, className: cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className), ...props })));
|
|
22
|
+
DevInput.displayName = "DevInput";
|
|
23
|
+
/* ── Label ─────────────────────────────────────────────────────────────────── */
|
|
24
|
+
export const DevLabel = forwardRef(({ className, ...props }, ref) => (_jsx("label", { ref: ref, className: cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className), ...props })));
|
|
25
|
+
DevLabel.displayName = "DevLabel";
|
|
26
|
+
/* ── Textarea ──────────────────────────────────────────────────────────────── */
|
|
27
|
+
export const DevTextarea = forwardRef(({ className, ...props }, ref) => (_jsx("textarea", { ref: ref, className: cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ...props })));
|
|
28
|
+
DevTextarea.displayName = "DevTextarea";
|
|
29
|
+
/* ── Badge ─────────────────────────────────────────────────────────────────── */
|
|
30
|
+
/** Only the `outline` badge variant is used by these blocks. */
|
|
31
|
+
export function DevBadge({ className, ...props }) {
|
|
32
|
+
return (_jsx("span", { className: cn("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
/* ── Switch ────────────────────────────────────────────────────────────────── */
|
|
35
|
+
/**
|
|
36
|
+
* A native-checkbox toggle styled to read like the shadcn Switch. `onCheckedChange`
|
|
37
|
+
* mirrors the shadcn/Radix API so call sites stay identical.
|
|
38
|
+
*/
|
|
39
|
+
export function DevSwitch({ checked, onCheckedChange, disabled, className, ...props }) {
|
|
40
|
+
return (_jsx("button", { type: "button", role: "switch", "aria-checked": checked, disabled: disabled, "data-plan-interactive": true, onClick: () => onCheckedChange(!checked), className: cn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", checked ? "bg-primary" : "bg-input", className), ...props, children: _jsx("span", { className: cn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform", checked ? "translate-x-5" : "translate-x-0") }) }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A native `<select>` styled to match the shadcn SelectTrigger. Drop-in for the
|
|
44
|
+
* simple enum pickers the dev-doc editors use. `onValueChange` mirrors the shadcn
|
|
45
|
+
* API. The chevron is positioned over the native control.
|
|
46
|
+
*/
|
|
47
|
+
export function DevSelect({ value, onValueChange, options, disabled, className, "aria-label": ariaLabel, }) {
|
|
48
|
+
return (_jsxs("div", { className: cn("relative", className), children: [_jsx("select", { value: value, disabled: disabled, "aria-label": ariaLabel, "data-plan-interactive": true, onChange: (event) => onValueChange(event.target.value), className: cn("flex h-10 w-full appearance-none items-center justify-between rounded-md border border-input bg-background px-3 py-2 pr-8 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"), children: options.map((option) => (_jsx("option", { value: option.value, children: typeof option.label === "string" ? option.label : option.value }, option.value))) }), _jsx(IconChevronDown, { className: "pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 opacity-50" })] }));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=dev-doc-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-doc-ui.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/dev-doc-ui.tsx"],"names":[],"mappings":"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","sourcesContent":["import { forwardRef } from \"react\";\nimport type {\n ComponentProps,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n ReactNode,\n TextareaHTMLAttributes,\n} from \"react\";\nimport { IconChevronDown } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils.js\";\n\n/**\n * Minimal, app-agnostic form primitives for the core \"dev-doc\" block library\n * (mermaid / api-endpoint / data-model / diff / file-tree / json-explorer /\n * annotated-code). These blocks previously imported the plan app's shadcn/ui\n * components (`@/components/ui/*`); core blocks must stay portable, so these are\n * plain styled elements that reproduce the SAME shadcn Tailwind classes byte-for\n * -byte. They resolve against whatever shadcn token theme (`border-input`,\n * `bg-background`, `ring-ring`, …) the host app ships, so the rendered look is\n * unchanged across apps.\n *\n * The Select is intentionally a NATIVE `<select>` styled to match the shadcn\n * trigger rather than a Radix popover: it keeps core dependency-free and behaves\n * identically for the simple enum pickers these editors use (method, change,\n * param location, diff mode).\n */\n\n/* ── Input ─────────────────────────────────────────────────────────────────── */\n\nexport const DevInput = forwardRef<\n HTMLInputElement,\n InputHTMLAttributes<HTMLInputElement>\n>(({ className, type, ...props }, ref) => (\n <input\n ref={ref}\n type={type}\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n className,\n )}\n {...props}\n />\n));\nDevInput.displayName = \"DevInput\";\n\n/* ── Label ─────────────────────────────────────────────────────────────────── */\n\nexport const DevLabel = forwardRef<\n HTMLLabelElement,\n LabelHTMLAttributes<HTMLLabelElement>\n>(({ className, ...props }, ref) => (\n <label\n ref={ref}\n className={cn(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n className,\n )}\n {...props}\n />\n));\nDevLabel.displayName = \"DevLabel\";\n\n/* ── Textarea ──────────────────────────────────────────────────────────────── */\n\nexport const DevTextarea = forwardRef<\n HTMLTextAreaElement,\n TextareaHTMLAttributes<HTMLTextAreaElement>\n>(({ className, ...props }, ref) => (\n <textarea\n ref={ref}\n className={cn(\n \"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n));\nDevTextarea.displayName = \"DevTextarea\";\n\n/* ── Badge ─────────────────────────────────────────────────────────────────── */\n\n/** Only the `outline` badge variant is used by these blocks. */\nexport function DevBadge({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ── Switch ────────────────────────────────────────────────────────────────── */\n\n/**\n * A native-checkbox toggle styled to read like the shadcn Switch. `onCheckedChange`\n * mirrors the shadcn/Radix API so call sites stay identical.\n */\nexport function DevSwitch({\n checked,\n onCheckedChange,\n disabled,\n className,\n ...props\n}: {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n disabled?: boolean;\n className?: string;\n} & Omit<\n InputHTMLAttributes<HTMLButtonElement>,\n \"onChange\" | \"checked\" | \"type\"\n>) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n disabled={disabled}\n data-plan-interactive\n onClick={() => onCheckedChange(!checked)}\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n checked ? \"bg-primary\" : \"bg-input\",\n className,\n )}\n {...(props as Record<string, unknown>)}\n >\n <span\n className={cn(\n \"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform\",\n checked ? \"translate-x-5\" : \"translate-x-0\",\n )}\n />\n </button>\n );\n}\n\n/* ── Select (native, shadcn-trigger styled) ────────────────────────────────── */\n\nexport interface DevSelectOption {\n value: string;\n label: ReactNode;\n}\n\n/**\n * A native `<select>` styled to match the shadcn SelectTrigger. Drop-in for the\n * simple enum pickers the dev-doc editors use. `onValueChange` mirrors the shadcn\n * API. The chevron is positioned over the native control.\n */\nexport function DevSelect({\n value,\n onValueChange,\n options,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n}: {\n value: string;\n onValueChange: (value: string) => void;\n options: DevSelectOption[];\n disabled?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}) {\n return (\n <div className={cn(\"relative\", className)}>\n <select\n value={value}\n disabled={disabled}\n aria-label={ariaLabel}\n data-plan-interactive\n onChange={(event) => onValueChange(event.target.value)}\n className={cn(\n \"flex h-10 w-full appearance-none items-center justify-between rounded-md border border-input bg-background px-3 py-2 pr-8 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n )}\n >\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {typeof option.label === \"string\" ? option.label : option.value}\n </option>\n ))}\n </select>\n <IconChevronDown className=\"pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 opacity-50\" />\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the PLAN-SPECIFIC diff block: its data schema and MDX
|
|
5
|
+
* round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via
|
|
6
|
+
* `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this
|
|
7
|
+
* React-free means importing it into a server module never pulls React (or the
|
|
8
|
+
* `diff` line-differ used only by the renderer) into the Nitro/SSR bundle.
|
|
9
|
+
*
|
|
10
|
+
* The schema MUST stay data-compatible with the `diff` branch of `planBlockSchema`
|
|
11
|
+
* (`plan-content.ts`), and the MDX `tag` + flat attribute shape MUST match the
|
|
12
|
+
* `<Diff filename language mode before after />` self-closing encoding so stored
|
|
13
|
+
* `.mdx` round-trips. The `before`/`after` source lives in ATTRIBUTES (not MDX
|
|
14
|
+
* children) — the shared `prop()` encoder round-trips multiline strings cleanly,
|
|
15
|
+
* and keeping them attributes avoids the code being reflowed as prose.
|
|
16
|
+
*/
|
|
17
|
+
/** Rendering layout for the diff body. */
|
|
18
|
+
export type DiffMode = "unified" | "split";
|
|
19
|
+
export interface DiffData {
|
|
20
|
+
/** Optional file path shown in the header (e.g. `src/add.ts`). */
|
|
21
|
+
filename?: string;
|
|
22
|
+
/** Optional language label rendered as a chip (e.g. `ts`). Purely cosmetic. */
|
|
23
|
+
language?: string;
|
|
24
|
+
/** Original ("before") source. */
|
|
25
|
+
before: string;
|
|
26
|
+
/** New ("after") source. */
|
|
27
|
+
after: string;
|
|
28
|
+
/** Layout: unified (default, one column) or split (side-by-side). */
|
|
29
|
+
mode?: DiffMode;
|
|
30
|
+
}
|
|
31
|
+
export declare const diffSchema: z.ZodType<DiffData>;
|
|
32
|
+
/**
|
|
33
|
+
* MDX config: `filename`, `language`, `mode`, `before`, and `after` are flat
|
|
34
|
+
* attributes — the `<Diff id … filename language mode before after />`
|
|
35
|
+
* self-closing form. Insertion order of `toAttrs` is the on-disk attribute order.
|
|
36
|
+
* `fromAttrs` mirrors a forgiving parse (`before ?? ""`, `after ?? ""`, optional
|
|
37
|
+
* `filename`/`language`/`mode` undefined when absent) so a plan missing an
|
|
38
|
+
* attribute still parses.
|
|
39
|
+
*/
|
|
40
|
+
export declare const diffMdx: BlockMdxConfig<DiffData>;
|
|
41
|
+
//# sourceMappingURL=diff.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,eAAO,MAAM,UAAU,EAMN,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,QAAQ,CAgB5C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const diffSchema = z.object({
|
|
3
|
+
filename: z.string().trim().max(400).optional(),
|
|
4
|
+
language: z.string().trim().max(40).optional(),
|
|
5
|
+
before: z.string().max(100_000),
|
|
6
|
+
after: z.string().max(100_000),
|
|
7
|
+
mode: z.enum(["unified", "split"]).optional(),
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* MDX config: `filename`, `language`, `mode`, `before`, and `after` are flat
|
|
11
|
+
* attributes — the `<Diff id … filename language mode before after />`
|
|
12
|
+
* self-closing form. Insertion order of `toAttrs` is the on-disk attribute order.
|
|
13
|
+
* `fromAttrs` mirrors a forgiving parse (`before ?? ""`, `after ?? ""`, optional
|
|
14
|
+
* `filename`/`language`/`mode` undefined when absent) so a plan missing an
|
|
15
|
+
* attribute still parses.
|
|
16
|
+
*/
|
|
17
|
+
export const diffMdx = {
|
|
18
|
+
tag: "Diff",
|
|
19
|
+
toAttrs: (data) => ({
|
|
20
|
+
filename: data.filename,
|
|
21
|
+
language: data.language,
|
|
22
|
+
mode: data.mode,
|
|
23
|
+
before: data.before,
|
|
24
|
+
after: data.after,
|
|
25
|
+
}),
|
|
26
|
+
fromAttrs: (attrs) => ({
|
|
27
|
+
filename: attrs.string("filename"),
|
|
28
|
+
language: attrs.string("language"),
|
|
29
|
+
mode: attrs.string("mode"),
|
|
30
|
+
before: attrs.string("before") ?? "",
|
|
31
|
+
after: attrs.string("after") ?? "",
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=diff.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/diff.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkCxB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC9C,CAAmC,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAA6B;IAC/C,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;IACF,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QAClC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAyB;QAClD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE;QACpC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE;KACnC,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the PLAN-SPECIFIC diff block: its data schema and MDX\n * round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via\n * `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this\n * React-free means importing it into a server module never pulls React (or the\n * `diff` line-differ used only by the renderer) into the Nitro/SSR bundle.\n *\n * The schema MUST stay data-compatible with the `diff` branch of `planBlockSchema`\n * (`plan-content.ts`), and the MDX `tag` + flat attribute shape MUST match the\n * `<Diff filename language mode before after />` self-closing encoding so stored\n * `.mdx` round-trips. The `before`/`after` source lives in ATTRIBUTES (not MDX\n * children) — the shared `prop()` encoder round-trips multiline strings cleanly,\n * and keeping them attributes avoids the code being reflowed as prose.\n */\n\n/** Rendering layout for the diff body. */\nexport type DiffMode = \"unified\" | \"split\";\n\nexport interface DiffData {\n /** Optional file path shown in the header (e.g. `src/add.ts`). */\n filename?: string;\n /** Optional language label rendered as a chip (e.g. `ts`). Purely cosmetic. */\n language?: string;\n /** Original (\"before\") source. */\n before: string;\n /** New (\"after\") source. */\n after: string;\n /** Layout: unified (default, one column) or split (side-by-side). */\n mode?: DiffMode;\n}\n\nexport const diffSchema = z.object({\n filename: z.string().trim().max(400).optional(),\n language: z.string().trim().max(40).optional(),\n before: z.string().max(100_000),\n after: z.string().max(100_000),\n mode: z.enum([\"unified\", \"split\"]).optional(),\n}) as unknown as z.ZodType<DiffData>;\n\n/**\n * MDX config: `filename`, `language`, `mode`, `before`, and `after` are flat\n * attributes — the `<Diff id … filename language mode before after />`\n * self-closing form. Insertion order of `toAttrs` is the on-disk attribute order.\n * `fromAttrs` mirrors a forgiving parse (`before ?? \"\"`, `after ?? \"\"`, optional\n * `filename`/`language`/`mode` undefined when absent) so a plan missing an\n * attribute still parses.\n */\nexport const diffMdx: BlockMdxConfig<DiffData> = {\n tag: \"Diff\",\n toAttrs: (data) => ({\n filename: data.filename,\n language: data.language,\n mode: data.mode,\n before: data.before,\n after: data.after,\n }),\n fromAttrs: (attrs) => ({\n filename: attrs.string(\"filename\"),\n language: attrs.string(\"language\"),\n mode: attrs.string(\"mode\") as DiffMode | undefined,\n before: attrs.string(\"before\") ?? \"\",\n after: attrs.string(\"after\") ?? \"\",\n }),\n};\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the PLAN-SPECIFIC `file-tree` block: its data schema
|
|
5
|
+
* and MDX round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via
|
|
6
|
+
* `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this
|
|
7
|
+
* React-free means importing it into a server module never pulls React into the
|
|
8
|
+
* Nitro/SSR bundle.
|
|
9
|
+
*
|
|
10
|
+
* The block renders a VS Code / GitHub-explorer style file/change tree: a flat
|
|
11
|
+
* list of `entries` (each a slash-delimited `path` with an optional change kind,
|
|
12
|
+
* note, and code snippet) from which the RENDERER derives the nested folder tree
|
|
13
|
+
* — the model never carries the folder structure, only the leaf paths. This keeps
|
|
14
|
+
* the data lean and the tree always consistent with the paths.
|
|
15
|
+
*
|
|
16
|
+
* The schema MUST stay data-compatible with the `file-tree` member of
|
|
17
|
+
* `planBlockSchema` (`plan-content.ts`), and the MDX `tag` (`FileTree`) +
|
|
18
|
+
* attribute shape MUST match it so stored `.mdx` round-trips: the whole `entries`
|
|
19
|
+
* array is one JSON prop (`<FileTree id … title entries={…} />`).
|
|
20
|
+
*/
|
|
21
|
+
/** The kind of change applied to a file, driving its change badge. */
|
|
22
|
+
export type FileTreeChange = "added" | "modified" | "removed" | "renamed";
|
|
23
|
+
export declare const FILE_TREE_CHANGES: FileTreeChange[];
|
|
24
|
+
/**
|
|
25
|
+
* One file in the tree. `path` is slash-delimited (`src/routes/git.ts`); the
|
|
26
|
+
* renderer derives the folder structure from its segments. `change` drives the
|
|
27
|
+
* change badge (A/M/D/R); `note` + `snippet` (with optional `language`) make the
|
|
28
|
+
* file row expandable to show why it changes and a code preview.
|
|
29
|
+
*/
|
|
30
|
+
export interface FileTreeEntry {
|
|
31
|
+
path: string;
|
|
32
|
+
change?: FileTreeChange;
|
|
33
|
+
note?: string;
|
|
34
|
+
snippet?: string;
|
|
35
|
+
language?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FileTreeData {
|
|
38
|
+
/** Optional heading shown above the tree (e.g. "Files touched"). */
|
|
39
|
+
title?: string;
|
|
40
|
+
entries: FileTreeEntry[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Data-compatible with the inline `file-tree` member of `planBlockSchema`
|
|
44
|
+
* (`plan-content.ts`). `entries` is required (at least one file); `title` is
|
|
45
|
+
* optional so a fresh tree validates from a couple of files.
|
|
46
|
+
*/
|
|
47
|
+
export declare const fileTreeSchema: z.ZodType<FileTreeData>;
|
|
48
|
+
/**
|
|
49
|
+
* MDX config: `title` is a flat string attribute and the whole `entries` array is
|
|
50
|
+
* serialized as one JSON prop on a self-closing element — the `<FileTree id …
|
|
51
|
+
* title entries={…} />` form. `toAttrs` emits `title` then `entries` in a STABLE
|
|
52
|
+
* order (the shared `prop()` encoder drops `title` when it is undefined).
|
|
53
|
+
*
|
|
54
|
+
* `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing
|
|
55
|
+
* `title` decodes to `undefined` and a missing `entries` decodes to `[]` so a
|
|
56
|
+
* plan written before this block existed still parses.
|
|
57
|
+
*/
|
|
58
|
+
export declare const fileTreeMdx: BlockMdxConfig<FileTreeData>;
|
|
59
|
+
//# sourceMappingURL=file-tree.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/file-tree.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AAEH,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1E,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAK7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAUD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAGV,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,YAAY,CAUpD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const FILE_TREE_CHANGES = [
|
|
3
|
+
"added",
|
|
4
|
+
"modified",
|
|
5
|
+
"removed",
|
|
6
|
+
"renamed",
|
|
7
|
+
];
|
|
8
|
+
const entrySchema = z.object({
|
|
9
|
+
path: z.string().trim().min(1).max(500),
|
|
10
|
+
change: z.enum(["added", "modified", "removed", "renamed"]).optional(),
|
|
11
|
+
note: z.string().trim().max(2_000).optional(),
|
|
12
|
+
snippet: z.string().max(50_000).optional(),
|
|
13
|
+
language: z.string().trim().max(40).optional(),
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Data-compatible with the inline `file-tree` member of `planBlockSchema`
|
|
17
|
+
* (`plan-content.ts`). `entries` is required (at least one file); `title` is
|
|
18
|
+
* optional so a fresh tree validates from a couple of files.
|
|
19
|
+
*/
|
|
20
|
+
export const fileTreeSchema = z.object({
|
|
21
|
+
title: z.string().trim().max(180).optional(),
|
|
22
|
+
entries: z.array(entrySchema).min(1).max(200),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* MDX config: `title` is a flat string attribute and the whole `entries` array is
|
|
26
|
+
* serialized as one JSON prop on a self-closing element — the `<FileTree id …
|
|
27
|
+
* title entries={…} />` form. `toAttrs` emits `title` then `entries` in a STABLE
|
|
28
|
+
* order (the shared `prop()` encoder drops `title` when it is undefined).
|
|
29
|
+
*
|
|
30
|
+
* `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing
|
|
31
|
+
* `title` decodes to `undefined` and a missing `entries` decodes to `[]` so a
|
|
32
|
+
* plan written before this block existed still parses.
|
|
33
|
+
*/
|
|
34
|
+
export const fileTreeMdx = {
|
|
35
|
+
tag: "FileTree",
|
|
36
|
+
toAttrs: (data) => ({
|
|
37
|
+
title: data.title,
|
|
38
|
+
entries: data.entries,
|
|
39
|
+
}),
|
|
40
|
+
fromAttrs: (attrs) => ({
|
|
41
|
+
title: attrs.string("title"),
|
|
42
|
+
entries: attrs.array("entries") ?? [],
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=file-tree.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/file-tree.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD,OAAO;IACP,UAAU;IACV,SAAS;IACT,SAAS;CACV,CAAC;AAsBF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;IAC7C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAA6B,CAAC;AAE/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC5C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CAC9C,CAAuC,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;IACF,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QAC5B,OAAO,EAAE,KAAK,CAAC,KAAK,CAAgB,SAAS,CAAC,IAAI,EAAE;KACrD,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the PLAN-SPECIFIC `file-tree` block: its data schema\n * and MDX round-trip config. Shared by the server MDX adapter (`plan-mdx.ts` via\n * `plan-block-registry.ts`) and the client spec (`planBlocks.tsx`). Keeping this\n * React-free means importing it into a server module never pulls React into the\n * Nitro/SSR bundle.\n *\n * The block renders a VS Code / GitHub-explorer style file/change tree: a flat\n * list of `entries` (each a slash-delimited `path` with an optional change kind,\n * note, and code snippet) from which the RENDERER derives the nested folder tree\n * — the model never carries the folder structure, only the leaf paths. This keeps\n * the data lean and the tree always consistent with the paths.\n *\n * The schema MUST stay data-compatible with the `file-tree` member of\n * `planBlockSchema` (`plan-content.ts`), and the MDX `tag` (`FileTree`) +\n * attribute shape MUST match it so stored `.mdx` round-trips: the whole `entries`\n * array is one JSON prop (`<FileTree id … title entries={…} />`).\n */\n\n/** The kind of change applied to a file, driving its change badge. */\nexport type FileTreeChange = \"added\" | \"modified\" | \"removed\" | \"renamed\";\n\nexport const FILE_TREE_CHANGES: FileTreeChange[] = [\n \"added\",\n \"modified\",\n \"removed\",\n \"renamed\",\n];\n\n/**\n * One file in the tree. `path` is slash-delimited (`src/routes/git.ts`); the\n * renderer derives the folder structure from its segments. `change` drives the\n * change badge (A/M/D/R); `note` + `snippet` (with optional `language`) make the\n * file row expandable to show why it changes and a code preview.\n */\nexport interface FileTreeEntry {\n path: string;\n change?: FileTreeChange;\n note?: string;\n snippet?: string;\n language?: string;\n}\n\nexport interface FileTreeData {\n /** Optional heading shown above the tree (e.g. \"Files touched\"). */\n title?: string;\n entries: FileTreeEntry[];\n}\n\nconst entrySchema = z.object({\n path: z.string().trim().min(1).max(500),\n change: z.enum([\"added\", \"modified\", \"removed\", \"renamed\"]).optional(),\n note: z.string().trim().max(2_000).optional(),\n snippet: z.string().max(50_000).optional(),\n language: z.string().trim().max(40).optional(),\n}) as z.ZodType<FileTreeEntry>;\n\n/**\n * Data-compatible with the inline `file-tree` member of `planBlockSchema`\n * (`plan-content.ts`). `entries` is required (at least one file); `title` is\n * optional so a fresh tree validates from a couple of files.\n */\nexport const fileTreeSchema = z.object({\n title: z.string().trim().max(180).optional(),\n entries: z.array(entrySchema).min(1).max(200),\n}) as unknown as z.ZodType<FileTreeData>;\n\n/**\n * MDX config: `title` is a flat string attribute and the whole `entries` array is\n * serialized as one JSON prop on a self-closing element — the `<FileTree id …\n * title entries={…} />` form. `toAttrs` emits `title` then `entries` in a STABLE\n * order (the shared `prop()` encoder drops `title` when it is undefined).\n *\n * `fromAttrs` tolerates missing/partial attributes for backward-compat: a missing\n * `title` decodes to `undefined` and a missing `entries` decodes to `[]` so a\n * plan written before this block existed still parses.\n */\nexport const fileTreeMdx: BlockMdxConfig<FileTreeData> = {\n tag: \"FileTree\",\n toAttrs: (data) => ({\n title: data.title,\n entries: data.entries,\n }),\n fromAttrs: (attrs) => ({\n title: attrs.string(\"title\"),\n entries: attrs.array<FileTreeEntry>(\"entries\") ?? [],\n }),\n};\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { BlockMdxConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pure (React-free) part of the standard HTML / Tailwind block: its data schema
|
|
5
|
+
* and MDX round-trip config. Shared by the React spec (`html.tsx`) and any
|
|
6
|
+
* server-side / agent registry (e.g. the plan app's `plan-block-registry.ts`),
|
|
7
|
+
* so importing it into a server module never pulls React in.
|
|
8
|
+
*
|
|
9
|
+
* This is the registry form of the plan `custom-html` block. The schema MUST
|
|
10
|
+
* stay data-compatible with the `custom-html` branch of the plan
|
|
11
|
+
* `planBlockSchema` (bounded `html`, optional bounded `css`, optional trimmed
|
|
12
|
+
* `caption`, all rejecting full-document / script markup) so a registered block
|
|
13
|
+
* still validates through the app's generic `update-block` re-validation. The
|
|
14
|
+
* MDX `tag` (`HtmlBlock`) + flat `html`/`css`/`caption` attribute shape MUST
|
|
15
|
+
* match the legacy `<HtmlBlock … html css caption />` encoding
|
|
16
|
+
* (`plan-mdx.ts` `serializeBlock`/`parseBlock`) so stored `.mdx` round-trips
|
|
17
|
+
* byte-compatibly.
|
|
18
|
+
*/
|
|
19
|
+
export interface HtmlBlockData {
|
|
20
|
+
/** Bounded HTML fragment (no html/head/body/script/style document markup). */
|
|
21
|
+
html: string;
|
|
22
|
+
/** Optional bounded CSS, scoped into the sandboxed iframe. */
|
|
23
|
+
css?: string;
|
|
24
|
+
/** Optional short caption rendered under the rendered fragment. */
|
|
25
|
+
caption?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const htmlSchema: z.ZodType<HtmlBlockData>;
|
|
28
|
+
/**
|
|
29
|
+
* MDX config: `html`, `css`, and `caption` are flat attributes (no children) —
|
|
30
|
+
* exactly the legacy `<HtmlBlock id … html css caption />` self-closing form.
|
|
31
|
+
* Insertion order of `toAttrs` is the on-disk attribute order, so it stays
|
|
32
|
+
* `html` → `css` → `caption` to match `plan-mdx.ts:serializeBlock`. `fromAttrs`
|
|
33
|
+
* mirrors the legacy parse defaults (`html ?? ""`, `css`/`caption` undefined
|
|
34
|
+
* when absent).
|
|
35
|
+
*/
|
|
36
|
+
export declare const htmlMdx: BlockMdxConfig<HtmlBlockData>;
|
|
37
|
+
//# sourceMappingURL=html.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.config.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/html.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAaD,eAAO,MAAM,UAAU,EAeG,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,aAAa,CAYjD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Rejects full HTML documents, executable/structural tags, and JS/data URLs.
|
|
4
|
+
* Kept byte-identical to the plan `noFullHtmlDocument` refine so the registry
|
|
5
|
+
* schema accepts exactly what `planBlockSchema` accepts (and nothing it would
|
|
6
|
+
* reject). Defense in depth — the block also renders inside a sandboxed iframe.
|
|
7
|
+
*/
|
|
8
|
+
const unsafeHtmlPattern = /(?:<!doctype|<\/?(?:html|head|body|script|style|iframe|object|embed|link|meta|base|form)[\s>/]|\b(?:javascript|data:text\/html)\s*:|\bsrcdoc\s*=|\bon[a-z][\w:-]*\s*=)/i;
|
|
9
|
+
const noFullHtmlDocument = (value) => !unsafeHtmlPattern.test(value);
|
|
10
|
+
export const htmlSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
html: z.string().max(100_000).refine(noFullHtmlDocument, {
|
|
13
|
+
message: "Custom HTML blocks must be bounded fragments without html/head/body/script/style tags.",
|
|
14
|
+
}),
|
|
15
|
+
css: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(50_000)
|
|
18
|
+
.refine(noFullHtmlDocument, {
|
|
19
|
+
message: "Custom CSS blocks must not include document or script tags.",
|
|
20
|
+
})
|
|
21
|
+
.optional(),
|
|
22
|
+
caption: z.string().trim().max(400).optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
/**
|
|
26
|
+
* MDX config: `html`, `css`, and `caption` are flat attributes (no children) —
|
|
27
|
+
* exactly the legacy `<HtmlBlock id … html css caption />` self-closing form.
|
|
28
|
+
* Insertion order of `toAttrs` is the on-disk attribute order, so it stays
|
|
29
|
+
* `html` → `css` → `caption` to match `plan-mdx.ts:serializeBlock`. `fromAttrs`
|
|
30
|
+
* mirrors the legacy parse defaults (`html ?? ""`, `css`/`caption` undefined
|
|
31
|
+
* when absent).
|
|
32
|
+
*/
|
|
33
|
+
export const htmlMdx = {
|
|
34
|
+
tag: "HtmlBlock",
|
|
35
|
+
toAttrs: (data) => ({
|
|
36
|
+
html: data.html,
|
|
37
|
+
css: data.css,
|
|
38
|
+
caption: data.caption,
|
|
39
|
+
}),
|
|
40
|
+
fromAttrs: (attrs) => ({
|
|
41
|
+
html: attrs.string("html") ?? "",
|
|
42
|
+
css: attrs.string("css"),
|
|
43
|
+
caption: attrs.string("caption"),
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=html.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.config.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/html.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB;;;;;GAKG;AACH,MAAM,iBAAiB,GACrB,yKAAyK,CAAC;AAE5K,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE;QACvD,OAAO,EACL,wFAAwF;KAC3F,CAAC;IACF,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,CAAC,MAAM,CAAC;SACX,MAAM,CAAC,kBAAkB,EAAE;QAC1B,OAAO,EAAE,6DAA6D;KACvE,CAAC;SACD,QAAQ,EAAE;IACb,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC/C,CAAC;KACD,MAAM,EAAyC,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkC;IACpD,GAAG,EAAE,WAAW;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;IACF,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAChC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QACxB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;KACjC,CAAC;CACH,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { BlockMdxConfig } from \"../types.js\";\n\n/**\n * Pure (React-free) part of the standard HTML / Tailwind block: its data schema\n * and MDX round-trip config. Shared by the React spec (`html.tsx`) and any\n * server-side / agent registry (e.g. the plan app's `plan-block-registry.ts`),\n * so importing it into a server module never pulls React in.\n *\n * This is the registry form of the plan `custom-html` block. The schema MUST\n * stay data-compatible with the `custom-html` branch of the plan\n * `planBlockSchema` (bounded `html`, optional bounded `css`, optional trimmed\n * `caption`, all rejecting full-document / script markup) so a registered block\n * still validates through the app's generic `update-block` re-validation. The\n * MDX `tag` (`HtmlBlock`) + flat `html`/`css`/`caption` attribute shape MUST\n * match the legacy `<HtmlBlock … html css caption />` encoding\n * (`plan-mdx.ts` `serializeBlock`/`parseBlock`) so stored `.mdx` round-trips\n * byte-compatibly.\n */\n\nexport interface HtmlBlockData {\n /** Bounded HTML fragment (no html/head/body/script/style document markup). */\n html: string;\n /** Optional bounded CSS, scoped into the sandboxed iframe. */\n css?: string;\n /** Optional short caption rendered under the rendered fragment. */\n caption?: string;\n}\n\n/**\n * Rejects full HTML documents, executable/structural tags, and JS/data URLs.\n * Kept byte-identical to the plan `noFullHtmlDocument` refine so the registry\n * schema accepts exactly what `planBlockSchema` accepts (and nothing it would\n * reject). Defense in depth — the block also renders inside a sandboxed iframe.\n */\nconst unsafeHtmlPattern =\n /(?:<!doctype|<\\/?(?:html|head|body|script|style|iframe|object|embed|link|meta|base|form)[\\s>/]|\\b(?:javascript|data:text\\/html)\\s*:|\\bsrcdoc\\s*=|\\bon[a-z][\\w:-]*\\s*=)/i;\n\nconst noFullHtmlDocument = (value: string) => !unsafeHtmlPattern.test(value);\n\nexport const htmlSchema = z\n .object({\n html: z.string().max(100_000).refine(noFullHtmlDocument, {\n message:\n \"Custom HTML blocks must be bounded fragments without html/head/body/script/style tags.\",\n }),\n css: z\n .string()\n .max(50_000)\n .refine(noFullHtmlDocument, {\n message: \"Custom CSS blocks must not include document or script tags.\",\n })\n .optional(),\n caption: z.string().trim().max(400).optional(),\n })\n .strict() as unknown as z.ZodType<HtmlBlockData>;\n\n/**\n * MDX config: `html`, `css`, and `caption` are flat attributes (no children) —\n * exactly the legacy `<HtmlBlock id … html css caption />` self-closing form.\n * Insertion order of `toAttrs` is the on-disk attribute order, so it stays\n * `html` → `css` → `caption` to match `plan-mdx.ts:serializeBlock`. `fromAttrs`\n * mirrors the legacy parse defaults (`html ?? \"\"`, `css`/`caption` undefined\n * when absent).\n */\nexport const htmlMdx: BlockMdxConfig<HtmlBlockData> = {\n tag: \"HtmlBlock\",\n toAttrs: (data) => ({\n html: data.html,\n css: data.css,\n caption: data.caption,\n }),\n fromAttrs: (attrs) => ({\n html: attrs.string(\"html\") ?? \"\",\n css: attrs.string(\"css\"),\n caption: attrs.string(\"caption\"),\n }),\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockReadProps, BlockEditProps } from "../types.js";
|
|
2
|
+
import { type HtmlBlockData } from "./html.config.js";
|
|
3
|
+
/** Read-only renderer: the sandboxed iframe preview plus an optional caption. */
|
|
4
|
+
export declare function HtmlReadBlock({ data, blockId, title, ctx, }: BlockReadProps<HtmlBlockData>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Custom editor: an "Edit source" toggle that flips between the live preview and
|
|
7
|
+
* inline HTML + CSS textareas (ported from the plan `CustomHtmlBlock`). The
|
|
8
|
+
* title is rendered by the registry's edit-mode section wrapper, so this only
|
|
9
|
+
* renders the toggle + content. Edits commit the merged data via `onChange`,
|
|
10
|
+
* which the app routes through its generic `update-block` patch (re-validated by
|
|
11
|
+
* the app schema).
|
|
12
|
+
*/
|
|
13
|
+
export declare function HtmlEditBlock({ data, onChange, editable, title, ctx, }: BlockEditProps<HtmlBlockData>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* The standard HTML / Tailwind block spec. Both apps register this; the plan app
|
|
16
|
+
* registers the matching React-free `{ schema, mdx }` server-side via
|
|
17
|
+
* `html.config.ts`. `empty()` seeds a friendly starter fragment for slash
|
|
18
|
+
* insertion.
|
|
19
|
+
*/
|
|
20
|
+
export declare const htmlBlock: import("../types.js").BlockSpec<HtmlBlockData>;
|
|
21
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/html.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAqD3E,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,aAAa,CAAC,2CAO/B;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,aAAa,CAAC,2CAiE/B;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,gDAepB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { IconCode, IconEdit, IconX } from "@tabler/icons-react";
|
|
4
|
+
import { defineBlock } from "../types.js";
|
|
5
|
+
import { htmlSchema, htmlMdx } from "./html.config.js";
|
|
6
|
+
/**
|
|
7
|
+
* Standard library HTML / Tailwind block. The registry form of the plan
|
|
8
|
+
* `custom-html` block: an author-supplied HTML (+ optional CSS) fragment
|
|
9
|
+
* rendered inside a sandboxed iframe, with an inline source editor.
|
|
10
|
+
*
|
|
11
|
+
* Security: the fragment is rendered in a `sandbox="allow-same-origin"` iframe
|
|
12
|
+
* with `referrerPolicy="no-referrer"` — no scripts execute — and the schema's
|
|
13
|
+
* `noFullHtmlDocument` refine rejects document/script/handler markup before it
|
|
14
|
+
* is ever stored. When the app injects `ctx.sanitizeHtml`, the fragment + CSS
|
|
15
|
+
* are additionally sanitized before being placed in the iframe `srcDoc`.
|
|
16
|
+
*
|
|
17
|
+
* Styling uses app-agnostic shadcn utility classes (`border`, `bg-muted`,
|
|
18
|
+
* `text-muted-foreground`) so the block renders cleanly in any template, not
|
|
19
|
+
* just the plan app.
|
|
20
|
+
*/
|
|
21
|
+
/** Build the iframe document for a fragment, applying app sanitization if given. */
|
|
22
|
+
function buildSrcDoc(data, sanitize) {
|
|
23
|
+
const css = data.css ?? "";
|
|
24
|
+
const body = sanitize ? sanitize(data.html, data.css) : data.html;
|
|
25
|
+
return `<!doctype html><html><head><style>body{margin:0;min-height:100%;font-family:Inter,system-ui,sans-serif;color:#1f1f1d;background:transparent;}*{box-sizing:border-box}${css}</style></head><body>${body}</body></html>`;
|
|
26
|
+
}
|
|
27
|
+
function HtmlPreview({ data, title, sanitize, }) {
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx("iframe", { title: title || "Custom HTML block", srcDoc: buildSrcDoc(data, sanitize), sandbox: "allow-same-origin", referrerPolicy: "no-referrer", className: "mt-4 h-[360px] w-full rounded-xl border bg-muted" }), data.caption && (_jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: data.caption }))] }));
|
|
29
|
+
}
|
|
30
|
+
/** Read-only renderer: the sandboxed iframe preview plus an optional caption. */
|
|
31
|
+
export function HtmlReadBlock({ data, blockId, title, ctx, }) {
|
|
32
|
+
return (_jsxs("section", { className: "plan-block group", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsx(HtmlPreview, { data: data, title: title, sanitize: ctx.sanitizeHtml })] }));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Custom editor: an "Edit source" toggle that flips between the live preview and
|
|
36
|
+
* inline HTML + CSS textareas (ported from the plan `CustomHtmlBlock`). The
|
|
37
|
+
* title is rendered by the registry's edit-mode section wrapper, so this only
|
|
38
|
+
* renders the toggle + content. Edits commit the merged data via `onChange`,
|
|
39
|
+
* which the app routes through its generic `update-block` patch (re-validated by
|
|
40
|
+
* the app schema).
|
|
41
|
+
*/
|
|
42
|
+
export function HtmlEditBlock({ data, onChange, editable, title, ctx, }) {
|
|
43
|
+
const [editing, setEditing] = useState(false);
|
|
44
|
+
const [html, setHtml] = useState(data.html);
|
|
45
|
+
const [css, setCss] = useState(data.css ?? "");
|
|
46
|
+
return (_jsxs("div", { className: "plan-html-block group", "data-an-block-edit": true, children: [_jsx("div", { className: "flex items-start justify-end gap-4", children: editable && (_jsxs("button", { type: "button", "data-plan-interactive": true, className: "inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground", onClick: () => setEditing((value) => !value), children: [editing ? (_jsx(IconX, { className: "size-4" })) : (_jsx(IconEdit, { className: "size-4" })), editing ? "Cancel" : "Edit source"] })) }), editing ? (_jsxs("div", { className: "mt-2 grid gap-3", "data-plan-interactive": true, children: [_jsx("textarea", { value: html, onChange: (event) => setHtml(event.target.value), className: "flex min-h-48 w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", placeholder: "HTML fragment" }), _jsx("textarea", { value: css, onChange: (event) => setCss(event.target.value), className: "flex min-h-32 w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", placeholder: "Optional CSS" }), _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx("button", { type: "button", "data-plan-interactive": true, className: "inline-flex h-9 items-center rounded-md px-4 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground", onClick: () => setEditing(false), children: "Cancel" }), _jsx("button", { type: "button", "data-plan-interactive": true, className: "inline-flex h-9 items-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90", onClick: () => {
|
|
47
|
+
onChange({ ...data, html, css: css || undefined });
|
|
48
|
+
setEditing(false);
|
|
49
|
+
}, children: "Save" })] })] })) : (_jsx(HtmlPreview, { data: data, title: title, sanitize: ctx.sanitizeHtml }))] }));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The standard HTML / Tailwind block spec. Both apps register this; the plan app
|
|
53
|
+
* registers the matching React-free `{ schema, mdx }` server-side via
|
|
54
|
+
* `html.config.ts`. `empty()` seeds a friendly starter fragment for slash
|
|
55
|
+
* insertion.
|
|
56
|
+
*/
|
|
57
|
+
export const htmlBlock = defineBlock({
|
|
58
|
+
type: "custom-html",
|
|
59
|
+
schema: htmlSchema,
|
|
60
|
+
mdx: htmlMdx,
|
|
61
|
+
Read: HtmlReadBlock,
|
|
62
|
+
Edit: HtmlEditBlock,
|
|
63
|
+
placement: ["block"],
|
|
64
|
+
// Config-driven: the render (a sandboxed card) differs from its source, so edit
|
|
65
|
+
// the html/css/caption from a corner button + panel rather than always-inline.
|
|
66
|
+
editSurface: "panel",
|
|
67
|
+
label: "HTML / Tailwind",
|
|
68
|
+
icon: IconCode,
|
|
69
|
+
description: "An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.",
|
|
70
|
+
empty: () => ({ html: '<div class="p-6">Edit this HTML fragment…</div>' }),
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/html.tsx"],"names":[],"mappings":"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","sourcesContent":["import { useState } from \"react\";\nimport { IconCode, IconEdit, IconX } from \"@tabler/icons-react\";\nimport { defineBlock } from \"../types.js\";\nimport type { BlockReadProps, BlockEditProps } from \"../types.js\";\nimport { htmlSchema, htmlMdx, type HtmlBlockData } from \"./html.config.js\";\n\n/**\n * Standard library HTML / Tailwind block. The registry form of the plan\n * `custom-html` block: an author-supplied HTML (+ optional CSS) fragment\n * rendered inside a sandboxed iframe, with an inline source editor.\n *\n * Security: the fragment is rendered in a `sandbox=\"allow-same-origin\"` iframe\n * with `referrerPolicy=\"no-referrer\"` — no scripts execute — and the schema's\n * `noFullHtmlDocument` refine rejects document/script/handler markup before it\n * is ever stored. When the app injects `ctx.sanitizeHtml`, the fragment + CSS\n * are additionally sanitized before being placed in the iframe `srcDoc`.\n *\n * Styling uses app-agnostic shadcn utility classes (`border`, `bg-muted`,\n * `text-muted-foreground`) so the block renders cleanly in any template, not\n * just the plan app.\n */\n\n/** Build the iframe document for a fragment, applying app sanitization if given. */\nfunction buildSrcDoc(\n data: HtmlBlockData,\n sanitize?: (html: string, css?: string) => string,\n): string {\n const css = data.css ?? \"\";\n const body = sanitize ? sanitize(data.html, data.css) : data.html;\n return `<!doctype html><html><head><style>body{margin:0;min-height:100%;font-family:Inter,system-ui,sans-serif;color:#1f1f1d;background:transparent;}*{box-sizing:border-box}${css}</style></head><body>${body}</body></html>`;\n}\n\nfunction HtmlPreview({\n data,\n title,\n sanitize,\n}: {\n data: HtmlBlockData;\n title?: string;\n sanitize?: (html: string, css?: string) => string;\n}) {\n return (\n <>\n <iframe\n title={title || \"Custom HTML block\"}\n srcDoc={buildSrcDoc(data, sanitize)}\n sandbox=\"allow-same-origin\"\n referrerPolicy=\"no-referrer\"\n className=\"mt-4 h-[360px] w-full rounded-xl border bg-muted\"\n />\n {data.caption && (\n <p className=\"mt-3 text-sm text-muted-foreground\">{data.caption}</p>\n )}\n </>\n );\n}\n\n/** Read-only renderer: the sandboxed iframe preview plus an optional caption. */\nexport function HtmlReadBlock({\n data,\n blockId,\n title,\n ctx,\n}: BlockReadProps<HtmlBlockData>) {\n return (\n <section className=\"plan-block group\" data-block-id={blockId}>\n {title && <div className=\"plan-block-label\">{title}</div>}\n <HtmlPreview data={data} title={title} sanitize={ctx.sanitizeHtml} />\n </section>\n );\n}\n\n/**\n * Custom editor: an \"Edit source\" toggle that flips between the live preview and\n * inline HTML + CSS textareas (ported from the plan `CustomHtmlBlock`). The\n * title is rendered by the registry's edit-mode section wrapper, so this only\n * renders the toggle + content. Edits commit the merged data via `onChange`,\n * which the app routes through its generic `update-block` patch (re-validated by\n * the app schema).\n */\nexport function HtmlEditBlock({\n data,\n onChange,\n editable,\n title,\n ctx,\n}: BlockEditProps<HtmlBlockData>) {\n const [editing, setEditing] = useState(false);\n const [html, setHtml] = useState(data.html);\n const [css, setCss] = useState(data.css ?? \"\");\n\n return (\n <div className=\"plan-html-block group\" data-an-block-edit>\n <div className=\"flex items-start justify-end gap-4\">\n {editable && (\n <button\n type=\"button\"\n data-plan-interactive\n className=\"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n onClick={() => setEditing((value) => !value)}\n >\n {editing ? (\n <IconX className=\"size-4\" />\n ) : (\n <IconEdit className=\"size-4\" />\n )}\n {editing ? \"Cancel\" : \"Edit source\"}\n </button>\n )}\n </div>\n {editing ? (\n <div className=\"mt-2 grid gap-3\" data-plan-interactive>\n <textarea\n value={html}\n onChange={(event) => setHtml(event.target.value)}\n className=\"flex min-h-48 w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n placeholder=\"HTML fragment\"\n />\n <textarea\n value={css}\n onChange={(event) => setCss(event.target.value)}\n className=\"flex min-h-32 w-full rounded-md border border-input bg-transparent px-3 py-2 font-mono text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n placeholder=\"Optional CSS\"\n />\n <div className=\"flex justify-end gap-2\">\n <button\n type=\"button\"\n data-plan-interactive\n className=\"inline-flex h-9 items-center rounded-md px-4 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\"\n onClick={() => setEditing(false)}\n >\n Cancel\n </button>\n <button\n type=\"button\"\n data-plan-interactive\n className=\"inline-flex h-9 items-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90\"\n onClick={() => {\n onChange({ ...data, html, css: css || undefined });\n setEditing(false);\n }}\n >\n Save\n </button>\n </div>\n </div>\n ) : (\n <HtmlPreview data={data} title={title} sanitize={ctx.sanitizeHtml} />\n )}\n </div>\n );\n}\n\n/**\n * The standard HTML / Tailwind block spec. Both apps register this; the plan app\n * registers the matching React-free `{ schema, mdx }` server-side via\n * `html.config.ts`. `empty()` seeds a friendly starter fragment for slash\n * insertion.\n */\nexport const htmlBlock = defineBlock<HtmlBlockData>({\n type: \"custom-html\",\n schema: htmlSchema,\n mdx: htmlMdx,\n Read: HtmlReadBlock,\n Edit: HtmlEditBlock,\n placement: [\"block\"],\n // Config-driven: the render (a sandboxed card) differs from its source, so edit\n // the html/css/caption from a corner button + panel rather than always-inline.\n editSurface: \"panel\",\n label: \"HTML / Tailwind\",\n icon: IconCode,\n description:\n \"An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.\",\n empty: () => ({ html: '<div class=\"p-6\">Edit this HTML fragment…</div>' }),\n});\n"]}
|