@agent-native/core 0.79.27 → 0.80.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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +26 -0
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +41 -0
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +51 -0
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +50 -0
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +49 -0
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +44 -0
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +46 -0
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +44 -0
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +48 -0
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +36 -0
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +38 -0
- package/corpus/core/docs/content/template-design.mdx +45 -0
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/agent/engine/index.ts +1 -0
- package/corpus/core/src/agent/engine/registry.ts +40 -0
- package/corpus/core/src/agent/production-agent.ts +6 -2
- package/corpus/core/src/cli/design-connect.ts +490 -0
- package/corpus/core/src/cli/index.ts +16 -0
- package/corpus/core/src/cli/skills.ts +126 -3
- package/corpus/core/src/client/AssistantChat.tsx +43 -7
- package/corpus/core/src/client/agent-chat.ts +27 -3
- package/corpus/core/src/client/blocks/library/MermaidBlock.tsx +1 -1
- package/corpus/core/src/client/blocks/library/diagram.tsx +2 -2
- package/corpus/core/src/client/blocks/library/wireframe.tsx +1 -1
- package/corpus/core/src/client/chat/message-components.tsx +1 -1
- package/corpus/core/src/client/chat-model-groups.ts +1 -2
- package/corpus/core/src/client/components/LiveCursorOverlay.tsx +33 -66
- package/corpus/core/src/client/composer/TiptapComposer.tsx +99 -24
- package/corpus/core/src/client/composer/useVoiceDictation.ts +429 -260
- package/corpus/core/src/client/frame-protocol.ts +17 -2
- package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +2 -2
- package/corpus/core/src/client/sharing/ShareButton.tsx +20 -15
- package/corpus/core/src/client/use-agent-engine-configured.ts +80 -28
- package/corpus/core/src/server/transcribe-voice.ts +57 -22
- package/corpus/core/src/shared/mcp-embed-headers.ts +23 -1
- package/corpus/core/src/styles/agent-native.css +56 -7
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/corpus/core/src/vite/client.ts +2 -0
- package/corpus/core/src/voice/index.ts +18 -0
- package/corpus/core/src/voice/voice-cleanup-prompt.ts +38 -0
- package/corpus/core/src/voice/voice-context.ts +217 -0
- package/corpus/core/src/voice/voice-replacements.ts +75 -0
- package/corpus/templates/analytics/AGENTS.md +4 -3
- package/corpus/templates/analytics/actions/list-session-recordings.ts +6 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +557 -400
- package/corpus/templates/analytics/app/global.css +0 -4
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/analytics/app/i18n-data.ts +20 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +33 -8
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +7 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +7 -0
- package/corpus/templates/analytics/changelog/2026-06-28-ask-tab-now-matches-the-darker-app-background.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-dashboard-email-reports-now-use-cleaner-light-mode-snapshots.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-sessions-now-show-only-signed-in-recordings-with-playable-re.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +3 -3
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +29 -7
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +5 -2
- package/corpus/templates/analytics/server/lib/session-replay.ts +24 -4
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -4
- package/corpus/templates/assets/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +29 -2
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +131 -42
- package/corpus/templates/brain/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/brain/app/i18n-data.ts +20 -0
- package/corpus/templates/brain/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +29 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +417 -299
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/calendar/app/i18n-data.ts +20 -0
- package/corpus/templates/calendar/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +6 -19
- package/corpus/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/clips/AGENTS.md +4 -0
- package/corpus/templates/clips/actions/cleanup-transcript.ts +39 -9
- package/corpus/templates/clips/actions/finalize-meeting.ts +81 -12
- package/corpus/templates/clips/actions/lib/agents-md-context.ts +4 -1
- package/corpus/templates/clips/app/components/library/library-layout.tsx +3 -3
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +1 -1
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +2 -2
- package/corpus/templates/clips/changelog/2026-06-28-left-sidebar-footer-controls-use-less-divider-chrome.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/personal-vocabulary.ts +13 -8
- package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +60 -1
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +1 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +5 -5
- package/corpus/templates/content/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +137 -0
- package/corpus/templates/design/AGENTS.md +95 -5
- package/corpus/templates/design/DESIGN.md +82 -0
- package/corpus/templates/design/DEVELOPING.md +43 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +426 -0
- package/corpus/templates/design/actions/apply-shader.ts +277 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +303 -0
- package/corpus/templates/design/actions/connect-localhost.ts +183 -0
- package/corpus/templates/design/actions/edit-design.ts +195 -42
- package/corpus/templates/design/actions/generate-design.ts +71 -1
- package/corpus/templates/design/actions/generate-screens.ts +193 -0
- package/corpus/templates/design/actions/get-code-layer-projection.ts +191 -0
- package/corpus/templates/design/actions/get-shader.ts +119 -0
- package/corpus/templates/design/actions/list-localhost-connections.ts +95 -0
- package/corpus/templates/design/actions/navigate.ts +55 -2
- package/corpus/templates/design/actions/view-screen.ts +68 -1
- package/corpus/templates/design/agent-native.app-skill.json +10 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +761 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +2057 -103
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +74 -38
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +399 -0
- package/corpus/templates/design/app/components/design/EditPanel.tsx +3185 -439
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +1124 -0
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +3116 -147
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +700 -13
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +107 -63
- package/corpus/templates/design/app/components/design/index.ts +0 -5
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +286 -0
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +699 -0
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +461 -0
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +166 -0
- package/corpus/templates/design/app/components/design/inspector/FigmaColorPicker.tsx +1420 -0
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +420 -0
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +215 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.stories.tsx +71 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +518 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderEffectRow.tsx +106 -0
- package/corpus/templates/design/app/components/design/inspector/figma-icons.tsx +361 -0
- package/corpus/templates/design/app/components/design/inspector/index.ts +60 -0
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +201 -0
- package/corpus/templates/design/app/components/design/types.ts +23 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +24 -13
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +4 -4
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +474 -36
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +22 -5
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +24 -11
- package/corpus/templates/design/app/global.css +121 -3
- package/corpus/templates/design/app/hooks/use-agent-generating.ts +4 -0
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +130 -8
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +329 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +264 -0
- package/corpus/templates/design/app/i18n-data.ts +2790 -1
- package/corpus/templates/design/app/pages/DesignEditor.tsx +5108 -851
- package/corpus/templates/design/changelog/2026-06-28-annotate-mode-now-combines-drawing-and-comment-pins-in-one-c.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-design-editor-panel-borders-are-cleaner-so-the-canvas-edge-s.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-drawing-prompts-now-reliably-open-and-submit-to-the-design-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-editor-app-menus-now-use-an-outline-agent-native-mark-with-b.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-figma-style-code-design-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-layer-selection-now-updates-chat-context-without-opening-the.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-layer-selections-now-preserve-hidden-and-locked-canvas-state.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-live-cursors-now-keep-names-beside-a-cleaner-pointer-marker.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-mode-switching-now-lives-in-a-compact-bottom-right-icon-dock.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-now-handles-zooming-drawing-opening-and-dele.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-now-selects-screens-on-click-and-opens-them-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-zooms-into-the-active-screen-with-smoother-e.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-selected-element-chips-in-chat-are-shorter-and-easier-to-sca.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-the-design-editor-toolbar-is-more-compact-and-the-app-menu-m.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-tweaks-now-live-at-the-top-of-the-design-sidebar-instead-of-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-tweaks-now-live-in-the-right-inspector-beside-the-design-tab.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-active-sidebar-rows-use-soft-highlights.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-agents-can-now-open-screen-overview-focus-screens-and-add.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-agents-now-edit-broad-copy-changes-more-reliably.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-editor-extensions-now-run-inline-beside-the-artboard.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-sidebars-use-darker-chrome-and-chat-warns-immediately.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-visual-edit-can-open-localhost-routes-as-url-backed-screens.md +6 -0
- package/corpus/templates/design/package.json +1 -0
- package/corpus/templates/design/server/db/schema.ts +26 -0
- package/corpus/templates/design/server/lib/design-snapshot.ts +1 -1
- package/corpus/templates/design/server/plugins/agent-chat.ts +3 -0
- package/corpus/templates/design/shared/api.ts +27 -0
- package/corpus/templates/design/shared/canvas-frames.ts +103 -0
- package/corpus/templates/design/shared/canvas-math.ts +1058 -0
- package/corpus/templates/design/shared/code-layer.ts +2212 -0
- package/corpus/templates/design/shared/color-utils.ts +180 -0
- package/corpus/templates/design/shared/generation-session.ts +61 -0
- package/corpus/templates/design/shared/shader-presets.ts +782 -0
- package/corpus/templates/design/shared/shader-safety.ts +137 -0
- package/corpus/templates/design/shared/source-mode.ts +237 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +149 -6
- package/corpus/templates/forms/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +2 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/forms/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/macros/changelog/2026-06-28-left-sidebar-footer-controls-use-less-divider-chrome.md +6 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +408 -247
- package/corpus/templates/mail/app/i18n/ar-SA.ts +4 -0
- package/corpus/templates/mail/app/i18n/de-DE.ts +4 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +4 -0
- package/corpus/templates/mail/app/i18n/es-ES.ts +4 -0
- package/corpus/templates/mail/app/i18n/fr-FR.ts +4 -0
- package/corpus/templates/mail/app/i18n/hi-IN.ts +4 -0
- package/corpus/templates/mail/app/i18n/ja-JP.ts +4 -0
- package/corpus/templates/mail/app/i18n/ko-KR.ts +4 -0
- package/corpus/templates/mail/app/i18n/pt-BR.ts +4 -0
- package/corpus/templates/mail/app/i18n/zh-CN.ts +4 -0
- package/corpus/templates/mail/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/mail/changelog/2026-06-28-pinned-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +6 -8
- package/corpus/templates/plan/app/components/plan/wireframe/Wireframe.tsx +1 -1
- package/corpus/templates/plan/app/global.css +61 -78
- package/corpus/templates/plan/app/pages/PlansPage.tsx +8 -0
- package/corpus/templates/plan/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-28-plans-use-the-shared-neutral-light-and-dark-theme.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-28-sending-open-feedback-from-a-plan-now-opens-the-inline-plan-.md +6 -0
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +5 -5
- package/corpus/templates/slides/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/videos/app/components/Sidebar.tsx +2 -2
- package/corpus/templates/videos/app/components/layout/Layout.tsx +29 -2
- package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +113 -30
- package/corpus/templates/videos/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/videos/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/videos/app/i18n/en-US.ts +2 -0
- package/corpus/templates/videos/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/videos/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/videos/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/videos/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/videos/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/videos/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/videos/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/videos/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/videos/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +9 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +37 -0
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +4 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/design-connect.d.ts +52 -0
- package/dist/cli/design-connect.d.ts.map +1 -0
- package/dist/cli/design-connect.js +409 -0
- package/dist/cli/design-connect.js.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills.d.ts +3 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +121 -3
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +38 -8
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts +6 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +17 -3
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/blocks/library/MermaidBlock.js +1 -1
- package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
- package/dist/client/blocks/library/diagram.js +1 -1
- package/dist/client/blocks/library/diagram.js.map +1 -1
- package/dist/client/blocks/library/wireframe.js +1 -1
- package/dist/client/blocks/library/wireframe.js.map +1 -1
- package/dist/client/chat/message-components.js +1 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat-model-groups.d.ts.map +1 -1
- package/dist/client/chat-model-groups.js +1 -2
- package/dist/client/chat-model-groups.js.map +1 -1
- package/dist/client/components/LiveCursorOverlay.d.ts +1 -2
- package/dist/client/components/LiveCursorOverlay.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.js +19 -40
- package/dist/client/components/LiveCursorOverlay.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +3 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +86 -24
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/useVoiceDictation.d.ts +9 -0
- package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
- package/dist/client/composer/useVoiceDictation.js +154 -32
- package/dist/client/composer/useVoiceDictation.js.map +1 -1
- package/dist/client/frame-protocol.d.ts +17 -2
- package/dist/client/frame-protocol.d.ts.map +1 -1
- package/dist/client/frame-protocol.js.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +2 -2
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +2 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +7 -6
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/use-agent-engine-configured.d.ts +5 -0
- package/dist/client/use-agent-engine-configured.d.ts.map +1 -1
- package/dist/client/use-agent-engine-configured.js +51 -25
- package/dist/client/use-agent-engine-configured.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +8 -8
- package/dist/progress/routes.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +40 -24
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/shared/mcp-embed-headers.d.ts +1 -0
- package/dist/shared/mcp-embed-headers.d.ts.map +1 -1
- package/dist/shared/mcp-embed-headers.js +20 -1
- package/dist/shared/mcp-embed-headers.js.map +1 -1
- package/dist/styles/agent-native.css +56 -7
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +2 -0
- package/dist/vite/client.js.map +1 -1
- package/dist/voice/index.d.ts +5 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +4 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/voice-cleanup-prompt.d.ts +6 -0
- package/dist/voice/voice-cleanup-prompt.d.ts.map +1 -0
- package/dist/voice/voice-cleanup-prompt.js +26 -0
- package/dist/voice/voice-cleanup-prompt.js.map +1 -0
- package/dist/voice/voice-context.d.ts +25 -0
- package/dist/voice/voice-context.d.ts.map +1 -0
- package/dist/voice/voice-context.js +156 -0
- package/dist/voice/voice-context.js.map +1 -0
- package/dist/voice/voice-replacements.d.ts +4 -0
- package/dist/voice/voice-replacements.d.ts.map +1 -0
- package/dist/voice/voice-replacements.js +52 -0
- package/dist/voice/voice-replacements.js.map +1 -0
- package/docs/content/locales/ar-SA/template-design.mdx +41 -0
- package/docs/content/locales/de-DE/template-design.mdx +51 -0
- package/docs/content/locales/es-ES/template-design.mdx +50 -0
- package/docs/content/locales/fr-FR/template-design.mdx +49 -0
- package/docs/content/locales/hi-IN/template-design.mdx +44 -0
- package/docs/content/locales/ja-JP/template-design.mdx +46 -0
- package/docs/content/locales/ko-KR/template-design.mdx +44 -0
- package/docs/content/locales/pt-BR/template-design.mdx +48 -0
- package/docs/content/locales/zh-CN/template-design.mdx +36 -0
- package/docs/content/locales/zh-TW/template-design.mdx +38 -0
- package/docs/content/template-design.mdx +45 -0
- package/package.json +2 -1
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/corpus/templates/design/app/components/design/DesignToolbar.tsx +0 -339
- package/corpus/templates/design/app/components/design/PresentMode.tsx +0 -68
- package/corpus/templates/design/app/components/design/ViewportTabs.tsx +0 -149
- package/corpus/templates/design/app/components/design/ZoomControls.tsx +0 -157
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { ShareButton, useT } from "@agent-native/core/client";
|
|
2
|
-
import {
|
|
3
|
-
IconArrowLeft,
|
|
4
|
-
IconAdjustments,
|
|
5
|
-
IconMessage,
|
|
6
|
-
IconPointer,
|
|
7
|
-
IconPencil,
|
|
8
|
-
IconPresentation,
|
|
9
|
-
IconDownload,
|
|
10
|
-
IconMinus,
|
|
11
|
-
IconPlus,
|
|
12
|
-
IconPencilPlus,
|
|
13
|
-
IconPin,
|
|
14
|
-
IconWand,
|
|
15
|
-
} from "@tabler/icons-react";
|
|
16
|
-
import { useState } from "react";
|
|
17
|
-
|
|
18
|
-
import { Button } from "@/components/ui/button";
|
|
19
|
-
import {
|
|
20
|
-
DropdownMenu,
|
|
21
|
-
DropdownMenuContent,
|
|
22
|
-
DropdownMenuItem,
|
|
23
|
-
DropdownMenuTrigger,
|
|
24
|
-
} from "@/components/ui/dropdown-menu";
|
|
25
|
-
import { Input } from "@/components/ui/input";
|
|
26
|
-
import { Separator } from "@/components/ui/separator";
|
|
27
|
-
import {
|
|
28
|
-
Tooltip,
|
|
29
|
-
TooltipContent,
|
|
30
|
-
TooltipTrigger,
|
|
31
|
-
} from "@/components/ui/tooltip";
|
|
32
|
-
import { cn } from "@/lib/utils";
|
|
33
|
-
|
|
34
|
-
import type { ViewportTab } from "./types";
|
|
35
|
-
|
|
36
|
-
export type EditorMode = "comment" | "edit" | "draw";
|
|
37
|
-
|
|
38
|
-
interface DesignToolbarProps {
|
|
39
|
-
title: string;
|
|
40
|
-
designId: string;
|
|
41
|
-
onTitleChange: (title: string) => void;
|
|
42
|
-
mode: EditorMode;
|
|
43
|
-
onModeChange: (mode: EditorMode) => void;
|
|
44
|
-
tweaksVisible: boolean;
|
|
45
|
-
onTweaksToggle: () => void;
|
|
46
|
-
zoom: number;
|
|
47
|
-
onZoomChange: (zoom: number) => void;
|
|
48
|
-
onExport: (format: string) => void;
|
|
49
|
-
onPresent: (mode: string) => void;
|
|
50
|
-
onBack: () => void;
|
|
51
|
-
tabs?: ViewportTab[];
|
|
52
|
-
activeTabId?: string;
|
|
53
|
-
onTabChange?: (tabId: string) => void;
|
|
54
|
-
/** Whether draw-on-canvas mode is active. */
|
|
55
|
-
drawMode?: boolean;
|
|
56
|
-
/** Toggle draw-on-canvas mode. */
|
|
57
|
-
onToggleDrawMode?: () => void;
|
|
58
|
-
/** Whether comment-pin drop mode is active. */
|
|
59
|
-
pinMode?: boolean;
|
|
60
|
-
/** Toggle comment-pin drop mode. */
|
|
61
|
-
onTogglePinMode?: () => void;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const MODE_ITEMS: {
|
|
65
|
-
mode: EditorMode;
|
|
66
|
-
icon: typeof IconMessage;
|
|
67
|
-
labelKey: string;
|
|
68
|
-
}[] = [
|
|
69
|
-
{
|
|
70
|
-
mode: "comment",
|
|
71
|
-
icon: IconMessage,
|
|
72
|
-
labelKey: "designEditor.modes.comment",
|
|
73
|
-
},
|
|
74
|
-
{ mode: "edit", icon: IconPointer, labelKey: "designEditor.modes.edit" },
|
|
75
|
-
{ mode: "draw", icon: IconPencil, labelKey: "designEditor.modes.draw" },
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
const EXPORT_FORMATS = [
|
|
79
|
-
{ value: "zip", labelKey: "designEditor.downloadZip" },
|
|
80
|
-
{ value: "svg", labelKey: "designEditor.downloadSvg" },
|
|
81
|
-
{ value: "pdf", labelKey: "designEditor.exportPdf" },
|
|
82
|
-
{ value: "html", labelKey: "designEditor.exportHtml" },
|
|
83
|
-
{ value: "coding-handoff", labelKey: "designEditor.copyCodingHandoff" },
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
const PRESENT_MODES = [
|
|
87
|
-
{ value: "tab", labelKey: "designEditor.presentInThisTab" },
|
|
88
|
-
{ value: "fullscreen", labelKey: "designEditor.presentFullscreen" },
|
|
89
|
-
{ value: "new-tab", labelKey: "designEditor.presentNewTab" },
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
export function DesignToolbar({
|
|
93
|
-
title,
|
|
94
|
-
onTitleChange,
|
|
95
|
-
mode,
|
|
96
|
-
onModeChange,
|
|
97
|
-
tweaksVisible,
|
|
98
|
-
onTweaksToggle,
|
|
99
|
-
zoom,
|
|
100
|
-
onZoomChange,
|
|
101
|
-
onExport,
|
|
102
|
-
onPresent,
|
|
103
|
-
onBack,
|
|
104
|
-
designId,
|
|
105
|
-
tabs,
|
|
106
|
-
activeTabId,
|
|
107
|
-
onTabChange,
|
|
108
|
-
drawMode,
|
|
109
|
-
onToggleDrawMode,
|
|
110
|
-
pinMode,
|
|
111
|
-
onTogglePinMode,
|
|
112
|
-
}: DesignToolbarProps) {
|
|
113
|
-
const t = useT();
|
|
114
|
-
const [editingTitle, setEditingTitle] = useState(false);
|
|
115
|
-
const [titleDraft, setTitleDraft] = useState(title);
|
|
116
|
-
const zoomLabel = `${Math.round(zoom)}%`;
|
|
117
|
-
|
|
118
|
-
const commitTitle = () => {
|
|
119
|
-
setEditingTitle(false);
|
|
120
|
-
if (titleDraft.trim() && titleDraft !== title) {
|
|
121
|
-
onTitleChange(titleDraft.trim());
|
|
122
|
-
} else {
|
|
123
|
-
setTitleDraft(title);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<div className="flex h-11 shrink-0 items-center gap-1.5 border-b border-border bg-background px-2">
|
|
129
|
-
{/* Back */}
|
|
130
|
-
<Button variant="ghost" size="icon" className="h-8 w-8" onClick={onBack}>
|
|
131
|
-
<IconArrowLeft className="h-4 w-4" />
|
|
132
|
-
</Button>
|
|
133
|
-
|
|
134
|
-
{/* Title */}
|
|
135
|
-
{editingTitle ? (
|
|
136
|
-
<Input
|
|
137
|
-
value={titleDraft}
|
|
138
|
-
onChange={(e) => setTitleDraft(e.target.value)}
|
|
139
|
-
onBlur={commitTitle}
|
|
140
|
-
onKeyDown={(e) => {
|
|
141
|
-
if (e.key === "Enter") commitTitle();
|
|
142
|
-
if (e.key === "Escape") {
|
|
143
|
-
setTitleDraft(title);
|
|
144
|
-
setEditingTitle(false);
|
|
145
|
-
}
|
|
146
|
-
}}
|
|
147
|
-
className="h-7 w-48 text-sm"
|
|
148
|
-
autoFocus
|
|
149
|
-
/>
|
|
150
|
-
) : (
|
|
151
|
-
<button
|
|
152
|
-
onClick={() => {
|
|
153
|
-
setTitleDraft(title);
|
|
154
|
-
setEditingTitle(true);
|
|
155
|
-
}}
|
|
156
|
-
className="cursor-pointer rounded px-2 py-1 text-sm font-medium text-foreground hover:bg-muted"
|
|
157
|
-
>
|
|
158
|
-
{title}
|
|
159
|
-
</button>
|
|
160
|
-
)}
|
|
161
|
-
|
|
162
|
-
<Separator orientation="vertical" className="mx-1 h-5" />
|
|
163
|
-
|
|
164
|
-
{/* File tabs */}
|
|
165
|
-
{tabs && tabs.length > 0 && (
|
|
166
|
-
<>
|
|
167
|
-
<div className="flex gap-0.5">
|
|
168
|
-
{tabs.map((tab) => (
|
|
169
|
-
<button
|
|
170
|
-
key={tab.id}
|
|
171
|
-
onClick={() => onTabChange?.(tab.id)}
|
|
172
|
-
className={cn(
|
|
173
|
-
"cursor-pointer rounded px-2.5 py-1 text-xs",
|
|
174
|
-
activeTabId === tab.id
|
|
175
|
-
? "bg-muted text-foreground"
|
|
176
|
-
: "text-muted-foreground hover:bg-muted/50 hover:text-foreground",
|
|
177
|
-
)}
|
|
178
|
-
>
|
|
179
|
-
{tab.filename}
|
|
180
|
-
</button>
|
|
181
|
-
))}
|
|
182
|
-
</div>
|
|
183
|
-
<Separator orientation="vertical" className="mx-1 h-5" />
|
|
184
|
-
</>
|
|
185
|
-
)}
|
|
186
|
-
|
|
187
|
-
{/* Spacer */}
|
|
188
|
-
<div className="flex-1" />
|
|
189
|
-
|
|
190
|
-
{/* Tools — Tweaks / Draw / Pin consolidated so the bar isn't a wall of icons.
|
|
191
|
-
The dot indicator lights up when any of the modes is active. */}
|
|
192
|
-
{(() => {
|
|
193
|
-
const anyToolActive = Boolean(tweaksVisible || drawMode || pinMode);
|
|
194
|
-
return (
|
|
195
|
-
<DropdownMenu>
|
|
196
|
-
<Tooltip>
|
|
197
|
-
<TooltipTrigger asChild>
|
|
198
|
-
<DropdownMenuTrigger asChild>
|
|
199
|
-
<Button
|
|
200
|
-
variant="ghost"
|
|
201
|
-
size="icon"
|
|
202
|
-
className={cn(
|
|
203
|
-
"relative h-8 w-8",
|
|
204
|
-
anyToolActive && "bg-muted text-foreground",
|
|
205
|
-
)}
|
|
206
|
-
aria-label={t("designEditor.designTools")}
|
|
207
|
-
>
|
|
208
|
-
<IconWand className="h-4 w-4" />
|
|
209
|
-
{anyToolActive && (
|
|
210
|
-
<span className="absolute top-1 right-1 h-1.5 w-1.5 rounded-full bg-primary" />
|
|
211
|
-
)}
|
|
212
|
-
</Button>
|
|
213
|
-
</DropdownMenuTrigger>
|
|
214
|
-
</TooltipTrigger>
|
|
215
|
-
<TooltipContent>{t("designEditor.designTools")}</TooltipContent>
|
|
216
|
-
</Tooltip>
|
|
217
|
-
<DropdownMenuContent align="end" className="w-48">
|
|
218
|
-
<DropdownMenuItem
|
|
219
|
-
onClick={onTweaksToggle}
|
|
220
|
-
className={cn(tweaksVisible && "bg-accent/50")}
|
|
221
|
-
>
|
|
222
|
-
<IconAdjustments className="h-4 w-4 mr-2" />
|
|
223
|
-
{t("designEditor.tweaks")}
|
|
224
|
-
</DropdownMenuItem>
|
|
225
|
-
{onToggleDrawMode && (
|
|
226
|
-
<DropdownMenuItem
|
|
227
|
-
data-toolbar-draw-button
|
|
228
|
-
onClick={onToggleDrawMode}
|
|
229
|
-
className={cn(drawMode && "bg-accent/50")}
|
|
230
|
-
>
|
|
231
|
-
<IconPencilPlus className="h-4 w-4 mr-2" />
|
|
232
|
-
{t("designEditor.drawOnCanvas")}
|
|
233
|
-
</DropdownMenuItem>
|
|
234
|
-
)}
|
|
235
|
-
{onTogglePinMode && (
|
|
236
|
-
<DropdownMenuItem
|
|
237
|
-
data-toolbar-pin-button
|
|
238
|
-
onClick={onTogglePinMode}
|
|
239
|
-
className={cn(pinMode && "bg-accent/50")}
|
|
240
|
-
>
|
|
241
|
-
<IconPin className="h-4 w-4 mr-2" />
|
|
242
|
-
{t("designEditor.dropCommentPin")}
|
|
243
|
-
</DropdownMenuItem>
|
|
244
|
-
)}
|
|
245
|
-
</DropdownMenuContent>
|
|
246
|
-
</DropdownMenu>
|
|
247
|
-
);
|
|
248
|
-
})()}
|
|
249
|
-
|
|
250
|
-
{/* Mode switcher */}
|
|
251
|
-
<div className="flex overflow-hidden rounded-md border border-border">
|
|
252
|
-
{MODE_ITEMS.map(({ mode: m, icon: Icon, labelKey }) => (
|
|
253
|
-
<Tooltip key={m}>
|
|
254
|
-
<TooltipTrigger asChild>
|
|
255
|
-
<button
|
|
256
|
-
onClick={() => onModeChange(m)}
|
|
257
|
-
className={cn(
|
|
258
|
-
"cursor-pointer px-2 py-1.5",
|
|
259
|
-
mode === m
|
|
260
|
-
? "bg-muted text-foreground"
|
|
261
|
-
: "text-muted-foreground hover:bg-muted/50 hover:text-foreground",
|
|
262
|
-
)}
|
|
263
|
-
>
|
|
264
|
-
<Icon className="h-3.5 w-3.5" />
|
|
265
|
-
</button>
|
|
266
|
-
</TooltipTrigger>
|
|
267
|
-
<TooltipContent>{t(labelKey)}</TooltipContent>
|
|
268
|
-
</Tooltip>
|
|
269
|
-
))}
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<Separator orientation="vertical" className="mx-1 h-5" />
|
|
273
|
-
|
|
274
|
-
{/* Zoom controls */}
|
|
275
|
-
<div className="flex items-center gap-0.5">
|
|
276
|
-
<Button
|
|
277
|
-
variant="ghost"
|
|
278
|
-
size="icon"
|
|
279
|
-
className="h-7 w-7"
|
|
280
|
-
onClick={() => onZoomChange(Math.max(25, zoom - 25))}
|
|
281
|
-
>
|
|
282
|
-
<IconMinus className="h-3 w-3" />
|
|
283
|
-
</Button>
|
|
284
|
-
<span className="min-w-12 text-center text-xs tabular-nums text-muted-foreground">
|
|
285
|
-
{zoomLabel}
|
|
286
|
-
</span>
|
|
287
|
-
<Button
|
|
288
|
-
variant="ghost"
|
|
289
|
-
size="icon"
|
|
290
|
-
className="h-7 w-7"
|
|
291
|
-
onClick={() => onZoomChange(Math.min(400, zoom + 25))}
|
|
292
|
-
>
|
|
293
|
-
<IconPlus className="h-3 w-3" />
|
|
294
|
-
</Button>
|
|
295
|
-
</div>
|
|
296
|
-
|
|
297
|
-
{/* Present */}
|
|
298
|
-
<DropdownMenu>
|
|
299
|
-
<DropdownMenuTrigger asChild>
|
|
300
|
-
<Button variant="ghost" size="icon" className="h-8 w-8">
|
|
301
|
-
<IconPresentation className="h-4 w-4" />
|
|
302
|
-
</Button>
|
|
303
|
-
</DropdownMenuTrigger>
|
|
304
|
-
<DropdownMenuContent align="end">
|
|
305
|
-
{PRESENT_MODES.map((pm) => (
|
|
306
|
-
<DropdownMenuItem
|
|
307
|
-
key={pm.value}
|
|
308
|
-
onClick={() => onPresent(pm.value)}
|
|
309
|
-
>
|
|
310
|
-
{t(pm.labelKey)}
|
|
311
|
-
</DropdownMenuItem>
|
|
312
|
-
))}
|
|
313
|
-
</DropdownMenuContent>
|
|
314
|
-
</DropdownMenu>
|
|
315
|
-
|
|
316
|
-
{/* Share */}
|
|
317
|
-
<ShareButton resourceType="design" resourceId={designId} />
|
|
318
|
-
|
|
319
|
-
{/* Export */}
|
|
320
|
-
<DropdownMenu>
|
|
321
|
-
<DropdownMenuTrigger asChild>
|
|
322
|
-
<Button variant="ghost" size="icon" className="h-8 w-8">
|
|
323
|
-
<IconDownload className="h-4 w-4" />
|
|
324
|
-
</Button>
|
|
325
|
-
</DropdownMenuTrigger>
|
|
326
|
-
<DropdownMenuContent align="end">
|
|
327
|
-
{EXPORT_FORMATS.map((fmt) => (
|
|
328
|
-
<DropdownMenuItem
|
|
329
|
-
key={fmt.value}
|
|
330
|
-
onClick={() => onExport(fmt.value)}
|
|
331
|
-
>
|
|
332
|
-
{t(fmt.labelKey)}
|
|
333
|
-
</DropdownMenuItem>
|
|
334
|
-
))}
|
|
335
|
-
</DropdownMenuContent>
|
|
336
|
-
</DropdownMenu>
|
|
337
|
-
</div>
|
|
338
|
-
);
|
|
339
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useT } from "@agent-native/core/client";
|
|
2
|
-
import { useEffect, useCallback, useRef } from "react";
|
|
3
|
-
|
|
4
|
-
interface PresentModeProps {
|
|
5
|
-
content: string;
|
|
6
|
-
onExit: () => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function PresentMode({ content, onExit }: PresentModeProps) {
|
|
10
|
-
const t = useT();
|
|
11
|
-
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
12
|
-
|
|
13
|
-
const handleKeyDown = useCallback(
|
|
14
|
-
(e: KeyboardEvent) => {
|
|
15
|
-
if (e.key === "Escape") {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
onExit();
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
[onExit],
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
25
|
-
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
26
|
-
}, [handleKeyDown]);
|
|
27
|
-
|
|
28
|
-
// Enter fullscreen on mount
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
document.documentElement.requestFullscreen?.().catch(() => {
|
|
31
|
-
// Fullscreen may not be available; continue in windowed mode
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
if (document.fullscreenElement) {
|
|
36
|
-
document.exitFullscreen?.().catch(() => {});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
// Listen for fullscreen exit to trigger onExit
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
function handleFullscreenChange() {
|
|
44
|
-
if (!document.fullscreenElement) {
|
|
45
|
-
onExit();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
49
|
-
return () =>
|
|
50
|
-
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
51
|
-
}, [onExit]);
|
|
52
|
-
|
|
53
|
-
const srcdoc = content.includes("</body>")
|
|
54
|
-
? content
|
|
55
|
-
: `<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><style>html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;}</style></head><body>${content}</body></html>`;
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div className="fixed inset-0 z-[9999] bg-black flex items-center justify-center">
|
|
59
|
-
<iframe
|
|
60
|
-
ref={iframeRef}
|
|
61
|
-
srcDoc={srcdoc}
|
|
62
|
-
sandbox="allow-scripts"
|
|
63
|
-
className="w-full h-full border-0"
|
|
64
|
-
title={t("designEditor.presentMode")}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { useT } from "@agent-native/core/client";
|
|
2
|
-
import { IconPlus, IconX } from "@tabler/icons-react";
|
|
3
|
-
import { useState, useRef, useCallback } from "react";
|
|
4
|
-
|
|
5
|
-
import { Button } from "@/components/ui/button";
|
|
6
|
-
import {
|
|
7
|
-
DropdownMenu,
|
|
8
|
-
DropdownMenuContent,
|
|
9
|
-
DropdownMenuItem,
|
|
10
|
-
DropdownMenuTrigger,
|
|
11
|
-
} from "@/components/ui/dropdown-menu";
|
|
12
|
-
import { cn } from "@/lib/utils";
|
|
13
|
-
|
|
14
|
-
import type { ViewportTab } from "./types";
|
|
15
|
-
|
|
16
|
-
interface ViewportTabsProps {
|
|
17
|
-
tabs: ViewportTab[];
|
|
18
|
-
activeTab: string;
|
|
19
|
-
onTabChange: (id: string) => void;
|
|
20
|
-
onTabClose: (id: string) => void;
|
|
21
|
-
onTabAdd: () => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function ViewportTabs({
|
|
25
|
-
tabs,
|
|
26
|
-
activeTab,
|
|
27
|
-
onTabChange,
|
|
28
|
-
onTabClose,
|
|
29
|
-
onTabAdd,
|
|
30
|
-
}: ViewportTabsProps) {
|
|
31
|
-
const t = useT();
|
|
32
|
-
const [draggedTab, setDraggedTab] = useState<string | null>(null);
|
|
33
|
-
const [contextTab, setContextTab] = useState<string | null>(null);
|
|
34
|
-
const tabsRef = useRef<HTMLDivElement>(null);
|
|
35
|
-
|
|
36
|
-
const handleDragStart = useCallback((e: React.DragEvent, tabId: string) => {
|
|
37
|
-
setDraggedTab(tabId);
|
|
38
|
-
e.dataTransfer.effectAllowed = "move";
|
|
39
|
-
e.dataTransfer.setData("text/plain", tabId);
|
|
40
|
-
}, []);
|
|
41
|
-
|
|
42
|
-
const handleDragOver = useCallback((e: React.DragEvent) => {
|
|
43
|
-
e.preventDefault();
|
|
44
|
-
e.dataTransfer.dropEffect = "move";
|
|
45
|
-
}, []);
|
|
46
|
-
|
|
47
|
-
const handleDrop = useCallback((e: React.DragEvent, targetId: string) => {
|
|
48
|
-
e.preventDefault();
|
|
49
|
-
const sourceId = e.dataTransfer.getData("text/plain");
|
|
50
|
-
if (sourceId === targetId) return;
|
|
51
|
-
// Reorder is handled by the parent via tab ordering.
|
|
52
|
-
// For now we just clear drag state; parent can implement reorder via onTabReorder if needed.
|
|
53
|
-
setDraggedTab(null);
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
const handleDragEnd = useCallback(() => {
|
|
57
|
-
setDraggedTab(null);
|
|
58
|
-
}, []);
|
|
59
|
-
|
|
60
|
-
const handleCloseOthers = useCallback(
|
|
61
|
-
(keepId: string) => {
|
|
62
|
-
tabs.forEach((tab) => {
|
|
63
|
-
if (tab.id !== keepId) {
|
|
64
|
-
onTabClose(tab.id);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
[tabs, onTabClose],
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const handleCloseAll = useCallback(() => {
|
|
72
|
-
tabs.forEach((tab) => onTabClose(tab.id));
|
|
73
|
-
}, [tabs, onTabClose]);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<div className="flex items-center border-b border-border bg-muted/30 h-9 overflow-hidden">
|
|
77
|
-
<div ref={tabsRef} className="flex items-center flex-1 overflow-x-auto">
|
|
78
|
-
{tabs.map((tab) => (
|
|
79
|
-
<DropdownMenu
|
|
80
|
-
key={tab.id}
|
|
81
|
-
open={contextTab === tab.id}
|
|
82
|
-
onOpenChange={(open) => !open && setContextTab(null)}
|
|
83
|
-
>
|
|
84
|
-
<DropdownMenuTrigger asChild>
|
|
85
|
-
<div
|
|
86
|
-
draggable
|
|
87
|
-
onDragStart={(e) => handleDragStart(e, tab.id)}
|
|
88
|
-
onDragOver={handleDragOver}
|
|
89
|
-
onDrop={(e) => handleDrop(e, tab.id)}
|
|
90
|
-
onDragEnd={handleDragEnd}
|
|
91
|
-
onContextMenu={(e) => {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
setContextTab(tab.id);
|
|
94
|
-
}}
|
|
95
|
-
onClick={() => onTabChange(tab.id)}
|
|
96
|
-
className={cn(
|
|
97
|
-
"group relative flex items-center gap-1.5 px-3 h-9 text-xs cursor-pointer select-none border-r border-border shrink-0",
|
|
98
|
-
tab.id === activeTab
|
|
99
|
-
? "bg-background text-foreground"
|
|
100
|
-
: "text-muted-foreground hover:bg-background/50",
|
|
101
|
-
draggedTab === tab.id && "opacity-50",
|
|
102
|
-
)}
|
|
103
|
-
>
|
|
104
|
-
<span className="truncate max-w-[120px]">{tab.filename}</span>
|
|
105
|
-
<button
|
|
106
|
-
onClick={(e) => {
|
|
107
|
-
e.stopPropagation();
|
|
108
|
-
onTabClose(tab.id);
|
|
109
|
-
}}
|
|
110
|
-
className={cn(
|
|
111
|
-
"shrink-0 rounded p-0.5 hover:bg-muted",
|
|
112
|
-
tab.id === activeTab
|
|
113
|
-
? "opacity-60 hover:opacity-100"
|
|
114
|
-
: "opacity-0 group-hover:opacity-60 hover:!opacity-100",
|
|
115
|
-
)}
|
|
116
|
-
>
|
|
117
|
-
<IconX className="w-3 h-3" />
|
|
118
|
-
</button>
|
|
119
|
-
{/* Active indicator */}
|
|
120
|
-
{tab.id === activeTab && (
|
|
121
|
-
<div className="absolute bottom-0 left-0 right-0 h-px bg-foreground" />
|
|
122
|
-
)}
|
|
123
|
-
</div>
|
|
124
|
-
</DropdownMenuTrigger>
|
|
125
|
-
<DropdownMenuContent align="start" className="w-40">
|
|
126
|
-
<DropdownMenuItem onClick={() => onTabClose(tab.id)}>
|
|
127
|
-
{t("designEditor.closeTab")}
|
|
128
|
-
</DropdownMenuItem>
|
|
129
|
-
<DropdownMenuItem onClick={() => handleCloseOthers(tab.id)}>
|
|
130
|
-
{t("designEditor.closeOtherTabs")}
|
|
131
|
-
</DropdownMenuItem>
|
|
132
|
-
<DropdownMenuItem onClick={handleCloseAll}>
|
|
133
|
-
{t("designEditor.closeAllTabs")}
|
|
134
|
-
</DropdownMenuItem>
|
|
135
|
-
</DropdownMenuContent>
|
|
136
|
-
</DropdownMenu>
|
|
137
|
-
))}
|
|
138
|
-
</div>
|
|
139
|
-
<Button
|
|
140
|
-
variant="ghost"
|
|
141
|
-
size="icon"
|
|
142
|
-
className="h-9 w-9 shrink-0 rounded-none"
|
|
143
|
-
onClick={onTabAdd}
|
|
144
|
-
>
|
|
145
|
-
<IconPlus className="w-3.5 h-3.5" />
|
|
146
|
-
</Button>
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
}
|