@rootnative/web 0.0.0-alpha.4 → 0.0.0-alpha.6

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 (67) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/_virtual/_rolldown/runtime.js +12 -0
  3. package/dist/apis/Animated/AnimatedEvent.d.ts +19 -0
  4. package/dist/apis/Animated/AnimatedEvent.js +52 -0
  5. package/dist/apis/Animated/AnimatedEvent.js.map +1 -0
  6. package/dist/apis/Animated/AnimatedExports.d.ts +20 -0
  7. package/dist/apis/Animated/AnimatedExports.js +32 -0
  8. package/dist/apis/Animated/AnimatedExports.js.map +1 -0
  9. package/dist/apis/Animated/AnimatedImplementation.d.ts +18 -0
  10. package/dist/apis/Animated/AnimatedImplementation.js +79 -0
  11. package/dist/apis/Animated/AnimatedImplementation.js.map +1 -0
  12. package/dist/apis/Animated/animations/Animation.d.ts +29 -0
  13. package/dist/apis/Animated/animations/Animation.js +31 -0
  14. package/dist/apis/Animated/animations/Animation.js.map +1 -0
  15. package/dist/apis/Animated/animations/SpringAnimation.d.ts +17 -0
  16. package/dist/apis/Animated/animations/SpringAnimation.js +132 -0
  17. package/dist/apis/Animated/animations/SpringAnimation.js.map +1 -0
  18. package/dist/apis/Animated/animations/TimingAnimation.d.ts +8 -0
  19. package/dist/apis/Animated/animations/TimingAnimation.js +55 -0
  20. package/dist/apis/Animated/animations/TimingAnimation.js.map +1 -0
  21. package/dist/apis/Animated/animations/springConfig.js +37 -0
  22. package/dist/apis/Animated/animations/springConfig.js.map +1 -0
  23. package/dist/apis/Animated/createAnimatedComponent.d.ts +27 -0
  24. package/dist/apis/Animated/createAnimatedComponent.js +43 -0
  25. package/dist/apis/Animated/createAnimatedComponent.js.map +1 -0
  26. package/dist/apis/Animated/nodes/AnimatedAddition.d.ts +14 -0
  27. package/dist/apis/Animated/nodes/AnimatedAddition.js +36 -0
  28. package/dist/apis/Animated/nodes/AnimatedAddition.js.map +1 -0
  29. package/dist/apis/Animated/nodes/AnimatedInterpolation.d.ts +26 -0
  30. package/dist/apis/Animated/nodes/AnimatedInterpolation.js +171 -0
  31. package/dist/apis/Animated/nodes/AnimatedInterpolation.js.map +1 -0
  32. package/dist/apis/Animated/nodes/AnimatedMultiplication.d.ts +14 -0
  33. package/dist/apis/Animated/nodes/AnimatedMultiplication.js +36 -0
  34. package/dist/apis/Animated/nodes/AnimatedMultiplication.js.map +1 -0
  35. package/dist/apis/Animated/nodes/AnimatedNode.d.ts +29 -0
  36. package/dist/apis/Animated/nodes/AnimatedNode.js +47 -0
  37. package/dist/apis/Animated/nodes/AnimatedNode.js.map +1 -0
  38. package/dist/apis/Animated/nodes/AnimatedObject.js +66 -0
  39. package/dist/apis/Animated/nodes/AnimatedObject.js.map +1 -0
  40. package/dist/apis/Animated/nodes/AnimatedProps.js +88 -0
  41. package/dist/apis/Animated/nodes/AnimatedProps.js.map +1 -0
  42. package/dist/apis/Animated/nodes/AnimatedStyle.js +65 -0
  43. package/dist/apis/Animated/nodes/AnimatedStyle.js.map +1 -0
  44. package/dist/apis/Animated/nodes/AnimatedTransform.js +64 -0
  45. package/dist/apis/Animated/nodes/AnimatedTransform.js.map +1 -0
  46. package/dist/apis/Animated/nodes/AnimatedValue.d.ts +26 -0
  47. package/dist/apis/Animated/nodes/AnimatedValue.js +81 -0
  48. package/dist/apis/Animated/nodes/AnimatedValue.js.map +1 -0
  49. package/dist/apis/Animated/nodes/AnimatedWithChildren.d.ts +9 -0
  50. package/dist/apis/Animated/nodes/AnimatedWithChildren.js +37 -0
  51. package/dist/apis/Animated/nodes/AnimatedWithChildren.js.map +1 -0
  52. package/dist/apis/Animated/useAnimatedProps.js +93 -0
  53. package/dist/apis/Animated/useAnimatedProps.js.map +1 -0
  54. package/dist/apis/Easing/bezier.js +69 -0
  55. package/dist/apis/Easing/bezier.js.map +1 -0
  56. package/dist/apis/Easing/index.d.ts +21 -0
  57. package/dist/apis/Easing/index.js +43 -0
  58. package/dist/apis/Easing/index.js.map +1 -0
  59. package/dist/index.d.ts +24 -22
  60. package/dist/index.js +4 -2
  61. package/dist/style/compile.js +61 -31
  62. package/dist/style/compile.js.map +1 -1
  63. package/dist/style/registry.d.ts +1 -0
  64. package/dist/style/registry.js +3 -0
  65. package/dist/style/registry.js.map +1 -1
  66. package/llms.txt +39 -13
  67. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ export type EasingFunction = (t: number) => number;
2
+ export declare const Easing: {
3
+ step0: (n: number) => number;
4
+ step1: (n: number) => number;
5
+ linear: (t: number) => number;
6
+ ease: (t: number) => number;
7
+ quad: (t: number) => number;
8
+ cubic: (t: number) => number;
9
+ poly: (n: number) => EasingFunction;
10
+ sin: (t: number) => number;
11
+ circle: (t: number) => number;
12
+ exp: (t: number) => number;
13
+ elastic: (bounciness?: number) => EasingFunction;
14
+ back: (s?: number) => EasingFunction;
15
+ bounce: (t: number) => number;
16
+ bezier: (x1: number, y1: number, x2: number, y2: number) => EasingFunction;
17
+ in: (easing: EasingFunction) => EasingFunction;
18
+ out: (easing: EasingFunction) => EasingFunction;
19
+ inOut: (easing: EasingFunction) => EasingFunction;
20
+ };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,43 @@
1
+ import { bezier } from "./bezier.js";
2
+ // src/apis/Easing/index.ts
3
+ let ease;
4
+ const Easing = {
5
+ step0: (n) => n > 0 ? 1 : 0,
6
+ step1: (n) => n >= 1 ? 1 : 0,
7
+ linear: (t) => t,
8
+ ease: (t) => {
9
+ ease ??= bezier(.42, 0, 1, 1);
10
+ return ease(t);
11
+ },
12
+ quad: (t) => t * t,
13
+ cubic: (t) => t * t * t,
14
+ poly: (n) => (t) => Math.pow(t, n),
15
+ sin: (t) => 1 - Math.cos(t * Math.PI / 2),
16
+ circle: (t) => 1 - Math.sqrt(1 - t * t),
17
+ exp: (t) => Math.pow(2, 10 * (t - 1)),
18
+ elastic: (bounciness = 1) => {
19
+ const p = bounciness * Math.PI;
20
+ return (t) => 1 - Math.pow(Math.cos(t * Math.PI / 2), 3) * Math.cos(t * p);
21
+ },
22
+ back: (s = 1.70158) => (t) => t * t * ((s + 1) * t - s),
23
+ bounce: (t) => {
24
+ if (t < 1 / 2.75) return 7.5625 * t * t;
25
+ if (t < 2 / 2.75) {
26
+ const t2 = t - 1.5 / 2.75;
27
+ return 7.5625 * t2 * t2 + .75;
28
+ }
29
+ if (t < 2.5 / 2.75) {
30
+ const t2 = t - 2.25 / 2.75;
31
+ return 7.5625 * t2 * t2 + .9375;
32
+ }
33
+ const t2 = t - 2.625 / 2.75;
34
+ return 7.5625 * t2 * t2 + .984375;
35
+ },
36
+ bezier,
37
+ in: (easing) => easing,
38
+ out: (easing) => (t) => 1 - easing(1 - t),
39
+ inOut: (easing) => (t) => t < .5 ? easing(t * 2) / 2 : 1 - easing((1 - t) * 2) / 2
40
+ };
41
+ export { Easing };
42
+
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/apis/Easing/index.ts"],"sourcesContent":["import { bezier } from './bezier'\n\nexport type EasingFunction = (t: number) => number\n\nlet ease: EasingFunction | undefined\n\nexport const Easing: {\n step0: (n: number) => number\n step1: (n: number) => number\n linear: (t: number) => number\n ease: (t: number) => number\n quad: (t: number) => number\n cubic: (t: number) => number\n poly: (n: number) => EasingFunction\n sin: (t: number) => number\n circle: (t: number) => number\n exp: (t: number) => number\n elastic: (bounciness?: number) => EasingFunction\n back: (s?: number) => EasingFunction\n bounce: (t: number) => number\n bezier: (x1: number, y1: number, x2: number, y2: number) => EasingFunction\n in: (easing: EasingFunction) => EasingFunction\n out: (easing: EasingFunction) => EasingFunction\n inOut: (easing: EasingFunction) => EasingFunction\n} = {\n step0: (n) => (n > 0 ? 1 : 0),\n\n step1: (n) => (n >= 1 ? 1 : 0),\n\n linear: (t) => t,\n\n // React Native's curve, which is CSS `ease-in`, not CSS `ease`. Made on the first use, so an\n // import costs nothing.\n ease: (t) => {\n ease ??= bezier(0.42, 0, 1, 1)\n return ease(t)\n },\n\n quad: (t) => t * t,\n\n cubic: (t) => t * t * t,\n\n poly: (n) => (t) => Math.pow(t, n),\n\n sin: (t) => 1 - Math.cos((t * Math.PI) / 2),\n\n circle: (t) => 1 - Math.sqrt(1 - t * t),\n\n exp: (t) => Math.pow(2, 10 * (t - 1)),\n\n elastic: (bounciness = 1) => {\n const p = bounciness * Math.PI\n return (t) => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p)\n },\n\n back:\n (s = 1.70158) =>\n (t) =>\n t * t * ((s + 1) * t - s),\n\n bounce: (t) => {\n if (t < 1 / 2.75) return 7.5625 * t * t\n if (t < 2 / 2.75) {\n const t2 = t - 1.5 / 2.75\n return 7.5625 * t2 * t2 + 0.75\n }\n if (t < 2.5 / 2.75) {\n const t2 = t - 2.25 / 2.75\n return 7.5625 * t2 * t2 + 0.9375\n }\n const t2 = t - 2.625 / 2.75\n return 7.5625 * t2 * t2 + 0.984375\n },\n\n bezier,\n\n in: (easing) => easing,\n\n out: (easing) => (t) => 1 - easing(1 - t),\n\n inOut: (easing) => (t) => (t < 0.5 ? easing(t * 2) / 2 : 1 - easing((1 - t) * 2) / 2),\n}\n"],"mappings":";;AAIA,IAAI;AAEJ,MAAa,SAkBT;CACF,QAAQ,MAAO,IAAI,IAAI,IAAI;CAE3B,QAAQ,MAAO,KAAK,IAAI,IAAI;CAE5B,SAAS,MAAM;CAIf,OAAO,MAAM;EACX,SAAS,OAAO,KAAM,GAAG,GAAG,CAAC;EAC7B,OAAO,KAAK,CAAC;CACf;CAEA,OAAO,MAAM,IAAI;CAEjB,QAAQ,MAAM,IAAI,IAAI;CAEtB,OAAO,OAAO,MAAM,KAAK,IAAI,GAAG,CAAC;CAEjC,MAAM,MAAM,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,CAAC;CAE1C,SAAS,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC;CAEtC,MAAM,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,EAAE;CAEpC,UAAU,aAAa,MAAM;EAC3B,MAAM,IAAI,aAAa,KAAK;EAC5B,QAAQ,MAAM,IAAI,KAAK,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC;CAC7E;CAEA,OACG,IAAI,aACJ,MACC,IAAI,MAAM,IAAI,KAAK,IAAI;CAE3B,SAAS,MAAM;EACb,IAAI,IAAI,IAAI,MAAM,OAAO,SAAS,IAAI;EACtC,IAAI,IAAI,IAAI,MAAM;GAChB,MAAM,KAAK,IAAI,MAAM;GACrB,OAAO,SAAS,KAAK,KAAK;EAC5B;EACA,IAAI,IAAI,MAAM,MAAM;GAClB,MAAM,KAAK,IAAI,OAAO;GACtB,OAAO,SAAS,KAAK,KAAK;EAC5B;EACA,MAAM,KAAK,IAAI,QAAQ;EACvB,OAAO,SAAS,KAAK,KAAK;CAC5B;CAEA;CAEA,KAAK,WAAW;CAEhB,MAAM,YAAY,MAAM,IAAI,OAAO,IAAI,CAAC;CAExC,QAAQ,YAAY,MAAO,IAAI,KAAM,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI;AACrF"}
package/dist/index.d.ts CHANGED
@@ -1,61 +1,63 @@
1
1
  import { AccessibilityAnnouncementFinishedEvent, AccessibilityChangeEvent, AccessibilityChangeEventName, AccessibilityEventSubscription, AccessibilityInfo } from "./apis/AccessibilityInfo/index.js";
2
2
  import { Alert, AlertButton, AlertButtonStyle, AlertOptions, AlertType } from "./apis/Alert/index.js";
3
+ import { BoxShadowValue, ColorValue, CursorValue, DimensionValue, DropShadowValue, EdgeInsetsValue, FilterFunction, FontVariant, ImageResizeMode, ImageStyle, NativeColorValue, OpaqueColorValue, PointValue, TextStyle, TransformsStyle, ViewStyle } from "./apis/StyleSheet/types.js";
4
+ import { AnimatedExports_d_exports } from "./apis/Animated/AnimatedExports.js";
5
+ import { Insets, PressabilityConfig, PressabilityEventHandlers } from "./events/press/types.js";
6
+ import { StyleProp } from "./style/types.js";
7
+ import { AccessibilityActionEvent, AccessibilityProps, AccessibilityState, AccessibilityValue, DOMEventHandlers, HostComponent, HostInstance, HostMethods, LayoutChangeEvent, LayoutRectangle, MeasureInWindowOnSuccessCallback, MeasureLayoutOnSuccessCallback, MeasureOnSuccessCallback, Role, ViewInstance, ViewProps } from "./components/View/types.js";
8
+ import { PressEvent, TextInstance, TextProps } from "./components/Text/types.js";
9
+ import { TextAncestorContext } from "./components/Text/TextAncestorContext.js";
3
10
  import { Appearance, AppearanceListener, AppearancePreferences, ColorSchemeName, NativeEventSubscription } from "./apis/Appearance/index.js";
4
11
  import { AppState, AppStateEvent, AppStateStatus } from "./apis/AppState/index.js";
5
12
  import { BackHandler, BackHandlerSubscription, BackPressHandler } from "./apis/BackHandler/index.js";
6
13
  import { Clipboard } from "./apis/Clipboard/index.js";
7
14
  import { Dimensions, DimensionsChangeHandler, DimensionsValue, EmitterSubscription, ScaledSize } from "./apis/Dimensions/index.js";
15
+ import { Easing, EasingFunction } from "./apis/Easing/index.js";
8
16
  import { I18nManager, I18nManagerConstants } from "./apis/I18nManager/index.js";
9
17
  import { AndroidKeyboardEvent, IOSKeyboardEvent, Keyboard, KeyboardEvent, KeyboardEventEasing, KeyboardEventName, KeyboardMetrics } from "./apis/Keyboard/index.js";
10
18
  import { Linking } from "./apis/Linking/index.js";
11
19
  import { GestureResponderHandlers, PanResponder, PanResponderCallbacks, PanResponderGestureState, PanResponderInstance } from "./apis/PanResponder/index.js";
12
20
  import { PixelRatio } from "./apis/PixelRatio/index.js";
13
21
  import { Platform } from "./apis/Platform/index.js";
14
- import { PlatformOSType, PlatformSelectSpec, PlatformType } from "./apis/Platform/types.js";
15
22
  import { ProcessedColorValue, processColor } from "./apis/processColor/index.js";
16
23
  import { Share, ShareAction, ShareContent, ShareOptions } from "./apis/Share/index.js";
24
+ import { PlatformOSType, PlatformSelectSpec, PlatformType } from "./apis/Platform/types.js";
17
25
  import { AbsoluteFillStyle, StyleSheet } from "./apis/StyleSheet/index.js";
18
- import { StyleProp } from "./style/types.js";
19
- import { BoxShadowValue, ColorValue, CursorValue, DimensionValue, DropShadowValue, EdgeInsetsValue, FilterFunction, FontVariant, ImageResizeMode, ImageStyle, NativeColorValue, OpaqueColorValue, PointValue, TextStyle, TransformsStyle, ViewStyle } from "./apis/StyleSheet/types.js";
20
26
  import { useColorScheme } from "./apis/useColorScheme/index.js";
21
27
  import { useWindowDimensions } from "./apis/useWindowDimensions/index.js";
22
28
  import { Vibration } from "./apis/Vibration/index.js";
23
29
  import { ActivityIndicator } from "./components/ActivityIndicator/index.js";
24
- import { AccessibilityActionEvent, AccessibilityProps, AccessibilityState, AccessibilityValue, DOMEventHandlers, HostComponent, HostInstance, HostMethods, LayoutChangeEvent, LayoutRectangle, MeasureInWindowOnSuccessCallback, MeasureLayoutOnSuccessCallback, MeasureOnSuccessCallback, Role, ViewInstance, ViewProps } from "./components/View/types.js";
25
- import { ActivityIndicatorProps } from "./components/ActivityIndicator/types.js";
26
30
  import { Button } from "./components/Button/index.js";
27
- import { Insets, PressabilityConfig, PressabilityEventHandlers } from "./events/press/types.js";
31
+ import { FlatList } from "./components/FlatList/index.js";
32
+ import { ActivityIndicatorProps } from "./components/ActivityIndicator/types.js";
33
+ import { Image } from "./components/Image/index.js";
28
34
  import { TouchableWithoutFeedbackProps } from "./components/TouchableWithoutFeedback/types.js";
29
35
  import { ButtonProps } from "./components/Button/types.js";
30
- import { FlatList } from "./components/FlatList/index.js";
36
+ import { KeyboardAvoidingView } from "./components/KeyboardAvoidingView/index.js";
31
37
  import { NativeScrollEvent, NativeScrollPoint, NativeScrollRectangle, NativeScrollSize, ScrollEvent, ScrollToOptions, ScrollViewInstance, ScrollViewProps } from "./components/ScrollView/types.js";
32
38
  import { CellRendererProps, FlatListInstance, FlatListProps, ListRenderItem, ListRenderItemInfo, ListSeparatorComponent, ListSeparatorProps, ListSeparators, ScrollToIndexParams, ScrollToItemParams, ScrollToOffsetParams, ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs, ViewableItemsChangedInfo } from "./components/FlatList/types.js";
33
- import { Image } from "./components/Image/index.js";
34
- import { ImageErrorEvent, ImageInstance, ImageLoadEvent, ImageLoadEventData, ImageProgressEvent, ImageProps, ImageResolvedAssetSource, ImageSize, ImageSource, ImageStatics, ImageURISource } from "./components/Image/types.js";
35
- import { KeyboardAvoidingView } from "./components/KeyboardAvoidingView/index.js";
36
- import { KeyboardAvoidingViewInstance, KeyboardAvoidingViewProps } from "./components/KeyboardAvoidingView/types.js";
37
39
  import { Modal } from "./components/Modal/index.js";
38
- import { ModalEvent, ModalOrientationChangeEvent, ModalProps } from "./components/Modal/types.js";
40
+ import { ImageErrorEvent, ImageInstance, ImageLoadEvent, ImageLoadEventData, ImageProgressEvent, ImageProps, ImageResolvedAssetSource, ImageSize, ImageSource, ImageStatics, ImageURISource } from "./components/Image/types.js";
39
41
  import { Pressable } from "./components/Pressable/index.js";
40
- import { PressableAndroidRippleConfig, PressableInstance, PressableProps, PressableStateCallbackType } from "./components/Pressable/types.js";
42
+ import { KeyboardAvoidingViewInstance, KeyboardAvoidingViewProps } from "./components/KeyboardAvoidingView/types.js";
41
43
  import { RefreshControl } from "./components/RefreshControl/index.js";
42
- import { RefreshControlProps } from "./components/RefreshControl/types.js";
44
+ import { ModalEvent, ModalOrientationChangeEvent, ModalProps } from "./components/Modal/types.js";
43
45
  import { ScrollView } from "./components/ScrollView/index.js";
46
+ import { PressableAndroidRippleConfig, PressableInstance, PressableProps, PressableStateCallbackType } from "./components/Pressable/types.js";
44
47
  import { StatusBar, StatusBarAnimation, StatusBarProps, StatusBarStatics, StatusBarStyle } from "./components/StatusBar/index.js";
48
+ import { RefreshControlProps } from "./components/RefreshControl/types.js";
45
49
  import { Switch } from "./components/Switch/index.js";
46
- import { SwitchChangeEvent, SwitchChangeEventData, SwitchProps } from "./components/Switch/types.js";
47
50
  import { Text } from "./components/Text/index.js";
48
- import { PressEvent, TextInstance, TextProps } from "./components/Text/types.js";
49
- import { TextAncestorContext } from "./components/Text/TextAncestorContext.js";
50
51
  import { TextInput } from "./components/TextInput/index.js";
51
- import { EnterKeyHint, InputMode, KeyboardType, ReturnKeyType, SubmitBehavior, TextInputChangeEvent, TextInputChangeEventData, TextInputContentSizeChangeEvent, TextInputEndEditingEvent, TextInputFocusEvent, TextInputInstance, TextInputKeyPressEvent, TextInputProps, TextInputScrollEvent, TextInputSelection, TextInputSelectionChangeEvent, TextInputState, TextInputSubmitEditingEvent } from "./components/TextInput/types.js";
52
+ import { SwitchChangeEvent, SwitchChangeEventData, SwitchProps } from "./components/Switch/types.js";
52
53
  import { TouchableHighlight } from "./components/TouchableHighlight/index.js";
53
- import { TouchableHighlightProps } from "./components/TouchableHighlight/types.js";
54
+ import { EnterKeyHint, InputMode, KeyboardType, ReturnKeyType, SubmitBehavior, TextInputChangeEvent, TextInputChangeEventData, TextInputContentSizeChangeEvent, TextInputEndEditingEvent, TextInputFocusEvent, TextInputInstance, TextInputKeyPressEvent, TextInputProps, TextInputScrollEvent, TextInputSelection, TextInputSelectionChangeEvent, TextInputState, TextInputSubmitEditingEvent } from "./components/TextInput/types.js";
54
55
  import { TouchableNativeFeedback } from "./components/TouchableNativeFeedback/index.js";
55
- import { TouchableNativeFeedbackProps } from "./components/TouchableNativeFeedback/types.js";
56
+ import { TouchableHighlightProps } from "./components/TouchableHighlight/types.js";
56
57
  import { TouchableOpacity } from "./components/TouchableOpacity/index.js";
57
- import { TouchableOpacityProps } from "./components/TouchableOpacity/types.js";
58
+ import { TouchableNativeFeedbackProps } from "./components/TouchableNativeFeedback/types.js";
58
59
  import { TouchableWithoutFeedback } from "./components/TouchableWithoutFeedback/index.js";
60
+ import { TouchableOpacityProps } from "./components/TouchableOpacity/types.js";
59
61
  import { View } from "./components/View/index.js";
60
62
  import { CreateElementProps, unstable_createElement } from "./compat/createElement/index.js";
61
63
  import { findNodeHandle } from "./compat/findNodeHandle/index.js";
@@ -70,5 +72,5 @@ declare global {
70
72
  */
71
73
  const __DEV__: boolean;
72
74
  }
73
- export { type AbsoluteFillStyle, type AccessibilityActionEvent, type AccessibilityAnnouncementFinishedEvent, type AccessibilityChangeEvent, type AccessibilityChangeEventName, type AccessibilityEventSubscription, AccessibilityInfo, type AccessibilityProps, type AccessibilityState, type AccessibilityValue, ActivityIndicator, type ActivityIndicatorProps, Alert, type AlertButton, type AlertButtonStyle, type AlertOptions, type AlertType, type AndroidKeyboardEvent, AppState, type AppStateEvent, type AppStateStatus, Appearance, type AppearanceListener, type AppearancePreferences, BackHandler, type BackHandlerSubscription, type BackPressHandler, type BlurEvent, type BoxShadowValue, Button, type ButtonProps, type CellRendererProps, Clipboard, type ColorSchemeName, type ColorValue, type CreateElementProps, type CursorValue, type DOMEventHandlers, type DimensionValue, Dimensions, type DimensionsChangeHandler, type DimensionsValue, type DropShadowValue, type EdgeInsetsValue, type EmitterSubscription, type EnterKeyHint, type EventSubscription, type FilterFunction, FlatList, type FlatListInstance, type FlatListProps, type FocusEvent, type FontVariant, type GestureResponderEvent, type GestureResponderHandlers, type HostComponent, type HostInstance, type HostMethods, I18nManager, type I18nManagerConstants, type IOSKeyboardEvent, Image, type ImageErrorEvent, type ImageInstance, type ImageLoadEvent, type ImageLoadEventData, type ImageProgressEvent, type ImageProps, type ImageResizeMode, type ImageResolvedAssetSource, type ImageSize, type ImageSource, type ImageStatics, type ImageStyle, type ImageURISource, type InputMode, type Insets, Keyboard, KeyboardAvoidingView, type KeyboardAvoidingViewInstance, type KeyboardAvoidingViewProps, type KeyboardEvent, type KeyboardEventEasing, type KeyboardEventName, type KeyboardMetrics, type KeyboardType, type LayoutChangeEvent, type LayoutRectangle, Linking, type ListRenderItem, type ListRenderItemInfo, type ListSeparatorComponent, type ListSeparatorProps, type ListSeparators, type MeasureInWindowOnSuccessCallback, type MeasureLayoutOnSuccessCallback, type MeasureOnSuccessCallback, Modal, type ModalEvent, type ModalOrientationChangeEvent, type ModalProps, type MouseEvent, type NativeColorValue, type NativeEventSubscription, type NativeScrollEvent, type NativeScrollPoint, type NativeScrollRectangle, type NativeScrollSize, type NativeSyntheticEvent, type NativeTouchEvent, type OpaqueColorValue, PanResponder, type PanResponderCallbacks, type PanResponderGestureState, type PanResponderInstance, PixelRatio, Platform, type PlatformOSType, type PlatformSelectSpec, type PlatformType, type PointValue, type PointerEvent, type PressEvent, type PressabilityConfig, type PressabilityEventHandlers, Pressable, type PressableAndroidRippleConfig, type PressableInstance, type PressableProps, type PressableStateCallbackType, type ProcessedColorValue, RefreshControl, type RefreshControlProps, type ReturnKeyType, type Role, type ScaledSize, type ScrollEvent, type ScrollToIndexParams, type ScrollToItemParams, type ScrollToOffsetParams, type ScrollToOptions, ScrollView, type ScrollViewInstance, type ScrollViewProps, Share, type ShareAction, type ShareContent, type ShareOptions, StatusBar, type StatusBarAnimation, type StatusBarProps, type StatusBarStatics, type StatusBarStyle, type StyleProp, StyleSheet, type SubmitBehavior, Switch, type SwitchChangeEvent, type SwitchChangeEventData, type SwitchProps, type TargetedEvent, Text, TextAncestorContext, TextInput, type TextInputChangeEvent, type TextInputChangeEventData, type TextInputContentSizeChangeEvent, type TextInputEndEditingEvent, type TextInputFocusEvent, type TextInputInstance, type TextInputKeyPressEvent, type TextInputProps, type TextInputScrollEvent, type TextInputSelection, type TextInputSelectionChangeEvent, type TextInputState, type TextInputSubmitEditingEvent, type TextInstance, type TextProps, type TextStyle, TouchableHighlight, type TouchableHighlightProps, TouchableNativeFeedback, type TouchableNativeFeedbackProps, TouchableOpacity, type TouchableOpacityProps, TouchableWithoutFeedback, type TouchableWithoutFeedbackProps, type TransformsStyle, type TurboModule, TurboModuleRegistry, Vibration, View, type ViewInstance, type ViewProps, type ViewStyle, type ViewToken, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableItemsChangedInfo, findNodeHandle, processColor, unstable_createElement, useColorScheme, usePressability, useWindowDimensions };
75
+ export { type AbsoluteFillStyle, type AccessibilityActionEvent, type AccessibilityAnnouncementFinishedEvent, type AccessibilityChangeEvent, type AccessibilityChangeEventName, type AccessibilityEventSubscription, AccessibilityInfo, type AccessibilityProps, type AccessibilityState, type AccessibilityValue, ActivityIndicator, type ActivityIndicatorProps, Alert, type AlertButton, type AlertButtonStyle, type AlertOptions, type AlertType, type AndroidKeyboardEvent, AnimatedExports_d_exports as Animated, AppState, type AppStateEvent, type AppStateStatus, Appearance, type AppearanceListener, type AppearancePreferences, BackHandler, type BackHandlerSubscription, type BackPressHandler, type BlurEvent, type BoxShadowValue, Button, type ButtonProps, type CellRendererProps, Clipboard, type ColorSchemeName, type ColorValue, type CreateElementProps, type CursorValue, type DOMEventHandlers, type DimensionValue, Dimensions, type DimensionsChangeHandler, type DimensionsValue, type DropShadowValue, Easing, type EasingFunction, type EdgeInsetsValue, type EmitterSubscription, type EnterKeyHint, type EventSubscription, type FilterFunction, FlatList, type FlatListInstance, type FlatListProps, type FocusEvent, type FontVariant, type GestureResponderEvent, type GestureResponderHandlers, type HostComponent, type HostInstance, type HostMethods, I18nManager, type I18nManagerConstants, type IOSKeyboardEvent, Image, type ImageErrorEvent, type ImageInstance, type ImageLoadEvent, type ImageLoadEventData, type ImageProgressEvent, type ImageProps, type ImageResizeMode, type ImageResolvedAssetSource, type ImageSize, type ImageSource, type ImageStatics, type ImageStyle, type ImageURISource, type InputMode, type Insets, Keyboard, KeyboardAvoidingView, type KeyboardAvoidingViewInstance, type KeyboardAvoidingViewProps, type KeyboardEvent, type KeyboardEventEasing, type KeyboardEventName, type KeyboardMetrics, type KeyboardType, type LayoutChangeEvent, type LayoutRectangle, Linking, type ListRenderItem, type ListRenderItemInfo, type ListSeparatorComponent, type ListSeparatorProps, type ListSeparators, type MeasureInWindowOnSuccessCallback, type MeasureLayoutOnSuccessCallback, type MeasureOnSuccessCallback, Modal, type ModalEvent, type ModalOrientationChangeEvent, type ModalProps, type MouseEvent, type NativeColorValue, type NativeEventSubscription, type NativeScrollEvent, type NativeScrollPoint, type NativeScrollRectangle, type NativeScrollSize, type NativeSyntheticEvent, type NativeTouchEvent, type OpaqueColorValue, PanResponder, type PanResponderCallbacks, type PanResponderGestureState, type PanResponderInstance, PixelRatio, Platform, type PlatformOSType, type PlatformSelectSpec, type PlatformType, type PointValue, type PointerEvent, type PressEvent, type PressabilityConfig, type PressabilityEventHandlers, Pressable, type PressableAndroidRippleConfig, type PressableInstance, type PressableProps, type PressableStateCallbackType, type ProcessedColorValue, RefreshControl, type RefreshControlProps, type ReturnKeyType, type Role, type ScaledSize, type ScrollEvent, type ScrollToIndexParams, type ScrollToItemParams, type ScrollToOffsetParams, type ScrollToOptions, ScrollView, type ScrollViewInstance, type ScrollViewProps, Share, type ShareAction, type ShareContent, type ShareOptions, StatusBar, type StatusBarAnimation, type StatusBarProps, type StatusBarStatics, type StatusBarStyle, type StyleProp, StyleSheet, type SubmitBehavior, Switch, type SwitchChangeEvent, type SwitchChangeEventData, type SwitchProps, type TargetedEvent, Text, TextAncestorContext, TextInput, type TextInputChangeEvent, type TextInputChangeEventData, type TextInputContentSizeChangeEvent, type TextInputEndEditingEvent, type TextInputFocusEvent, type TextInputInstance, type TextInputKeyPressEvent, type TextInputProps, type TextInputScrollEvent, type TextInputSelection, type TextInputSelectionChangeEvent, type TextInputState, type TextInputSubmitEditingEvent, type TextInstance, type TextProps, type TextStyle, TouchableHighlight, type TouchableHighlightProps, TouchableNativeFeedback, type TouchableNativeFeedbackProps, TouchableOpacity, type TouchableOpacityProps, TouchableWithoutFeedback, type TouchableWithoutFeedbackProps, type TransformsStyle, type TurboModule, TurboModuleRegistry, Vibration, View, type ViewInstance, type ViewProps, type ViewStyle, type ViewToken, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableItemsChangedInfo, findNodeHandle, processColor, unstable_createElement, useColorScheme, usePressability, useWindowDimensions };
74
76
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import { AccessibilityInfo } from "./apis/AccessibilityInfo/index.js";
2
2
  import { Alert } from "./apis/Alert/index.js";
3
+ import { AnimatedExports_exports } from "./apis/Animated/AnimatedExports.js";
3
4
  import { Appearance } from "./apis/Appearance/index.js";
5
+ import { TextAncestorContext } from "./components/Text/TextAncestorContext.js";
4
6
  import { AppState } from "./apis/AppState/index.js";
5
7
  import { BackHandler } from "./apis/BackHandler/index.js";
6
8
  import { Clipboard } from "./apis/Clipboard/index.js";
7
9
  import { Dimensions } from "./apis/Dimensions/index.js";
10
+ import { Easing } from "./apis/Easing/index.js";
8
11
  import { I18nManager } from "./apis/I18nManager/index.js";
9
12
  import { Keyboard } from "./apis/Keyboard/index.js";
10
13
  import { Linking } from "./apis/Linking/index.js";
@@ -20,7 +23,6 @@ import { Vibration } from "./apis/Vibration/index.js";
20
23
  import { ActivityIndicator } from "./components/ActivityIndicator/index.js";
21
24
  import { Button } from "./components/Button/index.js";
22
25
  import { FlatList } from "./components/FlatList/index.js";
23
- import { TextAncestorContext } from "./components/Text/TextAncestorContext.js";
24
26
  import { Image } from "./components/Image/index.js";
25
27
  import { KeyboardAvoidingView } from "./components/KeyboardAvoidingView/index.js";
26
28
  import { Modal } from "./components/Modal/index.js";
@@ -40,4 +42,4 @@ import { unstable_createElement } from "./compat/createElement/index.js";
40
42
  import { findNodeHandle } from "./compat/findNodeHandle/index.js";
41
43
  import { TurboModuleRegistry } from "./compat/TurboModuleRegistry/index.js";
42
44
  import { usePressability } from "./events/press/usePressability.js";
43
- export { AccessibilityInfo, ActivityIndicator, Alert, AppState, Appearance, BackHandler, Button, Clipboard, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, PanResponder, PixelRatio, Platform, Pressable, RefreshControl, ScrollView, Share, StatusBar, StyleSheet, Switch, Text, TextAncestorContext, TextInput, TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, TurboModuleRegistry, Vibration, View, findNodeHandle, processColor, unstable_createElement, useColorScheme, usePressability, useWindowDimensions };
45
+ export { AccessibilityInfo, ActivityIndicator, Alert, AnimatedExports_exports as Animated, AppState, Appearance, BackHandler, Button, Clipboard, Dimensions, Easing, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, PanResponder, PixelRatio, Platform, Pressable, RefreshControl, ScrollView, Share, StatusBar, StyleSheet, Switch, Text, TextAncestorContext, TextInput, TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, TurboModuleRegistry, Vibration, View, findNodeHandle, processColor, unstable_createElement, useColorScheme, usePressability, useWindowDimensions };
@@ -23,50 +23,80 @@ const pointerEventsStyle = Object.freeze({
23
23
  "box-none": Object.freeze({ pointerEvents: "box-none" }),
24
24
  "box-only": Object.freeze({ pointerEvents: "box-only" })
25
25
  });
26
- const caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
27
- const collectFrozen = (style, out) => {
28
- if (style === null || style === void 0 || style === false || style === "") return true;
26
+ const newNode = () => ({
27
+ classes: void 0,
28
+ frozen: void 0,
29
+ values: void 0
30
+ });
31
+ let caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
32
+ const MAX_VALUE_NODES = 1e4;
33
+ let valueNodes = 0;
34
+ const walk = (style, node) => {
35
+ if (style === null || style === void 0 || style === false || style === "") return node;
29
36
  if (Array.isArray(style)) {
30
- for (const entry of style) if (!collectFrozen(entry, out)) return false;
31
- return true;
37
+ let current = node;
38
+ for (const entry of style) {
39
+ current = walk(entry, current);
40
+ if (current === void 0) return void 0;
41
+ }
42
+ return current;
43
+ }
44
+ if (typeof style !== "object") return void 0;
45
+ if (Object.isFrozen(style)) {
46
+ const frozen = node.frozen ??= /* @__PURE__ */ new WeakMap();
47
+ let next = frozen.get(style);
48
+ if (next === void 0) {
49
+ next = newNode();
50
+ frozen.set(style, next);
51
+ }
52
+ return next;
53
+ }
54
+ let current = node;
55
+ for (const name in style) {
56
+ if (!Object.hasOwn(style, name)) continue;
57
+ const value = style[name];
58
+ const type = typeof value;
59
+ if (type === "object" && value !== null || type === "function") return void 0;
60
+ const values = current.values ??= /* @__PURE__ */ new Map();
61
+ let byValue = values.get(name);
62
+ if (byValue === void 0) {
63
+ byValue = /* @__PURE__ */ new Map();
64
+ values.set(name, byValue);
65
+ }
66
+ let next = byValue.get(value);
67
+ if (next === void 0) {
68
+ next = newNode();
69
+ byValue.set(value, next);
70
+ valueNodes += 1;
71
+ }
72
+ current = next;
32
73
  }
33
- if (typeof style !== "object" || !Object.isFrozen(style)) return false;
34
- out.push(style);
35
- return true;
74
+ return current;
36
75
  };
37
76
  const compileFlat = (flat, registry) => flat === void 0 ? "" : joinClassNames(registry.classesFor(resolveStyle(flat)), boxPointerEventsClass(flat["pointerEvents"], registry));
38
77
  const compileStyle = (style, registry = getStyleRegistry()) => {
39
- const frozen = [];
40
- if (!collectFrozen(style, frozen)) return compileFlat(flattenStyle(style), registry);
41
- if (frozen.length === 0) return "";
42
- const cache = caches[getLeftAndRightSwap() ? 1 : 0];
43
- let level = cache.get(registry);
44
- if (level === void 0) {
45
- level = /* @__PURE__ */ new WeakMap();
46
- cache.set(registry, level);
78
+ if (style === null || style === void 0 || style === false || style === "") return "";
79
+ if (valueNodes > 1e4) {
80
+ caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
81
+ valueNodes = 0;
47
82
  }
48
- let node;
49
- for (const object of frozen) {
50
- if (node !== void 0) level = node.next ??= /* @__PURE__ */ new WeakMap();
51
- node = level.get(object);
52
- if (node === void 0) {
53
- node = {
54
- classes: void 0,
55
- next: void 0
56
- };
57
- level.set(object, node);
58
- }
83
+ const cache = caches[getLeftAndRightSwap() ? 1 : 0];
84
+ let root = cache.get(registry);
85
+ if (root === void 0) {
86
+ root = newNode();
87
+ cache.set(registry, root);
59
88
  }
60
- const leaf = node;
61
- leaf.classes ??= compileFlat(frozen.length === 1 ? frozen[0] : flattenStyle(frozen), registry);
89
+ const leaf = walk(style, root);
90
+ if (leaf === void 0) return compileFlat(flattenStyle(style), registry);
91
+ leaf.classes ??= compileFlat(flattenStyle(style), registry);
62
92
  return leaf.classes;
63
93
  };
64
94
  /**
65
95
  * The class of a component's default style, in the reset sheet. Any style of the app beats it,
66
96
  * as any style beats the defaults of native layout.
67
97
  */
68
- const compileReset = (className, style, registry = getStyleRegistry()) => registry.resetClass(className, resolveStyle(style));
98
+ const compileReset = (className, style, registry = getStyleRegistry()) => registry.hasClass(className) ? className : registry.resetClass(className, resolveStyle(style));
69
99
  const joinClassNames = (...names) => names.filter((name) => typeof name === "string" && name !== "").join(" ");
70
- export { compileReset, compileStyle, flattenStyle, joinClassNames, pointerEventsStyle };
100
+ export { MAX_VALUE_NODES, compileReset, compileStyle, flattenStyle, joinClassNames, pointerEventsStyle };
71
101
 
72
102
  //# sourceMappingURL=compile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","names":[],"sources":["../../src/style/compile.ts"],"sourcesContent":["import { getLeftAndRightSwap } from './direction'\nimport { getStyleRegistry, type StyleRegistry } from './registry'\nimport { resolveStyle } from './resolveStyle'\nimport type { FlatStyle, StyleProp } from './types'\n\nexport const flattenStyle = <T extends object>(style: StyleProp<T>): T | undefined => {\n if (style === null || style === undefined || style === false || style === '') return undefined\n if (!Array.isArray(style)) return style as T\n\n let result: object | undefined\n for (const entry of style as ReadonlyArray<StyleProp<T>>) {\n const flat = flattenStyle(entry)\n if (flat === undefined) continue\n result = result === undefined ? { ...flat } : Object.assign(result, flat)\n }\n return result as T | undefined\n}\n\n// A child selector can't be an atomic class. The child rule of `box-none` has no specificity, so\n// a child with its own `pointerEvents` keeps it. The children of `box-only` are never a target.\nconst boxPointerEventsClass = (value: unknown, registry: StyleRegistry): string | undefined => {\n if (value === 'box-none') {\n return registry.staticClass('rn-pe-box-none', [\n '.rn-pe-box-none{pointer-events:none}',\n ':where(.rn-pe-box-none)>*{pointer-events:auto}',\n ])\n }\n if (value === 'box-only') {\n return registry.staticClass('rn-pe-box-only', [\n '.rn-pe-box-only{pointer-events:auto}',\n '.rn-pe-box-only>*{pointer-events:none!important}',\n ])\n }\n return undefined\n}\n\n// The `pointerEvents` prop as a style. The prop wins over the same key of `style`.\nexport const pointerEventsStyle: Readonly<\n Record<'auto' | 'none' | 'box-none' | 'box-only', FlatStyle>\n> = Object.freeze({\n auto: Object.freeze({ pointerEvents: 'auto' }),\n none: Object.freeze({ pointerEvents: 'none' }),\n 'box-none': Object.freeze({ pointerEvents: 'box-none' }),\n 'box-only': Object.freeze({ pointerEvents: 'box-only' }),\n})\n\n// A path through the cache, one frozen style object for each step. The classes of a node are the\n// classes of the objects on its path, flattened in that order.\ntype CacheNode = { classes: string | undefined; next: WeakMap<FlatStyle, CacheNode> | undefined }\n\n// One cache for each value of the left and right swap, because the classes of a style differ.\nconst caches = [\n new WeakMap<StyleRegistry, WeakMap<FlatStyle, CacheNode>>(),\n new WeakMap<StyleRegistry, WeakMap<FlatStyle, CacheNode>>(),\n] as const\n\n// Static objects from StyleSheet.create are frozen, so they can be cache keys. Returns false at\n// the first entry that isn't a frozen object. `Object.isFrozen` is true for a number, and a\n// WeakMap throws on it.\nconst collectFrozen = (style: StyleProp<object>, out: FlatStyle[]): boolean => {\n if (style === null || style === undefined || style === false || style === '') return true\n if (Array.isArray(style)) {\n for (const entry of style as ReadonlyArray<StyleProp<object>>) {\n if (!collectFrozen(entry, out)) return false\n }\n return true\n }\n if (typeof style !== 'object' || !Object.isFrozen(style)) return false\n out.push(style as FlatStyle)\n return true\n}\n\nconst compileFlat = (flat: FlatStyle | undefined, registry: StyleRegistry): string =>\n flat === undefined\n ? ''\n : joinClassNames(\n registry.classesFor(resolveStyle(flat)),\n boxPointerEventsClass(flat['pointerEvents'], registry),\n )\n\nexport const compileStyle = (\n style: StyleProp<object>,\n registry: StyleRegistry = getStyleRegistry(),\n): string => {\n const frozen: FlatStyle[] = []\n if (!collectFrozen(style, frozen)) {\n return compileFlat(flattenStyle(style) as FlatStyle | undefined, registry)\n }\n if (frozen.length === 0) return ''\n\n const cache = caches[getLeftAndRightSwap() ? 1 : 0]\n let level = cache.get(registry)\n if (level === undefined) {\n level = new WeakMap()\n cache.set(registry, level)\n }\n let node: CacheNode | undefined\n for (const object of frozen) {\n if (node !== undefined) level = node.next ??= new WeakMap()\n node = level.get(object)\n if (node === undefined) {\n node = { classes: undefined, next: undefined }\n level.set(object, node)\n }\n }\n const leaf = node as CacheNode\n leaf.classes ??= compileFlat(\n frozen.length === 1 ? frozen[0] : flattenStyle<FlatStyle>(frozen),\n registry,\n )\n return leaf.classes\n}\n\n/**\n * The class of a component's default style, in the reset sheet. Any style of the app beats it,\n * as any style beats the defaults of native layout.\n */\nexport const compileReset = (\n className: string,\n style: FlatStyle,\n registry: StyleRegistry = getStyleRegistry(),\n): string => registry.resetClass(className, resolveStyle(style))\n\n// Joins class names and skips the empty ones.\nexport const joinClassNames = (...names: ReadonlyArray<string | false | undefined>): string =>\n names.filter((name) => typeof name === 'string' && name !== '').join(' ')\n"],"mappings":";;;;AAKA,MAAa,gBAAkC,UAAuC;CACpF,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,SAAS,UAAU,IAAI,OAAO,KAAA;CACrF,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,IAAI;CACJ,KAAK,MAAM,SAAS,OAAsC;EACxD,MAAM,OAAO,aAAa,KAAK;EAC/B,IAAI,SAAS,KAAA,GAAW;EACxB,SAAS,WAAW,KAAA,IAAY,EAAE,GAAG,KAAK,IAAI,OAAO,OAAO,QAAQ,IAAI;CAC1E;CACA,OAAO;AACT;AAIA,MAAM,yBAAyB,OAAgB,aAAgD;CAC7F,IAAI,UAAU,YACZ,OAAO,SAAS,YAAY,kBAAkB,CAC5C,wCACA,gDACF,CAAC;CAEH,IAAI,UAAU,YACZ,OAAO,SA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,QAAQ;EAC3B,IAAI,SAAS,KAAA,GAAW,QAAQ,KAAK,yBAAS,IAAI,QAAQ;EAC1D,OAAO,MAAM,IAAI,MAAM;EACvB,IAAI,SAAS,KAAA,GAAW;GACtB,OAAO;IAAE,SAAS,KAAA;IAAW,MAAM,KAAA;GAAU;GAC7C,MAAM,IAAI,QAAQ,IAAI;EACxB;CACF;CACA,MAAM,OAAO;CACb,KAAK,YAAY,YACf,OAAO,WAAW,IAAI,OAAO,KAAK,aAAwB,MAAM,GAChE,QACF;CACA,OAAO,KAAK;AACd;;;;;AAMA,MAAa,gBACX,WACA,OACA,WAA0B,iBAAiB,MAChC,SAAS,WAAW,WAAW,aAAa,KAAK,CAAC;AAG/D,MAAa,kBAAkB,GAAG,UAChC,MAAM,QAAQ,SAAS,OAAO,SAAS,YAAY,SAAS,EAAE,CAAC,CAAC,KAAK,GAAG"}
1
+ {"version":3,"file":"compile.js","names":[],"sources":["../../src/style/compile.ts"],"sourcesContent":["import { getLeftAndRightSwap } from './direction'\nimport { getStyleRegistry, type StyleRegistry } from './registry'\nimport { resolveStyle } from './resolveStyle'\nimport type { FlatStyle, StyleProp } from './types'\n\nexport const flattenStyle = <T extends object>(style: StyleProp<T>): T | undefined => {\n if (style === null || style === undefined || style === false || style === '') return undefined\n if (!Array.isArray(style)) return style as T\n\n let result: object | undefined\n for (const entry of style as ReadonlyArray<StyleProp<T>>) {\n const flat = flattenStyle(entry)\n if (flat === undefined) continue\n result = result === undefined ? { ...flat } : Object.assign(result, flat)\n }\n return result as T | undefined\n}\n\n// A child selector can't be an atomic class. The child rule of `box-none` has no specificity, so\n// a child with its own `pointerEvents` keeps it. The children of `box-only` are never a target.\nconst boxPointerEventsClass = (value: unknown, registry: StyleRegistry): string | undefined => {\n if (value === 'box-none') {\n return registry.staticClass('rn-pe-box-none', [\n '.rn-pe-box-none{pointer-events:none}',\n ':where(.rn-pe-box-none)>*{pointer-events:auto}',\n ])\n }\n if (value === 'box-only') {\n return registry.staticClass('rn-pe-box-only', [\n '.rn-pe-box-only{pointer-events:auto}',\n '.rn-pe-box-only>*{pointer-events:none!important}',\n ])\n }\n return undefined\n}\n\n// The `pointerEvents` prop as a style. The prop wins over the same key of `style`.\nexport const pointerEventsStyle: Readonly<\n Record<'auto' | 'none' | 'box-none' | 'box-only', FlatStyle>\n> = Object.freeze({\n auto: Object.freeze({ pointerEvents: 'auto' }),\n none: Object.freeze({ pointerEvents: 'none' }),\n 'box-none': Object.freeze({ pointerEvents: 'box-none' }),\n 'box-only': Object.freeze({ pointerEvents: 'box-only' }),\n})\n\n// A path through the cache. A frozen object, as from StyleSheet.create, is one step by identity.\n// Any other object is one step for each of its declarations, by name and value: a component\n// that makes a new style object on each render still makes the same declarations. The classes\n// of a node are the classes of the steps on its path, flattened in that order.\ntype CacheNode = {\n classes: string | undefined\n frozen: WeakMap<FlatStyle, CacheNode> | undefined\n values: Map<string, Map<unknown, CacheNode>> | undefined\n}\n\nconst newNode = (): CacheNode => ({ classes: undefined, frozen: undefined, values: undefined })\n\n// One cache for each value of the left and right swap, because the classes of a style differ.\nlet caches: readonly [WeakMap<StyleRegistry, CacheNode>, WeakMap<StyleRegistry, CacheNode>] = [\n new WeakMap(),\n new WeakMap(),\n]\n\n// A value that changes on each render, such as an animated width, makes a new node each time.\n// Past this number of such nodes, the cache starts again.\nexport const MAX_VALUE_NODES = 10_000\nlet valueNodes = 0\n\n// The node at the end of the path of `style`, from `node`. Undefined for a style with no path:\n// a value that isn't a primitive, such as a transform, or an entry that isn't an object.\nconst walk = (style: StyleProp<object>, node: CacheNode): CacheNode | undefined => {\n if (style === null || style === undefined || style === false || style === '') return node\n if (Array.isArray(style)) {\n let current: CacheNode | undefined = node\n for (const entry of style as ReadonlyArray<StyleProp<object>>) {\n current = walk(entry, current)\n if (current === undefined) return undefined\n }\n return current\n }\n // `Object.isFrozen` is true for a number, and a WeakMap throws on it.\n if (typeof style !== 'object') return undefined\n\n if (Object.isFrozen(style)) {\n const frozen = (node.frozen ??= new WeakMap())\n let next = frozen.get(style as FlatStyle)\n if (next === undefined) {\n next = newNode()\n frozen.set(style as FlatStyle, next)\n }\n return next\n }\n\n let current = node\n for (const name in style) {\n if (!Object.hasOwn(style, name)) continue\n const value = (style as FlatStyle)[name]\n const type = typeof value\n if ((type === 'object' && value !== null) || type === 'function') return undefined\n const values = (current.values ??= new Map())\n let byValue = values.get(name)\n if (byValue === undefined) {\n byValue = new Map()\n values.set(name, byValue)\n }\n let next = byValue.get(value)\n if (next === undefined) {\n next = newNode()\n byValue.set(value, next)\n valueNodes += 1\n }\n current = next\n }\n return current\n}\n\nconst compileFlat = (flat: FlatStyle | undefined, registry: StyleRegistry): string =>\n flat === undefined\n ? ''\n : joinClassNames(\n registry.classesFor(resolveStyle(flat)),\n boxPointerEventsClass(flat['pointerEvents'], registry),\n )\n\nexport const compileStyle = (\n style: StyleProp<object>,\n registry: StyleRegistry = getStyleRegistry(),\n): string => {\n if (style === null || style === undefined || style === false || style === '') return ''\n if (valueNodes > MAX_VALUE_NODES) {\n caches = [new WeakMap(), new WeakMap()]\n valueNodes = 0\n }\n\n const cache = caches[getLeftAndRightSwap() ? 1 : 0]\n let root = cache.get(registry)\n if (root === undefined) {\n root = newNode()\n cache.set(registry, root)\n }\n const leaf = walk(style, root)\n if (leaf === undefined) {\n return compileFlat(flattenStyle(style) as FlatStyle | undefined, registry)\n }\n leaf.classes ??= compileFlat(flattenStyle(style) as FlatStyle | undefined, registry)\n return leaf.classes\n}\n\n/**\n * The class of a component's default style, in the reset sheet. Any style of the app beats it,\n * as any style beats the defaults of native layout.\n */\nexport const compileReset = (\n className: string,\n style: FlatStyle,\n registry: StyleRegistry = getStyleRegistry(),\n): string =>\n // Each render of each component calls this, so the style resolves only for a new class.\n registry.hasClass(className) ? className : registry.resetClass(className, resolveStyle(style))\n\n// Joins class names and skips the empty ones.\nexport const joinClassNames = (...names: ReadonlyArray<string | false | undefined>): string =>\n names.filter((name) => typeof name === 'string' && name !== '').join(' ')\n"],"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,OAAO,oBAAoB,IAAI,IAAI;CACjD,IAAI,OAAO,MAAM,IAAI,QAAQ;CAC7B,IAAI,SAAS,KAAA,GAAW;EACtB,OAAO,QAAQ;EACf,MAAM,IAAI,UAAU,IAAI;CAC1B;CACA,MAAM,OAAO,KAAK,OAAO,IAAI;CAC7B,IAAI,SAAS,KAAA,GACX,OAAO,YAAY,aAAa,KAAK,GAA4B,QAAQ;CAE3E,KAAK,YAAY,YAAY,aAAa,KAAK,GAA4B,QAAQ;CACnF,OAAO,KAAK;AACd;;;;;AAMA,MAAa,gBACX,WACA,OACA,WAA0B,iBAAiB,MAG3C,SAAS,SAAS,SAAS,IAAI,YAAY,SAAS,WAAW,WAAW,aAAa,KAAK,CAAC;AAG/F,MAAa,kBAAkB,GAAG,UAChC,MAAM,QAAQ,SAAS,OAAO,SAAS,YAAY,SAAS,EAAE,CAAC,CAAC,KAAK,GAAG"}
@@ -15,6 +15,7 @@ export declare class StyleRegistry {
15
15
  classFor(property: string, value: string): string;
16
16
  classesFor(declarations: CSSDeclarations): string;
17
17
  staticClass(className: string, rules: ReadonlyArray<string>): string;
18
+ hasClass(className: string): boolean;
18
19
  resetClass(className: string, declarations: CSSDeclarations): string;
19
20
  cssText(): {
20
21
  reset: string;
@@ -90,6 +90,9 @@ var StyleRegistry = class {
90
90
  }
91
91
  return className;
92
92
  }
93
+ hasClass(className) {
94
+ return this.classNames.has(className);
95
+ }
93
96
  resetClass(className, declarations) {
94
97
  if (this.classNames.has(className)) return className;
95
98
  this.classNames.set(className, className);
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","names":[],"sources":["../../src/style/registry.ts"],"sourcesContent":["import { hasDOM } from '../utils/env'\nimport type { CSSDeclarations } from './types'\n\n// Three style elements, and with equal specificity the later sheet wins:\n// - the reset rules of the components, which stand for the defaults of native layout,\n// - the shorthand rules of the app's styles,\n// - the longhand rules of the app's styles.\n// So any style of the app beats a default, and a longhand always beats a shorthand, as on native.\nexport const RESET_STYLE_ID = 'rootnative-style-reset'\nexport const SHORTHAND_STYLE_ID = 'rootnative-style-shorthand'\nexport const LONGHAND_STYLE_ID = 'rootnative-style-longhand'\n\nconst SHEET_ORDER = [RESET_STYLE_ID, SHORTHAND_STYLE_ID, LONGHAND_STYLE_ID] as const\n\nconst shorthandProperties: ReadonlySet<string> = new Set([\n 'border',\n 'borderBlock',\n 'borderColor',\n 'borderInline',\n 'borderRadius',\n 'borderStyle',\n 'borderWidth',\n 'flex',\n 'flexFlow',\n 'gap',\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'margin',\n 'marginBlock',\n 'marginInline',\n 'outline',\n 'overflow',\n 'padding',\n 'paddingBlock',\n 'paddingInline',\n 'textDecoration',\n])\n\nexport const isShorthandProperty = (name: string): boolean => shorthandProperties.has(name)\n\nconst toKebab = (name: string): string => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n\nconst hash = (input: string): string => {\n let h = 0x811c9dc5\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i)\n h = Math.imul(h, 0x01000193)\n }\n return (h >>> 0).toString(36)\n}\n\nexport type StyleSheets = {\n reset: CSSStyleSheet | null\n shorthand: CSSStyleSheet | null\n longhand: CSSStyleSheet | null\n}\n\nexport class StyleRegistry {\n private readonly classNames = new Map<string, string>()\n private readonly adopted = new Set<string>()\n private readonly resetRules: string[] = []\n private readonly shorthandRules: string[] = []\n private readonly longhandRules: string[] = []\n private readonly sheets: StyleSheets\n\n constructor(sheets: StyleSheets = { reset: null, shorthand: null, longhand: null }) {\n this.sheets = sheets\n this.adopt(sheets.reset)\n this.adopt(sheets.shorthand)\n this.adopt(sheets.longhand)\n }\n\n classFor(property: string, value: string): string {\n const key = `${property}:${value}`\n const known = this.classNames.get(key)\n if (known !== undefined) return known\n\n const className = `rn-${hash(key)}`\n this.classNames.set(key, className)\n\n const shorthand = isShorthandProperty(property)\n const rule = `.${className}{${toKebab(property)}:${value}}`\n const rules = shorthand ? this.shorthandRules : this.longhandRules\n rules.push(rule)\n\n if (!this.adopted.has(className)) {\n const sheet = shorthand ? this.sheets.shorthand : this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n return className\n }\n\n classesFor(declarations: CSSDeclarations): string {\n const names: string[] = []\n for (const property in declarations) {\n names.push(this.classFor(property, declarations[property] as string))\n }\n return names.join(' ')\n }\n\n // Inserts a fixed set of rules under one class name, once. For rules an atomic\n // declaration cannot express, for example a child selector.\n staticClass(className: string, rules: ReadonlyArray<string>): string {\n if (this.classNames.has(className)) return className\n this.classNames.set(className, className)\n for (const rule of rules) {\n this.longhandRules.push(rule)\n if (!this.adopted.has(className)) {\n const sheet = this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n }\n return className\n }\n\n // Inserts the default style of a component as one rule in the reset sheet, once. Its class\n // name is its own, never an atomic one, so a style of the app with the same declaration\n // still gets an atomic class that beats the default.\n resetClass(className: string, declarations: CSSDeclarations): string {\n if (this.classNames.has(className)) return className\n this.classNames.set(className, className)\n const body = Object.entries(declarations)\n .map(([property, value]) => `${toKebab(property)}:${value}`)\n .join(';')\n const rule = `.${className}{${body}}`\n this.resetRules.push(rule)\n if (!this.adopted.has(className)) {\n const sheet = this.sheets.reset\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n return className\n }\n\n // The rules of each sheet, for server rendering.\n cssText(): { reset: string; shorthand: string; longhand: string } {\n return {\n reset: this.resetRules.join('\\n'),\n shorthand: this.shorthandRules.join('\\n'),\n longhand: this.longhandRules.join('\\n'),\n }\n }\n\n get ruleCount(): number {\n return this.resetRules.length + this.shorthandRules.length + this.longhandRules.length\n }\n\n // Remembers the class names the server already rendered, so the client does not insert them again.\n private adopt(sheet: CSSStyleSheet | null): void {\n if (sheet === null) return\n for (const rule of Array.from(sheet.cssRules)) {\n if (rule instanceof CSSStyleRule) this.adopted.add(rule.selectorText.slice(1))\n }\n }\n}\n\nlet defaultRegistry: StyleRegistry | null = null\n\nexport const getStyleRegistry = (): StyleRegistry => {\n if (defaultRegistry !== null) return defaultRegistry\n defaultRegistry = new StyleRegistry(\n hasDOM()\n ? {\n reset: domSheet(RESET_STYLE_ID),\n shorthand: domSheet(SHORTHAND_STYLE_ID),\n longhand: domSheet(LONGHAND_STYLE_ID),\n }\n : { reset: null, shorthand: null, longhand: null },\n )\n return defaultRegistry\n}\n\n// For tests, so each file starts with an empty registry.\nexport const resetStyleRegistry = (): void => {\n defaultRegistry = null\n if (!hasDOM()) return\n for (const id of SHEET_ORDER) document.getElementById(id)?.remove()\n}\n\n// A new style element goes before the sheets that must come after it. A page from an older\n// server can have the other two sheets already.\nconst domSheet = (id: (typeof SHEET_ORDER)[number]): CSSStyleSheet => {\n let element = document.getElementById(id) as HTMLStyleElement | null\n if (element === null) {\n element = document.createElement('style')\n element.id = id\n const later = SHEET_ORDER.slice(SHEET_ORDER.indexOf(id) + 1)\n .map((name) => document.getElementById(name))\n .find((found) => found !== null)\n if (later === undefined || later === null) document.head.appendChild(element)\n else later.before(element)\n }\n return element.sheet as CSSStyleSheet\n}\n"],"mappings":";;AAQA,MAAa,iBAAiB;AAC9B,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AAEjC,MAAM,cAAc;CAAC;CAAgB;CAAoB;AAAiB;AAE1E,MAAM,sCAA2C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,uBAAuB,SAA0B,oBAAoB,IAAI,IAAI;AAE1F,MAAM,WAAW,SAAyB,KAAK,QAAQ,WAAW,MAAM,IAAI,EAAE,YAAY,GAAG;AAE7F,MAAM,QAAQ,UAA0B;CACtC,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,KAAK,MAAM,WAAW,CAAC;EACvB,IAAI,KAAK,KAAK,GAAG,QAAU;CAC7B;CACA,QAAQ,MAA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B;EACtC,UAAU,SAAS,iBAAiB;CACtC,IACA;EAAE,OAAO;EAAM,WAAW;EAAM,UAAU;CAAK,CACrD;CACA,OAAO;AACT;AAWA,MAAM,YAAY,OAAoD;CACpE,IAAI,UAAU,SAAS,eAAe,EAAE;CACxC,IAAI,YAAY,MAAM;EACpB,UAAU,SAAS,cAAc,OAAO;EACxC,QAAQ,KAAK;EACb,MAAM,QAAQ,YAAY,MAAM,YAAY,QAAQ,EAAE,IAAI,CAAC,CAAC,CACzD,KAAK,SAAS,SAAS,eAAe,IAAI,CAAC,CAAC,CAC5C,MAAM,UAAU,UAAU,IAAI;EACjC,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,SAAS,KAAK,YAAY,OAAO;OACvE,MAAM,OAAO,OAAO;CAC3B;CACA,OAAO,QAAQ;AACjB"}
1
+ {"version":3,"file":"registry.js","names":[],"sources":["../../src/style/registry.ts"],"sourcesContent":["import { hasDOM } from '../utils/env'\nimport type { CSSDeclarations } from './types'\n\n// Three style elements, and with equal specificity the later sheet wins:\n// - the reset rules of the components, which stand for the defaults of native layout,\n// - the shorthand rules of the app's styles,\n// - the longhand rules of the app's styles.\n// So any style of the app beats a default, and a longhand always beats a shorthand, as on native.\nexport const RESET_STYLE_ID = 'rootnative-style-reset'\nexport const SHORTHAND_STYLE_ID = 'rootnative-style-shorthand'\nexport const LONGHAND_STYLE_ID = 'rootnative-style-longhand'\n\nconst SHEET_ORDER = [RESET_STYLE_ID, SHORTHAND_STYLE_ID, LONGHAND_STYLE_ID] as const\n\nconst shorthandProperties: ReadonlySet<string> = new Set([\n 'border',\n 'borderBlock',\n 'borderColor',\n 'borderInline',\n 'borderRadius',\n 'borderStyle',\n 'borderWidth',\n 'flex',\n 'flexFlow',\n 'gap',\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'margin',\n 'marginBlock',\n 'marginInline',\n 'outline',\n 'overflow',\n 'padding',\n 'paddingBlock',\n 'paddingInline',\n 'textDecoration',\n])\n\nexport const isShorthandProperty = (name: string): boolean => shorthandProperties.has(name)\n\nconst toKebab = (name: string): string => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n\nconst hash = (input: string): string => {\n let h = 0x811c9dc5\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i)\n h = Math.imul(h, 0x01000193)\n }\n return (h >>> 0).toString(36)\n}\n\nexport type StyleSheets = {\n reset: CSSStyleSheet | null\n shorthand: CSSStyleSheet | null\n longhand: CSSStyleSheet | null\n}\n\nexport class StyleRegistry {\n private readonly classNames = new Map<string, string>()\n private readonly adopted = new Set<string>()\n private readonly resetRules: string[] = []\n private readonly shorthandRules: string[] = []\n private readonly longhandRules: string[] = []\n private readonly sheets: StyleSheets\n\n constructor(sheets: StyleSheets = { reset: null, shorthand: null, longhand: null }) {\n this.sheets = sheets\n this.adopt(sheets.reset)\n this.adopt(sheets.shorthand)\n this.adopt(sheets.longhand)\n }\n\n classFor(property: string, value: string): string {\n const key = `${property}:${value}`\n const known = this.classNames.get(key)\n if (known !== undefined) return known\n\n const className = `rn-${hash(key)}`\n this.classNames.set(key, className)\n\n const shorthand = isShorthandProperty(property)\n const rule = `.${className}{${toKebab(property)}:${value}}`\n const rules = shorthand ? this.shorthandRules : this.longhandRules\n rules.push(rule)\n\n if (!this.adopted.has(className)) {\n const sheet = shorthand ? this.sheets.shorthand : this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n return className\n }\n\n classesFor(declarations: CSSDeclarations): string {\n const names: string[] = []\n for (const property in declarations) {\n names.push(this.classFor(property, declarations[property] as string))\n }\n return names.join(' ')\n }\n\n // Inserts a fixed set of rules under one class name, once. For rules an atomic\n // declaration cannot express, for example a child selector.\n staticClass(className: string, rules: ReadonlyArray<string>): string {\n if (this.classNames.has(className)) return className\n this.classNames.set(className, className)\n for (const rule of rules) {\n this.longhandRules.push(rule)\n if (!this.adopted.has(className)) {\n const sheet = this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n }\n return className\n }\n\n // True for a class of `staticClass` or `resetClass` that this registry already has.\n hasClass(className: string): boolean {\n return this.classNames.has(className)\n }\n\n // Inserts the default style of a component as one rule in the reset sheet, once. Its class\n // name is its own, never an atomic one, so a style of the app with the same declaration\n // still gets an atomic class that beats the default.\n resetClass(className: string, declarations: CSSDeclarations): string {\n if (this.classNames.has(className)) return className\n this.classNames.set(className, className)\n const body = Object.entries(declarations)\n .map(([property, value]) => `${toKebab(property)}:${value}`)\n .join(';')\n const rule = `.${className}{${body}}`\n this.resetRules.push(rule)\n if (!this.adopted.has(className)) {\n const sheet = this.sheets.reset\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n return className\n }\n\n // The rules of each sheet, for server rendering.\n cssText(): { reset: string; shorthand: string; longhand: string } {\n return {\n reset: this.resetRules.join('\\n'),\n shorthand: this.shorthandRules.join('\\n'),\n longhand: this.longhandRules.join('\\n'),\n }\n }\n\n get ruleCount(): number {\n return this.resetRules.length + this.shorthandRules.length + this.longhandRules.length\n }\n\n // Remembers the class names the server already rendered, so the client does not insert them again.\n private adopt(sheet: CSSStyleSheet | null): void {\n if (sheet === null) return\n for (const rule of Array.from(sheet.cssRules)) {\n if (rule instanceof CSSStyleRule) this.adopted.add(rule.selectorText.slice(1))\n }\n }\n}\n\nlet defaultRegistry: StyleRegistry | null = null\n\nexport const getStyleRegistry = (): StyleRegistry => {\n if (defaultRegistry !== null) return defaultRegistry\n defaultRegistry = new StyleRegistry(\n hasDOM()\n ? {\n reset: domSheet(RESET_STYLE_ID),\n shorthand: domSheet(SHORTHAND_STYLE_ID),\n longhand: domSheet(LONGHAND_STYLE_ID),\n }\n : { reset: null, shorthand: null, longhand: null },\n )\n return defaultRegistry\n}\n\n// For tests, so each file starts with an empty registry.\nexport const resetStyleRegistry = (): void => {\n defaultRegistry = null\n if (!hasDOM()) return\n for (const id of SHEET_ORDER) document.getElementById(id)?.remove()\n}\n\n// A new style element goes before the sheets that must come after it. A page from an older\n// server can have the other two sheets already.\nconst domSheet = (id: (typeof SHEET_ORDER)[number]): CSSStyleSheet => {\n let element = document.getElementById(id) as HTMLStyleElement | null\n if (element === null) {\n element = document.createElement('style')\n element.id = id\n const later = SHEET_ORDER.slice(SHEET_ORDER.indexOf(id) + 1)\n .map((name) => document.getElementById(name))\n .find((found) => found !== null)\n if (later === undefined || later === null) document.head.appendChild(element)\n else later.before(element)\n }\n return element.sheet as CSSStyleSheet\n}\n"],"mappings":";;AAQA,MAAa,iBAAiB;AAC9B,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AAEjC,MAAM,cAAc;CAAC;CAAgB;CAAoB;AAAiB;AAE1E,MAAM,sCAA2C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,uBAAuB,SAA0B,oBAAoB,IAAI,IAAI;AAE1F,MAAM,WAAW,SAAyB,KAAK,QAAQ,WAAW,MAAM,IAAI,EAAE,YAAY,GAAG;AAE7F,MAAM,QAAQ,UAA0B;CACtC,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,KAAK,MAAM,WAAW,CAAC;EACvB,IAAI,KAAK,KAAK,GAAG,QAAU;CAC7B;CACA,QAAQ,MAAM,EAAA,CAAG,SAAS,EAAE;AAC9B;AAQA,IAAa,gBAAb,MAA2B;CAQzB,YAAY,SAAsB;EAAE,OAAO;EAAM,WAAW;EAAM,UAAU;CAAK,GAAG;EAPpF,KAAiB,6BAAa,IAAI,IAAoB;EACtD,KAAiB,0BAAU,IAAI,IAAY;EAC3C,KAAiB,aAAuB,CAAC;EACzC,KAAiB,iBAA2B,CAAC;EAC7C,KAAiB,gBAA0B,CAAC;EAI1C,KAAK,SAAS;EACd,KAAK,MAAM,OAAO,KAAK;EACvB,KAAK,MAAM,OAAO,SAAS;EAC3B,KAAK,MAAM,OA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AAS,SAAS,eAAe,IAAI,CAAC,CAAC,CAC5C,MAAM,UAAU,UAAU,IAAI;EACjC,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,SAAS,KAAK,YAAY,OAAO;OACvE,MAAM,OAAO,OAAO;CAC3B;CACA,OAAO,QAAQ;AACjB"}
package/llms.txt CHANGED
@@ -63,7 +63,7 @@ ReferenceError. Add it to ssr.noExternal.
63
63
 
64
64
  ## Expo
65
65
 
66
- An Expo app (no Expo Router) runs on @rootnative/web through
66
+ An Expo app, also with Expo Router, runs on @rootnative/web through
67
67
  @rootnative/web-expo, installed under the name react-native-web:
68
68
  npm install react-native-web@npm:@rootnative/web-expo
69
69
  Restart the dev server with --clear. The app code, the Babel preset, and the
@@ -71,15 +71,19 @@ react-native types stay. Expo's Babel preset rewrites each react-native import
71
71
  to react-native-web/dist/exports/<Name>; the package has those files, and each
72
72
  one loads only its own module of @rootnative/web, so the bundle has only the
73
73
  components the app imports. It also gives Expo AppRegistry and the page reset
74
- (body margin 0). Works: the dev server, expo export --platform web with
75
- web.output 'single', Reanimated 4 (the preset adds the Worklets plugin), image
76
- imports, react-native-svg. web-expo depends on the exact same version of
77
- @rootnative/web: install that version if the app imports @rootnative/web too.
78
- A name that @rootnative/web lacks (Animated, Easing, LayoutAnimation,
79
- SectionList, VirtualizedList, ImageBackground, SafeAreaView, and more) loads
80
- as a stub that throws "<Name> is not in @rootnative/web yet" on use;
74
+ (body margin 0), and UIManager, NativeModules ({ UIManager }, no native
75
+ module), LogBox (no-ops), DeviceEventEmitter, NativeEventEmitter (only
76
+ JavaScript emits events), and AssetRegistry, as react-native-web does.
77
+ Works: the dev server, expo export --platform web with web.output 'single'
78
+ or 'static' (each route renders on the server, then hydrates), Expo Router
79
+ (tabs, a stack, links, back, a URL that opens a screen), Reanimated 4 (the
80
+ preset adds the Worklets plugin), image imports, react-native-svg.
81
+ web-expo depends on the exact same version of @rootnative/web: install that
82
+ version if the app imports @rootnative/web too.
83
+ A name that @rootnative/web lacks (LayoutAnimation, SectionList,
84
+ VirtualizedList, ImageBackground, SafeAreaView, and more) loads as a stub
85
+ that throws "<Name> is not in @rootnative/web yet" on use;
81
86
  node_modules/react-native-web/expo-exports.json lists them under "missing".
82
- Expo Router needs Animated, so it doesn't work yet.
83
87
 
84
88
  ## Entry points
85
89
 
@@ -110,13 +114,18 @@ Modal, KeyboardAvoidingView, StatusBar.
110
114
  APIs: StyleSheet, Platform, Dimensions, useWindowDimensions, Appearance,
111
115
  useColorScheme, AppState, Keyboard, Linking, Alert, Share, Vibration, Clipboard,
112
116
  AccessibilityInfo, I18nManager, BackHandler, PixelRatio, processColor,
113
- PanResponder, usePressability.
117
+ PanResponder, Animated, Easing, usePressability.
114
118
 
115
119
  Compat, for libraries only, do not call in app code: unstable_createElement,
116
120
  findNodeHandle, TurboModuleRegistry.
117
121
 
118
122
  NOT IMPLEMENTED, do not import:
119
- - SectionList, VirtualizedList, Animated, LayoutAnimation.
123
+ - SectionList, VirtualizedList, LayoutAnimation.
124
+ - Animated: ValueXY, Color, decay, sequence, stagger, loop, delay, subtract,
125
+ divide, modulo, diffClamp, forkEvent, unforkEvent, attachNativeEvent,
126
+ Animated.Image, Animated.ScrollView, Animated.FlatList,
127
+ Animated.SectionList, useAnimatedValue, useAnimatedValueXY,
128
+ useAnimatedColor.
120
129
  - A Next.js plugin, and templates for a Vite app with and without server
121
130
  rendering.
122
131
 
@@ -190,8 +199,9 @@ only). Any other prop that isn't a React Native prop is dropped.
190
199
  - elevation, borderCurve, includeFontPadding, overlayColor: no web effect.
191
200
  - Types: the style props take React Native 0.88's ViewStyle, TextStyle, and
192
201
  ImageStyle, and StyleSheet.create checks each key and value. touchAction is
193
- the one web-only key. transform takes no Animated value, and resizeMode has
194
- no 'none' yet. Any other CSS property passes through at runtime but needs a
202
+ the one web-only key. transform takes no Animated value (animate it with
203
+ Animated.View), and resizeMode has no 'none' yet. Any other CSS property
204
+ passes through at runtime but needs a
195
205
  cast: { transition: '...' } as ViewStyle, or as unknown as ViewStyle for a
196
206
  value that React Native's type doesn't allow.
197
207
 
@@ -550,6 +560,22 @@ StatusBar
550
560
  The element captures the pointer at the grant. Negotiation works as on
551
561
  native. dx and dy are CSS pixels; vx and vy are pixels per millisecond.
552
562
  onShouldBlockNativeResponder is ignored. getInteractionHandle() is null.
563
+ - Easing: every curve and helper of React Native, with the same math. ease is
564
+ cubic-bezier(0.42, 0, 1, 1) (CSS ease-in, not CSS ease). bezier throws for
565
+ an x out of [0, 1]. Type of a curve: EasingFunction. Pass a curve as the
566
+ easing of Animated.timing.
567
+ - Animated: Value (setValue, setOffset, flattenOffset, extractOffset,
568
+ stopAnimation, resetAnimation, interpolate, listeners), add, multiply,
569
+ timing (500 ms and Easing.inOut(Easing.ease) by default), spring (all
570
+ three kinds of config, velocity, overshootClamping), parallel
571
+ (stopTogether), event, View, Text, createAnimatedComponent, Node,
572
+ Interpolation. interpolate takes numbers, strings with numbers ('90deg'),
573
+ and colors (out as rgba()). NO native driver: useNativeDriver: true runs
574
+ the same JavaScript driver on the main thread. A frame writes the style to
575
+ the element with no React render; a value in a prop that isn't style
576
+ renders the component on each frame. With prefers-reduced-motion, timing
577
+ and spring go to toValue at once, after their delay. toValue and velocity
578
+ take only a number. Animated.event always returns a function.
553
579
  - usePressability(config): returns pointer, keyboard, and focus handlers, not
554
580
  the native responder handlers. Spread them on a View. Memoize the config.
555
581
  A null config returns null. hitSlop doesn't grow the hit area. Set
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/web",
3
- "version": "0.0.0-alpha.4",
3
+ "version": "0.0.0-alpha.6",
4
4
  "description": "A standalone web runtime for React Native apps",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rootnative.github.io/web/",