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

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 (243) hide show
  1. package/CHANGELOG.md +66 -1
  2. package/dist/apis/AccessibilityInfo/index.d.ts +30 -0
  3. package/dist/apis/AccessibilityInfo/index.js +84 -0
  4. package/dist/apis/AccessibilityInfo/index.js.map +1 -0
  5. package/dist/apis/Alert/index.d.ts +22 -0
  6. package/dist/apis/Alert/index.js +141 -0
  7. package/dist/apis/Alert/index.js.map +1 -0
  8. package/dist/apis/AppState/index.d.ts +21 -0
  9. package/dist/apis/AppState/index.js +86 -0
  10. package/dist/apis/AppState/index.js.map +1 -0
  11. package/dist/apis/Appearance/index.d.ts +14 -0
  12. package/dist/apis/Appearance/index.js +39 -0
  13. package/dist/apis/Appearance/index.js.map +1 -0
  14. package/dist/apis/BackHandler/index.d.ts +10 -0
  15. package/dist/apis/BackHandler/index.js +16 -0
  16. package/dist/apis/BackHandler/index.js.map +1 -0
  17. package/dist/apis/Clipboard/index.d.ts +9 -0
  18. package/dist/apis/Clipboard/index.js +45 -0
  19. package/dist/apis/Clipboard/index.js.map +1 -0
  20. package/dist/apis/Dimensions/index.d.ts +19 -0
  21. package/dist/apis/Dimensions/index.js +66 -0
  22. package/dist/apis/Dimensions/index.js.map +1 -0
  23. package/dist/apis/I18nManager/index.d.ts +14 -0
  24. package/dist/apis/I18nManager/index.js +33 -0
  25. package/dist/apis/I18nManager/index.js.map +1 -0
  26. package/dist/apis/Keyboard/index.d.ts +36 -0
  27. package/dist/apis/Keyboard/index.js +149 -0
  28. package/dist/apis/Keyboard/index.js.map +1 -0
  29. package/dist/apis/Linking/index.d.ts +29 -0
  30. package/dist/apis/Linking/index.js +86 -0
  31. package/dist/apis/Linking/index.js.map +1 -0
  32. package/dist/apis/PanResponder/index.d.ts +50 -0
  33. package/dist/apis/PanResponder/index.js +239 -0
  34. package/dist/apis/PanResponder/index.js.map +1 -0
  35. package/dist/apis/PixelRatio/index.d.ts +8 -0
  36. package/dist/apis/PixelRatio/index.js +15 -0
  37. package/dist/apis/PixelRatio/index.js.map +1 -0
  38. package/dist/apis/Platform/index.d.ts +4 -0
  39. package/dist/apis/Platform/index.js +28 -0
  40. package/dist/apis/Platform/index.js.map +1 -0
  41. package/dist/apis/Platform/types.d.ts +19 -0
  42. package/dist/apis/Share/index.d.ts +30 -0
  43. package/dist/apis/Share/index.js +34 -0
  44. package/dist/apis/Share/index.js.map +1 -0
  45. package/dist/apis/StyleSheet/index.d.ts +23 -0
  46. package/dist/apis/StyleSheet/index.js +29 -0
  47. package/dist/apis/StyleSheet/index.js.map +1 -0
  48. package/dist/apis/StyleSheet/types.d.ts +328 -0
  49. package/dist/apis/Vibration/index.d.ts +9 -0
  50. package/dist/apis/Vibration/index.js +40 -0
  51. package/dist/apis/Vibration/index.js.map +1 -0
  52. package/dist/apis/processColor/index.d.ts +3 -0
  53. package/dist/apis/processColor/index.js +12 -0
  54. package/dist/apis/processColor/index.js.map +1 -0
  55. package/dist/apis/useColorScheme/index.d.ts +3 -0
  56. package/dist/apis/useColorScheme/index.js +13 -0
  57. package/dist/apis/useColorScheme/index.js.map +1 -0
  58. package/dist/apis/useWindowDimensions/index.d.ts +3 -0
  59. package/dist/apis/useWindowDimensions/index.js +19 -0
  60. package/dist/apis/useWindowDimensions/index.js.map +1 -0
  61. package/dist/assets-registry/index.d.ts +18 -0
  62. package/dist/assets-registry/index.js +12 -0
  63. package/dist/assets-registry/index.js.map +1 -0
  64. package/dist/bundler/index.js +30 -0
  65. package/dist/bundler/index.js.map +1 -0
  66. package/dist/bundler/inlinePlatformOS.js +121 -0
  67. package/dist/bundler/inlinePlatformOS.js.map +1 -0
  68. package/dist/bundler/worklets.js +61 -0
  69. package/dist/bundler/worklets.js.map +1 -0
  70. package/dist/compat/TurboModuleRegistry/index.d.ts +16 -0
  71. package/dist/compat/TurboModuleRegistry/index.js +14 -0
  72. package/dist/compat/TurboModuleRegistry/index.js.map +1 -0
  73. package/dist/compat/createElement/index.d.ts +9 -0
  74. package/dist/compat/createElement/index.js +40 -0
  75. package/dist/compat/createElement/index.js.map +1 -0
  76. package/dist/compat/findNodeHandle/index.d.ts +7 -0
  77. package/dist/compat/findNodeHandle/index.js +19 -0
  78. package/dist/compat/findNodeHandle/index.js.map +1 -0
  79. package/dist/components/ActivityIndicator/index.d.ts +5 -0
  80. package/dist/components/ActivityIndicator/index.js +74 -0
  81. package/dist/components/ActivityIndicator/index.js.map +1 -0
  82. package/dist/components/ActivityIndicator/types.d.ts +8 -0
  83. package/dist/components/Button/index.d.ts +5 -0
  84. package/dist/components/Button/index.js +48 -0
  85. package/dist/components/Button/index.js.map +1 -0
  86. package/dist/components/Button/types.d.ts +31 -0
  87. package/dist/components/FlatList/index.d.ts +5 -0
  88. package/dist/components/FlatList/index.js +433 -0
  89. package/dist/components/FlatList/index.js.map +1 -0
  90. package/dist/components/FlatList/types.d.ts +138 -0
  91. package/dist/components/FlatList/viewability.js +86 -0
  92. package/dist/components/FlatList/viewability.js.map +1 -0
  93. package/dist/components/Image/index.d.ts +7 -0
  94. package/dist/components/Image/index.js +301 -0
  95. package/dist/components/Image/index.js.map +1 -0
  96. package/dist/components/Image/source.js +97 -0
  97. package/dist/components/Image/source.js.map +1 -0
  98. package/dist/components/Image/types.d.ts +96 -0
  99. package/dist/components/KeyboardAvoidingView/index.d.ts +10 -0
  100. package/dist/components/KeyboardAvoidingView/index.js +118 -0
  101. package/dist/components/KeyboardAvoidingView/index.js.map +1 -0
  102. package/dist/components/KeyboardAvoidingView/types.d.ts +14 -0
  103. package/dist/components/Modal/index.d.ts +9 -0
  104. package/dist/components/Modal/index.js +271 -0
  105. package/dist/components/Modal/index.js.map +1 -0
  106. package/dist/components/Modal/types.d.ts +29 -0
  107. package/dist/components/Pressable/index.d.ts +5 -0
  108. package/dist/components/Pressable/index.js +106 -0
  109. package/dist/components/Pressable/index.js.map +1 -0
  110. package/dist/components/Pressable/types.d.ts +44 -0
  111. package/dist/components/RefreshControl/index.d.ts +5 -0
  112. package/dist/components/RefreshControl/index.js +176 -0
  113. package/dist/components/RefreshControl/index.js.map +1 -0
  114. package/dist/components/RefreshControl/pull.js +16 -0
  115. package/dist/components/RefreshControl/pull.js.map +1 -0
  116. package/dist/components/RefreshControl/types.d.ts +14 -0
  117. package/dist/components/ScrollView/index.d.ts +5 -0
  118. package/dist/components/ScrollView/index.js +318 -0
  119. package/dist/components/ScrollView/index.js.map +1 -0
  120. package/dist/components/ScrollView/snap.js +38 -0
  121. package/dist/components/ScrollView/snap.js.map +1 -0
  122. package/dist/components/ScrollView/types.d.ts +115 -0
  123. package/dist/components/StatusBar/index.d.ts +26 -0
  124. package/dist/components/StatusBar/index.js +113 -0
  125. package/dist/components/StatusBar/index.js.map +1 -0
  126. package/dist/components/Switch/index.d.ts +5 -0
  127. package/dist/components/Switch/index.js +89 -0
  128. package/dist/components/Switch/index.js.map +1 -0
  129. package/dist/components/Switch/types.d.ts +25 -0
  130. package/dist/components/Text/TextAncestorContext.d.ts +3 -0
  131. package/dist/components/Text/TextAncestorContext.js +6 -0
  132. package/dist/components/Text/TextAncestorContext.js.map +1 -0
  133. package/dist/components/Text/index.d.ts +6 -0
  134. package/dist/components/Text/index.js +133 -0
  135. package/dist/components/Text/index.js.map +1 -0
  136. package/dist/components/Text/types.d.ts +38 -0
  137. package/dist/components/TextInput/autocomplete.js +102 -0
  138. package/dist/components/TextInput/autocomplete.js.map +1 -0
  139. package/dist/components/TextInput/index.d.ts +8 -0
  140. package/dist/components/TextInput/index.js +290 -0
  141. package/dist/components/TextInput/index.js.map +1 -0
  142. package/dist/components/TextInput/types.d.ts +130 -0
  143. package/dist/components/TouchableHighlight/index.d.ts +5 -0
  144. package/dist/components/TouchableHighlight/index.js +109 -0
  145. package/dist/components/TouchableHighlight/index.js.map +1 -0
  146. package/dist/components/TouchableHighlight/types.d.ts +15 -0
  147. package/dist/components/TouchableNativeFeedback/index.d.ts +11 -0
  148. package/dist/components/TouchableNativeFeedback/index.js +29 -0
  149. package/dist/components/TouchableNativeFeedback/index.js.map +1 -0
  150. package/dist/components/TouchableNativeFeedback/types.d.ts +19 -0
  151. package/dist/components/TouchableOpacity/index.d.ts +5 -0
  152. package/dist/components/TouchableOpacity/index.js +122 -0
  153. package/dist/components/TouchableOpacity/index.js.map +1 -0
  154. package/dist/components/TouchableOpacity/types.d.ts +11 -0
  155. package/dist/components/TouchableWithoutFeedback/index.d.ts +5 -0
  156. package/dist/components/TouchableWithoutFeedback/index.js +70 -0
  157. package/dist/components/TouchableWithoutFeedback/index.js.map +1 -0
  158. package/dist/components/TouchableWithoutFeedback/types.d.ts +40 -0
  159. package/dist/components/View/index.d.ts +5 -0
  160. package/dist/components/View/index.js +50 -0
  161. package/dist/components/View/index.js.map +1 -0
  162. package/dist/components/View/types.d.ts +98 -0
  163. package/dist/dom/Head.d.ts +21 -0
  164. package/dist/dom/Head.js +53 -0
  165. package/dist/dom/Head.js.map +1 -0
  166. package/dist/dom/index.d.ts +2 -22
  167. package/dist/dom/index.js +1 -53
  168. package/dist/events/press/Pressability.d.ts +2 -0
  169. package/dist/events/press/Pressability.js +366 -0
  170. package/dist/events/press/Pressability.js.map +1 -0
  171. package/dist/events/press/cursorStyle.js +5 -0
  172. package/dist/events/press/cursorStyle.js.map +1 -0
  173. package/dist/events/press/index.d.ts +4 -0
  174. package/dist/events/press/mergeHandlers.js +30 -0
  175. package/dist/events/press/mergeHandlers.js.map +1 -0
  176. package/dist/events/press/types.d.ts +48 -0
  177. package/dist/events/press/usePressability.d.ts +4 -0
  178. package/dist/events/press/usePressability.js +18 -0
  179. package/dist/events/press/usePressability.js.map +1 -0
  180. package/dist/events/responderEvent.js +50 -0
  181. package/dist/events/responderEvent.js.map +1 -0
  182. package/dist/events/types.d.ts +33 -0
  183. package/dist/index.d.ts +66 -1009
  184. package/dist/index.js +43 -3872
  185. package/dist/reactNativeVersion.d.ts +7 -0
  186. package/dist/reactNativeVersion.js +10 -0
  187. package/dist/reactNativeVersion.js.map +1 -0
  188. package/dist/render/domProps.js +66 -0
  189. package/dist/render/domProps.js.map +1 -0
  190. package/dist/render/hitSlop.js +21 -0
  191. package/dist/render/hitSlop.js.map +1 -0
  192. package/dist/render/hostMethods.js +44 -0
  193. package/dist/render/hostMethods.js.map +1 -0
  194. package/dist/render/resolveTag.js +64 -0
  195. package/dist/render/resolveTag.js.map +1 -0
  196. package/dist/render/useElementLayout.js +25 -0
  197. package/dist/render/useElementLayout.js.map +1 -0
  198. package/dist/server/index.d.ts +2 -23
  199. package/dist/server/index.js +8 -4
  200. package/dist/server/index.js.map +1 -1
  201. package/dist/style/StyleRegistryContext.js +8 -0
  202. package/dist/style/StyleRegistryContext.js.map +1 -0
  203. package/dist/style/color.js +16 -0
  204. package/dist/style/color.js.map +1 -0
  205. package/dist/style/compile.js +72 -0
  206. package/dist/style/compile.js.map +1 -0
  207. package/dist/style/direction.js +33 -0
  208. package/dist/style/direction.js.map +1 -0
  209. package/dist/style/index.d.ts +25 -0
  210. package/dist/style/index.js +38 -0
  211. package/dist/style/index.js.map +1 -0
  212. package/dist/style/registry.d.ts +27 -0
  213. package/dist/{StyleRegistryContext-CAD45r4n.js → style/registry.js} +32 -10
  214. package/dist/style/registry.js.map +1 -0
  215. package/dist/style/resolveStyle.js +181 -0
  216. package/dist/style/resolveStyle.js.map +1 -0
  217. package/dist/style/shadow.js +87 -0
  218. package/dist/style/shadow.js.map +1 -0
  219. package/dist/style/splitLayoutProps.js +52 -0
  220. package/dist/style/splitLayoutProps.js.map +1 -0
  221. package/dist/style/transform.js +35 -0
  222. package/dist/style/transform.js.map +1 -0
  223. package/dist/style/types.d.ts +4 -0
  224. package/dist/style/units.js +21 -0
  225. package/dist/style/units.js.map +1 -0
  226. package/dist/style/webStyle.js +9 -0
  227. package/dist/style/webStyle.js.map +1 -0
  228. package/dist/{env-DK5Mt9yX.js → utils/env.js} +2 -2
  229. package/dist/utils/env.js.map +1 -0
  230. package/dist/utils/scrollLock.js +28 -0
  231. package/dist/utils/scrollLock.js.map +1 -0
  232. package/dist/utils/warn.js +11 -0
  233. package/dist/utils/warn.js.map +1 -0
  234. package/dist/vite/index.d.ts +9 -1
  235. package/dist/vite/index.js +71 -174
  236. package/dist/vite/index.js.map +1 -1
  237. package/llms.txt +203 -22
  238. package/package.json +16 -3
  239. package/dist/StyleRegistryContext-CAD45r4n.js.map +0 -1
  240. package/dist/dom/index.js.map +0 -1
  241. package/dist/env-DK5Mt9yX.js.map +0 -1
  242. package/dist/index.js.map +0 -1
  243. package/dist/types-BxTWbdj9.d.ts +0 -5
package/llms.txt CHANGED
@@ -22,9 +22,17 @@ Peers: react ^19.0.0, react-dom ^19.0.0. ESM only.
22
22
  1. Add the Vite plugin (Vite 8) to vite.config.ts:
23
23
  import { rootnative } from '@rootnative/web/vite'
24
24
  plugins: [react(), rootnative()]
25
+ With Reanimated, or a library built on it: rootnative({ worklets: true }).
26
+ It runs the Babel plugin of react-native-worklets on the app code and the
27
+ libraries. The app needs react-native-worklets and @babel/core.
25
28
  It resolves react-native to @rootnative/web (the exact name only), resolves
26
29
  .web.* files first, defines __DEV__ (true on the dev server, false in a
27
30
  production build, from NODE_ENV), and puts 'web' in place of Platform.OS.
31
+ It also defines global as globalThis, resolves
32
+ @react-native/assets-registry/registry to @rootnative/web/assets-registry,
33
+ resolves the two react-native-web style files that Reanimated 4 imports to
34
+ @rootnative/web/style, and gives pre-bundled dependencies the .web.*
35
+ extensions.
28
36
  An alias or a __DEV__ define in your own config wins.
29
37
  2. Add src/react-native.d.ts (in a folder that tsconfig.json includes):
30
38
  declare module 'react-native' { export * from '@rootnative/web' }
@@ -43,14 +51,36 @@ Browsers: Chrome 95, Edge 95, Firefox 93, Safari 15.1, iOS Safari 15.1.
43
51
 
44
52
  Without the plugin (another bundler): alias the exact name react-native to
45
53
  @rootnative/web, put a .web variant of each extension first, and define
46
- __DEV__. In Vite, define it in define and in
47
- optimizeDeps.rolldownOptions.transform.define: the dependency optimizer
48
- doesn't apply define. Platform.OS then stays a read at run time.
54
+ __DEV__ and global (as globalThis). In Vite, set the defines in define and in
55
+ optimizeDeps.rolldownOptions.transform.define, and the extensions in
56
+ resolve.extensions and optimizeDeps.rolldownOptions.resolve.extensions: the
57
+ dependency optimizer has its own. Add the compat aliases that a library
58
+ needs. Platform.OS then stays a read at run time.
49
59
 
50
60
  Server rendering with Vite: the plugin applies to app code on the server. A
51
61
  dependency that Vite leaves to Node gets no __DEV__ and throws a
52
62
  ReferenceError. Add it to ssr.noExternal.
53
63
 
64
+ ## Expo
65
+
66
+ An Expo app (no Expo Router) runs on @rootnative/web through
67
+ @rootnative/web-expo, installed under the name react-native-web:
68
+ npm install react-native-web@npm:@rootnative/web-expo
69
+ Restart the dev server with --clear. The app code, the Babel preset, and the
70
+ react-native types stay. Expo's Babel preset rewrites each react-native import
71
+ to react-native-web/dist/exports/<Name>; the package has those files, and each
72
+ one loads only its own module of @rootnative/web, so the bundle has only the
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;
81
+ node_modules/react-native-web/expo-exports.json lists them under "missing".
82
+ Expo Router needs Animated, so it doesn't work yet.
83
+
54
84
  ## Entry points
55
85
 
56
86
  - @rootnative/web: the React Native components and APIs. Import it as
@@ -60,29 +90,45 @@ ReferenceError. Add it to ssr.noExternal.
60
90
  renderStyleTags, styleTagsHTML, StyleRegistry.
61
91
  - @rootnative/web/vite: rootnative(), the Vite plugin. Only in vite.config.ts.
62
92
 
93
+ Libraries: react-native-svg, react-native-safe-area-context, and
94
+ @react-native-async-storage/async-storage need nothing more. Reanimated and
95
+ libraries on it need rootnative({ worklets: true }). An icon set of
96
+ @react-native-vector-icons needs its font from the app: import the .ttf of
97
+ the package with ?url, then document.fonts.add(new FontFace(name, url)).
98
+ Set skipLibCheck: true, because the type files of a native library import
99
+ the real react-native types.
100
+
63
101
  Import /dom and /server only in code that runs on the web.
64
102
 
65
103
  ## What ships
66
104
 
67
105
  Components: View, Text, Image, Pressable, TouchableHighlight,
68
106
  TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, Button,
69
- ScrollView, FlatList, TextInput, Switch, ActivityIndicator, StatusBar.
107
+ ScrollView, FlatList, RefreshControl, TextInput, Switch, ActivityIndicator,
108
+ Modal, KeyboardAvoidingView, StatusBar.
70
109
 
71
110
  APIs: StyleSheet, Platform, Dimensions, useWindowDimensions, Appearance,
72
- useColorScheme, AccessibilityInfo, I18nManager, BackHandler, PixelRatio,
73
- processColor, PanResponder, usePressability.
111
+ useColorScheme, AppState, Keyboard, Linking, Alert, Share, Vibration, Clipboard,
112
+ AccessibilityInfo, I18nManager, BackHandler, PixelRatio, processColor,
113
+ PanResponder, usePressability.
114
+
115
+ Compat, for libraries only, do not call in app code: unstable_createElement,
116
+ findNodeHandle, TurboModuleRegistry.
74
117
 
75
118
  NOT IMPLEMENTED, do not import:
76
- - RefreshControl, Modal.
77
- - Alert, AppState, Linking, Share, Vibration, Clipboard.
78
119
  - SectionList, VirtualizedList, Animated, LayoutAnimation.
79
120
  - A Next.js plugin, and templates for a Vite app with and without server
80
121
  rendering.
81
122
 
82
123
  Out of scope: Expo, Metro, React 18, CommonJS, Flow.
83
124
 
84
- A component ref is the DOM element. View has no measure, measureInWindow,
85
- measureLayout, or setNativeProps: use onLayout or getBoundingClientRect().
125
+ A component ref is the DOM element, typed HostInstance (ViewInstance,
126
+ TextInstance, ImageInstance, PressableInstance). It has measure(callback),
127
+ measureInWindow(callback), measureLayout(ancestor, onSuccess, onFail), and
128
+ setNativeProps({ style }). Each one calls its callback at once, with CSS
129
+ pixels from getBoundingClientRect(). The window is the visible area.
130
+ setNativeProps writes an inline style, and any other prop has no effect.
131
+ Type a ref as useRef<ViewInstance>(null), not useRef<HTMLElement>(null).
86
132
  ScrollView, FlatList, and TextInput add the methods listed below.
87
133
 
88
134
  ## Semantic HTML
@@ -127,18 +173,27 @@ only). Any other prop that isn't a React Native prop is dropped.
127
173
  aspectRatio, and fontWeight stay unitless. Strings pass through.
128
174
  - Colors use the React Native parser. A color it can't parse is dropped.
129
175
  - flex: 1 is 1 1 0%. flex: 0 is 0 0 auto. flex: -1 is 0 1 auto.
130
- - A longhand wins over a shorthand, whatever the key order.
176
+ - Any style wins over a default (flex: 1 beats the default flexShrink 0). A
177
+ longhand wins over a shorthand, whatever the key order.
131
178
  - Start and end props (marginStart, paddingEnd, start, end, borderStartWidth,
132
179
  borderTopStartRadius, ...) become logical CSS and flip in right-to-left.
133
- - marginLeft, paddingLeft, left, and their right partners stay physical in a
134
- right-to-left layout. Native swaps them by default. Use start and end props
135
- for anything that must follow the direction.
180
+ - marginLeft, paddingLeft, left, the left and right borders and corners, and
181
+ their right partners swap sides in a right-to-left layout, as on native.
182
+ They compile to logical CSS. I18nManager.swapLeftAndRightInRTL(false)
183
+ before the first render keeps them physical. A start or end style wins
184
+ over a left or right style of the same side.
136
185
  - transform, boxShadow, and filter take the React Native array or a CSS
137
186
  string. shadow* props become box-shadow when boxShadow isn't set.
138
187
  textShadow* props become text-shadow.
139
188
  - fontFamily 'System' is the browser's system font stack. Named font weights
140
189
  become numbers.
141
190
  - elevation, borderCurve, includeFontPadding, overlayColor: no web effect.
191
+ - Types: the style props take React Native 0.88's ViewStyle, TextStyle, and
192
+ 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
195
+ cast: { transition: '...' } as ViewStyle, or as unknown as ViewStyle for a
196
+ value that React Native's type doesn't allow.
142
197
 
143
198
  ## Components
144
199
 
@@ -187,6 +242,9 @@ Pressable
187
242
  130 ms, as on native.
188
243
  - onPress gets the pointer up event, or the click event for a keyboard or
189
244
  assistive technology press. preventDefault() on it cancels the click.
245
+ - The click that follows a tap stops when it lands outside the pressed
246
+ element, for example on a modal that the press opened. A click on the
247
+ pressed element goes through.
190
248
  - hitSlop grows the hit area with a ::before box. A parent with overflow
191
249
  hidden clips it.
192
250
  - pressRetentionOffset defaults to 20 on three sides and 30 at the bottom.
@@ -261,8 +319,9 @@ ScrollView
261
319
  - scrollEnabled={false} hides the overflow.
262
320
  - snapToInterval, snapToOffsets, pagingEnabled snap after the scroll settles.
263
321
  - stickyHeaderIndices: vertical only. keyboardDismissMode: on-drag works.
264
- - refreshControl wraps the scroller. RefreshControl isn't in the package, so
265
- pass your own component.
322
+ - refreshControl wraps the scroller and gets the style props that place the
323
+ box (margins, flex, sizes, position, transform, gaps), as on Android. The
324
+ scroller fills it and keeps the rest of the style.
266
325
  - Ref: the scroll element plus scrollTo({ x, y, animated }) (animated defaults
267
326
  to true), scrollToEnd({ animated }), getScrollableNode(),
268
327
  getInnerViewNode(). flashScrollIndicators() does nothing.
@@ -271,6 +330,22 @@ ScrollView
271
330
  - Native-only props (bounces, decelerationRate, contentInset, the zoom props,
272
331
  ...) are ignored.
273
332
 
333
+ RefreshControl
334
+ - Pass it to ScrollView as refreshControl, or give FlatList onRefresh and
335
+ refreshing. Pull to refresh with TOUCH ONLY: mouse, pen, and keyboard have
336
+ no pull, so add a refresh button too.
337
+ - A pull starts at the top of the list when the finger first moves down. The
338
+ indicator moves half the finger distance. A release after 128 px of finger
339
+ calls onRefresh. onRefresh must set refreshing to true at once, or the
340
+ indicator goes back. No pull while refreshing or with enabled={false}.
341
+ - In a flipped scroller (an inverted FlatList), the indicator sits at the
342
+ bottom and the pull goes up, as on native.
343
+ - Android's look: an arc on a white disc (40 px, size="large" 56 px), at rest
344
+ 64 px under progressViewOffset minus the disc. colors[0], else tintColor,
345
+ else black, is the arc. progressBackgroundColor is the disc.
346
+ - title is the accessible name; no visible text. titleColor: no effect.
347
+ - View props and the ref go to the wrapper, which has aria-busy.
348
+
274
349
  FlatList
275
350
  - NO VIRTUALIZER. It renders every item. Load a long list in pages with
276
351
  onEndReached.
@@ -285,7 +360,10 @@ FlatList
285
360
  stickyHeaderIndices, and the ScrollView props.
286
361
  - onEndReached fires once per content length. The default threshold is 2 px.
287
362
  A list shorter than its viewport fires it after mount.
288
- - onRefresh and refreshing show no indicator. Pass refreshControl instead.
363
+ - onRefresh and refreshing wrap the scroller in a RefreshControl, with
364
+ progressViewOffset, as on native. With onRefresh, refreshing must be a
365
+ boolean, or the list throws. A refreshControl prop wins.
366
+ renderScrollComponent gets the three props and adds its own control.
289
367
  - Ref: scrollToOffset, scrollToIndex (a row index with numColumns),
290
368
  scrollToItem, scrollToEnd, recordInteraction, getScrollableNode.
291
369
  onScrollToIndexFailed never fires.
@@ -305,7 +383,7 @@ TextInput
305
383
  values map (name-given to given-name, sms-otp to one-time-code).
306
384
  - A value with no change handler stays fixed, with no React warning.
307
385
  - Ref: the element plus clear(), isFocused(), getNativeRef(),
308
- setNativeProps({ text }). TextInput.State has currentlyFocusedInput(),
386
+ setNativeProps({ text, style }). TextInput.State has currentlyFocusedInput(),
309
387
  focusTextInput(element), blurTextInput(element).
310
388
 
311
389
  Switch
@@ -335,6 +413,35 @@ ActivityIndicator
335
413
  centers the indicator. The ref and the other props go to the indicator.
336
414
  - It turns also with prefers-reduced-motion.
337
415
 
416
+ Modal
417
+ - A <dialog> opened with showModal(), in a portal on <body>: the top layer,
418
+ above every zIndex. The rest of the page is inert and doesn't scroll.
419
+ - visible decides (default true). Escape, and the back gesture of Chrome on
420
+ Android, call onRequestClose: hide the modal there. While visible is true,
421
+ the modal stays open.
422
+ - onShow fires once per show, when the enter animation ends. onDismiss fires
423
+ after visible becomes false and the exit animation ends, not on unmount.
424
+ - The focus moves into the modal (the first control, or the dialog itself),
425
+ and back to the opener when it hides.
426
+ - The modal stays in place when the keyboard opens: it undoes the move of the
427
+ page that Safari on iOS makes for a focused field. Use a
428
+ KeyboardAvoidingView inside it.
429
+ - A press inside doesn't reach a Pressable around the Modal. A nested modal
430
+ goes on top, and Escape closes the top one first.
431
+ - The children go in a box that fills the viewport: white, backdropColor, or
432
+ clear with transparent. style goes to the box. ref and modalRef are the
433
+ <dialog>. testID, aria props, and DOM handlers go to the <dialog>.
434
+ - Renders nothing on the server. It shows after hydration.
435
+ - animationType: slide (up from the bottom) or fade, 200 ms with the curves
436
+ of the Android modal; none (default) is instant. The modal stays until its
437
+ exit animation ends and takes no presses then; a nested modal closes at
438
+ once. Reduced motion: instant.
439
+ - presentationStyle, supportedOrientations, onOrientationChange,
440
+ allowSwipeDismissal, hardwareAccelerated, statusBarTranslucent,
441
+ navigationBarTranslucent: ignored.
442
+ - Firefox before 98 and Safari before 15.4 have no showModal(): a fixed box
443
+ on top, Escape works, the page isn't inert.
444
+
338
445
  StatusBar
339
446
  - backgroundColor writes <meta name="theme-color"> in the browser, after
340
447
  mount, so the server HTML doesn't have it. The last mounted StatusBar wins.
@@ -360,6 +467,62 @@ StatusBar
360
467
  prefers-color-scheme. setColorScheme('light' | 'dark') overrides it for the
361
468
  app and sets color-scheme on <html>. null or 'unspecified' clears it.
362
469
  addChangeListener(fn) returns { remove() }.
470
+ - AppState: currentState is 'active' while the page is visible, else
471
+ 'background' ('active' on the server). No 'inactive'. addEventListener:
472
+ 'change' (visibilitychange, and 'background' on pagehide), 'blur' and
473
+ 'focus' (the browser window, as on Android), 'memoryWarning' (never fires).
474
+ Returns { remove() }. An unknown event throws.
475
+ - Linking: openURL opens a URL of this site in this tab, a URL of another
476
+ site in a new tab (no opener; rejects when the browser blocks it, so call
477
+ it from a press handler), and mailto:, tel:, sms:, and other schemes from
478
+ this tab. javascript: and data: reject. A URL that isn't a string or is
479
+ empty throws at once. canOpenURL is true for each URL that openURL tries.
480
+ getInitialURL is the URL that the page loaded with (null on the server).
481
+ The 'url' event NEVER fires on the web: the router owns the URL. emit,
482
+ addListener, removeAllListeners, listenerCount work. openSettings rejects.
483
+ sendIntent rejects with 'Unsupported'. For a link that the user clicks,
484
+ prefer href on Text or View.
485
+ - Alert.alert(title, message?, buttons?, options?): a <dialog
486
+ role="alertdialog"> with showModal(), outside the React tree, with the look
487
+ of Android's alert (teal text buttons; dark gray card in the dark scheme,
488
+ from Appearance or userInterfaceStyle). All buttons show, in order; with
489
+ three, the first sits at the start. No buttons or [] give OK. A press closes
490
+ the alert, then calls onPress(). style 'destructive' is red text. Focus:
491
+ isPreferred, else the cancel button, else the first.
492
+ - Alert: Escape (and Chrome's Android back gesture) presses the style
493
+ 'cancel' button. Without one, Escape and a click outside close the alert
494
+ only with cancelable: true, then onDismiss runs. A new alert goes on top.
495
+ Alert.prompt does nothing yet (dev warning). On the server, nothing.
496
+ - Keyboard: as on Android. keyboardDidShow fires when the on-screen keyboard
497
+ shows and when its height changes, keyboardDidHide when it hides. The Will
498
+ and ChangeFrame events never fire. The keyboard comes from the visual
499
+ viewport, which shrinks by it, and counts only while a text field has the
500
+ focus; with navigator.virtualKeyboard.overlaysContent, from its rectangle.
501
+ Events: duration 0, easing 'keyboard', endCoordinates in CSS px (screenY =
502
+ top of the keyboard from the window top). dismiss() blurs the focused text
503
+ field. isVisible(), metrics(). scheduleLayoutAnimation does nothing. No
504
+ event on a desktop or with a hardware keyboard.
505
+ - KeyboardAvoidingView: React Native 0.88 math. behavior 'padding'
506
+ (paddingBottom), 'height' (first height less the covered part, flex: 0),
507
+ 'position' (inner view with contentContainerStyle, moved by bottom), none
508
+ (plain View). The frame comes from onLayout, so y is relative to the
509
+ parent: pass the distance to the window top in keyboardVerticalOffset, as on
510
+ native. No animation.
511
+ - Share: share({ title, message, url }) calls navigator.share with title,
512
+ text (the message), and url. Resolves { action: 'sharedAction' |
513
+ 'dismissedAction', activityType: null }; a closed sheet is dismissedAction.
514
+ REJECTS with 'Unsupported platform' where the browser has no share sheet
515
+ (for example Firefox on a desktop, or a page on plain http). Call it from a press handler. options
516
+ have no effect.
517
+ - Vibration: navigator.vibrate with Android's rules. A number is
518
+ milliseconds (default 400). An array is [wait, vibrate, wait, ...]. repeat
519
+ plays an array again until cancel(). Does nothing where the browser has no
520
+ Vibration API (Safari, iOS, most desktops).
521
+ - Clipboard (deprecated in React Native): setString writes with
522
+ navigator.clipboard.writeText, or a hidden textarea and
523
+ execCommand('copy') on a page with no Clipboard API. A refused write only
524
+ warns in development. getString reads with readText and REJECTS when the
525
+ browser refuses. Call both from a press handler.
363
526
  - AccessibilityInfo: reduce motion, reduce transparency, invert colors, and
364
527
  high contrast read live media queries, with change events.
365
528
  isScreenReaderEnabled, isAccessibilityServiceEnabled, isBoldTextEnabled, and
@@ -370,7 +533,7 @@ StatusBar
370
533
  tabIndex={-1} so that it can take focus.
371
534
  - I18nManager: isRTL reads the dir of <html> each time. forceRTL sets dir on
372
535
  <html> at once. allowRTL(false) changes only what isRTL reports.
373
- swapLeftAndRightInRTL stores the flag and has no effect on styles. isRTL is
536
+ swapLeftAndRightInRTL(false) keeps left and right styles physical. isRTL is
374
537
  false on the server.
375
538
  - BackHandler: listeners register and never fire. exitApp() does nothing. Use
376
539
  the history API of your router.
@@ -380,8 +543,10 @@ StatusBar
380
543
  - processColor: an unsigned 32-bit ARGB integer, as on iOS. null for a color
381
544
  it can't parse.
382
545
  - PanResponder: runs on pointer events. panHandlers are six pointer handlers;
383
- spread them on a View. Set touchAction: 'none' in the style (or 'pan-y' for
384
- a horizontal drag in a vertical scroll), or the browser scrolls instead.
546
+ spread them on a View. While a responder holds the gesture, the page
547
+ doesn't scroll (onShouldBlockNativeResponder false lets it scroll). A
548
+ responder that takes the gesture on a move needs touchAction: 'none' in
549
+ the style (or 'pan-y' for a horizontal drag in a vertical scroll).
385
550
  The element captures the pointer at the grant. Negotiation works as on
386
551
  native. dx and dy are CSS pixels; vx and vy are pixels per millisecond.
387
552
  onShouldBlockNativeResponder is ignored. getInteractionHandle() is null.
@@ -389,6 +554,22 @@ StatusBar
389
554
  the native responder handlers. Spread them on a View. Memoize the config.
390
555
  A null config returns null. hitSlop doesn't grow the hit area. Set
391
556
  touchAction yourself for cancelable={false}.
557
+ - unstable_createElement(type, props): compat, not in React Native. Renders an
558
+ element from React Native props: style compiles to class names, the
559
+ accessibility props become ARIA attributes, onPress and the responder
560
+ handlers are dropped, every other prop goes to the element. No style reset.
561
+ - findNodeHandle(value): compat. Returns the DOM element of a ref, of an
562
+ element, or of a ScrollView ref. A number comes back as it is. null for a
563
+ class component instance.
564
+ - TurboModuleRegistry: compat. get() returns null, getEnforcing() throws.
565
+ - @rootnative/web/assets-registry: compat entry with registerAsset and
566
+ getAssetByID. The Vite plugin aliases @react-native/assets-registry/registry
567
+ to it. Empty unless your code registers an asset.
568
+ - @rootnative/web/style: compat entry for Reanimated 4. createReactDOMStyle
569
+ (also the default export) gives inline DOM style values, shorthands first.
570
+ createTransformValue and createTextShadowValue give CSS values. Without the
571
+ Worklets Babel plugin, pass the shared values as a dependency array to each
572
+ Reanimated hook.
392
573
 
393
574
  ## Server rendering
394
575
 
@@ -412,7 +593,7 @@ Render the whole <html> document with React, not only the app:
412
593
  - Write the style tags after the render ends.
413
594
  - Render <head> with React, so the tags of Head land in it. Pasted into a
414
595
  template, they land at the start of <body>.
415
- - renderStyleTags(registry) returns the same two <style> elements as React
596
+ - renderStyleTags(registry) returns the same three <style> elements as React
416
597
  elements.
417
598
  - The client calls hydrateRoot(root, <App />) with no provider. It adopts the
418
599
  server's <style> elements, so it inserts no rule twice.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/web",
3
- "version": "0.0.0-alpha.2",
3
+ "version": "0.0.0-alpha.4",
4
4
  "description": "A standalone web runtime for React Native apps",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rootnative.github.io/web/",
@@ -32,9 +32,12 @@
32
32
  ],
33
33
  "exports": {
34
34
  ".": "./dist/index.js",
35
+ "./assets-registry": "./dist/assets-registry/index.js",
35
36
  "./dom": "./dist/dom/index.js",
36
37
  "./server": "./dist/server/index.js",
38
+ "./style": "./dist/style/index.js",
37
39
  "./vite": "./dist/vite/index.js",
40
+ "./internal/*.js": "./dist/*.js",
38
41
  "./package.json": "./package.json"
39
42
  },
40
43
  "scripts": {
@@ -50,23 +53,33 @@
50
53
  "peerDependencies": {
51
54
  "react": "^19.0.0",
52
55
  "react-dom": "^19.0.0",
56
+ "@babel/core": "^7.0.0",
57
+ "react-native-worklets": ">=0.5.0",
53
58
  "vite": "^8.0.0"
54
59
  },
55
60
  "peerDependenciesMeta": {
61
+ "@babel/core": {
62
+ "optional": true
63
+ },
64
+ "react-native-worklets": {
65
+ "optional": true
66
+ },
56
67
  "vite": {
57
68
  "optional": true
58
69
  }
59
70
  },
60
71
  "devDependencies": {
72
+ "@babel/core": "7.29.13",
61
73
  "@types/react": "19.3.0",
62
74
  "@types/react-dom": "19.3.0",
63
75
  "@vitejs/plugin-react": "6.1.2",
64
76
  "@vitest/browser": "5.0.5",
65
77
  "@vitest/browser-playwright": "5.0.5",
66
78
  "playwright": "1.64.1",
67
- "react": "19.3.1",
68
- "react-dom": "19.3.1",
79
+ "react": "19.3.0",
80
+ "react-dom": "19.3.0",
69
81
  "react-native": "0.88.1",
82
+ "react-native-worklets": "0.13.0",
70
83
  "tsdown": "0.23.4",
71
84
  "vite": "8.3.5",
72
85
  "vitest": "5.0.5"
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyleRegistryContext-CAD45r4n.js","names":[],"sources":["../src/style/registry.ts","../src/style/StyleRegistryContext.ts"],"sourcesContent":["import { hasDOM } from '../utils/env'\nimport type { CSSDeclarations } from './types'\n\n// Two style elements: shorthand rules first, longhand rules after them. With equal\n// specificity the later sheet wins, so a longhand always beats a shorthand, as on native.\nexport const SHORTHAND_STYLE_ID = 'rootnative-style-shorthand'\nexport const LONGHAND_STYLE_ID = 'rootnative-style-longhand'\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\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 = { shorthand: CSSStyleSheet | null; longhand: CSSStyleSheet | null }\n\nexport class StyleRegistry {\n private readonly classNames = new Map<string, string>()\n private readonly adopted = new Set<string>()\n private readonly shorthandRules: string[] = []\n private readonly longhandRules: string[] = []\n private readonly sheets: StyleSheets\n\n constructor(sheets: StyleSheets = { shorthand: null, longhand: null }) {\n this.sheets = sheets\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 = shorthandProperties.has(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 // The rules of each sheet, for server rendering.\n cssText(): { shorthand: string; longhand: string } {\n return { shorthand: this.shorthandRules.join('\\n'), longhand: this.longhandRules.join('\\n') }\n }\n\n get ruleCount(): number {\n return 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 ? { shorthand: domSheet(SHORTHAND_STYLE_ID), longhand: domSheet(LONGHAND_STYLE_ID) }\n : { 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 document.getElementById(SHORTHAND_STYLE_ID)?.remove()\n document.getElementById(LONGHAND_STYLE_ID)?.remove()\n}\n\nconst domSheet = (id: string): CSSStyleSheet => {\n let element = document.getElementById(id) as HTMLStyleElement | null\n if (element === null) {\n element = document.createElement('style')\n element.id = id\n document.head.appendChild(element)\n }\n return element.sheet as CSSStyleSheet\n}\n","import { createContext, useContext, type Context } from 'react'\n\nimport { getStyleRegistry, type StyleRegistry } from './registry'\n\nexport const StyleRegistryContext: Context<StyleRegistry | null> =\n createContext<StyleRegistry | null>(null)\n\nexport const useStyleRegistry = (): StyleRegistry =>\n useContext(StyleRegistryContext) ?? getStyleRegistry()\n"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/dom/Head.tsx"],"sourcesContent":["import { createElement, Fragment, type ReactElement, type ReactNode } from 'react'\n\nexport type OpenGraph = {\n title?: string | undefined\n description?: string | undefined\n image?: string | undefined\n url?: string | undefined\n type?: string | undefined\n siteName?: string | undefined\n}\n\nexport type HeadProps = {\n title?: string | undefined\n description?: string | undefined\n canonical?: string | undefined\n robots?: string | undefined\n themeColor?: string | undefined\n openGraph?: OpenGraph | undefined\n // One or more schema.org objects, rendered as JSON-LD.\n jsonLd?: Record<string, unknown> | ReadonlyArray<Record<string, unknown>> | undefined\n // Extra head elements: <meta>, <link>, <title>. React moves them into <head>.\n children?: ReactNode\n}\n\nconst openGraphKeys: ReadonlyArray<[keyof OpenGraph, string]> = [\n ['title', 'og:title'],\n ['description', 'og:description'],\n ['image', 'og:image'],\n ['url', 'og:url'],\n ['type', 'og:type'],\n ['siteName', 'og:site_name'],\n]\n\n// A closing tag inside a script would end it early.\nconst escapeJSON = (json: string): string => json.replace(/</g, '\\\\u003c')\n\n// Use one Head per page. React 19 hoists <title>, <meta>, and <link> into <head> on the\n// server and the client, but it does not merge two Heads.\nexport function Head(props: HeadProps): ReactElement {\n const { canonical, children, description, jsonLd, openGraph, robots, themeColor, title } = props\n const nodes: ReactNode[] = []\n\n if (title !== undefined) nodes.push(createElement('title', { key: 'title' }, title))\n if (description !== undefined) {\n nodes.push(\n createElement('meta', { key: 'description', name: 'description', content: description }),\n )\n }\n if (robots !== undefined) {\n nodes.push(createElement('meta', { key: 'robots', name: 'robots', content: robots }))\n }\n if (themeColor !== undefined) {\n nodes.push(\n createElement('meta', { key: 'theme-color', name: 'theme-color', content: themeColor }),\n )\n }\n if (canonical !== undefined) {\n nodes.push(createElement('link', { key: 'canonical', rel: 'canonical', href: canonical }))\n }\n if (openGraph !== undefined) {\n for (const [key, property] of openGraphKeys) {\n const content = openGraph[key]\n if (content !== undefined)\n nodes.push(createElement('meta', { key: property, property, content }))\n }\n }\n if (jsonLd !== undefined) {\n nodes.push(\n createElement('script', {\n key: 'json-ld',\n type: 'application/ld+json',\n dangerouslySetInnerHTML: { __html: escapeJSON(JSON.stringify(jsonLd)) },\n }),\n )\n }\n\n return createElement(Fragment, null, ...nodes, children)\n}\n"],"mappings":";;AAwBA,MAAM,gBAA0D;CAC9D,CAAC,SAAS,UAAU;CACpB,CAAC,eAAe,gBAAgB;CAChC,CAAC,SAAS,UAAU;CACpB,CAAC,OAAO,QAAQ;CAChB,CAAC,QAAQ,SAAS;CAClB,CAAC,YAAY,cAAc;AAC7B;AAGA,MAAM,cAAc,SAAyB,KAAK,QAAQ,MAAM,SAAS;AAIzE,SAAgB,KAAK,OAAgC;CACnD,MAAM,EAAE,WAAW,UAAU,aAAa,QAAQ,WAAW,QAAQ,YAAY,UAAU;CAC3F,MAAM,QAAqB,CAAC;CAE5B,IAAI,UAAU,KAAA,GAAW,MAAM,KAAK,cAAc,SAAS,EAAE,KAAK,QAAQ,GAAG,KAAK,CAAC;CACnF,IAAI,gBAAgB,KAAA,GAClB,MAAM,KACJ,cAAc,QAAQ;EAAE,KAAK;EAAe,MAAM;EAAe,SAAS;CAAY,CAAC,CACzF;CAEF,IAAI,WAAW,KAAA,GACb,MAAM,KAAK,cAAc,QAAQ;EAAE,KAAK;EAAU,MAAM;EAAU,SAAS;CAAO,CAAC,CAAC;CAEtF,IAAI,eAAe,KAAA,GACjB,MAAM,KACJ,cAAc,QAAQ;EAAE,KAAK;EAAe,MAAM;EAAe,SAAS;CAAW,CAAC,CACxF;CAEF,IAAI,cAAc,KAAA,GAChB,MAAM,KAAK,cAAc,QAAQ;EAAE,KAAK;EAAa,KAAK;EAAa,MAAM;CAAU,CAAC,CAAC;CAE3F,IAAI,cAAc,KAAA,GAChB,KAAK,MAAM,CAAC,KAAK,aAAa,eAAe;EAC3C,MAAM,UAAU,UAAU;EAC1B,IAAI,YAAY,KAAA,GACd,MAAM,KAAK,cAAc,QAAQ;GAAE,KAAK;GAAU;GAAU;EAAQ,CAAC,CAAC;CAC1E;CAEF,IAAI,WAAW,KAAA,GACb,MAAM,KACJ,cAAc,UAAU;EACtB,KAAK;EACL,MAAM;EACN,yBAAyB,EAAE,QAAQ,WAAW,KAAK,UAAU,MAAM,CAAC,EAAE;CACxE,CAAC,CACH;CAGF,OAAO,cAAc,UAAU,MAAM,GAAG,OAAO,QAAQ;AACzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-DK5Mt9yX.js","names":[],"sources":["../src/utils/env.ts"],"sourcesContent":["declare const process: { env: { NODE_ENV?: string } } | undefined\n\ndeclare global {\n interface ImportMeta {\n env?: { MODE?: string }\n }\n}\n\nconst nodeEnv = (): string | undefined =>\n typeof process !== 'undefined' ? process.env.NODE_ENV : import.meta.env?.MODE\n\nexport const isTestEnv = (): boolean => nodeEnv() === 'test'\n\nexport const isProductionEnv = (): boolean => nodeEnv() === 'production'\n\nexport const hasDOM = (): boolean =>\n typeof window !== 'undefined' && typeof document !== 'undefined'\n\nexport const matchesMedia = (query: string): boolean =>\n hasDOM() && typeof window.matchMedia === 'function' && window.matchMedia(query).matches\n"],"mappings":";AAQA,MAAM,gBACJ,OAAO,YAAY,cAAA,QAAA,IAAA,WAAqC,YAAY,KAAK;AAE3E,MAAa,kBAA2B,QAAQ,MAAM;AAEtD,MAAa,wBAAiC,QAAQ,MAAM;AAE5D,MAAa,eACX,OAAO,WAAW,eAAe,OAAO,aAAa;AAEvD,MAAa,gBAAgB,UAC3B,OAAO,KAAK,OAAO,OAAO,eAAe,cAAc,OAAO,WAAW,KAAK,CAAC,CAAC"}