@agent-native/core 0.85.7 → 0.86.1
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 +1 -1
- package/corpus/core/CHANGELOG.md +133 -1
- package/corpus/core/README.md +0 -11
- package/corpus/core/docs/content/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/ar-SA/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/ar-SA/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/ar-SA/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/ar-SA/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/ar-SA/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/workspace-connections.mdx +11 -11
- package/corpus/core/docs/content/locales/de-DE/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/de-DE/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/de-DE/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/de-DE/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/de-DE/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/es-ES/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/es-ES/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/es-ES/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/es-ES/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/fr-FR/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/fr-FR/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/fr-FR/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/fr-FR/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/hi-IN/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/hi-IN/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/hi-IN/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/hi-IN/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/ja-JP/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/ja-JP/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/ja-JP/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/ja-JP/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/ko-KR/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/ko-KR/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/ko-KR/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/ko-KR/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/pt-BR/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/pt-BR/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/pt-BR/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/pt-BR/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/zh-CN/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/zh-CN/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/zh-CN/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/zh-CN/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.mdx +0 -1
- package/corpus/core/docs/content/locales/zh-TW/plan-plugin.mdx +10 -9
- package/corpus/core/docs/content/locales/zh-TW/sharing.mdx +1 -2
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +2 -3
- package/corpus/core/docs/content/locales/zh-TW/template-plan.mdx +23 -7
- package/corpus/core/docs/content/locales/zh-TW/tracking.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/workspace-connections.mdx +1 -1
- package/corpus/core/docs/content/plan-plugin.mdx +12 -11
- package/corpus/core/docs/content/sharing.mdx +1 -2
- package/corpus/core/docs/content/skills-guide.mdx +4 -3
- package/corpus/core/docs/content/template-plan.mdx +37 -6
- package/corpus/core/docs/content/tracking.mdx +1 -1
- package/corpus/core/docs/content/workspace-connections.mdx +1 -1
- package/corpus/core/package.json +7 -6
- package/corpus/core/src/agent/run-store.ts +1 -1
- package/corpus/core/src/chat-threads/store.ts +73 -11
- package/corpus/core/src/checkpoints/store.ts +13 -2
- package/corpus/core/src/cli/create.ts +3 -4
- package/corpus/core/src/cli/design-connect.ts +469 -9
- package/corpus/core/src/cli/index.ts +13 -0
- package/corpus/core/src/cli/plan-local.ts +281 -24
- package/corpus/core/src/cli/skills.ts +177 -21
- package/corpus/core/src/cli/templates-meta.ts +0 -13
- package/corpus/core/src/cli/visualize-repo.ts +715 -0
- package/corpus/core/src/client/AgentPanel.tsx +10 -0
- package/corpus/core/src/client/AssistantChat.tsx +194 -21
- package/corpus/core/src/client/ErrorBoundary.tsx +67 -12
- package/corpus/core/src/client/ErrorReportActions.tsx +69 -0
- package/corpus/core/src/client/FeedbackButton.tsx +8 -4
- package/corpus/core/src/client/agent-chat-adapter.ts +6 -5
- package/corpus/core/src/client/app-providers.tsx +2 -2
- package/corpus/core/src/client/collab/index.ts +31 -0
- package/corpus/core/src/client/components/LiveCursorOverlay.tsx +16 -1
- package/corpus/core/src/client/components/PresenceBar.tsx +14 -1
- package/corpus/core/src/client/components/RecentEditHighlights.tsx +219 -0
- package/corpus/core/src/client/components/RemoteSelectionRings.tsx +40 -6
- package/corpus/core/src/client/db-admin/DbAdminPage.tsx +41 -13
- package/corpus/core/src/client/db-admin/SqlEditor.tsx +10 -3
- package/corpus/core/src/client/db-admin/TableEditor.tsx +12 -5
- package/corpus/core/src/client/db-admin/useAgentSync.ts +10 -3
- package/corpus/core/src/client/db-admin/useDbAdmin.ts +65 -16
- package/corpus/core/src/client/error-reporting.ts +100 -0
- package/corpus/core/src/client/index.ts +59 -0
- package/corpus/core/src/client/org/OrgSwitcher.tsx +0 -4
- package/corpus/core/src/client/org/RequireActiveOrg.tsx +12 -0
- package/corpus/core/src/client/rich-markdown-editor/SharedRichEditor.tsx +49 -32
- package/corpus/core/src/client/rich-markdown-editor/index.ts +6 -0
- package/corpus/core/src/client/rich-markdown-editor/surgical-apply.ts +192 -0
- package/corpus/core/src/client/rich-markdown-editor/useCollabReconcile.ts +59 -8
- package/corpus/core/src/client/session-replay.ts +181 -15
- package/corpus/core/src/client/sse-event-processor.ts +90 -1
- package/corpus/core/src/client/use-action.ts +123 -25
- package/corpus/core/src/client/use-agent-engine-configured.ts +7 -1
- package/corpus/core/src/client/use-chat-threads.ts +18 -7
- package/corpus/core/src/client/use-db-sync.ts +104 -19
- package/corpus/core/src/client/visual-style-controls.tsx +1088 -0
- package/corpus/core/src/collab/agent-presence.ts +191 -62
- package/corpus/core/src/collab/awareness.ts +83 -6
- package/corpus/core/src/collab/client.ts +89 -146
- package/corpus/core/src/collab/index.ts +34 -0
- package/corpus/core/src/collab/recent-edits.ts +171 -0
- package/corpus/core/src/collab/undo.ts +432 -0
- package/corpus/core/src/collab/ydoc-manager.ts +68 -0
- package/corpus/core/src/connections/catalog.ts +2 -3
- package/corpus/core/src/db/create-get-db.ts +86 -1
- package/corpus/core/src/db/ensure-additive-columns.ts +430 -0
- package/corpus/core/src/db/index.ts +6 -0
- package/corpus/core/src/db/migrations.ts +236 -35
- package/corpus/core/src/db-admin/index.ts +26 -0
- package/corpus/core/src/db-admin/operations.ts +87 -49
- package/corpus/core/src/jobs/scheduler.ts +17 -14
- package/corpus/core/src/localization/default-messages.ts +4 -0
- package/corpus/core/src/observability/traces.ts +182 -1
- package/corpus/core/src/org/context.ts +79 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +10 -6
- package/corpus/core/src/server/auth-marketing.ts +0 -11
- package/corpus/core/src/server/auth.ts +11 -4
- package/corpus/core/src/server/builder-design-systems.ts +328 -9
- package/corpus/core/src/server/collab-plugin.ts +56 -13
- package/corpus/core/src/server/design-token-utils.ts +1 -1
- package/corpus/core/src/server/fusion-app.ts +447 -0
- package/corpus/core/src/server/index.ts +28 -0
- package/corpus/core/src/server/onboarding-html.ts +3 -4
- package/corpus/core/src/server/poll-events.ts +14 -2
- package/corpus/core/src/server/poll.ts +219 -12
- package/corpus/core/src/server/schema-prompt.ts +28 -9
- package/corpus/core/src/settings/store.ts +33 -2
- package/corpus/core/src/sharing/actions/set-resource-visibility.ts +2 -0
- package/corpus/core/src/sharing/actions/share-resource.ts +3 -0
- package/corpus/core/src/sharing/actions/unshare-resource.ts +2 -0
- package/corpus/core/src/styles/agent-native.css +0 -5
- package/corpus/core/src/templates/default/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/corpus/core/src/templates/default/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/core/src/templates/default/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/core/src/templates/default/app/root.tsx +47 -0
- package/corpus/core/src/templates/default/package.json +3 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +8 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +22 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/corpus/core/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -0
- package/corpus/core/src/tracking/providers.ts +22 -1
- package/corpus/templates/analytics/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +20 -5
- package/corpus/templates/analytics/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/analytics/AGENTS.md +35 -6
- package/corpus/templates/analytics/actions/delete-db-admin-connection.ts +19 -0
- package/corpus/templates/analytics/actions/list-db-admin-connections.ts +18 -0
- package/corpus/templates/analytics/actions/navigate.ts +28 -4
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +1 -1
- package/corpus/templates/analytics/actions/save-db-admin-connection.ts +33 -0
- package/corpus/templates/analytics/actions/view-screen.ts +65 -0
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +23 -1
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +21 -0
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +16 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +36 -1
- package/corpus/templates/analytics/app/i18n-data.ts +361 -10
- package/corpus/templates/analytics/app/pages/Agents.tsx +512 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +11 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +76 -40
- package/corpus/templates/analytics/app/pages/sessions/session-replay-devtools.ts +5 -0
- package/corpus/templates/analytics/app/routes/agents.tsx +10 -0
- package/corpus/templates/analytics/changelog/2026-07-03-agent-admin-tools-page.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-03-agent-llm-observability-dashboard.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-03-connect-other-app-databases-from-analytics.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-03-session-recordings-now-include-response-bodies-for-5xx-error.md +6 -0
- package/corpus/templates/analytics/docs/schemas/first-party-analytics.md +34 -0
- package/corpus/templates/analytics/docs/schemas/tracked-events.md +6 -0
- package/corpus/templates/analytics/package.json +3 -3
- package/corpus/templates/analytics/seeds/dashboards/agent-observability-llm.json +173 -0
- package/corpus/templates/analytics/server/db/schema.ts +27 -0
- package/corpus/templates/analytics/server/jobs/analytics-alerts.ts +23 -5
- package/corpus/templates/analytics/server/lib/analytics-alerts.ts +58 -13
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +23 -0
- package/corpus/templates/analytics/server/lib/dashboard-seeds.ts +5 -0
- package/corpus/templates/analytics/server/lib/db-admin-connections.ts +458 -0
- package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +120 -8
- package/corpus/templates/analytics/server/lib/session-replay.ts +3 -2
- package/corpus/templates/analytics/server/plugins/db.ts +128 -2
- package/corpus/templates/analytics/server/routes/[base]/_agent-native/analytics-db-admin/[...path].ts +1 -0
- package/corpus/templates/analytics/server/routes/_agent-native/analytics-db-admin/[...path].ts +160 -0
- package/corpus/templates/analytics/server/routes/api/session-replay/agent-diagnostics.json.get.ts +45 -1
- package/corpus/templates/analytics/shared/session-replay-diagnostics.ts +10 -0
- package/corpus/templates/assets/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/corpus/templates/assets/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/assets/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/assets/package.json +3 -3
- package/corpus/templates/assets/server/plugins/db.ts +63 -2
- package/corpus/templates/brain/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/brain/package.json +3 -3
- package/corpus/templates/brain/server/plugins/db.ts +75 -2
- package/corpus/templates/calendar/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/calendar/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/calendar/package.json +3 -3
- package/corpus/templates/calendar/server/plugins/db.ts +64 -2
- package/corpus/templates/chat/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/chat/package.json +3 -3
- package/corpus/templates/clips/actions/finalize-recording.ts +50 -40
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +8 -6
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +3 -3
- package/corpus/templates/clips/changelog/2026-07-03-mobile-recording-pages-keep-videos-in-a-16-9-player-with-act.md +6 -0
- package/corpus/templates/clips/package.json +3 -3
- package/corpus/templates/clips/server/lib/recording-upload-state.ts +56 -0
- package/corpus/templates/clips/server/plugins/db.ts +68 -1
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +27 -3
- package/corpus/templates/content/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/content/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/content/actions/edit-document.ts +48 -1
- package/corpus/templates/content/actions/list-documents.ts +101 -94
- package/corpus/templates/content/actions/search-documents.ts +19 -3
- package/corpus/templates/content/actions/update-document.ts +54 -1
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +127 -7
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +97 -2
- package/corpus/templates/content/app/root.tsx +9 -0
- package/corpus/templates/content/changelog/2026-07-03-agent-document-edits-now-appear-as-a-live-collaborator-prese.md +6 -0
- package/corpus/templates/content/changelog/2026-07-03-document-search-and-list-views-load-faster-on-large-workspac.md +6 -0
- package/corpus/templates/content/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
- package/corpus/templates/content/package.json +3 -3
- package/corpus/templates/content/server/plugins/db.ts +57 -1
- package/corpus/templates/design/.agents/skills/full-app-build/SKILL.md +140 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +20 -0
- package/corpus/templates/design/AGENTS.md +63 -19
- package/corpus/templates/design/actions/add-fusion-screens.ts +91 -0
- package/corpus/templates/design/actions/apply-a11y-fix.ts +5 -1
- package/corpus/templates/design/actions/apply-component-prop-edit.ts +10 -2
- package/corpus/templates/design/actions/apply-fusion-edits.ts +161 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +34 -1
- package/corpus/templates/design/actions/create-component.ts +5 -1
- package/corpus/templates/design/actions/create-fusion-app.ts +202 -0
- package/corpus/templates/design/actions/deploy-fusion-app.ts +123 -0
- package/corpus/templates/design/actions/edit-design.ts +13 -16
- package/corpus/templates/design/actions/get-design-system.ts +21 -0
- package/corpus/templates/design/actions/get-fusion-deploy-status.ts +86 -0
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +14 -37
- package/corpus/templates/design/actions/list-fusion-edits.ts +96 -0
- package/corpus/templates/design/actions/list-local-files.ts +133 -0
- package/corpus/templates/design/actions/push-fusion-app.ts +62 -0
- package/corpus/templates/design/actions/queue-fusion-edit.ts +112 -0
- package/corpus/templates/design/actions/read-local-file.ts +139 -0
- package/corpus/templates/design/actions/send-fusion-message.ts +69 -0
- package/corpus/templates/design/actions/sync-fusion-app.ts +196 -0
- package/corpus/templates/design/actions/write-local-file.ts +115 -14
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +12 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +379 -0
- package/corpus/templates/design/app/components/design/EditPanel.tsx +149 -73
- package/corpus/templates/design/app/components/design/FusionAppBanner.tsx +328 -0
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +148 -30
- package/corpus/templates/design/app/components/design/LocalhostWriteConsentDialog.tsx +1 -1
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +567 -6
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +7 -98
- package/corpus/templates/design/app/components/design/code-workbench/ActivityBar.tsx +85 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +466 -0
- package/corpus/templates/design/app/components/design/code-workbench/SideBar.tsx +114 -0
- package/corpus/templates/design/app/components/design/code-workbench/commands.ts +339 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/Breadcrumbs.tsx +42 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/BufferSync.tsx +128 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/EditorTabs.tsx +372 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +268 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/StatusBar.tsx +208 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +61 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-theme-palette.ts +191 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-theme.ts +29 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/status-bar-lang.ts +21 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/tab-drag.ts +27 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +161 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +555 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/file-icons.tsx +115 -0
- package/corpus/templates/design/app/components/design/code-workbench/format/format-on-open.ts +65 -0
- package/corpus/templates/design/app/components/design/code-workbench/format/prettier-format.ts +182 -0
- package/corpus/templates/design/app/components/design/code-workbench/model-registry.ts +133 -0
- package/corpus/templates/design/app/components/design/code-workbench/quickinput/QuickInput.tsx +563 -0
- package/corpus/templates/design/app/components/design/code-workbench/quickinput/fuzzy.ts +170 -0
- package/corpus/templates/design/app/components/design/code-workbench/search/SearchView.tsx +508 -0
- package/corpus/templates/design/app/components/design/code-workbench/search/search-engine.ts +280 -0
- package/corpus/templates/design/app/components/design/code-workbench/store.tsx +782 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/create-providers.ts +39 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/inline-provider.ts +196 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +177 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/tree.ts +110 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/types.ts +103 -0
- package/corpus/templates/design/app/components/design/code-workbench-theme.ts +68 -0
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +127 -10
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +52 -29
- package/corpus/templates/design/app/components/design/inspector/index.ts +9 -0
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +56 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +80 -1
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +6 -16
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +6 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +17 -15
- package/corpus/templates/design/app/i18n-data.ts +185 -160
- package/corpus/templates/design/app/pages/DesignEditor.tsx +1474 -175
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +32 -14
- package/corpus/templates/design/app/pages/Index.tsx +90 -17
- package/corpus/templates/design/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-the-ai-now-edits-like-a-collaborator-on-canvas-its-cursor-gl.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-the-code-editor-is-easier-to-use-with-top-sidebar-tabs-clear.md +6 -0
- package/corpus/templates/design/changelog/2026-07-03-the-code-panel-is-now-a-full-vs-code-style-editor-with-a-fil.md +6 -0
- package/corpus/templates/design/package.json +4 -3
- package/corpus/templates/design/server/db/schema.ts +31 -0
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +16 -106
- package/corpus/templates/design/server/lib/fusion-screens.ts +246 -0
- package/corpus/templates/design/server/plugins/db.ts +89 -2
- package/corpus/templates/design/shared/collab-selection.ts +52 -0
- package/corpus/templates/design/shared/full-app.ts +126 -0
- package/corpus/templates/design/shared/pen-path.ts +296 -0
- package/corpus/templates/dispatch/package.json +3 -3
- package/corpus/templates/forms/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/forms/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/forms/package.json +3 -3
- package/corpus/templates/forms/server/plugins/db.ts +62 -2
- package/corpus/templates/macros/package.json +3 -3
- package/corpus/templates/macros/server/plugins/db.ts +63 -2
- package/corpus/templates/mail/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/mail/.agents/skills/storing-data/SKILL.md +8 -0
- package/corpus/templates/mail/app/root.tsx +60 -1
- package/corpus/templates/mail/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
- package/corpus/templates/mail/package.json +3 -3
- package/corpus/templates/mail/server/lib/contact-frequency.ts +42 -15
- package/corpus/templates/mail/server/plugins/db.ts +63 -2
- package/corpus/templates/plan/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +9 -3
- package/corpus/templates/plan/.agents/skills/visualize-repo/SKILL.md +92 -0
- package/corpus/templates/plan/actions/export-visual-plan.ts +5 -0
- package/corpus/templates/plan/actions/get-local-plan-folder.ts +4 -22
- package/corpus/templates/plan/actions/get-plan-version.ts +6 -16
- package/corpus/templates/plan/actions/list-plan-versions.ts +48 -20
- package/corpus/templates/plan/actions/patch-visual-plan-source.ts +41 -1
- package/corpus/templates/plan/actions/promote-local-plan-folder.ts +4 -22
- package/corpus/templates/plan/actions/update-local-plan-comments.ts +4 -2
- package/corpus/templates/plan/actions/update-local-plan-folder.ts +4 -22
- package/corpus/templates/plan/actions/update-visual-plan.ts +60 -1
- package/corpus/templates/plan/agent-native.app-skill.json +10 -0
- package/corpus/templates/plan/app/components/editor/PlanDocumentEditor.tsx +138 -39
- package/corpus/templates/plan/app/components/editor/usePlanUndoStack.ts +165 -23
- package/corpus/templates/plan/app/components/plan/PlanContentRenderer.tsx +80 -4
- package/corpus/templates/plan/app/global.css +11 -9
- package/corpus/templates/plan/app/hooks/use-navigation-state.ts +10 -1
- package/corpus/templates/plan/app/hooks/use-plan-presence.ts +66 -0
- package/corpus/templates/plan/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/plan/app/i18n/de-DE.ts +4 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +4 -0
- package/corpus/templates/plan/app/i18n/es-ES.ts +4 -0
- package/corpus/templates/plan/app/i18n/fr-FR.ts +4 -0
- package/corpus/templates/plan/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/plan/app/i18n/ja-JP.ts +4 -0
- package/corpus/templates/plan/app/i18n/ko-KR.ts +4 -0
- package/corpus/templates/plan/app/i18n/pt-BR.ts +4 -0
- package/corpus/templates/plan/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/plan/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +289 -66
- package/corpus/templates/plan/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-03-local-visual-plans-and-recaps-can-save-comments-without-sign.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-03-plan-tabs-render-nested-text-instead-of-raw-json.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-03-plans-are-now-fully-real-time-collaborative-multiple-people-.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-03-plans-open-and-refresh-faster-especially-long-lived-plans-wi.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-03-undo-now-survives-agent-edits-cmd-z-keeps-working-on-your-ow.md +6 -0
- package/corpus/templates/plan/package.json +5 -3
- package/corpus/templates/plan/server/db/schema.ts +12 -0
- package/corpus/templates/plan/server/lib/local-plan-kind.ts +25 -0
- package/corpus/templates/plan/server/lib/plan-versions.ts +83 -1
- package/corpus/templates/plan/server/lib/public-action-paths.ts +0 -2
- package/corpus/templates/plan/server/plans.ts +26 -3
- package/corpus/templates/plan/server/plugins/db.ts +105 -2
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +8 -4
- package/corpus/templates/slides/AGENTS.md +11 -3
- package/corpus/templates/slides/actions/_agent-presence.ts +48 -0
- package/corpus/templates/slides/actions/add-slide.ts +16 -18
- package/corpus/templates/slides/actions/get-design-system.ts +21 -0
- package/corpus/templates/slides/actions/import-file.ts +15 -7
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +14 -37
- package/corpus/templates/slides/actions/patch-deck.ts +4 -2
- package/corpus/templates/slides/actions/update-slide.ts +114 -77
- package/corpus/templates/slides/actions/view-screen.ts +39 -0
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +32 -8
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +47 -3
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +34 -39
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +507 -72
- package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +346 -0
- package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +56 -6
- package/corpus/templates/slides/app/components/editor/TweaksPanel.tsx +46 -96
- package/corpus/templates/slides/app/components/layout/Layout.tsx +6 -1
- package/corpus/templates/slides/app/components/visual-editor/SaveStatusIndicator.tsx +8 -1
- package/corpus/templates/slides/app/context/DeckContext.tsx +589 -176
- package/corpus/templates/slides/app/hooks/use-deck-presence.ts +84 -42
- package/corpus/templates/slides/app/i18n/ar-SA.ts +54 -7
- package/corpus/templates/slides/app/i18n/de-DE.ts +53 -8
- package/corpus/templates/slides/app/i18n/en-US.ts +54 -7
- package/corpus/templates/slides/app/i18n/es-ES.ts +53 -8
- package/corpus/templates/slides/app/i18n/fr-FR.ts +53 -8
- package/corpus/templates/slides/app/i18n/hi-IN.ts +54 -7
- package/corpus/templates/slides/app/i18n/ja-JP.ts +53 -8
- package/corpus/templates/slides/app/i18n/ko-KR.ts +53 -7
- package/corpus/templates/slides/app/i18n/pt-BR.ts +53 -8
- package/corpus/templates/slides/app/i18n/zh-CN.ts +54 -7
- package/corpus/templates/slides/app/i18n/zh-TW.ts +54 -7
- package/corpus/templates/slides/app/lib/canvas-zoom.ts +16 -1
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +28 -16
- package/corpus/templates/slides/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-03-figma-style-slide-editing.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-03-see-the-ai-working-with-you-when-the-agent-edits-a-slide-it-.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-03-slide-editing-now-keeps-thumbnails-speaker-notes-styling-and.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-03-undo-redo-is-now-precise-and-safe-with-collaborators-it-only.md +6 -0
- package/corpus/templates/slides/package.json +3 -3
- package/corpus/templates/slides/server/handlers/decks.ts +31 -3
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +16 -104
- package/corpus/templates/slides/server/plugins/db.ts +65 -2
- package/corpus/templates/videos/netlify.toml +1 -12
- package/dist/agent/run-store.js +1 -1
- package/dist/agent/run-store.js.map +1 -1
- package/dist/chat-threads/store.d.ts +9 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +63 -11
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/checkpoints/store.d.ts.map +1 -1
- package/dist/checkpoints/store.js +10 -2
- package/dist/checkpoints/store.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +3 -5
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts +49 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +414 -9
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +12 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/plan-local.d.ts +24 -0
- package/dist/cli/plan-local.d.ts.map +1 -1
- package/dist/cli/plan-local.js +188 -20
- package/dist/cli/plan-local.js.map +1 -1
- package/dist/cli/skills.d.ts +3 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +173 -21
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +0 -14
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/cli/visualize-repo.d.ts +49 -0
- package/dist/cli/visualize-repo.d.ts.map +1 -0
- package/dist/cli/visualize-repo.js +561 -0
- package/dist/cli/visualize-repo.js.map +1 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +2 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +175 -18
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ErrorBoundary.d.ts.map +1 -1
- package/dist/client/ErrorBoundary.js +37 -2
- package/dist/client/ErrorBoundary.js.map +1 -1
- package/dist/client/ErrorReportActions.d.ts +13 -0
- package/dist/client/ErrorReportActions.d.ts.map +1 -0
- package/dist/client/ErrorReportActions.js +14 -0
- package/dist/client/ErrorReportActions.js.map +1 -0
- package/dist/client/FeedbackButton.d.ts +3 -1
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +6 -5
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +6 -5
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/app-providers.d.ts +2 -2
- package/dist/client/app-providers.js.map +1 -1
- package/dist/client/collab/index.d.ts +4 -1
- package/dist/client/collab/index.d.ts.map +1 -1
- package/dist/client/collab/index.js +3 -0
- package/dist/client/collab/index.js.map +1 -1
- package/dist/client/components/LiveCursorOverlay.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.js +11 -3
- package/dist/client/components/LiveCursorOverlay.js.map +1 -1
- package/dist/client/components/PresenceBar.d.ts.map +1 -1
- package/dist/client/components/PresenceBar.js +6 -1
- package/dist/client/components/PresenceBar.js.map +1 -1
- package/dist/client/components/RecentEditHighlights.d.ts +43 -0
- package/dist/client/components/RecentEditHighlights.d.ts.map +1 -0
- package/dist/client/components/RecentEditHighlights.js +146 -0
- package/dist/client/components/RecentEditHighlights.js.map +1 -0
- package/dist/client/components/RemoteSelectionRings.d.ts +9 -0
- package/dist/client/components/RemoteSelectionRings.d.ts.map +1 -1
- package/dist/client/components/RemoteSelectionRings.js +22 -8
- package/dist/client/components/RemoteSelectionRings.js.map +1 -1
- package/dist/client/db-admin/DbAdminPage.d.ts +9 -1
- package/dist/client/db-admin/DbAdminPage.d.ts.map +1 -1
- package/dist/client/db-admin/DbAdminPage.js +17 -13
- package/dist/client/db-admin/DbAdminPage.js.map +1 -1
- package/dist/client/db-admin/SqlEditor.d.ts +3 -1
- package/dist/client/db-admin/SqlEditor.d.ts.map +1 -1
- package/dist/client/db-admin/SqlEditor.js +3 -3
- package/dist/client/db-admin/SqlEditor.js.map +1 -1
- package/dist/client/db-admin/TableEditor.d.ts +3 -1
- package/dist/client/db-admin/TableEditor.d.ts.map +1 -1
- package/dist/client/db-admin/TableEditor.js +6 -6
- package/dist/client/db-admin/TableEditor.js.map +1 -1
- package/dist/client/db-admin/useAgentSync.d.ts +3 -2
- package/dist/client/db-admin/useAgentSync.d.ts.map +1 -1
- package/dist/client/db-admin/useAgentSync.js +8 -4
- package/dist/client/db-admin/useAgentSync.js.map +1 -1
- package/dist/client/db-admin/useDbAdmin.d.ts +11 -7
- package/dist/client/db-admin/useDbAdmin.d.ts.map +1 -1
- package/dist/client/db-admin/useDbAdmin.js +45 -20
- package/dist/client/db-admin/useDbAdmin.js.map +1 -1
- package/dist/client/error-reporting.d.ts +19 -0
- package/dist/client/error-reporting.d.ts.map +1 -0
- package/dist/client/error-reporting.js +71 -0
- package/dist/client/error-reporting.js.map +1 -0
- package/dist/client/index.d.ts +8 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +1 -3
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/RequireActiveOrg.d.ts.map +1 -1
- package/dist/client/org/RequireActiveOrg.js +2 -1
- package/dist/client/org/RequireActiveOrg.js.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +8 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/SharedRichEditor.js +8 -2
- package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
- package/dist/client/rich-markdown-editor/index.d.ts +1 -0
- package/dist/client/rich-markdown-editor/index.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/index.js +1 -0
- package/dist/client/rich-markdown-editor/index.js.map +1 -1
- package/dist/client/rich-markdown-editor/surgical-apply.d.ts +66 -0
- package/dist/client/rich-markdown-editor/surgical-apply.d.ts.map +1 -0
- package/dist/client/rich-markdown-editor/surgical-apply.js +147 -0
- package/dist/client/rich-markdown-editor/surgical-apply.js.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +18 -2
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +39 -8
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
- package/dist/client/session-replay.d.ts +10 -1
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +134 -7
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +81 -1
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/use-action.d.ts +24 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +109 -27
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-agent-engine-configured.d.ts.map +1 -1
- package/dist/client/use-agent-engine-configured.js +7 -1
- package/dist/client/use-agent-engine-configured.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +11 -3
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +36 -0
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +68 -12
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/visual-style-controls.d.ts +90 -0
- package/dist/client/visual-style-controls.d.ts.map +1 -0
- package/dist/client/visual-style-controls.js +499 -0
- package/dist/client/visual-style-controls.js.map +1 -0
- package/dist/collab/agent-presence.d.ts +51 -5
- package/dist/collab/agent-presence.d.ts.map +1 -1
- package/dist/collab/agent-presence.js +144 -58
- package/dist/collab/agent-presence.js.map +1 -1
- package/dist/collab/awareness-store.d.ts +32 -0
- package/dist/collab/awareness-store.d.ts.map +1 -0
- package/dist/collab/awareness-store.js +0 -0
- package/dist/collab/awareness-store.js.map +1 -0
- package/dist/collab/awareness.d.ts +12 -1
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/awareness.js +53 -5
- package/dist/collab/awareness.js.map +1 -1
- package/dist/collab/client.d.ts +2 -0
- package/dist/collab/client.d.ts.map +1 -1
- package/dist/collab/client.js +79 -119
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/index.d.ts +3 -1
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.js +5 -1
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/recent-edits.d.ts +87 -0
- package/dist/collab/recent-edits.d.ts.map +1 -0
- package/dist/collab/recent-edits.js +116 -0
- package/dist/collab/recent-edits.js.map +1 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/undo.d.ts +121 -0
- package/dist/collab/undo.d.ts.map +1 -0
- package/dist/collab/undo.js +244 -0
- package/dist/collab/undo.js.map +1 -0
- package/dist/collab/ydoc-manager.d.ts +10 -0
- package/dist/collab/ydoc-manager.d.ts.map +1 -1
- package/dist/collab/ydoc-manager.js +57 -0
- package/dist/collab/ydoc-manager.js.map +1 -1
- package/dist/connections/catalog.d.ts +2 -2
- package/dist/connections/catalog.d.ts.map +1 -1
- package/dist/connections/catalog.js +1 -1
- package/dist/connections/catalog.js.map +1 -1
- package/dist/db/create-get-db.d.ts +22 -0
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +73 -1
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/db/ensure-additive-columns.d.ts +93 -0
- package/dist/db/ensure-additive-columns.d.ts.map +1 -0
- package/dist/db/ensure-additive-columns.js +355 -0
- package/dist/db/ensure-additive-columns.js.map +1 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +70 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +196 -33
- package/dist/db/migrations.js.map +1 -1
- package/dist/db-admin/index.d.ts +3 -0
- package/dist/db-admin/index.d.ts.map +1 -0
- package/dist/db-admin/index.js +2 -0
- package/dist/db-admin/index.js.map +1 -0
- package/dist/db-admin/operations.d.ts +26 -5
- package/dist/db-admin/operations.d.ts.map +1 -1
- package/dist/db-admin/operations.js +66 -55
- package/dist/db-admin/operations.js.map +1 -1
- package/dist/jobs/scheduler.js +17 -10
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +2 -2
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +155 -1
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/context.d.ts +7 -0
- package/dist/org/context.d.ts.map +1 -1
- package/dist/org/context.js +54 -2
- package/dist/org/context.js.map +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +10 -6
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth-marketing.d.ts.map +1 -1
- package/dist/server/auth-marketing.js +0 -10
- package/dist/server/auth-marketing.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +6 -4
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +61 -0
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +219 -14
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/collab-plugin.d.ts.map +1 -1
- package/dist/server/collab-plugin.js +45 -13
- package/dist/server/collab-plugin.js.map +1 -1
- package/dist/server/design-token-utils.d.ts +1 -1
- package/dist/server/design-token-utils.js +1 -1
- package/dist/server/design-token-utils.js.map +1 -1
- package/dist/server/fusion-app.d.ts +107 -0
- package/dist/server/fusion-app.d.ts.map +1 -0
- package/dist/server/fusion-app.js +371 -0
- package/dist/server/fusion-app.js.map +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +3 -4
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/poll-events.d.ts +2 -0
- package/dist/server/poll-events.d.ts.map +1 -1
- package/dist/server/poll-events.js +7 -2
- package/dist/server/poll-events.js.map +1 -1
- package/dist/server/poll.d.ts +47 -3
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +176 -10
- package/dist/server/poll.js.map +1 -1
- package/dist/server/schema-prompt.d.ts.map +1 -1
- package/dist/server/schema-prompt.js +24 -7
- package/dist/server/schema-prompt.js.map +1 -1
- package/dist/settings/store.d.ts.map +1 -1
- package/dist/settings/store.js +32 -3
- package/dist/settings/store.js.map +1 -1
- package/dist/sharing/actions/set-resource-visibility.js +2 -0
- package/dist/sharing/actions/set-resource-visibility.js.map +1 -1
- package/dist/sharing/actions/share-resource.d.ts.map +1 -1
- package/dist/sharing/actions/share-resource.js +3 -0
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/sharing/actions/unshare-resource.js +2 -0
- package/dist/sharing/actions/unshare-resource.js.map +1 -1
- package/dist/styles/agent-native.css +0 -5
- package/dist/templates/default/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +8 -0
- package/dist/templates/default/app/root.tsx +47 -0
- package/dist/templates/default/package.json +3 -3
- package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +8 -0
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +22 -0
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +8 -0
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -0
- package/dist/tracking/providers.d.ts.map +1 -1
- package/dist/tracking/providers.js +17 -1
- package/dist/tracking/providers.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +0 -1
- package/docs/content/locales/ar-SA/cloneable-saas.mdx +0 -1
- package/docs/content/locales/ar-SA/plan-plugin.mdx +10 -9
- package/docs/content/locales/ar-SA/sharing.mdx +1 -2
- package/docs/content/locales/ar-SA/skills-guide.mdx +2 -3
- package/docs/content/locales/ar-SA/template-plan.mdx +23 -7
- package/docs/content/locales/ar-SA/tracking.mdx +1 -1
- package/docs/content/locales/ar-SA/workspace-connections.mdx +11 -11
- package/docs/content/locales/de-DE/cloneable-saas.mdx +0 -1
- package/docs/content/locales/de-DE/plan-plugin.mdx +10 -9
- package/docs/content/locales/de-DE/sharing.mdx +1 -2
- package/docs/content/locales/de-DE/skills-guide.mdx +2 -3
- package/docs/content/locales/de-DE/template-plan.mdx +23 -7
- package/docs/content/locales/de-DE/tracking.mdx +1 -1
- package/docs/content/locales/de-DE/workspace-connections.mdx +1 -1
- package/docs/content/locales/es-ES/cloneable-saas.mdx +0 -1
- package/docs/content/locales/es-ES/plan-plugin.mdx +10 -9
- package/docs/content/locales/es-ES/sharing.mdx +1 -2
- package/docs/content/locales/es-ES/skills-guide.mdx +2 -3
- package/docs/content/locales/es-ES/template-plan.mdx +23 -7
- package/docs/content/locales/es-ES/tracking.mdx +1 -1
- package/docs/content/locales/es-ES/workspace-connections.mdx +1 -1
- package/docs/content/locales/fr-FR/cloneable-saas.mdx +0 -1
- package/docs/content/locales/fr-FR/plan-plugin.mdx +10 -9
- package/docs/content/locales/fr-FR/sharing.mdx +1 -2
- package/docs/content/locales/fr-FR/skills-guide.mdx +2 -3
- package/docs/content/locales/fr-FR/template-plan.mdx +23 -7
- package/docs/content/locales/fr-FR/tracking.mdx +1 -1
- package/docs/content/locales/fr-FR/workspace-connections.mdx +1 -1
- package/docs/content/locales/hi-IN/cloneable-saas.mdx +0 -1
- package/docs/content/locales/hi-IN/plan-plugin.mdx +10 -9
- package/docs/content/locales/hi-IN/sharing.mdx +1 -2
- package/docs/content/locales/hi-IN/skills-guide.mdx +2 -3
- package/docs/content/locales/hi-IN/template-plan.mdx +23 -7
- package/docs/content/locales/hi-IN/tracking.mdx +1 -1
- package/docs/content/locales/hi-IN/workspace-connections.mdx +1 -1
- package/docs/content/locales/ja-JP/cloneable-saas.mdx +0 -1
- package/docs/content/locales/ja-JP/plan-plugin.mdx +10 -9
- package/docs/content/locales/ja-JP/sharing.mdx +1 -2
- package/docs/content/locales/ja-JP/skills-guide.mdx +2 -3
- package/docs/content/locales/ja-JP/template-plan.mdx +23 -7
- package/docs/content/locales/ja-JP/tracking.mdx +1 -1
- package/docs/content/locales/ja-JP/workspace-connections.mdx +1 -1
- package/docs/content/locales/ko-KR/cloneable-saas.mdx +0 -1
- package/docs/content/locales/ko-KR/plan-plugin.mdx +10 -9
- package/docs/content/locales/ko-KR/sharing.mdx +1 -2
- package/docs/content/locales/ko-KR/skills-guide.mdx +2 -3
- package/docs/content/locales/ko-KR/template-plan.mdx +23 -7
- package/docs/content/locales/ko-KR/tracking.mdx +1 -1
- package/docs/content/locales/ko-KR/workspace-connections.mdx +1 -1
- package/docs/content/locales/pt-BR/cloneable-saas.mdx +0 -1
- package/docs/content/locales/pt-BR/plan-plugin.mdx +10 -9
- package/docs/content/locales/pt-BR/sharing.mdx +1 -2
- package/docs/content/locales/pt-BR/skills-guide.mdx +2 -3
- package/docs/content/locales/pt-BR/template-plan.mdx +23 -7
- package/docs/content/locales/pt-BR/tracking.mdx +1 -1
- package/docs/content/locales/pt-BR/workspace-connections.mdx +1 -1
- package/docs/content/locales/zh-CN/cloneable-saas.mdx +0 -1
- package/docs/content/locales/zh-CN/plan-plugin.mdx +10 -9
- package/docs/content/locales/zh-CN/sharing.mdx +1 -2
- package/docs/content/locales/zh-CN/skills-guide.mdx +2 -3
- package/docs/content/locales/zh-CN/template-plan.mdx +23 -7
- package/docs/content/locales/zh-CN/tracking.mdx +1 -1
- package/docs/content/locales/zh-CN/workspace-connections.mdx +1 -1
- package/docs/content/locales/zh-TW/cloneable-saas.mdx +0 -1
- package/docs/content/locales/zh-TW/plan-plugin.mdx +10 -9
- package/docs/content/locales/zh-TW/sharing.mdx +1 -2
- package/docs/content/locales/zh-TW/skills-guide.mdx +2 -3
- package/docs/content/locales/zh-TW/template-plan.mdx +23 -7
- package/docs/content/locales/zh-TW/tracking.mdx +1 -1
- package/docs/content/locales/zh-TW/workspace-connections.mdx +1 -1
- package/docs/content/plan-plugin.mdx +12 -11
- package/docs/content/sharing.mdx +1 -2
- package/docs/content/skills-guide.mdx +4 -3
- package/docs/content/template-plan.mdx +37 -6
- package/docs/content/tracking.mdx +1 -1
- package/docs/content/workspace-connections.mdx +1 -1
- package/package.json +7 -6
- package/src/templates/default/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +8 -0
- package/src/templates/default/app/root.tsx +47 -0
- package/src/templates/default/package.json +3 -3
- package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +8 -0
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +22 -0
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +82 -19
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +15 -0
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +8 -0
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +1 -0
- package/corpus/core/docs/content/locales/ar-SA/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/de-DE/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/es-ES/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/fr-FR/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/hi-IN/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/ja-JP/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/ko-KR/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/pt-BR/template-videos.mdx +0 -336
- package/corpus/core/docs/content/locales/zh-CN/template-videos.mdx +0 -334
- package/corpus/core/docs/content/locales/zh-TW/template-videos.mdx +0 -334
- package/corpus/core/docs/content/template-videos.mdx +0 -332
- package/corpus/templates/design/app/components/design/CodeWorkbenchHost.tsx +0 -697
- package/corpus/templates/slides/app/components/editor/CodeEditor.tsx +0 -49
- package/corpus/templates/videos/.agents/skills/actions/SKILL.md +0 -432
- package/corpus/templates/videos/.agents/skills/animation-tracks/SKILL.md +0 -99
- package/corpus/templates/videos/.agents/skills/capture-learnings/SKILL.md +0 -76
- package/corpus/templates/videos/.agents/skills/composition-management/SKILL.md +0 -106
- package/corpus/templates/videos/.agents/skills/create-skill/SKILL.md +0 -221
- package/corpus/templates/videos/.agents/skills/delegate-to-agent/SKILL.md +0 -263
- package/corpus/templates/videos/.agents/skills/frontend-design/SKILL.md +0 -112
- package/corpus/templates/videos/.agents/skills/security/SKILL.md +0 -263
- package/corpus/templates/videos/.agents/skills/self-modifying-code/SKILL.md +0 -88
- package/corpus/templates/videos/.agents/skills/shadcn-ui/SKILL.md +0 -95
- package/corpus/templates/videos/.builder/ANIMATED_PROPERTIES.md +0 -335
- package/corpus/templates/videos/.builder/KEYFRAME_SYNC.md +0 -166
- package/corpus/templates/videos/.builder/SEAMLESS_SYNC.md +0 -211
- package/corpus/templates/videos/.builder/rules/deploy-app.mdc +0 -22
- package/corpus/templates/videos/.builder/rules/organize-ui.mdc +0 -9
- package/corpus/templates/videos/.builder/skills/remotion/SKILL.md +0 -29
- package/corpus/templates/videos/.builder/skills/remotion/rules/animations.md +0 -27
- package/corpus/templates/videos/.builder/skills/remotion/rules/assets.md +0 -43
- package/corpus/templates/videos/.builder/skills/remotion/rules/audio.md +0 -58
- package/corpus/templates/videos/.builder/skills/remotion/rules/compositions.md +0 -129
- package/corpus/templates/videos/.builder/skills/remotion/rules/fonts.md +0 -47
- package/corpus/templates/videos/.builder/skills/remotion/rules/images.md +0 -41
- package/corpus/templates/videos/.builder/skills/remotion/rules/parameters.md +0 -59
- package/corpus/templates/videos/.builder/skills/remotion/rules/sequencing.md +0 -54
- package/corpus/templates/videos/.builder/skills/remotion/rules/tailwind.md +0 -11
- package/corpus/templates/videos/.builder/skills/remotion/rules/text-animations.md +0 -18
- package/corpus/templates/videos/.builder/skills/remotion/rules/timing.md +0 -103
- package/corpus/templates/videos/.builder/skills/remotion/rules/transparent-videos.md +0 -35
- package/corpus/templates/videos/.builder/skills/remotion/rules/trimming.md +0 -38
- package/corpus/templates/videos/.builder/skills/remotion/rules/videos.md +0 -54
- package/corpus/templates/videos/.dockerignore +0 -62
- package/corpus/templates/videos/.env.example +0 -4
- package/corpus/templates/videos/.oxfmtrc.json +0 -8
- package/corpus/templates/videos/AGENTS.md +0 -46
- package/corpus/templates/videos/CHANGELOG.md +0 -10
- package/corpus/templates/videos/DEVELOPING.md +0 -143
- package/corpus/templates/videos/README.md +0 -33
- package/corpus/templates/videos/actions/analyze-brand-assets.ts +0 -151
- package/corpus/templates/videos/actions/apply-design-system.ts +0 -35
- package/corpus/templates/videos/actions/create-design-system.ts +0 -84
- package/corpus/templates/videos/actions/create-folder.ts +0 -48
- package/corpus/templates/videos/actions/db-connect.ts +0 -45
- package/corpus/templates/videos/actions/db-health.ts +0 -24
- package/corpus/templates/videos/actions/db-status.ts +0 -28
- package/corpus/templates/videos/actions/delete-composition.ts +0 -272
- package/corpus/templates/videos/actions/delete-folder.ts +0 -27
- package/corpus/templates/videos/actions/generate-animated-component.ts +0 -470
- package/corpus/templates/videos/actions/get-composition.ts +0 -36
- package/corpus/templates/videos/actions/get-design-system.ts +0 -35
- package/corpus/templates/videos/actions/import-code.ts +0 -67
- package/corpus/templates/videos/actions/import-design-project.ts +0 -42
- package/corpus/templates/videos/actions/import-document.ts +0 -125
- package/corpus/templates/videos/actions/import-from-url.ts +0 -18
- package/corpus/templates/videos/actions/import-github.ts +0 -182
- package/corpus/templates/videos/actions/list-compositions.ts +0 -32
- package/corpus/templates/videos/actions/list-design-systems.ts +0 -66
- package/corpus/templates/videos/actions/list-folders.ts +0 -61
- package/corpus/templates/videos/actions/move-composition-to-folder.ts +0 -59
- package/corpus/templates/videos/actions/navigate.ts +0 -40
- package/corpus/templates/videos/actions/rename-folder.ts +0 -41
- package/corpus/templates/videos/actions/run.ts +0 -2
- package/corpus/templates/videos/actions/save-composition.ts +0 -114
- package/corpus/templates/videos/actions/set-default-design-system.ts +0 -40
- package/corpus/templates/videos/actions/update-composition.ts +0 -81
- package/corpus/templates/videos/actions/update-design-system.ts +0 -68
- package/corpus/templates/videos/actions/validate-compositions.ts +0 -502
- package/corpus/templates/videos/actions/view-screen.ts +0 -48
- package/corpus/templates/videos/app/components/CameraControls.tsx +0 -442
- package/corpus/templates/videos/app/components/CameraToolbar.tsx +0 -437
- package/corpus/templates/videos/app/components/CloudUpgrade.tsx +0 -287
- package/corpus/templates/videos/app/components/CollabPresenceBar.tsx +0 -81
- package/corpus/templates/videos/app/components/CompSettingsEditor.tsx +0 -107
- package/corpus/templates/videos/app/components/ComponentLibrarySidebar.tsx +0 -457
- package/corpus/templates/videos/app/components/ComponentPropsPanel.tsx +0 -227
- package/corpus/templates/videos/app/components/ComponentsSidebar.tsx +0 -70
- package/corpus/templates/videos/app/components/CompositionCard.tsx +0 -147
- package/corpus/templates/videos/app/components/CurrentElementPanel.tsx +0 -835
- package/corpus/templates/videos/app/components/CursorControls.tsx +0 -664
- package/corpus/templates/videos/app/components/CursorPositioningOverlay.tsx +0 -238
- package/corpus/templates/videos/app/components/LibraryFolderRow.tsx +0 -235
- package/corpus/templates/videos/app/components/MotionCurveSelect.tsx +0 -61
- package/corpus/templates/videos/app/components/NewCompositionPopover.tsx +0 -192
- package/corpus/templates/videos/app/components/PropsEditor.tsx +0 -210
- package/corpus/templates/videos/app/components/QuestionFlow.tsx +0 -40
- package/corpus/templates/videos/app/components/Sidebar.tsx +0 -609
- package/corpus/templates/videos/app/components/StudioHeader.tsx +0 -109
- package/corpus/templates/videos/app/components/Timeline.tsx +0 -2067
- package/corpus/templates/videos/app/components/TrackPropertiesPanel.tsx +0 -922
- package/corpus/templates/videos/app/components/TweaksPanel.tsx +0 -277
- package/corpus/templates/videos/app/components/VideoPlayer.tsx +0 -487
- package/corpus/templates/videos/app/components/design-system/DesignSystemCard.tsx +0 -134
- package/corpus/templates/videos/app/components/design-system/DesignSystemPreview.tsx +0 -176
- package/corpus/templates/videos/app/components/design-system/DesignSystemSetup.tsx +0 -707
- package/corpus/templates/videos/app/components/keyframes/KeyframeActionButtons.tsx +0 -78
- package/corpus/templates/videos/app/components/keyframes/KeyframeNavigation.tsx +0 -59
- package/corpus/templates/videos/app/components/keyframes/PropertyNumberInput.tsx +0 -56
- package/corpus/templates/videos/app/components/layout/Header.tsx +0 -64
- package/corpus/templates/videos/app/components/layout/HeaderActions.tsx +0 -84
- package/corpus/templates/videos/app/components/layout/Layout.tsx +0 -132
- package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +0 -180
- package/corpus/templates/videos/app/components/ui/accordion.tsx +0 -56
- package/corpus/templates/videos/app/components/ui/alert-dialog.tsx +0 -139
- package/corpus/templates/videos/app/components/ui/alert.tsx +0 -59
- package/corpus/templates/videos/app/components/ui/aspect-ratio.tsx +0 -5
- package/corpus/templates/videos/app/components/ui/avatar.tsx +0 -48
- package/corpus/templates/videos/app/components/ui/badge.tsx +0 -37
- package/corpus/templates/videos/app/components/ui/breadcrumb.tsx +0 -115
- package/corpus/templates/videos/app/components/ui/button.tsx +0 -57
- package/corpus/templates/videos/app/components/ui/calendar.tsx +0 -68
- package/corpus/templates/videos/app/components/ui/card.tsx +0 -86
- package/corpus/templates/videos/app/components/ui/carousel.tsx +0 -260
- package/corpus/templates/videos/app/components/ui/chart.tsx +0 -375
- package/corpus/templates/videos/app/components/ui/checkbox.tsx +0 -28
- package/corpus/templates/videos/app/components/ui/collapsible.tsx +0 -9
- package/corpus/templates/videos/app/components/ui/command.tsx +0 -154
- package/corpus/templates/videos/app/components/ui/context-menu.tsx +0 -202
- package/corpus/templates/videos/app/components/ui/dialog.tsx +0 -130
- package/corpus/templates/videos/app/components/ui/drawer.tsx +0 -116
- package/corpus/templates/videos/app/components/ui/dropdown-menu.tsx +0 -212
- package/corpus/templates/videos/app/components/ui/form.tsx +0 -177
- package/corpus/templates/videos/app/components/ui/hover-card.tsx +0 -27
- package/corpus/templates/videos/app/components/ui/input-otp.tsx +0 -69
- package/corpus/templates/videos/app/components/ui/input.tsx +0 -22
- package/corpus/templates/videos/app/components/ui/label.tsx +0 -24
- package/corpus/templates/videos/app/components/ui/menubar.tsx +0 -234
- package/corpus/templates/videos/app/components/ui/navigation-menu.tsx +0 -128
- package/corpus/templates/videos/app/components/ui/pagination.tsx +0 -121
- package/corpus/templates/videos/app/components/ui/popover.tsx +0 -44
- package/corpus/templates/videos/app/components/ui/progress.tsx +0 -26
- package/corpus/templates/videos/app/components/ui/radio-group.tsx +0 -42
- package/corpus/templates/videos/app/components/ui/resizable.tsx +0 -43
- package/corpus/templates/videos/app/components/ui/scroll-area.tsx +0 -46
- package/corpus/templates/videos/app/components/ui/select.tsx +0 -158
- package/corpus/templates/videos/app/components/ui/separator.tsx +0 -29
- package/corpus/templates/videos/app/components/ui/sheet.tsx +0 -160
- package/corpus/templates/videos/app/components/ui/sidebar.tsx +0 -782
- package/corpus/templates/videos/app/components/ui/skeleton.tsx +0 -15
- package/corpus/templates/videos/app/components/ui/slider.tsx +0 -26
- package/corpus/templates/videos/app/components/ui/sonner.tsx +0 -58
- package/corpus/templates/videos/app/components/ui/spinner.tsx +0 -17
- package/corpus/templates/videos/app/components/ui/switch.tsx +0 -27
- package/corpus/templates/videos/app/components/ui/table.tsx +0 -117
- package/corpus/templates/videos/app/components/ui/tabs.tsx +0 -53
- package/corpus/templates/videos/app/components/ui/textarea.tsx +0 -23
- package/corpus/templates/videos/app/components/ui/toast.tsx +0 -127
- package/corpus/templates/videos/app/components/ui/toaster.tsx +0 -33
- package/corpus/templates/videos/app/components/ui/toggle-group.tsx +0 -59
- package/corpus/templates/videos/app/components/ui/toggle.tsx +0 -43
- package/corpus/templates/videos/app/components/ui/tooltip.tsx +0 -30
- package/corpus/templates/videos/app/components/ui/use-toast.ts +0 -3
- package/corpus/templates/videos/app/config/constants.ts +0 -204
- package/corpus/templates/videos/app/contexts/CompositionContext.tsx +0 -437
- package/corpus/templates/videos/app/contexts/CurrentElementContext.tsx +0 -247
- package/corpus/templates/videos/app/contexts/PlaybackContext.tsx +0 -65
- package/corpus/templates/videos/app/contexts/TimelineContext.tsx +0 -433
- package/corpus/templates/videos/app/entry.client.tsx +0 -19
- package/corpus/templates/videos/app/entry.server.tsx +0 -10
- package/corpus/templates/videos/app/global.css +0 -171
- package/corpus/templates/videos/app/hooks/use-composition-collab.ts +0 -269
- package/corpus/templates/videos/app/hooks/use-composition-design-system.ts +0 -47
- package/corpus/templates/videos/app/hooks/use-database-compositions.ts +0 -144
- package/corpus/templates/videos/app/hooks/use-db-status.ts +0 -30
- package/corpus/templates/videos/app/hooks/use-design-systems.ts +0 -21
- package/corpus/templates/videos/app/hooks/use-folders.ts +0 -199
- package/corpus/templates/videos/app/hooks/use-mobile.tsx +0 -21
- package/corpus/templates/videos/app/hooks/use-navigation-state.ts +0 -52
- package/corpus/templates/videos/app/hooks/use-question-flow.ts +0 -14
- package/corpus/templates/videos/app/hooks/use-toast.ts +0 -188
- package/corpus/templates/videos/app/hooks/useUnsavedChanges.ts +0 -48
- package/corpus/templates/videos/app/i18n/ar-SA.ts +0 -446
- package/corpus/templates/videos/app/i18n/de-DE.ts +0 -470
- package/corpus/templates/videos/app/i18n/en-US.ts +0 -452
- package/corpus/templates/videos/app/i18n/es-ES.ts +0 -468
- package/corpus/templates/videos/app/i18n/fr-FR.ts +0 -469
- package/corpus/templates/videos/app/i18n/hi-IN.ts +0 -446
- package/corpus/templates/videos/app/i18n/index.ts +0 -34
- package/corpus/templates/videos/app/i18n/ja-JP.ts +0 -460
- package/corpus/templates/videos/app/i18n/ko-KR.ts +0 -453
- package/corpus/templates/videos/app/i18n/pt-BR.ts +0 -461
- package/corpus/templates/videos/app/i18n/zh-CN.ts +0 -437
- package/corpus/templates/videos/app/i18n/zh-TW.ts +0 -437
- package/corpus/templates/videos/app/lib/database-compositions.ts +0 -67
- package/corpus/templates/videos/app/lib/design-systems.ts +0 -234
- package/corpus/templates/videos/app/lib/tab-id.ts +0 -1
- package/corpus/templates/videos/app/lib/utils.ts +0 -1
- package/corpus/templates/videos/app/pages/ComponentLibrary.tsx +0 -134
- package/corpus/templates/videos/app/pages/ComponentLibraryView.tsx +0 -362
- package/corpus/templates/videos/app/pages/CompositionView.tsx +0 -715
- package/corpus/templates/videos/app/pages/DesignSystems.tsx +0 -180
- package/corpus/templates/videos/app/pages/Index.tsx +0 -258
- package/corpus/templates/videos/app/pages/NewComposition.tsx +0 -95
- package/corpus/templates/videos/app/pages/NotFound.tsx +0 -36
- package/corpus/templates/videos/app/remotion/CameraHost.tsx +0 -223
- package/corpus/templates/videos/app/remotion/animations/useElementAnimations.ts +0 -231
- package/corpus/templates/videos/app/remotion/componentRegistry.ts +0 -473
- package/corpus/templates/videos/app/remotion/components/AnimatedElement.tsx +0 -436
- package/corpus/templates/videos/app/remotion/components/InteractiveElement.tsx +0 -159
- package/corpus/templates/videos/app/remotion/components/InteractiveZoneEditor.tsx +0 -273
- package/corpus/templates/videos/app/remotion/compositions/BlankComposition.tsx +0 -204
- package/corpus/templates/videos/app/remotion/compositions/index.ts +0 -2
- package/corpus/templates/videos/app/remotion/createComponentCursorTrack.ts +0 -132
- package/corpus/templates/videos/app/remotion/docs/CURSOR_TRACKS.md +0 -285
- package/corpus/templates/videos/app/remotion/easingFunctions.ts +0 -255
- package/corpus/templates/videos/app/remotion/hooks/createInteractiveComposition.tsx +0 -283
- package/corpus/templates/videos/app/remotion/hooks/useCursorHistory.ts +0 -72
- package/corpus/templates/videos/app/remotion/hooks/useCursorTypeFromHover.ts +0 -35
- package/corpus/templates/videos/app/remotion/hooks/useEditableZones.tsx +0 -267
- package/corpus/templates/videos/app/remotion/hooks/useHoverAnimation.ts +0 -90
- package/corpus/templates/videos/app/remotion/hooks/useHoverAnimationSmooth.ts +0 -146
- package/corpus/templates/videos/app/remotion/hooks/useInteractiveComponent.ts +0 -711
- package/corpus/templates/videos/app/remotion/hooks/useRegisterInteractiveElement.ts +0 -56
- package/corpus/templates/videos/app/remotion/library-components/Button.tsx +0 -252
- package/corpus/templates/videos/app/remotion/library-components/Card.tsx +0 -241
- package/corpus/templates/videos/app/remotion/library-components/CodePanel.tsx +0 -1005
- package/corpus/templates/videos/app/remotion/library-components/FileItem.tsx +0 -196
- package/corpus/templates/videos/app/remotion/library-components/FolderItem.tsx +0 -199
- package/corpus/templates/videos/app/remotion/library-components/PrimaryButton.tsx +0 -177
- package/corpus/templates/videos/app/remotion/library-components/SecondaryButton.tsx +0 -167
- package/corpus/templates/videos/app/remotion/library-components/SectionHeader.tsx +0 -108
- package/corpus/templates/videos/app/remotion/library-components/TEMPLATE.tsx +0 -211
- package/corpus/templates/videos/app/remotion/library-components/index.ts +0 -10
- package/corpus/templates/videos/app/remotion/registry.ts +0 -91
- package/corpus/templates/videos/app/remotion/testing/animationTestUtils.ts +0 -366
- package/corpus/templates/videos/app/remotion/trackAnimation.ts +0 -179
- package/corpus/templates/videos/app/remotion/trackHelpers.ts +0 -110
- package/corpus/templates/videos/app/remotion/ui-components/Cursor.tsx +0 -182
- package/corpus/templates/videos/app/remotion/ui-components/InteractiveButton.tsx +0 -116
- package/corpus/templates/videos/app/remotion/ui-components/InteractiveCard.tsx +0 -126
- package/corpus/templates/videos/app/remotion/ui-components/index.ts +0 -16
- package/corpus/templates/videos/app/remotion/utils/animationHelpers.ts +0 -444
- package/corpus/templates/videos/app/remotion/utils/interactiveElements.ts +0 -235
- package/corpus/templates/videos/app/remotion/utils/springAnimation.ts +0 -76
- package/corpus/templates/videos/app/root.tsx +0 -165
- package/corpus/templates/videos/app/routes/$.tsx +0 -10
- package/corpus/templates/videos/app/routes/_index.tsx +0 -25
- package/corpus/templates/videos/app/routes/c.$compositionId.tsx +0 -10
- package/corpus/templates/videos/app/routes/components.tsx +0 -10
- package/corpus/templates/videos/app/routes/design-systems.tsx +0 -10
- package/corpus/templates/videos/app/routes/extensions.$id.$slug.tsx +0 -2
- package/corpus/templates/videos/app/routes/extensions.$id.tsx +0 -5
- package/corpus/templates/videos/app/routes/extensions._index.tsx +0 -5
- package/corpus/templates/videos/app/routes/extensions.tsx +0 -5
- package/corpus/templates/videos/app/routes/settings.tsx +0 -88
- package/corpus/templates/videos/app/routes/team.tsx +0 -11
- package/corpus/templates/videos/app/routes.ts +0 -4
- package/corpus/templates/videos/app/state.ts +0 -77
- package/corpus/templates/videos/app/types/elementAnimations.ts +0 -121
- package/corpus/templates/videos/app/types.ts +0 -200
- package/corpus/templates/videos/app/utils/compositionHelpers.ts +0 -445
- package/corpus/templates/videos/app/utils/debug.ts +0 -63
- package/corpus/templates/videos/app/utils/keyframeUtils.ts +0 -331
- package/corpus/templates/videos/app/utils/timelineCoordinates.ts +0 -79
- package/corpus/templates/videos/app/vite-env.d.ts +0 -6
- package/corpus/templates/videos/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +0 -6
- package/corpus/templates/videos/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +0 -6
- package/corpus/templates/videos/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +0 -6
- package/corpus/templates/videos/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +0 -6
- package/corpus/templates/videos/changelog/2026-06-29-video-layouts-adapt-when-the-agent-sidebar-is-open.md +0 -6
- package/corpus/templates/videos/components.json +0 -20
- package/corpus/templates/videos/data/sync-config.json +0 -3
- package/corpus/templates/videos/docs/examples/create-composition.example.ts +0 -128
- package/corpus/templates/videos/drizzle.config.ts +0 -3
- package/corpus/templates/videos/learnings.defaults.md +0 -5
- package/corpus/templates/videos/package.json +0 -114
- package/corpus/templates/videos/public/agent-native-icon-dark.svg +0 -10
- package/corpus/templates/videos/public/agent-native-icon-light.svg +0 -10
- package/corpus/templates/videos/public/agent-native-logo-dark.svg +0 -21
- package/corpus/templates/videos/public/agent-native-logo-light.svg +0 -21
- package/corpus/templates/videos/public/favicon.svg +0 -1
- package/corpus/templates/videos/public/icon-180.svg +0 -1
- package/corpus/templates/videos/public/icon-192.svg +0 -1
- package/corpus/templates/videos/public/icon-512.svg +0 -1
- package/corpus/templates/videos/public/manifest.json +0 -21
- package/corpus/templates/videos/public/placeholder.svg +0 -1
- package/corpus/templates/videos/public/robots.txt +0 -14
- package/corpus/templates/videos/react-router.config.ts +0 -7
- package/corpus/templates/videos/server/db/index.ts +0 -37
- package/corpus/templates/videos/server/db/schema.ts +0 -55
- package/corpus/templates/videos/server/middleware/auth.ts +0 -15
- package/corpus/templates/videos/server/plugins/agent-chat.ts +0 -29
- package/corpus/templates/videos/server/plugins/auth.ts +0 -14
- package/corpus/templates/videos/server/plugins/collab.ts +0 -11
- package/corpus/templates/videos/server/plugins/core-routes.ts +0 -22
- package/corpus/templates/videos/server/plugins/db.ts +0 -160
- package/corpus/templates/videos/server/routes/[...page].get.ts +0 -5
- package/corpus/templates/videos/server/routes/[...page].head.ts +0 -1
- package/corpus/templates/videos/server/routes/api/save-composition-defaults.post.ts +0 -274
- package/corpus/templates/videos/shared/api.ts +0 -75
- package/corpus/templates/videos/ssr-entry.ts +0 -15
- package/corpus/templates/videos/tsconfig.json +0 -21
- package/corpus/templates/videos/vite.config.ts +0 -19
- package/corpus/templates/videos/vitest.config.ts +0 -16
- package/docs/content/locales/ar-SA/template-videos.mdx +0 -336
- package/docs/content/locales/de-DE/template-videos.mdx +0 -336
- package/docs/content/locales/es-ES/template-videos.mdx +0 -336
- package/docs/content/locales/fr-FR/template-videos.mdx +0 -336
- package/docs/content/locales/hi-IN/template-videos.mdx +0 -336
- package/docs/content/locales/ja-JP/template-videos.mdx +0 -336
- package/docs/content/locales/ko-KR/template-videos.mdx +0 -336
- package/docs/content/locales/pt-BR/template-videos.mdx +0 -336
- package/docs/content/locales/zh-CN/template-videos.mdx +0 -334
- package/docs/content/locales/zh-TW/template-videos.mdx +0 -334
- package/docs/content/template-videos.mdx +0 -332
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrgSwitcher.js","sourceRoot":"","sources":["../../../src/client/org/OrgSwitcher.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,0BAA0B,CAAC;AAiBlC,SAAS,sBAAsB,CAAC,KAAgC;IAC9D,IA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GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAC9B,QAAQ,EAAE,YAAY,CAAC,SAAS,EAChC,SAAS,EAAC,8GAA8G,uBAGjH,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EACvD,SAAS,EAAC,yKAAyK,YAElL,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CACxB,KAAC,WAAW,IAAC,SAAS,EAAC,sBAAsB,GAAG,CACjD,CAAC,CAAC,CAAC,CACF,aAAa,CACd,GACM,IACL,IACD,CACR,IACwB,GACH,IACJ,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport {\n IconApps,\n IconArrowUpRight,\n IconBrain,\n IconBrandJira,\n IconBrush,\n IconBuilding,\n IconCalendar,\n IconCalendarTime,\n IconChartBar,\n IconCheck,\n IconChevronRight,\n IconClipboardList,\n IconCode,\n IconContract,\n IconFileText,\n IconLayoutBoard,\n IconLoader2,\n IconLogout,\n IconMail,\n IconMessageCircle,\n IconMicrophone,\n IconNote,\n IconPhone,\n IconPhoto,\n IconPlus,\n IconPresentation,\n IconRoute,\n IconScreenShare,\n IconSelector,\n IconSettings,\n IconStack2,\n IconUser,\n IconUserPlus,\n IconUsers,\n IconVideo,\n IconWorld,\n} from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { useNavigate } from \"react-router\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n useOrg,\n useSwitchOrg,\n useCreateOrg,\n useInviteMember,\n useAcceptInvitation,\n useJoinByDomain,\n} from \"./hooks.js\";\nimport {\n ORG_SWITCHER_MAX_APP_LINKS,\n useOrgSwitcherAppLinks,\n visibleOrgAppLinks,\n type OrgSwitcherAppLink,\n} from \"./workspace-app-links.js\";\n\nexport interface OrgSwitcherProps {\n className?: string;\n /** Hide entirely when the user only belongs to one org. Default: false. */\n hideWhenSingle?: boolean;\n /** Keep the switcher's button height reserved while org state is loading. */\n reserveSpace?: boolean;\n /**\n * Path to navigate to when the user clicks \"Organization settings\".\n * Defaults to the standard Team tab inside Settings. Templates with an\n * established org surface can pass their own path; pass `null` to only open\n * the in-sidebar settings panel.\n */\n settingsPath?: string | null;\n}\n\nfunction personalLabelFromEmail(email: string | null | undefined): string {\n if (!email) return \"Personal\";\n const local = email.split(\"@\")[0] ?? email;\n const cleaned = local.replace(/[._-]+/g, \" \").trim();\n if (!cleaned) return \"Personal\";\n return cleaned\n .split(\" \")\n .filter(Boolean)\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\ntype Mode = \"list\" | \"create\" | \"invite\";\n\nconst POPOVER_CONTENT_CLASS =\n \"z-50 min-w-[14rem] rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst ITEM_CLASS =\n \"flex w-full items-center gap-2 px-2.5 py-1.5 text-xs text-foreground hover:bg-accent focus-visible:bg-accent focus:outline-none disabled:opacity-50 disabled:pointer-events-none\";\n\nconst SECTION_LABEL_CLASS =\n \"px-2.5 pt-1 pb-0.5 text-[10px] uppercase tracking-wide text-muted-foreground\";\n\nconst APP_SUBMENU_CONTENT_CLASS =\n \"z-50 w-72 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst SWITCHER_BUTTON_CLASS =\n \"flex w-full items-center gap-2 rounded-md border border-border/70 px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60 cursor-pointer\";\n\nconst DEFAULT_ORGANIZATION_SETTINGS_PATH = \"/settings#team\";\n\nconst APP_ICON_MAP: Record<string, typeof IconApps> = {\n Mail: IconMail,\n CalendarDays: IconCalendar,\n FileText: IconFileText,\n LayoutBoard: IconLayoutBoard,\n BarChart2: IconChartBar,\n GalleryHorizontal: IconPresentation,\n Video: IconVideo,\n BrandJira: IconBrandJira,\n ClipboardList: IconClipboardList,\n Users: IconUsers,\n Code: IconCode,\n Contract: IconContract,\n MessageCircle: IconMessageCircle,\n Route: IconRoute,\n ScreenShare: IconScreenShare,\n Brush: IconBrush,\n Brain: IconBrain,\n Phone: IconPhone,\n Note: IconNote,\n Microphone: IconMicrophone,\n CalendarTime: IconCalendarTime,\n Globe: IconWorld,\n Photo: IconPhoto,\n};\n\nfunction appMenuIcon(app: OrgSwitcherAppLink): typeof IconApps {\n if (app.icon) return APP_ICON_MAP[app.icon] ?? IconStack2;\n return app.isDispatch ? IconMessageCircle : IconStack2;\n}\n\nfunction organizationSettingsPath(path: string): string {\n return path.includes(\"#\") ? path : `${path}#team`;\n}\n\nfunction AppMenuLink({\n app,\n onNavigate,\n}: {\n app: OrgSwitcherAppLink;\n onNavigate: () => void;\n}) {\n const Icon = appMenuIcon(app);\n return (\n <a\n href={app.href}\n onClick={onNavigate}\n className={`flex items-center gap-2 rounded-sm px-2.5 py-2 text-xs outline-none hover:bg-accent focus:bg-accent ${\n app.isDispatch ? \"border border-primary/20 bg-primary/5\" : \"\"\n }`}\n >\n <span\n className={`flex h-7 w-7 shrink-0 items-center justify-center rounded-md ${\n app.isDispatch\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground\"\n }`}\n >\n <Icon className=\"h-3.5 w-3.5\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium text-foreground\">\n {app.name}\n </span>\n <span className=\"block truncate text-[11px] text-muted-foreground\">\n {app.isDispatch\n ? \"Main hub\"\n : app.status === \"pending\"\n ? \"Building\"\n : \"Open app\"}\n </span>\n </span>\n <IconArrowUpRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </a>\n );\n}\n\nfunction AppsSubmenu({\n apps,\n isWorkspace,\n isLoading,\n dispatchHref,\n dispatchAllAppsHref,\n onNavigate,\n}: {\n apps: OrgSwitcherAppLink[];\n isWorkspace: boolean;\n isLoading: boolean;\n dispatchHref: string;\n dispatchAllAppsHref: string;\n onNavigate: () => void;\n}) {\n const { links, overflowCount } = visibleOrgAppLinks(apps);\n const visibleDispatchApp = links.find((app) => app.isDispatch);\n const dispatchApp =\n visibleDispatchApp ??\n ({\n id: \"dispatch\",\n name: \"Dispatch\",\n href: dispatchHref,\n isDispatch: true,\n status: \"ready\",\n } satisfies OrgSwitcherAppLink);\n const visibleNonDispatch = links\n .filter((app) => !app.isDispatch)\n .slice(0, visibleDispatchApp ? undefined : ORG_SWITCHER_MAX_APP_LINKS - 1);\n const shownCount = (dispatchApp ? 1 : 0) + visibleNonDispatch.length;\n const remainingCount = Math.max(overflowCount, apps.length - shownCount);\n\n return (\n <PopoverPrimitive.Root>\n <PopoverPrimitive.Trigger asChild>\n <button type=\"button\" className={`${ITEM_CLASS} cursor-pointer`}>\n <IconApps className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Apps</span>\n <span className=\"text-[11px] text-muted-foreground\">\n {isLoading ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n apps.length\n )}\n </span>\n <IconChevronRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"right\"\n align=\"start\"\n sideOffset={8}\n collisionPadding={12}\n className={APP_SUBMENU_CONTENT_CLASS}\n >\n <div className=\"px-2.5 py-1.5\">\n <div className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">\n {isWorkspace ? \"Workspace apps\" : \"Default apps\"}\n </div>\n <div className=\"mt-0.5 text-[11px] text-muted-foreground\">\n {isWorkspace\n ? \"Dispatch is the workspace hub.\"\n : \"Dispatch is the home base.\"}\n </div>\n </div>\n\n <AppMenuLink app={dispatchApp} onNavigate={onNavigate} />\n\n {visibleNonDispatch.length > 0 && (\n <div className=\"my-1 h-px bg-border\" />\n )}\n {visibleNonDispatch.map((app) => (\n <AppMenuLink key={app.id} app={app} onNavigate={onNavigate} />\n ))}\n\n {remainingCount > 0 && (\n <>\n <div className=\"my-1 h-px bg-border\" />\n <a\n href={dispatchAllAppsHref}\n onClick={onNavigate}\n className=\"flex items-center gap-2 rounded-sm px-2.5 py-1.5 text-xs text-foreground outline-none hover:bg-accent focus:bg-accent\"\n >\n <IconMessageCircle className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1\">\n {`View ${remainingCount} more in Dispatch`}\n </span>\n <IconArrowUpRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </a>\n </>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n\nfunction ReservedOrgSwitcherSpace({ className }: { className?: string }) {\n return <div aria-hidden=\"true\" className={`h-8 ${className ?? \"\"}`} />;\n}\n\nfunction OrgSwitcherLoadingPlaceholder({ className }: { className?: string }) {\n return (\n <button\n type=\"button\"\n disabled\n aria-label=\"Loading organization\"\n className={`${SWITCHER_BUTTON_CLASS} animate-pulse ${className ?? \"\"}`}\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 opacity-60\" />\n <span className=\"h-3 min-w-0 flex-1 rounded-sm bg-muted-foreground/20\" />\n <IconSelector className=\"h-3 w-3 shrink-0 opacity-30\" />\n </button>\n );\n}\n\n/**\n * Compact org switcher button. Shows the active org (or \"Personal\" when the\n * user has none); opens a popover with the user's other orgs, pending\n * invitations, inline forms to create a new org / invite a teammate, and a\n * sign-out item. Renders nothing in dev / no-auth mode.\n */\nexport function OrgSwitcher({\n className,\n hideWhenSingle,\n reserveSpace,\n settingsPath = DEFAULT_ORGANIZATION_SETTINGS_PATH,\n}: OrgSwitcherProps) {\n const { data: org, isLoading } = useOrg();\n const switchOrg = useSwitchOrg();\n const createOrg = useCreateOrg();\n const inviteMember = useInviteMember();\n const acceptInvitation = useAcceptInvitation();\n const joinByDomain = useJoinByDomain();\n const navigate = useNavigate();\n const [open, setOpen] = useState(false);\n const [mode, setMode] = useState<Mode>(\"list\");\n const [newName, setNewName] = useState(\"\");\n const [inviteEmail, setInviteEmail] = useState(\"\");\n const [signingOut, setSigningOut] = useState(false);\n const [joiningOrgId, setJoiningOrgId] = useState<string | null>(null);\n const appLinks = useOrgSwitcherAppLinks(open);\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next);\n if (!next) {\n setMode(\"list\");\n setNewName(\"\");\n setInviteEmail(\"\");\n }\n };\n\n const handleSignOut = async () => {\n if (signingOut) return;\n setSigningOut(true);\n try {\n await fetch(agentNativePath(\"/_agent-native/auth/logout\"), {\n method: \"POST\",\n credentials: \"include\",\n });\n } catch {\n /* fall through to reload — server may already have cleared the cookie */\n }\n window.location.reload();\n };\n\n if (!org) {\n return reserveSpace && isLoading ? (\n <OrgSwitcherLoadingPlaceholder className={className} />\n ) : null;\n }\n\n const orgs = org.orgs ?? [];\n const pendingInvitations = org.pendingInvitations ?? [];\n const domainMatches = org.domainMatches ?? [];\n const orgCount = orgs.length;\n const hasAny =\n orgCount > 0 || pendingInvitations.length > 0 || domainMatches.length > 0;\n if (!hasAny && !org.email) {\n return reserveSpace ? (\n <ReservedOrgSwitcherSpace className={className} />\n ) : null;\n }\n if (\n hideWhenSingle &&\n orgCount < 2 &&\n pendingInvitations.length === 0 &&\n domainMatches.length === 0\n ) {\n return reserveSpace ? (\n <ReservedOrgSwitcherSpace className={className} />\n ) : null;\n }\n\n const canInvite =\n !!org.orgId && (org.role === \"owner\" || org.role === \"admin\");\n\n const personalLabel = personalLabelFromEmail(org.email);\n const inOrg = !!org.orgId;\n const buttonLabel = org.orgName ?? \"Personal\";\n const ButtonIcon = inOrg ? IconBuilding : IconUser;\n const organizationSettingsHref = settingsPath\n ? organizationSettingsPath(settingsPath)\n : null;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n <PopoverPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className={`${SWITCHER_BUTTON_CLASS} ${className ?? \"\"}`}\n >\n <ButtonIcon className=\"h-3.5 w-3.5 shrink-0\" />\n <span className=\"truncate flex-1 text-start\">{buttonLabel}</span>\n <IconSelector className=\"h-3 w-3 shrink-0 opacity-50\" />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"top\"\n align=\"start\"\n sideOffset={6}\n collisionPadding={12}\n className={POPOVER_CONTENT_CLASS}\n onOpenAutoFocus={(e) => {\n // Don't auto-focus the first item — feels heavy on a switcher.\n if (mode === \"list\") e.preventDefault();\n }}\n >\n {mode === \"list\" && (\n <>\n {!inOrg && (\n <div\n className=\"flex w-full items-center gap-2 px-2.5 py-1.5 text-xs text-muted-foreground\"\n aria-disabled=\"true\"\n >\n <IconUser className=\"h-3.5 w-3.5 shrink-0\" />\n <span className=\"truncate flex-1 text-start\">\n Personal ({personalLabel})\n </span>\n </div>\n )}\n {orgs.length > 0 && (\n <div className={SECTION_LABEL_CLASS}>Organizations</div>\n )}\n {orgs.map((o) => (\n <button\n key={o.orgId}\n type=\"button\"\n onClick={async () => {\n if (o.orgId === org.orgId) {\n setOpen(false);\n return;\n }\n try {\n await switchOrg.mutateAsync(o.orgId);\n setOpen(false);\n } catch {\n /* error surfaced via switchOrg.error */\n }\n }}\n disabled={switchOrg.isPending}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-start\">\n {o.orgName}\n </span>\n {o.orgId === org.orgId && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n ))}\n\n {pendingInvitations.length > 0 && (\n <>\n {orgs.length > 0 && <div className=\"my-1 h-px bg-border\" />}\n <div className={SECTION_LABEL_CLASS}>Invitations</div>\n {pendingInvitations.map((inv) => (\n <div\n key={inv.id}\n className=\"flex items-center gap-2 px-2.5 py-1.5 text-xs\"\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-foreground\">\n {inv.orgName}\n </span>\n <button\n type=\"button\"\n onClick={async () => {\n try {\n await acceptInvitation.mutateAsync(inv.id);\n setOpen(false);\n } catch {\n /* error surfaced via acceptInvitation.error */\n }\n }}\n disabled={acceptInvitation.isPending}\n className=\"rounded px-1.5 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/10 disabled:opacity-50 cursor-pointer\"\n >\n {acceptInvitation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Join\"\n )}\n </button>\n </div>\n ))}\n </>\n )}\n\n {domainMatches.length > 0 && (\n <>\n {(orgs.length > 0 || pendingInvitations.length > 0) && (\n <div className=\"my-1 h-px bg-border\" />\n )}\n <div className={SECTION_LABEL_CLASS}>Join your team</div>\n {domainMatches.map((match) => {\n const isJoining =\n joinByDomain.isPending && joiningOrgId === match.orgId;\n return (\n <div\n key={match.orgId}\n className=\"flex items-center gap-2 px-2.5 py-1.5 text-xs\"\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-foreground\">\n {match.orgName}\n </span>\n <button\n type=\"button\"\n onClick={async () => {\n setJoiningOrgId(match.orgId);\n try {\n await joinByDomain.mutateAsync(match.orgId);\n setOpen(false);\n } catch {\n /* error surfaced via joinByDomain.error */\n } finally {\n setJoiningOrgId(null);\n }\n }}\n disabled={joinByDomain.isPending}\n className=\"rounded px-1.5 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/10 disabled:opacity-50 cursor-pointer\"\n >\n {isJoining ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Join\"\n )}\n </button>\n </div>\n );\n })}\n </>\n )}\n\n <div className=\"my-1 h-px bg-border\" />\n <AppsSubmenu\n apps={appLinks.apps}\n isWorkspace={appLinks.isWorkspace}\n isLoading={appLinks.isLoading}\n dispatchHref={appLinks.dispatchHref}\n dispatchAllAppsHref={appLinks.dispatchAllAppsHref}\n onNavigate={() => setOpen(false)}\n />\n {inOrg && (\n <button\n type=\"button\"\n onClick={() => {\n setOpen(false);\n window.dispatchEvent(new CustomEvent(\"agent-panel:open\"));\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:open-settings\", {\n detail: { section: \"workspace-settings\" },\n }),\n );\n if (organizationSettingsHref) {\n navigate(organizationSettingsHref);\n }\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconSettings className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">\n Organization settings\n </span>\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n // Clear any leftover input from a prior session — otherwise\n // the create form re-opens prefilled with the just-created\n // org's name and looks like a create dialog for the new org.\n setNewName(\"\");\n setMode(\"create\");\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconPlus className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Create organization</span>\n </button>\n {canInvite && (\n <button\n type=\"button\"\n onClick={() => {\n setInviteEmail(\"\");\n setMode(\"invite\");\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconUserPlus className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Invite member</span>\n </button>\n )}\n\n <div className=\"my-1 h-px bg-border\" />\n <button\n type=\"button\"\n onClick={handleSignOut}\n disabled={signingOut}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n {signingOut ? (\n <IconLoader2 className=\"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground\" />\n ) : (\n <IconLogout className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"flex-1 text-start\">\n Sign out\n {org.email ? (\n <span className=\"ms-1 text-muted-foreground\">\n ({org.email})\n </span>\n ) : null}\n </span>\n </button>\n\n {(switchOrg.error ||\n acceptInvitation.error ||\n joinByDomain.error) && (\n <div className=\"px-2.5 pt-1 text-[11px] text-destructive\">\n {\n (\n (switchOrg.error ||\n acceptInvitation.error ||\n joinByDomain.error) as Error\n ).message\n }\n </div>\n )}\n </>\n )}\n\n {mode === \"create\" && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const name = newName.trim();\n if (!name) return;\n try {\n await createOrg.mutateAsync(name);\n handleOpenChange(false);\n } catch {\n /* error surfaced via createOrg.error */\n }\n }}\n className=\"px-2 py-1.5\"\n >\n <div className=\"px-0.5 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground\">\n New organization\n </div>\n <input\n autoFocus\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n placeholder=\"Organization name\"\n disabled={createOrg.isPending}\n className=\"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n {createOrg.error && (\n <div className=\"pt-1 text-[11px] text-destructive\">\n {(createOrg.error as Error).message}\n </div>\n )}\n <div className=\"flex items-center gap-1.5 pt-1.5\">\n <button\n type=\"button\"\n onClick={() => setMode(\"list\")}\n disabled={createOrg.isPending}\n className=\"flex-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50 cursor-pointer\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={createOrg.isPending || !newName.trim()}\n className=\"flex flex-1 items-center justify-center rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50 cursor-pointer\"\n >\n {createOrg.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Create\"\n )}\n </button>\n </div>\n </form>\n )}\n\n {mode === \"invite\" && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const email = inviteEmail.trim();\n if (!email) return;\n try {\n await inviteMember.mutateAsync(email);\n setInviteEmail(\"\");\n setMode(\"list\");\n } catch {\n /* error surfaced via inviteMember.error */\n }\n }}\n className=\"px-2 py-1.5\"\n >\n <div className=\"px-0.5 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground\">\n Invite to {org.orgName}\n </div>\n <input\n autoFocus\n type=\"email\"\n value={inviteEmail}\n onChange={(e) => setInviteEmail(e.target.value)}\n placeholder=\"teammate@company.com\"\n disabled={inviteMember.isPending}\n className=\"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n {inviteMember.error && (\n <div className=\"pt-1 text-[11px] text-destructive\">\n {(inviteMember.error as Error).message}\n </div>\n )}\n <div className=\"flex items-center gap-1.5 pt-1.5\">\n <button\n type=\"button\"\n onClick={() => setMode(\"list\")}\n disabled={inviteMember.isPending}\n className=\"flex-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50 cursor-pointer\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={inviteMember.isPending || !inviteEmail.trim()}\n className=\"flex flex-1 items-center justify-center rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50 cursor-pointer\"\n >\n {inviteMember.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Send invite\"\n )}\n </button>\n </div>\n </form>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"OrgSwitcher.js","sourceRoot":"","sources":["../../../src/client/org/OrgSwitcher.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,WAAW,EACX,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,0BAA0B,CAAC;AAiBlC,SAAS,sBAAsB,CAAC,KAAgC;IAC9D,IAAI,CAAC,KAAK;QAAE,OAAO,UAAU,CAAC;IAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;IAC3C,MAAM,OAAO,GAAG,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EAAE,EACvD,SAAS,EAAC,yKAAyK,YAElL,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CACxB,KAAC,WAAW,IAAC,SAAS,EAAC,sBAAsB,GAAG,CACjD,CAAC,CAAC,CAAC,CACF,aAAa,CACd,GACM,IACL,IACD,CACR,IACwB,GACH,IACJ,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport {\n IconApps,\n IconArrowUpRight,\n IconBrain,\n IconBrandJira,\n IconBrush,\n IconBuilding,\n IconCalendar,\n IconCalendarTime,\n IconChartBar,\n IconCheck,\n IconChevronRight,\n IconClipboardList,\n IconCode,\n IconFileText,\n IconLayoutBoard,\n IconLoader2,\n IconLogout,\n IconMail,\n IconMessageCircle,\n IconMicrophone,\n IconNote,\n IconPhone,\n IconPhoto,\n IconPlus,\n IconPresentation,\n IconRoute,\n IconScreenShare,\n IconSelector,\n IconSettings,\n IconStack2,\n IconUser,\n IconUserPlus,\n IconUsers,\n IconWorld,\n} from \"@tabler/icons-react\";\nimport { useState } from \"react\";\nimport { useNavigate } from \"react-router\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n useOrg,\n useSwitchOrg,\n useCreateOrg,\n useInviteMember,\n useAcceptInvitation,\n useJoinByDomain,\n} from \"./hooks.js\";\nimport {\n ORG_SWITCHER_MAX_APP_LINKS,\n useOrgSwitcherAppLinks,\n visibleOrgAppLinks,\n type OrgSwitcherAppLink,\n} from \"./workspace-app-links.js\";\n\nexport interface OrgSwitcherProps {\n className?: string;\n /** Hide entirely when the user only belongs to one org. Default: false. */\n hideWhenSingle?: boolean;\n /** Keep the switcher's button height reserved while org state is loading. */\n reserveSpace?: boolean;\n /**\n * Path to navigate to when the user clicks \"Organization settings\".\n * Defaults to the standard Team tab inside Settings. Templates with an\n * established org surface can pass their own path; pass `null` to only open\n * the in-sidebar settings panel.\n */\n settingsPath?: string | null;\n}\n\nfunction personalLabelFromEmail(email: string | null | undefined): string {\n if (!email) return \"Personal\";\n const local = email.split(\"@\")[0] ?? email;\n const cleaned = local.replace(/[._-]+/g, \" \").trim();\n if (!cleaned) return \"Personal\";\n return cleaned\n .split(\" \")\n .filter(Boolean)\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\ntype Mode = \"list\" | \"create\" | \"invite\";\n\nconst POPOVER_CONTENT_CLASS =\n \"z-50 min-w-[14rem] rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst ITEM_CLASS =\n \"flex w-full items-center gap-2 px-2.5 py-1.5 text-xs text-foreground hover:bg-accent focus-visible:bg-accent focus:outline-none disabled:opacity-50 disabled:pointer-events-none\";\n\nconst SECTION_LABEL_CLASS =\n \"px-2.5 pt-1 pb-0.5 text-[10px] uppercase tracking-wide text-muted-foreground\";\n\nconst APP_SUBMENU_CONTENT_CLASS =\n \"z-50 w-72 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\";\n\nconst SWITCHER_BUTTON_CLASS =\n \"flex w-full items-center gap-2 rounded-md border border-border/70 px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-60 cursor-pointer\";\n\nconst DEFAULT_ORGANIZATION_SETTINGS_PATH = \"/settings#team\";\n\nconst APP_ICON_MAP: Record<string, typeof IconApps> = {\n Mail: IconMail,\n CalendarDays: IconCalendar,\n FileText: IconFileText,\n LayoutBoard: IconLayoutBoard,\n BarChart2: IconChartBar,\n GalleryHorizontal: IconPresentation,\n BrandJira: IconBrandJira,\n ClipboardList: IconClipboardList,\n Users: IconUsers,\n Code: IconCode,\n MessageCircle: IconMessageCircle,\n Route: IconRoute,\n ScreenShare: IconScreenShare,\n Brush: IconBrush,\n Brain: IconBrain,\n Phone: IconPhone,\n Note: IconNote,\n Microphone: IconMicrophone,\n CalendarTime: IconCalendarTime,\n Globe: IconWorld,\n Photo: IconPhoto,\n};\n\nfunction appMenuIcon(app: OrgSwitcherAppLink): typeof IconApps {\n if (app.icon) return APP_ICON_MAP[app.icon] ?? IconStack2;\n return app.isDispatch ? IconMessageCircle : IconStack2;\n}\n\nfunction organizationSettingsPath(path: string): string {\n return path.includes(\"#\") ? path : `${path}#team`;\n}\n\nfunction AppMenuLink({\n app,\n onNavigate,\n}: {\n app: OrgSwitcherAppLink;\n onNavigate: () => void;\n}) {\n const Icon = appMenuIcon(app);\n return (\n <a\n href={app.href}\n onClick={onNavigate}\n className={`flex items-center gap-2 rounded-sm px-2.5 py-2 text-xs outline-none hover:bg-accent focus:bg-accent ${\n app.isDispatch ? \"border border-primary/20 bg-primary/5\" : \"\"\n }`}\n >\n <span\n className={`flex h-7 w-7 shrink-0 items-center justify-center rounded-md ${\n app.isDispatch\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground\"\n }`}\n >\n <Icon className=\"h-3.5 w-3.5\" />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium text-foreground\">\n {app.name}\n </span>\n <span className=\"block truncate text-[11px] text-muted-foreground\">\n {app.isDispatch\n ? \"Main hub\"\n : app.status === \"pending\"\n ? \"Building\"\n : \"Open app\"}\n </span>\n </span>\n <IconArrowUpRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </a>\n );\n}\n\nfunction AppsSubmenu({\n apps,\n isWorkspace,\n isLoading,\n dispatchHref,\n dispatchAllAppsHref,\n onNavigate,\n}: {\n apps: OrgSwitcherAppLink[];\n isWorkspace: boolean;\n isLoading: boolean;\n dispatchHref: string;\n dispatchAllAppsHref: string;\n onNavigate: () => void;\n}) {\n const { links, overflowCount } = visibleOrgAppLinks(apps);\n const visibleDispatchApp = links.find((app) => app.isDispatch);\n const dispatchApp =\n visibleDispatchApp ??\n ({\n id: \"dispatch\",\n name: \"Dispatch\",\n href: dispatchHref,\n isDispatch: true,\n status: \"ready\",\n } satisfies OrgSwitcherAppLink);\n const visibleNonDispatch = links\n .filter((app) => !app.isDispatch)\n .slice(0, visibleDispatchApp ? undefined : ORG_SWITCHER_MAX_APP_LINKS - 1);\n const shownCount = (dispatchApp ? 1 : 0) + visibleNonDispatch.length;\n const remainingCount = Math.max(overflowCount, apps.length - shownCount);\n\n return (\n <PopoverPrimitive.Root>\n <PopoverPrimitive.Trigger asChild>\n <button type=\"button\" className={`${ITEM_CLASS} cursor-pointer`}>\n <IconApps className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Apps</span>\n <span className=\"text-[11px] text-muted-foreground\">\n {isLoading ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n apps.length\n )}\n </span>\n <IconChevronRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"right\"\n align=\"start\"\n sideOffset={8}\n collisionPadding={12}\n className={APP_SUBMENU_CONTENT_CLASS}\n >\n <div className=\"px-2.5 py-1.5\">\n <div className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">\n {isWorkspace ? \"Workspace apps\" : \"Default apps\"}\n </div>\n <div className=\"mt-0.5 text-[11px] text-muted-foreground\">\n {isWorkspace\n ? \"Dispatch is the workspace hub.\"\n : \"Dispatch is the home base.\"}\n </div>\n </div>\n\n <AppMenuLink app={dispatchApp} onNavigate={onNavigate} />\n\n {visibleNonDispatch.length > 0 && (\n <div className=\"my-1 h-px bg-border\" />\n )}\n {visibleNonDispatch.map((app) => (\n <AppMenuLink key={app.id} app={app} onNavigate={onNavigate} />\n ))}\n\n {remainingCount > 0 && (\n <>\n <div className=\"my-1 h-px bg-border\" />\n <a\n href={dispatchAllAppsHref}\n onClick={onNavigate}\n className=\"flex items-center gap-2 rounded-sm px-2.5 py-1.5 text-xs text-foreground outline-none hover:bg-accent focus:bg-accent\"\n >\n <IconMessageCircle className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1\">\n {`View ${remainingCount} more in Dispatch`}\n </span>\n <IconArrowUpRight className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </a>\n </>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n\nfunction ReservedOrgSwitcherSpace({ className }: { className?: string }) {\n return <div aria-hidden=\"true\" className={`h-8 ${className ?? \"\"}`} />;\n}\n\nfunction OrgSwitcherLoadingPlaceholder({ className }: { className?: string }) {\n return (\n <button\n type=\"button\"\n disabled\n aria-label=\"Loading organization\"\n className={`${SWITCHER_BUTTON_CLASS} animate-pulse ${className ?? \"\"}`}\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 opacity-60\" />\n <span className=\"h-3 min-w-0 flex-1 rounded-sm bg-muted-foreground/20\" />\n <IconSelector className=\"h-3 w-3 shrink-0 opacity-30\" />\n </button>\n );\n}\n\n/**\n * Compact org switcher button. Shows the active org (or \"Personal\" when the\n * user has none); opens a popover with the user's other orgs, pending\n * invitations, inline forms to create a new org / invite a teammate, and a\n * sign-out item. Renders nothing in dev / no-auth mode.\n */\nexport function OrgSwitcher({\n className,\n hideWhenSingle,\n reserveSpace,\n settingsPath = DEFAULT_ORGANIZATION_SETTINGS_PATH,\n}: OrgSwitcherProps) {\n const { data: org, isLoading } = useOrg();\n const switchOrg = useSwitchOrg();\n const createOrg = useCreateOrg();\n const inviteMember = useInviteMember();\n const acceptInvitation = useAcceptInvitation();\n const joinByDomain = useJoinByDomain();\n const navigate = useNavigate();\n const [open, setOpen] = useState(false);\n const [mode, setMode] = useState<Mode>(\"list\");\n const [newName, setNewName] = useState(\"\");\n const [inviteEmail, setInviteEmail] = useState(\"\");\n const [signingOut, setSigningOut] = useState(false);\n const [joiningOrgId, setJoiningOrgId] = useState<string | null>(null);\n const appLinks = useOrgSwitcherAppLinks(open);\n\n const handleOpenChange = (next: boolean) => {\n setOpen(next);\n if (!next) {\n setMode(\"list\");\n setNewName(\"\");\n setInviteEmail(\"\");\n }\n };\n\n const handleSignOut = async () => {\n if (signingOut) return;\n setSigningOut(true);\n try {\n await fetch(agentNativePath(\"/_agent-native/auth/logout\"), {\n method: \"POST\",\n credentials: \"include\",\n });\n } catch {\n /* fall through to reload — server may already have cleared the cookie */\n }\n window.location.reload();\n };\n\n if (!org) {\n return reserveSpace && isLoading ? (\n <OrgSwitcherLoadingPlaceholder className={className} />\n ) : null;\n }\n\n const orgs = org.orgs ?? [];\n const pendingInvitations = org.pendingInvitations ?? [];\n const domainMatches = org.domainMatches ?? [];\n const orgCount = orgs.length;\n const hasAny =\n orgCount > 0 || pendingInvitations.length > 0 || domainMatches.length > 0;\n if (!hasAny && !org.email) {\n return reserveSpace ? (\n <ReservedOrgSwitcherSpace className={className} />\n ) : null;\n }\n if (\n hideWhenSingle &&\n orgCount < 2 &&\n pendingInvitations.length === 0 &&\n domainMatches.length === 0\n ) {\n return reserveSpace ? (\n <ReservedOrgSwitcherSpace className={className} />\n ) : null;\n }\n\n const canInvite =\n !!org.orgId && (org.role === \"owner\" || org.role === \"admin\");\n\n const personalLabel = personalLabelFromEmail(org.email);\n const inOrg = !!org.orgId;\n const buttonLabel = org.orgName ?? \"Personal\";\n const ButtonIcon = inOrg ? IconBuilding : IconUser;\n const organizationSettingsHref = settingsPath\n ? organizationSettingsPath(settingsPath)\n : null;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n <PopoverPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className={`${SWITCHER_BUTTON_CLASS} ${className ?? \"\"}`}\n >\n <ButtonIcon className=\"h-3.5 w-3.5 shrink-0\" />\n <span className=\"truncate flex-1 text-start\">{buttonLabel}</span>\n <IconSelector className=\"h-3 w-3 shrink-0 opacity-50\" />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"top\"\n align=\"start\"\n sideOffset={6}\n collisionPadding={12}\n className={POPOVER_CONTENT_CLASS}\n onOpenAutoFocus={(e) => {\n // Don't auto-focus the first item — feels heavy on a switcher.\n if (mode === \"list\") e.preventDefault();\n }}\n >\n {mode === \"list\" && (\n <>\n {!inOrg && (\n <div\n className=\"flex w-full items-center gap-2 px-2.5 py-1.5 text-xs text-muted-foreground\"\n aria-disabled=\"true\"\n >\n <IconUser className=\"h-3.5 w-3.5 shrink-0\" />\n <span className=\"truncate flex-1 text-start\">\n Personal ({personalLabel})\n </span>\n </div>\n )}\n {orgs.length > 0 && (\n <div className={SECTION_LABEL_CLASS}>Organizations</div>\n )}\n {orgs.map((o) => (\n <button\n key={o.orgId}\n type=\"button\"\n onClick={async () => {\n if (o.orgId === org.orgId) {\n setOpen(false);\n return;\n }\n try {\n await switchOrg.mutateAsync(o.orgId);\n setOpen(false);\n } catch {\n /* error surfaced via switchOrg.error */\n }\n }}\n disabled={switchOrg.isPending}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-start\">\n {o.orgName}\n </span>\n {o.orgId === org.orgId && (\n <IconCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n ))}\n\n {pendingInvitations.length > 0 && (\n <>\n {orgs.length > 0 && <div className=\"my-1 h-px bg-border\" />}\n <div className={SECTION_LABEL_CLASS}>Invitations</div>\n {pendingInvitations.map((inv) => (\n <div\n key={inv.id}\n className=\"flex items-center gap-2 px-2.5 py-1.5 text-xs\"\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-foreground\">\n {inv.orgName}\n </span>\n <button\n type=\"button\"\n onClick={async () => {\n try {\n await acceptInvitation.mutateAsync(inv.id);\n setOpen(false);\n } catch {\n /* error surfaced via acceptInvitation.error */\n }\n }}\n disabled={acceptInvitation.isPending}\n className=\"rounded px-1.5 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/10 disabled:opacity-50 cursor-pointer\"\n >\n {acceptInvitation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Join\"\n )}\n </button>\n </div>\n ))}\n </>\n )}\n\n {domainMatches.length > 0 && (\n <>\n {(orgs.length > 0 || pendingInvitations.length > 0) && (\n <div className=\"my-1 h-px bg-border\" />\n )}\n <div className={SECTION_LABEL_CLASS}>Join your team</div>\n {domainMatches.map((match) => {\n const isJoining =\n joinByDomain.isPending && joiningOrgId === match.orgId;\n return (\n <div\n key={match.orgId}\n className=\"flex items-center gap-2 px-2.5 py-1.5 text-xs\"\n >\n <IconBuilding className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate flex-1 text-foreground\">\n {match.orgName}\n </span>\n <button\n type=\"button\"\n onClick={async () => {\n setJoiningOrgId(match.orgId);\n try {\n await joinByDomain.mutateAsync(match.orgId);\n setOpen(false);\n } catch {\n /* error surfaced via joinByDomain.error */\n } finally {\n setJoiningOrgId(null);\n }\n }}\n disabled={joinByDomain.isPending}\n className=\"rounded px-1.5 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/10 disabled:opacity-50 cursor-pointer\"\n >\n {isJoining ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Join\"\n )}\n </button>\n </div>\n );\n })}\n </>\n )}\n\n <div className=\"my-1 h-px bg-border\" />\n <AppsSubmenu\n apps={appLinks.apps}\n isWorkspace={appLinks.isWorkspace}\n isLoading={appLinks.isLoading}\n dispatchHref={appLinks.dispatchHref}\n dispatchAllAppsHref={appLinks.dispatchAllAppsHref}\n onNavigate={() => setOpen(false)}\n />\n {inOrg && (\n <button\n type=\"button\"\n onClick={() => {\n setOpen(false);\n window.dispatchEvent(new CustomEvent(\"agent-panel:open\"));\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:open-settings\", {\n detail: { section: \"workspace-settings\" },\n }),\n );\n if (organizationSettingsHref) {\n navigate(organizationSettingsHref);\n }\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconSettings className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">\n Organization settings\n </span>\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n // Clear any leftover input from a prior session — otherwise\n // the create form re-opens prefilled with the just-created\n // org's name and looks like a create dialog for the new org.\n setNewName(\"\");\n setMode(\"create\");\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconPlus className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Create organization</span>\n </button>\n {canInvite && (\n <button\n type=\"button\"\n onClick={() => {\n setInviteEmail(\"\");\n setMode(\"invite\");\n }}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n <IconUserPlus className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"flex-1 text-start\">Invite member</span>\n </button>\n )}\n\n <div className=\"my-1 h-px bg-border\" />\n <button\n type=\"button\"\n onClick={handleSignOut}\n disabled={signingOut}\n className={`${ITEM_CLASS} cursor-pointer`}\n >\n {signingOut ? (\n <IconLoader2 className=\"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground\" />\n ) : (\n <IconLogout className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground rtl:-scale-x-100\" />\n )}\n <span className=\"flex-1 text-start\">\n Sign out\n {org.email ? (\n <span className=\"ms-1 text-muted-foreground\">\n ({org.email})\n </span>\n ) : null}\n </span>\n </button>\n\n {(switchOrg.error ||\n acceptInvitation.error ||\n joinByDomain.error) && (\n <div className=\"px-2.5 pt-1 text-[11px] text-destructive\">\n {\n (\n (switchOrg.error ||\n acceptInvitation.error ||\n joinByDomain.error) as Error\n ).message\n }\n </div>\n )}\n </>\n )}\n\n {mode === \"create\" && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const name = newName.trim();\n if (!name) return;\n try {\n await createOrg.mutateAsync(name);\n handleOpenChange(false);\n } catch {\n /* error surfaced via createOrg.error */\n }\n }}\n className=\"px-2 py-1.5\"\n >\n <div className=\"px-0.5 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground\">\n New organization\n </div>\n <input\n autoFocus\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n placeholder=\"Organization name\"\n disabled={createOrg.isPending}\n className=\"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n {createOrg.error && (\n <div className=\"pt-1 text-[11px] text-destructive\">\n {(createOrg.error as Error).message}\n </div>\n )}\n <div className=\"flex items-center gap-1.5 pt-1.5\">\n <button\n type=\"button\"\n onClick={() => setMode(\"list\")}\n disabled={createOrg.isPending}\n className=\"flex-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50 cursor-pointer\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={createOrg.isPending || !newName.trim()}\n className=\"flex flex-1 items-center justify-center rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50 cursor-pointer\"\n >\n {createOrg.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Create\"\n )}\n </button>\n </div>\n </form>\n )}\n\n {mode === \"invite\" && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const email = inviteEmail.trim();\n if (!email) return;\n try {\n await inviteMember.mutateAsync(email);\n setInviteEmail(\"\");\n setMode(\"list\");\n } catch {\n /* error surfaced via inviteMember.error */\n }\n }}\n className=\"px-2 py-1.5\"\n >\n <div className=\"px-0.5 pb-1 text-[10px] uppercase tracking-wide text-muted-foreground\">\n Invite to {org.orgName}\n </div>\n <input\n autoFocus\n type=\"email\"\n value={inviteEmail}\n onChange={(e) => setInviteEmail(e.target.value)}\n placeholder=\"teammate@company.com\"\n disabled={inviteMember.isPending}\n className=\"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n {inviteMember.error && (\n <div className=\"pt-1 text-[11px] text-destructive\">\n {(inviteMember.error as Error).message}\n </div>\n )}\n <div className=\"flex items-center gap-1.5 pt-1.5\">\n <button\n type=\"button\"\n onClick={() => setMode(\"list\")}\n disabled={inviteMember.isPending}\n className=\"flex-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50 cursor-pointer\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={inviteMember.isPending || !inviteEmail.trim()}\n className=\"flex flex-1 items-center justify-center rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50 cursor-pointer\"\n >\n {inviteMember.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n \"Send invite\"\n )}\n </button>\n </div>\n </form>\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireActiveOrg.d.ts","sourceRoot":"","sources":["../../../src/client/org/RequireActiveOrg.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RequireActiveOrg.d.ts","sourceRoot":"","sources":["../../../src/client/org/RequireActiveOrg.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAW5C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,GACV,EAAE,qBAAqB,sCAgCvB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { IconAlertTriangle, IconBuilding, IconLoader2, IconUserPlus, IconAt, } from "@tabler/icons-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
+
import { ErrorReportActions } from "../ErrorReportActions.js";
|
|
4
5
|
import { useT } from "../i18n.js";
|
|
5
6
|
import { useAcceptInvitation, useCreateOrg, useJoinByDomain, useOrg, } from "./hooks.js";
|
|
6
7
|
/**
|
|
@@ -38,7 +39,7 @@ export function RequireActiveOrg({ children, title, description, className, }) {
|
|
|
38
39
|
function ErrorPane({ message, onRetry, className, }) {
|
|
39
40
|
const t = useT();
|
|
40
41
|
return (_jsx("div", { className: "flex h-full w-full items-center justify-center overflow-y-auto bg-background p-8 " +
|
|
41
|
-
(className ?? ""), children: _jsxs("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg", children: [_jsxs("div", { className: "mb-4 flex items-center gap-2", children: [_jsx(IconAlertTriangle, { className: "h-5 w-5 text-muted-foreground" }), _jsx("h1", { className: "text-lg font-semibold", children: t("org.loadErrorTitle") })] }), _jsx("p", { className: "mb-5 text-sm text-muted-foreground", children: message }), _jsx("button", { type: "button", onClick: onRetry, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90", children: t("org.tryAgain") })] }) }));
|
|
42
|
+
(className ?? ""), children: _jsxs("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg", children: [_jsxs("div", { className: "mb-4 flex items-center gap-2", children: [_jsx(IconAlertTriangle, { className: "h-5 w-5 text-muted-foreground" }), _jsx("h1", { className: "text-lg font-semibold", children: t("org.loadErrorTitle") })] }), _jsx("p", { className: "mb-5 text-sm text-muted-foreground", children: message }), _jsx("button", { type: "button", onClick: onRetry, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90", children: t("org.tryAgain") }), _jsx(ErrorReportActions, { appName: "Organization", title: t("org.loadErrorTitle"), details: message, issueTitle: "Organization load error", feedbackLabel: t("org.sendFeedback"), feedbackPlaceholder: t("org.feedbackPlaceholder"), githubLabel: t("org.openGitHubIssue"), className: "mt-4 justify-start", align: "start" })] }) }));
|
|
42
43
|
}
|
|
43
44
|
function CreateOrgPane({ pendingInvitations, domainMatches, email, title, description, className, }) {
|
|
44
45
|
const t = useT();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireActiveOrg.js","sourceRoot":"","sources":["../../../src/client/org/RequireActiveOrg.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,GACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,MAAM,GACP,MAAM,YAAY,CAAC;AAiBpB;;;;;;;;;;;;;;;GAeG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ACd,CAAC,CAAC,uIAAuI;gCACzI,CAAC,CAAC,4HAA4H,YAGjI,SAAS,CAAC,SAAS;gCAClB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;gCACnB,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,GACxB,IACJ,CACR,IACG,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconAlertTriangle,\n IconBuilding,\n IconLoader2,\n IconUserPlus,\n IconAt,\n} from \"@tabler/icons-react\";\nimport { ReactNode, useState } from \"react\";\n\nimport { useT } from \"../i18n.js\";\nimport {\n useAcceptInvitation,\n useCreateOrg,\n useJoinByDomain,\n useOrg,\n} from \"./hooks.js\";\n\nexport interface RequireActiveOrgProps {\n children: ReactNode;\n /**\n * Override the heading shown on the create-org pane. Default: \"Create your organization\".\n */\n title?: string;\n /**\n * Override the description shown below the heading. Default explains that\n * an org is required to use the app.\n */\n description?: string;\n /** Optional extra classes on the blocking pane wrapper. */\n className?: string;\n}\n\n/**\n * Guards its children behind the user having an active organization.\n *\n * When the user has no active org, renders a blocking, centered pane in place\n * of `children` with:\n * 1. Any pending invitations (one-click accept), and\n * 2. A \"Create your organization\" form.\n *\n * As soon as an org is joined or created, `useOrg` refetches and `children`\n * renders normally.\n *\n * The pane fills whatever box this component is rendered into — it does **not**\n * position itself `fixed` over the viewport. Place it inside your app shell so\n * ambient UI (agent sidebar, global nav) stays accessible while the user\n * completes org setup.\n */\nexport function RequireActiveOrg({\n children,\n title,\n description,\n className,\n}: RequireActiveOrgProps) {\n const t = useT();\n const { data: org, isLoading, isError, error, refetch } = useOrg();\n\n if (isLoading) return null;\n\n // Network / server failure on the org lookup — do NOT fall through to the\n // create-org pane (that would lock out an existing member on a transient\n // 500). Render a retry state instead. Only treat a successful null orgId\n // response as \"genuinely no org\".\n if (isError) {\n return (\n <ErrorPane\n message={(error as Error)?.message ?? t(\"org.loadErrorFallback\")}\n onRetry={() => void refetch()}\n className={className}\n />\n );\n }\n\n if (org?.orgId) return <>{children}</>;\n\n return (\n <CreateOrgPane\n pendingInvitations={org?.pendingInvitations ?? []}\n domainMatches={org?.domainMatches ?? []}\n email={org?.email ?? \"\"}\n title={title ?? t(\"org.createTitle\")}\n description={description ?? t(\"org.createDescription\")}\n className={className}\n />\n );\n}\n\nfunction ErrorPane({\n message,\n onRetry,\n className,\n}: {\n message: string;\n onRetry: () => void;\n className?: string;\n}) {\n const t = useT();\n return (\n <div\n className={\n \"flex h-full w-full items-center justify-center overflow-y-auto bg-background p-8 \" +\n (className ?? \"\")\n }\n >\n <div className=\"w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg\">\n <div className=\"mb-4 flex items-center gap-2\">\n <IconAlertTriangle className=\"h-5 w-5 text-muted-foreground\" />\n <h1 className=\"text-lg font-semibold\">{t(\"org.loadErrorTitle\")}</h1>\n </div>\n <p className=\"mb-5 text-sm text-muted-foreground\">{message}</p>\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90\"\n >\n {t(\"org.tryAgain\")}\n </button>\n </div>\n </div>\n );\n}\n\nfunction CreateOrgPane({\n pendingInvitations,\n domainMatches,\n email,\n title,\n description,\n className,\n}: {\n pendingInvitations: Array<{\n id: string;\n orgId: string;\n orgName: string;\n invitedBy: string;\n }>;\n domainMatches: Array<{ orgId: string; orgName: string }>;\n email: string;\n title: string;\n description: string;\n className?: string;\n}) {\n const t = useT();\n const createOrg = useCreateOrg();\n const acceptInvitation = useAcceptInvitation();\n const joinByDomain = useJoinByDomain();\n const [name, setName] = useState(\"\");\n\n const hasInvites = pendingInvitations.length > 0;\n const hasDomainMatches = domainMatches.length > 0;\n const userDomain = email.split(\"@\")[1] ?? \"\";\n const [showCreateForm, setShowCreateForm] = useState(\n !hasDomainMatches && !hasInvites,\n );\n\n const busy =\n createOrg.isPending || acceptInvitation.isPending || joinByDomain.isPending;\n\n return (\n <div\n className={\n \"flex h-full w-full items-center justify-center overflow-y-auto bg-background p-8 \" +\n (className ?? \"\")\n }\n >\n <div className=\"my-auto w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg\">\n <div className=\"mb-6 flex items-center gap-2\">\n <IconBuilding className=\"h-5 w-5 text-muted-foreground\" />\n <h1 className=\"text-lg font-semibold\">{title}</h1>\n </div>\n <p className=\"mb-6 text-sm text-muted-foreground\">{description}</p>\n\n {hasDomainMatches && (\n <div className=\"mb-4\">\n <div className=\"mb-2 text-[10px] uppercase tracking-wide text-muted-foreground\">\n {domainMatches.length === 1\n ? t(\"org.yourOrganization\")\n : t(\"org.joinYourTeam\")}\n </div>\n <ul className=\"space-y-2\">\n {domainMatches.map((match) => (\n <li\n key={match.orgId}\n className=\"flex items-center gap-3 rounded-lg border border-primary/50 bg-primary/5 px-4 py-3\"\n >\n <IconAt className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm font-medium\">\n {match.orgName}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {t(\"org.openToDomainEmails\", { domain: userDomain })}\n </div>\n </div>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => joinByDomain.mutate(match.orgId)}\n className=\"shrink-0 rounded-md bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n >\n {joinByDomain.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n t(\"org.joinOrg\", { name: match.orgName })\n )}\n </button>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {hasInvites && (\n <div className=\"mb-4\">\n <div className=\"mb-2 text-[10px] uppercase tracking-wide text-muted-foreground\">\n {t(\"org.pendingInvitations\")}\n </div>\n <ul className=\"space-y-2\">\n {pendingInvitations.map((inv) => (\n <li\n key={inv.id}\n className=\"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2\"\n >\n <IconUserPlus className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm font-medium\">\n {inv.orgName}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {t(\"org.invitedBy\", { name: inv.invitedBy })}\n </div>\n </div>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => acceptInvitation.mutate(inv.id)}\n className=\"shrink-0 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n >\n {acceptInvitation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n t(\"org.accept\")\n )}\n </button>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {(hasDomainMatches || hasInvites) && (\n <button\n type=\"button\"\n onClick={() => setShowCreateForm((v) => !v)}\n className=\"mb-4 flex w-full cursor-pointer items-center gap-3\"\n >\n <div className=\"h-px flex-1 bg-border\" />\n <span className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">\n {t(\"org.createSeparate\")}\n </span>\n <div className=\"h-px flex-1 bg-border\" />\n </button>\n )}\n\n {showCreateForm && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const trimmed = name.trim();\n if (!trimmed) return;\n try {\n await createOrg.mutateAsync(trimmed);\n } catch {\n /* surfaced below */\n }\n }}\n className=\"space-y-3\"\n >\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-medium text-foreground\">\n {t(\"org.organizationName\")}\n </span>\n <input\n autoFocus={!hasDomainMatches && !hasInvites}\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder={t(\"org.organizationPlaceholder\")}\n disabled={busy}\n className=\"w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n </label>\n {createOrg.error && (\n <div className=\"text-xs text-red-600\">\n {(createOrg.error as Error).message}\n </div>\n )}\n {acceptInvitation.error && (\n <div className=\"text-xs text-red-600\">\n {(acceptInvitation.error as Error).message}\n </div>\n )}\n {joinByDomain.error && (\n <div className=\"text-xs text-red-600\">\n {(joinByDomain.error as Error).message}\n </div>\n )}\n <button\n type=\"submit\"\n disabled={busy || !name.trim()}\n className={\n hasDomainMatches\n ? \"w-full rounded-md border border-input bg-background px-4 py-2 text-sm font-medium text-foreground hover:bg-accent disabled:opacity-50\"\n : \"w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n }\n >\n {createOrg.isPending\n ? t(\"org.creating\")\n : t(\"org.createOrganization\")}\n </button>\n </form>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RequireActiveOrg.js","sourceRoot":"","sources":["../../../src/client/org/RequireActiveOrg.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,GACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,MAAM,GACP,MAAM,YAAY,CAAC;AAiBpB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,GACa;IACtB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC;IAEnE,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC;IAE3B,0EAA0E;IAC1E,yEAAyE;IACzE,yEAAyE;IACzE,kCAAkC;IAClC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,KAAC,SAAS,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SAAS;gCAClB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;gCACnB,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,GACxB,IACJ,CACR,IACG,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconAlertTriangle,\n IconBuilding,\n IconLoader2,\n IconUserPlus,\n IconAt,\n} from \"@tabler/icons-react\";\nimport { ReactNode, useState } from \"react\";\n\nimport { ErrorReportActions } from \"../ErrorReportActions.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n useAcceptInvitation,\n useCreateOrg,\n useJoinByDomain,\n useOrg,\n} from \"./hooks.js\";\n\nexport interface RequireActiveOrgProps {\n children: ReactNode;\n /**\n * Override the heading shown on the create-org pane. Default: \"Create your organization\".\n */\n title?: string;\n /**\n * Override the description shown below the heading. Default explains that\n * an org is required to use the app.\n */\n description?: string;\n /** Optional extra classes on the blocking pane wrapper. */\n className?: string;\n}\n\n/**\n * Guards its children behind the user having an active organization.\n *\n * When the user has no active org, renders a blocking, centered pane in place\n * of `children` with:\n * 1. Any pending invitations (one-click accept), and\n * 2. A \"Create your organization\" form.\n *\n * As soon as an org is joined or created, `useOrg` refetches and `children`\n * renders normally.\n *\n * The pane fills whatever box this component is rendered into — it does **not**\n * position itself `fixed` over the viewport. Place it inside your app shell so\n * ambient UI (agent sidebar, global nav) stays accessible while the user\n * completes org setup.\n */\nexport function RequireActiveOrg({\n children,\n title,\n description,\n className,\n}: RequireActiveOrgProps) {\n const t = useT();\n const { data: org, isLoading, isError, error, refetch } = useOrg();\n\n if (isLoading) return null;\n\n // Network / server failure on the org lookup — do NOT fall through to the\n // create-org pane (that would lock out an existing member on a transient\n // 500). Render a retry state instead. Only treat a successful null orgId\n // response as \"genuinely no org\".\n if (isError) {\n return (\n <ErrorPane\n message={(error as Error)?.message ?? t(\"org.loadErrorFallback\")}\n onRetry={() => void refetch()}\n className={className}\n />\n );\n }\n\n if (org?.orgId) return <>{children}</>;\n\n return (\n <CreateOrgPane\n pendingInvitations={org?.pendingInvitations ?? []}\n domainMatches={org?.domainMatches ?? []}\n email={org?.email ?? \"\"}\n title={title ?? t(\"org.createTitle\")}\n description={description ?? t(\"org.createDescription\")}\n className={className}\n />\n );\n}\n\nfunction ErrorPane({\n message,\n onRetry,\n className,\n}: {\n message: string;\n onRetry: () => void;\n className?: string;\n}) {\n const t = useT();\n return (\n <div\n className={\n \"flex h-full w-full items-center justify-center overflow-y-auto bg-background p-8 \" +\n (className ?? \"\")\n }\n >\n <div className=\"w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg\">\n <div className=\"mb-4 flex items-center gap-2\">\n <IconAlertTriangle className=\"h-5 w-5 text-muted-foreground\" />\n <h1 className=\"text-lg font-semibold\">{t(\"org.loadErrorTitle\")}</h1>\n </div>\n <p className=\"mb-5 text-sm text-muted-foreground\">{message}</p>\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90\"\n >\n {t(\"org.tryAgain\")}\n </button>\n <ErrorReportActions\n appName=\"Organization\"\n title={t(\"org.loadErrorTitle\")}\n details={message}\n issueTitle=\"Organization load error\"\n feedbackLabel={t(\"org.sendFeedback\")}\n feedbackPlaceholder={t(\"org.feedbackPlaceholder\")}\n githubLabel={t(\"org.openGitHubIssue\")}\n className=\"mt-4 justify-start\"\n align=\"start\"\n />\n </div>\n </div>\n );\n}\n\nfunction CreateOrgPane({\n pendingInvitations,\n domainMatches,\n email,\n title,\n description,\n className,\n}: {\n pendingInvitations: Array<{\n id: string;\n orgId: string;\n orgName: string;\n invitedBy: string;\n }>;\n domainMatches: Array<{ orgId: string; orgName: string }>;\n email: string;\n title: string;\n description: string;\n className?: string;\n}) {\n const t = useT();\n const createOrg = useCreateOrg();\n const acceptInvitation = useAcceptInvitation();\n const joinByDomain = useJoinByDomain();\n const [name, setName] = useState(\"\");\n\n const hasInvites = pendingInvitations.length > 0;\n const hasDomainMatches = domainMatches.length > 0;\n const userDomain = email.split(\"@\")[1] ?? \"\";\n const [showCreateForm, setShowCreateForm] = useState(\n !hasDomainMatches && !hasInvites,\n );\n\n const busy =\n createOrg.isPending || acceptInvitation.isPending || joinByDomain.isPending;\n\n return (\n <div\n className={\n \"flex h-full w-full items-center justify-center overflow-y-auto bg-background p-8 \" +\n (className ?? \"\")\n }\n >\n <div className=\"my-auto w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-lg\">\n <div className=\"mb-6 flex items-center gap-2\">\n <IconBuilding className=\"h-5 w-5 text-muted-foreground\" />\n <h1 className=\"text-lg font-semibold\">{title}</h1>\n </div>\n <p className=\"mb-6 text-sm text-muted-foreground\">{description}</p>\n\n {hasDomainMatches && (\n <div className=\"mb-4\">\n <div className=\"mb-2 text-[10px] uppercase tracking-wide text-muted-foreground\">\n {domainMatches.length === 1\n ? t(\"org.yourOrganization\")\n : t(\"org.joinYourTeam\")}\n </div>\n <ul className=\"space-y-2\">\n {domainMatches.map((match) => (\n <li\n key={match.orgId}\n className=\"flex items-center gap-3 rounded-lg border border-primary/50 bg-primary/5 px-4 py-3\"\n >\n <IconAt className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm font-medium\">\n {match.orgName}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {t(\"org.openToDomainEmails\", { domain: userDomain })}\n </div>\n </div>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => joinByDomain.mutate(match.orgId)}\n className=\"shrink-0 rounded-md bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n >\n {joinByDomain.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n t(\"org.joinOrg\", { name: match.orgName })\n )}\n </button>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {hasInvites && (\n <div className=\"mb-4\">\n <div className=\"mb-2 text-[10px] uppercase tracking-wide text-muted-foreground\">\n {t(\"org.pendingInvitations\")}\n </div>\n <ul className=\"space-y-2\">\n {pendingInvitations.map((inv) => (\n <li\n key={inv.id}\n className=\"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2\"\n >\n <IconUserPlus className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-sm font-medium\">\n {inv.orgName}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {t(\"org.invitedBy\", { name: inv.invitedBy })}\n </div>\n </div>\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => acceptInvitation.mutate(inv.id)}\n className=\"shrink-0 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n >\n {acceptInvitation.isPending ? (\n <IconLoader2 className=\"h-3 w-3 animate-spin\" />\n ) : (\n t(\"org.accept\")\n )}\n </button>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {(hasDomainMatches || hasInvites) && (\n <button\n type=\"button\"\n onClick={() => setShowCreateForm((v) => !v)}\n className=\"mb-4 flex w-full cursor-pointer items-center gap-3\"\n >\n <div className=\"h-px flex-1 bg-border\" />\n <span className=\"text-[10px] uppercase tracking-wide text-muted-foreground\">\n {t(\"org.createSeparate\")}\n </span>\n <div className=\"h-px flex-1 bg-border\" />\n </button>\n )}\n\n {showCreateForm && (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n const trimmed = name.trim();\n if (!trimmed) return;\n try {\n await createOrg.mutateAsync(trimmed);\n } catch {\n /* surfaced below */\n }\n }}\n className=\"space-y-3\"\n >\n <label className=\"block\">\n <span className=\"mb-1 block text-xs font-medium text-foreground\">\n {t(\"org.organizationName\")}\n </span>\n <input\n autoFocus={!hasDomainMatches && !hasInvites}\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder={t(\"org.organizationPlaceholder\")}\n disabled={busy}\n className=\"w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring disabled:opacity-50\"\n />\n </label>\n {createOrg.error && (\n <div className=\"text-xs text-red-600\">\n {(createOrg.error as Error).message}\n </div>\n )}\n {acceptInvitation.error && (\n <div className=\"text-xs text-red-600\">\n {(acceptInvitation.error as Error).message}\n </div>\n )}\n {joinByDomain.error && (\n <div className=\"text-xs text-red-600\">\n {(joinByDomain.error as Error).message}\n </div>\n )}\n <button\n type=\"submit\"\n disabled={busy || !name.trim()}\n className={\n hasDomainMatches\n ? \"w-full rounded-md border border-input bg-background px-4 py-2 text-sm font-medium text-foreground hover:bg-accent disabled:opacity-50\"\n : \"w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50\"\n }\n >\n {createOrg.isPending\n ? t(\"org.creating\")\n : t(\"org.createOrganization\")}\n </button>\n </form>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import { type BubbleToolbarItem } from "./BubbleToolbar.js";
|
|
|
5
5
|
import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser, type SharedEditorFeatures } from "./extensions.js";
|
|
6
6
|
import type { ImageUploadFn } from "./ImageExtension.js";
|
|
7
7
|
import { type SlashCommandItem } from "./SlashCommandMenu.js";
|
|
8
|
+
import { type UseCollabReconcileOptions } from "./useCollabReconcile.js";
|
|
8
9
|
export interface SharedRichEditorProps {
|
|
9
10
|
value: string;
|
|
10
11
|
onChange: (markdown: string) => void;
|
|
@@ -66,6 +67,12 @@ export interface SharedRichEditorProps {
|
|
|
66
67
|
emitUpdate?: boolean;
|
|
67
68
|
addToHistory?: boolean;
|
|
68
69
|
}) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Optional parser for surgical reconcile. Custom value formats that already
|
|
72
|
+
* handle surgical writes inside `setContent` can pass `false` so the default
|
|
73
|
+
* markdown parser never treats their source bytes as literal markdown.
|
|
74
|
+
*/
|
|
75
|
+
parseValue?: UseCollabReconcileOptions["parseValue"];
|
|
69
76
|
/** Canonicalize `value` for the echo / already-in-sync equality checks. */
|
|
70
77
|
normalizeValue?: (value: string) => string;
|
|
71
78
|
/** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */
|
|
@@ -97,5 +104,5 @@ export interface SharedRichEditorProps {
|
|
|
97
104
|
* With a `ydoc` it binds the framework collaboration stack; markdown stays the
|
|
98
105
|
* canonical saved representation while the Y.Doc is transient live state.
|
|
99
106
|
*/
|
|
100
|
-
export declare function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable, dialect, preset, features, onImageUpload, extraExtensions, placeholder, className, editorClassName, ariaLabel, interactive, ydoc, awareness, user, disableHistory, slashItems, buildBubbleItems, getMarkdown, setContent, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }: SharedRichEditorProps): import("react").JSX.Element;
|
|
107
|
+
export declare function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable, dialect, preset, features, onImageUpload, extraExtensions, placeholder, className, editorClassName, ariaLabel, interactive, ydoc, awareness, user, disableHistory, slashItems, buildBubbleItems, getMarkdown, setContent, parseValue, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }: SharedRichEditorProps): import("react").JSX.Element;
|
|
101
108
|
//# sourceMappingURL=SharedRichEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedRichEditor.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAEL,KAA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cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;KACxB,KAAK,OAAO,CAAC;IACd,oEAAoE;IACpE,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,eAAe,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,QAAe,EACf,OAAe,EACf,MAAe,EACf,QAAQ,EACR,aAAoB,EACpB,eAAe,EACf,WAAwC,EACxC,SAAS,EACT,eAAe,EACf,SAAS,EACT,WAAsB,EACtB,IAAW,EACX,SAAgB,EAChB,IAAW,EACX,cAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACd,EAAE,qBAAqB,+BA+JvB"}
|
|
@@ -17,7 +17,7 @@ import { useCollabReconcile, getEditorMarkdown, } from "./useCollabReconcile.js"
|
|
|
17
17
|
* With a `ydoc` it binds the framework collaboration stack; markdown stays the
|
|
18
18
|
* canonical saved representation while the Y.Doc is transient live state.
|
|
19
19
|
*/
|
|
20
|
-
export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable = true, dialect = "gfm", preset = "plan", features, onImageUpload = null, extraExtensions, placeholder = "Type '/' for commands...", className, editorClassName, ariaLabel, interactive = editable, ydoc = null, awareness = null, user = null, disableHistory = false, slashItems, buildBubbleItems, getMarkdown, setContent, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }) {
|
|
20
|
+
export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable = true, dialect = "gfm", preset = "plan", features, onImageUpload = null, extraExtensions, placeholder = "Type '/' for commands...", className, editorClassName, ariaLabel, interactive = editable, ydoc = null, awareness = null, user = null, disableHistory = false, slashItems, buildBubbleItems, getMarkdown, setContent, parseValue, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, onEditorReady, }) {
|
|
21
21
|
const readMarkdown = getMarkdown ?? getEditorMarkdown;
|
|
22
22
|
const onChangeRef = useRef(onChange);
|
|
23
23
|
const onBlurRef = useRef(onBlur);
|
|
@@ -95,7 +95,12 @@ export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, ed
|
|
|
95
95
|
onBlur: () => {
|
|
96
96
|
onBlurRef.current?.();
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
// Recreate the editor when the shared Y.Doc identity changes — including
|
|
99
|
+
// null → doc. Extensions are baked in at creation, so a ydoc that arrives
|
|
100
|
+
// AFTER the first mount (fresh page load: the session/user resolves after
|
|
101
|
+
// the editor mounts) would otherwise never bind Collaboration: the editor
|
|
102
|
+
// looks fine but produces no Yjs updates and never receives peers' edits.
|
|
103
|
+
}, [ydoc]);
|
|
99
104
|
const collabState = useCollabReconcile({
|
|
100
105
|
editor,
|
|
101
106
|
ydoc,
|
|
@@ -105,6 +110,7 @@ export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, ed
|
|
|
105
110
|
editable,
|
|
106
111
|
getMarkdown: readMarkdown,
|
|
107
112
|
setContent,
|
|
113
|
+
parseValue,
|
|
108
114
|
normalizeValue,
|
|
109
115
|
shouldSeed,
|
|
110
116
|
initialAppliedUpdatedAt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedRichEditor.js","sourceRoot":"","sources":["../../../src/client/rich-mark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AAE,MAAM,GAAI,IAC7B,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { Extension, Node, Mark } from \"@tiptap/core\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport type { Awareness } from \"y-protocols/awareness\";\nimport type { Doc as YDoc } from \"yjs\";\n\nimport { cn } from \"../utils.js\";\nimport { BubbleToolbar, type BubbleToolbarItem } from \"./BubbleToolbar.js\";\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorFeatures,\n} from \"./extensions.js\";\nimport type { ImageUploadFn } from \"./ImageExtension.js\";\nimport { SlashCommandMenu, type SlashCommandItem } from \"./SlashCommandMenu.js\";\nimport {\n useCollabReconcile,\n getEditorMarkdown,\n type UseCollabReconcileResult,\n} from \"./useCollabReconcile.js\";\n\nexport interface SharedRichEditorProps {\n value: string;\n onChange: (markdown: string) => void;\n onBlur?: () => void;\n contentUpdatedAt?: string | null;\n editable?: boolean;\n dialect?: RichMarkdownDialect;\n preset?: RichMarkdownEditorPreset;\n /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */\n features?: SharedEditorFeatures;\n /**\n * Injectable image uploader for the shared image block. Used only when\n * `features.image` is on. Pass `uploadEditorImage` (the framework\n * `upload-image` action) for a real uploading image block.\n */\n onImageUpload?: ImageUploadFn | null;\n /**\n * App-specific extensions (Notion nodes, media, drag handles, comment\n * anchors, …) appended after the shared base schema.\n */\n extraExtensions?: Array<Extension | Node | Mark>;\n placeholder?: string;\n className?: string;\n editorClassName?: string;\n ariaLabel?: string;\n interactive?: boolean;\n /**\n * Yjs document for real-time multi-user editing. When provided, prose is\n * authored against the shared Y.Doc and mirrored back to `value` as markdown\n * (still the source of truth). When omitted, the editor is a plain controlled\n * `value`/`onChange` editor — the existing, non-collaborative behavior.\n */\n ydoc?: YDoc | null;\n /** Shared awareness instance for live cursors/presence. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n /**\n * Disable StarterKit's built-in undo/redo for a controlled (non-collab)\n * editor whose host owns its own undo authority (see\n * {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a\n * `ydoc` is present (Yjs always owns history then). Default `false`, so every\n * existing embedder is unchanged.\n */\n disableHistory?: boolean;\n /** Override the slash-menu block command list. */\n slashItems?: SlashCommandItem[];\n /** Override the bubble-toolbar item builder. */\n buildBubbleItems?: (\n editor: import(\"@tiptap/react\").Editor,\n toggleLink: () => void,\n ) => BubbleToolbarItem[];\n /**\n * Override how the editor's content is read into the canonical `value`.\n * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk\n * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so\n * seed/reconcile/onChange all speak the same value space.\n */\n getMarkdown?: (editor: import(\"@tiptap/react\").Editor) => string;\n /** Override how the canonical `value` is applied into the editor (seed + reconcile). */\n setContent?: (\n editor: import(\"@tiptap/react\").Editor,\n value: string,\n options: { emitUpdate?: boolean; addToHistory?: boolean },\n ) => void;\n /** Canonicalize `value` for the echo / already-in-sync equality checks. */\n normalizeValue?: (value: string) => string;\n /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */\n shouldSeed?: (info: {\n value: string;\n currentMarkdown: string;\n fragmentLength: number;\n }) => boolean;\n /** Initial \"applied\" watermark (see {@link useCollabReconcile}). */\n initialAppliedUpdatedAt?: string | null;\n /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */\n wrapperClassName?: string;\n /**\n * Fires once the editor instance exists. Lets a host capture the root\n * `editor.view` — e.g. to repaint the WHOLE document after a structural block\n * move (a column emptied and its container dissolved) that a surgical\n * per-region patch can't express, since the change is in the root doc itself.\n */\n onEditorReady?: (editor: import(\"@tiptap/react\").Editor) => void;\n}\n\n/**\n * The single shared rich markdown editor surface. Combines\n * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +\n * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /\n * lead-client logic), and the shared {@link SlashCommandMenu} +\n * {@link BubbleToolbar}.\n *\n * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.\n * With a `ydoc` it binds the framework collaboration stack; markdown stays the\n * canonical saved representation while the Y.Doc is transient live state.\n */\nexport function SharedRichEditor({\n value,\n onChange,\n onBlur,\n contentUpdatedAt,\n editable = true,\n dialect = \"gfm\",\n preset = \"plan\",\n features,\n onImageUpload = null,\n extraExtensions,\n placeholder = \"Type '/' for commands...\",\n className,\n editorClassName,\n ariaLabel,\n interactive = editable,\n ydoc = null,\n awareness = null,\n user = null,\n disableHistory = false,\n slashItems,\n buildBubbleItems,\n getMarkdown,\n setContent,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n wrapperClassName,\n onEditorReady,\n}: SharedRichEditorProps) {\n const readMarkdown = getMarkdown ?? getEditorMarkdown;\n const onChangeRef = useRef(onChange);\n const onBlurRef = useRef(onBlur);\n onChangeRef.current = onChange;\n onBlurRef.current = onBlur;\n\n const extensions = useMemo(\n () =>\n createSharedEditorExtensions({\n dialect,\n preset,\n placeholder,\n features,\n extraExtensions,\n onImageUpload,\n collab: ydoc ? { ydoc, awareness, user } : null,\n disableHistory,\n }),\n // `preset` is retained in the dependency list so future preset-specific\n // schema branches re-create the editor; it is currently schema-neutral. The\n // collab inputs are identity-stable per block (one Y.Doc per docId), so they\n // only change on a genuine doc switch — exactly when the editor must\n // re-create to rebind Collaboration.\n [\n dialect,\n placeholder,\n preset,\n features,\n extraExtensions,\n onImageUpload,\n ydoc,\n awareness,\n user?.name,\n user?.email,\n user?.color,\n disableHistory,\n ],\n );\n\n const collab = !!ydoc;\n\n // The collab hook needs the editor, but useEditor's `onUpdate` needs the\n // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards\n // through `guardsRef`, which is populated right after the hook runs below.\n // `onUpdate` only ever fires after the editor exists, by which point the ref\n // holds the real guards.\n const guardsRef = useRef<UseCollabReconcileResult | null>(null);\n\n const editor = useEditor({\n extensions,\n // With Collaboration active the prose is owned by the shared Y.XmlFragment.\n // Seeding `content` here too would make the editor initialize from BOTH the\n // prop and the Y.Doc, firing a spurious initial update that could autosave a\n // stale value over newer SQL. The lead-client seed effect populates an empty\n // doc instead. Non-collab editors keep initializing from `value`.\n // With Collaboration the Y.Doc owns the prose (seeded by the lead client).\n // With a custom `setContent` the reconcile seeds the editor too (the raw\n // `value` is not directly settable content — e.g. the plan's blocks JSON),\n // so only the plain markdown path seeds from `value` here.\n content: collab || setContent ? null : value,\n editable,\n editorProps: {\n attributes: {\n class: cn(\"an-rich-md-prose\", editorClassName),\n ...(ariaLabel ? { role: \"textbox\", \"aria-label\": ariaLabel } : {}),\n },\n },\n onUpdate: ({ editor, transaction }) => {\n const guards = guardsRef.current;\n if (!guards || guards.shouldIgnoreUpdate(transaction)) return;\n try {\n const markdown = readMarkdown(editor);\n if (!guards.registerEmitted(markdown)) return;\n queueMicrotask(() => onChangeRef.current(markdown));\n } catch (error) {\n console.error(\"Markdown serialization error:\", error);\n }\n },\n onBlur: () => {\n onBlurRef.current?.();\n },\n });\n\n const collabState = useCollabReconcile({\n editor,\n ydoc,\n awareness,\n value,\n contentUpdatedAt,\n editable,\n getMarkdown: readMarkdown,\n setContent,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n });\n guardsRef.current = collabState;\n\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n editor.setEditable(editable);\n }, [editable, editor]);\n\n useEffect(() => {\n if (editor) onEditorReady?.(editor);\n }, [editor, onEditorReady]);\n\n useEffect(() => () => editor?.destroy(), [editor]);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!editable || !editor || editor.isDestroyed) return;\n const target = event.target as HTMLElement;\n if (\n target.classList.contains(\"an-rich-md-wrapper\") ||\n target.classList.contains(\"an-rich-md-clickable\")\n ) {\n editor.chain().focus(\"end\").run();\n }\n };\n\n if (!editor) {\n return (\n <div\n className={cn(\"an-rich-md-wrapper an-rich-md-loading\", className)}\n data-plan-interactive={interactive ? true : undefined}\n />\n );\n }\n\n return (\n <div\n className={cn(\n \"an-rich-md-wrapper an-rich-md-clickable\",\n !editable && \"an-rich-md-wrapper--readonly\",\n wrapperClassName,\n className,\n )}\n onClick={handleWrapperClick}\n data-plan-interactive={interactive ? true : undefined}\n >\n {editable ? (\n <BubbleToolbar editor={editor} buildItems={buildBubbleItems} />\n ) : null}\n {editable ? (\n <SlashCommandMenu editor={editor} items={slashItems} />\n ) : null}\n <EditorContent editor={editor} />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SharedRichEditor.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAA0B,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,4BAA4B,GAK7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAyB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,yBAAyB,CAAC;AA8FjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,KAAK,EACf,MAAM,GAAG,MAAM,EACf,QAAQ,EACR,aAAa,GAAG,IAAI,EACpB,eAAe,EACf,WAAW,GAAG,0BAA0B,EACxC,SAAS,EACT,eAAe,EACf,SAAS,EACT,WAAW,GAAG,QAAQ,EACtB,IAAI,GAAG,IAAI,EACX,SAAS,GAAG,IAAI,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C,CAAC,CAAC,SAAS,GACrD,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,yCAAyC,EACzC,CAAC,QAAQ,IAAI,8BAA8B,EAC3C,gBAAgB,EAChB,SAAS,CACV,EACD,OAAO,EAAE,kBAAkB,2BACJ,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,aAEpD,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAI,CAChE,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAI,CACxD,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,GAAI,IAC7B,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { Extension, Node, Mark } from \"@tiptap/core\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport type { Awareness } from \"y-protocols/awareness\";\nimport type { Doc as YDoc } from \"yjs\";\n\nimport { cn } from \"../utils.js\";\nimport { BubbleToolbar, type BubbleToolbarItem } from \"./BubbleToolbar.js\";\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorFeatures,\n} from \"./extensions.js\";\nimport type { ImageUploadFn } from \"./ImageExtension.js\";\nimport { SlashCommandMenu, type SlashCommandItem } from \"./SlashCommandMenu.js\";\nimport {\n useCollabReconcile,\n getEditorMarkdown,\n type UseCollabReconcileResult,\n type UseCollabReconcileOptions,\n} from \"./useCollabReconcile.js\";\n\nexport interface SharedRichEditorProps {\n value: string;\n onChange: (markdown: string) => void;\n onBlur?: () => void;\n contentUpdatedAt?: string | null;\n editable?: boolean;\n dialect?: RichMarkdownDialect;\n preset?: RichMarkdownEditorPreset;\n /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */\n features?: SharedEditorFeatures;\n /**\n * Injectable image uploader for the shared image block. Used only when\n * `features.image` is on. Pass `uploadEditorImage` (the framework\n * `upload-image` action) for a real uploading image block.\n */\n onImageUpload?: ImageUploadFn | null;\n /**\n * App-specific extensions (Notion nodes, media, drag handles, comment\n * anchors, …) appended after the shared base schema.\n */\n extraExtensions?: Array<Extension | Node | Mark>;\n placeholder?: string;\n className?: string;\n editorClassName?: string;\n ariaLabel?: string;\n interactive?: boolean;\n /**\n * Yjs document for real-time multi-user editing. When provided, prose is\n * authored against the shared Y.Doc and mirrored back to `value` as markdown\n * (still the source of truth). When omitted, the editor is a plain controlled\n * `value`/`onChange` editor — the existing, non-collaborative behavior.\n */\n ydoc?: YDoc | null;\n /** Shared awareness instance for live cursors/presence. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n /**\n * Disable StarterKit's built-in undo/redo for a controlled (non-collab)\n * editor whose host owns its own undo authority (see\n * {@link CreateSharedEditorExtensionsOptions.disableHistory}). Ignored when a\n * `ydoc` is present (Yjs always owns history then). Default `false`, so every\n * existing embedder is unchanged.\n */\n disableHistory?: boolean;\n /** Override the slash-menu block command list. */\n slashItems?: SlashCommandItem[];\n /** Override the bubble-toolbar item builder. */\n buildBubbleItems?: (\n editor: import(\"@tiptap/react\").Editor,\n toggleLink: () => void,\n ) => BubbleToolbarItem[];\n /**\n * Override how the editor's content is read into the canonical `value`.\n * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk\n * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so\n * seed/reconcile/onChange all speak the same value space.\n */\n getMarkdown?: (editor: import(\"@tiptap/react\").Editor) => string;\n /** Override how the canonical `value` is applied into the editor (seed + reconcile). */\n setContent?: (\n editor: import(\"@tiptap/react\").Editor,\n value: string,\n options: { emitUpdate?: boolean; addToHistory?: boolean },\n ) => void;\n /**\n * Optional parser for surgical reconcile. Custom value formats that already\n * handle surgical writes inside `setContent` can pass `false` so the default\n * markdown parser never treats their source bytes as literal markdown.\n */\n parseValue?: UseCollabReconcileOptions[\"parseValue\"];\n /** Canonicalize `value` for the echo / already-in-sync equality checks. */\n normalizeValue?: (value: string) => string;\n /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */\n shouldSeed?: (info: {\n value: string;\n currentMarkdown: string;\n fragmentLength: number;\n }) => boolean;\n /** Initial \"applied\" watermark (see {@link useCollabReconcile}). */\n initialAppliedUpdatedAt?: string | null;\n /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */\n wrapperClassName?: string;\n /**\n * Fires once the editor instance exists. Lets a host capture the root\n * `editor.view` — e.g. to repaint the WHOLE document after a structural block\n * move (a column emptied and its container dissolved) that a surgical\n * per-region patch can't express, since the change is in the root doc itself.\n */\n onEditorReady?: (editor: import(\"@tiptap/react\").Editor) => void;\n}\n\n/**\n * The single shared rich markdown editor surface. Combines\n * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +\n * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /\n * lead-client logic), and the shared {@link SlashCommandMenu} +\n * {@link BubbleToolbar}.\n *\n * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.\n * With a `ydoc` it binds the framework collaboration stack; markdown stays the\n * canonical saved representation while the Y.Doc is transient live state.\n */\nexport function SharedRichEditor({\n value,\n onChange,\n onBlur,\n contentUpdatedAt,\n editable = true,\n dialect = \"gfm\",\n preset = \"plan\",\n features,\n onImageUpload = null,\n extraExtensions,\n placeholder = \"Type '/' for commands...\",\n className,\n editorClassName,\n ariaLabel,\n interactive = editable,\n ydoc = null,\n awareness = null,\n user = null,\n disableHistory = false,\n slashItems,\n buildBubbleItems,\n getMarkdown,\n setContent,\n parseValue,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n wrapperClassName,\n onEditorReady,\n}: SharedRichEditorProps) {\n const readMarkdown = getMarkdown ?? getEditorMarkdown;\n const onChangeRef = useRef(onChange);\n const onBlurRef = useRef(onBlur);\n onChangeRef.current = onChange;\n onBlurRef.current = onBlur;\n\n const extensions = useMemo(\n () =>\n createSharedEditorExtensions({\n dialect,\n preset,\n placeholder,\n features,\n extraExtensions,\n onImageUpload,\n collab: ydoc ? { ydoc, awareness, user } : null,\n disableHistory,\n }),\n // `preset` is retained in the dependency list so future preset-specific\n // schema branches re-create the editor; it is currently schema-neutral. The\n // collab inputs are identity-stable per block (one Y.Doc per docId), so they\n // only change on a genuine doc switch — exactly when the editor must\n // re-create to rebind Collaboration.\n [\n dialect,\n placeholder,\n preset,\n features,\n extraExtensions,\n onImageUpload,\n ydoc,\n awareness,\n user?.name,\n user?.email,\n user?.color,\n disableHistory,\n ],\n );\n\n const collab = !!ydoc;\n\n // The collab hook needs the editor, but useEditor's `onUpdate` needs the\n // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards\n // through `guardsRef`, which is populated right after the hook runs below.\n // `onUpdate` only ever fires after the editor exists, by which point the ref\n // holds the real guards.\n const guardsRef = useRef<UseCollabReconcileResult | null>(null);\n\n const editor = useEditor(\n {\n extensions,\n // With Collaboration active the prose is owned by the shared Y.XmlFragment.\n // Seeding `content` here too would make the editor initialize from BOTH the\n // prop and the Y.Doc, firing a spurious initial update that could autosave a\n // stale value over newer SQL. The lead-client seed effect populates an empty\n // doc instead. Non-collab editors keep initializing from `value`.\n // With Collaboration the Y.Doc owns the prose (seeded by the lead client).\n // With a custom `setContent` the reconcile seeds the editor too (the raw\n // `value` is not directly settable content — e.g. the plan's blocks JSON),\n // so only the plain markdown path seeds from `value` here.\n content: collab || setContent ? null : value,\n editable,\n editorProps: {\n attributes: {\n class: cn(\"an-rich-md-prose\", editorClassName),\n ...(ariaLabel ? { role: \"textbox\", \"aria-label\": ariaLabel } : {}),\n },\n },\n onUpdate: ({ editor, transaction }) => {\n const guards = guardsRef.current;\n if (!guards || guards.shouldIgnoreUpdate(transaction)) return;\n try {\n const markdown = readMarkdown(editor);\n if (!guards.registerEmitted(markdown)) return;\n queueMicrotask(() => onChangeRef.current(markdown));\n } catch (error) {\n console.error(\"Markdown serialization error:\", error);\n }\n },\n onBlur: () => {\n onBlurRef.current?.();\n },\n // Recreate the editor when the shared Y.Doc identity changes — including\n // null → doc. Extensions are baked in at creation, so a ydoc that arrives\n // AFTER the first mount (fresh page load: the session/user resolves after\n // the editor mounts) would otherwise never bind Collaboration: the editor\n // looks fine but produces no Yjs updates and never receives peers' edits.\n },\n [ydoc],\n );\n\n const collabState = useCollabReconcile({\n editor,\n ydoc,\n awareness,\n value,\n contentUpdatedAt,\n editable,\n getMarkdown: readMarkdown,\n setContent,\n parseValue,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n });\n guardsRef.current = collabState;\n\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n editor.setEditable(editable);\n }, [editable, editor]);\n\n useEffect(() => {\n if (editor) onEditorReady?.(editor);\n }, [editor, onEditorReady]);\n\n useEffect(() => () => editor?.destroy(), [editor]);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!editable || !editor || editor.isDestroyed) return;\n const target = event.target as HTMLElement;\n if (\n target.classList.contains(\"an-rich-md-wrapper\") ||\n target.classList.contains(\"an-rich-md-clickable\")\n ) {\n editor.chain().focus(\"end\").run();\n }\n };\n\n if (!editor) {\n return (\n <div\n className={cn(\"an-rich-md-wrapper an-rich-md-loading\", className)}\n data-plan-interactive={interactive ? true : undefined}\n />\n );\n }\n\n return (\n <div\n className={cn(\n \"an-rich-md-wrapper an-rich-md-clickable\",\n !editable && \"an-rich-md-wrapper--readonly\",\n wrapperClassName,\n className,\n )}\n onClick={handleWrapperClick}\n data-plan-interactive={interactive ? true : undefined}\n >\n {editable ? (\n <BubbleToolbar editor={editor} buildItems={buildBubbleItems} />\n ) : null}\n {editable ? (\n <SlashCommandMenu editor={editor} items={slashItems} />\n ) : null}\n <EditorContent editor={editor} />\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createSharedEditorExtensions, MARKDOWN_DIALECT_CONFIG, type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser, type SharedEditorCollab, type SharedEditorFeatures, type CreateSharedEditorExtensionsOptions, } from "./extensions.js";
|
|
2
2
|
export { useCollabReconcile, getEditorMarkdown, RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION, type UseCollabReconcileOptions, type UseCollabReconcileResult, } from "./useCollabReconcile.js";
|
|
3
|
+
export { applyDocSurgically, defaultParseValue, diffTopLevel, type TopLevelDiff, } from "./surgical-apply.js";
|
|
3
4
|
export { SlashCommandMenu, DEFAULT_SLASH_COMMANDS, createImageSlashCommand, type SlashCommandItem, type SlashCommandMenuProps, } from "./SlashCommandMenu.js";
|
|
4
5
|
export { SharedImage, createImageExtension, pickAndInsertImage, type ImageUploadFn, type SharedImageOptions, } from "./ImageExtension.js";
|
|
5
6
|
export { uploadEditorImage } from "./uploadEditorImage.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mCAAmC,GACzC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sCAAsC,EACtC,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,GACzC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,oCAAoC,EACpC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mCAAmC,GACzC,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,KAAK,m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EACpC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,KAAK,mCAAmC,GACzC,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createSharedEditorExtensions, MARKDOWN_DIALECT_CONFIG, } from "./extensions.js";
|
|
2
2
|
export { useCollabReconcile, getEditorMarkdown, RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION, } from "./useCollabReconcile.js";
|
|
3
|
+
export { applyDocSurgically, defaultParseValue, diffTopLevel, } from "./surgical-apply.js";
|
|
3
4
|
export { SlashCommandMenu, DEFAULT_SLASH_COMMANDS, createImageSlashCommand, } from "./SlashCommandMenu.js";
|
|
4
5
|
export { SharedImage, createImageExtension, pickAndInsertImage, } from "./ImageExtension.js";
|
|
5
6
|
export { uploadEditorImage } from "./uploadEditorImage.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,GAOxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sCAAsC,GAGvC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,GAGxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,GAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,GAG7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,oCAAoC,GAIrC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,GAEhC,MAAM,4BAA4B,CAAC","sourcesContent":["export {\n createSharedEditorExtensions,\n MARKDOWN_DIALECT_CONFIG,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorCollab,\n type SharedEditorFeatures,\n type CreateSharedEditorExtensionsOptions,\n} from \"./extensions.js\";\nexport {\n useCollabReconcile,\n getEditorMarkdown,\n RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION,\n type UseCollabReconcileOptions,\n type UseCollabReconcileResult,\n} from \"./useCollabReconcile.js\";\nexport {\n SlashCommandMenu,\n DEFAULT_SLASH_COMMANDS,\n createImageSlashCommand,\n type SlashCommandItem,\n type SlashCommandMenuProps,\n} from \"./SlashCommandMenu.js\";\nexport {\n SharedImage,\n createImageExtension,\n pickAndInsertImage,\n type ImageUploadFn,\n type SharedImageOptions,\n} from \"./ImageExtension.js\";\nexport { uploadEditorImage } from \"./uploadEditorImage.js\";\nexport {\n BubbleToolbar,\n buildDefaultBubbleItems,\n type BubbleToolbarItem,\n type BubbleToolbarProps,\n} from \"./BubbleToolbar.js\";\nexport {\n SharedRichEditor,\n type SharedRichEditorProps,\n} from \"./SharedRichEditor.js\";\nexport {\n createCodeBlockNode,\n DEFAULT_CODE_LANGUAGES,\n type CodeLanguageOption,\n type CodeBlockClassNames,\n type CreateCodeBlockNodeOptions,\n} from \"./CodeBlockNode.js\";\nexport {\n RichMarkdownEditor,\n createRichMarkdownExtensions,\n type RichMarkdownEditorProps,\n type CreateRichMarkdownExtensionsOptions,\n} from \"./RichMarkdownEditor.js\";\nexport { RunId, RUN_ID_NODE_TYPES } from \"./RunId.js\";\nexport { gfmToProseJSON, proseJSONToGfm } from \"./gfmDoc.js\";\nexport {\n DragHandle,\n DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR,\n type DragHandleDropContext,\n type DragHandleDropPlacement,\n type DragHandleOptions,\n} from \"./DragHandle.js\";\nexport {\n createRegistryBlockNode,\n RegistryBlockNodeView,\n RegistryBlockDataProvider,\n useRegistryBlockData,\n type CreateRegistryBlockNodeOptions,\n type RegistryBlockDataValue,\n type RegistryBlockSideMapBlock,\n} from \"./RegistryBlockNode.js\";\nexport {\n buildRegistryBlockSlashItems,\n getRegistryBlockSlashDescription,\n getRegistryBlockSlashSearchText,\n type BuildRegistryBlockSlashItemsOptions,\n} from \"./registrySlashCommands.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,GAOxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,sCAAsC,GAGvC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,GAEb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,GAGxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,kBAAkB,GAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,GAG7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,oCAAoC,GAIrC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,GAIrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,GAEhC,MAAM,4BAA4B,CAAC","sourcesContent":["export {\n createSharedEditorExtensions,\n MARKDOWN_DIALECT_CONFIG,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorCollab,\n type SharedEditorFeatures,\n type CreateSharedEditorExtensionsOptions,\n} from \"./extensions.js\";\nexport {\n useCollabReconcile,\n getEditorMarkdown,\n RICH_MARKDOWN_PROGRAMMATIC_TRANSACTION,\n type UseCollabReconcileOptions,\n type UseCollabReconcileResult,\n} from \"./useCollabReconcile.js\";\nexport {\n applyDocSurgically,\n defaultParseValue,\n diffTopLevel,\n type TopLevelDiff,\n} from \"./surgical-apply.js\";\nexport {\n SlashCommandMenu,\n DEFAULT_SLASH_COMMANDS,\n createImageSlashCommand,\n type SlashCommandItem,\n type SlashCommandMenuProps,\n} from \"./SlashCommandMenu.js\";\nexport {\n SharedImage,\n createImageExtension,\n pickAndInsertImage,\n type ImageUploadFn,\n type SharedImageOptions,\n} from \"./ImageExtension.js\";\nexport { uploadEditorImage } from \"./uploadEditorImage.js\";\nexport {\n BubbleToolbar,\n buildDefaultBubbleItems,\n type BubbleToolbarItem,\n type BubbleToolbarProps,\n} from \"./BubbleToolbar.js\";\nexport {\n SharedRichEditor,\n type SharedRichEditorProps,\n} from \"./SharedRichEditor.js\";\nexport {\n createCodeBlockNode,\n DEFAULT_CODE_LANGUAGES,\n type CodeLanguageOption,\n type CodeBlockClassNames,\n type CreateCodeBlockNodeOptions,\n} from \"./CodeBlockNode.js\";\nexport {\n RichMarkdownEditor,\n createRichMarkdownExtensions,\n type RichMarkdownEditorProps,\n type CreateRichMarkdownExtensionsOptions,\n} from \"./RichMarkdownEditor.js\";\nexport { RunId, RUN_ID_NODE_TYPES } from \"./RunId.js\";\nexport { gfmToProseJSON, proseJSONToGfm } from \"./gfmDoc.js\";\nexport {\n DragHandle,\n DEFAULT_DRAG_HANDLE_WRAPPER_SELECTOR,\n type DragHandleDropContext,\n type DragHandleDropPlacement,\n type DragHandleOptions,\n} from \"./DragHandle.js\";\nexport {\n createRegistryBlockNode,\n RegistryBlockNodeView,\n RegistryBlockDataProvider,\n useRegistryBlockData,\n type CreateRegistryBlockNodeOptions,\n type RegistryBlockDataValue,\n type RegistryBlockSideMapBlock,\n} from \"./RegistryBlockNode.js\";\nexport {\n buildRegistryBlockSlashItems,\n getRegistryBlockSlashDescription,\n getRegistryBlockSlashSearchText,\n type BuildRegistryBlockSlashItemsOptions,\n} from \"./registrySlashCommands.js\";\n"]}
|