basalt-core 0.0.0-rc5

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 (325) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli/basalt.d.ts +3 -0
  3. package/dist/cli/basalt.d.ts.map +1 -0
  4. package/dist/cli/basalt.js +47 -0
  5. package/dist/cli/basalt.js.map +1 -0
  6. package/dist/cli/bundle-cli.d.ts +12 -0
  7. package/dist/cli/bundle-cli.d.ts.map +1 -0
  8. package/dist/cli/bundle-cli.js +124 -0
  9. package/dist/cli/bundle-cli.js.map +1 -0
  10. package/dist/cli/bundleWithAssets.d.ts +79 -0
  11. package/dist/cli/bundleWithAssets.d.ts.map +1 -0
  12. package/dist/cli/bundleWithAssets.js +198 -0
  13. package/dist/cli/bundleWithAssets.js.map +1 -0
  14. package/dist/cli/desktop.d.ts +339 -0
  15. package/dist/cli/desktop.d.ts.map +1 -0
  16. package/dist/cli/desktop.js +1029 -0
  17. package/dist/cli/desktop.js.map +1 -0
  18. package/dist/cli/doctor.d.ts +31 -0
  19. package/dist/cli/doctor.d.ts.map +1 -0
  20. package/dist/cli/doctor.js +283 -0
  21. package/dist/cli/doctor.js.map +1 -0
  22. package/dist/cli/init.d.ts +77 -0
  23. package/dist/cli/init.d.ts.map +1 -0
  24. package/dist/cli/init.js +442 -0
  25. package/dist/cli/init.js.map +1 -0
  26. package/dist/cli/metro.d.ts +49 -0
  27. package/dist/cli/metro.d.ts.map +1 -0
  28. package/dist/cli/metro.js +148 -0
  29. package/dist/cli/metro.js.map +1 -0
  30. package/dist/cli/packageApp.d.ts +102 -0
  31. package/dist/cli/packageApp.d.ts.map +1 -0
  32. package/dist/cli/packageApp.js +319 -0
  33. package/dist/cli/packageApp.js.map +1 -0
  34. package/dist/cli/steps.d.ts +34 -0
  35. package/dist/cli/steps.d.ts.map +1 -0
  36. package/dist/cli/steps.js +53 -0
  37. package/dist/cli/steps.js.map +1 -0
  38. package/dist/metro-config.d.ts +168 -0
  39. package/dist/metro-config.d.ts.map +1 -0
  40. package/dist/metro-config.js +671 -0
  41. package/dist/metro-config.js.map +1 -0
  42. package/dist/react-native.config.d.ts +7 -0
  43. package/dist/react-native.config.d.ts.map +1 -0
  44. package/dist/react-native.config.js +80 -0
  45. package/dist/react-native.config.js.map +1 -0
  46. package/dist/src/DragSource.d.ts +52 -0
  47. package/dist/src/DragSource.d.ts.map +1 -0
  48. package/dist/src/DragSource.js +97 -0
  49. package/dist/src/DragSource.js.map +1 -0
  50. package/dist/src/DropTarget.d.ts +58 -0
  51. package/dist/src/DropTarget.d.ts.map +1 -0
  52. package/dist/src/DropTarget.js +131 -0
  53. package/dist/src/DropTarget.js.map +1 -0
  54. package/dist/src/KeyHandler.d.ts +57 -0
  55. package/dist/src/KeyHandler.d.ts.map +1 -0
  56. package/dist/src/KeyHandler.js +48 -0
  57. package/dist/src/KeyHandler.js.map +1 -0
  58. package/dist/src/Menu.d.ts +72 -0
  59. package/dist/src/Menu.d.ts.map +1 -0
  60. package/dist/src/Menu.js +179 -0
  61. package/dist/src/Menu.js.map +1 -0
  62. package/dist/src/TitleBar.d.ts +75 -0
  63. package/dist/src/TitleBar.d.ts.map +1 -0
  64. package/dist/src/TitleBar.js +236 -0
  65. package/dist/src/TitleBar.js.map +1 -0
  66. package/dist/src/Window.d.ts +87 -0
  67. package/dist/src/Window.d.ts.map +1 -0
  68. package/dist/src/Window.js +248 -0
  69. package/dist/src/Window.js.map +1 -0
  70. package/dist/src/closeRequest.d.ts +55 -0
  71. package/dist/src/closeRequest.d.ts.map +1 -0
  72. package/dist/src/closeRequest.js +134 -0
  73. package/dist/src/closeRequest.js.map +1 -0
  74. package/dist/src/index.d.ts +45 -0
  75. package/dist/src/index.d.ts.map +1 -0
  76. package/dist/src/index.js +92 -0
  77. package/dist/src/index.js.map +1 -0
  78. package/dist/src/overrides/Alert.d.ts +69 -0
  79. package/dist/src/overrides/Alert.d.ts.map +1 -0
  80. package/dist/src/overrides/Alert.js +112 -0
  81. package/dist/src/overrides/Alert.js.map +1 -0
  82. package/dist/src/overrides/BaseViewConfig.d.ts +28 -0
  83. package/dist/src/overrides/BaseViewConfig.d.ts.map +1 -0
  84. package/dist/src/overrides/BaseViewConfig.js +72 -0
  85. package/dist/src/overrides/BaseViewConfig.js.map +1 -0
  86. package/dist/src/overrides/Platform.linux.d.ts +10 -0
  87. package/dist/src/overrides/Platform.linux.d.ts.map +1 -0
  88. package/dist/src/overrides/Platform.linux.js +15 -0
  89. package/dist/src/overrides/Platform.linux.js.map +1 -0
  90. package/dist/src/overrides/Platform.macos.d.ts +10 -0
  91. package/dist/src/overrides/Platform.macos.d.ts.map +1 -0
  92. package/dist/src/overrides/Platform.macos.js +15 -0
  93. package/dist/src/overrides/Platform.macos.js.map +1 -0
  94. package/dist/src/overrides/Platform.windows.d.ts +10 -0
  95. package/dist/src/overrides/Platform.windows.d.ts.map +1 -0
  96. package/dist/src/overrides/Platform.windows.js +15 -0
  97. package/dist/src/overrides/Platform.windows.js.map +1 -0
  98. package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts +24 -0
  99. package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts.map +1 -0
  100. package/dist/src/overrides/ReactDevToolsSettingsManager.js +30 -0
  101. package/dist/src/overrides/ReactDevToolsSettingsManager.js.map +1 -0
  102. package/dist/src/overrides/RefreshControl.d.ts +52 -0
  103. package/dist/src/overrides/RefreshControl.d.ts.map +1 -0
  104. package/dist/src/overrides/RefreshControl.js +92 -0
  105. package/dist/src/overrides/RefreshControl.js.map +1 -0
  106. package/dist/src/overrides/ScrollView.d.ts +39 -0
  107. package/dist/src/overrides/ScrollView.d.ts.map +1 -0
  108. package/dist/src/overrides/ScrollView.js +59 -0
  109. package/dist/src/overrides/ScrollView.js.map +1 -0
  110. package/dist/src/overrides/Share.d.ts +96 -0
  111. package/dist/src/overrides/Share.d.ts.map +1 -0
  112. package/dist/src/overrides/Share.js +97 -0
  113. package/dist/src/overrides/Share.js.map +1 -0
  114. package/dist/src/overrides/TextInput.d.ts +81 -0
  115. package/dist/src/overrides/TextInput.d.ts.map +1 -0
  116. package/dist/src/overrides/TextInput.js +213 -0
  117. package/dist/src/overrides/TextInput.js.map +1 -0
  118. package/dist/src/overrides/View.d.ts +36 -0
  119. package/dist/src/overrides/View.d.ts.map +1 -0
  120. package/dist/src/overrides/View.js +99 -0
  121. package/dist/src/overrides/View.js.map +1 -0
  122. package/dist/src/overrides/createPlatform.d.ts +32 -0
  123. package/dist/src/overrides/createPlatform.d.ts.map +1 -0
  124. package/dist/src/overrides/createPlatform.js +84 -0
  125. package/dist/src/overrides/createPlatform.js.map +1 -0
  126. package/dist/src/overrides/setUpDeveloperTools.d.ts +28 -0
  127. package/dist/src/overrides/setUpDeveloperTools.d.ts.map +1 -0
  128. package/dist/src/overrides/setUpDeveloperTools.js +84 -0
  129. package/dist/src/overrides/setUpDeveloperTools.js.map +1 -0
  130. package/dist/src/overrides/setUpXHR.d.ts +46 -0
  131. package/dist/src/overrides/setUpXHR.d.ts.map +1 -0
  132. package/dist/src/overrides/setUpXHR.js +236 -0
  133. package/dist/src/overrides/setUpXHR.js.map +1 -0
  134. package/dist/src/quitRequest.d.ts +55 -0
  135. package/dist/src/quitRequest.d.ts.map +1 -0
  136. package/dist/src/quitRequest.js +121 -0
  137. package/dist/src/quitRequest.js.map +1 -0
  138. package/dist/src/resourcePath.d.ts +18 -0
  139. package/dist/src/resourcePath.d.ts.map +1 -0
  140. package/dist/src/resourcePath.js +31 -0
  141. package/dist/src/resourcePath.js.map +1 -0
  142. package/dist/src/responseBody.d.ts +76 -0
  143. package/dist/src/responseBody.d.ts.map +1 -0
  144. package/dist/src/responseBody.js +94 -0
  145. package/dist/src/responseBody.js.map +1 -0
  146. package/dist/src/responseHeaders.d.ts +40 -0
  147. package/dist/src/responseHeaders.d.ts.map +1 -0
  148. package/dist/src/responseHeaders.js +75 -0
  149. package/dist/src/responseHeaders.js.map +1 -0
  150. package/dist/src/titleBarState.d.ts +43 -0
  151. package/dist/src/titleBarState.d.ts.map +1 -0
  152. package/dist/src/titleBarState.js +77 -0
  153. package/dist/src/titleBarState.js.map +1 -0
  154. package/dist/src/useContextMenu.d.ts +113 -0
  155. package/dist/src/useContextMenu.d.ts.map +1 -0
  156. package/dist/src/useContextMenu.js +109 -0
  157. package/dist/src/useContextMenu.js.map +1 -0
  158. package/dist/src/useDialog.d.ts +98 -0
  159. package/dist/src/useDialog.d.ts.map +1 -0
  160. package/dist/src/useDialog.js +112 -0
  161. package/dist/src/useDialog.js.map +1 -0
  162. package/dist/src/useDisplays.d.ts +70 -0
  163. package/dist/src/useDisplays.d.ts.map +1 -0
  164. package/dist/src/useDisplays.js +118 -0
  165. package/dist/src/useDisplays.js.map +1 -0
  166. package/dist/src/useHandledKeys.d.ts +38 -0
  167. package/dist/src/useHandledKeys.d.ts.map +1 -0
  168. package/dist/src/useHandledKeys.js +70 -0
  169. package/dist/src/useHandledKeys.js.map +1 -0
  170. package/dist/src/useWindow.d.ts +140 -0
  171. package/dist/src/useWindow.d.ts.map +1 -0
  172. package/dist/src/useWindow.js +233 -0
  173. package/dist/src/useWindow.js.map +1 -0
  174. package/dist/tsconfig.tsbuildinfo +1 -0
  175. package/native/CMakeLists.txt +355 -0
  176. package/native/bootstrap.sh +613 -0
  177. package/native/cmake/CompilerFlags.cmake +49 -0
  178. package/native/cmake/Expo.cmake +125 -0
  179. package/native/cmake/ReactNativeCore.cmake +612 -0
  180. package/native/cmake/Reanimated.cmake +108 -0
  181. package/native/cmake/Skia.cmake +379 -0
  182. package/native/cmake/ThirdParty.cmake +290 -0
  183. package/native/cmake/Worklets.cmake +67 -0
  184. package/native/cmake/codegen/CMakeLists.txt +32 -0
  185. package/native/core/AppIdentity.cpp +85 -0
  186. package/native/core/AppIdentity.h +59 -0
  187. package/native/core/AppPaths.cpp +96 -0
  188. package/native/core/AppPaths.h +53 -0
  189. package/native/core/AppearanceModule.cpp +60 -0
  190. package/native/core/AppearanceModule.h +40 -0
  191. package/native/core/Backface.h +59 -0
  192. package/native/core/BlobModule.cpp +283 -0
  193. package/native/core/BlobModule.h +76 -0
  194. package/native/core/BlobRegistry.cpp +75 -0
  195. package/native/core/BlobRegistry.h +44 -0
  196. package/native/core/ColorScheme.cpp +105 -0
  197. package/native/core/ColorScheme.h +59 -0
  198. package/native/core/ComponentRegistry.h +30 -0
  199. package/native/core/ControlMetrics.h +37 -0
  200. package/native/core/CoreModules.cpp +592 -0
  201. package/native/core/CoreModules.h +308 -0
  202. package/native/core/DebuggingOverlay.cpp +106 -0
  203. package/native/core/DebuggingOverlay.h +65 -0
  204. package/native/core/DesktopControls.cpp +232 -0
  205. package/native/core/DesktopControls.h +170 -0
  206. package/native/core/DevBundle.cpp +108 -0
  207. package/native/core/DevBundle.h +69 -0
  208. package/native/core/DevMenu.cpp +99 -0
  209. package/native/core/DevMenu.h +75 -0
  210. package/native/core/DialogModule.cpp +150 -0
  211. package/native/core/DialogModule.h +51 -0
  212. package/native/core/DragAndDrop.cpp +45 -0
  213. package/native/core/DragAndDrop.h +225 -0
  214. package/native/core/ExpoImageComponent.cpp +79 -0
  215. package/native/core/ExpoImageComponent.h +80 -0
  216. package/native/core/ExpoModules.cpp +415 -0
  217. package/native/core/ExpoModules.h +115 -0
  218. package/native/core/ExpoRuntime.cpp +366 -0
  219. package/native/core/ExpoRuntime.h +42 -0
  220. package/native/core/FocusRing.h +36 -0
  221. package/native/core/FontRegistry.h +51 -0
  222. package/native/core/GestureHandlerModule.cpp +136 -0
  223. package/native/core/GestureHandlerModule.h +71 -0
  224. package/native/core/Gestures.cpp +533 -0
  225. package/native/core/Gestures.h +145 -0
  226. package/native/core/HoverTracker.cpp +69 -0
  227. package/native/core/HoverTracker.h +109 -0
  228. package/native/core/HttpClient.cpp +282 -0
  229. package/native/core/ImageBytes.cpp +205 -0
  230. package/native/core/ImageBytes.h +29 -0
  231. package/native/core/ImageCache.cpp +51 -0
  232. package/native/core/ImageCache.h +89 -0
  233. package/native/core/JsRuntimeAccess.cpp +70 -0
  234. package/native/core/JsRuntimeAccess.h +60 -0
  235. package/native/core/JsiPromise.h +51 -0
  236. package/native/core/KeyEvents.cpp +116 -0
  237. package/native/core/KeyEvents.h +144 -0
  238. package/native/core/LogBoxSurface.cpp +46 -0
  239. package/native/core/LogBoxSurface.h +68 -0
  240. package/native/core/MenuModel.h +117 -0
  241. package/native/core/MenuModule.cpp +209 -0
  242. package/native/core/MenuModule.h +66 -0
  243. package/native/core/MountingWalk.h +524 -0
  244. package/native/core/PackageModules.cpp.in +25 -0
  245. package/native/core/PackageModules.h +50 -0
  246. package/native/core/PlatformConstantsModule.cpp +63 -0
  247. package/native/core/PlatformConstantsModule.h +64 -0
  248. package/native/core/PlatformServices.h +213 -0
  249. package/native/core/PointerButtons.h +63 -0
  250. package/native/core/PullToRefresh.cpp +57 -0
  251. package/native/core/PullToRefresh.h +73 -0
  252. package/native/core/ReanimatedCompat.h +47 -0
  253. package/native/core/ReanimatedModule.cpp +203 -0
  254. package/native/core/ReanimatedModule.h +55 -0
  255. package/native/core/ScrollAnimation.cpp +59 -0
  256. package/native/core/ScrollAnimation.h +70 -0
  257. package/native/core/ScrollBounds.cpp +26 -0
  258. package/native/core/ScrollBounds.h +68 -0
  259. package/native/core/ScrollIndicator.cpp +50 -0
  260. package/native/core/ScrollIndicator.h +69 -0
  261. package/native/core/ScrollMomentum.cpp +71 -0
  262. package/native/core/ScrollMomentum.h +73 -0
  263. package/native/core/ScrollSnap.cpp +123 -0
  264. package/native/core/ScrollSnap.h +80 -0
  265. package/native/core/ShareFallback.cpp +101 -0
  266. package/native/core/ShareFallback.h +45 -0
  267. package/native/core/SkiaPictureViewComponent.cpp +11 -0
  268. package/native/core/SkiaPictureViewComponent.h +47 -0
  269. package/native/core/SourceCodeModule.cpp +55 -0
  270. package/native/core/SourceCodeModule.h +53 -0
  271. package/native/core/StatusBarModule.cpp +23 -0
  272. package/native/core/StatusBarModule.h +42 -0
  273. package/native/core/TestDialog.cpp +148 -0
  274. package/native/core/TestDialog.h +96 -0
  275. package/native/core/TestKeys.cpp +78 -0
  276. package/native/core/TestKeys.h +50 -0
  277. package/native/core/TestQuitFile.cpp +33 -0
  278. package/native/core/TestQuitFile.h +60 -0
  279. package/native/core/TestSettle.h +192 -0
  280. package/native/core/TitleBarRegions.h +31 -0
  281. package/native/core/TurboModuleProxy.cpp +51 -0
  282. package/native/core/TurboModuleProxy.h +46 -0
  283. package/native/core/UIManagerAccess.cpp +43 -0
  284. package/native/core/UIManagerAccess.h +43 -0
  285. package/native/core/WindowBoundsCache.cpp +319 -0
  286. package/native/core/WindowControl.h +235 -0
  287. package/native/core/WindowHost.h +158 -0
  288. package/native/core/WindowMethods.cpp +167 -0
  289. package/native/core/WindowMethods.h +84 -0
  290. package/native/core/WindowsModule.cpp +448 -0
  291. package/native/core/WindowsModule.h +133 -0
  292. package/native/core/WorkletsModule.cpp +199 -0
  293. package/native/core/WorkletsModule.h +57 -0
  294. package/native/core/portability_probe.cpp +210 -0
  295. package/native/tests/EventRecorder.h +124 -0
  296. package/native/tests/TestHarness.cpp +109 -0
  297. package/native/tests/TestHarness.h +89 -0
  298. package/native/tests/TreeDump.h +49 -0
  299. package/native/tests/test_app_identity.cpp +114 -0
  300. package/native/tests/test_app_paths.cpp +48 -0
  301. package/native/tests/test_appearance.cpp +107 -0
  302. package/native/tests/test_backface.cpp +79 -0
  303. package/native/tests/test_blobs.cpp +157 -0
  304. package/native/tests/test_controls.cpp +185 -0
  305. package/native/tests/test_devbundle.cpp +103 -0
  306. package/native/tests/test_drag_and_drop.cpp +143 -0
  307. package/native/tests/test_gestures.cpp +331 -0
  308. package/native/tests/test_hover.cpp +92 -0
  309. package/native/tests/test_image_cache.cpp +109 -0
  310. package/native/tests/test_js_runtime_access.cpp +137 -0
  311. package/native/tests/test_key_events.cpp +235 -0
  312. package/native/tests/test_momentum.cpp +138 -0
  313. package/native/tests/test_quit_file.cpp +104 -0
  314. package/native/tests/test_scroll_animation.cpp +120 -0
  315. package/native/tests/test_scroll_bounds.cpp +66 -0
  316. package/native/tests/test_scroll_indicator.cpp +149 -0
  317. package/native/tests/test_scroll_snap.cpp +112 -0
  318. package/native/tests/test_settle.cpp +115 -0
  319. package/native/tests/test_share.cpp +75 -0
  320. package/native/tests/test_sourcecode.cpp +62 -0
  321. package/native/tests/test_window_close.cpp +119 -0
  322. package/native/tests/test_window_limits.cpp +123 -0
  323. package/package.json +43 -0
  324. package/react-native.config.js +86 -0
  325. package/supported-versions.json +66 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Window.d.ts","sourceRoot":"","sources":["../../src/Window.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAC,mBAAmB,EAAW,MAAM,gBAAgB,CAAC;AAElE,mFAAmF;AACnF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC7C,CAAC;AAiBF,6DAA6D;AAC7D,eAAO,MAAM,WAAW,SAAwB,CAAC;AAyDjD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,cAAc,GACf,EAAE,WAAW,GAAG,IAAI,CAwGpB;yBA/Ge,MAAM"}
@@ -0,0 +1,248 @@
1
+ /**
2
+ * A second window.
3
+ *
4
+ * <Window title="Preview" width={600} height={400} onClose={hide}>
5
+ * <Preview id={id} />
6
+ * </Window>
7
+ *
8
+ * Mount it and a window opens; unmount it and the window closes. React Native
9
+ * has no API for this because a phone has one window and it is the screen.
10
+ *
11
+ * ## A window is a React root
12
+ *
13
+ * That is Fabric's grain rather than a decision this makes: a surface is what
14
+ * has a size, a layout context and a root shadow node, and two windows sharing
15
+ * one would be two windows sharing a layout. So a second window runs a second
16
+ * React tree, and `<Window>`'s children are rendered *there* rather than where
17
+ * they were written.
18
+ *
19
+ * Which has a consequence worth stating plainly, because it is the one thing
20
+ * that will surprise people: **the children do not see React context from the
21
+ * tree they were written in.** A theme provider, a navigation container or a
22
+ * Redux store wrapping the `<Window>` is not wrapping its children. What does
23
+ * cross is props -- the elements themselves are passed through, so anything
24
+ * captured in a closure or given as a prop arrives intact, including state and
25
+ * callbacks:
26
+ *
27
+ * const [count, setCount] = useState(0);
28
+ * <Window><Text onPress={() => setCount(count + 1)}>{count}</Text></Window>
29
+ *
30
+ * works, and re-renders the window when `count` changes. A `useContext` inside
31
+ * `<Preview>` does not. An app that needs context in a window should pass the
32
+ * value as a prop and re-provide it inside.
33
+ *
34
+ * ## `onClose`
35
+ *
36
+ * Called when the *person* closed the window -- its own close button, or the
37
+ * window manager -- and not when the app unmounted the `<Window>`. An app that
38
+ * unmounted it already knows.
39
+ *
40
+ * It is the half that keeps the two sides agreeing: without it an app's `open`
41
+ * flag would stay true after the window had gone, the next render would try to
42
+ * close a window that closed itself, and the window could never be reopened.
43
+ *
44
+ * ## `onCloseRequest`
45
+ *
46
+ * <Window onCloseRequest={close => (dirty ? ask() : close())}>
47
+ *
48
+ * The other half of `onClose`, and the earlier one: somebody is *trying* to
49
+ * close the window and it has not closed. A `<Window>` with this prop refuses
50
+ * every close the window manager asks for and reports the attempt instead, so
51
+ * the app can ask "are you sure".
52
+ *
53
+ * There are two ways to then say yes, and they are not the same one written
54
+ * twice. Unmounting the `<Window>` is the React-shaped one and usually right --
55
+ * the window is a render of some state, and agreeing to close it is that state
56
+ * changing. The `close` the handler is handed is the other, for when the app
57
+ * has no such state to change, and it closes the window without `onClose`,
58
+ * because an app that just said yes is not waiting to be told.
59
+ *
60
+ * `onClose` is unaffected by any of this: it still means the person closed the
61
+ * window, which now only happens when there is no handler to refuse it.
62
+ *
63
+ * `useWindow()` inside a second window's tree still reports the *active*
64
+ * window, not the one it is in; that is a real gap and is in docs/BACKLOG.md.
65
+ *
66
+ * @format
67
+ */
68
+ 'use strict';
69
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
70
+ if (k2 === undefined) k2 = k;
71
+ var desc = Object.getOwnPropertyDescriptor(m, k);
72
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
73
+ desc = { enumerable: true, get: function() { return m[k]; } };
74
+ }
75
+ Object.defineProperty(o, k2, desc);
76
+ }) : (function(o, m, k, k2) {
77
+ if (k2 === undefined) k2 = k;
78
+ o[k2] = m[k];
79
+ }));
80
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
81
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
82
+ }) : function(o, v) {
83
+ o["default"] = v;
84
+ });
85
+ var __importStar = (this && this.__importStar) || (function () {
86
+ var ownKeys = function(o) {
87
+ ownKeys = Object.getOwnPropertyNames || function (o) {
88
+ var ar = [];
89
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
90
+ return ar;
91
+ };
92
+ return ownKeys(o);
93
+ };
94
+ return function (mod) {
95
+ if (mod && mod.__esModule) return mod;
96
+ var result = {};
97
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
98
+ __setModuleDefault(result, mod);
99
+ return result;
100
+ };
101
+ })();
102
+ Object.defineProperty(exports, "__esModule", { value: true });
103
+ exports.isSupported = void 0;
104
+ exports.Window = Window;
105
+ const React = __importStar(require("react"));
106
+ const react_native_1 = require("react-native");
107
+ const closeRequest_1 = require("./closeRequest");
108
+ const NativeWindows = react_native_1.TurboModuleRegistry.get('BasaltWindows');
109
+ /** Whether this platform can open a second window at all. */
110
+ exports.isSupported = NativeWindows != null;
111
+ // What each open window is rendering, by the id `<Window>` gave it, and who to
112
+ // tell when it changes. Module level because the two ends are in different
113
+ // React roots and have no ancestor in common -- which is the whole situation.
114
+ // Must match kWindowClosedEvent in native/core/WindowsModule.h.
115
+ const CLOSED_EVENT = 'basaltWindowClosed';
116
+ const contents = new Map();
117
+ const listeners = new Map();
118
+ let nextId = 1;
119
+ function setContent(id, children) {
120
+ contents.set(id, children);
121
+ const listener = listeners.get(id);
122
+ if (listener != null) {
123
+ listener(children);
124
+ }
125
+ }
126
+ /**
127
+ * The component every second window runs.
128
+ *
129
+ * Registered once, under a name an app will not collide with. It renders
130
+ * whatever its `<Window>` currently has as children, and subscribes so that a
131
+ * re-render of the first tree reaches the second.
132
+ */
133
+ function WindowContent({ basaltWindowId }) {
134
+ const [children, setChildren] = React.useState(() => contents.get(basaltWindowId) ?? null);
135
+ React.useEffect(() => {
136
+ listeners.set(basaltWindowId, setChildren);
137
+ // Read again on mount: the first tree may have re-rendered between the
138
+ // window opening and this root evaluating, and the map is the truth.
139
+ setChildren(contents.get(basaltWindowId) ?? null);
140
+ return () => {
141
+ listeners.delete(basaltWindowId);
142
+ };
143
+ }, [basaltWindowId]);
144
+ return children;
145
+ }
146
+ const CONTENT_COMPONENT = 'BasaltWindowContent';
147
+ let registered = false;
148
+ function ensureRegistered() {
149
+ if (registered || !exports.isSupported) {
150
+ return;
151
+ }
152
+ registered = true;
153
+ react_native_1.AppRegistry.registerComponent(CONTENT_COMPONENT, () => WindowContent);
154
+ }
155
+ function Window({ title, width, height, children, onClose, onCloseRequest, }) {
156
+ const id = React.useRef(null);
157
+ if (id.current == null) {
158
+ id.current = nextId++;
159
+ }
160
+ const windowId = id.current;
161
+ // Written during render rather than in an effect, so that the second root
162
+ // never renders a frame behind the first. Rendering is not supposed to have
163
+ // effects; this one is a write to a map the other root reads, which is the
164
+ // narrowest version of what a portal does.
165
+ setContent(windowId, children);
166
+ // The surface id the host gave us, which is what closes the window. Kept in a
167
+ // ref rather than in state: nothing renders differently for it.
168
+ const surfaceId = React.useRef(null);
169
+ // And the same id in state, which `onCloseRequest` needs. A ref changing is
170
+ // not a render, and the intercept has to be registered once the host has
171
+ // answered with an id -- which is a promise later than the effect that asked
172
+ // for the window. Two homes for one number, because the two readers want
173
+ // different things from it.
174
+ const [opened, setOpened] = React.useState(null);
175
+ // In a ref so that the subscription below does not have to be torn down and
176
+ // rebuilt every time an app passes a new closure, which is every render.
177
+ const onCloseRef = React.useRef(onClose);
178
+ onCloseRef.current = onClose;
179
+ // Deliberately not depending on title, width or height. They are how a window
180
+ // *opens*, and re-opening one because its title changed would be a new window
181
+ // in a new place. Changing them afterwards is `useWindow()`'s job.
182
+ // Closed by the person rather than by the app -- its own close button, or the
183
+ // window manager. The window is already gone by the time this arrives; what
184
+ // it is for is telling the app, so its state stops saying the window is open.
185
+ //
186
+ // Without it the next render would try to close a window that closed itself,
187
+ // and an app whose `open` flag never cleared could never reopen one.
188
+ React.useEffect(() => {
189
+ if (!exports.isSupported) {
190
+ return;
191
+ }
192
+ const subscription = react_native_1.DeviceEventEmitter.addListener(CLOSED_EVENT, closedId => {
193
+ if (closedId !== surfaceId.current) {
194
+ return;
195
+ }
196
+ // Forgotten first, so the cleanup below does not ask the host to close a
197
+ // window that is already gone.
198
+ surfaceId.current = null;
199
+ setOpened(null);
200
+ if (onCloseRef.current != null) {
201
+ onCloseRef.current();
202
+ }
203
+ });
204
+ return () => subscription.remove();
205
+ }, []);
206
+ // Asked before it closes, if the app wants to be. See closeRequest.js.
207
+ (0, closeRequest_1.useCloseRequestFor)(() => opened,
208
+ // `isSupported` is what proves the module is here.
209
+ (closing) => NativeWindows.close(closing), onCloseRequest, [opened]);
210
+ React.useEffect(() => {
211
+ if (!exports.isSupported) {
212
+ return;
213
+ }
214
+ ensureRegistered();
215
+ let closed = false;
216
+ NativeWindows.open({
217
+ component: CONTENT_COMPONENT,
218
+ title: title ?? '',
219
+ width: width ?? 900,
220
+ height: height ?? 700,
221
+ props: { basaltWindowId: windowId },
222
+ }).then((openedId) => {
223
+ // Unmounted while the window was opening, which is a race a fast app
224
+ // really does lose: close what was opened rather than leaking it.
225
+ if (closed) {
226
+ if (openedId != null) {
227
+ NativeWindows.close(openedId);
228
+ }
229
+ return;
230
+ }
231
+ surfaceId.current = openedId;
232
+ setOpened(openedId);
233
+ });
234
+ return () => {
235
+ closed = true;
236
+ if (surfaceId.current != null) {
237
+ NativeWindows.close(surfaceId.current);
238
+ surfaceId.current = null;
239
+ }
240
+ contents.delete(windowId);
241
+ listeners.delete(windowId);
242
+ };
243
+ // eslint-disable-next-line react-hooks/exhaustive-deps
244
+ }, [windowId]);
245
+ return null;
246
+ }
247
+ Window.isSupported = exports.isSupported;
248
+ //# sourceMappingURL=Window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Window.js","sourceRoot":"","sources":["../../src/Window.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAEH,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Fb,wBA+GC;AA3MD,6CAA+B;AAE/B,+CAAkF;AAElF,iDAAkD;AA4BlD,MAAM,aAAa,GAAG,kCAAmB,CAAC,GAAG,CAAsB,eAAe,CAAC,CAAC;AAEpF,6DAA6D;AAChD,QAAA,WAAW,GAAG,aAAa,IAAI,IAAI,CAAC;AAEjD,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,gEAAgE;AAChE,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;AACpD,MAAM,SAAS,GAAG,IAAI,GAAG,EAA+C,CAAC;AAEzE,IAAI,M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,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,IAAI,CAAC;YACd,IAAI,SAAS,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;gBAC9B,aAAc,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACxC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;YAC3B,CAAC;YACD,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC;QACF,uDAAuD;IACzD,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,WAAW,GAAG,mBAAW,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Being asked before a window closes.
3
+ *
4
+ * The shared half of `useCloseRequest()` and `<Window onCloseRequest>`: they
5
+ * are the same mechanism pointed at two different windows, and the only thing
6
+ * that differs is which id and how it closes.
7
+ *
8
+ * ## Why a registration rather than a returned `false`
9
+ *
10
+ * Electron spells this `event.preventDefault()` in a `close` handler, and can,
11
+ * because its handler runs in the main process and the answer is there the
12
+ * moment the event is raised. Here the handler is JavaScript on another thread
13
+ * and the window manager wants a synchronous yes or no -- so the decision has
14
+ * to exist *before* the attempt. Registering a handler is what makes it exist:
15
+ * the host then refuses every close and reports the attempt, and the app closes
16
+ * the window itself when it is ready.
17
+ *
18
+ * The cost is that a window with a handler never closes on its own, which is
19
+ * why the handler is given the thing that does.
20
+ *
21
+ * @format
22
+ */
23
+ /** A window's id, as the host hands them out. */
24
+ export type WindowId = number;
25
+ /**
26
+ * What the handler is given: call it to let the close through. It stops
27
+ * intercepting first, so the close it then asks for is not refused by the
28
+ * registration that produced the question.
29
+ */
30
+ export type AllowClose = () => void;
31
+ export type CloseRequestHandler = (close: AllowClose) => void;
32
+ /** Whether this platform can be asked at all. */
33
+ export declare const isSupported: boolean;
34
+ /**
35
+ * The window the app started in.
36
+ *
37
+ * Asked rather than assumed: `getWindows()` answers main window first, which is
38
+ * the same ordering the host keeps its records in. The fallback is the constant
39
+ * every host uses for it, for a platform with no windows module -- where the
40
+ * whole thing is a no-op anyway.
41
+ */
42
+ export declare function mainWindowId(): WindowId;
43
+ /**
44
+ * Ask to be asked, and hear about it.
45
+ *
46
+ * `getId` is a function rather than a number because a second window's id
47
+ * arrives from a promise: the hook may run before the window exists. Returning
48
+ * null means "not yet", and `deps` is what re-runs this once it is.
49
+ *
50
+ * `close` is what the handler is handed. It stops intercepting first, so that
51
+ * the close it then asks for is not refused by the registration that produced
52
+ * the question -- an app that answers "yes" once should not be asked again.
53
+ */
54
+ export declare function useCloseRequestFor(getId: () => WindowId | null | undefined, close: (id: WindowId) => void, handler: CloseRequestHandler | null | undefined, deps: ReadonlyArray<unknown>): void;
55
+ //# sourceMappingURL=closeRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closeRequest.d.ts","sourceRoot":"","sources":["../../src/closeRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAY9D,iDAAiD;AACjD,eAAO,MAAM,WAAW,SAAwC,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAGvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,EACxC,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,IAAI,EAC7B,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAC/C,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,GAC3B,IAAI,CAkDN"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * Being asked before a window closes.
4
+ *
5
+ * The shared half of `useCloseRequest()` and `<Window onCloseRequest>`: they
6
+ * are the same mechanism pointed at two different windows, and the only thing
7
+ * that differs is which id and how it closes.
8
+ *
9
+ * ## Why a registration rather than a returned `false`
10
+ *
11
+ * Electron spells this `event.preventDefault()` in a `close` handler, and can,
12
+ * because its handler runs in the main process and the answer is there the
13
+ * moment the event is raised. Here the handler is JavaScript on another thread
14
+ * and the window manager wants a synchronous yes or no -- so the decision has
15
+ * to exist *before* the attempt. Registering a handler is what makes it exist:
16
+ * the host then refuses every close and reports the attempt, and the app closes
17
+ * the window itself when it is ready.
18
+ *
19
+ * The cost is that a window with a handler never closes on its own, which is
20
+ * why the handler is given the thing that does.
21
+ *
22
+ * @format
23
+ */
24
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ var desc = Object.getOwnPropertyDescriptor(m, k);
27
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
+ desc = { enumerable: true, get: function() { return m[k]; } };
29
+ }
30
+ Object.defineProperty(o, k2, desc);
31
+ }) : (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ o[k2] = m[k];
34
+ }));
35
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
36
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
37
+ }) : function(o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar = (this && this.__importStar) || (function () {
41
+ var ownKeys = function(o) {
42
+ ownKeys = Object.getOwnPropertyNames || function (o) {
43
+ var ar = [];
44
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
45
+ return ar;
46
+ };
47
+ return ownKeys(o);
48
+ };
49
+ return function (mod) {
50
+ if (mod && mod.__esModule) return mod;
51
+ var result = {};
52
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
53
+ __setModuleDefault(result, mod);
54
+ return result;
55
+ };
56
+ })();
57
+ Object.defineProperty(exports, "__esModule", { value: true });
58
+ exports.isSupported = void 0;
59
+ exports.mainWindowId = mainWindowId;
60
+ exports.useCloseRequestFor = useCloseRequestFor;
61
+ const React = __importStar(require("react"));
62
+ const react_native_1 = require("react-native");
63
+ const NativeWindows = react_native_1.TurboModuleRegistry.get('BasaltWindows');
64
+ // Must match kWindowCloseRequestedEvent in native/core/WindowsModule.h.
65
+ const CLOSE_REQUESTED_EVENT = 'basaltWindowCloseRequested';
66
+ /** Whether this platform can be asked at all. */
67
+ exports.isSupported = NativeWindows?.interceptClose != null;
68
+ /**
69
+ * The window the app started in.
70
+ *
71
+ * Asked rather than assumed: `getWindows()` answers main window first, which is
72
+ * the same ordering the host keeps its records in. The fallback is the constant
73
+ * every host uses for it, for a platform with no windows module -- where the
74
+ * whole thing is a no-op anyway.
75
+ */
76
+ function mainWindowId() {
77
+ const open = NativeWindows?.getWindows?.();
78
+ return Array.isArray(open) && open.length > 0 ? open[0] : 1;
79
+ }
80
+ /**
81
+ * Ask to be asked, and hear about it.
82
+ *
83
+ * `getId` is a function rather than a number because a second window's id
84
+ * arrives from a promise: the hook may run before the window exists. Returning
85
+ * null means "not yet", and `deps` is what re-runs this once it is.
86
+ *
87
+ * `close` is what the handler is handed. It stops intercepting first, so that
88
+ * the close it then asks for is not refused by the registration that produced
89
+ * the question -- an app that answers "yes" once should not be asked again.
90
+ */
91
+ function useCloseRequestFor(getId, close, handler, deps) {
92
+ const handlerRef = React.useRef(handler);
93
+ handlerRef.current = handler;
94
+ // In a ref for the same reason, and it matters less only because both callers
95
+ // pass something that closes over nothing. Reading it through a ref is what
96
+ // keeps that from being load-bearing.
97
+ const closeRef = React.useRef(close);
98
+ closeRef.current = close;
99
+ // Whether there is a handler at all, rather than which one. An app passes a
100
+ // new closure every render and re-registering on each would be a subscription
101
+ // torn down and rebuilt for nothing.
102
+ const wanted = handler != null;
103
+ React.useEffect(() => {
104
+ if (!exports.isSupported || !wanted) {
105
+ return;
106
+ }
107
+ const id = getId();
108
+ if (id == null) {
109
+ return;
110
+ }
111
+ // `isSupported` above is what proves these are here; it is computed at
112
+ // module scope from the same optional call, which the compiler cannot
113
+ // follow.
114
+ NativeWindows.interceptClose(id, true);
115
+ const subscription = react_native_1.DeviceEventEmitter.addListener(CLOSE_REQUESTED_EVENT, (requestedId) => {
116
+ if (requestedId !== id) {
117
+ return;
118
+ }
119
+ handlerRef.current?.(() => {
120
+ NativeWindows.interceptClose(id, false);
121
+ closeRef.current(id);
122
+ });
123
+ });
124
+ return () => {
125
+ // Stop intercepting on the way out. A window whose app stopped listening
126
+ // and went on refusing every close would be a window that cannot be
127
+ // closed at all, which is a worse bug than the one this prevents.
128
+ NativeWindows.interceptClose(id, false);
129
+ subscription.remove();
130
+ };
131
+ // eslint-disable-next-line react-hooks/exhaustive-deps
132
+ }, [wanted, ...deps]);
133
+ }
134
+ //# sourceMappingURL=closeRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closeRequest.js","sourceRoot":"","sources":["../../src/closeRequest.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCH,oCAGC;AAaD,gDAuDC;AA5GD,6CAA+B;AAE/B,+CAAqE;AAmBrE,MAAM,aAAa,GAAG,kCAAmB,CAAC,GAAG,CAAsB,eAAe,CAAC,CAAC;AAEpF,wEAAwE;AACxE,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAE3D,iDAAiD;AACpC,QAAA,WAAW,GAAG,aAAa,EAAE,cAAc,IAAI,IAAI,CAAC;AAEjE;;;;;;;GAOG;AACH,SAAgB,YAAY;IAC1B,MAAM,IAAI,GAAG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AE,EAAE,KAAK,CAAC,CAAC;gBAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,yEAAyE;YACzE,oEAAoE;YACpE,kEAAkE;YAClE,aAAc,CAAC,cAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAC1C,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;QACF,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * basalt-core
3
+ *
4
+ * What this platform adds to React Native, and nothing else. Components come
5
+ * from `react-native` exactly as they do on iOS and Android; this is where the
6
+ * few things with no React Native equivalent live.
7
+ *
8
+ * It used to re-export all of `react-native` as well, and that is worth saying
9
+ * why it no longer does, because the failure was quiet until something imported
10
+ * this file. Babel compiles `export * from 'react-native'` into a loop that
11
+ * reads every one of React Native's exports once -- and most of them are lazy
12
+ * getters, which run their module's top level when read. So importing this
13
+ * package loaded every deprecated component (and printed every deprecation
14
+ * warning), and loaded DevMenu, whose getEnforcing throws on a host with no
15
+ * DevMenu module. That throw aborted the importing module, which in an Expo app
16
+ * is App.js, and the app stopped at "App entry not found". Nothing had imported
17
+ * this file before the title bar gave apps a reason to.
18
+ *
19
+ * @format
20
+ */
21
+ export { default as Platform } from './overrides/Platform';
22
+ export { useDialog, dialog } from './useDialog';
23
+ export { resourcePath } from './resourcePath';
24
+ export type { Dialog, DialogFilter, DialogOptions, DialogResult } from './useDialog';
25
+ export { Menu } from './Menu';
26
+ export type { MenuItemProps, MenuProps, MenuRole, MenuSubmenuProps } from './Menu';
27
+ export { useContextMenu, contextMenu } from './useContextMenu';
28
+ export type { ContextMenu, ContextMenuItem, ContextMenuPoint } from './useContextMenu';
29
+ export { Window } from './Window';
30
+ export type { WindowProps } from './Window';
31
+ export { useWindow, useCloseRequest, windowControl } from './useWindow';
32
+ export { useQuitRequest, quit } from './quitRequest';
33
+ export { useDisplays, displays, primaryDisplay, pointerPosition } from './useDisplays';
34
+ export { DropTarget, dropTargetId } from './DropTarget';
35
+ export { KeyHandler } from './KeyHandler';
36
+ export { DragSource, dragSourceId } from './DragSource';
37
+ export type { DragSourceProps } from './DragSource';
38
+ export type { DropPayload, DropPoint, DropTargetProps } from './DropTarget';
39
+ export type { HandledKey, KeyHandlerProps, PressedKey } from './KeyHandler';
40
+ export type { Display, PointerPosition } from './useDisplays';
41
+ export type { AllowQuit, QuitRequestHandler } from './quitRequest';
42
+ export type { CloseRequestHandler, UseWindow, WindowBounds, WindowCapabilities, WindowControl, WindowId, } from './useWindow';
43
+ export { TitleBar, useTitleBar, useTitleBarMetrics } from './TitleBar';
44
+ export type { TitleBarMetrics, TitleBarOptions, TitleBarStyle } from './TitleBar';
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAInF,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,YAAY,EAAC,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAGjF,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAC,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGrF,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,YAAY,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAI1C,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAItE,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAInD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAIrF,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAGtD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACtD,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,EAAC,WAAW,EAAE,SAAS,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAC1E,YAAY,EAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC1E,YAAY,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAC5D,YAAY,EAAC,SAAS,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,QAAQ,GACT,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACrE,YAAY,EAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * basalt-core
3
+ *
4
+ * What this platform adds to React Native, and nothing else. Components come
5
+ * from `react-native` exactly as they do on iOS and Android; this is where the
6
+ * few things with no React Native equivalent live.
7
+ *
8
+ * It used to re-export all of `react-native` as well, and that is worth saying
9
+ * why it no longer does, because the failure was quiet until something imported
10
+ * this file. Babel compiles `export * from 'react-native'` into a loop that
11
+ * reads every one of React Native's exports once -- and most of them are lazy
12
+ * getters, which run their module's top level when read. So importing this
13
+ * package loaded every deprecated component (and printed every deprecation
14
+ * warning), and loaded DevMenu, whose getEnforcing throws on a host with no
15
+ * DevMenu module. That throw aborted the importing module, which in an Expo app
16
+ * is App.js, and the app stopped at "App entry not found". Nothing had imported
17
+ * this file before the title bar gave apps a reason to.
18
+ *
19
+ * @format
20
+ */
21
+ 'use strict';
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.useTitleBarMetrics = exports.useTitleBar = exports.TitleBar = exports.dragSourceId = exports.DragSource = exports.KeyHandler = exports.dropTargetId = exports.DropTarget = exports.pointerPosition = exports.primaryDisplay = exports.displays = exports.useDisplays = exports.quit = exports.useQuitRequest = exports.windowControl = exports.useCloseRequest = exports.useWindow = exports.Window = exports.contextMenu = exports.useContextMenu = exports.Menu = exports.resourcePath = exports.dialog = exports.useDialog = exports.Platform = void 0;
27
+ // Extensionless on purpose: Metro picks Platform.linux.js, Platform.macos.js or
28
+ // Platform.windows.js by the platform being bundled for, which is the same
29
+ // mechanism React Native uses for its own and means this line never has to know
30
+ // how many desktops there are.
31
+ var Platform_1 = require("./overrides/Platform");
32
+ Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return __importDefault(Platform_1).default; } });
33
+ // The native file dialogs, which React Native has no API for: a phone has none.
34
+ // See useDialog.js.
35
+ var useDialog_1 = require("./useDialog");
36
+ Object.defineProperty(exports, "useDialog", { enumerable: true, get: function () { return useDialog_1.useDialog; } });
37
+ Object.defineProperty(exports, "dialog", { enumerable: true, get: function () { return useDialog_1.dialog; } });
38
+ // Where a packaged app's own files are; see resourcePath.ts.
39
+ var resourcePath_1 = require("./resourcePath");
40
+ Object.defineProperty(exports, "resourcePath", { enumerable: true, get: function () { return resourcePath_1.resourcePath; } });
41
+ // The application menu. On macOS it is also what makes Cmd-C reach a text
42
+ // field, which is why an app gets one whether or not it renders a <Menu>. See
43
+ // Menu.js.
44
+ var Menu_1 = require("./Menu");
45
+ Object.defineProperty(exports, "Menu", { enumerable: true, get: function () { return Menu_1.Menu; } });
46
+ // A context menu, which every desktop has -- including the one with no menu
47
+ // bar. See useContextMenu.js.
48
+ var useContextMenu_1 = require("./useContextMenu");
49
+ Object.defineProperty(exports, "useContextMenu", { enumerable: true, get: function () { return useContextMenu_1.useContextMenu; } });
50
+ Object.defineProperty(exports, "contextMenu", { enumerable: true, get: function () { return useContextMenu_1.contextMenu; } });
51
+ // A second window, which is a second surface and so a second React root. See
52
+ // Window.js for what that costs and what it does not.
53
+ var Window_1 = require("./Window");
54
+ Object.defineProperty(exports, "Window", { enumerable: true, get: function () { return Window_1.Window; } });
55
+ // The window itself: its size, how big it may be, its position, whether it
56
+ // fills the screen, live bounds, and being asked before it closes. See
57
+ // useWindow.js.
58
+ var useWindow_1 = require("./useWindow");
59
+ Object.defineProperty(exports, "useWindow", { enumerable: true, get: function () { return useWindow_1.useWindow; } });
60
+ Object.defineProperty(exports, "useCloseRequest", { enumerable: true, get: function () { return useWindow_1.useCloseRequest; } });
61
+ Object.defineProperty(exports, "windowControl", { enumerable: true, get: function () { return useWindow_1.windowControl; } });
62
+ // Being asked before the *application* quits, which the window half above
63
+ // does not cover: see src/quitRequest.ts.
64
+ var quitRequest_1 = require("./quitRequest");
65
+ Object.defineProperty(exports, "useQuitRequest", { enumerable: true, get: function () { return quitRequest_1.useQuitRequest; } });
66
+ Object.defineProperty(exports, "quit", { enumerable: true, get: function () { return quitRequest_1.quit; } });
67
+ // What screens the desktop has, which React Native's Dimensions does not
68
+ // answer: see src/useDisplays.ts.
69
+ var useDisplays_1 = require("./useDisplays");
70
+ Object.defineProperty(exports, "useDisplays", { enumerable: true, get: function () { return useDisplays_1.useDisplays; } });
71
+ Object.defineProperty(exports, "displays", { enumerable: true, get: function () { return useDisplays_1.displays; } });
72
+ Object.defineProperty(exports, "primaryDisplay", { enumerable: true, get: function () { return useDisplays_1.primaryDisplay; } });
73
+ Object.defineProperty(exports, "pointerPosition", { enumerable: true, get: function () { return useDisplays_1.pointerPosition; } });
74
+ // Accepting a file or text dragged onto the app, which React Native has no
75
+ // API for: see src/DropTarget.tsx.
76
+ var DropTarget_1 = require("./DropTarget");
77
+ Object.defineProperty(exports, "DropTarget", { enumerable: true, get: function () { return DropTarget_1.DropTarget; } });
78
+ Object.defineProperty(exports, "dropTargetId", { enumerable: true, get: function () { return DropTarget_1.dropTargetId; } });
79
+ // Keyboard shortcuts on a view, which React Native has only inside a
80
+ // <TextInput>. See src/KeyHandler.tsx.
81
+ var KeyHandler_1 = require("./KeyHandler");
82
+ Object.defineProperty(exports, "KeyHandler", { enumerable: true, get: function () { return KeyHandler_1.KeyHandler; } });
83
+ var DragSource_1 = require("./DragSource");
84
+ Object.defineProperty(exports, "DragSource", { enumerable: true, get: function () { return DragSource_1.DragSource; } });
85
+ Object.defineProperty(exports, "dragSourceId", { enumerable: true, get: function () { return DragSource_1.dragSourceId; } });
86
+ // The window's title bar: its title and colours, and a hidden style that lets
87
+ // the app draw its own header. See TitleBar.js.
88
+ var TitleBar_1 = require("./TitleBar");
89
+ Object.defineProperty(exports, "TitleBar", { enumerable: true, get: function () { return TitleBar_1.TitleBar; } });
90
+ Object.defineProperty(exports, "useTitleBar", { enumerable: true, get: function () { return TitleBar_1.useTitleBar; } });
91
+ Object.defineProperty(exports, "useTitleBarMetrics", { enumerable: true, get: function () { return TitleBar_1.useTitleBarMetrics; } });
92
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,YAAY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