@llc3233149/core 0.9.0

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 (457) hide show
  1. package/dist/canvaskit.d.ts +9 -0
  2. package/dist/canvaskit.d.ts.map +1 -0
  3. package/dist/canvaskit.js +55 -0
  4. package/dist/canvaskit.js.map +1 -0
  5. package/dist/clipboard.d.ts +32 -0
  6. package/dist/clipboard.d.ts.map +1 -0
  7. package/dist/clipboard.js +345 -0
  8. package/dist/clipboard.js.map +1 -0
  9. package/dist/color.d.ts +28 -0
  10. package/dist/color.d.ts.map +1 -0
  11. package/dist/color.js +67 -0
  12. package/dist/color.js.map +1 -0
  13. package/dist/constants.d.ts +159 -0
  14. package/dist/constants.d.ts.map +1 -0
  15. package/dist/constants.js +224 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/copy.d.ts +20 -0
  18. package/dist/copy.d.ts.map +1 -0
  19. package/dist/copy.js +64 -0
  20. package/dist/copy.js.map +1 -0
  21. package/dist/fig-export-worker.d.ts +2 -0
  22. package/dist/fig-export-worker.d.ts.map +1 -0
  23. package/dist/fig-export-worker.js +17 -0
  24. package/dist/fig-export-worker.js.map +1 -0
  25. package/dist/fig-export.d.ts +13 -0
  26. package/dist/fig-export.d.ts.map +1 -0
  27. package/dist/fig-export.js +243 -0
  28. package/dist/fig-export.js.map +1 -0
  29. package/dist/figma-api.d.ts +268 -0
  30. package/dist/figma-api.d.ts.map +1 -0
  31. package/dist/figma-api.js +1074 -0
  32. package/dist/figma-api.js.map +1 -0
  33. package/dist/figma-rest-import.d.ts +122 -0
  34. package/dist/figma-rest-import.d.ts.map +1 -0
  35. package/dist/figma-rest-import.js +319 -0
  36. package/dist/figma-rest-import.js.map +1 -0
  37. package/dist/fonts.d.ts +24 -0
  38. package/dist/fonts.d.ts.map +1 -0
  39. package/dist/fonts.js +356 -0
  40. package/dist/fonts.js.map +1 -0
  41. package/dist/geometry.d.ts +14 -0
  42. package/dist/geometry.d.ts.map +1 -0
  43. package/dist/geometry.js +47 -0
  44. package/dist/geometry.js.map +1 -0
  45. package/dist/index.d.ts +38 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +32 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/kiwi/codec.d.ts +292 -0
  50. package/dist/kiwi/codec.d.ts.map +1 -0
  51. package/dist/kiwi/codec.js +340 -0
  52. package/dist/kiwi/codec.js.map +1 -0
  53. package/dist/kiwi/fig-file.d.ts +4 -0
  54. package/dist/kiwi/fig-file.d.ts.map +1 -0
  55. package/dist/kiwi/fig-file.js +236 -0
  56. package/dist/kiwi/fig-file.js.map +1 -0
  57. package/dist/kiwi/fig-import.d.ts +4 -0
  58. package/dist/kiwi/fig-import.d.ts.map +1 -0
  59. package/dist/kiwi/fig-import.js +248 -0
  60. package/dist/kiwi/fig-import.js.map +1 -0
  61. package/dist/kiwi/fig-parse-worker.d.ts +7 -0
  62. package/dist/kiwi/fig-parse-worker.d.ts.map +1 -0
  63. package/dist/kiwi/fig-parse-worker.js +184 -0
  64. package/dist/kiwi/fig-parse-worker.js.map +1 -0
  65. package/dist/kiwi/instance-overrides.d.ts +66 -0
  66. package/dist/kiwi/instance-overrides.d.ts.map +1 -0
  67. package/dist/kiwi/instance-overrides.js +644 -0
  68. package/dist/kiwi/instance-overrides.js.map +1 -0
  69. package/dist/kiwi/kiwi-convert.d.ts +19 -0
  70. package/dist/kiwi/kiwi-convert.d.ts.map +1 -0
  71. package/dist/kiwi/kiwi-convert.js +678 -0
  72. package/dist/kiwi/kiwi-convert.js.map +1 -0
  73. package/dist/kiwi/kiwi-schema/bb.d.ts +25 -0
  74. package/dist/kiwi/kiwi-schema/bb.d.ts.map +1 -0
  75. package/dist/kiwi/kiwi-schema/bb.js +225 -0
  76. package/dist/kiwi/kiwi-schema/bb.js.map +1 -0
  77. package/dist/kiwi/kiwi-schema/binary.d.ts +5 -0
  78. package/dist/kiwi/kiwi-schema/binary.d.ts.map +1 -0
  79. package/dist/kiwi/kiwi-schema/binary.js +86 -0
  80. package/dist/kiwi/kiwi-schema/binary.js.map +1 -0
  81. package/dist/kiwi/kiwi-schema/index.d.ts +6 -0
  82. package/dist/kiwi/kiwi-schema/index.d.ts.map +1 -0
  83. package/dist/kiwi/kiwi-schema/index.js +5 -0
  84. package/dist/kiwi/kiwi-schema/index.js.map +1 -0
  85. package/dist/kiwi/kiwi-schema/js.d.ts +4 -0
  86. package/dist/kiwi/kiwi-schema/js.d.ts.map +1 -0
  87. package/dist/kiwi/kiwi-schema/js.js +282 -0
  88. package/dist/kiwi/kiwi-schema/js.js.map +1 -0
  89. package/dist/kiwi/kiwi-schema/parser.d.ts +5 -0
  90. package/dist/kiwi/kiwi-schema/parser.d.ts.map +1 -0
  91. package/dist/kiwi/kiwi-schema/parser.js +228 -0
  92. package/dist/kiwi/kiwi-schema/parser.js.map +1 -0
  93. package/dist/kiwi/kiwi-schema/schema.d.ts +22 -0
  94. package/dist/kiwi/kiwi-schema/schema.d.ts.map +1 -0
  95. package/dist/kiwi/kiwi-schema/schema.js +2 -0
  96. package/dist/kiwi/kiwi-schema/schema.js.map +1 -0
  97. package/dist/kiwi/kiwi-schema/util.d.ts +3 -0
  98. package/dist/kiwi/kiwi-schema/util.d.ts.map +1 -0
  99. package/dist/kiwi/kiwi-schema/util.js +10 -0
  100. package/dist/kiwi/kiwi-schema/util.js.map +1 -0
  101. package/dist/kiwi/protocol.d.ts +172 -0
  102. package/dist/kiwi/protocol.d.ts.map +1 -0
  103. package/dist/kiwi/protocol.js +214 -0
  104. package/dist/kiwi/protocol.js.map +1 -0
  105. package/dist/kiwi/schema.d.ts +3 -0
  106. package/dist/kiwi/schema.d.ts.map +1 -0
  107. package/dist/kiwi/schema.js +2285 -0
  108. package/dist/kiwi/schema.js.map +1 -0
  109. package/dist/kiwi-serialize.d.ts +17 -0
  110. package/dist/kiwi-serialize.d.ts.map +1 -0
  111. package/dist/kiwi-serialize.js +419 -0
  112. package/dist/kiwi-serialize.js.map +1 -0
  113. package/dist/layout.d.ts +9 -0
  114. package/dist/layout.d.ts.map +1 -0
  115. package/dist/layout.js +533 -0
  116. package/dist/layout.js.map +1 -0
  117. package/dist/profiler/draw-call-counter.d.ts +9 -0
  118. package/dist/profiler/draw-call-counter.d.ts.map +1 -0
  119. package/dist/profiler/draw-call-counter.js +37 -0
  120. package/dist/profiler/draw-call-counter.js.map +1 -0
  121. package/dist/profiler/frame-capture.d.ts +34 -0
  122. package/dist/profiler/frame-capture.d.ts.map +1 -0
  123. package/dist/profiler/frame-capture.js +90 -0
  124. package/dist/profiler/frame-capture.js.map +1 -0
  125. package/dist/profiler/frame-stats.d.ts +33 -0
  126. package/dist/profiler/frame-stats.d.ts.map +1 -0
  127. package/dist/profiler/frame-stats.js +103 -0
  128. package/dist/profiler/frame-stats.js.map +1 -0
  129. package/dist/profiler/gpu-timer.d.ts +15 -0
  130. package/dist/profiler/gpu-timer.d.ts.map +1 -0
  131. package/dist/profiler/gpu-timer.js +77 -0
  132. package/dist/profiler/gpu-timer.js.map +1 -0
  133. package/dist/profiler/hud-renderer.d.ts +22 -0
  134. package/dist/profiler/hud-renderer.d.ts.map +1 -0
  135. package/dist/profiler/hud-renderer.js +200 -0
  136. package/dist/profiler/hud-renderer.js.map +1 -0
  137. package/dist/profiler/index.d.ts +9 -0
  138. package/dist/profiler/index.d.ts.map +1 -0
  139. package/dist/profiler/index.js +8 -0
  140. package/dist/profiler/index.js.map +1 -0
  141. package/dist/profiler/phase-timer.d.ts +9 -0
  142. package/dist/profiler/phase-timer.d.ts.map +1 -0
  143. package/dist/profiler/phase-timer.js +51 -0
  144. package/dist/profiler/phase-timer.js.map +1 -0
  145. package/dist/profiler/render-profiler.d.ts +41 -0
  146. package/dist/profiler/render-profiler.d.ts.map +1 -0
  147. package/dist/profiler/render-profiler.js +142 -0
  148. package/dist/profiler/render-profiler.js.map +1 -0
  149. package/dist/render/components.d.ts +25 -0
  150. package/dist/render/components.d.ts.map +1 -0
  151. package/dist/render/components.js +55 -0
  152. package/dist/render/components.js.map +1 -0
  153. package/dist/render/emoji-icons.d.ts +5 -0
  154. package/dist/render/emoji-icons.d.ts.map +1 -0
  155. package/dist/render/emoji-icons.js +55 -0
  156. package/dist/render/emoji-icons.js.map +1 -0
  157. package/dist/render/export-code.d.ts +9 -0
  158. package/dist/render/export-code.d.ts.map +1 -0
  159. package/dist/render/export-code.js +335 -0
  160. package/dist/render/export-code.js.map +1 -0
  161. package/dist/render/export-jsx.d.ts +5 -0
  162. package/dist/render/export-jsx.d.ts.map +1 -0
  163. package/dist/render/export-jsx.js +621 -0
  164. package/dist/render/export-jsx.js.map +1 -0
  165. package/dist/render/index.d.ts +8 -0
  166. package/dist/render/index.d.ts.map +1 -0
  167. package/dist/render/index.js +8 -0
  168. package/dist/render/index.js.map +1 -0
  169. package/dist/render/jsx-runtime.d.ts +31 -0
  170. package/dist/render/jsx-runtime.d.ts.map +1 -0
  171. package/dist/render/jsx-runtime.js +13 -0
  172. package/dist/render/jsx-runtime.js.map +1 -0
  173. package/dist/render/mini-react.d.ts +14 -0
  174. package/dist/render/mini-react.d.ts.map +1 -0
  175. package/dist/render/mini-react.js +16 -0
  176. package/dist/render/mini-react.js.map +1 -0
  177. package/dist/render/render-jsx.d.ts +24 -0
  178. package/dist/render/render-jsx.d.ts.map +1 -0
  179. package/dist/render/render-jsx.js +51 -0
  180. package/dist/render/render-jsx.js.map +1 -0
  181. package/dist/render/renderer.d.ts +16 -0
  182. package/dist/render/renderer.d.ts.map +1 -0
  183. package/dist/render/renderer.js +437 -0
  184. package/dist/render/renderer.js.map +1 -0
  185. package/dist/render/tailwind.d.ts +20 -0
  186. package/dist/render/tailwind.d.ts.map +1 -0
  187. package/dist/render/tailwind.js +115 -0
  188. package/dist/render/tailwind.js.map +1 -0
  189. package/dist/render/tree.d.ts +72 -0
  190. package/dist/render/tree.d.ts.map +1 -0
  191. package/dist/render/tree.js +63 -0
  192. package/dist/render/tree.js.map +1 -0
  193. package/dist/render-image.d.ts +19 -0
  194. package/dist/render-image.d.ts.map +1 -0
  195. package/dist/render-image.js +84 -0
  196. package/dist/render-image.js.map +1 -0
  197. package/dist/renderer/effects.d.ts +9 -0
  198. package/dist/renderer/effects.d.ts.map +1 -0
  199. package/dist/renderer/effects.js +44 -0
  200. package/dist/renderer/effects.js.map +1 -0
  201. package/dist/renderer/fills.d.ts +9 -0
  202. package/dist/renderer/fills.d.ts.map +1 -0
  203. package/dist/renderer/fills.js +189 -0
  204. package/dist/renderer/fills.js.map +1 -0
  205. package/dist/renderer/index.d.ts +2 -0
  206. package/dist/renderer/index.d.ts.map +1 -0
  207. package/dist/renderer/index.js +2 -0
  208. package/dist/renderer/index.js.map +1 -0
  209. package/dist/renderer/label-cache.d.ts +43 -0
  210. package/dist/renderer/label-cache.d.ts.map +1 -0
  211. package/dist/renderer/label-cache.js +85 -0
  212. package/dist/renderer/label-cache.js.map +1 -0
  213. package/dist/renderer/labels.d.ts +6 -0
  214. package/dist/renderer/labels.d.ts.map +1 -0
  215. package/dist/renderer/labels.js +126 -0
  216. package/dist/renderer/labels.js.map +1 -0
  217. package/dist/renderer/lru-cache.d.ts +20 -0
  218. package/dist/renderer/lru-cache.d.ts.map +1 -0
  219. package/dist/renderer/lru-cache.js +65 -0
  220. package/dist/renderer/lru-cache.js.map +1 -0
  221. package/dist/renderer/overlays.d.ts +25 -0
  222. package/dist/renderer/overlays.d.ts.map +1 -0
  223. package/dist/renderer/overlays.js +783 -0
  224. package/dist/renderer/overlays.js.map +1 -0
  225. package/dist/renderer/renderer.d.ts +229 -0
  226. package/dist/renderer/renderer.d.ts.map +1 -0
  227. package/dist/renderer/renderer.js +909 -0
  228. package/dist/renderer/renderer.js.map +1 -0
  229. package/dist/renderer/rulers.d.ts +8 -0
  230. package/dist/renderer/rulers.d.ts.map +1 -0
  231. package/dist/renderer/rulers.js +147 -0
  232. package/dist/renderer/rulers.js.map +1 -0
  233. package/dist/renderer/scene.d.ts +11 -0
  234. package/dist/renderer/scene.d.ts.map +1 -0
  235. package/dist/renderer/scene.js +392 -0
  236. package/dist/renderer/scene.js.map +1 -0
  237. package/dist/renderer/shapes.d.ts +13 -0
  238. package/dist/renderer/shapes.d.ts.map +1 -0
  239. package/dist/renderer/shapes.js +160 -0
  240. package/dist/renderer/shapes.js.map +1 -0
  241. package/dist/renderer/strokes.d.ts +9 -0
  242. package/dist/renderer/strokes.d.ts.map +1 -0
  243. package/dist/renderer/strokes.js +180 -0
  244. package/dist/renderer/strokes.js.map +1 -0
  245. package/dist/rpc/commands.d.ts +202 -0
  246. package/dist/rpc/commands.d.ts.map +1 -0
  247. package/dist/rpc/commands.js +429 -0
  248. package/dist/rpc/commands.js.map +1 -0
  249. package/dist/rpc/index.d.ts +3 -0
  250. package/dist/rpc/index.d.ts.map +1 -0
  251. package/dist/rpc/index.js +2 -0
  252. package/dist/rpc/index.js.map +1 -0
  253. package/dist/scene-graph.d.ts +318 -0
  254. package/dist/scene-graph.d.ts.map +1 -0
  255. package/dist/scene-graph.js +803 -0
  256. package/dist/scene-graph.js.map +1 -0
  257. package/dist/snap.d.ts +16 -0
  258. package/dist/snap.d.ts.map +1 -0
  259. package/dist/snap.js +97 -0
  260. package/dist/snap.js.map +1 -0
  261. package/dist/style-runs.d.ts +20 -0
  262. package/dist/style-runs.d.ts.map +1 -0
  263. package/dist/style-runs.js +168 -0
  264. package/dist/style-runs.js.map +1 -0
  265. package/dist/svg-export/defs.d.ts +19 -0
  266. package/dist/svg-export/defs.d.ts.map +1 -0
  267. package/dist/svg-export/defs.js +191 -0
  268. package/dist/svg-export/defs.js.map +1 -0
  269. package/dist/svg-export/index.d.ts +8 -0
  270. package/dist/svg-export/index.d.ts.map +1 -0
  271. package/dist/svg-export/index.js +318 -0
  272. package/dist/svg-export/index.js.map +1 -0
  273. package/dist/svg-export/paths.d.ts +9 -0
  274. package/dist/svg-export/paths.d.ts.map +1 -0
  275. package/dist/svg-export/paths.js +189 -0
  276. package/dist/svg-export/paths.js.map +1 -0
  277. package/dist/svg-node.d.ts +8 -0
  278. package/dist/svg-node.d.ts.map +1 -0
  279. package/dist/svg-node.js +48 -0
  280. package/dist/svg-node.js.map +1 -0
  281. package/dist/text-editor.d.ts +57 -0
  282. package/dist/text-editor.d.ts.map +1 -0
  283. package/dist/text-editor.js +337 -0
  284. package/dist/text-editor.js.map +1 -0
  285. package/dist/tools/ai-adapter.d.ts +22 -0
  286. package/dist/tools/ai-adapter.d.ts.map +1 -0
  287. package/dist/tools/ai-adapter.js +121 -0
  288. package/dist/tools/ai-adapter.js.map +1 -0
  289. package/dist/tools/analyze.d.ts +22 -0
  290. package/dist/tools/analyze.d.ts.map +1 -0
  291. package/dist/tools/analyze.js +677 -0
  292. package/dist/tools/analyze.js.map +1 -0
  293. package/dist/tools/create.d.ts +8 -0
  294. package/dist/tools/create.d.ts.map +1 -0
  295. package/dist/tools/create.js +204 -0
  296. package/dist/tools/create.js.map +1 -0
  297. package/dist/tools/describe.d.ts +9 -0
  298. package/dist/tools/describe.d.ts.map +1 -0
  299. package/dist/tools/describe.js +295 -0
  300. package/dist/tools/describe.js.map +1 -0
  301. package/dist/tools/export-code.d.ts +2 -0
  302. package/dist/tools/export-code.d.ts.map +1 -0
  303. package/dist/tools/export-code.js +34 -0
  304. package/dist/tools/export-code.js.map +1 -0
  305. package/dist/tools/export-tailwind-config.d.ts +27 -0
  306. package/dist/tools/export-tailwind-config.d.ts.map +1 -0
  307. package/dist/tools/export-tailwind-config.js +215 -0
  308. package/dist/tools/export-tailwind-config.js.map +1 -0
  309. package/dist/tools/icons.d.ts +5 -0
  310. package/dist/tools/icons.d.ts.map +1 -0
  311. package/dist/tools/icons.js +192 -0
  312. package/dist/tools/icons.js.map +1 -0
  313. package/dist/tools/index.d.ts +7 -0
  314. package/dist/tools/index.d.ts.map +1 -0
  315. package/dist/tools/index.js +6 -0
  316. package/dist/tools/index.js.map +1 -0
  317. package/dist/tools/modify.d.ts +22 -0
  318. package/dist/tools/modify.d.ts.map +1 -0
  319. package/dist/tools/modify.js +653 -0
  320. package/dist/tools/modify.js.map +1 -0
  321. package/dist/tools/patterns.d.ts +2 -0
  322. package/dist/tools/patterns.d.ts.map +1 -0
  323. package/dist/tools/patterns.js +173 -0
  324. package/dist/tools/patterns.js.map +1 -0
  325. package/dist/tools/read.d.ts +17 -0
  326. package/dist/tools/read.d.ts.map +1 -0
  327. package/dist/tools/read.js +379 -0
  328. package/dist/tools/read.js.map +1 -0
  329. package/dist/tools/registry.d.ts +3 -0
  330. package/dist/tools/registry.d.ts.map +1 -0
  331. package/dist/tools/registry.js +124 -0
  332. package/dist/tools/registry.js.map +1 -0
  333. package/dist/tools/schema.d.ts +46 -0
  334. package/dist/tools/schema.d.ts.map +1 -0
  335. package/dist/tools/schema.js +17 -0
  336. package/dist/tools/schema.js.map +1 -0
  337. package/dist/tools/structure.d.ts +18 -0
  338. package/dist/tools/structure.d.ts.map +1 -0
  339. package/dist/tools/structure.js +345 -0
  340. package/dist/tools/structure.js.map +1 -0
  341. package/dist/tools/variables.d.ts +12 -0
  342. package/dist/tools/variables.d.ts.map +1 -0
  343. package/dist/tools/variables.js +190 -0
  344. package/dist/tools/variables.js.map +1 -0
  345. package/dist/tools/vector.d.ts +15 -0
  346. package/dist/tools/vector.d.ts.map +1 -0
  347. package/dist/tools/vector.js +312 -0
  348. package/dist/tools/vector.js.map +1 -0
  349. package/dist/types.d.ts +29 -0
  350. package/dist/types.d.ts.map +1 -0
  351. package/dist/types.js +2 -0
  352. package/dist/types.js.map +1 -0
  353. package/dist/undo.d.ts +33 -0
  354. package/dist/undo.d.ts.map +1 -0
  355. package/dist/undo.js +98 -0
  356. package/dist/undo.js.map +1 -0
  357. package/dist/vector.d.ts +14 -0
  358. package/dist/vector.d.ts.map +1 -0
  359. package/dist/vector.js +334 -0
  360. package/dist/vector.js.map +1 -0
  361. package/dist/xpath.d.ts +8 -0
  362. package/dist/xpath.d.ts.map +1 -0
  363. package/dist/xpath.js +199 -0
  364. package/dist/xpath.js.map +1 -0
  365. package/package.json +54 -0
  366. package/src/canvaskit.ts +66 -0
  367. package/src/clipboard.ts +444 -0
  368. package/src/color.ts +83 -0
  369. package/src/constants.ts +277 -0
  370. package/src/copy.ts +75 -0
  371. package/src/fig-export-worker.ts +28 -0
  372. package/src/fig-export.ts +321 -0
  373. package/src/figma-api.ts +1297 -0
  374. package/src/figma-rest-import.ts +443 -0
  375. package/src/fonts.ts +369 -0
  376. package/src/geometry.ts +73 -0
  377. package/src/global.d.ts +20 -0
  378. package/src/index.ts +247 -0
  379. package/src/kiwi/codec.ts +614 -0
  380. package/src/kiwi/fig-file.ts +248 -0
  381. package/src/kiwi/fig-import.ts +300 -0
  382. package/src/kiwi/fig-parse-worker.ts +213 -0
  383. package/src/kiwi/instance-overrides.ts +682 -0
  384. package/src/kiwi/kiwi-convert.ts +771 -0
  385. package/src/kiwi/kiwi-schema/bb.ts +244 -0
  386. package/src/kiwi/kiwi-schema/binary.ts +102 -0
  387. package/src/kiwi/kiwi-schema/index.ts +5 -0
  388. package/src/kiwi/kiwi-schema/js.ts +339 -0
  389. package/src/kiwi/kiwi-schema/parser.ts +287 -0
  390. package/src/kiwi/kiwi-schema/schema.ts +24 -0
  391. package/src/kiwi/kiwi-schema/util.ts +10 -0
  392. package/src/kiwi/protocol.ts +237 -0
  393. package/src/kiwi/schema.ts +2286 -0
  394. package/src/kiwi-serialize.ts +467 -0
  395. package/src/layout.ts +608 -0
  396. package/src/profiler/draw-call-counter.ts +43 -0
  397. package/src/profiler/frame-capture.ts +139 -0
  398. package/src/profiler/frame-stats.ts +122 -0
  399. package/src/profiler/gpu-timer.ts +93 -0
  400. package/src/profiler/hud-renderer.ts +242 -0
  401. package/src/profiler/index.ts +8 -0
  402. package/src/profiler/phase-timer.ts +62 -0
  403. package/src/profiler/render-profiler.ts +163 -0
  404. package/src/render/components.ts +69 -0
  405. package/src/render/emoji-icons.ts +60 -0
  406. package/src/render/export-code.ts +366 -0
  407. package/src/render/export-jsx.ts +633 -0
  408. package/src/render/index.ts +38 -0
  409. package/src/render/jsx-runtime.ts +36 -0
  410. package/src/render/mini-react.ts +30 -0
  411. package/src/render/render-jsx.ts +74 -0
  412. package/src/render/renderer.ts +508 -0
  413. package/src/render/tailwind.ts +114 -0
  414. package/src/render/tree.ts +137 -0
  415. package/src/render-image.ts +139 -0
  416. package/src/renderer/effects.ts +64 -0
  417. package/src/renderer/fills.ts +248 -0
  418. package/src/renderer/index.ts +1 -0
  419. package/src/renderer/label-cache.ts +114 -0
  420. package/src/renderer/labels.ts +168 -0
  421. package/src/renderer/lru-cache.ts +71 -0
  422. package/src/renderer/overlays.ts +1089 -0
  423. package/src/renderer/renderer.ts +1226 -0
  424. package/src/renderer/rulers.ts +230 -0
  425. package/src/renderer/scene.ts +554 -0
  426. package/src/renderer/shapes.ts +193 -0
  427. package/src/renderer/strokes.ts +221 -0
  428. package/src/rpc/commands.ts +667 -0
  429. package/src/rpc/index.ts +25 -0
  430. package/src/scene-graph.ts +1254 -0
  431. package/src/snap.ts +122 -0
  432. package/src/style-runs.ts +234 -0
  433. package/src/svg-export/defs.ts +255 -0
  434. package/src/svg-export/index.ts +427 -0
  435. package/src/svg-export/paths.ts +212 -0
  436. package/src/svg-node.ts +62 -0
  437. package/src/text-editor.ts +349 -0
  438. package/src/tools/ai-adapter.ts +144 -0
  439. package/src/tools/analyze.ts +786 -0
  440. package/src/tools/create.ts +206 -0
  441. package/src/tools/describe.ts +280 -0
  442. package/src/tools/export-code.ts +41 -0
  443. package/src/tools/export-tailwind-config.ts +266 -0
  444. package/src/tools/icons.ts +213 -0
  445. package/src/tools/index.ts +6 -0
  446. package/src/tools/modify.ts +651 -0
  447. package/src/tools/patterns.ts +189 -0
  448. package/src/tools/read.ts +401 -0
  449. package/src/tools/registry.ts +155 -0
  450. package/src/tools/schema.ts +65 -0
  451. package/src/tools/structure.ts +348 -0
  452. package/src/tools/variables.ts +193 -0
  453. package/src/tools/vector.ts +311 -0
  454. package/src/types.ts +32 -0
  455. package/src/undo.ts +126 -0
  456. package/src/vector.ts +413 -0
  457. package/src/xpath.ts +259 -0
@@ -0,0 +1,266 @@
1
+ import { colorToHex } from '../color'
2
+ import { defineTool } from './schema'
3
+ import type { SceneGraph } from '../scene-graph'
4
+
5
+ interface FigmaPage {
6
+ findAll(predicate: (node: { id: string; type: string }) => boolean): { id: string; type: string }[]
7
+ }
8
+
9
+ interface FigmaContext {
10
+ currentPage: FigmaPage
11
+ graph: SceneGraph
12
+ }
13
+
14
+ interface ColorToken {
15
+ name: string
16
+ hex: string
17
+ count: number
18
+ }
19
+
20
+ interface TypographyToken {
21
+ family: string
22
+ sizes: number[]
23
+ }
24
+
25
+ interface SpacingToken {
26
+ value: number
27
+ count: number
28
+ }
29
+
30
+ /**
31
+ * Build a Tailwind v4 config object from scene graph analysis.
32
+ * Pure function — takes extracted tokens, returns a config string.
33
+ */
34
+ export function buildTailwindConfig(opts: {
35
+ colors: ColorToken[]
36
+ typography: TypographyToken[]
37
+ spacing: SpacingToken[]
38
+ borderRadius: number[]
39
+ prefix?: string
40
+ }): string {
41
+ const { colors, typography, spacing, borderRadius, prefix } = opts
42
+ const lines: string[] = [
43
+ '/** @type {import(\'tailwindcss\').Config} */',
44
+ 'export default {',
45
+ ' theme: {',
46
+ ' extend: {'
47
+ ]
48
+
49
+ // Colors
50
+ if (colors.length > 0) {
51
+ lines.push(' colors: {')
52
+ for (const c of colors) {
53
+ const key = sanitizeKey(c.name, prefix)
54
+ lines.push(` '${key}': '${c.hex}',`)
55
+ }
56
+ lines.push(' },')
57
+ }
58
+
59
+ // Font families
60
+ const families = [...new Set(typography.map((t) => t.family))].filter(Boolean)
61
+ if (families.length > 0) {
62
+ lines.push(' fontFamily: {')
63
+ for (const family of families) {
64
+ const key = sanitizeKey(family, prefix)
65
+ lines.push(` '${key}': ['${family}', 'sans-serif'],`)
66
+ }
67
+ lines.push(' },')
68
+ }
69
+
70
+ // Font sizes
71
+ const allSizes = [...new Set(typography.flatMap((t) => t.sizes))].sort((a, b) => a - b)
72
+ if (allSizes.length > 0) {
73
+ lines.push(' fontSize: {')
74
+ for (const size of allSizes) {
75
+ lines.push(` '${size}': '${size}px',`)
76
+ }
77
+ lines.push(' },')
78
+ }
79
+
80
+ // Spacing
81
+ if (spacing.length > 0) {
82
+ lines.push(' spacing: {')
83
+ for (const s of spacing) {
84
+ lines.push(` '${s.value}': '${s.value}px',`)
85
+ }
86
+ lines.push(' },')
87
+ }
88
+
89
+ // Border radius
90
+ if (borderRadius.length > 0) {
91
+ lines.push(' borderRadius: {')
92
+ for (const r of borderRadius) {
93
+ lines.push(` '${r}': '${r}px',`)
94
+ }
95
+ lines.push(' },')
96
+ }
97
+
98
+ lines.push(' },')
99
+ lines.push(' },')
100
+ lines.push('}')
101
+
102
+ return lines.join('\n')
103
+ }
104
+
105
+ function sanitizeKey(name: string, prefix?: string): string {
106
+ const clean = name
107
+ .toLowerCase()
108
+ .replace(/[^a-z0-9]+/g, '-')
109
+ .replace(/^-+|-+$/g, '')
110
+ return prefix ? `${prefix}-${clean}` : clean
111
+ }
112
+
113
+ /**
114
+ * Extract color tokens from the scene graph.
115
+ */
116
+ function extractColors(figma: FigmaContext): ColorToken[] {
117
+ const colorMap = new Map<string, ColorToken>()
118
+
119
+ figma.currentPage.findAll((node) => {
120
+ const raw = figma.graph.getNode(node.id)
121
+ if (!raw) return false
122
+
123
+ const boundVars = raw.boundVariables
124
+ for (const fill of raw.fills) {
125
+ if (fill.type === 'SOLID' && fill.visible) {
126
+ const hex = colorToHex(fill.color)
127
+ const varName = boundVars['fills'] ? String(boundVars['fills']) : null
128
+ const name = varName ?? hex
129
+ const entry = colorMap.get(hex)
130
+ if (entry) {
131
+ entry.count++
132
+ if (varName && entry.name === hex) entry.name = varName
133
+ } else {
134
+ colorMap.set(hex, { name, hex, count: 1 })
135
+ }
136
+ }
137
+ }
138
+ for (const stroke of raw.strokes) {
139
+ if (stroke.visible) {
140
+ const hex = colorToHex(stroke.color)
141
+ const varName = boundVars['strokes'] ? String(boundVars['strokes']) : null
142
+ const name = varName ?? hex
143
+ const entry = colorMap.get(hex)
144
+ if (entry) {
145
+ entry.count++
146
+ if (varName && entry.name === hex) entry.name = varName
147
+ } else {
148
+ colorMap.set(hex, { name, hex, count: 1 })
149
+ }
150
+ }
151
+ }
152
+ return false
153
+ })
154
+
155
+ return [...colorMap.values()].sort((a, b) => b.count - a.count)
156
+ }
157
+
158
+ /**
159
+ * Extract typography tokens from the scene graph.
160
+ */
161
+ function extractTypography(figma: FigmaContext): TypographyToken[] {
162
+ const familyMap = new Map<string, Set<number>>()
163
+
164
+ figma.currentPage.findAll((node) => {
165
+ if (node.type !== 'TEXT') return false
166
+ const raw = figma.graph.getNode(node.id)
167
+ if (!raw) return false
168
+
169
+ const family = raw.fontFamily
170
+ if (!family) return false
171
+
172
+ const sizes = familyMap.get(family) ?? new Set<number>()
173
+ sizes.add(raw.fontSize)
174
+ familyMap.set(family, sizes)
175
+ return false
176
+ })
177
+
178
+ return [...familyMap.entries()].map(([family, sizes]) => ({
179
+ family,
180
+ sizes: [...sizes].sort((a, b) => a - b)
181
+ }))
182
+ }
183
+
184
+ /**
185
+ * Extract spacing tokens from the scene graph.
186
+ */
187
+ function extractSpacing(figma: FigmaContext): SpacingToken[] {
188
+ const spacingMap = new Map<number, number>()
189
+
190
+ figma.currentPage.findAll((node) => {
191
+ const raw = figma.graph.getNode(node.id)
192
+ if (!raw) return false
193
+
194
+ if (raw.layoutMode !== 'NONE' && raw.itemSpacing > 0) {
195
+ spacingMap.set(raw.itemSpacing, (spacingMap.get(raw.itemSpacing) ?? 0) + 1)
196
+ }
197
+ for (const p of [raw.paddingTop, raw.paddingRight, raw.paddingBottom, raw.paddingLeft]) {
198
+ if (p > 0) {
199
+ spacingMap.set(p, (spacingMap.get(p) ?? 0) + 1)
200
+ }
201
+ }
202
+ return false
203
+ })
204
+
205
+ return [...spacingMap.entries()]
206
+ .sort((a, b) => b[1] - a[1])
207
+ .map(([value, count]) => ({ value, count }))
208
+ }
209
+
210
+ /**
211
+ * Extract border radius values from the scene graph.
212
+ */
213
+ function extractBorderRadius(figma: FigmaContext): number[] {
214
+ const radii = new Set<number>()
215
+
216
+ figma.currentPage.findAll((node) => {
217
+ const raw = figma.graph.getNode(node.id)
218
+ if (!raw) return false
219
+
220
+ for (const r of [raw.topLeftRadius, raw.topRightRadius, raw.bottomRightRadius, raw.bottomLeftRadius]) {
221
+ if (r > 0) radii.add(r)
222
+ }
223
+ return false
224
+ })
225
+
226
+ return [...radii].sort((a, b) => a - b)
227
+ }
228
+
229
+ // ─── Tool definition ─────────────────────────────────────────
230
+
231
+ export const exportTailwindConfig = defineTool({
232
+ name: 'export_tailwind_config',
233
+ description:
234
+ 'Generate a Tailwind CSS config from the current page\'s design tokens — colors, typography, spacing, and border radius.',
235
+ params: {
236
+ prefix: {
237
+ type: 'string',
238
+ description: 'Optional prefix for token keys (e.g. "brand")'
239
+ }
240
+ },
241
+ execute: (figma, args) => {
242
+ const colors = extractColors(figma)
243
+ const typography = extractTypography(figma)
244
+ const spacing = extractSpacing(figma)
245
+ const borderRadius = extractBorderRadius(figma)
246
+
247
+ const config = buildTailwindConfig({
248
+ colors,
249
+ typography,
250
+ spacing,
251
+ borderRadius,
252
+ prefix: args.prefix
253
+ })
254
+
255
+ return {
256
+ config,
257
+ summary: {
258
+ colors: colors.length,
259
+ fontFamilies: new Set(typography.map((t) => t.family)).size,
260
+ fontSizes: new Set(typography.flatMap((t) => t.sizes)).size,
261
+ spacingValues: spacing.length,
262
+ borderRadiusValues: borderRadius.length
263
+ }
264
+ }
265
+ }
266
+ })
@@ -0,0 +1,213 @@
1
+ import { defineTool, nodeSummary } from './schema'
2
+ import { parseColor } from '../color'
3
+ import type { VectorNetwork } from '../scene-graph'
4
+
5
+ /**
6
+ * Stroke-based icon library (24×24 viewbox, Lucide-style).
7
+ * Each icon is a VectorNetwork with vertices, segments, and regions.
8
+ * Tangents {x:0,y:0} = straight line segments.
9
+ */
10
+
11
+ const T0 = { x: 0, y: 0 }
12
+
13
+ // Helper: build a simple polyline (open path, no regions)
14
+ function polyline(...pts: [number, number][]): VectorNetwork {
15
+ const vertices = pts.map(([x, y]) => ({ x, y }))
16
+ const segments = []
17
+ for (let i = 0; i < pts.length - 1; i++) {
18
+ segments.push({ start: i, end: i + 1, tangentStart: T0, tangentEnd: T0 })
19
+ }
20
+ return { vertices, segments, regions: [] }
21
+ }
22
+
23
+ // Helper: merge multiple networks into one
24
+ function merge(...nets: VectorNetwork[]): VectorNetwork {
25
+ const vertices: VectorNetwork['vertices'] = []
26
+ const segments: VectorNetwork['segments'] = []
27
+ const regions: VectorNetwork['regions'] = []
28
+ for (const n of nets) {
29
+ const off = vertices.length
30
+ vertices.push(...n.vertices)
31
+ segments.push(...n.segments.map(s => ({
32
+ ...s, start: s.start + off, end: s.end + off
33
+ })))
34
+ regions.push(...n.regions.map(r => ({
35
+ ...r, loops: r.loops.map(l => l.map(i => i + segments.length - n.segments.length + i - i))
36
+ })))
37
+ }
38
+ // Fix region loop indices properly
39
+ let segOff = 0
40
+ const fixedRegions: VectorNetwork['regions'] = []
41
+ let vOff = 0
42
+ for (const n of nets) {
43
+ for (const r of n.regions) {
44
+ fixedRegions.push({
45
+ ...r,
46
+ loops: r.loops.map(l => l.map(i => i + segOff))
47
+ })
48
+ }
49
+ segOff += n.segments.length
50
+ vOff += n.vertices.length
51
+ }
52
+ return { vertices, segments, regions: fixedRegions }
53
+ }
54
+
55
+ // Closed shape helper: polyline that closes back to start, with a filled region
56
+ function closedShape(...pts: [number, number][]): VectorNetwork {
57
+ const vertices = pts.map(([x, y]) => ({ x, y }))
58
+ const segments = []
59
+ for (let i = 0; i < pts.length; i++) {
60
+ segments.push({ start: i, end: (i + 1) % pts.length, tangentStart: T0, tangentEnd: T0 })
61
+ }
62
+ const loop = segments.map((_, i) => i)
63
+ return { vertices, segments, regions: [{ windingRule: 'NONZERO', loops: [loop] }] }
64
+ }
65
+
66
+ // Circle approximation with cubic bezier (4 arcs)
67
+ function circle(cx: number, cy: number, r: number): VectorNetwork {
68
+ const k = r * 0.5523 // bezier approximation constant
69
+ const vertices = [
70
+ { x: cx, y: cy - r }, // top
71
+ { x: cx + r, y: cy }, // right
72
+ { x: cx, y: cy + r }, // bottom
73
+ { x: cx - r, y: cy }, // left
74
+ ]
75
+ const segments = [
76
+ { start: 0, end: 1, tangentStart: { x: k, y: 0 }, tangentEnd: { x: 0, y: -k } },
77
+ { start: 1, end: 2, tangentStart: { x: 0, y: k }, tangentEnd: { x: k, y: 0 } },
78
+ { start: 2, end: 3, tangentStart: { x: -k, y: 0 }, tangentEnd: { x: 0, y: k } },
79
+ { start: 3, end: 0, tangentStart: { x: 0, y: -k }, tangentEnd: { x: -k, y: 0 } },
80
+ ]
81
+ return { vertices, segments, regions: [{ windingRule: 'NONZERO', loops: [[0, 1, 2, 3]] }] }
82
+ }
83
+
84
+ export const ICONS: Record<string, VectorNetwork> = {
85
+ // Navigation
86
+ home: merge(polyline([3,9],[12,2],[21,9]), polyline([4,10],[4,20],[10,20],[10,14],[14,14],[14,20],[20,20],[20,10])),
87
+ 'arrow-left': merge(polyline([19,12],[5,12]), polyline([12,19],[5,12],[12,5])),
88
+ 'arrow-right': merge(polyline([5,12],[19,12]), polyline([12,5],[19,12],[12,19])),
89
+ 'chevron-left': polyline([15,18],[9,12],[15,6]),
90
+ 'chevron-right': polyline([9,6],[15,12],[9,18]),
91
+ 'chevron-down': polyline([6,9],[12,15],[18,9]),
92
+ menu: merge(polyline([3,12],[21,12]), polyline([3,6],[21,6]), polyline([3,18],[21,18])),
93
+
94
+ // Actions
95
+ search: merge(circle(11, 11, 8), polyline([21,21],[16.65,16.65])),
96
+ plus: merge(polyline([12,5],[12,19]), polyline([5,12],[19,12])),
97
+ minus: polyline([5,12],[19,12]),
98
+ x: merge(polyline([18,6],[6,18]), polyline([6,6],[18,18])),
99
+ check: polyline([20,6],[9,17],[4,12]),
100
+ edit: merge(polyline([11,4],[4,4],[4,20],[20,20],[20,13]), polyline([18.5,2.5],[21.5,5.5],[12,15],[8,15],[8,11],[17.5,1.5])),
101
+
102
+ // Common UI
103
+ user: merge(circle(12, 8, 4), polyline([4,20],[4,18],[8,14],[16,14],[20,18],[20,20])),
104
+ users: merge(circle(9, 7, 4), polyline([2,21],[2,19],[6,15],[12,15],[16,19],[16,21]), circle(19, 7, 3), polyline([17,14],[21,18],[22,21])),
105
+ settings: merge(circle(12, 12, 3), polyline([12,2],[12,4]), polyline([12,20],[12,22]), polyline([2,12],[4,12]), polyline([20,12],[22,12]), polyline([4.93,4.93],[6.34,6.34]), polyline([17.66,17.66],[19.07,19.07]), polyline([4.93,19.07],[6.34,17.66]), polyline([17.66,6.34],[19.07,4.93])),
106
+ heart: polyline([12,21],[3,13],[3,8],[6,4],[10,4],[12,7],[14,4],[18,4],[21,8],[21,13],[12,21]),
107
+ star: polyline([12,2],[15.09,8.26],[22,9.27],[17,14.14],[18.18,21.02],[12,17.77],[5.82,21.02],[7,14.14],[2,9.27],[8.91,8.26],[12,2]),
108
+ bell: merge(polyline([10,21],[14,21]), polyline([18,8],[18,13],[21,17],[3,17],[6,13],[6,8],[6,5],[9,3],[12,3],[15,3],[18,5])),
109
+ mail: merge(closedShape([2,4],[22,4],[22,20],[2,20]), polyline([2,4],[12,13],[22,4])),
110
+ phone: closedShape([5,2],[8,2],[9,6],[7,8],[9,12],[12,15],[16,15],[18,13],[22,16],[22,19],[20,22],[4,22],[2,19],[2,5]),
111
+ calendar: merge(closedShape([3,4],[21,4],[21,22],[3,22]), polyline([16,2],[16,6]), polyline([8,2],[8,6]), polyline([3,10],[21,10])),
112
+ clock: merge(circle(12, 12, 10), polyline([12,6],[12,12],[16,14])),
113
+
114
+ // Media
115
+ image: merge(closedShape([3,3],[21,3],[21,21],[3,21]), circle(8.5, 8.5, 2.5), polyline([21,15],[16,10],[5,21])),
116
+ camera: merge(polyline([4,7],[4,20],[20,20],[20,7],[17,7],[15,4],[9,4],[7,7],[4,7]), circle(12, 13, 3)),
117
+ play: closedShape([5,3],[19,12],[5,21]),
118
+ pause: merge(closedShape([6,4],[10,4],[10,20],[6,20]), closedShape([14,4],[18,4],[18,20],[14,20])),
119
+
120
+ // Files
121
+ file: polyline([14,2],[6,2],[6,22],[18,22],[18,6],[14,2],[14,6],[18,6]),
122
+ folder: polyline([2,4],[2,20],[22,20],[22,8],[12,8],[10,4],[2,4]),
123
+ download: merge(polyline([12,3],[12,15]), polyline([5,12],[12,19],[19,12]), polyline([3,21],[21,21])),
124
+ upload: merge(polyline([12,19],[12,7]), polyline([5,14],[12,7],[19,14]), polyline([3,21],[21,21])),
125
+ trash: merge(polyline([3,6],[21,6]), polyline([8,6],[8,3],[16,3],[16,6]), polyline([5,6],[6,21],[18,21],[19,6]), polyline([10,10],[10,17]), polyline([14,10],[14,17])),
126
+ copy: merge(polyline([8,4],[4,4],[4,16],[8,16]), closedShape([8,8],[20,8],[20,20],[8,20])),
127
+
128
+ // Communication
129
+ 'message-circle': merge(circle(12, 11, 9), polyline([8,20],[12,17])),
130
+ send: merge(polyline([22,2],[15,22],[11,13],[2,9],[22,2]), polyline([11,13],[22,2])),
131
+ share: merge(circle(18, 5, 3), circle(6, 12, 3), circle(18, 19, 3), polyline([8.59,13.51],[15.42,17.49]), polyline([15.41,6.51],[8.59,10.49])),
132
+
133
+ // Status
134
+ 'alert-circle': merge(circle(12, 12, 10), polyline([12,8],[12,12]), polyline([12,16],[12,16.01])),
135
+ 'check-circle': merge(circle(12, 12, 10), polyline([9,12],[11,14],[15,10])),
136
+ info: merge(circle(12, 12, 10), polyline([12,16],[12,12]), polyline([12,8],[12,8.01])),
137
+ eye: merge(polyline([1,12],[5,6],[12,4],[19,6],[23,12],[19,18],[12,20],[5,18],[1,12]), circle(12, 12, 3)),
138
+ 'eye-off': merge(polyline([1,1],[23,23]), polyline([17.94,17.94],[12,20],[5,18],[1,12],[5,6],[9,4.5]), polyline([14.12,4.08],[19,6],[23,12],[20,16.5]), circle(12, 12, 3)),
139
+
140
+ // Layout
141
+ grid: merge(polyline([3,3],[21,3],[21,21],[3,21],[3,3]), polyline([3,9],[21,9]), polyline([3,15],[21,15]), polyline([9,3],[9,21]), polyline([15,3],[15,21])),
142
+ list: merge(polyline([8,6],[21,6]), polyline([8,12],[21,12]), polyline([8,18],[21,18]), polyline([3,6],[3.01,6]), polyline([3,12],[3.01,12]), polyline([3,18],[3.01,18])),
143
+ filter: polyline([22,3],[2,3],[10,12.46],[10,19],[14,21],[14,12.46],[22,3]),
144
+ 'log-out': merge(polyline([9,21],[5,21],[5,3],[9,3]), polyline([16,17],[21,12],[16,7]), polyline([21,12],[9,12])),
145
+ 'log-in': merge(polyline([15,3],[19,3],[19,21],[15,21]), polyline([10,7],[15,12],[10,17]), polyline([15,12],[3,12])),
146
+
147
+ // Misc
148
+ link: merge(polyline([10,13],[14,9],[16,7],[19,7],[21,9],[21,12],[19,14],[17,16]), polyline([14,11],[10,15],[8,17],[5,17],[3,15],[3,12],[5,10],[7,8])),
149
+ 'external-link': merge(polyline([18,13],[18,19],[5,19],[5,6],[11,6]), polyline([15,3],[21,3],[21,9]), polyline([10,14],[21,3])),
150
+ refresh: merge(polyline([1,4],[1,10],[7,10]), polyline([23,20],[23,14],[17,14]), polyline([3.51,15],[7,19],[12,20],[17,19],[20.49,15]), polyline([20.49,9],[17,5],[12,4],[7,5],[3.51,9])),
151
+ loader: merge(polyline([12,2],[12,6]), polyline([12,18],[12,22]), polyline([4.93,4.93],[7.76,7.76]), polyline([16.24,16.24],[19.07,19.07]), polyline([2,12],[6,12]), polyline([18,12],[22,12]), polyline([4.93,19.07],[7.76,16.24]), polyline([16.24,7.76],[19.07,4.93])),
152
+ zap: polyline([13,2],[3,14],[12,14],[11,22],[21,10],[12,10],[13,2]),
153
+ globe: merge(circle(12, 12, 10), polyline([2,12],[22,12]), polyline([12,2],[9,6],[8,12],[9,18],[12,22]), polyline([12,2],[15,6],[16,12],[15,18],[12,22])),
154
+ }
155
+
156
+ export const ICON_NAMES = Object.keys(ICONS)
157
+
158
+ export const createIcon = defineTool({
159
+ name: 'create_icon',
160
+ mutates: true,
161
+ description: 'Create a vector icon from the built-in icon library. Returns a sized, colored vector node. Use this instead of emoji or unicode symbols for professional icons.',
162
+ params: {
163
+ name: {
164
+ type: 'string', required: true,
165
+ description: 'Icon name',
166
+ enum: ICON_NAMES
167
+ },
168
+ x: { type: 'number', description: 'X position' },
169
+ y: { type: 'number', description: 'Y position' },
170
+ size: { type: 'number', description: 'Icon size in px (default 24)' },
171
+ color: { type: 'color', description: 'Icon color hex (default #374151)' },
172
+ parent_id: { type: 'string', description: 'Parent node ID' }
173
+ },
174
+ execute: (figma, args) => {
175
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- defensive: runtime key may not exist
176
+ const network: VectorNetwork | undefined = ICONS[args.name]
177
+ if (!network) return { error: `Unknown icon "${args.name}". Available: ${ICON_NAMES.join(', ')}` }
178
+
179
+ const size = args.size ?? 24
180
+ const scale = size / 24
181
+ const color = args.color ?? '#374151'
182
+
183
+ // Scale the network to requested size
184
+ const scaled: VectorNetwork = {
185
+ vertices: network.vertices.map(v => ({ ...v, x: v.x * scale, y: v.y * scale })),
186
+ segments: network.segments.map(s => ({
187
+ ...s,
188
+ tangentStart: { x: s.tangentStart.x * scale, y: s.tangentStart.y * scale },
189
+ tangentEnd: { x: s.tangentEnd.x * scale, y: s.tangentEnd.y * scale }
190
+ })),
191
+ regions: network.regions
192
+ }
193
+
194
+ const node = figma.createVector()
195
+ node.x = args.x ?? 0
196
+ node.y = args.y ?? 0
197
+ node.resize(size, size)
198
+ node.name = args.name
199
+ figma.graph.updateNode(node.id, { vectorNetwork: scaled } as any)
200
+
201
+ // Apply stroke for line icons
202
+ const c = parseColor(color)
203
+ node.strokes = [{ color: c, weight: scale * 2, opacity: 1, visible: true, align: 'CENTER' }]
204
+ node.fills = []
205
+
206
+ if (args.parent_id) {
207
+ const parent = figma.getNodeById(args.parent_id)
208
+ if (parent) parent.appendChild(node)
209
+ }
210
+
211
+ return nodeSummary(node)
212
+ }
213
+ })
@@ -0,0 +1,6 @@
1
+ export { ALL_TOOLS } from './registry'
2
+ export { defineTool, nodeToResult, nodeSummary } from './schema'
3
+ export type { ToolDef, ParamDef, ParamType } from './schema'
4
+ export { toolsToAI, extractNodeIds } from './ai-adapter'
5
+ export { buildTailwindConfig } from './export-tailwind-config'
6
+ export { selectionToCode, type CodeFormat } from '../render/export-code'