@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.
Files changed (292) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +21 -2
  3. package/corpus/core/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
  4. package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +1 -1
  5. package/corpus/core/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
  6. package/corpus/core/docs/content/locales/de-DE/template-design.mdx +1 -1
  7. package/corpus/core/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
  8. package/corpus/core/docs/content/locales/es-ES/template-design.mdx +1 -1
  9. package/corpus/core/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
  10. package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +1 -1
  11. package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +1 -1
  12. package/corpus/core/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
  13. package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +1 -1
  14. package/corpus/core/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
  15. package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +1 -1
  16. package/corpus/core/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
  17. package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +1 -1
  18. package/corpus/core/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
  19. package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +1 -1
  20. package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
  21. package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +1 -1
  22. package/corpus/core/docs/content/real-time-collaboration.mdx +2 -2
  23. package/corpus/core/docs/content/template-design.mdx +1 -1
  24. package/corpus/core/package.json +3 -7
  25. package/corpus/core/src/action.ts +21 -0
  26. package/corpus/core/src/agent/durable-background.ts +32 -11
  27. package/corpus/core/src/agent/production-agent.ts +11 -1
  28. package/corpus/core/src/agent/run-loop-with-resume.ts +3 -1
  29. package/corpus/core/src/brand-kit/fig/index.ts +17 -37
  30. package/corpus/core/src/cli/index.ts +1 -1
  31. package/corpus/core/src/cli/mcp-config-writers.ts +187 -51
  32. package/corpus/core/src/cli/skills.ts +18 -3
  33. package/corpus/core/src/client/AssistantChat.tsx +11 -1
  34. package/corpus/core/src/client/agent-chat.ts +12 -1
  35. package/corpus/core/src/client/composer/PromptComposer.tsx +100 -41
  36. package/corpus/core/src/client/org/OrgSwitcher.tsx +1 -1
  37. package/corpus/core/src/client/sharing/ShareButton.tsx +3 -27
  38. package/corpus/core/src/collab/presence.ts +1 -1
  39. package/corpus/core/src/mcp/connect-route.ts +34 -5
  40. package/corpus/core/src/server/action-discovery.ts +4 -0
  41. package/corpus/core/src/server/agent-chat-plugin.ts +20 -0
  42. package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +2 -0
  43. package/corpus/templates/analytics/actions/update-dashboard.ts +8 -0
  44. package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
  45. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +117 -33
  46. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +4 -0
  47. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +7 -0
  48. package/corpus/templates/analytics/changelog/2026-06-27-dashboards-can-now-nest-under-a-parent-in-the-sidebar-via-a-.md +6 -0
  49. package/corpus/templates/analytics/changelog/2026-06-29-analytics-pages-now-sit-closer-under-the-header-with-tighter.md +6 -0
  50. package/corpus/templates/assets/actions/generate-image-batch.ts +3 -0
  51. package/corpus/templates/assets/actions/generate-image.ts +3 -0
  52. package/corpus/templates/assets/changelog/2026-06-29-longer-agent-generation-window.md +6 -0
  53. package/corpus/templates/assets/netlify.toml +3 -3
  54. package/corpus/templates/assets/server/plugins/agent-chat.ts +4 -1
  55. package/corpus/templates/clips/app/components/capture-install-options.tsx +7 -8
  56. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +1 -1
  57. package/corpus/templates/content/AGENTS.md +12 -0
  58. package/corpus/templates/content/app/blocks/BuilderDocsBlocks.tsx +10 -0
  59. package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +1 -0
  60. package/corpus/templates/content/app/components/editor/ContentReferencePreview.tsx +185 -0
  61. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +3 -0
  62. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +19 -0
  63. package/corpus/templates/content/app/components/editor/extensions/ContentReferenceNode.tsx +82 -0
  64. package/corpus/templates/content/app/global.css +9 -0
  65. package/corpus/templates/content/app/i18n/zh-TW.ts +12 -0
  66. package/corpus/templates/content/app/i18n-data.ts +140 -0
  67. package/corpus/templates/content/changelog/2026-06-29-reusable-mdx-references-now-preview-linked-local-documents-i.md +6 -0
  68. package/corpus/templates/content/shared/builder-docs-blocks.ts +8 -0
  69. package/corpus/templates/content/shared/builder-mdx.ts +141 -4
  70. package/corpus/templates/content/shared/nfm.ts +62 -0
  71. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +10 -11
  72. package/corpus/templates/design/AGENTS.md +5 -0
  73. package/corpus/templates/design/_gitignore +7 -0
  74. package/corpus/templates/design/actions/apply-visual-edit.ts +22 -12
  75. package/corpus/templates/design/actions/create-design-system.ts +15 -4
  76. package/corpus/templates/design/actions/create-file.ts +20 -1
  77. package/corpus/templates/design/actions/delete-design-system.ts +2 -2
  78. package/corpus/templates/design/actions/duplicate-design.ts +35 -9
  79. package/corpus/templates/design/actions/generate-design.ts +146 -69
  80. package/corpus/templates/design/actions/generate-screens.ts +51 -19
  81. package/corpus/templates/design/actions/get-design-snapshot.ts +5 -1
  82. package/corpus/templates/design/actions/get-design.ts +2 -0
  83. package/corpus/templates/design/actions/import-design-project.ts +28 -9
  84. package/corpus/templates/design/actions/import-document.ts +22 -8
  85. package/corpus/templates/design/actions/index-design-system-with-builder.ts +6 -153
  86. package/corpus/templates/design/actions/navigate.ts +105 -54
  87. package/corpus/templates/design/actions/set-default-design-system.ts +17 -3
  88. package/corpus/templates/design/actions/show-design-questions.ts +2 -0
  89. package/corpus/templates/design/actions/update-design.ts +2 -1
  90. package/corpus/templates/design/actions/view-screen.ts +12 -6
  91. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +4 -4
  92. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +159 -41
  93. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +8 -4
  94. package/corpus/templates/design/app/components/design/DrawOverlay.tsx +37 -42
  95. package/corpus/templates/design/app/components/design/EditPanel.tsx +336 -183
  96. package/corpus/templates/design/app/components/design/LayersPanel.tsx +153 -34
  97. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +135 -33
  98. package/corpus/templates/design/app/components/design/QuestionFlow.tsx +6 -0
  99. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
  100. package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +4 -10
  101. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +84 -43
  102. package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +4 -4
  103. package/corpus/templates/design/app/components/design/inspector/{FigmaColorPicker.tsx → DesignColorPicker.tsx} +89 -62
  104. package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +14 -26
  105. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +40 -12
  106. package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +13 -4
  107. package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +13 -13
  108. package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +13 -9
  109. package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +13 -4
  110. package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +6 -6
  111. package/corpus/templates/design/app/components/design/inspector/{figma-icons.tsx → design-icons.tsx} +2 -2
  112. package/corpus/templates/design/app/components/design/inspector/index.ts +12 -12
  113. package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +5 -2
  114. package/corpus/templates/design/app/components/editor/PromptDialog.tsx +3 -3
  115. package/corpus/templates/design/app/components/layout/Layout.tsx +5 -2
  116. package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -1
  117. package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +167 -91
  118. package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +16 -3
  119. package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +15 -0
  120. package/corpus/templates/design/app/global.css +4 -0
  121. package/corpus/templates/design/app/hooks/use-design-system.ts +4 -1
  122. package/corpus/templates/design/app/hooks/use-navigation-state.ts +38 -3
  123. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +9 -2
  124. package/corpus/templates/design/app/i18n/zh-TW.ts +22 -0
  125. package/corpus/templates/design/app/i18n-data.ts +527 -0
  126. package/corpus/templates/design/app/lib/design-systems.ts +6 -4
  127. package/corpus/templates/design/app/lib/design-templates.ts +15 -3
  128. package/corpus/templates/design/app/pages/DesignEditor.tsx +641 -158
  129. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +42 -34
  130. package/corpus/templates/design/app/pages/VisualEdit.tsx +100 -0
  131. package/corpus/templates/design/app/root.tsx +42 -9
  132. package/corpus/templates/design/app/routes/visual-edit.tsx +7 -0
  133. package/corpus/templates/design/changelog/2026-06-28-live-cursors-now-keep-names-beside-a-cleaner-pointer-marker.md +1 -1
  134. package/corpus/templates/design/changelog/2026-06-28-mode-switching-now-lives-in-a-compact-bottom-right-icon-dock.md +1 -1
  135. package/corpus/templates/design/changelog/2026-06-28-visual-code-design-mode.md +6 -0
  136. package/corpus/templates/design/changelog/2026-06-29-design-generation-prompts-now-show-connect-ai-before-sending.md +6 -0
  137. package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +1 -1
  138. package/corpus/templates/design/changelog/2026-06-29-fixed-design-editor-exports-and-gradient-edits-so-multi-scre.md +6 -0
  139. package/corpus/templates/design/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
  140. package/corpus/templates/design/changelog/2026-06-29-png-export-handles-modern-css-color-functions-more-reliably.md +6 -0
  141. package/corpus/templates/design/changelog/2026-06-29-png-export-now-ignores-duplicate-clicks-while-a-download-is-.md +6 -0
  142. package/corpus/templates/design/changelog/2026-06-29-public-visual-edit-and-shared-design-links-now-invite-visito.md +6 -0
  143. package/corpus/templates/design/changelog/2026-06-29-visual-edit-actions-now-reject-missing-design-targets-before.md +6 -0
  144. package/corpus/templates/design/e2e/README.md +71 -0
  145. package/corpus/templates/design/e2e/global-setup.ts +157 -0
  146. package/corpus/templates/design/e2e/helpers.ts +148 -0
  147. package/corpus/templates/design/netlify.toml +3 -4
  148. package/corpus/templates/design/package.json +5 -1
  149. package/corpus/templates/design/playwright.config.ts +51 -0
  150. package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +121 -0
  151. package/corpus/templates/design/server/handlers/uploads.ts +89 -38
  152. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +181 -0
  153. package/corpus/templates/design/server/lib/coding-handoff.ts +33 -4
  154. package/corpus/templates/design/server/lib/design-export.ts +35 -8
  155. package/corpus/templates/design/server/plugins/agent-chat.ts +4 -0
  156. package/corpus/templates/design/server/plugins/auth.ts +10 -1
  157. package/corpus/templates/design/server/routes/api/index-design-system-with-builder.post.ts +1 -0
  158. package/corpus/templates/design/shared/api.ts +2 -0
  159. package/corpus/templates/design/shared/apply-edits.ts +12 -8
  160. package/corpus/templates/design/shared/canvas-math.ts +19 -1
  161. package/corpus/templates/design/shared/code-layer.ts +87 -28
  162. package/corpus/templates/design/shared/generation-session.ts +1 -0
  163. package/corpus/templates/design/shared/resolve-tweaks.ts +4 -3
  164. package/corpus/templates/design/shared/shader-presets.ts +10 -0
  165. package/corpus/templates/design/shared/source-mode.ts +9 -0
  166. package/corpus/templates/design/vitest.config.ts +2 -1
  167. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -1
  168. package/corpus/templates/plan/.agents/skills/visual-plan/references/canvas.md +1 -1
  169. package/corpus/templates/plan/AGENTS.md +1 -1
  170. package/corpus/templates/plan/actions/create-plan-design.ts +1 -1
  171. package/corpus/templates/plan/actions/validate-local-plan-source.ts +2 -10
  172. package/corpus/templates/plan/app/pages/PlansPage.tsx +1 -0
  173. package/corpus/templates/plan/docs/commenting-ux-plan.md +2 -2
  174. package/corpus/templates/plan/server/plan-content.ts +1 -1
  175. package/corpus/templates/plan/server/ui-plan-html.ts +2 -2
  176. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +6 -153
  177. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +53 -38
  178. package/corpus/templates/slides/app/components/design-system/{fig-import-response.ts → builder-index-response.ts} +9 -6
  179. package/corpus/templates/slides/app/components/visual-editor/MultiSelectChip.tsx +1 -1
  180. package/corpus/templates/slides/changelog/2026-06-29-design-system-setup-now-indexes-uploaded-design-files-throug.md +6 -0
  181. package/corpus/templates/slides/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
  182. package/corpus/templates/slides/netlify.toml +3 -6
  183. package/corpus/templates/slides/server/handlers/index-design-system-with-builder.ts +116 -0
  184. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +179 -0
  185. package/corpus/templates/slides/server/plugins/agent-chat.ts +4 -1
  186. package/corpus/templates/slides/server/routes/api/index-design-system-with-builder.post.ts +1 -0
  187. package/dist/action.d.ts +15 -0
  188. package/dist/action.d.ts.map +1 -1
  189. package/dist/action.js +6 -0
  190. package/dist/action.js.map +1 -1
  191. package/dist/agent/durable-background.d.ts +9 -7
  192. package/dist/agent/durable-background.d.ts.map +1 -1
  193. package/dist/agent/durable-background.js +27 -11
  194. package/dist/agent/durable-background.js.map +1 -1
  195. package/dist/agent/production-agent.d.ts +7 -0
  196. package/dist/agent/production-agent.d.ts.map +1 -1
  197. package/dist/agent/production-agent.js +4 -1
  198. package/dist/agent/production-agent.js.map +1 -1
  199. package/dist/agent/run-loop-with-resume.d.ts +2 -1
  200. package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
  201. package/dist/agent/run-loop-with-resume.js +2 -2
  202. package/dist/agent/run-loop-with-resume.js.map +1 -1
  203. package/dist/brand-kit/fig/index.d.ts +4 -4
  204. package/dist/brand-kit/fig/index.d.ts.map +1 -1
  205. package/dist/brand-kit/fig/index.js +14 -27
  206. package/dist/brand-kit/fig/index.js.map +1 -1
  207. package/dist/cli/index.js +1 -1
  208. package/dist/cli/index.js.map +1 -1
  209. package/dist/cli/mcp-config-writers.d.ts +15 -7
  210. package/dist/cli/mcp-config-writers.d.ts.map +1 -1
  211. package/dist/cli/mcp-config-writers.js +198 -45
  212. package/dist/cli/mcp-config-writers.js.map +1 -1
  213. package/dist/cli/skills.d.ts +1 -1
  214. package/dist/cli/skills.d.ts.map +1 -1
  215. package/dist/cli/skills.js +18 -3
  216. package/dist/cli/skills.js.map +1 -1
  217. package/dist/client/AssistantChat.d.ts.map +1 -1
  218. package/dist/client/AssistantChat.js +11 -1
  219. package/dist/client/AssistantChat.js.map +1 -1
  220. package/dist/client/agent-chat.d.ts.map +1 -1
  221. package/dist/client/agent-chat.js +15 -2
  222. package/dist/client/agent-chat.js.map +1 -1
  223. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  224. package/dist/client/composer/PromptComposer.js +35 -1
  225. package/dist/client/composer/PromptComposer.js.map +1 -1
  226. package/dist/client/org/OrgSwitcher.js +1 -1
  227. package/dist/client/org/OrgSwitcher.js.map +1 -1
  228. package/dist/client/sharing/ShareButton.d.ts +1 -1
  229. package/dist/client/sharing/ShareButton.d.ts.map +1 -1
  230. package/dist/client/sharing/ShareButton.js +2 -15
  231. package/dist/client/sharing/ShareButton.js.map +1 -1
  232. package/dist/collab/presence.d.ts +1 -1
  233. package/dist/collab/presence.js +1 -1
  234. package/dist/collab/presence.js.map +1 -1
  235. package/dist/collab/routes.d.ts +1 -1
  236. package/dist/mcp/connect-route.d.ts.map +1 -1
  237. package/dist/mcp/connect-route.js +34 -5
  238. package/dist/mcp/connect-route.js.map +1 -1
  239. package/dist/notifications/routes.d.ts +3 -3
  240. package/dist/observability/routes.d.ts +3 -3
  241. package/dist/resources/handlers.d.ts +1 -1
  242. package/dist/server/action-discovery.d.ts.map +1 -1
  243. package/dist/server/action-discovery.js +5 -0
  244. package/dist/server/action-discovery.js.map +1 -1
  245. package/dist/server/agent-chat-plugin.d.ts +6 -0
  246. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  247. package/dist/server/agent-chat-plugin.js +12 -3
  248. package/dist/server/agent-chat-plugin.js.map +1 -1
  249. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  250. package/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
  251. package/docs/content/locales/ar-SA/template-design.mdx +1 -1
  252. package/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
  253. package/docs/content/locales/de-DE/template-design.mdx +1 -1
  254. package/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
  255. package/docs/content/locales/es-ES/template-design.mdx +1 -1
  256. package/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
  257. package/docs/content/locales/fr-FR/template-design.mdx +1 -1
  258. package/docs/content/locales/hi-IN/template-design.mdx +1 -1
  259. package/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
  260. package/docs/content/locales/ja-JP/template-design.mdx +1 -1
  261. package/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
  262. package/docs/content/locales/ko-KR/template-design.mdx +1 -1
  263. package/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
  264. package/docs/content/locales/pt-BR/template-design.mdx +1 -1
  265. package/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
  266. package/docs/content/locales/zh-CN/template-design.mdx +1 -1
  267. package/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
  268. package/docs/content/locales/zh-TW/template-design.mdx +1 -1
  269. package/docs/content/real-time-collaboration.mdx +2 -2
  270. package/docs/content/template-design.mdx +1 -1
  271. package/package.json +3 -7
  272. package/corpus/core/src/brand-kit/fig/decode.ts +0 -410
  273. package/corpus/core/src/brand-kit/fig/extract-design-system.ts +0 -947
  274. package/corpus/core/src/brand-kit/fig/fig-to-html.ts +0 -1906
  275. package/corpus/templates/design/actions/import-figma.ts +0 -55
  276. package/corpus/templates/design/changelog/2026-06-28-figma-style-code-design-mode.md +0 -6
  277. package/corpus/templates/design/server/handlers/import-figma-system.ts +0 -86
  278. package/corpus/templates/design/server/routes/api/import-figma-system.post.ts +0 -1
  279. package/corpus/templates/slides/server/handlers/import-figma-system.ts +0 -101
  280. package/corpus/templates/slides/server/routes/api/import-figma-system.post.ts +0 -1
  281. package/dist/brand-kit/fig/decode.d.ts +0 -33
  282. package/dist/brand-kit/fig/decode.d.ts.map +0 -1
  283. package/dist/brand-kit/fig/decode.js +0 -358
  284. package/dist/brand-kit/fig/decode.js.map +0 -1
  285. package/dist/brand-kit/fig/extract-design-system.d.ts +0 -44
  286. package/dist/brand-kit/fig/extract-design-system.d.ts.map +0 -1
  287. package/dist/brand-kit/fig/extract-design-system.js +0 -752
  288. package/dist/brand-kit/fig/extract-design-system.js.map +0 -1
  289. package/dist/brand-kit/fig/fig-to-html.d.ts +0 -246
  290. package/dist/brand-kit/fig/fig-to-html.d.ts.map +0 -1
  291. package/dist/brand-kit/fig/fig-to-html.js +0 -1506
  292. package/dist/brand-kit/fig/fig-to-html.js.map +0 -1
@@ -39,7 +39,7 @@ import {
39
39
  IconSizingMin,
40
40
  IconSizingRemove,
41
41
  IconSizingVariable,
42
- } from "./figma-icons";
42
+ } from "./design-icons";
43
43
  import { ScrubInput } from "./ScrubInput";
44
44
 
45
45
  export type AutoLayoutDirection = "horizontal" | "vertical";
@@ -78,7 +78,7 @@ export interface AutoLayoutMatrixValue {
78
78
  };
79
79
  /**
80
80
  * Currently-set min/max constraints per axis, in px. `null` means the
81
- * constraint is not set (Figma shows the "Add min/max…" menu item instead of
81
+ * constraint is not set (the design editor shows the "Add min/max…" menu item instead of
82
82
  * a sub-row). Optional so existing callers are unaffected.
83
83
  */
84
84
  childMinMax?: {
@@ -92,6 +92,12 @@ export interface AutoLayoutMatrixValue {
92
92
  * unaffected.
93
93
  */
94
94
  display?: "flex" | "block";
95
+ /**
96
+ * When true, the gap mode is "Auto" (CSS `justify-content: space-between`).
97
+ * When false or omitted, gap mode is "Fixed" (a numeric gap value).
98
+ * Drives the checked state of the Fixed/Auto items in the gap dropdown.
99
+ */
100
+ spaceBetween?: boolean;
95
101
  }
96
102
 
97
103
  export interface AutoLayoutMatrixLabels {
@@ -157,7 +163,7 @@ export interface AutoLayoutMatrixProps {
157
163
  ) => void;
158
164
  /**
159
165
  * Invoked when the user picks "Apply variable…". Optional — when omitted the
160
- * variable row is still shown but disabled (placeholder), matching Figma when
166
+ * variable row is still shown but disabled (placeholder), matching the design editor when
161
167
  * no variable collections exist.
162
168
  */
163
169
  onApplyVariable?: (axis: AutoLayoutSizingAxis) => void;
@@ -245,12 +251,14 @@ export function AutoLayoutMatrix({
245
251
  }: AutoLayoutMatrixProps) {
246
252
  const copy = { ...DEFAULT_AUTO_LAYOUT_LABELS, ...labels };
247
253
 
248
- const horizontalPaddingValue = Math.round(
249
- (value.padding.left + value.padding.right) / 2,
250
- );
251
- const verticalPaddingValue = Math.round(
252
- (value.padding.top + value.padding.bottom) / 2,
253
- );
254
+ // Show left/top as the representative value when padding is linked.
255
+ // Averaging the two sides would silently destroy asymmetric padding on the
256
+ // next edit — the onChange handler sets both sides to the same number, so
257
+ // whatever is displayed becomes the new value for both sides. Using the
258
+ // left/top value means scrubbing up/down from the current value preserves
259
+ // the user's intent without a silent lossy round-trip through the average.
260
+ const horizontalPaddingValue = value.padding.left;
261
+ const verticalPaddingValue = value.padding.top;
254
262
 
255
263
  const activeFlow = getFlowOption(value);
256
264
  const isBlock = activeFlow === "normal";
@@ -282,13 +290,13 @@ export function AutoLayoutMatrix({
282
290
  {/* ── Flow ── */}
283
291
  <div className="space-y-1.5">
284
292
  <ControlLabel>
285
- {"Flow" /* i18n-ignore Figma inspector label */}
293
+ {"Flow" /* i18n-ignore design inspector label */}
286
294
  </ControlLabel>
287
295
  <div className="flex items-center gap-1.5">
288
296
  {/* 4-segment flow bar: normal / vertical / horizontal / grid */}
289
297
  <div className="flex h-7 flex-1 items-center gap-0.5 rounded-md bg-[var(--design-editor-control-bg)] p-0.5">
290
298
  <FlowButton
291
- label={"Normal flow" /* i18n-ignore Figma inspector label */}
299
+ label={"Normal flow" /* i18n-ignore design inspector label */}
292
300
  active={activeFlow === "normal"}
293
301
  disabled={disabled}
294
302
  onClick={() => selectFlow("normal")}
@@ -312,7 +320,7 @@ export function AutoLayoutMatrix({
312
320
  <IconFlowHorizontal className="size-3.5" />
313
321
  </FlowButton>
314
322
  <FlowButton
315
- label={"Grid" /* i18n-ignore Figma inspector label */}
323
+ label={"Grid" /* i18n-ignore design inspector label */}
316
324
  active={activeFlow === "grid"}
317
325
  disabled={disabled}
318
326
  onClick={() => selectFlow("grid")}
@@ -347,7 +355,7 @@ export function AutoLayoutMatrix({
347
355
  {/* ── Resizing ── */}
348
356
  <div className="space-y-1.5">
349
357
  <ControlLabel>
350
- {"Resizing" /* i18n-ignore Figma inspector label */}
358
+ {"Resizing" /* i18n-ignore design inspector label */}
351
359
  </ControlLabel>
352
360
  <div className="grid grid-cols-[1fr_1fr_auto] items-start gap-1.5">
353
361
  <SizingField
@@ -414,7 +422,7 @@ export function AutoLayoutMatrix({
414
422
  {/* Left: Alignment label + compact 3×3 matrix (no border box) */}
415
423
  <div className="space-y-1.5">
416
424
  <ControlLabel>
417
- {"Alignment" /* i18n-ignore Figma inspector label */}
425
+ {"Alignment" /* i18n-ignore design inspector label */}
418
426
  </ControlLabel>
419
427
  <CompactAlignmentMatrix
420
428
  value={value.alignment}
@@ -434,6 +442,8 @@ export function AutoLayoutMatrix({
434
442
  onDistribute={onDistribute}
435
443
  label={copy.gap}
436
444
  disabled={disabled || isBlock}
445
+ direction={value.direction}
446
+ gapMode={value.spaceBetween ? "auto" : "fixed"}
437
447
  />
438
448
  </div>
439
449
  </div>
@@ -584,9 +594,9 @@ const ALIGNMENT_CELLS: Array<{
584
594
  /**
585
595
  * Compact 3×3 alignment grid (no border box). Inactive cells show a faint dot;
586
596
  * the active cell shows accent bars oriented by flow — horizontal bars for a
587
- * vertical flow, vertical bars for a horizontal flow (Figma convention).
597
+ * vertical flow, vertical bars for a horizontal flow (editor convention).
588
598
  * When `onDistribute` is provided, two distribute buttons (H + V) are rendered
589
- * below the grid, matching Figma's inspector layout.
599
+ * below the grid, matching the design editor's inspector layout.
590
600
  */
591
601
  function CompactAlignmentMatrix({
592
602
  value,
@@ -651,7 +661,7 @@ function CompactAlignmentMatrix({
651
661
  <button
652
662
  type="button"
653
663
  aria-label={
654
- "Distribute horizontal spacing" /* i18n-ignore Figma inspector tooltip */
664
+ "Distribute horizontal spacing" /* i18n-ignore design inspector tooltip */
655
665
  }
656
666
  disabled={disabled}
657
667
  onClick={() => onDistribute("horizontal")}
@@ -666,7 +676,7 @@ function CompactAlignmentMatrix({
666
676
  </TooltipTrigger>
667
677
  <TooltipContent>
668
678
  {
669
- "Distribute horizontal spacing" /* i18n-ignore Figma inspector tooltip */
679
+ "Distribute horizontal spacing" /* i18n-ignore design inspector tooltip */
670
680
  }
671
681
  </TooltipContent>
672
682
  </Tooltip>
@@ -675,7 +685,7 @@ function CompactAlignmentMatrix({
675
685
  <button
676
686
  type="button"
677
687
  aria-label={
678
- "Distribute vertical spacing" /* i18n-ignore Figma inspector tooltip */
688
+ "Distribute vertical spacing" /* i18n-ignore design inspector tooltip */
679
689
  }
680
690
  disabled={disabled}
681
691
  onClick={() => onDistribute("vertical")}
@@ -690,7 +700,7 @@ function CompactAlignmentMatrix({
690
700
  </TooltipTrigger>
691
701
  <TooltipContent>
692
702
  {
693
- "Distribute vertical spacing" /* i18n-ignore Figma inspector tooltip */
703
+ "Distribute vertical spacing" /* i18n-ignore design inspector tooltip */
694
704
  }
695
705
  </TooltipContent>
696
706
  </Tooltip>
@@ -834,12 +844,16 @@ function GapField({
834
844
  onDistribute,
835
845
  label,
836
846
  disabled,
847
+ direction,
848
+ gapMode = "fixed",
837
849
  }: {
838
850
  value: number;
839
851
  onGapChange: (gap: number) => void;
840
852
  onDistribute?: (axis: DistributionAxis) => void;
841
853
  label: string;
842
854
  disabled: boolean;
855
+ direction: AutoLayoutDirection;
856
+ gapMode?: "fixed" | "auto";
843
857
  }) {
844
858
  return (
845
859
  <div className="flex items-center gap-1.5">
@@ -897,26 +911,26 @@ function GapField({
897
911
  sideOffset={4}
898
912
  >
899
913
  <DropdownMenuCheckboxItem
900
- checked
914
+ checked={gapMode !== "auto"}
901
915
  className="text-[12px]"
902
916
  onSelect={() => {
903
917
  /* Fixed gap: keep current numeric value (already numeric). */
904
918
  }}
905
919
  >
906
- {"Fixed" /* i18n-ignore Figma gap mode label */}
920
+ {"Fixed" /* i18n-ignore design gap mode label */}
907
921
  </DropdownMenuCheckboxItem>
908
922
  <DropdownMenuCheckboxItem
909
- checked={false}
923
+ checked={gapMode === "auto"}
910
924
  className="text-[12px]"
911
- onSelect={() => onDistribute("horizontal")}
925
+ onSelect={() => onDistribute(direction)}
912
926
  >
913
- {"Auto" /* i18n-ignore Figma gap mode label */}
927
+ {"Auto" /* i18n-ignore design gap mode label */}
914
928
  </DropdownMenuCheckboxItem>
915
929
  </DropdownMenuContent>
916
930
  </DropdownMenu>
917
931
  ) : null}
918
932
  </div>
919
- {/* Sliders / advanced spacing icon (Figma's tune control) */}
933
+ {/* Sliders / advanced spacing icon (the design editor's tune control) */}
920
934
  <Tooltip>
921
935
  <TooltipTrigger asChild>
922
936
  <Button
@@ -927,7 +941,7 @@ function GapField({
927
941
  aria-label={
928
942
  "Advanced gap settings" /* i18n-ignore inspector tooltip */
929
943
  }
930
- onClick={() => onDistribute?.("horizontal")}
944
+ onClick={() => onDistribute?.(direction)}
931
945
  className="size-7 shrink-0 rounded-md text-muted-foreground hover:bg-[var(--design-editor-control-bg)] hover:text-foreground"
932
946
  >
933
947
  <IconSlidersMini />
@@ -1050,8 +1064,8 @@ export interface SizingFieldProps {
1050
1064
  }
1051
1065
 
1052
1066
  /**
1053
- * Figma-style sizing field. Trigger renders `[axis | value | mode ▾]`; the menu
1054
- * is the full Figma resizing dropdown:
1067
+ * design-editor sizing field. Trigger renders `[axis | value | mode ▾]`; the menu
1068
+ * is the full design resizing dropdown:
1055
1069
  * Fixed · Hug contents · Fill container
1056
1070
  * ──────────────────────
1057
1071
  * Add min … · Add max …
@@ -1076,8 +1090,13 @@ export function SizingField({
1076
1090
  }: SizingFieldProps) {
1077
1091
  const labels = { ...DEFAULT_AUTO_LAYOUT_LABELS, ...labelOverrides };
1078
1092
  const isWidth = sizingAxis === "horizontal";
1079
- // Which inline "add" editor is currently open (none by default).
1080
- const [editing, setEditing] = useState<null | "min" | "max">(null);
1093
+ // Local pending state for a newly-opened constraint editor. Holds the kind
1094
+ // and seed value so the sub-row is visible before the user has confirmed a
1095
+ // value. We only commit to onMinMaxChange when the user types or scrubs.
1096
+ const [pending, setPending] = useState<{
1097
+ kind: "min" | "max";
1098
+ seed: number;
1099
+ } | null>(null);
1081
1100
 
1082
1101
  const minValue = minMax?.min ?? null;
1083
1102
  const maxValue = minMax?.max ?? null;
@@ -1087,7 +1106,7 @@ export function SizingField({
1087
1106
  const canHug = options.includes("hug");
1088
1107
  const canFill = options.includes("fill");
1089
1108
 
1090
- // Figma rule: when Fixed, show ONLY the numeric value + chevron (no word).
1109
+ // design rule: when Fixed, show ONLY the numeric value + chevron (no word).
1091
1110
  // When Hug / Fill, show value + the mode word.
1092
1111
  const showWord = value !== "fixed";
1093
1112
 
@@ -1097,10 +1116,12 @@ export function SizingField({
1097
1116
  const maxLabel = isWidth ? labels.maxWidth : labels.maxHeight;
1098
1117
 
1099
1118
  const openEditor = (kind: "min" | "max") => {
1100
- // Seed a sensible default when first adding the constraint.
1119
+ // Compute a sensible seed but do NOT write it to the parent yet — only
1120
+ // show the pending sub-row. The value is committed when the user first
1121
+ // scrubs/types in the ConstraintSubRow.
1101
1122
  const seed = Math.max(0, Math.round(resolvedSize ?? 0));
1102
- onMinMaxChange?.(sizingAxis, kind, kind === "min" ? seed : seed || 1);
1103
- setEditing(kind);
1123
+ const seedValue = kind === "min" ? seed : seed || 1;
1124
+ setPending({ kind, seed: seedValue });
1104
1125
  };
1105
1126
 
1106
1127
  return (
@@ -1213,9 +1234,21 @@ export function SizingField({
1213
1234
  onChange={(next) => onMinMaxChange?.(sizingAxis, "min", next)}
1214
1235
  onRemove={() => {
1215
1236
  onMinMaxChange?.(sizingAxis, "min", null);
1216
- setEditing((cur) => (cur === "min" ? null : cur));
1217
1237
  }}
1218
1238
  />
1239
+ ) : pending?.kind === "min" ? (
1240
+ // Pending (uncommitted) min row — shown before the user confirms a value.
1241
+ <ConstraintSubRow
1242
+ label={minLabel}
1243
+ value={pending.seed}
1244
+ disabled={disabled}
1245
+ removeLabel={labels.removeConstraint}
1246
+ onChange={(next) => {
1247
+ setPending(null);
1248
+ onMinMaxChange?.(sizingAxis, "min", next);
1249
+ }}
1250
+ onRemove={() => setPending(null)}
1251
+ />
1219
1252
  ) : null}
1220
1253
  {hasMax ? (
1221
1254
  <ConstraintSubRow
@@ -1226,9 +1259,21 @@ export function SizingField({
1226
1259
  onChange={(next) => onMinMaxChange?.(sizingAxis, "max", next)}
1227
1260
  onRemove={() => {
1228
1261
  onMinMaxChange?.(sizingAxis, "max", null);
1229
- setEditing((cur) => (cur === "max" ? null : cur));
1230
1262
  }}
1231
1263
  />
1264
+ ) : pending?.kind === "max" ? (
1265
+ // Pending (uncommitted) max row — shown before the user confirms a value.
1266
+ <ConstraintSubRow
1267
+ label={maxLabel}
1268
+ value={pending.seed}
1269
+ disabled={disabled}
1270
+ removeLabel={labels.removeConstraint}
1271
+ onChange={(next) => {
1272
+ setPending(null);
1273
+ onMinMaxChange?.(sizingAxis, "max", next);
1274
+ }}
1275
+ onRemove={() => setPending(null)}
1276
+ />
1232
1277
  ) : null}
1233
1278
  </div>
1234
1279
  );
@@ -1251,11 +1296,7 @@ function SizingMenuItem({
1251
1296
  return (
1252
1297
  <DropdownMenuItem
1253
1298
  disabled={disabled}
1254
- onSelect={(event) => {
1255
- // Keep the menu's selection semantics but route through our handler.
1256
- event.preventDefault();
1257
- onSelect();
1258
- }}
1299
+ onSelect={onSelect}
1259
1300
  className="gap-2 pl-2 pr-2 text-[12px]"
1260
1301
  >
1261
1302
  <span className="flex size-4 shrink-0 items-center justify-center text-muted-foreground">
@@ -1353,7 +1394,7 @@ function CheckMini() {
1353
1394
  // Inline SVG glyphs (Tabler-weight, 24px viewBox)
1354
1395
  // ─────────────────────────────────────────────────
1355
1396
 
1356
- /** Minimal downward chevron — matches the Figma caret weight. */
1397
+ /** Minimal downward chevron — matches the design caret weight. */
1357
1398
  function ChevronDownMini() {
1358
1399
  return (
1359
1400
  <svg
@@ -66,7 +66,7 @@ const DEFAULT_LABELS: ConstraintsWidgetLabels = {
66
66
  // ── pin-box geometry ────────────────────────────────────────────────────────
67
67
  // The preview box is 40×40px (size-10). Inside it sits an 18×14px inner rect
68
68
  // (representing a child element) centered at (20,20). The proportions match
69
- // Figma's "little box" widget — inner rect is ~45–50% of the outer box width
69
+ // the design editor's "little box" widget — inner rect is ~45–50% of the outer box width
70
70
  // and slightly shorter in height to resemble a real element.
71
71
  //
72
72
  // Edge pins: 5px long, 2px wide, placed 2px from the box edge (flush to border).
@@ -83,7 +83,7 @@ const DEFAULT_LABELS: ConstraintsWidgetLabels = {
83
83
  //
84
84
  // Center marker: for h=center or v=center, a single accent line runs through
85
85
  // the full width/height of the box (including through the inner rect), drawn
86
- // on top at the midpoint — matching Figma's solid crosshair treatment.
86
+ // on top at the midpoint — matching the design editor's solid crosshair treatment.
87
87
  //
88
88
  // Scale mode: all four pins on that axis render dashed, accent color.
89
89
 
@@ -93,7 +93,7 @@ const INNER_H = 14; // inner rect height (slightly shorter than wide = realistic
93
93
  const INNER_X = (BOX - INNER_W) / 2; // 11
94
94
  const INNER_Y = (BOX - INNER_H) / 2; // 13
95
95
  const PIN_LEN = 5; // visual pin length
96
- const PIN_W = 2; // pin stroke width (Figma: 2px thick pins)
96
+ const PIN_W = 2; // pin stroke width (design editor: 2px thick pins)
97
97
  const MARGIN = 2; // gap between outer box edge and pin start
98
98
  const CENTER = BOX / 2; // 20
99
99
 
@@ -264,7 +264,7 @@ function PinBox({
264
264
  />
265
265
 
266
266
  {/* center crosshair lines — drawn THROUGH the full box width/height
267
- (including through the inner rect), matching Figma's solid crosshair.
267
+ (including through the inner rect), matching the design editor's solid crosshair.
268
268
  Only rendered when the constraint is "center" on that axis. */}
269
269
  {hCenter && (
270
270
  <line