react-native-nano-icons 1.0.1 → 1.1.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 (138) hide show
  1. package/README.md +139 -21
  2. package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +15 -0
  3. package/android/src/main/java/com/nanoicons/NanoIconView.kt +27 -4
  4. package/android/src/main/java/com/nanoicons/NanoIconViewManager.kt +7 -0
  5. package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +3 -0
  6. package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconProps.cpp +6 -1
  7. package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconProps.h +4 -2
  8. package/ios/NanoIconView.mm +34 -44
  9. package/ios/NanoIconsFontLoader.mm +5 -0
  10. package/lib/commonjs/cli/build.d.ts +26 -0
  11. package/lib/commonjs/cli/build.js +174 -64
  12. package/lib/commonjs/cli/buildSymbols.d.ts +30 -1
  13. package/lib/commonjs/cli/buildSymbols.js +120 -42
  14. package/lib/commonjs/cli/expoConfig.d.ts +11 -0
  15. package/lib/commonjs/cli/expoConfig.js +28 -9
  16. package/lib/commonjs/cli/fingerprint.d.ts +15 -0
  17. package/lib/commonjs/cli/fingerprint.js +42 -0
  18. package/lib/commonjs/cli/index.d.ts +2 -2
  19. package/lib/commonjs/cli/index.js +3 -1
  20. package/lib/commonjs/cli/link.d.ts +4 -0
  21. package/lib/commonjs/cli/link.js +38 -1
  22. package/lib/commonjs/cli/sameOutputs.d.ts +5 -0
  23. package/lib/commonjs/cli/sameOutputs.js +45 -0
  24. package/lib/commonjs/index.node.js +1 -1
  25. package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -2
  26. package/lib/commonjs/plugin/src/buildFonts.js +11 -3
  27. package/lib/commonjs/plugin/src/buildSymbols.d.ts +2 -2
  28. package/lib/commonjs/plugin/src/buildSymbols.js +10 -3
  29. package/lib/commonjs/plugin/src/frozen.d.ts +3 -0
  30. package/lib/commonjs/plugin/src/frozen.js +18 -0
  31. package/lib/commonjs/plugin/src/index.js +3 -3
  32. package/lib/commonjs/plugin/src/types.d.ts +22 -1
  33. package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.d.ts +1 -1
  34. package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.js +2 -2
  35. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +3 -3
  36. package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +8 -8
  37. package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.d.ts +1 -1
  38. package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.js +2 -2
  39. package/lib/commonjs/scripts/cli.js +31 -2
  40. package/lib/commonjs/src/core/flatten/dom.js +40 -5
  41. package/lib/commonjs/src/core/flatten/element.js +2 -1
  42. package/lib/commonjs/src/core/flatten/stages/collapse.js +12 -0
  43. package/lib/commonjs/src/core/font/compile.d.ts +0 -1
  44. package/lib/commonjs/src/core/font/compile.js +2 -8
  45. package/lib/commonjs/src/core/glyph/merge.d.ts +2 -1
  46. package/lib/commonjs/src/core/glyph/merge.js +27 -36
  47. package/lib/commonjs/src/core/glyph/parse.d.ts +1 -2
  48. package/lib/commonjs/src/core/glyph/parse.js +31 -18
  49. package/lib/commonjs/src/core/glyph/placement.d.ts +1 -0
  50. package/lib/commonjs/src/core/glyph/placement.js +9 -3
  51. package/lib/commonjs/src/core/pathkit/types.d.ts +1 -0
  52. package/lib/commonjs/src/core/pathkit/winding.d.ts +14 -3
  53. package/lib/commonjs/src/core/pathkit/winding.js +434 -7
  54. package/lib/commonjs/src/core/pipeline/config.d.ts +1 -0
  55. package/lib/commonjs/src/core/pipeline/prepare.d.ts +1 -1
  56. package/lib/commonjs/src/core/pipeline/prepare.js +4 -16
  57. package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +1 -0
  58. package/lib/commonjs/src/core/pipeline/prepareIcon.js +3 -1
  59. package/lib/commonjs/src/core/pipeline/prepareSymbol.d.ts +2 -0
  60. package/lib/commonjs/src/core/pipeline/prepareSymbol.js +15 -3
  61. package/lib/commonjs/src/core/pipeline/preparedSvgCache.js +2 -2
  62. package/lib/commonjs/src/core/pipeline/runFontPipeline.js +20 -12
  63. package/lib/commonjs/src/core/pipeline/runSymbolPipeline.d.ts +2 -0
  64. package/lib/commonjs/src/core/pipeline/runSymbolPipeline.js +2 -0
  65. package/lib/commonjs/src/core/symbols/contents.d.ts +1 -1
  66. package/lib/commonjs/src/core/symbols/contents.js +6 -2
  67. package/lib/commonjs/src/core/symbols/knockout.js +4 -3
  68. package/lib/commonjs/src/core/symbols/layers.d.ts +1 -0
  69. package/lib/commonjs/src/core/symbols/layers.js +133 -92
  70. package/lib/commonjs/src/core/symbols/template.d.ts +8 -3
  71. package/lib/commonjs/src/core/symbols/template.js +23 -8
  72. package/lib/commonjs/src/core/symbols/vectorDrawable.d.ts +8 -0
  73. package/lib/commonjs/src/core/symbols/vectorDrawable.js +28 -2
  74. package/lib/commonjs/src/utils/fingerPrint.d.ts +3 -0
  75. package/lib/commonjs/src/utils/fingerPrint.js +5 -1
  76. package/lib/commonjs/src/utils/fontIdentity.d.ts +1 -1
  77. package/lib/commonjs/src/utils/fontIdentity.js +2 -2
  78. package/lib/module/createNanoIconsSet.js +0 -1
  79. package/lib/module/createNanoIconsSet.native.js +22 -18
  80. package/lib/module/createNanoIconsSet.shared.js +32 -18
  81. package/lib/module/createNanoIconsSet.web.js +103 -61
  82. package/lib/module/devServerFont.js +1 -1
  83. package/lib/module/devServerFont.web.js +3 -5
  84. package/lib/module/fontIntegrity.js +20 -38
  85. package/lib/module/fontIntegrity.web.js +48 -0
  86. package/lib/module/fontIntegrityStore.js +65 -0
  87. package/lib/module/index.js +1 -1
  88. package/lib/module/index.node.js +1 -1
  89. package/lib/module/index.web.js +4 -0
  90. package/lib/module/loadDynamicFont.js +3 -15
  91. package/lib/module/specs/NanoIconViewNativeComponent.ts +2 -1
  92. package/lib/module/utils/fingerPrint.js +4 -3
  93. package/lib/module/utils/fontIdentity.js +2 -2
  94. package/lib/module/utils/fontScale.js +10 -2
  95. package/lib/module/utils/glyphRuntime.js +13 -0
  96. package/lib/module/utils/iconAccessibility.js +26 -0
  97. package/lib/module/utils/iconPropsEqual.js +27 -0
  98. package/lib/module/utils/webCss.js +26 -0
  99. package/lib/module/utils/webStyle.js +86 -0
  100. package/lib/module/webFont.js +33 -0
  101. package/lib/typescript/src/const/codegenPrimitives.d.ts +1 -0
  102. package/lib/typescript/src/core/glyph/merge.d.ts +2 -1
  103. package/lib/typescript/src/core/glyph/parse.d.ts +1 -2
  104. package/lib/typescript/src/core/glyph/placement.d.ts +1 -0
  105. package/lib/typescript/src/core/pathkit/types.d.ts +1 -0
  106. package/lib/typescript/src/core/pathkit/winding.d.ts +14 -3
  107. package/lib/typescript/src/core/symbols/contents.d.ts +1 -1
  108. package/lib/typescript/src/core/symbols/layers.d.ts +1 -0
  109. package/lib/typescript/src/core/symbols/template.d.ts +8 -3
  110. package/lib/typescript/src/core/symbols/vectorDrawable.d.ts +8 -0
  111. package/lib/typescript/src/createNanoIconsSet.d.ts +0 -1
  112. package/lib/typescript/src/createNanoIconsSet.native.d.ts +0 -2
  113. package/lib/typescript/src/createNanoIconsSet.shared.d.ts +1 -3
  114. package/lib/typescript/src/createNanoIconsSet.web.d.ts +1 -2
  115. package/lib/typescript/src/fontIntegrity.d.ts +2 -14
  116. package/lib/typescript/src/fontIntegrity.web.d.ts +7 -0
  117. package/lib/typescript/src/fontIntegrityStore.d.ts +19 -0
  118. package/lib/typescript/src/index.d.ts +2 -1
  119. package/lib/typescript/src/index.web.d.ts +5 -0
  120. package/lib/typescript/src/loadDynamicFont.d.ts +0 -1
  121. package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts +2 -1
  122. package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
  123. package/lib/typescript/src/types.d.ts +37 -9
  124. package/lib/typescript/src/utils/fingerPrint.d.ts +3 -0
  125. package/lib/typescript/src/utils/fontIdentity.d.ts +1 -1
  126. package/lib/typescript/src/utils/glyphRuntime.d.ts +8 -0
  127. package/lib/typescript/src/utils/iconAccessibility.d.ts +4 -0
  128. package/lib/typescript/src/utils/iconPropsEqual.d.ts +4 -0
  129. package/lib/typescript/src/utils/webCss.d.ts +9 -0
  130. package/lib/typescript/src/utils/webStyle.d.ts +3 -0
  131. package/lib/typescript/src/webFont.d.ts +6 -0
  132. package/package.json +19 -3
  133. package/src/const/codegenPrimitives.ts +3 -3
  134. package/src/specs/NanoIconViewNativeComponent.ts +2 -1
  135. package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
  136. package/lib/commonjs/src/core/pathkit/evenodd.d.ts +0 -12
  137. package/lib/commonjs/src/core/pathkit/evenodd.js +0 -37
  138. package/lib/typescript/src/core/pathkit/evenodd.d.ts +0 -13
@@ -0,0 +1,19 @@
1
+ export type FontIntegrityIssue = {
2
+ fontFamily: string;
3
+ family: string;
4
+ linking: 'static' | 'dynamic';
5
+ message: string;
6
+ /** The error behind a dynamic font failure or a web font load failure, when there is one. */
7
+ cause?: unknown;
8
+ };
9
+ export type FontIntegrityStatus = 'found' | 'resolved';
10
+ type Listener = (issue: FontIntegrityIssue, status: FontIntegrityStatus) => void;
11
+ export declare function causeDetail(cause: unknown): unknown[];
12
+ export declare function recordIssue(family: string, linking: 'static' | 'dynamic', message: string, cause?: unknown, notifyLater?: boolean): void;
13
+ export declare function resolveFontIssue(family: string): void;
14
+ export declare function addFontIntegrityListener(listener: Listener): () => void;
15
+ export declare function getFontIntegrityIssues(): FontIntegrityIssue[];
16
+ export declare function useFontIntegrityIssue(family: string): FontIntegrityIssue | undefined;
17
+ export declare function __resetFontIssuesForTests(): void;
18
+ export {};
19
+ //# sourceMappingURL=fontIntegrityStore.d.ts.map
@@ -1,4 +1,5 @@
1
1
  export { createIconSet as createNanoIconSet, type IconComponent, type IconProps, } from './createNanoIconsSet';
2
- export { addFontIntegrityListener, getFontIntegrityIssues, type FontIntegrityIssue, type FontIntegrityStatus, } from './fontIntegrity';
2
+ export { addFontIntegrityListener, getFontIntegrityIssues, useFontIntegrityIssue, type FontIntegrityIssue, type FontIntegrityStatus, } from './fontIntegrity';
3
+ export type { GlyphEntry, GlyphLayer, NanoGlyphMap, NanoGlyphMapInput, } from './core/types';
3
4
  export type { ColorValue } from 'react-native';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ export { createIconSet as createNanoIconSet, type IconComponent, type IconProps, } from './createNanoIconsSet.web';
2
+ export { addFontIntegrityListener, getFontIntegrityIssues, useFontIntegrityIssue, type FontIntegrityIssue, type FontIntegrityStatus, } from './fontIntegrity.web';
3
+ export type { GlyphEntry, GlyphLayer, NanoGlyphMap, NanoGlyphMapInput, } from './core/types';
4
+ export type { ColorValue } from 'react-native';
5
+ //# sourceMappingURL=index.web.d.ts.map
@@ -22,7 +22,6 @@ export declare function loadDynamicFont(family: string, font: unknown, opts?: {
22
22
  * errored, or not managed by us).
23
23
  */
24
24
  export declare function useDynamicFontPending(managed: boolean, family: string): boolean;
25
- export declare function useDynamicFontStatus(family: string): FontStatus | undefined;
26
25
  /** Test-only: reset module state between tests. */
27
26
  export declare function __resetDynamicFontsForTests(): void;
28
27
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { ColorValue, ViewProps } from 'react-native';
2
- import type { Float, Int32 } from '../const/codegenPrimitives';
2
+ import type { Float, Int32, WithDefault } from '../const/codegenPrimitives';
3
3
  export interface NativeProps extends ViewProps {
4
4
  fontFamily: string;
5
5
  codepoints: ReadonlyArray<Int32>;
@@ -10,6 +10,7 @@ export interface NativeProps extends ViewProps {
10
10
  fontScale: Float;
11
11
  advanceWidth: Int32;
12
12
  unitsPerEm: Int32;
13
+ squareGlyphScale?: WithDefault<Float, 0>;
13
14
  }
14
15
  declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
15
16
  export default _default;
@@ -3,6 +3,7 @@ export interface Spec extends TurboModule {
3
3
  /** Pass glyphMap.m.f as `family`. On iOS it must also match the TTF's embedded PostScript/full name. */
4
4
  registerFont(family: string, uri: string): Promise<boolean>;
5
5
  isFontRegistered(family: string): Promise<boolean>;
6
+ isFontAvailable(family: string): boolean;
6
7
  }
7
8
  declare const _default: Spec | null | undefined;
8
9
  export default _default;
@@ -1,28 +1,56 @@
1
1
  import type { ComponentRef, Ref } from 'react';
2
- import type { AccessibilityRole, ColorValue, View, ViewStyle } from 'react-native';
2
+ import type { ColorValue, TextProps, View, ViewProps } from 'react-native';
3
3
  import type { NanoGlyphMapInput } from './core/types';
4
4
  import type { TintMode } from './utils/glyphRuntime';
5
5
  type ViewRef = ComponentRef<typeof View>;
6
6
  export type IconProps<Name> = {
7
+ /** Icon name: the SVG file name without `.svg`. */
7
8
  name: Name;
9
+ /**
10
+ * Icon height in points. Defaults to `12`, and on web to `1em`, so the icon
11
+ * follows the CSS `font-size`.
12
+ */
8
13
  size?: number;
14
+ /**
15
+ * One color, or one per layer. A shorter array repeats its last color.
16
+ * Defaults to the original SVG's colors. On web, `currentColor` layers and icons
17
+ * drawn only in black follow the CSS `color`.
18
+ */
9
19
  color?: ColorValue | ColorValue[];
20
+ /**
21
+ * Which layers `color` applies to: every layer, or only those drawn with
22
+ * `currentColor`.
23
+ * @default 'all'
24
+ */
10
25
  tintMode?: TintMode;
11
- allowFontScaling?: boolean;
12
- style?: ViewStyle;
13
- accessible?: boolean;
26
+ /**
27
+ * The box the icon is drawn in.
28
+ * - `'fit-glyph'`: `size` high and as wide as the glyph (default font
29
+ * behavior).
30
+ * - `'square'`: `size` high and wide, with the glyph fitted and centered,
31
+ * like `resizeMode="contain"`.
32
+ * @default 'fit-glyph'
33
+ */
34
+ frame?: 'fit-glyph' | 'square';
35
+ /**
36
+ * Label announced by screen readers. Without it, the icon is decorative and
37
+ * hidden from screen readers, unless `accessible`, `accessibilityRole`,
38
+ * `importantForAccessibility="yes"` or `accessibilityElementsHidden={false}`
39
+ * exposes it. On web, an exposed icon without a label is named after `name`.
40
+ */
14
41
  accessibilityLabel?: string;
15
- accessibilityRole?: AccessibilityRole;
42
+ /**
43
+ * Hides the icon from screen readers.
44
+ * @platform `iOS` and `Web` only - no-op on Android.
45
+ */
16
46
  accessibilityElementsHidden?: boolean;
17
- importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants';
18
47
  ref?: Ref<ViewRef>;
19
- testID?: string;
20
48
  /**
21
49
  * Forwarded to the container element on web.
22
- * @platform Web only - no-op on native.
50
+ * @platform `Web` only - no-op on native.
23
51
  */
24
52
  className?: string;
25
- };
53
+ } & Partial<Pick<TextProps, 'allowFontScaling'> & Pick<ViewProps, 'style' | 'testID' | 'accessible' | 'accessibilityRole' | 'importantForAccessibility'>>;
26
54
  export type IconComponent<GM extends NanoGlyphMapInput> = React.FC<IconProps<keyof GM['i']>> & {
27
55
  loadFont: (font?: number | string | {
28
56
  uri: string;
@@ -1,12 +1,15 @@
1
1
  export type FingerprintInputs = {
2
2
  upm: number;
3
3
  safeZone: number;
4
+ curveTolerance: number;
4
5
  startUnicode: number;
5
6
  version: string;
6
7
  toolchain: readonly string[];
7
8
  };
8
9
  export type SymbolFingerprintInputs = {
9
10
  prefix: string;
11
+ fit?: 'content' | 'viewBox';
12
+ scale?: number;
10
13
  version: string;
11
14
  toolchain: readonly string[];
12
15
  };
@@ -1,4 +1,4 @@
1
- export declare function buildFontFamily(fontFamily: string, inputHash: string): string;
1
+ export declare function buildFontFamily(fontFamily: string, contentHash: string): string;
2
2
  export declare function configuredFontFamily(family: string): string;
3
3
  export declare function isFontFileOf(fontFamily: string, fileName: string): boolean;
4
4
  export declare function isBuildFontFile(fileName: string): boolean;
@@ -7,6 +7,14 @@ export declare const DEFAULT_ICON_SIZE = 12;
7
7
  * (codepoint 63) sized to the font's em when the name is unknown.
8
8
  */
9
9
  export declare function resolveGlyphEntry<GM extends NanoGlyphMapInput>(glyphMap: GM, name: keyof GM['i']): GlyphEntry;
10
+ /**
11
+ * Size of a glyph in a square box, as fractions of the box side: the glyph's
12
+ * longer side fits the safe zone.
13
+ */
14
+ export declare function squareGlyphBox(advanceWidth: number, unitsPerEm: number, safeZone: number): {
15
+ scale: number;
16
+ width: number;
17
+ };
10
18
  /** A memoized codepoint -> string converter, scoped per icon set. */
11
19
  export declare function createCharCache(): (codepoint: number) => string;
12
20
  /**
@@ -0,0 +1,4 @@
1
+ import type { IconProps } from '../types';
2
+ export type IconAccessibilityProps = Pick<IconProps<unknown>, 'accessible' | 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityElementsHidden' | 'importantForAccessibility'>;
3
+ export declare function iconAccessibilityProps({ accessible, accessibilityLabel, accessibilityRole, accessibilityElementsHidden, importantForAccessibility, }: IconAccessibilityProps): IconAccessibilityProps;
4
+ //# sourceMappingURL=iconAccessibility.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { IconProps } from '../types';
2
+ export declare function shallowEqualStyle(a: unknown, b: unknown): boolean;
3
+ export declare function areIconPropsEqual<Name>(prev: IconProps<Name>, next: IconProps<Name>): boolean;
4
+ //# sourceMappingURL=iconPropsEqual.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { GlyphEntry } from '../core/types';
2
+ export declare const ICON_CLASS = "nano-icon";
3
+ export declare const STYLE_HREF = "react-native-nano-icons";
4
+ export declare const STYLE_PRECEDENCE = "react-native-nano-icons";
5
+ export declare const BASE_CSS: string;
6
+ export declare const BASE_HREF: string;
7
+ export declare function followsTextColor(layers: GlyphEntry[1]): boolean;
8
+ export declare function shortHash(value: string): string;
9
+ //# sourceMappingURL=webCss.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { CSSProperties } from 'react';
2
+ export declare function resolveWebStyle(style: unknown): CSSProperties | undefined;
3
+ //# sourceMappingURL=webStyle.d.ts.map
@@ -0,0 +1,6 @@
1
+ export declare function webFontUrl(font: unknown): string | undefined;
2
+ export declare function isWebFontRegistered(family: string): boolean;
3
+ export declare function registerWebFont(family: string, url: string): Promise<void>;
4
+ export declare function __resetWebFontsForTests(): void;
5
+ export declare function warnFontNotLoaded(fontBasename: string): void;
6
+ //# sourceMappingURL=webFont.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nano-icons",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-beta.2",
4
4
  "description": "High-performance icon rendering for React Native & Expo.",
5
5
  "react-native": "./lib/module/index.js",
6
6
  "source": "src/index.ts",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@expo/config-plugins": ">=9.0.0",
42
- "@xmldom/xmldom": "^0.9.10",
42
+ "@xmldom/xmldom": "^0.8.15 || ^0.9.12",
43
43
  "chalk": "^5.6.2",
44
44
  "cubic2quad": "^1.2.1",
45
45
  "fonteditor-core": "^2.6.3",
@@ -53,6 +53,7 @@
53
53
  "@expo/config": ">=9.0.0",
54
54
  "expo": "*",
55
55
  "react": "*",
56
+ "react-dom": "*",
56
57
  "react-native": ">=0.81.0"
57
58
  },
58
59
  "peerDependenciesMeta": {
@@ -64,6 +65,9 @@
64
65
  },
65
66
  "expo": {
66
67
  "optional": true
68
+ },
69
+ "react-dom": {
70
+ "optional": true
67
71
  }
68
72
  },
69
73
  "devDependencies": {
@@ -72,14 +76,17 @@
72
76
  "@types/node": "^25.2.3",
73
77
  "@types/plist": "^3.0.5",
74
78
  "@types/react": "~19.1.0",
79
+ "@types/react-dom": "~19.1.0",
75
80
  "@types/svg2ttf": "^5.0.3",
76
81
  "@types/xcode": "^3.0.0",
82
+ "@xmldom/xmldom-0.8": "npm:@xmldom/xmldom@0.8.15",
77
83
  "babel-plugin-module-resolver": "^5.0.2",
78
84
  "del-cli": "^6.0.0",
79
85
  "expo-module-scripts": "^5.0.8",
80
86
  "jest": "^29.7.0",
81
87
  "patch-package": "^8.0.0",
82
88
  "react": "19.1.0",
89
+ "react-dom": "19.1.0",
83
90
  "react-native": "^0.84.0",
84
91
  "react-native-builder-bob": "^0.40.18",
85
92
  "typescript": "^5.9.3"
@@ -88,13 +95,17 @@
88
95
  ".": {
89
96
  "source": "./src/index.ts",
90
97
  "react-native": "./lib/module/index.js",
98
+ "browser": {
99
+ "types": "./lib/typescript/src/index.d.ts",
100
+ "default": "./lib/module/index.web.js"
101
+ },
91
102
  "require": {
92
103
  "types": "./lib/typescript/src/index.d.ts",
93
104
  "default": "./lib/commonjs/index.node.js"
94
105
  },
95
106
  "import": {
96
107
  "types": "./lib/typescript/src/index.d.ts",
97
- "default": "./lib/module/index.js"
108
+ "default": "./lib/module/index.web.js"
98
109
  },
99
110
  "default": "./lib/commonjs/index.node.js"
100
111
  },
@@ -121,6 +132,11 @@
121
132
  "default": "./lib/commonjs/cli/index.js"
122
133
  }
123
134
  },
135
+ "./fingerprint": {
136
+ "source": "./cli/fingerprint.ts",
137
+ "types": "./lib/commonjs/cli/fingerprint.d.ts",
138
+ "default": "./lib/commonjs/cli/fingerprint.js"
139
+ },
124
140
  "./pipeline": {
125
141
  "source": "./src/core/pipeline/index.ts",
126
142
  "require": {
@@ -1,4 +1,4 @@
1
- // Local numeric aliases for RN codegen TS spec parsing.
1
+ // Local type aliases for RN codegen TS spec parsing.
2
2
  //
3
3
  // RN 0.79 and lower's codegen resolves any TSTypeAliasDeclaration found in the spec
4
4
  // file back to its original RHS before the array-element handler runs — so a
@@ -8,7 +8,7 @@
8
8
  // importing `Int32` / `Float` from here leaves a bare identifier that matches
9
9
  // the primitive-type branch (`case 'Int32'` / `case 'Float'`).
10
10
  //
11
- // These are pure number aliases at runtime; RN codegen only cares about the
12
- // identifier name.
11
+ // These are plain TS aliases; RN codegen only cares about the identifier name.
13
12
  export type Int32 = number;
14
13
  export type Float = number;
14
+ export type WithDefault<Type, _Value extends Type> = Type | null | undefined;
@@ -1,6 +1,6 @@
1
1
  import { codegenNativeComponent } from 'react-native';
2
2
  import type { ColorValue, ViewProps } from 'react-native';
3
- import type { Float, Int32 } from '../const/codegenPrimitives';
3
+ import type { Float, Int32, WithDefault } from '../const/codegenPrimitives';
4
4
 
5
5
  export interface NativeProps extends ViewProps {
6
6
  fontFamily: string;
@@ -12,6 +12,7 @@ export interface NativeProps extends ViewProps {
12
12
  fontScale: Float;
13
13
  advanceWidth: Int32;
14
14
  unitsPerEm: Int32;
15
+ squareGlyphScale?: WithDefault<Float, 0>;
15
16
  }
16
17
 
17
18
  export default codegenNativeComponent<NativeProps>('NanoIconView', {
@@ -5,6 +5,7 @@ export interface Spec extends TurboModule {
5
5
  /** Pass glyphMap.m.f as `family`. On iOS it must also match the TTF's embedded PostScript/full name. */
6
6
  registerFont(family: string, uri: string): Promise<boolean>;
7
7
  isFontRegistered(family: string): Promise<boolean>;
8
+ isFontAvailable(family: string): boolean;
8
9
  }
9
10
 
10
11
  // `get` (not `getEnforcing`) so the absence of the native module (web, Expo Go,
@@ -1,12 +0,0 @@
1
- import type { PathKitModule } from './types';
2
- /**
3
- * Convert a path `d` string with evenodd fill semantics to an equivalent
4
- * path that renders identically under nonzero winding.
5
- *
6
- * Steps:
7
- * 1. Parse via PathKit, set fill type to EVENODD, simplify (resolve topology)
8
- * 2. Split into contours, compute containment depths
9
- * 3. Fix winding: even depth = CCW (outer), odd depth = CW (hole)
10
- * 4. Reconstruct d string
11
- */
12
- export declare function convertEvenoddToWinding(PathKit: PathKitModule, d: string): string;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertEvenoddToWinding = convertEvenoddToWinding;
4
- const contours_1 = require("./contours");
5
- /**
6
- * Convert a path `d` string with evenodd fill semantics to an equivalent
7
- * path that renders identically under nonzero winding.
8
- *
9
- * Steps:
10
- * 1. Parse via PathKit, set fill type to EVENODD, simplify (resolve topology)
11
- * 2. Split into contours, compute containment depths
12
- * 3. Fix winding: even depth = CCW (outer), odd depth = CW (hole)
13
- * 4. Reconstruct d string
14
- */
15
- function convertEvenoddToWinding(PathKit, d) {
16
- const V = (0, contours_1.verbMap)(PathKit);
17
- // 1. Parse and simplify with EVENODD fill type
18
- const p = PathKit.FromSVGString(d);
19
- if (!p)
20
- return d;
21
- p.setFillType((0, contours_1.fillTypes)(PathKit).EVENODD);
22
- p.simplify();
23
- // Get the simplified SVG string and re-parse for command access
24
- const simplified = p.toSVGString();
25
- p.delete?.();
26
- const p2 = PathKit.FromSVGString(simplified);
27
- if (!p2)
28
- return simplified;
29
- const cmds = p2.toCmds();
30
- p2.delete?.();
31
- if (cmds.length === 0)
32
- return simplified;
33
- // 2.+3. Split into contours and fix winding via containment analysis
34
- const allCmds = (0, contours_1.orientedContours)(cmds, V).flatMap((x) => x.cmds);
35
- // 4. Reconstruct d string from fixed commands
36
- return (0, contours_1.cmdsToPathData)(allCmds, V);
37
- }
@@ -1,13 +0,0 @@
1
- import type { PathKitModule } from './types';
2
- /**
3
- * Convert a path `d` string with evenodd fill semantics to an equivalent
4
- * path that renders identically under nonzero winding.
5
- *
6
- * Steps:
7
- * 1. Parse via PathKit, set fill type to EVENODD, simplify (resolve topology)
8
- * 2. Split into contours, compute containment depths
9
- * 3. Fix winding: even depth = CCW (outer), odd depth = CW (hole)
10
- * 4. Reconstruct d string
11
- */
12
- export declare function convertEvenoddToWinding(PathKit: PathKitModule, d: string): string;
13
- //# sourceMappingURL=evenodd.d.ts.map