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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/LICENSES.md +40 -0
  2. package/README.md +41 -10
  3. package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +31 -0
  4. package/android/src/main/java/com/nanoicons/NanoIconView.kt +50 -15
  5. package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +72 -11
  6. package/ios/NanoIconFontResolver.h +5 -0
  7. package/ios/NanoIconFontResolver.mm +32 -0
  8. package/ios/NanoIconView.h +0 -4
  9. package/ios/NanoIconView.mm +62 -57
  10. package/ios/NanoIconsFontLoader.mm +10 -32
  11. package/lib/commonjs/cli/build.d.ts +11 -3
  12. package/lib/commonjs/cli/build.js +86 -25
  13. package/lib/commonjs/cli/config.d.ts +1 -1
  14. package/lib/commonjs/cli/config.js +1 -1
  15. package/lib/commonjs/cli/expoConfig.d.ts +3 -2
  16. package/lib/commonjs/cli/expoConfig.js +22 -9
  17. package/lib/commonjs/cli/index.d.ts +5 -5
  18. package/lib/commonjs/cli/index.js +16 -14
  19. package/lib/commonjs/cli/link.d.ts +4 -3
  20. package/lib/commonjs/cli/link.js +127 -45
  21. package/lib/commonjs/cli/logger.js +9 -7
  22. package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -3
  23. package/lib/commonjs/plugin/src/buildFonts.js +5 -15
  24. package/lib/commonjs/plugin/src/index.d.ts +2 -2
  25. package/lib/commonjs/plugin/src/index.js +2 -2
  26. package/lib/commonjs/plugin/src/types.d.ts +10 -1
  27. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +1 -1
  28. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +6 -13
  29. package/lib/commonjs/scripts/cli.js +46 -23
  30. package/lib/commonjs/src/core/flatten/arcs.d.ts +2 -0
  31. package/lib/commonjs/src/core/flatten/arcs.js +136 -0
  32. package/lib/commonjs/src/core/flatten/document.d.ts +35 -0
  33. package/lib/commonjs/src/core/flatten/document.js +164 -0
  34. package/lib/commonjs/src/core/flatten/dom.d.ts +24 -0
  35. package/lib/commonjs/src/core/flatten/dom.js +221 -0
  36. package/lib/commonjs/src/core/flatten/element.d.ts +12 -0
  37. package/lib/commonjs/src/core/flatten/element.js +97 -0
  38. package/lib/commonjs/src/core/flatten/geometry.d.ts +21 -0
  39. package/lib/commonjs/src/core/flatten/geometry.js +85 -0
  40. package/lib/commonjs/src/core/flatten/index.d.ts +2 -0
  41. package/lib/commonjs/src/core/flatten/index.js +11 -0
  42. package/lib/commonjs/src/core/flatten/inherit.d.ts +13 -0
  43. package/lib/commonjs/src/core/flatten/inherit.js +249 -0
  44. package/lib/commonjs/src/core/flatten/path.d.ts +19 -0
  45. package/lib/commonjs/src/core/flatten/path.js +439 -0
  46. package/lib/commonjs/src/core/flatten/pathops.d.ts +14 -0
  47. package/lib/commonjs/src/core/flatten/pathops.js +236 -0
  48. package/lib/commonjs/src/core/flatten/shape.d.ts +29 -0
  49. package/lib/commonjs/src/core/flatten/shape.js +415 -0
  50. package/lib/commonjs/src/core/flatten/stages/clip-path.d.ts +4 -0
  51. package/lib/commonjs/src/core/flatten/stages/clip-path.js +20 -0
  52. package/lib/commonjs/src/core/flatten/stages/collapse.d.ts +2 -0
  53. package/lib/commonjs/src/core/flatten/stages/collapse.js +86 -0
  54. package/lib/commonjs/src/core/flatten/stages/defs.d.ts +4 -0
  55. package/lib/commonjs/src/core/flatten/stages/defs.js +49 -0
  56. package/lib/commonjs/src/core/flatten/stages/discard.d.ts +4 -0
  57. package/lib/commonjs/src/core/flatten/stages/discard.js +50 -0
  58. package/lib/commonjs/src/core/flatten/stages/fill-rule.d.ts +2 -0
  59. package/lib/commonjs/src/core/flatten/stages/fill-rule.js +7 -0
  60. package/lib/commonjs/src/core/flatten/stages/nested-svg.d.ts +2 -0
  61. package/lib/commonjs/src/core/flatten/stages/nested-svg.js +131 -0
  62. package/lib/commonjs/src/core/flatten/stages/opacity.d.ts +2 -0
  63. package/lib/commonjs/src/core/flatten/stages/opacity.js +7 -0
  64. package/lib/commonjs/src/core/flatten/stages/shapes.d.ts +7 -0
  65. package/lib/commonjs/src/core/flatten/stages/shapes.js +37 -0
  66. package/lib/commonjs/src/core/flatten/stages/stroke.d.ts +3 -0
  67. package/lib/commonjs/src/core/flatten/stages/stroke.js +34 -0
  68. package/lib/commonjs/src/core/flatten/stages/styles.d.ts +2 -0
  69. package/lib/commonjs/src/core/flatten/stages/styles.js +29 -0
  70. package/lib/commonjs/src/core/flatten/stages/use.d.ts +4 -0
  71. package/lib/commonjs/src/core/flatten/stages/use.js +80 -0
  72. package/lib/commonjs/src/core/flatten/stages/validate.d.ts +2 -0
  73. package/lib/commonjs/src/core/flatten/stages/validate.js +39 -0
  74. package/lib/commonjs/src/core/flatten/stages.d.ts +2 -0
  75. package/lib/commonjs/src/core/flatten/stages.js +40 -0
  76. package/lib/commonjs/src/core/flatten/transform.d.ts +35 -0
  77. package/lib/commonjs/src/core/flatten/transform.js +221 -0
  78. package/lib/commonjs/src/core/font/compile.d.ts +2 -1
  79. package/lib/commonjs/src/core/font/compile.js +21 -7
  80. package/lib/commonjs/src/core/font/metrics.js +7 -0
  81. package/lib/commonjs/src/core/font/quadratic.d.ts +1 -0
  82. package/lib/commonjs/src/core/font/quadratic.js +31 -0
  83. package/lib/commonjs/src/core/glyph/merge.d.ts +7 -0
  84. package/lib/commonjs/src/core/glyph/merge.js +57 -0
  85. package/lib/commonjs/src/core/glyph/parse.d.ts +26 -0
  86. package/lib/commonjs/src/core/{svg/svg_dom.js → glyph/parse.js} +21 -77
  87. package/lib/commonjs/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +1 -13
  88. package/lib/commonjs/src/core/{svg/layers.js → glyph/placement.js} +0 -17
  89. package/lib/commonjs/src/core/glyph/validate.d.ts +8 -0
  90. package/lib/commonjs/src/core/glyph/validate.js +33 -0
  91. package/lib/commonjs/src/core/pathkit/contours.d.ts +74 -0
  92. package/lib/commonjs/src/core/{svg/svg_pathops.js → pathkit/contours.js} +72 -312
  93. package/lib/commonjs/src/core/pathkit/evenodd.d.ts +12 -0
  94. package/lib/commonjs/src/core/pathkit/evenodd.js +51 -0
  95. package/lib/commonjs/src/core/pathkit/load.d.ts +2 -0
  96. package/lib/commonjs/src/core/pathkit/load.js +26 -0
  97. package/lib/commonjs/src/core/pathkit/types.d.ts +69 -0
  98. package/lib/commonjs/src/core/pathkit/types.js +2 -0
  99. package/lib/commonjs/src/core/pipeline/config.d.ts +1 -0
  100. package/lib/commonjs/src/core/pipeline/iconPool.d.ts +3 -0
  101. package/lib/commonjs/src/core/pipeline/iconPool.js +51 -0
  102. package/lib/commonjs/src/core/pipeline/index.d.ts +3 -3
  103. package/lib/commonjs/src/core/pipeline/index.js +6 -5
  104. package/lib/commonjs/src/core/pipeline/prepare.d.ts +19 -0
  105. package/lib/commonjs/src/core/pipeline/prepare.js +56 -0
  106. package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +22 -0
  107. package/lib/commonjs/src/core/pipeline/prepareIcon.js +78 -0
  108. package/lib/commonjs/src/core/pipeline/prepareWorker.d.ts +1 -0
  109. package/lib/commonjs/src/core/pipeline/prepareWorker.js +12 -0
  110. package/lib/commonjs/src/core/pipeline/{run.d.ts → runFontPipeline.d.ts} +7 -4
  111. package/lib/commonjs/src/core/pipeline/runFontPipeline.js +109 -0
  112. package/lib/commonjs/src/core/types.d.ts +3 -92
  113. package/lib/commonjs/src/utils/fingerPrint.d.ts +8 -1
  114. package/lib/commonjs/src/utils/fingerPrint.js +8 -1
  115. package/lib/commonjs/src/utils/fontIdentity.d.ts +4 -0
  116. package/lib/commonjs/src/utils/fontIdentity.js +24 -0
  117. package/lib/commonjs/src/utils/packageVersion.d.ts +2 -0
  118. package/lib/commonjs/src/utils/packageVersion.js +37 -0
  119. package/lib/commonjs/src/utils/parse.d.ts +0 -1
  120. package/lib/commonjs/src/utils/parse.js +0 -8
  121. package/lib/commonjs/src/utils/svgPatterns.d.ts +38 -0
  122. package/lib/commonjs/src/utils/svgPatterns.js +46 -0
  123. package/lib/module/const/codegenPrimitives.js +1 -2
  124. package/lib/module/const/colors.js +1 -2
  125. package/lib/module/createNanoIconsSet.js +1 -2
  126. package/lib/module/createNanoIconsSet.native.js +11 -4
  127. package/lib/module/createNanoIconsSet.shared.js +12 -7
  128. package/lib/module/createNanoIconsSet.web.js +7 -5
  129. package/lib/module/fontIntegrity.js +99 -0
  130. package/lib/module/index.js +1 -1
  131. package/lib/module/index.node.js +1 -2
  132. package/lib/module/loadDynamicFont.js +14 -7
  133. package/lib/module/nativeFontLoader.js +3 -0
  134. package/lib/module/nativeFontLoader.web.js +3 -0
  135. package/lib/module/specs/NativeNanoIconsFontLoader.js +1 -2
  136. package/lib/module/types.js +1 -2
  137. package/lib/module/utils/fingerPrint.js +3 -3
  138. package/lib/module/utils/fontIdentity.js +20 -0
  139. package/lib/module/utils/glyphRuntime.js +1 -2
  140. package/lib/module/utils/packageVersion.js +29 -0
  141. package/lib/module/utils/parse.js +1 -9
  142. package/lib/module/utils/runtimeLog.js +12 -0
  143. package/lib/module/utils/shallowEqualColor.js +1 -2
  144. package/lib/module/utils/svgPatterns.js +49 -0
  145. package/lib/typescript/src/core/flatten/arcs.d.ts +3 -0
  146. package/lib/typescript/src/core/flatten/document.d.ts +36 -0
  147. package/lib/typescript/src/core/flatten/dom.d.ts +25 -0
  148. package/lib/typescript/src/core/flatten/element.d.ts +13 -0
  149. package/lib/typescript/src/core/flatten/geometry.d.ts +22 -0
  150. package/lib/typescript/src/core/flatten/index.d.ts +3 -0
  151. package/lib/typescript/src/core/flatten/inherit.d.ts +14 -0
  152. package/lib/typescript/src/core/flatten/path.d.ts +20 -0
  153. package/lib/typescript/src/core/flatten/pathops.d.ts +15 -0
  154. package/lib/typescript/src/core/flatten/shape.d.ts +30 -0
  155. package/lib/typescript/src/core/flatten/stages/clip-path.d.ts +5 -0
  156. package/lib/typescript/src/core/flatten/stages/collapse.d.ts +3 -0
  157. package/lib/typescript/src/core/flatten/stages/defs.d.ts +5 -0
  158. package/lib/typescript/src/core/flatten/stages/discard.d.ts +5 -0
  159. package/lib/typescript/src/core/flatten/stages/fill-rule.d.ts +3 -0
  160. package/lib/typescript/src/core/flatten/stages/nested-svg.d.ts +3 -0
  161. package/lib/typescript/src/core/flatten/stages/opacity.d.ts +3 -0
  162. package/lib/typescript/src/core/flatten/stages/shapes.d.ts +8 -0
  163. package/lib/typescript/src/core/flatten/stages/stroke.d.ts +4 -0
  164. package/lib/typescript/src/core/flatten/stages/styles.d.ts +3 -0
  165. package/lib/typescript/src/core/flatten/stages/use.d.ts +5 -0
  166. package/lib/typescript/src/core/flatten/stages/validate.d.ts +3 -0
  167. package/lib/typescript/src/core/flatten/stages.d.ts +3 -0
  168. package/lib/typescript/src/core/flatten/transform.d.ts +36 -0
  169. package/lib/typescript/src/core/glyph/merge.d.ts +8 -0
  170. package/lib/typescript/src/core/glyph/parse.d.ts +27 -0
  171. package/lib/typescript/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +2 -14
  172. package/lib/typescript/src/core/glyph/validate.d.ts +9 -0
  173. package/lib/typescript/src/core/pathkit/contours.d.ts +75 -0
  174. package/lib/typescript/src/core/pathkit/evenodd.d.ts +13 -0
  175. package/lib/typescript/src/core/pathkit/load.d.ts +3 -0
  176. package/lib/typescript/src/core/pathkit/types.d.ts +70 -0
  177. package/lib/typescript/src/core/types.d.ts +3 -92
  178. package/lib/typescript/src/fontIntegrity.d.ts +24 -0
  179. package/lib/typescript/src/index.d.ts +1 -0
  180. package/lib/typescript/src/nativeFontLoader.d.ts +2 -0
  181. package/lib/typescript/src/nativeFontLoader.web.d.ts +3 -0
  182. package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
  183. package/lib/typescript/src/types.d.ts +5 -0
  184. package/lib/typescript/src/utils/fingerPrint.d.ts +8 -1
  185. package/lib/typescript/src/utils/fontIdentity.d.ts +5 -0
  186. package/lib/typescript/src/utils/packageVersion.d.ts +3 -0
  187. package/lib/typescript/src/utils/parse.d.ts +0 -1
  188. package/lib/typescript/src/utils/runtimeLog.d.ts +5 -0
  189. package/lib/typescript/src/utils/svgPatterns.d.ts +39 -0
  190. package/package.json +13 -11
  191. package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
  192. package/lib/commonjs/src/core/pipeline/managers.d.ts +0 -11
  193. package/lib/commonjs/src/core/pipeline/managers.js +0 -104
  194. package/lib/commonjs/src/core/pipeline/run.js +0 -189
  195. package/lib/commonjs/src/core/svg/svg_dom.d.ts +0 -51
  196. package/lib/commonjs/src/core/svg/svg_pathops.d.ts +0 -32
  197. package/lib/module/const/codegenPrimitives.js.map +0 -1
  198. package/lib/module/const/colors.js.map +0 -1
  199. package/lib/module/core/font/compile.js +0 -81
  200. package/lib/module/core/font/compile.js.map +0 -1
  201. package/lib/module/core/font/metrics.js +0 -37
  202. package/lib/module/core/font/metrics.js.map +0 -1
  203. package/lib/module/core/pipeline/config.js +0 -20
  204. package/lib/module/core/pipeline/config.js.map +0 -1
  205. package/lib/module/core/pipeline/index.js +0 -5
  206. package/lib/module/core/pipeline/index.js.map +0 -1
  207. package/lib/module/core/pipeline/managers.js +0 -94
  208. package/lib/module/core/pipeline/managers.js.map +0 -1
  209. package/lib/module/core/pipeline/run.js +0 -204
  210. package/lib/module/core/pipeline/run.js.map +0 -1
  211. package/lib/module/core/shims/pathops.py +0 -181
  212. package/lib/module/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  213. package/lib/module/core/svg/layers.js +0 -85
  214. package/lib/module/core/svg/layers.js.map +0 -1
  215. package/lib/module/core/svg/svg_dom.js +0 -170
  216. package/lib/module/core/svg/svg_dom.js.map +0 -1
  217. package/lib/module/core/svg/svg_pathops.js +0 -750
  218. package/lib/module/core/svg/svg_pathops.js.map +0 -1
  219. package/lib/module/core/tsconfig.json +0 -32
  220. package/lib/module/core/types.js +0 -2
  221. package/lib/module/core/types.js.map +0 -1
  222. package/lib/module/createNanoIconsSet.js.map +0 -1
  223. package/lib/module/createNanoIconsSet.native.js.map +0 -1
  224. package/lib/module/createNanoIconsSet.shared.js.map +0 -1
  225. package/lib/module/createNanoIconsSet.web.js.map +0 -1
  226. package/lib/module/index.js.map +0 -1
  227. package/lib/module/index.node.js.map +0 -1
  228. package/lib/module/loadDynamicFont.js.map +0 -1
  229. package/lib/module/specs/NativeNanoIconsFontLoader.js.map +0 -1
  230. package/lib/module/types.js.map +0 -1
  231. package/lib/module/utils/fingerPrint.js.map +0 -1
  232. package/lib/module/utils/glyphRuntime.js.map +0 -1
  233. package/lib/module/utils/parse.js.map +0 -1
  234. package/lib/module/utils/shallowEqualColor.js.map +0 -1
  235. package/lib/typescript/__tests__/build.unit.test.d.ts +0 -3
  236. package/lib/typescript/__tests__/build.unit.test.d.ts.map +0 -1
  237. package/lib/typescript/__tests__/clippath.e2e.test.d.ts +0 -3
  238. package/lib/typescript/__tests__/clippath.e2e.test.d.ts.map +0 -1
  239. package/lib/typescript/__tests__/fingerprint.unit.test.d.ts +0 -3
  240. package/lib/typescript/__tests__/fingerprint.unit.test.d.ts.map +0 -1
  241. package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts +0 -2
  242. package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts.map +0 -1
  243. package/lib/typescript/__tests__/link.unit.test.d.ts +0 -3
  244. package/lib/typescript/__tests__/link.unit.test.d.ts.map +0 -1
  245. package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts +0 -2
  246. package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts.map +0 -1
  247. package/lib/typescript/__tests__/pipeline.e2e.test.d.ts +0 -3
  248. package/lib/typescript/__tests__/pipeline.e2e.test.d.ts.map +0 -1
  249. package/lib/typescript/__tests__/placement.unit.test.d.ts +0 -3
  250. package/lib/typescript/__tests__/placement.unit.test.d.ts.map +0 -1
  251. package/lib/typescript/__tests__/svg_dom.unit.test.d.ts +0 -3
  252. package/lib/typescript/__tests__/svg_dom.unit.test.d.ts.map +0 -1
  253. package/lib/typescript/cli/build.d.ts +0 -32
  254. package/lib/typescript/cli/build.d.ts.map +0 -1
  255. package/lib/typescript/cli/link.d.ts +0 -12
  256. package/lib/typescript/cli/link.d.ts.map +0 -1
  257. package/lib/typescript/cli/logger.d.ts +0 -28
  258. package/lib/typescript/cli/logger.d.ts.map +0 -1
  259. package/lib/typescript/src/const/codegenPrimitives.d.ts.map +0 -1
  260. package/lib/typescript/src/const/colors.d.ts.map +0 -1
  261. package/lib/typescript/src/core/font/compile.d.ts +0 -21
  262. package/lib/typescript/src/core/font/compile.d.ts.map +0 -1
  263. package/lib/typescript/src/core/font/metrics.d.ts +0 -2
  264. package/lib/typescript/src/core/font/metrics.d.ts.map +0 -1
  265. package/lib/typescript/src/core/pipeline/config.d.ts +0 -16
  266. package/lib/typescript/src/core/pipeline/config.d.ts.map +0 -1
  267. package/lib/typescript/src/core/pipeline/index.d.ts +0 -4
  268. package/lib/typescript/src/core/pipeline/index.d.ts.map +0 -1
  269. package/lib/typescript/src/core/pipeline/managers.d.ts +0 -12
  270. package/lib/typescript/src/core/pipeline/managers.d.ts.map +0 -1
  271. package/lib/typescript/src/core/pipeline/run.d.ts +0 -15
  272. package/lib/typescript/src/core/pipeline/run.d.ts.map +0 -1
  273. package/lib/typescript/src/core/svg/layers.d.ts.map +0 -1
  274. package/lib/typescript/src/core/svg/svg_dom.d.ts +0 -52
  275. package/lib/typescript/src/core/svg/svg_dom.d.ts.map +0 -1
  276. package/lib/typescript/src/core/svg/svg_pathops.d.ts +0 -33
  277. package/lib/typescript/src/core/svg/svg_pathops.d.ts.map +0 -1
  278. package/lib/typescript/src/core/types.d.ts.map +0 -1
  279. package/lib/typescript/src/createNanoIconsSet.d.ts.map +0 -1
  280. package/lib/typescript/src/createNanoIconsSet.native.d.ts.map +0 -1
  281. package/lib/typescript/src/createNanoIconsSet.shared.d.ts.map +0 -1
  282. package/lib/typescript/src/createNanoIconsSet.web.d.ts.map +0 -1
  283. package/lib/typescript/src/index.d.ts.map +0 -1
  284. package/lib/typescript/src/index.node.d.ts.map +0 -1
  285. package/lib/typescript/src/loadDynamicFont.d.ts.map +0 -1
  286. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts.map +0 -1
  287. package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts.map +0 -1
  288. package/lib/typescript/src/types.d.ts.map +0 -1
  289. package/lib/typescript/src/utils/fingerPrint.d.ts.map +0 -1
  290. package/lib/typescript/src/utils/glyphRuntime.d.ts.map +0 -1
  291. package/lib/typescript/src/utils/parse.d.ts.map +0 -1
  292. package/lib/typescript/src/utils/shallowEqualColor.d.ts.map +0 -1
  293. package/plugin/src/buildFonts.ts +0 -42
  294. package/plugin/src/index.ts +0 -21
  295. package/plugin/src/types.ts +0 -42
  296. package/plugin/src/withNanoIconsFontLinking.ts +0 -136
  297. package/plugin/tsconfig.json +0 -9
  298. package/scripts/cli.ts +0 -63
  299. package/scripts/tsconfig.json +0 -25
  300. package/src/const/colors.ts +0 -150
  301. package/src/core/font/compile.ts +0 -99
  302. package/src/core/font/metrics.ts +0 -44
  303. package/src/core/pipeline/config.ts +0 -25
  304. package/src/core/pipeline/index.ts +0 -3
  305. package/src/core/pipeline/managers.ts +0 -132
  306. package/src/core/pipeline/run.ts +0 -274
  307. package/src/core/shims/pathops.py +0 -181
  308. package/src/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  309. package/src/core/svg/layers.ts +0 -110
  310. package/src/core/svg/svg_dom.ts +0 -194
  311. package/src/core/svg/svg_pathops.ts +0 -1040
  312. package/src/core/tsconfig.json +0 -32
  313. package/src/core/types.ts +0 -157
  314. package/src/createNanoIconsSet.native.tsx +0 -192
  315. package/src/createNanoIconsSet.shared.tsx +0 -174
  316. package/src/createNanoIconsSet.tsx +0 -20
  317. package/src/createNanoIconsSet.web.tsx +0 -109
  318. package/src/index.node.ts +0 -14
  319. package/src/index.ts +0 -6
  320. package/src/loadDynamicFont.ts +0 -162
  321. package/src/types.ts +0 -31
  322. package/src/utils/fingerPrint.ts +0 -20
  323. package/src/utils/glyphRuntime.ts +0 -46
  324. package/src/utils/parse.ts +0 -67
  325. package/src/utils/shallowEqualColor.ts +0 -17
@@ -0,0 +1,26 @@
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.loadPathKit = loadPathKit;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const promises_1 = __importDefault(require("node:fs/promises"));
9
+ let instance = null;
10
+ async function loadPathKit() {
11
+ if (instance)
12
+ return instance;
13
+ const PathKitInit = require('pathkit-wasm/bin/pathkit.js');
14
+ const pathkitJsPath = require.resolve('pathkit-wasm/bin/pathkit.js');
15
+ const pathkitBinDir = node_path_1.default.dirname(pathkitJsPath);
16
+ const pathkitWasmPath = node_path_1.default.join(pathkitBinDir, 'pathkit.wasm');
17
+ const wasmBinary = await promises_1.default.readFile(pathkitWasmPath);
18
+ const pkInit = PathKitInit({
19
+ wasmBinary,
20
+ locateFile: (file) => node_path_1.default.join(pathkitBinDir, file),
21
+ });
22
+ instance = await (typeof pkInit?.ready === 'function'
23
+ ? pkInit.ready()
24
+ : pkInit);
25
+ return instance;
26
+ }
@@ -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 });
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { type IconResult, type IconTask } from './prepareIcon';
2
+ export declare function defaultConcurrency(): number;
3
+ export declare function prepareIcons(tasks: IconTask[], concurrency: number): Promise<IconResult[]>;
@@ -0,0 +1,51 @@
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.defaultConcurrency = defaultConcurrency;
7
+ exports.prepareIcons = prepareIcons;
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_os_1 = __importDefault(require("node:os"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const node_worker_threads_1 = require("node:worker_threads");
12
+ const load_1 = require("../pathkit/load");
13
+ const prepareIcon_1 = require("./prepareIcon");
14
+ const WORKER_PATH = node_path_1.default.join(__dirname, 'prepareWorker.js');
15
+ function defaultConcurrency() {
16
+ return Math.max(1, Math.min(8, node_os_1.default.availableParallelism()));
17
+ }
18
+ async function prepareIcons(tasks, concurrency) {
19
+ const workers = Math.min(concurrency, tasks.length);
20
+ if (workers <= 1 || !node_fs_1.default.existsSync(WORKER_PATH)) {
21
+ const pathkit = await (0, load_1.loadPathKit)();
22
+ const results = [];
23
+ for (const task of tasks)
24
+ results.push(await (0, prepareIcon_1.prepareIcon)(task, pathkit));
25
+ return results;
26
+ }
27
+ const results = new Array(tasks.length);
28
+ let next = 0;
29
+ const runWorker = () => new Promise((resolve, reject) => {
30
+ const worker = new node_worker_threads_1.Worker(WORKER_PATH);
31
+ let current = -1;
32
+ const dispatch = () => {
33
+ if (next >= tasks.length) {
34
+ worker.terminate().then(() => resolve(), reject);
35
+ return;
36
+ }
37
+ current = next++;
38
+ worker.postMessage(tasks[current]);
39
+ };
40
+ worker.on('message', (result) => {
41
+ results[current] = result;
42
+ dispatch();
43
+ });
44
+ worker.on('error', (err) => {
45
+ worker.terminate().finally(() => reject(err));
46
+ });
47
+ dispatch();
48
+ });
49
+ await Promise.all(Array.from({ length: workers }, runWorker));
50
+ return results;
51
+ }
@@ -1,3 +1,3 @@
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 { ensureEmptyDir } from './config';
@@ -1,7 +1,8 @@
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.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 config_1 = require("./config");
8
+ Object.defineProperty(exports, "ensureEmptyDir", { enumerable: true, get: function () { return config_1.ensureEmptyDir; } });
@@ -0,0 +1,19 @@
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
+ }): Promise<PreparedSvg | null>;
@@ -0,0 +1,56 @@
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
+ /**
14
+ * Shared per-file SVG prep: validate → preprocess → flatten → parse →
15
+ * evenodd convert → same-color merge. Returns null for unsupported SVGs.
16
+ */
17
+ async function prepareSvgLayers(opts) {
18
+ const { filePath, fileLabel, pathkit, logger } = opts;
19
+ const rawContent = await promises_1.default.readFile(filePath, 'utf-8');
20
+ const validation = (0, validate_1.validateSvg)(rawContent);
21
+ if (validation.valid === false) {
22
+ logger?.warn(`${fileLabel} skipped: ${validation.reason}`);
23
+ return null;
24
+ }
25
+ const preprocessed = (0, validate_1.preprocessSvg)(rawContent);
26
+ let flattenedSvg;
27
+ try {
28
+ flattenedSvg = (0, index_1.flattenSvg)(preprocessed, pathkit);
29
+ }
30
+ catch (err) {
31
+ throw new Error(`${fileLabel} failed to flatten: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
32
+ }
33
+ const parsed = (0, parse_1.parseFlattenedSvg)(flattenedSvg, {
34
+ onSanitize: (original) => {
35
+ logger?.info(` ⚠ ${fileLabel} sanitized path: path was missing initial moveto (prepended M from endpoint)`);
36
+ logger?.info(` Original: ${original.slice(0, 80)}…`);
37
+ },
38
+ onMissingViewBox: (assumed) => {
39
+ logger?.warn(`${fileLabel} has no viewBox; assuming [${assumed.join(' ')}]`);
40
+ },
41
+ });
42
+ // Convert evenodd to nonzero winding with our containment-based
43
+ // algorithm. Mark as noMerge — compound paths with holes must stay
44
+ // separate so their CW hole contours don't cancel adjacent paths' CCW
45
+ // contours.
46
+ for (const p of parsed.paths) {
47
+ if (p.fillRule === 'evenodd') {
48
+ logger?.info(` ↻ ${fileLabel} converting evenodd path to nonzero winding`);
49
+ p.d = (0, evenodd_1.convertEvenoddToWinding)(pathkit, p.d);
50
+ delete p.fillRule;
51
+ p.noMerge = true;
52
+ }
53
+ }
54
+ const mergedPaths = (0, merge_1.mergeSameColorPaths)(parsed.paths, logger);
55
+ return { viewBox: parsed.viewBox, paths: mergedPaths };
56
+ }
@@ -0,0 +1,22 @@
1
+ import type { PathKitModule } from '../pathkit/types';
2
+ export type IconTask = {
3
+ file: string;
4
+ filePath: string;
5
+ fontFamily: string;
6
+ upm: number;
7
+ safeZone: number;
8
+ };
9
+ export type IconLog = [level: 'info' | 'warn' | 'fail', message: string];
10
+ export type IconLayer = {
11
+ fill: string | null;
12
+ d: string;
13
+ };
14
+ export type IconResult = {
15
+ file: string;
16
+ iconName: string;
17
+ adv: number;
18
+ layers: IconLayer[];
19
+ logs: IconLog[];
20
+ error: string | null;
21
+ };
22
+ export declare function prepareIcon(task: IconTask, pathkit: PathKitModule): Promise<IconResult>;
@@ -0,0 +1,78 @@
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.prepareIcon = prepareIcon;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const parse_1 = require("../glyph/parse");
9
+ const placement_1 = require("../glyph/placement");
10
+ const prepare_1 = require("./prepare");
11
+ function collectingLogger(logs) {
12
+ const push = (level) => (msg) => {
13
+ logs.push([level, msg]);
14
+ };
15
+ return {
16
+ start: () => { },
17
+ update: () => { },
18
+ succeed: () => { },
19
+ fail: push('fail'),
20
+ info: push('info'),
21
+ warn: push('warn'),
22
+ };
23
+ }
24
+ async function prepareIcon(task, pathkit) {
25
+ const logs = [];
26
+ const logger = collectingLogger(logs);
27
+ const iconName = node_path_1.default.parse(task.file).name;
28
+ const fileLabel = `[${task.fontFamily}: ${task.file}]`;
29
+ const result = {
30
+ file: task.file,
31
+ iconName,
32
+ adv: 0,
33
+ layers: [],
34
+ logs,
35
+ error: null,
36
+ };
37
+ logger.info(`Processing ${task.file}`);
38
+ let prepared;
39
+ try {
40
+ prepared = await (0, prepare_1.prepareSvgLayers)({
41
+ filePath: task.filePath,
42
+ fileLabel,
43
+ pathkit,
44
+ logger,
45
+ });
46
+ }
47
+ catch (err) {
48
+ result.error = err instanceof Error ? err.message : String(err);
49
+ return result;
50
+ }
51
+ if (!prepared)
52
+ return result;
53
+ const { vx, vy, scale, xOff, yOff, adv } = (0, placement_1.computePlacement)({
54
+ upm: task.upm,
55
+ safeZone: task.safeZone,
56
+ viewBox: prepared.viewBox,
57
+ });
58
+ result.adv = adv;
59
+ for (const p of prepared.paths) {
60
+ if ((0, parse_1.shouldSkipPath)(p.d, p.fill))
61
+ continue;
62
+ result.layers.push({
63
+ fill: p.fill,
64
+ d: (0, placement_1.transformPathForFont)(pathkit, p.d, {
65
+ vx,
66
+ vy,
67
+ scale,
68
+ xOff,
69
+ yOff,
70
+ upm: task.upm,
71
+ }),
72
+ });
73
+ }
74
+ if (result.layers.length === 0) {
75
+ logger.warn(`${fileLabel} produced no glyphs: nothing in it paints`);
76
+ }
77
+ return result;
78
+ }
@@ -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 prepareIcon_1 = require("./prepareIcon");
6
+ const port = node_worker_threads_1.parentPort;
7
+ if (!port)
8
+ throw new Error('prepareWorker must run inside a worker thread');
9
+ port.on('message', async (task) => {
10
+ const pathkit = await (0, load_1.loadPathKit)();
11
+ port.postMessage(await (0, prepareIcon_1.prepareIcon)(task, pathkit));
12
+ });
@@ -1,14 +1,17 @@
1
- import { type PipelineConfig, type PipelinePaths } from './config.js';
2
- import type { NanoLogger } from '../types.js';
1
+ import type { NanoLogger } from '../types';
2
+ import { type PipelineConfig, type PipelinePaths } from './config';
3
3
  export type PipelineResult = {
4
4
  ttfPath: string;
5
5
  glyphmapPath: string;
6
+ family: string;
7
+ woff2Path?: string;
6
8
  };
7
9
  /**
8
10
  * Run the font pipeline with given config and paths.
9
- * Uses the singleton Pyodide/PathKit instance (initialized on first call).
11
+ * Uses the cached PathKit instance (initialized on first call).
10
12
  */
11
- export declare function runPipeline(config: PipelineConfig, paths: PipelinePaths, options?: {
13
+ export declare function runFontPipeline(config: PipelineConfig, paths: PipelinePaths, options?: {
12
14
  logger?: NanoLogger;
13
15
  inputHash?: string;
16
+ concurrency?: number;
14
17
  }): Promise<PipelineResult>;
@@ -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.runFontPipeline = runFontPipeline;
7
+ const promises_1 = __importDefault(require("node:fs/promises"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const compile_1 = require("../font/compile");
10
+ const fontIdentity_1 = require("../../utils/fontIdentity");
11
+ const config_1 = require("./config");
12
+ const iconPool_1 = require("./iconPool");
13
+ /**
14
+ * Run the font pipeline with given config and paths.
15
+ * Uses the cached PathKit instance (initialized on first call).
16
+ */
17
+ async function runFontPipeline(config, paths, options) {
18
+ const startTime = Date.now();
19
+ const logger = options?.logger;
20
+ logger?.update(`Building "${config.fontFamily}"…`);
21
+ (0, config_1.ensureDir)(paths.outputDir);
22
+ const files = (await promises_1.default.readdir(paths.inputDir)).filter((f) => f.toLowerCase().endsWith('.svg'));
23
+ const inputHash = options?.inputHash;
24
+ const family = inputHash
25
+ ? (0, fontIdentity_1.buildFontFamily)(config.fontFamily, inputHash)
26
+ : config.fontFamily;
27
+ const glyphMap = {
28
+ m: {
29
+ f: family,
30
+ u: config.upm,
31
+ z: config.safeZone,
32
+ s: config.startUnicode,
33
+ ...(config.linking === 'dynamic' ? { l: 'd' } : {}),
34
+ ...(config.web ? { w: true } : {}),
35
+ },
36
+ i: {},
37
+ };
38
+ let currentUnicode = config.startUnicode;
39
+ const codepointToIcon = new Map();
40
+ const allGlyphs = [];
41
+ const failed = [];
42
+ const results = await (0, iconPool_1.prepareIcons)(files.map((file) => ({
43
+ file,
44
+ filePath: node_path_1.default.join(paths.inputDir, file),
45
+ fontFamily: config.fontFamily,
46
+ upm: config.upm,
47
+ safeZone: config.safeZone,
48
+ })), options?.concurrency ?? (0, iconPool_1.defaultConcurrency)());
49
+ for (const result of results) {
50
+ for (const [level, msg] of result.logs)
51
+ logger?.[level](msg);
52
+ if (result.error !== null) {
53
+ logger?.fail(result.error);
54
+ failed.push(result.file);
55
+ continue;
56
+ }
57
+ const layers = [];
58
+ for (const layer of result.layers) {
59
+ const cp = currentUnicode++;
60
+ codepointToIcon.set(cp, result.iconName);
61
+ allGlyphs.push({
62
+ codepoint: cp,
63
+ advanceWidth: result.adv,
64
+ d: layer.d,
65
+ });
66
+ layers.push([cp, layer.fill || 'black']);
67
+ }
68
+ if (layers.length > 0) {
69
+ glyphMap.i[result.iconName] = [result.adv, layers];
70
+ }
71
+ }
72
+ if (failed.length) {
73
+ throw new Error(`${failed.length} of ${files.length} icons in [${config.fontFamily}] could not be converted: ${failed.join(', ')}`);
74
+ }
75
+ const glyphmapPath = node_path_1.default.join(paths.outputDir, `${config.fontFamily}.glyphmap.json`);
76
+ if (inputHash) {
77
+ glyphMap.m.h = inputHash;
78
+ }
79
+ await promises_1.default.writeFile(glyphmapPath, JSON.stringify(glyphMap), 'utf8');
80
+ logger?.info(`Compiling TTF…`);
81
+ const ttfPath = node_path_1.default.join(paths.outputDir, `${config.fontFamily}.ttf`);
82
+ let ttfBuffer;
83
+ try {
84
+ ttfBuffer = await (0, compile_1.compileTtfFromGlyphs)({
85
+ glyphs: allGlyphs,
86
+ outTtfPath: ttfPath,
87
+ fontName: family,
88
+ upm: config.upm,
89
+ ascent: config.upm,
90
+ descent: 0,
91
+ });
92
+ }
93
+ catch (err) {
94
+ (0, compile_1.parseCompileTtfFromGlyphsError)(err, codepointToIcon);
95
+ }
96
+ let woff2Path;
97
+ if (config.web && ttfBuffer) {
98
+ logger?.info(`Compiling WOFF2…`);
99
+ woff2Path = node_path_1.default.join(paths.outputDir, `${config.fontFamily}.woff2`);
100
+ await promises_1.default.writeFile(woff2Path, await (0, compile_1.compileWoff2FromTtf)(ttfBuffer));
101
+ }
102
+ const iconCount = Object.keys(glyphMap.i).length;
103
+ const elapsed = Date.now() - startTime;
104
+ const products = woff2Path
105
+ ? `${config.fontFamily}.ttf + ${config.fontFamily}.woff2`
106
+ : `${config.fontFamily}.ttf`;
107
+ logger?.succeed(`Built ${products} [${iconCount} icon${iconCount === 1 ? '' : 's'} in ${elapsed}ms]`);
108
+ return { ttfPath, glyphmapPath, family, woff2Path };
109
+ }
@@ -7,98 +7,6 @@ export type NanoLogger = {
7
7
  info: (msg: string) => void;
8
8
  warn: (msg: string) => void;
9
9
  };
10
- export type Point = readonly [number, number];
11
- export type Cmd = readonly number[];
12
- export type VerbMap = {
13
- MOVE: number;
14
- LINE: number;
15
- QUAD: number;
16
- CONIC: number;
17
- CUBIC: number;
18
- CLOSE: number;
19
- };
20
- export type WrappedPath = {
21
- p: PathKitPath;
22
- meta: {
23
- moves: Point[];
24
- };
25
- };
26
- export interface PathKitPath {
27
- delete?: () => void;
28
- moveTo: (x: number, y: number) => void;
29
- lineTo: (x: number, y: number) => void;
30
- quadTo: (x1: number, y1: number, x2: number, y2: number) => void;
31
- cubicTo: (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number) => void;
32
- close: () => void;
33
- simplify: () => void;
34
- toSVGString: () => string;
35
- toCmds: () => Cmd[];
36
- getBounds: () => {
37
- fLeft: number;
38
- fTop: number;
39
- fRight: number;
40
- fBottom: number;
41
- };
42
- getFillType?: () => number;
43
- setFillType: (t: number) => void;
44
- dash?: (on: number, off: number, phase: number) => void;
45
- stroke: (opts: {
46
- width: number;
47
- cap: number;
48
- join: number;
49
- miter_limit: number;
50
- }) => PathKitPath | null;
51
- transform: (a: number, c: number, e: number, b: number, d: number, f: number, g: number, h: number, i: number) => void;
52
- }
53
- export interface PathKitModule {
54
- MOVE_VERB?: number;
55
- LINE_VERB?: number;
56
- QUAD_VERB?: number;
57
- CONIC_VERB?: number;
58
- CUBIC_VERB?: number;
59
- CLOSE_VERB?: number;
60
- FillType?: {
61
- EVENODD?: number;
62
- EVEN_ODD?: number;
63
- WINDING?: number;
64
- NONZERO?: number;
65
- };
66
- StrokeCap?: {
67
- BUTT?: number;
68
- ROUND?: number;
69
- SQUARE?: number;
70
- };
71
- StrokeJoin?: {
72
- MITER?: number;
73
- ROUND?: number;
74
- BEVEL?: number;
75
- };
76
- PathOp?: {
77
- UNION?: number;
78
- INTERSECT?: number;
79
- DIFFERENCE?: number;
80
- };
81
- NewPath: (src?: PathKitPath) => PathKitPath;
82
- FromSVGString: (svg: string) => PathKitPath | null;
83
- MakeFromOp: (a: PathKitPath, b: PathKitPath, op: number) => PathKitPath | null;
84
- }
85
- export type PyodideModule = {
86
- mountNodeFS: (mountpoint: string, hostPath: string) => void;
87
- registerJsModule: (name: string, mod: unknown) => void;
88
- loadPackage: (pkgs: string[], options?: {
89
- messageCallback?: (msg: string) => void;
90
- errorCallback?: (msg: string) => void;
91
- }) => Promise<void>;
92
- runPythonAsync: (code: string) => Promise<unknown>;
93
- runPython: (code: string) => string;
94
- FS: {
95
- writeFile: (path: string, data: string) => void;
96
- };
97
- globals: {
98
- set: (key: string, value: unknown) => void;
99
- get: (key: string) => unknown;
100
- };
101
- };
102
10
  export type GlyphLayer = [codepoint: number, color: string];
103
11
  export type GlyphEntry = [adv: number, layers: GlyphLayer[]];
104
12
  export type IconsMap = Record<string, GlyphEntry>;
@@ -110,6 +18,7 @@ export type IconsMap = Record<string, GlyphEntry>;
110
18
  * s - start unicode,
111
19
  * h - hash,
112
20
  * l - linking mode: 's' (static, bundled — default when absent) or 'd' (dynamic, OTA-delivered),
21
+ * w - web output: true when a .woff2 was built alongside the .ttf (absent otherwise),
113
22
  * i - icons,
114
23
  * adv - advance width,
115
24
  */
@@ -121,6 +30,7 @@ export type NanoGlyphMap = {
121
30
  s: number;
122
31
  h?: string;
123
32
  l?: 's' | 'd';
33
+ w?: true;
124
34
  };
125
35
  i: IconsMap;
126
36
  };
@@ -133,6 +43,7 @@ export type NanoGlyphMapInput = {
133
43
  s: number;
134
44
  h?: string;
135
45
  l?: 's' | 'd' | (string & {});
46
+ w?: boolean;
136
47
  };
137
48
  i: Record<string, readonly unknown[]>;
138
49
  };
@@ -1 +1,8 @@
1
- export declare function getFingerprintSync(dir: string): string;
1
+ export type FingerprintInputs = {
2
+ upm: number;
3
+ safeZone: number;
4
+ startUnicode: number;
5
+ version: string;
6
+ toolchain: readonly string[];
7
+ };
8
+ export declare function getFingerprintSync(dir: string, inputs: FingerprintInputs): string;
@@ -4,7 +4,7 @@ exports.getFingerprintSync = getFingerprintSync;
4
4
  const crypto = require('crypto');
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
- function getFingerprintSync(dir) {
7
+ function getFingerprintSync(dir, inputs) {
8
8
  const files = fs
9
9
  .readdirSync(dir)
10
10
  .filter((f) => f.endsWith('.svg'))
@@ -16,5 +16,12 @@ function getFingerprintSync(dir) {
16
16
  hash.update(file);
17
17
  hash.update(fs.readFileSync(filePath));
18
18
  }
19
+ hash.update(JSON.stringify([
20
+ inputs.upm,
21
+ inputs.safeZone,
22
+ inputs.startUnicode,
23
+ inputs.version,
24
+ inputs.toolchain,
25
+ ]));
19
26
  return hash.digest('hex');
20
27
  }