@agent-native/core 0.80.4 → 0.80.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +21 -2
- package/corpus/core/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +1 -1
- package/corpus/core/docs/content/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/template-design.mdx +1 -1
- package/corpus/core/package.json +3 -7
- package/corpus/core/src/action.ts +21 -0
- package/corpus/core/src/agent/durable-background.ts +32 -11
- package/corpus/core/src/agent/production-agent.ts +11 -1
- package/corpus/core/src/agent/run-loop-with-resume.ts +3 -1
- package/corpus/core/src/brand-kit/fig/index.ts +17 -37
- package/corpus/core/src/cli/index.ts +1 -1
- package/corpus/core/src/cli/mcp-config-writers.ts +187 -51
- package/corpus/core/src/cli/skills.ts +18 -3
- package/corpus/core/src/client/AssistantChat.tsx +11 -1
- package/corpus/core/src/client/agent-chat.ts +12 -1
- package/corpus/core/src/client/composer/PromptComposer.tsx +100 -41
- package/corpus/core/src/client/org/OrgSwitcher.tsx +1 -1
- package/corpus/core/src/client/sharing/ShareButton.tsx +3 -27
- package/corpus/core/src/collab/presence.ts +1 -1
- package/corpus/core/src/mcp/connect-route.ts +34 -5
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +20 -0
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +2 -0
- package/corpus/templates/analytics/actions/update-dashboard.ts +8 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +117 -33
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +4 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +7 -0
- package/corpus/templates/analytics/changelog/2026-06-27-dashboards-can-now-nest-under-a-parent-in-the-sidebar-via-a-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-pages-now-sit-closer-under-the-header-with-tighter.md +6 -0
- package/corpus/templates/assets/actions/generate-image-batch.ts +3 -0
- package/corpus/templates/assets/actions/generate-image.ts +3 -0
- package/corpus/templates/assets/changelog/2026-06-29-longer-agent-generation-window.md +6 -0
- package/corpus/templates/assets/netlify.toml +3 -3
- package/corpus/templates/assets/server/plugins/agent-chat.ts +4 -1
- package/corpus/templates/clips/app/components/capture-install-options.tsx +7 -8
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +1 -1
- package/corpus/templates/content/AGENTS.md +12 -0
- package/corpus/templates/content/app/blocks/BuilderDocsBlocks.tsx +10 -0
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +1 -0
- package/corpus/templates/content/app/components/editor/ContentReferencePreview.tsx +185 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +3 -0
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +19 -0
- package/corpus/templates/content/app/components/editor/extensions/ContentReferenceNode.tsx +82 -0
- package/corpus/templates/content/app/global.css +9 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +12 -0
- package/corpus/templates/content/app/i18n-data.ts +140 -0
- package/corpus/templates/content/changelog/2026-06-29-reusable-mdx-references-now-preview-linked-local-documents-i.md +6 -0
- package/corpus/templates/content/shared/builder-docs-blocks.ts +8 -0
- package/corpus/templates/content/shared/builder-mdx.ts +141 -4
- package/corpus/templates/content/shared/nfm.ts +62 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +10 -11
- package/corpus/templates/design/AGENTS.md +5 -0
- package/corpus/templates/design/_gitignore +7 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +22 -12
- package/corpus/templates/design/actions/create-design-system.ts +15 -4
- package/corpus/templates/design/actions/create-file.ts +20 -1
- package/corpus/templates/design/actions/delete-design-system.ts +2 -2
- package/corpus/templates/design/actions/duplicate-design.ts +35 -9
- package/corpus/templates/design/actions/generate-design.ts +146 -69
- package/corpus/templates/design/actions/generate-screens.ts +51 -19
- package/corpus/templates/design/actions/get-design-snapshot.ts +5 -1
- package/corpus/templates/design/actions/get-design.ts +2 -0
- package/corpus/templates/design/actions/import-design-project.ts +28 -9
- package/corpus/templates/design/actions/import-document.ts +22 -8
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +6 -153
- package/corpus/templates/design/actions/navigate.ts +105 -54
- package/corpus/templates/design/actions/set-default-design-system.ts +17 -3
- package/corpus/templates/design/actions/show-design-questions.ts +2 -0
- package/corpus/templates/design/actions/update-design.ts +2 -1
- package/corpus/templates/design/actions/view-screen.ts +12 -6
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +4 -4
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +159 -41
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +8 -4
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +37 -42
- package/corpus/templates/design/app/components/design/EditPanel.tsx +336 -183
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +153 -34
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +135 -33
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +6 -0
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +4 -10
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +84 -43
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +4 -4
- package/corpus/templates/design/app/components/design/inspector/{FigmaColorPicker.tsx → DesignColorPicker.tsx} +89 -62
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +14 -26
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +40 -12
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +13 -4
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +13 -13
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +13 -9
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +13 -4
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design/inspector/{figma-icons.tsx → design-icons.tsx} +2 -2
- package/corpus/templates/design/app/components/design/inspector/index.ts +12 -12
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +5 -2
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +3 -3
- package/corpus/templates/design/app/components/layout/Layout.tsx +5 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +167 -91
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +16 -3
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +15 -0
- package/corpus/templates/design/app/global.css +4 -0
- package/corpus/templates/design/app/hooks/use-design-system.ts +4 -1
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +38 -3
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +9 -2
- package/corpus/templates/design/app/i18n/zh-TW.ts +22 -0
- package/corpus/templates/design/app/i18n-data.ts +527 -0
- package/corpus/templates/design/app/lib/design-systems.ts +6 -4
- package/corpus/templates/design/app/lib/design-templates.ts +15 -3
- package/corpus/templates/design/app/pages/DesignEditor.tsx +641 -158
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +42 -34
- package/corpus/templates/design/app/pages/VisualEdit.tsx +100 -0
- package/corpus/templates/design/app/root.tsx +42 -9
- package/corpus/templates/design/app/routes/visual-edit.tsx +7 -0
- package/corpus/templates/design/changelog/2026-06-28-live-cursors-now-keep-names-beside-a-cleaner-pointer-marker.md +1 -1
- package/corpus/templates/design/changelog/2026-06-28-mode-switching-now-lives-in-a-compact-bottom-right-icon-dock.md +1 -1
- package/corpus/templates/design/changelog/2026-06-28-visual-code-design-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-generation-prompts-now-show-connect-ai-before-sending.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +1 -1
- package/corpus/templates/design/changelog/2026-06-29-fixed-design-editor-exports-and-gradient-edits-so-multi-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-png-export-handles-modern-css-color-functions-more-reliably.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-png-export-now-ignores-duplicate-clicks-while-a-download-is-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-public-visual-edit-and-shared-design-links-now-invite-visito.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-visual-edit-actions-now-reject-missing-design-targets-before.md +6 -0
- package/corpus/templates/design/e2e/README.md +71 -0
- package/corpus/templates/design/e2e/global-setup.ts +157 -0
- package/corpus/templates/design/e2e/helpers.ts +148 -0
- package/corpus/templates/design/netlify.toml +3 -4
- package/corpus/templates/design/package.json +5 -1
- package/corpus/templates/design/playwright.config.ts +51 -0
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +121 -0
- package/corpus/templates/design/server/handlers/uploads.ts +89 -38
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +181 -0
- package/corpus/templates/design/server/lib/coding-handoff.ts +33 -4
- package/corpus/templates/design/server/lib/design-export.ts +35 -8
- package/corpus/templates/design/server/plugins/agent-chat.ts +4 -0
- package/corpus/templates/design/server/plugins/auth.ts +10 -1
- package/corpus/templates/design/server/routes/api/index-design-system-with-builder.post.ts +1 -0
- package/corpus/templates/design/shared/api.ts +2 -0
- package/corpus/templates/design/shared/apply-edits.ts +12 -8
- package/corpus/templates/design/shared/canvas-math.ts +19 -1
- package/corpus/templates/design/shared/code-layer.ts +87 -28
- package/corpus/templates/design/shared/generation-session.ts +1 -0
- package/corpus/templates/design/shared/resolve-tweaks.ts +4 -3
- package/corpus/templates/design/shared/shader-presets.ts +10 -0
- package/corpus/templates/design/shared/source-mode.ts +9 -0
- package/corpus/templates/design/vitest.config.ts +2 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/plan/.agents/skills/visual-plan/references/canvas.md +1 -1
- package/corpus/templates/plan/AGENTS.md +1 -1
- package/corpus/templates/plan/actions/create-plan-design.ts +1 -1
- package/corpus/templates/plan/actions/validate-local-plan-source.ts +2 -10
- package/corpus/templates/plan/app/pages/PlansPage.tsx +1 -0
- package/corpus/templates/plan/docs/commenting-ux-plan.md +2 -2
- package/corpus/templates/plan/server/plan-content.ts +1 -1
- package/corpus/templates/plan/server/ui-plan-html.ts +2 -2
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +6 -153
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +53 -38
- package/corpus/templates/slides/app/components/design-system/{fig-import-response.ts → builder-index-response.ts} +9 -6
- package/corpus/templates/slides/app/components/visual-editor/MultiSelectChip.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-06-29-design-system-setup-now-indexes-uploaded-design-files-throug.md +6 -0
- package/corpus/templates/slides/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
- package/corpus/templates/slides/netlify.toml +3 -6
- package/corpus/templates/slides/server/handlers/index-design-system-with-builder.ts +116 -0
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +179 -0
- package/corpus/templates/slides/server/plugins/agent-chat.ts +4 -1
- package/corpus/templates/slides/server/routes/api/index-design-system-with-builder.post.ts +1 -0
- package/dist/action.d.ts +15 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +6 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/durable-background.d.ts +9 -7
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +27 -11
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/production-agent.d.ts +7 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +4 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts +2 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +2 -2
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/brand-kit/fig/index.d.ts +4 -4
- package/dist/brand-kit/fig/index.d.ts.map +1 -1
- package/dist/brand-kit/fig/index.js +14 -27
- package/dist/brand-kit/fig/index.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp-config-writers.d.ts +15 -7
- package/dist/cli/mcp-config-writers.d.ts.map +1 -1
- package/dist/cli/mcp-config-writers.js +198 -45
- package/dist/cli/mcp-config-writers.js.map +1 -1
- package/dist/cli/skills.d.ts +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +18 -3
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +11 -1
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +15 -2
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +35 -1
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/org/OrgSwitcher.js +1 -1
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +1 -1
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +2 -15
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/collab/presence.d.ts +1 -1
- package/dist/collab/presence.js +1 -1
- package/dist/collab/presence.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +34 -5
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +5 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +6 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +12 -3
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ar-SA/template-design.mdx +1 -1
- package/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
- package/docs/content/locales/de-DE/template-design.mdx +1 -1
- package/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/es-ES/template-design.mdx +1 -1
- package/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/fr-FR/template-design.mdx +1 -1
- package/docs/content/locales/hi-IN/template-design.mdx +1 -1
- package/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ja-JP/template-design.mdx +1 -1
- package/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ko-KR/template-design.mdx +1 -1
- package/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/pt-BR/template-design.mdx +1 -1
- package/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/zh-CN/template-design.mdx +1 -1
- package/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/zh-TW/template-design.mdx +1 -1
- package/docs/content/real-time-collaboration.mdx +2 -2
- package/docs/content/template-design.mdx +1 -1
- package/package.json +3 -7
- package/corpus/core/src/brand-kit/fig/decode.ts +0 -410
- package/corpus/core/src/brand-kit/fig/extract-design-system.ts +0 -947
- package/corpus/core/src/brand-kit/fig/fig-to-html.ts +0 -1906
- package/corpus/templates/design/actions/import-figma.ts +0 -55
- package/corpus/templates/design/changelog/2026-06-28-figma-style-code-design-mode.md +0 -6
- package/corpus/templates/design/server/handlers/import-figma-system.ts +0 -86
- package/corpus/templates/design/server/routes/api/import-figma-system.post.ts +0 -1
- package/corpus/templates/slides/server/handlers/import-figma-system.ts +0 -101
- package/corpus/templates/slides/server/routes/api/import-figma-system.post.ts +0 -1
- package/dist/brand-kit/fig/decode.d.ts +0 -33
- package/dist/brand-kit/fig/decode.d.ts.map +0 -1
- package/dist/brand-kit/fig/decode.js +0 -358
- package/dist/brand-kit/fig/decode.js.map +0 -1
- package/dist/brand-kit/fig/extract-design-system.d.ts +0 -44
- package/dist/brand-kit/fig/extract-design-system.d.ts.map +0 -1
- package/dist/brand-kit/fig/extract-design-system.js +0 -752
- package/dist/brand-kit/fig/extract-design-system.js.map +0 -1
- package/dist/brand-kit/fig/fig-to-html.d.ts +0 -246
- package/dist/brand-kit/fig/fig-to-html.d.ts.map +0 -1
- package/dist/brand-kit/fig/fig-to-html.js +0 -1506
- package/dist/brand-kit/fig/fig-to-html.js.map +0 -1
|
@@ -85,6 +85,7 @@ interface CanvasToolProps {
|
|
|
85
85
|
|
|
86
86
|
export interface CanvasPrimitiveInsert {
|
|
87
87
|
kind: DraftPrimitiveKind;
|
|
88
|
+
nodeId?: string;
|
|
88
89
|
geometry: FrameGeometry;
|
|
89
90
|
points?: Point[];
|
|
90
91
|
pathData?: string;
|
|
@@ -95,6 +96,11 @@ export interface CanvasPrimitiveInsert {
|
|
|
95
96
|
autoSize?: boolean;
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
interface PersistedDraftPrimitive {
|
|
100
|
+
frameId: string;
|
|
101
|
+
nodeId: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
interface ScreenMetadata {
|
|
99
105
|
source?: string;
|
|
100
106
|
sourceType?: string;
|
|
@@ -136,7 +142,7 @@ interface MultiScreenCanvasProps {
|
|
|
136
142
|
onCreatePrimitive?: (
|
|
137
143
|
screenId: string,
|
|
138
144
|
primitive: CanvasPrimitiveInsert,
|
|
139
|
-
) => boolean;
|
|
145
|
+
) => boolean | string;
|
|
140
146
|
onCreateScreenFrame?: (geometry: FrameGeometry) => void;
|
|
141
147
|
onDeleteSelection?: (ids: string[]) => boolean | void;
|
|
142
148
|
onZoomChange?: (zoom: number) => void;
|
|
@@ -152,7 +158,7 @@ interface MultiScreenCanvasProps {
|
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
/**
|
|
155
|
-
*
|
|
161
|
+
* design-editor overview canvas. Renders every file in the design as a movable,
|
|
156
162
|
* resizable frame inside an infinite, pannable surface.
|
|
157
163
|
*/
|
|
158
164
|
const SCREEN_WIDTH = 320;
|
|
@@ -193,6 +199,8 @@ interface DuplicatePreview {
|
|
|
193
199
|
display: string;
|
|
194
200
|
x: number;
|
|
195
201
|
y: number;
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
196
204
|
canDuplicate: boolean;
|
|
197
205
|
moved: boolean;
|
|
198
206
|
}
|
|
@@ -351,6 +359,7 @@ interface DraftCreateDragState {
|
|
|
351
359
|
tool: DraftCreationTool;
|
|
352
360
|
originClient: Point;
|
|
353
361
|
originCanvas: Point;
|
|
362
|
+
originFrameId?: string;
|
|
354
363
|
points: Point[];
|
|
355
364
|
hasMoved: boolean;
|
|
356
365
|
}
|
|
@@ -691,20 +700,34 @@ export function MultiScreenCanvas({
|
|
|
691
700
|
[getCurrentDraftEntries, getCurrentFrameEntries],
|
|
692
701
|
);
|
|
693
702
|
|
|
694
|
-
const
|
|
695
|
-
(
|
|
696
|
-
|
|
697
|
-
return getCurrentFrameEntries()
|
|
703
|
+
const getFrameEntryAtPoint = useCallback(
|
|
704
|
+
(point: Point) =>
|
|
705
|
+
getCurrentFrameEntries()
|
|
698
706
|
.map((entry, index) => ({ ...entry, index }))
|
|
699
707
|
.filter((entry) =>
|
|
700
|
-
rectContainsPoint(
|
|
708
|
+
rectContainsPoint(
|
|
709
|
+
{
|
|
710
|
+
left: entry.geometry.x,
|
|
711
|
+
top: entry.geometry.y,
|
|
712
|
+
right: entry.geometry.x + entry.geometry.width,
|
|
713
|
+
bottom: entry.geometry.y + entry.geometry.height,
|
|
714
|
+
},
|
|
715
|
+
point,
|
|
716
|
+
),
|
|
701
717
|
)
|
|
702
718
|
.sort(
|
|
703
719
|
(a, b) =>
|
|
704
720
|
(b.geometry.z ?? 0) - (a.geometry.z ?? 0) || b.index - a.index,
|
|
705
|
-
)[0]
|
|
721
|
+
)[0],
|
|
722
|
+
[getCurrentFrameEntries],
|
|
723
|
+
);
|
|
724
|
+
|
|
725
|
+
const getFrameAtClientPoint = useCallback(
|
|
726
|
+
(clientX: number, clientY: number) => {
|
|
727
|
+
const point = canvasPointFromClient(clientX, clientY);
|
|
728
|
+
return getFrameEntryAtPoint(point)?.id;
|
|
706
729
|
},
|
|
707
|
-
[canvasPointFromClient,
|
|
730
|
+
[canvasPointFromClient, getFrameEntryAtPoint],
|
|
708
731
|
);
|
|
709
732
|
|
|
710
733
|
const deleteSelectedItems = useCallback(() => {
|
|
@@ -932,8 +955,14 @@ export function MultiScreenCanvas({
|
|
|
932
955
|
);
|
|
933
956
|
|
|
934
957
|
const getTargetFrameForDraft = useCallback(
|
|
935
|
-
(draft: DraftPrimitive) =>
|
|
936
|
-
getCurrentFrameEntries()
|
|
958
|
+
(draft: DraftPrimitive, preferredFrameId?: string) => {
|
|
959
|
+
const entries = getCurrentFrameEntries();
|
|
960
|
+
const preferred = preferredFrameId
|
|
961
|
+
? entries.find((entry) => entry.id === preferredFrameId)
|
|
962
|
+
: undefined;
|
|
963
|
+
if (preferred) return preferred;
|
|
964
|
+
|
|
965
|
+
return entries
|
|
937
966
|
.filter(({ geometry }) =>
|
|
938
967
|
rectContainsPoint(
|
|
939
968
|
{
|
|
@@ -945,13 +974,17 @@ export function MultiScreenCanvas({
|
|
|
945
974
|
getFrameCenter(draft.geometry),
|
|
946
975
|
),
|
|
947
976
|
)
|
|
948
|
-
.sort((a, b) => (b.geometry.z ?? 0) - (a.geometry.z ?? 0))[0]
|
|
977
|
+
.sort((a, b) => (b.geometry.z ?? 0) - (a.geometry.z ?? 0))[0];
|
|
978
|
+
},
|
|
949
979
|
[getCurrentFrameEntries],
|
|
950
980
|
);
|
|
951
981
|
|
|
952
982
|
const persistDraftPrimitive = useCallback(
|
|
953
|
-
(
|
|
954
|
-
|
|
983
|
+
(
|
|
984
|
+
draft: DraftPrimitive,
|
|
985
|
+
preferredFrameId?: string,
|
|
986
|
+
): PersistedDraftPrimitive | null => {
|
|
987
|
+
const targetFrame = getTargetFrameForDraft(draft, preferredFrameId);
|
|
955
988
|
if (!targetFrame || !onCreatePrimitive) return null;
|
|
956
989
|
const targetScreen = screens.find(
|
|
957
990
|
(screen) => screen.id === targetFrame.id,
|
|
@@ -970,7 +1003,13 @@ export function MultiScreenCanvas({
|
|
|
970
1003
|
targetMetadata,
|
|
971
1004
|
);
|
|
972
1005
|
const persisted = onCreatePrimitive(targetFrame.id, localPrimitive);
|
|
973
|
-
|
|
1006
|
+
if (!persisted) return null;
|
|
1007
|
+
return {
|
|
1008
|
+
frameId: targetFrame.id,
|
|
1009
|
+
nodeId:
|
|
1010
|
+
(typeof persisted === "string" ? persisted : localPrimitive.nodeId) ??
|
|
1011
|
+
draft.id,
|
|
1012
|
+
};
|
|
974
1013
|
},
|
|
975
1014
|
[
|
|
976
1015
|
getScreenMetadata,
|
|
@@ -982,14 +1021,14 @@ export function MultiScreenCanvas({
|
|
|
982
1021
|
);
|
|
983
1022
|
|
|
984
1023
|
const commitDraftPrimitive = useCallback(
|
|
985
|
-
(nextDraft: DraftPrimitive) => {
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
1024
|
+
(nextDraft: DraftPrimitive, preferredFrameId?: string) => {
|
|
1025
|
+
const persisted = persistDraftPrimitive(nextDraft, preferredFrameId);
|
|
1026
|
+
if (persisted) {
|
|
988
1027
|
updateDraftPrimitives((current) =>
|
|
989
1028
|
current.filter((draft) => draft.id !== nextDraft.id),
|
|
990
1029
|
);
|
|
991
1030
|
updateSelectedDraftIds(() => []);
|
|
992
|
-
updateSelectedIds(() => [
|
|
1031
|
+
updateSelectedIds(() => [persisted.nodeId]);
|
|
993
1032
|
return;
|
|
994
1033
|
}
|
|
995
1034
|
|
|
@@ -1185,6 +1224,7 @@ export function MultiScreenCanvas({
|
|
|
1185
1224
|
e.stopPropagation();
|
|
1186
1225
|
|
|
1187
1226
|
const originCanvas = getCanvasPoint(e.clientX, e.clientY);
|
|
1227
|
+
const originFrameId = getFrameEntryAtPoint(originCanvas)?.id;
|
|
1188
1228
|
const initialGeometry = getDraftGeometryForTool(
|
|
1189
1229
|
tool,
|
|
1190
1230
|
originCanvas,
|
|
@@ -1204,6 +1244,7 @@ export function MultiScreenCanvas({
|
|
|
1204
1244
|
tool,
|
|
1205
1245
|
originClient: { x: e.clientX, y: e.clientY },
|
|
1206
1246
|
originCanvas,
|
|
1247
|
+
originFrameId,
|
|
1207
1248
|
points: initialPoints ?? [],
|
|
1208
1249
|
hasMoved: false,
|
|
1209
1250
|
};
|
|
@@ -1267,12 +1308,18 @@ export function MultiScreenCanvas({
|
|
|
1267
1308
|
}
|
|
1268
1309
|
|
|
1269
1310
|
let endCanvas = getCanvasPoint(ev.clientX, ev.clientY);
|
|
1311
|
+
const canvasMoved =
|
|
1312
|
+
Math.hypot(
|
|
1313
|
+
endCanvas.x - state.originCanvas.x,
|
|
1314
|
+
endCanvas.y - state.originCanvas.y,
|
|
1315
|
+
) >= 0.5;
|
|
1270
1316
|
const releaseMoved =
|
|
1271
1317
|
state.hasMoved ||
|
|
1272
1318
|
Math.hypot(
|
|
1273
1319
|
ev.clientX - state.originClient.x,
|
|
1274
1320
|
ev.clientY - state.originClient.y,
|
|
1275
|
-
) >= DRAG_THRESHOLD
|
|
1321
|
+
) >= DRAG_THRESHOLD ||
|
|
1322
|
+
canvasMoved;
|
|
1276
1323
|
state.hasMoved = releaseMoved;
|
|
1277
1324
|
let points = state.tool === "pen" ? state.points : undefined;
|
|
1278
1325
|
if (state.tool === "pen") {
|
|
@@ -1303,7 +1350,7 @@ export function MultiScreenCanvas({
|
|
|
1303
1350
|
toolProps,
|
|
1304
1351
|
fallbackText: t("designEditor.tools.text"),
|
|
1305
1352
|
});
|
|
1306
|
-
commitDraftPrimitive(nextDraft);
|
|
1353
|
+
commitDraftPrimitive(nextDraft, state.originFrameId);
|
|
1307
1354
|
if (activeTool === undefined) {
|
|
1308
1355
|
setLocalActiveTool("move");
|
|
1309
1356
|
}
|
|
@@ -1325,6 +1372,7 @@ export function MultiScreenCanvas({
|
|
|
1325
1372
|
commitDraftPrimitive,
|
|
1326
1373
|
finishDrag,
|
|
1327
1374
|
getCanvasPoint,
|
|
1375
|
+
getFrameEntryAtPoint,
|
|
1328
1376
|
installDragListeners,
|
|
1329
1377
|
onActiveToolChange,
|
|
1330
1378
|
onCreateScreenFrame,
|
|
@@ -1422,25 +1470,45 @@ export function MultiScreenCanvas({
|
|
|
1422
1470
|
const handleMouseUp = () => {
|
|
1423
1471
|
const state = dragState.current;
|
|
1424
1472
|
if (state?.type === "draft-move" && state.hasMoved) {
|
|
1425
|
-
const persisted: Array<{
|
|
1473
|
+
const persisted: Array<{
|
|
1474
|
+
draftId: string;
|
|
1475
|
+
frameId: string;
|
|
1476
|
+
nodeId: string;
|
|
1477
|
+
}> = [];
|
|
1426
1478
|
draftPrimitivesRef.current.forEach((draft) => {
|
|
1427
1479
|
if (!state.targetIds.includes(draft.id)) return;
|
|
1428
|
-
const
|
|
1429
|
-
if (
|
|
1480
|
+
const result = persistDraftPrimitive(draft);
|
|
1481
|
+
if (result) {
|
|
1482
|
+
persisted.push({
|
|
1483
|
+
draftId: draft.id,
|
|
1484
|
+
frameId: result.frameId,
|
|
1485
|
+
nodeId: result.nodeId,
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1430
1488
|
});
|
|
1431
1489
|
|
|
1432
1490
|
if (persisted.length > 0) {
|
|
1433
1491
|
const persistedDraftIds = new Set(
|
|
1434
1492
|
persisted.map((entry) => entry.draftId),
|
|
1435
1493
|
);
|
|
1436
|
-
const lastFrameId = persisted[persisted.length - 1]?.frameId;
|
|
1437
1494
|
updateDraftPrimitives((current) =>
|
|
1438
1495
|
current.filter((draft) => !persistedDraftIds.has(draft.id)),
|
|
1439
1496
|
);
|
|
1440
1497
|
updateSelectedDraftIds((current) =>
|
|
1441
1498
|
current.filter((draftId) => !persistedDraftIds.has(draftId)),
|
|
1442
1499
|
);
|
|
1443
|
-
|
|
1500
|
+
const lastNodeId = persisted[persisted.length - 1]?.nodeId;
|
|
1501
|
+
if (lastNodeId) updateSelectedIds(() => [lastNodeId]);
|
|
1502
|
+
} else {
|
|
1503
|
+
// No draft landed in a frame — restore each moved draft to its
|
|
1504
|
+
// original position so the move is atomic (commit or revert).
|
|
1505
|
+
updateDraftPrimitives((current) =>
|
|
1506
|
+
current.map((draft) => {
|
|
1507
|
+
if (!state.targetIds.includes(draft.id)) return draft;
|
|
1508
|
+
const origin = state.originDrafts[draft.id];
|
|
1509
|
+
return origin ?? draft;
|
|
1510
|
+
}),
|
|
1511
|
+
);
|
|
1444
1512
|
}
|
|
1445
1513
|
}
|
|
1446
1514
|
finishDrag();
|
|
@@ -1618,6 +1686,7 @@ export function MultiScreenCanvas({
|
|
|
1618
1686
|
: [id];
|
|
1619
1687
|
if (!currentSelectedIds.includes(id)) {
|
|
1620
1688
|
updateSelectedIds(() => [id]);
|
|
1689
|
+
onPick(id);
|
|
1621
1690
|
}
|
|
1622
1691
|
updateSelectedDraftIds(() => []);
|
|
1623
1692
|
|
|
@@ -1715,6 +1784,7 @@ export function MultiScreenCanvas({
|
|
|
1715
1784
|
finishDrag,
|
|
1716
1785
|
getCurrentFrameEntries,
|
|
1717
1786
|
installDragListeners,
|
|
1787
|
+
onPick,
|
|
1718
1788
|
showTransformFeedback,
|
|
1719
1789
|
updateFrameGeometry,
|
|
1720
1790
|
updateSelectedDraftIds,
|
|
@@ -1783,6 +1853,8 @@ export function MultiScreenCanvas({
|
|
|
1783
1853
|
{
|
|
1784
1854
|
preserveAspectRatio: ev.shiftKey,
|
|
1785
1855
|
resizeFromCenter: ev.altKey,
|
|
1856
|
+
minWidth: 1,
|
|
1857
|
+
minHeight: 1,
|
|
1786
1858
|
},
|
|
1787
1859
|
);
|
|
1788
1860
|
const snap = computeResizeSnap(
|
|
@@ -2002,10 +2074,15 @@ export function MultiScreenCanvas({
|
|
|
2002
2074
|
y: surfaceRect ? e.clientY - surfaceRect.top + 16 : e.clientY,
|
|
2003
2075
|
};
|
|
2004
2076
|
|
|
2077
|
+
const previewWidth = sourceFrame?.geometry.width ?? SCREEN_WIDTH;
|
|
2078
|
+
const previewHeight = sourceFrame?.geometry.height ?? SCREEN_HEIGHT;
|
|
2079
|
+
|
|
2005
2080
|
setDuplicatePreview({
|
|
2006
2081
|
display,
|
|
2007
2082
|
x: previewPoint.x,
|
|
2008
2083
|
y: previewPoint.y,
|
|
2084
|
+
width: previewWidth,
|
|
2085
|
+
height: previewHeight,
|
|
2009
2086
|
canDuplicate: !!onDuplicate,
|
|
2010
2087
|
moved: false,
|
|
2011
2088
|
});
|
|
@@ -2019,6 +2096,8 @@ export function MultiScreenCanvas({
|
|
|
2019
2096
|
display,
|
|
2020
2097
|
x: rect ? ev.clientX - rect.left + 16 : ev.clientX,
|
|
2021
2098
|
y: rect ? ev.clientY - rect.top + 16 : ev.clientY,
|
|
2099
|
+
width: previewWidth,
|
|
2100
|
+
height: previewHeight,
|
|
2022
2101
|
canDuplicate: !!onDuplicate,
|
|
2023
2102
|
moved,
|
|
2024
2103
|
});
|
|
@@ -2028,9 +2107,15 @@ export function MultiScreenCanvas({
|
|
|
2028
2107
|
setDuplicatePreview(null);
|
|
2029
2108
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
2030
2109
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
2110
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2111
|
+
window.removeEventListener("blur", handleBlur);
|
|
2031
2112
|
duplicateCleanup.current = null;
|
|
2032
2113
|
};
|
|
2033
2114
|
|
|
2115
|
+
const handleBlur = () => {
|
|
2116
|
+
cleanupDuplicateGesture();
|
|
2117
|
+
};
|
|
2118
|
+
|
|
2034
2119
|
const handleMouseUp = (ev: MouseEvent) => {
|
|
2035
2120
|
const moved =
|
|
2036
2121
|
Math.hypot(ev.clientX - origin.x, ev.clientY - origin.y) >=
|
|
@@ -2069,6 +2154,7 @@ export function MultiScreenCanvas({
|
|
|
2069
2154
|
duplicateCleanup.current = cleanupDuplicateGesture;
|
|
2070
2155
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2071
2156
|
window.addEventListener("mouseup", handleMouseUp);
|
|
2157
|
+
window.addEventListener("blur", handleBlur);
|
|
2072
2158
|
},
|
|
2073
2159
|
[canvasPointFromClient, getCurrentFrameEntries, onDuplicate, onPick],
|
|
2074
2160
|
);
|
|
@@ -2334,7 +2420,7 @@ export function MultiScreenCanvas({
|
|
|
2334
2420
|
return;
|
|
2335
2421
|
}
|
|
2336
2422
|
|
|
2337
|
-
if (event.key === "Enter"
|
|
2423
|
+
if (event.key === "Enter") {
|
|
2338
2424
|
event.preventDefault();
|
|
2339
2425
|
event.stopPropagation();
|
|
2340
2426
|
event.stopImmediatePropagation();
|
|
@@ -2342,6 +2428,14 @@ export function MultiScreenCanvas({
|
|
|
2342
2428
|
return;
|
|
2343
2429
|
}
|
|
2344
2430
|
|
|
2431
|
+
if (event.key === "Escape") {
|
|
2432
|
+
event.preventDefault();
|
|
2433
|
+
event.stopPropagation();
|
|
2434
|
+
event.stopImmediatePropagation();
|
|
2435
|
+
clearActivePenPath();
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2345
2439
|
if (event.key === "Delete" || event.key === "Backspace") {
|
|
2346
2440
|
event.preventDefault();
|
|
2347
2441
|
event.stopPropagation();
|
|
@@ -2566,10 +2660,10 @@ export function MultiScreenCanvas({
|
|
|
2566
2660
|
style={{
|
|
2567
2661
|
left: duplicatePreview.x,
|
|
2568
2662
|
top: duplicatePreview.y,
|
|
2569
|
-
width:
|
|
2570
|
-
height:
|
|
2571
|
-
maxWidth:
|
|
2572
|
-
maxHeight:
|
|
2663
|
+
width: duplicatePreview.width * Math.min(scale, 1),
|
|
2664
|
+
height: duplicatePreview.height * Math.min(scale, 1),
|
|
2665
|
+
maxWidth: duplicatePreview.width,
|
|
2666
|
+
maxHeight: duplicatePreview.height,
|
|
2573
2667
|
}}
|
|
2574
2668
|
>
|
|
2575
2669
|
<div className="flex h-full w-full items-start justify-between rounded-lg bg-muted/20 p-2">
|
|
@@ -2988,6 +3082,7 @@ function Screen({
|
|
|
2988
3082
|
if (penActive || creationToolActive) return;
|
|
2989
3083
|
if (e.shiftKey) {
|
|
2990
3084
|
e.stopPropagation();
|
|
3085
|
+
onPick(screen.id, e);
|
|
2991
3086
|
return;
|
|
2992
3087
|
}
|
|
2993
3088
|
onStartFrameDrag(screen.id, e);
|
|
@@ -3016,7 +3111,7 @@ function Screen({
|
|
|
3016
3111
|
<button
|
|
3017
3112
|
type="button"
|
|
3018
3113
|
className={cn(
|
|
3019
|
-
"flex h-5 max-w-[46%] shrink-0 items-center gap-1 overflow-hidden rounded-md border border-border bg-background/95 px-1.5 text-[10px] font-medium text-foreground opacity-0 shadow-sm transition-opacity",
|
|
3114
|
+
"relative z-40 flex h-5 max-w-[46%] shrink-0 items-center gap-1 overflow-hidden rounded-md border border-border bg-background/95 px-1.5 text-[10px] font-medium text-foreground opacity-0 shadow-sm transition-opacity",
|
|
3020
3115
|
"hover:bg-accent hover:text-accent-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3021
3116
|
"group-hover/frame:opacity-100 group-focus-within/frame:opacity-100",
|
|
3022
3117
|
emphasized && "opacity-100",
|
|
@@ -3143,7 +3238,7 @@ function Screen({
|
|
|
3143
3238
|
<ResizeHandles
|
|
3144
3239
|
active={selectionOutlined}
|
|
3145
3240
|
enabled={!penActive && !creationToolActive && handlesEnabled}
|
|
3146
|
-
showRotate
|
|
3241
|
+
showRotate
|
|
3147
3242
|
chromeScale={chromeScale}
|
|
3148
3243
|
onStartResize={(handle, e) => onStartResize(screen.id, handle, e)}
|
|
3149
3244
|
onStartRotate={(e) => onStartRotate(screen.id, e)}
|
|
@@ -3400,6 +3495,12 @@ function isEditableHotkeyTarget(target: EventTarget | null) {
|
|
|
3400
3495
|
].join(","),
|
|
3401
3496
|
);
|
|
3402
3497
|
if (!editable) return false;
|
|
3498
|
+
if (
|
|
3499
|
+
editable.getAttribute("role") === "textbox" ||
|
|
3500
|
+
editable.hasAttribute("data-hotkeys-scope")
|
|
3501
|
+
) {
|
|
3502
|
+
return true;
|
|
3503
|
+
}
|
|
3403
3504
|
if (editable instanceof HTMLElement && editable.isContentEditable) {
|
|
3404
3505
|
return true;
|
|
3405
3506
|
}
|
|
@@ -3703,6 +3804,7 @@ function draftPrimitiveToInsert(
|
|
|
3703
3804
|
: undefined;
|
|
3704
3805
|
return {
|
|
3705
3806
|
kind: draft.kind,
|
|
3807
|
+
nodeId: draft.id,
|
|
3706
3808
|
geometry: localGeometry,
|
|
3707
3809
|
points: draft.points?.map(toLocalPoint),
|
|
3708
3810
|
pathData: scaledPenPath ? serializePenPath(scaledPenPath) : undefined,
|
|
@@ -554,6 +554,12 @@ function SliderQuestion({
|
|
|
554
554
|
const current =
|
|
555
555
|
typeof value === "number" ? value : Math.round((min + max) / 2);
|
|
556
556
|
|
|
557
|
+
useEffect(() => {
|
|
558
|
+
if (typeof value !== "number") {
|
|
559
|
+
onChange(Math.round((min + max) / 2));
|
|
560
|
+
}
|
|
561
|
+
}, []);
|
|
562
|
+
|
|
557
563
|
return (
|
|
558
564
|
<div className="rounded-md border border-border bg-muted/25 px-3 py-3">
|
|
559
565
|
<div className="mb-3 flex items-center justify-between text-xs text-muted-foreground">
|
|
@@ -295,7 +295,8 @@ function TweakControl({
|
|
|
295
295
|
/>
|
|
296
296
|
<span className="min-w-[2ch] text-right text-[11px] tabular-nums text-muted-foreground">
|
|
297
297
|
{typeof value === "number" ? value : 50}
|
|
298
|
-
{tweak.
|
|
298
|
+
{tweak.unit ??
|
|
299
|
+
(tweak.cssVar?.toLowerCase().includes("radius") ? "px" : "")}
|
|
299
300
|
</span>
|
|
300
301
|
</div>
|
|
301
302
|
)}
|
|
@@ -29,14 +29,11 @@ export interface AlignmentMatrixLabels {
|
|
|
29
29
|
alignBottomLeft: string;
|
|
30
30
|
alignBottomCenter: string;
|
|
31
31
|
alignBottomRight: string;
|
|
32
|
-
distributeHorizontal: string;
|
|
33
|
-
distributeVertical: string;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export interface AlignmentMatrixProps {
|
|
37
35
|
value: AlignmentMatrixValue;
|
|
38
36
|
onChange: (value: AlignmentMatrixValue) => void;
|
|
39
|
-
onDistribute?: (axis: DistributionAxis) => void;
|
|
40
37
|
labels?: Partial<AlignmentMatrixLabels>;
|
|
41
38
|
disabled?: boolean;
|
|
42
39
|
className?: string;
|
|
@@ -57,8 +54,6 @@ const DEFAULT_LABELS: AlignmentMatrixLabels = {
|
|
|
57
54
|
alignBottomLeft: "Align bottom left", // i18n-ignore fallback component label
|
|
58
55
|
alignBottomCenter: "Align bottom center", // i18n-ignore fallback component label
|
|
59
56
|
alignBottomRight: "Align bottom right", // i18n-ignore fallback component label
|
|
60
|
-
distributeHorizontal: "Distribute horizontal spacing", // i18n-ignore fallback component label
|
|
61
|
-
distributeVertical: "Distribute vertical spacing", // i18n-ignore fallback component label
|
|
62
57
|
};
|
|
63
58
|
|
|
64
59
|
const MATRIX_OPTIONS: Array<{
|
|
@@ -77,7 +72,7 @@ const MATRIX_OPTIONS: Array<{
|
|
|
77
72
|
{ horizontal: "right", vertical: "bottom", labelKey: "alignBottomRight" },
|
|
78
73
|
];
|
|
79
74
|
|
|
80
|
-
/**
|
|
75
|
+
/** design-editor alignment cell: blue bars when active, faint dot when inactive. */
|
|
81
76
|
function AlignmentCell({
|
|
82
77
|
horizontal,
|
|
83
78
|
vertical,
|
|
@@ -130,7 +125,7 @@ function AlignmentCell({
|
|
|
130
125
|
}
|
|
131
126
|
|
|
132
127
|
/**
|
|
133
|
-
* Renders the
|
|
128
|
+
* Renders the design-editor blue bars for the active alignment cell.
|
|
134
129
|
*
|
|
135
130
|
* Bar orientation matches the flow direction:
|
|
136
131
|
* - HORIZONTAL flow → VERTICAL bars (tall, narrow), packed to the active
|
|
@@ -138,7 +133,7 @@ function AlignmentCell({
|
|
|
138
133
|
* - VERTICAL flow → HORIZONTAL bars (wide, short), packed to the active
|
|
139
134
|
* vertical edge (top/middle/bottom), then aligned horizontally.
|
|
140
135
|
*
|
|
141
|
-
* No outer frame rect —
|
|
136
|
+
* No outer frame rect — the design editor's active cell shows only the bars.
|
|
142
137
|
*/
|
|
143
138
|
function AlignmentBars({
|
|
144
139
|
horizontal,
|
|
@@ -302,7 +297,6 @@ function VerticalFlowBars({
|
|
|
302
297
|
export function AlignmentMatrix({
|
|
303
298
|
value,
|
|
304
299
|
onChange,
|
|
305
|
-
onDistribute,
|
|
306
300
|
labels,
|
|
307
301
|
disabled = false,
|
|
308
302
|
className,
|
|
@@ -314,7 +308,7 @@ export function AlignmentMatrix({
|
|
|
314
308
|
<TooltipProvider delayDuration={250}>
|
|
315
309
|
<div className={cn("flex flex-col gap-0", className)}>
|
|
316
310
|
{/*
|
|
317
|
-
* 3×3 dot grid —
|
|
311
|
+
* 3×3 dot grid — design-editor style.
|
|
318
312
|
* NO border, NO background box — bare grid of cells.
|
|
319
313
|
* Each cell is 22px; 3 cols = 66px total.
|
|
320
314
|
*/}
|