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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as StyleRegistry, i as SHORTHAND_STYLE_ID, r as LONGHAND_STYLE_ID, t as StyleRegistryContext } from "../StyleRegistryContext-D6yDrZk0.js";
1
+ import { a as StyleRegistry, i as SHORTHAND_STYLE_ID, r as LONGHAND_STYLE_ID, t as StyleRegistryContext } from "../StyleRegistryContext-CAD45r4n.js";
2
2
  import { Fragment, createElement } from "react";
3
3
  // src/server/index.ts
4
4
  const createStyleRegistry = () => new StyleRegistry();
@@ -1,4 +1,4 @@
1
- import { n as isProductionEnv } from "../env-BQE0B2yw.js";
1
+ import { n as isProductionEnv } from "../env-DK5Mt9yX.js";
2
2
  // src/bundler/inlinePlatformOS.ts
3
3
  const SOURCES = /* @__PURE__ */ new Set(["react-native", "@rootnative/web"]);
4
4
  const REPLACEMENT = "\"web\"";
package/llms.txt CHANGED
@@ -6,8 +6,8 @@
6
6
  > rendering, and SEO tags. It doesn't use react-native-web.
7
7
 
8
8
  Status: early alpha. The API can change between releases. Every component and
9
- API has tests that run in a real Chromium browser. Firefox and Safari aren't in
10
- the test run yet.
9
+ API has tests that run in real browsers: Chromium, Firefox, and WebKit, the
10
+ engine of Safari.
11
11
 
12
12
  Docs: https://rootnative.github.io/web/
13
13
  Full: https://rootnative.github.io/web/llms-full.txt
@@ -64,19 +64,18 @@ Import /dom and /server only in code that runs on the web.
64
64
 
65
65
  ## What ships
66
66
 
67
- Components: View, Text, Image, Pressable, ScrollView, FlatList, TextInput,
68
- StatusBar.
67
+ Components: View, Text, Image, Pressable, TouchableHighlight,
68
+ TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, Button,
69
+ ScrollView, FlatList, TextInput, Switch, ActivityIndicator, StatusBar.
69
70
 
70
71
  APIs: StyleSheet, Platform, Dimensions, useWindowDimensions, Appearance,
71
72
  useColorScheme, AccessibilityInfo, I18nManager, BackHandler, PixelRatio,
72
73
  processColor, PanResponder, usePressability.
73
74
 
74
75
  NOT IMPLEMENTED, do not import:
75
- - Button, ActivityIndicator, Switch, RefreshControl, Modal, TouchableOpacity,
76
- TouchableHighlight, TouchableWithoutFeedback, TouchableNativeFeedback.
76
+ - RefreshControl, Modal.
77
77
  - Alert, AppState, Linking, Share, Vibration, Clipboard.
78
78
  - SectionList, VirtualizedList, Animated, LayoutAnimation.
79
- - onPressIn, onPressOut, onLongPress on Text. onPress on Text works.
80
79
  - A Next.js plugin, and templates for a Vite app with and without server
81
80
  rendering.
82
81
 
@@ -152,10 +151,16 @@ Text
152
151
  - numberOfLines 1 ends the line with an ellipsis. A larger number clamps.
153
152
  - ellipsizeMode: tail and clip. head and middle show the ellipsis at the end.
154
153
  - selectable is true by default on the web (false on native).
155
- - onPress gets the DOM click event. onClick runs first, and preventDefault()
156
- in it stops onPress. disabled sets aria-disabled and stops onPress.
157
- - A Text with onPress is a span that a keyboard can't focus. Use href to go to
158
- a page, or wrap it in a Pressable with role="button" for an action.
154
+ - onPress, onPressIn, onPressOut, onLongPress, and pressRetentionOffset work
155
+ as on Pressable. The event is a GestureResponderEvent. As on native, only
156
+ onPress or onLongPress makes a Text pressable. suppressHighlighting is
157
+ ignored, as on Android.
158
+ - A pressable Text with no role has role="link", is in the tab order, and
159
+ Enter or Space presses it. With href it renders an <a>. role="button"
160
+ renders a <button>. disabled sets aria-disabled, and the Text isn't
161
+ pressable, so a pressable parent gets the press.
162
+ - On a pressable Text, onClick and the other DOM handlers run before the press
163
+ handlers, and both run.
159
164
 
160
165
  Image
161
166
  - Renders a div box with an <img> inside. The style sizes the box. With no
@@ -189,6 +194,62 @@ Pressable
189
194
  - disabled sets aria-disabled, leaves the tab order, and stops every press.
190
195
  - android_ripple, android_disableSound, blockNativeResponder: ignored.
191
196
 
197
+ TouchableHighlight
198
+ - The press handling of Pressable, with no minimum press duration. A div
199
+ around one child that takes a style. role="button" renders a button.
200
+ - While pressed: underlayColor (default black) as the background, and
201
+ activeOpacity (default 0.85) on the child. After onPress, the underlay
202
+ stays for delayPressOut ms, so a short tap shows it. No press handler, no
203
+ underlay. testOnly_pressed shows it. onShowUnderlay, onHideUnderlay.
204
+ - Give the child an opaque background color, or the underlay shows at full
205
+ strength.
206
+ - In the tab order only with onPress. onFocus and onBlur fire.
207
+ rejectResponderTermination sets touch-action: none.
208
+
209
+ TouchableNativeFeedback
210
+ - Works as TouchableWithoutFeedback, with no ripple, as on iOS. background
211
+ and useForeground are ignored.
212
+ - SelectableBackground(), SelectableBackgroundBorderless(), and Ripple(color,
213
+ borderless, rippleRadius) return the objects of React Native.
214
+ canUseNativeForeground() is false. Call Ripple outside a component: the
215
+ React Compiler lint reads a capitalized call as a component.
216
+
217
+ TouchableOpacity
218
+ - The press handling of Pressable, with no minimum press duration.
219
+ role="button" renders <button type="button">. Without a role, a div.
220
+ - Dims to activeOpacity (default 0.2) at once when a press starts, and over
221
+ 150 ms when the pointer comes back into the press area. Fades back to the
222
+ style's opacity over 250 ms when the press ends or the pointer leaves, and
223
+ when disabled or the style's opacity changes. Easing.inOut(Easing.quad),
224
+ through the Web Animations API, with no new render.
225
+ - In the tab order only with onPress, as on native. onFocus and onBlur fire
226
+ (native doesn't call them). rejectResponderTermination sets touch-action:
227
+ none. hitSlop and pressRetentionOffset as on Pressable.
228
+ - touchSoundDisabled, hasTVPreferredFocus, nextFocus*: ignored.
229
+
230
+ TouchableWithoutFeedback
231
+ - No element of its own. Its only child gets the press handlers (the child's
232
+ own DOM handlers run first), the accessibility props, role, testID,
233
+ nativeID, id, and onLayout. style stays out, as on native.
234
+ - onFocus and onBlur replace the child's. Without them, the child keeps its
235
+ own. The child is in the tab order only with onPress and not disabled.
236
+ - hitSlop goes to the child, but a View doesn't grow its hit area yet.
237
+ rejectResponderTermination is ignored.
238
+
239
+ Button
240
+ - <button type="button"> with the title in a Text, on TouchableOpacity: it
241
+ dims to 0.2 while pressed. title must be a string, or Button throws.
242
+ - The look of the Android button: background #2196F3, white text, weight 500,
243
+ radius 2, 8 px around the title. color sets the background. The title keeps
244
+ its case (Android makes it uppercase). No elevation.
245
+ - disabled (or aria-disabled, or accessibilityState.disabled): background
246
+ #dfdfdf, text #a1a1a1, aria-disabled, out of the tab order, no press.
247
+ - Takes only the props of React Native's Button: no style, no children. For
248
+ another look, use Pressable with role="button".
249
+ - accessibilityLanguage sets lang. accessibilityActions,
250
+ onAccessibilityAction, touchSoundDisabled, hasTVPreferredFocus, nextFocus*:
251
+ ignored. Ref: the button element.
252
+
192
253
  ScrollView
193
254
  - Scrolls its own box, not the document. On a phone, the browser's address
194
255
  bar doesn't hide as it scrolls.
@@ -247,6 +308,33 @@ TextInput
247
308
  setNativeProps({ text }). TextInput.State has currentlyFocusedInput(),
248
309
  focusTextInput(element), blurTextInput(element).
249
310
 
311
+ Switch
312
+ - <input type="checkbox" role="switch">, transparent, over a drawn track and
313
+ thumb. The browser gives the press, Space, the focus, and <label for>.
314
+ - Controlled, as on native: it shows value (only true is on). A press calls
315
+ onChange (nativeEvent.value, nativeEvent.target), then onValueChange(value).
316
+ When value doesn't change, the switch goes back.
317
+ - The look of the Android switch: 40 by 20 px, track #939393 off and #A3D3CF
318
+ on, thumb #FAFAFA off and #009688 on. trackColor={{ false, true }} and
319
+ thumbColor replace them. The thumb moves over 150 ms, not with
320
+ prefers-reduced-motion. Right-to-left puts the on position at the left.
321
+ - disabled (or accessibilityState.disabled): the input is disabled, and the
322
+ switch has an opacity of 0.5.
323
+ - style, onLayout, and pointerEvents go to the root element, which has
324
+ alignSelf: flex-start. A width and height in style change the size. The
325
+ ref, id, testID, and the accessibility props go to the input.
326
+ - ios_backgroundColor, onTintColor, tintColor, thumbTintColor: ignored.
327
+
328
+ ActivityIndicator
329
+ - A spinner: an SVG that turns once each 0.75 s, in an element with
330
+ role="progressbar". size: small (20 px, the default), large (36 px), or a
331
+ number. color: the default is #999999.
332
+ - animating={false} stops and hides it, and it keeps its space.
333
+ hidesWhenStopped={false} keeps a stopped indicator visible.
334
+ - Two elements, as on native: style and onLayout go to a container that
335
+ centers the indicator. The ref and the other props go to the indicator.
336
+ - It turns also with prefers-reduced-motion.
337
+
250
338
  StatusBar
251
339
  - backgroundColor writes <meta name="theme-color"> in the browser, after
252
340
  mount, so the server HTML doesn't have it. The last mounted StatusBar wins.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/web",
3
- "version": "0.0.0-alpha.1",
3
+ "version": "0.0.0-alpha.2",
4
4
  "description": "A standalone web runtime for React Native apps",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rootnative.github.io/web/",
@@ -66,6 +66,7 @@
66
66
  "playwright": "1.64.1",
67
67
  "react": "19.3.1",
68
68
  "react-dom": "19.3.1",
69
+ "react-native": "0.88.1",
69
70
  "tsdown": "0.23.4",
70
71
  "vite": "8.3.5",
71
72
  "vitest": "5.0.5"