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
@@ -36,56 +36,140 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.syncAndroidFontAssets = syncAndroidFontAssets;
40
+ exports.copySymbolsetsIntoCatalog = copySymbolsetsIntoCatalog;
41
+ exports.linkBareSymbols = linkBareSymbols;
42
+ exports.copyDrawablesIntoResDir = copyDrawablesIntoResDir;
43
+ exports.linkBareAndroidDrawables = linkBareAndroidDrawables;
39
44
  exports.linkBare = linkBare;
40
45
  const node_fs_1 = __importDefault(require("node:fs"));
41
46
  const node_path_1 = __importDefault(require("node:path"));
42
47
  const plist = __importStar(require("plist"));
48
+ const contents_1 = require("../src/core/symbols/contents");
49
+ const naming_1 = require("../src/utils/naming");
50
+ const fontIdentity_1 = require("../src/utils/fontIdentity");
43
51
  const ANDROID_FONTS_DIR = 'android/app/src/main/assets/fonts';
52
+ const ANDROID_DRAWABLES_DIR = 'android/app/src/main/res/drawable';
44
53
  const IOS_NANOICONS_FONTS_DIR = 'nanoicons-fonts';
45
54
  const IOS_RUN_SCRIPT_PHASE_NAME = 'Copy nanoicons fonts';
46
- async function linkAndroid(projectRoot, builtFonts) {
47
- const androidFontsPath = node_path_1.default.join(projectRoot, ANDROID_FONTS_DIR);
48
- node_fs_1.default.mkdirSync(androidFontsPath, { recursive: true });
49
- for (const b of builtFonts) {
50
- const dest = node_path_1.default.join(androidFontsPath, node_path_1.default.basename(b.ttfPath));
51
- node_fs_1.default.copyFileSync(b.ttfPath, dest);
55
+ const IOS_APPLICATION_PRODUCT_TYPE = 'com.apple.product-type.application';
56
+ const XCODE_PROJECT_DIR_VARIABLE = /\$[({](?:SRCROOT|PROJECT_DIR)[)}]/g;
57
+ const SURROUNDING_QUOTES = /^["']|["']$/g;
58
+ function getAppTarget(project) {
59
+ const appTarget = project.getTarget(IOS_APPLICATION_PRODUCT_TYPE);
60
+ if (appTarget)
61
+ return appTarget;
62
+ const { uuid, firstTarget } = project.getFirstTarget();
63
+ return { uuid, target: firstTarget };
64
+ }
65
+ function resolveInfoPlistPaths(project, target, iosDir, fallbackPath) {
66
+ const configurationList = project.pbxXCConfigurationList()[target.buildConfigurationList];
67
+ const buildConfigurations = project.pbxXCBuildConfigurationSection();
68
+ const configuredPaths = new Set();
69
+ if (typeof configurationList === 'object') {
70
+ for (const { value } of configurationList.buildConfigurations) {
71
+ const configuration = buildConfigurations[value];
72
+ if (typeof configuration !== 'object')
73
+ continue;
74
+ const setting = configuration.buildSettings['INFOPLIST_FILE'];
75
+ if (typeof setting !== 'string')
76
+ continue;
77
+ configuredPaths.add(node_path_1.default.resolve(iosDir, setting
78
+ .replace(SURROUNDING_QUOTES, '')
79
+ .replace(XCODE_PROJECT_DIR_VARIABLE, iosDir)));
80
+ }
81
+ }
82
+ const existingPaths = [...configuredPaths].filter((plistPath) => node_fs_1.default.existsSync(plistPath));
83
+ if (existingPaths.length)
84
+ return existingPaths;
85
+ return node_fs_1.default.existsSync(fallbackPath) ? [fallbackPath] : [];
86
+ }
87
+ function syncUIAppFonts(infoPlistPath, add, remove) {
88
+ const parsed = plist.parse(node_fs_1.default.readFileSync(infoPlistPath, 'utf8'));
89
+ const existing = Array.isArray(parsed['UIAppFonts'])
90
+ ? parsed['UIAppFonts']
91
+ : [];
92
+ const fonts = [
93
+ ...new Set([...existing.filter((f) => !remove.includes(f)), ...add]),
94
+ ];
95
+ if (fonts.length === existing.length &&
96
+ fonts.every((f, i) => f === existing[i])) {
97
+ return;
98
+ }
99
+ const updated = { ...parsed, UIAppFonts: fonts };
100
+ node_fs_1.default.writeFileSync(infoPlistPath, plist.build(updated), 'utf8');
101
+ }
102
+ function syncAndroidFontAssets(fontsDir, staticFonts, configuredFamilies) {
103
+ const keep = new Set(staticFonts.map((b) => `${b.family}.ttf`));
104
+ if (node_fs_1.default.existsSync(fontsDir)) {
105
+ for (const existing of node_fs_1.default.readdirSync(fontsDir)) {
106
+ if (keep.has(existing))
107
+ continue;
108
+ if ((0, fontIdentity_1.isBuildFontFile)(existing) ||
109
+ configuredFamilies.some((family) => (0, fontIdentity_1.isFontFileOf)(family, existing))) {
110
+ node_fs_1.default.unlinkSync(node_path_1.default.join(fontsDir, existing));
111
+ }
112
+ }
113
+ }
114
+ if (!staticFonts.length)
115
+ return;
116
+ node_fs_1.default.mkdirSync(fontsDir, { recursive: true });
117
+ for (const b of staticFonts) {
118
+ node_fs_1.default.copyFileSync(b.ttfPath, node_path_1.default.join(fontsDir, `${b.family}.ttf`));
52
119
  }
53
120
  }
54
- async function linkIos(projectRoot, builtFonts) {
121
+ async function linkAndroid(projectRoot, staticFonts, builtFonts) {
122
+ syncAndroidFontAssets(node_path_1.default.join(projectRoot, ANDROID_FONTS_DIR), staticFonts, builtFonts.map((b) => b.fontFamily));
123
+ }
124
+ async function linkIos(projectRoot, staticFonts, dynamicFonts, logger) {
55
125
  const iosDir = node_path_1.default.join(projectRoot, 'ios');
56
126
  const xcodeprojDir = node_fs_1.default
57
127
  .readdirSync(iosDir, { withFileTypes: true })
58
128
  .find((d) => d.name.endsWith('.xcodeproj'));
59
- if (!xcodeprojDir)
60
- return;
61
- const appName = xcodeprojDir.name.replace(/\.xcodeproj$/, '');
62
- const infoPlistPath = node_path_1.default.join(iosDir, appName, 'Info.plist');
63
- if (!node_fs_1.default.existsSync(infoPlistPath))
64
- return;
65
- const fontNames = [];
66
- const iosFontsStaging = node_path_1.default.join(iosDir, IOS_NANOICONS_FONTS_DIR);
67
- node_fs_1.default.mkdirSync(iosFontsStaging, { recursive: true });
68
- for (const b of builtFonts) {
69
- const name = node_path_1.default.basename(b.ttfPath);
70
- fontNames.push(name);
71
- node_fs_1.default.copyFileSync(b.ttfPath, node_path_1.default.join(iosFontsStaging, name));
72
- }
73
- const plistContent = node_fs_1.default.readFileSync(infoPlistPath, 'utf8');
74
- const obj = plist.parse(plistContent);
75
- const existing = Array.isArray(obj['UIAppFonts'])
76
- ? obj['UIAppFonts']
77
- : [];
78
- const merged = [...new Set([...existing, ...fontNames])];
79
- const updated = {
80
- ...obj,
81
- UIAppFonts: merged,
82
- };
83
- node_fs_1.default.writeFileSync(infoPlistPath, plist.build(updated), 'utf8');
129
+ if (!xcodeprojDir) {
130
+ logger.warn(`No .xcodeproj found in ${iosDir} — skipping iOS linking.`);
131
+ return false;
132
+ }
84
133
  const pbxprojPath = node_path_1.default.join(iosDir, xcodeprojDir.name, 'project.pbxproj');
134
+ if (!node_fs_1.default.existsSync(pbxprojPath)) {
135
+ logger.warn(`${node_path_1.default.relative(projectRoot, pbxprojPath)} not found — skipping iOS linking.`);
136
+ return false;
137
+ }
85
138
  const xcode = require('xcode');
86
- const project = xcode.project(pbxprojPath);
87
- project.parseSync();
88
- const hasPhase = Object.entries(project.hash.project.objects['PBXShellScriptBuildPhase'] ?? {}).some(([, v]) => typeof v === 'object' && v?.name?.includes(IOS_RUN_SCRIPT_PHASE_NAME));
139
+ const project = xcode.project(pbxprojPath).parseSync();
140
+ const appName = xcodeprojDir.name.replace(XCODEPROJ_RE, '');
141
+ const { uuid: targetUuid, target } = getAppTarget(project);
142
+ const infoPlistPaths = resolveInfoPlistPaths(project, target, iosDir, node_path_1.default.join(iosDir, appName, 'Info.plist'));
143
+ if (!infoPlistPaths.length) {
144
+ logger.warn(`No Info.plist resolved for target "${target.name}" — set INFOPLIST_FILE in its build settings, ` +
145
+ `or place one at ios/${appName}/Info.plist. Skipping iOS linking.`);
146
+ return false;
147
+ }
148
+ const fontNames = staticFonts.map((b) => node_path_1.default.basename(b.ttfPath));
149
+ const removedNames = dynamicFonts.map((b) => `${b.fontFamily}.ttf`);
150
+ const iosFontsStaging = node_path_1.default.join(iosDir, IOS_NANOICONS_FONTS_DIR);
151
+ if (node_fs_1.default.existsSync(iosFontsStaging)) {
152
+ for (const existing of node_fs_1.default.readdirSync(iosFontsStaging)) {
153
+ if (existing.endsWith('.ttf') && !fontNames.includes(existing)) {
154
+ node_fs_1.default.unlinkSync(node_path_1.default.join(iosFontsStaging, existing));
155
+ removedNames.push(existing);
156
+ }
157
+ }
158
+ }
159
+ if (staticFonts.length) {
160
+ node_fs_1.default.mkdirSync(iosFontsStaging, { recursive: true });
161
+ for (const b of staticFonts) {
162
+ node_fs_1.default.copyFileSync(b.ttfPath, node_path_1.default.join(iosFontsStaging, node_path_1.default.basename(b.ttfPath)));
163
+ }
164
+ }
165
+ for (const infoPlistPath of infoPlistPaths) {
166
+ syncUIAppFonts(infoPlistPath, fontNames, removedNames);
167
+ }
168
+ if (!staticFonts.length)
169
+ return true;
170
+ const hasPhase = Object.values(project.hash.project.objects['PBXShellScriptBuildPhase'] ?? {}).some((phase) => typeof phase === 'object' &&
171
+ typeof phase['name'] === 'string' &&
172
+ phase['name'].includes(IOS_RUN_SCRIPT_PHASE_NAME));
89
173
  if (!hasPhase) {
90
174
  const script = `
91
175
  NANOICONS_DIR="\\\${PROJECT_DIR}/${IOS_NANOICONS_FONTS_DIR}"
@@ -93,9 +177,187 @@ async function linkIos(projectRoot, builtFonts) {
93
177
  cp "$NANOICONS_DIR"/*.ttf "\\\${BUILT_PRODUCTS_DIR}/\\\${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" 2>/dev/null || true
94
178
  fi
95
179
  `;
96
- project.addBuildPhase([], 'PBXShellScriptBuildPhase', IOS_RUN_SCRIPT_PHASE_NAME, project.getFirstTarget().uuid, { shellPath: '/bin/sh', shellScript: script });
180
+ project.addBuildPhase([], 'PBXShellScriptBuildPhase', IOS_RUN_SCRIPT_PHASE_NAME, targetUuid, { shellPath: '/bin/sh', shellScript: script });
97
181
  node_fs_1.default.writeFileSync(pbxprojPath, project.writeSync(), 'utf8');
98
182
  }
183
+ return true;
184
+ }
185
+ // ---------------------------------------------------------------------------
186
+ // Custom SF Symbol linking (iOS)
187
+ // ---------------------------------------------------------------------------
188
+ const IOS_SYMBOLS_CATALOG = 'NanoIconsSymbols.xcassets';
189
+ function findIosApp(projectRoot) {
190
+ const iosDir = node_path_1.default.join(projectRoot, 'ios');
191
+ if (!node_fs_1.default.existsSync(iosDir))
192
+ return null;
193
+ const xcodeprojDir = node_fs_1.default
194
+ .readdirSync(iosDir, { withFileTypes: true })
195
+ .find((d) => d.name.endsWith('.xcodeproj'));
196
+ if (!xcodeprojDir)
197
+ return null;
198
+ return {
199
+ iosDir,
200
+ xcodeprojName: xcodeprojDir.name,
201
+ appName: xcodeprojDir.name.replace(XCODEPROJ_RE, ''),
202
+ };
203
+ }
204
+ // File/folder name matchers (filesystem, CLI-specific).
205
+ const XCODEPROJ_RE = /\.xcodeproj$/;
206
+ const NANO_ASSET_RE = /\.(symbolset|imageset)$/;
207
+ const XML_FILE_RE = /\.xml$/;
208
+ // Ledgers of what we last linked, kept in the build output dir. Read before a
209
+ // re-link so a renamed prefix or a dropped set is cleaned too — the current-prefix
210
+ // scan below only sees names still in the config.
211
+ const SYMBOL_LEDGER = '.nanoicons-catalog.json';
212
+ const DRAWABLE_LEDGER = '.nanoicons-drawables.json';
213
+ function readLedger(ledgerPath) {
214
+ try {
215
+ const names = JSON.parse(node_fs_1.default.readFileSync(ledgerPath, 'utf8'));
216
+ return Array.isArray(names) ? names : [];
217
+ }
218
+ catch {
219
+ return [];
220
+ }
221
+ }
222
+ // Copy generated asset folders into a catalog, first removing everything we
223
+ // linked last time (ledger) plus any current-prefix match (ledger-less fallback).
224
+ // Handles removed icons, mode switches, prefix renames and dropped sets.
225
+ function copySymbolsetsIntoCatalog(catalogDir, builtSymbolSets) {
226
+ const outputDir = builtSymbolSets[0]
227
+ ? node_path_1.default.dirname(builtSymbolSets[0].symbolsDir)
228
+ : null;
229
+ const ledgerPath = outputDir ? node_path_1.default.join(outputDir, SYMBOL_LEDGER) : null;
230
+ const stale = new Set(ledgerPath ? readLedger(ledgerPath) : []);
231
+ const prefixes = new Set(builtSymbolSets.map((s) => s.prefix));
232
+ for (const entry of node_fs_1.default.readdirSync(catalogDir, { withFileTypes: true })) {
233
+ if (!entry.isDirectory() || !NANO_ASSET_RE.test(entry.name))
234
+ continue;
235
+ const assetName = entry.name.replace(NANO_ASSET_RE, '');
236
+ for (const prefix of prefixes) {
237
+ if (assetName.startsWith(`${prefix}.`)) {
238
+ stale.add(entry.name);
239
+ break;
240
+ }
241
+ }
242
+ }
243
+ for (const name of stale) {
244
+ node_fs_1.default.rmSync(node_path_1.default.join(catalogDir, name), { recursive: true, force: true });
245
+ }
246
+ const linked = [];
247
+ for (const set of builtSymbolSets) {
248
+ for (const assetDir of set.assetDirs) {
249
+ const base = node_path_1.default.basename(assetDir);
250
+ node_fs_1.default.cpSync(assetDir, node_path_1.default.join(catalogDir, base), { recursive: true });
251
+ linked.push(base);
252
+ }
253
+ }
254
+ if (ledgerPath)
255
+ node_fs_1.default.writeFileSync(ledgerPath, JSON.stringify(linked));
256
+ }
257
+ /**
258
+ * Link custom SF Symbols into the iOS app. Primary path writes into the app's
259
+ * existing Images.xcassets (no pbxproj changes). Fallback (no Images.xcassets)
260
+ * creates NanoIconsSymbols.xcassets and registers it on the first target.
261
+ */
262
+ async function linkBareSymbols(projectRoot, builtSymbolSets, logger) {
263
+ if (!builtSymbolSets.length)
264
+ return;
265
+ const app = findIosApp(projectRoot);
266
+ if (!app) {
267
+ const outputDirs = [
268
+ ...new Set(builtSymbolSets.map((s) => node_path_1.default.dirname(s.symbolsDir))),
269
+ ];
270
+ const rel = node_path_1.default.relative(projectRoot, outputDirs[0] ?? '');
271
+ logger.info(`No ios/ project found — symbols saved to ${rel}/ (skipping link)`);
272
+ return;
273
+ }
274
+ const imagesCatalog = node_path_1.default.join(app.iosDir, app.appName, 'Images.xcassets');
275
+ if (node_fs_1.default.existsSync(imagesCatalog)) {
276
+ copySymbolsetsIntoCatalog(imagesCatalog, builtSymbolSets);
277
+ logger.succeed(`Linked symbols → ios/${app.appName}/Images.xcassets`);
278
+ return;
279
+ }
280
+ // Fallback: dedicated catalog + pbxproj resource entry
281
+ const catalogDir = node_path_1.default.join(app.iosDir, IOS_SYMBOLS_CATALOG);
282
+ node_fs_1.default.mkdirSync(catalogDir, { recursive: true });
283
+ node_fs_1.default.writeFileSync(node_path_1.default.join(catalogDir, 'Contents.json'), (0, contents_1.catalogRootContentsJson)(), 'utf8');
284
+ copySymbolsetsIntoCatalog(catalogDir, builtSymbolSets);
285
+ const pbxprojPath = node_path_1.default.join(app.iosDir, app.xcodeprojName, 'project.pbxproj');
286
+ const xcode = require('xcode');
287
+ const project = xcode.project(pbxprojPath);
288
+ project.parseSync();
289
+ if (!project.hasFile(IOS_SYMBOLS_CATALOG)) {
290
+ try {
291
+ project.addResourceFile(IOS_SYMBOLS_CATALOG, {
292
+ target: project.getFirstTarget().uuid,
293
+ lastKnownFileType: 'folder.assetcatalog',
294
+ sourceTree: '"<group>"',
295
+ }, undefined);
296
+ node_fs_1.default.writeFileSync(pbxprojPath, project.writeSync(), 'utf8');
297
+ }
298
+ catch (err) {
299
+ const message = err instanceof Error ? err.message : String(err);
300
+ logger.warn(`Could not register ${IOS_SYMBOLS_CATALOG} in the Xcode project (${message}). ` +
301
+ `Add ios/${IOS_SYMBOLS_CATALOG} to your app target's resources in Xcode once.`);
302
+ return;
303
+ }
304
+ }
305
+ logger.succeed(`Linked symbols → ios/${IOS_SYMBOLS_CATALOG}`);
306
+ }
307
+ // ---------------------------------------------------------------------------
308
+ // Android VectorDrawable linking
309
+ // ---------------------------------------------------------------------------
310
+ // Copy generated VectorDrawable XML into a res/drawable dir, first removing what
311
+ // we linked last time (ledger) plus any current-prefix match. Handles removed
312
+ // icons, prefix renames and dropped sets.
313
+ function copyDrawablesIntoResDir(drawableDir, builtSymbolSets) {
314
+ node_fs_1.default.mkdirSync(drawableDir, { recursive: true });
315
+ const outputDir = builtSymbolSets[0]
316
+ ? node_path_1.default.dirname(builtSymbolSets[0].drawablesDir)
317
+ : null;
318
+ const ledgerPath = outputDir ? node_path_1.default.join(outputDir, DRAWABLE_LEDGER) : null;
319
+ const stale = new Set(ledgerPath ? readLedger(ledgerPath) : []);
320
+ const prefixes = new Set(builtSymbolSets.map((s) => (0, naming_1.toDrawableResourceName)(s.prefix)));
321
+ for (const entry of node_fs_1.default.readdirSync(drawableDir, { withFileTypes: true })) {
322
+ if (!entry.isFile() || !entry.name.endsWith('.xml'))
323
+ continue;
324
+ const base = entry.name.replace(XML_FILE_RE, '');
325
+ for (const prefix of prefixes) {
326
+ if (base.startsWith(`${prefix}_`)) {
327
+ stale.add(entry.name);
328
+ break;
329
+ }
330
+ }
331
+ }
332
+ for (const name of stale) {
333
+ node_fs_1.default.rmSync(node_path_1.default.join(drawableDir, name), { force: true });
334
+ }
335
+ const linked = [];
336
+ for (const set of builtSymbolSets) {
337
+ for (const file of set.drawableFiles) {
338
+ const base = node_path_1.default.basename(file);
339
+ node_fs_1.default.copyFileSync(file, node_path_1.default.join(drawableDir, base));
340
+ linked.push(base);
341
+ }
342
+ }
343
+ if (ledgerPath)
344
+ node_fs_1.default.writeFileSync(ledgerPath, JSON.stringify(linked));
345
+ }
346
+ /**
347
+ * Link generated VectorDrawables into the Android app's res/drawable. They are
348
+ * compiled automatically by AGP and resolve by name via getIdentifier — the
349
+ * native-tab-bar counterpart to the iOS asset catalog. No gradle changes needed.
350
+ */
351
+ async function linkBareAndroidDrawables(projectRoot, builtSymbolSets, logger) {
352
+ if (!builtSymbolSets.length)
353
+ return;
354
+ if (!node_fs_1.default.existsSync(node_path_1.default.join(projectRoot, 'android'))) {
355
+ logger.info('No android/ project found — skipping drawable link');
356
+ return;
357
+ }
358
+ const drawableDir = node_path_1.default.join(projectRoot, ANDROID_DRAWABLES_DIR);
359
+ copyDrawablesIntoResDir(drawableDir, builtSymbolSets);
360
+ logger.succeed(`Linked drawables → ${ANDROID_DRAWABLES_DIR}`);
99
361
  }
100
362
  /**
101
363
  * Link built TTFs into native project directories.
@@ -105,7 +367,7 @@ async function linkIos(projectRoot, builtFonts) {
105
367
  * - Only one platform dir exists → link that platform only
106
368
  * - Neither exists (e.g. React Native Web) → skip native linking, report output dir
107
369
  */
108
- async function linkBare(projectRoot, builtFonts, logger) {
370
+ async function linkBare(projectRoot, builtFonts, logger, totalSets = builtFonts.length) {
109
371
  if (!builtFonts.length)
110
372
  return;
111
373
  const staticFonts = builtFonts.filter((b) => b.linking === 'static');
@@ -125,21 +387,25 @@ async function linkBare(projectRoot, builtFonts, logger) {
125
387
  logger.info(`No native directories found — fonts saved to ${rel}/ (no native dirs, skipping link)`);
126
388
  return;
127
389
  }
128
- if (!staticFonts.length) {
129
- logger.succeed(`All ${dynamicFonts.length} font(s) use dynamic linking — nothing to bundle natively.`);
130
- return;
131
- }
132
390
  const linkedPlatforms = [];
133
391
  if (hasAndroid) {
134
- await linkAndroid(projectRoot, staticFonts);
392
+ await linkAndroid(projectRoot, staticFonts, builtFonts);
135
393
  linkedPlatforms.push('android');
136
394
  }
137
- if (hasIos) {
138
- await linkIos(projectRoot, staticFonts);
395
+ if (hasIos &&
396
+ (await linkIos(projectRoot, staticFonts, dynamicFonts, logger))) {
139
397
  linkedPlatforms.push('ios');
140
398
  }
399
+ if (!staticFonts.length) {
400
+ logger.succeed(`All ${dynamicFonts.length} font(s) use dynamic linking — nothing to bundle natively.`);
401
+ return;
402
+ }
141
403
  const dynamicSuffix = dynamicFonts.length
142
404
  ? ` (${dynamicFonts.length} dynamic font${dynamicFonts.length === 1 ? '' : 's'} skipped)`
143
405
  : '';
144
- logger.succeed(`Linked fonts → ${linkedPlatforms.join(', ')}${dynamicSuffix}`);
406
+ if (!linkedPlatforms.length) {
407
+ logger.fail(`No platforms linked${dynamicSuffix}.`);
408
+ return;
409
+ }
410
+ logger.succeed(`Linked [${staticFonts.map((b) => b.fontFamily).join(', ')}] (${staticFonts.length}/${totalSets}) → ${linkedPlatforms.join(', ')}${dynamicSuffix}`);
145
411
  }
@@ -30,13 +30,15 @@ async function createOraLogger(level) {
30
30
  spinner.fail(chalk.red(msg));
31
31
  },
32
32
  info(msg) {
33
- if (level === 'verbose') {
34
- // Print below the current spinner without disrupting it
35
- process.stdout.write(`\n${dimPrefix}${chalk.dim(msg)}`);
36
- }
33
+ if (level !== 'verbose')
34
+ return;
35
+ spinner.clear();
36
+ process.stdout.write(`${dimPrefix}${chalk.dim(msg)}\n`);
37
+ if (spinner.isSpinning && process.stdout.isTTY)
38
+ spinner.render();
37
39
  },
38
40
  warn(msg) {
39
- spinner.warn(chalk.yellow(msg));
41
+ spinner.warn(chalk.dim(msg));
40
42
  },
41
43
  };
42
44
  }
@@ -63,14 +65,14 @@ async function createQuietLogger(level) {
63
65
  console.log(`${dimPrefix} ${tick} ${msg}`);
64
66
  },
65
67
  fail(msg) {
66
- console.error(`${dimPrefix} ${cross} ${msg}`);
68
+ console.error(`${dimPrefix} ${cross} ${chalk.red(msg)}`);
67
69
  },
68
70
  info(msg) {
69
71
  if (level === 'verbose')
70
72
  console.log(`${dimPrefix} ${info} ${msg}`);
71
73
  },
72
74
  warn(msg) {
73
- console.warn(`${dimPrefix} ${warning} ${msg}`);
75
+ console.warn(`${dimPrefix} ${warning} ${chalk.dim(msg)}`);
74
76
  },
75
77
  };
76
78
  }
@@ -0,0 +1,62 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { type BuiltFont, type IconSetConfig, type NanoLogger, SvgWorkerPool } from '../cli/index';
3
+ export declare const FONT_ROUTE = "/__nanoicons/";
4
+ export declare const REBUILD_DEBOUNCE_MS = 50;
5
+ export declare const ADDED_FILES_SETTLE_MS = 250;
6
+ export declare const CHANGE_LABEL: {
7
+ add: string;
8
+ change: string;
9
+ delete: string;
10
+ };
11
+ export declare function summarize(changes: string[]): string;
12
+ export type WatchEvent = {
13
+ filePath: string;
14
+ type: 'add' | 'change' | 'delete';
15
+ };
16
+ /** metro-file-map < 0.84.3: one entry per raw watcher event, absolute paths. */
17
+ type LegacyChangeEvent = {
18
+ eventsQueue: WatchEvent[];
19
+ };
20
+ /**
21
+ * metro-file-map >= 0.84.3 (Expo SDK 57 ships 0.84.5): events are
22
+ * aggregated per file into `changes`, keyed by paths relative to `rootDir`.
23
+ */
24
+ type AggregatedChangeEvent = {
25
+ rootDir: string;
26
+ changes: {
27
+ addedFiles: Iterable<[string, unknown]>;
28
+ modifiedFiles: Iterable<[string, unknown]>;
29
+ removedFiles: Iterable<[string, unknown]>;
30
+ };
31
+ };
32
+ export type ChangeEvent = LegacyChangeEvent | AggregatedChangeEvent;
33
+ export type FileWatcher = {
34
+ on(event: 'change', listener: (change: ChangeEvent) => void): unknown;
35
+ };
36
+ export declare function toWatchEvents(change: ChangeEvent): WatchEvent[];
37
+ export type Next = (err?: unknown) => void;
38
+ export type DevLogger = NanoLogger & {
39
+ notify(msg: string): void;
40
+ };
41
+ export declare class FontRebuildWatcher {
42
+ private readonly projectRoot;
43
+ private readonly logger;
44
+ private readonly svgWorkerPool;
45
+ private readonly setsByInputDir;
46
+ private readonly fontsByFamily;
47
+ private readonly dirty;
48
+ private readonly preparedSvgCache;
49
+ private webDetected;
50
+ private pending;
51
+ private timer;
52
+ private settleMs;
53
+ constructor(projectRoot: string, iconSets: IconSetConfig[], watcher: FileWatcher, logger: DevLogger, svgWorkerPool?: SvgWorkerPool);
54
+ get build(): Promise<void>;
55
+ fontFor(family: string): BuiltFont | undefined;
56
+ private onChange;
57
+ private schedule;
58
+ private flush;
59
+ private rebuildDirty;
60
+ middleware: (req: IncomingMessage, res: ServerResponse, next: Next) => void;
61
+ }
62
+ export {};
@@ -0,0 +1,174 @@
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.FontRebuildWatcher = exports.CHANGE_LABEL = exports.ADDED_FILES_SETTLE_MS = exports.REBUILD_DEBOUNCE_MS = exports.FONT_ROUTE = void 0;
7
+ exports.summarize = summarize;
8
+ exports.toWatchEvents = toWatchEvents;
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const index_1 = require("../cli/index");
12
+ exports.FONT_ROUTE = '/__nanoicons/';
13
+ exports.REBUILD_DEBOUNCE_MS = 50;
14
+ exports.ADDED_FILES_SETTLE_MS = 250;
15
+ const MAX_LISTED_CHANGES = 3;
16
+ const WEB_PLATFORM = /[?&]platform=web(?:&|$)/;
17
+ exports.CHANGE_LABEL = {
18
+ add: 'added',
19
+ change: 'changed',
20
+ delete: 'removed',
21
+ };
22
+ function setName(set) {
23
+ return set.fontFamily ?? node_path_1.default.basename(set.inputDir);
24
+ }
25
+ function summarize(changes) {
26
+ const listed = changes.slice(0, MAX_LISTED_CHANGES).join(', ');
27
+ const rest = changes.length - MAX_LISTED_CHANGES;
28
+ return rest > 0 ? `${listed} and ${rest} more` : listed;
29
+ }
30
+ function toWatchEvents(change) {
31
+ if ('eventsQueue' in change && Array.isArray(change.eventsQueue)) {
32
+ return change.eventsQueue;
33
+ }
34
+ if (!('changes' in change) || !change.changes)
35
+ return [];
36
+ const { changes, rootDir } = change;
37
+ const events = [];
38
+ const collect = (files, type) => {
39
+ if (!files)
40
+ return;
41
+ for (const [relativePath] of files) {
42
+ events.push({ filePath: node_path_1.default.resolve(rootDir, relativePath), type });
43
+ }
44
+ };
45
+ collect(changes.addedFiles, 'add');
46
+ collect(changes.modifiedFiles, 'change');
47
+ collect(changes.removedFiles, 'delete');
48
+ return events;
49
+ }
50
+ class FontRebuildWatcher {
51
+ projectRoot;
52
+ logger;
53
+ svgWorkerPool;
54
+ setsByInputDir = new Map();
55
+ fontsByFamily = new Map();
56
+ dirty = new Map();
57
+ preparedSvgCache = new Map();
58
+ webDetected = false;
59
+ pending = Promise.resolve();
60
+ timer;
61
+ settleMs = exports.REBUILD_DEBOUNCE_MS;
62
+ constructor(projectRoot, iconSets, watcher, logger, svgWorkerPool = new index_1.SvgWorkerPool()) {
63
+ this.projectRoot = projectRoot;
64
+ this.logger = logger;
65
+ this.svgWorkerPool = svgWorkerPool;
66
+ for (const set of iconSets) {
67
+ this.setsByInputDir.set(node_path_1.default.resolve(projectRoot, set.inputDir), set);
68
+ }
69
+ watcher.on('change', (change) => this.onChange(toWatchEvents(change)));
70
+ this.svgWorkerPool.warm();
71
+ this.schedule(iconSets);
72
+ }
73
+ get build() {
74
+ return this.pending;
75
+ }
76
+ fontFor(family) {
77
+ return this.fontsByFamily.get(family);
78
+ }
79
+ onChange(events) {
80
+ for (const event of events) {
81
+ if (!event.filePath.toLowerCase().endsWith('.svg'))
82
+ continue;
83
+ const set = this.setsByInputDir.get(node_path_1.default.dirname(event.filePath));
84
+ if (!set)
85
+ continue;
86
+ if (event.type === 'add')
87
+ this.settleMs = exports.ADDED_FILES_SETTLE_MS;
88
+ this.schedule([set], `${node_path_1.default.basename(event.filePath)} ${exports.CHANGE_LABEL[event.type]}`);
89
+ }
90
+ }
91
+ schedule(sets, change) {
92
+ for (const set of sets) {
93
+ const changes = this.dirty.get(set) ?? [];
94
+ if (change)
95
+ changes.push(change);
96
+ this.dirty.set(set, changes);
97
+ }
98
+ if (this.timer)
99
+ clearTimeout(this.timer);
100
+ this.timer = setTimeout(() => this.flush(), this.settleMs);
101
+ }
102
+ flush() {
103
+ this.timer = undefined;
104
+ this.settleMs = exports.REBUILD_DEBOUNCE_MS;
105
+ this.pending = this.pending.then(() => this.rebuildDirty());
106
+ }
107
+ async rebuildDirty() {
108
+ const sets = [...this.dirty.keys()];
109
+ for (const [set, changes] of this.dirty) {
110
+ if (changes.length) {
111
+ this.logger.notify(`${setName(set)}: ${summarize(changes)}, rebuilding…`);
112
+ }
113
+ }
114
+ this.dirty.clear();
115
+ if (!sets.length)
116
+ return;
117
+ let built;
118
+ try {
119
+ built = await (0, index_1.buildAllFonts)(sets, this.projectRoot, {
120
+ logger: this.logger,
121
+ keepOutputsOnFailure: true,
122
+ preparedSvgCache: this.preparedSvgCache,
123
+ svgWorkerPool: this.svgWorkerPool,
124
+ withWeb: this.webDetected,
125
+ });
126
+ }
127
+ catch (err) {
128
+ if (!(err instanceof index_1.IconSetBuildError)) {
129
+ this.logger.fail(err instanceof Error ? err.message : String(err));
130
+ return;
131
+ }
132
+ built = err.built;
133
+ }
134
+ for (const font of built) {
135
+ for (const [family, previous] of this.fontsByFamily) {
136
+ if (previous.fontFamily === font.fontFamily) {
137
+ this.fontsByFamily.delete(family);
138
+ }
139
+ }
140
+ this.fontsByFamily.set(font.family, font);
141
+ }
142
+ }
143
+ middleware = (req, res, next) => {
144
+ const url = req.url ?? '';
145
+ if (!this.webDetected && WEB_PLATFORM.test(url)) {
146
+ this.webDetected = true;
147
+ this.schedule([...this.setsByInputDir.values()].filter((set) => set.web), 'web bundle requested');
148
+ }
149
+ const isFontRequest = url.startsWith(exports.FONT_ROUTE) &&
150
+ (req.method === 'GET' || req.method === 'HEAD');
151
+ if (!isFontRequest) {
152
+ next();
153
+ return;
154
+ }
155
+ const family = decodeURIComponent(url.slice(exports.FONT_ROUTE.length).replace(/\.ttf(\?.*)?$/, ''));
156
+ void this.pending.then(() => {
157
+ const font = this.fontsByFamily.get(family);
158
+ if (!font || !node_fs_1.default.existsSync(font.ttfPath)) {
159
+ res.statusCode = 404;
160
+ res.end();
161
+ return;
162
+ }
163
+ res.statusCode = 200;
164
+ res.setHeader('Content-Type', 'font/ttf');
165
+ res.setHeader('Cache-Control', 'no-store');
166
+ if (req.method === 'HEAD') {
167
+ res.end();
168
+ return;
169
+ }
170
+ node_fs_1.default.createReadStream(font.ttfPath).pipe(res);
171
+ });
172
+ };
173
+ }
174
+ exports.FontRebuildWatcher = FontRebuildWatcher;