react-native-nano-icons 0.2.1 → 1.0.0-beta.2

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 (404) hide show
  1. package/LICENSES.md +40 -0
  2. package/README.md +165 -12
  3. package/android/build.gradle +8 -1
  4. package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +31 -0
  5. package/android/src/main/java/com/nanoicons/NanoIconView.kt +103 -19
  6. package/android/src/main/java/com/nanoicons/NanoIconViewManager.kt +42 -18
  7. package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +72 -11
  8. package/android/src/main/jni/CMakeLists.txt +38 -0
  9. package/android/src/main/jni/RNNanoIconsSpec.h +19 -0
  10. package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewComponentDescriptor.h +11 -0
  11. package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewShadowNode.cpp +46 -0
  12. package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewShadowNode.h +41 -0
  13. package/ios/NanoIconFontResolver.h +5 -0
  14. package/ios/NanoIconFontResolver.mm +32 -0
  15. package/ios/NanoIconInlineBaseline.h +4 -0
  16. package/ios/NanoIconInlineBaseline.mm +190 -0
  17. package/ios/NanoIconView.h +1 -4
  18. package/ios/NanoIconView.mm +178 -162
  19. package/ios/NanoIconsFontLoader.mm +10 -32
  20. package/lib/commonjs/cli/build.d.ts +16 -3
  21. package/lib/commonjs/cli/build.js +108 -25
  22. package/lib/commonjs/cli/buildSymbols.d.ts +26 -0
  23. package/lib/commonjs/cli/buildSymbols.js +134 -0
  24. package/lib/commonjs/cli/config.d.ts +4 -2
  25. package/lib/commonjs/cli/config.js +4 -4
  26. package/lib/commonjs/cli/expoConfig.d.ts +6 -2
  27. package/lib/commonjs/cli/expoConfig.js +37 -13
  28. package/lib/commonjs/cli/index.d.ts +7 -5
  29. package/lib/commonjs/cli/index.js +27 -14
  30. package/lib/commonjs/cli/link.d.ts +19 -3
  31. package/lib/commonjs/cli/link.js +311 -45
  32. package/lib/commonjs/cli/logger.js +9 -7
  33. package/lib/commonjs/metro/fontRebuildWatcher.d.ts +62 -0
  34. package/lib/commonjs/metro/fontRebuildWatcher.js +174 -0
  35. package/lib/commonjs/metro/index.d.ts +35 -0
  36. package/lib/commonjs/metro/index.js +92 -0
  37. package/lib/commonjs/metro/symbolRebuildWatcher.d.ts +19 -0
  38. package/lib/commonjs/metro/symbolRebuildWatcher.js +76 -0
  39. package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -3
  40. package/lib/commonjs/plugin/src/buildFonts.js +5 -15
  41. package/lib/commonjs/plugin/src/buildSymbols.d.ts +3 -0
  42. package/lib/commonjs/plugin/src/buildSymbols.js +18 -0
  43. package/lib/commonjs/plugin/src/index.d.ts +2 -2
  44. package/lib/commonjs/plugin/src/index.js +10 -4
  45. package/lib/commonjs/plugin/src/types.d.ts +44 -3
  46. package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.d.ts +8 -0
  47. package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.js +29 -0
  48. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +1 -1
  49. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +6 -13
  50. package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.d.ts +8 -0
  51. package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.js +37 -0
  52. package/lib/commonjs/scripts/cli.js +64 -23
  53. package/lib/commonjs/src/core/flatten/arcs.d.ts +2 -0
  54. package/lib/commonjs/src/core/flatten/arcs.js +136 -0
  55. package/lib/commonjs/src/core/flatten/document.d.ts +35 -0
  56. package/lib/commonjs/src/core/flatten/document.js +164 -0
  57. package/lib/commonjs/src/core/flatten/dom.d.ts +24 -0
  58. package/lib/commonjs/src/core/flatten/dom.js +221 -0
  59. package/lib/commonjs/src/core/flatten/element.d.ts +12 -0
  60. package/lib/commonjs/src/core/flatten/element.js +97 -0
  61. package/lib/commonjs/src/core/flatten/geometry.d.ts +21 -0
  62. package/lib/commonjs/src/core/flatten/geometry.js +85 -0
  63. package/lib/commonjs/src/core/flatten/index.d.ts +2 -0
  64. package/lib/commonjs/src/core/flatten/index.js +11 -0
  65. package/lib/commonjs/src/core/flatten/inherit.d.ts +13 -0
  66. package/lib/commonjs/src/core/flatten/inherit.js +249 -0
  67. package/lib/commonjs/src/core/flatten/path.d.ts +19 -0
  68. package/lib/commonjs/src/core/flatten/path.js +439 -0
  69. package/lib/commonjs/src/core/flatten/pathops.d.ts +14 -0
  70. package/lib/commonjs/src/core/flatten/pathops.js +236 -0
  71. package/lib/commonjs/src/core/flatten/shape.d.ts +29 -0
  72. package/lib/commonjs/src/core/flatten/shape.js +415 -0
  73. package/lib/commonjs/src/core/flatten/stages/clip-path.d.ts +4 -0
  74. package/lib/commonjs/src/core/flatten/stages/clip-path.js +20 -0
  75. package/lib/commonjs/src/core/flatten/stages/collapse.d.ts +2 -0
  76. package/lib/commonjs/src/core/flatten/stages/collapse.js +86 -0
  77. package/lib/commonjs/src/core/flatten/stages/defs.d.ts +4 -0
  78. package/lib/commonjs/src/core/flatten/stages/defs.js +49 -0
  79. package/lib/commonjs/src/core/flatten/stages/discard.d.ts +4 -0
  80. package/lib/commonjs/src/core/flatten/stages/discard.js +50 -0
  81. package/lib/commonjs/src/core/flatten/stages/fill-rule.d.ts +2 -0
  82. package/lib/commonjs/src/core/flatten/stages/fill-rule.js +7 -0
  83. package/lib/commonjs/src/core/flatten/stages/nested-svg.d.ts +2 -0
  84. package/lib/commonjs/src/core/flatten/stages/nested-svg.js +131 -0
  85. package/lib/commonjs/src/core/flatten/stages/opacity.d.ts +2 -0
  86. package/lib/commonjs/src/core/flatten/stages/opacity.js +7 -0
  87. package/lib/commonjs/src/core/flatten/stages/shapes.d.ts +7 -0
  88. package/lib/commonjs/src/core/flatten/stages/shapes.js +37 -0
  89. package/lib/commonjs/src/core/flatten/stages/stroke.d.ts +3 -0
  90. package/lib/commonjs/src/core/flatten/stages/stroke.js +34 -0
  91. package/lib/commonjs/src/core/flatten/stages/styles.d.ts +2 -0
  92. package/lib/commonjs/src/core/flatten/stages/styles.js +29 -0
  93. package/lib/commonjs/src/core/flatten/stages/use.d.ts +4 -0
  94. package/lib/commonjs/src/core/flatten/stages/use.js +80 -0
  95. package/lib/commonjs/src/core/flatten/stages/validate.d.ts +2 -0
  96. package/lib/commonjs/src/core/flatten/stages/validate.js +39 -0
  97. package/lib/commonjs/src/core/flatten/stages.d.ts +2 -0
  98. package/lib/commonjs/src/core/flatten/stages.js +40 -0
  99. package/lib/commonjs/src/core/flatten/transform.d.ts +35 -0
  100. package/lib/commonjs/src/core/flatten/transform.js +221 -0
  101. package/lib/commonjs/src/core/font/compile.d.ts +2 -1
  102. package/lib/commonjs/src/core/font/compile.js +19 -7
  103. package/lib/commonjs/src/core/font/metrics.js +7 -0
  104. package/lib/commonjs/src/core/font/quadratic.d.ts +2 -0
  105. package/lib/commonjs/src/core/font/quadratic.js +33 -0
  106. package/lib/commonjs/src/core/glyph/merge.d.ts +7 -0
  107. package/lib/commonjs/src/core/glyph/merge.js +59 -0
  108. package/lib/commonjs/src/core/glyph/parse.d.ts +27 -0
  109. package/lib/commonjs/src/core/{svg/svg_dom.js → glyph/parse.js} +21 -77
  110. package/lib/commonjs/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +1 -13
  111. package/lib/commonjs/src/core/{svg/layers.js → glyph/placement.js} +0 -17
  112. package/lib/commonjs/src/core/glyph/validate.d.ts +8 -0
  113. package/lib/commonjs/src/core/glyph/validate.js +33 -0
  114. package/lib/commonjs/src/core/pathkit/contours.d.ts +75 -0
  115. package/lib/commonjs/src/core/{svg/svg_pathops.js → pathkit/contours.js} +79 -301
  116. package/lib/commonjs/src/core/pathkit/evenodd.d.ts +12 -0
  117. package/lib/commonjs/src/core/pathkit/evenodd.js +37 -0
  118. package/lib/commonjs/src/core/pathkit/load.d.ts +2 -0
  119. package/lib/commonjs/src/core/pathkit/load.js +26 -0
  120. package/lib/commonjs/src/core/pathkit/types.d.ts +69 -0
  121. package/lib/commonjs/src/core/pathkit/types.js +2 -0
  122. package/lib/commonjs/src/core/pathkit/winding.d.ts +4 -0
  123. package/lib/commonjs/src/core/pathkit/winding.js +59 -0
  124. package/lib/commonjs/src/core/pipeline/config.d.ts +2 -0
  125. package/lib/commonjs/src/core/pipeline/config.js +6 -0
  126. package/lib/commonjs/src/core/pipeline/iconPool.d.ts +14 -0
  127. package/lib/commonjs/src/core/pipeline/iconPool.js +109 -0
  128. package/lib/commonjs/src/core/pipeline/index.d.ts +5 -3
  129. package/lib/commonjs/src/core/pipeline/index.js +8 -5
  130. package/lib/commonjs/src/core/pipeline/prepare.d.ts +20 -0
  131. package/lib/commonjs/src/core/pipeline/prepare.js +74 -0
  132. package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +25 -0
  133. package/lib/commonjs/src/core/pipeline/prepareIcon.js +81 -0
  134. package/lib/commonjs/src/core/pipeline/prepareSvg.d.ts +6 -0
  135. package/lib/commonjs/src/core/pipeline/prepareSvg.js +11 -0
  136. package/lib/commonjs/src/core/pipeline/prepareSymbol.d.ts +26 -0
  137. package/lib/commonjs/src/core/pipeline/prepareSymbol.js +79 -0
  138. package/lib/commonjs/src/core/pipeline/prepareWorker.d.ts +1 -0
  139. package/lib/commonjs/src/core/pipeline/prepareWorker.js +12 -0
  140. package/lib/commonjs/src/core/pipeline/preparedSvgCache.d.ts +6 -0
  141. package/lib/commonjs/src/core/pipeline/preparedSvgCache.js +44 -0
  142. package/lib/commonjs/src/core/pipeline/runFontPipeline.d.ts +22 -0
  143. package/lib/commonjs/src/core/pipeline/runFontPipeline.js +111 -0
  144. package/lib/commonjs/src/core/pipeline/runSymbolPipeline.d.ts +54 -0
  145. package/lib/commonjs/src/core/pipeline/runSymbolPipeline.js +161 -0
  146. package/lib/commonjs/src/core/symbols/contents.d.ts +2 -0
  147. package/lib/commonjs/src/core/symbols/contents.js +15 -0
  148. package/lib/commonjs/src/core/symbols/knockout.d.ts +3 -0
  149. package/lib/commonjs/src/core/symbols/knockout.js +51 -0
  150. package/lib/commonjs/src/core/symbols/layers.d.ts +36 -0
  151. package/lib/commonjs/src/core/symbols/layers.js +182 -0
  152. package/lib/commonjs/src/core/symbols/template.d.ts +22 -0
  153. package/lib/commonjs/src/core/symbols/template.js +140 -0
  154. package/lib/commonjs/src/core/symbols/vectorDrawable.d.ts +11 -0
  155. package/lib/commonjs/src/core/symbols/vectorDrawable.js +66 -0
  156. package/lib/commonjs/src/core/types.d.ts +3 -92
  157. package/lib/commonjs/src/utils/fingerPrint.d.ts +19 -1
  158. package/lib/commonjs/src/utils/fingerPrint.js +29 -3
  159. package/lib/commonjs/src/utils/fontIdentity.d.ts +4 -0
  160. package/lib/commonjs/src/utils/fontIdentity.js +24 -0
  161. package/lib/commonjs/src/utils/naming.d.ts +10 -0
  162. package/lib/commonjs/src/utils/naming.js +49 -0
  163. package/lib/commonjs/src/utils/packageVersion.d.ts +2 -0
  164. package/lib/commonjs/src/utils/packageVersion.js +37 -0
  165. package/lib/commonjs/src/utils/parse.d.ts +0 -1
  166. package/lib/commonjs/src/utils/parse.js +0 -8
  167. package/lib/commonjs/src/utils/svgPatterns.d.ts +38 -0
  168. package/lib/commonjs/src/utils/svgPatterns.js +46 -0
  169. package/lib/module/const/codegenPrimitives.js +1 -2
  170. package/lib/module/const/colors.js +1 -2
  171. package/lib/module/createNanoIconsSet.js +1 -2
  172. package/lib/module/createNanoIconsSet.native.js +38 -28
  173. package/lib/module/createNanoIconsSet.shared.js +15 -9
  174. package/lib/module/createNanoIconsSet.web.js +22 -8
  175. package/lib/module/devServerFont.js +30 -0
  176. package/lib/module/devServerFont.web.js +25 -0
  177. package/lib/module/fontIntegrity.js +99 -0
  178. package/lib/module/index.js +1 -1
  179. package/lib/module/index.node.js +1 -2
  180. package/lib/module/loadDynamicFont.js +20 -10
  181. package/lib/module/nativeFontLoader.js +3 -0
  182. package/lib/module/nativeFontLoader.web.js +3 -0
  183. package/lib/module/specs/NanoIconViewNativeComponent.ts +9 -6
  184. package/lib/module/specs/NativeNanoIconsFontLoader.js +1 -2
  185. package/lib/module/symbols/index.android.js +42 -0
  186. package/lib/module/symbols/index.ios.js +35 -0
  187. package/lib/module/symbols/index.js +35 -0
  188. package/lib/module/symbols/index.native.js +12 -0
  189. package/lib/module/symbols/types.js +1 -0
  190. package/lib/module/types.js +1 -2
  191. package/lib/module/utils/fingerPrint.js +20 -5
  192. package/lib/module/utils/fontIdentity.js +20 -0
  193. package/lib/module/utils/glyphRuntime.js +36 -3
  194. package/lib/module/utils/naming.js +46 -0
  195. package/lib/module/utils/packageVersion.js +29 -0
  196. package/lib/module/utils/parse.js +1 -9
  197. package/lib/module/utils/runtimeLog.js +12 -0
  198. package/lib/module/utils/shallowEqualColor.js +1 -2
  199. package/lib/module/utils/svgPatterns.js +49 -0
  200. package/lib/module/utils/validateLayerColor.js +24 -0
  201. package/lib/typescript/src/core/flatten/arcs.d.ts +3 -0
  202. package/lib/typescript/src/core/flatten/document.d.ts +36 -0
  203. package/lib/typescript/src/core/flatten/dom.d.ts +25 -0
  204. package/lib/typescript/src/core/flatten/element.d.ts +13 -0
  205. package/lib/typescript/src/core/flatten/geometry.d.ts +22 -0
  206. package/lib/typescript/src/core/flatten/index.d.ts +3 -0
  207. package/lib/typescript/src/core/flatten/inherit.d.ts +14 -0
  208. package/lib/typescript/src/core/flatten/path.d.ts +20 -0
  209. package/lib/typescript/src/core/flatten/pathops.d.ts +15 -0
  210. package/lib/typescript/src/core/flatten/shape.d.ts +30 -0
  211. package/lib/typescript/src/core/flatten/stages/clip-path.d.ts +5 -0
  212. package/lib/typescript/src/core/flatten/stages/collapse.d.ts +3 -0
  213. package/lib/typescript/src/core/flatten/stages/defs.d.ts +5 -0
  214. package/lib/typescript/src/core/flatten/stages/discard.d.ts +5 -0
  215. package/lib/typescript/src/core/flatten/stages/fill-rule.d.ts +3 -0
  216. package/lib/typescript/src/core/flatten/stages/nested-svg.d.ts +3 -0
  217. package/lib/typescript/src/core/flatten/stages/opacity.d.ts +3 -0
  218. package/lib/typescript/src/core/flatten/stages/shapes.d.ts +8 -0
  219. package/lib/typescript/src/core/flatten/stages/stroke.d.ts +4 -0
  220. package/lib/typescript/src/core/flatten/stages/styles.d.ts +3 -0
  221. package/lib/typescript/src/core/flatten/stages/use.d.ts +5 -0
  222. package/lib/typescript/src/core/flatten/stages/validate.d.ts +3 -0
  223. package/lib/typescript/src/core/flatten/stages.d.ts +3 -0
  224. package/lib/typescript/src/core/flatten/transform.d.ts +36 -0
  225. package/lib/typescript/src/core/glyph/merge.d.ts +8 -0
  226. package/lib/typescript/src/core/glyph/parse.d.ts +28 -0
  227. package/lib/typescript/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +2 -14
  228. package/lib/typescript/src/core/glyph/validate.d.ts +9 -0
  229. package/lib/typescript/src/core/pathkit/contours.d.ts +76 -0
  230. package/lib/typescript/src/core/pathkit/evenodd.d.ts +13 -0
  231. package/lib/typescript/src/core/pathkit/load.d.ts +3 -0
  232. package/lib/typescript/src/core/pathkit/types.d.ts +70 -0
  233. package/lib/typescript/src/core/pathkit/winding.d.ts +5 -0
  234. package/lib/typescript/src/core/symbols/contents.d.ts +3 -0
  235. package/lib/typescript/src/core/symbols/knockout.d.ts +4 -0
  236. package/lib/typescript/src/core/symbols/layers.d.ts +37 -0
  237. package/lib/typescript/src/core/symbols/template.d.ts +23 -0
  238. package/lib/typescript/src/core/symbols/vectorDrawable.d.ts +12 -0
  239. package/lib/typescript/src/core/types.d.ts +3 -92
  240. package/lib/typescript/src/devServerFont.d.ts +4 -0
  241. package/lib/typescript/src/devServerFont.web.d.ts +4 -0
  242. package/lib/typescript/src/fontIntegrity.d.ts +24 -0
  243. package/lib/typescript/src/index.d.ts +1 -0
  244. package/lib/typescript/src/loadDynamicFont.d.ts +1 -0
  245. package/lib/typescript/src/nativeFontLoader.d.ts +2 -0
  246. package/lib/typescript/src/nativeFontLoader.web.d.ts +3 -0
  247. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts +6 -5
  248. package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
  249. package/lib/typescript/src/symbols/index.android.d.ts +33 -0
  250. package/lib/typescript/src/symbols/index.d.ts +31 -0
  251. package/lib/typescript/src/symbols/index.ios.d.ts +31 -0
  252. package/lib/typescript/src/symbols/index.native.d.ts +8 -0
  253. package/lib/typescript/src/symbols/types.d.ts +24 -0
  254. package/lib/typescript/src/types.d.ts +7 -0
  255. package/lib/typescript/src/utils/fingerPrint.d.ts +19 -1
  256. package/lib/typescript/src/utils/fontIdentity.d.ts +5 -0
  257. package/lib/typescript/src/utils/glyphRuntime.d.ts +3 -1
  258. package/lib/typescript/src/utils/naming.d.ts +11 -0
  259. package/lib/typescript/src/utils/packageVersion.d.ts +3 -0
  260. package/lib/typescript/src/utils/parse.d.ts +0 -1
  261. package/lib/typescript/src/utils/runtimeLog.d.ts +5 -0
  262. package/lib/typescript/src/utils/svgPatterns.d.ts +39 -0
  263. package/lib/typescript/src/utils/validateLayerColor.d.ts +3 -0
  264. package/metro.js +1 -0
  265. package/package.json +37 -11
  266. package/react-native-nano-icons.podspec +4 -1
  267. package/react-native.config.js +10 -0
  268. package/src/specs/NanoIconViewNativeComponent.ts +9 -6
  269. package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
  270. package/lib/commonjs/src/core/pipeline/managers.d.ts +0 -11
  271. package/lib/commonjs/src/core/pipeline/managers.js +0 -104
  272. package/lib/commonjs/src/core/pipeline/run.d.ts +0 -14
  273. package/lib/commonjs/src/core/pipeline/run.js +0 -189
  274. package/lib/commonjs/src/core/svg/svg_dom.d.ts +0 -51
  275. package/lib/commonjs/src/core/svg/svg_pathops.d.ts +0 -32
  276. package/lib/module/const/codegenPrimitives.js.map +0 -1
  277. package/lib/module/const/colors.js.map +0 -1
  278. package/lib/module/core/font/compile.js +0 -81
  279. package/lib/module/core/font/compile.js.map +0 -1
  280. package/lib/module/core/font/metrics.js +0 -37
  281. package/lib/module/core/font/metrics.js.map +0 -1
  282. package/lib/module/core/pipeline/config.js +0 -20
  283. package/lib/module/core/pipeline/config.js.map +0 -1
  284. package/lib/module/core/pipeline/index.js +0 -5
  285. package/lib/module/core/pipeline/index.js.map +0 -1
  286. package/lib/module/core/pipeline/managers.js +0 -94
  287. package/lib/module/core/pipeline/managers.js.map +0 -1
  288. package/lib/module/core/pipeline/run.js +0 -204
  289. package/lib/module/core/pipeline/run.js.map +0 -1
  290. package/lib/module/core/shims/pathops.py +0 -181
  291. package/lib/module/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  292. package/lib/module/core/svg/layers.js +0 -85
  293. package/lib/module/core/svg/layers.js.map +0 -1
  294. package/lib/module/core/svg/svg_dom.js +0 -170
  295. package/lib/module/core/svg/svg_dom.js.map +0 -1
  296. package/lib/module/core/svg/svg_pathops.js +0 -750
  297. package/lib/module/core/svg/svg_pathops.js.map +0 -1
  298. package/lib/module/core/tsconfig.json +0 -32
  299. package/lib/module/core/types.js +0 -2
  300. package/lib/module/core/types.js.map +0 -1
  301. package/lib/module/createNanoIconsSet.js.map +0 -1
  302. package/lib/module/createNanoIconsSet.native.js.map +0 -1
  303. package/lib/module/createNanoIconsSet.shared.js.map +0 -1
  304. package/lib/module/createNanoIconsSet.web.js.map +0 -1
  305. package/lib/module/index.js.map +0 -1
  306. package/lib/module/index.node.js.map +0 -1
  307. package/lib/module/loadDynamicFont.js.map +0 -1
  308. package/lib/module/specs/NativeNanoIconsFontLoader.js.map +0 -1
  309. package/lib/module/types.js.map +0 -1
  310. package/lib/module/utils/fingerPrint.js.map +0 -1
  311. package/lib/module/utils/glyphRuntime.js.map +0 -1
  312. package/lib/module/utils/parse.js.map +0 -1
  313. package/lib/module/utils/shallowEqualColor.js.map +0 -1
  314. package/lib/typescript/__tests__/build.unit.test.d.ts +0 -3
  315. package/lib/typescript/__tests__/build.unit.test.d.ts.map +0 -1
  316. package/lib/typescript/__tests__/clippath.e2e.test.d.ts +0 -3
  317. package/lib/typescript/__tests__/clippath.e2e.test.d.ts.map +0 -1
  318. package/lib/typescript/__tests__/fingerprint.unit.test.d.ts +0 -3
  319. package/lib/typescript/__tests__/fingerprint.unit.test.d.ts.map +0 -1
  320. package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts +0 -2
  321. package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts.map +0 -1
  322. package/lib/typescript/__tests__/link.unit.test.d.ts +0 -3
  323. package/lib/typescript/__tests__/link.unit.test.d.ts.map +0 -1
  324. package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts +0 -2
  325. package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts.map +0 -1
  326. package/lib/typescript/__tests__/pipeline.e2e.test.d.ts +0 -3
  327. package/lib/typescript/__tests__/pipeline.e2e.test.d.ts.map +0 -1
  328. package/lib/typescript/__tests__/placement.unit.test.d.ts +0 -3
  329. package/lib/typescript/__tests__/placement.unit.test.d.ts.map +0 -1
  330. package/lib/typescript/__tests__/svg_dom.unit.test.d.ts +0 -3
  331. package/lib/typescript/__tests__/svg_dom.unit.test.d.ts.map +0 -1
  332. package/lib/typescript/cli/build.d.ts +0 -32
  333. package/lib/typescript/cli/build.d.ts.map +0 -1
  334. package/lib/typescript/cli/link.d.ts +0 -12
  335. package/lib/typescript/cli/link.d.ts.map +0 -1
  336. package/lib/typescript/cli/logger.d.ts +0 -28
  337. package/lib/typescript/cli/logger.d.ts.map +0 -1
  338. package/lib/typescript/src/const/codegenPrimitives.d.ts.map +0 -1
  339. package/lib/typescript/src/const/colors.d.ts.map +0 -1
  340. package/lib/typescript/src/core/font/compile.d.ts +0 -21
  341. package/lib/typescript/src/core/font/compile.d.ts.map +0 -1
  342. package/lib/typescript/src/core/font/metrics.d.ts +0 -2
  343. package/lib/typescript/src/core/font/metrics.d.ts.map +0 -1
  344. package/lib/typescript/src/core/pipeline/config.d.ts +0 -16
  345. package/lib/typescript/src/core/pipeline/config.d.ts.map +0 -1
  346. package/lib/typescript/src/core/pipeline/index.d.ts +0 -4
  347. package/lib/typescript/src/core/pipeline/index.d.ts.map +0 -1
  348. package/lib/typescript/src/core/pipeline/managers.d.ts +0 -12
  349. package/lib/typescript/src/core/pipeline/managers.d.ts.map +0 -1
  350. package/lib/typescript/src/core/pipeline/run.d.ts +0 -15
  351. package/lib/typescript/src/core/pipeline/run.d.ts.map +0 -1
  352. package/lib/typescript/src/core/svg/layers.d.ts.map +0 -1
  353. package/lib/typescript/src/core/svg/svg_dom.d.ts +0 -52
  354. package/lib/typescript/src/core/svg/svg_dom.d.ts.map +0 -1
  355. package/lib/typescript/src/core/svg/svg_pathops.d.ts +0 -33
  356. package/lib/typescript/src/core/svg/svg_pathops.d.ts.map +0 -1
  357. package/lib/typescript/src/core/types.d.ts.map +0 -1
  358. package/lib/typescript/src/createNanoIconsSet.d.ts.map +0 -1
  359. package/lib/typescript/src/createNanoIconsSet.native.d.ts.map +0 -1
  360. package/lib/typescript/src/createNanoIconsSet.shared.d.ts.map +0 -1
  361. package/lib/typescript/src/createNanoIconsSet.web.d.ts.map +0 -1
  362. package/lib/typescript/src/index.d.ts.map +0 -1
  363. package/lib/typescript/src/index.node.d.ts.map +0 -1
  364. package/lib/typescript/src/loadDynamicFont.d.ts.map +0 -1
  365. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts.map +0 -1
  366. package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts.map +0 -1
  367. package/lib/typescript/src/types.d.ts.map +0 -1
  368. package/lib/typescript/src/utils/fingerPrint.d.ts.map +0 -1
  369. package/lib/typescript/src/utils/glyphRuntime.d.ts.map +0 -1
  370. package/lib/typescript/src/utils/parse.d.ts.map +0 -1
  371. package/lib/typescript/src/utils/shallowEqualColor.d.ts.map +0 -1
  372. package/plugin/src/buildFonts.ts +0 -42
  373. package/plugin/src/index.ts +0 -21
  374. package/plugin/src/types.ts +0 -42
  375. package/plugin/src/withNanoIconsFontLinking.ts +0 -136
  376. package/plugin/tsconfig.json +0 -9
  377. package/scripts/cli.ts +0 -63
  378. package/scripts/tsconfig.json +0 -25
  379. package/src/const/colors.ts +0 -150
  380. package/src/core/font/compile.ts +0 -99
  381. package/src/core/font/metrics.ts +0 -44
  382. package/src/core/pipeline/config.ts +0 -25
  383. package/src/core/pipeline/index.ts +0 -3
  384. package/src/core/pipeline/managers.ts +0 -132
  385. package/src/core/pipeline/run.ts +0 -274
  386. package/src/core/shims/pathops.py +0 -181
  387. package/src/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  388. package/src/core/svg/layers.ts +0 -110
  389. package/src/core/svg/svg_dom.ts +0 -194
  390. package/src/core/svg/svg_pathops.ts +0 -1040
  391. package/src/core/tsconfig.json +0 -32
  392. package/src/core/types.ts +0 -157
  393. package/src/createNanoIconsSet.native.tsx +0 -192
  394. package/src/createNanoIconsSet.shared.tsx +0 -174
  395. package/src/createNanoIconsSet.tsx +0 -20
  396. package/src/createNanoIconsSet.web.tsx +0 -109
  397. package/src/index.node.ts +0 -14
  398. package/src/index.ts +0 -6
  399. package/src/loadDynamicFont.ts +0 -162
  400. package/src/types.ts +0 -31
  401. package/src/utils/fingerPrint.ts +0 -20
  402. package/src/utils/glyphRuntime.ts +0 -46
  403. package/src/utils/parse.ts +0 -67
  404. package/src/utils/shallowEqualColor.ts +0 -17
@@ -0,0 +1,69 @@
1
+ export type Point = readonly [number, number];
2
+ export type Cmd = readonly number[];
3
+ export type VerbMap = {
4
+ MOVE: number;
5
+ LINE: number;
6
+ QUAD: number;
7
+ CONIC: number;
8
+ CUBIC: number;
9
+ CLOSE: number;
10
+ };
11
+ export interface PathKitPath {
12
+ delete?: () => void;
13
+ moveTo: (x: number, y: number) => void;
14
+ lineTo: (x: number, y: number) => void;
15
+ quadTo: (x1: number, y1: number, x2: number, y2: number) => void;
16
+ cubicTo: (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number) => void;
17
+ close: () => void;
18
+ simplify: () => void;
19
+ toSVGString: () => string;
20
+ toCmds: () => Cmd[];
21
+ getBounds: () => {
22
+ fLeft: number;
23
+ fTop: number;
24
+ fRight: number;
25
+ fBottom: number;
26
+ };
27
+ getFillType?: () => number;
28
+ setFillType: (t: number) => void;
29
+ dash?: (on: number, off: number, phase: number) => void;
30
+ stroke: (opts: {
31
+ width: number;
32
+ cap: number;
33
+ join: number;
34
+ miter_limit: number;
35
+ }) => PathKitPath | null;
36
+ transform: (a: number, c: number, e: number, b: number, d: number, f: number, g: number, h: number, i: number) => void;
37
+ }
38
+ export interface PathKitModule {
39
+ MOVE_VERB?: number;
40
+ LINE_VERB?: number;
41
+ QUAD_VERB?: number;
42
+ CONIC_VERB?: number;
43
+ CUBIC_VERB?: number;
44
+ CLOSE_VERB?: number;
45
+ FillType?: {
46
+ EVENODD?: number;
47
+ EVEN_ODD?: number;
48
+ WINDING?: number;
49
+ NONZERO?: number;
50
+ };
51
+ StrokeCap?: {
52
+ BUTT?: number;
53
+ ROUND?: number;
54
+ SQUARE?: number;
55
+ };
56
+ StrokeJoin?: {
57
+ MITER?: number;
58
+ ROUND?: number;
59
+ BEVEL?: number;
60
+ };
61
+ PathOp?: {
62
+ UNION?: number;
63
+ INTERSECT?: number;
64
+ DIFFERENCE?: number;
65
+ };
66
+ NewPath: (src?: PathKitPath) => PathKitPath;
67
+ FromSVGString: (svg: string) => PathKitPath | null;
68
+ MakeFromOp: (a: PathKitPath, b: PathKitPath, op: number) => PathKitPath | null;
69
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type { PathKitModule, PathKitPath } from './types';
2
+ export declare function orientedPathData(PathKit: PathKitModule, path: PathKitPath): string;
3
+ export declare function canonicalWinding(PathKit: PathKitModule, d: string): string;
4
+ export declare function reversedWinding(PathKit: PathKitModule, d: string): string;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orientedPathData = orientedPathData;
4
+ exports.canonicalWinding = canonicalWinding;
5
+ exports.reversedWinding = reversedWinding;
6
+ const contours_1 = require("./contours");
7
+ function conicsToCubics(cmds, V) {
8
+ let x = 0;
9
+ let y = 0;
10
+ return cmds.map((cmd) => {
11
+ const verb = cmd[0];
12
+ if (verb === V.CONIC) {
13
+ const [, cx, cy, ex, ey, w] = cmd;
14
+ const k = (4 * w) / (3 * (1 + w));
15
+ const out = [
16
+ V.CUBIC,
17
+ x + k * (cx - x),
18
+ y + k * (cy - y),
19
+ ex + k * (cx - ex),
20
+ ey + k * (cy - ey),
21
+ ex,
22
+ ey,
23
+ ];
24
+ x = ex;
25
+ y = ey;
26
+ return out;
27
+ }
28
+ if (verb !== V.CLOSE) {
29
+ x = cmd[cmd.length - 2];
30
+ y = cmd[cmd.length - 1];
31
+ }
32
+ return cmd;
33
+ });
34
+ }
35
+ function orientedContoursOf(PathKit, path) {
36
+ path.simplify();
37
+ const V = (0, contours_1.verbMap)(PathKit);
38
+ return (0, contours_1.orientedContours)(conicsToCubics(path.toCmds(), V), V);
39
+ }
40
+ function orientedPathData(PathKit, path) {
41
+ return (0, contours_1.cmdsToPathData)(orientedContoursOf(PathKit, path).flatMap((c) => c.cmds), (0, contours_1.verbMap)(PathKit));
42
+ }
43
+ function canonicalWinding(PathKit, d) {
44
+ const path = PathKit.FromSVGString(d);
45
+ if (!path)
46
+ return d;
47
+ const out = orientedPathData(PathKit, path);
48
+ path.delete?.();
49
+ return out;
50
+ }
51
+ function reversedWinding(PathKit, d) {
52
+ const path = PathKit.FromSVGString(d);
53
+ if (!path)
54
+ return d;
55
+ const V = (0, contours_1.verbMap)(PathKit);
56
+ const contours = orientedContoursOf(PathKit, path);
57
+ path.delete?.();
58
+ return (0, contours_1.cmdsToPathData)(contours.flatMap((c) => (0, contours_1.reverseClosedContourKeepStart)(c.cmds, c.explicitCloseWanted, V)), V);
59
+ }
@@ -4,6 +4,7 @@ export type PipelineConfig = {
4
4
  safeZone: number;
5
5
  startUnicode: number;
6
6
  linking: 'static' | 'dynamic';
7
+ web?: boolean;
7
8
  };
8
9
  export type PipelinePaths = {
9
10
  inputDir: string;
@@ -13,3 +14,4 @@ export type PipelinePaths = {
13
14
  export declare function ensureEmptyDir(dir: string): void;
14
15
  /** Create directory if it does not exist; do not remove existing contents (for shared output dirs). */
15
16
  export declare function ensureDir(dir: string): void;
17
+ export declare function writeFileAtomic(filePath: string, data: string | Uint8Array): void;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ensureEmptyDir = ensureEmptyDir;
7
7
  exports.ensureDir = ensureDir;
8
+ exports.writeFileAtomic = writeFileAtomic;
8
9
  const node_fs_1 = __importDefault(require("node:fs"));
9
10
  function ensureEmptyDir(dir) {
10
11
  if (node_fs_1.default.existsSync(dir))
@@ -15,3 +16,8 @@ function ensureEmptyDir(dir) {
15
16
  function ensureDir(dir) {
16
17
  node_fs_1.default.mkdirSync(dir, { recursive: true });
17
18
  }
19
+ function writeFileAtomic(filePath, data) {
20
+ const tmpPath = `${filePath}.tmp`;
21
+ node_fs_1.default.writeFileSync(tmpPath, data);
22
+ node_fs_1.default.renameSync(tmpPath, filePath);
23
+ }
@@ -0,0 +1,14 @@
1
+ import { type SvgPrepareTask, type SvgPrepareResult } from './prepareSvg';
2
+ export declare function defaultConcurrency(): number;
3
+ export declare class SvgWorkerPool {
4
+ private readonly size;
5
+ private readonly workers;
6
+ private queue;
7
+ constructor(size?: number);
8
+ prepare<T extends SvgPrepareTask>(tasks: T[]): Promise<SvgPrepareResult<T>[]>;
9
+ warm(): void;
10
+ close(): Promise<void>;
11
+ private run;
12
+ private discard;
13
+ }
14
+ export declare function prepareIcons<T extends SvgPrepareTask>(tasks: T[], concurrency: number): Promise<SvgPrepareResult<T>[]>;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SvgWorkerPool = void 0;
7
+ exports.defaultConcurrency = defaultConcurrency;
8
+ exports.prepareIcons = prepareIcons;
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_os_1 = __importDefault(require("node:os"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const node_worker_threads_1 = require("node:worker_threads");
13
+ const load_1 = require("../pathkit/load");
14
+ const prepareSvg_1 = require("./prepareSvg");
15
+ const WORKER_PATH = node_path_1.default.join(__dirname, 'prepareWorker.js');
16
+ function defaultConcurrency() {
17
+ return Math.max(1, Math.min(8, node_os_1.default.availableParallelism()));
18
+ }
19
+ async function prepareInProcess(tasks) {
20
+ const pathkit = await (0, load_1.loadPathKit)();
21
+ const results = [];
22
+ for (const task of tasks)
23
+ results.push(await (0, prepareSvg_1.prepareSvg)(task, pathkit));
24
+ return results;
25
+ }
26
+ class SvgWorkerPool {
27
+ size;
28
+ workers = [];
29
+ queue = Promise.resolve();
30
+ constructor(size = defaultConcurrency()) {
31
+ this.size = size;
32
+ }
33
+ prepare(tasks) {
34
+ const run = this.queue.then(() => this.run(tasks));
35
+ this.queue = run.catch(() => { });
36
+ return run;
37
+ }
38
+ warm() {
39
+ if (!node_fs_1.default.existsSync(WORKER_PATH))
40
+ return;
41
+ for (let i = this.workers.length; i < this.size; i++) {
42
+ const worker = new node_worker_threads_1.Worker(WORKER_PATH);
43
+ worker.unref();
44
+ this.workers.push(worker);
45
+ }
46
+ }
47
+ async close() {
48
+ await Promise.all(this.workers.splice(0).map((w) => w.terminate()));
49
+ }
50
+ async run(tasks) {
51
+ const wanted = Math.min(this.size, tasks.length);
52
+ if (wanted <= 1 || !node_fs_1.default.existsSync(WORKER_PATH)) {
53
+ return prepareInProcess(tasks);
54
+ }
55
+ for (let i = this.workers.length; i < wanted; i++) {
56
+ this.workers.push(new node_worker_threads_1.Worker(WORKER_PATH));
57
+ }
58
+ const results = new Array(tasks.length);
59
+ let next = 0;
60
+ const drain = (worker) => new Promise((resolve, reject) => {
61
+ let current = -1;
62
+ const onMessage = (result) => {
63
+ results[current] = result;
64
+ dispatch();
65
+ };
66
+ const onError = (err) => {
67
+ detach();
68
+ this.discard(worker);
69
+ reject(err);
70
+ };
71
+ const detach = () => {
72
+ worker.off('message', onMessage);
73
+ worker.off('error', onError);
74
+ worker.unref();
75
+ };
76
+ const dispatch = () => {
77
+ if (next >= tasks.length) {
78
+ detach();
79
+ resolve();
80
+ return;
81
+ }
82
+ current = next++;
83
+ worker.postMessage(tasks[current]);
84
+ };
85
+ worker.ref();
86
+ worker.on('message', onMessage);
87
+ worker.on('error', onError);
88
+ dispatch();
89
+ });
90
+ await Promise.all(this.workers.slice(0, wanted).map(drain));
91
+ return results;
92
+ }
93
+ discard(worker) {
94
+ const i = this.workers.indexOf(worker);
95
+ if (i !== -1)
96
+ this.workers.splice(i, 1);
97
+ void worker.terminate();
98
+ }
99
+ }
100
+ exports.SvgWorkerPool = SvgWorkerPool;
101
+ async function prepareIcons(tasks, concurrency) {
102
+ const pool = new SvgWorkerPool(concurrency);
103
+ try {
104
+ return await pool.prepare(tasks);
105
+ }
106
+ finally {
107
+ await pool.close();
108
+ }
109
+ }
@@ -1,3 +1,5 @@
1
- export { runPipeline, type PipelineResult } from './run.js';
2
- export type { PipelineConfig, PipelinePaths } from './config.js';
3
- export { ensureEmptyDir } from './config.js';
1
+ export { runFontPipeline, runFontPipeline as runPipeline, type PipelineResult, } from './runFontPipeline';
2
+ export type { PipelineConfig, PipelinePaths } from './config';
3
+ export type { PreparedSvgCache } from './preparedSvgCache';
4
+ export { SvgWorkerPool } from './iconPool';
5
+ export { ensureEmptyDir } from './config';
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureEmptyDir = exports.runPipeline = void 0;
4
- var run_js_1 = require("./run.js");
5
- Object.defineProperty(exports, "runPipeline", { enumerable: true, get: function () { return run_js_1.runPipeline; } });
6
- var config_js_1 = require("./config.js");
7
- Object.defineProperty(exports, "ensureEmptyDir", { enumerable: true, get: function () { return config_js_1.ensureEmptyDir; } });
3
+ exports.ensureEmptyDir = exports.SvgWorkerPool = exports.runPipeline = exports.runFontPipeline = void 0;
4
+ var runFontPipeline_1 = require("./runFontPipeline");
5
+ Object.defineProperty(exports, "runFontPipeline", { enumerable: true, get: function () { return runFontPipeline_1.runFontPipeline; } });
6
+ Object.defineProperty(exports, "runPipeline", { enumerable: true, get: function () { return runFontPipeline_1.runFontPipeline; } });
7
+ var iconPool_1 = require("./iconPool");
8
+ Object.defineProperty(exports, "SvgWorkerPool", { enumerable: true, get: function () { return iconPool_1.SvgWorkerPool; } });
9
+ var config_1 = require("./config");
10
+ Object.defineProperty(exports, "ensureEmptyDir", { enumerable: true, get: function () { return config_1.ensureEmptyDir; } });
@@ -0,0 +1,20 @@
1
+ import { type ParsedPath } from '../glyph/parse';
2
+ import type { PathKitModule } from '../pathkit/types';
3
+ import type { NanoLogger } from '../types';
4
+ export type PreparedSvg = {
5
+ viewBox: [number, number, number, number];
6
+ /** Z-ordered, same-color-merged, nonzero-winding layers. */
7
+ paths: ParsedPath[];
8
+ };
9
+ /**
10
+ * Shared per-file SVG prep: validate → preprocess → flatten → parse →
11
+ * evenodd convert → same-color merge. Returns null for unsupported SVGs.
12
+ */
13
+ export declare function prepareSvgLayers(opts: {
14
+ filePath: string;
15
+ /** Label used in log messages, e.g. `"MyIcons:heart.svg"`. */
16
+ fileLabel: string;
17
+ pathkit: PathKitModule;
18
+ logger?: NanoLogger;
19
+ tagKnockouts?: boolean;
20
+ }): Promise<PreparedSvg | null>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.prepareSvgLayers = prepareSvgLayers;
7
+ const promises_1 = __importDefault(require("node:fs/promises"));
8
+ const index_1 = require("../flatten/index");
9
+ const merge_1 = require("../glyph/merge");
10
+ const parse_1 = require("../glyph/parse");
11
+ const validate_1 = require("../glyph/validate");
12
+ const evenodd_1 = require("../pathkit/evenodd");
13
+ const knockout_1 = require("../symbols/knockout");
14
+ function tagKnockoutPaths(paths, svg, pathkit, fileLabel, logger) {
15
+ const marked = (0, knockout_1.markKnockoutFills)(svg);
16
+ if (marked === null)
17
+ return;
18
+ const markedPaths = (0, parse_1.parseFlattenedSvg)((0, index_1.flattenSvg)(marked, pathkit)).paths;
19
+ if (markedPaths.length !== paths.length) {
20
+ logger?.warn(`${fileLabel}: ignoring ${knockout_1.KNOCKOUT_ATTRIBUTE}, the annotated elements change the flattened shape count`);
21
+ return;
22
+ }
23
+ markedPaths.forEach((markedPath, i) => {
24
+ if (markedPath.fill !== paths[i].fill)
25
+ paths[i].knockout = true;
26
+ });
27
+ }
28
+ /**
29
+ * Shared per-file SVG prep: validate → preprocess → flatten → parse →
30
+ * evenodd convert → same-color merge. Returns null for unsupported SVGs.
31
+ */
32
+ async function prepareSvgLayers(opts) {
33
+ const { filePath, fileLabel, pathkit, logger } = opts;
34
+ const rawContent = await promises_1.default.readFile(filePath, 'utf-8');
35
+ const validation = (0, validate_1.validateSvg)(rawContent);
36
+ if (validation.valid === false) {
37
+ logger?.warn(`${fileLabel} skipped: ${validation.reason}`);
38
+ return null;
39
+ }
40
+ const preprocessed = (0, validate_1.preprocessSvg)(rawContent);
41
+ let flattenedSvg;
42
+ try {
43
+ flattenedSvg = (0, index_1.flattenSvg)(preprocessed, pathkit);
44
+ }
45
+ catch (err) {
46
+ throw new Error(`${fileLabel} failed to flatten: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
47
+ }
48
+ const parsed = (0, parse_1.parseFlattenedSvg)(flattenedSvg, {
49
+ onSanitize: (original) => {
50
+ logger?.info(` ⚠ ${fileLabel} sanitized path: path was missing initial moveto (prepended M from endpoint)`);
51
+ logger?.info(` Original: ${original.slice(0, 80)}…`);
52
+ },
53
+ onMissingViewBox: (assumed) => {
54
+ logger?.warn(`${fileLabel} has no viewBox; assuming [${assumed.join(' ')}]`);
55
+ },
56
+ });
57
+ if (opts.tagKnockouts) {
58
+ tagKnockoutPaths(parsed.paths, preprocessed, pathkit, fileLabel, logger);
59
+ }
60
+ // Convert evenodd to nonzero winding with our containment-based
61
+ // algorithm. Mark as noMerge — compound paths with holes must stay
62
+ // separate so their CW hole contours don't cancel adjacent paths' CCW
63
+ // contours.
64
+ for (const p of parsed.paths) {
65
+ if (p.fillRule === 'evenodd') {
66
+ logger?.info(` ↻ ${fileLabel} converting evenodd path to nonzero winding`);
67
+ p.d = (0, evenodd_1.convertEvenoddToWinding)(pathkit, p.d);
68
+ delete p.fillRule;
69
+ p.noMerge = true;
70
+ }
71
+ }
72
+ const mergedPaths = (0, merge_1.mergeSameColorPaths)(parsed.paths, logger);
73
+ return { viewBox: parsed.viewBox, paths: mergedPaths };
74
+ }
@@ -0,0 +1,25 @@
1
+ import type { PathKitModule } from '../pathkit/types';
2
+ import type { NanoLogger } from '../types';
3
+ export type IconTask = {
4
+ kind: 'font';
5
+ file: string;
6
+ filePath: string;
7
+ fontFamily: string;
8
+ upm: number;
9
+ safeZone: number;
10
+ };
11
+ export type IconLog = [level: 'info' | 'warn' | 'fail', message: string];
12
+ export type IconLayer = {
13
+ fill: string | null;
14
+ d: string;
15
+ };
16
+ export type IconResult = {
17
+ file: string;
18
+ iconName: string;
19
+ adv: number;
20
+ layers: IconLayer[];
21
+ logs: IconLog[];
22
+ error: string | null;
23
+ };
24
+ export declare function collectingLogger(logs: IconLog[]): NanoLogger;
25
+ export declare function prepareIcon(task: IconTask, pathkit: PathKitModule): Promise<IconResult>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.collectingLogger = collectingLogger;
7
+ exports.prepareIcon = prepareIcon;
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const quadratic_1 = require("../font/quadratic");
10
+ const parse_1 = require("../glyph/parse");
11
+ const placement_1 = require("../glyph/placement");
12
+ const prepare_1 = require("./prepare");
13
+ function collectingLogger(logs) {
14
+ const push = (level) => (msg) => {
15
+ logs.push([level, msg]);
16
+ };
17
+ return {
18
+ start: () => { },
19
+ update: () => { },
20
+ succeed: () => { },
21
+ fail: push('fail'),
22
+ info: push('info'),
23
+ warn: push('warn'),
24
+ };
25
+ }
26
+ async function prepareIcon(task, pathkit) {
27
+ const logs = [];
28
+ const logger = collectingLogger(logs);
29
+ const iconName = node_path_1.default.parse(task.file).name;
30
+ const fileLabel = `[${task.fontFamily}: ${task.file}]`;
31
+ const result = {
32
+ file: task.file,
33
+ iconName,
34
+ adv: 0,
35
+ layers: [],
36
+ logs,
37
+ error: null,
38
+ };
39
+ logger.info(`Processing ${task.file}`);
40
+ let prepared;
41
+ try {
42
+ prepared = await (0, prepare_1.prepareSvgLayers)({
43
+ filePath: task.filePath,
44
+ fileLabel,
45
+ pathkit,
46
+ logger,
47
+ });
48
+ }
49
+ catch (err) {
50
+ result.error = err instanceof Error ? err.message : String(err);
51
+ return result;
52
+ }
53
+ if (!prepared)
54
+ return result;
55
+ const { vx, vy, scale, xOff, yOff, adv } = (0, placement_1.computePlacement)({
56
+ upm: task.upm,
57
+ safeZone: task.safeZone,
58
+ viewBox: prepared.viewBox,
59
+ });
60
+ result.adv = adv;
61
+ for (const p of prepared.paths) {
62
+ if ((0, parse_1.shouldSkipPath)(p.d, p.fill))
63
+ continue;
64
+ const placed = (0, placement_1.transformPathForFont)(pathkit, p.d, {
65
+ vx,
66
+ vy,
67
+ scale,
68
+ xOff,
69
+ yOff,
70
+ upm: task.upm,
71
+ });
72
+ result.layers.push({
73
+ fill: p.fill,
74
+ d: (0, quadratic_1.toQuadraticPath)(placed, task.upm * quadratic_1.QUADRATIC_ERROR_BOUND_EM),
75
+ });
76
+ }
77
+ if (result.layers.length === 0) {
78
+ logger.warn(`${fileLabel} produced no glyphs: nothing in it paints`);
79
+ }
80
+ return result;
81
+ }
@@ -0,0 +1,6 @@
1
+ import type { PathKitModule } from '../pathkit/types';
2
+ import { type IconResult, type IconTask } from './prepareIcon';
3
+ import { type SymbolResult, type SymbolTask } from './prepareSymbol';
4
+ export type SvgPrepareTask = IconTask | SymbolTask;
5
+ export type SvgPrepareResult<T extends SvgPrepareTask> = T extends IconTask ? IconResult : SymbolResult;
6
+ export declare function prepareSvg<T extends SvgPrepareTask>(task: T, pathkit: PathKitModule): Promise<SvgPrepareResult<T>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareSvg = prepareSvg;
4
+ const prepareIcon_1 = require("./prepareIcon");
5
+ const prepareSymbol_1 = require("./prepareSymbol");
6
+ function prepareSvg(task, pathkit) {
7
+ const result = task.kind === 'font'
8
+ ? (0, prepareIcon_1.prepareIcon)(task, pathkit)
9
+ : (0, prepareSymbol_1.prepareSymbol)(task, pathkit);
10
+ return result;
11
+ }
@@ -0,0 +1,26 @@
1
+ import type { PathKitModule } from '../pathkit/types';
2
+ import { type IconLog } from './prepareIcon';
3
+ export type SymbolTask = {
4
+ kind: 'symbol';
5
+ file: string;
6
+ filePath: string;
7
+ setName: string;
8
+ prefix: string;
9
+ };
10
+ export type SymbolAsset = {
11
+ assetName: string;
12
+ assetDirName: string;
13
+ svgFilename: string;
14
+ svg: string;
15
+ contents: string;
16
+ vdXml: string;
17
+ vdOriginalXml: string;
18
+ };
19
+ export type SymbolResult = {
20
+ file: string;
21
+ iconName: string;
22
+ asset: SymbolAsset | null;
23
+ logs: IconLog[];
24
+ error: string | null;
25
+ };
26
+ export declare function prepareSymbol(task: SymbolTask, pathkit: PathKitModule): Promise<SymbolResult>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.prepareSymbol = prepareSymbol;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const parse_1 = require("../glyph/parse");
9
+ const contents_1 = require("../symbols/contents");
10
+ const layers_1 = require("../symbols/layers");
11
+ const template_1 = require("../symbols/template");
12
+ const vectorDrawable_1 = require("../symbols/vectorDrawable");
13
+ const prepareIcon_1 = require("./prepareIcon");
14
+ const prepare_1 = require("./prepare");
15
+ async function prepareSymbol(task, pathkit) {
16
+ const logs = [];
17
+ const logger = (0, prepareIcon_1.collectingLogger)(logs);
18
+ const iconName = node_path_1.default.parse(task.file).name;
19
+ const fileLabel = `${task.setName}:${task.file}`;
20
+ const result = {
21
+ file: task.file,
22
+ iconName,
23
+ asset: null,
24
+ logs,
25
+ error: null,
26
+ };
27
+ logger.info(`Processing ${task.file}`);
28
+ let prepared;
29
+ try {
30
+ prepared = await (0, prepare_1.prepareSvgLayers)({
31
+ filePath: task.filePath,
32
+ fileLabel,
33
+ pathkit,
34
+ logger,
35
+ tagKnockouts: true,
36
+ });
37
+ }
38
+ catch (err) {
39
+ result.error = err instanceof Error ? err.message : String(err);
40
+ return result;
41
+ }
42
+ if (!prepared)
43
+ return result;
44
+ const drawable = prepared.paths.filter((p) => !(0, parse_1.shouldSkipPath)(p.d, p.fill));
45
+ if (drawable.length === 0) {
46
+ logger.warn(`Skipping "${fileLabel}": no drawable paths`);
47
+ return result;
48
+ }
49
+ const assetName = `${task.prefix}.${iconName}`;
50
+ const svgFilename = `${assetName}.svg`;
51
+ const { layers, monochrome } = (0, layers_1.resolveSymbolLayers)(pathkit, drawable, {
52
+ onKnockoutLayer: () => logger.info(` ⊖ Knockout layer: hole in monochrome, own fill in original`),
53
+ });
54
+ const bounds = (0, layers_1.contentBounds)(pathkit, layers.map((l) => l.d)) ?? undefined;
55
+ result.asset = {
56
+ assetName,
57
+ assetDirName: `${assetName}.symbolset`,
58
+ svgFilename,
59
+ svg: (0, template_1.buildSymbolTemplate)({
60
+ layers,
61
+ viewBox: prepared.viewBox,
62
+ contentBounds: bounds,
63
+ descriptiveName: assetName,
64
+ logger,
65
+ }),
66
+ contents: (0, contents_1.symbolsetContentsJson)(svgFilename),
67
+ vdXml: (0, vectorDrawable_1.buildVectorDrawableXml)({
68
+ layers: [{ d: monochrome, fill: null }],
69
+ viewBox: prepared.viewBox,
70
+ contentBounds: bounds,
71
+ }),
72
+ vdOriginalXml: (0, vectorDrawable_1.buildVectorDrawableXml)({
73
+ layers,
74
+ viewBox: prepared.viewBox,
75
+ contentBounds: bounds,
76
+ }),
77
+ };
78
+ return result;
79
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_worker_threads_1 = require("node:worker_threads");
4
+ const load_1 = require("../pathkit/load");
5
+ const prepareSvg_1 = require("./prepareSvg");
6
+ const port = node_worker_threads_1.parentPort;
7
+ if (!port)
8
+ throw new Error('prepareWorker must run inside a worker thread');
9
+ const pathkitReady = (0, load_1.loadPathKit)();
10
+ port.on('message', async (task) => {
11
+ port.postMessage(await (0, prepareSvg_1.prepareSvg)(task, await pathkitReady));
12
+ });