@pairdraw/core 0.20.0 → 0.21.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.
Files changed (539) hide show
  1. package/dist/canvas/noise/render.js +1 -1
  2. package/dist/canvas/noise/render.js.map +1 -1
  3. package/dist/canvas/noise/shader.d.ts +6 -3
  4. package/dist/canvas/noise/shader.d.ts.map +1 -1
  5. package/dist/canvas/noise/shader.js +12 -7
  6. package/dist/canvas/noise/shader.js.map +1 -1
  7. package/dist/canvas/noise/tile.d.ts.map +1 -1
  8. package/dist/canvas/noise/tile.js +2 -1
  9. package/dist/canvas/noise/tile.js.map +1 -1
  10. package/dist/canvas/renderer/colors.d.ts +20 -5
  11. package/dist/canvas/renderer/colors.d.ts.map +1 -1
  12. package/dist/canvas/renderer/colors.js +48 -42
  13. package/dist/canvas/renderer/colors.js.map +1 -1
  14. package/dist/canvas/renderer/document-surface.d.ts +25 -0
  15. package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
  16. package/dist/canvas/renderer/document-surface.js +46 -0
  17. package/dist/canvas/renderer/document-surface.js.map +1 -0
  18. package/dist/canvas/renderer/fonts.d.ts.map +1 -1
  19. package/dist/canvas/renderer/fonts.js +6 -4
  20. package/dist/canvas/renderer/fonts.js.map +1 -1
  21. package/dist/canvas/renderer/lifecycle.js +4 -3
  22. package/dist/canvas/renderer/lifecycle.js.map +1 -1
  23. package/dist/canvas/renderer/methods.d.ts.map +1 -1
  24. package/dist/canvas/renderer/methods.js +1 -0
  25. package/dist/canvas/renderer/methods.js.map +1 -1
  26. package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
  27. package/dist/canvas/renderer/pipeline.js +23 -2
  28. package/dist/canvas/renderer/pipeline.js.map +1 -1
  29. package/dist/canvas/renderer/retained-backing.d.ts.map +1 -1
  30. package/dist/canvas/renderer/retained-backing.js +2 -1
  31. package/dist/canvas/renderer/retained-backing.js.map +1 -1
  32. package/dist/canvas/renderer/tiles/surface-pool.d.ts.map +1 -1
  33. package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
  34. package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
  35. package/dist/canvas/renderer.d.ts +20 -2
  36. package/dist/canvas/renderer.d.ts.map +1 -1
  37. package/dist/canvas/renderer.js +28 -4
  38. package/dist/canvas/renderer.js.map +1 -1
  39. package/dist/canvas/scene.d.ts.map +1 -1
  40. package/dist/canvas/scene.js +4 -3
  41. package/dist/canvas/scene.js.map +1 -1
  42. package/dist/canvas/shaders/compile.d.ts +3 -1
  43. package/dist/canvas/shaders/compile.d.ts.map +1 -1
  44. package/dist/canvas/shaders/compile.js +12 -3
  45. package/dist/canvas/shaders/compile.js.map +1 -1
  46. package/dist/canvas/shaders/draw.d.ts.map +1 -1
  47. package/dist/canvas/shaders/draw.js +10 -3
  48. package/dist/canvas/shaders/draw.js.map +1 -1
  49. package/dist/canvas/shaders/effect.d.ts.map +1 -1
  50. package/dist/canvas/shaders/effect.js +8 -17
  51. package/dist/canvas/shaders/effect.js.map +1 -1
  52. package/dist/canvas/shadows/shape.d.ts.map +1 -1
  53. package/dist/canvas/shadows/shape.js +4 -2
  54. package/dist/canvas/shadows/shape.js.map +1 -1
  55. package/dist/canvas/shadows.d.ts.map +1 -1
  56. package/dist/canvas/shadows.js +4 -2
  57. package/dist/canvas/shadows.js.map +1 -1
  58. package/dist/canvas/text/decorations.d.ts +2 -2
  59. package/dist/canvas/text/decorations.d.ts.map +1 -1
  60. package/dist/canvas/text/decorations.js +5 -5
  61. package/dist/canvas/text/decorations.js.map +1 -1
  62. package/dist/canvas/text/index.js +1 -1
  63. package/dist/canvas/text/index.js.map +1 -1
  64. package/dist/canvas/text/paragraph/index.d.ts +2 -2
  65. package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
  66. package/dist/canvas/text/paragraph/index.js +16 -5
  67. package/dist/canvas/text/paragraph/index.js.map +1 -1
  68. package/dist/canvas/text/renderer.d.ts +2 -1
  69. package/dist/canvas/text/renderer.d.ts.map +1 -1
  70. package/dist/canvas/text/shape.js +4 -4
  71. package/dist/canvas/text/shape.js.map +1 -1
  72. package/dist/canvas/texture.d.ts.map +1 -1
  73. package/dist/canvas/texture.js +2 -1
  74. package/dist/canvas/texture.js.map +1 -1
  75. package/dist/design-memory/rules.js +1 -1
  76. package/dist/editor/clipboard/assets.d.ts.map +1 -1
  77. package/dist/editor/clipboard/assets.js +2 -2
  78. package/dist/editor/clipboard/assets.js.map +1 -1
  79. package/dist/editor/clipboard/component-matches.d.ts +13 -0
  80. package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
  81. package/dist/editor/clipboard/component-matches.js +50 -0
  82. package/dist/editor/clipboard/component-matches.js.map +1 -0
  83. package/dist/editor/clipboard/dependencies.d.ts +7 -0
  84. package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
  85. package/dist/editor/clipboard/dependencies.js +5 -0
  86. package/dist/editor/clipboard/dependencies.js.map +1 -1
  87. package/dist/editor/clipboard/export.js +2 -2
  88. package/dist/editor/clipboard/export.js.map +1 -1
  89. package/dist/editor/clipboard.d.ts.map +1 -1
  90. package/dist/editor/clipboard.js +48 -19
  91. package/dist/editor/clipboard.js.map +1 -1
  92. package/dist/editor/components/properties.d.ts.map +1 -1
  93. package/dist/editor/components/properties.js +3 -3
  94. package/dist/editor/components/properties.js.map +1 -1
  95. package/dist/editor/eyedropper.d.ts +1 -1
  96. package/dist/editor/eyedropper.d.ts.map +1 -1
  97. package/dist/editor/eyedropper.js +6 -3
  98. package/dist/editor/eyedropper.js.map +1 -1
  99. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  100. package/dist/editor/history/atomic-tool.js +3 -2
  101. package/dist/editor/history/atomic-tool.js.map +1 -1
  102. package/dist/editor/shapes/pencil.js +1 -1
  103. package/dist/editor/structure/state.d.ts.map +1 -1
  104. package/dist/editor/structure/state.js +2 -2
  105. package/dist/editor/structure/state.js.map +1 -1
  106. package/dist/editor/text.d.ts.map +1 -1
  107. package/dist/editor/text.js +2 -2
  108. package/dist/editor/text.js.map +1 -1
  109. package/dist/editor/variables.js +3 -3
  110. package/dist/editor/variables.js.map +1 -1
  111. package/dist/figma-api/fresh-read.d.ts +15 -0
  112. package/dist/figma-api/fresh-read.d.ts.map +1 -0
  113. package/dist/figma-api/fresh-read.js +54 -0
  114. package/dist/figma-api/fresh-read.js.map +1 -0
  115. package/dist/figma-api/graph-ref.d.ts +9 -0
  116. package/dist/figma-api/graph-ref.d.ts.map +1 -0
  117. package/dist/figma-api/graph-ref.js +14 -0
  118. package/dist/figma-api/graph-ref.js.map +1 -0
  119. package/dist/figma-api/index.d.ts +6 -1
  120. package/dist/figma-api/index.d.ts.map +1 -1
  121. package/dist/figma-api/index.js +12 -5
  122. package/dist/figma-api/index.js.map +1 -1
  123. package/dist/figma-api/pending-layout.d.ts +3 -3
  124. package/dist/figma-api/pending-layout.d.ts.map +1 -1
  125. package/dist/figma-api/pending-layout.js +7 -3
  126. package/dist/figma-api/pending-layout.js.map +1 -1
  127. package/dist/figma-api/pending-sync.d.ts +1 -1
  128. package/dist/figma-api/pending-sync.d.ts.map +1 -1
  129. package/dist/figma-api/pending-sync.js +3 -1
  130. package/dist/figma-api/pending-sync.js.map +1 -1
  131. package/dist/figma-api/proxy.d.ts.map +1 -1
  132. package/dist/figma-api/proxy.js +3 -2
  133. package/dist/figma-api/proxy.js.map +1 -1
  134. package/dist/figma-api/reactions.d.ts +20 -4
  135. package/dist/figma-api/reactions.d.ts.map +1 -1
  136. package/dist/figma-api/reactions.js +49 -3
  137. package/dist/figma-api/reactions.js.map +1 -1
  138. package/dist/figma-api/variables/index.d.ts.map +1 -1
  139. package/dist/figma-api/variables/index.js +2 -2
  140. package/dist/figma-api/variables/index.js.map +1 -1
  141. package/dist/io/formats/design-tokens/css/known.js +1 -1
  142. package/dist/io/formats/design-tokens/css/known.js.map +1 -1
  143. package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
  144. package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
  145. package/dist/io/formats/design-tokens/css/read.js +11 -5
  146. package/dist/io/formats/design-tokens/css/read.js.map +1 -1
  147. package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
  148. package/dist/io/formats/design-tokens/css/sync.js +17 -4
  149. package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
  150. package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
  151. package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
  152. package/dist/io/formats/design-tokens/css/values.js +24 -8
  153. package/dist/io/formats/design-tokens/css/values.js.map +1 -1
  154. package/dist/io/formats/design-tokens/decode.d.ts +7 -6
  155. package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
  156. package/dist/io/formats/design-tokens/decode.js +13 -12
  157. package/dist/io/formats/design-tokens/decode.js.map +1 -1
  158. package/dist/io/formats/design-tokens/export.js +3 -3
  159. package/dist/io/formats/design-tokens/export.js.map +1 -1
  160. package/dist/io/formats/design-tokens/plan/index.d.ts.map +1 -1
  161. package/dist/io/formats/design-tokens/plan/index.js +4 -3
  162. package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
  163. package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
  164. package/dist/io/formats/design-tokens/plan/styles.js +9 -9
  165. package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
  166. package/dist/io/formats/design-tokens/styles.d.ts +4 -4
  167. package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
  168. package/dist/io/formats/design-tokens/styles.js +7 -7
  169. package/dist/io/formats/design-tokens/styles.js.map +1 -1
  170. package/dist/io/formats/design-tokens/sync/drift.js +2 -2
  171. package/dist/io/formats/design-tokens/sync/drift.js.map +1 -1
  172. package/dist/io/formats/design-tokens/values.d.ts +10 -5
  173. package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
  174. package/dist/io/formats/design-tokens/values.js +13 -7
  175. package/dist/io/formats/design-tokens/values.js.map +1 -1
  176. package/dist/io/formats/drawio/label.js +1 -1
  177. package/dist/io/formats/drawio/paint.js +1 -1
  178. package/dist/io/formats/drawio/warnings.d.ts +17 -2
  179. package/dist/io/formats/drawio/warnings.d.ts.map +1 -1
  180. package/dist/io/formats/drawio/warnings.js +15 -8
  181. package/dist/io/formats/drawio/warnings.js.map +1 -1
  182. package/dist/io/formats/fig/export/index.d.ts.map +1 -1
  183. package/dist/io/formats/fig/export/index.js +15 -3
  184. package/dist/io/formats/fig/export/index.js.map +1 -1
  185. package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
  186. package/dist/io/formats/fig/export/patch/index.js +2 -1
  187. package/dist/io/formats/fig/export/patch/index.js.map +1 -1
  188. package/dist/io/formats/fig/export/setup.d.ts +7 -2
  189. package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
  190. package/dist/io/formats/fig/export/setup.js +12 -13
  191. package/dist/io/formats/fig/export/setup.js.map +1 -1
  192. package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
  193. package/dist/io/formats/fig/export/variables.js +9 -7
  194. package/dist/io/formats/fig/export/variables.js.map +1 -1
  195. package/dist/io/formats/html/index.d.ts +1 -0
  196. package/dist/io/formats/html/index.d.ts.map +1 -1
  197. package/dist/io/formats/html/index.js +5 -3
  198. package/dist/io/formats/html/index.js.map +1 -1
  199. package/dist/io/formats/html/vectors.js +1 -0
  200. package/dist/io/formats/html/vectors.js.map +1 -1
  201. package/dist/io/formats/mermaid/layers.js +2 -2
  202. package/dist/io/formats/mermaid/layers.js.map +1 -1
  203. package/dist/io/formats/mermaid/styles.js +1 -1
  204. package/dist/io/formats/pdf/export.d.ts.map +1 -1
  205. package/dist/io/formats/pdf/export.js +1 -0
  206. package/dist/io/formats/pdf/export.js.map +1 -1
  207. package/dist/io/formats/pdf/prepare.d.ts +4 -4
  208. package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
  209. package/dist/io/formats/pdf/prepare.js +2 -2
  210. package/dist/io/formats/pdf/prepare.js.map +1 -1
  211. package/dist/io/formats/pen/index.d.ts.map +1 -1
  212. package/dist/io/formats/pen/index.js +13 -2
  213. package/dist/io/formats/pen/index.js.map +1 -1
  214. package/dist/io/formats/pptx/style.js +1 -1
  215. package/dist/io/formats/raster/render.d.ts +1 -1
  216. package/dist/io/formats/raster/render.d.ts.map +1 -1
  217. package/dist/io/formats/raster/render.js +9 -4
  218. package/dist/io/formats/raster/render.js.map +1 -1
  219. package/dist/io/formats/svg/defs.d.ts +6 -3
  220. package/dist/io/formats/svg/defs.d.ts.map +1 -1
  221. package/dist/io/formats/svg/defs.js +12 -11
  222. package/dist/io/formats/svg/defs.js.map +1 -1
  223. package/dist/io/formats/svg/effects.js +2 -2
  224. package/dist/io/formats/svg/effects.js.map +1 -1
  225. package/dist/io/formats/svg/export.d.ts +5 -2
  226. package/dist/io/formats/svg/export.d.ts.map +1 -1
  227. package/dist/io/formats/svg/export.js +4 -2
  228. package/dist/io/formats/svg/export.js.map +1 -1
  229. package/dist/io/formats/svg/filter.d.ts +4 -1
  230. package/dist/io/formats/svg/filter.d.ts.map +1 -1
  231. package/dist/io/formats/svg/filter.js +6 -2
  232. package/dist/io/formats/svg/filter.js.map +1 -1
  233. package/dist/io/formats/svg/grain.js +1 -1
  234. package/dist/io/formats/svg/grain.js.map +1 -1
  235. package/dist/io/formats/svg/import.d.ts +4 -2
  236. package/dist/io/formats/svg/import.d.ts.map +1 -1
  237. package/dist/io/formats/svg/import.js +2 -1
  238. package/dist/io/formats/svg/import.js.map +1 -1
  239. package/dist/io/formats/svg/text/export.d.ts.map +1 -1
  240. package/dist/io/formats/svg/text/export.js +8 -8
  241. package/dist/io/formats/svg/text/export.js.map +1 -1
  242. package/dist/io/formats/svg/text/layout.js +2 -2
  243. package/dist/io/formats/svg/text/layout.js.map +1 -1
  244. package/dist/io/formats.d.ts.map +1 -1
  245. package/dist/io/formats.js +11 -4
  246. package/dist/io/formats.js.map +1 -1
  247. package/dist/io/index.d.ts +2 -2
  248. package/dist/io/subgraph.d.ts.map +1 -1
  249. package/dist/io/subgraph.js +1 -1
  250. package/dist/io/subgraph.js.map +1 -1
  251. package/dist/io/types.d.ts +12 -3
  252. package/dist/io/types.d.ts.map +1 -1
  253. package/dist/kiwi/fig/session/options.d.ts +3 -0
  254. package/dist/kiwi/fig/session/options.d.ts.map +1 -1
  255. package/dist/kiwi/fig/session/options.js +4 -0
  256. package/dist/kiwi/fig/session/options.js.map +1 -1
  257. package/dist/layout/yoga-helpers.d.ts +2 -1
  258. package/dist/layout/yoga-helpers.d.ts.map +1 -1
  259. package/dist/layout/yoga-helpers.js +7 -1
  260. package/dist/layout/yoga-helpers.js.map +1 -1
  261. package/dist/layout.js +24 -1
  262. package/dist/layout.js.map +1 -1
  263. package/dist/lint/fixes.js +1 -1
  264. package/dist/lint/linter.js +2 -2
  265. package/dist/lint/linter.js.map +1 -1
  266. package/dist/pairdraw-api/comments.d.ts +4 -1
  267. package/dist/pairdraw-api/comments.d.ts.map +1 -1
  268. package/dist/pairdraw-api/comments.js +5 -0
  269. package/dist/pairdraw-api/comments.js.map +1 -1
  270. package/dist/pairdraw-api/index.d.ts +3 -3
  271. package/dist/pairdraw-api/index.d.ts.map +1 -1
  272. package/dist/pairdraw-api/index.js +5 -5
  273. package/dist/pairdraw-api/index.js.map +1 -1
  274. package/dist/pairdraw-api/nodes.d.ts +1 -1
  275. package/dist/prototype/scene.js +1 -1
  276. package/dist/rpc/analyze-commands.js +1 -1
  277. package/dist/rpc/read-commands.d.ts +2 -2
  278. package/dist/rpc/read-commands.js +3 -3
  279. package/dist/rpc/read-commands.js.map +1 -1
  280. package/dist/rpc/variables-command.js +2 -2
  281. package/dist/rpc/variables-command.js.map +1 -1
  282. package/dist/text/font/provider.d.ts +15 -0
  283. package/dist/text/font/provider.d.ts.map +1 -0
  284. package/dist/text/font/provider.js +18 -0
  285. package/dist/text/font/provider.js.map +1 -0
  286. package/dist/text/font/readiness.d.ts +32 -0
  287. package/dist/text/font/readiness.d.ts.map +1 -0
  288. package/dist/text/font/{status.js → readiness.js} +8 -4
  289. package/dist/text/font/readiness.js.map +1 -0
  290. package/dist/text/index.d.ts +4 -3
  291. package/dist/text/index.js +4 -3
  292. package/dist/text/prepare.d.ts +9 -4
  293. package/dist/text/prepare.d.ts.map +1 -1
  294. package/dist/text/prepare.js +9 -4
  295. package/dist/text/prepare.js.map +1 -1
  296. package/dist/tools/analyze/colors.js +1 -1
  297. package/dist/tools/analyze/responsive/index.js +7 -18
  298. package/dist/tools/analyze/responsive/index.js.map +1 -1
  299. package/dist/tools/analyze/responsive/widths.d.ts +27 -0
  300. package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
  301. package/dist/tools/analyze/responsive/widths.js +49 -0
  302. package/dist/tools/analyze/responsive/widths.js.map +1 -0
  303. package/dist/tools/analyze.d.ts +2 -1
  304. package/dist/tools/analyze.js +2 -1
  305. package/dist/tools/codegen/tokens.d.ts.map +1 -1
  306. package/dist/tools/codegen/tokens.js +2 -2
  307. package/dist/tools/codegen/tokens.js.map +1 -1
  308. package/dist/tools/comments.d.ts.map +1 -1
  309. package/dist/tools/comments.js +2 -2
  310. package/dist/tools/comments.js.map +1 -1
  311. package/dist/tools/component-catalog.d.ts.map +1 -1
  312. package/dist/tools/component-catalog.js +5 -3
  313. package/dist/tools/component-catalog.js.map +1 -1
  314. package/dist/tools/create/basic.js +1 -1
  315. package/dist/tools/create/behaviours.js +1 -1
  316. package/dist/tools/create/html.d.ts.map +1 -1
  317. package/dist/tools/create/html.js +1 -3
  318. package/dist/tools/create/html.js.map +1 -1
  319. package/dist/tools/create/icons.js +2 -2
  320. package/dist/tools/create/icons.js.map +1 -1
  321. package/dist/tools/create/mermaid.js +1 -1
  322. package/dist/tools/create/render.js +1 -1
  323. package/dist/tools/create/svg.js +5 -2
  324. package/dist/tools/create/svg.js.map +1 -1
  325. package/dist/tools/create/vector.js +3 -3
  326. package/dist/tools/create/vector.js.map +1 -1
  327. package/dist/tools/css/shorthand.d.ts +20 -0
  328. package/dist/tools/css/shorthand.d.ts.map +1 -0
  329. package/dist/tools/css/shorthand.js +54 -0
  330. package/dist/tools/css/shorthand.js.map +1 -0
  331. package/dist/tools/describe/index.js +2 -2
  332. package/dist/tools/describe/index.js.map +1 -1
  333. package/dist/tools/describe/issues.js +1 -1
  334. package/dist/tools/html-host.d.ts.map +1 -1
  335. package/dist/tools/html-host.js +5 -3
  336. package/dist/tools/html-host.js.map +1 -1
  337. package/dist/tools/image-ai/apply.d.ts.map +1 -1
  338. package/dist/tools/image-ai/apply.js +1 -3
  339. package/dist/tools/image-ai/apply.js.map +1 -1
  340. package/dist/tools/image-ai/generate.js +1 -1
  341. package/dist/tools/image-ai/service.d.ts.map +1 -1
  342. package/dist/tools/image-ai/service.js +5 -3
  343. package/dist/tools/image-ai/service.js.map +1 -1
  344. package/dist/tools/index.d.ts +2 -1
  345. package/dist/tools/index.js +2 -1
  346. package/dist/tools/modify/effects.js +1 -1
  347. package/dist/tools/modify/effects.js.map +1 -1
  348. package/dist/tools/modify/geometry.d.ts.map +1 -1
  349. package/dist/tools/modify/geometry.js +14 -3
  350. package/dist/tools/modify/geometry.js.map +1 -1
  351. package/dist/tools/modify/layout.d.ts.map +1 -1
  352. package/dist/tools/modify/layout.js +35 -8
  353. package/dist/tools/modify/layout.js.map +1 -1
  354. package/dist/tools/modify/matching.d.ts.map +1 -1
  355. package/dist/tools/modify/matching.js +10 -10
  356. package/dist/tools/modify/matching.js.map +1 -1
  357. package/dist/tools/modify/paint.d.ts.map +1 -1
  358. package/dist/tools/modify/paint.js +57 -5
  359. package/dist/tools/modify/paint.js.map +1 -1
  360. package/dist/tools/modify/reactions.d.ts.map +1 -1
  361. package/dist/tools/modify/reactions.js +2 -2
  362. package/dist/tools/modify/reactions.js.map +1 -1
  363. package/dist/tools/modify/text.d.ts.map +1 -1
  364. package/dist/tools/modify/text.js +3 -3
  365. package/dist/tools/modify/text.js.map +1 -1
  366. package/dist/tools/prompts/codegen.js +1 -1
  367. package/dist/tools/prompts/codegen.js.map +1 -1
  368. package/dist/tools/read/css.d.ts +14 -0
  369. package/dist/tools/read/css.d.ts.map +1 -0
  370. package/dist/tools/read/css.js +306 -0
  371. package/dist/tools/read/css.js.map +1 -0
  372. package/dist/tools/read/libraries.js +1 -1
  373. package/dist/tools/read/reactions.js +1 -1
  374. package/dist/tools/read/reactions.js.map +1 -1
  375. package/dist/tools/read/space.d.ts.map +1 -1
  376. package/dist/tools/read/space.js +0 -2
  377. package/dist/tools/read/space.js.map +1 -1
  378. package/dist/tools/read.d.ts +2 -1
  379. package/dist/tools/read.js +2 -1
  380. package/dist/tools/registry/core.d.ts +1 -1
  381. package/dist/tools/registry/core.js +3 -1
  382. package/dist/tools/registry/core.js.map +1 -1
  383. package/dist/tools/schema.d.ts +6 -4
  384. package/dist/tools/schema.d.ts.map +1 -1
  385. package/dist/tools/schema.js +9 -5
  386. package/dist/tools/schema.js.map +1 -1
  387. package/dist/tools/script/host.d.ts.map +1 -1
  388. package/dist/tools/script/host.js +5 -3
  389. package/dist/tools/script/host.js.map +1 -1
  390. package/dist/tools/variables/collections.js +1 -1
  391. package/dist/tools/variables/collections.js.map +1 -1
  392. package/dist/tools/variables/values.d.ts.map +1 -1
  393. package/dist/tools/variables/values.js +4 -4
  394. package/dist/tools/variables/values.js.map +1 -1
  395. package/dist/tools/vector/vectorize.d.ts.map +1 -1
  396. package/dist/tools/vector/vectorize.js +6 -4
  397. package/dist/tools/vector/vectorize.js.map +1 -1
  398. package/dist/tools/video-host.d.ts.map +1 -1
  399. package/dist/tools/video-host.js +5 -3
  400. package/dist/tools/video-host.js.map +1 -1
  401. package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
  402. package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
  403. package/dist/vector/vectorize/svg/gradients.js +5 -5
  404. package/dist/vector/vectorize/svg/gradients.js.map +1 -1
  405. package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
  406. package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
  407. package/dist/vector/vectorize/svg/to-vectors.js +13 -12
  408. package/dist/vector/vectorize/svg/to-vectors.js.map +1 -1
  409. package/package.json +9 -9
  410. package/src/canvas/noise/render.ts +1 -1
  411. package/src/canvas/noise/shader.ts +13 -5
  412. package/src/canvas/noise/tile.ts +2 -1
  413. package/src/canvas/renderer/colors.ts +76 -50
  414. package/src/canvas/renderer/document-surface.ts +53 -0
  415. package/src/canvas/renderer/fonts.ts +6 -4
  416. package/src/canvas/renderer/lifecycle.ts +4 -4
  417. package/src/canvas/renderer/methods.ts +1 -0
  418. package/src/canvas/renderer/pipeline.ts +21 -3
  419. package/src/canvas/renderer/retained-backing.ts +2 -1
  420. package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
  421. package/src/canvas/renderer.ts +36 -11
  422. package/src/canvas/scene.ts +4 -3
  423. package/src/canvas/shaders/compile.ts +14 -3
  424. package/src/canvas/shaders/draw.ts +11 -4
  425. package/src/canvas/shaders/effect.ts +8 -19
  426. package/src/canvas/shadows/shape.ts +4 -2
  427. package/src/canvas/shadows.ts +5 -2
  428. package/src/canvas/text/decorations.ts +15 -5
  429. package/src/canvas/text/index.ts +9 -1
  430. package/src/canvas/text/paragraph/index.ts +16 -6
  431. package/src/canvas/text/renderer.ts +2 -1
  432. package/src/canvas/text/shape.ts +4 -4
  433. package/src/canvas/texture.ts +2 -1
  434. package/src/editor/clipboard/assets.ts +6 -2
  435. package/src/editor/clipboard/component-matches.ts +65 -0
  436. package/src/editor/clipboard/dependencies.ts +22 -1
  437. package/src/editor/clipboard/export.ts +2 -2
  438. package/src/editor/clipboard.ts +74 -20
  439. package/src/editor/components/properties.ts +3 -2
  440. package/src/editor/eyedropper.ts +14 -4
  441. package/src/editor/history/atomic-tool.ts +3 -2
  442. package/src/editor/structure/state.ts +2 -1
  443. package/src/editor/text.ts +2 -1
  444. package/src/editor/variables.ts +3 -3
  445. package/src/figma-api/fresh-read.ts +57 -0
  446. package/src/figma-api/graph-ref.ts +13 -0
  447. package/src/figma-api/index.ts +12 -4
  448. package/src/figma-api/pending-layout.ts +7 -3
  449. package/src/figma-api/pending-sync.ts +4 -1
  450. package/src/figma-api/proxy.ts +2 -1
  451. package/src/figma-api/reactions.ts +91 -10
  452. package/src/figma-api/variables/index.ts +5 -4
  453. package/src/io/formats/design-tokens/css/known.ts +1 -1
  454. package/src/io/formats/design-tokens/css/read.ts +20 -7
  455. package/src/io/formats/design-tokens/css/sync.ts +9 -4
  456. package/src/io/formats/design-tokens/css/values.ts +37 -9
  457. package/src/io/formats/design-tokens/decode.ts +17 -12
  458. package/src/io/formats/design-tokens/export.ts +3 -3
  459. package/src/io/formats/design-tokens/plan/index.ts +6 -5
  460. package/src/io/formats/design-tokens/plan/styles.ts +37 -10
  461. package/src/io/formats/design-tokens/styles.ts +10 -7
  462. package/src/io/formats/design-tokens/sync/drift.ts +6 -4
  463. package/src/io/formats/design-tokens/values.ts +15 -8
  464. package/src/io/formats/drawio/warnings.ts +28 -9
  465. package/src/io/formats/fig/export/index.ts +36 -3
  466. package/src/io/formats/fig/export/patch/index.ts +4 -1
  467. package/src/io/formats/fig/export/setup.ts +25 -15
  468. package/src/io/formats/fig/export/variables.ts +17 -6
  469. package/src/io/formats/html/index.ts +9 -3
  470. package/src/io/formats/html/vectors.ts +1 -0
  471. package/src/io/formats/mermaid/layers.ts +2 -2
  472. package/src/io/formats/pdf/export.ts +1 -0
  473. package/src/io/formats/pdf/prepare.ts +6 -6
  474. package/src/io/formats/pen/index.ts +15 -4
  475. package/src/io/formats/raster/render.ts +12 -4
  476. package/src/io/formats/svg/defs.ts +26 -14
  477. package/src/io/formats/svg/effects.ts +2 -2
  478. package/src/io/formats/svg/export.ts +17 -3
  479. package/src/io/formats/svg/filter.ts +12 -2
  480. package/src/io/formats/svg/grain.ts +1 -1
  481. package/src/io/formats/svg/import.ts +6 -3
  482. package/src/io/formats/svg/text/export.ts +10 -8
  483. package/src/io/formats/svg/text/layout.ts +2 -2
  484. package/src/io/formats.ts +18 -5
  485. package/src/io/index.ts +1 -0
  486. package/src/io/subgraph.ts +4 -1
  487. package/src/io/types.ts +10 -0
  488. package/src/kiwi/fig/session/options.ts +4 -1
  489. package/src/layout/yoga-helpers.ts +8 -0
  490. package/src/layout.ts +47 -1
  491. package/src/lint/linter.ts +1 -1
  492. package/src/pairdraw-api/comments.ts +6 -0
  493. package/src/pairdraw-api/index.ts +7 -9
  494. package/src/rpc/read-commands.ts +4 -4
  495. package/src/rpc/variables-command.ts +2 -2
  496. package/src/text/font/provider.ts +26 -0
  497. package/src/text/font/{status.ts → readiness.ts} +13 -9
  498. package/src/text/index.ts +2 -1
  499. package/src/text/prepare.ts +9 -4
  500. package/src/tools/analyze/responsive/index.ts +8 -15
  501. package/src/tools/analyze/responsive/widths.ts +63 -0
  502. package/src/tools/analyze.ts +2 -0
  503. package/src/tools/codegen/tokens.ts +4 -2
  504. package/src/tools/comments.ts +6 -4
  505. package/src/tools/component-catalog.ts +5 -3
  506. package/src/tools/create/html.ts +0 -3
  507. package/src/tools/create/icons.ts +1 -1
  508. package/src/tools/create/svg.ts +4 -1
  509. package/src/tools/create/vector.ts +2 -2
  510. package/src/tools/css/shorthand.ts +64 -0
  511. package/src/tools/describe/index.ts +2 -8
  512. package/src/tools/html-host.ts +5 -3
  513. package/src/tools/image-ai/apply.ts +0 -2
  514. package/src/tools/image-ai/service.ts +5 -3
  515. package/src/tools/index.ts +2 -0
  516. package/src/tools/modify/effects.ts +1 -1
  517. package/src/tools/modify/geometry.ts +16 -3
  518. package/src/tools/modify/layout.ts +47 -13
  519. package/src/tools/modify/matching.ts +14 -11
  520. package/src/tools/modify/paint.ts +85 -5
  521. package/src/tools/modify/reactions.ts +3 -2
  522. package/src/tools/modify/text.ts +15 -11
  523. package/src/tools/prompts/codegen.md +2 -1
  524. package/src/tools/read/css.ts +365 -0
  525. package/src/tools/read/reactions.ts +3 -2
  526. package/src/tools/read/space.ts +0 -2
  527. package/src/tools/read.ts +1 -0
  528. package/src/tools/registry/core.ts +3 -2
  529. package/src/tools/schema.ts +14 -5
  530. package/src/tools/script/host.ts +6 -3
  531. package/src/tools/variables/collections.ts +1 -1
  532. package/src/tools/variables/values.ts +16 -5
  533. package/src/tools/vector/vectorize.ts +10 -4
  534. package/src/tools/video-host.ts +5 -3
  535. package/src/vector/vectorize/svg/gradients.ts +8 -5
  536. package/src/vector/vectorize/svg/to-vectors.ts +48 -14
  537. package/dist/text/font/status.d.ts +0 -28
  538. package/dist/text/font/status.d.ts.map +0 -1
  539. package/dist/text/font/status.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":[],"sources":["../../../src/tools/modify/text.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'\nimport type { FigmaFontName, FigmaFontNameInput } from '#core/figma-api/fonts/names'\nimport type { FigmaVariationSettings } from '#core/figma-api/fonts/variations'\nimport { PairdrawAPI } from '#core/pairdraw-api'\nimport { normalizeLinkURL } from '#core/text/hyperlink'\nimport { collectNodeFontFaces } from '#core/text/requirements/collect'\nimport {\n parseOptionalToolColor,\n toolNumber,\n nodeIdInputSchema,\n defineTool,\n nodeNotFound,\n toolFailure\n} from '#core/tools/schema'\n\n/**\n * A link a text tool sets, as the editor's link field takes it: a web or mail address, with\n * `https:` or `mailto:` added when typed without a scheme. Null or blank removes the link.\n */\nconst hyperlinkInputSchema = v.optional(\n v.pipe(\n v.nullable(v.string()),\n v.description(\n 'Link the text opens: an http(s) or mailto address (\"example.com\" becomes https://example.com, \"hi@example.com\" becomes mailto:). null or \"\" removes the link. Links are not underlined automatically; set text_decoration for that.'\n )\n )\n)\n\n/**\n * A scheme at the start of a typed link, even with a digit after its colon (`tel:123`), unless it\n * reads as a host and port (`localhost:3000`, `example.com:8080`), which gets `https://`.\n */\nconst TYPED_SCHEME = /^([a-z][a-z\\d+.-]*):/i\n\n/** A web address in the form the Figma API's link setter takes: `http(s)://host…`. */\nconst WEB_URL = /^https?:\\/\\/[^\\s/?#]+\\S*$/\n\n/** Whether a typed link names a scheme other than the http, https, and mailto links take. */\nfunction hasForeignScheme(typed: string): boolean {\n const scheme = TYPED_SCHEME.exec(typed)?.[1]?.toLowerCase()\n if (!scheme || scheme.includes('.') || scheme === 'localhost') return false\n return !['http', 'https', 'mailto'].includes(scheme)\n}\n\n/** What setting `hyperlink` asks for: no change, a removal, a URL, or an address it refuses. */\nfunction requestedHyperlink(\n hyperlink: string | null | undefined\n): { link: { type: 'URL'; value: string } | null } | { error: string } | null {\n if (hyperlink === undefined) return null\n if (hyperlink === null || hyperlink.trim() === '') return { link: null }\n const url = hasForeignScheme(hyperlink.trim()) ? null : normalizeLinkURL(hyperlink)\n if (!url) {\n return {\n error: `\"${hyperlink}\" is not a link the editor opens: use an http, https, or mailto address`\n }\n }\n // Figma keeps schemes in lower case and web addresses as `scheme://host`, so a loosely typed\n // `http:example.com` is written as the URL it parses to.\n const lowered = url.replace(TYPED_SCHEME, (scheme) => scheme.toLowerCase())\n const value =\n lowered.startsWith('mailto:') || WEB_URL.test(lowered) ? lowered : new URL(lowered).href\n return { link: { type: 'URL', value } }\n}\n\n/** The fonts a text layer uses, which an edit that lays it out again needs loaded. */\nexport function textFonts(figma: FigmaAPI, id: string): FigmaFontNameInput[] {\n const node = figma.graph.getNode(id)\n return node ? collectNodeFontFaces(node) : []\n}\n\nexport const setText = defineTool({\n name: 'set_text',\n\n description: 'Set text content of a text node.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n text: v.pipe(v.string(), v.description('Text content'))\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, { id, text }) => {\n const node = figma.getNodeById(id)\n if (!node) return { error: `Node \"${id}\" not found` }\n node.characters = text\n return { id, text }\n }\n})\n\n/** Variable font axes a font tool can set, as Figma's `variationSettings`. */\n// An object with a value for every key rather than a record: a record publishes `propertyNames`,\n// which OpenAI refuses, and a JSON object's keys are strings anyway.\nconst variationsInputSchema = v.optional(\n v.pipe(\n v.objectWithRest({}, v.number()),\n v.description(\n 'Variable font axis values by OpenType tag (e.g. {\"wght\": 550, \"wdth\": 75}); axes left out keep the style\\'s values. Without a style, the nearest named style is picked.'\n )\n )\n)\n\n/** OpenType features a text tool sets, by tag; tags left out keep their state. */\nconst fontFeaturesInputSchema = v.optional(\n v.pipe(\n v.objectWithRest({}, v.boolean()),\n v.description(\n 'OpenType feature toggles by four-letter tag (e.g. {\"TNUM\": true, \"LIGA\": false, \"SS02\": true}); tags left out keep their state. Only features the font has take effect.'\n )\n )\n)\n\n/** Why a feature map cannot apply: a tag is not four letters, or a value is not a boolean. */\nfunction badFeatureEntry(features: Record<string, boolean> | undefined): { error: string } | null {\n for (const [tag, enabled] of Object.entries(features ?? {})) {\n if (tag.length !== 4) return { error: `\"${tag}\" is not a four-letter OpenType feature tag` }\n if (typeof enabled !== 'boolean') {\n return { error: `Feature \"${tag}\" needs a boolean value, received ${typeof enabled}` }\n }\n }\n return null\n}\n\n/**\n * The font a font tool gives text: what it names, the rest from `current`. Axes without a style\n * leave the style out, for the nearest named style to be picked.\n */\nfunction fontNameInput(\n args: { family?: string; style?: string; variations?: FigmaVariationSettings },\n current: FigmaFontName | null\n): FigmaFontNameInput {\n return {\n family: args.family ?? current?.family ?? '',\n style: args.style ?? (args.variations ? undefined : (current?.style ?? 'Regular')),\n variationSettings: args.variations\n }\n}\n\n/**\n * The font `set_font` gives the text, or null when it keeps the text's. Text set in several fonts\n * takes the given family or style for all of it, keeping the rest from its first character. Axes\n * without a style are set per range, each range taking its nearest named style, as in Figma.\n */\nfunction requestedFont(\n node: FigmaNodeProxy,\n args: { family?: string; style?: string; variations?: FigmaVariationSettings }\n): { whole: FigmaFontName } | { perRange: FigmaFontNameInput } | null {\n if (!args.family && !args.style && !args.variations) return null\n const fontName =\n typeof node.fontName === 'symbol' && node.characters.length > 0\n ? node.getRangeFontName(0, 1)\n : node.fontName\n const current = typeof fontName === 'symbol' ? null : fontName\n const family = args.family ?? current?.family ?? ''\n if (args.variations && !args.style && node.characters.length > 0) {\n return { perRange: { family, variationSettings: args.variations } }\n }\n const style = args.style ?? current?.style ?? 'Regular'\n return { whole: { family, style, variationSettings: args.variations } }\n}\n\nexport const setFont = defineTool({\n name: 'set_font',\n\n description: 'Set font properties of a text node.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n family: v.optional(v.pipe(v.string(), v.description('Font family name'))),\n size: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.description('Font size')))),\n style: v.optional(\n v.pipe(v.string(), v.description('Font style (e.g. \"Bold\", \"Regular\", \"Bold Italic\")'))\n ),\n variations: variationsInputSchema\n }),\n // A new font replaces the text's, which then need not be loaded, so a missing font can be\n // replaced; a size or per-range axes lay out the text in its own fonts.\n fonts: (figma, args) => {\n const node = figma.getNodeById(args.id)\n const font = node && requestedFont(node, args)\n if (font && 'whole' in font) return [font.whole]\n return [...(font ? [font.perRange] : []), ...textFonts(figma, args.id)]\n },\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n const badTag = badVariationTag(args.variations)\n if (badTag) return badTag\n const font = requestedFont(node, args)\n try {\n if (font && 'whole' in font) node.fontName = font.whole\n else if (font) node.setRangeFontName(0, node.characters.length, font.perRange)\n // The size comes after the font, so it lays the text out in the font it ends up in.\n if (args.size !== undefined) node.fontSize = args.size\n } catch (error) {\n return toolFailure(error)\n }\n return { id: args.id, fontName: node.fontName, fontSize: node.fontSize }\n }\n})\n\n/** The font `set_font_range` gives its range: what it names, the rest from the range's start. */\nfunction rangeFont(\n node: FigmaNodeProxy,\n args: { start: number; family?: string; style?: string; variations?: FigmaVariationSettings }\n): FigmaFontNameInput {\n const inText = args.start < node.characters.length\n const current = inText ? node.getRangeFontName(args.start, args.start + 1) : node.fontName\n return fontNameInput(args, typeof current === 'symbol' ? null : current)\n}\n\ntype RangeEdit = {\n hyperlink: { link: { type: 'URL'; value: string } | null } | null\n color: Color | undefined\n}\n\n/** Why a variation setting cannot apply: an axis tag is not four letters. */\nfunction badVariationTag(variations: FigmaVariationSettings | undefined): { error: string } | null {\n const tag = Object.keys(variations ?? {}).find((key) => key.length !== 4)\n return tag === undefined ? null : { error: `\"${tag}\" is not a four-letter OpenType axis tag` }\n}\n\n/** What a range edit sets, or why it cannot run: nothing named, a bad colour, or a bad link. */\nfunction rangeEdit(args: {\n family?: string\n size?: number\n style?: string\n variations?: unknown\n font_features?: Record<string, boolean>\n color?: string\n hyperlink?: string | null\n}): RangeEdit | { error: string } {\n if (\n !args.family &&\n !args.size &&\n !args.style &&\n !args.variations &&\n !args.font_features &&\n !args.color &&\n args.hyperlink === undefined\n ) {\n return {\n error:\n 'set_font_range needs at least one of family, size, style, variations, font_features, color, or hyperlink'\n }\n }\n const hyperlink = requestedHyperlink(args.hyperlink)\n if (hyperlink && 'error' in hyperlink) return hyperlink\n const color = parseOptionalToolColor(args.color)\n if ('error' in color) return color\n return { hyperlink: hyperlink ?? null, color: color.color }\n}\n\nexport const setFontRange = defineTool({\n name: 'set_font_range',\n\n description: 'Set font properties, OpenType features, color, or a link for a text range.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n start: toolNumber(v.pipe(v.number(), v.minValue(0), v.description('Start character index'))),\n end: toolNumber(v.pipe(v.number(), v.minValue(0), v.description('End character index'))),\n family: v.optional(v.pipe(v.string(), v.description('Font family name'))),\n size: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.description('Font size')))),\n style: v.optional(v.pipe(v.string(), v.description('Font style'))),\n variations: variationsInputSchema,\n font_features: fontFeaturesInputSchema,\n color: v.optional(v.pipe(v.string(), v.description('Text color (hex)'))),\n hyperlink: hyperlinkInputSchema\n }),\n fonts: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return []\n const font = args.family || args.style || args.variations ? rangeFont(node, args) : null\n // A colour alone is a paint and lays nothing out, so text in a missing font can still take it.\n // Features reshape glyphs, so they need the text's fonts as a size change does.\n const laysOut = font !== null || args.size !== undefined || args.font_features !== undefined\n return [...(font ? [font] : []), ...(laysOut ? textFonts(figma, args.id) : [])]\n },\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n const { start, end } = args\n const badTag = badVariationTag(args.variations)\n if (badTag) return badTag\n const badFeature = badFeatureEntry(args.font_features)\n if (badFeature) return badFeature\n const edit = rangeEdit(args)\n if ('error' in edit) return edit\n const { hyperlink, color } = edit\n // The range methods reject an empty range or one past the text, before changing anything.\n try {\n if (args.size) node.setRangeFontSize(start, end, args.size)\n if (args.family || args.style || args.variations) {\n node.setRangeFontName(start, end, rangeFont(node, args))\n }\n if (color) node.setRangeFills(start, end, [{ type: 'SOLID', color }])\n if (hyperlink) node.setRangeHyperlink(start, end, hyperlink.link)\n if (args.font_features) {\n new PairdrawAPI(figma).setRangeFontFeatures(node, start, end, args.font_features)\n }\n } catch (error) {\n return toolFailure(error)\n }\n return {\n id: args.id,\n range: { start, end },\n ...(hyperlink ? { hyperlink: hyperlink.link?.value ?? null } : {})\n }\n }\n})\n\nexport const setTextResize = defineTool({\n name: 'set_text_resize',\n\n description: 'Set text auto-resize mode.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n mode: v.pipe(\n v.picklist(['NONE', 'WIDTH_AND_HEIGHT', 'HEIGHT', 'TRUNCATE']),\n v.description('Resize mode')\n )\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, { id, mode }) => {\n const node = figma.getNodeById(id)\n if (!node) return { error: `Node \"${id}\" not found` }\n node.textAutoResize = mode\n return { id, textAutoResize: mode }\n }\n})\n\nexport const setTextProperties = defineTool({\n name: 'set_text_properties',\n\n description:\n 'Set text layout properties: alignment, auto-resize, text case, decoration, truncation, OpenType features, and a link for the whole text.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: v.pipe(v.string(), v.description('Text node ID')),\n align_horizontal: v.optional(\n v.pipe(\n v.picklist(['LEFT', 'CENTER', 'RIGHT', 'JUSTIFIED']),\n v.description('Horizontal text alignment')\n )\n ),\n align_vertical: v.optional(\n v.pipe(v.picklist(['TOP', 'CENTER', 'BOTTOM']), v.description('Vertical text alignment'))\n ),\n auto_resize: v.optional(\n v.pipe(\n v.picklist(['NONE', 'WIDTH_AND_HEIGHT', 'HEIGHT', 'TRUNCATE']),\n v.description('Text auto-resize mode')\n )\n ),\n direction: v.optional(\n v.pipe(v.picklist(['AUTO', 'LTR', 'RTL']), v.description('Text direction'))\n ),\n text_decoration: v.optional(\n v.pipe(v.picklist(['NONE', 'UNDERLINE', 'STRIKETHROUGH']), v.description('Text decoration'))\n ),\n hyperlink: hyperlinkInputSchema,\n font_features: fontFeaturesInputSchema\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n if (node.type !== 'TEXT') return { error: `Node \"${args.id}\" is not a TEXT node` }\n // Refused before anything changes, so a bad address leaves the text as it was.\n const hyperlink = requestedHyperlink(args.hyperlink)\n if (hyperlink && 'error' in hyperlink) return hyperlink\n const badFeature = badFeatureEntry(args.font_features)\n if (badFeature) return badFeature\n const updated: string[] = []\n if (args.align_horizontal !== undefined) {\n node.textAlignHorizontal = args.align_horizontal\n updated.push('textAlignHorizontal')\n }\n if (args.align_vertical !== undefined) {\n node.textAlignVertical = args.align_vertical\n updated.push('textAlignVertical')\n }\n if (args.auto_resize !== undefined) {\n node.textAutoResize = args.auto_resize\n updated.push('textAutoResize')\n }\n if (args.direction !== undefined) {\n new PairdrawAPI(figma).setTextDirection(node, args.direction)\n updated.push('textDirection')\n }\n if (args.text_decoration !== undefined) {\n node.textDecoration = args.text_decoration\n updated.push('textDecoration')\n }\n if (args.font_features) {\n new PairdrawAPI(figma).setFontFeatures(node, args.font_features)\n updated.push('fontFeatures')\n }\n if (hyperlink) {\n try {\n node.hyperlink = hyperlink.link\n } catch (error) {\n return toolFailure(error)\n }\n updated.push('hyperlink')\n }\n return { id: args.id, updated }\n }\n})\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,uBAAuB,EAAE,SAC7B,EAAE,KACA,EAAE,SAAS,EAAE,OAAO,CAAC,GACrB,EAAE,YACA,2OACF,CACF,CACF;;;;;AAMA,MAAM,eAAe;;AAGrB,MAAM,UAAU;;AAGhB,SAAS,iBAAiB,OAAwB;CAChD,MAAM,SAAS,aAAa,KAAK,KAAK,CAAC,GAAG,EAAE,EAAE,YAAY;CAC1D,IAAI,CAAC,UAAU,OAAO,SAAS,GAAG,KAAK,WAAW,aAAa,OAAO;CACtE,OAAO,CAAC;EAAC;EAAQ;EAAS;CAAQ,CAAC,CAAC,SAAS,MAAM;AACrD;;AAGA,SAAS,mBACP,WAC4E;CAC5E,IAAI,cAAc,KAAA,GAAW,OAAO;CACpC,IAAI,cAAc,QAAQ,UAAU,KAAK,MAAM,IAAI,OAAO,EAAE,MAAM,KAAK;CACvE,MAAM,MAAM,iBAAiB,UAAU,KAAK,CAAC,IAAI,OAAO,iBAAiB,SAAS;CAClF,IAAI,CAAC,KACH,OAAO,EACL,OAAO,IAAI,UAAU,yEACvB;CAIF,MAAM,UAAU,IAAI,QAAQ,eAAe,WAAW,OAAO,YAAY,CAAC;CAG1E,OAAO,EAAE,MAAM;EAAE,MAAM;EAAO,OAD5B,QAAQ,WAAW,SAAS,KAAK,QAAQ,KAAK,OAAO,IAAI,UAAU,IAAI,IAAI,OAAO,CAAC,CAAC;CAClD,EAAE;AACxC;;AAGA,SAAgB,UAAU,OAAiB,IAAkC;CAC3E,MAAM,OAAO,MAAM,MAAM,QAAQ,EAAE;CACnC,OAAO,OAAO,qBAAqB,IAAI,IAAI,CAAC;AAC9C;AAEA,MAAa,UAAU,WAAW;CAChC,MAAM;CAEN,aAAa;CACb,WAAW;EAAE,MAAM;EAAQ,UAAU;CAAa;CA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AAgB,KAAK,aAAa;EACrD,IAAI,YAAY,OAAO;EACvB,MAAM,UAAoB,CAAC;EAC3B,IAAI,KAAK,qBAAqB,KAAA,GAAW;GACvC,KAAK,sBAAsB,KAAK;GAChC,QAAQ,KAAK,qBAAqB;EACpC;EACA,IAAI,KAAK,mBAAmB,KAAA,GAAW;GACrC,KAAK,oBAAoB,KAAK;GAC9B,QAAQ,KAAK,mBAAmB;EAClC;EACA,IAAI,KAAK,gBAAgB,KAAA,GAAW;GAClC,KAAK,iBAAiB,KAAK;GAC3B,QAAQ,KAAK,gBAAgB;EAC/B;EACA,IAAI,KAAK,cAAc,KAAA,GAAW;GAChC,IAAI,YAAY,KAAK,CAAC,CAAC,iBAAiB,MAAM,KAAK,SAAS;GAC5D,QAAQ,KAAK,eAAe;EAC9B;EACA,IAAI,KAAK,oBAAoB,KAAA,GAAW;GACtC,KAAK,iBAAiB,KAAK;GAC3B,QAAQ,KAAK,gBAAgB;EAC/B;EACA,IAAI,KAAK,eAAe;GACtB,IAAI,YAAY,KAAK,CAAC,CAAC,gBAAgB,MAAM,KAAK,aAAa;GAC/D,QAAQ,KAAK,cAAc;EAC7B;EACA,IAAI,WAAW;GACb,IAAI;IACF,KAAK,YAAY,UAAU;GAC7B,SAAS,OAAO;IACd,OAAO,YAAY,KAAK;GAC1B;GACA,QAAQ,KAAK,WAAW;EAC1B;EACA,OAAO;GAAE,IAAI,KAAK;GAAI;EAAQ;CAChC;AACF,CAAC"}
1
+ {"version":3,"file":"text.js","names":[],"sources":["../../../src/tools/modify/text.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { DocumentColorSpace } from '@pairdraw/scene-graph'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'\nimport type { FigmaFontName, FigmaFontNameInput } from '#core/figma-api/fonts/names'\nimport type { FigmaVariationSettings } from '#core/figma-api/fonts/variations'\nimport { PairdrawAPI } from '#core/pairdraw-api'\nimport { normalizeLinkURL } from '#core/text/hyperlink'\nimport { collectNodeFontFaces } from '#core/text/requirements/collect'\nimport {\n parseOptionalToolColor,\n toolNumber,\n nodeIdInputSchema,\n defineTool,\n nodeNotFound,\n toolFailure\n} from '#core/tools/schema'\n\n/**\n * A link a text tool sets, as the editor's link field takes it: a web or mail address, with\n * `https:` or `mailto:` added when typed without a scheme. Null or blank removes the link.\n */\nconst hyperlinkInputSchema = v.optional(\n v.pipe(\n v.nullable(v.string()),\n v.description(\n 'Link the text opens: an http(s) or mailto address (\"example.com\" becomes https://example.com, \"hi@example.com\" becomes mailto:). null or \"\" removes the link. Links are not underlined automatically; set text_decoration for that.'\n )\n )\n)\n\n/**\n * A scheme at the start of a typed link, even with a digit after its colon (`tel:123`), unless it\n * reads as a host and port (`localhost:3000`, `example.com:8080`), which gets `https://`.\n */\nconst TYPED_SCHEME = /^([a-z][a-z\\d+.-]*):/i\n\n/** A web address in the form the Figma API's link setter takes: `http(s)://host…`. */\nconst WEB_URL = /^https?:\\/\\/[^\\s/?#]+\\S*$/\n\n/** Whether a typed link names a scheme other than the http, https, and mailto links take. */\nfunction hasForeignScheme(typed: string): boolean {\n const scheme = TYPED_SCHEME.exec(typed)?.[1]?.toLowerCase()\n if (!scheme || scheme.includes('.') || scheme === 'localhost') return false\n return !['http', 'https', 'mailto'].includes(scheme)\n}\n\n/** What setting `hyperlink` asks for: no change, a removal, a URL, or an address it refuses. */\nfunction requestedHyperlink(\n hyperlink: string | null | undefined\n): { link: { type: 'URL'; value: string } | null } | { error: string } | null {\n if (hyperlink === undefined) return null\n if (hyperlink === null || hyperlink.trim() === '') return { link: null }\n const url = hasForeignScheme(hyperlink.trim()) ? null : normalizeLinkURL(hyperlink)\n if (!url) {\n return {\n error: `\"${hyperlink}\" is not a link the editor opens: use an http, https, or mailto address`\n }\n }\n // Figma keeps schemes in lower case and web addresses as `scheme://host`, so a loosely typed\n // `http:example.com` is written as the URL it parses to.\n const lowered = url.replace(TYPED_SCHEME, (scheme) => scheme.toLowerCase())\n const value =\n lowered.startsWith('mailto:') || WEB_URL.test(lowered) ? lowered : new URL(lowered).href\n return { link: { type: 'URL', value } }\n}\n\n/** The fonts a text layer uses, which an edit that lays it out again needs loaded. */\nexport function textFonts(figma: FigmaAPI, id: string): FigmaFontNameInput[] {\n const node = figma.graph.getNode(id)\n return node ? collectNodeFontFaces(node) : []\n}\n\nexport const setText = defineTool({\n name: 'set_text',\n\n description: 'Set text content of a text node.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n text: v.pipe(v.string(), v.description('Text content'))\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, { id, text }) => {\n const node = figma.getNodeById(id)\n if (!node) return { error: `Node \"${id}\" not found` }\n node.characters = text\n return { id, text }\n }\n})\n\n/** Variable font axes a font tool can set, as Figma's `variationSettings`. */\n// An object with a value for every key rather than a record: a record publishes `propertyNames`,\n// which OpenAI refuses, and a JSON object's keys are strings anyway.\nconst variationsInputSchema = v.optional(\n v.pipe(\n v.objectWithRest({}, v.number()),\n v.description(\n 'Variable font axis values by OpenType tag (e.g. {\"wght\": 550, \"wdth\": 75}); axes left out keep the style\\'s values. Without a style, the nearest named style is picked.'\n )\n )\n)\n\n/** OpenType features a text tool sets, by tag; tags left out keep their state. */\nconst fontFeaturesInputSchema = v.optional(\n v.pipe(\n v.objectWithRest({}, v.boolean()),\n v.description(\n 'OpenType feature toggles by four-letter tag (e.g. {\"TNUM\": true, \"LIGA\": false, \"SS02\": true}); tags left out keep their state. Only features the font has take effect.'\n )\n )\n)\n\n/** Why a feature map cannot apply: a tag is not four letters, or a value is not a boolean. */\nfunction badFeatureEntry(features: Record<string, boolean> | undefined): { error: string } | null {\n for (const [tag, enabled] of Object.entries(features ?? {})) {\n if (tag.length !== 4) return { error: `\"${tag}\" is not a four-letter OpenType feature tag` }\n if (typeof enabled !== 'boolean') {\n return { error: `Feature \"${tag}\" needs a boolean value, received ${typeof enabled}` }\n }\n }\n return null\n}\n\n/**\n * The font a font tool gives text: what it names, the rest from `current`. Axes without a style\n * leave the style out, for the nearest named style to be picked.\n */\nfunction fontNameInput(\n args: { family?: string; style?: string; variations?: FigmaVariationSettings },\n current: FigmaFontName | null\n): FigmaFontNameInput {\n return {\n family: args.family ?? current?.family ?? '',\n style: args.style ?? (args.variations ? undefined : (current?.style ?? 'Regular')),\n variationSettings: args.variations\n }\n}\n\n/**\n * The font `set_font` gives the text, or null when it keeps the text's. Text set in several fonts\n * takes the given family or style for all of it, keeping the rest from its first character. Axes\n * without a style are set per range, each range taking its nearest named style, as in Figma.\n */\nfunction requestedFont(\n node: FigmaNodeProxy,\n args: { family?: string; style?: string; variations?: FigmaVariationSettings }\n): { whole: FigmaFontName } | { perRange: FigmaFontNameInput } | null {\n if (!args.family && !args.style && !args.variations) return null\n const fontName =\n typeof node.fontName === 'symbol' && node.characters.length > 0\n ? node.getRangeFontName(0, 1)\n : node.fontName\n const current = typeof fontName === 'symbol' ? null : fontName\n const family = args.family ?? current?.family ?? ''\n if (args.variations && !args.style && node.characters.length > 0) {\n return { perRange: { family, variationSettings: args.variations } }\n }\n const style = args.style ?? current?.style ?? 'Regular'\n return { whole: { family, style, variationSettings: args.variations } }\n}\n\nexport const setFont = defineTool({\n name: 'set_font',\n\n description: 'Set font properties of a text node.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n family: v.optional(v.pipe(v.string(), v.description('Font family name'))),\n size: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.description('Font size')))),\n style: v.optional(\n v.pipe(v.string(), v.description('Font style (e.g. \"Bold\", \"Regular\", \"Bold Italic\")'))\n ),\n variations: variationsInputSchema\n }),\n // A new font replaces the text's, which then need not be loaded, so a missing font can be\n // replaced; a size or per-range axes lay out the text in its own fonts.\n fonts: (figma, args) => {\n const node = figma.getNodeById(args.id)\n const font = node && requestedFont(node, args)\n if (font && 'whole' in font) return [font.whole]\n return [...(font ? [font.perRange] : []), ...textFonts(figma, args.id)]\n },\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n const badTag = badVariationTag(args.variations)\n if (badTag) return badTag\n const font = requestedFont(node, args)\n try {\n if (font && 'whole' in font) node.fontName = font.whole\n else if (font) node.setRangeFontName(0, node.characters.length, font.perRange)\n // The size comes after the font, so it lays the text out in the font it ends up in.\n if (args.size !== undefined) node.fontSize = args.size\n } catch (error) {\n return toolFailure(error)\n }\n return { id: args.id, fontName: node.fontName, fontSize: node.fontSize }\n }\n})\n\n/** The font `set_font_range` gives its range: what it names, the rest from the range's start. */\nfunction rangeFont(\n node: FigmaNodeProxy,\n args: { start: number; family?: string; style?: string; variations?: FigmaVariationSettings }\n): FigmaFontNameInput {\n const inText = args.start < node.characters.length\n const current = inText ? node.getRangeFontName(args.start, args.start + 1) : node.fontName\n return fontNameInput(args, typeof current === 'symbol' ? null : current)\n}\n\ntype RangeEdit = {\n hyperlink: { link: { type: 'URL'; value: string } | null } | null\n color: Color | undefined\n}\n\n/** Why a variation setting cannot apply: an axis tag is not four letters. */\nfunction badVariationTag(variations: FigmaVariationSettings | undefined): { error: string } | null {\n const tag = Object.keys(variations ?? {}).find((key) => key.length !== 4)\n return tag === undefined ? null : { error: `\"${tag}\" is not a four-letter OpenType axis tag` }\n}\n\n/** What a range edit sets, or why it cannot run: nothing named, a bad colour, or a bad link. */\nfunction rangeEdit(\n args: {\n family?: string\n size?: number\n style?: string\n variations?: unknown\n font_features?: Record<string, boolean>\n color?: string\n hyperlink?: string | null\n },\n profile: DocumentColorSpace\n): RangeEdit | { error: string } {\n if (\n !args.family &&\n !args.size &&\n !args.style &&\n !args.variations &&\n !args.font_features &&\n !args.color &&\n args.hyperlink === undefined\n ) {\n return {\n error:\n 'set_font_range needs at least one of family, size, style, variations, font_features, color, or hyperlink'\n }\n }\n const hyperlink = requestedHyperlink(args.hyperlink)\n if (hyperlink && 'error' in hyperlink) return hyperlink\n const color = parseOptionalToolColor(args.color, profile)\n if ('error' in color) return color\n return { hyperlink: hyperlink ?? null, color: color.color }\n}\n\nexport const setFontRange = defineTool({\n name: 'set_font_range',\n\n description: 'Set font properties, OpenType features, color, or a link for a text range.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n start: toolNumber(v.pipe(v.number(), v.minValue(0), v.description('Start character index'))),\n end: toolNumber(v.pipe(v.number(), v.minValue(0), v.description('End character index'))),\n family: v.optional(v.pipe(v.string(), v.description('Font family name'))),\n size: v.optional(toolNumber(v.pipe(v.number(), v.minValue(1), v.description('Font size')))),\n style: v.optional(v.pipe(v.string(), v.description('Font style'))),\n variations: variationsInputSchema,\n font_features: fontFeaturesInputSchema,\n color: v.optional(v.pipe(v.string(), v.description('Text color (hex)'))),\n hyperlink: hyperlinkInputSchema\n }),\n fonts: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return []\n const font = args.family || args.style || args.variations ? rangeFont(node, args) : null\n // A colour alone is a paint and lays nothing out, so text in a missing font can still take it.\n // Features reshape glyphs, so they need the text's fonts as a size change does.\n const laysOut = font !== null || args.size !== undefined || args.font_features !== undefined\n return [...(font ? [font] : []), ...(laysOut ? textFonts(figma, args.id) : [])]\n },\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n const { start, end } = args\n const badTag = badVariationTag(args.variations)\n if (badTag) return badTag\n const badFeature = badFeatureEntry(args.font_features)\n if (badFeature) return badFeature\n const edit = rangeEdit(args, figma.graph.documentColorSpace)\n if ('error' in edit) return edit\n const { hyperlink, color } = edit\n // The range methods reject an empty range or one past the text, before changing anything.\n try {\n if (args.size) node.setRangeFontSize(start, end, args.size)\n if (args.family || args.style || args.variations) {\n node.setRangeFontName(start, end, rangeFont(node, args))\n }\n if (color) node.setRangeFills(start, end, [{ type: 'SOLID', color }])\n if (hyperlink) node.setRangeHyperlink(start, end, hyperlink.link)\n if (args.font_features) {\n new PairdrawAPI(figma).setRangeFontFeatures(node, start, end, args.font_features)\n }\n } catch (error) {\n return toolFailure(error)\n }\n return {\n id: args.id,\n range: { start, end },\n ...(hyperlink ? { hyperlink: hyperlink.link?.value ?? null } : {})\n }\n }\n})\n\nexport const setTextResize = defineTool({\n name: 'set_text_resize',\n\n description: 'Set text auto-resize mode.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: nodeIdInputSchema,\n mode: v.pipe(\n v.picklist(['NONE', 'WIDTH_AND_HEIGHT', 'HEIGHT', 'TRUNCATE']),\n v.description('Resize mode')\n )\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, { id, mode }) => {\n const node = figma.getNodeById(id)\n if (!node) return { error: `Node \"${id}\" not found` }\n node.textAutoResize = mode\n return { id, textAutoResize: mode }\n }\n})\n\nexport const setTextProperties = defineTool({\n name: 'set_text_properties',\n\n description:\n 'Set text layout properties: alignment, auto-resize, text case, decoration, truncation, OpenType features, and a link for the whole text.',\n execution: { kind: 'sync', mutation: 'properties' },\n input: v.strictObject({\n id: v.pipe(v.string(), v.description('Text node ID')),\n align_horizontal: v.optional(\n v.pipe(\n v.picklist(['LEFT', 'CENTER', 'RIGHT', 'JUSTIFIED']),\n v.description('Horizontal text alignment')\n )\n ),\n align_vertical: v.optional(\n v.pipe(v.picklist(['TOP', 'CENTER', 'BOTTOM']), v.description('Vertical text alignment'))\n ),\n auto_resize: v.optional(\n v.pipe(\n v.picklist(['NONE', 'WIDTH_AND_HEIGHT', 'HEIGHT', 'TRUNCATE']),\n v.description('Text auto-resize mode')\n )\n ),\n direction: v.optional(\n v.pipe(v.picklist(['AUTO', 'LTR', 'RTL']), v.description('Text direction'))\n ),\n text_decoration: v.optional(\n v.pipe(v.picklist(['NONE', 'UNDERLINE', 'STRIKETHROUGH']), v.description('Text decoration'))\n ),\n hyperlink: hyperlinkInputSchema,\n font_features: fontFeaturesInputSchema\n }),\n fonts: (figma, { id }) => textFonts(figma, id),\n execute: (figma, args) => {\n const node = figma.getNodeById(args.id)\n if (!node) return nodeNotFound(args.id)\n if (node.type !== 'TEXT') return { error: `Node \"${args.id}\" is not a TEXT node` }\n // Refused before anything changes, so a bad address leaves the text as it was.\n const hyperlink = requestedHyperlink(args.hyperlink)\n if (hyperlink && 'error' in hyperlink) return hyperlink\n const badFeature = badFeatureEntry(args.font_features)\n if (badFeature) return badFeature\n const updated: string[] = []\n if (args.align_horizontal !== undefined) {\n node.textAlignHorizontal = args.align_horizontal\n updated.push('textAlignHorizontal')\n }\n if (args.align_vertical !== undefined) {\n node.textAlignVertical = args.align_vertical\n updated.push('textAlignVertical')\n }\n if (args.auto_resize !== undefined) {\n node.textAutoResize = args.auto_resize\n updated.push('textAutoResize')\n }\n if (args.direction !== undefined) {\n new PairdrawAPI(figma).setTextDirection(node, args.direction)\n updated.push('textDirection')\n }\n if (args.text_decoration !== undefined) {\n node.textDecoration = args.text_decoration\n updated.push('textDecoration')\n }\n if (args.font_features) {\n new PairdrawAPI(figma).setFontFeatures(node, args.font_features)\n updated.push('fontFeatures')\n }\n if (hyperlink) {\n try {\n node.hyperlink = hyperlink.link\n } catch (error) {\n return toolFailure(error)\n }\n updated.push('hyperlink')\n }\n return { id: args.id, updated }\n }\n})\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,uBAAuB,EAAE,SAC7B,EAAE,KACA,EAAE,SAAS,EAAE,OAAO,CAAC,GACrB,EAAE,YACA,2OACF,CACF,CACF;;;;;AAMA,MAAM,eAAe;;AAGrB,MAAM,UAAU;;AAGhB,SAAS,iBAAiB,OAAwB;CAChD,MAAM,SAAS,aAAa,KAAK,KAAK,CAAC,GAAG,EAAE,EAAE,YAAY;CAC1D,IAAI,CAAC,UAAU,OAAO,SAAS,GAAG,KAAK,WAAW,aAAa,OAAO;CACtE,OAAO,CAAC;EAAC;EAAQ;EAAS;CAAQ,CAAC,CAAC,SAAS,MAAM;AACrD;;AAGA,SAAS,mBACP,WAC4E;CAC5E,IAAI,cA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ACtC,KAAK,iBAAiB,KAAK;GAC3B,QAAQ,KAAK,gBAAgB;EAC/B;EACA,IAAI,KAAK,eAAe;GACtB,IAAI,YAAY,KAAK,CAAC,CAAC,gBAAgB,MAAM,KAAK,aAAa;GAC/D,QAAQ,KAAK,cAAc;EAC7B;EACA,IAAI,WAAW;GACb,IAAI;IACF,KAAK,YAAY,UAAU;GAC7B,SAAS,OAAO;IACd,OAAO,YAAY,KAAK;GAC1B;GACA,QAAQ,KAAK,WAAW;EAC1B;EACA,OAAO;GAAE,IAAI,KAAK;GAAI;EAAQ;CAChC;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/tools/prompts/codegen.md?raw
2
- var codegen_default = "# Design to Code\n\nYou convert Figma designs into production frontend code. You have full access to the design document through tools. Never guess — always read the actual design data.\n\n> Note: Auto-layout and visual property names match the JSX props in the render system. See `describe` tool output for semantic role and layout analysis of any node.\n\n## Workflow\n\n### Step 1 — Survey\n\nUnderstand the full picture before writing any code.\n\n```\nget_page_tree → document structure, all top-level frames\nget_components → reusable components defined by the designer\nlist_variables → design tokens (colors, numbers, strings, booleans)\nlist_collections → variable collections and modes (light/dark, density, etc.)\nanalyze_colors → color palette, frequencies, which colors use variables\nanalyze_typography → font stacks, sizes, weights in use\nanalyze_spacing → gap and padding values, grid compliance\n```\n\nAfter this step you should know:\n\n- How many screens/pages the design has\n- What components exist\n- What the token system looks like (or if there is none)\n- The typographic scale\n- The spacing system (4px grid? 8px grid? irregular?)\n\n### Step 2 — Decompose\n\nIdentify the component architecture.\n\n```\nanalyze_clusters → find repeated visual patterns that should be components\ndescribe (per node) → semantic role, layout direction, visual properties, issues\nget_jsx (per node) → structural JSX to understand nesting and layout\n```\n\nBuild a component map:\n\n- **Screens** — top-level frames that represent pages/views\n- **Components** — COMPONENT/COMPONENT_SET nodes or repeated patterns from analyze_clusters\n- **Primitives** — leaf elements (text, icons, dividers) that don't need their own component file\n\nFor each component determine:\n\n- **Props** — what content varies between instances (text, color, icon, visibility)\n- **Variants** — if the component has multiple states (default/hover/active, small/medium/large)\n- **Slots** — where child content is injected\n- **Behaviour** — `get_behaviour id=<component_id>` tells whether the designer made it a control, after Reka UI's primitives. Build such a component on that Reka primitive (`SwitchRoot` with `SwitchThumb`, `SliderRoot` with `SliderTrack`, `SliderRange`, and `SliderThumb`, `TabsRoot` with `TabsList`, `TabsTrigger`, and `TabsContent`, …): each part is the slot the behaviour names, its values are the properties it binds (`v-model` for the value, `disabled`), and its interaction states map to the variants for `data-state`, `:hover`, `:active`, `:focus-visible`, and `[data-disabled]`. Do not reimplement the control's keyboard and accessibility handling. In React use the Radix primitive with the same parts (Reka UI is the Vue port of Radix), and with a component library use its equivalent; see **Component libraries** below.\n\n### Step 3 — Extract tokens\n\n```\nlist_variables → all variables with values per mode\nlist_collections → collection structure and mode names\n```\n\nMap design variables to code tokens. The approach depends on the target stack:\n\n#### Tailwind projects\n\nDo NOT create CSS custom properties for font sizes, font weights, spacing, or border radius — Tailwind has its own system for these. Use Tailwind utility classes directly:\n\n- Font sizes → `text-[13px]`, `text-sm`, `text-base`, etc.\n- Font weights → `font-bold`, `font-medium`, `font-[600]`\n- Spacing → `gap-3`, `p-4`, `px-5`, `py-[14px]`, or arbitrary `gap-[12px]`\n- Border radius → `rounded-xl`, `rounded-[14px]`, `rounded-full`\n\nOnly create CSS custom properties for **semantic colors** — these are the values that would change across themes. Name them to avoid conflicts with Tailwind's built-in variables (do NOT use names like `--font-bold`, `--text-sm`, `--radius-lg`):\n\n```css\n:root {\n --movie-bg: #0f0f1a;\n --movie-surface: #1a1a2e;\n --movie-accent: #7c3aed;\n --movie-text: #ffffff;\n --movie-text-dim: #ffffff80;\n}\n```\n\nReference in Tailwind classes: `bg-[var(--movie-bg)]`, `text-[var(--movie-text)]`\n\n#### CSS Modules / plain CSS projects\n\nCreate CSS custom properties for all token categories (colors, spacing, typography, radius). Use a project-specific prefix to avoid collisions:\n\n```css\n:root {\n --app-color-bg: #0f0f1a;\n --app-space-sm: 4px;\n --app-text-sm: 12px;\n --app-radius-md: 8px;\n}\n```\n\n#### Styled Components projects\n\nPut every token category in a typed theme object passed to `ThemeProvider`, and read it in styles as `${({ theme }) => theme.color.bg}`. Declare its type once by augmenting `DefaultTheme` in `styled.d.ts`:\n\n```ts\nexport const theme = {\n color: { bg: '#0f0f1a', surface: '#1a1a2e', accent: '#7c3aed', text: '#ffffff' },\n space: { sm: '4px', md: '8px', lg: '16px' },\n radius: { md: '8px', full: '9999px' },\n font: { body: \"'Inter', sans-serif\" }\n} as const\n```\n\nFor multi-mode collections either build one theme object per mode and swap it on `ThemeProvider`, or write the colors as CSS custom properties in `createGlobalStyle` and keep the theme pointing at `var(--…)`, which switches without re-rendering.\n\n#### Component library projects\n\nWhen the project uses shadcn/ui, Chakra UI, or MUI, write tokens into the library's own theme instead of a parallel set of custom properties; see **Component libraries** below for where each one keeps them.\n\n#### No design variables in the file\n\nIf the design has no Figma variables, extract implicit tokens from `analyze_colors` and `analyze_typography` output — identify the de facto palette and type scale. For Tailwind projects, only extract semantic colors as CSS custom properties; use Tailwind utilities for everything else.\n\n#### Multi-mode collections (light/dark)\n\n- Generate token values for each mode\n- Use CSS custom properties with class-based switching (`.dark { ... }`)\n\n### Step 4 — Generate code\n\nFor each component, bottom-up (primitives first, then composites, then screens):\n\n```\nget_jsx id=<component_id> → read structure\ndescribe id=<component_id> → understand semantic role\nexport_svg ids=[<icon_ids>] → extract vector assets\n```\n\n**Rules:**\n\n- One component per file\n- Component name comes from the Figma node name, converted to PascalCase\n- Props interface reflects the variable content identified in Step 2\n- Use design tokens from Step 3 for semantic colors\n- For Tailwind: use utility classes directly for spacing, font sizes, weights, radius — do NOT wrap them in `var()` indirection\n- Match measurements exactly: font sizes, spacing, border radii, colors\n- Use auto-layout data to determine flex direction, gap, padding, alignment\n- Preserve text direction and container flow direction separately when the design uses RTL.\n- Absolute positioning only when `layoutPositioning` is `ABSOLUTE` or layout mode is `NONE`\n- If a node has `clipsContent: true`, use `overflow: hidden`\n- Text nodes: preserve font family, size, weight, line height, letter spacing, alignment\n- Images/illustrations: use `export_svg` for vectors, placeholder `<img>` for raster (`next/image` in Next.js)\n- Icons: an `<Icon name=\"set:name\">` in `get_jsx` is an Iconify icon; emit it from the chosen icon package (see **Icons** below). An icon drawn as paths was edited or comes from no set, so export it with `export_svg`\n\n**Interactive states:**\n\nFigma designs rarely include hover/active/focus states unless the component has explicit variants for them. Always add sensible interactive feedback to clickable elements:\n\n- **Buttons (primary):** `hover:brightness-110 active:brightness-90 transition-all`\n- **Buttons (secondary/ghost):** `hover:bg-white/[0.12] active:bg-white/[0.06] transition-colors`\n- **Icon buttons:** `hover:bg-white/[0.15] active:scale-95 transition-all`\n- **Cards/list items (if clickable):** `hover:bg-white/[0.04] transition-colors`\n- **Links/text buttons:** `hover:underline` or `hover:opacity-80`\n- **All interactive elements:** add `cursor-pointer` and `select-none`\n- **Focus visible:** add `focus-visible:ring-2 focus-visible:ring-offset-2` with accent color for accessibility\n\nWith plain CSS, CSS Modules, or Styled Components write the same feedback as `:hover`, `:active`, and `:focus-visible` rules; with a component library keep its built-in states and adjust them through its theme.\n\nIf the design HAS explicit hover/active variants (COMPONENT_SET with state property), use those exact styles instead of defaults above.\n\n### Step 5 — Verify\n\nAfter generating code, verify against the design:\n\n```\ndescribe id=<root> → re-check structure matches\nget_jsx id=<root> → compare JSX structure with generated component tree\n```\n\nCheck:\n\n- All text content from the design appears in the code\n- All colors reference tokens or use correct hex/opacity values\n- Spacing values match the design\n- Component hierarchy matches the design's node tree\n- No nodes were skipped or merged incorrectly\n\nList any deviations with rationale.\n\n## Target stack\n\nThe user specifies the target stack. Adapt code generation accordingly:\n\n**React + Tailwind** — functional components, TypeScript, utility classes, `className`\n**React + CSS Modules** — functional components, TypeScript, `.module.css` files, `styles.className`\n**React + Styled Components** — functional components, TypeScript, `styled.*` components and a typed theme (see **Styled Components**)\n**Next.js** — React with the App Router, styled with Tailwind, CSS Modules, or Styled Components (see **Next.js**)\n**Vue 3 + Tailwind** — `<script setup lang=\"ts\">`, `defineProps`, `<template>`, Tailwind utility classes\n**Vue 3 + CSS** — `<script setup lang=\"ts\">`, `defineProps`, `<template>`, scoped `<style>`\n**Svelte + Tailwind** — `<script lang=\"ts\">`, `$props()`, Tailwind utility classes\n**HTML + CSS** — semantic HTML, BEM or utility classes, CSS custom properties\n\nTwo choices sit on top of the stack: the **component library** (shadcn/ui, Radix, Chakra UI, MUI, Reka UI, or the project's own components) and the **icon package** (Lucide, Heroicons, Font Awesome, React Icons, or Iconify). Read them from the project when you can see it: `package.json` dependencies, a `components.json` (shadcn/ui), existing imports.\n\nIf the user hasn't specified a stack, ask before generating code. Ask about the component library and icon package in the same question when the project does not show them.\n\n## Next.js\n\nTarget the App Router unless the project already uses `pages/`.\n\n- **Routes** — each screen is `app/<route>/page.tsx`; the home screen is `app/page.tsx`. Chrome shared by several screens (header, sidebar, footer that are the same instance or layers on each) goes in `app/layout.tsx` or a nested `layout.tsx`, not into every page. Name routes after the frame names in kebab-case.\n- **Server and client components** — components are Server Components by default. Add `'use client'` only to the components that need state, event handlers, effects, or browser APIs: every behaviour control, anything with `onClick`, and Radix, Chakra, MUI, or Styled Components wrappers. Keep the boundary at the leaves: a page stays a Server Component that renders client leaves, and passes them data as serializable props.\n- **Images** — use `next/image` for raster fills with the design's `width` and `height`; for an image that fills its frame use `fill` with `sizes`, on a parent with `position: relative`. Put exported assets in `public/` and reference them from `/`. Always pass `alt`, from the layer name or the surrounding text.\n- **Fonts** — load design fonts with `next/font/google` (or `next/font/local` for fonts that are not on Google Fonts) in `app/layout.tsx`, only the weights `analyze_typography` reports, and expose each as a CSS variable (`variable: '--font-inter'`) that Tailwind or the theme reads.\n- **Links** — a layer that navigates to another screen (nav items, text links, cards that open a detail screen) is `next/link`'s `<Link href>`, not a `<button>` or `<a onClick>`.\n- **Metadata** — export `metadata` from each `page.tsx` with a `title` taken from the frame name.\n- **Styling** — Tailwind tokens go in `app/globals.css`. CSS Modules work as in React. Styled Components need the compiler option (`compiler: { styledComponents: true }` in `next.config`) and a style registry client component that collects styles with `ServerStyleSheet` and `useServerInsertedHTML`, wrapped around `children` in `app/layout.tsx`; every file that calls `styled` is a client component.\n\n## Styled Components\n\n- One component file holds its styled elements, named after the layers they draw (`const Root = styled.button`, `const Label = styled.span`), or a sibling `Button.styles.ts` when it grows long.\n- Variant properties become transient props (`$variant`, `$size`) so they never reach the DOM; select their styles with the `css` helper from a lookup keyed by the variant value, not nested ternaries.\n- Interaction states are `&:hover`, `&:active`, `&:focus-visible`, and `&:disabled`. On a Radix primitive wrap it (`styled(Switch.Root)`) and style its `&[data-state='checked']` and `&[data-disabled]` attributes.\n- Tokens come from the theme (see **Step 3**); never hard-code a value the design binds to a variable.\n- Global resets, font faces, and mode custom properties go in one `createGlobalStyle`.\n- Styled Components is React only. For Vue or Svelte write scoped styles instead.\n\n## Component libraries\n\nWhen the project uses a component library, build each behaviour control on that library's component instead of its own markup, and map the design's variant properties to the library's own props (`variant`, `size`, `disabled`). Style the parts the design draws differently through the library's styling hooks; do not rebuild a component the library provides. Components with no behaviour (cards, headers, list rows) stay the project's own components built from library layout primitives or plain elements.\n\nReka UI (Vue) and Radix (React) share part names: Reka's `SwitchRoot` is Radix's `Switch.Root`, and so on. shadcn/ui wraps Radix in React and shadcn-vue wraps Reka UI in Vue under the same component names. Both expose state as `data-state` (`checked`/`unchecked`, `on`/`off`, `open`/`closed`, `active`/`inactive`) and `data-disabled`, which is where the design's state variants go. Radix takes the value as a controlled pair instead of `v-model`: `checked`/`onCheckedChange` (switch, checkbox), `pressed`/`onPressedChange` (toggle), `open`/`onOpenChange` (collapsible), `value`/`onValueChange` (tabs, radio group, toggle group, accordion, slider with an array value). Import Radix from the unified `radix-ui` package (`import { Switch } from 'radix-ui'`) unless the project already uses the per-primitive `@radix-ui/react-*` packages.\n\n- `button` — Reka UI native `<button>`; Radix native `<button>`; shadcn/ui `Button`; Chakra UI `Button`; MUI `Button`\n- `textField` — Reka UI native `<input>`; Radix native `<input>`; shadcn/ui `Input`; Chakra UI `Input` in `Field.Root`; MUI `TextField`\n- `textarea` — Reka UI native `<textarea>`; Radix native `<textarea>`; shadcn/ui `Textarea`; Chakra UI `Textarea` in `Field.Root`; MUI `TextField multiline`\n- `numberField` — Reka UI `NumberFieldRoot`, `NumberFieldInput`, `NumberFieldIncrement`, `NumberFieldDecrement`; Radix native `<input type=\"number\">` with stepper buttons; shadcn/ui `Input type=\"number\"`; Chakra UI `NumberInput.Root`, `NumberInput.Input`, `NumberInput.IncrementTrigger`, `NumberInput.DecrementTrigger`; MUI `TextField type=\"number\"`\n- `toggle` — Reka UI `Toggle`; Radix `Toggle.Root`; shadcn/ui `Toggle`; Chakra UI `Button` with `aria-pressed`; MUI `ToggleButton`\n- `switch` — Reka UI `SwitchRoot`, `SwitchThumb`; Radix `Switch.Root`, `Switch.Thumb`; shadcn/ui `Switch`; Chakra UI `Switch.Root`, `Switch.Control`, `Switch.Thumb`; MUI `Switch`\n- `checkbox` — Reka UI `CheckboxRoot`, `CheckboxIndicator`; Radix `Checkbox.Root`, `Checkbox.Indicator`; shadcn/ui `Checkbox`; Chakra UI `Checkbox.Root`, `Checkbox.Control`, `Checkbox.Indicator`; MUI `Checkbox`\n- `radioGroup` — Reka UI `RadioGroupRoot`, `RadioGroupItem`, `RadioGroupIndicator`; Radix `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.Indicator`; shadcn/ui `RadioGroup`, `RadioGroupItem`; Chakra UI `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.ItemIndicator`; MUI `RadioGroup` with `Radio` in `FormControlLabel`\n- `toggleGroup` — Reka UI `ToggleGroupRoot`, `ToggleGroupItem`; Radix `ToggleGroup.Root`, `ToggleGroup.Item`; shadcn/ui `ToggleGroup`, `ToggleGroupItem`; Chakra UI `SegmentGroup.Root`, `SegmentGroup.Item`; MUI `ToggleButtonGroup`, `ToggleButton`\n- `slider` — Reka UI `SliderRoot`, `SliderTrack`, `SliderRange`, `SliderThumb`; Radix `Slider.Root`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; shadcn/ui `Slider`; Chakra UI `Slider.Root`, `Slider.Control`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; MUI `Slider` (`rail`, `track`, `thumb` slots)\n- `progress` — Reka UI `ProgressRoot`, `ProgressIndicator`; Radix `Progress.Root`, `Progress.Indicator`; shadcn/ui `Progress`; Chakra UI `Progress.Root`, `Progress.Track`, `Progress.Range`; MUI `LinearProgress variant=\"determinate\"`\n- `tabs` — Reka UI `TabsRoot`, `TabsList`, `TabsTrigger`, `TabsContent`; Radix `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; shadcn/ui `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`; Chakra UI `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; MUI `Tabs`, `Tab`, with a panel per tab\n- `collapsible` — Reka UI `CollapsibleRoot`, `CollapsibleTrigger`, `CollapsibleContent`; Radix `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; shadcn/ui `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent`; Chakra UI `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; MUI `Collapse` toggled by a `Button`\n- `accordion` — Reka UI `AccordionRoot`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Radix `Accordion.Root`, `Accordion.Item`, `Accordion.Trigger`, `Accordion.Content`; shadcn/ui `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Chakra UI `Accordion.Root`, `Accordion.Item`, `Accordion.ItemTrigger`, `Accordion.ItemContent`; MUI `Accordion`, `AccordionSummary`, `AccordionDetails` per item\n\nA `radio` behaviour is one item of a `radioGroup`: its `RadioGroupItem`, `RadioGroup.Item`, or `Radio`. A behaviour's `items` slot holds the group's items and a tab list's children are its triggers, so the list above names the item parts too. In Reka UI and Radix an accordion trigger sits inside `AccordionHeader` / `Accordion.Header`. A `progress` behaviour's `track` slot is the root itself, `ProgressRoot` / `Progress.Root` in Reka UI and Radix (`Progress.Track` in Chakra UI), so do not add a wrapper for it. A `tabs` behaviour's `panels` slot has no part of its own: its children are the content parts, `TabsContent` / `Tabs.Content`, placed directly under the root.\n\nWhere each library keeps tokens and variants:\n\n- **shadcn/ui** — components are copied into the project (`components/ui`), so restyle them there to match the design rather than overriding every call site. Map semantic colors to its CSS variables (`--background`, `--foreground`, `--primary`, `--primary-foreground`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`) and the base corner radius to `--radius`, per mode under `.dark`. These replace the Tailwind rule against radius custom properties above because shadcn/ui already defines them. Add design variants to the component's `cva` `variants` (`variant`, `size`) under the design's own value names, and merge classes with `cn()`.\n- **Radix (unstyled)** — style each part directly with the project's styling approach; state selectors are `[data-state=…]` and `[data-disabled]`, and Tailwind's `data-[state=checked]:` variants.\n- **Chakra UI v3** — put tokens in `createSystem(defaultConfig, { theme: { tokens, semanticTokens } })`, with mode values as `{ base, _dark }` semantic tokens, and pass the system to `ChakraProvider`. Spacing, radius, and typography use style props (`gap`, `px`, `rounded`, `fontSize`). Component variants go in a `recipe` (single part) or `slotRecipe` (multi-part, such as switch or tabs).\n- **MUI** — put tokens in `createTheme`: `palette` (one theme per mode, or `colorSchemes` with CSS variables), `typography`, `spacing`, and `shape.borderRadius`. Style instances with `sx` and reusable pieces with `styled()` from `@mui/material/styles`; add design variants to `components.<Name>.variants` and part overrides to `components.<Name>.styleOverrides` (`MuiSwitch`'s `thumb` and `track`, `MuiSlider`'s `rail`, `track`, and `thumb`).\n- **The project's own components** — `design_to_component_map` lists the design's components with their variants and instance counts. Match each to an existing component in the codebase by name and role before writing a new one, and extend an existing component's props for a new variant rather than duplicating it.\n\n## Icons\n\n`get_jsx` writes a named icon as `<Icon name=\"lucide:arrow-right\" size={16} color=\"#6b7280\" />`. The name is an Iconify name, `<set>:<icon>`; `size` is its width and height; `color` is its color (black when absent); `label`, when present, is the name the designer gave the layer. Use it as `aria-label` when the icon stands alone and carries meaning (an icon button); otherwise the icon is decorative, so give it `aria-hidden=\"true\"`. Use the color through the same token the surrounding text uses when it matches one.\n\nEmit each icon from the icon package the user chose. Iconify set prefixes map to packages mechanically; convert the kebab-case icon name to PascalCase for the component:\n\n- `lucide:arrow-right` — `lucide-react`, `lucide-vue-next`, `@lucide/svelte`: `ArrowRight`, with `size` and `strokeWidth`\n- `heroicons:arrow-right` (24 outline) — `@heroicons/react/24/outline` or `@heroicons/vue/24/outline`: `ArrowRightIcon`\n- `heroicons:arrow-right-solid`, `-20-solid`, `-16-solid` — `@heroicons/react/24/solid`, `/20/solid`, `/16/solid`: `ArrowRightIcon`\n- `fa6-solid:house`, `fa6-regular:heart`, `fa6-brands:github` — `@fortawesome/react-fontawesome` (or `vue-fontawesome`) with `@fortawesome/free-solid-svg-icons`, `free-regular-svg-icons`, `free-brands-svg-icons`: `<FontAwesomeIcon icon={faHouse} />`\n- `tabler:home` — `@tabler/icons-react`: `IconHome`\n- `ph:house` — `@phosphor-icons/react`: `House` (`@phosphor-icons/vue`: `PhHouse`). A `-thin`, `-light`, `-bold`, `-fill`, or `-duotone` suffix is the `weight` prop on the base component, not part of its name: `ph:house-bold` → `<House weight=\"bold\" />`\n- `radix-icons:home` — `@radix-ui/react-icons`: `HomeIcon`\n- `mdi:home` — `@mdi/react` with `@mdi/js`: `<Icon path={mdiHome} />`\n\nReact Icons bundles many sets under one package, each behind a prefix: `lucide:` → `react-icons/lu` (`LuArrowRight`), `heroicons:` → `react-icons/hi2` (`HiOutlineArrowRight`, `HiArrowRight` for solid, `HiMiniArrowRight` for `-20-solid`, `HiMicroArrowRight` for `-16-solid`), `fa6-solid:` / `fa6-regular:` / `fa6-brands:` → `react-icons/fa6` (`FaHouse`, `FaRegHeart`, `FaGithub`), `tabler:` → `react-icons/tb` (`TbHome`), `ph:` → `react-icons/pi` (`PiHouse`, with the weight kept in the name: `PiHouseBold`, `PiHouseFill`), `ic:` → `react-icons/md` (`MdHome`), `bi:` → `react-icons/bs` (`BsHouse`), `ri:` → `react-icons/ri` (`RiHomeLine`), `feather:` → `react-icons/fi` (`FiHome`), `simple-icons:` → `react-icons/si` (`SiGithub`). Size with `size`, color with `color` or a text color class.\n\nRules:\n\n- Check that the export exists in the installed package version; sets rename icons between releases. When the name differs, pick the package's equivalent and say so.\n- When the design's set has no package in the chosen library (an `mdi:` icon with Lucide chosen), do not silently swap in a different-looking icon. Use Iconify for that icon (`@iconify/react` or `@iconify/vue`, `<Icon icon=\"mdi:home\" />`) or export it with `export_svg`, and list it under deviations. Replace it with the chosen set's closest icon only when the user asks for one consistent set.\n- With no package chosen, use the package that owns the design's set (`lucide:` → `lucide-react`), or Iconify when the design mixes sets.\n- Import icons by name from the package (`import { ArrowRight } from 'lucide-react'`); never import a whole set.\n\n## Component file structure\n\n```\ncomponents/\n Button.tsx (or .vue, .svelte)\n Card.tsx\n Header.tsx\n ...\ntokens.css (semantic color tokens only, for Tailwind projects)\npages/\n HomePage.tsx (or routes, views — depends on framework)\nassets/\n icon-arrow.svg\n icon-check.svg\n```\n\nIn Next.js screens are routes and assets are public files:\n\n```\napp/\n layout.tsx (fonts, shared chrome, global styles)\n globals.css (tokens)\n page.tsx (home screen)\n settings/\n page.tsx\ncomponents/\n Button.tsx\n ui/ (shadcn/ui components, when used)\npublic/\n hero.png\n```\n\n## Common patterns\n\n**Auto-layout → Flexbox**\n\n- `layoutMode: HORIZONTAL` → `flex-direction: row`\n- `layoutMode: VERTICAL` → `flex-direction: column`\n- `itemSpacing` → `gap`\n- `paddingTop/Right/Bottom/Left` → `padding`\n- `primaryAxisAlign: CENTER` → `justify-content: center`\n- `counterAxisAlign: CENTER` → `align-items: center`\n- `layoutWrap: WRAP` → `flex-wrap: wrap`\n- `primaryAxisSizing: HUG` / `counterAxisSizing: HUG` → no explicit size on that axis (content-sized)\n\n**Grid layout**\n\n- `layoutMode: GRID` → `display: grid`\n- `gridTemplateColumns` → `grid-template-columns`\n- `gridTemplateRows` → `grid-template-rows`\n- `gridColumnGap/gridRowGap` → `column-gap/row-gap`\n\n**Sizing**\n\n- Fill lives on the child: `layoutGrow > 0` fills the parent's primary axis (`flex-grow: 1`), `layoutAlignSelf: STRETCH` fills the cross axis (`align-self: stretch`, no fixed size on that axis). In a grid, `layoutGrow` fills the cell's width and `STRETCH` its height.\n- Fixed width/height only on axes that neither hug nor fill\n\n**Corner radius**\n\n- `independentCorners: true` → per-corner border-radius\n- `cornerRadius` → uniform border-radius\n\n**Effects**\n\n- `DROP_SHADOW` → `box-shadow`\n- `INNER_SHADOW` → `box-shadow: inset ...`\n- `LAYER_BLUR` → `filter: blur(...)`\n- `BACKGROUND_BLUR` → `backdrop-filter: blur(...)`\n\n**Text**\n\n- `fontFamily` → `font-family`\n- `fontSize` → `font-size`\n- `fontWeight` → `font-weight`\n- `lineHeight` → `line-height` (null = normal/auto)\n- `letterSpacing` → `letter-spacing`\n- `textAlignHorizontal` → `text-align`\n- `textAutoResize: WIDTH_AND_HEIGHT` → no explicit dimensions\n- `textAutoResize: HEIGHT` → fixed width, auto height\n- `textAutoResize: NONE` → fixed width and height\n- `textDecoration` → `text-decoration`\n- `textCase` → `text-transform`\n\n## Scene authoring reference\n\nThe appended reference applies when inspecting or editing Pairdraw scenes, not to the target frontend framework's API.\n";
2
+ var codegen_default = "# Design to Code\n\nYou convert Figma designs into production frontend code. You have full access to the design document through tools. Never guess — always read the actual design data.\n\n> Note: Auto-layout and visual property names match the JSX props in the render system. Read geometry and style with `get_css` (CSS-like lines, colours as tokens), roles and design issues with `describe`, and structure with `get_jsx`.\n\n## Workflow\n\n### Step 1 — Survey\n\nUnderstand the full picture before writing any code.\n\n```\nget_page_tree → document structure, all top-level frames\nget_components → reusable components defined by the designer\nlist_variables → design tokens (colors, numbers, strings, booleans)\nlist_collections → variable collections and modes (light/dark, density, etc.)\nanalyze_colors → color palette, frequencies, which colors use variables\nanalyze_typography → font stacks, sizes, weights in use\nanalyze_spacing → gap and padding values, grid compliance\n```\n\nAfter this step you should know:\n\n- How many screens/pages the design has\n- What components exist\n- What the token system looks like (or if there is none)\n- The typographic scale\n- The spacing system (4px grid? 8px grid? irregular?)\n\n### Step 2 — Decompose\n\nIdentify the component architecture.\n\n```\nanalyze_clusters → find repeated visual patterns that should be components\nget_css (per node) → CSS shape: flex, gap, padding, size constraints, token colours, text\ndescribe (per node) → semantic role, layout direction, visual properties, issues\nget_jsx (per node) → structural JSX to understand nesting and layout\n```\n\nBuild a component map:\n\n- **Screens** — top-level frames that represent pages/views\n- **Components** — COMPONENT/COMPONENT_SET nodes or repeated patterns from analyze_clusters\n- **Primitives** — leaf elements (text, icons, dividers) that don't need their own component file\n\nFor each component determine:\n\n- **Props** — what content varies between instances (text, color, icon, visibility)\n- **Variants** — if the component has multiple states (default/hover/active, small/medium/large)\n- **Slots** — where child content is injected\n- **Behaviour** — `get_behaviour id=<component_id>` tells whether the designer made it a control, after Reka UI's primitives. Build such a component on that Reka primitive (`SwitchRoot` with `SwitchThumb`, `SliderRoot` with `SliderTrack`, `SliderRange`, and `SliderThumb`, `TabsRoot` with `TabsList`, `TabsTrigger`, and `TabsContent`, …): each part is the slot the behaviour names, its values are the properties it binds (`v-model` for the value, `disabled`), and its interaction states map to the variants for `data-state`, `:hover`, `:active`, `:focus-visible`, and `[data-disabled]`. Do not reimplement the control's keyboard and accessibility handling. In React use the Radix primitive with the same parts (Reka UI is the Vue port of Radix), and with a component library use its equivalent; see **Component libraries** below.\n\n### Step 3 — Extract tokens\n\n```\nlist_variables → all variables with values per mode\nlist_collections → collection structure and mode names\n```\n\nMap design variables to code tokens. The approach depends on the target stack:\n\n#### Tailwind projects\n\nDo NOT create CSS custom properties for font sizes, font weights, spacing, or border radius — Tailwind has its own system for these. Use Tailwind utility classes directly:\n\n- Font sizes → `text-[13px]`, `text-sm`, `text-base`, etc.\n- Font weights → `font-bold`, `font-medium`, `font-[600]`\n- Spacing → `gap-3`, `p-4`, `px-5`, `py-[14px]`, or arbitrary `gap-[12px]`\n- Border radius → `rounded-xl`, `rounded-[14px]`, `rounded-full`\n\nOnly create CSS custom properties for **semantic colors** — these are the values that would change across themes. Name them to avoid conflicts with Tailwind's built-in variables (do NOT use names like `--font-bold`, `--text-sm`, `--radius-lg`):\n\n```css\n:root {\n --movie-bg: #0f0f1a;\n --movie-surface: #1a1a2e;\n --movie-accent: #7c3aed;\n --movie-text: #ffffff;\n --movie-text-dim: #ffffff80;\n}\n```\n\nReference in Tailwind classes: `bg-[var(--movie-bg)]`, `text-[var(--movie-text)]`\n\n#### CSS Modules / plain CSS projects\n\nCreate CSS custom properties for all token categories (colors, spacing, typography, radius). Use a project-specific prefix to avoid collisions:\n\n```css\n:root {\n --app-color-bg: #0f0f1a;\n --app-space-sm: 4px;\n --app-text-sm: 12px;\n --app-radius-md: 8px;\n}\n```\n\n#### Styled Components projects\n\nPut every token category in a typed theme object passed to `ThemeProvider`, and read it in styles as `${({ theme }) => theme.color.bg}`. Declare its type once by augmenting `DefaultTheme` in `styled.d.ts`:\n\n```ts\nexport const theme = {\n color: { bg: '#0f0f1a', surface: '#1a1a2e', accent: '#7c3aed', text: '#ffffff' },\n space: { sm: '4px', md: '8px', lg: '16px' },\n radius: { md: '8px', full: '9999px' },\n font: { body: \"'Inter', sans-serif\" }\n} as const\n```\n\nFor multi-mode collections either build one theme object per mode and swap it on `ThemeProvider`, or write the colors as CSS custom properties in `createGlobalStyle` and keep the theme pointing at `var(--…)`, which switches without re-rendering.\n\n#### Component library projects\n\nWhen the project uses shadcn/ui, Chakra UI, or MUI, write tokens into the library's own theme instead of a parallel set of custom properties; see **Component libraries** below for where each one keeps them.\n\n#### No design variables in the file\n\nIf the design has no Figma variables, extract implicit tokens from `analyze_colors` and `analyze_typography` output — identify the de facto palette and type scale. For Tailwind projects, only extract semantic colors as CSS custom properties; use Tailwind utilities for everything else.\n\n#### Multi-mode collections (light/dark)\n\n- Generate token values for each mode\n- Use CSS custom properties with class-based switching (`.dark { ... }`)\n\n### Step 4 — Generate code\n\nFor each component, bottom-up (primitives first, then composites, then screens):\n\n```\nget_jsx id=<component_id> → read structure\ndescribe id=<component_id> → understand semantic role\nexport_svg ids=[<icon_ids>] → extract vector assets\n```\n\n**Rules:**\n\n- One component per file\n- Component name comes from the Figma node name, converted to PascalCase\n- Props interface reflects the variable content identified in Step 2\n- Use design tokens from Step 3 for semantic colors\n- For Tailwind: use utility classes directly for spacing, font sizes, weights, radius — do NOT wrap them in `var()` indirection\n- Match measurements exactly: font sizes, spacing, border radii, colors\n- Use auto-layout data to determine flex direction, gap, padding, alignment\n- Preserve text direction and container flow direction separately when the design uses RTL.\n- Absolute positioning only when `layoutPositioning` is `ABSOLUTE` or layout mode is `NONE`\n- If a node has `clipsContent: true`, use `overflow: hidden`\n- Text nodes: preserve font family, size, weight, line height, letter spacing, alignment\n- Images/illustrations: use `export_svg` for vectors, placeholder `<img>` for raster (`next/image` in Next.js)\n- Icons: an `<Icon name=\"set:name\">` in `get_jsx` is an Iconify icon; emit it from the chosen icon package (see **Icons** below). An icon drawn as paths was edited or comes from no set, so export it with `export_svg`\n\n**Interactive states:**\n\nFigma designs rarely include hover/active/focus states unless the component has explicit variants for them. Always add sensible interactive feedback to clickable elements:\n\n- **Buttons (primary):** `hover:brightness-110 active:brightness-90 transition-all`\n- **Buttons (secondary/ghost):** `hover:bg-white/[0.12] active:bg-white/[0.06] transition-colors`\n- **Icon buttons:** `hover:bg-white/[0.15] active:scale-95 transition-all`\n- **Cards/list items (if clickable):** `hover:bg-white/[0.04] transition-colors`\n- **Links/text buttons:** `hover:underline` or `hover:opacity-80`\n- **All interactive elements:** add `cursor-pointer` and `select-none`\n- **Focus visible:** add `focus-visible:ring-2 focus-visible:ring-offset-2` with accent color for accessibility\n\nWith plain CSS, CSS Modules, or Styled Components write the same feedback as `:hover`, `:active`, and `:focus-visible` rules; with a component library keep its built-in states and adjust them through its theme.\n\nIf the design HAS explicit hover/active variants (COMPONENT_SET with state property), use those exact styles instead of defaults above.\n\n### Step 5 — Verify\n\nAfter generating code, verify against the design:\n\n```\ndescribe id=<root> → re-check structure matches\nget_jsx id=<root> → compare JSX structure with generated component tree\n```\n\nCheck:\n\n- All text content from the design appears in the code\n- All colors reference tokens or use correct hex/opacity values\n- Spacing values match the design\n- Component hierarchy matches the design's node tree\n- No nodes were skipped or merged incorrectly\n\nList any deviations with rationale.\n\n## Target stack\n\nThe user specifies the target stack. Adapt code generation accordingly:\n\n**React + Tailwind** — functional components, TypeScript, utility classes, `className`\n**React + CSS Modules** — functional components, TypeScript, `.module.css` files, `styles.className`\n**React + Styled Components** — functional components, TypeScript, `styled.*` components and a typed theme (see **Styled Components**)\n**Next.js** — React with the App Router, styled with Tailwind, CSS Modules, or Styled Components (see **Next.js**)\n**Vue 3 + Tailwind** — `<script setup lang=\"ts\">`, `defineProps`, `<template>`, Tailwind utility classes\n**Vue 3 + CSS** — `<script setup lang=\"ts\">`, `defineProps`, `<template>`, scoped `<style>`\n**Svelte + Tailwind** — `<script lang=\"ts\">`, `$props()`, Tailwind utility classes\n**HTML + CSS** — semantic HTML, BEM or utility classes, CSS custom properties\n\nTwo choices sit on top of the stack: the **component library** (shadcn/ui, Radix, Chakra UI, MUI, Reka UI, or the project's own components) and the **icon package** (Lucide, Heroicons, Font Awesome, React Icons, or Iconify). Read them from the project when you can see it: `package.json` dependencies, a `components.json` (shadcn/ui), existing imports.\n\nIf the user hasn't specified a stack, ask before generating code. Ask about the component library and icon package in the same question when the project does not show them.\n\n## Next.js\n\nTarget the App Router unless the project already uses `pages/`.\n\n- **Routes** — each screen is `app/<route>/page.tsx`; the home screen is `app/page.tsx`. Chrome shared by several screens (header, sidebar, footer that are the same instance or layers on each) goes in `app/layout.tsx` or a nested `layout.tsx`, not into every page. Name routes after the frame names in kebab-case.\n- **Server and client components** — components are Server Components by default. Add `'use client'` only to the components that need state, event handlers, effects, or browser APIs: every behaviour control, anything with `onClick`, and Radix, Chakra, MUI, or Styled Components wrappers. Keep the boundary at the leaves: a page stays a Server Component that renders client leaves, and passes them data as serializable props.\n- **Images** — use `next/image` for raster fills with the design's `width` and `height`; for an image that fills its frame use `fill` with `sizes`, on a parent with `position: relative`. Put exported assets in `public/` and reference them from `/`. Always pass `alt`, from the layer name or the surrounding text.\n- **Fonts** — load design fonts with `next/font/google` (or `next/font/local` for fonts that are not on Google Fonts) in `app/layout.tsx`, only the weights `analyze_typography` reports, and expose each as a CSS variable (`variable: '--font-inter'`) that Tailwind or the theme reads.\n- **Links** — a layer that navigates to another screen (nav items, text links, cards that open a detail screen) is `next/link`'s `<Link href>`, not a `<button>` or `<a onClick>`.\n- **Metadata** — export `metadata` from each `page.tsx` with a `title` taken from the frame name.\n- **Styling** — Tailwind tokens go in `app/globals.css`. CSS Modules work as in React. Styled Components need the compiler option (`compiler: { styledComponents: true }` in `next.config`) and a style registry client component that collects styles with `ServerStyleSheet` and `useServerInsertedHTML`, wrapped around `children` in `app/layout.tsx`; every file that calls `styled` is a client component.\n\n## Styled Components\n\n- One component file holds its styled elements, named after the layers they draw (`const Root = styled.button`, `const Label = styled.span`), or a sibling `Button.styles.ts` when it grows long.\n- Variant properties become transient props (`$variant`, `$size`) so they never reach the DOM; select their styles with the `css` helper from a lookup keyed by the variant value, not nested ternaries.\n- Interaction states are `&:hover`, `&:active`, `&:focus-visible`, and `&:disabled`. On a Radix primitive wrap it (`styled(Switch.Root)`) and style its `&[data-state='checked']` and `&[data-disabled]` attributes.\n- Tokens come from the theme (see **Step 3**); never hard-code a value the design binds to a variable.\n- Global resets, font faces, and mode custom properties go in one `createGlobalStyle`.\n- Styled Components is React only. For Vue or Svelte write scoped styles instead.\n\n## Component libraries\n\nWhen the project uses a component library, build each behaviour control on that library's component instead of its own markup, and map the design's variant properties to the library's own props (`variant`, `size`, `disabled`). Style the parts the design draws differently through the library's styling hooks; do not rebuild a component the library provides. Components with no behaviour (cards, headers, list rows) stay the project's own components built from library layout primitives or plain elements.\n\nReka UI (Vue) and Radix (React) share part names: Reka's `SwitchRoot` is Radix's `Switch.Root`, and so on. shadcn/ui wraps Radix in React and shadcn-vue wraps Reka UI in Vue under the same component names. Both expose state as `data-state` (`checked`/`unchecked`, `on`/`off`, `open`/`closed`, `active`/`inactive`) and `data-disabled`, which is where the design's state variants go. Radix takes the value as a controlled pair instead of `v-model`: `checked`/`onCheckedChange` (switch, checkbox), `pressed`/`onPressedChange` (toggle), `open`/`onOpenChange` (collapsible), `value`/`onValueChange` (tabs, radio group, toggle group, accordion, slider with an array value). Import Radix from the unified `radix-ui` package (`import { Switch } from 'radix-ui'`) unless the project already uses the per-primitive `@radix-ui/react-*` packages.\n\n- `button` — Reka UI native `<button>`; Radix native `<button>`; shadcn/ui `Button`; Chakra UI `Button`; MUI `Button`\n- `textField` — Reka UI native `<input>`; Radix native `<input>`; shadcn/ui `Input`; Chakra UI `Input` in `Field.Root`; MUI `TextField`\n- `textarea` — Reka UI native `<textarea>`; Radix native `<textarea>`; shadcn/ui `Textarea`; Chakra UI `Textarea` in `Field.Root`; MUI `TextField multiline`\n- `numberField` — Reka UI `NumberFieldRoot`, `NumberFieldInput`, `NumberFieldIncrement`, `NumberFieldDecrement`; Radix native `<input type=\"number\">` with stepper buttons; shadcn/ui `Input type=\"number\"`; Chakra UI `NumberInput.Root`, `NumberInput.Input`, `NumberInput.IncrementTrigger`, `NumberInput.DecrementTrigger`; MUI `TextField type=\"number\"`\n- `toggle` — Reka UI `Toggle`; Radix `Toggle.Root`; shadcn/ui `Toggle`; Chakra UI `Button` with `aria-pressed`; MUI `ToggleButton`\n- `switch` — Reka UI `SwitchRoot`, `SwitchThumb`; Radix `Switch.Root`, `Switch.Thumb`; shadcn/ui `Switch`; Chakra UI `Switch.Root`, `Switch.Control`, `Switch.Thumb`; MUI `Switch`\n- `checkbox` — Reka UI `CheckboxRoot`, `CheckboxIndicator`; Radix `Checkbox.Root`, `Checkbox.Indicator`; shadcn/ui `Checkbox`; Chakra UI `Checkbox.Root`, `Checkbox.Control`, `Checkbox.Indicator`; MUI `Checkbox`\n- `radioGroup` — Reka UI `RadioGroupRoot`, `RadioGroupItem`, `RadioGroupIndicator`; Radix `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.Indicator`; shadcn/ui `RadioGroup`, `RadioGroupItem`; Chakra UI `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.ItemIndicator`; MUI `RadioGroup` with `Radio` in `FormControlLabel`\n- `toggleGroup` — Reka UI `ToggleGroupRoot`, `ToggleGroupItem`; Radix `ToggleGroup.Root`, `ToggleGroup.Item`; shadcn/ui `ToggleGroup`, `ToggleGroupItem`; Chakra UI `SegmentGroup.Root`, `SegmentGroup.Item`; MUI `ToggleButtonGroup`, `ToggleButton`\n- `slider` — Reka UI `SliderRoot`, `SliderTrack`, `SliderRange`, `SliderThumb`; Radix `Slider.Root`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; shadcn/ui `Slider`; Chakra UI `Slider.Root`, `Slider.Control`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; MUI `Slider` (`rail`, `track`, `thumb` slots)\n- `progress` — Reka UI `ProgressRoot`, `ProgressIndicator`; Radix `Progress.Root`, `Progress.Indicator`; shadcn/ui `Progress`; Chakra UI `Progress.Root`, `Progress.Track`, `Progress.Range`; MUI `LinearProgress variant=\"determinate\"`\n- `tabs` — Reka UI `TabsRoot`, `TabsList`, `TabsTrigger`, `TabsContent`; Radix `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; shadcn/ui `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`; Chakra UI `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; MUI `Tabs`, `Tab`, with a panel per tab\n- `collapsible` — Reka UI `CollapsibleRoot`, `CollapsibleTrigger`, `CollapsibleContent`; Radix `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; shadcn/ui `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent`; Chakra UI `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; MUI `Collapse` toggled by a `Button`\n- `accordion` — Reka UI `AccordionRoot`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Radix `Accordion.Root`, `Accordion.Item`, `Accordion.Trigger`, `Accordion.Content`; shadcn/ui `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Chakra UI `Accordion.Root`, `Accordion.Item`, `Accordion.ItemTrigger`, `Accordion.ItemContent`; MUI `Accordion`, `AccordionSummary`, `AccordionDetails` per item\n\nA `radio` behaviour is one item of a `radioGroup`: its `RadioGroupItem`, `RadioGroup.Item`, or `Radio`. A behaviour's `items` slot holds the group's items and a tab list's children are its triggers, so the list above names the item parts too. In Reka UI and Radix an accordion trigger sits inside `AccordionHeader` / `Accordion.Header`. A `progress` behaviour's `track` slot is the root itself, `ProgressRoot` / `Progress.Root` in Reka UI and Radix (`Progress.Track` in Chakra UI), so do not add a wrapper for it. A `tabs` behaviour's `panels` slot has no part of its own: its children are the content parts, `TabsContent` / `Tabs.Content`, placed directly under the root.\n\nWhere each library keeps tokens and variants:\n\n- **shadcn/ui** — components are copied into the project (`components/ui`), so restyle them there to match the design rather than overriding every call site. Map semantic colors to its CSS variables (`--background`, `--foreground`, `--primary`, `--primary-foreground`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`) and the base corner radius to `--radius`, per mode under `.dark`. These replace the Tailwind rule against radius custom properties above because shadcn/ui already defines them. Add design variants to the component's `cva` `variants` (`variant`, `size`) under the design's own value names, and merge classes with `cn()`.\n- **Radix (unstyled)** — style each part directly with the project's styling approach; state selectors are `[data-state=…]` and `[data-disabled]`, and Tailwind's `data-[state=checked]:` variants.\n- **Chakra UI v3** — put tokens in `createSystem(defaultConfig, { theme: { tokens, semanticTokens } })`, with mode values as `{ base, _dark }` semantic tokens, and pass the system to `ChakraProvider`. Spacing, radius, and typography use style props (`gap`, `px`, `rounded`, `fontSize`). Component variants go in a `recipe` (single part) or `slotRecipe` (multi-part, such as switch or tabs).\n- **MUI** — put tokens in `createTheme`: `palette` (one theme per mode, or `colorSchemes` with CSS variables), `typography`, `spacing`, and `shape.borderRadius`. Style instances with `sx` and reusable pieces with `styled()` from `@mui/material/styles`; add design variants to `components.<Name>.variants` and part overrides to `components.<Name>.styleOverrides` (`MuiSwitch`'s `thumb` and `track`, `MuiSlider`'s `rail`, `track`, and `thumb`).\n- **The project's own components** — `design_to_component_map` lists the design's components with their variants and instance counts. Match each to an existing component in the codebase by name and role before writing a new one, and extend an existing component's props for a new variant rather than duplicating it.\n\n## Icons\n\n`get_jsx` writes a named icon as `<Icon name=\"lucide:arrow-right\" size={16} color=\"#6b7280\" />`. The name is an Iconify name, `<set>:<icon>`; `size` is its width and height; `color` is its color (black when absent); `label`, when present, is the name the designer gave the layer. Use it as `aria-label` when the icon stands alone and carries meaning (an icon button); otherwise the icon is decorative, so give it `aria-hidden=\"true\"`. Use the color through the same token the surrounding text uses when it matches one.\n\nEmit each icon from the icon package the user chose. Iconify set prefixes map to packages mechanically; convert the kebab-case icon name to PascalCase for the component:\n\n- `lucide:arrow-right` — `lucide-react`, `lucide-vue-next`, `@lucide/svelte`: `ArrowRight`, with `size` and `strokeWidth`\n- `heroicons:arrow-right` (24 outline) — `@heroicons/react/24/outline` or `@heroicons/vue/24/outline`: `ArrowRightIcon`\n- `heroicons:arrow-right-solid`, `-20-solid`, `-16-solid` — `@heroicons/react/24/solid`, `/20/solid`, `/16/solid`: `ArrowRightIcon`\n- `fa6-solid:house`, `fa6-regular:heart`, `fa6-brands:github` — `@fortawesome/react-fontawesome` (or `vue-fontawesome`) with `@fortawesome/free-solid-svg-icons`, `free-regular-svg-icons`, `free-brands-svg-icons`: `<FontAwesomeIcon icon={faHouse} />`\n- `tabler:home` — `@tabler/icons-react`: `IconHome`\n- `ph:house` — `@phosphor-icons/react`: `House` (`@phosphor-icons/vue`: `PhHouse`). A `-thin`, `-light`, `-bold`, `-fill`, or `-duotone` suffix is the `weight` prop on the base component, not part of its name: `ph:house-bold` → `<House weight=\"bold\" />`\n- `radix-icons:home` — `@radix-ui/react-icons`: `HomeIcon`\n- `mdi:home` — `@mdi/react` with `@mdi/js`: `<Icon path={mdiHome} />`\n\nReact Icons bundles many sets under one package, each behind a prefix: `lucide:` → `react-icons/lu` (`LuArrowRight`), `heroicons:` → `react-icons/hi2` (`HiOutlineArrowRight`, `HiArrowRight` for solid, `HiMiniArrowRight` for `-20-solid`, `HiMicroArrowRight` for `-16-solid`), `fa6-solid:` / `fa6-regular:` / `fa6-brands:` → `react-icons/fa6` (`FaHouse`, `FaRegHeart`, `FaGithub`), `tabler:` → `react-icons/tb` (`TbHome`), `ph:` → `react-icons/pi` (`PiHouse`, with the weight kept in the name: `PiHouseBold`, `PiHouseFill`), `ic:` → `react-icons/md` (`MdHome`), `bi:` → `react-icons/bs` (`BsHouse`), `ri:` → `react-icons/ri` (`RiHomeLine`), `feather:` → `react-icons/fi` (`FiHome`), `simple-icons:` → `react-icons/si` (`SiGithub`). Size with `size`, color with `color` or a text color class.\n\nRules:\n\n- Check that the export exists in the installed package version; sets rename icons between releases. When the name differs, pick the package's equivalent and say so.\n- When the design's set has no package in the chosen library (an `mdi:` icon with Lucide chosen), do not silently swap in a different-looking icon. Use Iconify for that icon (`@iconify/react` or `@iconify/vue`, `<Icon icon=\"mdi:home\" />`) or export it with `export_svg`, and list it under deviations. Replace it with the chosen set's closest icon only when the user asks for one consistent set.\n- With no package chosen, use the package that owns the design's set (`lucide:` → `lucide-react`), or Iconify when the design mixes sets.\n- Import icons by name from the package (`import { ArrowRight } from 'lucide-react'`); never import a whole set.\n\n## Component file structure\n\n```\ncomponents/\n Button.tsx (or .vue, .svelte)\n Card.tsx\n Header.tsx\n ...\ntokens.css (semantic color tokens only, for Tailwind projects)\npages/\n HomePage.tsx (or routes, views — depends on framework)\nassets/\n icon-arrow.svg\n icon-check.svg\n```\n\nIn Next.js screens are routes and assets are public files:\n\n```\napp/\n layout.tsx (fonts, shared chrome, global styles)\n globals.css (tokens)\n page.tsx (home screen)\n settings/\n page.tsx\ncomponents/\n Button.tsx\n ui/ (shadcn/ui components, when used)\npublic/\n hero.png\n```\n\n## Common patterns\n\n**Auto-layout → Flexbox**\n\n- `layoutMode: HORIZONTAL` → `flex-direction: row`\n- `layoutMode: VERTICAL` → `flex-direction: column`\n- `itemSpacing` → `gap`\n- `paddingTop/Right/Bottom/Left` → `padding`\n- `primaryAxisAlign: CENTER` → `justify-content: center`\n- `counterAxisAlign: CENTER` → `align-items: center`\n- `layoutWrap: WRAP` → `flex-wrap: wrap`\n- `primaryAxisSizing: HUG` / `counterAxisSizing: HUG` → no explicit size on that axis (content-sized)\n\n**Grid layout**\n\n- `layoutMode: GRID` → `display: grid`\n- `gridTemplateColumns` → `grid-template-columns`\n- `gridTemplateRows` → `grid-template-rows`\n- `gridColumnGap/gridRowGap` → `column-gap/row-gap`\n\n**Sizing**\n\n- Fill lives on the child: `layoutGrow > 0` fills the parent's primary axis (`flex-grow: 1`), `layoutAlignSelf: STRETCH` fills the cross axis (`align-self: stretch`, no fixed size on that axis). In a grid, `layoutGrow` fills the cell's width and `STRETCH` its height.\n- Fixed width/height only on axes that neither hug nor fill\n\n**Corner radius**\n\n- `independentCorners: true` → per-corner border-radius\n- `cornerRadius` → uniform border-radius\n\n**Effects**\n\n- `DROP_SHADOW` → `box-shadow`\n- `INNER_SHADOW` → `box-shadow: inset ...`\n- `LAYER_BLUR` → `filter: blur(...)`\n- `BACKGROUND_BLUR` → `backdrop-filter: blur(...)`\n\n**Text**\n\n- `fontFamily` → `font-family`\n- `fontSize` → `font-size`\n- `fontWeight` → `font-weight`\n- `lineHeight` → `line-height` (null = normal/auto)\n- `letterSpacing` → `letter-spacing`\n- `textAlignHorizontal` → `text-align`\n- `textAutoResize: WIDTH_AND_HEIGHT` → no explicit dimensions\n- `textAutoResize: HEIGHT` → fixed width, auto height\n- `textAutoResize: NONE` → fixed width and height\n- `textDecoration` → `text-decoration`\n- `textCase` → `text-transform`\n\n## Scene authoring reference\n\nThe appended reference applies when inspecting or editing Pairdraw scenes, not to the target frontend framework's API.\n";
3
3
  //#endregion
4
4
  export { codegen_default as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.js","names":[],"sources":["../../../src/tools/prompts/codegen.md?raw"],"sourcesContent":["export default \"# Design to Code\\n\\nYou convert Figma designs into production frontend code. You have full access to the design document through tools. Never guess — always read the actual design data.\\n\\n> Note: Auto-layout and visual property names match the JSX props in the render system. See `describe` tool output for semantic role and layout analysis of any node.\\n\\n## Workflow\\n\\n### Step 1 — Survey\\n\\nUnderstand the full picture before writing any code.\\n\\n```\\nget_page_tree → document structure, all top-level frames\\nget_components → reusable components defined by the designer\\nlist_variables → design tokens (colors, numbers, strings, booleans)\\nlist_collections → variable collections and modes (light/dark, density, etc.)\\nanalyze_colors → color palette, frequencies, which colors use variables\\nanalyze_typography → font stacks, sizes, weights in use\\nanalyze_spacing → gap and padding values, grid compliance\\n```\\n\\nAfter this step you should know:\\n\\n- How many screens/pages the design has\\n- What components exist\\n- What the token system looks like (or if there is none)\\n- The typographic scale\\n- The spacing system (4px grid? 8px grid? irregular?)\\n\\n### Step 2 — Decompose\\n\\nIdentify the component architecture.\\n\\n```\\nanalyze_clusters → find repeated visual patterns that should be components\\ndescribe (per node) → semantic role, layout direction, visual properties, issues\\nget_jsx (per node) → structural JSX to understand nesting and layout\\n```\\n\\nBuild a component map:\\n\\n- **Screens** — top-level frames that represent pages/views\\n- **Components** — COMPONENT/COMPONENT_SET nodes or repeated patterns from analyze_clusters\\n- **Primitives** — leaf elements (text, icons, dividers) that don't need their own component file\\n\\nFor each component determine:\\n\\n- **Props** — what content varies between instances (text, color, icon, visibility)\\n- **Variants** — if the component has multiple states (default/hover/active, small/medium/large)\\n- **Slots** — where child content is injected\\n- **Behaviour** — `get_behaviour id=<component_id>` tells whether the designer made it a control, after Reka UI's primitives. Build such a component on that Reka primitive (`SwitchRoot` with `SwitchThumb`, `SliderRoot` with `SliderTrack`, `SliderRange`, and `SliderThumb`, `TabsRoot` with `TabsList`, `TabsTrigger`, and `TabsContent`, …): each part is the slot the behaviour names, its values are the properties it binds (`v-model` for the value, `disabled`), and its interaction states map to the variants for `data-state`, `:hover`, `:active`, `:focus-visible`, and `[data-disabled]`. Do not reimplement the control's keyboard and accessibility handling. In React use the Radix primitive with the same parts (Reka UI is the Vue port of Radix), and with a component library use its equivalent; see **Component libraries** below.\\n\\n### Step 3 — Extract tokens\\n\\n```\\nlist_variables → all variables with values per mode\\nlist_collections → collection structure and mode names\\n```\\n\\nMap design variables to code tokens. The approach depends on the target stack:\\n\\n#### Tailwind projects\\n\\nDo NOT create CSS custom properties for font sizes, font weights, spacing, or border radius — Tailwind has its own system for these. Use Tailwind utility classes directly:\\n\\n- Font sizes → `text-[13px]`, `text-sm`, `text-base`, etc.\\n- Font weights → `font-bold`, `font-medium`, `font-[600]`\\n- Spacing → `gap-3`, `p-4`, `px-5`, `py-[14px]`, or arbitrary `gap-[12px]`\\n- Border radius → `rounded-xl`, `rounded-[14px]`, `rounded-full`\\n\\nOnly create CSS custom properties for **semantic colors** — these are the values that would change across themes. Name them to avoid conflicts with Tailwind's built-in variables (do NOT use names like `--font-bold`, `--text-sm`, `--radius-lg`):\\n\\n```css\\n:root {\\n --movie-bg: #0f0f1a;\\n --movie-surface: #1a1a2e;\\n --movie-accent: #7c3aed;\\n --movie-text: #ffffff;\\n --movie-text-dim: #ffffff80;\\n}\\n```\\n\\nReference in Tailwind classes: `bg-[var(--movie-bg)]`, `text-[var(--movie-text)]`\\n\\n#### CSS Modules / plain CSS projects\\n\\nCreate CSS custom properties for all token categories (colors, spacing, typography, radius). Use a project-specific prefix to avoid collisions:\\n\\n```css\\n:root {\\n --app-color-bg: #0f0f1a;\\n --app-space-sm: 4px;\\n --app-text-sm: 12px;\\n --app-radius-md: 8px;\\n}\\n```\\n\\n#### Styled Components projects\\n\\nPut every token category in a typed theme object passed to `ThemeProvider`, and read it in styles as `${({ theme }) => theme.color.bg}`. Declare its type once by augmenting `DefaultTheme` in `styled.d.ts`:\\n\\n```ts\\nexport const theme = {\\n color: { bg: '#0f0f1a', surface: '#1a1a2e', accent: '#7c3aed', text: '#ffffff' },\\n space: { sm: '4px', md: '8px', lg: '16px' },\\n radius: { md: '8px', full: '9999px' },\\n font: { body: \\\"'Inter', sans-serif\\\" }\\n} as const\\n```\\n\\nFor multi-mode collections either build one theme object per mode and swap it on `ThemeProvider`, or write the colors as CSS custom properties in `createGlobalStyle` and keep the theme pointing at `var(--…)`, which switches without re-rendering.\\n\\n#### Component library projects\\n\\nWhen the project uses shadcn/ui, Chakra UI, or MUI, write tokens into the library's own theme instead of a parallel set of custom properties; see **Component libraries** below for where each one keeps them.\\n\\n#### No design variables in the file\\n\\nIf the design has no Figma variables, extract implicit tokens from `analyze_colors` and `analyze_typography` output — identify the de facto palette and type scale. For Tailwind projects, only extract semantic colors as CSS custom properties; use Tailwind utilities for everything else.\\n\\n#### Multi-mode collections (light/dark)\\n\\n- Generate token values for each mode\\n- Use CSS custom properties with class-based switching (`.dark { ... }`)\\n\\n### Step 4 — Generate code\\n\\nFor each component, bottom-up (primitives first, then composites, then screens):\\n\\n```\\nget_jsx id=<component_id> → read structure\\ndescribe id=<component_id> → understand semantic role\\nexport_svg ids=[<icon_ids>] → extract vector assets\\n```\\n\\n**Rules:**\\n\\n- One component per file\\n- Component name comes from the Figma node name, converted to PascalCase\\n- Props interface reflects the variable content identified in Step 2\\n- Use design tokens from Step 3 for semantic colors\\n- For Tailwind: use utility classes directly for spacing, font sizes, weights, radius — do NOT wrap them in `var()` indirection\\n- Match measurements exactly: font sizes, spacing, border radii, colors\\n- Use auto-layout data to determine flex direction, gap, padding, alignment\\n- Preserve text direction and container flow direction separately when the design uses RTL.\\n- Absolute positioning only when `layoutPositioning` is `ABSOLUTE` or layout mode is `NONE`\\n- If a node has `clipsContent: true`, use `overflow: hidden`\\n- Text nodes: preserve font family, size, weight, line height, letter spacing, alignment\\n- Images/illustrations: use `export_svg` for vectors, placeholder `<img>` for raster (`next/image` in Next.js)\\n- Icons: an `<Icon name=\\\"set:name\\\">` in `get_jsx` is an Iconify icon; emit it from the chosen icon package (see **Icons** below). An icon drawn as paths was edited or comes from no set, so export it with `export_svg`\\n\\n**Interactive states:**\\n\\nFigma designs rarely include hover/active/focus states unless the component has explicit variants for them. Always add sensible interactive feedback to clickable elements:\\n\\n- **Buttons (primary):** `hover:brightness-110 active:brightness-90 transition-all`\\n- **Buttons (secondary/ghost):** `hover:bg-white/[0.12] active:bg-white/[0.06] transition-colors`\\n- **Icon buttons:** `hover:bg-white/[0.15] active:scale-95 transition-all`\\n- **Cards/list items (if clickable):** `hover:bg-white/[0.04] transition-colors`\\n- **Links/text buttons:** `hover:underline` or `hover:opacity-80`\\n- **All interactive elements:** add `cursor-pointer` and `select-none`\\n- **Focus visible:** add `focus-visible:ring-2 focus-visible:ring-offset-2` with accent color for accessibility\\n\\nWith plain CSS, CSS Modules, or Styled Components write the same feedback as `:hover`, `:active`, and `:focus-visible` rules; with a component library keep its built-in states and adjust them through its theme.\\n\\nIf the design HAS explicit hover/active variants (COMPONENT_SET with state property), use those exact styles instead of defaults above.\\n\\n### Step 5 — Verify\\n\\nAfter generating code, verify against the design:\\n\\n```\\ndescribe id=<root> → re-check structure matches\\nget_jsx id=<root> → compare JSX structure with generated component tree\\n```\\n\\nCheck:\\n\\n- All text content from the design appears in the code\\n- All colors reference tokens or use correct hex/opacity values\\n- Spacing values match the design\\n- Component hierarchy matches the design's node tree\\n- No nodes were skipped or merged incorrectly\\n\\nList any deviations with rationale.\\n\\n## Target stack\\n\\nThe user specifies the target stack. Adapt code generation accordingly:\\n\\n**React + Tailwind** — functional components, TypeScript, utility classes, `className`\\n**React + CSS Modules** — functional components, TypeScript, `.module.css` files, `styles.className`\\n**React + Styled Components** — functional components, TypeScript, `styled.*` components and a typed theme (see **Styled Components**)\\n**Next.js** — React with the App Router, styled with Tailwind, CSS Modules, or Styled Components (see **Next.js**)\\n**Vue 3 + Tailwind** — `<script setup lang=\\\"ts\\\">`, `defineProps`, `<template>`, Tailwind utility classes\\n**Vue 3 + CSS** — `<script setup lang=\\\"ts\\\">`, `defineProps`, `<template>`, scoped `<style>`\\n**Svelte + Tailwind** — `<script lang=\\\"ts\\\">`, `$props()`, Tailwind utility classes\\n**HTML + CSS** — semantic HTML, BEM or utility classes, CSS custom properties\\n\\nTwo choices sit on top of the stack: the **component library** (shadcn/ui, Radix, Chakra UI, MUI, Reka UI, or the project's own components) and the **icon package** (Lucide, Heroicons, Font Awesome, React Icons, or Iconify). Read them from the project when you can see it: `package.json` dependencies, a `components.json` (shadcn/ui), existing imports.\\n\\nIf the user hasn't specified a stack, ask before generating code. Ask about the component library and icon package in the same question when the project does not show them.\\n\\n## Next.js\\n\\nTarget the App Router unless the project already uses `pages/`.\\n\\n- **Routes** — each screen is `app/<route>/page.tsx`; the home screen is `app/page.tsx`. Chrome shared by several screens (header, sidebar, footer that are the same instance or layers on each) goes in `app/layout.tsx` or a nested `layout.tsx`, not into every page. Name routes after the frame names in kebab-case.\\n- **Server and client components** — components are Server Components by default. Add `'use client'` only to the components that need state, event handlers, effects, or browser APIs: every behaviour control, anything with `onClick`, and Radix, Chakra, MUI, or Styled Components wrappers. Keep the boundary at the leaves: a page stays a Server Component that renders client leaves, and passes them data as serializable props.\\n- **Images** — use `next/image` for raster fills with the design's `width` and `height`; for an image that fills its frame use `fill` with `sizes`, on a parent with `position: relative`. Put exported assets in `public/` and reference them from `/`. Always pass `alt`, from the layer name or the surrounding text.\\n- **Fonts** — load design fonts with `next/font/google` (or `next/font/local` for fonts that are not on Google Fonts) in `app/layout.tsx`, only the weights `analyze_typography` reports, and expose each as a CSS variable (`variable: '--font-inter'`) that Tailwind or the theme reads.\\n- **Links** — a layer that navigates to another screen (nav items, text links, cards that open a detail screen) is `next/link`'s `<Link href>`, not a `<button>` or `<a onClick>`.\\n- **Metadata** — export `metadata` from each `page.tsx` with a `title` taken from the frame name.\\n- **Styling** — Tailwind tokens go in `app/globals.css`. CSS Modules work as in React. Styled Components need the compiler option (`compiler: { styledComponents: true }` in `next.config`) and a style registry client component that collects styles with `ServerStyleSheet` and `useServerInsertedHTML`, wrapped around `children` in `app/layout.tsx`; every file that calls `styled` is a client component.\\n\\n## Styled Components\\n\\n- One component file holds its styled elements, named after the layers they draw (`const Root = styled.button`, `const Label = styled.span`), or a sibling `Button.styles.ts` when it grows long.\\n- Variant properties become transient props (`$variant`, `$size`) so they never reach the DOM; select their styles with the `css` helper from a lookup keyed by the variant value, not nested ternaries.\\n- Interaction states are `&:hover`, `&:active`, `&:focus-visible`, and `&:disabled`. On a Radix primitive wrap it (`styled(Switch.Root)`) and style its `&[data-state='checked']` and `&[data-disabled]` attributes.\\n- Tokens come from the theme (see **Step 3**); never hard-code a value the design binds to a variable.\\n- Global resets, font faces, and mode custom properties go in one `createGlobalStyle`.\\n- Styled Components is React only. For Vue or Svelte write scoped styles instead.\\n\\n## Component libraries\\n\\nWhen the project uses a component library, build each behaviour control on that library's component instead of its own markup, and map the design's variant properties to the library's own props (`variant`, `size`, `disabled`). Style the parts the design draws differently through the library's styling hooks; do not rebuild a component the library provides. Components with no behaviour (cards, headers, list rows) stay the project's own components built from library layout primitives or plain elements.\\n\\nReka UI (Vue) and Radix (React) share part names: Reka's `SwitchRoot` is Radix's `Switch.Root`, and so on. shadcn/ui wraps Radix in React and shadcn-vue wraps Reka UI in Vue under the same component names. Both expose state as `data-state` (`checked`/`unchecked`, `on`/`off`, `open`/`closed`, `active`/`inactive`) and `data-disabled`, which is where the design's state variants go. Radix takes the value as a controlled pair instead of `v-model`: `checked`/`onCheckedChange` (switch, checkbox), `pressed`/`onPressedChange` (toggle), `open`/`onOpenChange` (collapsible), `value`/`onValueChange` (tabs, radio group, toggle group, accordion, slider with an array value). Import Radix from the unified `radix-ui` package (`import { Switch } from 'radix-ui'`) unless the project already uses the per-primitive `@radix-ui/react-*` packages.\\n\\n- `button` — Reka UI native `<button>`; Radix native `<button>`; shadcn/ui `Button`; Chakra UI `Button`; MUI `Button`\\n- `textField` — Reka UI native `<input>`; Radix native `<input>`; shadcn/ui `Input`; Chakra UI `Input` in `Field.Root`; MUI `TextField`\\n- `textarea` — Reka UI native `<textarea>`; Radix native `<textarea>`; shadcn/ui `Textarea`; Chakra UI `Textarea` in `Field.Root`; MUI `TextField multiline`\\n- `numberField` — Reka UI `NumberFieldRoot`, `NumberFieldInput`, `NumberFieldIncrement`, `NumberFieldDecrement`; Radix native `<input type=\\\"number\\\">` with stepper buttons; shadcn/ui `Input type=\\\"number\\\"`; Chakra UI `NumberInput.Root`, `NumberInput.Input`, `NumberInput.IncrementTrigger`, `NumberInput.DecrementTrigger`; MUI `TextField type=\\\"number\\\"`\\n- `toggle` — Reka UI `Toggle`; Radix `Toggle.Root`; shadcn/ui `Toggle`; Chakra UI `Button` with `aria-pressed`; MUI `ToggleButton`\\n- `switch` — Reka UI `SwitchRoot`, `SwitchThumb`; Radix `Switch.Root`, `Switch.Thumb`; shadcn/ui `Switch`; Chakra UI `Switch.Root`, `Switch.Control`, `Switch.Thumb`; MUI `Switch`\\n- `checkbox` — Reka UI `CheckboxRoot`, `CheckboxIndicator`; Radix `Checkbox.Root`, `Checkbox.Indicator`; shadcn/ui `Checkbox`; Chakra UI `Checkbox.Root`, `Checkbox.Control`, `Checkbox.Indicator`; MUI `Checkbox`\\n- `radioGroup` — Reka UI `RadioGroupRoot`, `RadioGroupItem`, `RadioGroupIndicator`; Radix `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.Indicator`; shadcn/ui `RadioGroup`, `RadioGroupItem`; Chakra UI `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.ItemIndicator`; MUI `RadioGroup` with `Radio` in `FormControlLabel`\\n- `toggleGroup` — Reka UI `ToggleGroupRoot`, `ToggleGroupItem`; Radix `ToggleGroup.Root`, `ToggleGroup.Item`; shadcn/ui `ToggleGroup`, `ToggleGroupItem`; Chakra UI `SegmentGroup.Root`, `SegmentGroup.Item`; MUI `ToggleButtonGroup`, `ToggleButton`\\n- `slider` — Reka UI `SliderRoot`, `SliderTrack`, `SliderRange`, `SliderThumb`; Radix `Slider.Root`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; shadcn/ui `Slider`; Chakra UI `Slider.Root`, `Slider.Control`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; MUI `Slider` (`rail`, `track`, `thumb` slots)\\n- `progress` — Reka UI `ProgressRoot`, `ProgressIndicator`; Radix `Progress.Root`, `Progress.Indicator`; shadcn/ui `Progress`; Chakra UI `Progress.Root`, `Progress.Track`, `Progress.Range`; MUI `LinearProgress variant=\\\"determinate\\\"`\\n- `tabs` — Reka UI `TabsRoot`, `TabsList`, `TabsTrigger`, `TabsContent`; Radix `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; shadcn/ui `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`; Chakra UI `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; MUI `Tabs`, `Tab`, with a panel per tab\\n- `collapsible` — Reka UI `CollapsibleRoot`, `CollapsibleTrigger`, `CollapsibleContent`; Radix `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; shadcn/ui `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent`; Chakra UI `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; MUI `Collapse` toggled by a `Button`\\n- `accordion` — Reka UI `AccordionRoot`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Radix `Accordion.Root`, `Accordion.Item`, `Accordion.Trigger`, `Accordion.Content`; shadcn/ui `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Chakra UI `Accordion.Root`, `Accordion.Item`, `Accordion.ItemTrigger`, `Accordion.ItemContent`; MUI `Accordion`, `AccordionSummary`, `AccordionDetails` per item\\n\\nA `radio` behaviour is one item of a `radioGroup`: its `RadioGroupItem`, `RadioGroup.Item`, or `Radio`. A behaviour's `items` slot holds the group's items and a tab list's children are its triggers, so the list above names the item parts too. In Reka UI and Radix an accordion trigger sits inside `AccordionHeader` / `Accordion.Header`. A `progress` behaviour's `track` slot is the root itself, `ProgressRoot` / `Progress.Root` in Reka UI and Radix (`Progress.Track` in Chakra UI), so do not add a wrapper for it. A `tabs` behaviour's `panels` slot has no part of its own: its children are the content parts, `TabsContent` / `Tabs.Content`, placed directly under the root.\\n\\nWhere each library keeps tokens and variants:\\n\\n- **shadcn/ui** — components are copied into the project (`components/ui`), so restyle them there to match the design rather than overriding every call site. Map semantic colors to its CSS variables (`--background`, `--foreground`, `--primary`, `--primary-foreground`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`) and the base corner radius to `--radius`, per mode under `.dark`. These replace the Tailwind rule against radius custom properties above because shadcn/ui already defines them. Add design variants to the component's `cva` `variants` (`variant`, `size`) under the design's own value names, and merge classes with `cn()`.\\n- **Radix (unstyled)** — style each part directly with the project's styling approach; state selectors are `[data-state=…]` and `[data-disabled]`, and Tailwind's `data-[state=checked]:` variants.\\n- **Chakra UI v3** — put tokens in `createSystem(defaultConfig, { theme: { tokens, semanticTokens } })`, with mode values as `{ base, _dark }` semantic tokens, and pass the system to `ChakraProvider`. Spacing, radius, and typography use style props (`gap`, `px`, `rounded`, `fontSize`). Component variants go in a `recipe` (single part) or `slotRecipe` (multi-part, such as switch or tabs).\\n- **MUI** — put tokens in `createTheme`: `palette` (one theme per mode, or `colorSchemes` with CSS variables), `typography`, `spacing`, and `shape.borderRadius`. Style instances with `sx` and reusable pieces with `styled()` from `@mui/material/styles`; add design variants to `components.<Name>.variants` and part overrides to `components.<Name>.styleOverrides` (`MuiSwitch`'s `thumb` and `track`, `MuiSlider`'s `rail`, `track`, and `thumb`).\\n- **The project's own components** — `design_to_component_map` lists the design's components with their variants and instance counts. Match each to an existing component in the codebase by name and role before writing a new one, and extend an existing component's props for a new variant rather than duplicating it.\\n\\n## Icons\\n\\n`get_jsx` writes a named icon as `<Icon name=\\\"lucide:arrow-right\\\" size={16} color=\\\"#6b7280\\\" />`. The name is an Iconify name, `<set>:<icon>`; `size` is its width and height; `color` is its color (black when absent); `label`, when present, is the name the designer gave the layer. Use it as `aria-label` when the icon stands alone and carries meaning (an icon button); otherwise the icon is decorative, so give it `aria-hidden=\\\"true\\\"`. Use the color through the same token the surrounding text uses when it matches one.\\n\\nEmit each icon from the icon package the user chose. Iconify set prefixes map to packages mechanically; convert the kebab-case icon name to PascalCase for the component:\\n\\n- `lucide:arrow-right` — `lucide-react`, `lucide-vue-next`, `@lucide/svelte`: `ArrowRight`, with `size` and `strokeWidth`\\n- `heroicons:arrow-right` (24 outline) — `@heroicons/react/24/outline` or `@heroicons/vue/24/outline`: `ArrowRightIcon`\\n- `heroicons:arrow-right-solid`, `-20-solid`, `-16-solid` — `@heroicons/react/24/solid`, `/20/solid`, `/16/solid`: `ArrowRightIcon`\\n- `fa6-solid:house`, `fa6-regular:heart`, `fa6-brands:github` — `@fortawesome/react-fontawesome` (or `vue-fontawesome`) with `@fortawesome/free-solid-svg-icons`, `free-regular-svg-icons`, `free-brands-svg-icons`: `<FontAwesomeIcon icon={faHouse} />`\\n- `tabler:home` — `@tabler/icons-react`: `IconHome`\\n- `ph:house` — `@phosphor-icons/react`: `House` (`@phosphor-icons/vue`: `PhHouse`). A `-thin`, `-light`, `-bold`, `-fill`, or `-duotone` suffix is the `weight` prop on the base component, not part of its name: `ph:house-bold` → `<House weight=\\\"bold\\\" />`\\n- `radix-icons:home` — `@radix-ui/react-icons`: `HomeIcon`\\n- `mdi:home` — `@mdi/react` with `@mdi/js`: `<Icon path={mdiHome} />`\\n\\nReact Icons bundles many sets under one package, each behind a prefix: `lucide:` → `react-icons/lu` (`LuArrowRight`), `heroicons:` → `react-icons/hi2` (`HiOutlineArrowRight`, `HiArrowRight` for solid, `HiMiniArrowRight` for `-20-solid`, `HiMicroArrowRight` for `-16-solid`), `fa6-solid:` / `fa6-regular:` / `fa6-brands:` → `react-icons/fa6` (`FaHouse`, `FaRegHeart`, `FaGithub`), `tabler:` → `react-icons/tb` (`TbHome`), `ph:` → `react-icons/pi` (`PiHouse`, with the weight kept in the name: `PiHouseBold`, `PiHouseFill`), `ic:` → `react-icons/md` (`MdHome`), `bi:` → `react-icons/bs` (`BsHouse`), `ri:` → `react-icons/ri` (`RiHomeLine`), `feather:` → `react-icons/fi` (`FiHome`), `simple-icons:` → `react-icons/si` (`SiGithub`). Size with `size`, color with `color` or a text color class.\\n\\nRules:\\n\\n- Check that the export exists in the installed package version; sets rename icons between releases. When the name differs, pick the package's equivalent and say so.\\n- When the design's set has no package in the chosen library (an `mdi:` icon with Lucide chosen), do not silently swap in a different-looking icon. Use Iconify for that icon (`@iconify/react` or `@iconify/vue`, `<Icon icon=\\\"mdi:home\\\" />`) or export it with `export_svg`, and list it under deviations. Replace it with the chosen set's closest icon only when the user asks for one consistent set.\\n- With no package chosen, use the package that owns the design's set (`lucide:` → `lucide-react`), or Iconify when the design mixes sets.\\n- Import icons by name from the package (`import { ArrowRight } from 'lucide-react'`); never import a whole set.\\n\\n## Component file structure\\n\\n```\\ncomponents/\\n Button.tsx (or .vue, .svelte)\\n Card.tsx\\n Header.tsx\\n ...\\ntokens.css (semantic color tokens only, for Tailwind projects)\\npages/\\n HomePage.tsx (or routes, views — depends on framework)\\nassets/\\n icon-arrow.svg\\n icon-check.svg\\n```\\n\\nIn Next.js screens are routes and assets are public files:\\n\\n```\\napp/\\n layout.tsx (fonts, shared chrome, global styles)\\n globals.css (tokens)\\n page.tsx (home screen)\\n settings/\\n page.tsx\\ncomponents/\\n Button.tsx\\n ui/ (shadcn/ui components, when used)\\npublic/\\n hero.png\\n```\\n\\n## Common patterns\\n\\n**Auto-layout → Flexbox**\\n\\n- `layoutMode: HORIZONTAL` → `flex-direction: row`\\n- `layoutMode: VERTICAL` → `flex-direction: column`\\n- `itemSpacing` → `gap`\\n- `paddingTop/Right/Bottom/Left` → `padding`\\n- `primaryAxisAlign: CENTER` → `justify-content: center`\\n- `counterAxisAlign: CENTER` → `align-items: center`\\n- `layoutWrap: WRAP` → `flex-wrap: wrap`\\n- `primaryAxisSizing: HUG` / `counterAxisSizing: HUG` → no explicit size on that axis (content-sized)\\n\\n**Grid layout**\\n\\n- `layoutMode: GRID` → `display: grid`\\n- `gridTemplateColumns` → `grid-template-columns`\\n- `gridTemplateRows` → `grid-template-rows`\\n- `gridColumnGap/gridRowGap` → `column-gap/row-gap`\\n\\n**Sizing**\\n\\n- Fill lives on the child: `layoutGrow > 0` fills the parent's primary axis (`flex-grow: 1`), `layoutAlignSelf: STRETCH` fills the cross axis (`align-self: stretch`, no fixed size on that axis). In a grid, `layoutGrow` fills the cell's width and `STRETCH` its height.\\n- Fixed width/height only on axes that neither hug nor fill\\n\\n**Corner radius**\\n\\n- `independentCorners: true` → per-corner border-radius\\n- `cornerRadius` → uniform border-radius\\n\\n**Effects**\\n\\n- `DROP_SHADOW` → `box-shadow`\\n- `INNER_SHADOW` → `box-shadow: inset ...`\\n- `LAYER_BLUR` → `filter: blur(...)`\\n- `BACKGROUND_BLUR` → `backdrop-filter: blur(...)`\\n\\n**Text**\\n\\n- `fontFamily` → `font-family`\\n- `fontSize` → `font-size`\\n- `fontWeight` → `font-weight`\\n- `lineHeight` → `line-height` (null = normal/auto)\\n- `letterSpacing` → `letter-spacing`\\n- `textAlignHorizontal` → `text-align`\\n- `textAutoResize: WIDTH_AND_HEIGHT` → no explicit dimensions\\n- `textAutoResize: HEIGHT` → fixed width, auto height\\n- `textAutoResize: NONE` → fixed width and height\\n- `textDecoration` → `text-decoration`\\n- `textCase` → `text-transform`\\n\\n## Scene authoring reference\\n\\nThe appended reference applies when inspecting or editing Pairdraw scenes, not to the target frontend framework's API.\\n\""],"mappings":";AAAA,IAAA,kBAAe"}
1
+ {"version":3,"file":"codegen.js","names":[],"sources":["../../../src/tools/prompts/codegen.md?raw"],"sourcesContent":["export default \"# Design to Code\\n\\nYou convert Figma designs into production frontend code. You have full access to the design document through tools. Never guess — always read the actual design data.\\n\\n> Note: Auto-layout and visual property names match the JSX props in the render system. Read geometry and style with `get_css` (CSS-like lines, colours as tokens), roles and design issues with `describe`, and structure with `get_jsx`.\\n\\n## Workflow\\n\\n### Step 1 — Survey\\n\\nUnderstand the full picture before writing any code.\\n\\n```\\nget_page_tree → document structure, all top-level frames\\nget_components → reusable components defined by the designer\\nlist_variables → design tokens (colors, numbers, strings, booleans)\\nlist_collections → variable collections and modes (light/dark, density, etc.)\\nanalyze_colors → color palette, frequencies, which colors use variables\\nanalyze_typography → font stacks, sizes, weights in use\\nanalyze_spacing → gap and padding values, grid compliance\\n```\\n\\nAfter this step you should know:\\n\\n- How many screens/pages the design has\\n- What components exist\\n- What the token system looks like (or if there is none)\\n- The typographic scale\\n- The spacing system (4px grid? 8px grid? irregular?)\\n\\n### Step 2 — Decompose\\n\\nIdentify the component architecture.\\n\\n```\\nanalyze_clusters → find repeated visual patterns that should be components\\nget_css (per node) → CSS shape: flex, gap, padding, size constraints, token colours, text\\ndescribe (per node) → semantic role, layout direction, visual properties, issues\\nget_jsx (per node) → structural JSX to understand nesting and layout\\n```\\n\\nBuild a component map:\\n\\n- **Screens** — top-level frames that represent pages/views\\n- **Components** — COMPONENT/COMPONENT_SET nodes or repeated patterns from analyze_clusters\\n- **Primitives** — leaf elements (text, icons, dividers) that don't need their own component file\\n\\nFor each component determine:\\n\\n- **Props** — what content varies between instances (text, color, icon, visibility)\\n- **Variants** — if the component has multiple states (default/hover/active, small/medium/large)\\n- **Slots** — where child content is injected\\n- **Behaviour** — `get_behaviour id=<component_id>` tells whether the designer made it a control, after Reka UI's primitives. Build such a component on that Reka primitive (`SwitchRoot` with `SwitchThumb`, `SliderRoot` with `SliderTrack`, `SliderRange`, and `SliderThumb`, `TabsRoot` with `TabsList`, `TabsTrigger`, and `TabsContent`, …): each part is the slot the behaviour names, its values are the properties it binds (`v-model` for the value, `disabled`), and its interaction states map to the variants for `data-state`, `:hover`, `:active`, `:focus-visible`, and `[data-disabled]`. Do not reimplement the control's keyboard and accessibility handling. In React use the Radix primitive with the same parts (Reka UI is the Vue port of Radix), and with a component library use its equivalent; see **Component libraries** below.\\n\\n### Step 3 — Extract tokens\\n\\n```\\nlist_variables → all variables with values per mode\\nlist_collections → collection structure and mode names\\n```\\n\\nMap design variables to code tokens. The approach depends on the target stack:\\n\\n#### Tailwind projects\\n\\nDo NOT create CSS custom properties for font sizes, font weights, spacing, or border radius — Tailwind has its own system for these. Use Tailwind utility classes directly:\\n\\n- Font sizes → `text-[13px]`, `text-sm`, `text-base`, etc.\\n- Font weights → `font-bold`, `font-medium`, `font-[600]`\\n- Spacing → `gap-3`, `p-4`, `px-5`, `py-[14px]`, or arbitrary `gap-[12px]`\\n- Border radius → `rounded-xl`, `rounded-[14px]`, `rounded-full`\\n\\nOnly create CSS custom properties for **semantic colors** — these are the values that would change across themes. Name them to avoid conflicts with Tailwind's built-in variables (do NOT use names like `--font-bold`, `--text-sm`, `--radius-lg`):\\n\\n```css\\n:root {\\n --movie-bg: #0f0f1a;\\n --movie-surface: #1a1a2e;\\n --movie-accent: #7c3aed;\\n --movie-text: #ffffff;\\n --movie-text-dim: #ffffff80;\\n}\\n```\\n\\nReference in Tailwind classes: `bg-[var(--movie-bg)]`, `text-[var(--movie-text)]`\\n\\n#### CSS Modules / plain CSS projects\\n\\nCreate CSS custom properties for all token categories (colors, spacing, typography, radius). Use a project-specific prefix to avoid collisions:\\n\\n```css\\n:root {\\n --app-color-bg: #0f0f1a;\\n --app-space-sm: 4px;\\n --app-text-sm: 12px;\\n --app-radius-md: 8px;\\n}\\n```\\n\\n#### Styled Components projects\\n\\nPut every token category in a typed theme object passed to `ThemeProvider`, and read it in styles as `${({ theme }) => theme.color.bg}`. Declare its type once by augmenting `DefaultTheme` in `styled.d.ts`:\\n\\n```ts\\nexport const theme = {\\n color: { bg: '#0f0f1a', surface: '#1a1a2e', accent: '#7c3aed', text: '#ffffff' },\\n space: { sm: '4px', md: '8px', lg: '16px' },\\n radius: { md: '8px', full: '9999px' },\\n font: { body: \\\"'Inter', sans-serif\\\" }\\n} as const\\n```\\n\\nFor multi-mode collections either build one theme object per mode and swap it on `ThemeProvider`, or write the colors as CSS custom properties in `createGlobalStyle` and keep the theme pointing at `var(--…)`, which switches without re-rendering.\\n\\n#### Component library projects\\n\\nWhen the project uses shadcn/ui, Chakra UI, or MUI, write tokens into the library's own theme instead of a parallel set of custom properties; see **Component libraries** below for where each one keeps them.\\n\\n#### No design variables in the file\\n\\nIf the design has no Figma variables, extract implicit tokens from `analyze_colors` and `analyze_typography` output — identify the de facto palette and type scale. For Tailwind projects, only extract semantic colors as CSS custom properties; use Tailwind utilities for everything else.\\n\\n#### Multi-mode collections (light/dark)\\n\\n- Generate token values for each mode\\n- Use CSS custom properties with class-based switching (`.dark { ... }`)\\n\\n### Step 4 — Generate code\\n\\nFor each component, bottom-up (primitives first, then composites, then screens):\\n\\n```\\nget_jsx id=<component_id> → read structure\\ndescribe id=<component_id> → understand semantic role\\nexport_svg ids=[<icon_ids>] → extract vector assets\\n```\\n\\n**Rules:**\\n\\n- One component per file\\n- Component name comes from the Figma node name, converted to PascalCase\\n- Props interface reflects the variable content identified in Step 2\\n- Use design tokens from Step 3 for semantic colors\\n- For Tailwind: use utility classes directly for spacing, font sizes, weights, radius — do NOT wrap them in `var()` indirection\\n- Match measurements exactly: font sizes, spacing, border radii, colors\\n- Use auto-layout data to determine flex direction, gap, padding, alignment\\n- Preserve text direction and container flow direction separately when the design uses RTL.\\n- Absolute positioning only when `layoutPositioning` is `ABSOLUTE` or layout mode is `NONE`\\n- If a node has `clipsContent: true`, use `overflow: hidden`\\n- Text nodes: preserve font family, size, weight, line height, letter spacing, alignment\\n- Images/illustrations: use `export_svg` for vectors, placeholder `<img>` for raster (`next/image` in Next.js)\\n- Icons: an `<Icon name=\\\"set:name\\\">` in `get_jsx` is an Iconify icon; emit it from the chosen icon package (see **Icons** below). An icon drawn as paths was edited or comes from no set, so export it with `export_svg`\\n\\n**Interactive states:**\\n\\nFigma designs rarely include hover/active/focus states unless the component has explicit variants for them. Always add sensible interactive feedback to clickable elements:\\n\\n- **Buttons (primary):** `hover:brightness-110 active:brightness-90 transition-all`\\n- **Buttons (secondary/ghost):** `hover:bg-white/[0.12] active:bg-white/[0.06] transition-colors`\\n- **Icon buttons:** `hover:bg-white/[0.15] active:scale-95 transition-all`\\n- **Cards/list items (if clickable):** `hover:bg-white/[0.04] transition-colors`\\n- **Links/text buttons:** `hover:underline` or `hover:opacity-80`\\n- **All interactive elements:** add `cursor-pointer` and `select-none`\\n- **Focus visible:** add `focus-visible:ring-2 focus-visible:ring-offset-2` with accent color for accessibility\\n\\nWith plain CSS, CSS Modules, or Styled Components write the same feedback as `:hover`, `:active`, and `:focus-visible` rules; with a component library keep its built-in states and adjust them through its theme.\\n\\nIf the design HAS explicit hover/active variants (COMPONENT_SET with state property), use those exact styles instead of defaults above.\\n\\n### Step 5 — Verify\\n\\nAfter generating code, verify against the design:\\n\\n```\\ndescribe id=<root> → re-check structure matches\\nget_jsx id=<root> → compare JSX structure with generated component tree\\n```\\n\\nCheck:\\n\\n- All text content from the design appears in the code\\n- All colors reference tokens or use correct hex/opacity values\\n- Spacing values match the design\\n- Component hierarchy matches the design's node tree\\n- No nodes were skipped or merged incorrectly\\n\\nList any deviations with rationale.\\n\\n## Target stack\\n\\nThe user specifies the target stack. Adapt code generation accordingly:\\n\\n**React + Tailwind** — functional components, TypeScript, utility classes, `className`\\n**React + CSS Modules** — functional components, TypeScript, `.module.css` files, `styles.className`\\n**React + Styled Components** — functional components, TypeScript, `styled.*` components and a typed theme (see **Styled Components**)\\n**Next.js** — React with the App Router, styled with Tailwind, CSS Modules, or Styled Components (see **Next.js**)\\n**Vue 3 + Tailwind** — `<script setup lang=\\\"ts\\\">`, `defineProps`, `<template>`, Tailwind utility classes\\n**Vue 3 + CSS** — `<script setup lang=\\\"ts\\\">`, `defineProps`, `<template>`, scoped `<style>`\\n**Svelte + Tailwind** — `<script lang=\\\"ts\\\">`, `$props()`, Tailwind utility classes\\n**HTML + CSS** — semantic HTML, BEM or utility classes, CSS custom properties\\n\\nTwo choices sit on top of the stack: the **component library** (shadcn/ui, Radix, Chakra UI, MUI, Reka UI, or the project's own components) and the **icon package** (Lucide, Heroicons, Font Awesome, React Icons, or Iconify). Read them from the project when you can see it: `package.json` dependencies, a `components.json` (shadcn/ui), existing imports.\\n\\nIf the user hasn't specified a stack, ask before generating code. Ask about the component library and icon package in the same question when the project does not show them.\\n\\n## Next.js\\n\\nTarget the App Router unless the project already uses `pages/`.\\n\\n- **Routes** — each screen is `app/<route>/page.tsx`; the home screen is `app/page.tsx`. Chrome shared by several screens (header, sidebar, footer that are the same instance or layers on each) goes in `app/layout.tsx` or a nested `layout.tsx`, not into every page. Name routes after the frame names in kebab-case.\\n- **Server and client components** — components are Server Components by default. Add `'use client'` only to the components that need state, event handlers, effects, or browser APIs: every behaviour control, anything with `onClick`, and Radix, Chakra, MUI, or Styled Components wrappers. Keep the boundary at the leaves: a page stays a Server Component that renders client leaves, and passes them data as serializable props.\\n- **Images** — use `next/image` for raster fills with the design's `width` and `height`; for an image that fills its frame use `fill` with `sizes`, on a parent with `position: relative`. Put exported assets in `public/` and reference them from `/`. Always pass `alt`, from the layer name or the surrounding text.\\n- **Fonts** — load design fonts with `next/font/google` (or `next/font/local` for fonts that are not on Google Fonts) in `app/layout.tsx`, only the weights `analyze_typography` reports, and expose each as a CSS variable (`variable: '--font-inter'`) that Tailwind or the theme reads.\\n- **Links** — a layer that navigates to another screen (nav items, text links, cards that open a detail screen) is `next/link`'s `<Link href>`, not a `<button>` or `<a onClick>`.\\n- **Metadata** — export `metadata` from each `page.tsx` with a `title` taken from the frame name.\\n- **Styling** — Tailwind tokens go in `app/globals.css`. CSS Modules work as in React. Styled Components need the compiler option (`compiler: { styledComponents: true }` in `next.config`) and a style registry client component that collects styles with `ServerStyleSheet` and `useServerInsertedHTML`, wrapped around `children` in `app/layout.tsx`; every file that calls `styled` is a client component.\\n\\n## Styled Components\\n\\n- One component file holds its styled elements, named after the layers they draw (`const Root = styled.button`, `const Label = styled.span`), or a sibling `Button.styles.ts` when it grows long.\\n- Variant properties become transient props (`$variant`, `$size`) so they never reach the DOM; select their styles with the `css` helper from a lookup keyed by the variant value, not nested ternaries.\\n- Interaction states are `&:hover`, `&:active`, `&:focus-visible`, and `&:disabled`. On a Radix primitive wrap it (`styled(Switch.Root)`) and style its `&[data-state='checked']` and `&[data-disabled]` attributes.\\n- Tokens come from the theme (see **Step 3**); never hard-code a value the design binds to a variable.\\n- Global resets, font faces, and mode custom properties go in one `createGlobalStyle`.\\n- Styled Components is React only. For Vue or Svelte write scoped styles instead.\\n\\n## Component libraries\\n\\nWhen the project uses a component library, build each behaviour control on that library's component instead of its own markup, and map the design's variant properties to the library's own props (`variant`, `size`, `disabled`). Style the parts the design draws differently through the library's styling hooks; do not rebuild a component the library provides. Components with no behaviour (cards, headers, list rows) stay the project's own components built from library layout primitives or plain elements.\\n\\nReka UI (Vue) and Radix (React) share part names: Reka's `SwitchRoot` is Radix's `Switch.Root`, and so on. shadcn/ui wraps Radix in React and shadcn-vue wraps Reka UI in Vue under the same component names. Both expose state as `data-state` (`checked`/`unchecked`, `on`/`off`, `open`/`closed`, `active`/`inactive`) and `data-disabled`, which is where the design's state variants go. Radix takes the value as a controlled pair instead of `v-model`: `checked`/`onCheckedChange` (switch, checkbox), `pressed`/`onPressedChange` (toggle), `open`/`onOpenChange` (collapsible), `value`/`onValueChange` (tabs, radio group, toggle group, accordion, slider with an array value). Import Radix from the unified `radix-ui` package (`import { Switch } from 'radix-ui'`) unless the project already uses the per-primitive `@radix-ui/react-*` packages.\\n\\n- `button` — Reka UI native `<button>`; Radix native `<button>`; shadcn/ui `Button`; Chakra UI `Button`; MUI `Button`\\n- `textField` — Reka UI native `<input>`; Radix native `<input>`; shadcn/ui `Input`; Chakra UI `Input` in `Field.Root`; MUI `TextField`\\n- `textarea` — Reka UI native `<textarea>`; Radix native `<textarea>`; shadcn/ui `Textarea`; Chakra UI `Textarea` in `Field.Root`; MUI `TextField multiline`\\n- `numberField` — Reka UI `NumberFieldRoot`, `NumberFieldInput`, `NumberFieldIncrement`, `NumberFieldDecrement`; Radix native `<input type=\\\"number\\\">` with stepper buttons; shadcn/ui `Input type=\\\"number\\\"`; Chakra UI `NumberInput.Root`, `NumberInput.Input`, `NumberInput.IncrementTrigger`, `NumberInput.DecrementTrigger`; MUI `TextField type=\\\"number\\\"`\\n- `toggle` — Reka UI `Toggle`; Radix `Toggle.Root`; shadcn/ui `Toggle`; Chakra UI `Button` with `aria-pressed`; MUI `ToggleButton`\\n- `switch` — Reka UI `SwitchRoot`, `SwitchThumb`; Radix `Switch.Root`, `Switch.Thumb`; shadcn/ui `Switch`; Chakra UI `Switch.Root`, `Switch.Control`, `Switch.Thumb`; MUI `Switch`\\n- `checkbox` — Reka UI `CheckboxRoot`, `CheckboxIndicator`; Radix `Checkbox.Root`, `Checkbox.Indicator`; shadcn/ui `Checkbox`; Chakra UI `Checkbox.Root`, `Checkbox.Control`, `Checkbox.Indicator`; MUI `Checkbox`\\n- `radioGroup` — Reka UI `RadioGroupRoot`, `RadioGroupItem`, `RadioGroupIndicator`; Radix `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.Indicator`; shadcn/ui `RadioGroup`, `RadioGroupItem`; Chakra UI `RadioGroup.Root`, `RadioGroup.Item`, `RadioGroup.ItemIndicator`; MUI `RadioGroup` with `Radio` in `FormControlLabel`\\n- `toggleGroup` — Reka UI `ToggleGroupRoot`, `ToggleGroupItem`; Radix `ToggleGroup.Root`, `ToggleGroup.Item`; shadcn/ui `ToggleGroup`, `ToggleGroupItem`; Chakra UI `SegmentGroup.Root`, `SegmentGroup.Item`; MUI `ToggleButtonGroup`, `ToggleButton`\\n- `slider` — Reka UI `SliderRoot`, `SliderTrack`, `SliderRange`, `SliderThumb`; Radix `Slider.Root`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; shadcn/ui `Slider`; Chakra UI `Slider.Root`, `Slider.Control`, `Slider.Track`, `Slider.Range`, `Slider.Thumb`; MUI `Slider` (`rail`, `track`, `thumb` slots)\\n- `progress` — Reka UI `ProgressRoot`, `ProgressIndicator`; Radix `Progress.Root`, `Progress.Indicator`; shadcn/ui `Progress`; Chakra UI `Progress.Root`, `Progress.Track`, `Progress.Range`; MUI `LinearProgress variant=\\\"determinate\\\"`\\n- `tabs` — Reka UI `TabsRoot`, `TabsList`, `TabsTrigger`, `TabsContent`; Radix `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; shadcn/ui `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`; Chakra UI `Tabs.Root`, `Tabs.List`, `Tabs.Trigger`, `Tabs.Content`; MUI `Tabs`, `Tab`, with a panel per tab\\n- `collapsible` — Reka UI `CollapsibleRoot`, `CollapsibleTrigger`, `CollapsibleContent`; Radix `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; shadcn/ui `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent`; Chakra UI `Collapsible.Root`, `Collapsible.Trigger`, `Collapsible.Content`; MUI `Collapse` toggled by a `Button`\\n- `accordion` — Reka UI `AccordionRoot`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Radix `Accordion.Root`, `Accordion.Item`, `Accordion.Trigger`, `Accordion.Content`; shadcn/ui `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`; Chakra UI `Accordion.Root`, `Accordion.Item`, `Accordion.ItemTrigger`, `Accordion.ItemContent`; MUI `Accordion`, `AccordionSummary`, `AccordionDetails` per item\\n\\nA `radio` behaviour is one item of a `radioGroup`: its `RadioGroupItem`, `RadioGroup.Item`, or `Radio`. A behaviour's `items` slot holds the group's items and a tab list's children are its triggers, so the list above names the item parts too. In Reka UI and Radix an accordion trigger sits inside `AccordionHeader` / `Accordion.Header`. A `progress` behaviour's `track` slot is the root itself, `ProgressRoot` / `Progress.Root` in Reka UI and Radix (`Progress.Track` in Chakra UI), so do not add a wrapper for it. A `tabs` behaviour's `panels` slot has no part of its own: its children are the content parts, `TabsContent` / `Tabs.Content`, placed directly under the root.\\n\\nWhere each library keeps tokens and variants:\\n\\n- **shadcn/ui** — components are copied into the project (`components/ui`), so restyle them there to match the design rather than overriding every call site. Map semantic colors to its CSS variables (`--background`, `--foreground`, `--primary`, `--primary-foreground`, `--secondary`, `--muted`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`) and the base corner radius to `--radius`, per mode under `.dark`. These replace the Tailwind rule against radius custom properties above because shadcn/ui already defines them. Add design variants to the component's `cva` `variants` (`variant`, `size`) under the design's own value names, and merge classes with `cn()`.\\n- **Radix (unstyled)** — style each part directly with the project's styling approach; state selectors are `[data-state=…]` and `[data-disabled]`, and Tailwind's `data-[state=checked]:` variants.\\n- **Chakra UI v3** — put tokens in `createSystem(defaultConfig, { theme: { tokens, semanticTokens } })`, with mode values as `{ base, _dark }` semantic tokens, and pass the system to `ChakraProvider`. Spacing, radius, and typography use style props (`gap`, `px`, `rounded`, `fontSize`). Component variants go in a `recipe` (single part) or `slotRecipe` (multi-part, such as switch or tabs).\\n- **MUI** — put tokens in `createTheme`: `palette` (one theme per mode, or `colorSchemes` with CSS variables), `typography`, `spacing`, and `shape.borderRadius`. Style instances with `sx` and reusable pieces with `styled()` from `@mui/material/styles`; add design variants to `components.<Name>.variants` and part overrides to `components.<Name>.styleOverrides` (`MuiSwitch`'s `thumb` and `track`, `MuiSlider`'s `rail`, `track`, and `thumb`).\\n- **The project's own components** — `design_to_component_map` lists the design's components with their variants and instance counts. Match each to an existing component in the codebase by name and role before writing a new one, and extend an existing component's props for a new variant rather than duplicating it.\\n\\n## Icons\\n\\n`get_jsx` writes a named icon as `<Icon name=\\\"lucide:arrow-right\\\" size={16} color=\\\"#6b7280\\\" />`. The name is an Iconify name, `<set>:<icon>`; `size` is its width and height; `color` is its color (black when absent); `label`, when present, is the name the designer gave the layer. Use it as `aria-label` when the icon stands alone and carries meaning (an icon button); otherwise the icon is decorative, so give it `aria-hidden=\\\"true\\\"`. Use the color through the same token the surrounding text uses when it matches one.\\n\\nEmit each icon from the icon package the user chose. Iconify set prefixes map to packages mechanically; convert the kebab-case icon name to PascalCase for the component:\\n\\n- `lucide:arrow-right` — `lucide-react`, `lucide-vue-next`, `@lucide/svelte`: `ArrowRight`, with `size` and `strokeWidth`\\n- `heroicons:arrow-right` (24 outline) — `@heroicons/react/24/outline` or `@heroicons/vue/24/outline`: `ArrowRightIcon`\\n- `heroicons:arrow-right-solid`, `-20-solid`, `-16-solid` — `@heroicons/react/24/solid`, `/20/solid`, `/16/solid`: `ArrowRightIcon`\\n- `fa6-solid:house`, `fa6-regular:heart`, `fa6-brands:github` — `@fortawesome/react-fontawesome` (or `vue-fontawesome`) with `@fortawesome/free-solid-svg-icons`, `free-regular-svg-icons`, `free-brands-svg-icons`: `<FontAwesomeIcon icon={faHouse} />`\\n- `tabler:home` — `@tabler/icons-react`: `IconHome`\\n- `ph:house` — `@phosphor-icons/react`: `House` (`@phosphor-icons/vue`: `PhHouse`). A `-thin`, `-light`, `-bold`, `-fill`, or `-duotone` suffix is the `weight` prop on the base component, not part of its name: `ph:house-bold` → `<House weight=\\\"bold\\\" />`\\n- `radix-icons:home` — `@radix-ui/react-icons`: `HomeIcon`\\n- `mdi:home` — `@mdi/react` with `@mdi/js`: `<Icon path={mdiHome} />`\\n\\nReact Icons bundles many sets under one package, each behind a prefix: `lucide:` → `react-icons/lu` (`LuArrowRight`), `heroicons:` → `react-icons/hi2` (`HiOutlineArrowRight`, `HiArrowRight` for solid, `HiMiniArrowRight` for `-20-solid`, `HiMicroArrowRight` for `-16-solid`), `fa6-solid:` / `fa6-regular:` / `fa6-brands:` → `react-icons/fa6` (`FaHouse`, `FaRegHeart`, `FaGithub`), `tabler:` → `react-icons/tb` (`TbHome`), `ph:` → `react-icons/pi` (`PiHouse`, with the weight kept in the name: `PiHouseBold`, `PiHouseFill`), `ic:` → `react-icons/md` (`MdHome`), `bi:` → `react-icons/bs` (`BsHouse`), `ri:` → `react-icons/ri` (`RiHomeLine`), `feather:` → `react-icons/fi` (`FiHome`), `simple-icons:` → `react-icons/si` (`SiGithub`). Size with `size`, color with `color` or a text color class.\\n\\nRules:\\n\\n- Check that the export exists in the installed package version; sets rename icons between releases. When the name differs, pick the package's equivalent and say so.\\n- When the design's set has no package in the chosen library (an `mdi:` icon with Lucide chosen), do not silently swap in a different-looking icon. Use Iconify for that icon (`@iconify/react` or `@iconify/vue`, `<Icon icon=\\\"mdi:home\\\" />`) or export it with `export_svg`, and list it under deviations. Replace it with the chosen set's closest icon only when the user asks for one consistent set.\\n- With no package chosen, use the package that owns the design's set (`lucide:` → `lucide-react`), or Iconify when the design mixes sets.\\n- Import icons by name from the package (`import { ArrowRight } from 'lucide-react'`); never import a whole set.\\n\\n## Component file structure\\n\\n```\\ncomponents/\\n Button.tsx (or .vue, .svelte)\\n Card.tsx\\n Header.tsx\\n ...\\ntokens.css (semantic color tokens only, for Tailwind projects)\\npages/\\n HomePage.tsx (or routes, views — depends on framework)\\nassets/\\n icon-arrow.svg\\n icon-check.svg\\n```\\n\\nIn Next.js screens are routes and assets are public files:\\n\\n```\\napp/\\n layout.tsx (fonts, shared chrome, global styles)\\n globals.css (tokens)\\n page.tsx (home screen)\\n settings/\\n page.tsx\\ncomponents/\\n Button.tsx\\n ui/ (shadcn/ui components, when used)\\npublic/\\n hero.png\\n```\\n\\n## Common patterns\\n\\n**Auto-layout → Flexbox**\\n\\n- `layoutMode: HORIZONTAL` → `flex-direction: row`\\n- `layoutMode: VERTICAL` → `flex-direction: column`\\n- `itemSpacing` → `gap`\\n- `paddingTop/Right/Bottom/Left` → `padding`\\n- `primaryAxisAlign: CENTER` → `justify-content: center`\\n- `counterAxisAlign: CENTER` → `align-items: center`\\n- `layoutWrap: WRAP` → `flex-wrap: wrap`\\n- `primaryAxisSizing: HUG` / `counterAxisSizing: HUG` → no explicit size on that axis (content-sized)\\n\\n**Grid layout**\\n\\n- `layoutMode: GRID` → `display: grid`\\n- `gridTemplateColumns` → `grid-template-columns`\\n- `gridTemplateRows` → `grid-template-rows`\\n- `gridColumnGap/gridRowGap` → `column-gap/row-gap`\\n\\n**Sizing**\\n\\n- Fill lives on the child: `layoutGrow > 0` fills the parent's primary axis (`flex-grow: 1`), `layoutAlignSelf: STRETCH` fills the cross axis (`align-self: stretch`, no fixed size on that axis). In a grid, `layoutGrow` fills the cell's width and `STRETCH` its height.\\n- Fixed width/height only on axes that neither hug nor fill\\n\\n**Corner radius**\\n\\n- `independentCorners: true` → per-corner border-radius\\n- `cornerRadius` → uniform border-radius\\n\\n**Effects**\\n\\n- `DROP_SHADOW` → `box-shadow`\\n- `INNER_SHADOW` → `box-shadow: inset ...`\\n- `LAYER_BLUR` → `filter: blur(...)`\\n- `BACKGROUND_BLUR` → `backdrop-filter: blur(...)`\\n\\n**Text**\\n\\n- `fontFamily` → `font-family`\\n- `fontSize` → `font-size`\\n- `fontWeight` → `font-weight`\\n- `lineHeight` → `line-height` (null = normal/auto)\\n- `letterSpacing` → `letter-spacing`\\n- `textAlignHorizontal` → `text-align`\\n- `textAutoResize: WIDTH_AND_HEIGHT` → no explicit dimensions\\n- `textAutoResize: HEIGHT` → fixed width, auto height\\n- `textAutoResize: NONE` → fixed width and height\\n- `textDecoration` → `text-decoration`\\n- `textCase` → `text-transform`\\n\\n## Scene authoring reference\\n\\nThe appended reference applies when inspecting or editing Pairdraw scenes, not to the target frontend framework's API.\\n\""],"mappings":";AAAA,IAAA,kBAAe"}
@@ -0,0 +1,14 @@
1
+ import { ToolDef } from "../schema.js";
2
+ //#region src/tools/read/css.d.ts
3
+ /**
4
+ * A subtree as CSS-shaped lines: one line per node, lengths in px, colours in the document's
5
+ * profile with the token that binds them in `var(--name, …)` form: hex in an sRGB document,
6
+ * `color(display-p3 …)` in a Display P3 one. This is the read side of the CSS shorthand the
7
+ * setters accept, so a value read here can be written back unchanged.
8
+ */
9
+ declare const DEFAULT_MAX_BYTES = 6000;
10
+ declare const HARD_MAX_BYTES = 20000;
11
+ declare const getCSS: ToolDef;
12
+ //#endregion
13
+ export { DEFAULT_MAX_BYTES, HARD_MAX_BYTES, getCSS };
14
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","names":[],"sources":["../../../src/tools/read/css.ts"],"mappings":";;;;;;;;cAca;cACA;cAmSA,QAAA"}