first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { PackagerAsset } from '@react-native/assets-registry/registry';
export type ResolvedAssetSource = {
__packager_asset: boolean;
width?: number;
height?: number;
uri: string;
scale: number;
};
export default class AssetSourceResolver {
serverUrl: string;
jsbundleUrl?: string | null;
asset: PackagerAsset;
constructor(serverUrl: string | undefined | null, jsbundleUrl: string | undefined | null, asset: PackagerAsset);
isLoadedFromServer(): boolean;
isLoadedFromFileSystem(): boolean;
defaultAsset(): ResolvedAssetSource;
/**
* @returns absolute remote URL for the hosted asset.
*/
assetServerURL(): ResolvedAssetSource;
fromSource(source: string): ResolvedAssetSource;
static pickScale(scales: number[], deviceScale: number): number;
}
//# sourceMappingURL=AssetSourceResolver.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AssetSourceResolver.web.d.ts","sourceRoot":"","sources":["../../src/utils/AssetSourceResolver.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAcF,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,SAAS,EAAE,MAAM,CAAC;IAGlB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,KAAK,EAAE,aAAa,CAAC;gBAGnB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACpC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACtC,KAAK,EAAE,aAAa;IAQtB,kBAAkB,IAAI,OAAO;IAK7B,sBAAsB,IAAI,OAAO;IAIjC,YAAY,IAAI,mBAAmB;IAInC;;OAEG;IACH,cAAc,IAAI,mBAAmB;IAUrC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAU/C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAQhE"}

View File

@@ -0,0 +1,3 @@
export declare const decode83: (str: string) => number;
export declare const encode83: (n: number, length: number) => string;
//# sourceMappingURL=base83.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"base83.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/base83.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,WAQnC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,QAAQ,MAAM,KAAG,MAOpD,CAAC"}

View File

@@ -0,0 +1,7 @@
export declare const isBlurhashValid: (blurhash: string) => {
result: boolean;
errorReason?: string;
};
declare const decode: (blurhash: string, width: number, height: number, punch?: number) => Uint8ClampedArray<ArrayBuffer>;
export default decode;
//# sourceMappingURL=decode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/decode.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAQzF,CAAC;AAuBF,QAAA,MAAM,MAAM,GAAI,UAAU,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,mCAsD9E,CAAC;AAEF,eAAe,MAAM,CAAC"}

View File

@@ -0,0 +1,4 @@
export declare class ValidationError extends Error {
constructor(message: string);
}
//# sourceMappingURL=error.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/error.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAK5B"}

View File

@@ -0,0 +1,8 @@
export declare function useBlurhash(blurhash: {
uri?: string;
width?: number | null;
height?: number | null;
} | undefined | null, punch?: number): readonly [{
uri: string;
} | null, boolean | ""];
//# sourceMappingURL=useBlurhash.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"useBlurhash.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/useBlurhash.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,WAAW,CACzB,QAAQ,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,EAC5F,KAAK,GAAE,MAAU;;wBAiElB"}

View File

@@ -0,0 +1,5 @@
export declare const sRGBToLinear: (value: number) => number;
export declare const linearTosRGB: (value: number) => number;
export declare const sign: (n: number) => 1 | -1;
export declare const signPow: (val: number, exp: number) => number;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,WAAqB,CAAC;AAEpD,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,WAA6C,CAAC"}

View File

@@ -0,0 +1,3 @@
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
export default resolveAssetSource;
//# sourceMappingURL=resolveAssetSource.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveAssetSource.d.ts","sourceRoot":"","sources":["../../src/utils/resolveAssetSource.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,iDAAiD,CAAC;AAEjF,eAAe,kBAAkB,CAAC"}

View File

@@ -0,0 +1,9 @@
import AssetSourceResolver, { ResolvedAssetSource } from './AssetSourceResolver.web';
export declare function setCustomSourceTransformer(transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource): void;
/**
* `source` is either a number (opaque type returned by require('./foo.png'))
* or an `ImageSource` like { uri: '<http location || file path>' }
*/
export default function resolveAssetSource(source: any): ResolvedAssetSource | undefined;
export declare const pickScale: typeof AssetSourceResolver.pickScale;
//# sourceMappingURL=resolveAssetSource.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveAssetSource.web.d.ts","sourceRoot":"","sources":["../../src/utils/resolveAssetSource.web.ts"],"names":[],"mappings":"AAEA,OAAO,mBAAmB,EAAE,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrF,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,mBAAmB,GAClE,IAAI,CAEN;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,mBAAmB,GAAG,SAAS,CAevF;AAQD,eAAO,MAAQ,SAAS,sCAAwB,CAAC"}

View File

@@ -0,0 +1,14 @@
import { ImageSource } from '../Image.types';
/**
* Converts a blurhash string (`blurhash:/<hash>/<width>/<height>` or <hash>/<width>/<height>) into an `ImageSource`.
*
* @return An ImageSource representing the provided blurhash.
* */
export declare function resolveBlurhashString(str: string): ImageSource;
/**
* Converts a thumbhash string (`thumbhash:/<hash>` or `<hash>`) into an `ImageSource`.
*
* @return An ImageSource representing the provided thumbhash.
* */
export declare function resolveThumbhashString(str: string): ImageSource;
//# sourceMappingURL=resolveHashString.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveHashString.d.ts","sourceRoot":"","sources":["../../src/utils/resolveHashString.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAS7C;;;;KAIK;AACL,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAO9D;AAED;;;;KAIK;AACL,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAO/D"}

View File

@@ -0,0 +1,18 @@
import { ImageSource } from '../Image.types';
/**
* Converts a string in blurhash format (`blurhash:/<hash>/<width>/<height>`
* or <hash>/<width>/<height>) into an `ImageSource`.
*
* @return An ImageSource representing the provided blurhash.
* */
export declare function resolveBlurhashString(str: string): ImageSource;
/**
* Converts a string in thumbhash format (`thumbhash:/<hash>` or `<hash>`)
* into an `ImageSource`.
* Note: Unlike the `resolveBlurhashString` the `thumbhash:/` scheme has to be present,
* as the scheme has to be explicitly stated to be interpreted a `thumbhash` source.
*
* @return An ImageSource representing the provided thumbhash.
* */
export declare function resolveThumbhashString(str: string): ImageSource;
//# sourceMappingURL=resolveHashString.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveHashString.web.d.ts","sourceRoot":"","sources":["../../src/utils/resolveHashString.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;KAKK;AACL,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAO9D;AAED;;;;;;;KAOK;AACL,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAK/D"}

View File

@@ -0,0 +1,11 @@
import { ImageNativeProps, ImageProps, ImageSource } from '../Image.types';
export declare function isBlurhashString(str: string): boolean;
export declare function isThumbhashString(str: string): boolean;
export declare function isSFSymbolString(str: string): boolean;
export declare function resolveSFSymbolString(str: string): ImageSource;
export declare function resolveSource(source?: ImageSource | string | number | null): ImageSource | null;
/**
* Resolves provided `source` prop to an array of objects expected by the native implementation.
*/
export declare function resolveSources(sources?: ImageProps['source']): ImageNativeProps['source'];
//# sourceMappingURL=resolveSources.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveSources.d.ts","sourceRoot":"","sources":["../../src/utils/resolveSources.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG3E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAGD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAI9D;AAED,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAyB/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAYzF"}

View File

@@ -0,0 +1,66 @@
/**
* Encodes an RGBA image to a ThumbHash. RGB should not be premultiplied by A.
*
* @param w The width of the input image. Must be ≤100px.
* @param h The height of the input image. Must be ≤100px.
* @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.
* @returns The ThumbHash as a Uint8Array.
*/
export declare function rgbaToThumbHash(w: number, h: number, rgba: Uint8Array): Uint8Array<ArrayBuffer>;
/**
* Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
*
* @param hash The bytes of the ThumbHash.
* @returns The width, height, and pixels of the rendered placeholder image.
*/
export declare function thumbHashToRGBA(hash: Uint8Array): {
w: number;
h: number;
rgba: Uint8Array<ArrayBuffer>;
};
/**
* Extracts the average color from a ThumbHash. RGB is not be premultiplied by A.
*
* @param hash The bytes of the ThumbHash.
* @returns The RGBA values for the average color. Each value ranges from 0 to 1.
*/
export declare function thumbHashToAverageRGBA(hash: Uint8Array): {
r: number;
g: number;
b: number;
a: number;
};
/**
* Extracts the approximate aspect ratio of the original image.
*
* @param hash The bytes of the ThumbHash.
* @returns The approximate aspect ratio (i.e. width / height).
*/
export declare function thumbHashToApproximateAspectRatio(hash: Uint8Array): number;
/**
* Encodes an RGBA image to a PNG data URL. RGB should not be premultiplied by
* A. This is optimized for speed and simplicity and does not optimize for size
* at all. This doesn't do any compression (all values are stored uncompressed).
*
* @param w The width of the input image. Must be ≤100px.
* @param h The height of the input image. Must be ≤100px.
* @param rgba The pixels in the input image, row-by-row. Must have w*h*4 elements.
* @returns A data URL containing a PNG for the input image.
*/
export declare function rgbaToDataURL(w: number, h: number, rgba: Uint8Array): string;
/**
* Decodes a ThumbHash to a PNG data URL. This is a convenience function that
* just calls "thumbHashToRGBA" followed by "rgbaToDataURL".
*
* @param hash The bytes of the ThumbHash.
* @returns A data URL containing a PNG for the rendered ThumbHash.
*/
export declare function thumbHashToDataURL(hash: Uint8Array): string;
/**
* Convenience function added to the original thumbhash code, allows generating a thumbhash image directly from
* thumbhash string.
* @param thumbhash string from which thumbhashDataURL should be generated
* @returns A data URL containing a PNG for the rendered ThumbHash
*/
export declare function thumbHashStringToDataURL(thumbhash: string): string;
//# sourceMappingURL=thumbhash.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"thumbhash.d.ts","sourceRoot":"","sources":["../../../src/utils/thumbhash/thumbhash.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,2BAuGrE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU;;;;EAuF/C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU;;;;;EAiBtD;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,UAAU,UAOjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,UAsGnE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAG3D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGlE"}