@agent-native/core 0.80.0 → 0.80.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 +2 -2
- package/corpus/core/CHANGELOG.md +8 -0
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +14 -1
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +15 -1
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +15 -1
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +15 -1
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +15 -1
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +16 -1
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +14 -1
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +14 -1
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +14 -1
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +14 -1
- package/corpus/core/docs/content/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/template-design.mdx +14 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/application-state/handlers.ts +1 -1
- package/corpus/core/src/brand-kit/index.ts +1 -1
- package/corpus/core/src/cli/skills.ts +18 -0
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +1 -1
- package/corpus/core/src/client/extensions/portable-extension.ts +1 -1
- package/corpus/core/src/code-agents/transcript-normalizer.ts +1 -1
- package/corpus/core/src/extensions/path.ts +1 -4
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +1 -1
- package/corpus/core/src/mcp/build-server.ts +1 -1
- package/corpus/core/src/org/handlers.ts +5 -5
- package/corpus/core/src/org/plugin.ts +2 -2
- package/corpus/core/src/scripts/call-agent.ts +1 -1
- package/corpus/core/src/scripts/db/safety.ts +1 -1
- package/corpus/core/src/server/auth.ts +3 -0
- package/corpus/core/src/server/builder-design-systems.ts +308 -0
- package/corpus/core/src/server/core-routes-plugin.ts +29 -3
- package/corpus/core/src/server/index.ts +8 -0
- package/corpus/core/src/styles/agent-native.css +14 -7
- package/corpus/core/src/usage/store.ts +2 -2
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +298 -15
- package/corpus/templates/analytics/actions/get-sql-dashboard.ts +9 -4
- package/corpus/templates/analytics/actions/mutate-dashboard.ts +18 -2
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +12 -2
- package/corpus/templates/analytics/app/hooks/use-replay-storage-status.ts +66 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +37 -0
- package/corpus/templates/analytics/app/i18n-data.ts +404 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +333 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-layout.ts +121 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +49 -26
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +137 -36
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-agents-can-now-place-new-charts-into-requested-das.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-queries-now-report-failed-source-query-errors-inst.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-charts-can-now-be-dropped-between-full-dashboard-rows-to-cre.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-dashboard-email-reports-include-the-full-dashboard-image-wit.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-main-surface-border-reaches-the-top.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-session-replay-now-records-playable-sessions-in-production-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-set-up-session-replay-storage-from-settings-connect-builder-.md +6 -0
- package/corpus/templates/analytics/scripts/cleanup-empty-session-recordings.ts +102 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +49 -26
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +81 -20
- package/corpus/templates/analytics/server/lib/replay-storage.ts +79 -0
- package/corpus/templates/analytics/server/lib/s3-upload-provider.ts +255 -0
- package/corpus/templates/analytics/server/lib/session-replay.ts +29 -8
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -2
- package/corpus/templates/analytics/server/plugins/onboarding.ts +97 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +24 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +105 -5
- package/corpus/templates/content/actions/set-image-alt-text.ts +1 -1
- package/corpus/templates/content/shared/document-export.ts +1 -1
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +8 -18
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +17 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +32 -5
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +259 -0
- package/corpus/templates/design/actions/update-file.ts +9 -2
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +33 -75
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +72 -9
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +41 -39
- package/corpus/templates/design/app/components/design/EditPanel.tsx +1029 -249
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +450 -101
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +978 -154
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +7 -9
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +133 -66
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +1234 -344
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +144 -94
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +301 -72
- package/corpus/templates/design/app/components/design/inspector/FigmaColorPicker.tsx +876 -286
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +601 -0
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +242 -0
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +30 -7
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +212 -155
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +423 -0
- package/corpus/templates/design/app/components/design/inspector/figma-icons.tsx +487 -107
- package/corpus/templates/design/app/components/design/inspector/index.ts +27 -0
- package/corpus/templates/design/app/global.css +29 -3
- package/corpus/templates/design/app/i18n/zh-TW.ts +13 -0
- package/corpus/templates/design/app/i18n-data.ts +239 -1
- package/corpus/templates/design/app/pages/DesignEditor.tsx +1023 -353
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +57 -221
- package/corpus/templates/design/changelog/2026-06-29-canvas-selection-no-longer-flashes-broken-prototype-html-whe.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-command-menu-selections-are-clearer-in-dark-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-element-selection-now-stays-on-the-intended-layer-after-sele.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-full-view-controls-now-sit-above-frames-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-tools-can-draw-shapes-create-screens-and-kee.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-pen-tool-now-creates-anchor-based-bezier-vectors-with-ha.md +6 -0
- package/corpus/templates/design/server/handlers/import-figma-system.ts +38 -85
- package/corpus/templates/design/server/lib/design-snapshot.ts +9 -1
- package/corpus/templates/design/shared/code-layer.ts +209 -9
- package/corpus/templates/design/shared/html-content.ts +21 -0
- package/corpus/templates/design/shared/pen-path.ts +207 -0
- package/corpus/templates/mail/app/lib/utils.ts +2 -2
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -10
- package/corpus/templates/slides/AGENTS.md +3 -2
- package/corpus/templates/slides/actions/import-file.ts +26 -17
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +259 -0
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +35 -167
- package/corpus/templates/slides/app/components/design-system/fig-import-response.ts +9 -13
- package/corpus/templates/slides/app/context/DeckContext.tsx +1 -1
- package/corpus/templates/slides/app/i18n/ar-SA.ts +9 -37
- package/corpus/templates/slides/app/i18n/de-DE.ts +10 -25
- package/corpus/templates/slides/app/i18n/en-US.ts +9 -26
- package/corpus/templates/slides/app/i18n/es-ES.ts +10 -28
- package/corpus/templates/slides/app/i18n/fr-FR.ts +10 -28
- package/corpus/templates/slides/app/i18n/hi-IN.ts +9 -26
- package/corpus/templates/slides/app/i18n/ja-JP.ts +10 -22
- package/corpus/templates/slides/app/i18n/ko-KR.ts +9 -23
- package/corpus/templates/slides/app/i18n/pt-BR.ts +10 -28
- package/corpus/templates/slides/app/i18n/zh-CN.ts +9 -22
- package/corpus/templates/slides/app/i18n/zh-TW.ts +9 -22
- package/corpus/templates/slides/server/handlers/import-figma-system.ts +44 -12
- package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
- package/corpus/templates/videos/app/components/NewCompositionPopover.tsx +1 -1
- package/dist/application-state/handlers.js +1 -1
- package/dist/application-state/handlers.js.map +1 -1
- package/dist/brand-kit/index.d.ts +1 -1
- package/dist/brand-kit/index.js +1 -1
- package/dist/brand-kit/index.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +18 -0
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/extensions/portable-extension.d.ts +1 -1
- package/dist/client/extensions/portable-extension.d.ts.map +1 -1
- package/dist/client/extensions/portable-extension.js.map +1 -1
- package/dist/code-agents/transcript-normalizer.js +1 -1
- package/dist/code-agents/transcript-normalizer.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/extensions/path.d.ts +1 -1
- package/dist/extensions/path.d.ts.map +1 -1
- package/dist/extensions/path.js.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +1 -1
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/mcp/build-server.d.ts +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/org/handlers.js +5 -5
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/plugin.js +2 -2
- package/dist/org/plugin.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/scripts/call-agent.js +1 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/db/safety.js +1 -1
- package/dist/scripts/db/safety.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +3 -0
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +28 -0
- package/dist/server/builder-design-systems.d.ts.map +1 -0
- package/dist/server/builder-design-systems.js +217 -0
- package/dist/server/builder-design-systems.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +20 -3
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/agent-native.css +14 -7
- package/dist/usage/store.js +2 -2
- package/dist/usage/store.js.map +1 -1
- package/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
- package/docs/content/locales/ar-SA/template-design.mdx +14 -1
- package/docs/content/locales/de-DE/skills-guide.mdx +5 -0
- package/docs/content/locales/de-DE/template-design.mdx +15 -1
- package/docs/content/locales/es-ES/skills-guide.mdx +5 -0
- package/docs/content/locales/es-ES/template-design.mdx +15 -1
- package/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
- package/docs/content/locales/fr-FR/template-design.mdx +15 -1
- package/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
- package/docs/content/locales/hi-IN/template-design.mdx +15 -1
- package/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
- package/docs/content/locales/ja-JP/template-design.mdx +16 -1
- package/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
- package/docs/content/locales/ko-KR/template-design.mdx +14 -1
- package/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
- package/docs/content/locales/pt-BR/template-design.mdx +14 -1
- package/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
- package/docs/content/locales/zh-CN/template-design.mdx +14 -1
- package/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
- package/docs/content/locales/zh-TW/template-design.mdx +14 -1
- package/docs/content/skills-guide.mdx +5 -0
- package/docs/content/template-design.mdx +14 -1
- package/package.json +1 -1
- package/corpus/templates/design/actions/import-figma-file.ts +0 -166
- package/corpus/templates/slides/server/lib/fig-design-system.ts +0 -110
|
@@ -56,11 +56,9 @@ export function TweaksPanelContent({
|
|
|
56
56
|
/>
|
|
57
57
|
))
|
|
58
58
|
) : (
|
|
59
|
-
<div className="flex flex-col items-center gap-2 py-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
</div>
|
|
63
|
-
<p className="text-[11px] leading-snug text-muted-foreground">
|
|
59
|
+
<div className="flex flex-col items-center gap-2 py-6 text-center">
|
|
60
|
+
<IconAdjustmentsHorizontal className="size-5 text-muted-foreground/40" />
|
|
61
|
+
<p className="text-[11px] leading-snug text-muted-foreground/70">
|
|
64
62
|
{t("designEditor.noTweakControls")}
|
|
65
63
|
</p>
|
|
66
64
|
{onRequestTweaks && (
|
|
@@ -155,7 +153,7 @@ export function TweaksPanel({
|
|
|
155
153
|
type="button"
|
|
156
154
|
onMouseDown={(e) => e.stopPropagation()}
|
|
157
155
|
onClick={() => setCollapsed((c) => !c)}
|
|
158
|
-
className="cursor-pointer text-[11px] font-semibold
|
|
156
|
+
className="cursor-pointer text-[11px] font-semibold text-foreground hover:text-foreground/80"
|
|
159
157
|
>
|
|
160
158
|
{t("designEditor.tweaks")}
|
|
161
159
|
</button>
|
|
@@ -231,7 +229,7 @@ function TweakControl({
|
|
|
231
229
|
<Switch
|
|
232
230
|
checked={!!value}
|
|
233
231
|
onCheckedChange={(checked) => onChange(checked)}
|
|
234
|
-
className="scale-
|
|
232
|
+
className="scale-[0.7] origin-right"
|
|
235
233
|
/>
|
|
236
234
|
</div>
|
|
237
235
|
);
|
|
@@ -251,7 +249,7 @@ function TweakControl({
|
|
|
251
249
|
type="button"
|
|
252
250
|
onClick={() => onChange(opt.value)}
|
|
253
251
|
className={cn(
|
|
254
|
-
"size-
|
|
252
|
+
"size-4 cursor-pointer rounded-sm transition-all",
|
|
255
253
|
value === opt.value
|
|
256
254
|
? "ring-2 ring-foreground/80 ring-offset-1 ring-offset-card"
|
|
257
255
|
: "ring-1 ring-border/60 hover:ring-border",
|
|
@@ -286,7 +284,7 @@ function TweakControl({
|
|
|
286
284
|
)}
|
|
287
285
|
|
|
288
286
|
{tweak.type === "slider" && (
|
|
289
|
-
<div className="flex h-6 items-center gap-
|
|
287
|
+
<div className="flex h-6 items-center gap-1.5">
|
|
290
288
|
<Slider
|
|
291
289
|
min={tweak.min ?? 0}
|
|
292
290
|
max={tweak.max ?? 100}
|
|
@@ -11,6 +11,7 @@ import { cn } from "@/lib/utils";
|
|
|
11
11
|
export type AlignmentHorizontal = "left" | "center" | "right";
|
|
12
12
|
export type AlignmentVertical = "top" | "middle" | "bottom";
|
|
13
13
|
export type DistributionAxis = "horizontal" | "vertical";
|
|
14
|
+
export type FlowDirection = "horizontal" | "vertical";
|
|
14
15
|
|
|
15
16
|
export interface AlignmentMatrixValue {
|
|
16
17
|
horizontal: AlignmentHorizontal;
|
|
@@ -39,6 +40,8 @@ export interface AlignmentMatrixProps {
|
|
|
39
40
|
labels?: Partial<AlignmentMatrixLabels>;
|
|
40
41
|
disabled?: boolean;
|
|
41
42
|
className?: string;
|
|
43
|
+
/** Auto-layout flow direction — controls bar orientation in active cell */
|
|
44
|
+
direction?: FlowDirection;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
type MatrixIcon = ComponentType<{ className?: string }>;
|
|
@@ -81,6 +84,7 @@ function AlignmentCell({
|
|
|
81
84
|
active,
|
|
82
85
|
label,
|
|
83
86
|
disabled,
|
|
87
|
+
direction,
|
|
84
88
|
onClick,
|
|
85
89
|
}: {
|
|
86
90
|
horizontal: AlignmentHorizontal;
|
|
@@ -88,10 +92,9 @@ function AlignmentCell({
|
|
|
88
92
|
active: boolean;
|
|
89
93
|
label: string;
|
|
90
94
|
disabled: boolean;
|
|
95
|
+
direction: FlowDirection;
|
|
91
96
|
onClick: () => void;
|
|
92
97
|
}) {
|
|
93
|
-
// The active cell shows blue bars representing the alignment direction.
|
|
94
|
-
// Inactive cells show a small faint dot.
|
|
95
98
|
return (
|
|
96
99
|
<Tooltip>
|
|
97
100
|
<TooltipTrigger asChild>
|
|
@@ -102,16 +105,20 @@ function AlignmentCell({
|
|
|
102
105
|
disabled={disabled}
|
|
103
106
|
onClick={onClick}
|
|
104
107
|
className={cn(
|
|
105
|
-
"flex size-[
|
|
108
|
+
"flex size-[22px] items-center justify-center rounded-sm transition-colors",
|
|
106
109
|
"hover:bg-[var(--design-editor-control-bg)]",
|
|
107
110
|
disabled && "pointer-events-none opacity-40",
|
|
108
111
|
)}
|
|
109
112
|
>
|
|
110
113
|
{active ? (
|
|
111
|
-
<AlignmentBars
|
|
114
|
+
<AlignmentBars
|
|
115
|
+
horizontal={horizontal}
|
|
116
|
+
vertical={vertical}
|
|
117
|
+
direction={direction}
|
|
118
|
+
/>
|
|
112
119
|
) : (
|
|
113
120
|
<span
|
|
114
|
-
className="block size-
|
|
121
|
+
className="block size-[3px] rounded-full bg-current opacity-20"
|
|
115
122
|
aria-hidden="true"
|
|
116
123
|
/>
|
|
117
124
|
)}
|
|
@@ -124,95 +131,150 @@ function AlignmentCell({
|
|
|
124
131
|
|
|
125
132
|
/**
|
|
126
133
|
* Renders the Figma-style blue bars for the active alignment cell.
|
|
127
|
-
*
|
|
128
|
-
*
|
|
134
|
+
*
|
|
135
|
+
* Bar orientation matches the flow direction:
|
|
136
|
+
* - HORIZONTAL flow → VERTICAL bars (tall, narrow), packed to the active
|
|
137
|
+
* horizontal edge (left/center/right), then aligned vertically.
|
|
138
|
+
* - VERTICAL flow → HORIZONTAL bars (wide, short), packed to the active
|
|
139
|
+
* vertical edge (top/middle/bottom), then aligned horizontally.
|
|
140
|
+
*
|
|
141
|
+
* No outer frame rect — Figma's active cell shows only the bars.
|
|
129
142
|
*/
|
|
130
143
|
function AlignmentBars({
|
|
131
144
|
horizontal,
|
|
132
145
|
vertical,
|
|
146
|
+
direction,
|
|
133
147
|
}: {
|
|
134
148
|
horizontal: AlignmentHorizontal;
|
|
135
149
|
vertical: AlignmentVertical;
|
|
150
|
+
direction: FlowDirection;
|
|
136
151
|
}) {
|
|
137
|
-
// We draw 2-3 small bars inside a tiny box to indicate alignment direction.
|
|
138
|
-
// The bars are positioned based on which corner/edge is active.
|
|
139
152
|
const accent = "var(--design-editor-accent-color, #18a0fb)";
|
|
140
|
-
|
|
141
|
-
// Determine the transform for the inner bars container
|
|
142
|
-
// based on alignment position within the 16×16 drawing area
|
|
143
|
-
const justifyClass =
|
|
144
|
-
horizontal === "left"
|
|
145
|
-
? "justify-start"
|
|
146
|
-
: horizontal === "right"
|
|
147
|
-
? "justify-end"
|
|
148
|
-
: "justify-center";
|
|
149
|
-
|
|
150
|
-
const alignClass =
|
|
151
|
-
vertical === "top"
|
|
152
|
-
? "items-start"
|
|
153
|
-
: vertical === "bottom"
|
|
154
|
-
? "items-end"
|
|
155
|
-
: "items-center";
|
|
153
|
+
const size = 14; // SVG canvas size
|
|
156
154
|
|
|
157
155
|
return (
|
|
158
156
|
<svg
|
|
159
|
-
viewBox=
|
|
160
|
-
width={
|
|
161
|
-
height={
|
|
157
|
+
viewBox={`0 0 ${size} ${size}`}
|
|
158
|
+
width={size}
|
|
159
|
+
height={size}
|
|
162
160
|
fill="none"
|
|
163
161
|
aria-hidden="true"
|
|
164
162
|
>
|
|
165
|
-
{
|
|
163
|
+
{direction === "horizontal" ? (
|
|
164
|
+
<HorizontalFlowBars
|
|
165
|
+
horizontal={horizontal}
|
|
166
|
+
vertical={vertical}
|
|
167
|
+
accent={accent}
|
|
168
|
+
size={size}
|
|
169
|
+
/>
|
|
170
|
+
) : (
|
|
171
|
+
<VerticalFlowBars
|
|
172
|
+
horizontal={horizontal}
|
|
173
|
+
vertical={vertical}
|
|
174
|
+
accent={accent}
|
|
175
|
+
size={size}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
</svg>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* HORIZONTAL flow: items are laid out left→right.
|
|
184
|
+
* Bars are VERTICAL (tall, narrow) representing child items.
|
|
185
|
+
* Packed toward the active horizontal edge; aligned vertically.
|
|
186
|
+
*/
|
|
187
|
+
function HorizontalFlowBars({
|
|
188
|
+
horizontal,
|
|
189
|
+
vertical,
|
|
190
|
+
accent,
|
|
191
|
+
size,
|
|
192
|
+
}: {
|
|
193
|
+
horizontal: AlignmentHorizontal;
|
|
194
|
+
vertical: AlignmentVertical;
|
|
195
|
+
accent: string;
|
|
196
|
+
size: number;
|
|
197
|
+
}) {
|
|
198
|
+
// Two vertical bars of slightly different heights for visual interest
|
|
199
|
+
const barW = 2; // bar width
|
|
200
|
+
const barH = [7, 5]; // bar heights
|
|
201
|
+
const gap = 2; // gap between bars
|
|
202
|
+
const margin = 1.5; // distance from edge
|
|
203
|
+
|
|
204
|
+
// X positions: bars packed toward the horizontal alignment edge
|
|
205
|
+
const totalW = barW * 2 + gap;
|
|
206
|
+
const xStart =
|
|
207
|
+
horizontal === "left"
|
|
208
|
+
? margin
|
|
209
|
+
: horizontal === "right"
|
|
210
|
+
? size - margin - totalW
|
|
211
|
+
: (size - totalW) / 2;
|
|
212
|
+
|
|
213
|
+
// Y positions: each bar aligned to the vertical edge
|
|
214
|
+
const getBarY = (h: number) => {
|
|
215
|
+
if (vertical === "top") return margin;
|
|
216
|
+
if (vertical === "bottom") return size - margin - h;
|
|
217
|
+
return (size - h) / 2;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<>
|
|
166
222
|
<rect
|
|
167
|
-
x=
|
|
168
|
-
y=
|
|
169
|
-
width=
|
|
170
|
-
height=
|
|
171
|
-
rx=
|
|
172
|
-
|
|
173
|
-
strokeWidth="1"
|
|
174
|
-
opacity="0.35"
|
|
223
|
+
x={xStart}
|
|
224
|
+
y={getBarY(barH[0]!)}
|
|
225
|
+
width={barW}
|
|
226
|
+
height={barH[0]}
|
|
227
|
+
rx={0.5}
|
|
228
|
+
fill={accent}
|
|
175
229
|
/>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
230
|
+
<rect
|
|
231
|
+
x={xStart + barW + gap}
|
|
232
|
+
y={getBarY(barH[1]!)}
|
|
233
|
+
width={barW}
|
|
234
|
+
height={barH[1]}
|
|
235
|
+
rx={0.5}
|
|
236
|
+
fill={accent}
|
|
181
237
|
/>
|
|
182
|
-
|
|
238
|
+
</>
|
|
183
239
|
);
|
|
184
240
|
}
|
|
185
241
|
|
|
186
|
-
|
|
242
|
+
/**
|
|
243
|
+
* VERTICAL flow: items are laid out top→bottom.
|
|
244
|
+
* Bars are HORIZONTAL (wide, short) representing child items.
|
|
245
|
+
* Packed toward the active vertical edge; aligned horizontally.
|
|
246
|
+
*/
|
|
247
|
+
function VerticalFlowBars({
|
|
187
248
|
horizontal,
|
|
188
249
|
vertical,
|
|
189
250
|
accent,
|
|
251
|
+
size,
|
|
190
252
|
}: {
|
|
191
253
|
horizontal: AlignmentHorizontal;
|
|
192
254
|
vertical: AlignmentVertical;
|
|
193
255
|
accent: string;
|
|
256
|
+
size: number;
|
|
194
257
|
}) {
|
|
195
|
-
//
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
const totalH = barH * 2 + gap;
|
|
201
|
-
const totalW = Math.max(...barW);
|
|
258
|
+
// Two horizontal bars of slightly different widths for visual interest
|
|
259
|
+
const barH = 2; // bar height
|
|
260
|
+
const barW = [7, 5]; // bar widths
|
|
261
|
+
const gap = 2; // gap between bars
|
|
262
|
+
const margin = 1.5; // distance from edge
|
|
202
263
|
|
|
203
|
-
// Y
|
|
264
|
+
// Y positions: bars packed toward the vertical alignment edge
|
|
265
|
+
const totalH = barH * 2 + gap;
|
|
204
266
|
const yStart =
|
|
205
267
|
vertical === "top"
|
|
206
|
-
?
|
|
268
|
+
? margin
|
|
207
269
|
: vertical === "bottom"
|
|
208
|
-
?
|
|
209
|
-
: (
|
|
270
|
+
? size - margin - totalH
|
|
271
|
+
: (size - totalH) / 2;
|
|
210
272
|
|
|
211
|
-
// X positions
|
|
273
|
+
// X positions: each bar aligned to the horizontal edge
|
|
212
274
|
const getBarX = (w: number) => {
|
|
213
|
-
if (horizontal === "left") return
|
|
214
|
-
if (horizontal === "right") return
|
|
215
|
-
return (
|
|
275
|
+
if (horizontal === "left") return margin;
|
|
276
|
+
if (horizontal === "right") return size - margin - w;
|
|
277
|
+
return (size - w) / 2;
|
|
216
278
|
};
|
|
217
279
|
|
|
218
280
|
return (
|
|
@@ -244,19 +306,23 @@ export function AlignmentMatrix({
|
|
|
244
306
|
labels,
|
|
245
307
|
disabled = false,
|
|
246
308
|
className,
|
|
309
|
+
direction = "horizontal",
|
|
247
310
|
}: AlignmentMatrixProps) {
|
|
248
311
|
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
249
312
|
|
|
250
313
|
return (
|
|
251
314
|
<TooltipProvider delayDuration={250}>
|
|
252
|
-
<div className={cn("
|
|
253
|
-
{/*
|
|
315
|
+
<div className={cn("flex flex-col gap-0", className)}>
|
|
316
|
+
{/*
|
|
317
|
+
* 3×3 dot grid — Figma style.
|
|
318
|
+
* NO border, NO background box — bare grid of cells.
|
|
319
|
+
* Each cell is 22px; 3 cols = 66px total.
|
|
320
|
+
*/}
|
|
254
321
|
<div
|
|
255
|
-
className=
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
style={{ width: 84 }}
|
|
322
|
+
className="grid grid-cols-3"
|
|
323
|
+
style={{ width: 66 }}
|
|
324
|
+
role="group"
|
|
325
|
+
aria-label={copy.title}
|
|
260
326
|
>
|
|
261
327
|
{MATRIX_OPTIONS.map((option) => {
|
|
262
328
|
const active =
|
|
@@ -270,6 +336,7 @@ export function AlignmentMatrix({
|
|
|
270
336
|
active={active}
|
|
271
337
|
label={copy[option.labelKey]}
|
|
272
338
|
disabled={disabled}
|
|
339
|
+
direction={direction}
|
|
273
340
|
onClick={() =>
|
|
274
341
|
onChange({
|
|
275
342
|
horizontal: option.horizontal,
|