@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,678 @@
1
+ import { normalizeColor } from '../color.js';
2
+ import { DEFAULT_FONT_FAMILY, DEFAULT_STROKE_MITER_LIMIT } from '../constants.js';
3
+ import { styleToWeight } from '../fonts.js';
4
+ import { decodeVectorNetworkBlob } from '../vector.js';
5
+ export function guidToString(guid) {
6
+ return `${guid.sessionID}:${guid.localID}`;
7
+ }
8
+ export function stringToGuid(str) {
9
+ const [session, local] = str.split(':');
10
+ return { sessionID: parseInt(session, 10), localID: parseInt(local, 10) };
11
+ }
12
+ export const VARIABLE_BINDING_FIELDS = {
13
+ cornerRadius: 'CORNER_RADIUS',
14
+ topLeftRadius: 'RECTANGLE_TOP_LEFT_CORNER_RADIUS',
15
+ topRightRadius: 'RECTANGLE_TOP_RIGHT_CORNER_RADIUS',
16
+ bottomLeftRadius: 'RECTANGLE_BOTTOM_LEFT_CORNER_RADIUS',
17
+ bottomRightRadius: 'RECTANGLE_BOTTOM_RIGHT_CORNER_RADIUS',
18
+ strokeWeight: 'STROKE_WEIGHT',
19
+ itemSpacing: 'STACK_SPACING',
20
+ paddingLeft: 'STACK_PADDING_LEFT',
21
+ paddingTop: 'STACK_PADDING_TOP',
22
+ paddingRight: 'STACK_PADDING_RIGHT',
23
+ paddingBottom: 'STACK_PADDING_BOTTOM',
24
+ counterAxisSpacing: 'STACK_COUNTER_SPACING',
25
+ visible: 'VISIBLE',
26
+ opacity: 'OPACITY',
27
+ width: 'WIDTH',
28
+ height: 'HEIGHT',
29
+ fontSize: 'FONT_SIZE',
30
+ letterSpacing: 'LETTER_SPACING',
31
+ lineHeight: 'LINE_HEIGHT'
32
+ };
33
+ export const VARIABLE_BINDING_FIELDS_INVERSE = Object.fromEntries(Object.entries(VARIABLE_BINDING_FIELDS).map(([k, v]) => [v, k]));
34
+ const convertColor = normalizeColor;
35
+ function imageHashToString(hash) {
36
+ const bytes = Object.keys(hash)
37
+ .sort((a, b) => Number(a) - Number(b))
38
+ .map((k) => hash[Number(k)]);
39
+ return bytes.map((b) => b.toString(16).padStart(2, '0')).join('');
40
+ }
41
+ function convertGradientTransform(t) {
42
+ if (!t)
43
+ return undefined;
44
+ return { m00: t.m00, m01: t.m01, m02: t.m02, m10: t.m10, m11: t.m11, m12: t.m12 };
45
+ }
46
+ export function convertFills(paints) {
47
+ if (!paints)
48
+ return [];
49
+ return paints.map((p) => {
50
+ const base = {
51
+ type: p.type,
52
+ color: convertColor(p.color),
53
+ opacity: p.opacity ?? 1,
54
+ visible: p.visible ?? true,
55
+ blendMode: (p.blendMode ?? 'NORMAL')
56
+ };
57
+ if (p.type.startsWith('GRADIENT') && p.stops) {
58
+ base.gradientStops = p.stops.map((s) => ({
59
+ color: convertColor(s.color),
60
+ position: s.position
61
+ }));
62
+ if (p.transform) {
63
+ base.gradientTransform = convertGradientTransform(p.transform);
64
+ }
65
+ }
66
+ if (p.type === 'IMAGE') {
67
+ if (p.image && typeof p.image === 'object') {
68
+ const img = p.image;
69
+ if (typeof img.hash === 'object') {
70
+ base.imageHash = imageHashToString(img.hash);
71
+ }
72
+ else if (typeof img.hash === 'string') {
73
+ base.imageHash = img.hash;
74
+ }
75
+ }
76
+ base.imageScaleMode = (p.imageScaleMode ?? 'FILL');
77
+ if (p.transform) {
78
+ base.imageTransform = convertGradientTransform(p.transform);
79
+ }
80
+ }
81
+ return base;
82
+ });
83
+ }
84
+ function convertStrokes(paints, weight, align, cap, join, dashPattern) {
85
+ if (!paints)
86
+ return [];
87
+ return paints.map((p) => ({
88
+ color: convertColor(p.color),
89
+ weight: weight ?? 1,
90
+ opacity: p.opacity ?? 1,
91
+ visible: p.visible ?? true,
92
+ align: (align === 'INSIDE'
93
+ ? 'INSIDE'
94
+ : (align === 'OUTSIDE'
95
+ ? 'OUTSIDE'
96
+ : 'CENTER')),
97
+ cap: (cap ?? 'NONE'),
98
+ join: (join ?? 'MITER'),
99
+ dashPattern: dashPattern ?? []
100
+ }));
101
+ }
102
+ function convertEffects(effects) {
103
+ if (!effects)
104
+ return [];
105
+ return effects.map((e) => ({
106
+ type: e.type,
107
+ color: convertColor(e.color),
108
+ offset: e.offset ?? { x: 0, y: 0 },
109
+ radius: e.radius ?? 0,
110
+ spread: e.spread ?? 0,
111
+ visible: e.visible ?? true,
112
+ blendMode: (e.blendMode ?? 'NORMAL')
113
+ }));
114
+ }
115
+ const NODE_TYPE_MAP = {
116
+ DOCUMENT: 'DOCUMENT',
117
+ VARIABLE: 'VARIABLE',
118
+ CANVAS: 'CANVAS',
119
+ FRAME: 'FRAME',
120
+ RECTANGLE: 'RECTANGLE',
121
+ ROUNDED_RECTANGLE: 'ROUNDED_RECTANGLE',
122
+ ELLIPSE: 'ELLIPSE',
123
+ TEXT: 'TEXT',
124
+ LINE: 'LINE',
125
+ STAR: 'STAR',
126
+ REGULAR_POLYGON: 'POLYGON',
127
+ VECTOR: 'VECTOR',
128
+ BOOLEAN_OPERATION: 'VECTOR',
129
+ GROUP: 'GROUP',
130
+ SECTION: 'SECTION',
131
+ COMPONENT: 'COMPONENT',
132
+ COMPONENT_SET: 'COMPONENT_SET',
133
+ INSTANCE: 'INSTANCE',
134
+ SYMBOL: 'COMPONENT',
135
+ CONNECTOR: 'CONNECTOR',
136
+ SHAPE_WITH_TEXT: 'SHAPE_WITH_TEXT'
137
+ };
138
+ function mapNodeType(type) {
139
+ if (type)
140
+ return NODE_TYPE_MAP[type] ?? 'RECTANGLE';
141
+ return 'RECTANGLE';
142
+ }
143
+ function mapStackMode(mode) {
144
+ switch (mode) {
145
+ case 'HORIZONTAL':
146
+ return 'HORIZONTAL';
147
+ case 'VERTICAL':
148
+ return 'VERTICAL';
149
+ default:
150
+ return 'NONE';
151
+ }
152
+ }
153
+ function mapStackSizing(sizing) {
154
+ switch (sizing) {
155
+ case 'RESIZE_TO_FIT':
156
+ case 'RESIZE_TO_FIT_WITH_IMPLICIT_SIZE':
157
+ return 'HUG';
158
+ case 'FILL':
159
+ return 'FILL';
160
+ default:
161
+ return 'FIXED';
162
+ }
163
+ }
164
+ function mapStackJustify(justify) {
165
+ switch (justify) {
166
+ case 'CENTER':
167
+ return 'CENTER';
168
+ case 'MAX':
169
+ return 'MAX';
170
+ case 'SPACE_BETWEEN':
171
+ return 'SPACE_BETWEEN';
172
+ default:
173
+ return 'MIN';
174
+ }
175
+ }
176
+ function mapStackCounterAlign(align) {
177
+ switch (align) {
178
+ case 'CENTER':
179
+ return 'CENTER';
180
+ case 'MAX':
181
+ return 'MAX';
182
+ case 'STRETCH':
183
+ return 'STRETCH';
184
+ case 'BASELINE':
185
+ return 'BASELINE';
186
+ default:
187
+ return 'MIN';
188
+ }
189
+ }
190
+ function mapAlignSelf(align) {
191
+ switch (align) {
192
+ case 'MIN':
193
+ return 'MIN';
194
+ case 'CENTER':
195
+ return 'CENTER';
196
+ case 'MAX':
197
+ return 'MAX';
198
+ case 'STRETCH':
199
+ return 'STRETCH';
200
+ case 'BASELINE':
201
+ return 'BASELINE';
202
+ default:
203
+ return 'AUTO';
204
+ }
205
+ }
206
+ function mapConstraint(c) {
207
+ switch (c) {
208
+ case 'CENTER':
209
+ return 'CENTER';
210
+ case 'MAX':
211
+ return 'MAX';
212
+ case 'STRETCH':
213
+ return 'STRETCH';
214
+ case 'SCALE':
215
+ return 'SCALE';
216
+ default:
217
+ return 'MIN';
218
+ }
219
+ }
220
+ function mapTextDecoration(d) {
221
+ switch (d) {
222
+ case 'UNDERLINE':
223
+ return 'UNDERLINE';
224
+ case 'STRIKETHROUGH':
225
+ return 'STRIKETHROUGH';
226
+ default:
227
+ return 'NONE';
228
+ }
229
+ }
230
+ function convertLineHeight(lh, fontSize) {
231
+ if (!lh)
232
+ return null;
233
+ if (lh.units === 'PIXELS')
234
+ return lh.value;
235
+ if (lh.units === 'PERCENT')
236
+ return (lh.value / 100) * (fontSize ?? 14);
237
+ if (lh.units === 'RAW')
238
+ return lh.value * (fontSize ?? 14);
239
+ return null;
240
+ }
241
+ function convertLetterSpacing(ls, fontSize) {
242
+ if (!ls)
243
+ return 0;
244
+ if (ls.units === 'PIXELS')
245
+ return ls.value;
246
+ if (ls.units === 'PERCENT')
247
+ return (ls.value / 100) * (fontSize ?? 14);
248
+ return ls.value;
249
+ }
250
+ function mapArcData(data) {
251
+ if (!data)
252
+ return null;
253
+ return {
254
+ startingAngle: data.startingAngle ?? 0,
255
+ endingAngle: data.endingAngle ?? 2 * Math.PI,
256
+ innerRadius: data.innerRadius ?? 0
257
+ };
258
+ }
259
+ function convertStyleOverride(override, fallbackFontSize) {
260
+ const style = {};
261
+ if (override.fontName) {
262
+ style.fontFamily = override.fontName.family;
263
+ style.fontWeight = styleToWeight(override.fontName.style);
264
+ style.italic = override.fontName.style.toLowerCase().includes('italic');
265
+ }
266
+ if (override.fontSize !== undefined)
267
+ style.fontSize = override.fontSize;
268
+ if (override.letterSpacing) {
269
+ style.letterSpacing = convertLetterSpacing(override.letterSpacing, override.fontSize ?? fallbackFontSize);
270
+ }
271
+ if (override.lineHeight) {
272
+ const lh = convertLineHeight(override.lineHeight, override.fontSize ?? fallbackFontSize);
273
+ if (lh != null)
274
+ style.lineHeight = lh;
275
+ }
276
+ const deco = override.textDecoration;
277
+ if (deco)
278
+ style.textDecoration = mapTextDecoration(deco);
279
+ return style;
280
+ }
281
+ function buildStyleMap(table, fallbackFontSize) {
282
+ const styleMap = new Map();
283
+ for (const override of table) {
284
+ const id = override.styleID;
285
+ if (id === undefined)
286
+ continue;
287
+ const style = convertStyleOverride(override, fallbackFontSize);
288
+ if (Object.keys(style).length > 0)
289
+ styleMap.set(id, style);
290
+ }
291
+ return styleMap;
292
+ }
293
+ function collectStyleRuns(ids, styleMap) {
294
+ const runs = [];
295
+ let currentId = ids[0];
296
+ let start = 0;
297
+ for (let i = 1; i <= ids.length; i++) {
298
+ if (i === ids.length || ids[i] !== currentId) {
299
+ if (currentId !== 0) {
300
+ const style = styleMap.get(currentId);
301
+ if (style)
302
+ runs.push({ start, length: i - start, style });
303
+ }
304
+ if (i < ids.length) {
305
+ currentId = ids[i];
306
+ start = i;
307
+ }
308
+ }
309
+ }
310
+ return runs;
311
+ }
312
+ function importStyleRuns(nc) {
313
+ const td = nc.textData;
314
+ if (!td?.characterStyleIDs || !td.styleOverrideTable)
315
+ return [];
316
+ const ids = td.characterStyleIDs;
317
+ if (ids.length === 0 || td.styleOverrideTable.length === 0)
318
+ return [];
319
+ const styleMap = buildStyleMap(td.styleOverrideTable, nc.fontSize);
320
+ if (styleMap.size === 0)
321
+ return [];
322
+ return collectStyleRuns(ids, styleMap);
323
+ }
324
+ function resolveVectorNetwork(nc, blobs) {
325
+ const vectorData = nc.vectorData;
326
+ if (vectorData?.vectorNetworkBlob === undefined)
327
+ return null;
328
+ const idx = vectorData.vectorNetworkBlob;
329
+ if (idx < 0 || idx >= blobs.length)
330
+ return null;
331
+ try {
332
+ const network = decodeVectorNetworkBlob(blobs[idx], vectorData.styleOverrideTable);
333
+ const ns = vectorData.normalizedSize;
334
+ const nodeW = nc.size?.x ?? 0;
335
+ const nodeH = nc.size?.y ?? 0;
336
+ if (ns && nodeW > 0 && nodeH > 0 && (ns.x !== nodeW || ns.y !== nodeH)) {
337
+ const sx = nodeW / ns.x;
338
+ const sy = nodeH / ns.y;
339
+ for (const v of network.vertices) {
340
+ v.x *= sx;
341
+ v.y *= sy;
342
+ }
343
+ for (const seg of network.segments) {
344
+ seg.tangentStart = { x: seg.tangentStart.x * sx, y: seg.tangentStart.y * sy };
345
+ seg.tangentEnd = { x: seg.tangentEnd.x * sx, y: seg.tangentEnd.y * sy };
346
+ }
347
+ }
348
+ return network;
349
+ }
350
+ catch {
351
+ return null;
352
+ }
353
+ }
354
+ export function resolveGeometryPaths(paths, blobs) {
355
+ if (!paths || paths.length === 0)
356
+ return [];
357
+ const result = [];
358
+ for (const p of paths) {
359
+ if (p.commandsBlob === undefined || p.commandsBlob < 0 || p.commandsBlob >= blobs.length)
360
+ continue;
361
+ const blob = blobs[p.commandsBlob];
362
+ if (blob.length === 0)
363
+ continue;
364
+ result.push({
365
+ windingRule: (p.windingRule === 'EVENODD' ? 'EVENODD' : 'NONZERO'),
366
+ commandsBlob: blob
367
+ });
368
+ }
369
+ return result;
370
+ }
371
+ function extractBoundVariables(nc) {
372
+ const bindings = {};
373
+ nc.fillPaints?.forEach((paint, i) => {
374
+ if (paint.colorVariableBinding) {
375
+ bindings[`fills/${i}/color`] = guidToString(paint.colorVariableBinding.variableID);
376
+ }
377
+ });
378
+ nc.strokePaints?.forEach((paint, i) => {
379
+ if (paint.colorVariableBinding) {
380
+ bindings[`strokes/${i}/color`] = guidToString(paint.colorVariableBinding.variableID);
381
+ }
382
+ });
383
+ return bindings;
384
+ }
385
+ function convertTransformProps(nc) {
386
+ const x = nc.transform?.m02 ?? 0;
387
+ const y = nc.transform?.m12 ?? 0;
388
+ const width = nc.size?.x ?? 100;
389
+ const height = nc.size?.y ?? 100;
390
+ let rotation = 0;
391
+ let flipX = false;
392
+ if (nc.transform) {
393
+ const det = nc.transform.m00 * nc.transform.m11 - nc.transform.m01 * nc.transform.m10;
394
+ if (det < 0)
395
+ flipX = true;
396
+ const sx = flipX ? -1 : 1;
397
+ rotation = Math.atan2(nc.transform.m10 * sx, nc.transform.m00 * sx) * (180 / Math.PI);
398
+ }
399
+ return { x, y, width, height, rotation, flipX, flipY: false };
400
+ }
401
+ function convertCornerProps(nc) {
402
+ return {
403
+ cornerRadius: nc.cornerRadius ?? 0,
404
+ topLeftRadius: nc.rectangleTopLeftCornerRadius ?? nc.cornerRadius ?? 0,
405
+ topRightRadius: nc.rectangleTopRightCornerRadius ?? nc.cornerRadius ?? 0,
406
+ bottomRightRadius: nc.rectangleBottomRightCornerRadius ?? nc.cornerRadius ?? 0,
407
+ bottomLeftRadius: nc.rectangleBottomLeftCornerRadius ?? nc.cornerRadius ?? 0,
408
+ independentCorners: nc.rectangleCornerRadiiIndependent ?? false,
409
+ cornerSmoothing: nc.cornerSmoothing ?? 0
410
+ };
411
+ }
412
+ function convertTextProps(nc) {
413
+ return {
414
+ text: nc.textData?.characters ?? '',
415
+ fontSize: nc.fontSize ?? 14,
416
+ fontFamily: nc.fontName?.family ?? DEFAULT_FONT_FAMILY,
417
+ fontWeight: styleToWeight(nc.fontName?.style ?? ''),
418
+ italic: nc.fontName?.style.toLowerCase().includes('italic') ?? false,
419
+ textAlignHorizontal: (nc.textAlignHorizontal ?? 'LEFT'),
420
+ textAlignVertical: (nc.textAlignVertical ?? 'TOP'),
421
+ textAutoResize: (nc.textAutoResize ?? 'NONE'),
422
+ textCase: (nc.textCase ?? 'ORIGINAL'),
423
+ textDecoration: mapTextDecoration(nc.textDecoration),
424
+ lineHeight: convertLineHeight(nc.lineHeight, nc.fontSize),
425
+ letterSpacing: convertLetterSpacing(nc.letterSpacing, nc.fontSize),
426
+ maxLines: (nc.maxLines ?? null),
427
+ styleRuns: importStyleRuns(nc),
428
+ textTruncation: nc.textTruncation === 'ENDING' ? 'ENDING' : 'DISABLED'
429
+ };
430
+ }
431
+ function convertLayoutPadding(nc) {
432
+ return {
433
+ paddingTop: nc.stackVerticalPadding ?? nc.stackPadding ?? 0,
434
+ paddingBottom: nc.stackPaddingBottom ?? nc.stackVerticalPadding ?? nc.stackPadding ?? 0,
435
+ paddingLeft: nc.stackHorizontalPadding ?? nc.stackPadding ?? 0,
436
+ paddingRight: nc.stackPaddingRight ?? nc.stackHorizontalPadding ?? nc.stackPadding ?? 0
437
+ };
438
+ }
439
+ function convertLayoutProps(nc) {
440
+ return {
441
+ layoutMode: mapStackMode(nc.stackMode),
442
+ itemSpacing: nc.stackSpacing ?? 0,
443
+ ...convertLayoutPadding(nc),
444
+ primaryAxisSizing: mapStackSizing(nc.stackPrimarySizing),
445
+ counterAxisSizing: mapStackSizing(nc.stackCounterSizing),
446
+ primaryAxisAlign: mapStackJustify(nc.stackPrimaryAlignItems ?? nc.stackJustify),
447
+ counterAxisAlign: mapStackCounterAlign(nc.stackCounterAlignItems ?? nc.stackCounterAlign),
448
+ layoutWrap: nc.stackWrap === 'WRAP' ? 'WRAP' : 'NO_WRAP',
449
+ counterAxisSpacing: nc.stackCounterSpacing ?? 0,
450
+ layoutPositioning: nc.stackPositioning === 'ABSOLUTE' ? 'ABSOLUTE' : 'AUTO',
451
+ layoutGrow: nc.stackChildPrimaryGrow ?? 0,
452
+ layoutAlignSelf: mapAlignSelf(nc.stackChildAlignSelf),
453
+ counterAxisAlignContent: nc.stackCounterAlignContent === 'SPACE_BETWEEN' ? 'SPACE_BETWEEN' : 'AUTO',
454
+ itemReverseZIndex: (nc.stackReverseZIndex ?? false),
455
+ strokesIncludedInLayout: (nc.strokesIncludedInLayout ?? false)
456
+ };
457
+ }
458
+ function convertVectorAndStrokeProps(nc, blobs) {
459
+ return {
460
+ vectorNetwork: resolveVectorNetwork(nc, blobs),
461
+ fillGeometry: resolveGeometryPaths(nc.fillGeometry, blobs),
462
+ strokeGeometry: resolveGeometryPaths(nc.strokeGeometry, blobs),
463
+ arcData: mapArcData(nc.arcData),
464
+ strokeCap: (nc.strokeCap ?? 'NONE'),
465
+ strokeJoin: (nc.strokeJoin ?? 'MITER'),
466
+ dashPattern: nc.dashPattern ?? [],
467
+ borderTopWeight: (nc.borderTopWeight ?? 0),
468
+ borderRightWeight: (nc.borderRightWeight ?? 0),
469
+ borderBottomWeight: (nc.borderBottomWeight ?? 0),
470
+ borderLeftWeight: (nc.borderLeftWeight ?? 0),
471
+ independentStrokeWeights: (nc.borderStrokeWeightsIndependent ?? false),
472
+ strokeMiterLimit: DEFAULT_STROKE_MITER_LIMIT
473
+ };
474
+ }
475
+ export function nodeChangeToProps(nc, blobs) {
476
+ let nodeType = mapNodeType(nc.type);
477
+ if (nodeType === 'FRAME' && isComponentSet(nc))
478
+ nodeType = 'COMPONENT_SET';
479
+ return {
480
+ nodeType,
481
+ name: nc.name ?? nodeType,
482
+ ...convertTransformProps(nc),
483
+ opacity: nc.opacity ?? 1,
484
+ visible: nc.visible ?? true,
485
+ locked: nc.locked ?? false,
486
+ blendMode: nc.blendMode ?? 'PASS_THROUGH',
487
+ fills: convertFills(nc.fillPaints),
488
+ strokes: convertStrokes(nc.strokePaints, nc.strokeWeight, nc.strokeAlign, nc.strokeCap, nc.strokeJoin, nc.dashPattern ?? []),
489
+ effects: convertEffects(nc.effects),
490
+ ...convertCornerProps(nc),
491
+ ...convertTextProps(nc),
492
+ horizontalConstraint: mapConstraint(nc.horizontalConstraint),
493
+ verticalConstraint: mapConstraint(nc.verticalConstraint),
494
+ ...convertLayoutProps(nc),
495
+ ...convertVectorAndStrokeProps(nc, blobs),
496
+ minWidth: (nc.minWidth ?? null),
497
+ maxWidth: (nc.maxWidth ?? null),
498
+ minHeight: (nc.minHeight ?? null),
499
+ maxHeight: (nc.maxHeight ?? null),
500
+ isMask: (nc.isMask ?? false),
501
+ maskType: (nc.maskType ?? 'ALPHA'),
502
+ expanded: true,
503
+ autoRename: (nc.autoRename ?? true),
504
+ boundVariables: extractBoundVariables(nc),
505
+ clipsContent: nc.frameMaskDisabled === false,
506
+ componentId: extractSymbolId(nc)
507
+ };
508
+ }
509
+ function isComponentSet(nc) {
510
+ const defs = nc.componentPropDefs;
511
+ if (!defs?.length)
512
+ return false;
513
+ return defs.some((d) => d.type === 'VARIANT');
514
+ }
515
+ export function sortChildren(children, parentNc, nodeMap) {
516
+ const stackMode = parentNc.stackMode;
517
+ if (stackMode === 'HORIZONTAL' || stackMode === 'VERTICAL') {
518
+ const axis = stackMode === 'HORIZONTAL' ? 'm02' : 'm12';
519
+ children.sort((a, b) => {
520
+ const aT = nodeMap.get(a)?.transform?.[axis] ?? 0;
521
+ const bT = nodeMap.get(b)?.transform?.[axis] ?? 0;
522
+ return aT - bT;
523
+ });
524
+ }
525
+ else {
526
+ children.sort((a, b) => {
527
+ const aPos = nodeMap.get(a)?.parentIndex?.position ?? '';
528
+ const bPos = nodeMap.get(b)?.parentIndex?.position ?? '';
529
+ return aPos < bPos ? -1 : (aPos > bPos ? 1 : 0);
530
+ });
531
+ }
532
+ }
533
+ function extractSymbolId(nc) {
534
+ const sd = nc.symbolData;
535
+ if (!sd?.symbolID)
536
+ return '';
537
+ return guidToString(sd.symbolID);
538
+ }
539
+ function applyOverridePaints(ov, updates) {
540
+ if (ov.textData != null) {
541
+ const td = ov.textData;
542
+ if (td.characters != null)
543
+ updates.text = td.characters;
544
+ const runs = importStyleRuns(ov);
545
+ if (runs.length > 0)
546
+ updates.styleRuns = runs;
547
+ }
548
+ if (ov.fillPaints != null)
549
+ updates.fills = convertFills(ov.fillPaints);
550
+ if (ov.strokePaints != null)
551
+ updates.strokes = convertStrokes(ov.strokePaints, ov.strokeWeight, ov.strokeAlign);
552
+ if (ov.effects != null)
553
+ updates.effects = convertEffects(ov.effects);
554
+ if (ov.visible != null)
555
+ updates.visible = ov.visible;
556
+ if (ov.opacity != null)
557
+ updates.opacity = ov.opacity;
558
+ if (ov.name != null)
559
+ updates.name = ov.name;
560
+ if (ov.locked != null)
561
+ updates.locked = ov.locked;
562
+ }
563
+ function applyOverrideGeometry(ov, updates) {
564
+ if (ov.size != null) {
565
+ const sz = ov.size;
566
+ if (sz.x != null)
567
+ updates.width = sz.x;
568
+ if (sz.y != null)
569
+ updates.height = sz.y;
570
+ }
571
+ if (ov.cornerRadius != null)
572
+ updates.cornerRadius = ov.cornerRadius;
573
+ if (ov.rectangleTopLeftCornerRadius != null)
574
+ updates.topLeftRadius = ov.rectangleTopLeftCornerRadius;
575
+ if (ov.rectangleTopRightCornerRadius != null)
576
+ updates.topRightRadius = ov.rectangleTopRightCornerRadius;
577
+ if (ov.rectangleBottomRightCornerRadius != null)
578
+ updates.bottomRightRadius = ov.rectangleBottomRightCornerRadius;
579
+ if (ov.rectangleBottomLeftCornerRadius != null)
580
+ updates.bottomLeftRadius = ov.rectangleBottomLeftCornerRadius;
581
+ if (ov.rectangleCornerRadiiIndependent != null)
582
+ updates.independentCorners = ov.rectangleCornerRadiiIndependent;
583
+ if (ov.arcData != null)
584
+ updates.arcData = mapArcData(ov.arcData);
585
+ if (ov.frameMaskDisabled != null)
586
+ updates.clipsContent = ov.frameMaskDisabled === false;
587
+ }
588
+ function applyOverrideLayout(ov, updates) {
589
+ if (ov.stackSpacing != null)
590
+ updates.itemSpacing = ov.stackSpacing;
591
+ if (ov.stackPrimarySizing != null)
592
+ updates.primaryAxisSizing = mapStackSizing(ov.stackPrimarySizing);
593
+ if (ov.stackCounterSizing != null)
594
+ updates.counterAxisSizing = mapStackSizing(ov.stackCounterSizing);
595
+ if (ov.stackPrimaryAlignItems != null)
596
+ updates.primaryAxisAlign = mapStackJustify(ov.stackPrimaryAlignItems);
597
+ if (ov.stackCounterAlignItems != null)
598
+ updates.counterAxisAlign = mapStackCounterAlign(ov.stackCounterAlignItems);
599
+ if (ov.stackChildPrimaryGrow != null)
600
+ updates.layoutGrow = ov.stackChildPrimaryGrow;
601
+ if (ov.stackChildAlignSelf != null)
602
+ updates.layoutAlignSelf = mapAlignSelf(ov.stackChildAlignSelf);
603
+ if (ov.stackPositioning != null)
604
+ updates.layoutPositioning =
605
+ ov.stackPositioning === 'ABSOLUTE' ? 'ABSOLUTE' : 'AUTO';
606
+ if (ov.stackVerticalPadding != null) {
607
+ updates.paddingTop = ov.stackVerticalPadding;
608
+ if (ov.stackPaddingBottom == null)
609
+ updates.paddingBottom = ov.stackVerticalPadding;
610
+ }
611
+ if (ov.stackHorizontalPadding != null) {
612
+ updates.paddingLeft = ov.stackHorizontalPadding;
613
+ if (ov.stackPaddingRight == null)
614
+ updates.paddingRight = ov.stackHorizontalPadding;
615
+ }
616
+ if (ov.stackPaddingBottom != null)
617
+ updates.paddingBottom = ov.stackPaddingBottom;
618
+ if (ov.stackPaddingRight != null)
619
+ updates.paddingRight = ov.stackPaddingRight;
620
+ }
621
+ function applyOverrideStrokes(ov, updates) {
622
+ if (ov.strokeWeight != null && !ov.strokePaints) {
623
+ updates.strokes = updates.strokes ?? [];
624
+ }
625
+ if (ov.strokeAlign != null && updates.strokes) {
626
+ const align = ov.strokeAlign === 'INSIDE' ? 'INSIDE' : (ov.strokeAlign === 'OUTSIDE' ? 'OUTSIDE' : 'CENTER');
627
+ for (const s of updates.strokes)
628
+ s.align = align;
629
+ }
630
+ if (ov.borderTopWeight != null)
631
+ updates.borderTopWeight = ov.borderTopWeight;
632
+ if (ov.borderRightWeight != null)
633
+ updates.borderRightWeight = ov.borderRightWeight;
634
+ if (ov.borderBottomWeight != null)
635
+ updates.borderBottomWeight = ov.borderBottomWeight;
636
+ if (ov.borderLeftWeight != null)
637
+ updates.borderLeftWeight = ov.borderLeftWeight;
638
+ if (ov.borderStrokeWeightsIndependent != null)
639
+ updates.independentStrokeWeights = ov.borderStrokeWeightsIndependent;
640
+ }
641
+ function applyOverrideText(ov, updates) {
642
+ if (ov.fontName != null) {
643
+ const fn = ov.fontName;
644
+ if (fn.family)
645
+ updates.fontFamily = fn.family;
646
+ if (fn.style) {
647
+ updates.fontWeight = styleToWeight(fn.style);
648
+ updates.italic = fn.style.toLowerCase().includes('italic');
649
+ }
650
+ }
651
+ if (ov.fontSize != null)
652
+ updates.fontSize = ov.fontSize;
653
+ if (ov.textAlignHorizontal != null)
654
+ updates.textAlignHorizontal = ov.textAlignHorizontal;
655
+ if (ov.textAutoResize != null)
656
+ updates.textAutoResize = ov.textAutoResize;
657
+ if (ov.lineHeight != null)
658
+ updates.lineHeight = convertLineHeight(ov.lineHeight, ov.fontSize);
659
+ if (ov.letterSpacing != null)
660
+ updates.letterSpacing = convertLetterSpacing(ov.letterSpacing, ov.fontSize);
661
+ if (ov.maxLines != null)
662
+ updates.maxLines = ov.maxLines;
663
+ if (ov.textTruncation != null)
664
+ updates.textTruncation =
665
+ ov.textTruncation === 'ENDING' ? 'ENDING' : 'DISABLED';
666
+ if (ov.textDecoration != null)
667
+ updates.textDecoration = mapTextDecoration(ov.textDecoration);
668
+ }
669
+ export function convertOverrideToProps(ov) {
670
+ const updates = {};
671
+ applyOverridePaints(ov, updates);
672
+ applyOverrideGeometry(ov, updates);
673
+ applyOverrideLayout(ov, updates);
674
+ applyOverrideStrokes(ov, updates);
675
+ applyOverrideText(ov, updates);
676
+ return updates;
677
+ }
678
+ //# sourceMappingURL=kiwi-convert.js.map