@ng-native/desktop 0.0.0 → 0.24.0

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 (401) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -0
  3. package/app.plugin.cjs +17 -0
  4. package/bin/app-config.mjs +168 -0
  5. package/bin/autolink.mjs +224 -0
  6. package/bin/cli.mjs +158 -0
  7. package/bin/host.mjs +427 -0
  8. package/bin/ng-native-desktop.mjs +4 -0
  9. package/bin/package.mjs +971 -0
  10. package/bin/plist.mjs +68 -0
  11. package/bin/prebuilt.mjs +328 -0
  12. package/bin/toolchain.mjs +192 -0
  13. package/native/CMakeLists.txt +277 -0
  14. package/native/appkit/CMakeLists.txt +130 -0
  15. package/native/appkit/address-search.h +26 -0
  16. package/native/appkit/address-search.mm +277 -0
  17. package/native/appkit/animation-frames.h +14 -0
  18. package/native/appkit/animation-frames.mm +106 -0
  19. package/native/appkit/app-info.h +12 -0
  20. package/native/appkit/app-info.mm +98 -0
  21. package/native/appkit/app-updater.mm +128 -0
  22. package/native/appkit/app-windows.h +81 -0
  23. package/native/appkit/app-windows.mm +318 -0
  24. package/native/appkit/appkit-backend.h +73 -0
  25. package/native/appkit/appkit-backend.mm +276 -0
  26. package/native/appkit/apple-authentication.h +19 -0
  27. package/native/appkit/apple-authentication.mm +248 -0
  28. package/native/appkit/apple-button-view.h +10 -0
  29. package/native/appkit/apple-button-view.mm +37 -0
  30. package/native/appkit/apple-id-button.h +16 -0
  31. package/native/appkit/apple-id-button.mm +50 -0
  32. package/native/appkit/audio.h +16 -0
  33. package/native/appkit/audio.mm +275 -0
  34. package/native/appkit/battery.h +13 -0
  35. package/native/appkit/battery.mm +92 -0
  36. package/native/appkit/bookmarks.h +17 -0
  37. package/native/appkit/bookmarks.mm +145 -0
  38. package/native/appkit/calendar.h +25 -0
  39. package/native/appkit/calendar.mm +660 -0
  40. package/native/appkit/camera-sheet.h +59 -0
  41. package/native/appkit/camera-sheet.mm +344 -0
  42. package/native/appkit/camera-view.h +15 -0
  43. package/native/appkit/camera-view.mm +134 -0
  44. package/native/appkit/camera.h +61 -0
  45. package/native/appkit/camera.mm +496 -0
  46. package/native/appkit/cg-canvas.h +24 -0
  47. package/native/appkit/cg-canvas.mm +663 -0
  48. package/native/appkit/component-view.h +17 -0
  49. package/native/appkit/crypto.h +19 -0
  50. package/native/appkit/crypto.mm +78 -0
  51. package/native/appkit/desktop-expo.h +29 -0
  52. package/native/appkit/desktop-expo.mm +385 -0
  53. package/native/appkit/expo-image-drawing.h +46 -0
  54. package/native/appkit/expo-image-drawing.mm +131 -0
  55. package/native/appkit/expo-image-view.h +15 -0
  56. package/native/appkit/expo-image-view.mm +182 -0
  57. package/native/appkit/expo-ui-renderer.h +68 -0
  58. package/native/appkit/expo-ui-renderer.mm +101 -0
  59. package/native/appkit/expo-ui-view.h +26 -0
  60. package/native/appkit/expo-ui-view.mm +134 -0
  61. package/native/appkit/expo-ui.swift +1284 -0
  62. package/native/appkit/file-system.h +16 -0
  63. package/native/appkit/file-system.mm +140 -0
  64. package/native/appkit/fonts.h +12 -0
  65. package/native/appkit/fonts.mm +48 -0
  66. package/native/appkit/geocoder.h +19 -0
  67. package/native/appkit/geocoder.mm +101 -0
  68. package/native/appkit/glass-effect.h +22 -0
  69. package/native/appkit/glass-effect.mm +63 -0
  70. package/native/appkit/glass-view.h +8 -0
  71. package/native/appkit/glass-view.mm +65 -0
  72. package/native/appkit/header-toolbar.h +60 -0
  73. package/native/appkit/header-toolbar.mm +632 -0
  74. package/native/appkit/host-view.h +54 -0
  75. package/native/appkit/host-view.mm +1228 -0
  76. package/native/appkit/image-manipulator.h +14 -0
  77. package/native/appkit/image-manipulator.mm +191 -0
  78. package/native/appkit/image-request.h +22 -0
  79. package/native/appkit/image-request.mm +62 -0
  80. package/native/appkit/image-view.h +8 -0
  81. package/native/appkit/image-view.mm +142 -0
  82. package/native/appkit/input-replay.h +25 -0
  83. package/native/appkit/input-replay.mm +418 -0
  84. package/native/appkit/language-model.h +14 -0
  85. package/native/appkit/language-model.mm +99 -0
  86. package/native/appkit/language-model.swift +472 -0
  87. package/native/appkit/local-authentication.h +15 -0
  88. package/native/appkit/local-authentication.mm +133 -0
  89. package/native/appkit/location.h +16 -0
  90. package/native/appkit/location.mm +214 -0
  91. package/native/appkit/main.mm +1475 -0
  92. package/native/appkit/map-view.h +15 -0
  93. package/native/appkit/map-view.mm +109 -0
  94. package/native/appkit/maps.h +35 -0
  95. package/native/appkit/maps.mm +343 -0
  96. package/native/appkit/menu-bar.h +22 -0
  97. package/native/appkit/menu-bar.mm +208 -0
  98. package/native/appkit/modal-focus.h +16 -0
  99. package/native/appkit/modal-focus.mm +26 -0
  100. package/native/appkit/modal-host-view.h +79 -0
  101. package/native/appkit/modal-host-view.mm +442 -0
  102. package/native/appkit/native-controls.h +22 -0
  103. package/native/appkit/native-controls.mm +431 -0
  104. package/native/appkit/network-state.h +12 -0
  105. package/native/appkit/network-state.mm +64 -0
  106. package/native/appkit/network.h +14 -0
  107. package/native/appkit/network.mm +396 -0
  108. package/native/appkit/notifications.h +19 -0
  109. package/native/appkit/notifications.mm +309 -0
  110. package/native/appkit/photo-library.h +33 -0
  111. package/native/appkit/photo-library.mm +548 -0
  112. package/native/appkit/pointer-buttons.h +32 -0
  113. package/native/appkit/presentation-label.h +15 -0
  114. package/native/appkit/presentation-label.mm +12 -0
  115. package/native/appkit/presented-screen.h +19 -0
  116. package/native/appkit/presented-screen.mm +181 -0
  117. package/native/appkit/printing.h +42 -0
  118. package/native/appkit/printing.mm +393 -0
  119. package/native/appkit/push.h +19 -0
  120. package/native/appkit/push.mm +81 -0
  121. package/native/appkit/red-box.h +26 -0
  122. package/native/appkit/red-box.mm +387 -0
  123. package/native/appkit/screen-capture.h +21 -0
  124. package/native/appkit/screen-capture.mm +92 -0
  125. package/native/appkit/scroll-view.h +13 -0
  126. package/native/appkit/scroll-view.mm +251 -0
  127. package/native/appkit/scrollers.h +25 -0
  128. package/native/appkit/scrollers.mm +43 -0
  129. package/native/appkit/search-field.h +34 -0
  130. package/native/appkit/search-field.mm +291 -0
  131. package/native/appkit/search-toolbar-item.h +19 -0
  132. package/native/appkit/search-toolbar-item.mm +269 -0
  133. package/native/appkit/share-picker.h +34 -0
  134. package/native/appkit/share-picker.mm +121 -0
  135. package/native/appkit/split-view.h +77 -0
  136. package/native/appkit/split-view.mm +1206 -0
  137. package/native/appkit/store-review.h +13 -0
  138. package/native/appkit/store-review.mm +28 -0
  139. package/native/appkit/surface-view.h +45 -0
  140. package/native/appkit/surface-view.mm +562 -0
  141. package/native/appkit/svg-view.h +18 -0
  142. package/native/appkit/svg-view.mm +103 -0
  143. package/native/appkit/symbol-drawing.h +24 -0
  144. package/native/appkit/symbol-drawing.mm +117 -0
  145. package/native/appkit/symbol-view.h +8 -0
  146. package/native/appkit/symbol-view.mm +33 -0
  147. package/native/appkit/system-access.h +34 -0
  148. package/native/appkit/system-access.mm +210 -0
  149. package/native/appkit/system.h +24 -0
  150. package/native/appkit/system.mm +403 -0
  151. package/native/appkit/tab-walk.h +31 -0
  152. package/native/appkit/tab-walk.mm +64 -0
  153. package/native/appkit/test-launch.h +36 -0
  154. package/native/appkit/test-launch.mm +115 -0
  155. package/native/appkit/text-input-field.h +81 -0
  156. package/native/appkit/text-input-field.mm +525 -0
  157. package/native/appkit/text-layout.h +58 -0
  158. package/native/appkit/text-layout.mm +485 -0
  159. package/native/appkit/text-recognition.h +13 -0
  160. package/native/appkit/text-recognition.mm +102 -0
  161. package/native/appkit/tracking.h +13 -0
  162. package/native/appkit/tracking.mm +51 -0
  163. package/native/appkit/tray-and-dock.h +45 -0
  164. package/native/appkit/tray-and-dock.mm +130 -0
  165. package/native/appkit/undo.h +23 -0
  166. package/native/appkit/undo.mm +125 -0
  167. package/native/appkit/updates.h +17 -0
  168. package/native/appkit/updates.mm +71 -0
  169. package/native/appkit/video-view.h +10 -0
  170. package/native/appkit/video-view.mm +42 -0
  171. package/native/appkit/video.h +38 -0
  172. package/native/appkit/video.mm +404 -0
  173. package/native/appkit/web-browser.h +12 -0
  174. package/native/appkit/web-browser.mm +97 -0
  175. package/native/appkit/web-view-component.h +10 -0
  176. package/native/appkit/web-view-component.mm +62 -0
  177. package/native/appkit/web-view.h +31 -0
  178. package/native/appkit/web-view.mm +401 -0
  179. package/native/cmake/libraries/react-native-reanimated.cmake +45 -0
  180. package/native/cmake/libraries/react-native-worklets.cmake +46 -0
  181. package/native/cmake/libraries.cmake +109 -0
  182. package/native/cmake/linked-modules.cmake +112 -0
  183. package/native/cmake/react-native.cmake +175 -0
  184. package/native/cmake/runtime-dependencies.cmake +34 -0
  185. package/native/cmake/swift.cmake +43 -0
  186. package/native/cmake/third-party.cmake +74 -0
  187. package/native/core/include/ngn/absent-views.h +27 -0
  188. package/native/core/include/ngn/accessibility.h +140 -0
  189. package/native/core/include/ngn/address-search.h +69 -0
  190. package/native/core/include/ngn/animation-frames.h +39 -0
  191. package/native/core/include/ngn/app-info.h +52 -0
  192. package/native/core/include/ngn/app-menus.h +151 -0
  193. package/native/core/include/ngn/app-windows.h +181 -0
  194. package/native/core/include/ngn/apple-authentication.h +116 -0
  195. package/native/core/include/ngn/asset.h +28 -0
  196. package/native/core/include/ngn/audio.h +125 -0
  197. package/native/core/include/ngn/back-swipe.h +121 -0
  198. package/native/core/include/ngn/battery.h +48 -0
  199. package/native/core/include/ngn/bytes.h +59 -0
  200. package/native/core/include/ngn/calendar.h +180 -0
  201. package/native/core/include/ngn/camera.h +222 -0
  202. package/native/core/include/ngn/control-sizes.h +111 -0
  203. package/native/core/include/ngn/core-modules.h +108 -0
  204. package/native/core/include/ngn/crypto.h +38 -0
  205. package/native/core/include/ngn/default-menu.h +91 -0
  206. package/native/core/include/ngn/desktop-expo.h +193 -0
  207. package/native/core/include/ngn/desktop-modal.h +109 -0
  208. package/native/core/include/ngn/desktop-props.h +75 -0
  209. package/native/core/include/ngn/desktop-view-props.h +110 -0
  210. package/native/core/include/ngn/dev-server.h +33 -0
  211. package/native/core/include/ngn/dom-web-view.h +53 -0
  212. package/native/core/include/ngn/download.h +24 -0
  213. package/native/core/include/ngn/expo-image.h +192 -0
  214. package/native/core/include/ngn/expo-ui.h +133 -0
  215. package/native/core/include/ngn/file-system.h +274 -0
  216. package/native/core/include/ngn/focus-order.h +63 -0
  217. package/native/core/include/ngn/fonts.h +64 -0
  218. package/native/core/include/ngn/gestures.h +305 -0
  219. package/native/core/include/ngn/glass.h +67 -0
  220. package/native/core/include/ngn/header-bar.h +112 -0
  221. package/native/core/include/ngn/host-state.h +243 -0
  222. package/native/core/include/ngn/image-manipulator.h +70 -0
  223. package/native/core/include/ngn/input-dispatcher.h +211 -0
  224. package/native/core/include/ngn/input-script.h +56 -0
  225. package/native/core/include/ngn/input.h +112 -0
  226. package/native/core/include/ngn/key-value-store.h +41 -0
  227. package/native/core/include/ngn/language-model.h +69 -0
  228. package/native/core/include/ngn/launch-frame.h +47 -0
  229. package/native/core/include/ngn/launch-settings.h +98 -0
  230. package/native/core/include/ngn/layout-animations.h +24 -0
  231. package/native/core/include/ngn/library-components.h +13 -0
  232. package/native/core/include/ngn/library-glue.h +53 -0
  233. package/native/core/include/ngn/live-regions.h +54 -0
  234. package/native/core/include/ngn/local-authentication.h +74 -0
  235. package/native/core/include/ngn/location.h +89 -0
  236. package/native/core/include/ngn/maps.h +226 -0
  237. package/native/core/include/ngn/module-registry.h +51 -0
  238. package/native/core/include/ngn/mounting-backend.h +96 -0
  239. package/native/core/include/ngn/mounting-manager.h +155 -0
  240. package/native/core/include/ngn/native-controls.h +161 -0
  241. package/native/core/include/ngn/native-module.h +109 -0
  242. package/native/core/include/ngn/network-state.h +44 -0
  243. package/native/core/include/ngn/network.h +100 -0
  244. package/native/core/include/ngn/notifications.h +185 -0
  245. package/native/core/include/ngn/photo-library.h +134 -0
  246. package/native/core/include/ngn/printing.h +69 -0
  247. package/native/core/include/ngn/processes.h +114 -0
  248. package/native/core/include/ngn/red-box.h +119 -0
  249. package/native/core/include/ngn/reload-thread.h +258 -0
  250. package/native/core/include/ngn/runtime.h +163 -0
  251. package/native/core/include/ngn/safe-areas.h +82 -0
  252. package/native/core/include/ngn/screen-capture.h +35 -0
  253. package/native/core/include/ngn/screen-presentation.h +85 -0
  254. package/native/core/include/ngn/screen-stacks.h +80 -0
  255. package/native/core/include/ngn/scrollers.h +106 -0
  256. package/native/core/include/ngn/sharing.h +39 -0
  257. package/native/core/include/ngn/spawn-rules.h +78 -0
  258. package/native/core/include/ngn/splash-screen.h +41 -0
  259. package/native/core/include/ngn/split-view.h +270 -0
  260. package/native/core/include/ngn/sqlite.h +38 -0
  261. package/native/core/include/ngn/store-review.h +26 -0
  262. package/native/core/include/ngn/surface-book.h +101 -0
  263. package/native/core/include/ngn/surface-metrics.h +51 -0
  264. package/native/core/include/ngn/svg.h +434 -0
  265. package/native/core/include/ngn/symbol.h +90 -0
  266. package/native/core/include/ngn/system.h +102 -0
  267. package/native/core/include/ngn/tabs-host.h +171 -0
  268. package/native/core/include/ngn/text-input.h +134 -0
  269. package/native/core/include/ngn/text-measurer.h +38 -0
  270. package/native/core/include/ngn/text-recognition.h +55 -0
  271. package/native/core/include/ngn/tracking.h +34 -0
  272. package/native/core/include/ngn/tray-and-dock.h +107 -0
  273. package/native/core/include/ngn/undo.h +37 -0
  274. package/native/core/include/ngn/updates.h +253 -0
  275. package/native/core/include/ngn/video.h +126 -0
  276. package/native/core/include/ngn/view-box.h +126 -0
  277. package/native/core/include/ngn/view-transform.h +26 -0
  278. package/native/core/include/ngn/view-tree.h +85 -0
  279. package/native/core/include/ngn/web-browser.h +45 -0
  280. package/native/core/include/ngn/web-view.h +137 -0
  281. package/native/core/include/ngn/worklet-host.h +98 -0
  282. package/native/core/src/absent-views.cpp +41 -0
  283. package/native/core/src/accessibility.cpp +374 -0
  284. package/native/core/src/animation-frames.cpp +49 -0
  285. package/native/core/src/app-menus.cpp +359 -0
  286. package/native/core/src/app-windows.cpp +444 -0
  287. package/native/core/src/back-swipe.cpp +98 -0
  288. package/native/core/src/bytes.cpp +158 -0
  289. package/native/core/src/control-sizes.cpp +232 -0
  290. package/native/core/src/default-menu.cpp +96 -0
  291. package/native/core/src/desktop-modal.cpp +162 -0
  292. package/native/core/src/desktop-view-props.cpp +80 -0
  293. package/native/core/src/dev-server-helper.cpp +152 -0
  294. package/native/core/src/dev-server.cpp +103 -0
  295. package/native/core/src/dom-web-view.cpp +45 -0
  296. package/native/core/src/download.cpp +53 -0
  297. package/native/core/src/expo-image.cpp +548 -0
  298. package/native/core/src/expo-ui.cpp +203 -0
  299. package/native/core/src/focus-order.cpp +441 -0
  300. package/native/core/src/gestures.cpp +1806 -0
  301. package/native/core/src/glass.cpp +49 -0
  302. package/native/core/src/header-bar.cpp +104 -0
  303. package/native/core/src/host-services.cpp +50 -0
  304. package/native/core/src/host-state.cpp +61 -0
  305. package/native/core/src/input-dispatcher.cpp +727 -0
  306. package/native/core/src/input-script.cpp +123 -0
  307. package/native/core/src/key-value-store.cpp +169 -0
  308. package/native/core/src/launch-settings.cpp +148 -0
  309. package/native/core/src/layout-animations.cpp +62 -0
  310. package/native/core/src/libraries/RNCWebViewSpec.cpp +80 -0
  311. package/native/core/src/libraries/react-native-reanimated.cpp +216 -0
  312. package/native/core/src/libraries/react-native-worklets.cpp +192 -0
  313. package/native/core/src/libraries/rnscreens.cpp +125 -0
  314. package/native/core/src/libraries/rnsvg.cpp +358 -0
  315. package/native/core/src/libraries/safeareacontext.cpp +70 -0
  316. package/native/core/src/libraries/worklets-idle-frames.js +70 -0
  317. package/native/core/src/library-glue.cpp +35 -0
  318. package/native/core/src/live-regions.cpp +122 -0
  319. package/native/core/src/module-registry.cpp +50 -0
  320. package/native/core/src/modules/accessibility-manager.cpp +98 -0
  321. package/native/core/src/modules/address-search.cpp +219 -0
  322. package/native/core/src/modules/alert-manager.cpp +140 -0
  323. package/native/core/src/modules/app-info.cpp +74 -0
  324. package/native/core/src/modules/app-modules.cpp +412 -0
  325. package/native/core/src/modules/apple-authentication.cpp +188 -0
  326. package/native/core/src/modules/asset.cpp +111 -0
  327. package/native/core/src/modules/async-storage.cpp +192 -0
  328. package/native/core/src/modules/audio.cpp +541 -0
  329. package/native/core/src/modules/battery.cpp +88 -0
  330. package/native/core/src/modules/calendar.cpp +457 -0
  331. package/native/core/src/modules/camera.cpp +401 -0
  332. package/native/core/src/modules/core-modules.cpp +62 -0
  333. package/native/core/src/modules/crypto.cpp +117 -0
  334. package/native/core/src/modules/desktop-expo.cpp +527 -0
  335. package/native/core/src/modules/file-system.cpp +941 -0
  336. package/native/core/src/modules/fonts.cpp +163 -0
  337. package/native/core/src/modules/image-loader.cpp +105 -0
  338. package/native/core/src/modules/image-manipulator.cpp +305 -0
  339. package/native/core/src/modules/language-model.cpp +195 -0
  340. package/native/core/src/modules/local-authentication.cpp +140 -0
  341. package/native/core/src/modules/location.cpp +186 -0
  342. package/native/core/src/modules/maps.cpp +500 -0
  343. package/native/core/src/modules/network-state.cpp +72 -0
  344. package/native/core/src/modules/networking.cpp +387 -0
  345. package/native/core/src/modules/notifications.cpp +549 -0
  346. package/native/core/src/modules/photo-library.cpp +385 -0
  347. package/native/core/src/modules/printing.cpp +201 -0
  348. package/native/core/src/modules/screen-capture.cpp +71 -0
  349. package/native/core/src/modules/sharing.cpp +59 -0
  350. package/native/core/src/modules/splash-screen.cpp +70 -0
  351. package/native/core/src/modules/sqlite.cpp +421 -0
  352. package/native/core/src/modules/store-review.cpp +23 -0
  353. package/native/core/src/modules/text-recognition.cpp +107 -0
  354. package/native/core/src/modules/tracking.cpp +46 -0
  355. package/native/core/src/modules/undo.cpp +59 -0
  356. package/native/core/src/modules/video.cpp +366 -0
  357. package/native/core/src/modules/web-browser.cpp +100 -0
  358. package/native/core/src/modules/web-socket.cpp +266 -0
  359. package/native/core/src/mounting-manager.cpp +384 -0
  360. package/native/core/src/native-controls.cpp +129 -0
  361. package/native/core/src/native-module.cpp +250 -0
  362. package/native/core/src/network.cpp +219 -0
  363. package/native/core/src/posix-launcher.cpp +366 -0
  364. package/native/core/src/processes.cpp +324 -0
  365. package/native/core/src/red-box-errors.js +83 -0
  366. package/native/core/src/red-box.cpp +306 -0
  367. package/native/core/src/runtime.cpp +420 -0
  368. package/native/core/src/safe-areas.cpp +137 -0
  369. package/native/core/src/screen-presentation.cpp +61 -0
  370. package/native/core/src/screen-stacks.cpp +254 -0
  371. package/native/core/src/scrollers.cpp +181 -0
  372. package/native/core/src/spawn-rules.cpp +292 -0
  373. package/native/core/src/split-view.cpp +343 -0
  374. package/native/core/src/svg.cpp +2190 -0
  375. package/native/core/src/symbol.cpp +94 -0
  376. package/native/core/src/tabs-host.cpp +234 -0
  377. package/native/core/src/text-input.cpp +139 -0
  378. package/native/core/src/text-layout-manager.cpp +63 -0
  379. package/native/core/src/tray-and-dock.cpp +154 -0
  380. package/native/core/src/updates.cpp +965 -0
  381. package/native/core/src/view-box.cpp +788 -0
  382. package/native/core/src/view-transform.cpp +45 -0
  383. package/native/core/src/view-tree.cpp +234 -0
  384. package/native/core/src/web-view.cpp +143 -0
  385. package/native/core/src/worklet-host.cpp +10 -0
  386. package/native/scripts/build-hermes.sh +44 -0
  387. package/native/scripts/build.sh +175 -0
  388. package/native/scripts/cache-dir.sh +18 -0
  389. package/native/scripts/codegen-library.sh +193 -0
  390. package/native/scripts/compiler-launcher.sh +17 -0
  391. package/native/scripts/fetch.sh +174 -0
  392. package/native/scripts/hermes-built.sh +10 -0
  393. package/native/scripts/host-dir.sh +16 -0
  394. package/native/scripts/launch-probe.sh +60 -0
  395. package/native/scripts/macos-target.sh +8 -0
  396. package/native/scripts/make-prebuilt.mjs +360 -0
  397. package/native/scripts/prebuilt-host-cache.mjs +158 -0
  398. package/native/shim/openssl/sha.h +22 -0
  399. package/native/shim/view-platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +37 -0
  400. package/package.json +73 -1
  401. package/prebuilt.json +33 -0
@@ -0,0 +1,80 @@
1
+ // react-native-screens' native stack, the same on every toolkit: every screen of an
2
+ // RNSScreenStack stays mounted, the top one (its last screen) is shown, and those below it are
3
+ // covered: not drawn and not hit, with their views and state kept for when they return.
4
+ //
5
+ // A screen that comes to the top hears willAppear then appear, which is what the router sets
6
+ // SCREEN_SHOWN from, and the screen it covers hears willDisappear then disappear. Push and pop swap
7
+ // at once, so each pair is sent together, in UIKit's order. A popped screen is already gone and
8
+ // hears nothing, as on iOS when JavaScript pops.
9
+ #pragma once
10
+
11
+ #include "ngn/back-swipe.h"
12
+ #include "ngn/view-tree.h"
13
+
14
+ #include <optional>
15
+ #include <unordered_map>
16
+ #include <unordered_set>
17
+ #include <vector>
18
+
19
+ namespace ngn {
20
+
21
+ class ScreenStacks {
22
+ public:
23
+ virtual ~ScreenStacks() = default;
24
+
25
+ // A view's children changed. Settled with the transaction, so a push that inserts and removes
26
+ // in one commit is one change.
27
+ void childrenChanged(const ViewTree &tree, Tag parent);
28
+ // A screen's props changed: its presentation may have (screen-presentation.h).
29
+ void propsChanged(const ViewTree &tree, Tag tag);
30
+ void deleted(Tag tag);
31
+
32
+ struct Covered {
33
+ Tag tag;
34
+ bool covered;
35
+ };
36
+ // Settles every stack whose screens changed since the last call: marks the screens covered or
37
+ // not in `tree`, sends the events, and returns the screens whose covered state changed, for the
38
+ // backend to hide or show.
39
+ //
40
+ // A presented screen (screen-presentation.h) does not cover the screens under it: those below
41
+ // the last pushed screen are covered, and the presented ones over it are each presented.
42
+ std::vector<Covered> settle(ViewTree &tree);
43
+
44
+ // The screens that came to be presented (covered = true) or stopped being presented since the
45
+ // last call, as settle found them.
46
+ std::vector<Covered> takePresented();
47
+
48
+ // The top screen of a stack, or -1.
49
+ Tag top(Tag stack) const;
50
+
51
+ // The header a container shows: the RNSScreenStackHeaderConfig of the last pushed screen of the
52
+ // innermost stack (a presented screen draws its own) in the container that has one (a window has one toolbar, and the screen in
53
+ // front fills it). Stacks under a covered screen or in a container of their own do not count,
54
+ // but for the content pane of a split view or a tabs host, which is the window's content.
55
+ struct FrontHeader {
56
+ Tag config{-1};
57
+ Tag screen{-1};
58
+ // Whether the screen has one below it to go back to.
59
+ bool canGoBack{false};
60
+ bool operator==(const FrontHeader &) const = default;
61
+ };
62
+ std::optional<FrontHeader> frontHeader(const ViewTree &tree, Tag root) const;
63
+
64
+ // What a back swipe in `root`'s window moves: the innermost stack in the window's content with a
65
+ // screen below its last pushed one, and nothing presented over it. Nothing when that screen has
66
+ // `gestureEnabled: false` or `stackAnimation: none`, as on iOS.
67
+ std::optional<BackSwipeTarget> backSwipeTarget(const ViewTree &tree, Tag root) const;
68
+
69
+ protected:
70
+ // Where events leave the core: through the view's event emitter by default, recorded in tests.
71
+ virtual void emit(const ViewTree::Node &node, const char *event);
72
+
73
+ private:
74
+ std::unordered_set<Tag> dirty_;
75
+ std::unordered_map<Tag, Tag> tops_;
76
+ std::unordered_set<Tag> presented_;
77
+ std::vector<Covered> presentedChanges_;
78
+ };
79
+
80
+ } // namespace ngn
@@ -0,0 +1,106 @@
1
+ // Scroll bars that follow the user's "Show scroll bars" setting. Overlay scrollers float over the
2
+ // content; legacy ones (the setting's "Always", or "Automatically" with a mouse) take a strip of
3
+ // the scroll view, so the content has to be laid out that much narrower, as a browser does for a
4
+ // classic scroll bar.
5
+ //
6
+ // The toolkit says which style is in force and how wide a legacy scroller is, and each mounted
7
+ // scroll view reports the gutter its scrollers take (scrollerGutter). DesktopScrollViewShadowNode
8
+ // reads its own as it is made or cloned and pads its content by it, so the toolkit asks for a new
9
+ // layout by updating the scroll view's state once its gutter has changed.
10
+ #pragma once
11
+
12
+ #include "ngn/desktop-props.h"
13
+
14
+ #include <react/renderer/components/scrollview/ScrollViewEventEmitter.h>
15
+ #include <react/renderer/components/scrollview/ScrollViewProps.h>
16
+ #include <react/renderer/components/scrollview/ScrollViewShadowNode.h>
17
+ #include <react/renderer/components/scrollview/ScrollViewState.h>
18
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
19
+ #include <react/renderer/graphics/Size.h>
20
+
21
+ #include <mutex>
22
+ #include <unordered_map>
23
+
24
+ namespace ngn {
25
+
26
+ enum class ScrollerStyle { Overlay, Legacy };
27
+
28
+ // What a scroll view's scrollers take from its content, in points: the vertical scroller's strip
29
+ // on the right, the horizontal one's at the bottom.
30
+ struct ScrollerGutter {
31
+ float right{0};
32
+ float bottom{0};
33
+ bool operator==(const ScrollerGutter &) const = default;
34
+ };
35
+
36
+ // Which scrollers a scroll view shows, and whether AppKit hides them when the content fits.
37
+ struct ScrollerVisibility {
38
+ bool vertical{false};
39
+ bool horizontal{false};
40
+ bool autohides{true};
41
+ bool operator==(const ScrollerVisibility &) const = default;
42
+ };
43
+
44
+ // A scroller along an axis the content overflows, or always the vertical one for
45
+ // `scrollbar-gutter: stable`; none for `scrollbar-width: none` or an indicator turned off.
46
+ ScrollerVisibility scrollerVisibility(
47
+ const DesktopProps &props,
48
+ bool showsVertical,
49
+ bool showsHorizontal,
50
+ facebook::react::Size content,
51
+ facebook::react::Size view);
52
+
53
+ // The gutter the visible scrollers take: their width for legacy scrollers, nothing for overlay.
54
+ ScrollerGutter scrollerGutter(ScrollerStyle style, float legacyWidth, const ScrollerVisibility &visibility);
55
+
56
+ // `style` with `gutter` added to the padding Yoga reads for the right and bottom edges in
57
+ // `direction`. A percentage or `auto` there is left alone.
58
+ facebook::yoga::Style withGutter(
59
+ const facebook::yoga::Style &style,
60
+ ScrollerGutter gutter,
61
+ facebook::yoga::Direction direction);
62
+
63
+ // The gutters of the mounted scroll views, by tag: set on the UI thread, read as Yoga lays out.
64
+ class ScrollerGutters {
65
+ public:
66
+ static ScrollerGutters &shared();
67
+ // True when the gutter changed, so the scroll view needs a new layout.
68
+ bool set(facebook::react::Tag tag, ScrollerGutter gutter);
69
+ ScrollerGutter get(facebook::react::Tag tag) const;
70
+ void remove(facebook::react::Tag tag);
71
+
72
+ private:
73
+ mutable std::mutex mutex_;
74
+ std::unordered_map<facebook::react::Tag, ScrollerGutter> gutters_;
75
+ };
76
+
77
+ // React Native's ScrollViewShadowNode (which is final), padding its content by its gutter.
78
+ class DesktopScrollViewShadowNode final : public facebook::react::ConcreteViewShadowNode<
79
+ facebook::react::ScrollViewComponentName,
80
+ facebook::react::ScrollViewProps,
81
+ facebook::react::ScrollViewEventEmitter,
82
+ facebook::react::ScrollViewState> {
83
+ public:
84
+ DesktopScrollViewShadowNode(
85
+ const facebook::react::ShadowNodeFragment &fragment,
86
+ const facebook::react::ShadowNodeFamily::Shared &family,
87
+ facebook::react::ShadowNodeTraits traits);
88
+ DesktopScrollViewShadowNode(
89
+ const facebook::react::ShadowNode &sourceShadowNode,
90
+ const facebook::react::ShadowNodeFragment &fragment);
91
+
92
+ static facebook::react::ScrollViewState initialStateData(
93
+ const facebook::react::Props::Shared &props,
94
+ const facebook::react::ShadowNodeFamily::Shared &family,
95
+ const facebook::react::ComponentDescriptor &componentDescriptor);
96
+
97
+ void layout(facebook::react::LayoutContext layoutContext) override;
98
+ facebook::react::Point getContentOriginOffset(bool includeTransform) const override;
99
+
100
+ private:
101
+ void applyGutter(facebook::yoga::Direction direction);
102
+ void updateStateIfNeeded();
103
+ void updateScrollContentOffsetIfNeeded();
104
+ };
105
+
106
+ } // namespace ngn
@@ -0,0 +1,39 @@
1
+ // NgNativeSharing: what @ng-native/device's Sharing calls on macOS, where React Native's Share has
2
+ // no implementation, over a SharePicker: AppKit's NSSharingServicePicker shown at the key window.
3
+ //
4
+ // - share({message, url, title}): {action: 'sharedAction', activityType} with the service the user
5
+ // shared through, or {action: 'dismissedAction', activityType: null}. A request with neither a
6
+ // message nor a url is refused, and one at a time is shown. With `noPrompts`
7
+ // (NGN_NO_PROMPTS=1) nothing is shown, and the share answers as dismissed.
8
+ //
9
+ // A file url is shared only inside the file boundary `files` draws (readableSource), and refused
10
+ // otherwise before anything is shown; without `files`, no file is shared.
11
+ #pragma once
12
+
13
+ #include "ngn/file-system.h"
14
+ #include "ngn/native-module.h"
15
+
16
+ #include <functional>
17
+ #include <memory>
18
+ #include <optional>
19
+ #include <string>
20
+
21
+ namespace ngn {
22
+
23
+ class SharePicker {
24
+ public:
25
+ struct Request {
26
+ std::optional<std::string> message;
27
+ std::optional<std::string> url;
28
+ std::optional<std::string> title;
29
+ };
30
+ virtual ~SharePicker() = default;
31
+ // Shows the picker; answers once, on any thread, with the service picked (its name, as
32
+ // NSSharingService's title), or nothing when it was dismissed.
33
+ virtual void show(const Request &request, std::function<void(std::optional<std::string> service)> done) = 0;
34
+ };
35
+
36
+ std::shared_ptr<NativeModule> makeSharingModule(
37
+ std::shared_ptr<SharePicker> picker, bool noPrompts = false, std::shared_ptr<FileAccess> files = nullptr);
38
+
39
+ } // namespace ngn
@@ -0,0 +1,78 @@
1
+ // The spawn capability rules, as @ng-native/device's spawn-rules.ts states them, enforced again in
2
+ // the core: a program the app spawns must match a capability its plugin options declared, whatever
3
+ // the JavaScript checked first. Each argument is a literal or a `{name:regex}` placeholder,
4
+ // anchored as a whole and never taking an option unless its pattern starts with `-`; a placeholder
5
+ // followed by `...` takes zero or more arguments. Shells and programs that run their arguments as
6
+ // a command are refused, a bare name runs only where it was pinned at startup on SEARCH_PATH, and
7
+ // no program or argument may hold a NUL.
8
+ #pragma once
9
+
10
+ #include <functional>
11
+ #include <map>
12
+ #include <optional>
13
+ #include <regex>
14
+ #include <stdexcept>
15
+ #include <string>
16
+ #include <vector>
17
+
18
+ namespace ngn {
19
+
20
+ struct SpawnCapability {
21
+ std::string program;
22
+ std::vector<std::string> args;
23
+ };
24
+
25
+ struct ArgumentRule {
26
+ bool placeholder{false};
27
+ // The literal, or the placeholder's name.
28
+ std::string value;
29
+ std::regex pattern;
30
+ // Whether the pattern itself starts with `-`, so the value may be an option.
31
+ bool option{false};
32
+ bool repeated{false};
33
+ };
34
+
35
+ struct CompiledCapability {
36
+ std::string program;
37
+ std::vector<ArgumentRule> args;
38
+ };
39
+
40
+ class SpawnRuleError : public std::runtime_error {
41
+ public:
42
+ using std::runtime_error::runtime_error;
43
+ };
44
+
45
+ extern const std::vector<std::string> kSearchPath;
46
+
47
+ // Why `program` cannot be declared, or nothing when it can.
48
+ std::optional<std::string> programProblem(const std::string &program);
49
+
50
+ // Throws SpawnRuleError on a bad declaration.
51
+ ArgumentRule parseArgument(const std::string &arg);
52
+ CompiledCapability compileCapability(const SpawnCapability &capability);
53
+
54
+ bool matchArguments(const std::vector<ArgumentRule> &rules, const std::vector<std::string> &args);
55
+
56
+ // The path to run for `program` with `args`, or nothing when no capability allows it. `program`
57
+ // is the declared path or name exactly; a bare name runs only where `resolved` pinned it.
58
+ std::optional<std::string> matchSpawn(
59
+ const std::vector<CompiledCapability> &capabilities,
60
+ const std::string &program,
61
+ const std::vector<std::string> &args,
62
+ const std::map<std::string, std::optional<std::string>> &resolved);
63
+
64
+ struct ProgramLookup {
65
+ std::function<bool(const std::string &path)> isExecutable;
66
+ // A developer tool stub that only runs xcrun, with no Command Line Tools to run.
67
+ std::function<bool(const std::string &path)> isStub;
68
+ };
69
+
70
+ // Where a declared program runs from, pinned once at startup, or nothing when it is absent.
71
+ std::optional<std::string> resolveProgram(const std::string &program, const ProgramLookup &lookup);
72
+
73
+ // Only the declared variables of `env`, and none holding a NUL.
74
+ std::map<std::string, std::string> filterEnvironment(
75
+ const std::map<std::string, std::string> &env,
76
+ const std::vector<std::string> &allowed);
77
+
78
+ } // namespace ngn
@@ -0,0 +1,41 @@
1
+ // The splash screen on macOS: the app's first windows, held hidden. A Mac app has no launch
2
+ // screen; its windows show when their first frame mounts. Holding the splash keeps them hidden
3
+ // past that, until the app hides the splash, so an app that loads fonts or data first never shows
4
+ // a window that is empty or set in the fallback face.
5
+ //
6
+ // NgNativeSplashScreen, what @ng-native/expo's splashScreen calls on expo-splash-screen:
7
+ // - preventAutoHideAsync(): holds the windows; true, or false once a window has already shown,
8
+ // when it is too late to hold anything, as expo-splash-screen answers once its screen is gone.
9
+ // - hideAsync(), hide(): shows the windows held, in the order they were ready.
10
+ // A reload, which ends the module, lets the windows go too.
11
+ #pragma once
12
+
13
+ #include "ngn/native-module.h"
14
+
15
+ #include <functional>
16
+ #include <memory>
17
+ #include <mutex>
18
+ #include <vector>
19
+
20
+ namespace ngn {
21
+
22
+ class SplashGate {
23
+ public:
24
+ // Holds what `show` is given from now on; false, holding nothing, once anything has shown.
25
+ bool hold();
26
+ // Runs the shows held, in order, and lets every later one run at once.
27
+ void release();
28
+ // Runs `show` now, or once the hold is released. On the caller's thread, or release()'s.
29
+ void show(std::function<void()> show);
30
+ bool held();
31
+
32
+ private:
33
+ std::mutex mutex_;
34
+ bool held_{false};
35
+ bool shown_{false};
36
+ std::vector<std::function<void()>> waiting_;
37
+ };
38
+
39
+ std::shared_ptr<NativeModule> makeSplashScreenModule(std::shared_ptr<SplashGate> gate);
40
+
41
+ } // namespace ngn
@@ -0,0 +1,270 @@
1
+ // `<split-view>` and its sidebar, the same on every toolkit: the components, what of them goes back
2
+ // into layout, and the source lists a toolkit draws.
3
+ //
4
+ // - NgNativeSplitView holds the sidebar pane (NgNativeSidebar) then the content pane
5
+ // (NgNativeSplitContent). The first split view in a window is the window's (on macOS its
6
+ // NSSplitViewController, with the full-height sidebar); one inside another split view, a modal or a
7
+ // tabs host is a plain split view in the content.
8
+ // - Each pane is a container of its own (input.h), sized by the toolkit: the size it reports goes
9
+ // back to the pane's shadow node as state, which lays it out at that size.
10
+ // - NgNativeSidebarSection and NgNativeSidebarItem are model objects: neighbouring sections in one
11
+ // parent are one source list, which the toolkit draws in their place. An item with children is a
12
+ // custom row, which the toolkit puts in a cell and whose width it reports as state. Yoga gives a
13
+ // section its title row's height and each row at least kSidebarRowHeight, so the space a source
14
+ // list takes in layout is the space it draws in.
15
+ #pragma once
16
+
17
+ #include "ngn/view-tree.h"
18
+
19
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
20
+ #include <react/renderer/components/view/ViewEventEmitter.h>
21
+ #include <react/renderer/components/view/ViewProps.h>
22
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
23
+
24
+ #include <string>
25
+ #include <unordered_map>
26
+ #include <unordered_set>
27
+ #include <vector>
28
+
29
+ namespace ngn {
30
+
31
+ extern const char SplitViewComponentName[];
32
+ extern const char SidebarComponentName[];
33
+ extern const char SplitContentComponentName[];
34
+ extern const char SidebarSectionComponentName[];
35
+ extern const char SidebarItemComponentName[];
36
+
37
+ // A source list's row, and a titled section's title row, in points.
38
+ constexpr facebook::react::Float kSidebarRowHeight = 28;
39
+ constexpr facebook::react::Float kSidebarHeaderHeight = 28;
40
+ // The sidebar's width before its toolkit or its autosave says otherwise.
41
+ constexpr facebook::react::Float kSidebarDefaultWidth = 240;
42
+
43
+ class SplitPaneProps final : public facebook::react::ViewProps {
44
+ public:
45
+ SplitPaneProps() = default;
46
+ SplitPaneProps(
47
+ const facebook::react::PropsParserContext &context,
48
+ const SplitPaneProps &sourceProps,
49
+ const facebook::react::RawProps &rawProps);
50
+
51
+ // The sidebar's own; the content pane has none of them.
52
+ bool collapsed{false};
53
+ // 0 for no bound.
54
+ facebook::react::Float paneMinWidth{0};
55
+ facebook::react::Float paneMaxWidth{0};
56
+ std::string autosaveName;
57
+ };
58
+
59
+ // The size the toolkit gives a pane, or a custom row's width (height unused). Zero until it reports.
60
+ struct SplitPaneState {
61
+ facebook::react::Size size{};
62
+ };
63
+
64
+ template <const char *Name>
65
+ using SplitPaneShadowNode = facebook::react::
66
+ ConcreteViewShadowNode<Name, SplitPaneProps, facebook::react::ViewEventEmitter, SplitPaneState>;
67
+
68
+ // A view sized by its toolkit (a pane, a tab's screen): it takes the size its state says,
69
+ // positioned absolutely, since its container places it.
70
+ template <class ShadowNodeT>
71
+ class ToolkitSizedComponentDescriptor final : public facebook::react::ConcreteComponentDescriptor<ShadowNodeT> {
72
+ using Base = facebook::react::ConcreteComponentDescriptor<ShadowNodeT>;
73
+
74
+ public:
75
+ using Base::Base;
76
+ void adopt(facebook::react::ShadowNode &shadowNode) const override {
77
+ const auto &state = static_cast<const typename ShadowNodeT::ConcreteState &>(*shadowNode.getState()).getData();
78
+ if (state.size.width > 0 && state.size.height > 0) {
79
+ auto &layoutable = static_cast<facebook::react::YogaLayoutableShadowNode &>(shadowNode);
80
+ layoutable.setPositionType(YGPositionTypeAbsolute);
81
+ layoutable.setSize(state.size);
82
+ }
83
+ Base::adopt(shadowNode);
84
+ }
85
+ };
86
+
87
+ template <const char *Name>
88
+ using SplitPaneComponentDescriptor = ToolkitSizedComponentDescriptor<SplitPaneShadowNode<Name>>;
89
+
90
+ using SidebarComponentDescriptor = SplitPaneComponentDescriptor<SidebarComponentName>;
91
+ using SplitContentComponentDescriptor = SplitPaneComponentDescriptor<SplitContentComponentName>;
92
+
93
+ class SplitViewShadowNode final : public facebook::react::ConcreteViewShadowNode<SplitViewComponentName> {
94
+ public:
95
+ using ConcreteViewShadowNode::ConcreteViewShadowNode;
96
+ };
97
+ using SplitViewComponentDescriptor = facebook::react::ConcreteComponentDescriptor<SplitViewShadowNode>;
98
+
99
+ class SidebarSectionProps final : public facebook::react::ViewProps {
100
+ public:
101
+ SidebarSectionProps() = default;
102
+ SidebarSectionProps(
103
+ const facebook::react::PropsParserContext &context,
104
+ const SidebarSectionProps &sourceProps,
105
+ const facebook::react::RawProps &rawProps);
106
+
107
+ std::string title;
108
+ bool collapsible{false};
109
+ };
110
+
111
+ // Whether the user folded the section away with its disclosure.
112
+ struct SidebarSectionState {
113
+ bool collapsed{false};
114
+ };
115
+
116
+ class SidebarSectionShadowNode final : public facebook::react::ConcreteViewShadowNode<
117
+ SidebarSectionComponentName,
118
+ SidebarSectionProps,
119
+ facebook::react::ViewEventEmitter,
120
+ SidebarSectionState> {
121
+ public:
122
+ using ConcreteViewShadowNode::ConcreteViewShadowNode;
123
+ // A titled section starts with its title row; a collapsed one is only that.
124
+ void applySourceListLayout() const;
125
+ };
126
+
127
+ class SidebarSectionComponentDescriptor final
128
+ : public facebook::react::ConcreteComponentDescriptor<SidebarSectionShadowNode> {
129
+ public:
130
+ using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
131
+ void adopt(facebook::react::ShadowNode &shadowNode) const override;
132
+ };
133
+
134
+ class SidebarItemProps final : public facebook::react::ViewProps {
135
+ public:
136
+ SidebarItemProps() = default;
137
+ SidebarItemProps(
138
+ const facebook::react::PropsParserContext &context,
139
+ const SidebarItemProps &sourceProps,
140
+ const facebook::react::RawProps &rawProps);
141
+
142
+ std::string label;
143
+ std::string badge;
144
+ std::string sfSymbol;
145
+ std::string drawable;
146
+ bool selected{false};
147
+ };
148
+
149
+ class SidebarItemShadowNode final : public facebook::react::ConcreteViewShadowNode<
150
+ SidebarItemComponentName,
151
+ SidebarItemProps,
152
+ facebook::react::ViewEventEmitter,
153
+ SplitPaneState> {
154
+ public:
155
+ using ConcreteViewShadowNode::ConcreteViewShadowNode;
156
+ // At least a row's height, and the width of the cell it is drawn in once the toolkit says.
157
+ void applySourceListLayout() const;
158
+ };
159
+
160
+ class SidebarItemComponentDescriptor final
161
+ : public facebook::react::ConcreteComponentDescriptor<SidebarItemShadowNode> {
162
+ public:
163
+ using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
164
+ void adopt(facebook::react::ShadowNode &shadowNode) const override;
165
+ };
166
+
167
+ // A source list as the toolkit draws it.
168
+ struct SidebarRow {
169
+ Tag tag{-1};
170
+ std::string label;
171
+ std::string badge;
172
+ std::string sfSymbol;
173
+ bool selected{false};
174
+ // An item with children: the toolkit hosts its views in the row.
175
+ bool custom{false};
176
+ bool operator==(const SidebarRow &) const = default;
177
+ };
178
+
179
+ struct SidebarGroup {
180
+ Tag tag{-1};
181
+ // Empty for a section with no title row: its rows sit at the top level.
182
+ std::string title;
183
+ bool collapsible{false};
184
+ std::vector<SidebarRow> rows;
185
+ bool operator==(const SidebarGroup &) const = default;
186
+ };
187
+
188
+ struct SourceList {
189
+ std::vector<SidebarGroup> groups;
190
+ bool operator==(const SourceList &) const = default;
191
+ };
192
+
193
+ // The source lists among `parent`'s children: one for each run of neighbouring sections.
194
+ std::vector<SourceList> sourceLists(const ViewTree &tree, Tag parent);
195
+
196
+ // Whether a click on `chain` (a hit test from a custom row's root, root first) is for the row's
197
+ // content rather than for selecting the row: something under the root takes it, a focusable view
198
+ // (a pressable, a control) or a text input.
199
+ bool rowContentTakesClick(const ViewTree &tree, const std::vector<Tag> &chain);
200
+
201
+ // What the split views and source lists of a surface became in a transaction, kept by the
202
+ // mounting manager as ScreenStacks is.
203
+ class Sidebars {
204
+ public:
205
+ void childrenChanged(const ViewTree &tree, Tag parent);
206
+ void propsChanged(const ViewTree &tree, Tag tag);
207
+ void deleted(Tag tag);
208
+
209
+ // A split view, or a tabs host (tabs-host.h), which draws as one with its tabs as the sidebar.
210
+ struct SplitView {
211
+ Tag tag{-1};
212
+ // The window's own split view, or a plain one in the content.
213
+ bool window{false};
214
+ bool operator==(const SplitView &) const = default;
215
+ };
216
+ struct Lists {
217
+ Tag parent{-1};
218
+ std::vector<SourceList> lists;
219
+ bool operator==(const Lists &) const = default;
220
+ };
221
+ struct Changes {
222
+ // Split views mounted since the last call, outermost first.
223
+ std::vector<SplitView> splitViews;
224
+ // Parents whose source lists changed, with what they are now (empty when none is left).
225
+ std::vector<Lists> lists;
226
+ };
227
+ Changes settle(const ViewTree &tree, SurfaceId surfaceId);
228
+
229
+ private:
230
+ std::unordered_set<Tag> dirtyParents_;
231
+ std::vector<Tag> newSplits_;
232
+ // Split views already sent: each is decided once, when it first mounts in its surface.
233
+ std::unordered_set<Tag> placed_;
234
+ std::unordered_map<Tag, std::vector<SourceList>> lists_;
235
+ // The window's split view of each surface.
236
+ std::unordered_map<SurfaceId, Tag> windowSplits_;
237
+ };
238
+
239
+ // The sidebar's collapsed state between the app's prop and the toolkit's own toggles (the title
240
+ // bar button, View > Show Sidebar, a drag that shuts it).
241
+ class SidebarCollapse {
242
+ public:
243
+ // The prop changed: what the toolkit must be set to, if anything.
244
+ std::optional<bool> propChanged(bool collapsed);
245
+ // The toolkit's state changed: whether to tell the app, which it does when the app's prop
246
+ // says otherwise.
247
+ bool toolkitChanged(bool collapsed);
248
+
249
+ private:
250
+ bool prop_{false};
251
+ bool toolkit_{false};
252
+ };
253
+
254
+ // Sizes reported as the toolkit lays out (every step of a divider drag), coalesced so layout hears
255
+ // each view's latest at most once per display frame.
256
+ class FrameSizes {
257
+ public:
258
+ // Whether this is the first report since the last flush: the toolkit then asks for a flush on
259
+ // the next frame.
260
+ bool report(Tag tag, facebook::react::Size size);
261
+ // The sizes that changed since the last flush, the latest of each.
262
+ std::vector<std::pair<Tag, facebook::react::Size>> flush();
263
+ void forget(Tag tag);
264
+
265
+ private:
266
+ std::unordered_map<Tag, facebook::react::Size> pending_;
267
+ std::unordered_map<Tag, facebook::react::Size> applied_;
268
+ };
269
+
270
+ } // namespace ngn
@@ -0,0 +1,38 @@
1
+ // NgNativeSqlite: expo-sqlite's databases over the system's sqlite3, for @ng-native/expo's
2
+ // `database()` on a desktop OS. A TurboModule cannot hand JavaScript an object with methods, so a
3
+ // database is a handle: `openDatabaseAsync` answers `{id, databasePath, databaseName}`, and every
4
+ // other call takes the id first. The desktop loader builds expo-sqlite's SQLiteDatabase over it
5
+ // (withTransactionAsync is BEGIN, the task, then COMMIT or ROLLBACK, through execAsync).
6
+ //
7
+ // - openDatabaseAsync / openDatabaseSync (name, options?, directory?): `:memory:` is in memory, a
8
+ // name is a file in `directory`, or in defaultDatabaseDirectory, made when missing. A file
9
+ // database uses the WAL journal, as expo-sqlite's does.
10
+ // - execAsync / execSync (id, source): one or more statements, results dropped.
11
+ // - runAsync / runSync (id, source, params?): one statement, answering {lastInsertRowId, changes}.
12
+ // - getFirstAsync / getFirstSync and getAllAsync / getAllSync (id, source, params?): the rows as
13
+ // objects keyed by column name, or the first one, or null.
14
+ // - isInTransactionAsync / isInTransactionSync (id), closeAsync / closeSync (id).
15
+ // - deleteDatabaseAsync / deleteDatabaseSync (name, directory?): refused while it is open.
16
+ //
17
+ // A database file opens, is made or is deleted only where `files` lets the app write
18
+ // (FileAccess::writeFor): its own folders, the user's picks and the paths its capabilities declare
19
+ // readwrite. Anywhere else, `directory` included, is refused in the same words whether or not a
20
+ // file is there.
21
+ //
22
+ // Params are an array for `?` and `?NNN`, or an object whose keys are the names as written in the
23
+ // SQL (`$id`, `:id`, `@id`). A boolean binds as 0 or 1, and bytes as {base64}, which is also how a
24
+ // blob column comes back. Every call runs on the JavaScript thread, in the order it was made.
25
+ // Closing the module (a reload) closes every database it opened.
26
+ #pragma once
27
+
28
+ #include "ngn/file-system.h"
29
+ #include "ngn/native-module.h"
30
+
31
+ #include <memory>
32
+ #include <string>
33
+
34
+ namespace ngn {
35
+
36
+ std::shared_ptr<NativeModule> makeSqliteModule(std::string defaultDatabaseDirectory, std::shared_ptr<FileAccess> files);
37
+
38
+ } // namespace ngn
@@ -0,0 +1,26 @@
1
+ // NgNativeStoreReview: what @ng-native/expo's StoreReview calls on expo-store-review. A Mac app
2
+ // can ask for a rating only from the Mac App Store, so in a `mas` build the host has a
3
+ // ReviewPrompt (SKStoreReviewController) and anywhere else none, and the module is inert:
4
+ //
5
+ // - isAvailableAsync(), hasAction(): whether there is a prompt to show.
6
+ // - requestReview(): asks the system to show its rating prompt, which it may decline to. Nothing
7
+ // without a prompt, or with `noPrompts` (NGN_NO_PROMPTS=1).
8
+ // - storeUrl(): null. A Mac app's store page is not in its config, so Updates opens none either.
9
+ #pragma once
10
+
11
+ #include "ngn/native-module.h"
12
+
13
+ #include <memory>
14
+
15
+ namespace ngn {
16
+
17
+ class ReviewPrompt {
18
+ public:
19
+ virtual ~ReviewPrompt() = default;
20
+ virtual void request() = 0;
21
+ };
22
+
23
+ // `prompt` is null outside a Mac App Store build.
24
+ std::shared_ptr<NativeModule> makeStoreReviewModule(std::shared_ptr<ReviewPrompt> prompt, bool noPrompts);
25
+
26
+ } // namespace ngn