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

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,74 @@ All notable changes to `@rootnative/web` are in this file. The format follows [K
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.0.0-alpha.3] - 2026-11-14
8
+
9
+ ### Added
10
+
11
+ - **`AppState`**: `active` while the page is visible, `background` while it's hidden or unloads. `change` fires on `visibilitychange` and `pagehide`, and `blur` and `focus` fire when the browser window loses or gets the focus, as on Android. There's no `inactive` state.
12
+ - **`Linking`**: `openURL` opens a URL of your site in this tab, a URL of another site in a new tab, and `mailto:`, `tel:`, and other schemes through the system. It rejects `javascript:` and `data:`, and a new tab that the browser blocks. `getInitialURL` returns the URL that the page loaded with. The browser never fires the `url` event, because your router owns the URL. `openSettings` and `sendIntent` reject.
13
+ - **`Share`**: opens the browser's share sheet with the title, the message, and the URL. A closed sheet resolves `dismissedAction`. A browser with no share sheet rejects with `Unsupported platform`.
14
+ - **`Vibration`**: vibrates with Android's rules: a number is milliseconds, and an array starts with a wait. `repeat` plays an array until `cancel()`. A browser with no Vibration API, such as Safari, does nothing.
15
+ - **`Clipboard`**: `setString` and `getString` through the async Clipboard API. `setString` falls back to a hidden text field on a page with no Clipboard API, and `getString` rejects when the browser refuses. It's deprecated in React Native, so the first call logs a warning.
16
+ - **`RefreshControl`**: pull to refresh with touch, with Android's indicator: an arc on a white disc that comes down from the top. A release past the target calls `onRefresh`. `colors`, `progressBackgroundColor`, `size`, `progressViewOffset`, and `enabled` work. A mouse or a keyboard has no pull. In a flipped scroller, such as an inverted `FlatList`, the pull goes up from the bottom, as on native.
17
+ - **`FlatList`** pull to refresh: `onRefresh` and `refreshing` wrap the scroller in a `RefreshControl`, with `progressViewOffset`, as on native. With `onRefresh`, `refreshing` must be a boolean, or the list throws.
18
+ - **`Modal`**: a `<dialog>` that opens with `showModal()`, so it's above the page, and the page under it is inert and doesn't scroll. Escape calls `onRequestClose`, the focus moves in and back to the opener, and a nested modal goes on top. `animationType` slides or fades the modal in and out in 200 ms, as on Android, and the modal stays until its exit animation ends. `transparent`, `backdropColor`, `onShow`, and `onDismiss` work. It stays in place when the keyboard opens, also in Safari on iOS, which moves the page up for a focused field. It renders nothing on the server and shows after hydration.
19
+ - **`EventSubscription`**, the type of the object that `addEventListener` returns.
20
+ - **`Alert`**: `Alert.alert` shows a `<dialog role="alertdialog">` with the look of Android's alert, outside the React tree. Escape presses the `cancel` button, a `cancelable` alert also closes on Escape or a click outside and calls `onDismiss`, `destructive` text is red, and the dark scheme follows `Appearance` or `userInterfaceStyle`. `Alert.prompt` does nothing yet.
21
+ - **Compat exports** for libraries that import them from `react-native` on the web: `unstable_createElement` renders an element from React Native props, `findNodeHandle` returns the DOM element of a ref, and `TurboModuleRegistry.get` returns `null`. `react-native-svg` and `react-native-safe-area-context` need them.
22
+ - **`@rootnative/web/assets-registry`**, an entry with `registerAsset` and `getAssetByID`. The Vite plugin resolves `@react-native/assets-registry/registry` to it, because `react-native-svg` imports that module on the web.
23
+ - **`Keyboard`**: as on Android, `keyboardDidShow` fires when the on-screen keyboard shows and when its height changes, and `keyboardDidHide` fires when it hides. It reads the keyboard from the visual viewport while a text field has the focus, or from the VirtualKeyboard API when the app sets `overlaysContent`. When the browser moves the page up to show the field, as Safari on iOS does, `screenY` moves down by the same distance. `dismiss`, `isVisible`, and `metrics` work.
24
+ - **`KeyboardAvoidingView`**, with the math of React Native 0.88: `padding`, `height`, and `position`, `keyboardVerticalOffset`, `enabled`, and `contentContainerStyle`.
25
+ - **`@rootnative/web/style`**, an entry with `createReactDOMStyle`, `createTransformValue`, and `createTextShadowValue`. The Vite plugin resolves the two `react-native-web` files that Reanimated 4 imports to it, so Reanimated animates the components of this package.
26
+ - The Vite plugin defines `global` as `globalThis`, as Metro does. Reanimated and Worklets read it.
27
+ - **Style types** of React Native 0.88: `ViewStyle`, `TextStyle`, `ImageStyle`, `ColorValue`, `DimensionValue`, `BoxShadowValue`, `CursorValue`, `DropShadowValue`, `EdgeInsetsValue`, `FilterFunction`, `FontVariant`, `NativeColorValue`, `OpaqueColorValue`, `PointValue`, and `TransformsStyle`.
28
+ - **Event and instance types**: `TargetedEvent`, `PointerEvent`, `AccessibilityActionEvent`, `HostInstance`, and `ViewInstance`. A focus handler typed with `NativeSyntheticEvent<TargetedEvent>` fits the `onFocus` of each component.
29
+ - **Host methods** on the ref of `View`, `Text`, `Image`, `TextInput`, `ScrollView`, `Pressable`, and the touchables: `measure`, `measureInWindow`, `measureLayout`, and `setNativeProps({ style })`. Each one calls its callback at once, with the box from `getBoundingClientRect()`. The new types are `HostMethods`, `TextInstance`, `ImageInstance`, `MeasureOnSuccessCallback`, `MeasureInWindowOnSuccessCallback`, and `MeasureLayoutOnSuccessCallback`.
30
+ - **`rootnative({ worklets: true })`**: the Vite plugin runs the Babel plugin of `react-native-worklets` on your code and on the libraries that have worklets, also in the dependency optimizer. Reanimated needs it, and so does a library built on Reanimated. The app needs `react-native-worklets` and `@babel/core`, which are optional peer dependencies now.
31
+ - **Compat types** `TurboModule` and `HostComponent`, which the type files of libraries import from `react-native`.
32
+
33
+ ### Changed
34
+
35
+ - **Breaking:** the `ref` of a host component has the type `HostInstance`, which is the element plus the measure methods. A ref typed as `useRef<HTMLElement>(null)` is now a type error. Use `useRef<ViewInstance>(null)`, as on native.
36
+ - **Breaking:** the `style` props take React Native's style types, not any object, and `StyleSheet.create` checks each key and value, as on native. A CSS property that React Native doesn't have is now a type error, except `touchAction`. It still works at runtime. See [Styles](https://rootnative.github.io/web/styles#types).
37
+ - A `ScrollView` with `refreshControl` gives the control the style props that place the box, and the scroller fills it, as on Android. Before, the scroller kept the whole style.
38
+ - The props types that React Native declares as interfaces are interfaces here too: `ViewProps`, `TextProps`, `TextInputProps`, `ImageProps`, `PressableProps`, `ScrollViewProps`, `FlatListProps`, `SwitchProps`, `ButtonProps`, `ActivityIndicatorProps`, `RefreshControlProps`, `TouchableHighlightProps`, `TouchableWithoutFeedbackProps`, `KeyboardAvoidingViewProps`, and `AccessibilityProps`. A library can add a prop with `declare module 'react-native'`. Before, such a library replaced the whole type, and `style` and `testID` were missing from the props of every library.
39
+ - **Left and right styles swap in a right-to-left layout**, as on native: `left`, `right`, `marginLeft`, `paddingLeft`, the left and right borders and corners, and their partners. They compile to logical CSS properties now, so the CSS of a left-to-right page has other property names and class names, with the same layout. `I18nManager.swapLeftAndRightInRTL(false)` keeps them on the physical side. Before, the flag had no effect.
40
+
41
+ ### Fixed
42
+
43
+ - `flex: 1` now grows and shrinks from a size of 0, as the docs say. Before, the defaults of `View` (`flexShrink: 0`, `flexBasis: 'auto'`) won over it, so a `flex: 1` view grew to its content and a `ScrollView` in it didn't scroll. Any style now wins over the defaults of `View`, `Text`, `TextInput`, and `Image`. The same fix makes `fontWeight` and the other font props work in a nested `Text`.
44
+ - The server renders three `<style>` elements now: the defaults of the components come first. Render all three with `renderStyleTags` or `styleTagsHTML`.
45
+ - The Vite plugin now gives the dependency optimizer the `.web` extensions too. Before, a pre-bundled library loaded its native file where it had a `.web.js` file, and the dev server stopped on `react-native-safe-area-context`.
46
+ - A tap that put a new pressable under the finger, for example in a modal that it opened, pressed that pressable too in Chrome on Android. The click of the tap now stops when it lands outside the pressed element.
47
+ - `pointerEvents: 'box-none'` and `'box-only'` now work in a `style`, as the prop does. Before, they became CSS with no effect, so a full-size layer of a library took every click of the page under it. A child of a `box-none` view keeps its own `pointerEvents`.
48
+ - A `PanResponder` that holds the gesture stops the scroll of the page on a touch screen, as on native. Before, a drag that wasn't straight scrolled the page and ended the gesture, unless the element had `touchAction: 'none'`. `onShouldBlockNativeResponder` works now: return `false` to let the page scroll.
49
+ - A `PanResponder` inside a `Pressable` keeps the pointer now. Before, the `Pressable` took the pointer capture, so the responder got the grant but no move and no release. A responder that takes the pointer on a move ends the press of a `Pressable` inside it, as on native, and a `Pressable` that takes the start isn't followed by a start of the responder around it.
50
+
51
+ ## [0.0.0-alpha.2] - 2026-11-11
52
+
53
+ ### Added
54
+
55
+ - **`ActivityIndicator`**: a spinner with `animating`, `color` (default `#999999`), `hidesWhenStopped`, and `size` (`small`, `large`, or a number). It has the role `progressbar`.
56
+ - **`Button`**: a `<button type="button">` with the `title`, on `TouchableOpacity`. It has the look of the Android button, `color` sets the background, and the title keeps its case.
57
+ - **`Switch`**: a checkbox input with the role `switch` under a drawn track and thumb, with `value`, `onValueChange`, `onChange`, `trackColor`, `thumbColor`, and `disabled`. It has the look of the Android switch.
58
+ - **`TouchableHighlight`**: shows `underlayColor` (default black) behind its child and gives the child `activeOpacity` (default `0.85`) while pressed, with `onShowUnderlay` and `onHideUnderlay`.
59
+ - **`TouchableNativeFeedback`**: works as on iOS, with no ripple. `SelectableBackground`, `SelectableBackgroundBorderless`, and `Ripple` return the objects of React Native, and `canUseNativeForeground()` is `false`.
60
+ - **`TouchableOpacity`**: dims to `activeOpacity` (default `0.2`) while pressed, with React Native's timing and curve, through the Web Animations API.
61
+ - **`TouchableWithoutFeedback`**: gives its only child the press handlers and its accessibility props, with no element of its own.
62
+ - **`Text` press events:** `onPressIn`, `onPressOut`, `onLongPress`, and `pressRetentionOffset`, on the same press responder as `Pressable`. `suppressHighlighting` is ignored, as on Android.
63
+
64
+ ### Changed
65
+
66
+ - A pressable `Text` has the role `link` and is in the tab order, as on native, so Enter and Space press it. A `Text` is pressable with `onPress` or `onLongPress`, and not `disabled`.
67
+ - **Breaking:** `Text` presses as `Pressable` does: `onPress` fires on the pointer release and gets a `GestureResponderEvent`. `preventDefault()` in `onClick` no longer stops `onPress`: both run, `onClick` first.
68
+ - `PressEvent` is now the same type as `GestureResponderEvent`, and it's deprecated.
69
+
70
+ ### Fixed
71
+
72
+ - **`__DEV__` in a production build.** The Vite plugin of `0.0.0-alpha.1` set `__DEV__` to `true` in each build, also in production. It's now `false` in a production build.
73
+ - **Development warnings on a production server.** A server render with `NODE_ENV=production` logged the development warnings. It no longer does.
74
+
7
75
  ## [0.0.0-alpha.1] - 2026-11-10
8
76
 
9
77
  ### Added
@@ -45,6 +113,8 @@ The first alpha. It runs a React Native app in the browser with the components a
45
113
  - There's no Vite plugin yet. Set the `react-native` alias by hand, as [Installation](https://rootnative.github.io/web/installation) shows.
46
114
  - The tests run in Chromium. Firefox and Safari aren't in the test run yet.
47
115
 
48
- [unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.1...HEAD
116
+ [unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.3...HEAD
117
+ [0.0.0-alpha.3]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.3
118
+ [0.0.0-alpha.2]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.2
49
119
  [0.0.0-alpha.1]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.1
50
120
  [0.0.0-alpha.0]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.0
@@ -0,0 +1,8 @@
1
+ import { a as getStyleRegistry } from "./registry-Aa_Od5m0.js";
2
+ import { createContext, useContext } from "react";
3
+ // src/style/StyleRegistryContext.ts
4
+ const StyleRegistryContext = createContext(null);
5
+ const useStyleRegistry = () => useContext(StyleRegistryContext) ?? getStyleRegistry();
6
+ export { useStyleRegistry as n, StyleRegistryContext as t };
7
+
8
+ //# sourceMappingURL=StyleRegistryContext-ROsMlY4O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StyleRegistryContext-ROsMlY4O.js","names":[],"sources":["../src/style/StyleRegistryContext.ts"],"sourcesContent":["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":";;;AAIA,MAAa,uBACX,cAAoC,IAAI;AAE1C,MAAa,yBACX,WAAW,oBAAoB,KAAK,iBAAiB"}
@@ -0,0 +1,18 @@
1
+ /** An asset as a React Native packager registers it. */
2
+ export type PackagerAsset = {
3
+ readonly httpServerLocation: string;
4
+ readonly name: string;
5
+ readonly type: string;
6
+ readonly scales: ReadonlyArray<number>;
7
+ readonly width?: number | null;
8
+ readonly height?: number | null;
9
+ readonly hash?: string;
10
+ };
11
+ /**
12
+ * Compat entry. The Vite plugin points `@react-native/assets-registry/registry` here, because
13
+ * libraries such as `react-native-svg` import that module on the web. A web bundler gives an
14
+ * image import a URL, not a number, so the registry stays empty unless your code fills it.
15
+ */
16
+ export declare const registerAsset: (asset: PackagerAsset) => number;
17
+ export declare const getAssetByID: (assetId: number) => PackagerAsset | undefined;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ // src/assets-registry/index.ts
2
+ const assets = [];
3
+ /**
4
+ * Compat entry. The Vite plugin points `@react-native/assets-registry/registry` here, because
5
+ * libraries such as `react-native-svg` import that module on the web. A web bundler gives an
6
+ * image import a URL, not a number, so the registry stays empty unless your code fills it.
7
+ */
8
+ const registerAsset = (asset) => assets.push(asset);
9
+ const getAssetByID = (assetId) => assets[assetId - 1];
10
+ export { getAssetByID, registerAsset };
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/assets-registry/index.ts"],"sourcesContent":["/** An asset as a React Native packager registers it. */\nexport type PackagerAsset = {\n readonly httpServerLocation: string\n readonly name: string\n readonly type: string\n readonly scales: ReadonlyArray<number>\n readonly width?: number | null\n readonly height?: number | null\n readonly hash?: string\n}\n\nconst assets: PackagerAsset[] = []\n\n/**\n * Compat entry. The Vite plugin points `@react-native/assets-registry/registry` here, because\n * libraries such as `react-native-svg` import that module on the web. A web bundler gives an\n * image import a URL, not a number, so the registry stays empty unless your code fills it.\n */\nexport const registerAsset = (asset: PackagerAsset): number => assets.push(asset)\n\nexport const getAssetByID = (assetId: number): PackagerAsset | undefined => assets[assetId - 1]\n"],"mappings":";AAWA,MAAM,SAA0B,CAAC;;;;;;AAOjC,MAAa,iBAAiB,UAAiC,OAAO,KAAK,KAAK;AAEhF,MAAa,gBAAgB,YAA+C,OAAO,UAAU"}
@@ -0,0 +1,400 @@
1
+ import { a as getStyleRegistry } from "./registry-Aa_Od5m0.js";
2
+ import normalizeColor from "@react-native/normalize-colors";
3
+ // src/style/color.ts
4
+ const toCSSColor = (value) => {
5
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
6
+ const packed = normalizeColor(value);
7
+ if (packed === null || packed === void 0) return void 0;
8
+ const r = packed >>> 24 & 255;
9
+ const g = packed >>> 16 & 255;
10
+ const b = packed >>> 8 & 255;
11
+ const a = (packed & 255) / 255;
12
+ return a === 1 ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${round(a)})`;
13
+ };
14
+ const round = (n) => Math.round(n * 1e3) / 1e3;
15
+ // src/style/direction.ts
16
+ let swap = true;
17
+ const getLeftAndRightSwap = () => swap;
18
+ const setLeftAndRightSwap = (value) => {
19
+ swap = value;
20
+ };
21
+ /**
22
+ * The logical CSS property of each physical left or right style. Fabric moves these styles to
23
+ * the start and end edges in a right-to-left layout. A logical property does the same in the
24
+ * browser: it is the left edge in a left-to-right layout, and the right edge in a right-to-left
25
+ * one. The class names stay the same in both, so the server render needs no direction.
26
+ */
27
+ const swappedProperties = {
28
+ left: "insetInlineStart",
29
+ right: "insetInlineEnd",
30
+ marginLeft: "marginInlineStart",
31
+ marginRight: "marginInlineEnd",
32
+ paddingLeft: "paddingInlineStart",
33
+ paddingRight: "paddingInlineEnd",
34
+ borderLeftWidth: "borderInlineStartWidth",
35
+ borderRightWidth: "borderInlineEndWidth",
36
+ borderLeftColor: "borderInlineStartColor",
37
+ borderRightColor: "borderInlineEndColor",
38
+ borderLeftStyle: "borderInlineStartStyle",
39
+ borderRightStyle: "borderInlineEndStyle",
40
+ borderTopLeftRadius: "borderStartStartRadius",
41
+ borderTopRightRadius: "borderStartEndRadius",
42
+ borderBottomLeftRadius: "borderEndStartRadius",
43
+ borderBottomRightRadius: "borderEndEndRadius"
44
+ };
45
+ // src/style/units.ts
46
+ const toUnit = (value, unit) => {
47
+ if (typeof value === "number") return value === 0 ? "0" : `${value}${unit}`;
48
+ return String(value);
49
+ };
50
+ const unitlessProperties = /* @__PURE__ */ new Set([
51
+ "aspectRatio",
52
+ "flex",
53
+ "flexGrow",
54
+ "flexShrink",
55
+ "fontWeight",
56
+ "lineClamp",
57
+ "WebkitLineClamp",
58
+ "opacity",
59
+ "zIndex",
60
+ "scale",
61
+ "shadowOpacity"
62
+ ]);
63
+ // src/style/shadow.ts
64
+ const offsetOf = (value) => {
65
+ const o = value ?? {};
66
+ return {
67
+ x: typeof o.width === "number" ? o.width : 0,
68
+ y: typeof o.height === "number" ? o.height : 0
69
+ };
70
+ };
71
+ const legacyBoxShadow = (style) => {
72
+ const { x, y } = offsetOf(style["shadowOffset"]);
73
+ const radius = typeof style["shadowRadius"] === "number" ? style["shadowRadius"] : 0;
74
+ const opacity = typeof style["shadowOpacity"] === "number" ? style["shadowOpacity"] : 1;
75
+ const color = toCSSColor(style["shadowColor"] ?? "black");
76
+ if (color === void 0) return void 0;
77
+ return `${x}px ${y}px ${radius}px ${withOpacity(color, opacity)}`;
78
+ };
79
+ const toCSSTextShadow = (style) => {
80
+ const { x, y } = offsetOf(style["textShadowOffset"]);
81
+ const radius = typeof style["textShadowRadius"] === "number" ? style["textShadowRadius"] : 0;
82
+ const color = toCSSColor(style["textShadowColor"] ?? "black");
83
+ if (color === void 0) return void 0;
84
+ return `${x}px ${y}px ${radius}px ${color}`;
85
+ };
86
+ const toCSSBoxShadow = (value) => {
87
+ if (typeof value === "string") return value;
88
+ if (!Array.isArray(value)) return void 0;
89
+ const shadows = value.map((s) => {
90
+ const parts = [
91
+ toUnit(s.offsetX, "px"),
92
+ toUnit(s.offsetY, "px"),
93
+ toUnit(s.blurRadius ?? 0, "px"),
94
+ toUnit(s.spreadDistance ?? 0, "px"),
95
+ toCSSColor(s.color ?? "black") ?? "black"
96
+ ];
97
+ if (s.inset === true) parts.push("inset");
98
+ return parts.join(" ");
99
+ });
100
+ return shadows.length === 0 ? "none" : shadows.join(", ");
101
+ };
102
+ const lengthFilters = /* @__PURE__ */ new Set(["blur"]);
103
+ const angleFilters = /* @__PURE__ */ new Set(["hueRotate"]);
104
+ const toCSSFilter = (value) => {
105
+ if (typeof value === "string") return value;
106
+ if (!Array.isArray(value)) return void 0;
107
+ const parts = [];
108
+ for (const entry of value) for (const [name, raw] of Object.entries(entry)) {
109
+ const css = toFilterFunction(name, raw);
110
+ if (css !== void 0) parts.push(css);
111
+ }
112
+ return parts.length === 0 ? "none" : parts.join(" ");
113
+ };
114
+ const toFilterFunction = (name, raw) => {
115
+ if (name === "dropShadow") {
116
+ const shadow = typeof raw === "string" ? raw : dropShadow(raw);
117
+ return shadow === void 0 ? void 0 : `drop-shadow(${shadow})`;
118
+ }
119
+ const cssName = name === "hueRotate" ? "hue-rotate" : name;
120
+ if (typeof raw === "number") {
121
+ if (lengthFilters.has(name)) return `${cssName}(${raw}px)`;
122
+ if (angleFilters.has(name)) return `${cssName}(${raw}deg)`;
123
+ return `${cssName}(${raw})`;
124
+ }
125
+ if (typeof raw === "string") return `${cssName}(${raw})`;
126
+ };
127
+ const dropShadow = (v) => {
128
+ const color = toCSSColor(v["color"] ?? "black");
129
+ if (color === void 0) return void 0;
130
+ return [
131
+ toUnit(v["offsetX"] ?? 0, "px"),
132
+ toUnit(v["offsetY"] ?? 0, "px"),
133
+ toUnit(v["standardDeviation"] ?? 0, "px"),
134
+ color
135
+ ].join(" ");
136
+ };
137
+ const withOpacity = (color, opacity) => {
138
+ if (opacity >= 1) return color;
139
+ const match = /^rgba?\((\d+),(\d+),(\d+)(?:,([\d.]+))?\)$/.exec(color);
140
+ if (match === null) return color;
141
+ const alpha = match[4] === void 0 ? 1 : Number(match[4]);
142
+ const a = Math.round(alpha * opacity * 1e3) / 1e3;
143
+ return `rgba(${match[1]},${match[2]},${match[3]},${a})`;
144
+ };
145
+ // src/style/transform.ts
146
+ const lengthFunctions = /* @__PURE__ */ new Set([
147
+ "translateX",
148
+ "translateY",
149
+ "translateZ",
150
+ "perspective"
151
+ ]);
152
+ const toCSSTransform = (value) => {
153
+ if (typeof value === "string") return value;
154
+ if (!Array.isArray(value)) return void 0;
155
+ const parts = [];
156
+ for (const entry of value) {
157
+ if (entry === null || typeof entry !== "object") continue;
158
+ for (const [name, raw] of Object.entries(entry)) {
159
+ const css = toTransformFunction(name, raw);
160
+ if (css !== void 0) parts.push(css);
161
+ }
162
+ }
163
+ return parts.length === 0 ? "none" : parts.join(" ");
164
+ };
165
+ const toTransformFunction = (name, raw) => {
166
+ if (name === "matrix" && Array.isArray(raw)) return `${raw.length === 16 ? "matrix3d" : "matrix"}(${raw.join(",")})`;
167
+ if (name === "translate" && Array.isArray(raw)) return `translate(${raw.map((v) => toUnit(v, "px")).join(",")})`;
168
+ if (typeof raw === "number") return lengthFunctions.has(name) ? `${name}(${raw}px)` : `${name}(${raw})`;
169
+ if (typeof raw === "string") return `${name}(${raw})`;
170
+ };
171
+ const toCSSTransformOrigin = (value) => {
172
+ if (typeof value === "string") return value;
173
+ if (!Array.isArray(value)) return void 0;
174
+ return value.map((v) => toUnit(v, "px")).join(" ");
175
+ };
176
+ // src/style/resolveStyle.ts
177
+ const colorProperties = /* @__PURE__ */ new Set([
178
+ "backgroundColor",
179
+ "borderBlockColor",
180
+ "borderBlockEndColor",
181
+ "borderBlockStartColor",
182
+ "borderBottomColor",
183
+ "borderColor",
184
+ "borderEndColor",
185
+ "borderLeftColor",
186
+ "borderRightColor",
187
+ "borderStartColor",
188
+ "borderTopColor",
189
+ "color",
190
+ "outlineColor",
191
+ "textDecorationColor"
192
+ ]);
193
+ const renamedProperties = {
194
+ borderEndColor: "borderInlineEndColor",
195
+ borderEndWidth: "borderInlineEndWidth",
196
+ borderStartColor: "borderInlineStartColor",
197
+ borderStartWidth: "borderInlineStartWidth",
198
+ borderTopStartRadius: "borderStartStartRadius",
199
+ borderTopEndRadius: "borderStartEndRadius",
200
+ borderBottomStartRadius: "borderEndStartRadius",
201
+ borderBottomEndRadius: "borderEndEndRadius",
202
+ end: "insetInlineEnd",
203
+ marginEnd: "marginInlineEnd",
204
+ marginStart: "marginInlineStart",
205
+ paddingEnd: "paddingInlineEnd",
206
+ paddingStart: "paddingInlineStart",
207
+ start: "insetInlineStart",
208
+ writingDirection: "direction"
209
+ };
210
+ const expandedProperties = {
211
+ marginHorizontal: ["marginLeft", "marginRight"],
212
+ marginVertical: ["marginTop", "marginBottom"],
213
+ paddingHorizontal: ["paddingLeft", "paddingRight"],
214
+ paddingVertical: ["paddingTop", "paddingBottom"]
215
+ };
216
+ const ignoredProperties = /* @__PURE__ */ new Set([
217
+ "borderCurve",
218
+ "elevation",
219
+ "includeFontPadding",
220
+ "overlayColor",
221
+ "shadowColor",
222
+ "shadowOffset",
223
+ "shadowOpacity",
224
+ "shadowRadius",
225
+ "textShadowColor",
226
+ "textShadowOffset",
227
+ "textShadowRadius",
228
+ "tintColor"
229
+ ]);
230
+ const fontWeightNames = {
231
+ ultralight: "200",
232
+ thin: "100",
233
+ light: "300",
234
+ regular: "400",
235
+ medium: "500",
236
+ semibold: "600",
237
+ condensedBold: "700",
238
+ condensed: "400",
239
+ heavy: "800",
240
+ black: "900"
241
+ };
242
+ const resizeModeToObjectFit = {
243
+ contain: "contain",
244
+ cover: "cover",
245
+ stretch: "fill",
246
+ center: "none",
247
+ repeat: "none"
248
+ };
249
+ const systemFontStack = "system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
250
+ const textAlignVerticalToVerticalAlign = {
251
+ top: "top",
252
+ center: "middle",
253
+ bottom: "bottom"
254
+ };
255
+ const resolveStyle = (style) => {
256
+ const out = {};
257
+ const swap = getLeftAndRightSwap();
258
+ let swapped;
259
+ for (const [name, value] of Object.entries(style)) {
260
+ if (value === void 0 || value === null || ignoredProperties.has(name)) continue;
261
+ if (swap && isPhysical(name)) {
262
+ swapped ??= {};
263
+ resolveProperty(name, value, swapped);
264
+ } else resolveProperty(name, value, out);
265
+ }
266
+ if (swapped !== void 0) for (const name in swapped) {
267
+ const target = swappedProperties[name] ?? name;
268
+ if (out[target] === void 0) out[target] = swapped[name];
269
+ }
270
+ if (out["boxShadow"] === void 0 && hasLegacyShadow(style)) {
271
+ const shadow = legacyBoxShadow(style);
272
+ if (shadow !== void 0) out["boxShadow"] = shadow;
273
+ }
274
+ if (style["textShadowColor"] !== void 0 || style["textShadowOffset"] !== void 0) {
275
+ const shadow = toCSSTextShadow(style);
276
+ if (shadow !== void 0) out["textShadow"] = shadow;
277
+ }
278
+ return out;
279
+ };
280
+ const isPhysical = (name) => swappedProperties[name] !== void 0 || name === "marginHorizontal" || name === "paddingHorizontal";
281
+ const resolveProperty = (name, value, out) => {
282
+ switch (name) {
283
+ case "flex":
284
+ if (typeof value === "number") out["flex"] = value > 0 ? `${value} 1 0%` : value === 0 ? "0 0 auto" : "0 1 auto";
285
+ else out["flex"] = String(value);
286
+ return;
287
+ case "transform": {
288
+ const transform = toCSSTransform(value);
289
+ if (transform !== void 0) out["transform"] = transform;
290
+ return;
291
+ }
292
+ case "transformOrigin": {
293
+ const origin = toCSSTransformOrigin(value);
294
+ if (origin !== void 0) out["transformOrigin"] = origin;
295
+ return;
296
+ }
297
+ case "boxShadow": {
298
+ const shadow = toCSSBoxShadow(value);
299
+ if (shadow !== void 0) out["boxShadow"] = shadow;
300
+ return;
301
+ }
302
+ case "filter": {
303
+ const filter = toCSSFilter(value);
304
+ if (filter !== void 0) out["filter"] = filter;
305
+ return;
306
+ }
307
+ case "fontWeight":
308
+ out["fontWeight"] = fontWeightNames[String(value)] ?? String(value);
309
+ return;
310
+ case "fontFamily":
311
+ out["fontFamily"] = value === "System" ? systemFontStack : String(value);
312
+ return;
313
+ case "fontVariant":
314
+ out["fontVariant"] = Array.isArray(value) ? value.join(" ") : String(value);
315
+ return;
316
+ case "fontVariationSettings":
317
+ out["fontVariationSettings"] = Array.isArray(value) ? value.map((v) => `'${v.axis}' ${v.value}`).join(", ") : String(value);
318
+ return;
319
+ case "resizeMode": {
320
+ const fit = resizeModeToObjectFit[String(value)];
321
+ if (fit !== void 0 && out["objectFit"] === void 0) out["objectFit"] = fit;
322
+ return;
323
+ }
324
+ case "objectFit":
325
+ out["objectFit"] = String(value);
326
+ return;
327
+ case "textAlignVertical": {
328
+ const align = textAlignVerticalToVerticalAlign[String(value)];
329
+ if (align !== void 0 && out["verticalAlign"] === void 0) out["verticalAlign"] = align;
330
+ return;
331
+ }
332
+ case "backgroundImage":
333
+ if (typeof value === "string") out["backgroundImage"] = value;
334
+ return;
335
+ case "pointerEvents":
336
+ if (value === "auto" || value === "none") out["pointerEvents"] = value;
337
+ return;
338
+ }
339
+ if (colorProperties.has(name)) {
340
+ const color = toCSSColor(value);
341
+ if (color !== void 0) out[renamedProperties[name] ?? name] = color;
342
+ return;
343
+ }
344
+ const targets = expandedProperties[name] ?? [renamedProperties[name] ?? name];
345
+ const css = unitlessProperties.has(name) ? String(value) : toUnit(value, "px");
346
+ for (const target of targets) out[target] = css;
347
+ };
348
+ const hasLegacyShadow = (style) => style["shadowColor"] !== void 0 || style["shadowOffset"] !== void 0 || style["shadowOpacity"] !== void 0 || style["shadowRadius"] !== void 0;
349
+ // src/style/compile.ts
350
+ const flattenStyle = (style) => {
351
+ if (style === null || style === void 0 || style === false || style === "") return void 0;
352
+ if (!Array.isArray(style)) return style;
353
+ let result;
354
+ for (const entry of style) {
355
+ const flat = flattenStyle(entry);
356
+ if (flat === void 0) continue;
357
+ result = result === void 0 ? { ...flat } : Object.assign(result, flat);
358
+ }
359
+ return result;
360
+ };
361
+ const boxPointerEventsClass = (value, registry) => {
362
+ if (value === "box-none") return registry.staticClass("rn-pe-box-none", [".rn-pe-box-none{pointer-events:none}", ":where(.rn-pe-box-none)>*{pointer-events:auto}"]);
363
+ if (value === "box-only") return registry.staticClass("rn-pe-box-only", [".rn-pe-box-only{pointer-events:auto}", ".rn-pe-box-only>*{pointer-events:none!important}"]);
364
+ };
365
+ const pointerEventsStyle = Object.freeze({
366
+ auto: Object.freeze({ pointerEvents: "auto" }),
367
+ none: Object.freeze({ pointerEvents: "none" }),
368
+ "box-none": Object.freeze({ pointerEvents: "box-none" }),
369
+ "box-only": Object.freeze({ pointerEvents: "box-only" })
370
+ });
371
+ const caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
372
+ const compileStyle = (style, registry = getStyleRegistry()) => {
373
+ const flat = flattenStyle(style);
374
+ if (flat === void 0) return "";
375
+ const cacheable = Object.isFrozen(flat);
376
+ const cache = caches[getLeftAndRightSwap() ? 1 : 0];
377
+ let perRegistry = cache.get(registry);
378
+ if (cacheable) {
379
+ const cached = perRegistry?.get(flat);
380
+ if (cached !== void 0) return cached;
381
+ }
382
+ const classes = joinClassNames(registry.classesFor(resolveStyle(flat)), boxPointerEventsClass(flat["pointerEvents"], registry));
383
+ if (cacheable) {
384
+ if (perRegistry === void 0) {
385
+ perRegistry = /* @__PURE__ */ new WeakMap();
386
+ cache.set(registry, perRegistry);
387
+ }
388
+ perRegistry.set(flat, classes);
389
+ }
390
+ return classes;
391
+ };
392
+ /**
393
+ * The class of a component's default style, in the reset sheet. Any style of the app beats it,
394
+ * as any style beats the defaults of native layout.
395
+ */
396
+ const compileReset = (className, style, registry = getStyleRegistry()) => registry.resetClass(className, resolveStyle(style));
397
+ const joinClassNames = (...names) => names.filter((name) => typeof name === "string" && name !== "").join(" ");
398
+ export { pointerEventsStyle as a, toCSSTransform as c, setLeftAndRightSwap as d, toCSSColor as f, joinClassNames as i, toCSSTextShadow as l, compileStyle as n, resolveStyle as o, flattenStyle as r, systemFontStack as s, compileReset as t, getLeftAndRightSwap as u };
399
+
400
+ //# sourceMappingURL=compile-CVUjQrR9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-CVUjQrR9.js","names":[],"sources":["../src/style/color.ts","../src/style/direction.ts","../src/style/units.ts","../src/style/shadow.ts","../src/style/transform.ts","../src/style/resolveStyle.ts","../src/style/compile.ts"],"sourcesContent":["import normalizeColor from '@react-native/normalize-colors'\n\nexport const toCSSColor = (value: unknown): string | undefined => {\n if (typeof value !== 'string' && typeof value !== 'number') return undefined\n const packed = normalizeColor(value)\n if (packed === null || packed === undefined) return undefined\n\n const r = (packed >>> 24) & 0xff\n const g = (packed >>> 16) & 0xff\n const b = (packed >>> 8) & 0xff\n const a = (packed & 0xff) / 255\n\n return a === 1 ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${round(a)})`\n}\n\nconst round = (n: number): number => Math.round(n * 1000) / 1000\n","// `I18nManager.swapLeftAndRightInRTL` sets this. On by default, as on native.\nlet swap = true\n\nexport const getLeftAndRightSwap = (): boolean => swap\n\nexport const setLeftAndRightSwap = (value: boolean): void => {\n swap = value\n}\n\n/**\n * The logical CSS property of each physical left or right style. Fabric moves these styles to\n * the start and end edges in a right-to-left layout. A logical property does the same in the\n * browser: it is the left edge in a left-to-right layout, and the right edge in a right-to-left\n * one. The class names stay the same in both, so the server render needs no direction.\n */\nexport const swappedProperties: Readonly<Record<string, string>> = {\n left: 'insetInlineStart',\n right: 'insetInlineEnd',\n marginLeft: 'marginInlineStart',\n marginRight: 'marginInlineEnd',\n paddingLeft: 'paddingInlineStart',\n paddingRight: 'paddingInlineEnd',\n borderLeftWidth: 'borderInlineStartWidth',\n borderRightWidth: 'borderInlineEndWidth',\n borderLeftColor: 'borderInlineStartColor',\n borderRightColor: 'borderInlineEndColor',\n borderLeftStyle: 'borderInlineStartStyle',\n borderRightStyle: 'borderInlineEndStyle',\n borderTopLeftRadius: 'borderStartStartRadius',\n borderTopRightRadius: 'borderStartEndRadius',\n borderBottomLeftRadius: 'borderEndStartRadius',\n borderBottomRightRadius: 'borderEndEndRadius',\n}\n","export const toUnit = (value: unknown, unit: string): string => {\n if (typeof value === 'number') return value === 0 ? '0' : `${value}${unit}`\n return String(value)\n}\n\nexport const unitlessProperties: ReadonlySet<string> = new Set([\n 'aspectRatio',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'fontWeight',\n 'lineClamp',\n 'WebkitLineClamp',\n 'opacity',\n 'zIndex',\n 'scale',\n 'shadowOpacity',\n])\n","import { toCSSColor } from './color'\nimport { toUnit } from './units'\n\ntype Offset = { width?: unknown; height?: unknown }\n\nconst offsetOf = (value: unknown): { x: number; y: number } => {\n const o = (value ?? {}) as Offset\n return {\n x: typeof o.width === 'number' ? o.width : 0,\n y: typeof o.height === 'number' ? o.height : 0,\n }\n}\n\n// The deprecated shadowColor/shadowOffset/shadowOpacity/shadowRadius props.\nexport const legacyBoxShadow = (style: Record<string, unknown>): string | undefined => {\n const { x, y } = offsetOf(style['shadowOffset'])\n const radius = typeof style['shadowRadius'] === 'number' ? style['shadowRadius'] : 0\n const opacity = typeof style['shadowOpacity'] === 'number' ? style['shadowOpacity'] : 1\n const color = toCSSColor(style['shadowColor'] ?? 'black')\n if (color === undefined) return undefined\n return `${x}px ${y}px ${radius}px ${withOpacity(color, opacity)}`\n}\n\nexport const toCSSTextShadow = (style: Record<string, unknown>): string | undefined => {\n const { x, y } = offsetOf(style['textShadowOffset'])\n const radius = typeof style['textShadowRadius'] === 'number' ? style['textShadowRadius'] : 0\n const color = toCSSColor(style['textShadowColor'] ?? 'black')\n if (color === undefined) return undefined\n return `${x}px ${y}px ${radius}px ${color}`\n}\n\ntype BoxShadowValue = {\n offsetX: unknown\n offsetY: unknown\n blurRadius?: unknown\n spreadDistance?: unknown\n color?: unknown\n inset?: unknown\n}\n\nexport const toCSSBoxShadow = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (!Array.isArray(value)) return undefined\n const shadows = (value as BoxShadowValue[]).map((s) => {\n const parts = [\n toUnit(s.offsetX, 'px'),\n toUnit(s.offsetY, 'px'),\n toUnit(s.blurRadius ?? 0, 'px'),\n toUnit(s.spreadDistance ?? 0, 'px'),\n toCSSColor(s.color ?? 'black') ?? 'black',\n ]\n if (s.inset === true) parts.push('inset')\n return parts.join(' ')\n })\n return shadows.length === 0 ? 'none' : shadows.join(', ')\n}\n\nconst lengthFilters = new Set(['blur'])\nconst angleFilters = new Set(['hueRotate'])\n\nexport const toCSSFilter = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (!Array.isArray(value)) return undefined\n const parts: string[] = []\n for (const entry of value as ReadonlyArray<Record<string, unknown>>) {\n for (const [name, raw] of Object.entries(entry)) {\n const css = toFilterFunction(name, raw)\n if (css !== undefined) parts.push(css)\n }\n }\n return parts.length === 0 ? 'none' : parts.join(' ')\n}\n\nconst toFilterFunction = (name: string, raw: unknown): string | undefined => {\n if (name === 'dropShadow') {\n const shadow = typeof raw === 'string' ? raw : dropShadow(raw as Record<string, unknown>)\n return shadow === undefined ? undefined : `drop-shadow(${shadow})`\n }\n const cssName = name === 'hueRotate' ? 'hue-rotate' : name\n if (typeof raw === 'number') {\n if (lengthFilters.has(name)) return `${cssName}(${raw}px)`\n if (angleFilters.has(name)) return `${cssName}(${raw}deg)`\n return `${cssName}(${raw})`\n }\n if (typeof raw === 'string') return `${cssName}(${raw})`\n return undefined\n}\n\nconst dropShadow = (v: Record<string, unknown>): string | undefined => {\n const color = toCSSColor(v['color'] ?? 'black')\n if (color === undefined) return undefined\n return [\n toUnit(v['offsetX'] ?? 0, 'px'),\n toUnit(v['offsetY'] ?? 0, 'px'),\n toUnit(v['standardDeviation'] ?? 0, 'px'),\n color,\n ].join(' ')\n}\n\nconst withOpacity = (color: string, opacity: number): string => {\n if (opacity >= 1) return color\n const match = /^rgba?\\((\\d+),(\\d+),(\\d+)(?:,([\\d.]+))?\\)$/.exec(color)\n if (match === null) return color\n const alpha = match[4] === undefined ? 1 : Number(match[4])\n const a = Math.round(alpha * opacity * 1000) / 1000\n return `rgba(${match[1]},${match[2]},${match[3]},${a})`\n}\n","import { toUnit } from './units'\n\nconst lengthFunctions = new Set(['translateX', 'translateY', 'translateZ', 'perspective'])\n\nexport const toCSSTransform = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (!Array.isArray(value)) return undefined\n\n const parts: string[] = []\n for (const entry of value as ReadonlyArray<unknown>) {\n if (entry === null || typeof entry !== 'object') continue\n for (const [name, raw] of Object.entries(entry as Record<string, unknown>)) {\n const css = toTransformFunction(name, raw)\n if (css !== undefined) parts.push(css)\n }\n }\n return parts.length === 0 ? 'none' : parts.join(' ')\n}\n\nconst toTransformFunction = (name: string, raw: unknown): string | undefined => {\n if (name === 'matrix' && Array.isArray(raw)) {\n const fn = raw.length === 16 ? 'matrix3d' : 'matrix'\n return `${fn}(${(raw as number[]).join(',')})`\n }\n if (name === 'translate' && Array.isArray(raw)) {\n return `translate(${(raw as unknown[]).map((v) => toUnit(v, 'px')).join(',')})`\n }\n if (typeof raw === 'number') {\n return lengthFunctions.has(name) ? `${name}(${raw}px)` : `${name}(${raw})`\n }\n if (typeof raw === 'string') return `${name}(${raw})`\n return undefined\n}\n\nexport const toCSSTransformOrigin = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (!Array.isArray(value)) return undefined\n return (value as unknown[]).map((v) => toUnit(v, 'px')).join(' ')\n}\n","import { toCSSColor } from './color'\nimport { getLeftAndRightSwap, swappedProperties } from './direction'\nimport { legacyBoxShadow, toCSSBoxShadow, toCSSFilter, toCSSTextShadow } from './shadow'\nimport { toCSSTransform, toCSSTransformOrigin } from './transform'\nimport type { CSSDeclarations, FlatStyle } from './types'\nimport { toUnit, unitlessProperties } from './units'\n\nconst colorProperties = new Set([\n 'backgroundColor',\n 'borderBlockColor',\n 'borderBlockEndColor',\n 'borderBlockStartColor',\n 'borderBottomColor',\n 'borderColor',\n 'borderEndColor',\n 'borderLeftColor',\n 'borderRightColor',\n 'borderStartColor',\n 'borderTopColor',\n 'color',\n 'outlineColor',\n 'textDecorationColor',\n])\n\n// React Native names that differ from the CSS name with the same meaning.\nconst renamedProperties: Record<string, string> = {\n borderEndColor: 'borderInlineEndColor',\n borderEndWidth: 'borderInlineEndWidth',\n borderStartColor: 'borderInlineStartColor',\n borderStartWidth: 'borderInlineStartWidth',\n borderTopStartRadius: 'borderStartStartRadius',\n borderTopEndRadius: 'borderStartEndRadius',\n borderBottomStartRadius: 'borderEndStartRadius',\n borderBottomEndRadius: 'borderEndEndRadius',\n end: 'insetInlineEnd',\n marginEnd: 'marginInlineEnd',\n marginStart: 'marginInlineStart',\n paddingEnd: 'paddingInlineEnd',\n paddingStart: 'paddingInlineStart',\n start: 'insetInlineStart',\n writingDirection: 'direction',\n}\n\n// React Native shorthands that have no single CSS property.\nconst expandedProperties: Record<string, readonly string[]> = {\n marginHorizontal: ['marginLeft', 'marginRight'],\n marginVertical: ['marginTop', 'marginBottom'],\n paddingHorizontal: ['paddingLeft', 'paddingRight'],\n paddingVertical: ['paddingTop', 'paddingBottom'],\n}\n\n// Native-only properties, or properties that another step handles.\nconst ignoredProperties = new Set([\n 'borderCurve',\n 'elevation',\n 'includeFontPadding',\n 'overlayColor',\n 'shadowColor',\n 'shadowOffset',\n 'shadowOpacity',\n 'shadowRadius',\n 'textShadowColor',\n 'textShadowOffset',\n 'textShadowRadius',\n 'tintColor',\n])\n\nconst fontWeightNames: Record<string, string> = {\n ultralight: '200',\n thin: '100',\n light: '300',\n regular: '400',\n medium: '500',\n semibold: '600',\n condensedBold: '700',\n condensed: '400',\n heavy: '800',\n black: '900',\n}\n\nconst resizeModeToObjectFit: Record<string, string> = {\n contain: 'contain',\n cover: 'cover',\n stretch: 'fill',\n center: 'none',\n repeat: 'none',\n}\n\n// The font React Native calls \"System\".\nexport const systemFontStack: string =\n 'system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif'\n\nconst textAlignVerticalToVerticalAlign: Record<string, string> = {\n top: 'top',\n center: 'middle',\n bottom: 'bottom',\n}\n\nexport const resolveStyle = (style: FlatStyle): CSSDeclarations => {\n const out: CSSDeclarations = {}\n const swap = getLeftAndRightSwap()\n // A swapped left or right style and a start or end style can name the same CSS property.\n // The start or end style wins in any key order, as Yoga reads the start edge first.\n let swapped: CSSDeclarations | undefined\n\n for (const [name, value] of Object.entries(style)) {\n if (value === undefined || value === null || ignoredProperties.has(name)) continue\n if (swap && isPhysical(name)) {\n swapped ??= {}\n resolveProperty(name, value, swapped)\n } else {\n resolveProperty(name, value, out)\n }\n }\n if (swapped !== undefined) {\n for (const name in swapped) {\n const target = swappedProperties[name] ?? name\n if (out[target] === undefined) out[target] = swapped[name] as string\n }\n }\n\n if (out['boxShadow'] === undefined && hasLegacyShadow(style)) {\n const shadow = legacyBoxShadow(style)\n if (shadow !== undefined) out['boxShadow'] = shadow\n }\n if (style['textShadowColor'] !== undefined || style['textShadowOffset'] !== undefined) {\n const shadow = toCSSTextShadow(style)\n if (shadow !== undefined) out['textShadow'] = shadow\n }\n\n return out\n}\n\nconst isPhysical = (name: string): boolean =>\n swappedProperties[name] !== undefined ||\n name === 'marginHorizontal' ||\n name === 'paddingHorizontal'\n\nconst resolveProperty = (name: string, value: unknown, out: CSSDeclarations): void => {\n switch (name) {\n case 'flex':\n if (typeof value === 'number') {\n out['flex'] = value > 0 ? `${value} 1 0%` : value === 0 ? '0 0 auto' : '0 1 auto'\n } else {\n out['flex'] = String(value)\n }\n return\n case 'transform': {\n const transform = toCSSTransform(value)\n if (transform !== undefined) out['transform'] = transform\n return\n }\n case 'transformOrigin': {\n const origin = toCSSTransformOrigin(value)\n if (origin !== undefined) out['transformOrigin'] = origin\n return\n }\n case 'boxShadow': {\n const shadow = toCSSBoxShadow(value)\n if (shadow !== undefined) out['boxShadow'] = shadow\n return\n }\n case 'filter': {\n const filter = toCSSFilter(value)\n if (filter !== undefined) out['filter'] = filter\n return\n }\n case 'fontWeight':\n out['fontWeight'] = fontWeightNames[String(value)] ?? String(value)\n return\n case 'fontFamily':\n out['fontFamily'] = value === 'System' ? systemFontStack : String(value)\n return\n case 'fontVariant':\n out['fontVariant'] = Array.isArray(value) ? value.join(' ') : String(value)\n return\n case 'fontVariationSettings':\n out['fontVariationSettings'] = Array.isArray(value)\n ? (value as ReadonlyArray<{ axis: string; value: number }>)\n .map((v) => `'${v.axis}' ${v.value}`)\n .join(', ')\n : String(value)\n return\n case 'resizeMode': {\n const fit = resizeModeToObjectFit[String(value)]\n if (fit !== undefined && out['objectFit'] === undefined) out['objectFit'] = fit\n return\n }\n case 'objectFit':\n out['objectFit'] = String(value)\n return\n case 'textAlignVertical': {\n const align = textAlignVerticalToVerticalAlign[String(value)]\n if (align !== undefined && out['verticalAlign'] === undefined) out['verticalAlign'] = align\n return\n }\n case 'backgroundImage':\n if (typeof value === 'string') out['backgroundImage'] = value\n return\n case 'pointerEvents':\n // `box-none` and `box-only` need a child selector. `compileStyle` adds their class.\n if (value === 'auto' || value === 'none') out['pointerEvents'] = value\n return\n }\n\n if (colorProperties.has(name)) {\n const color = toCSSColor(value)\n if (color !== undefined) out[renamedProperties[name] ?? name] = color\n return\n }\n\n const targets = expandedProperties[name] ?? [renamedProperties[name] ?? name]\n const css = unitlessProperties.has(name) ? String(value) : toUnit(value, 'px')\n for (const target of targets) out[target] = css\n}\n\nconst hasLegacyShadow = (style: FlatStyle): boolean =>\n style['shadowColor'] !== undefined ||\n style['shadowOffset'] !== undefined ||\n style['shadowOpacity'] !== undefined ||\n style['shadowRadius'] !== undefined\n","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// 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, string>>(),\n new WeakMap<StyleRegistry, WeakMap<FlatStyle, string>>(),\n] as const\n\nexport const compileStyle = (\n style: StyleProp<object>,\n registry: StyleRegistry = getStyleRegistry(),\n): string => {\n const flat = flattenStyle(style) as FlatStyle | undefined\n if (flat === undefined) return ''\n\n // Static objects from StyleSheet.create are frozen, so they can be cached by identity.\n const cacheable = Object.isFrozen(flat)\n const cache = caches[getLeftAndRightSwap() ? 1 : 0]\n let perRegistry = cache.get(registry)\n if (cacheable) {\n const cached = perRegistry?.get(flat)\n if (cached !== undefined) return cached\n }\n\n const classes = joinClassNames(\n registry.classesFor(resolveStyle(flat)),\n boxPointerEventsClass(flat['pointerEvents'], registry),\n )\n if (cacheable) {\n if (perRegistry === undefined) {\n perRegistry = new WeakMap()\n cache.set(registry, perRegistry)\n }\n perRegistry.set(flat, classes)\n }\n return 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":";;;AAEA,MAAa,cAAc,UAAuC;CAChE,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU,OAAO,KAAA;CACnE,MAAM,SAAS,eAAe,KAAK;CACnC,IAAI,WAAW,QAAQ,WAAW,KAAA,GAAW,OAAO,KAAA;CAEpD,MAAM,IAAK,WAAW,KAAM;CAC5B,MAAM,IAAK,WAAW,KAAM;CAC5B,MAAM,IAAK,WAAW,IAAK;CAC3B,MAAM,KAAK,SAAS,OAAQ;CAE5B,OAAO,MAAM,IAAI,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,EAAE;AAC3E;AAEA,MAAM,SAAS,MAAsB,KAAK,MAAM,IAAI,GAAI,IAAI;;ACd5D,IAAI,OAAO;AAEX,MAAa,4BAAqC;AAElD,MAAa,uBAAuB,UAAyB;CAC3D,OAAO;AACT;;;;;;;AAQA,MAAa,oBAAsD;CACjE,MAAM;CACN,OAAO;CACP,YAAY;CACZ,aAAa;CACb,aAAa;CACb,cAAc;CACd,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,kBAAkB;CAClB,iBAAiB;CACjB,kBAAkB;CAClB,qBAAqB;CACrB,sBAAsB;CACtB,wBAAwB;CACxB,yBAAyB;AAC3B;;AChCA,MAAa,UAAU,OAAgB,SAAyB;CAC9D,IAAI,OAAO,UAAU,UAAU,OAAO,UAAU,IAAI,MAAM,GAAG,QAAQ;CACrE,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,qCAA0C,IAAI,IAAI;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O,EAAE,eAAe,WAAW,CAAC;CACvD,YAAY,OAAO,OAAO,EAAE,eAAe,WAAW,CAAC;AACzD,CAAC;AAGD,MAAM,SAAS,iBACb,IAAI,QAAmD,mBACvD,IAAI,QAAmD,CACzD;AAEA,MAAa,gBACX,OACA,WAA0B,iBAAiB,MAChC;CACX,MAAM,OAAO,aAAa,KAAK;CAC/B,IAAI,SAAS,KAAA,GAAW,OAAO;CAG/B,MAAM,YAAY,OAAO,SAAS,IAAI;CACtC,MAAM,QAAQ,OAAO,oBAAoB,IAAI,IAAI;CACjD,IAAI,cAAc,MAAM,IAAI,QAAQ;CACpC,IAAI,WAAW;EACb,MAAM,SAAS,aAAa,IAAI,IAAI;EACpC,IAAI,WAAW,KAAA,GAAW,OAAO;CACnC;CAEA,MAAM,UAAU,eACd,SAAS,WAAW,aAAa,IAAI,CAAC,GACtC,sBAAsB,KAAK,kBAAkB,QAAQ,CACvD;CACA,IAAI,WAAW;EACb,IAAI,gBAAgB,KAAA,GAAW;GAC7B,8BAAc,IAAI,QAAQ;GAC1B,MAAM,IAAI,UAAU,WAAW;EACjC;EACA,YAAY,IAAI,MAAM,OAAO;CAC/B;CACA,OAAO;AACT;;;;;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,9 +1,9 @@
1
1
  // src/utils/env.ts
2
- const nodeEnv = () => typeof process !== "undefined" ? "development" : import.meta.env?.MODE;
2
+ const nodeEnv = () => typeof process !== "undefined" ? process.env.NODE_ENV : import.meta.env?.MODE;
3
3
  const isTestEnv = () => nodeEnv() === "test";
4
4
  const isProductionEnv = () => nodeEnv() === "production";
5
5
  const hasDOM = () => typeof window !== "undefined" && typeof document !== "undefined";
6
6
  const matchesMedia = (query) => hasDOM() && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
7
7
  export { matchesMedia as i, isProductionEnv as n, isTestEnv as r, hasDOM as t };
8
8
 
9
- //# sourceMappingURL=env-BQE0B2yw.js.map
9
+ //# sourceMappingURL=env-DK5Mt9yX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-BQE0B2yw.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,gBAAqC,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"}
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"}