@ng-native/desktop 0.26.0 → 0.27.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 (256) hide show
  1. package/README.md +6 -3
  2. package/bin/app-config.mjs +1 -0
  3. package/bin/archive.mjs +166 -0
  4. package/bin/autolink.mjs +61 -30
  5. package/bin/cli.mjs +127 -27
  6. package/bin/host.mjs +255 -58
  7. package/bin/package-linux.mjs +1394 -0
  8. package/bin/package.mjs +171 -35
  9. package/bin/plist.mjs +6 -2
  10. package/bin/png-icon.mjs +315 -0
  11. package/bin/prebuilt.mjs +147 -26
  12. package/bin/toolchain.mjs +258 -19
  13. package/native/CMakeLists.txt +64 -6
  14. package/native/appkit/CMakeLists.txt +2 -1
  15. package/native/appkit/appkit-backend.h +1 -0
  16. package/native/appkit/appkit-backend.mm +13 -0
  17. package/native/appkit/header-toolbar.mm +28 -25
  18. package/native/appkit/host-view.h +10 -0
  19. package/native/appkit/host-view.mm +146 -40
  20. package/native/appkit/input-replay.h +6 -0
  21. package/native/appkit/input-replay.mm +21 -12
  22. package/native/appkit/main.mm +11 -7
  23. package/native/appkit/native-controls.mm +13 -1
  24. package/native/appkit/split-view.mm +7 -13
  25. package/native/appkit/text-input-field.h +4 -0
  26. package/native/appkit/text-input-field.mm +20 -1
  27. package/native/cmake/curl.cmake +79 -0
  28. package/native/cmake/libraries/react-native-reanimated.cmake +5 -0
  29. package/native/cmake/libraries/react-native-worklets.cmake +5 -0
  30. package/native/cmake/linked-modules.cmake +20 -4
  31. package/native/cmake/react-native.cmake +18 -1
  32. package/native/core/include/ngn/accent-colors.h +38 -0
  33. package/native/core/include/ngn/accessibility-relations.h +65 -0
  34. package/native/core/include/ngn/accessibility.h +26 -0
  35. package/native/core/include/ngn/animated-frame-loop.h +56 -0
  36. package/native/core/include/ngn/app-info.h +24 -8
  37. package/native/core/include/ngn/app-menus.h +14 -1
  38. package/native/core/include/ngn/app-windows.h +15 -2
  39. package/native/core/include/ngn/aria-role.h +96 -0
  40. package/native/core/include/ngn/audio.h +2 -0
  41. package/native/core/include/ngn/camera.h +9 -0
  42. package/native/core/include/ngn/control-sizes.h +7 -2
  43. package/native/core/include/ngn/crash-report.h +31 -0
  44. package/native/core/include/ngn/curl-network.h +93 -0
  45. package/native/core/include/ngn/dbus-menu.h +39 -0
  46. package/native/core/include/ngn/default-menu.h +36 -0
  47. package/native/core/include/ngn/desktop-expo.h +7 -1
  48. package/native/core/include/ngn/desktop-modules.h +22 -0
  49. package/native/core/include/ngn/desktop-props.h +21 -1
  50. package/native/core/include/ngn/desktop-view-props.h +6 -0
  51. package/native/core/include/ngn/focus-order.h +10 -0
  52. package/native/core/include/ngn/header-bar.h +22 -0
  53. package/native/core/include/ngn/host-os.h +6 -0
  54. package/native/core/include/ngn/host-reload.h +21 -0
  55. package/native/core/include/ngn/host-state.h +23 -0
  56. package/native/core/include/ngn/image-source.h +26 -1
  57. package/native/core/include/ngn/input-script.h +3 -3
  58. package/native/core/include/ngn/input.h +4 -1
  59. package/native/core/include/ngn/launch-frame.h +21 -0
  60. package/native/core/include/ngn/launch-settings.h +23 -5
  61. package/native/core/include/ngn/mounting-backend.h +5 -0
  62. package/native/core/include/ngn/mounting-manager.h +1 -0
  63. package/native/core/include/ngn/native-controls.h +26 -5
  64. package/native/core/include/ngn/notification-schedule.h +74 -0
  65. package/native/core/include/ngn/notifications.h +2 -1
  66. package/native/core/include/ngn/openssl-update-crypto.h +15 -0
  67. package/native/core/include/ngn/photo-library.h +60 -20
  68. package/native/core/include/ngn/posix-locale.h +43 -0
  69. package/native/core/include/ngn/runtime.h +5 -0
  70. package/native/core/include/ngn/safe-areas.h +14 -2
  71. package/native/core/include/ngn/split-view.h +78 -0
  72. package/native/core/include/ngn/surface-metrics.h +7 -0
  73. package/native/core/include/ngn/system.h +14 -0
  74. package/native/core/include/ngn/text-input.h +13 -0
  75. package/native/core/include/ngn/text-units.h +38 -0
  76. package/native/core/include/ngn/updates.h +14 -2
  77. package/native/core/include/ngn/view-box.h +40 -0
  78. package/native/core/include/ngn/view-transform.h +15 -0
  79. package/native/core/include/ngn/web-browser.h +46 -0
  80. package/native/core/src/accent-colors.cpp +88 -0
  81. package/native/core/src/accessibility-relations.cpp +138 -0
  82. package/native/core/src/accessibility.cpp +50 -0
  83. package/native/core/src/animated-frame-loop.cpp +166 -0
  84. package/native/core/src/app-menus.cpp +26 -9
  85. package/native/core/src/app-windows.cpp +27 -6
  86. package/native/core/src/aria-role.cpp +127 -0
  87. package/native/core/src/control-sizes.cpp +9 -5
  88. package/native/core/src/crash-report.cpp +196 -0
  89. package/native/core/src/curl-network.cpp +1562 -0
  90. package/native/core/src/dbus-menu.cpp +71 -0
  91. package/native/core/src/default-menu.cpp +134 -0
  92. package/native/core/src/desktop-view-props.cpp +14 -0
  93. package/native/core/src/focus-order.cpp +19 -0
  94. package/native/core/src/header-bar.cpp +20 -0
  95. package/native/core/src/host-os.cpp +19 -0
  96. package/native/core/src/host-reload.cpp +45 -0
  97. package/native/core/src/host-state.cpp +8 -0
  98. package/native/core/src/image-source.cpp +90 -0
  99. package/native/core/src/input-dispatcher.cpp +27 -5
  100. package/native/core/src/input-script.cpp +3 -2
  101. package/native/core/src/launch-settings.cpp +76 -0
  102. package/native/core/src/libraries/react-native-reanimated.cpp +6 -1
  103. package/native/core/src/modules/app-info.cpp +55 -6
  104. package/native/core/src/modules/app-modules.cpp +1 -1
  105. package/native/core/src/modules/audio.cpp +4 -2
  106. package/native/core/src/modules/camera.cpp +8 -11
  107. package/native/core/src/modules/desktop-expo.cpp +10 -5
  108. package/native/core/src/modules/desktop-modules.cpp +106 -41
  109. package/native/core/src/modules/file-photo-picker.cpp +408 -0
  110. package/native/core/src/modules/notifications.cpp +13 -17
  111. package/native/core/src/modules/photo-library.cpp +42 -13
  112. package/native/core/src/modules/web-browser.cpp +89 -0
  113. package/native/core/src/mounting-manager.cpp +12 -0
  114. package/native/core/src/native-controls.cpp +42 -1
  115. package/native/core/src/notification-schedule.cpp +429 -0
  116. package/native/core/src/openssl-update-crypto.cpp +83 -0
  117. package/native/core/src/posix-locale.cpp +192 -0
  118. package/native/core/src/runtime.cpp +30 -1
  119. package/native/core/src/safe-areas.cpp +19 -4
  120. package/native/core/src/spawn-rules.cpp +4 -1
  121. package/native/core/src/split-view.cpp +93 -0
  122. package/native/core/src/system.cpp +19 -0
  123. package/native/core/src/text-input.cpp +18 -1
  124. package/native/core/src/text-units.cpp +99 -0
  125. package/native/core/src/updates.cpp +76 -17
  126. package/native/core/src/view-box.cpp +75 -40
  127. package/native/core/src/view-transform.cpp +28 -0
  128. package/native/docker/Dockerfile +38 -0
  129. package/native/docker/Dockerfile.fedora +36 -0
  130. package/native/docker/glibc-floor.sh +49 -0
  131. package/native/gtk/CMakeLists.txt +137 -0
  132. package/native/gtk/accent-colour.cpp +57 -0
  133. package/native/gtk/accent-colour.h +41 -0
  134. package/native/gtk/accessibility-settings.cpp +159 -0
  135. package/native/gtk/accessibility-settings.h +62 -0
  136. package/native/gtk/accessible-text.cpp +151 -0
  137. package/native/gtk/accessible-text.h +49 -0
  138. package/native/gtk/accessible.cpp +306 -0
  139. package/native/gtk/accessible.h +75 -0
  140. package/native/gtk/alerts.cpp +267 -0
  141. package/native/gtk/alerts.h +30 -0
  142. package/native/gtk/animation-frames.cpp +159 -0
  143. package/native/gtk/animation-frames.h +20 -0
  144. package/native/gtk/app-info.cpp +91 -0
  145. package/native/gtk/app-info.h +25 -0
  146. package/native/gtk/app-windows.cpp +439 -0
  147. package/native/gtk/app-windows.h +150 -0
  148. package/native/gtk/audio.cpp +370 -0
  149. package/native/gtk/audio.h +54 -0
  150. package/native/gtk/auth-session.cpp +73 -0
  151. package/native/gtk/auth-session.h +16 -0
  152. package/native/gtk/battery.cpp +110 -0
  153. package/native/gtk/battery.h +19 -0
  154. package/native/gtk/box-paint.cpp +262 -0
  155. package/native/gtk/box-paint.h +32 -0
  156. package/native/gtk/cairo-canvas.cpp +755 -0
  157. package/native/gtk/cairo-canvas.h +49 -0
  158. package/native/gtk/camera.cpp +909 -0
  159. package/native/gtk/camera.h +69 -0
  160. package/native/gtk/capture.cpp +46 -0
  161. package/native/gtk/capture.h +19 -0
  162. package/native/gtk/clock-format.cpp +151 -0
  163. package/native/gtk/clock-format.h +36 -0
  164. package/native/gtk/crypto.cpp +75 -0
  165. package/native/gtk/crypto.h +14 -0
  166. package/native/gtk/dbus-properties.cpp +131 -0
  167. package/native/gtk/dbus-properties.h +61 -0
  168. package/native/gtk/drag-and-drop.cpp +339 -0
  169. package/native/gtk/drag-and-drop.h +30 -0
  170. package/native/gtk/file-dialogs.cpp +239 -0
  171. package/native/gtk/file-dialogs.h +21 -0
  172. package/native/gtk/file-system.cpp +212 -0
  173. package/native/gtk/file-system.h +25 -0
  174. package/native/gtk/focus.cpp +282 -0
  175. package/native/gtk/focus.h +37 -0
  176. package/native/gtk/fonts.cpp +89 -0
  177. package/native/gtk/fonts.h +22 -0
  178. package/native/gtk/gst-frames.cpp +150 -0
  179. package/native/gtk/gst-frames.h +47 -0
  180. package/native/gtk/gst-playback.cpp +496 -0
  181. package/native/gtk/gst-playback.h +81 -0
  182. package/native/gtk/gtk-backend.cpp +690 -0
  183. package/native/gtk/gtk-backend.h +134 -0
  184. package/native/gtk/host-sources.cpp +354 -0
  185. package/native/gtk/host-sources.h +46 -0
  186. package/native/gtk/image-manipulator.cpp +254 -0
  187. package/native/gtk/image-manipulator.h +30 -0
  188. package/native/gtk/image-view.cpp +256 -0
  189. package/native/gtk/image-view.h +54 -0
  190. package/native/gtk/input-replay.cpp +299 -0
  191. package/native/gtk/input-replay.h +36 -0
  192. package/native/gtk/launcher-badge.cpp +29 -0
  193. package/native/gtk/launcher-badge.h +21 -0
  194. package/native/gtk/locales.cpp +131 -0
  195. package/native/gtk/locales.h +23 -0
  196. package/native/gtk/location.cpp +274 -0
  197. package/native/gtk/location.h +19 -0
  198. package/native/gtk/main.cpp +1092 -0
  199. package/native/gtk/menus.cpp +447 -0
  200. package/native/gtk/menus.h +100 -0
  201. package/native/gtk/native-controls.cpp +831 -0
  202. package/native/gtk/native-controls.h +58 -0
  203. package/native/gtk/network-state.cpp +72 -0
  204. package/native/gtk/network-state.h +24 -0
  205. package/native/gtk/notifications.cpp +235 -0
  206. package/native/gtk/notifications.h +30 -0
  207. package/native/gtk/pango-text.cpp +274 -0
  208. package/native/gtk/pango-text.h +73 -0
  209. package/native/gtk/portal.cpp +451 -0
  210. package/native/gtk/portal.h +71 -0
  211. package/native/gtk/printing.cpp +338 -0
  212. package/native/gtk/printing.h +34 -0
  213. package/native/gtk/proxy-resolver.cpp +74 -0
  214. package/native/gtk/proxy-resolver.h +20 -0
  215. package/native/gtk/screens.cpp +1461 -0
  216. package/native/gtk/screens.h +274 -0
  217. package/native/gtk/scroll-view.cpp +414 -0
  218. package/native/gtk/scroll-view.h +82 -0
  219. package/native/gtk/secret-store.cpp +120 -0
  220. package/native/gtk/secret-store.h +27 -0
  221. package/native/gtk/settings-portal.cpp +129 -0
  222. package/native/gtk/settings-portal.h +47 -0
  223. package/native/gtk/split-view.cpp +1105 -0
  224. package/native/gtk/split-view.h +195 -0
  225. package/native/gtk/status-notifier.cpp +487 -0
  226. package/native/gtk/status-notifier.h +43 -0
  227. package/native/gtk/surface-input.cpp +251 -0
  228. package/native/gtk/surface-input.h +57 -0
  229. package/native/gtk/system-access.cpp +295 -0
  230. package/native/gtk/system-access.h +37 -0
  231. package/native/gtk/text-field.cpp +827 -0
  232. package/native/gtk/text-field.h +78 -0
  233. package/native/gtk/video.cpp +527 -0
  234. package/native/gtk/video.h +47 -0
  235. package/native/gtk/view-widget.cpp +431 -0
  236. package/native/gtk/view-widget.h +105 -0
  237. package/native/gtk/window-scale.cpp +95 -0
  238. package/native/gtk/window-scale.h +35 -0
  239. package/native/scripts/atspi-check.py +310 -0
  240. package/native/scripts/atspi-check.test.py +48 -0
  241. package/native/scripts/build.sh +20 -3
  242. package/native/scripts/compilers.sh +17 -0
  243. package/native/scripts/deb-depends-check.sh +22 -0
  244. package/native/scripts/fetch.sh +23 -2
  245. package/native/scripts/launch-cell.sh +157 -0
  246. package/native/scripts/launch-probe.sh +14 -3
  247. package/native/scripts/make-prebuilt.mjs +133 -44
  248. package/native/scripts/prebuilt-host-cache.mjs +71 -40
  249. package/native/scripts/reset-for-compilers.sh +44 -0
  250. package/native/scripts/start-xvfb.sh +35 -0
  251. package/native/shim/paragraph-platform/react/renderer/components/text/HostPlatformParagraphProps.h +35 -0
  252. package/native/shim/view-platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +5 -2
  253. package/native/shim/worklets/linux-reanimated-props.h +14 -0
  254. package/native/shim/worklets/linux-worklets.h +23 -0
  255. package/package.json +6 -3
  256. package/prebuilt.json +70 -6
@@ -2,10 +2,11 @@
2
2
  * A built prebuilt host kept between release runs (make-prebuilt.mjs --host-cache), so a release
3
3
  * whose host inputs did not change packs the host it already built instead of building it again.
4
4
  *
5
- * The cache holds the build's `appkit/` files as the build left them, before they are stripped and
6
- * signed, and a `host.json` naming the inputs key they were built from and each file's digest. A
7
- * cache is used only when its key is the one computed now and every file still has its digest;
8
- * anything else builds from scratch.
5
+ * The cache holds the build's host files as the build left them, before they are stripped and
6
+ * signed, in the folder the build has them in (`appkit/` for macOS, `gtk/` for Linux), and a
7
+ * `host.json` naming the inputs key they were built from and each file's digest. A cache is used
8
+ * only when its key is the one computed now and every file still has its digest; anything else
9
+ * builds from scratch.
9
10
  */
10
11
  import { createHash } from 'node:crypto';
11
12
  import {
@@ -20,8 +21,19 @@ import {
20
21
  } from 'node:fs';
21
22
  import path from 'node:path';
22
23
 
23
- /** What the cache holds, under `appkit/`: the files make-prebuilt.mjs archives. */
24
- export const HOST_FILES = ['ngn-macos', 'hermesc', 'hermesvm.framework', 'Sparkle.framework'];
24
+ /**
25
+ * @typedef {{ folder: string, files: readonly string[] }} HostLayout The build's subfolder the host
26
+ * is in, and the files make-prebuilt.mjs archives from it, which the cache holds.
27
+ */
28
+
29
+ /** @type {HostLayout} The universal AppKit host. */
30
+ export const MACOS_HOST = {
31
+ folder: 'appkit',
32
+ files: ['ngn-macos', 'hermesc', 'hermesvm.framework', 'Sparkle.framework'],
33
+ };
34
+
35
+ /** @type {HostLayout} The GTK host, for one architecture. */
36
+ export const LINUX_HOST = { folder: 'gtk', files: ['ngn-linux', 'hermesc'] };
25
37
 
26
38
  /** Bumped when the cache's layout or what the key covers changes, so older caches miss. */
27
39
  const SCHEMA = 1;
@@ -64,11 +76,22 @@ export function treeDigests(base, root) {
64
76
  * sources: [string, string][],
65
77
  * toolchain: string,
66
78
  * signing: string,
79
+ * platform?: { os?: string, arch?: string },
67
80
  * }} inputs `libraries`: each compiled-in library's version. `sources`: the digests
68
- * (treeDigests) of the host's native sources and build scripts. `toolchain`: the compiler and SDK.
69
- * `signing`: the identity the archive is signed with, `-` for ad hoc.
81
+ * (treeDigests) of the host's native sources and build scripts. `toolchain`: the compiler and SDK,
82
+ * or for Linux the compiler, glibc and the build image's libraries. `signing`: the identity the
83
+ * archive is signed with, `-` for ad hoc. `platform`: the OS and architecture of a Linux host;
84
+ * left out for the universal macOS host, whose key it leaves as it was.
70
85
  */
71
- export function hostInputsKey({ flavour, reactNative, libraries, sources, toolchain, signing }) {
86
+ export function hostInputsKey({
87
+ flavour,
88
+ reactNative,
89
+ libraries,
90
+ sources,
91
+ toolchain,
92
+ signing,
93
+ platform,
94
+ }) {
72
95
  const sortedLibraries = Object.fromEntries(
73
96
  Object.entries(libraries).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)),
74
97
  );
@@ -81,71 +104,79 @@ export function hostInputsKey({ flavour, reactNative, libraries, sources, toolch
81
104
  sources,
82
105
  toolchain,
83
106
  signing,
107
+ platform,
84
108
  }),
85
109
  );
86
110
  }
87
111
 
88
112
  /**
89
- * The cached host's `appkit` folder when `dir` holds a host built from `key` whose files are all as
90
- * they were saved, else null with why: a cache that is missing, from other inputs, short of a file
91
- * or changed in any byte is never used.
113
+ * The cached host's folder when `dir` holds a host built from `key` whose files are all as they
114
+ * were saved, else null with why: a cache that is missing, from other inputs, short of a file or
115
+ * changed in any byte is never used.
92
116
  *
93
117
  * @param {string} dir
94
118
  * @param {string} key
95
- * @returns {{ appkit: string, reason?: undefined } | { appkit: null, reason: string }}
119
+ * @param {HostLayout} [layout]
120
+ * @returns {{ host: string, reason?: undefined } | { host: null, reason: string }}
96
121
  */
97
- export function readHostCache(dir, key) {
122
+ export function readHostCache(dir, key, layout = MACOS_HOST) {
98
123
  const record = path.join(dir, 'host.json');
99
- if (!existsSync(record)) return { appkit: null, reason: `no built host in ${dir}` };
124
+ if (!existsSync(record)) return { host: null, reason: `no built host in ${dir}` };
100
125
  /** @type {{ schema?: number, key?: string, files?: [string, string][] }} */
101
126
  let saved;
102
127
  try {
103
128
  saved = JSON.parse(readFileSync(record, 'utf8'));
104
129
  } catch (error) {
105
130
  return {
106
- appkit: null,
131
+ host: null,
107
132
  reason: `${record} is unreadable: ${/** @type {Error} */ (error).message}`,
108
133
  };
109
134
  }
110
135
  if (saved === null || typeof saved !== 'object' || Array.isArray(saved)) {
111
- return { appkit: null, reason: `${record} is not a host record` };
136
+ return { host: null, reason: `${record} is not a host record` };
112
137
  }
113
138
  if (saved.schema !== SCHEMA || saved.key !== key) {
114
- return { appkit: null, reason: `the host in ${dir} was built from other inputs` };
139
+ return { host: null, reason: `the host in ${dir} was built from other inputs` };
115
140
  }
116
- const appkit = path.join(dir, 'appkit');
141
+ const host = path.join(dir, layout.folder);
142
+ const reason = changedFrom(host, layout.files, saved.files);
143
+ return reason ? { host: null, reason: `the host in ${dir} ${reason}` } : { host };
144
+ }
145
+
146
+ /**
147
+ * Why the host in `host` is not the one saved with `digests`, or null where every file is there
148
+ * and as it was.
149
+ *
150
+ * @param {string} host
151
+ * @param {readonly string[]} files
152
+ * @param {unknown} digests
153
+ */
154
+ function changedFrom(host, files, digests) {
117
155
  try {
118
- for (const name of HOST_FILES) {
119
- if (!existsSync(path.join(appkit, name))) {
120
- return { appkit: null, reason: `the host in ${dir} has no ${name}` };
121
- }
122
- }
123
- const now = JSON.stringify(treeDigests(appkit, appkit));
124
- if (now !== JSON.stringify(saved.files)) {
125
- return { appkit: null, reason: `the host in ${dir} is not as it was saved` };
126
- }
156
+ const gone = files.find((name) => !existsSync(path.join(host, name)));
157
+ if (gone) return `has no ${gone}`;
158
+ const same = JSON.stringify(treeDigests(host, host)) === JSON.stringify(digests);
159
+ return same ? null : 'is not as it was saved';
127
160
  } catch (error) {
128
- return {
129
- appkit: null,
130
- reason: `the host in ${dir} is unreadable: ${/** @type {Error} */ (error).message}`,
131
- };
161
+ return `is unreadable: ${/** @type {Error} */ (error).message}`;
132
162
  }
133
- return { appkit };
134
163
  }
135
164
 
136
165
  /**
137
- * Replaces `dir` with the host files in `appkit` (a build's, before stripping and signing) and the
138
- * record naming `key`. The record goes in last, so a copy cut short is never read as a host.
166
+ * Replaces `dir` with the host files in `built` (a build's host folder, before stripping and
167
+ * signing) and the record naming `key`. The record goes in last, so a copy cut short is never read
168
+ * as a host.
139
169
  *
140
170
  * @param {string} dir
141
171
  * @param {string} key
142
- * @param {string} appkit
172
+ * @param {string} built
173
+ * @param {HostLayout} [layout]
143
174
  */
144
- export function writeHostCache(dir, key, appkit) {
175
+ export function writeHostCache(dir, key, built, layout = MACOS_HOST) {
145
176
  rmSync(dir, { recursive: true, force: true });
146
- const target = path.join(dir, 'appkit');
147
- for (const name of HOST_FILES) {
148
- cpSync(path.join(appkit, name), path.join(target, name), {
177
+ const target = path.join(dir, layout.folder);
178
+ for (const name of layout.files) {
179
+ cpSync(path.join(built, name), path.join(target, name), {
149
180
  recursive: true,
150
181
  verbatimSymlinks: true,
151
182
  });
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Clear a build directory's CMake cache when it was configured with another compiler than the one
3
+ # asked for now, as a build after the switch to clang (compilers.sh) finds one GCC configured.
4
+ #
5
+ # reset-for-compilers.sh <build dir> [-DCMAKE_C_COMPILER=… -DCMAKE_CXX_COMPILER=…]
6
+ #
7
+ # CMake starts a directory over itself when its compiler changes, but without the -D's it was
8
+ # given, so RN_DIR and the rest come out empty and the configure fails. A directory configured with
9
+ # the compiler asked for keeps its cache, as does one where none is asked for (CC and CXX, which
10
+ # CMake reads once, being the caller's) or none is cached yet.
11
+ set -euo pipefail
12
+ build="$1"
13
+ shift
14
+ cache="$build/CMakeCache.txt"
15
+ [ -f "$cache" ] || exit 0
16
+ for arg in "$@"; do
17
+ case "$arg" in
18
+ -DCMAKE_C_COMPILER=* | -DCMAKE_CXX_COMPILER=*) ;;
19
+ *) continue ;;
20
+ esac
21
+ name="${arg#-D}"
22
+ name="${name%%=*}"
23
+ wanted="${arg#*=}"
24
+ cached="$(sed -n "s/^$name:[A-Z]*=//p" "$cache" | head -n 1)"
25
+ [ -n "$cached" ] || continue
26
+ # The path CMake found for it, which it compares with the one it finds again on PATH: in
27
+ # CMakeFiles/<version>/CMake{C,CXX}Compiler.cmake, where the cache keeps the name as given.
28
+ lang=CXX
29
+ [ "$name" = CMAKE_C_COMPILER ] && lang=C
30
+ recorded="$(sed -n "s/^set($name \"\(.*\)\")$/\1/p" "$build"/CMakeFiles/*/CMake${lang}Compiler.cmake 2>/dev/null | head -n 1 || true)"
31
+ [ -n "$recorded" ] || { case "$cached" in */*) recorded="$cached" ;; esac; }
32
+ found="$(command -v "$wanted" 2>/dev/null || true)"
33
+ if [ -n "$recorded" ] && [ -n "$found" ]; then
34
+ differs=$([ "$found" != "$recorded" ] && echo 1 || echo 0)
35
+ else
36
+ # Nothing to compare paths by: by name, as the name is what is asked for.
37
+ differs=$([ "$(basename "$cached")" != "$(basename "$wanted")" ] && echo 1 || echo 0)
38
+ fi
39
+ if [ "$differs" = 1 ]; then
40
+ rm -rf "$cache" "$build/CMakeFiles"
41
+ exit 0
42
+ fi
43
+ done
44
+ exit 0
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # Starts Xvfb on display :99 in the background, with its output in <log>, and returns once it takes
3
+ # connections, printing its PID for the caller to stop:
4
+ #
5
+ # xvfb=$(native/scripts/start-xvfb.sh "$out/xvfb.log")
6
+ # trap "kill $xvfb" EXIT
7
+ #
8
+ # Xvfb writes the display's number to -displayfd once it listens. Fails, printing the log, when Xvfb
9
+ # exits first or has not written it within [seconds] (20 by default).
10
+ set -euo pipefail
11
+
12
+ log="$1"
13
+ seconds="${2:-20}"
14
+ ready=$(mktemp)
15
+ trap 'rm -f "$ready"' EXIT
16
+
17
+ Xvfb :99 -screen 0 1280x800x24 -nolisten tcp -displayfd 3 3> "$ready" > "$log" 2>&1 &
18
+ pid=$!
19
+
20
+ why="did not take connections within ${seconds}s"
21
+ for _ in $(seq $((seconds * 5))); do
22
+ if [ -s "$ready" ]; then
23
+ echo "$pid"
24
+ exit 0
25
+ fi
26
+ if ! kill -0 "$pid" 2> /dev/null; then
27
+ why="exited before it took connections"
28
+ break
29
+ fi
30
+ sleep 0.2
31
+ done
32
+ kill "$pid" 2> /dev/null || true
33
+ echo "start-xvfb: Xvfb on :99 $why" >&2
34
+ cat "$log" >&2
35
+ exit 1
@@ -0,0 +1,35 @@
1
+ // React Native's cxx platform's paragraph props with the desktop props beside them
2
+ // (ngn/desktop-props.h), as a View's have them (ngn/desktop-view-props.h): a `<text>`'s
3
+ // `aria-level`, `aria-describedby`, ARIA states and counts, Tab order, cursor and context menu reach
4
+ // the core as a view's do. React Native's ParagraphProps is this class (ParagraphProps.h), so the
5
+ // shim's directory comes before the cxx platform's for every target (cmake/react-native.cmake).
6
+ #pragma once
7
+
8
+ #include <react/renderer/components/text/BaseParagraphProps.h>
9
+
10
+ #include "ngn/desktop-props.h"
11
+
12
+ namespace ngn {
13
+
14
+ // desktop-view-props.h's, declared here so React Native's own text sources need nothing more.
15
+ DesktopProps parseDesktopProps(
16
+ const facebook::react::PropsParserContext &context,
17
+ const DesktopProps &source,
18
+ const facebook::react::RawProps &rawProps);
19
+
20
+ } // namespace ngn
21
+
22
+ namespace facebook::react {
23
+
24
+ class HostPlatformParagraphProps : public BaseParagraphProps, public ngn::HasDesktopProps {
25
+ public:
26
+ HostPlatformParagraphProps() = default;
27
+ HostPlatformParagraphProps(
28
+ const PropsParserContext &context,
29
+ const HostPlatformParagraphProps &sourceProps,
30
+ const RawProps &rawProps)
31
+ : BaseParagraphProps(context, sourceProps, rawProps),
32
+ ngn::HasDesktopProps{ngn::parseDesktopProps(context, sourceProps.desktop, rawProps)} {}
33
+ };
34
+
35
+ } // namespace facebook::react
@@ -15,9 +15,12 @@ namespace facebook::react::HostPlatformViewTraitsInitializer {
15
15
 
16
16
  inline bool formsStackingContext(const ViewProps &props) {
17
17
  // A live region reads its text from the views under it (ngn/live-regions.h), and an
18
- // accessibility element is read with the text inside it (ngn/accessibility.h).
18
+ // accessibility element is read with the text inside it (ngn/accessibility.h). A view that names
19
+ // others as its label is the end of a relation (ngn/accessibility-relations.h), as one with a
20
+ // nativeID another names already is in React Native.
19
21
  if (props.accessibilityLiveRegion != AccessibilityLiveRegion::None || props.role != Role::None ||
20
- !props.accessibilityRole.empty() || !props.accessibilityLabel.empty()) {
22
+ !props.accessibilityRole.empty() || !props.accessibilityLabel.empty() ||
23
+ !props.accessibilityLabelledBy.value.empty()) {
21
24
  return true;
22
25
  }
23
26
  const auto *desktop = dynamic_cast<const ngn::HasDesktopProps *>(&props);
@@ -0,0 +1,14 @@
1
+ // Force-included into Reanimated's shared C++ on Linux (cmake/libraries/react-native-reanimated.cmake).
2
+ // Its PlatformDepMethodsHolder.h declares the function that updates a view's props without a
3
+ // commit for Android and Apple only. The desktop's glue (core/src/libraries/react-native-reanimated.cpp)
4
+ // gives it Apple's form on every OS. The header declares none on Linux, so this one is the
5
+ // holder's. Reanimated calls it on neither OS, as Apple's IOS_SYNCHRONOUSLY_UPDATE_UI_PROPS is off.
6
+ #pragma once
7
+
8
+ #include <folly/dynamic.h>
9
+
10
+ #include <functional>
11
+
12
+ namespace reanimated {
13
+ using SynchronouslyUpdateUIPropsFunction = std::function<void(const int, const folly::dynamic &)>;
14
+ } // namespace reanimated
@@ -0,0 +1,23 @@
1
+ // Force-included into react-native-worklets' shared C++ on Linux
2
+ // (cmake/libraries/react-native-worklets.cmake), for what it takes from Apple's libraries that
3
+ // glibc and libstdc++ do not give:
4
+ // - <algorithm>, <iterator> and <stdexcept>, which some of its sources use without including:
5
+ // libc++ brings them in through other headers, and libstdc++ does not.
6
+ // - The one-argument pthread_setname_np, which worklets 0.13 calls on every OS but Android to name
7
+ // the thread an AsyncQueue starts. glibc's takes the thread and at most 15 bytes of name, and
8
+ // refuses a longer one, so the name is cut to fit.
9
+ #pragma once
10
+
11
+ #include <pthread.h>
12
+
13
+ #include <algorithm>
14
+ #include <cstring>
15
+ #include <iterator>
16
+ #include <stdexcept>
17
+
18
+ inline int pthread_setname_np(const char *name) {
19
+ char fitted[16];
20
+ std::strncpy(fitted, name, sizeof(fitted) - 1);
21
+ fitted[sizeof(fitted) - 1] = '\0';
22
+ return pthread_setname_np(pthread_self(), fitted);
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/desktop",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "The macOS desktop host for Angular Native: React Native's C++ core and Hermes, mounting into AppKit views, and the ng-native-desktop command that builds and launches it.",
5
5
  "keywords": [
6
6
  "angular",
@@ -16,7 +16,7 @@
16
16
  "ng-native-desktop": "./bin/ng-native-desktop.mjs"
17
17
  },
18
18
  "dependencies": {
19
- "@ng-native/device": "0.26.0"
19
+ "@ng-native/device": "0.27.0"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react-native": "~0.88.0"
@@ -59,7 +59,10 @@
59
59
  "native/core/include",
60
60
  "native/core/src",
61
61
  "native/appkit",
62
- "!native/appkit/tests"
62
+ "!native/appkit/tests",
63
+ "native/gtk",
64
+ "native/docker",
65
+ "!native/gtk/tests"
63
66
  ],
64
67
  "publishConfig": {
65
68
  "access": "public"
package/prebuilt.json CHANGED
@@ -4,8 +4,8 @@
4
4
  {
5
5
  "reactNative": "0.88.0",
6
6
  "flavour": "debug",
7
- "url": "https://github.com/ng-native/ng-native/releases/download/v0.26.0/ng-native-desktop-host-0.26.0-rn-0.88.0-macos-universal-debug.tar.gz",
8
- "sha256": "ff2af29a2d7046f7d5d0e4176c3f9c8e2be05e2bda57ea15c29cede2c0b494de",
7
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-macos-universal-debug.tar.gz",
8
+ "sha256": "c6547c9ecdec30e5568afb2cd5c3f2d5212f483f98e985a5e2b56fef0c4ff419",
9
9
  "libraries": {
10
10
  "react-native-screens": "4.30.0",
11
11
  "react-native-safe-area-context": "5.10.1",
@@ -13,13 +13,13 @@
13
13
  "react-native-worklets": "0.13.0",
14
14
  "react-native-reanimated": "4.7.1"
15
15
  },
16
- "inputs": "a511221639ad9e0f0ce29a96aa32839dd251f5cfae6f74e8c8cf819ce25898c9"
16
+ "inputs": "0a10788349417cc834b9e0b2f97cbbb3185a38f2f36299cbf737e76f9d24c716"
17
17
  },
18
18
  {
19
19
  "reactNative": "0.88.0",
20
20
  "flavour": "release",
21
- "url": "https://github.com/ng-native/ng-native/releases/download/v0.26.0/ng-native-desktop-host-0.26.0-rn-0.88.0-macos-universal.tar.gz",
22
- "sha256": "ade1562cdc5409e4099eb38640f8d52b20be7254d115e2d069896d2f2d78f518",
21
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-macos-universal.tar.gz",
22
+ "sha256": "fd6da08b299895489cf2ad12ce290c2c69f88997767fd1514f5cb8a234200fa2",
23
23
  "libraries": {
24
24
  "react-native-screens": "4.30.0",
25
25
  "react-native-safe-area-context": "5.10.1",
@@ -27,7 +27,71 @@
27
27
  "react-native-worklets": "0.13.0",
28
28
  "react-native-reanimated": "4.7.1"
29
29
  },
30
- "inputs": "689a371456085b1c3a8af2c7ab254db1db115e13063f1d0b81da6c6e23908080"
30
+ "inputs": "b9e2bdaeaddaad700cfe40150549db4d3efd9f16b49010c23049be387ce49c62"
31
+ },
32
+ {
33
+ "reactNative": "0.88.0",
34
+ "flavour": "debug",
35
+ "os": "linux",
36
+ "arch": "x64",
37
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-linux-x64-debug.tar.gz",
38
+ "sha256": "96555986cb7e7f156d1fd2826587cc36451ea94ba93de635bd8daf6c72eef6fe",
39
+ "libraries": {
40
+ "react-native-screens": "4.30.0",
41
+ "react-native-safe-area-context": "5.10.1",
42
+ "react-native-svg": "15.16.0",
43
+ "react-native-worklets": "0.13.0",
44
+ "react-native-reanimated": "4.7.1"
45
+ },
46
+ "inputs": "b735426f8962943f9bccd575232c8ec267c0c2bcf92780a576bb02215fcd9ce3"
47
+ },
48
+ {
49
+ "reactNative": "0.88.0",
50
+ "flavour": "release",
51
+ "os": "linux",
52
+ "arch": "x64",
53
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-linux-x64.tar.gz",
54
+ "sha256": "979c07198c6138a704c91649aed13c1a877d80b8e247bb2d0a3dbbf39c54ab7c",
55
+ "libraries": {
56
+ "react-native-screens": "4.30.0",
57
+ "react-native-safe-area-context": "5.10.1",
58
+ "react-native-svg": "15.16.0",
59
+ "react-native-worklets": "0.13.0",
60
+ "react-native-reanimated": "4.7.1"
61
+ },
62
+ "inputs": "22ba2060ea208746013460a5ba6ef3ff1c8161831ddbe684516a2d3476085559"
63
+ },
64
+ {
65
+ "reactNative": "0.88.0",
66
+ "flavour": "debug",
67
+ "os": "linux",
68
+ "arch": "arm64",
69
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-linux-arm64-debug.tar.gz",
70
+ "sha256": "f578ecf89b55634be13a9030a78c1895ef3979ce7f5ef7b187c2fe3fe038f07f",
71
+ "libraries": {
72
+ "react-native-screens": "4.30.0",
73
+ "react-native-safe-area-context": "5.10.1",
74
+ "react-native-svg": "15.16.0",
75
+ "react-native-worklets": "0.13.0",
76
+ "react-native-reanimated": "4.7.1"
77
+ },
78
+ "inputs": "7ecfe1eb1912bb0b651eaacfca5e51c5ba906384a453ce9913d000d1d0ee429a"
79
+ },
80
+ {
81
+ "reactNative": "0.88.0",
82
+ "flavour": "release",
83
+ "os": "linux",
84
+ "arch": "arm64",
85
+ "url": "https://github.com/ng-native/ng-native/releases/download/v0.27.0/ng-native-desktop-host-0.27.0-rn-0.88.0-linux-arm64.tar.gz",
86
+ "sha256": "928595e25100de9aeb195284a61f5196b779109f75077e9e8ff673838834b5eb",
87
+ "libraries": {
88
+ "react-native-screens": "4.30.0",
89
+ "react-native-safe-area-context": "5.10.1",
90
+ "react-native-svg": "15.16.0",
91
+ "react-native-worklets": "0.13.0",
92
+ "react-native-reanimated": "4.7.1"
93
+ },
94
+ "inputs": "259fcf15601db608e2840cd6e8636f106b3078303fb41a9699cab05ef2184585"
31
95
  }
32
96
  ]
33
97
  }