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.
- package/LICENSES.md +40 -0
- package/README.md +165 -12
- package/android/build.gradle +8 -1
- package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +31 -0
- package/android/src/main/java/com/nanoicons/NanoIconView.kt +103 -19
- package/android/src/main/java/com/nanoicons/NanoIconViewManager.kt +42 -18
- package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +72 -11
- package/android/src/main/jni/CMakeLists.txt +38 -0
- package/android/src/main/jni/RNNanoIconsSpec.h +19 -0
- package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewComponentDescriptor.h +11 -0
- package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewShadowNode.cpp +46 -0
- package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconViewShadowNode.h +41 -0
- package/ios/NanoIconFontResolver.h +5 -0
- package/ios/NanoIconFontResolver.mm +32 -0
- package/ios/NanoIconInlineBaseline.h +4 -0
- package/ios/NanoIconInlineBaseline.mm +190 -0
- package/ios/NanoIconView.h +1 -4
- package/ios/NanoIconView.mm +178 -162
- package/ios/NanoIconsFontLoader.mm +10 -32
- package/lib/commonjs/cli/build.d.ts +16 -3
- package/lib/commonjs/cli/build.js +108 -25
- package/lib/commonjs/cli/buildSymbols.d.ts +26 -0
- package/lib/commonjs/cli/buildSymbols.js +134 -0
- package/lib/commonjs/cli/config.d.ts +4 -2
- package/lib/commonjs/cli/config.js +4 -4
- package/lib/commonjs/cli/expoConfig.d.ts +6 -2
- package/lib/commonjs/cli/expoConfig.js +37 -13
- package/lib/commonjs/cli/index.d.ts +7 -5
- package/lib/commonjs/cli/index.js +27 -14
- package/lib/commonjs/cli/link.d.ts +19 -3
- package/lib/commonjs/cli/link.js +311 -45
- package/lib/commonjs/cli/logger.js +9 -7
- package/lib/commonjs/metro/fontRebuildWatcher.d.ts +62 -0
- package/lib/commonjs/metro/fontRebuildWatcher.js +174 -0
- package/lib/commonjs/metro/index.d.ts +35 -0
- package/lib/commonjs/metro/index.js +92 -0
- package/lib/commonjs/metro/symbolRebuildWatcher.d.ts +19 -0
- package/lib/commonjs/metro/symbolRebuildWatcher.js +76 -0
- package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -3
- package/lib/commonjs/plugin/src/buildFonts.js +5 -15
- package/lib/commonjs/plugin/src/buildSymbols.d.ts +3 -0
- package/lib/commonjs/plugin/src/buildSymbols.js +18 -0
- package/lib/commonjs/plugin/src/index.d.ts +2 -2
- package/lib/commonjs/plugin/src/index.js +10 -4
- package/lib/commonjs/plugin/src/types.d.ts +44 -3
- package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.d.ts +8 -0
- package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.js +29 -0
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +1 -1
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +6 -13
- package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.d.ts +8 -0
- package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.js +37 -0
- package/lib/commonjs/scripts/cli.js +64 -23
- package/lib/commonjs/src/core/flatten/arcs.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/arcs.js +136 -0
- package/lib/commonjs/src/core/flatten/document.d.ts +35 -0
- package/lib/commonjs/src/core/flatten/document.js +164 -0
- package/lib/commonjs/src/core/flatten/dom.d.ts +24 -0
- package/lib/commonjs/src/core/flatten/dom.js +221 -0
- package/lib/commonjs/src/core/flatten/element.d.ts +12 -0
- package/lib/commonjs/src/core/flatten/element.js +97 -0
- package/lib/commonjs/src/core/flatten/geometry.d.ts +21 -0
- package/lib/commonjs/src/core/flatten/geometry.js +85 -0
- package/lib/commonjs/src/core/flatten/index.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/index.js +11 -0
- package/lib/commonjs/src/core/flatten/inherit.d.ts +13 -0
- package/lib/commonjs/src/core/flatten/inherit.js +249 -0
- package/lib/commonjs/src/core/flatten/path.d.ts +19 -0
- package/lib/commonjs/src/core/flatten/path.js +439 -0
- package/lib/commonjs/src/core/flatten/pathops.d.ts +14 -0
- package/lib/commonjs/src/core/flatten/pathops.js +236 -0
- package/lib/commonjs/src/core/flatten/shape.d.ts +29 -0
- package/lib/commonjs/src/core/flatten/shape.js +415 -0
- package/lib/commonjs/src/core/flatten/stages/clip-path.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/clip-path.js +20 -0
- package/lib/commonjs/src/core/flatten/stages/collapse.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/collapse.js +86 -0
- package/lib/commonjs/src/core/flatten/stages/defs.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/defs.js +49 -0
- package/lib/commonjs/src/core/flatten/stages/discard.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/discard.js +50 -0
- package/lib/commonjs/src/core/flatten/stages/fill-rule.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/fill-rule.js +7 -0
- package/lib/commonjs/src/core/flatten/stages/nested-svg.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/nested-svg.js +131 -0
- package/lib/commonjs/src/core/flatten/stages/opacity.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/opacity.js +7 -0
- package/lib/commonjs/src/core/flatten/stages/shapes.d.ts +7 -0
- package/lib/commonjs/src/core/flatten/stages/shapes.js +37 -0
- package/lib/commonjs/src/core/flatten/stages/stroke.d.ts +3 -0
- package/lib/commonjs/src/core/flatten/stages/stroke.js +34 -0
- package/lib/commonjs/src/core/flatten/stages/styles.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/styles.js +29 -0
- package/lib/commonjs/src/core/flatten/stages/use.d.ts +4 -0
- package/lib/commonjs/src/core/flatten/stages/use.js +80 -0
- package/lib/commonjs/src/core/flatten/stages/validate.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages/validate.js +39 -0
- package/lib/commonjs/src/core/flatten/stages.d.ts +2 -0
- package/lib/commonjs/src/core/flatten/stages.js +40 -0
- package/lib/commonjs/src/core/flatten/transform.d.ts +35 -0
- package/lib/commonjs/src/core/flatten/transform.js +221 -0
- package/lib/commonjs/src/core/font/compile.d.ts +2 -1
- package/lib/commonjs/src/core/font/compile.js +19 -7
- package/lib/commonjs/src/core/font/metrics.js +7 -0
- package/lib/commonjs/src/core/font/quadratic.d.ts +2 -0
- package/lib/commonjs/src/core/font/quadratic.js +33 -0
- package/lib/commonjs/src/core/glyph/merge.d.ts +7 -0
- package/lib/commonjs/src/core/glyph/merge.js +59 -0
- package/lib/commonjs/src/core/glyph/parse.d.ts +27 -0
- package/lib/commonjs/src/core/{svg/svg_dom.js → glyph/parse.js} +21 -77
- package/lib/commonjs/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +1 -13
- package/lib/commonjs/src/core/{svg/layers.js → glyph/placement.js} +0 -17
- package/lib/commonjs/src/core/glyph/validate.d.ts +8 -0
- package/lib/commonjs/src/core/glyph/validate.js +33 -0
- package/lib/commonjs/src/core/pathkit/contours.d.ts +75 -0
- package/lib/commonjs/src/core/{svg/svg_pathops.js → pathkit/contours.js} +79 -301
- package/lib/commonjs/src/core/pathkit/evenodd.d.ts +12 -0
- package/lib/commonjs/src/core/pathkit/evenodd.js +37 -0
- package/lib/commonjs/src/core/pathkit/load.d.ts +2 -0
- package/lib/commonjs/src/core/pathkit/load.js +26 -0
- package/lib/commonjs/src/core/pathkit/types.d.ts +69 -0
- package/lib/commonjs/src/core/pathkit/types.js +2 -0
- package/lib/commonjs/src/core/pathkit/winding.d.ts +4 -0
- package/lib/commonjs/src/core/pathkit/winding.js +59 -0
- package/lib/commonjs/src/core/pipeline/config.d.ts +2 -0
- package/lib/commonjs/src/core/pipeline/config.js +6 -0
- package/lib/commonjs/src/core/pipeline/iconPool.d.ts +14 -0
- package/lib/commonjs/src/core/pipeline/iconPool.js +109 -0
- package/lib/commonjs/src/core/pipeline/index.d.ts +5 -3
- package/lib/commonjs/src/core/pipeline/index.js +8 -5
- package/lib/commonjs/src/core/pipeline/prepare.d.ts +20 -0
- package/lib/commonjs/src/core/pipeline/prepare.js +74 -0
- package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +25 -0
- package/lib/commonjs/src/core/pipeline/prepareIcon.js +81 -0
- package/lib/commonjs/src/core/pipeline/prepareSvg.d.ts +6 -0
- package/lib/commonjs/src/core/pipeline/prepareSvg.js +11 -0
- package/lib/commonjs/src/core/pipeline/prepareSymbol.d.ts +26 -0
- package/lib/commonjs/src/core/pipeline/prepareSymbol.js +79 -0
- package/lib/commonjs/src/core/pipeline/prepareWorker.d.ts +1 -0
- package/lib/commonjs/src/core/pipeline/prepareWorker.js +12 -0
- package/lib/commonjs/src/core/pipeline/preparedSvgCache.d.ts +6 -0
- package/lib/commonjs/src/core/pipeline/preparedSvgCache.js +44 -0
- package/lib/commonjs/src/core/pipeline/runFontPipeline.d.ts +22 -0
- package/lib/commonjs/src/core/pipeline/runFontPipeline.js +111 -0
- package/lib/commonjs/src/core/pipeline/runSymbolPipeline.d.ts +54 -0
- package/lib/commonjs/src/core/pipeline/runSymbolPipeline.js +161 -0
- package/lib/commonjs/src/core/symbols/contents.d.ts +2 -0
- package/lib/commonjs/src/core/symbols/contents.js +15 -0
- package/lib/commonjs/src/core/symbols/knockout.d.ts +3 -0
- package/lib/commonjs/src/core/symbols/knockout.js +51 -0
- package/lib/commonjs/src/core/symbols/layers.d.ts +36 -0
- package/lib/commonjs/src/core/symbols/layers.js +182 -0
- package/lib/commonjs/src/core/symbols/template.d.ts +22 -0
- package/lib/commonjs/src/core/symbols/template.js +140 -0
- package/lib/commonjs/src/core/symbols/vectorDrawable.d.ts +11 -0
- package/lib/commonjs/src/core/symbols/vectorDrawable.js +66 -0
- package/lib/commonjs/src/core/types.d.ts +3 -92
- package/lib/commonjs/src/utils/fingerPrint.d.ts +19 -1
- package/lib/commonjs/src/utils/fingerPrint.js +29 -3
- package/lib/commonjs/src/utils/fontIdentity.d.ts +4 -0
- package/lib/commonjs/src/utils/fontIdentity.js +24 -0
- package/lib/commonjs/src/utils/naming.d.ts +10 -0
- package/lib/commonjs/src/utils/naming.js +49 -0
- package/lib/commonjs/src/utils/packageVersion.d.ts +2 -0
- package/lib/commonjs/src/utils/packageVersion.js +37 -0
- package/lib/commonjs/src/utils/parse.d.ts +0 -1
- package/lib/commonjs/src/utils/parse.js +0 -8
- package/lib/commonjs/src/utils/svgPatterns.d.ts +38 -0
- package/lib/commonjs/src/utils/svgPatterns.js +46 -0
- package/lib/module/const/codegenPrimitives.js +1 -2
- package/lib/module/const/colors.js +1 -2
- package/lib/module/createNanoIconsSet.js +1 -2
- package/lib/module/createNanoIconsSet.native.js +38 -28
- package/lib/module/createNanoIconsSet.shared.js +15 -9
- package/lib/module/createNanoIconsSet.web.js +22 -8
- package/lib/module/devServerFont.js +30 -0
- package/lib/module/devServerFont.web.js +25 -0
- package/lib/module/fontIntegrity.js +99 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.node.js +1 -2
- package/lib/module/loadDynamicFont.js +20 -10
- package/lib/module/nativeFontLoader.js +3 -0
- package/lib/module/nativeFontLoader.web.js +3 -0
- package/lib/module/specs/NanoIconViewNativeComponent.ts +9 -6
- package/lib/module/specs/NativeNanoIconsFontLoader.js +1 -2
- package/lib/module/symbols/index.android.js +42 -0
- package/lib/module/symbols/index.ios.js +35 -0
- package/lib/module/symbols/index.js +35 -0
- package/lib/module/symbols/index.native.js +12 -0
- package/lib/module/symbols/types.js +1 -0
- package/lib/module/types.js +1 -2
- package/lib/module/utils/fingerPrint.js +20 -5
- package/lib/module/utils/fontIdentity.js +20 -0
- package/lib/module/utils/glyphRuntime.js +36 -3
- package/lib/module/utils/naming.js +46 -0
- package/lib/module/utils/packageVersion.js +29 -0
- package/lib/module/utils/parse.js +1 -9
- package/lib/module/utils/runtimeLog.js +12 -0
- package/lib/module/utils/shallowEqualColor.js +1 -2
- package/lib/module/utils/svgPatterns.js +49 -0
- package/lib/module/utils/validateLayerColor.js +24 -0
- package/lib/typescript/src/core/flatten/arcs.d.ts +3 -0
- package/lib/typescript/src/core/flatten/document.d.ts +36 -0
- package/lib/typescript/src/core/flatten/dom.d.ts +25 -0
- package/lib/typescript/src/core/flatten/element.d.ts +13 -0
- package/lib/typescript/src/core/flatten/geometry.d.ts +22 -0
- package/lib/typescript/src/core/flatten/index.d.ts +3 -0
- package/lib/typescript/src/core/flatten/inherit.d.ts +14 -0
- package/lib/typescript/src/core/flatten/path.d.ts +20 -0
- package/lib/typescript/src/core/flatten/pathops.d.ts +15 -0
- package/lib/typescript/src/core/flatten/shape.d.ts +30 -0
- package/lib/typescript/src/core/flatten/stages/clip-path.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/collapse.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/defs.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/discard.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/fill-rule.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/nested-svg.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/opacity.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/shapes.d.ts +8 -0
- package/lib/typescript/src/core/flatten/stages/stroke.d.ts +4 -0
- package/lib/typescript/src/core/flatten/stages/styles.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages/use.d.ts +5 -0
- package/lib/typescript/src/core/flatten/stages/validate.d.ts +3 -0
- package/lib/typescript/src/core/flatten/stages.d.ts +3 -0
- package/lib/typescript/src/core/flatten/transform.d.ts +36 -0
- package/lib/typescript/src/core/glyph/merge.d.ts +8 -0
- package/lib/typescript/src/core/glyph/parse.d.ts +28 -0
- package/lib/typescript/src/core/{svg/layers.d.ts → glyph/placement.d.ts} +2 -14
- package/lib/typescript/src/core/glyph/validate.d.ts +9 -0
- package/lib/typescript/src/core/pathkit/contours.d.ts +76 -0
- package/lib/typescript/src/core/pathkit/evenodd.d.ts +13 -0
- package/lib/typescript/src/core/pathkit/load.d.ts +3 -0
- package/lib/typescript/src/core/pathkit/types.d.ts +70 -0
- package/lib/typescript/src/core/pathkit/winding.d.ts +5 -0
- package/lib/typescript/src/core/symbols/contents.d.ts +3 -0
- package/lib/typescript/src/core/symbols/knockout.d.ts +4 -0
- package/lib/typescript/src/core/symbols/layers.d.ts +37 -0
- package/lib/typescript/src/core/symbols/template.d.ts +23 -0
- package/lib/typescript/src/core/symbols/vectorDrawable.d.ts +12 -0
- package/lib/typescript/src/core/types.d.ts +3 -92
- package/lib/typescript/src/devServerFont.d.ts +4 -0
- package/lib/typescript/src/devServerFont.web.d.ts +4 -0
- package/lib/typescript/src/fontIntegrity.d.ts +24 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/loadDynamicFont.d.ts +1 -0
- package/lib/typescript/src/nativeFontLoader.d.ts +2 -0
- package/lib/typescript/src/nativeFontLoader.web.d.ts +3 -0
- package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts +6 -5
- package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
- package/lib/typescript/src/symbols/index.android.d.ts +33 -0
- package/lib/typescript/src/symbols/index.d.ts +31 -0
- package/lib/typescript/src/symbols/index.ios.d.ts +31 -0
- package/lib/typescript/src/symbols/index.native.d.ts +8 -0
- package/lib/typescript/src/symbols/types.d.ts +24 -0
- package/lib/typescript/src/types.d.ts +7 -0
- package/lib/typescript/src/utils/fingerPrint.d.ts +19 -1
- package/lib/typescript/src/utils/fontIdentity.d.ts +5 -0
- package/lib/typescript/src/utils/glyphRuntime.d.ts +3 -1
- package/lib/typescript/src/utils/naming.d.ts +11 -0
- package/lib/typescript/src/utils/packageVersion.d.ts +3 -0
- package/lib/typescript/src/utils/parse.d.ts +0 -1
- package/lib/typescript/src/utils/runtimeLog.d.ts +5 -0
- package/lib/typescript/src/utils/svgPatterns.d.ts +39 -0
- package/lib/typescript/src/utils/validateLayerColor.d.ts +3 -0
- package/metro.js +1 -0
- package/package.json +37 -11
- package/react-native-nano-icons.podspec +4 -1
- package/react-native.config.js +10 -0
- package/src/specs/NanoIconViewNativeComponent.ts +9 -6
- package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
- package/lib/commonjs/src/core/pipeline/managers.d.ts +0 -11
- package/lib/commonjs/src/core/pipeline/managers.js +0 -104
- package/lib/commonjs/src/core/pipeline/run.d.ts +0 -14
- package/lib/commonjs/src/core/pipeline/run.js +0 -189
- package/lib/commonjs/src/core/svg/svg_dom.d.ts +0 -51
- package/lib/commonjs/src/core/svg/svg_pathops.d.ts +0 -32
- package/lib/module/const/codegenPrimitives.js.map +0 -1
- package/lib/module/const/colors.js.map +0 -1
- package/lib/module/core/font/compile.js +0 -81
- package/lib/module/core/font/compile.js.map +0 -1
- package/lib/module/core/font/metrics.js +0 -37
- package/lib/module/core/font/metrics.js.map +0 -1
- package/lib/module/core/pipeline/config.js +0 -20
- package/lib/module/core/pipeline/config.js.map +0 -1
- package/lib/module/core/pipeline/index.js +0 -5
- package/lib/module/core/pipeline/index.js.map +0 -1
- package/lib/module/core/pipeline/managers.js +0 -94
- package/lib/module/core/pipeline/managers.js.map +0 -1
- package/lib/module/core/pipeline/run.js +0 -204
- package/lib/module/core/pipeline/run.js.map +0 -1
- package/lib/module/core/shims/pathops.py +0 -181
- package/lib/module/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
- package/lib/module/core/svg/layers.js +0 -85
- package/lib/module/core/svg/layers.js.map +0 -1
- package/lib/module/core/svg/svg_dom.js +0 -170
- package/lib/module/core/svg/svg_dom.js.map +0 -1
- package/lib/module/core/svg/svg_pathops.js +0 -750
- package/lib/module/core/svg/svg_pathops.js.map +0 -1
- package/lib/module/core/tsconfig.json +0 -32
- package/lib/module/core/types.js +0 -2
- package/lib/module/core/types.js.map +0 -1
- package/lib/module/createNanoIconsSet.js.map +0 -1
- package/lib/module/createNanoIconsSet.native.js.map +0 -1
- package/lib/module/createNanoIconsSet.shared.js.map +0 -1
- package/lib/module/createNanoIconsSet.web.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/index.node.js.map +0 -1
- package/lib/module/loadDynamicFont.js.map +0 -1
- package/lib/module/specs/NativeNanoIconsFontLoader.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/fingerPrint.js.map +0 -1
- package/lib/module/utils/glyphRuntime.js.map +0 -1
- package/lib/module/utils/parse.js.map +0 -1
- package/lib/module/utils/shallowEqualColor.js.map +0 -1
- package/lib/typescript/__tests__/build.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/build.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/clippath.e2e.test.d.ts +0 -3
- package/lib/typescript/__tests__/clippath.e2e.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/fingerprint.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/fingerprint.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts +0 -2
- package/lib/typescript/__tests__/glyphRuntime.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/link.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/link.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts +0 -2
- package/lib/typescript/__tests__/loadDynamicFont.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/pipeline.e2e.test.d.ts +0 -3
- package/lib/typescript/__tests__/pipeline.e2e.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/placement.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/placement.unit.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/svg_dom.unit.test.d.ts +0 -3
- package/lib/typescript/__tests__/svg_dom.unit.test.d.ts.map +0 -1
- package/lib/typescript/cli/build.d.ts +0 -32
- package/lib/typescript/cli/build.d.ts.map +0 -1
- package/lib/typescript/cli/link.d.ts +0 -12
- package/lib/typescript/cli/link.d.ts.map +0 -1
- package/lib/typescript/cli/logger.d.ts +0 -28
- package/lib/typescript/cli/logger.d.ts.map +0 -1
- package/lib/typescript/src/const/codegenPrimitives.d.ts.map +0 -1
- package/lib/typescript/src/const/colors.d.ts.map +0 -1
- package/lib/typescript/src/core/font/compile.d.ts +0 -21
- package/lib/typescript/src/core/font/compile.d.ts.map +0 -1
- package/lib/typescript/src/core/font/metrics.d.ts +0 -2
- package/lib/typescript/src/core/font/metrics.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/config.d.ts +0 -16
- package/lib/typescript/src/core/pipeline/config.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/index.d.ts +0 -4
- package/lib/typescript/src/core/pipeline/index.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/managers.d.ts +0 -12
- package/lib/typescript/src/core/pipeline/managers.d.ts.map +0 -1
- package/lib/typescript/src/core/pipeline/run.d.ts +0 -15
- package/lib/typescript/src/core/pipeline/run.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/layers.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/svg_dom.d.ts +0 -52
- package/lib/typescript/src/core/svg/svg_dom.d.ts.map +0 -1
- package/lib/typescript/src/core/svg/svg_pathops.d.ts +0 -33
- package/lib/typescript/src/core/svg/svg_pathops.d.ts.map +0 -1
- package/lib/typescript/src/core/types.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.native.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.shared.d.ts.map +0 -1
- package/lib/typescript/src/createNanoIconsSet.web.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/index.node.d.ts.map +0 -1
- package/lib/typescript/src/loadDynamicFont.d.ts.map +0 -1
- package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/utils/fingerPrint.d.ts.map +0 -1
- package/lib/typescript/src/utils/glyphRuntime.d.ts.map +0 -1
- package/lib/typescript/src/utils/parse.d.ts.map +0 -1
- package/lib/typescript/src/utils/shallowEqualColor.d.ts.map +0 -1
- package/plugin/src/buildFonts.ts +0 -42
- package/plugin/src/index.ts +0 -21
- package/plugin/src/types.ts +0 -42
- package/plugin/src/withNanoIconsFontLinking.ts +0 -136
- package/plugin/tsconfig.json +0 -9
- package/scripts/cli.ts +0 -63
- package/scripts/tsconfig.json +0 -25
- package/src/const/colors.ts +0 -150
- package/src/core/font/compile.ts +0 -99
- package/src/core/font/metrics.ts +0 -44
- package/src/core/pipeline/config.ts +0 -25
- package/src/core/pipeline/index.ts +0 -3
- package/src/core/pipeline/managers.ts +0 -132
- package/src/core/pipeline/run.ts +0 -274
- package/src/core/shims/pathops.py +0 -181
- package/src/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
- package/src/core/svg/layers.ts +0 -110
- package/src/core/svg/svg_dom.ts +0 -194
- package/src/core/svg/svg_pathops.ts +0 -1040
- package/src/core/tsconfig.json +0 -32
- package/src/core/types.ts +0 -157
- package/src/createNanoIconsSet.native.tsx +0 -192
- package/src/createNanoIconsSet.shared.tsx +0 -174
- package/src/createNanoIconsSet.tsx +0 -20
- package/src/createNanoIconsSet.web.tsx +0 -109
- package/src/index.node.ts +0 -14
- package/src/index.ts +0 -6
- package/src/loadDynamicFont.ts +0 -162
- package/src/types.ts +0 -31
- package/src/utils/fingerPrint.ts +0 -20
- package/src/utils/glyphRuntime.ts +0 -46
- package/src/utils/parse.ts +0 -67
- package/src/utils/shallowEqualColor.ts +0 -17
package/src/loadDynamicFont.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'react';
|
|
2
|
-
import { Image, Platform } from 'react-native';
|
|
3
|
-
import NanoIconsFontLoader from './specs/NativeNanoIconsFontLoader';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Runtime registration of dynamically-linked (`l:"d"`) fonts.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
type FontStatus = 'loading' | 'ready' | 'error';
|
|
10
|
-
|
|
11
|
-
const statusByFamily = new Map<string, FontStatus>();
|
|
12
|
-
const inFlight = new Map<string, Promise<void>>();
|
|
13
|
-
const listeners = new Set<() => void>();
|
|
14
|
-
|
|
15
|
-
function emit(): void {
|
|
16
|
-
for (const l of listeners) l();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function setStatus(family: string, status: FontStatus): void {
|
|
20
|
-
statusByFamily.set(family, status);
|
|
21
|
-
emit();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function getFontStatus(family: string): FontStatus | undefined {
|
|
25
|
-
return statusByFamily.get(family);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** A font source: a require()'d module, an { uri }, or a path/uri string. */
|
|
29
|
-
export type FontSource = number | string | { uri: string };
|
|
30
|
-
|
|
31
|
-
export function resolveFontUri(font: unknown): string {
|
|
32
|
-
if (typeof font === 'number') {
|
|
33
|
-
const source = Image.resolveAssetSource(font);
|
|
34
|
-
if (!source?.uri) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
'[react-native-nano-icons] Could not resolve the font asset to a uri.'
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return source.uri;
|
|
40
|
-
}
|
|
41
|
-
if (typeof font === 'string') return font;
|
|
42
|
-
if (
|
|
43
|
-
font != null &&
|
|
44
|
-
typeof font === 'object' &&
|
|
45
|
-
typeof (font as { uri?: unknown }).uri === 'string'
|
|
46
|
-
) {
|
|
47
|
-
return (font as { uri: string }).uri;
|
|
48
|
-
}
|
|
49
|
-
throw new Error(
|
|
50
|
-
'[react-native-nano-icons] Unsupported font source. Pass require("Foo.ttf"), { uri }, or a path string.'
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function register(family: string, uri: string): Promise<void> {
|
|
55
|
-
if (Platform.OS === 'web') {
|
|
56
|
-
// Browser FontFace API. Typed loosely so this compiles under both the RN-only
|
|
57
|
-
// lib config and a DOM-aware app config without depending on the DOM lib.
|
|
58
|
-
const g = globalThis as unknown as {
|
|
59
|
-
FontFace?: new (
|
|
60
|
-
family: string,
|
|
61
|
-
source: string
|
|
62
|
-
) => {
|
|
63
|
-
load(): Promise<unknown>;
|
|
64
|
-
};
|
|
65
|
-
document?: { fonts?: { add(face: unknown): void } };
|
|
66
|
-
};
|
|
67
|
-
if (!g.FontFace || !g.document?.fonts) {
|
|
68
|
-
throw new Error(
|
|
69
|
-
'[react-native-nano-icons] FontFace API unavailable; cannot load dynamic font on this platform.'
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
const face = new g.FontFace(family, `url(${uri})`);
|
|
73
|
-
await face.load();
|
|
74
|
-
g.document.fonts.add(face);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!NanoIconsFontLoader) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
'[react-native-nano-icons] Native font loader is unavailable (Expo Go or module not built). ' +
|
|
81
|
-
'Load the font yourself, or use a development/production build.'
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
await NanoIconsFontLoader.registerFont(family, uri);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Register `font` under `family`. Concurrent calls share one in-flight load.
|
|
89
|
-
* Once settled, a later call retries after an error or no-ops if already
|
|
90
|
-
* registered — unless `opts.force` re-registers (used by the explicit `loadFont`).
|
|
91
|
-
*/
|
|
92
|
-
export function loadDynamicFont(
|
|
93
|
-
family: string,
|
|
94
|
-
font: unknown,
|
|
95
|
-
opts?: { force?: boolean }
|
|
96
|
-
): Promise<void> {
|
|
97
|
-
// Dedupe concurrent calls.
|
|
98
|
-
const existing = inFlight.get(family);
|
|
99
|
-
if (existing) return existing;
|
|
100
|
-
|
|
101
|
-
// Already registered → skip, unless the caller forces a reload.
|
|
102
|
-
if (!opts?.force && statusByFamily.get(family) === 'ready') {
|
|
103
|
-
return Promise.resolve();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
setStatus(family, 'loading');
|
|
107
|
-
|
|
108
|
-
const run = async (): Promise<void> => {
|
|
109
|
-
try {
|
|
110
|
-
await register(family, resolveFontUri(font));
|
|
111
|
-
setStatus(family, 'ready');
|
|
112
|
-
} catch (err) {
|
|
113
|
-
setStatus(family, 'error');
|
|
114
|
-
throw err;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const tracked = run();
|
|
119
|
-
|
|
120
|
-
// Release the slot once settled so later calls can retry/reload
|
|
121
|
-
inFlight.set(
|
|
122
|
-
family,
|
|
123
|
-
(async () => {
|
|
124
|
-
try {
|
|
125
|
-
await tracked;
|
|
126
|
-
} catch {
|
|
127
|
-
// status already reflects the failure
|
|
128
|
-
} finally {
|
|
129
|
-
inFlight.delete(family);
|
|
130
|
-
}
|
|
131
|
-
})()
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
return tracked;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Subscribe a component to a family's load state. Returns `true` while a managed
|
|
139
|
-
* font is still loading (so the icon should hide), `false` otherwise (ready,
|
|
140
|
-
* errored, or not managed by us).
|
|
141
|
-
*/
|
|
142
|
-
export function useDynamicFontPending(
|
|
143
|
-
managed: boolean,
|
|
144
|
-
family: string
|
|
145
|
-
): boolean {
|
|
146
|
-
const status = useSyncExternalStore(
|
|
147
|
-
(cb) => {
|
|
148
|
-
listeners.add(cb);
|
|
149
|
-
return () => listeners.delete(cb);
|
|
150
|
-
},
|
|
151
|
-
() => (managed ? statusByFamily.get(family) : undefined),
|
|
152
|
-
() => undefined
|
|
153
|
-
);
|
|
154
|
-
return managed && status === 'loading';
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Test-only: reset module state between tests. */
|
|
158
|
-
export function __resetDynamicFontsForTests(): void {
|
|
159
|
-
statusByFamily.clear();
|
|
160
|
-
inFlight.clear();
|
|
161
|
-
listeners.clear();
|
|
162
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ComponentRef, Ref } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
AccessibilityRole,
|
|
4
|
-
ColorValue,
|
|
5
|
-
View,
|
|
6
|
-
ViewStyle,
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
import type { NanoGlyphMapInput } from './core/types';
|
|
9
|
-
|
|
10
|
-
type ViewRef = ComponentRef<typeof View>;
|
|
11
|
-
|
|
12
|
-
export type IconProps<Name> = {
|
|
13
|
-
name: Name;
|
|
14
|
-
size?: number;
|
|
15
|
-
color?: ColorValue | ColorValue[];
|
|
16
|
-
allowFontScaling?: boolean;
|
|
17
|
-
style?: ViewStyle;
|
|
18
|
-
accessible?: boolean;
|
|
19
|
-
accessibilityLabel?: string;
|
|
20
|
-
accessibilityRole?: AccessibilityRole;
|
|
21
|
-
accessibilityElementsHidden?: boolean; // iOS
|
|
22
|
-
importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants'; // Android
|
|
23
|
-
ref?: Ref<ViewRef>;
|
|
24
|
-
testID?: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type IconComponent<GM extends NanoGlyphMapInput> = React.FC<
|
|
28
|
-
IconProps<keyof GM['i']>
|
|
29
|
-
> & {
|
|
30
|
-
loadFont: (font?: number | string | { uri: string }) => Promise<void>;
|
|
31
|
-
};
|
package/src/utils/fingerPrint.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const crypto = require('crypto');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
export function getFingerprintSync(dir: string): string {
|
|
6
|
-
const files = fs
|
|
7
|
-
.readdirSync(dir)
|
|
8
|
-
.filter((f: string) => f.endsWith('.svg'))
|
|
9
|
-
.sort();
|
|
10
|
-
const hash = crypto.createHash('sha256');
|
|
11
|
-
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
const filePath = path.join(dir, file);
|
|
14
|
-
// Hash both path and content
|
|
15
|
-
hash.update(file);
|
|
16
|
-
hash.update(fs.readFileSync(filePath));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return hash.digest('hex');
|
|
20
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ColorValue } from 'react-native';
|
|
2
|
-
import type { NanoGlyphMapInput, GlyphEntry } from '../core/types';
|
|
3
|
-
|
|
4
|
-
/** Default icon size (px) shared by every platform renderer. */
|
|
5
|
-
export const DEFAULT_ICON_SIZE = 12;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Look up a glyph entry by name, falling back to a single '?' layer
|
|
9
|
-
* (codepoint 63) sized to the font's em when the name is unknown.
|
|
10
|
-
*/
|
|
11
|
-
export function resolveGlyphEntry<GM extends NanoGlyphMapInput>(
|
|
12
|
-
glyphMap: GM,
|
|
13
|
-
name: keyof GM['i']
|
|
14
|
-
): GlyphEntry {
|
|
15
|
-
return (glyphMap.i[name as string] ?? [
|
|
16
|
-
glyphMap.m.u,
|
|
17
|
-
[[63, 'black']],
|
|
18
|
-
]) as GlyphEntry;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** A memoized codepoint -> string converter, scoped per icon set. */
|
|
22
|
-
export function createCharCache(): (codepoint: number) => string {
|
|
23
|
-
const cache = new Map<number, string>();
|
|
24
|
-
return (codepoint) => {
|
|
25
|
-
let ch = cache.get(codepoint);
|
|
26
|
-
if (ch === undefined) {
|
|
27
|
-
ch = String.fromCodePoint(codepoint);
|
|
28
|
-
cache.set(codepoint, ch);
|
|
29
|
-
}
|
|
30
|
-
return ch;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Build a per-layer color resolver for one render: an explicit per-index
|
|
36
|
-
* color wins, else the last supplied palette color spills onto remaining
|
|
37
|
-
* layers, else the glyph's own source color, else black.
|
|
38
|
-
*/
|
|
39
|
-
export function createLayerColorResolver(
|
|
40
|
-
color: ColorValue | ColorValue[] | undefined
|
|
41
|
-
): (index: number, srcColor: string | undefined) => ColorValue {
|
|
42
|
-
const colorArray = Array.isArray(color) ? color : [color];
|
|
43
|
-
const lastPaletteColor = colorArray[colorArray.length - 1];
|
|
44
|
-
return (index, srcColor) =>
|
|
45
|
-
colorArray[index] ?? lastPaletteColor ?? srcColor ?? 'black';
|
|
46
|
-
}
|
package/src/utils/parse.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { CSS_NAMED_COLORS } from '../const/colors';
|
|
2
|
-
|
|
3
|
-
// e.g. u0041.svg -> 65
|
|
4
|
-
export function parseCodepointFromFilename(filename: string): number {
|
|
5
|
-
const m = /^u([0-9a-fA-F]+)\.svg$/.exec(filename);
|
|
6
|
-
if (!m) throw new Error(`Unexpected glyph filename: ${filename}`);
|
|
7
|
-
return parseInt(m[1]!, 16);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// e.g. #ff0000 -> [255, 0, 0, 1], rgba(255, 0, 0, 0.5) -> [255, 0, 0, 0.5], rgb(255, 0, 0) -> [255, 0, 0, 1], blue -> [0, 0, 255, 1] etc.
|
|
11
|
-
export function parseColor(
|
|
12
|
-
color: string
|
|
13
|
-
): [r: number, g: number, b: number, a: number] {
|
|
14
|
-
const c = color.trim();
|
|
15
|
-
|
|
16
|
-
// rgba(r,g,b,a)
|
|
17
|
-
if (c.indexOf('rgba(') === 0) {
|
|
18
|
-
const inner = c.slice(5, c.indexOf(')'));
|
|
19
|
-
const p = inner.split(',');
|
|
20
|
-
return [+(p[0] ?? '0'), +(p[1] ?? '0'), +(p[2] ?? '0'), +(p[3] ?? '1')];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// rgb(r,g,b)
|
|
24
|
-
if (c.indexOf('rgb(') === 0) {
|
|
25
|
-
const inner = c.slice(4, c.indexOf(')'));
|
|
26
|
-
const p = inner.split(',');
|
|
27
|
-
return [+(p[0] ?? '0'), +(p[1] ?? '0'), +(p[2] ?? '0'), 1];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// hex — first char is '#' (charCode 35)
|
|
31
|
-
if (c.charCodeAt(0) === 35) {
|
|
32
|
-
if (c.length === 9) {
|
|
33
|
-
// #rrggbbaa
|
|
34
|
-
return [
|
|
35
|
-
parseInt(c.slice(1, 3), 16),
|
|
36
|
-
parseInt(c.slice(3, 5), 16),
|
|
37
|
-
parseInt(c.slice(5, 7), 16),
|
|
38
|
-
parseInt(c.slice(7, 9), 16) / 255,
|
|
39
|
-
];
|
|
40
|
-
}
|
|
41
|
-
if (c.length === 7) {
|
|
42
|
-
// #rrggbb
|
|
43
|
-
return [
|
|
44
|
-
parseInt(c.slice(1, 3), 16),
|
|
45
|
-
parseInt(c.slice(3, 5), 16),
|
|
46
|
-
parseInt(c.slice(5, 7), 16),
|
|
47
|
-
1,
|
|
48
|
-
];
|
|
49
|
-
}
|
|
50
|
-
if (c.length === 4) {
|
|
51
|
-
// #rgb — expand each nibble × 17
|
|
52
|
-
return [
|
|
53
|
-
parseInt(c.slice(1, 2), 16) * 17,
|
|
54
|
-
parseInt(c.slice(2, 3), 16) * 17,
|
|
55
|
-
parseInt(c.slice(3, 4), 16) * 17,
|
|
56
|
-
1,
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// named color lookup (O(1))
|
|
62
|
-
const named = CSS_NAMED_COLORS[c.toLowerCase()];
|
|
63
|
-
if (named !== undefined) return [named[0], named[1], named[2], 1];
|
|
64
|
-
|
|
65
|
-
// unknown — SVG default is opaque black
|
|
66
|
-
return [0, 0, 0, 1];
|
|
67
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ColorValue } from 'react-native';
|
|
2
|
-
|
|
3
|
-
/** Shallow-compare two color props (single value or array) instead of arr ref for memo equality. */
|
|
4
|
-
export function shallowEqualColor(
|
|
5
|
-
a: ColorValue | ColorValue[] | undefined,
|
|
6
|
-
b: ColorValue | ColorValue[] | undefined
|
|
7
|
-
): boolean {
|
|
8
|
-
if (a === b) return true;
|
|
9
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
10
|
-
if (a.length !== b.length) return false;
|
|
11
|
-
for (let i = 0; i < a.length; i++) {
|
|
12
|
-
if (a[i] !== b[i]) return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}
|