react-native-nano-icons 0.1.1 → 0.1.3

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 (99) hide show
  1. package/README.md +20 -164
  2. package/android/build.gradle +28 -0
  3. package/android/src/main/java/com/nanoicons/NanoIconView.kt +78 -0
  4. package/android/src/main/java/com/nanoicons/NanoIconViewManager.kt +84 -0
  5. package/android/src/main/java/com/nanoicons/NanoIconsPackage.kt +22 -0
  6. package/ios/NanoIconView.h +4 -0
  7. package/ios/NanoIconView.mm +246 -0
  8. package/lib/commonjs/cli/build.js +1 -1
  9. package/lib/commonjs/cli/config.d.ts +2 -2
  10. package/lib/commonjs/cli/config.js +7 -6
  11. package/lib/commonjs/plugin/src/buildFonts.d.ts +1 -0
  12. package/lib/commonjs/plugin/src/buildFonts.js +9 -0
  13. package/lib/commonjs/plugin/src/index.js +1 -34
  14. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +6 -6
  15. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +11 -15
  16. package/lib/commonjs/scripts/cli.js +15 -5
  17. package/lib/commonjs/src/core/font/compile.d.ts +13 -2
  18. package/lib/commonjs/src/core/font/compile.js +49 -46
  19. package/lib/commonjs/src/core/pipeline/managers.js +19 -3
  20. package/lib/commonjs/src/core/pipeline/run.js +121 -32
  21. package/lib/commonjs/src/core/svg/layers.d.ts +16 -0
  22. package/lib/commonjs/src/core/svg/layers.js +27 -0
  23. package/lib/commonjs/src/core/svg/svg_dom.d.ts +29 -1
  24. package/lib/commonjs/src/core/svg/svg_dom.js +78 -2
  25. package/lib/commonjs/src/core/svg/svg_pathops.d.ts +11 -0
  26. package/lib/commonjs/src/core/svg/svg_pathops.js +209 -19
  27. package/lib/commonjs/src/core/types.d.ts +30 -15
  28. package/lib/module/core/font/compile.js +52 -41
  29. package/lib/module/core/font/compile.js.map +1 -1
  30. package/lib/module/core/pipeline/managers.js +17 -3
  31. package/lib/module/core/pipeline/managers.js.map +1 -1
  32. package/lib/module/core/pipeline/run.js +131 -44
  33. package/lib/module/core/pipeline/run.js.map +1 -1
  34. package/lib/module/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  35. package/lib/module/core/svg/layers.js +34 -0
  36. package/lib/module/core/svg/layers.js.map +1 -1
  37. package/lib/module/core/svg/svg_dom.js +91 -4
  38. package/lib/module/core/svg/svg_dom.js.map +1 -1
  39. package/lib/module/core/svg/svg_pathops.js +203 -19
  40. package/lib/module/core/svg/svg_pathops.js.map +1 -1
  41. package/lib/module/createNanoIconsSet.js +3 -79
  42. package/lib/module/createNanoIconsSet.js.map +1 -1
  43. package/lib/module/createNanoIconsSet.native.js +68 -0
  44. package/lib/module/createNanoIconsSet.native.js.map +1 -0
  45. package/lib/module/createNanoIconsSet.shared.js +91 -0
  46. package/lib/module/createNanoIconsSet.shared.js.map +1 -0
  47. package/lib/module/index.js +1 -2
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/specs/NanoIconViewNativeComponent.ts +15 -0
  50. package/lib/module/types.js +4 -0
  51. package/lib/module/types.js.map +1 -0
  52. package/lib/module/utils/shallowEqualColor.js +15 -0
  53. package/lib/module/utils/shallowEqualColor.js.map +1 -0
  54. package/lib/typescript/src/core/font/compile.d.ts +13 -2
  55. package/lib/typescript/src/core/font/compile.d.ts.map +1 -1
  56. package/lib/typescript/src/core/pipeline/managers.d.ts.map +1 -1
  57. package/lib/typescript/src/core/pipeline/run.d.ts.map +1 -1
  58. package/lib/typescript/src/core/svg/layers.d.ts +16 -0
  59. package/lib/typescript/src/core/svg/layers.d.ts.map +1 -1
  60. package/lib/typescript/src/core/svg/svg_dom.d.ts +29 -1
  61. package/lib/typescript/src/core/svg/svg_dom.d.ts.map +1 -1
  62. package/lib/typescript/src/core/svg/svg_pathops.d.ts +11 -0
  63. package/lib/typescript/src/core/svg/svg_pathops.d.ts.map +1 -1
  64. package/lib/typescript/src/core/types.d.ts +30 -15
  65. package/lib/typescript/src/core/types.d.ts.map +1 -1
  66. package/lib/typescript/src/createNanoIconsSet.d.ts +5 -18
  67. package/lib/typescript/src/createNanoIconsSet.d.ts.map +1 -1
  68. package/lib/typescript/src/createNanoIconsSet.native.d.ts +7 -0
  69. package/lib/typescript/src/createNanoIconsSet.native.d.ts.map +1 -0
  70. package/lib/typescript/src/createNanoIconsSet.shared.d.ts +11 -0
  71. package/lib/typescript/src/createNanoIconsSet.shared.d.ts.map +1 -0
  72. package/lib/typescript/src/index.d.ts.map +1 -1
  73. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts +14 -0
  74. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts.map +1 -0
  75. package/lib/typescript/src/types.d.ts +19 -0
  76. package/lib/typescript/src/types.d.ts.map +1 -0
  77. package/lib/typescript/src/utils/shallowEqualColor.d.ts +4 -0
  78. package/lib/typescript/src/utils/shallowEqualColor.d.ts.map +1 -0
  79. package/package.json +22 -5
  80. package/plugin/src/buildFonts.ts +13 -0
  81. package/plugin/src/index.ts +3 -50
  82. package/plugin/src/withNanoIconsFontLinking.ts +22 -24
  83. package/react-native-nano-icons.podspec +18 -0
  84. package/scripts/cli.ts +14 -5
  85. package/src/core/font/compile.ts +65 -61
  86. package/src/core/pipeline/managers.ts +26 -3
  87. package/src/core/pipeline/run.ts +156 -38
  88. package/src/core/shims/picosvg-0.22.3-py3-none-any.whl +0 -0
  89. package/src/core/svg/layers.ts +44 -0
  90. package/src/core/svg/svg_dom.ts +96 -4
  91. package/src/core/svg/svg_pathops.ts +245 -27
  92. package/src/core/types.ts +21 -10
  93. package/src/createNanoIconsSet.native.tsx +108 -0
  94. package/src/createNanoIconsSet.shared.tsx +121 -0
  95. package/src/createNanoIconsSet.tsx +7 -126
  96. package/src/index.ts +1 -2
  97. package/src/specs/NanoIconViewNativeComponent.ts +15 -0
  98. package/src/types.ts +27 -0
  99. package/src/utils/shallowEqualColor.ts +17 -0
@@ -0,0 +1,15 @@
1
+ import { codegenNativeComponent } from 'react-native';
2
+ import type { CodegenTypes as CT, ViewProps } from 'react-native';
3
+
4
+ export interface NativeProps extends ViewProps {
5
+ fontFamily: string;
6
+ codepoints: ReadonlyArray<CT.Int32>;
7
+ colors: ReadonlyArray<CT.Int32>;
8
+ fontSize: CT.Float;
9
+ advanceWidth: CT.Int32;
10
+ unitsPerEm: CT.Int32;
11
+ iconWidth: CT.Float;
12
+ iconHeight: CT.Float;
13
+ }
14
+
15
+ export default codegenNativeComponent<NativeProps>('NanoIconView');
package/src/types.ts ADDED
@@ -0,0 +1,27 @@
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
+ ref?: Ref<ViewRef>;
22
+ testID?: string;
23
+ };
24
+
25
+ export type IconComponent<GM extends NanoGlyphMapInput> = React.FC<
26
+ IconProps<keyof GM['i']>
27
+ >;
@@ -0,0 +1,17 @@
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
+ }