@moondraft/import 0.0.0-stage → 0.2.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 (337) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +34 -0
  3. package/README.md +36 -2
  4. package/SOURCE.md +394 -0
  5. package/dist/adapter/convert.d.ts +144 -0
  6. package/dist/adapter/convert.js +2811 -0
  7. package/dist/adapter/figma-descriptions.d.ts +7 -0
  8. package/dist/adapter/figma-descriptions.js +34 -0
  9. package/dist/adapter/figma-grids.d.ts +12 -0
  10. package/dist/adapter/figma-grids.js +175 -0
  11. package/dist/adapter/figma-handoff.d.ts +12 -0
  12. package/dist/adapter/figma-handoff.js +167 -0
  13. package/dist/adapter/figma-hyperlinks.d.ts +13 -0
  14. package/dist/adapter/figma-hyperlinks.js +77 -0
  15. package/dist/adapter/figma.d.ts +12 -0
  16. package/dist/adapter/figma.js +40 -0
  17. package/dist/adapter/file-components.d.ts +20 -0
  18. package/dist/adapter/file-components.js +352 -0
  19. package/dist/adapter/file-resources.d.ts +29 -0
  20. package/dist/adapter/file-resources.js +851 -0
  21. package/dist/adapter/image-crop.d.ts +18 -0
  22. package/dist/adapter/image-crop.js +30 -0
  23. package/dist/adapter/index.d.ts +6 -0
  24. package/dist/adapter/index.js +9 -0
  25. package/dist/adapter/link.d.ts +49 -0
  26. package/dist/adapter/link.js +892 -0
  27. package/dist/adapter/payload.d.ts +31 -0
  28. package/dist/adapter/payload.js +78 -0
  29. package/dist/adapter/shapes.d.ts +31 -0
  30. package/dist/adapter/shapes.js +75 -0
  31. package/dist/adapter/variables.d.ts +45 -0
  32. package/dist/adapter/variables.js +106 -0
  33. package/dist/figma-file.d.ts +38 -0
  34. package/dist/figma-file.js +97 -0
  35. package/dist/figma-worker.d.ts +11 -0
  36. package/dist/figma-worker.js +12 -0
  37. package/dist/figma.d.ts +26 -0
  38. package/dist/figma.js +230 -0
  39. package/dist/index.d.ts +29 -0
  40. package/dist/index.js +50 -0
  41. package/dist/report.d.ts +42 -0
  42. package/dist/report.js +142 -0
  43. package/dist/serialize.d.ts +7 -0
  44. package/dist/serialize.js +79 -0
  45. package/dist/svg.d.ts +33 -0
  46. package/dist/svg.js +44 -0
  47. package/dist/syntax.d.ts +8 -0
  48. package/dist/syntax.js +19 -0
  49. package/dist/taco/figma-import/clipboard.d.ts +25 -0
  50. package/dist/taco/figma-import/clipboard.js +87 -0
  51. package/dist/taco/figma-import/clipboardSize.d.ts +31 -0
  52. package/dist/taco/figma-import/clipboardSize.js +107 -0
  53. package/dist/taco/figma-import/container/compression.d.ts +9 -0
  54. package/dist/taco/figma-import/container/compression.js +174 -0
  55. package/dist/taco/figma-import/container/error.d.ts +15 -0
  56. package/dist/taco/figma-import/container/error.js +19 -0
  57. package/dist/taco/figma-import/container/kiwiContainer.d.ts +41 -0
  58. package/dist/taco/figma-import/container/kiwiContainer.js +61 -0
  59. package/dist/taco/figma-import/container/limits.d.ts +22 -0
  60. package/dist/taco/figma-import/container/limits.js +22 -0
  61. package/dist/taco/figma-import/container/zip.d.ts +14 -0
  62. package/dist/taco/figma-import/container/zip.js +154 -0
  63. package/dist/taco/figma-import/figFile.d.ts +34 -0
  64. package/dist/taco/figma-import/figFile.js +91 -0
  65. package/dist/taco/figma-import/figFileDocument.d.ts +25 -0
  66. package/dist/taco/figma-import/figFileDocument.js +100 -0
  67. package/dist/taco/figma-import/import/blobs.d.ts +10 -0
  68. package/dist/taco/figma-import/import/blobs.js +23 -0
  69. package/dist/taco/figma-import/import/carry.d.ts +24 -0
  70. package/dist/taco/figma-import/import/carry.js +66 -0
  71. package/dist/taco/figma-import/import/componentProps.d.ts +90 -0
  72. package/dist/taco/figma-import/import/componentProps.js +329 -0
  73. package/dist/taco/figma-import/import/componentSets.d.ts +85 -0
  74. package/dist/taco/figma-import/import/componentSets.js +647 -0
  75. package/dist/taco/figma-import/import/converters/effects.d.ts +31 -0
  76. package/dist/taco/figma-import/import/converters/effects.js +127 -0
  77. package/dist/taco/figma-import/import/converters/ellipse.d.ts +7 -0
  78. package/dist/taco/figma-import/import/converters/ellipse.js +54 -0
  79. package/dist/taco/figma-import/import/converters/exportSettings.d.ts +4 -0
  80. package/dist/taco/figma-import/import/converters/exportSettings.js +49 -0
  81. package/dist/taco/figma-import/import/converters/frame.d.ts +21 -0
  82. package/dist/taco/figma-import/import/converters/frame.js +63 -0
  83. package/dist/taco/figma-import/import/converters/gradient.d.ts +74 -0
  84. package/dist/taco/figma-import/import/converters/gradient.js +108 -0
  85. package/dist/taco/figma-import/import/converters/group.d.ts +19 -0
  86. package/dist/taco/figma-import/import/converters/group.js +30 -0
  87. package/dist/taco/figma-import/import/converters/image.d.ts +13 -0
  88. package/dist/taco/figma-import/import/converters/image.js +94 -0
  89. package/dist/taco/figma-import/import/converters/layout.d.ts +33 -0
  90. package/dist/taco/figma-import/import/converters/layout.js +187 -0
  91. package/dist/taco/figma-import/import/converters/line.d.ts +11 -0
  92. package/dist/taco/figma-import/import/converters/line.js +40 -0
  93. package/dist/taco/figma-import/import/converters/rectangle.d.ts +3 -0
  94. package/dist/taco/figma-import/import/converters/rectangle.js +11 -0
  95. package/dist/taco/figma-import/import/converters/section.d.ts +8 -0
  96. package/dist/taco/figma-import/import/converters/section.js +29 -0
  97. package/dist/taco/figma-import/import/converters/shared.d.ts +71 -0
  98. package/dist/taco/figma-import/import/converters/shared.js +372 -0
  99. package/dist/taco/figma-import/import/converters/text.d.ts +54 -0
  100. package/dist/taco/figma-import/import/converters/text.js +707 -0
  101. package/dist/taco/figma-import/import/converters/vector.d.ts +105 -0
  102. package/dist/taco/figma-import/import/converters/vector.js +609 -0
  103. package/dist/taco/figma-import/import/converters/vectorNetwork.d.ts +114 -0
  104. package/dist/taco/figma-import/import/converters/vectorNetwork.js +503 -0
  105. package/dist/taco/figma-import/import/fields.d.ts +15 -0
  106. package/dist/taco/figma-import/import/fields.js +29 -0
  107. package/dist/taco/figma-import/import/instances.d.ts +184 -0
  108. package/dist/taco/figma-import/import/instances.js +1530 -0
  109. package/dist/taco/figma-import/import/nestingCycles.d.ts +86 -0
  110. package/dist/taco/figma-import/import/nestingCycles.js +488 -0
  111. package/dist/taco/figma-import/import/slots.d.ts +56 -0
  112. package/dist/taco/figma-import/import/slots.js +96 -0
  113. package/dist/taco/figma-import/import/styles.d.ts +48 -0
  114. package/dist/taco/figma-import/import/styles.js +48 -0
  115. package/dist/taco/figma-import/import/tree.d.ts +66 -0
  116. package/dist/taco/figma-import/import/tree.js +194 -0
  117. package/dist/taco/figma-import/import/types.d.ts +232 -0
  118. package/dist/taco/figma-import/import/types.js +33 -0
  119. package/dist/taco/figma-import/import/variables.d.ts +137 -0
  120. package/dist/taco/figma-import/import/variables.js +769 -0
  121. package/dist/taco/figma-import/import/variantTrees.d.ts +20 -0
  122. package/dist/taco/figma-import/import/variantTrees.js +520 -0
  123. package/dist/taco/figma-import/import/walk.d.ts +207 -0
  124. package/dist/taco/figma-import/import/walk.js +1464 -0
  125. package/dist/taco/figma-import/index.d.ts +22 -0
  126. package/dist/taco/figma-import/index.js +13 -0
  127. package/dist/taco/figma-import/kiwi/byteReader.d.ts +37 -0
  128. package/dist/taco/figma-import/kiwi/byteReader.js +151 -0
  129. package/dist/taco/figma-import/kiwi/error.d.ts +14 -0
  130. package/dist/taco/figma-import/kiwi/error.js +29 -0
  131. package/dist/taco/figma-import/kiwi/limits.d.ts +18 -0
  132. package/dist/taco/figma-import/kiwi/limits.js +18 -0
  133. package/dist/taco/figma-import/kiwi/message.d.ts +12 -0
  134. package/dist/taco/figma-import/kiwi/message.js +147 -0
  135. package/dist/taco/figma-import/kiwi/schema.d.ts +42 -0
  136. package/dist/taco/figma-import/kiwi/schema.js +206 -0
  137. package/dist/taco/figma-import/kiwi/types.d.ts +46 -0
  138. package/dist/taco/figma-import/kiwi/types.js +18 -0
  139. package/dist/taco/model/agent-hidden-fields.d.ts +20 -0
  140. package/dist/taco/model/agent-hidden-fields.js +29 -0
  141. package/dist/taco/model/asset-users.d.ts +23 -0
  142. package/dist/taco/model/asset-users.js +128 -0
  143. package/dist/taco/model/auto-layout-lines.d.ts +32 -0
  144. package/dist/taco/model/auto-layout-lines.js +70 -0
  145. package/dist/taco/model/codec.d.ts +444 -0
  146. package/dist/taco/model/codec.js +5665 -0
  147. package/dist/taco/model/color.d.ts +11 -0
  148. package/dist/taco/model/color.js +61 -0
  149. package/dist/taco/model/comment-operations.d.ts +102 -0
  150. package/dist/taco/model/comment-operations.js +227 -0
  151. package/dist/taco/model/component-evaluation.d.ts +96 -0
  152. package/dist/taco/model/component-evaluation.js +555 -0
  153. package/dist/taco/model/component-expressions.d.ts +242 -0
  154. package/dist/taco/model/component-expressions.js +1082 -0
  155. package/dist/taco/model/component-properties.d.ts +111 -0
  156. package/dist/taco/model/component-properties.js +339 -0
  157. package/dist/taco/model/component-samples.d.ts +83 -0
  158. package/dist/taco/model/component-samples.js +290 -0
  159. package/dist/taco/model/component-validity.d.ts +85 -0
  160. package/dist/taco/model/component-validity.js +397 -0
  161. package/dist/taco/model/components.d.ts +155 -0
  162. package/dist/taco/model/components.js +505 -0
  163. package/dist/taco/model/connector-ends.d.ts +20 -0
  164. package/dist/taco/model/connector-ends.js +188 -0
  165. package/dist/taco/model/connector-geometry.d.ts +74 -0
  166. package/dist/taco/model/connector-geometry.js +293 -0
  167. package/dist/taco/model/corner-radii.d.ts +26 -0
  168. package/dist/taco/model/corner-radii.js +47 -0
  169. package/dist/taco/model/derivations.d.ts +81 -0
  170. package/dist/taco/model/derivations.js +151 -0
  171. package/dist/taco/model/export-settings.d.ts +53 -0
  172. package/dist/taco/model/export-settings.js +156 -0
  173. package/dist/taco/model/expressions/ast.d.ts +153 -0
  174. package/dist/taco/model/expressions/ast.js +6 -0
  175. package/dist/taco/model/expressions/cache.d.ts +23 -0
  176. package/dist/taco/model/expressions/cache.js +43 -0
  177. package/dist/taco/model/expressions/check.d.ts +72 -0
  178. package/dist/taco/model/expressions/check.js +517 -0
  179. package/dist/taco/model/expressions/completion.d.ts +61 -0
  180. package/dist/taco/model/expressions/completion.js +421 -0
  181. package/dist/taco/model/expressions/evaluate.d.ts +32 -0
  182. package/dist/taco/model/expressions/evaluate.js +519 -0
  183. package/dist/taco/model/expressions/forms.d.ts +84 -0
  184. package/dist/taco/model/expressions/forms.js +200 -0
  185. package/dist/taco/model/expressions/index.d.ts +14 -0
  186. package/dist/taco/model/expressions/index.js +17 -0
  187. package/dist/taco/model/expressions/lexer.d.ts +42 -0
  188. package/dist/taco/model/expressions/lexer.js +213 -0
  189. package/dist/taco/model/expressions/library.d.ts +33 -0
  190. package/dist/taco/model/expressions/library.js +117 -0
  191. package/dist/taco/model/expressions/names.d.ts +43 -0
  192. package/dist/taco/model/expressions/names.js +99 -0
  193. package/dist/taco/model/expressions/parser.d.ts +15 -0
  194. package/dist/taco/model/expressions/parser.js +438 -0
  195. package/dist/taco/model/expressions/rename.d.ts +34 -0
  196. package/dist/taco/model/expressions/rename.js +46 -0
  197. package/dist/taco/model/expressions/source.d.ts +15 -0
  198. package/dist/taco/model/expressions/source.js +161 -0
  199. package/dist/taco/model/expressions/types.d.ts +119 -0
  200. package/dist/taco/model/expressions/types.js +102 -0
  201. package/dist/taco/model/expressions/values.d.ts +97 -0
  202. package/dist/taco/model/expressions/values.js +160 -0
  203. package/dist/taco/model/geometry-limits.d.ts +16 -0
  204. package/dist/taco/model/geometry-limits.js +67 -0
  205. package/dist/taco/model/geometry.d.ts +47 -0
  206. package/dist/taco/model/geometry.js +193 -0
  207. package/dist/taco/model/group-bounds.d.ts +38 -0
  208. package/dist/taco/model/group-bounds.js +144 -0
  209. package/dist/taco/model/id-table.d.ts +37 -0
  210. package/dist/taco/model/id-table.js +80 -0
  211. package/dist/taco/model/index.d.ts +25 -0
  212. package/dist/taco/model/index.js +27 -0
  213. package/dist/taco/model/instance-resolver.d.ts +376 -0
  214. package/dist/taco/model/instance-resolver.js +1778 -0
  215. package/dist/taco/model/layer-syntax.d.ts +340 -0
  216. package/dist/taco/model/layer-syntax.js +3506 -0
  217. package/dist/taco/model/layout/constraints.d.ts +84 -0
  218. package/dist/taco/model/layout/constraints.js +445 -0
  219. package/dist/taco/model/layout/frame-layout.d.ts +46 -0
  220. package/dist/taco/model/layout/frame-layout.js +618 -0
  221. package/dist/taco/model/layout/node-sizing.d.ts +163 -0
  222. package/dist/taco/model/layout/node-sizing.js +486 -0
  223. package/dist/taco/model/legacy-connector-caps.d.ts +15 -0
  224. package/dist/taco/model/legacy-connector-caps.js +70 -0
  225. package/dist/taco/model/linear-call.d.ts +48 -0
  226. package/dist/taco/model/linear-call.js +58 -0
  227. package/dist/taco/model/new-nodes.d.ts +145 -0
  228. package/dist/taco/model/new-nodes.js +277 -0
  229. package/dist/taco/model/node-builder.d.ts +449 -0
  230. package/dist/taco/model/node-builder.js +2294 -0
  231. package/dist/taco/model/node-table-watch.d.ts +36 -0
  232. package/dist/taco/model/node-table-watch.js +63 -0
  233. package/dist/taco/model/node-transform.d.ts +39 -0
  234. package/dist/taco/model/node-transform.js +79 -0
  235. package/dist/taco/model/node-users-index.d.ts +10 -0
  236. package/dist/taco/model/node-users-index.js +82 -0
  237. package/dist/taco/model/operation-references.d.ts +80 -0
  238. package/dist/taco/model/operation-references.js +399 -0
  239. package/dist/taco/model/operations.d.ts +610 -0
  240. package/dist/taco/model/operations.js +2882 -0
  241. package/dist/taco/model/overlay-table.d.ts +71 -0
  242. package/dist/taco/model/overlay-table.js +171 -0
  243. package/dist/taco/model/override-remap.d.ts +69 -0
  244. package/dist/taco/model/override-remap.js +230 -0
  245. package/dist/taco/model/parent-table.d.ts +53 -0
  246. package/dist/taco/model/parent-table.js +193 -0
  247. package/dist/taco/model/problem-collector.d.ts +27 -0
  248. package/dist/taco/model/problem-collector.js +101 -0
  249. package/dist/taco/model/sha256.d.ts +10 -0
  250. package/dist/taco/model/sha256.js +79 -0
  251. package/dist/taco/model/shape-geometry.d.ts +96 -0
  252. package/dist/taco/model/shape-geometry.js +368 -0
  253. package/dist/taco/model/shared-node-table.d.ts +97 -0
  254. package/dist/taco/model/shared-node-table.js +546 -0
  255. package/dist/taco/model/slots.d.ts +113 -0
  256. package/dist/taco/model/slots.js +281 -0
  257. package/dist/taco/model/stroke-settings.d.ts +37 -0
  258. package/dist/taco/model/stroke-settings.js +90 -0
  259. package/dist/taco/model/svg-path-import.d.ts +89 -0
  260. package/dist/taco/model/svg-path-import.js +219 -0
  261. package/dist/taco/model/text-measurement.d.ts +142 -0
  262. package/dist/taco/model/text-measurement.js +846 -0
  263. package/dist/taco/model/text-reads.d.ts +66 -0
  264. package/dist/taco/model/text-reads.js +128 -0
  265. package/dist/taco/model/text-sizer.d.ts +358 -0
  266. package/dist/taco/model/text-sizer.js +996 -0
  267. package/dist/taco/model/theme-users.d.ts +59 -0
  268. package/dist/taco/model/theme-users.js +312 -0
  269. package/dist/taco/model/thumbnail.d.ts +15 -0
  270. package/dist/taco/model/thumbnail.js +34 -0
  271. package/dist/taco/model/types.d.ts +2369 -0
  272. package/dist/taco/model/types.js +366 -0
  273. package/dist/taco/model/unknown-property.d.ts +5 -0
  274. package/dist/taco/model/unknown-property.js +7 -0
  275. package/dist/taco/model/validated-documents.d.ts +22 -0
  276. package/dist/taco/model/validated-documents.js +22 -0
  277. package/dist/taco/model/variable-modes.d.ts +61 -0
  278. package/dist/taco/model/variable-modes.js +438 -0
  279. package/dist/taco/model/variable-references.d.ts +54 -0
  280. package/dist/taco/model/variable-references.js +183 -0
  281. package/dist/taco/model/variables.d.ts +24 -0
  282. package/dist/taco/model/variables.js +151 -0
  283. package/dist/taco/model/vector-network.d.ts +34 -0
  284. package/dist/taco/model/vector-network.js +411 -0
  285. package/dist/taco/svg-import/import-svg.d.ts +36 -0
  286. package/dist/taco/svg-import/import-svg.js +729 -0
  287. package/dist/taco/svg-import/index.d.ts +3 -0
  288. package/dist/taco/svg-import/index.js +3 -0
  289. package/dist/taco/svg-import/limits/limits.d.ts +79 -0
  290. package/dist/taco/svg-import/limits/limits.js +160 -0
  291. package/dist/taco/svg-import/paint/gradients.d.ts +64 -0
  292. package/dist/taco/svg-import/paint/gradients.js +429 -0
  293. package/dist/taco/svg-import/paint/paint.d.ts +32 -0
  294. package/dist/taco/svg-import/paint/paint.js +162 -0
  295. package/dist/taco/svg-import/paths/paths.d.ts +58 -0
  296. package/dist/taco/svg-import/paths/paths.js +205 -0
  297. package/dist/taco/svg-import/public-types.d.ts +279 -0
  298. package/dist/taco/svg-import/public-types.js +56 -0
  299. package/dist/taco/svg-import/report/report.d.ts +44 -0
  300. package/dist/taco/svg-import/report/report.js +79 -0
  301. package/dist/taco/svg-import/reuse/reuse.d.ts +99 -0
  302. package/dist/taco/svg-import/reuse/reuse.js +840 -0
  303. package/dist/taco/svg-import/shapes/shapes.d.ts +35 -0
  304. package/dist/taco/svg-import/shapes/shapes.js +386 -0
  305. package/dist/taco/svg-import/structure/effects.d.ts +26 -0
  306. package/dist/taco/svg-import/structure/effects.js +618 -0
  307. package/dist/taco/svg-import/structure/image.d.ts +24 -0
  308. package/dist/taco/svg-import/structure/image.js +495 -0
  309. package/dist/taco/svg-import/structure/walk.d.ts +85 -0
  310. package/dist/taco/svg-import/structure/walk.js +544 -0
  311. package/dist/taco/svg-import/style/color.d.ts +40 -0
  312. package/dist/taco/svg-import/style/color.js +275 -0
  313. package/dist/taco/svg-import/style/computed.d.ts +214 -0
  314. package/dist/taco/svg-import/style/computed.js +1534 -0
  315. package/dist/taco/svg-import/style/css.d.ts +127 -0
  316. package/dist/taco/svg-import/style/css.js +541 -0
  317. package/dist/taco/svg-import/style/media.d.ts +25 -0
  318. package/dist/taco/svg-import/style/media.js +307 -0
  319. package/dist/taco/svg-import/style/properties.d.ts +43 -0
  320. package/dist/taco/svg-import/style/properties.js +135 -0
  321. package/dist/taco/svg-import/style/selector-reach.d.ts +30 -0
  322. package/dist/taco/svg-import/style/selector-reach.js +169 -0
  323. package/dist/taco/svg-import/style/selector-validity.d.ts +14 -0
  324. package/dist/taco/svg-import/style/selector-validity.js +307 -0
  325. package/dist/taco/svg-import/text/text.d.ts +29 -0
  326. package/dist/taco/svg-import/text/text.js +545 -0
  327. package/dist/taco/svg-import/transform/matrix.d.ts +111 -0
  328. package/dist/taco/svg-import/transform/matrix.js +229 -0
  329. package/dist/taco/svg-import/tree/element-data.d.ts +52 -0
  330. package/dist/taco/svg-import/tree/element-data.js +155 -0
  331. package/dist/taco/svg-import/tree/elements.d.ts +36 -0
  332. package/dist/taco/svg-import/tree/elements.js +121 -0
  333. package/dist/taco/svg-import/units/length.d.ts +43 -0
  334. package/dist/taco/svg-import/units/length.js +125 -0
  335. package/dist/taco/svg-import/units/viewbox.d.ts +35 -0
  336. package/dist/taco/svg-import/units/viewbox.js +77 -0
  337. package/package.json +55 -4
@@ -0,0 +1,275 @@
1
+ /**
2
+ * SVG/CSS color parsing for paint attributes: hex, `rgb()`/`rgba()`,
3
+ * `hsl()`/`hsla()`, the CSS named colors, `currentColor` and `none`.
4
+ * Parsing never throws: text this file does not understand parses to null
5
+ * and the caller reports it. No dates, randomness or globals: the same
6
+ * input always parses to the same color.
7
+ */
8
+ /**
9
+ * Parses an SVG/CSS color. Returns null when the text is not a color this
10
+ * package understands (the caller reports that; nothing is guessed).
11
+ * Keywords are ASCII case-insensitive; surrounding whitespace is ignored.
12
+ */
13
+ export function parseSvgColor(text) {
14
+ const value = asciiLower(text.trim());
15
+ if (value === "")
16
+ return null;
17
+ if (value === "currentcolor")
18
+ return { kind: "currentColor" };
19
+ if (value === "none")
20
+ return { kind: "none" };
21
+ if (value === "transparent")
22
+ return { kind: "color", value: { r: 0, g: 0, b: 0, a: 0 } };
23
+ if (value.startsWith("#"))
24
+ return asColor(parseHexColor(value));
25
+ const open = value.indexOf("(");
26
+ if (open > 0 && value.endsWith(")")) {
27
+ const name = value.slice(0, open);
28
+ const inner = value.slice(open + 1, -1);
29
+ if (name === "rgb" || name === "rgba")
30
+ return asColor(parseRgbFunction(inner));
31
+ if (name === "hsl" || name === "hsla")
32
+ return asColor(parseHslFunction(inner));
33
+ return null;
34
+ }
35
+ const named = NAMED_COLORS[value];
36
+ if (named === undefined)
37
+ return null;
38
+ return {
39
+ kind: "color",
40
+ value: { r: hexByte(named, 0), g: hexByte(named, 2), b: hexByte(named, 4), a: 1 },
41
+ };
42
+ }
43
+ /** "#RRGGBB", or "#RRGGBBAA" when the alpha is below 1. */
44
+ export function hexColor(rgba) {
45
+ const rgb = `#${byteHex(rgba.r)}${byteHex(rgba.g)}${byteHex(rgba.b)}`;
46
+ const alpha = Math.round(clamp(rgba.a, 0, 1) * 255);
47
+ return alpha === 255 ? rgb : `${rgb}${byteHex(alpha)}`;
48
+ }
49
+ /**
50
+ * "#RRGGBB" plus a separate opacity: undefined when the alpha is 1. Solid
51
+ * paints in the model carry their alpha as a paint opacity, so callers emit
52
+ * the color and the opacity separately.
53
+ */
54
+ export function hexColorAndOpacity(rgba) {
55
+ const color = `#${byteHex(rgba.r)}${byteHex(rgba.g)}${byteHex(rgba.b)}`;
56
+ return Math.round(clamp(rgba.a, 0, 1) * 255) === 255
57
+ ? { color, opacity: undefined }
58
+ : { color, opacity: rgba.a };
59
+ }
60
+ /** The CSS named colors as `rrggbb` hex, keyed by lowercase name. */
61
+ const NAMED_COLORS = {
62
+ aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "00ffff", aquamarine: "7fffd4",
63
+ azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000000",
64
+ blanchedalmond: "ffebcd", blue: "0000ff", blueviolet: "8a2be2", brown: "a52a2a",
65
+ burlywood: "deb887", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e",
66
+ coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c",
67
+ cyan: "00ffff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b",
68
+ darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b",
69
+ darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc",
70
+ darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b",
71
+ darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3",
72
+ deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969",
73
+ dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22",
74
+ fuchsia: "ff00ff", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700",
75
+ goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f",
76
+ grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c",
77
+ indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa",
78
+ lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6",
79
+ lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3",
80
+ lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a",
81
+ lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "778899", lightslategrey: "778899",
82
+ lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "00ff00", limegreen: "32cd32",
83
+ linen: "faf0e6", magenta: "ff00ff", maroon: "800000", mediumaquamarine: "66cdaa",
84
+ mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371",
85
+ mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585",
86
+ midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5",
87
+ navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000",
88
+ olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6",
89
+ palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093",
90
+ papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb",
91
+ plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399",
92
+ red: "ff0000", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513",
93
+ salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee",
94
+ sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd",
95
+ slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f",
96
+ steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8",
97
+ tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3",
98
+ white: "ffffff", whitesmoke: "f5f5f5", yellow: "ffff00", yellowgreen: "9acd32",
99
+ };
100
+ /** A CSS number: optional sign, digits with an optional dot, optional exponent. */
101
+ const NUMBER_PATTERN = /^[+-]?(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;
102
+ function asciiLower(text) {
103
+ return text.replace(/[A-Z]/g, (ch) => ch.toLowerCase());
104
+ }
105
+ function clamp(value, min, max) {
106
+ return value < min ? min : value > max ? max : value;
107
+ }
108
+ /** The value of one hex digit by char code, or -1 when the code is not a hex digit. */
109
+ function hexDigit(code) {
110
+ if (code >= 48 && code <= 57)
111
+ return code - 48;
112
+ if (code >= 97 && code <= 102)
113
+ return code - 87;
114
+ if (code >= 65 && code <= 70)
115
+ return code - 55;
116
+ return -1;
117
+ }
118
+ /** Two hex digits of `text` starting at `index` as a 0–255 byte. Callers check the length first. */
119
+ function hexByte(text, index) {
120
+ return hexDigit(text.charCodeAt(index)) * 16 + hexDigit(text.charCodeAt(index + 1));
121
+ }
122
+ /** A 0–255 channel as two uppercase hex digits. */
123
+ function byteHex(value) {
124
+ return clamp(Math.round(value), 0, 255)
125
+ .toString(16)
126
+ .padStart(2, "0")
127
+ .toUpperCase();
128
+ }
129
+ function asColor(rgba) {
130
+ return rgba === null ? null : { kind: "color", value: rgba };
131
+ }
132
+ /** `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`; the alpha digit expands like the color digits. */
133
+ function parseHexColor(text) {
134
+ const body = text.slice(1);
135
+ if (body.length !== 3 && body.length !== 4 && body.length !== 6 && body.length !== 8) {
136
+ return null;
137
+ }
138
+ for (let i = 0; i < body.length; i += 1) {
139
+ if (hexDigit(body.charCodeAt(i)) < 0)
140
+ return null;
141
+ }
142
+ if (body.length <= 4) {
143
+ return {
144
+ r: hexDigit(body.charCodeAt(0)) * 17,
145
+ g: hexDigit(body.charCodeAt(1)) * 17,
146
+ b: hexDigit(body.charCodeAt(2)) * 17,
147
+ a: body.length === 4 ? hexDigit(body.charCodeAt(3)) / 15 : 1,
148
+ };
149
+ }
150
+ return {
151
+ r: hexByte(body, 0),
152
+ g: hexByte(body, 2),
153
+ b: hexByte(body, 4),
154
+ a: body.length === 8 ? hexByte(body, 6) / 255 : 1,
155
+ };
156
+ }
157
+ /** A CSS number, or null; huge magnitudes come through as infinities for the caller to clamp. */
158
+ function parseNumber(text) {
159
+ return NUMBER_PATTERN.test(text) ? Number(text) : null;
160
+ }
161
+ /** One rgb channel: a 0–255 number or a percentage, clamped then rounded as CSS serializes it. */
162
+ function parseRgbChannel(text) {
163
+ const percent = text.endsWith("%");
164
+ const value = parseNumber(percent ? text.slice(0, -1) : text);
165
+ if (value === null)
166
+ return null;
167
+ return Math.round(clamp(percent ? (value * 255) / 100 : value, 0, 255));
168
+ }
169
+ /** An alpha: a number or a percentage, clamped to 0–1. */
170
+ function parseAlpha(text) {
171
+ const percent = text.endsWith("%");
172
+ const value = parseNumber(percent ? text.slice(0, -1) : text);
173
+ if (value === null)
174
+ return null;
175
+ return clamp(percent ? value / 100 : value, 0, 1);
176
+ }
177
+ /** A hue in degrees: a bare number is degrees; `deg`, `rad`, `grad` and `turn` convert. */
178
+ function parseHue(text) {
179
+ for (const unit of ["grad", "turn", "deg", "rad"]) {
180
+ if (text.endsWith(unit)) {
181
+ const value = parseNumber(text.slice(0, -unit.length));
182
+ if (value === null)
183
+ return null;
184
+ const degrees = unit === "grad"
185
+ ? value * 0.9
186
+ : unit === "turn"
187
+ ? value * 360
188
+ : unit === "rad"
189
+ ? (value * 180) / Math.PI
190
+ : value;
191
+ return Number.isFinite(degrees) ? degrees : null;
192
+ }
193
+ }
194
+ const value = parseNumber(text);
195
+ return value !== null && Number.isFinite(value) ? value : null;
196
+ }
197
+ /** A percentage channel such as saturation or lightness, clamped to 0–100; null without the `%`. */
198
+ function parsePercent(text) {
199
+ if (!text.endsWith("%"))
200
+ return null;
201
+ const value = parseNumber(text.slice(0, -1));
202
+ return value === null ? null : clamp(value, 0, 100);
203
+ }
204
+ /**
205
+ * Splits a function body into its three channels and optional alpha, in
206
+ * either the comma form (`255, 0, 0, 0.5`) or the space form with a `/`
207
+ * before the alpha (`255 0 0 / 50%`). Mixing the two forms returns null.
208
+ */
209
+ function splitFunctionArgs(inner) {
210
+ if (inner.includes(",")) {
211
+ const parts = inner.split(",").map((part) => part.trim());
212
+ const [first, second, third, fourth] = parts;
213
+ if (first === undefined || second === undefined || third === undefined)
214
+ return null;
215
+ if (parts.length === 3)
216
+ return { first, second, third, alpha: null, legacy: true };
217
+ if (parts.length === 4 && fourth !== undefined && fourth !== "") {
218
+ return { first, second, third, alpha: fourth, legacy: true };
219
+ }
220
+ return null;
221
+ }
222
+ const slash = inner.indexOf("/");
223
+ if (slash >= 0 && inner.indexOf("/", slash + 1) >= 0)
224
+ return null;
225
+ const channelText = (slash >= 0 ? inner.slice(0, slash) : inner).trim();
226
+ const alphaText = slash >= 0 ? inner.slice(slash + 1).trim() : null;
227
+ const [first, second, third, extra] = channelText === "" ? [] : channelText.split(/\s+/);
228
+ if (first === undefined || second === undefined || third === undefined || extra !== undefined) {
229
+ return null;
230
+ }
231
+ if (alphaText !== null && alphaText === "")
232
+ return null;
233
+ return { first, second, third, alpha: alphaText, legacy: false };
234
+ }
235
+ function parseRgbFunction(inner) {
236
+ const args = splitFunctionArgs(inner);
237
+ if (args === null)
238
+ return null;
239
+ // The comma form needs all three channels as numbers or all as percentages.
240
+ if (args.legacy) {
241
+ const percents = [args.first, args.second, args.third].filter((channel) => channel.endsWith("%")).length;
242
+ if (percents !== 0 && percents !== 3)
243
+ return null;
244
+ }
245
+ const r = parseRgbChannel(args.first);
246
+ const g = parseRgbChannel(args.second);
247
+ const b = parseRgbChannel(args.third);
248
+ const a = args.alpha === null ? 1 : parseAlpha(args.alpha);
249
+ if (r === null || g === null || b === null || a === null)
250
+ return null;
251
+ return { r, g, b, a };
252
+ }
253
+ function parseHslFunction(inner) {
254
+ const args = splitFunctionArgs(inner);
255
+ if (args === null)
256
+ return null;
257
+ const h = parseHue(args.first);
258
+ const s = parsePercent(args.second);
259
+ const l = parsePercent(args.third);
260
+ const a = args.alpha === null ? 1 : parseAlpha(args.alpha);
261
+ if (h === null || s === null || l === null || a === null)
262
+ return null;
263
+ return hslToRgb(h, s / 100, l / 100, a);
264
+ }
265
+ /** The CSS hsl conversion: `hue` in degrees (any value, it wraps), the rest 0–1. */
266
+ function hslToRgb(hue, saturation, lightness, alpha) {
267
+ const h = ((hue % 360) + 360) % 360;
268
+ const channel = (n) => {
269
+ const k = (n + h / 30) % 12;
270
+ const value = lightness -
271
+ saturation * Math.min(lightness, 1 - lightness) * Math.max(-1, Math.min(k - 3, 9 - k, 1));
272
+ return Math.round(clamp(value * 255, 0, 255));
273
+ };
274
+ return { r: channel(0), g: channel(8), b: channel(4), a: alpha };
275
+ }
@@ -0,0 +1,214 @@
1
+ import type { BlendMode } from "../../model/index.ts";
2
+ import type { SvgElementLike } from "../public-types.ts";
3
+ import type { LimitGuard } from "../limits/limits.ts";
4
+ import { type Rgba } from "./color.ts";
5
+ import { type CssRejection, type CssRule } from "./css.ts";
6
+ /**
7
+ * A `url()` paint reference: an id in this file, or (`external`) the text of
8
+ * a URL to another file, which opening never fetches.
9
+ */
10
+ export interface PaintReference {
11
+ readonly id: string;
12
+ readonly external: boolean;
13
+ }
14
+ /** A paint server's target: a color, nothing, or a `url()` reference. */
15
+ export type PaintValue = {
16
+ readonly kind: "none";
17
+ } | {
18
+ readonly kind: "color";
19
+ readonly color: Rgba;
20
+ } | ({
21
+ readonly kind: "ref";
22
+ readonly fallback: Rgba | null;
23
+ } & PaintReference);
24
+ /** Text decoration flags, from SVG's `text-decoration`. */
25
+ export interface TextDecorations {
26
+ readonly underline: boolean;
27
+ readonly lineThrough: boolean;
28
+ }
29
+ /**
30
+ * The fully computed style of one element: what the cascade, the
31
+ * presentation attributes and inheritance decide for every property the
32
+ * importer understands. Inherited properties come from the parent's
33
+ * computed style; `opacity`, `display`, `clipPath`, `mask`, `filter`,
34
+ * `blendMode`, `maskType` and `overflowVisible` always start from their
35
+ * initial value.
36
+ */
37
+ export interface ComputedStyle {
38
+ readonly fill: PaintValue;
39
+ readonly fillOpacity: number;
40
+ readonly fillRule: "nonzero" | "evenodd";
41
+ /** The winding rule a shape uses when it is inside a `<clipPath>`, in place of `fillRule`. */
42
+ readonly clipRule: "nonzero" | "evenodd";
43
+ readonly stroke: PaintValue;
44
+ readonly strokeWidth: number;
45
+ readonly strokeOpacity: number;
46
+ readonly strokeLinecap: "butt" | "round" | "square";
47
+ readonly strokeLinejoin: "miter" | "round" | "bevel";
48
+ readonly strokeMiterlimit: number;
49
+ readonly strokeDasharray: readonly number[] | null;
50
+ readonly strokeDashoffset: number;
51
+ readonly color: Rgba;
52
+ readonly opacity: number;
53
+ readonly display: "inline" | "none";
54
+ readonly visibility: "visible" | "hidden" | "collapse";
55
+ readonly clipPath: PaintReference | null;
56
+ readonly mask: PaintReference | null;
57
+ readonly filter: PaintReference | null;
58
+ readonly blendMode: BlendMode | null;
59
+ /** `vector-effect: non-scaling-stroke`: the stroke keeps its width in the outer viewport's units. */
60
+ readonly nonScalingStroke: boolean;
61
+ /** `mask-type`, read on a `<mask>`: whether its luminance or its alpha masks. */
62
+ readonly maskType: "luminance" | "alpha";
63
+ /**
64
+ * `overflow` is `visible` or `auto`, read on a `<symbol>`. False otherwise,
65
+ * as the UA style sets `overflow: hidden` on the viewport elements this is
66
+ * read on, so they clip to their viewport. Never inherited.
67
+ */
68
+ readonly overflowVisible: boolean;
69
+ readonly fontFamily: readonly string[];
70
+ readonly fontSize: number;
71
+ readonly fontWeight: number;
72
+ /** The requested `font-style`; a run carries it as `italic` only, since the model draws no oblique distinction. */
73
+ readonly fontStyle: "normal" | "italic" | "oblique";
74
+ /**
75
+ * The angle of an `oblique <angle>` font-style, in degrees, or null for a
76
+ * plain style. The model cannot draw a chosen slant, so a set angle is
77
+ * reported where the text is built. A 0deg oblique is upright (CSS Fonts
78
+ * 4), so it reads as `normal` here and never reaches this field.
79
+ */
80
+ readonly obliqueAngle: number | null;
81
+ /** Extra space between characters in px; null is SVG's `normal`. */
82
+ readonly letterSpacing: number | null;
83
+ readonly textDecoration: TextDecorations;
84
+ readonly textAnchor: "start" | "middle" | "end";
85
+ readonly stopColor: Rgba;
86
+ readonly stopOpacity: number;
87
+ /**
88
+ * `marker-start`, `marker-mid` and `marker-end`: the referenced marker's
89
+ * reference, or null for `none`. Inherited. The model
90
+ * has no markers, so a set one is only reported.
91
+ */
92
+ readonly markerStart: PaintReference | null;
93
+ readonly markerMid: PaintReference | null;
94
+ readonly markerEnd: PaintReference | null;
95
+ /** `flood-color`, read on `feFlood` and `feDropShadow`; never inherited. */
96
+ readonly floodColor: Rgba;
97
+ readonly floodOpacity: number;
98
+ /** Set when `text-decoration` named `overline`, which the model cannot draw. */
99
+ readonly overline: boolean;
100
+ /**
101
+ * A CSS `transform` declaration won the cascade on this element, so the
102
+ * `transform` attribute is left out, as a browser leaves it out (the
103
+ * attribute is a presentation attribute, which any CSS declaration beats).
104
+ * Never inherited.
105
+ */
106
+ readonly cssTransformWins: boolean;
107
+ /** Text white space is kept as written: `xml:space="preserve"` here or on an ancestor. */
108
+ readonly preserveWhitespace: boolean;
109
+ /**
110
+ * The element's own declarations whose value could not be read, in
111
+ * source order. Each was ignored, as CSS ignores it; the import lists
112
+ * them in the report. Never inherited. Capped: only the first
113
+ * MAX_KEPT_INVALID are kept; `invalidOverflow` counts the rest.
114
+ */
115
+ readonly invalid: readonly InvalidDeclaration[];
116
+ /** How many invalid declarations past the kept ones there were. */
117
+ readonly invalidOverflow: number;
118
+ /**
119
+ * The element's own winning declarations of properties the import does
120
+ * not support (see `PRESENTATION_PROPERTIES`) whose value changes the
121
+ * drawing, in source order. Each was ignored; the import lists them in
122
+ * one report line. Never inherited: an ancestor's is reported there.
123
+ */
124
+ readonly unsupported: readonly InvalidDeclaration[];
125
+ /**
126
+ * The pieces of the element's own `style` attribute that could not be
127
+ * parsed as declarations (no colon, an empty property), in source order
128
+ * and capped (see css.ts): the kept ones with `overflow` counting the
129
+ * rest. Each was left out, as CSS leaves it out; the import lists them.
130
+ * Never inherited.
131
+ */
132
+ readonly styleAttributeRejected: {
133
+ readonly rejected: readonly CssRejection[];
134
+ readonly overflow: number;
135
+ };
136
+ /**
137
+ * The paint and color fields whose computed value is `currentColor`, with
138
+ * the `url()` id when it is a reference's fallback. The keyword is the
139
+ * computed value (CSS Color 4 §6.4), so a child that inherits one of these
140
+ * resolves it against its own `color`.
141
+ */
142
+ readonly currentColorFields: ReadonlyMap<CurrentColorField, PaintReference | null>;
143
+ }
144
+ /** A declaration the cascade ignored because its value could not be read. */
145
+ export interface InvalidDeclaration {
146
+ readonly property: string;
147
+ readonly value: string;
148
+ /** Why it was ignored, when the value parses but crosses a cap. */
149
+ readonly reason?: string;
150
+ }
151
+ /** The style of the root element, before its own declarations. */
152
+ export declare function initialComputedStyle(): ComputedStyle;
153
+ /** The viewport percentages resolve against, for `stroke-width` percentages. */
154
+ export interface StyleViewport {
155
+ readonly width: number;
156
+ readonly height: number;
157
+ }
158
+ /**
159
+ * The `<style>` rules of one document, indexed by selector, so an element
160
+ * looks up only the rules for its own type, id and classes instead of
161
+ * testing every rule. Each lookup counts the rules it matches — one per
162
+ * rule, plus one per declaration and per character of its value, which is
163
+ * parsed again for every matching element — against the import's style work
164
+ * cap (`SvgImportLimits.styleWork`) before it builds anything, so a file
165
+ * pairing many rules, or a huge value, with many elements is refused instead
166
+ * of freezing the editor. Component checks count too: they compute styles
167
+ * like the walk does.
168
+ */
169
+ export declare class StyleRules {
170
+ #private;
171
+ /**
172
+ * The root element's computed font size, which `rem` lengths are of
173
+ * (CSS Values 4, font-relative lengths). Set once the root's style is
174
+ * computed; on the root itself `rem` is of the initial 16px.
175
+ */
176
+ rootFontSize: number;
177
+ constructor(rules: readonly CssRule[], guard: LimitGuard);
178
+ /**
179
+ * Counts one build of an element against the import's cap
180
+ * (`SvgImportLimits.elementBuilds`): every build computes the element's
181
+ * style once, through these rules.
182
+ */
183
+ countElementBuild(): void;
184
+ /**
185
+ * Counts one font family tried for a run of text against the style work
186
+ * cap (`SvgImportLimits.styleWork`), so a long `font-family` list
187
+ * inherited by many text elements is refused instead of freezing the
188
+ * editor with font lookups.
189
+ */
190
+ countFontLookup(): void;
191
+ /**
192
+ * Counts the declarations of one inline `style` attribute against the
193
+ * style work cap (`SvgImportLimits.styleWork`) as they are parsed — one
194
+ * per declaration plus its value's length, as a matched rule's
195
+ * declarations count — so a huge attribute is refused while it is read,
196
+ * before its declaration list is built, copied and walked.
197
+ */
198
+ countInlineStyleWork(units: number): void;
199
+ /** The rules that match the element, by specificity and then source order. */
200
+ matching(element: SvgElementLike): CssRule[];
201
+ }
202
+ /**
203
+ * Computes one element's style: presentation attributes first, then matching
204
+ * `<style>` rules by specificity and source order, then the inline `style`;
205
+ * then, in the same order, the `!important` declarations of the rules and of
206
+ * the inline `style`, which beat every normal one.
207
+ * A declaration whose value does not parse is dropped, as CSS does, so a
208
+ * broken value never hides a working one. `currentColor` resolves against
209
+ * the element's own computed `color`.
210
+ */
211
+ export declare function computeElementStyle(element: SvgElementLike, parent: ComputedStyle | null, rules: StyleRules, viewport: StyleViewport | null): ComputedStyle;
212
+ /** The style fields that accept `currentColor`. */
213
+ type CurrentColorField = "fill" | "stroke" | "stopColor" | "floodColor";
214
+ export {};