@agent-native/core 0.80.0 → 0.80.2

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.
Files changed (228) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +28 -0
  3. package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
  4. package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +14 -1
  5. package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +5 -0
  6. package/corpus/core/docs/content/locales/de-DE/template-design.mdx +15 -1
  7. package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +5 -0
  8. package/corpus/core/docs/content/locales/es-ES/template-design.mdx +15 -1
  9. package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
  10. package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +15 -1
  11. package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
  12. package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +15 -1
  13. package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
  14. package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +16 -1
  15. package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
  16. package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +14 -1
  17. package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
  18. package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +14 -1
  19. package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
  20. package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +14 -1
  21. package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
  22. package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +14 -1
  23. package/corpus/core/docs/content/skills-guide.mdx +5 -0
  24. package/corpus/core/docs/content/template-design.mdx +14 -1
  25. package/corpus/core/package.json +1 -1
  26. package/corpus/core/src/application-state/handlers.ts +1 -1
  27. package/corpus/core/src/brand-kit/index.ts +1 -1
  28. package/corpus/core/src/cli/skills.ts +18 -0
  29. package/corpus/core/src/client/AgentPanel.tsx +1 -1
  30. package/corpus/core/src/client/MultiTabAssistantChat.tsx +1 -1
  31. package/corpus/core/src/client/extensions/portable-extension.ts +1 -1
  32. package/corpus/core/src/code-agents/transcript-normalizer.ts +1 -1
  33. package/corpus/core/src/extensions/path.ts +1 -4
  34. package/corpus/core/src/integrations/a2a-continuation-processor.ts +1 -1
  35. package/corpus/core/src/mcp/build-server.ts +2 -2
  36. package/corpus/core/src/mcp/embed-app.ts +35 -1
  37. package/corpus/core/src/org/handlers.ts +5 -5
  38. package/corpus/core/src/org/plugin.ts +2 -2
  39. package/corpus/core/src/scripts/call-agent.ts +1 -1
  40. package/corpus/core/src/scripts/db/safety.ts +1 -1
  41. package/corpus/core/src/server/auth.ts +3 -0
  42. package/corpus/core/src/server/builder-design-systems.ts +308 -0
  43. package/corpus/core/src/server/core-routes-plugin.ts +29 -3
  44. package/corpus/core/src/server/index.ts +8 -0
  45. package/corpus/core/src/styles/agent-native.css +14 -7
  46. package/corpus/core/src/usage/store.ts +2 -2
  47. package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +298 -15
  48. package/corpus/templates/analytics/actions/get-sql-dashboard.ts +9 -4
  49. package/corpus/templates/analytics/actions/mutate-dashboard.ts +18 -2
  50. package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +12 -2
  51. package/corpus/templates/analytics/app/hooks/use-replay-storage-status.ts +66 -0
  52. package/corpus/templates/analytics/app/i18n/zh-TW.ts +37 -0
  53. package/corpus/templates/analytics/app/i18n-data.ts +404 -0
  54. package/corpus/templates/analytics/app/pages/Settings.tsx +333 -0
  55. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +2 -1
  56. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-layout.ts +121 -3
  57. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +49 -26
  58. package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +137 -36
  59. package/corpus/templates/analytics/changelog/2026-06-29-analytics-agents-can-now-place-new-charts-into-requested-das.md +6 -0
  60. package/corpus/templates/analytics/changelog/2026-06-29-analytics-queries-now-report-failed-source-query-errors-inst.md +6 -0
  61. package/corpus/templates/analytics/changelog/2026-06-29-charts-can-now-be-dropped-between-full-dashboard-rows-to-cre.md +6 -0
  62. package/corpus/templates/analytics/changelog/2026-06-29-dashboard-email-reports-include-the-full-dashboard-image-wit.md +6 -0
  63. package/corpus/templates/analytics/changelog/2026-06-29-main-surface-border-reaches-the-top.md +6 -0
  64. package/corpus/templates/analytics/changelog/2026-06-29-session-replay-now-records-playable-sessions-in-production-a.md +6 -0
  65. package/corpus/templates/analytics/changelog/2026-06-29-set-up-session-replay-storage-from-settings-connect-builder-.md +6 -0
  66. package/corpus/templates/analytics/scripts/cleanup-empty-session-recordings.ts +102 -0
  67. package/corpus/templates/analytics/server/lib/dashboard-report.ts +49 -26
  68. package/corpus/templates/analytics/server/lib/real-data-actions.ts +81 -20
  69. package/corpus/templates/analytics/server/lib/replay-storage.ts +79 -0
  70. package/corpus/templates/analytics/server/lib/s3-upload-provider.ts +255 -0
  71. package/corpus/templates/analytics/server/lib/session-replay.ts +29 -8
  72. package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -2
  73. package/corpus/templates/analytics/server/plugins/onboarding.ts +97 -0
  74. package/corpus/templates/clips/desktop/src/lib/recorder.ts +24 -0
  75. package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +105 -5
  76. package/corpus/templates/content/actions/set-image-alt-text.ts +1 -1
  77. package/corpus/templates/content/shared/document-export.ts +1 -1
  78. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +8 -18
  79. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +17 -0
  80. package/corpus/templates/design/actions/add-localhost-screens.ts +32 -5
  81. package/corpus/templates/design/actions/index-design-system-with-builder.ts +259 -0
  82. package/corpus/templates/design/actions/update-file.ts +9 -2
  83. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +33 -75
  84. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +72 -9
  85. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +41 -39
  86. package/corpus/templates/design/app/components/design/EditPanel.tsx +1029 -249
  87. package/corpus/templates/design/app/components/design/LayersPanel.tsx +450 -101
  88. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +978 -154
  89. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +7 -9
  90. package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +133 -66
  91. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +1234 -344
  92. package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +144 -94
  93. package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +301 -72
  94. package/corpus/templates/design/app/components/design/inspector/FigmaColorPicker.tsx +876 -286
  95. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +601 -0
  96. package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +242 -0
  97. package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +30 -7
  98. package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +212 -155
  99. package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +423 -0
  100. package/corpus/templates/design/app/components/design/inspector/figma-icons.tsx +487 -107
  101. package/corpus/templates/design/app/components/design/inspector/index.ts +27 -0
  102. package/corpus/templates/design/app/global.css +29 -3
  103. package/corpus/templates/design/app/i18n/zh-TW.ts +13 -0
  104. package/corpus/templates/design/app/i18n-data.ts +239 -1
  105. package/corpus/templates/design/app/pages/DesignEditor.tsx +1023 -353
  106. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +57 -221
  107. package/corpus/templates/design/changelog/2026-06-29-canvas-selection-no-longer-flashes-broken-prototype-html-whe.md +6 -0
  108. package/corpus/templates/design/changelog/2026-06-29-command-menu-selections-are-clearer-in-dark-mode.md +6 -0
  109. package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +6 -0
  110. package/corpus/templates/design/changelog/2026-06-29-element-selection-now-stays-on-the-intended-layer-after-sele.md +6 -0
  111. package/corpus/templates/design/changelog/2026-06-29-screen-overview-full-view-controls-now-sit-above-frames-inst.md +6 -0
  112. package/corpus/templates/design/changelog/2026-06-29-screen-overview-tools-can-draw-shapes-create-screens-and-kee.md +6 -0
  113. package/corpus/templates/design/changelog/2026-06-29-the-pen-tool-now-creates-anchor-based-bezier-vectors-with-ha.md +6 -0
  114. package/corpus/templates/design/server/handlers/import-figma-system.ts +38 -85
  115. package/corpus/templates/design/server/lib/design-snapshot.ts +9 -1
  116. package/corpus/templates/design/shared/code-layer.ts +209 -9
  117. package/corpus/templates/design/shared/html-content.ts +21 -0
  118. package/corpus/templates/design/shared/pen-path.ts +207 -0
  119. package/corpus/templates/mail/app/lib/utils.ts +2 -2
  120. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -10
  121. package/corpus/templates/slides/AGENTS.md +3 -2
  122. package/corpus/templates/slides/actions/import-file.ts +26 -17
  123. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +259 -0
  124. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +35 -167
  125. package/corpus/templates/slides/app/components/design-system/fig-import-response.ts +9 -13
  126. package/corpus/templates/slides/app/context/DeckContext.tsx +1 -1
  127. package/corpus/templates/slides/app/i18n/ar-SA.ts +9 -37
  128. package/corpus/templates/slides/app/i18n/de-DE.ts +10 -25
  129. package/corpus/templates/slides/app/i18n/en-US.ts +9 -26
  130. package/corpus/templates/slides/app/i18n/es-ES.ts +10 -28
  131. package/corpus/templates/slides/app/i18n/fr-FR.ts +10 -28
  132. package/corpus/templates/slides/app/i18n/hi-IN.ts +9 -26
  133. package/corpus/templates/slides/app/i18n/ja-JP.ts +10 -22
  134. package/corpus/templates/slides/app/i18n/ko-KR.ts +9 -23
  135. package/corpus/templates/slides/app/i18n/pt-BR.ts +10 -28
  136. package/corpus/templates/slides/app/i18n/zh-CN.ts +9 -22
  137. package/corpus/templates/slides/app/i18n/zh-TW.ts +9 -22
  138. package/corpus/templates/slides/server/handlers/import-figma-system.ts +44 -12
  139. package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
  140. package/corpus/templates/videos/app/components/NewCompositionPopover.tsx +1 -1
  141. package/dist/application-state/handlers.js +1 -1
  142. package/dist/application-state/handlers.js.map +1 -1
  143. package/dist/brand-kit/index.d.ts +1 -1
  144. package/dist/brand-kit/index.js +1 -1
  145. package/dist/brand-kit/index.js.map +1 -1
  146. package/dist/cli/skills.d.ts.map +1 -1
  147. package/dist/cli/skills.js +18 -0
  148. package/dist/cli/skills.js.map +1 -1
  149. package/dist/client/AgentPanel.js +1 -1
  150. package/dist/client/AgentPanel.js.map +1 -1
  151. package/dist/client/MultiTabAssistantChat.js +1 -1
  152. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  153. package/dist/client/extensions/portable-extension.d.ts +1 -1
  154. package/dist/client/extensions/portable-extension.d.ts.map +1 -1
  155. package/dist/client/extensions/portable-extension.js.map +1 -1
  156. package/dist/code-agents/transcript-normalizer.js +1 -1
  157. package/dist/code-agents/transcript-normalizer.js.map +1 -1
  158. package/dist/collab/awareness.d.ts +2 -2
  159. package/dist/collab/awareness.d.ts.map +1 -1
  160. package/dist/collab/routes.d.ts +1 -1
  161. package/dist/extensions/path.d.ts +1 -1
  162. package/dist/extensions/path.d.ts.map +1 -1
  163. package/dist/extensions/path.js.map +1 -1
  164. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  165. package/dist/integrations/a2a-continuation-processor.js +1 -1
  166. package/dist/integrations/a2a-continuation-processor.js.map +1 -1
  167. package/dist/mcp/build-server.d.ts +1 -1
  168. package/dist/mcp/build-server.d.ts.map +1 -1
  169. package/dist/mcp/build-server.js +1 -1
  170. package/dist/mcp/build-server.js.map +1 -1
  171. package/dist/mcp/embed-app.d.ts.map +1 -1
  172. package/dist/mcp/embed-app.js +35 -1
  173. package/dist/mcp/embed-app.js.map +1 -1
  174. package/dist/notifications/routes.d.ts +3 -3
  175. package/dist/observability/routes.d.ts +8 -8
  176. package/dist/org/handlers.js +5 -5
  177. package/dist/org/handlers.js.map +1 -1
  178. package/dist/org/plugin.js +2 -2
  179. package/dist/org/plugin.js.map +1 -1
  180. package/dist/resources/handlers.d.ts +1 -1
  181. package/dist/scripts/call-agent.js +1 -1
  182. package/dist/scripts/call-agent.js.map +1 -1
  183. package/dist/scripts/db/safety.js +1 -1
  184. package/dist/scripts/db/safety.js.map +1 -1
  185. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  186. package/dist/server/auth.d.ts.map +1 -1
  187. package/dist/server/auth.js +3 -0
  188. package/dist/server/auth.js.map +1 -1
  189. package/dist/server/builder-design-systems.d.ts +28 -0
  190. package/dist/server/builder-design-systems.d.ts.map +1 -0
  191. package/dist/server/builder-design-systems.js +217 -0
  192. package/dist/server/builder-design-systems.js.map +1 -0
  193. package/dist/server/core-routes-plugin.d.ts +1 -0
  194. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  195. package/dist/server/core-routes-plugin.js +20 -3
  196. package/dist/server/core-routes-plugin.js.map +1 -1
  197. package/dist/server/index.d.ts +1 -0
  198. package/dist/server/index.d.ts.map +1 -1
  199. package/dist/server/index.js +1 -0
  200. package/dist/server/index.js.map +1 -1
  201. package/dist/styles/agent-native.css +14 -7
  202. package/dist/usage/store.js +2 -2
  203. package/dist/usage/store.js.map +1 -1
  204. package/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
  205. package/docs/content/locales/ar-SA/template-design.mdx +14 -1
  206. package/docs/content/locales/de-DE/skills-guide.mdx +5 -0
  207. package/docs/content/locales/de-DE/template-design.mdx +15 -1
  208. package/docs/content/locales/es-ES/skills-guide.mdx +5 -0
  209. package/docs/content/locales/es-ES/template-design.mdx +15 -1
  210. package/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
  211. package/docs/content/locales/fr-FR/template-design.mdx +15 -1
  212. package/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
  213. package/docs/content/locales/hi-IN/template-design.mdx +15 -1
  214. package/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
  215. package/docs/content/locales/ja-JP/template-design.mdx +16 -1
  216. package/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
  217. package/docs/content/locales/ko-KR/template-design.mdx +14 -1
  218. package/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
  219. package/docs/content/locales/pt-BR/template-design.mdx +14 -1
  220. package/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
  221. package/docs/content/locales/zh-CN/template-design.mdx +14 -1
  222. package/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
  223. package/docs/content/locales/zh-TW/template-design.mdx +14 -1
  224. package/docs/content/skills-guide.mdx +5 -0
  225. package/docs/content/template-design.mdx +14 -1
  226. package/package.json +1 -1
  227. package/corpus/templates/design/actions/import-figma-file.ts +0 -166
  228. 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-4 text-center">
60
- <div className="flex size-8 items-center justify-center rounded-lg bg-muted/60">
61
- <IconAdjustmentsHorizontal className="size-4 text-muted-foreground/70" />
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 uppercase tracking-wider text-muted-foreground hover:text-foreground"
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-75 origin-right"
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-5 cursor-pointer rounded-full transition-all",
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-2">
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-[26px] items-center justify-center rounded-sm transition-colors",
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 horizontal={horizontal} vertical={vertical} />
114
+ <AlignmentBars
115
+ horizontal={horizontal}
116
+ vertical={vertical}
117
+ direction={direction}
118
+ />
112
119
  ) : (
113
120
  <span
114
- className="block size-1 rounded-full bg-current opacity-25"
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
- * The bars are drawn as short lines showing the items packed
128
- * against the given horizontal + vertical edge.
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="0 0 14 14"
160
- width={14}
161
- height={14}
157
+ viewBox={`0 0 ${size} ${size}`}
158
+ width={size}
159
+ height={size}
162
160
  fill="none"
163
161
  aria-hidden="true"
164
162
  >
165
- {/* Outer frame (faint) */}
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="0.5"
168
- y="0.5"
169
- width="13"
170
- height="13"
171
- rx="1"
172
- stroke={accent}
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
- {/* Inner content bars — positioned by alignment */}
177
- <AlignmentBarsContent
178
- horizontal={horizontal}
179
- vertical={vertical}
180
- accent={accent}
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
- </svg>
238
+ </>
183
239
  );
184
240
  }
185
241
 
186
- function AlignmentBarsContent({
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
- // Draw 2 bars (representing child items) packed toward the alignment edge.
196
- // The bars are thin rectangles with rounded caps.
197
- const barH = 2; // bar height in px
198
- const barW = [4, 3]; // varying widths for visual interest
199
- const gap = 1.5; // gap between bars
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 position based on vertical alignment
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
- ? 2.5
268
+ ? margin
207
269
  : vertical === "bottom"
208
- ? 14 - 2.5 - totalH
209
- : (14 - totalH) / 2;
270
+ ? size - margin - totalH
271
+ : (size - totalH) / 2;
210
272
 
211
- // X positions for the bars based on horizontal alignment
273
+ // X positions: each bar aligned to the horizontal edge
212
274
  const getBarX = (w: number) => {
213
- if (horizontal === "left") return 2.5;
214
- if (horizontal === "right") return 14 - 2.5 - w;
215
- return (14 - w) / 2;
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("space-y-0", className)}>
253
- {/* 3×3 dot grid — Figma style */}
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={cn(
256
- "grid grid-cols-3 rounded-md border border-[var(--design-editor-control-border,hsl(var(--border)))]",
257
- "bg-[var(--design-editor-control-bg)] p-0.5",
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,