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,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isKnockoutFill = isKnockoutFill;
4
+ exports.resolveSymbolLayers = resolveSymbolLayers;
5
+ exports.contentBounds = contentBounds;
6
+ const parse_1 = require("../../utils/parse");
7
+ const winding_1 = require("../pathkit/winding");
8
+ function isKnockoutFill(fill) {
9
+ if (fill === null)
10
+ return false;
11
+ const [r, g, b, a] = (0, parse_1.parseColor)(fill);
12
+ return a >= 0.9 && r >= 240 && g >= 240 && b >= 240;
13
+ }
14
+ function knockoutFlags(layers) {
15
+ if (layers.some((l) => l.knockout))
16
+ return layers.map((l) => !!l.knockout);
17
+ const whiteFlags = layers.map((l) => isKnockoutFill(l.fill));
18
+ return whiteFlags.some((w) => !w) ? whiteFlags : layers.map(() => false);
19
+ }
20
+ function pathOps(PathKit) {
21
+ const Ops = PathKit.PathOp ?? {};
22
+ const run = (a, b, op) => {
23
+ if (a.trim() === '')
24
+ return op === (Ops.UNION ?? 1) ? b : '';
25
+ if (b.trim() === '')
26
+ return op === (Ops.INTERSECT ?? 2) ? '' : a;
27
+ const pa = PathKit.FromSVGString(a);
28
+ const pb = PathKit.FromSVGString(b);
29
+ const out = pa && pb ? PathKit.MakeFromOp(pa, pb, op) : null;
30
+ pa?.delete?.();
31
+ pb?.delete?.();
32
+ if (!out)
33
+ return a;
34
+ const d = (0, winding_1.orientedPathData)(PathKit, out);
35
+ out.delete?.();
36
+ return d;
37
+ };
38
+ return {
39
+ difference: (a, b) => run(a, b, Ops.DIFFERENCE ?? 0),
40
+ union: (a, b) => run(a, b, Ops.UNION ?? 1),
41
+ intersect: (a, b) => run(a, b, Ops.INTERSECT ?? 2),
42
+ };
43
+ }
44
+ function resolveWithKnockouts(PathKit, layers, flags, onKnockoutLayer) {
45
+ const ops = pathOps(PathKit);
46
+ const visible = new Array(layers.length).fill('');
47
+ let aboveAll = '';
48
+ let aboveInk = '';
49
+ for (let i = layers.length - 1; i >= 0; i--) {
50
+ const d = layers[i].d;
51
+ visible[i] = ops.difference(d, flags[i] ? aboveAll : aboveInk);
52
+ aboveAll = ops.union(aboveAll, d);
53
+ if (!flags[i])
54
+ aboveInk = ops.union(aboveInk, d);
55
+ }
56
+ const emitted = [];
57
+ let monochrome = '';
58
+ layers.forEach((layer, i) => {
59
+ const region = visible[i];
60
+ if (region.trim() === '')
61
+ return;
62
+ if (!flags[i]) {
63
+ emitted.push({ d: (0, winding_1.canonicalWinding)(PathKit, region), fill: layer.fill });
64
+ monochrome = ops.union(monochrome, region);
65
+ return;
66
+ }
67
+ const inside = ops.intersect(region, monochrome);
68
+ const outside = ops.difference(region, monochrome);
69
+ const parts = [
70
+ inside.trim() === '' ? '' : (0, winding_1.reversedWinding)(PathKit, inside),
71
+ outside.trim() === '' ? '' : (0, winding_1.canonicalWinding)(PathKit, outside),
72
+ ].filter((part) => part !== '');
73
+ if (inside.trim() !== '')
74
+ onKnockoutLayer?.(i);
75
+ emitted.push({ d: parts.join(' '), fill: layer.fill });
76
+ monochrome = ops.union(ops.difference(monochrome, inside), outside);
77
+ });
78
+ return { layers: emitted, monochrome: (0, winding_1.canonicalWinding)(PathKit, monochrome) };
79
+ }
80
+ function resolveOccluded(PathKit, layers) {
81
+ const Ops = PathKit.PathOp ?? {};
82
+ const DIFFERENCE = Ops.DIFFERENCE ?? 0;
83
+ const UNION = Ops.UNION ?? 1;
84
+ const isEmptyD = (d) => d.trim() === '';
85
+ const emitted = [];
86
+ // Walk top → bottom, tracking the union of everything above.
87
+ let above = null;
88
+ for (let i = layers.length - 1; i >= 0; i--) {
89
+ const p = PathKit.FromSVGString(layers[i].d);
90
+ if (!p) {
91
+ emitted.push({ index: i, d: layers[i].d, fill: layers[i].fill });
92
+ continue;
93
+ }
94
+ p.simplify();
95
+ // visible region = path minus everything above
96
+ let visibleD;
97
+ if (above === null) {
98
+ visibleD = p.toSVGString();
99
+ }
100
+ else {
101
+ const visible = PathKit.MakeFromOp(p, above, DIFFERENCE);
102
+ if (visible) {
103
+ visible.simplify();
104
+ visibleD = visible.toSVGString();
105
+ visible.delete?.();
106
+ }
107
+ else {
108
+ visibleD = p.toSVGString();
109
+ }
110
+ }
111
+ if (!isEmptyD(visibleD)) {
112
+ emitted.push({ index: i, d: visibleD, fill: layers[i].fill });
113
+ }
114
+ if (above === null) {
115
+ above = p;
116
+ }
117
+ else {
118
+ const newAbove = PathKit.MakeFromOp(above, p, UNION);
119
+ p.delete?.();
120
+ if (newAbove) {
121
+ newAbove.simplify();
122
+ above.delete?.();
123
+ above = newAbove;
124
+ }
125
+ }
126
+ }
127
+ const monochrome = above?.toSVGString() ?? '';
128
+ above?.delete?.();
129
+ return {
130
+ layers: emitted
131
+ .sort((a, b) => a.index - b.index)
132
+ .map((r) => ({ d: r.d, fill: r.fill })),
133
+ monochrome,
134
+ };
135
+ }
136
+ function resolveSymbolLayers(PathKit, layers, options) {
137
+ const flags = knockoutFlags(layers);
138
+ if (flags.some(Boolean)) {
139
+ return resolveWithKnockouts(PathKit, layers, flags, options?.onKnockoutLayer);
140
+ }
141
+ if (layers.length <= 1) {
142
+ return {
143
+ layers: layers.map((l) => ({ d: l.d, fill: l.fill })),
144
+ monochrome: layers[0]?.d ?? '',
145
+ };
146
+ }
147
+ return resolveOccluded(PathKit, layers);
148
+ }
149
+ /**
150
+ * Tight bounding box [x, y, w, h] of path `d` strings in source coords, or null.
151
+ * Used to fit icon content (not the padded viewBox) to the cap band.
152
+ */
153
+ function contentBounds(PathKit, ds) {
154
+ let minX = Infinity;
155
+ let minY = Infinity;
156
+ let maxX = -Infinity;
157
+ let maxY = -Infinity;
158
+ for (const d of ds) {
159
+ const p = PathKit.FromSVGString(d);
160
+ if (!p)
161
+ continue;
162
+ const b = p.getBounds();
163
+ p.delete?.();
164
+ if (!Number.isFinite(b.fLeft) ||
165
+ !Number.isFinite(b.fTop) ||
166
+ !Number.isFinite(b.fRight) ||
167
+ !Number.isFinite(b.fBottom)) {
168
+ continue;
169
+ }
170
+ if (b.fLeft < minX)
171
+ minX = b.fLeft;
172
+ if (b.fTop < minY)
173
+ minY = b.fTop;
174
+ if (b.fRight > maxX)
175
+ maxX = b.fRight;
176
+ if (b.fBottom > maxY)
177
+ maxY = b.fBottom;
178
+ }
179
+ if (!Number.isFinite(minX) || maxX <= minX || maxY <= minY)
180
+ return null;
181
+ return [minX, minY, maxX - minX, maxY - minY];
182
+ }
@@ -0,0 +1,22 @@
1
+ import type { NanoLogger } from '../types';
2
+ export type SymbolTemplateLayer = {
3
+ /** Path data in source viewBox coordinates (nonzero winding). */
4
+ d: string;
5
+ fill: string | null;
6
+ };
7
+ export declare function layerHexColor(fill: string | null): string;
8
+ export declare function layerClass(layerIndex: number): string;
9
+ /**
10
+ * Build the template SVG for one symbol. Layers are back→front; every layer
11
+ * gets `monochrome-N multicolor-N:custom` classes, with the layer fills
12
+ * declared in a `<style>` block.
13
+ */
14
+ export declare function buildSymbolTemplate(opts: {
15
+ layers: SymbolTemplateLayer[];
16
+ viewBox: [number, number, number, number];
17
+ /** Tight content box `[x, y, w, h]`; used instead of the viewBox when given. */
18
+ contentBounds?: [number, number, number, number];
19
+ /** Shown in the template's Notes group. */
20
+ descriptiveName?: string;
21
+ logger?: NanoLogger;
22
+ }): string;
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.layerHexColor = layerHexColor;
4
+ exports.layerClass = layerClass;
5
+ exports.buildSymbolTemplate = buildSymbolTemplate;
6
+ const parse_1 = require("../../utils/parse");
7
+ /**
8
+ * Custom SF Symbol template (v3.0) emitter. Geometry (validated against Xcode 26
9
+ * actool): 800×600 canvas, cap band Capline y=76 → Baseline y=146, source
10
+ * columns at x=265/465/665.
11
+ *
12
+ * A variable template must contain all three source groups (actool rejects
13
+ * single-variant templates) -> duplicating the same paths into each — identical
14
+ * topology satisfies the point-correspondence requirement.
15
+ */
16
+ const CAPLINE_Y = 76;
17
+ const BASELINE_Y = 146;
18
+ const CAP_BAND = BASELINE_Y - CAPLINE_Y; // 70
19
+ const CAP_CENTER = (CAPLINE_Y + BASELINE_Y) / 2; // 111
20
+ // Content box is scaled to this height (= cap band) and centered, so symbols
21
+ // fill their optical box instead of rendering small inside a padded viewBox.
22
+ const GLYPH_HEIGHT = CAP_BAND;
23
+ const VARIANT_CENTERS = [
24
+ ['Ultralight', 265],
25
+ ['Regular', 465],
26
+ ['Black', 665],
27
+ ];
28
+ /** Columns are 200 apart — clamp glyph width so variants never overlap. */
29
+ const MAX_GLYPH_WIDTH = 160;
30
+ const H_REFERENCE_PATH = 'M85,145.755 L87.685,145.755 L113.369,79.287 L114.052002,79.287 ' +
31
+ 'L114.052002,76 L112.148,76 L85,145.755 Z ' +
32
+ 'M95.693,121.536 L130.996,121.536 L130.263,119.313 L96.474,119.313 L95.693,121.536 Z ' +
33
+ 'M139.14999,145.755 L141.787,145.755 L114.638,76 L113.466,76 L113.466,79.287 L139.14999,145.755 Z';
34
+ function fmt(n) {
35
+ return Number(n.toFixed(3)).toString();
36
+ }
37
+ // Escape XML text so a filename with &/</> can't break the emitted template.
38
+ function escapeXmlText(s) {
39
+ return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
40
+ }
41
+ function layerHexColor(fill) {
42
+ if (fill === null)
43
+ return '#000000';
44
+ const [r, g, b] = (0, parse_1.parseColor)(fill);
45
+ const h = (v) => Math.max(0, Math.min(255, Math.round(v)))
46
+ .toString(16)
47
+ .padStart(2, '0')
48
+ .toUpperCase();
49
+ return `#${h(r)}${h(g)}${h(b)}`;
50
+ }
51
+ function layerClass(layerIndex) {
52
+ return `monochrome-${layerIndex} multicolor-${layerIndex}:custom`;
53
+ }
54
+ function multicolorStyle(fill) {
55
+ const alpha = fill === null ? 1 : (0, parse_1.parseColor)(fill)[3];
56
+ const opacity = alpha < 1 ? `;opacity:${Number(alpha.toFixed(4))}` : '';
57
+ return `fill:${layerHexColor(fill)}${opacity}`;
58
+ }
59
+ function renderingModeStyles(layers) {
60
+ return layers
61
+ .map((layer, i) => ` .monochrome-${i} {fill:#000000}\n` +
62
+ ` .multicolor-${i}:custom {${multicolorStyle(layer.fill)}}`)
63
+ .join('\n');
64
+ }
65
+ /**
66
+ * Build the template SVG for one symbol. Layers are back→front; every layer
67
+ * gets `monochrome-N multicolor-N:custom` classes, with the layer fills
68
+ * declared in a `<style>` block.
69
+ */
70
+ function buildSymbolTemplate(opts) {
71
+ const { layers, viewBox, contentBounds, descriptiveName, logger } = opts;
72
+ // Fit the content box, not the padded viewBox; fall back to viewBox.
73
+ const [bx, by, bw, bh] = contentBounds ?? viewBox;
74
+ const safeBw = bw === 0 ? 1 : bw;
75
+ const safeBh = bh === 0 ? 1 : bh;
76
+ // Fit to cap-band height, clamped so wide glyphs don't overlap the next column.
77
+ let scale = GLYPH_HEIGHT / safeBh;
78
+ if (safeBw * scale > MAX_GLYPH_WIDTH) {
79
+ scale = MAX_GLYPH_WIDTH / safeBw;
80
+ logger?.info(` ↔ Wide glyph clamped to ${MAX_GLYPH_WIDTH} template units (aspect ${fmt(safeBw / safeBh)}:1)`);
81
+ }
82
+ const scaledW = safeBw * scale;
83
+ const scaledH = safeBh * scale;
84
+ // Center on the cap-band midline.
85
+ const yOff = CAP_CENTER - scaledH / 2;
86
+ const pathsMarkup = (indent) => layers
87
+ .map((layer, i) => `${indent}<path class="${layerClass(i)}" d="${layer.d}"/>`)
88
+ .join('\n');
89
+ const groups = [];
90
+ const margins = [];
91
+ for (const [name, cx] of VARIANT_CENTERS) {
92
+ const tx = cx - scaledW / 2;
93
+ // Translate into the column + scale into the cap band (handles non-zero origin).
94
+ const e = tx - bx * scale;
95
+ const f = yOff - by * scale;
96
+ groups.push(` <g id="${name}-S" transform="matrix(${fmt(scale)},0,0,${fmt(scale)},${fmt(e)},${fmt(f)})">\n` +
97
+ pathsMarkup(' ') +
98
+ `\n </g>`);
99
+ margins.push(` <path id="left-margin-${name}-S" d="M${fmt(tx)},56 l0,110" />\n` +
100
+ ` <path id="right-margin-${name}-S" d="M${fmt(tx + scaledW)},56 l0,110" />`);
101
+ }
102
+ const nameNote = descriptiveName
103
+ ? `\n <text id="descriptive-name" fill="#505050" x="785.0" y="560.0" text-anchor="end">Generated from ${escapeXmlText(descriptiveName)}</text>`
104
+ : '';
105
+ return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
106
+ <svg width="800" height="600" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
107
+ <style>
108
+ ${renderingModeStyles(layers)}
109
+ </style>
110
+ <g id="Notes" font-family="'LucidaGrande', 'Lucida Grande', sans-serif" font-weight="500" font-size="13px">
111
+ <rect x="0" y="0" width="800" height="600" fill="white"/>
112
+ <g font-weight="500" font-size="13px">
113
+ <text x="18px" y="176px">Small</text>
114
+ <text x="18px" y="376px">Medium</text>
115
+ <text x="18px" y="576px">Large</text>
116
+ </g>
117
+ <g font-weight="300" font-size="9px">
118
+ <text x="250px" y="30px">Ultralight</text>
119
+ <text x="450px" y="30px">Regular</text>
120
+ <text x="650px" y="30px">Black</text>${nameNote}
121
+ <text id="template-version" fill="#505050" x="785.0" y="575.0" text-anchor="end">Template v.3.0</text>
122
+ <text fill="#505050" x="785.0" y="590.0" text-anchor="end">Generated by react-native-nano-icons</text>
123
+ </g>
124
+ </g>
125
+ <g id="Guides" stroke="rgb(39,170,225)" stroke-width="0.5px">
126
+ <path id="Capline-S" d="M18,${CAPLINE_Y} l800,0" />
127
+ <path id="H-reference" d="${H_REFERENCE_PATH}" stroke="none" />
128
+ <path id="Baseline-S" d="M18,${BASELINE_Y} l800,0" />
129
+ ${margins.join('\n')}
130
+ <path id="Capline-M" d="M18,276 l800,0" />
131
+ <path id="Baseline-M" d="M18,346 l800,0" />
132
+ <path id="Capline-L" d="M18,476 l800,0" />
133
+ <path id="Baseline-L" d="M18,546 l800,0" />
134
+ </g>
135
+ <g id="Symbols">
136
+ ${groups.join('\n')}
137
+ </g>
138
+ </svg>
139
+ `;
140
+ }
@@ -0,0 +1,11 @@
1
+ import type { SymbolTemplateLayer } from './template';
2
+ /**
3
+ * VectorDrawable XML from z-ordered layers. `contentBounds` (tight `[x,y,w,h]`,
4
+ * defaults to viewBox) sets the viewport so padding doesn't shrink the icon.
5
+ */
6
+ export declare function buildVectorDrawableXml(opts: {
7
+ layers: SymbolTemplateLayer[];
8
+ viewBox: [number, number, number, number];
9
+ /** Tight content box `[x, y, w, h]`; used instead of the viewBox when given. */
10
+ contentBounds?: [number, number, number, number];
11
+ }): string;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildVectorDrawableXml = buildVectorDrawableXml;
4
+ const parse_1 = require("../../utils/parse");
5
+ /**
6
+ * Android VectorDrawable emitter — the tab-bar counterpart to the iOS
7
+ * `.symbolset`. `android:pathData` takes SVG path syntax verbatim (nonzero
8
+ * winding by default), so prepared layers drop straight in. Each layer keeps
9
+ * its fill; the bar paints every path in its tint when the icon is tinted.
10
+ *
11
+ * VectorDrawable's viewport always starts at (0,0), so a non-zero content origin
12
+ * is absorbed by a translating `<group>`.
13
+ */
14
+ // Intrinsic size (dp): height fixed to tab-icon size, width follows aspect
15
+ // ratio (capped).
16
+ const ICON_HEIGHT = 24;
17
+ const MAX_WIDTH = ICON_HEIGHT * 3;
18
+ function num(n) {
19
+ return Number(n.toFixed(3)).toString();
20
+ }
21
+ /** [r,g,b] (0–255) → `#rrggbb`. */
22
+ function hexColor(r, g, b) {
23
+ const h = (v) => Math.max(0, Math.min(255, Math.round(v)))
24
+ .toString(16)
25
+ .padStart(2, '0');
26
+ return `#${h(r)}${h(g)}${h(b)}`;
27
+ }
28
+ /** Fill attrs from a source fill (null = default black). */
29
+ function fillAttrs(fill) {
30
+ if (fill === null)
31
+ return 'android:fillColor="#000000"';
32
+ const [r, g, b, a] = (0, parse_1.parseColor)(fill);
33
+ const color = `android:fillColor="${hexColor(r, g, b)}"`;
34
+ return a < 1 ? `${color} android:fillAlpha="${Number(a.toFixed(4))}"` : color;
35
+ }
36
+ /**
37
+ * VectorDrawable XML from z-ordered layers. `contentBounds` (tight `[x,y,w,h]`,
38
+ * defaults to viewBox) sets the viewport so padding doesn't shrink the icon.
39
+ */
40
+ function buildVectorDrawableXml(opts) {
41
+ const { layers, viewBox, contentBounds } = opts;
42
+ const [bx, by, bw0, bh0] = contentBounds ?? viewBox;
43
+ const bw = bw0 === 0 ? 1 : bw0;
44
+ const bh = bh0 === 0 ? 1 : bh0;
45
+ // Size by height; width follows aspect ratio, capped at MAX_WIDTH.
46
+ let ch = ICON_HEIGHT;
47
+ let cw = ICON_HEIGHT * (bw / bh);
48
+ if (cw > MAX_WIDTH) {
49
+ cw = MAX_WIDTH;
50
+ ch = MAX_WIDTH * (bh / bw);
51
+ }
52
+ const paths = layers
53
+ .map((layer) => ` <path ${fillAttrs(layer.fill)} android:pathData="${layer.d}"/>`)
54
+ .join('\n');
55
+ // Translate group absorbs the viewport origin (VectorDrawable has none).
56
+ return `<vector xmlns:android="http://schemas.android.com/apk/res/android"
57
+ android:width="${num(cw)}dp"
58
+ android:height="${num(ch)}dp"
59
+ android:viewportWidth="${num(bw)}"
60
+ android:viewportHeight="${num(bh)}">
61
+ <group android:translateX="${num(-bx)}" android:translateY="${num(-by)}">
62
+ ${paths}
63
+ </group>
64
+ </vector>
65
+ `;
66
+ }
@@ -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,19 @@
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 type SymbolFingerprintInputs = {
9
+ prefix: string;
10
+ version: string;
11
+ toolchain: readonly string[];
12
+ };
13
+ export type SvgDirFingerprint = {
14
+ hash: string;
15
+ svgHashByFile: Map<string, string>;
16
+ };
17
+ export declare function getFingerprintSync(dir: string, inputs: FingerprintInputs): string;
18
+ export declare function fingerprintSvgDirSync(dir: string, inputs: FingerprintInputs): SvgDirFingerprint;
19
+ export declare function fingerprintSymbolDirSync(dir: string, inputs: SymbolFingerprintInputs): SvgDirFingerprint;
@@ -1,20 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFingerprintSync = getFingerprintSync;
4
+ exports.fingerprintSvgDirSync = fingerprintSvgDirSync;
5
+ exports.fingerprintSymbolDirSync = fingerprintSymbolDirSync;
4
6
  const crypto = require('crypto');
5
7
  const fs = require('fs');
6
8
  const path = require('path');
7
- function getFingerprintSync(dir) {
9
+ function getFingerprintSync(dir, inputs) {
10
+ return fingerprintSvgDirSync(dir, inputs).hash;
11
+ }
12
+ function fingerprintSvgDirSync(dir, inputs) {
13
+ return hashSvgDir(dir, [
14
+ inputs.upm,
15
+ inputs.safeZone,
16
+ inputs.startUnicode,
17
+ inputs.version,
18
+ inputs.toolchain,
19
+ ]);
20
+ }
21
+ function fingerprintSymbolDirSync(dir, inputs) {
22
+ return hashSvgDir(dir, [
23
+ 'symbol',
24
+ inputs.prefix,
25
+ inputs.version,
26
+ inputs.toolchain,
27
+ ]);
28
+ }
29
+ function hashSvgDir(dir, settings) {
8
30
  const files = fs
9
31
  .readdirSync(dir)
10
32
  .filter((f) => f.endsWith('.svg'))
11
33
  .sort();
12
34
  const hash = crypto.createHash('sha256');
35
+ const svgHashByFile = new Map();
13
36
  for (const file of files) {
14
37
  const filePath = path.join(dir, file);
38
+ const content = fs.readFileSync(filePath);
15
39
  // Hash both path and content
16
40
  hash.update(file);
17
- hash.update(fs.readFileSync(filePath));
41
+ hash.update(content);
42
+ svgHashByFile.set(file, crypto.createHash('sha256').update(content).digest('hex'));
18
43
  }
19
- return hash.digest('hex');
44
+ hash.update(JSON.stringify(settings));
45
+ return { hash: hash.digest('hex'), svgHashByFile };
20
46
  }
@@ -0,0 +1,4 @@
1
+ export declare function buildFontFamily(fontFamily: string, inputHash: string): string;
2
+ export declare function configuredFontFamily(family: string): string;
3
+ export declare function isFontFileOf(fontFamily: string, fileName: string): boolean;
4
+ export declare function isBuildFontFile(fileName: string): boolean;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildFontFamily = buildFontFamily;
4
+ exports.configuredFontFamily = configuredFontFamily;
5
+ exports.isFontFileOf = isFontFileOf;
6
+ exports.isBuildFontFile = isBuildFontFile;
7
+ const BUILD_HASH_LENGTH = 8;
8
+ const BUILD_HASH = `[0-9a-f]{${BUILD_HASH_LENGTH}}`;
9
+ const BUILD_SUFFIX = new RegExp(`-${BUILD_HASH}$`);
10
+ const BUILD_FONT_FILE = new RegExp(`-${BUILD_HASH}\\.ttf$`);
11
+ const REGEX_SPECIALS = /[.*+?^${}()|[\]\\]/g;
12
+ function buildFontFamily(fontFamily, inputHash) {
13
+ return `${fontFamily}-${inputHash.slice(0, BUILD_HASH_LENGTH)}`;
14
+ }
15
+ function configuredFontFamily(family) {
16
+ return family.replace(BUILD_SUFFIX, '');
17
+ }
18
+ function isFontFileOf(fontFamily, fileName) {
19
+ const escaped = fontFamily.replace(REGEX_SPECIALS, '\\$&');
20
+ return new RegExp(`^${escaped}(-${BUILD_HASH})?\\.ttf$`).test(fileName);
21
+ }
22
+ function isBuildFontFile(fileName) {
23
+ return BUILD_FONT_FILE.test(fileName);
24
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Resource names must match `[a-z][a-z0-9_]*` — no dots/uppercase.
3
+ * `nano.home` → `nano_home`, `nano.person-walking` → `nano_person_walking`.
4
+ */
5
+ export declare function toDrawableResourceName(assetName: string): string;
6
+ export declare function toOriginalDrawableResourceName(resourceName: string): string;
7
+ /** "my-tab icons" → "MyTabIcons" — PascalCase base for manifest identifiers. */
8
+ export declare function manifestBaseName(setName: string): string;
9
+ /** Manifest export name, e.g. `MyTabIconsSymbols` / `MyTabIconsDrawables`. */
10
+ export declare function manifestExportName(setName: string, suffix?: string): string;