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.
- package/README.md +139 -21
- package/android/src/main/java/com/nanoicons/NanoIconFonts.kt +15 -0
- package/android/src/main/java/com/nanoicons/NanoIconView.kt +27 -4
- package/android/src/main/java/com/nanoicons/NanoIconViewManager.kt +7 -0
- package/android/src/main/java/com/nanoicons/NanoIconsFontLoaderModule.kt +3 -0
- package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconProps.cpp +6 -1
- package/common/cpp/react/renderer/components/RNNanoIconsSpec/NanoIconProps.h +4 -2
- package/ios/NanoIconView.mm +34 -44
- package/ios/NanoIconsFontLoader.mm +5 -0
- package/lib/commonjs/cli/build.d.ts +26 -0
- package/lib/commonjs/cli/build.js +174 -64
- package/lib/commonjs/cli/buildSymbols.d.ts +30 -1
- package/lib/commonjs/cli/buildSymbols.js +120 -42
- package/lib/commonjs/cli/expoConfig.d.ts +11 -0
- package/lib/commonjs/cli/expoConfig.js +28 -9
- package/lib/commonjs/cli/fingerprint.d.ts +15 -0
- package/lib/commonjs/cli/fingerprint.js +42 -0
- package/lib/commonjs/cli/index.d.ts +2 -2
- package/lib/commonjs/cli/index.js +3 -1
- package/lib/commonjs/cli/link.d.ts +4 -0
- package/lib/commonjs/cli/link.js +38 -1
- package/lib/commonjs/cli/sameOutputs.d.ts +5 -0
- package/lib/commonjs/cli/sameOutputs.js +45 -0
- package/lib/commonjs/index.node.js +1 -1
- package/lib/commonjs/plugin/src/buildFonts.d.ts +3 -2
- package/lib/commonjs/plugin/src/buildFonts.js +11 -3
- package/lib/commonjs/plugin/src/buildSymbols.d.ts +2 -2
- package/lib/commonjs/plugin/src/buildSymbols.js +10 -3
- package/lib/commonjs/plugin/src/frozen.d.ts +3 -0
- package/lib/commonjs/plugin/src/frozen.js +18 -0
- package/lib/commonjs/plugin/src/index.js +3 -3
- package/lib/commonjs/plugin/src/types.d.ts +22 -1
- package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.d.ts +1 -1
- package/lib/commonjs/plugin/src/withNanoIconsDrawableLinking.js +2 -2
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.d.ts +3 -3
- package/lib/commonjs/plugin/src/withNanoIconsFontLinking.js +8 -8
- package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.d.ts +1 -1
- package/lib/commonjs/plugin/src/withNanoIconsSymbolLinking.js +2 -2
- package/lib/commonjs/scripts/cli.js +31 -2
- package/lib/commonjs/src/core/flatten/dom.js +40 -5
- package/lib/commonjs/src/core/flatten/element.js +2 -1
- package/lib/commonjs/src/core/flatten/stages/collapse.js +12 -0
- package/lib/commonjs/src/core/font/compile.d.ts +0 -1
- package/lib/commonjs/src/core/font/compile.js +2 -8
- package/lib/commonjs/src/core/glyph/merge.d.ts +2 -1
- package/lib/commonjs/src/core/glyph/merge.js +27 -36
- package/lib/commonjs/src/core/glyph/parse.d.ts +1 -2
- package/lib/commonjs/src/core/glyph/parse.js +31 -18
- package/lib/commonjs/src/core/glyph/placement.d.ts +1 -0
- package/lib/commonjs/src/core/glyph/placement.js +9 -3
- package/lib/commonjs/src/core/pathkit/types.d.ts +1 -0
- package/lib/commonjs/src/core/pathkit/winding.d.ts +14 -3
- package/lib/commonjs/src/core/pathkit/winding.js +434 -7
- package/lib/commonjs/src/core/pipeline/config.d.ts +1 -0
- package/lib/commonjs/src/core/pipeline/prepare.d.ts +1 -1
- package/lib/commonjs/src/core/pipeline/prepare.js +4 -16
- package/lib/commonjs/src/core/pipeline/prepareIcon.d.ts +1 -0
- package/lib/commonjs/src/core/pipeline/prepareIcon.js +3 -1
- package/lib/commonjs/src/core/pipeline/prepareSymbol.d.ts +2 -0
- package/lib/commonjs/src/core/pipeline/prepareSymbol.js +15 -3
- package/lib/commonjs/src/core/pipeline/preparedSvgCache.js +2 -2
- package/lib/commonjs/src/core/pipeline/runFontPipeline.js +20 -12
- package/lib/commonjs/src/core/pipeline/runSymbolPipeline.d.ts +2 -0
- package/lib/commonjs/src/core/pipeline/runSymbolPipeline.js +2 -0
- package/lib/commonjs/src/core/symbols/contents.d.ts +1 -1
- package/lib/commonjs/src/core/symbols/contents.js +6 -2
- package/lib/commonjs/src/core/symbols/knockout.js +4 -3
- package/lib/commonjs/src/core/symbols/layers.d.ts +1 -0
- package/lib/commonjs/src/core/symbols/layers.js +133 -92
- package/lib/commonjs/src/core/symbols/template.d.ts +8 -3
- package/lib/commonjs/src/core/symbols/template.js +23 -8
- package/lib/commonjs/src/core/symbols/vectorDrawable.d.ts +8 -0
- package/lib/commonjs/src/core/symbols/vectorDrawable.js +28 -2
- package/lib/commonjs/src/utils/fingerPrint.d.ts +3 -0
- package/lib/commonjs/src/utils/fingerPrint.js +5 -1
- package/lib/commonjs/src/utils/fontIdentity.d.ts +1 -1
- package/lib/commonjs/src/utils/fontIdentity.js +2 -2
- package/lib/module/createNanoIconsSet.js +0 -1
- package/lib/module/createNanoIconsSet.native.js +22 -18
- package/lib/module/createNanoIconsSet.shared.js +32 -18
- package/lib/module/createNanoIconsSet.web.js +103 -61
- package/lib/module/devServerFont.js +1 -1
- package/lib/module/devServerFont.web.js +3 -5
- package/lib/module/fontIntegrity.js +20 -38
- package/lib/module/fontIntegrity.web.js +48 -0
- package/lib/module/fontIntegrityStore.js +65 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.node.js +1 -1
- package/lib/module/index.web.js +4 -0
- package/lib/module/loadDynamicFont.js +3 -15
- package/lib/module/specs/NanoIconViewNativeComponent.ts +2 -1
- package/lib/module/utils/fingerPrint.js +4 -3
- package/lib/module/utils/fontIdentity.js +2 -2
- package/lib/module/utils/fontScale.js +10 -2
- package/lib/module/utils/glyphRuntime.js +13 -0
- package/lib/module/utils/iconAccessibility.js +26 -0
- package/lib/module/utils/iconPropsEqual.js +27 -0
- package/lib/module/utils/webCss.js +26 -0
- package/lib/module/utils/webStyle.js +86 -0
- package/lib/module/webFont.js +33 -0
- package/lib/typescript/src/const/codegenPrimitives.d.ts +1 -0
- package/lib/typescript/src/core/glyph/merge.d.ts +2 -1
- package/lib/typescript/src/core/glyph/parse.d.ts +1 -2
- package/lib/typescript/src/core/glyph/placement.d.ts +1 -0
- package/lib/typescript/src/core/pathkit/types.d.ts +1 -0
- package/lib/typescript/src/core/pathkit/winding.d.ts +14 -3
- package/lib/typescript/src/core/symbols/contents.d.ts +1 -1
- package/lib/typescript/src/core/symbols/layers.d.ts +1 -0
- package/lib/typescript/src/core/symbols/template.d.ts +8 -3
- package/lib/typescript/src/core/symbols/vectorDrawable.d.ts +8 -0
- package/lib/typescript/src/createNanoIconsSet.d.ts +0 -1
- package/lib/typescript/src/createNanoIconsSet.native.d.ts +0 -2
- package/lib/typescript/src/createNanoIconsSet.shared.d.ts +1 -3
- package/lib/typescript/src/createNanoIconsSet.web.d.ts +1 -2
- package/lib/typescript/src/fontIntegrity.d.ts +2 -14
- package/lib/typescript/src/fontIntegrity.web.d.ts +7 -0
- package/lib/typescript/src/fontIntegrityStore.d.ts +19 -0
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.web.d.ts +5 -0
- package/lib/typescript/src/loadDynamicFont.d.ts +0 -1
- package/lib/typescript/src/specs/NanoIconViewNativeComponent.d.ts +2 -1
- package/lib/typescript/src/specs/NativeNanoIconsFontLoader.d.ts +1 -0
- package/lib/typescript/src/types.d.ts +37 -9
- package/lib/typescript/src/utils/fingerPrint.d.ts +3 -0
- package/lib/typescript/src/utils/fontIdentity.d.ts +1 -1
- package/lib/typescript/src/utils/glyphRuntime.d.ts +8 -0
- package/lib/typescript/src/utils/iconAccessibility.d.ts +4 -0
- package/lib/typescript/src/utils/iconPropsEqual.d.ts +4 -0
- package/lib/typescript/src/utils/webCss.d.ts +9 -0
- package/lib/typescript/src/utils/webStyle.d.ts +3 -0
- package/lib/typescript/src/webFont.d.ts +6 -0
- package/package.json +19 -3
- package/src/const/codegenPrimitives.ts +3 -3
- package/src/specs/NanoIconViewNativeComponent.ts +2 -1
- package/src/specs/NativeNanoIconsFontLoader.ts +1 -0
- package/lib/commonjs/src/core/pathkit/evenodd.d.ts +0 -12
- package/lib/commonjs/src/core/pathkit/evenodd.js +0 -37
- 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 {
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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,
|
|
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,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,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.
|
|
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.
|
|
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
|
|
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
|
|
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
|