@symbiote-native/engine 0.1.0

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 (195) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -0
  3. package/build/accessibility-info/index.android.d.ts +3 -0
  4. package/build/accessibility-info/index.android.js +166 -0
  5. package/build/accessibility-info/index.d.ts +1 -0
  6. package/build/accessibility-info/index.ios.d.ts +3 -0
  7. package/build/accessibility-info/index.ios.js +219 -0
  8. package/build/accessibility-info/index.js +5 -0
  9. package/build/accessibility-info/shared.d.ts +34 -0
  10. package/build/accessibility-info/shared.js +13 -0
  11. package/build/action-sheet-ios/index.d.ts +36 -0
  12. package/build/action-sheet-ios/index.js +74 -0
  13. package/build/alert/index.android.d.ts +5 -0
  14. package/build/alert/index.android.js +117 -0
  15. package/build/alert/index.d.ts +1 -0
  16. package/build/alert/index.ios.d.ts +7 -0
  17. package/build/alert/index.ios.js +83 -0
  18. package/build/alert/index.js +8 -0
  19. package/build/alert/shared.d.ts +19 -0
  20. package/build/alert/shared.js +17 -0
  21. package/build/animated/animated-component-shared.d.ts +5 -0
  22. package/build/animated/animated-component-shared.js +54 -0
  23. package/build/animated/animation.d.ts +9 -0
  24. package/build/animated/animation.js +6 -0
  25. package/build/animated/animations/base.d.ts +27 -0
  26. package/build/animated/animations/base.js +90 -0
  27. package/build/animated/animations/composition.d.ts +38 -0
  28. package/build/animated/animations/composition.js +236 -0
  29. package/build/animated/animations/decay.d.ts +22 -0
  30. package/build/animated/animations/decay.js +65 -0
  31. package/build/animated/animations/raf.d.ts +5 -0
  32. package/build/animated/animations/raf.js +39 -0
  33. package/build/animated/animations/spring-config.d.ts +6 -0
  34. package/build/animated/animations/spring-config.js +55 -0
  35. package/build/animated/animations/spring.d.ts +50 -0
  36. package/build/animated/animations/spring.js +207 -0
  37. package/build/animated/animations/timing.d.ts +27 -0
  38. package/build/animated/animations/timing.js +101 -0
  39. package/build/animated/animations/tracking.d.ts +14 -0
  40. package/build/animated/animations/tracking.js +43 -0
  41. package/build/animated/bezier.d.ts +1 -0
  42. package/build/animated/bezier.js +101 -0
  43. package/build/animated/color.d.ts +37 -0
  44. package/build/animated/color.js +183 -0
  45. package/build/animated/easing.d.ts +20 -0
  46. package/build/animated/easing.js +96 -0
  47. package/build/animated/event.d.ts +36 -0
  48. package/build/animated/event.js +252 -0
  49. package/build/animated/graph.d.ts +38 -0
  50. package/build/animated/graph.js +227 -0
  51. package/build/animated/index.d.ts +20 -0
  52. package/build/animated/index.js +28 -0
  53. package/build/animated/interpolation-node.d.ts +16 -0
  54. package/build/animated/interpolation-node.js +57 -0
  55. package/build/animated/interpolation.d.ts +22 -0
  56. package/build/animated/interpolation.js +199 -0
  57. package/build/animated/mock.d.ts +56 -0
  58. package/build/animated/mock.js +127 -0
  59. package/build/animated/native/native-animated.d.ts +43 -0
  60. package/build/animated/native/native-animated.js +146 -0
  61. package/build/animated/operators.d.ts +80 -0
  62. package/build/animated/operators.js +266 -0
  63. package/build/animated/props.d.ts +20 -0
  64. package/build/animated/props.js +187 -0
  65. package/build/animated/style.d.ts +26 -0
  66. package/build/animated/style.js +187 -0
  67. package/build/animated/value-xy.d.ts +35 -0
  68. package/build/animated/value-xy.js +106 -0
  69. package/build/animated/value.d.ts +36 -0
  70. package/build/animated/value.js +185 -0
  71. package/build/app-registry/index.d.ts +40 -0
  72. package/build/app-registry/index.js +144 -0
  73. package/build/app-state/index.d.ts +16 -0
  74. package/build/app-state/index.js +105 -0
  75. package/build/appearance/index.d.ts +12 -0
  76. package/build/appearance/index.js +84 -0
  77. package/build/back-handler/index.d.ts +14 -0
  78. package/build/back-handler/index.js +106 -0
  79. package/build/commit.d.ts +16 -0
  80. package/build/commit.js +678 -0
  81. package/build/debug.d.ts +5 -0
  82. package/build/debug.js +18 -0
  83. package/build/dimensions/index.d.ts +28 -0
  84. package/build/dimensions/index.js +148 -0
  85. package/build/dispatch.d.ts +2 -0
  86. package/build/dispatch.js +18 -0
  87. package/build/events/index.d.ts +1 -0
  88. package/build/events/index.js +691 -0
  89. package/build/fabric.d.ts +32 -0
  90. package/build/fabric.js +59 -0
  91. package/build/host-instance/index.d.ts +11 -0
  92. package/build/host-instance/index.js +49 -0
  93. package/build/i18n-manager/index.d.ts +13 -0
  94. package/build/i18n-manager/index.js +91 -0
  95. package/build/index.d.ts +80 -0
  96. package/build/index.js +72 -0
  97. package/build/interaction-manager/index.d.ts +45 -0
  98. package/build/interaction-manager/index.js +222 -0
  99. package/build/keyboard/index.d.ts +31 -0
  100. package/build/keyboard/index.js +142 -0
  101. package/build/layout-animation/index.d.ts +66 -0
  102. package/build/layout-animation/index.js +183 -0
  103. package/build/linking/index.android.d.ts +2 -0
  104. package/build/linking/index.android.js +18 -0
  105. package/build/linking/index.d.ts +1 -0
  106. package/build/linking/index.ios.d.ts +2 -0
  107. package/build/linking/index.ios.js +9 -0
  108. package/build/linking/index.js +6 -0
  109. package/build/linking/shared.d.ts +32 -0
  110. package/build/linking/shared.js +98 -0
  111. package/build/native-events.d.ts +24 -0
  112. package/build/native-events.js +129 -0
  113. package/build/native-modules.d.ts +6 -0
  114. package/build/native-modules.js +57 -0
  115. package/build/node.d.ts +36 -0
  116. package/build/node.js +194 -0
  117. package/build/pan-responder/index.d.ts +53 -0
  118. package/build/pan-responder/index.js +353 -0
  119. package/build/permissions-android/index.d.ts +115 -0
  120. package/build/permissions-android/index.js +185 -0
  121. package/build/pixel-ratio/index.d.ts +8 -0
  122. package/build/pixel-ratio/index.js +27 -0
  123. package/build/platform/index.android.d.ts +22 -0
  124. package/build/platform/index.android.js +60 -0
  125. package/build/platform/index.d.ts +1 -0
  126. package/build/platform/index.ios.d.ts +18 -0
  127. package/build/platform/index.ios.js +62 -0
  128. package/build/platform/index.js +5 -0
  129. package/build/platform/shared.d.ts +25 -0
  130. package/build/platform/shared.js +41 -0
  131. package/build/platform-color.d.ts +19 -0
  132. package/build/platform-color.js +25 -0
  133. package/build/post-commit.d.ts +4 -0
  134. package/build/post-commit.js +16 -0
  135. package/build/process-aspect-ratio.d.ts +1 -0
  136. package/build/process-aspect-ratio.js +34 -0
  137. package/build/process-background-image/index.d.ts +28 -0
  138. package/build/process-background-image/index.js +557 -0
  139. package/build/process-box-shadow/index.d.ts +11 -0
  140. package/build/process-box-shadow/index.js +193 -0
  141. package/build/process-filter.d.ts +31 -0
  142. package/build/process-filter.js +304 -0
  143. package/build/process-font-variant.d.ts +1 -0
  144. package/build/process-font-variant.js +17 -0
  145. package/build/process-transform/index.d.ts +5 -0
  146. package/build/process-transform/index.js +120 -0
  147. package/build/process-transform-origin/index.d.ts +3 -0
  148. package/build/process-transform-origin/index.js +108 -0
  149. package/build/registry.d.ts +31 -0
  150. package/build/registry.js +145 -0
  151. package/build/settings/index.d.ts +8 -0
  152. package/build/settings/index.js +126 -0
  153. package/build/share/index.android.d.ts +3 -0
  154. package/build/share/index.android.js +56 -0
  155. package/build/share/index.d.ts +1 -0
  156. package/build/share/index.ios.d.ts +3 -0
  157. package/build/share/index.ios.js +47 -0
  158. package/build/share/index.js +6 -0
  159. package/build/share/shared.d.ts +32 -0
  160. package/build/share/shared.js +32 -0
  161. package/build/status-bar/index.android.d.ts +5 -0
  162. package/build/status-bar/index.android.js +83 -0
  163. package/build/status-bar/index.d.ts +1 -0
  164. package/build/status-bar/index.ios.d.ts +5 -0
  165. package/build/status-bar/index.ios.js +66 -0
  166. package/build/status-bar/index.js +4 -0
  167. package/build/status-bar/shared.d.ts +22 -0
  168. package/build/status-bar/shared.js +22 -0
  169. package/build/style/index.d.ts +1 -0
  170. package/build/style/index.js +30 -0
  171. package/build/style-registry/index.d.ts +11 -0
  172. package/build/style-registry/index.js +165 -0
  173. package/build/style-sheet/index.d.ts +20 -0
  174. package/build/style-sheet/index.js +121 -0
  175. package/build/styles.d.ts +220 -0
  176. package/build/styles.js +7 -0
  177. package/build/surface.d.ts +16 -0
  178. package/build/surface.js +67 -0
  179. package/build/tags.d.ts +1 -0
  180. package/build/tags.js +10 -0
  181. package/build/text-input-state.d.ts +5 -0
  182. package/build/text-input-state.js +29 -0
  183. package/build/toast-android/index.d.ts +10 -0
  184. package/build/toast-android/index.js +108 -0
  185. package/build/vibration/index.android.d.ts +2 -0
  186. package/build/vibration/index.android.js +18 -0
  187. package/build/vibration/index.d.ts +1 -0
  188. package/build/vibration/index.ios.d.ts +2 -0
  189. package/build/vibration/index.ios.js +54 -0
  190. package/build/vibration/index.js +6 -0
  191. package/build/vibration/shared.d.ts +15 -0
  192. package/build/vibration/shared.js +68 -0
  193. package/build/view-config.d.ts +1 -0
  194. package/build/view-config.js +114 -0
  195. package/package.json +41 -0
@@ -0,0 +1,27 @@
1
+ // PixelRatio: device pixel density helpers, a faithful port of RN's
2
+ // Libraries/Utilities/PixelRatio.js. Every value derives from
3
+ // Dimensions.get('window'): `get()` is the pixel scale, `getFontScale()` the user's
4
+ // text-size factor (falling back to scale when unset), and the two conversion
5
+ // helpers snap layout sizes (dp) onto the physical pixel grid. iOS-only
6
+ // startDetecting() is a no-op, kept for API parity.
7
+ import { Dimensions } from '../dimensions';
8
+ export const PixelRatio = {
9
+ get() {
10
+ return Dimensions.get('window').scale;
11
+ },
12
+ // RN: fontScale || get(). A 0/absent fontScale falls back to the pixel scale.
13
+ getFontScale() {
14
+ return Dimensions.get('window').fontScale || PixelRatio.get();
15
+ },
16
+ // dp -> px, guaranteed integer.
17
+ getPixelSizeForLayoutSize(layoutSize) {
18
+ return Math.round(layoutSize * PixelRatio.get());
19
+ },
20
+ // Snap a dp size to the nearest value that maps to a whole number of pixels.
21
+ roundToNearestPixel(layoutSize) {
22
+ const ratio = PixelRatio.get();
23
+ return Math.round(layoutSize * ratio) / ratio;
24
+ },
25
+ // No-op on iOS (web-only in RN). Kept for API parity.
26
+ startDetecting() { },
27
+ };
@@ -0,0 +1,22 @@
1
+ import { type IPlatformStatic } from './shared';
2
+ export type { IPlatformOSType, IPlatformSelectSpec, IPlatformStatic } from './shared';
3
+ export interface IPlatformConstantsAndroid {
4
+ isTesting: boolean;
5
+ isDisableAnimations?: boolean;
6
+ reactNativeVersion: {
7
+ major: number;
8
+ minor: number;
9
+ patch: number;
10
+ prerelease?: number | string | null;
11
+ };
12
+ Version: number;
13
+ Release: string;
14
+ Serial: string;
15
+ Fingerprint: string;
16
+ Model: string;
17
+ ServerHost?: string;
18
+ uiMode: string;
19
+ Brand: string;
20
+ Manufacturer: string;
21
+ }
22
+ export declare const Platform: IPlatformStatic<IPlatformConstantsAndroid>;
@@ -0,0 +1,60 @@
1
+ // The Android Platform: a faithful port of RN's Libraries/Utilities/Platform.android.js.
2
+ // `OS` is the static 'android'; `Version` is the numeric API level and the rest come
3
+ // from the PlatformConstants native module (RN spec NativePlatformConstantsAndroid.js,
4
+ // a different payload from iOS). Metro picks this on an Android host. The module name is
5
+ // the same 'PlatformConstants'; only the shape differs. See .docs/decisions/0022.
6
+ import { createConstantsResolver } from './shared';
7
+ // The filename already selected this host: 'android' is a literal, not a probe.
8
+ const OS_ANDROID = 'android';
9
+ // RN reads isTV off the uiMode constant.
10
+ const UI_MODE_TV = 'tv';
11
+ // Native unresolvable (headless): RN's Version getter would throw; we return 0, the
12
+ // neutral "unknown API level", so a Platform read never crashes a render.
13
+ const UNKNOWN_API_LEVEL = 0;
14
+ function isPlatformConstantsAndroid(value) {
15
+ if (typeof value !== 'object' || value === null)
16
+ return false;
17
+ return 'Version' in value && 'uiMode' in value;
18
+ }
19
+ const resolveConstants = createConstantsResolver(isPlatformConstantsAndroid);
20
+ export const Platform = {
21
+ OS: OS_ANDROID,
22
+ get Version() {
23
+ return resolveConstants()?.Version ?? UNKNOWN_API_LEVEL;
24
+ },
25
+ get constants() {
26
+ return resolveConstants();
27
+ },
28
+ // RN Android's Platform has no isPad / isMacCatalyst; they're always false here so app
29
+ // code can read them uniformly across hosts (RN parity: those are iOS-only concepts).
30
+ get isPad() {
31
+ return false;
32
+ },
33
+ get isTV() {
34
+ return resolveConstants()?.uiMode === UI_MODE_TV;
35
+ },
36
+ // RN Android's Platform.isVision is a hard false.
37
+ get isVision() {
38
+ return false;
39
+ },
40
+ // RN gates this behind __DEV__; shared has no __DEV__ flag, so we read the native
41
+ // flag directly: a release build's native module reports false anyway.
42
+ get isTesting() {
43
+ return resolveConstants()?.isTesting ?? false;
44
+ },
45
+ get isDisableAnimations() {
46
+ const constants = resolveConstants();
47
+ return constants?.isDisableAnimations ?? constants?.isTesting ?? false;
48
+ },
49
+ get isMacCatalyst() {
50
+ return false;
51
+ },
52
+ // RN's exact Android precedence: android -> native -> default.
53
+ select(spec) {
54
+ if ('android' in spec)
55
+ return spec.android;
56
+ if ('native' in spec)
57
+ return spec.native;
58
+ return spec.default;
59
+ },
60
+ };
@@ -0,0 +1 @@
1
+ export * from './index.ios';
@@ -0,0 +1,18 @@
1
+ import { type IPlatformStatic } from './shared';
2
+ export type { IPlatformOSType, IPlatformSelectSpec, IPlatformStatic } from './shared';
3
+ export interface IPlatformConstantsIOS {
4
+ forceTouchAvailable: boolean;
5
+ interfaceIdiom: string;
6
+ isTesting: boolean;
7
+ isDisableAnimations?: boolean;
8
+ osVersion: string;
9
+ systemName: string;
10
+ reactNativeVersion: {
11
+ major: number;
12
+ minor: number;
13
+ patch: number;
14
+ prerelease?: number | string | null;
15
+ };
16
+ isMacCatalyst?: boolean;
17
+ }
18
+ export declare const Platform: IPlatformStatic<IPlatformConstantsIOS>;
@@ -0,0 +1,62 @@
1
+ // The iOS Platform: a faithful port of RN's Libraries/Utilities/Platform.ios.js. `OS`
2
+ // is the static 'ios'; everything else derives from the PlatformConstants native module
3
+ // (RN spec NativePlatformConstantsIOS.js), read lazily and cached via the shared
4
+ // resolver. Metro picks this on an iOS host; it is also the base re-export target
5
+ // (platform.ts) so tsc / tsx / web (no Metro) land here too. See .docs/decisions/0022.
6
+ import { createConstantsResolver, UNKNOWN_VERSION, } from './shared';
7
+ // interfaceIdiom values RN compares against for the device-class getters.
8
+ const IDIOM_PAD = 'pad';
9
+ const IDIOM_TV = 'tv';
10
+ const IDIOM_VISION = 'vision';
11
+ // 'ios' is a literal, not a runtime probe: the filename already selected this host.
12
+ const OS_IOS = 'ios';
13
+ function isPlatformConstantsIOS(value) {
14
+ if (typeof value !== 'object' || value === null)
15
+ return false;
16
+ return 'osVersion' in value && 'interfaceIdiom' in value;
17
+ }
18
+ const resolveConstants = createConstantsResolver(isPlatformConstantsIOS);
19
+ function idiomEquals(idiom) {
20
+ return resolveConstants()?.interfaceIdiom === idiom;
21
+ }
22
+ export const Platform = {
23
+ OS: OS_IOS,
24
+ get Version() {
25
+ return resolveConstants()?.osVersion ?? UNKNOWN_VERSION;
26
+ },
27
+ // The whole getConstants() payload (RN exposes it as Platform.constants). May be
28
+ // undefined headless: RN would have thrown; we return undefined so callers branch.
29
+ get constants() {
30
+ return resolveConstants();
31
+ },
32
+ get isPad() {
33
+ return idiomEquals(IDIOM_PAD);
34
+ },
35
+ get isTV() {
36
+ return idiomEquals(IDIOM_TV);
37
+ },
38
+ get isVision() {
39
+ return idiomEquals(IDIOM_VISION);
40
+ },
41
+ get isTesting() {
42
+ return resolveConstants()?.isTesting ?? false;
43
+ },
44
+ // RN: isDisableAnimations ?? isTesting. The native flag wins; absent, it tracks
45
+ // isTesting (test runs disable animations by default).
46
+ get isDisableAnimations() {
47
+ const constants = resolveConstants();
48
+ return constants?.isDisableAnimations ?? constants?.isTesting ?? false;
49
+ },
50
+ get isMacCatalyst() {
51
+ return resolveConstants()?.isMacCatalyst ?? false;
52
+ },
53
+ // RN's exact iOS precedence: ios -> native -> default. `in` (not truthiness) so an
54
+ // explicit `undefined`/`false`/`0` under a present key still wins over default.
55
+ select(spec) {
56
+ if ('ios' in spec)
57
+ return spec.ios;
58
+ if ('native' in spec)
59
+ return spec.native;
60
+ return spec.default;
61
+ },
62
+ };
@@ -0,0 +1,5 @@
1
+ // Base / default Platform: re-exports the iOS implementation. Metro overrides this
2
+ // with platform.ios.ts / platform.android.ts on a real host; under tsc / tsx / web
3
+ // (no Metro) resolution lands here. The filename is the selector, no Platform.OS read.
4
+ // See .docs/decisions/0022 (and 0020 for the same split on component names).
5
+ export * from './index.ios';
@@ -0,0 +1,25 @@
1
+ export declare const PLATFORM_CONSTANTS = "PlatformConstants";
2
+ export declare const UNKNOWN_VERSION = "";
3
+ export type IPlatformOSType = 'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native';
4
+ export type IPlatformSelectSpec<T> = {
5
+ ios?: T;
6
+ android?: T;
7
+ macos?: T;
8
+ windows?: T;
9
+ web?: T;
10
+ native?: T;
11
+ default?: T;
12
+ };
13
+ export interface IPlatformStatic<TConstants> {
14
+ readonly OS: IPlatformOSType;
15
+ readonly Version: string | number;
16
+ readonly constants: TConstants | undefined;
17
+ readonly isPad: boolean;
18
+ readonly isTV: boolean;
19
+ readonly isVision: boolean;
20
+ readonly isTesting: boolean;
21
+ readonly isDisableAnimations: boolean;
22
+ readonly isMacCatalyst: boolean;
23
+ select<T>(spec: IPlatformSelectSpec<T>): T | undefined;
24
+ }
25
+ export declare function createConstantsResolver<TConstants>(guard: (value: unknown) => value is TConstants): () => TConstants | undefined;
@@ -0,0 +1,41 @@
1
+ // Shared, platform-neutral Platform bits: the public select/OS types, the static
2
+ // PlatformStatic shape, and the native PlatformConstants resolution machinery: the
3
+ // one place both platform.ios.ts and platform.android.ts pull from. Each platform file
4
+ // owns only what genuinely differs: the OS literal, the constants shape + guard, the
5
+ // select precedence, and the device-class getters. The filename is the selector (Metro
6
+ // picks platform.ios / platform.android by host); no Platform.OS read lives here.
7
+ // See .docs/decisions/0022 (and 0020 for the same split on component names).
8
+ import { dlog } from '../debug';
9
+ import { getNativeModule } from '../native-modules';
10
+ // The native module name RN registers PlatformConstants under, identical on both
11
+ // platforms; only getConstants()'s SHAPE differs, which each platform file guards.
12
+ export const PLATFORM_CONSTANTS = 'PlatformConstants';
13
+ // Native unresolvable (headless, or a binary without it): RN's getters would throw,
14
+ // but a Platform read must never crash a render, so getters fall back to neutral
15
+ // defaults. '' mirrors iOS "unknown OS version"; Android uses 0 for an unknown API level.
16
+ export const UNKNOWN_VERSION = '';
17
+ // Build a cached getConstants() resolver behind a structural guard. The native payload
18
+ // crosses from an untyped HostObject into TConstants only if `guard` vouches for it (no
19
+ // per-call cast); a failing shape is treated as "module absent". Resolved on first
20
+ // access and cached (RN caches in __constants), re-attempted until valid so a
21
+ // later-installed module is still picked up.
22
+ export function createConstantsResolver(guard) {
23
+ let cached;
24
+ return () => {
25
+ if (cached !== undefined)
26
+ return cached;
27
+ const module = getNativeModule(PLATFORM_CONSTANTS);
28
+ if (module === null) {
29
+ dlog('Platform: PlatformConstants not resolvable via native bridge — using defaults');
30
+ return undefined;
31
+ }
32
+ const constants = module.getConstants();
33
+ if (!guard(constants)) {
34
+ dlog('Platform: PlatformConstants.getConstants() returned an unexpected shape — using defaults');
35
+ return undefined;
36
+ }
37
+ dlog('Platform: resolved PlatformConstants');
38
+ cached = constants;
39
+ return cached;
40
+ };
41
+ }
@@ -0,0 +1,19 @@
1
+ export interface IDynamicColorIOSTuple {
2
+ light: IColorValue;
3
+ dark: IColorValue;
4
+ highContrastLight?: IColorValue;
5
+ highContrastDark?: IColorValue;
6
+ }
7
+ export interface IOpaqueColorValue {
8
+ readonly semantic?: readonly string[];
9
+ readonly dynamic?: {
10
+ readonly light: IColorValue;
11
+ readonly dark: IColorValue;
12
+ readonly highContrastLight?: IColorValue;
13
+ readonly highContrastDark?: IColorValue;
14
+ };
15
+ }
16
+ export type IColorValue = string | IOpaqueColorValue;
17
+ export declare function PlatformColor(...names: string[]): IOpaqueColorValue;
18
+ export declare function DynamicColorIOS(tuple: IDynamicColorIOSTuple): IOpaqueColorValue;
19
+ export declare function isOpaqueColorValue(value: unknown): value is IOpaqueColorValue;
@@ -0,0 +1,25 @@
1
+ // PlatformColor / DynamicColorIOS: opaque color values the native side resolves
2
+ // (iOS UIColor: semantic system colors and appearance-aware light/dark tuples).
3
+ // These are pure object constructors with no native dependency, so they live in
4
+ // shared and every adapter re-exports them. The opaque shape ({ semantic } /
5
+ // { dynamic }) is exactly what RN's processColor and the iOS RCTConvert UIColor
6
+ // path read, so our commit-time color seam routes these objects through the
7
+ // injected processor just like CSS-string colors (see commit.ts processValue).
8
+ export function PlatformColor(...names) {
9
+ return { semantic: names };
10
+ }
11
+ export function DynamicColorIOS(tuple) {
12
+ return {
13
+ dynamic: {
14
+ light: tuple.light,
15
+ dark: tuple.dark,
16
+ highContrastLight: tuple.highContrastLight,
17
+ highContrastDark: tuple.highContrastDark,
18
+ },
19
+ };
20
+ }
21
+ // True for the opaque objects above: the color seam uses this to route them
22
+ // through the platform processor alongside CSS-string colors.
23
+ export function isOpaqueColorValue(value) {
24
+ return typeof value === 'object' && value !== null && ('semantic' in value || 'dynamic' in value);
25
+ }
@@ -0,0 +1,4 @@
1
+ type IPostCommitHook = () => void;
2
+ export declare function registerPostCommit(hook: IPostCommitHook): void;
3
+ export declare function runPostCommitHooks(): void;
4
+ export {};
@@ -0,0 +1,16 @@
1
+ // Post-commit hooks: run once after every native commit that changed the tree (after
2
+ // completeRoot, when fresh Fabric tags have just been assigned). The seam exists so a
3
+ // consumer that needs a node's committed tag — today only the Animated native driver,
4
+ // which binds a props node to a view tag — can retry work that ran too early under an
5
+ // async-batched commit (Vue/Svelte schedule completeRoot on a microtask, so lifecycle
6
+ // code can reach a node before its tag exists; React commits synchronously and never
7
+ // queues). A neutral module so commit.ts and animated/props.ts share it without a
8
+ // dependency cycle.
9
+ const hooks = new Set();
10
+ export function registerPostCommit(hook) {
11
+ hooks.add(hook);
12
+ }
13
+ export function runPostCommitHooks() {
14
+ for (const hook of hooks)
15
+ hook();
16
+ }
@@ -0,0 +1 @@
1
+ export declare function processAspectRatio(aspectRatio: number | string | undefined): number | undefined;
@@ -0,0 +1,34 @@
1
+ // JS-side port of RN's processAspectRatio (Libraries/StyleSheet/processAspectRatio.js).
2
+ // Same root cause family as boxShadow/filter: RN registers `aspectRatio` with a JS
3
+ // `process` because enableNativeCSSParsing() defaults to false, so the CSS ratio string
4
+ // ('16 / 9') is resolved to a number IN JS before native. A plain number (the common,
5
+ // already-working form) passes through untouched; this is a no-op for it.
6
+ //
7
+ // RN throws via invariant() in __DEV__ on a malformed value; we dlog and return undefined.
8
+ import { dlog } from './debug';
9
+ // RN processAspectRatio.js:15-63. number → number; ratio string → number; invalid → undefined.
10
+ export function processAspectRatio(aspectRatio) {
11
+ if (typeof aspectRatio === 'number') {
12
+ return aspectRatio;
13
+ }
14
+ if (typeof aspectRatio !== 'string') {
15
+ if (aspectRatio != null) {
16
+ dlog(`processAspectRatio reject: must be a number, ratio string or "auto"`);
17
+ }
18
+ return undefined;
19
+ }
20
+ const matches = aspectRatio.split('/').map(s => s.trim());
21
+ // RN processAspectRatio.js:34-43: `auto` (and `auto <ratio>`) is not a numeric ratio.
22
+ if (matches.includes('auto')) {
23
+ return undefined;
24
+ }
25
+ const hasNonNumericValues = matches.some(n => Number.isNaN(Number(n)));
26
+ if (hasNonNumericValues || (matches.length !== 1 && matches.length !== 2)) {
27
+ dlog(`processAspectRatio reject: invalid ratio string "${aspectRatio}"`);
28
+ return undefined;
29
+ }
30
+ if (matches.length === 2) {
31
+ return Number(matches[0]) / Number(matches[1]);
32
+ }
33
+ return Number(matches[0]);
34
+ }
@@ -0,0 +1,28 @@
1
+ import type { IRadialGradientPosition, IRadialGradientShape, IRadialGradientSize } from '../styles';
2
+ type ILinearGradientDirection = {
3
+ type: 'angle';
4
+ value: number;
5
+ } | {
6
+ type: 'keyword';
7
+ value: string;
8
+ };
9
+ export type IParsedColorStop = {
10
+ color: unknown;
11
+ position: number | string | null;
12
+ };
13
+ export type IParsedLinearGradient = {
14
+ type: 'linear-gradient';
15
+ direction: ILinearGradientDirection;
16
+ colorStops: ReadonlyArray<IParsedColorStop>;
17
+ };
18
+ export type IParsedRadialGradient = {
19
+ type: 'radial-gradient';
20
+ shape: IRadialGradientShape;
21
+ size: IRadialGradientSize;
22
+ position: IRadialGradientPosition;
23
+ colorStops: ReadonlyArray<IParsedColorStop>;
24
+ };
25
+ export type IParsedBackgroundImage = IParsedLinearGradient | IParsedRadialGradient;
26
+ type IRawBackgroundImage = Record<string, unknown>;
27
+ export declare function processBackgroundImage(backgroundImage: ReadonlyArray<IRawBackgroundImage> | string | undefined): IParsedBackgroundImage[];
28
+ export type { IRawBackgroundImage };