@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,61 @@
1
+ // src/bundler/worklets.ts
2
+ /**
3
+ * The source of a file that can hold a worklet: a `'worklet'` directive, an import of
4
+ * Reanimated or Worklets, or a call that the Worklets Babel plugin turns into a worklet.
5
+ */
6
+ const WORKLET_CODE = /worklet|reanimated|useAnimated|useDerivedValue|useFrameCallback|runOnUI|scheduleOnUI|with(?:Timing|Spring|Decay|Repeat)\b/;
7
+ const SCRIPT_FILE = /\.[cm]?[jt]sx?$/;
8
+ const missing = (name) => /* @__PURE__ */ new Error(`[@rootnative/web] The \`worklets\` option needs \`${name}\`, and the app doesn't have it. Install it, or remove the option.`);
9
+ const loadTools = async (root) => {
10
+ const { createRequire } = await import("node:module");
11
+ const { resolve } = await import("node:path");
12
+ const fromRoot = createRequire(resolve(root, "package.json"));
13
+ let plugin;
14
+ let workletsManifest;
15
+ try {
16
+ plugin = fromRoot.resolve("react-native-worklets/plugin");
17
+ workletsManifest = fromRoot.resolve("react-native-worklets/package.json");
18
+ } catch {
19
+ throw missing("react-native-worklets");
20
+ }
21
+ for (const load of [fromRoot, createRequire(workletsManifest)]) try {
22
+ return {
23
+ babel: load("@babel/core"),
24
+ plugin
25
+ };
26
+ } catch {}
27
+ throw missing("@babel/core");
28
+ };
29
+ /**
30
+ * Makes the transform that runs the Worklets Babel plugin on one file, as the Babel preset of a
31
+ * React Native app does. It finds the plugin and Babel from the root of the app, on the first
32
+ * file that needs them.
33
+ */
34
+ const createWorkletTransform = (root) => {
35
+ let tools;
36
+ return async (code, id) => {
37
+ const file = id.split("?")[0];
38
+ if (file.startsWith("\0") || !SCRIPT_FILE.test(file) || !WORKLET_CODE.test(code)) return null;
39
+ tools ??= loadTools(root);
40
+ const { babel, plugin } = await tools;
41
+ const syntax = [];
42
+ if (/\.[cm]?tsx?$/.test(file)) syntax.push("typescript");
43
+ if (/\.[jt]sx$/.test(file)) syntax.push("jsx");
44
+ const result = await babel.transformAsync(code, {
45
+ filename: file,
46
+ babelrc: false,
47
+ configFile: false,
48
+ sourceMaps: true,
49
+ parserOpts: { plugins: syntax },
50
+ plugins: [plugin]
51
+ });
52
+ if (result?.code == null) return null;
53
+ return {
54
+ code: result.code,
55
+ map: result.map == null ? null : JSON.stringify(result.map)
56
+ };
57
+ };
58
+ };
59
+ export { WORKLET_CODE, createWorkletTransform };
60
+
61
+ //# sourceMappingURL=worklets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worklets.js","names":[],"sources":["../../src/bundler/worklets.ts"],"sourcesContent":["/**\n * The source of a file that can hold a worklet: a `'worklet'` directive, an import of\n * Reanimated or Worklets, or a call that the Worklets Babel plugin turns into a worklet.\n */\nexport const WORKLET_CODE: RegExp =\n /worklet|reanimated|useAnimated|useDerivedValue|useFrameCallback|runOnUI|scheduleOnUI|with(?:Timing|Spring|Decay|Repeat)\\b/\n\nconst SCRIPT_FILE = /\\.[cm]?[jt]sx?$/\n\n// The map is JSON text, which every bundler takes.\nexport type WorkletTransformResult = { code: string; map: string | null }\n\nexport type WorkletTransform = (code: string, id: string) => Promise<WorkletTransformResult | null>\n\ntype BabelCore = {\n transformAsync: (\n code: string,\n options: Record<string, unknown>,\n ) => Promise<{ code?: string | null; map?: object | null } | null>\n}\n\ntype Require = ((id: string) => unknown) & { resolve: (id: string) => string }\n\ntype Tools = { babel: BabelCore; plugin: string }\n\nconst missing = (name: string): Error =>\n new Error(\n `[@rootnative/web] The \\`worklets\\` option needs \\`${name}\\`, and the app doesn't have it. ` +\n `Install it, or remove the option.`,\n )\n\nconst loadTools = async (root: string): Promise<Tools> => {\n // Only Node runs this file. A dynamic import keeps the browser entries free of it.\n const { createRequire } = await import('node:module')\n const { resolve } = await import('node:path')\n const fromRoot = createRequire(resolve(root, 'package.json')) as Require\n\n let plugin: string\n let workletsManifest: string\n try {\n plugin = fromRoot.resolve('react-native-worklets/plugin')\n workletsManifest = fromRoot.resolve('react-native-worklets/package.json')\n } catch {\n throw missing('react-native-worklets')\n }\n\n // Babel is a peer of Worklets. A strict package layout links it beside Worklets, not in the app.\n for (const load of [fromRoot, createRequire(workletsManifest) as Require]) {\n try {\n return { babel: load('@babel/core') as BabelCore, plugin }\n } catch {\n // Try the next place.\n }\n }\n throw missing('@babel/core')\n}\n\n/**\n * Makes the transform that runs the Worklets Babel plugin on one file, as the Babel preset of a\n * React Native app does. It finds the plugin and Babel from the root of the app, on the first\n * file that needs them.\n */\nexport const createWorkletTransform = (root: string): WorkletTransform => {\n let tools: Promise<Tools> | undefined\n\n return async (code, id) => {\n const file = id.split('?')[0] as string\n if (file.startsWith('\\0') || !SCRIPT_FILE.test(file) || !WORKLET_CODE.test(code)) return null\n\n tools ??= loadTools(root)\n const { babel, plugin } = await tools\n\n // A library can ship TypeScript or JSX source. Babel reads the syntax and keeps it.\n const syntax: string[] = []\n if (/\\.[cm]?tsx?$/.test(file)) syntax.push('typescript')\n if (/\\.[jt]sx$/.test(file)) syntax.push('jsx')\n\n const result = await babel.transformAsync(code, {\n filename: file,\n babelrc: false,\n configFile: false,\n sourceMaps: true,\n parserOpts: { plugins: syntax },\n plugins: [plugin],\n })\n if (result?.code == null) return null\n return { code: result.code, map: result.map == null ? null : JSON.stringify(result.map) }\n }\n}\n"],"mappings":";;;;;AAIA,MAAa,eACX;AAEF,MAAM,cAAc;AAkBpB,MAAM,WAAW,yBACf,IAAI,MACF,qDAAqD,KAAK,mEAE5D;AAEF,MAAM,YAAY,OAAO,SAAiC;CAExD,MAAM,EAAE,kBAAkB,MAAM,OAAO;CACvC,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,WAAW,cAAc,QAAQ,MAAM,cAAc,CAAC;CAE5D,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,SAAS,SAAS,QAAQ,8BAA8B;EACxD,mBAAmB,SAAS,QAAQ,oCAAoC;CAC1E,QAAQ;EACN,MAAM,QAAQ,uBAAuB;CACvC;CAGA,KAAK,MAAM,QAAQ,CAAC,UAAU,cAAc,gBAAgB,CAAY,GACtE,IAAI;EACF,OAAO;GAAE,OAAO,KAAK,aAAa;GAAgB;EAAO;CAC3D,QAAQ,CAER;CAEF,MAAM,QAAQ,aAAa;AAC7B;;;;;;AAOA,MAAa,0BAA0B,SAAmC;CACxE,IAAI;CAEJ,OAAO,OAAO,MAAM,OAAO;EACzB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,CAAC;EAC3B,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,GAAG,OAAO;EAEzF,UAAU,UAAU,IAAI;EACxB,MAAM,EAAE,OAAO,WAAW,MAAM;EAGhC,MAAM,SAAmB,CAAC;EAC1B,IAAI,eAAe,KAAK,IAAI,GAAG,OAAO,KAAK,YAAY;EACvD,IAAI,YAAY,KAAK,IAAI,GAAG,OAAO,KAAK,KAAK;EAE7C,MAAM,SAAS,MAAM,MAAM,eAAe,MAAM;GAC9C,UAAU;GACV,SAAS;GACT,YAAY;GACZ,YAAY;GACZ,YAAY,EAAE,SAAS,OAAO;GAC9B,SAAS,CAAC,MAAM;EAClB,CAAC;EACD,IAAI,QAAQ,QAAQ,MAAM,OAAO;EACjC,OAAO;GAAE,MAAM,OAAO;GAAM,KAAK,OAAO,OAAO,OAAO,OAAO,KAAK,UAAU,OAAO,GAAG;EAAE;CAC1F;AACF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Compat type. The base type of a native module spec. A library extends it for the module that
3
+ * it reads with `TurboModuleRegistry`.
4
+ */
5
+ export interface TurboModule {
6
+ readonly getConstants?: (() => {}) | undefined;
7
+ }
8
+ /**
9
+ * Compat export. A browser has no native modules, so `get` always returns `null`. A library
10
+ * that reads its native module at import time then takes its JavaScript path.
11
+ */
12
+ export declare const TurboModuleRegistry: {
13
+ get<T = unknown>(name: string): T | null;
14
+ getEnforcing<T = unknown>(name: string): T;
15
+ };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,14 @@
1
+ // src/compat/TurboModuleRegistry/index.ts
2
+ /**
3
+ * Compat export. A browser has no native modules, so `get` always returns `null`. A library
4
+ * that reads its native module at import time then takes its JavaScript path.
5
+ */
6
+ const TurboModuleRegistry = {
7
+ get: () => null,
8
+ getEnforcing: (name) => {
9
+ throw new Error(`TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. A browser has no native modules.`);
10
+ }
11
+ };
12
+ export { TurboModuleRegistry };
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/compat/TurboModuleRegistry/index.ts"],"sourcesContent":["/**\n * Compat type. The base type of a native module spec. A library extends it for the module that\n * it reads with `TurboModuleRegistry`.\n */\nexport interface TurboModule {\n // React Native's own type for the constants.\n // oxlint-disable-next-line typescript/no-empty-object-type\n readonly getConstants?: (() => {}) | undefined\n}\n\n/**\n * Compat export. A browser has no native modules, so `get` always returns `null`. A library\n * that reads its native module at import time then takes its JavaScript path.\n */\nexport const TurboModuleRegistry: {\n get<T = unknown>(name: string): T | null\n getEnforcing<T = unknown>(name: string): T\n} = {\n get: () => null,\n getEnforcing: (name) => {\n throw new Error(\n `TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` +\n 'A browser has no native modules.',\n )\n },\n}\n"],"mappings":";;;;;AAcA,MAAa,sBAGT;CACF,WAAW;CACX,eAAe,SAAS;EACtB,MAAM,IAAI,MACR,2CAA2C,KAAK,uDAElD;CACF;AACF"}
@@ -0,0 +1,9 @@
1
+ import { ElementType, ReactElement } from "react";
2
+ export type CreateElementProps = Readonly<Record<string, unknown>>;
3
+ /**
4
+ * Compat export. Renders `type` with React Native props: `style` compiles to class names, and
5
+ * the accessibility props become ARIA attributes. Every other prop goes to the element as it
6
+ * is. Libraries such as `react-native-svg` import it from `react-native` on the web.
7
+ */
8
+ export declare const unstable_createElement: (type: ElementType, props?: CreateElementProps | null) => ReactElement;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { isNativeHandler, toDOMProps } from "../../render/domProps.js";
2
+ import { compileStyle } from "../../style/compile.js";
3
+ import { useStyleRegistry } from "../../style/StyleRegistryContext.js";
4
+ import { createElement } from "react";
5
+ // src/compat/createElement/index.tsx
6
+ const mappedProps = /* @__PURE__ */ new Set([
7
+ "focusable",
8
+ "importantForAccessibility",
9
+ "nativeID",
10
+ "testID"
11
+ ]);
12
+ const isNativeOnly = (name) => mappedProps.has(name) || name.startsWith("accessibility") || isNativeHandler(name);
13
+ function Host({ type, props }) {
14
+ const registry = useStyleRegistry();
15
+ const { className, style, ...rest } = props;
16
+ const domProps = {};
17
+ for (const name in rest) if (!isNativeOnly(name)) domProps[name] = rest[name];
18
+ Object.assign(domProps, toDOMProps(rest));
19
+ const compiled = compileStyle(style, registry);
20
+ const classes = typeof className === "string" && className !== "" ? [className] : [];
21
+ if (compiled !== "") classes.push(compiled);
22
+ if (classes.length > 0) domProps["className"] = classes.join(" ");
23
+ return createElement(type, domProps);
24
+ }
25
+ /**
26
+ * Compat export. Renders `type` with React Native props: `style` compiles to class names, and
27
+ * the accessibility props become ARIA attributes. Every other prop goes to the element as it
28
+ * is. Libraries such as `react-native-svg` import it from `react-native` on the web.
29
+ */
30
+ const unstable_createElement = (type, props) => {
31
+ const hostProps = props ?? {};
32
+ return createElement(Host, {
33
+ key: hostProps["key"],
34
+ type,
35
+ props: hostProps
36
+ });
37
+ };
38
+ export { unstable_createElement };
39
+
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/compat/createElement/index.tsx"],"sourcesContent":["import { createElement, type ElementType, type Key, type ReactElement } from 'react'\n\nimport { isNativeHandler, toDOMProps } from '../../render/domProps'\nimport { compileStyle } from '../../style/compile'\nimport { useStyleRegistry } from '../../style/StyleRegistryContext'\nimport type { FlatStyle, StyleProp } from '../../style/types'\n\nexport type CreateElementProps = Readonly<Record<string, unknown>>\n\n// `toDOMProps` turns these into DOM attributes, so the names themselves never reach the element.\nconst mappedProps = new Set(['focusable', 'importantForAccessibility', 'nativeID', 'testID'])\n\nconst isNativeOnly = (name: string): boolean =>\n mappedProps.has(name) || name.startsWith('accessibility') || isNativeHandler(name)\n\ntype HostProps = { type: ElementType; props: CreateElementProps }\n\n// The style registry comes from a context, and the caller can be a class component.\n// So the host element renders inside this component.\nfunction Host({ type, props }: HostProps): ReactElement {\n const registry = useStyleRegistry()\n const { className, style, ...rest } = props\n\n // Unlike `View`, an unknown prop stays: `d`, `fill`, and `viewBox` of an SVG element must\n // reach the element.\n const domProps: Record<string, unknown> = {}\n for (const name in rest) {\n if (!isNativeOnly(name)) domProps[name] = rest[name]\n }\n Object.assign(domProps, toDOMProps(rest as Parameters<typeof toDOMProps>[0]))\n\n const compiled = compileStyle(style as StyleProp<FlatStyle>, registry)\n const classes = typeof className === 'string' && className !== '' ? [className] : []\n if (compiled !== '') classes.push(compiled)\n if (classes.length > 0) domProps['className'] = classes.join(' ')\n\n return createElement(type, domProps)\n}\n\n/**\n * Compat export. Renders `type` with React Native props: `style` compiles to class names, and\n * the accessibility props become ARIA attributes. Every other prop goes to the element as it\n * is. Libraries such as `react-native-svg` import it from `react-native` on the web.\n */\nexport const unstable_createElement = (\n type: ElementType,\n props?: CreateElementProps | null,\n): ReactElement => {\n const hostProps = props ?? {}\n return createElement(Host, { key: hostProps['key'] as Key | undefined, type, props: hostProps })\n}\n"],"mappings":";;;;;AAUA,MAAM,8BAAc,IAAI,IAAI;CAAC;CAAa;CAA6B;CAAY;AAAQ,CAAC;AAE5F,MAAM,gBAAgB,SACpB,YAAY,IAAI,IAAI,KAAK,KAAK,WAAW,eAAe,KAAK,gBAAgB,IAAI;AAMnF,SAAS,KAAK,EAAE,MAAM,SAAkC;CACtD,MAAM,WAAW,iBAAiB;CAClC,MAAM,EAAE,WAAW,OAAO,GAAG,SAAS;CAItC,MAAM,WAAoC,CAAC;CAC3C,KAAK,MAAM,QAAQ,MACjB,IAAI,CAAC,aAAa,IAAI,GAAG,SAAS,QAAQ,KAAK;CAEjD,OAAO,OAAO,UAAU,WAAW,IAAwC,CAAC;CAE5E,MAAM,WAAW,aAAa,OAA+B,QAAQ;CACrE,MAAM,UAAU,OAAO,cAAc,YAAY,cAAc,KAAK,CAAC,SAAS,IAAI,CAAC;CACnF,IAAI,aAAa,IAAI,QAAQ,KAAK,QAAQ;CAC1C,IAAI,QAAQ,SAAS,GAAG,SAAS,eAAe,QAAQ,KAAK,GAAG;CAEhE,OAAO,cAAc,MAAM,QAAQ;AACrC;;;;;;AAOA,MAAa,0BACX,MACA,UACiB;CACjB,MAAM,YAAY,SAAS,CAAC;CAC5B,OAAO,cAAc,MAAM;EAAE,KAAK,UAAU;EAA2B;EAAM,OAAO;CAAU,CAAC;AACjG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Compat export. On native it returns the tag of a view. On the web it returns the DOM element
3
+ * of a ref, of an element, or of a scroll component. A number comes back as it is. A class
4
+ * component instance gives `null`, because React has no `findDOMNode`.
5
+ */
6
+ export declare const findNodeHandle: (componentOrHandle: unknown) => Element | number | null;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ // src/compat/findNodeHandle/index.ts
2
+ const isElement = (value) => value.nodeType === 1;
3
+ /**
4
+ * Compat export. On native it returns the tag of a view. On the web it returns the DOM element
5
+ * of a ref, of an element, or of a scroll component. A number comes back as it is. A class
6
+ * component instance gives `null`, because React has no `findDOMNode`.
7
+ */
8
+ const findNodeHandle = (componentOrHandle) => {
9
+ if (typeof componentOrHandle === "number") return componentOrHandle;
10
+ if (typeof componentOrHandle !== "object" || componentOrHandle === null) return null;
11
+ if (isElement(componentOrHandle)) return componentOrHandle;
12
+ const { getScrollableNode } = componentOrHandle;
13
+ if (typeof getScrollableNode === "function") return findNodeHandle(getScrollableNode.call(componentOrHandle));
14
+ if ("current" in componentOrHandle) return findNodeHandle(componentOrHandle.current);
15
+ return null;
16
+ };
17
+ export { findNodeHandle };
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/compat/findNodeHandle/index.ts"],"sourcesContent":["const isElement = (value: object): value is Element =>\n (value as { nodeType?: unknown }).nodeType === 1\n\n/**\n * Compat export. On native it returns the tag of a view. On the web it returns the DOM element\n * of a ref, of an element, or of a scroll component. A number comes back as it is. A class\n * component instance gives `null`, because React has no `findDOMNode`.\n */\nexport const findNodeHandle = (componentOrHandle: unknown): Element | number | null => {\n if (typeof componentOrHandle === 'number') return componentOrHandle\n if (typeof componentOrHandle !== 'object' || componentOrHandle === null) return null\n if (isElement(componentOrHandle)) return componentOrHandle\n\n const { getScrollableNode } = componentOrHandle as { getScrollableNode?: unknown }\n if (typeof getScrollableNode === 'function') {\n return findNodeHandle(getScrollableNode.call(componentOrHandle))\n }\n if ('current' in componentOrHandle) return findNodeHandle(componentOrHandle.current)\n return null\n}\n"],"mappings":";AAAA,MAAM,aAAa,UAChB,MAAiC,aAAa;;;;;;AAOjD,MAAa,kBAAkB,sBAAwD;CACrF,IAAI,OAAO,sBAAsB,UAAU,OAAO;CAClD,IAAI,OAAO,sBAAsB,YAAY,sBAAsB,MAAM,OAAO;CAChF,IAAI,UAAU,iBAAiB,GAAG,OAAO;CAEzC,MAAM,EAAE,sBAAsB;CAC9B,IAAI,OAAO,sBAAsB,YAC/B,OAAO,eAAe,kBAAkB,KAAK,iBAAiB,CAAC;CAEjE,IAAI,aAAa,mBAAmB,OAAO,eAAe,kBAAkB,OAAO;CACnF,OAAO;AACT"}
@@ -0,0 +1,5 @@
1
+ import { ActivityIndicatorProps } from "./types.js";
2
+ import { ReactElement } from "react";
3
+ export declare function ActivityIndicator(props: ActivityIndicatorProps): ReactElement;
4
+ export type { ActivityIndicatorProps };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { StyleSheet } from "../../apis/StyleSheet/index.js";
2
+ import { toCSSColor } from "../../style/color.js";
3
+ import { useStyleRegistry } from "../../style/StyleRegistryContext.js";
4
+ import { webStyle } from "../../style/webStyle.js";
5
+ import { View } from "../View/index.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/ActivityIndicator/index.tsx
8
+ const GRAY = "#999999";
9
+ const SPIN_CLASS = "rn-activity-indicator";
10
+ const SPIN_RULES = ["@keyframes rn-activity-indicator-spin{to{transform:rotate(360deg)}}", `.${SPIN_CLASS}{animation:rn-activity-indicator-spin .75s linear infinite}`];
11
+ const hiddenStyle = webStyle({ visibility: "hidden" });
12
+ const pausedStyle = { animationPlayState: "paused" };
13
+ function ActivityIndicator(props) {
14
+ const { animating = true, color = GRAY, hidesWhenStopped = true, onLayout, ref, size = "small", style, ...rest } = props;
15
+ const spinClass = useStyleRegistry().staticClass(SPIN_CLASS, SPIN_RULES);
16
+ const stroke = toCSSColor(color) ?? GRAY;
17
+ const sizeStyle = size === "small" ? styles.sizeSmall : size === "large" ? styles.sizeLarge : {
18
+ width: size,
19
+ height: size
20
+ };
21
+ return /* @__PURE__ */ jsx(View, {
22
+ onLayout,
23
+ style: [styles.container, style],
24
+ children: /* @__PURE__ */ jsx(View, {
25
+ role: "progressbar",
26
+ ...rest,
27
+ ref,
28
+ style: [sizeStyle, !animating && hidesWhenStopped && hiddenStyle],
29
+ children: /* @__PURE__ */ jsxs("svg", {
30
+ "aria-hidden": true,
31
+ className: spinClass,
32
+ height: "100%",
33
+ style: animating ? void 0 : pausedStyle,
34
+ viewBox: "0 0 32 32",
35
+ width: "100%",
36
+ children: [/* @__PURE__ */ jsx("circle", {
37
+ cx: "16",
38
+ cy: "16",
39
+ fill: "none",
40
+ opacity: "0.2",
41
+ r: "14",
42
+ stroke,
43
+ strokeWidth: "4"
44
+ }), /* @__PURE__ */ jsx("circle", {
45
+ cx: "16",
46
+ cy: "16",
47
+ fill: "none",
48
+ r: "14",
49
+ stroke,
50
+ strokeDasharray: "80",
51
+ strokeDashoffset: "60",
52
+ strokeWidth: "4"
53
+ })]
54
+ })
55
+ })
56
+ });
57
+ }
58
+ const styles = StyleSheet.create({
59
+ container: {
60
+ alignItems: "center",
61
+ justifyContent: "center"
62
+ },
63
+ sizeSmall: {
64
+ width: 20,
65
+ height: 20
66
+ },
67
+ sizeLarge: {
68
+ width: 36,
69
+ height: 36
70
+ }
71
+ });
72
+ export { ActivityIndicator };
73
+
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ActivityIndicator/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\n\nimport { StyleSheet } from '../../apis/StyleSheet'\nimport { toCSSColor } from '../../style/color'\nimport { useStyleRegistry } from '../../style/StyleRegistryContext'\nimport { webStyle } from '../../style/webStyle'\nimport { View } from '../View'\nimport type { ActivityIndicatorProps } from './types'\n\nexport type { ActivityIndicatorProps } from './types'\n\nconst GRAY = '#999999'\n\nconst SPIN_CLASS = 'rn-activity-indicator'\nconst SPIN_RULES = [\n '@keyframes rn-activity-indicator-spin{to{transform:rotate(360deg)}}',\n `.${SPIN_CLASS}{animation:rn-activity-indicator-spin .75s linear infinite}`,\n]\n\nconst hiddenStyle = webStyle({ visibility: 'hidden' })\n\nconst pausedStyle = { animationPlayState: 'paused' }\n\nexport function ActivityIndicator(props: ActivityIndicatorProps): ReactElement {\n const {\n animating = true,\n color = GRAY,\n hidesWhenStopped = true,\n onLayout,\n ref,\n size = 'small',\n style,\n ...rest\n } = props\n\n const registry = useStyleRegistry()\n const spinClass = registry.staticClass(SPIN_CLASS, SPIN_RULES)\n const stroke = toCSSColor(color) ?? GRAY\n\n const sizeStyle =\n size === 'small'\n ? styles.sizeSmall\n : size === 'large'\n ? styles.sizeLarge\n : { width: size, height: size }\n\n // As on native: the container gets `style` and `onLayout`, the indicator gets the other props\n // and the ref.\n return (\n <View onLayout={onLayout} style={[styles.container, style]}>\n <View\n role=\"progressbar\"\n {...rest}\n ref={ref}\n style={[sizeStyle, !animating && hidesWhenStopped && hiddenStyle]}\n >\n <svg\n aria-hidden\n className={spinClass}\n height=\"100%\"\n style={animating ? undefined : pausedStyle}\n viewBox=\"0 0 32 32\"\n width=\"100%\"\n >\n <circle\n cx=\"16\"\n cy=\"16\"\n fill=\"none\"\n opacity=\"0.2\"\n r=\"14\"\n stroke={stroke}\n strokeWidth=\"4\"\n />\n <circle\n cx=\"16\"\n cy=\"16\"\n fill=\"none\"\n r=\"14\"\n stroke={stroke}\n strokeDasharray=\"80\"\n strokeDashoffset=\"60\"\n strokeWidth=\"4\"\n />\n </svg>\n </View>\n </View>\n )\n}\n\nconst styles = StyleSheet.create({\n container: { alignItems: 'center', justifyContent: 'center' },\n sizeSmall: { width: 20, height: 20 },\n sizeLarge: { width: 36, height: 36 },\n})\n"],"mappings":";;;;;;;AAWA,MAAM,OAAO;AAEb,MAAM,aAAa;AACnB,MAAM,aAAa,CACjB,uEACA,IAAI,WAAW,4DACjB;AAEA,MAAM,cAAc,SAAS,EAAE,YAAY,SAAS,CAAC;AAErD,MAAM,cAAc,EAAE,oBAAoB,SAAS;AAEnD,SAAgB,kBAAkB,OAA6C;CAC7E,MAAM,EACJ,YAAY,MACZ,QAAQ,MACR,mBAAmB,MACnB,UACA,KACA,OAAO,SACP,OACA,GAAG,SACD;CAGJ,MAAM,YADW,iBACQ,CAAC,CAAC,YAAY,YAAY,UAAU;CAC7D,MAAM,SAAS,WAAW,KAAK,KAAK;CAEpC,MAAM,YACJ,SAAS,UACL,OAAO,YACP,SAAS,UACP,OAAO,YACP;EAAE,OAAO;EAAM,QAAQ;CAAK;CAIpC,OACE,oBAAC,MAAD;EAAgB;EAAU,OAAO,CAAC,OAAO,WAAW,KAAK;EACvD,UAAA,oBAAC,MAAD;GACE,MAAK;GACL,GAAI;GACC;GACL,OAAO,CAAC,WAAW,CAAC,aAAa,oBAAoB,WAAW;GAEhE,UAAA,qBAAC,OAAD;IACE,eAAA;IACA,WAAW;IACX,QAAO;IACP,OAAO,YAAY,KAAA,IAAY;IAC/B,SAAQ;IACR,OAAM;IANR,UAAA,CAQE,oBAAC,UAAD;KACE,IAAG;KACH,IAAG;KACH,MAAK;KACL,SAAQ;KACR,GAAE;KACM;KACR,aAAY;IACb,CAAA,GACD,oBAAC,UAAD;KACE,IAAG;KACH,IAAG;KACH,MAAK;KACL,GAAE;KACM;KACR,iBAAgB;KAChB,kBAAiB;KACjB,aAAY;IACb,CAAA,CACE;;EACD,CAAA;CACF,CAAA;AAEV;AAEA,MAAM,SAAS,WAAW,OAAO;CAC/B,WAAW;EAAE,YAAY;EAAU,gBAAgB;CAAS;CAC5D,WAAW;EAAE,OAAO;EAAI,QAAQ;CAAG;CACnC,WAAW;EAAE,OAAO;EAAI,QAAQ;CAAG;AACrC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ViewProps } from "../View/types.js";
2
+ export interface ActivityIndicatorProps extends ViewProps {
3
+ animating?: boolean | undefined;
4
+ color?: string | undefined;
5
+ hidesWhenStopped?: boolean | undefined;
6
+ size?: number | "small" | "large" | undefined;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { ButtonProps } from "./types.js";
2
+ import { ReactElement } from "react";
3
+ export declare function Button(props: ButtonProps): ReactElement;
4
+ export type { ButtonProps };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,48 @@
1
+ import { StyleSheet } from "../../apis/StyleSheet/index.js";
2
+ import { Text } from "../Text/index.js";
3
+ import { TouchableOpacity } from "../TouchableOpacity/index.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/Button/index.tsx
6
+ function Button(props) {
7
+ const { accessibilityActions: _accessibilityActions, accessibilityLanguage, accessibilityState, "aria-disabled": ariaDisabled, color, importantForAccessibility, onAccessibilityAction: _onAccessibilityAction, title, ...rest } = props;
8
+ if (typeof title !== "string") throw new Error("The title prop of a Button must be a string");
9
+ const disabled = props.disabled ?? ariaDisabled ?? accessibilityState?.disabled;
10
+ const state = disabled === accessibilityState?.disabled ? accessibilityState : {
11
+ ...accessibilityState,
12
+ disabled
13
+ };
14
+ return /* @__PURE__ */ jsx(TouchableOpacity, {
15
+ ...rest,
16
+ ...accessibilityLanguage !== void 0 && { lang: accessibilityLanguage },
17
+ role: "button",
18
+ accessibilityState: state,
19
+ disabled,
20
+ importantForAccessibility: importantForAccessibility === "no" ? "no-hide-descendants" : importantForAccessibility,
21
+ style: [
22
+ styles.button,
23
+ color != null && color !== "" && { backgroundColor: color },
24
+ disabled === true && styles.buttonDisabled
25
+ ],
26
+ children: /* @__PURE__ */ jsx(Text, {
27
+ style: [styles.text, disabled === true && styles.textDisabled],
28
+ children: title
29
+ })
30
+ });
31
+ }
32
+ const styles = StyleSheet.create({
33
+ button: {
34
+ backgroundColor: "#2196F3",
35
+ borderRadius: 2
36
+ },
37
+ text: {
38
+ color: "white",
39
+ fontWeight: "500",
40
+ margin: 8,
41
+ textAlign: "center"
42
+ },
43
+ buttonDisabled: { backgroundColor: "#dfdfdf" },
44
+ textDisabled: { color: "#a1a1a1" }
45
+ });
46
+ export { Button };
47
+
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\n\nimport { StyleSheet } from '../../apis/StyleSheet'\nimport { Text } from '../Text'\nimport { TouchableOpacity } from '../TouchableOpacity'\nimport type { ButtonProps } from './types'\n\nexport type { ButtonProps } from './types'\n\nexport function Button(props: ButtonProps): ReactElement {\n const {\n accessibilityActions: _accessibilityActions,\n accessibilityLanguage,\n accessibilityState,\n 'aria-disabled': ariaDisabled,\n color,\n importantForAccessibility,\n onAccessibilityAction: _onAccessibilityAction,\n title,\n ...rest\n } = props\n\n if (typeof title !== 'string') throw new Error('The title prop of a Button must be a string')\n\n const disabled = props.disabled ?? ariaDisabled ?? accessibilityState?.disabled\n // As in React Native, the state follows the resolved value, so `disabled={false}` wins.\n const state =\n disabled === accessibilityState?.disabled\n ? accessibilityState\n : { ...accessibilityState, disabled }\n\n // One element, where React Native has a View inside the touchable: a <button> takes no <div>.\n return (\n <TouchableOpacity\n {...rest}\n {...(accessibilityLanguage !== undefined && { lang: accessibilityLanguage })}\n role=\"button\"\n accessibilityState={state}\n disabled={disabled}\n // As in React Native: `no` also hides the text inside.\n importantForAccessibility={\n importantForAccessibility === 'no' ? 'no-hide-descendants' : importantForAccessibility\n }\n style={[\n styles.button,\n color != null && color !== '' && { backgroundColor: color },\n disabled === true && styles.buttonDisabled,\n ]}\n >\n <Text style={[styles.text, disabled === true && styles.textDisabled]}>{title}</Text>\n </TouchableOpacity>\n )\n}\n\n// The look of React Native's Button on Android, without the elevation.\nconst styles = StyleSheet.create({\n button: { backgroundColor: '#2196F3', borderRadius: 2 },\n text: { color: 'white', fontWeight: '500', margin: 8, textAlign: 'center' },\n buttonDisabled: { backgroundColor: '#dfdfdf' },\n textDisabled: { color: '#a1a1a1' },\n})\n"],"mappings":";;;;;AASA,SAAgB,OAAO,OAAkC;CACvD,MAAM,EACJ,sBAAsB,uBACtB,uBACA,oBACA,iBAAiB,cACjB,OACA,2BACA,uBAAuB,wBACvB,OACA,GAAG,SACD;CAEJ,IAAI,OAAO,UAAU,UAAU,MAAM,IAAI,MAAM,6CAA6C;CAE5F,MAAM,WAAW,MAAM,YAAY,gBAAgB,oBAAoB;CAEvE,MAAM,QACJ,aAAa,oBAAoB,WAC7B,qBACA;EAAE,GAAG;EAAoB;CAAS;CAGxC,OACE,oBAAC,kBAAD;EACE,GAAI;EACJ,GAAK,0BAA0B,KAAA,KAAa,EAAE,MAAM,sBAAsB;EAC1E,MAAK;EACL,oBAAoB;EACV;EAEV,2BACE,8BAA8B,OAAO,wBAAwB;EAE/D,OAAO;GACL,OAAO;GACP,SAAS,QAAQ,UAAU,MAAM,EAAE,iBAAiB,MAAM;GAC1D,aAAa,QAAQ,OAAO;EAC9B;EAEA,UAAA,oBAAC,MAAD;GAAM,OAAO,CAAC,OAAO,MAAM,aAAa,QAAQ,OAAO,YAAY;GAAI,UAAA;EAAY,CAAA;CACnE,CAAA;AAEtB;AAGA,MAAM,SAAS,WAAW,OAAO;CAC/B,QAAQ;EAAE,iBAAiB;EAAW,cAAc;CAAE;CACtD,MAAM;EAAE,OAAO;EAAS,YAAY;EAAO,QAAQ;EAAG,WAAW;CAAS;CAC1E,gBAAgB,EAAE,iBAAiB,UAAU;CAC7C,cAAc,EAAE,OAAO,UAAU;AACnC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { GestureResponderEvent } from "../../events/types.js";
2
+ import { TouchableTVProps } from "../TouchableWithoutFeedback/types.js";
3
+ import { AccessibilityState, HostInstance } from "../View/types.js";
4
+ import { Ref } from "react";
5
+ export interface ButtonProps extends TouchableTVProps {
6
+ title: string;
7
+ onPress?: ((event: GestureResponderEvent) => unknown) | undefined;
8
+ color?: string | undefined;
9
+ disabled?: boolean | undefined;
10
+ testID?: string | undefined;
11
+ ref?: Ref<HostInstance> | undefined;
12
+ accessible?: boolean | undefined;
13
+ accessibilityLabel?: string | undefined;
14
+ accessibilityHint?: string | undefined;
15
+ accessibilityLanguage?: string | undefined;
16
+ accessibilityState?: AccessibilityState | undefined;
17
+ importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
18
+ "aria-busy"?: boolean | undefined;
19
+ "aria-checked"?: boolean | "mixed" | undefined;
20
+ "aria-disabled"?: boolean | undefined;
21
+ "aria-expanded"?: boolean | undefined;
22
+ "aria-label"?: string | undefined;
23
+ "aria-selected"?: boolean | undefined;
24
+ accessibilityActions?: ReadonlyArray<{
25
+ name: string;
26
+ label?: string | undefined;
27
+ }> | undefined;
28
+ onAccessibilityAction?: ((event: unknown) => unknown) | undefined;
29
+ touchSoundDisabled?: boolean | undefined;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { CellRendererProps, FlatListInstance, FlatListProps, ListRenderItem, ListRenderItemInfo, ListSeparatorComponent, ListSeparatorProps, ListSeparators, ScrollToIndexParams, ScrollToItemParams, ScrollToOffsetParams, ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs, ViewableItemsChangedInfo } from "./types.js";
2
+ import { ReactElement } from "react";
3
+ export declare function FlatList<ItemT>(props: FlatListProps<ItemT>): ReactElement;
4
+ export type { CellRendererProps, FlatListInstance, FlatListProps, ListRenderItem, ListRenderItemInfo, ListSeparatorComponent, ListSeparatorProps, ListSeparators, ScrollToIndexParams, ScrollToItemParams, ScrollToOffsetParams, ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs, ViewableItemsChangedInfo };
5
+ //# sourceMappingURL=index.d.ts.map