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

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 (241) hide show
  1. package/CHANGELOG.md +31 -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/bundler/index.js +30 -0
  62. package/dist/bundler/index.js.map +1 -0
  63. package/dist/bundler/inlinePlatformOS.js +121 -0
  64. package/dist/bundler/inlinePlatformOS.js.map +1 -0
  65. package/dist/bundler/worklets.js +61 -0
  66. package/dist/bundler/worklets.js.map +1 -0
  67. package/dist/compat/TurboModuleRegistry/index.d.ts +16 -0
  68. package/dist/compat/TurboModuleRegistry/index.js +14 -0
  69. package/dist/compat/TurboModuleRegistry/index.js.map +1 -0
  70. package/dist/compat/createElement/index.d.ts +9 -0
  71. package/dist/compat/createElement/index.js +40 -0
  72. package/dist/compat/createElement/index.js.map +1 -0
  73. package/dist/compat/findNodeHandle/index.d.ts +7 -0
  74. package/dist/compat/findNodeHandle/index.js +19 -0
  75. package/dist/compat/findNodeHandle/index.js.map +1 -0
  76. package/dist/components/ActivityIndicator/index.d.ts +5 -0
  77. package/dist/components/ActivityIndicator/index.js +74 -0
  78. package/dist/components/ActivityIndicator/index.js.map +1 -0
  79. package/dist/components/ActivityIndicator/types.d.ts +8 -0
  80. package/dist/components/Button/index.d.ts +5 -0
  81. package/dist/components/Button/index.js +48 -0
  82. package/dist/components/Button/index.js.map +1 -0
  83. package/dist/components/Button/types.d.ts +31 -0
  84. package/dist/components/FlatList/index.d.ts +5 -0
  85. package/dist/components/FlatList/index.js +433 -0
  86. package/dist/components/FlatList/index.js.map +1 -0
  87. package/dist/components/FlatList/types.d.ts +138 -0
  88. package/dist/components/FlatList/viewability.js +86 -0
  89. package/dist/components/FlatList/viewability.js.map +1 -0
  90. package/dist/components/Image/index.d.ts +7 -0
  91. package/dist/components/Image/index.js +301 -0
  92. package/dist/components/Image/index.js.map +1 -0
  93. package/dist/components/Image/source.js +97 -0
  94. package/dist/components/Image/source.js.map +1 -0
  95. package/dist/components/Image/types.d.ts +96 -0
  96. package/dist/components/KeyboardAvoidingView/index.d.ts +10 -0
  97. package/dist/components/KeyboardAvoidingView/index.js +118 -0
  98. package/dist/components/KeyboardAvoidingView/index.js.map +1 -0
  99. package/dist/components/KeyboardAvoidingView/types.d.ts +14 -0
  100. package/dist/components/Modal/index.d.ts +9 -0
  101. package/dist/components/Modal/index.js +271 -0
  102. package/dist/components/Modal/index.js.map +1 -0
  103. package/dist/components/Modal/types.d.ts +29 -0
  104. package/dist/components/Pressable/index.d.ts +5 -0
  105. package/dist/components/Pressable/index.js +106 -0
  106. package/dist/components/Pressable/index.js.map +1 -0
  107. package/dist/components/Pressable/types.d.ts +44 -0
  108. package/dist/components/RefreshControl/index.d.ts +5 -0
  109. package/dist/components/RefreshControl/index.js +176 -0
  110. package/dist/components/RefreshControl/index.js.map +1 -0
  111. package/dist/components/RefreshControl/pull.js +16 -0
  112. package/dist/components/RefreshControl/pull.js.map +1 -0
  113. package/dist/components/RefreshControl/types.d.ts +14 -0
  114. package/dist/components/ScrollView/index.d.ts +5 -0
  115. package/dist/components/ScrollView/index.js +318 -0
  116. package/dist/components/ScrollView/index.js.map +1 -0
  117. package/dist/components/ScrollView/snap.js +38 -0
  118. package/dist/components/ScrollView/snap.js.map +1 -0
  119. package/dist/components/ScrollView/types.d.ts +115 -0
  120. package/dist/components/StatusBar/index.d.ts +26 -0
  121. package/dist/components/StatusBar/index.js +113 -0
  122. package/dist/components/StatusBar/index.js.map +1 -0
  123. package/dist/components/Switch/index.d.ts +5 -0
  124. package/dist/components/Switch/index.js +89 -0
  125. package/dist/components/Switch/index.js.map +1 -0
  126. package/dist/components/Switch/types.d.ts +25 -0
  127. package/dist/components/Text/TextAncestorContext.d.ts +3 -0
  128. package/dist/components/Text/TextAncestorContext.js +6 -0
  129. package/dist/components/Text/TextAncestorContext.js.map +1 -0
  130. package/dist/components/Text/index.d.ts +6 -0
  131. package/dist/components/Text/index.js +133 -0
  132. package/dist/components/Text/index.js.map +1 -0
  133. package/dist/components/Text/types.d.ts +38 -0
  134. package/dist/components/TextInput/autocomplete.js +102 -0
  135. package/dist/components/TextInput/autocomplete.js.map +1 -0
  136. package/dist/components/TextInput/index.d.ts +8 -0
  137. package/dist/components/TextInput/index.js +290 -0
  138. package/dist/components/TextInput/index.js.map +1 -0
  139. package/dist/components/TextInput/types.d.ts +130 -0
  140. package/dist/components/TouchableHighlight/index.d.ts +5 -0
  141. package/dist/components/TouchableHighlight/index.js +109 -0
  142. package/dist/components/TouchableHighlight/index.js.map +1 -0
  143. package/dist/components/TouchableHighlight/types.d.ts +15 -0
  144. package/dist/components/TouchableNativeFeedback/index.d.ts +11 -0
  145. package/dist/components/TouchableNativeFeedback/index.js +29 -0
  146. package/dist/components/TouchableNativeFeedback/index.js.map +1 -0
  147. package/dist/components/TouchableNativeFeedback/types.d.ts +19 -0
  148. package/dist/components/TouchableOpacity/index.d.ts +5 -0
  149. package/dist/components/TouchableOpacity/index.js +122 -0
  150. package/dist/components/TouchableOpacity/index.js.map +1 -0
  151. package/dist/components/TouchableOpacity/types.d.ts +11 -0
  152. package/dist/components/TouchableWithoutFeedback/index.d.ts +5 -0
  153. package/dist/components/TouchableWithoutFeedback/index.js +70 -0
  154. package/dist/components/TouchableWithoutFeedback/index.js.map +1 -0
  155. package/dist/components/TouchableWithoutFeedback/types.d.ts +40 -0
  156. package/dist/components/View/index.d.ts +5 -0
  157. package/dist/components/View/index.js +50 -0
  158. package/dist/components/View/index.js.map +1 -0
  159. package/dist/components/View/types.d.ts +98 -0
  160. package/dist/dom/Head.d.ts +21 -0
  161. package/dist/dom/Head.js +53 -0
  162. package/dist/dom/Head.js.map +1 -0
  163. package/dist/dom/index.d.ts +2 -22
  164. package/dist/dom/index.js +1 -53
  165. package/dist/events/press/Pressability.d.ts +2 -0
  166. package/dist/events/press/Pressability.js +366 -0
  167. package/dist/events/press/Pressability.js.map +1 -0
  168. package/dist/events/press/cursorStyle.js +5 -0
  169. package/dist/events/press/cursorStyle.js.map +1 -0
  170. package/dist/events/press/index.d.ts +4 -0
  171. package/dist/events/press/mergeHandlers.js +30 -0
  172. package/dist/events/press/mergeHandlers.js.map +1 -0
  173. package/dist/events/press/types.d.ts +48 -0
  174. package/dist/events/press/usePressability.d.ts +4 -0
  175. package/dist/events/press/usePressability.js +18 -0
  176. package/dist/events/press/usePressability.js.map +1 -0
  177. package/dist/events/responderEvent.js +50 -0
  178. package/dist/events/responderEvent.js.map +1 -0
  179. package/dist/events/types.d.ts +33 -0
  180. package/dist/index.d.ts +66 -1597
  181. package/dist/index.js +42 -4864
  182. package/dist/reactNativeVersion.d.ts +7 -0
  183. package/dist/reactNativeVersion.js +10 -0
  184. package/dist/reactNativeVersion.js.map +1 -0
  185. package/dist/render/domProps.js +66 -0
  186. package/dist/render/domProps.js.map +1 -0
  187. package/dist/render/hitSlop.js +21 -0
  188. package/dist/render/hitSlop.js.map +1 -0
  189. package/dist/render/hostMethods.js +44 -0
  190. package/dist/render/hostMethods.js.map +1 -0
  191. package/dist/render/resolveTag.js +64 -0
  192. package/dist/render/resolveTag.js.map +1 -0
  193. package/dist/render/useElementLayout.js +25 -0
  194. package/dist/render/useElementLayout.js.map +1 -0
  195. package/dist/server/index.d.ts +2 -27
  196. package/dist/server/index.js +2 -2
  197. package/dist/{StyleRegistryContext-ROsMlY4O.js → style/StyleRegistryContext.js} +3 -3
  198. package/dist/style/StyleRegistryContext.js.map +1 -0
  199. package/dist/style/color.js +16 -0
  200. package/dist/style/color.js.map +1 -0
  201. package/dist/style/compile.js +102 -0
  202. package/dist/style/compile.js.map +1 -0
  203. package/dist/style/direction.js +33 -0
  204. package/dist/style/direction.js.map +1 -0
  205. package/dist/style/index.d.ts +1 -1
  206. package/dist/style/index.js +5 -2
  207. package/dist/style/index.js.map +1 -1
  208. package/dist/style/registry.d.ts +28 -0
  209. package/dist/{registry-Aa_Od5m0.js → style/registry.js} +6 -3
  210. package/dist/style/registry.js.map +1 -0
  211. package/dist/style/resolveStyle.js +181 -0
  212. package/dist/style/resolveStyle.js.map +1 -0
  213. package/dist/style/shadow.js +87 -0
  214. package/dist/style/shadow.js.map +1 -0
  215. package/dist/style/splitLayoutProps.js +52 -0
  216. package/dist/style/splitLayoutProps.js.map +1 -0
  217. package/dist/style/transform.js +35 -0
  218. package/dist/style/transform.js.map +1 -0
  219. package/dist/style/types.d.ts +4 -0
  220. package/dist/style/units.js +21 -0
  221. package/dist/style/units.js.map +1 -0
  222. package/dist/style/webStyle.js +9 -0
  223. package/dist/style/webStyle.js.map +1 -0
  224. package/dist/{env-DK5Mt9yX.js → utils/env.js} +2 -2
  225. package/dist/utils/env.js.map +1 -0
  226. package/dist/utils/scrollLock.js +28 -0
  227. package/dist/utils/scrollLock.js.map +1 -0
  228. package/dist/utils/warn.js +11 -0
  229. package/dist/utils/warn.js.map +1 -0
  230. package/dist/vite/index.js +4 -202
  231. package/dist/vite/index.js.map +1 -1
  232. package/llms.txt +20 -0
  233. package/package.json +4 -3
  234. package/dist/StyleRegistryContext-ROsMlY4O.js.map +0 -1
  235. package/dist/compile-CVUjQrR9.js +0 -400
  236. package/dist/compile-CVUjQrR9.js.map +0 -1
  237. package/dist/dom/index.js.map +0 -1
  238. package/dist/env-DK5Mt9yX.js.map +0 -1
  239. package/dist/index.js.map +0 -1
  240. package/dist/registry-Aa_Od5m0.js.map +0 -1
  241. package/dist/types-BxTWbdj9.d.ts +0 -5
@@ -0,0 +1,7 @@
1
+ export type ReactNativeVersion = {
2
+ major: number;
3
+ minor: number;
4
+ patch: number;
5
+ prerelease: string | undefined;
6
+ };
7
+ //# sourceMappingURL=reactNativeVersion.d.ts.map
@@ -0,0 +1,10 @@
1
+ // src/reactNativeVersion.ts
2
+ const reactNativeVersion = {
3
+ major: 0,
4
+ minor: 88,
5
+ patch: 1,
6
+ prerelease: void 0
7
+ };
8
+ export { reactNativeVersion };
9
+
10
+ //# sourceMappingURL=reactNativeVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactNativeVersion.js","names":[],"sources":["../src/reactNativeVersion.ts"],"sourcesContent":["export type ReactNativeVersion = {\n major: number\n minor: number\n patch: number\n prerelease: string | undefined\n}\n\n// The react-native release whose API this package matches. Update it with the pin.\nexport const reactNativeVersion: ReactNativeVersion = {\n major: 0,\n minor: 88,\n patch: 1,\n prerelease: undefined,\n}\n"],"mappings":";AAQA,MAAa,qBAAyC;CACpD,OAAO;CACP,OAAO;CACP,OAAO;CACP,YAAY,KAAA;AACd"}
@@ -0,0 +1,66 @@
1
+ // src/render/domProps.ts
2
+ const liveRegionToAriaLive = {
3
+ none: "off",
4
+ polite: "polite",
5
+ assertive: "assertive"
6
+ };
7
+ const nativeHandler = /^on(Press|Layout|TextLayout|Accessibility|Magic|Responder|Refresh|.*ShouldSet)/;
8
+ const isNativeHandler = (name) => nativeHandler.test(name);
9
+ const passThrough = /* @__PURE__ */ new Set([
10
+ "lang",
11
+ "dir",
12
+ "target",
13
+ "rel",
14
+ "download"
15
+ ]);
16
+ const domEventHandlers = /* @__PURE__ */ new Set([
17
+ ..."abort animationEnd animationIteration animationStart auxClick beforeInput beforeToggle blur cancel canPlay canPlayThrough change click close compositionEnd compositionStart compositionUpdate contextMenu copy cut doubleClick drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error focus fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize scroll scrollEnd seeked seeking select stalled submit suspend timeUpdate toggle touchCancel touchEnd touchMove touchStart transitionCancel transitionEnd transitionRun transitionStart volumeChange waiting wheel".split(" ").flatMap((event) => {
18
+ const name = `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;
19
+ return [name, `${name}Capture`];
20
+ }),
21
+ "onMouseEnter",
22
+ "onMouseLeave",
23
+ "onPointerEnter",
24
+ "onPointerLeave"
25
+ ]);
26
+ const toDOMProps = (props) => {
27
+ const out = {};
28
+ for (const name in props) {
29
+ const value = props[name];
30
+ if (value === void 0) continue;
31
+ if (name.startsWith("aria-") || name.startsWith("data-") || passThrough.has(name) || domEventHandlers.has(name)) out[name] = value;
32
+ }
33
+ const { accessibilityLabel, accessibilityLabelledBy, accessibilityHint, accessibilityState, accessibilityValue, accessibilityLiveRegion, accessibilityElementsHidden, accessibilityViewIsModal, importantForAccessibility, id, nativeID, testID, tabIndex, focusable, href } = props;
34
+ if (accessibilityLabel !== void 0) out["aria-label"] ??= accessibilityLabel;
35
+ if (accessibilityLabelledBy !== void 0) out["aria-labelledby"] ??= Array.isArray(accessibilityLabelledBy) ? accessibilityLabelledBy.join(" ") : accessibilityLabelledBy;
36
+ if (accessibilityHint !== void 0) out["aria-description"] ??= accessibilityHint;
37
+ if (accessibilityLiveRegion !== void 0) out["aria-live"] ??= liveRegionToAriaLive[accessibilityLiveRegion];
38
+ if (accessibilityViewIsModal !== void 0) out["aria-modal"] ??= accessibilityViewIsModal;
39
+ if (accessibilityElementsHidden === true || importantForAccessibility === "no-hide-descendants") out["aria-hidden"] ??= true;
40
+ if (accessibilityState !== void 0) {
41
+ const { busy, checked, disabled, expanded, selected } = accessibilityState;
42
+ if (busy !== void 0) out["aria-busy"] ??= busy;
43
+ if (checked !== void 0) out["aria-checked"] ??= checked;
44
+ if (disabled !== void 0) out["aria-disabled"] ??= disabled;
45
+ if (expanded !== void 0) out["aria-expanded"] ??= expanded;
46
+ if (selected !== void 0) out["aria-selected"] ??= selected;
47
+ }
48
+ if (accessibilityValue !== void 0) {
49
+ const { max, min, now, text } = accessibilityValue;
50
+ if (max !== void 0) out["aria-valuemax"] ??= max;
51
+ if (min !== void 0) out["aria-valuemin"] ??= min;
52
+ if (now !== void 0) out["aria-valuenow"] ??= now;
53
+ if (text !== void 0) out["aria-valuetext"] ??= text;
54
+ }
55
+ const domId = id ?? nativeID;
56
+ if (domId !== void 0) out["id"] = domId;
57
+ if (testID !== void 0) out["data-testid"] = testID;
58
+ if (href !== void 0) out["href"] = href;
59
+ if (tabIndex !== void 0) out["tabIndex"] = tabIndex;
60
+ else if (focusable === true) out["tabIndex"] = 0;
61
+ else if (focusable === false) out["tabIndex"] = -1;
62
+ return out;
63
+ };
64
+ export { domEventHandlers, isNativeHandler, toDOMProps };
65
+
66
+ //# sourceMappingURL=domProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domProps.js","names":[],"sources":["../../src/render/domProps.ts"],"sourcesContent":["import type { AccessibilityProps } from '../components/View/types'\n\nexport type DOMProps = Record<string, unknown>\n\ntype Input = AccessibilityProps & Record<string, unknown>\n\nconst liveRegionToAriaLive: Record<string, string> = {\n none: 'off',\n polite: 'polite',\n assertive: 'assertive',\n}\n\n// React Native handlers that are not DOM events. A component maps them itself.\nconst nativeHandler =\n /^on(Press|Layout|TextLayout|Accessibility|Magic|Responder|Refresh|.*ShouldSet)/\n\nexport const isNativeHandler = (name: string): boolean => nativeHandler.test(name)\n\nconst passThrough = new Set(['lang', 'dir', 'target', 'rel', 'download'])\n\n// The events that React DOM 19 registers. Each has a handler prop and its `Capture` form. A\n// library can spread its own callback, such as `onValueChange`, onto a View: React Native and\n// react-native-web drop it, and React DOM logs an error for an `on*` prop that it doesn't know.\nconst reactDOMEvents =\n 'abort animationEnd animationIteration animationStart auxClick beforeInput beforeToggle blur ' +\n 'cancel canPlay canPlayThrough change click close compositionEnd compositionStart ' +\n 'compositionUpdate contextMenu copy cut doubleClick drag dragEnd dragEnter dragExit dragLeave ' +\n 'dragOver dragStart drop durationChange emptied encrypted ended error focus fullscreenChange ' +\n 'fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData ' +\n 'loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp ' +\n 'paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver ' +\n 'pointerUp progress rateChange reset resize scroll scrollEnd seeked seeking select stalled ' +\n 'submit suspend timeUpdate toggle touchCancel touchEnd touchMove touchStart transitionCancel ' +\n 'transitionEnd transitionRun transitionStart volumeChange waiting wheel'\n\nexport const domEventHandlers: ReadonlySet<string> = new Set([\n ...reactDOMEvents.split(' ').flatMap((event) => {\n const name = `on${event.charAt(0).toUpperCase()}${event.slice(1)}`\n return [name, `${name}Capture`]\n }),\n // These four have no capture phase.\n 'onMouseEnter',\n 'onMouseLeave',\n 'onPointerEnter',\n 'onPointerLeave',\n])\n\n// Maps React Native props to DOM attributes. Unknown props are dropped, so they never\n// reach the element. `aria-*` and `data-*` props, and the event handlers of React DOM, pass\n// through as they are.\nexport const toDOMProps = (props: Input): DOMProps => {\n const out: DOMProps = {}\n\n for (const name in props) {\n const value = props[name]\n if (value === undefined) continue\n if (\n name.startsWith('aria-') ||\n name.startsWith('data-') ||\n passThrough.has(name) ||\n domEventHandlers.has(name)\n ) {\n out[name] = value\n }\n }\n\n const {\n accessibilityLabel,\n accessibilityLabelledBy,\n accessibilityHint,\n accessibilityState,\n accessibilityValue,\n accessibilityLiveRegion,\n accessibilityElementsHidden,\n accessibilityViewIsModal,\n importantForAccessibility,\n id,\n nativeID,\n testID,\n tabIndex,\n focusable,\n href,\n } = props\n\n if (accessibilityLabel !== undefined) out['aria-label'] ??= accessibilityLabel\n if (accessibilityLabelledBy !== undefined) {\n out['aria-labelledby'] ??= Array.isArray(accessibilityLabelledBy)\n ? accessibilityLabelledBy.join(' ')\n : accessibilityLabelledBy\n }\n if (accessibilityHint !== undefined) out['aria-description'] ??= accessibilityHint\n if (accessibilityLiveRegion !== undefined) {\n out['aria-live'] ??= liveRegionToAriaLive[accessibilityLiveRegion]\n }\n if (accessibilityViewIsModal !== undefined) out['aria-modal'] ??= accessibilityViewIsModal\n if (accessibilityElementsHidden === true || importantForAccessibility === 'no-hide-descendants') {\n out['aria-hidden'] ??= true\n }\n\n if (accessibilityState !== undefined) {\n const { busy, checked, disabled, expanded, selected } = accessibilityState\n if (busy !== undefined) out['aria-busy'] ??= busy\n if (checked !== undefined) out['aria-checked'] ??= checked\n if (disabled !== undefined) out['aria-disabled'] ??= disabled\n if (expanded !== undefined) out['aria-expanded'] ??= expanded\n if (selected !== undefined) out['aria-selected'] ??= selected\n }\n\n if (accessibilityValue !== undefined) {\n const { max, min, now, text } = accessibilityValue\n if (max !== undefined) out['aria-valuemax'] ??= max\n if (min !== undefined) out['aria-valuemin'] ??= min\n if (now !== undefined) out['aria-valuenow'] ??= now\n if (text !== undefined) out['aria-valuetext'] ??= text\n }\n\n const domId = id ?? nativeID\n if (domId !== undefined) out['id'] = domId\n if (testID !== undefined) out['data-testid'] = testID\n if (href !== undefined) out['href'] = href\n\n if (tabIndex !== undefined) out['tabIndex'] = tabIndex\n else if (focusable === true) out['tabIndex'] = 0\n else if (focusable === false) out['tabIndex'] = -1\n\n return out\n}\n"],"mappings":";AAMA,MAAM,uBAA+C;CACnD,MAAM;CACN,QAAQ;CACR,WAAW;AACb;AAGA,MAAM,gBACJ;AAEF,MAAa,mBAAmB,SAA0B,cAAc,KAAK,IAAI;AAEjF,MAAM,8BAAc,IAAI,IAAI;CAAC;CAAQ;CAAO;CAAU;CAAO;AAAU,CAAC;AAiBxE,MAAa,mCAAwC,IAAI,IAAI;CAC3D,GAAG,62BAAe,MAAM,GAAG,CAAC,CAAC,SAAS,UAAU;EAC9C,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;EAC/D,OAAO,CAAC,MAAM,GAAG,KAAK,QAAQ;CAChC,CAAC;CAED;CACA;CACA;CACA;AACF,CAAC;AAKD,MAAa,cAAc,UAA2B;CACpD,MAAM,MAAgB,CAAC;CAEvB,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,QAAQ,MAAM;EACpB,IAAI,UAAU,KAAA,GAAW;EACzB,IACE,KAAK,WAAW,OAAO,KACvB,KAAK,WAAW,OAAO,KACvB,YAAY,IAAI,IAAI,KACpB,iBAAiB,IAAI,IAAI,GAEzB,IAAI,QAAQ;CAEhB;CAEA,MAAM,EACJ,oBACA,yBACA,mBACA,oBACA,oBACA,yBACA,6BACA,0BACA,2BACA,IACA,UACA,QACA,UACA,WACA,SACE;CAEJ,IAAI,uBAAuB,KAAA,GAAW,IAAI,kBAAkB;CAC5D,IAAI,4BAA4B,KAAA,GAC9B,IAAI,uBAAuB,MAAM,QAAQ,uBAAuB,IAC5D,wBAAwB,KAAK,GAAG,IAChC;CAEN,IAAI,sBAAsB,KAAA,GAAW,IAAI,wBAAwB;CACjE,IAAI,4BAA4B,KAAA,GAC9B,IAAI,iBAAiB,qBAAqB;CAE5C,IAAI,6BAA6B,KAAA,GAAW,IAAI,kBAAkB;CAClE,IAAI,gCAAgC,QAAQ,8BAA8B,uBACxE,IAAI,mBAAmB;CAGzB,IAAI,uBAAuB,KAAA,GAAW;EACpC,MAAM,EAAE,MAAM,SAAS,UAAU,UAAU,aAAa;EACxD,IAAI,SAAS,KAAA,GAAW,IAAI,iBAAiB;EAC7C,IAAI,YAAY,KAAA,GAAW,IAAI,oBAAoB;EACnD,IAAI,aAAa,KAAA,GAAW,IAAI,qBAAqB;EACrD,IAAI,aAAa,KAAA,GAAW,IAAI,qBAAqB;EACrD,IAAI,aAAa,KAAA,GAAW,IAAI,qBAAqB;CACvD;CAEA,IAAI,uBAAuB,KAAA,GAAW;EACpC,MAAM,EAAE,KAAK,KAAK,KAAK,SAAS;EAChC,IAAI,QAAQ,KAAA,GAAW,IAAI,qBAAqB;EAChD,IAAI,QAAQ,KAAA,GAAW,IAAI,qBAAqB;EAChD,IAAI,QAAQ,KAAA,GAAW,IAAI,qBAAqB;EAChD,IAAI,SAAS,KAAA,GAAW,IAAI,sBAAsB;CACpD;CAEA,MAAM,QAAQ,MAAM;CACpB,IAAI,UAAU,KAAA,GAAW,IAAI,QAAQ;CACrC,IAAI,WAAW,KAAA,GAAW,IAAI,iBAAiB;CAC/C,IAAI,SAAS,KAAA,GAAW,IAAI,UAAU;CAEtC,IAAI,aAAa,KAAA,GAAW,IAAI,cAAc;MACzC,IAAI,cAAc,MAAM,IAAI,cAAc;MAC1C,IAAI,cAAc,OAAO,IAAI,cAAc;CAEhD,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ // src/render/hitSlop.ts
2
+ const hitSlopClass = (registry, hitSlop) => {
3
+ if (hitSlop === void 0) return void 0;
4
+ const { top = 0, right = 0, bottom = 0, left = 0 } = typeof hitSlop === "number" ? {
5
+ top: hitSlop,
6
+ right: hitSlop,
7
+ bottom: hitSlop,
8
+ left: hitSlop
9
+ } : hitSlop;
10
+ if (top === 0 && right === 0 && bottom === 0 && left === 0) return void 0;
11
+ const name = `rn-hs-${[
12
+ top,
13
+ right,
14
+ bottom,
15
+ left
16
+ ].map((n) => String(n).replace(/[^0-9]/g, "_")).join("-")}`;
17
+ return registry.staticClass(name, [`.${name}::before{content:"";position:absolute;top:${-top}px;right:${-right}px;bottom:${-bottom}px;left:${-left}px;z-index:-1}`]);
18
+ };
19
+ export { hitSlopClass };
20
+
21
+ //# sourceMappingURL=hitSlop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hitSlop.js","names":[],"sources":["../../src/render/hitSlop.ts"],"sourcesContent":["import type { RectOrSize } from '../events/press/types'\nimport type { StyleRegistry } from '../style/registry'\n\n// The browser hit-tests a pseudo-element as part of its element, so an invisible ::before\n// box around the element grows its hit area. z-index -1 keeps it under the children, so it\n// never takes a press from them.\nexport const hitSlopClass = (\n registry: StyleRegistry,\n hitSlop: RectOrSize | undefined,\n): string | undefined => {\n if (hitSlop === undefined) return undefined\n const rect =\n typeof hitSlop === 'number'\n ? { top: hitSlop, right: hitSlop, bottom: hitSlop, left: hitSlop }\n : hitSlop\n const { top = 0, right = 0, bottom = 0, left = 0 } = rect\n if (top === 0 && right === 0 && bottom === 0 && left === 0) return undefined\n\n const name = `rn-hs-${[top, right, bottom, left].map((n) => String(n).replace(/[^0-9]/g, '_')).join('-')}`\n return registry.staticClass(name, [\n `.${name}::before{content:\"\";position:absolute;` +\n `top:${-top}px;right:${-right}px;bottom:${-bottom}px;left:${-left}px;z-index:-1}`,\n ])\n}\n"],"mappings":";AAMA,MAAa,gBACX,UACA,YACuB;CACvB,IAAI,YAAY,KAAA,GAAW,OAAO,KAAA;CAKlC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,MAH7C,OAAO,YAAY,WACf;EAAE,KAAK;EAAS,OAAO;EAAS,QAAQ;EAAS,MAAM;CAAQ,IAC/D;CAEN,IAAI,QAAQ,KAAK,UAAU,KAAK,WAAW,KAAK,SAAS,GAAG,OAAO,KAAA;CAEnE,MAAM,OAAO,SAAS;EAAC;EAAK;EAAO;EAAQ;CAAI,CAAC,CAAC,KAAK,MAAM,OAAO,CAAC,CAAC,CAAC,QAAQ,WAAW,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;CACvG,OAAO,SAAS,YAAY,MAAM,CAChC,IAAI,KAAK,4CACA,CAAC,IAAI,WAAW,CAAC,MAAM,YAAY,CAAC,OAAO,UAAU,CAAC,KAAK,eACtE,CAAC;AACH"}
@@ -0,0 +1,44 @@
1
+ import { flattenStyle } from "../style/compile.js";
2
+ import { resolveStyle } from "../style/resolveStyle.js";
3
+ import { warnOnce } from "../utils/warn.js";
4
+ // src/render/hostMethods.ts
5
+ const applyNativeProps = (element, nativeProps) => {
6
+ const inline = element.style;
7
+ for (const [name, value] of Object.entries(nativeProps)) {
8
+ if (name !== "style") {
9
+ warnOnce(`set-native-props-${name}`, `setNativeProps: only \`style\` works on the web. \`${name}\` has no effect.`);
10
+ continue;
11
+ }
12
+ const flat = flattenStyle(value);
13
+ if (flat !== void 0) Object.assign(inline, resolveStyle(flat));
14
+ }
15
+ };
16
+ const hostMethods = (element) => ({
17
+ measure: (callback) => {
18
+ const { left, top, width, height } = element.getBoundingClientRect();
19
+ const parent = element.parentElement?.getBoundingClientRect();
20
+ callback(left - (parent?.left ?? 0), top - (parent?.top ?? 0), width, height, left, top);
21
+ },
22
+ measureInWindow: (callback) => {
23
+ const { left, top, width, height } = element.getBoundingClientRect();
24
+ callback(left, top, width, height);
25
+ },
26
+ measureLayout: (relativeToNativeNode, onSuccess, onFail) => {
27
+ if (!(relativeToNativeNode instanceof Element) || !element.isConnected || !relativeToNativeNode.contains(element)) {
28
+ onFail?.();
29
+ return;
30
+ }
31
+ const { left, top, width, height } = element.getBoundingClientRect();
32
+ const ancestor = relativeToNativeNode.getBoundingClientRect();
33
+ onSuccess(left - ancestor.left, top - ancestor.top, width, height);
34
+ },
35
+ setNativeProps: (nativeProps) => applyNativeProps(element, nativeProps)
36
+ });
37
+ const withHostMethods = (element) => {
38
+ const instance = element;
39
+ if (instance.measureInWindow === void 0) Object.assign(instance, hostMethods(element));
40
+ return instance;
41
+ };
42
+ export { applyNativeProps, withHostMethods };
43
+
44
+ //# sourceMappingURL=hostMethods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostMethods.js","names":[],"sources":["../../src/render/hostMethods.ts"],"sourcesContent":["import type { HostInstance, HostMethods } from '../components/View/types'\nimport { flattenStyle } from '../style/compile'\nimport { resolveStyle } from '../style/resolveStyle'\nimport type { FlatStyle, StyleProp } from '../style/types'\nimport { warnOnce } from '../utils/warn'\n\n// Writes the `style` of `setNativeProps` as an inline style, so it stays until the next call, as\n// on native. Any other prop has no direct path to the element.\nexport const applyNativeProps = (element: HTMLElement, nativeProps: object): void => {\n const inline = element.style as unknown as Record<string, string>\n for (const [name, value] of Object.entries(nativeProps)) {\n if (name !== 'style') {\n warnOnce(\n `set-native-props-${name}`,\n `setNativeProps: only \\`style\\` works on the web. \\`${name}\\` has no effect.`,\n )\n continue\n }\n const flat = flattenStyle(value as StyleProp<FlatStyle>)\n if (flat !== undefined) Object.assign(inline, resolveStyle(flat))\n }\n}\n\nconst hostMethods = (element: HTMLElement): HostMethods => ({\n measure: (callback) => {\n const { left, top, width, height } = element.getBoundingClientRect()\n const parent = element.parentElement?.getBoundingClientRect()\n callback(left - (parent?.left ?? 0), top - (parent?.top ?? 0), width, height, left, top)\n },\n measureInWindow: (callback) => {\n const { left, top, width, height } = element.getBoundingClientRect()\n callback(left, top, width, height)\n },\n measureLayout: (relativeToNativeNode, onSuccess, onFail) => {\n // As on native, the other node must be an ancestor that is on screen.\n if (\n !(relativeToNativeNode instanceof Element) ||\n !element.isConnected ||\n !relativeToNativeNode.contains(element)\n ) {\n onFail?.()\n return\n }\n const { left, top, width, height } = element.getBoundingClientRect()\n const ancestor = relativeToNativeNode.getBoundingClientRect()\n onSuccess(left - ancestor.left, top - ancestor.top, width, height)\n },\n setNativeProps: (nativeProps) => applyNativeProps(element, nativeProps),\n})\n\n// Adds the methods of a React Native host instance to the element, once.\nexport const withHostMethods = <T extends HTMLElement>(element: T): T & HostMethods => {\n const instance = element as T & Partial<HostInstance>\n if (instance.measureInWindow === undefined) Object.assign(instance, hostMethods(element))\n return instance as T & HostMethods\n}\n"],"mappings":";;;;AAQA,MAAa,oBAAoB,SAAsB,gBAA8B;CACnF,MAAM,SAAS,QAAQ;CACvB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,WAAW,GAAG;EACvD,IAAI,SAAS,SAAS;GACpB,SACE,oBAAoB,QACpB,sDAAsD,KAAK,kBAC7D;GACA;EACF;EACA,MAAM,OAAO,aAAa,KAA6B;EACvD,IAAI,SAAS,KAAA,GAAW,OAAO,OAAO,QAAQ,aAAa,IAAI,CAAC;CAClE;AACF;AAEA,MAAM,eAAe,aAAuC;CAC1D,UAAU,aAAa;EACrB,MAAM,EAAE,MAAM,KAAK,OAAO,WAAW,QAAQ,sBAAsB;EACnE,MAAM,SAAS,QAAQ,eAAe,sBAAsB;EAC5D,SAAS,QAAQ,QAAQ,QAAQ,IAAI,OAAO,QAAQ,OAAO,IAAI,OAAO,QAAQ,MAAM,GAAG;CACzF;CACA,kBAAkB,aAAa;EAC7B,MAAM,EAAE,MAAM,KAAK,OAAO,WAAW,QAAQ,sBAAsB;EACnE,SAAS,MAAM,KAAK,OAAO,MAAM;CACnC;CACA,gBAAgB,sBAAsB,WAAW,WAAW;EAE1D,IACE,EAAE,gCAAgC,YAClC,CAAC,QAAQ,eACT,CAAC,qBAAqB,SAAS,OAAO,GACtC;GACA,SAAS;GACT;EACF;EACA,MAAM,EAAE,MAAM,KAAK,OAAO,WAAW,QAAQ,sBAAsB;EACnE,MAAM,WAAW,qBAAqB,sBAAsB;EAC5D,UAAU,OAAO,SAAS,MAAM,MAAM,SAAS,KAAK,OAAO,MAAM;CACnE;CACA,iBAAiB,gBAAgB,iBAAiB,SAAS,WAAW;AACxE;AAGA,MAAa,mBAA0C,YAAgC;CACrF,MAAM,WAAW;CACjB,IAAI,SAAS,oBAAoB,KAAA,GAAW,OAAO,OAAO,UAAU,YAAY,OAAO,CAAC;CACxF,OAAO;AACT"}
@@ -0,0 +1,64 @@
1
+ // src/render/resolveTag.ts
2
+ const legacyRoleToRole = {
3
+ header: "heading",
4
+ image: "img",
5
+ imagebutton: "button",
6
+ summary: "region",
7
+ text: "none",
8
+ adjustable: "slider",
9
+ search: "searchbox",
10
+ keyboardkey: "none"
11
+ };
12
+ const roleToTag = {
13
+ article: "article",
14
+ banner: "header",
15
+ button: "button",
16
+ complementary: "aside",
17
+ contentinfo: "footer",
18
+ figure: "figure",
19
+ form: "form",
20
+ list: "ul",
21
+ listitem: "li",
22
+ main: "main",
23
+ navigation: "nav",
24
+ separator: "hr"
25
+ };
26
+ const headingLevel = (level) => level !== void 0 && Number.isInteger(level) && level >= 1 && level <= 6 ? level : 2;
27
+ const voidTags = /* @__PURE__ */ new Set(["hr"]);
28
+ const resolveTag = (props, defaultTag, hasChildren = false) => {
29
+ const role = props.role ?? mapLegacyRole(props.accessibilityRole);
30
+ const resolved = tagForRole(role, props, defaultTag);
31
+ return hasChildren && voidTags.has(resolved.tag) ? {
32
+ tag: defaultTag,
33
+ role
34
+ } : resolved;
35
+ };
36
+ const tagForRole = (role, props, defaultTag) => {
37
+ if (role === "heading") return {
38
+ tag: `h${headingLevel(props["aria-level"])}`,
39
+ role: void 0
40
+ };
41
+ if (role === "link") return props.href === void 0 ? {
42
+ tag: defaultTag,
43
+ role: "link"
44
+ } : {
45
+ tag: "a",
46
+ role: void 0
47
+ };
48
+ if (role === void 0) return {
49
+ tag: props.href === void 0 ? defaultTag : "a",
50
+ role: void 0
51
+ };
52
+ const tag = roleToTag[role];
53
+ return tag === void 0 ? {
54
+ tag: defaultTag,
55
+ role
56
+ } : {
57
+ tag,
58
+ role: void 0
59
+ };
60
+ };
61
+ const mapLegacyRole = (legacy) => legacy === void 0 ? void 0 : legacyRoleToRole[legacy] ?? legacy;
62
+ export { resolveTag };
63
+
64
+ //# sourceMappingURL=resolveTag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveTag.js","names":[],"sources":["../../src/render/resolveTag.ts"],"sourcesContent":["export type ResolveTagInput = {\n role?: string | undefined\n accessibilityRole?: string | undefined\n 'aria-level'?: number | undefined\n href?: string | undefined\n}\n\nexport type ResolvedTag = {\n tag: string\n role: string | undefined\n}\n\n// Legacy accessibilityRole values that have an ARIA role with another name.\nconst legacyRoleToRole: Record<string, string> = {\n header: 'heading',\n image: 'img',\n imagebutton: 'button',\n summary: 'region',\n text: 'none',\n adjustable: 'slider',\n search: 'searchbox',\n keyboardkey: 'none',\n}\n\n// Roles whose HTML element carries the role on its own.\n//\n// The table roles are not here. The HTML parser moves any child of a <table> that is not a\n// row group out of the table, and wraps a bare <tr> in a <tbody>. Server-rendered markup\n// then does not match the React tree, and the flex reset breaks table layout. A div with\n// the ARIA table roles has the same semantics.\nconst roleToTag: Record<string, string> = {\n article: 'article',\n banner: 'header',\n button: 'button',\n complementary: 'aside',\n contentinfo: 'footer',\n figure: 'figure',\n form: 'form',\n list: 'ul',\n listitem: 'li',\n main: 'main',\n navigation: 'nav',\n separator: 'hr',\n}\n\nconst headingLevel = (level: number | undefined): number =>\n level !== undefined && Number.isInteger(level) && level >= 1 && level <= 6 ? level : 2\n\n// Elements that take no children. React throws when one gets children.\nconst voidTags = new Set(['hr'])\n\n// `hasChildren` matches React's check for a void element: children that are not null.\nexport const resolveTag = (\n props: ResolveTagInput,\n defaultTag: string,\n hasChildren = false,\n): ResolvedTag => {\n const role = props.role ?? mapLegacyRole(props.accessibilityRole)\n const resolved = tagForRole(role, props, defaultTag)\n return hasChildren && voidTags.has(resolved.tag) ? { tag: defaultTag, role } : resolved\n}\n\nconst tagForRole = (\n role: string | undefined,\n props: ResolveTagInput,\n defaultTag: string,\n): ResolvedTag => {\n if (role === 'heading') {\n return { tag: `h${headingLevel(props['aria-level'])}`, role: undefined }\n }\n\n if (role === 'link') {\n return props.href === undefined\n ? { tag: defaultTag, role: 'link' }\n : { tag: 'a', role: undefined }\n }\n\n if (role === undefined) {\n return { tag: props.href === undefined ? defaultTag : 'a', role: undefined }\n }\n\n const tag = roleToTag[role]\n return tag === undefined ? { tag: defaultTag, role } : { tag, role: undefined }\n}\n\nconst mapLegacyRole = (legacy: string | undefined): string | undefined =>\n legacy === undefined ? undefined : (legacyRoleToRole[legacy] ?? legacy)\n"],"mappings":";AAaA,MAAM,mBAA2C;CAC/C,QAAQ;CACR,OAAO;CACP,aAAa;CACb,SAAS;CACT,MAAM;CACN,YAAY;CACZ,QAAQ;CACR,aAAa;AACf;AAQA,MAAM,YAAoC;CACxC,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,aAAa;CACb,QAAQ;CACR,MAAM;CACN,MAAM;CACN,UAAU;CACV,MAAM;CACN,YAAY;CACZ,WAAW;AACb;AAEA,MAAM,gBAAgB,UACpB,UAAU,KAAA,KAAa,OAAO,UAAU,KAAK,KAAK,SAAS,KAAK,SAAS,IAAI,QAAQ;AAGvF,MAAM,2BAAW,IAAI,IAAI,CAAC,IAAI,CAAC;AAG/B,MAAa,cACX,OACA,YACA,cAAc,UACE;CAChB,MAAM,OAAO,MAAM,QAAQ,cAAc,MAAM,iBAAiB;CAChE,MAAM,WAAW,WAAW,MAAM,OAAO,UAAU;CACnD,OAAO,eAAe,SAAS,IAAI,SAAS,GAAG,IAAI;EAAE,KAAK;EAAY;CAAK,IAAI;AACjF;AAEA,MAAM,cACJ,MACA,OACA,eACgB;CAChB,IAAI,SAAS,WACX,OAAO;EAAE,KAAK,IAAI,aAAa,MAAM,aAAa;EAAK,MAAM,KAAA;CAAU;CAGzE,IAAI,SAAS,QACX,OAAO,MAAM,SAAS,KAAA,IAClB;EAAE,KAAK;EAAY,MAAM;CAAO,IAChC;EAAE,KAAK;EAAK,MAAM,KAAA;CAAU;CAGlC,IAAI,SAAS,KAAA,GACX,OAAO;EAAE,KAAK,MAAM,SAAS,KAAA,IAAY,aAAa;EAAK,MAAM,KAAA;CAAU;CAG7E,MAAM,MAAM,UAAU;CACtB,OAAO,QAAQ,KAAA,IAAY;EAAE,KAAK;EAAY;CAAK,IAAI;EAAE;EAAK,MAAM,KAAA;CAAU;AAChF;AAEA,MAAM,iBAAiB,WACrB,WAAW,KAAA,IAAY,KAAA,IAAa,iBAAiB,WAAW"}
@@ -0,0 +1,25 @@
1
+ import { useEffect, useRef } from "react";
2
+ // src/render/useElementLayout.ts
3
+ const measure = (element) => ({ nativeEvent: { layout: {
4
+ x: element.offsetLeft,
5
+ y: element.offsetTop,
6
+ width: element.offsetWidth,
7
+ height: element.offsetHeight
8
+ } } });
9
+ const useElementLayout = (ref, onLayout) => {
10
+ const latest = useRef(onLayout);
11
+ useEffect(() => {
12
+ latest.current = onLayout;
13
+ }, [onLayout]);
14
+ const enabled = onLayout !== void 0;
15
+ useEffect(() => {
16
+ const element = ref.current;
17
+ if (element === null || !enabled) return;
18
+ const observer = new ResizeObserver(() => latest.current?.(measure(element)));
19
+ observer.observe(element);
20
+ return () => observer.disconnect();
21
+ }, [ref, enabled]);
22
+ };
23
+ export { useElementLayout };
24
+
25
+ //# sourceMappingURL=useElementLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementLayout.js","names":[],"sources":["../../src/render/useElementLayout.ts"],"sourcesContent":["import { useEffect, useRef, type RefObject } from 'react'\n\nimport type { LayoutChangeEvent } from '../components/View/types'\n\nconst measure = (element: HTMLElement): LayoutChangeEvent => ({\n nativeEvent: {\n layout: {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight,\n },\n },\n})\n\n// Calls onLayout after mount and after each size change, as native does.\nexport const useElementLayout = (\n ref: RefObject<HTMLElement | null>,\n onLayout: ((event: LayoutChangeEvent) => void) | undefined,\n): void => {\n const latest = useRef(onLayout)\n useEffect(() => {\n latest.current = onLayout\n }, [onLayout])\n\n const enabled = onLayout !== undefined\n useEffect(() => {\n const element = ref.current\n if (element === null || !enabled) return\n\n const observer = new ResizeObserver(() => latest.current?.(measure(element)))\n observer.observe(element)\n return () => observer.disconnect()\n }, [ref, enabled])\n}\n"],"mappings":";;AAIA,MAAM,WAAW,aAA6C,EAC5D,aAAa,EACX,QAAQ;CACN,GAAG,QAAQ;CACX,GAAG,QAAQ;CACX,OAAO,QAAQ;CACf,QAAQ,QAAQ;AAClB,EACF,EACF;AAGA,MAAa,oBACX,KACA,aACS;CACT,MAAM,SAAS,OAAO,QAAQ;CAC9B,gBAAgB;EACd,OAAO,UAAU;CACnB,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,UAAU,aAAa,KAAA;CAC7B,gBAAgB;EACd,MAAM,UAAU,IAAI;EACpB,IAAI,YAAY,QAAQ,CAAC,SAAS;EAElC,MAAM,WAAW,IAAI,qBAAqB,OAAO,UAAU,QAAQ,OAAO,CAAC,CAAC;EAC5E,SAAS,QAAQ,OAAO;EACxB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,KAAK,OAAO,CAAC;AACnB"}
@@ -1,30 +1,5 @@
1
- import { t as CSSDeclarations } from "../types-BxTWbdj9.js";
1
+ import { StyleRegistry } from "../style/registry.js";
2
2
  import { ReactElement, ReactNode } from "react";
3
- type StyleSheets = {
4
- reset: CSSStyleSheet | null;
5
- shorthand: CSSStyleSheet | null;
6
- longhand: CSSStyleSheet | null;
7
- };
8
- export declare class StyleRegistry {
9
- private readonly classNames;
10
- private readonly adopted;
11
- private readonly resetRules;
12
- private readonly shorthandRules;
13
- private readonly longhandRules;
14
- private readonly sheets;
15
- constructor(sheets?: StyleSheets);
16
- classFor(property: string, value: string): string;
17
- classesFor(declarations: CSSDeclarations): string;
18
- staticClass(className: string, rules: ReadonlyArray<string>): string;
19
- resetClass(className: string, declarations: CSSDeclarations): string;
20
- cssText(): {
21
- reset: string;
22
- shorthand: string;
23
- longhand: string;
24
- };
25
- get ruleCount(): number;
26
- private adopt;
27
- }
28
3
  export declare const createStyleRegistry: () => StyleRegistry;
29
4
  export declare function StyleRegistryProvider(props: {
30
5
  registry: StyleRegistry;
@@ -32,5 +7,5 @@ export declare function StyleRegistryProvider(props: {
32
7
  }): ReactElement;
33
8
  export declare const renderStyleTags: (registry: StyleRegistry) => ReactElement;
34
9
  export declare const styleTagsHTML: (registry: StyleRegistry) => string;
35
- export {};
10
+ export { StyleRegistry };
36
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import { i as StyleRegistry, n as RESET_STYLE_ID, r as SHORTHAND_STYLE_ID, t as LONGHAND_STYLE_ID } from "../registry-Aa_Od5m0.js";
2
- import { t as StyleRegistryContext } from "../StyleRegistryContext-ROsMlY4O.js";
1
+ import { LONGHAND_STYLE_ID, RESET_STYLE_ID, SHORTHAND_STYLE_ID, StyleRegistry } from "../style/registry.js";
2
+ import { StyleRegistryContext } from "../style/StyleRegistryContext.js";
3
3
  import { Fragment, createElement } from "react";
4
4
  // src/server/index.ts
5
5
  const createStyleRegistry = () => new StyleRegistry();
@@ -1,8 +1,8 @@
1
- import { a as getStyleRegistry } from "./registry-Aa_Od5m0.js";
1
+ import { getStyleRegistry } from "./registry.js";
2
2
  import { createContext, useContext } from "react";
3
3
  // src/style/StyleRegistryContext.ts
4
4
  const StyleRegistryContext = createContext(null);
5
5
  const useStyleRegistry = () => useContext(StyleRegistryContext) ?? getStyleRegistry();
6
- export { useStyleRegistry as n, StyleRegistryContext as t };
6
+ export { StyleRegistryContext, useStyleRegistry };
7
7
 
8
- //# sourceMappingURL=StyleRegistryContext-ROsMlY4O.js.map
8
+ //# sourceMappingURL=StyleRegistryContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StyleRegistryContext.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,16 @@
1
+ import normalizeColor from "@react-native/normalize-colors";
2
+ // src/style/color.ts
3
+ const toCSSColor = (value) => {
4
+ if (typeof value !== "string" && typeof value !== "number") return void 0;
5
+ const packed = normalizeColor(value);
6
+ if (packed === null || packed === void 0) return void 0;
7
+ const r = packed >>> 24 & 255;
8
+ const g = packed >>> 16 & 255;
9
+ const b = packed >>> 8 & 255;
10
+ const a = (packed & 255) / 255;
11
+ return a === 1 ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${round(a)})`;
12
+ };
13
+ const round = (n) => Math.round(n * 1e3) / 1e3;
14
+ export { toCSSColor };
15
+
16
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","names":[],"sources":["../../src/style/color.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"],"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"}
@@ -0,0 +1,102 @@
1
+ import { getLeftAndRightSwap } from "./direction.js";
2
+ import { getStyleRegistry } from "./registry.js";
3
+ import { resolveStyle } from "./resolveStyle.js";
4
+ // src/style/compile.ts
5
+ const flattenStyle = (style) => {
6
+ if (style === null || style === void 0 || style === false || style === "") return void 0;
7
+ if (!Array.isArray(style)) return style;
8
+ let result;
9
+ for (const entry of style) {
10
+ const flat = flattenStyle(entry);
11
+ if (flat === void 0) continue;
12
+ result = result === void 0 ? { ...flat } : Object.assign(result, flat);
13
+ }
14
+ return result;
15
+ };
16
+ const boxPointerEventsClass = (value, registry) => {
17
+ 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}"]);
18
+ 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}"]);
19
+ };
20
+ const pointerEventsStyle = Object.freeze({
21
+ auto: Object.freeze({ pointerEvents: "auto" }),
22
+ none: Object.freeze({ pointerEvents: "none" }),
23
+ "box-none": Object.freeze({ pointerEvents: "box-none" }),
24
+ "box-only": Object.freeze({ pointerEvents: "box-only" })
25
+ });
26
+ const newNode = () => ({
27
+ classes: void 0,
28
+ frozen: void 0,
29
+ values: void 0
30
+ });
31
+ let caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
32
+ const MAX_VALUE_NODES = 1e4;
33
+ let valueNodes = 0;
34
+ const walk = (style, node) => {
35
+ if (style === null || style === void 0 || style === false || style === "") return node;
36
+ if (Array.isArray(style)) {
37
+ let current = node;
38
+ for (const entry of style) {
39
+ current = walk(entry, current);
40
+ if (current === void 0) return void 0;
41
+ }
42
+ return current;
43
+ }
44
+ if (typeof style !== "object") return void 0;
45
+ if (Object.isFrozen(style)) {
46
+ const frozen = node.frozen ??= /* @__PURE__ */ new WeakMap();
47
+ let next = frozen.get(style);
48
+ if (next === void 0) {
49
+ next = newNode();
50
+ frozen.set(style, next);
51
+ }
52
+ return next;
53
+ }
54
+ let current = node;
55
+ for (const name in style) {
56
+ if (!Object.hasOwn(style, name)) continue;
57
+ const value = style[name];
58
+ const type = typeof value;
59
+ if (type === "object" && value !== null || type === "function") return void 0;
60
+ const values = current.values ??= /* @__PURE__ */ new Map();
61
+ let byValue = values.get(name);
62
+ if (byValue === void 0) {
63
+ byValue = /* @__PURE__ */ new Map();
64
+ values.set(name, byValue);
65
+ }
66
+ let next = byValue.get(value);
67
+ if (next === void 0) {
68
+ next = newNode();
69
+ byValue.set(value, next);
70
+ valueNodes += 1;
71
+ }
72
+ current = next;
73
+ }
74
+ return current;
75
+ };
76
+ const compileFlat = (flat, registry) => flat === void 0 ? "" : joinClassNames(registry.classesFor(resolveStyle(flat)), boxPointerEventsClass(flat["pointerEvents"], registry));
77
+ const compileStyle = (style, registry = getStyleRegistry()) => {
78
+ if (style === null || style === void 0 || style === false || style === "") return "";
79
+ if (valueNodes > 1e4) {
80
+ caches = [/* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap()];
81
+ valueNodes = 0;
82
+ }
83
+ const cache = caches[getLeftAndRightSwap() ? 1 : 0];
84
+ let root = cache.get(registry);
85
+ if (root === void 0) {
86
+ root = newNode();
87
+ cache.set(registry, root);
88
+ }
89
+ const leaf = walk(style, root);
90
+ if (leaf === void 0) return compileFlat(flattenStyle(style), registry);
91
+ leaf.classes ??= compileFlat(flattenStyle(style), registry);
92
+ return leaf.classes;
93
+ };
94
+ /**
95
+ * The class of a component's default style, in the reset sheet. Any style of the app beats it,
96
+ * as any style beats the defaults of native layout.
97
+ */
98
+ const compileReset = (className, style, registry = getStyleRegistry()) => registry.hasClass(className) ? className : registry.resetClass(className, resolveStyle(style));
99
+ const joinClassNames = (...names) => names.filter((name) => typeof name === "string" && name !== "").join(" ");
100
+ export { MAX_VALUE_NODES, compileReset, compileStyle, flattenStyle, joinClassNames, pointerEventsStyle };
101
+
102
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.js","names":[],"sources":["../../src/style/compile.ts"],"sourcesContent":["import { getLeftAndRightSwap } from './direction'\nimport { getStyleRegistry, type StyleRegistry } from './registry'\nimport { resolveStyle } from './resolveStyle'\nimport type { FlatStyle, StyleProp } from './types'\n\nexport const flattenStyle = <T extends object>(style: StyleProp<T>): T | undefined => {\n if (style === null || style === undefined || style === false || style === '') return undefined\n if (!Array.isArray(style)) return style as T\n\n let result: object | undefined\n for (const entry of style as ReadonlyArray<StyleProp<T>>) {\n const flat = flattenStyle(entry)\n if (flat === undefined) continue\n result = result === undefined ? { ...flat } : Object.assign(result, flat)\n }\n return result as T | undefined\n}\n\n// A child selector can't be an atomic class. The child rule of `box-none` has no specificity, so\n// a child with its own `pointerEvents` keeps it. The children of `box-only` are never a target.\nconst boxPointerEventsClass = (value: unknown, registry: StyleRegistry): string | undefined => {\n if (value === 'box-none') {\n return registry.staticClass('rn-pe-box-none', [\n '.rn-pe-box-none{pointer-events:none}',\n ':where(.rn-pe-box-none)>*{pointer-events:auto}',\n ])\n }\n if (value === 'box-only') {\n return registry.staticClass('rn-pe-box-only', [\n '.rn-pe-box-only{pointer-events:auto}',\n '.rn-pe-box-only>*{pointer-events:none!important}',\n ])\n }\n return undefined\n}\n\n// The `pointerEvents` prop as a style. The prop wins over the same key of `style`.\nexport const pointerEventsStyle: Readonly<\n Record<'auto' | 'none' | 'box-none' | 'box-only', FlatStyle>\n> = Object.freeze({\n auto: Object.freeze({ pointerEvents: 'auto' }),\n none: Object.freeze({ pointerEvents: 'none' }),\n 'box-none': Object.freeze({ pointerEvents: 'box-none' }),\n 'box-only': Object.freeze({ pointerEvents: 'box-only' }),\n})\n\n// A path through the cache. A frozen object, as from StyleSheet.create, is one step by identity.\n// Any other object is one step for each of its declarations, by name and value: a component\n// that makes a new style object on each render still makes the same declarations. The classes\n// of a node are the classes of the steps on its path, flattened in that order.\ntype CacheNode = {\n classes: string | undefined\n frozen: WeakMap<FlatStyle, CacheNode> | undefined\n values: Map<string, Map<unknown, CacheNode>> | undefined\n}\n\nconst newNode = (): CacheNode => ({ classes: undefined, frozen: undefined, values: undefined })\n\n// One cache for each value of the left and right swap, because the classes of a style differ.\nlet caches: readonly [WeakMap<StyleRegistry, CacheNode>, WeakMap<StyleRegistry, CacheNode>] = [\n new WeakMap(),\n new WeakMap(),\n]\n\n// A value that changes on each render, such as an animated width, makes a new node each time.\n// Past this number of such nodes, the cache starts again.\nexport const MAX_VALUE_NODES = 10_000\nlet valueNodes = 0\n\n// The node at the end of the path of `style`, from `node`. Undefined for a style with no path:\n// a value that isn't a primitive, such as a transform, or an entry that isn't an object.\nconst walk = (style: StyleProp<object>, node: CacheNode): CacheNode | undefined => {\n if (style === null || style === undefined || style === false || style === '') return node\n if (Array.isArray(style)) {\n let current: CacheNode | undefined = node\n for (const entry of style as ReadonlyArray<StyleProp<object>>) {\n current = walk(entry, current)\n if (current === undefined) return undefined\n }\n return current\n }\n // `Object.isFrozen` is true for a number, and a WeakMap throws on it.\n if (typeof style !== 'object') return undefined\n\n if (Object.isFrozen(style)) {\n const frozen = (node.frozen ??= new WeakMap())\n let next = frozen.get(style as FlatStyle)\n if (next === undefined) {\n next = newNode()\n frozen.set(style as FlatStyle, next)\n }\n return next\n }\n\n let current = node\n for (const name in style) {\n if (!Object.hasOwn(style, name)) continue\n const value = (style as FlatStyle)[name]\n const type = typeof value\n if ((type === 'object' && value !== null) || type === 'function') return undefined\n const values = (current.values ??= new Map())\n let byValue = values.get(name)\n if (byValue === undefined) {\n byValue = new Map()\n values.set(name, byValue)\n }\n let next = byValue.get(value)\n if (next === undefined) {\n next = newNode()\n byValue.set(value, next)\n valueNodes += 1\n }\n current = next\n }\n return current\n}\n\nconst compileFlat = (flat: FlatStyle | undefined, registry: StyleRegistry): string =>\n flat === undefined\n ? ''\n : joinClassNames(\n registry.classesFor(resolveStyle(flat)),\n boxPointerEventsClass(flat['pointerEvents'], registry),\n )\n\nexport const compileStyle = (\n style: StyleProp<object>,\n registry: StyleRegistry = getStyleRegistry(),\n): string => {\n if (style === null || style === undefined || style === false || style === '') return ''\n if (valueNodes > MAX_VALUE_NODES) {\n caches = [new WeakMap(), new WeakMap()]\n valueNodes = 0\n }\n\n const cache = caches[getLeftAndRightSwap() ? 1 : 0]\n let root = cache.get(registry)\n if (root === undefined) {\n root = newNode()\n cache.set(registry, root)\n }\n const leaf = walk(style, root)\n if (leaf === undefined) {\n return compileFlat(flattenStyle(style) as FlatStyle | undefined, registry)\n }\n leaf.classes ??= compileFlat(flattenStyle(style) as FlatStyle | undefined, registry)\n return leaf.classes\n}\n\n/**\n * The class of a component's default style, in the reset sheet. Any style of the app beats it,\n * as any style beats the defaults of native layout.\n */\nexport const compileReset = (\n className: string,\n style: FlatStyle,\n registry: StyleRegistry = getStyleRegistry(),\n): string =>\n // Each render of each component calls this, so the style resolves only for a new class.\n registry.hasClass(className) ? className : registry.resetClass(className, resolveStyle(style))\n\n// Joins class names and skips the empty ones.\nexport const joinClassNames = (...names: ReadonlyArray<string | false | undefined>): string =>\n names.filter((name) => typeof name === 'string' && name !== '').join(' ')\n"],"mappings":";;;;AAKA,MAAa,gBAAkC,UAAuC;CACpF,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,SAAS,UAAU,IAAI,OAAO,KAAA;CACrF,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAElC,IAAI;CACJ,KAAK,MAAM,SAAS,OAAsC;EACxD,MAAM,OAAO,aAAa,KAAK;EAC/B,IAAI,SAAS,KAAA,GAAW;EACxB,SAAS,WAAW,KAAA,IAAY,EAAE,GAAG,KAAK,IAAI,OAAO,OAAO,QAAQ,IAAI;CAC1E;CACA,OAAO;AACT;AAIA,MAAM,yBAAyB,OAAgB,aAAgD;CAC7F,IAAI,UAAU,YACZ,OAAO,SAAS,YAAY,kBAAkB,CAC5C,wCACA,gDACF,CAAC;CAEH,IAAI,UAAU,YACZ,OAAO,SAAS,YAAY,kBAAkB,CAC5C,wCACA,kDACF,CAAC;AAGL;AAGA,MAAa,qBAET,OAAO,OAAO;CAChB,MAAM,OAAO,OAAO,EAAE,eAAe,OAAO,CAAC;CAC7C,MAAM,OAAO,OAAO,EAAE,eAAe,OAAO,CAAC;CAC7C,YAAY,OAAO,OAAO,EAAE,eAAe,WAAW,CAAC;CACvD,YAAY,OAAO,OAAO,EAAE,eAAe,WAAW,CAAC;AACzD,CAAC;AAYD,MAAM,iBAA4B;CAAE,SAAS,KAAA;CAAW,QAAQ,KAAA;CAAW,QAAQ,KAAA;AAAU;AAG7F,IAAI,SAA0F,iBAC5F,IAAI,QAAQ,mBACZ,IAAI,QAAQ,CACd;AAIA,MAAa,kBAAkB;AAC/B,IAAI,aAAa;AAIjB,MAAM,QAAQ,OAA0B,SAA2C;CACjF,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,SAAS,UAAU,IAAI,OAAO;CACrF,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,IAAI,UAAiC;EACrC,KAAK,MAAM,SAAS,OAA2C;GAC7D,UAAU,KAAK,OAAO,OAAO;GAC7B,IAAI,YAAY,KAAA,GAAW,OAAO,KAAA;EACpC;EACA,OAAO;CACT;CAEA,IAAI,OAAO,UAAU,UAAU,OAAO,KAAA;CAEtC,IAAI,OAAO,SAAS,KAAK,GAAG;EAC1B,MAAM,SAAU,KAAK,2BAAW,IAAI,QAAQ;EAC5C,IAAI,OAAO,OAAO,IAAI,KAAkB;EACxC,IAAI,SAAS,KAAA,GAAW;GACtB,OAAO,QAAQ;GACf,OAAO,IAAI,OAAoB,IAAI;EACrC;EACA,OAAO;CACT;CAEA,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,OAAO,OAAO,OAAO,IAAI,GAAG;EACjC,MAAM,QAAS,MAAoB;EACnC,MAAM,OAAO,OAAO;EACpB,IAAK,SAAS,YAAY,UAAU,QAAS,SAAS,YAAY,OAAO,KAAA;EACzE,MAAM,SAAU,QAAQ,2BAAW,IAAI,IAAI;EAC3C,IAAI,UAAU,OAAO,IAAI,IAAI;EAC7B,IAAI,YAAY,KAAA,GAAW;GACzB,0BAAU,IAAI,IAAI;GAClB,OAAO,IAAI,MAAM,OAAO;EAC1B;EACA,IAAI,OAAO,QAAQ,IAAI,KAAK;EAC5B,IAAI,SAAS,KAAA,GAAW;GACtB,OAAO,QAAQ;GACf,QAAQ,IAAI,OAAO,IAAI;GACvB,cAAc;EAChB;EACA,UAAU;CACZ;CACA,OAAO;AACT;AAEA,MAAM,eAAe,MAA6B,aAChD,SAAS,KAAA,IACL,KACA,eACE,SAAS,WAAW,aAAa,IAAI,CAAC,GACtC,sBAAsB,KAAK,kBAAkB,QAAQ,CACvD;AAEN,MAAa,gBACX,OACA,WAA0B,iBAAiB,MAChC;CACX,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,SAAS,UAAU,IAAI,OAAO;CACrF,IAAI,aAAA,KAA8B;EAChC,SAAS,iBAAC,IAAI,QAAQ,mBAAG,IAAI,QAAQ,CAAC;EACtC,aAAa;CACf;CAEA,MAAM,QAAQ,OAAO,oBAAoB,IAAI,IAAI;CACjD,IAAI,OAAO,MAAM,IAAI,QAAQ;CAC7B,IAAI,SAAS,KAAA,GAAW;EACtB,OAAO,QAAQ;EACf,MAAM,IAAI,UAAU,IAAI;CAC1B;CACA,MAAM,OAAO,KAAK,OAAO,IAAI;CAC7B,IAAI,SAAS,KAAA,GACX,OAAO,YAAY,aAAa,KAAK,GAA4B,QAAQ;CAE3E,KAAK,YAAY,YAAY,aAAa,KAAK,GAA4B,QAAQ;CACnF,OAAO,KAAK;AACd;;;;;AAMA,MAAa,gBACX,WACA,OACA,WAA0B,iBAAiB,MAG3C,SAAS,SAAS,SAAS,IAAI,YAAY,SAAS,WAAW,WAAW,aAAa,KAAK,CAAC;AAG/F,MAAa,kBAAkB,GAAG,UAChC,MAAM,QAAQ,SAAS,OAAO,SAAS,YAAY,SAAS,EAAE,CAAC,CAAC,KAAK,GAAG"}
@@ -0,0 +1,33 @@
1
+ // src/style/direction.ts
2
+ let swap = true;
3
+ const getLeftAndRightSwap = () => swap;
4
+ const setLeftAndRightSwap = (value) => {
5
+ swap = value;
6
+ };
7
+ /**
8
+ * The logical CSS property of each physical left or right style. Fabric moves these styles to
9
+ * the start and end edges in a right-to-left layout. A logical property does the same in the
10
+ * browser: it is the left edge in a left-to-right layout, and the right edge in a right-to-left
11
+ * one. The class names stay the same in both, so the server render needs no direction.
12
+ */
13
+ const swappedProperties = {
14
+ left: "insetInlineStart",
15
+ right: "insetInlineEnd",
16
+ marginLeft: "marginInlineStart",
17
+ marginRight: "marginInlineEnd",
18
+ paddingLeft: "paddingInlineStart",
19
+ paddingRight: "paddingInlineEnd",
20
+ borderLeftWidth: "borderInlineStartWidth",
21
+ borderRightWidth: "borderInlineEndWidth",
22
+ borderLeftColor: "borderInlineStartColor",
23
+ borderRightColor: "borderInlineEndColor",
24
+ borderLeftStyle: "borderInlineStartStyle",
25
+ borderRightStyle: "borderInlineEndStyle",
26
+ borderTopLeftRadius: "borderStartStartRadius",
27
+ borderTopRightRadius: "borderStartEndRadius",
28
+ borderBottomLeftRadius: "borderEndStartRadius",
29
+ borderBottomRightRadius: "borderEndEndRadius"
30
+ };
31
+ export { getLeftAndRightSwap, setLeftAndRightSwap, swappedProperties };
32
+
33
+ //# sourceMappingURL=direction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction.js","names":[],"sources":["../../src/style/direction.ts"],"sourcesContent":["// `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"],"mappings":";AACA,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"}
@@ -1,4 +1,4 @@
1
- import { n as FlatStyle, r as StyleProp, t as CSSDeclarations } from "../types-BxTWbdj9.js";
1
+ import { CSSDeclarations, FlatStyle, StyleProp } from "./types.js";
2
2
  /**
3
3
  * Compat export. Compiles a React Native style to inline DOM style values, keyed by the
4
4
  * camel-case names of `CSSStyleDeclaration`, with the same rules as the class names of `View`.
@@ -1,5 +1,8 @@
1
- import { c as toCSSTransform, l as toCSSTextShadow, o as resolveStyle, r as flattenStyle } from "../compile-CVUjQrR9.js";
2
- import { o as isShorthandProperty } from "../registry-Aa_Od5m0.js";
1
+ import { flattenStyle } from "./compile.js";
2
+ import { isShorthandProperty } from "./registry.js";
3
+ import { resolveStyle } from "./resolveStyle.js";
4
+ import { toCSSTextShadow } from "./shadow.js";
5
+ import { toCSSTransform } from "./transform.js";
3
6
  // src/style/index.ts
4
7
  /**
5
8
  * Compat export. Compiles a React Native style to inline DOM style values, keyed by the
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/style/index.ts"],"sourcesContent":["import { flattenStyle } from './compile'\nimport { isShorthandProperty } from './registry'\nimport { resolveStyle } from './resolveStyle'\nimport { toCSSTextShadow } from './shadow'\nimport { toCSSTransform } from './transform'\nimport type { CSSDeclarations, FlatStyle, StyleProp } from './types'\n\nexport type { CSSDeclarations } from './types'\n\n/**\n * Compat export. Compiles a React Native style to inline DOM style values, keyed by the\n * camel-case names of `CSSStyleDeclaration`, with the same rules as the class names of `View`.\n * Libraries such as Reanimated write the result into `element.style` on each frame.\n *\n * Shorthands come first, so a longhand written after them wins, as it does in the class names.\n */\nexport const createReactDOMStyle = (style: StyleProp<FlatStyle>): CSSDeclarations => {\n const flat = flattenStyle(style)\n if (flat === undefined) return {}\n\n const resolved = resolveStyle(flat)\n const shorthands: CSSDeclarations = {}\n const longhands: CSSDeclarations = {}\n for (const name in resolved) {\n const target = isShorthandProperty(name) ? shorthands : longhands\n target[name] = resolved[name] as string\n }\n return Object.assign(shorthands, longhands)\n}\n\n/**\n * Compat export. Turns a React Native `transform` array into a CSS `transform` value. An empty\n * string for a value that has no valid transform.\n */\nexport const createTransformValue = (transform: unknown): string => toCSSTransform(transform) ?? ''\n\n/**\n * Compat export. Turns the three React Native text shadow props into a CSS `text-shadow` value.\n * `undefined` for a color that it can't parse.\n */\nexport const createTextShadowValue = (style: {\n readonly textShadowColor?: unknown\n readonly textShadowOffset?: unknown\n readonly textShadowRadius?: unknown\n}): string | undefined => toCSSTextShadow(style)\n\n// react-native-web's `createReactDOMStyle` module has the function as its default export. The\n// Vite plugin points that module name here, so the same shape must be here too.\nexport default createReactDOMStyle\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,uBAAuB,UAAiD;CACnF,MAAM,OAAO,aAAa,KAAK;CAC/B,IAAI,SAAS,KAAA,GAAW,OAAO,CAAC;CAEhC,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAA8B,CAAC;CACrC,MAAM,YAA6B,CAAC;CACpC,KAAK,MAAM,QAAQ,UAAU;EAC3B,MAAM,SAAS,oBAAoB,IAAI,IAAI,aAAa;EACxD,OAAO,QAAQ,SAAS;CAC1B;CACA,OAAO,OAAO,OAAO,YAAY,SAAS;AAC5C;;;;;AAMA,MAAa,wBAAwB,cAA+B,eAAe,SAAS,KAAK;;;;;AAMjG,MAAa,yBAAyB,UAIZ,gBAAgB,KAAK"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/style/index.ts"],"sourcesContent":["import { flattenStyle } from './compile'\nimport { isShorthandProperty } from './registry'\nimport { resolveStyle } from './resolveStyle'\nimport { toCSSTextShadow } from './shadow'\nimport { toCSSTransform } from './transform'\nimport type { CSSDeclarations, FlatStyle, StyleProp } from './types'\n\nexport type { CSSDeclarations } from './types'\n\n/**\n * Compat export. Compiles a React Native style to inline DOM style values, keyed by the\n * camel-case names of `CSSStyleDeclaration`, with the same rules as the class names of `View`.\n * Libraries such as Reanimated write the result into `element.style` on each frame.\n *\n * Shorthands come first, so a longhand written after them wins, as it does in the class names.\n */\nexport const createReactDOMStyle = (style: StyleProp<FlatStyle>): CSSDeclarations => {\n const flat = flattenStyle(style)\n if (flat === undefined) return {}\n\n const resolved = resolveStyle(flat)\n const shorthands: CSSDeclarations = {}\n const longhands: CSSDeclarations = {}\n for (const name in resolved) {\n const target = isShorthandProperty(name) ? shorthands : longhands\n target[name] = resolved[name] as string\n }\n return Object.assign(shorthands, longhands)\n}\n\n/**\n * Compat export. Turns a React Native `transform` array into a CSS `transform` value. An empty\n * string for a value that has no valid transform.\n */\nexport const createTransformValue = (transform: unknown): string => toCSSTransform(transform) ?? ''\n\n/**\n * Compat export. Turns the three React Native text shadow props into a CSS `text-shadow` value.\n * `undefined` for a color that it can't parse.\n */\nexport const createTextShadowValue = (style: {\n readonly textShadowColor?: unknown\n readonly textShadowOffset?: unknown\n readonly textShadowRadius?: unknown\n}): string | undefined => toCSSTextShadow(style)\n\n// react-native-web's `createReactDOMStyle` module has the function as its default export. The\n// Vite plugin points that module name here, so the same shape must be here too.\nexport default createReactDOMStyle\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,uBAAuB,UAAiD;CACnF,MAAM,OAAO,aAAa,KAAK;CAC/B,IAAI,SAAS,KAAA,GAAW,OAAO,CAAC;CAEhC,MAAM,WAAW,aAAa,IAAI;CAClC,MAAM,aAA8B,CAAC;CACrC,MAAM,YAA6B,CAAC;CACpC,KAAK,MAAM,QAAQ,UAAU;EAC3B,MAAM,SAAS,oBAAoB,IAAI,IAAI,aAAa;EACxD,OAAO,QAAQ,SAAS;CAC1B;CACA,OAAO,OAAO,OAAO,YAAY,SAAS;AAC5C;;;;;AAMA,MAAa,wBAAwB,cAA+B,eAAe,SAAS,KAAK;;;;;AAMjG,MAAa,yBAAyB,UAIZ,gBAAgB,KAAK"}
@@ -0,0 +1,28 @@
1
+ import { CSSDeclarations } from "./types.js";
2
+ export type StyleSheets = {
3
+ reset: CSSStyleSheet | null;
4
+ shorthand: CSSStyleSheet | null;
5
+ longhand: CSSStyleSheet | null;
6
+ };
7
+ export declare class StyleRegistry {
8
+ private readonly classNames;
9
+ private readonly adopted;
10
+ private readonly resetRules;
11
+ private readonly shorthandRules;
12
+ private readonly longhandRules;
13
+ private readonly sheets;
14
+ constructor(sheets?: StyleSheets);
15
+ classFor(property: string, value: string): string;
16
+ classesFor(declarations: CSSDeclarations): string;
17
+ staticClass(className: string, rules: ReadonlyArray<string>): string;
18
+ hasClass(className: string): boolean;
19
+ resetClass(className: string, declarations: CSSDeclarations): string;
20
+ cssText(): {
21
+ reset: string;
22
+ shorthand: string;
23
+ longhand: string;
24
+ };
25
+ get ruleCount(): number;
26
+ private adopt;
27
+ }
28
+ //# sourceMappingURL=registry.d.ts.map