@ng-native/desktop 0.26.1 → 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.
- package/README.md +6 -3
- package/bin/app-config.mjs +1 -0
- package/bin/archive.mjs +166 -0
- package/bin/autolink.mjs +61 -30
- package/bin/cli.mjs +127 -27
- package/bin/host.mjs +255 -58
- package/bin/package-linux.mjs +1394 -0
- package/bin/package.mjs +171 -35
- package/bin/plist.mjs +6 -2
- package/bin/png-icon.mjs +315 -0
- package/bin/prebuilt.mjs +147 -26
- package/bin/toolchain.mjs +258 -19
- package/native/CMakeLists.txt +64 -6
- package/native/appkit/CMakeLists.txt +2 -1
- package/native/appkit/appkit-backend.h +1 -0
- package/native/appkit/appkit-backend.mm +13 -0
- package/native/appkit/header-toolbar.mm +28 -25
- package/native/appkit/host-view.h +10 -0
- package/native/appkit/host-view.mm +146 -40
- package/native/appkit/input-replay.h +6 -0
- package/native/appkit/input-replay.mm +21 -12
- package/native/appkit/main.mm +11 -7
- package/native/appkit/native-controls.mm +13 -1
- package/native/appkit/split-view.mm +7 -13
- package/native/appkit/text-input-field.h +4 -0
- package/native/appkit/text-input-field.mm +20 -1
- package/native/cmake/curl.cmake +79 -0
- package/native/cmake/libraries/react-native-reanimated.cmake +5 -0
- package/native/cmake/libraries/react-native-worklets.cmake +5 -0
- package/native/cmake/linked-modules.cmake +20 -4
- package/native/cmake/react-native.cmake +18 -1
- package/native/core/include/ngn/accent-colors.h +38 -0
- package/native/core/include/ngn/accessibility-relations.h +65 -0
- package/native/core/include/ngn/accessibility.h +26 -0
- package/native/core/include/ngn/animated-frame-loop.h +56 -0
- package/native/core/include/ngn/app-info.h +24 -8
- package/native/core/include/ngn/app-menus.h +14 -1
- package/native/core/include/ngn/app-windows.h +15 -2
- package/native/core/include/ngn/aria-role.h +96 -0
- package/native/core/include/ngn/audio.h +2 -0
- package/native/core/include/ngn/camera.h +9 -0
- package/native/core/include/ngn/control-sizes.h +7 -2
- package/native/core/include/ngn/crash-report.h +31 -0
- package/native/core/include/ngn/curl-network.h +93 -0
- package/native/core/include/ngn/dbus-menu.h +39 -0
- package/native/core/include/ngn/default-menu.h +36 -0
- package/native/core/include/ngn/desktop-expo.h +7 -1
- package/native/core/include/ngn/desktop-modules.h +22 -0
- package/native/core/include/ngn/desktop-props.h +21 -1
- package/native/core/include/ngn/desktop-view-props.h +6 -0
- package/native/core/include/ngn/focus-order.h +10 -0
- package/native/core/include/ngn/header-bar.h +22 -0
- package/native/core/include/ngn/host-os.h +6 -0
- package/native/core/include/ngn/host-reload.h +21 -0
- package/native/core/include/ngn/host-state.h +23 -0
- package/native/core/include/ngn/image-source.h +26 -1
- package/native/core/include/ngn/input-script.h +3 -3
- package/native/core/include/ngn/input.h +4 -1
- package/native/core/include/ngn/launch-frame.h +21 -0
- package/native/core/include/ngn/launch-settings.h +23 -5
- package/native/core/include/ngn/mounting-backend.h +5 -0
- package/native/core/include/ngn/mounting-manager.h +1 -0
- package/native/core/include/ngn/native-controls.h +26 -5
- package/native/core/include/ngn/notification-schedule.h +74 -0
- package/native/core/include/ngn/notifications.h +2 -1
- package/native/core/include/ngn/openssl-update-crypto.h +15 -0
- package/native/core/include/ngn/photo-library.h +60 -20
- package/native/core/include/ngn/posix-locale.h +43 -0
- package/native/core/include/ngn/runtime.h +5 -0
- package/native/core/include/ngn/safe-areas.h +14 -2
- package/native/core/include/ngn/split-view.h +78 -0
- package/native/core/include/ngn/surface-metrics.h +7 -0
- package/native/core/include/ngn/system.h +14 -0
- package/native/core/include/ngn/text-input.h +13 -0
- package/native/core/include/ngn/text-units.h +38 -0
- package/native/core/include/ngn/updates.h +14 -2
- package/native/core/include/ngn/view-box.h +40 -0
- package/native/core/include/ngn/view-transform.h +15 -0
- package/native/core/include/ngn/web-browser.h +46 -0
- package/native/core/src/accent-colors.cpp +88 -0
- package/native/core/src/accessibility-relations.cpp +138 -0
- package/native/core/src/accessibility.cpp +50 -0
- package/native/core/src/animated-frame-loop.cpp +166 -0
- package/native/core/src/app-menus.cpp +26 -9
- package/native/core/src/app-windows.cpp +27 -6
- package/native/core/src/aria-role.cpp +127 -0
- package/native/core/src/control-sizes.cpp +9 -5
- package/native/core/src/crash-report.cpp +196 -0
- package/native/core/src/curl-network.cpp +1562 -0
- package/native/core/src/dbus-menu.cpp +71 -0
- package/native/core/src/default-menu.cpp +134 -0
- package/native/core/src/desktop-view-props.cpp +14 -0
- package/native/core/src/focus-order.cpp +19 -0
- package/native/core/src/header-bar.cpp +20 -0
- package/native/core/src/host-os.cpp +19 -0
- package/native/core/src/host-reload.cpp +45 -0
- package/native/core/src/host-state.cpp +8 -0
- package/native/core/src/image-source.cpp +90 -0
- package/native/core/src/input-dispatcher.cpp +27 -5
- package/native/core/src/input-script.cpp +3 -2
- package/native/core/src/launch-settings.cpp +76 -0
- package/native/core/src/libraries/react-native-reanimated.cpp +6 -1
- package/native/core/src/modules/app-info.cpp +55 -6
- package/native/core/src/modules/app-modules.cpp +1 -1
- package/native/core/src/modules/audio.cpp +4 -2
- package/native/core/src/modules/camera.cpp +8 -11
- package/native/core/src/modules/desktop-expo.cpp +10 -5
- package/native/core/src/modules/desktop-modules.cpp +106 -41
- package/native/core/src/modules/file-photo-picker.cpp +408 -0
- package/native/core/src/modules/notifications.cpp +13 -17
- package/native/core/src/modules/photo-library.cpp +42 -13
- package/native/core/src/modules/web-browser.cpp +89 -0
- package/native/core/src/mounting-manager.cpp +12 -0
- package/native/core/src/native-controls.cpp +42 -1
- package/native/core/src/notification-schedule.cpp +429 -0
- package/native/core/src/openssl-update-crypto.cpp +83 -0
- package/native/core/src/posix-locale.cpp +192 -0
- package/native/core/src/runtime.cpp +30 -1
- package/native/core/src/safe-areas.cpp +19 -4
- package/native/core/src/spawn-rules.cpp +4 -1
- package/native/core/src/split-view.cpp +93 -0
- package/native/core/src/system.cpp +19 -0
- package/native/core/src/text-input.cpp +18 -1
- package/native/core/src/text-units.cpp +99 -0
- package/native/core/src/updates.cpp +76 -17
- package/native/core/src/view-box.cpp +75 -40
- package/native/core/src/view-transform.cpp +28 -0
- package/native/docker/Dockerfile +38 -0
- package/native/docker/Dockerfile.fedora +36 -0
- package/native/docker/glibc-floor.sh +49 -0
- package/native/gtk/CMakeLists.txt +137 -0
- package/native/gtk/accent-colour.cpp +57 -0
- package/native/gtk/accent-colour.h +41 -0
- package/native/gtk/accessibility-settings.cpp +159 -0
- package/native/gtk/accessibility-settings.h +62 -0
- package/native/gtk/accessible-text.cpp +151 -0
- package/native/gtk/accessible-text.h +49 -0
- package/native/gtk/accessible.cpp +306 -0
- package/native/gtk/accessible.h +75 -0
- package/native/gtk/alerts.cpp +267 -0
- package/native/gtk/alerts.h +30 -0
- package/native/gtk/animation-frames.cpp +159 -0
- package/native/gtk/animation-frames.h +20 -0
- package/native/gtk/app-info.cpp +91 -0
- package/native/gtk/app-info.h +25 -0
- package/native/gtk/app-windows.cpp +439 -0
- package/native/gtk/app-windows.h +150 -0
- package/native/gtk/audio.cpp +370 -0
- package/native/gtk/audio.h +54 -0
- package/native/gtk/auth-session.cpp +73 -0
- package/native/gtk/auth-session.h +16 -0
- package/native/gtk/battery.cpp +110 -0
- package/native/gtk/battery.h +19 -0
- package/native/gtk/box-paint.cpp +262 -0
- package/native/gtk/box-paint.h +32 -0
- package/native/gtk/cairo-canvas.cpp +755 -0
- package/native/gtk/cairo-canvas.h +49 -0
- package/native/gtk/camera.cpp +909 -0
- package/native/gtk/camera.h +69 -0
- package/native/gtk/capture.cpp +46 -0
- package/native/gtk/capture.h +19 -0
- package/native/gtk/clock-format.cpp +151 -0
- package/native/gtk/clock-format.h +36 -0
- package/native/gtk/crypto.cpp +75 -0
- package/native/gtk/crypto.h +14 -0
- package/native/gtk/dbus-properties.cpp +131 -0
- package/native/gtk/dbus-properties.h +61 -0
- package/native/gtk/drag-and-drop.cpp +339 -0
- package/native/gtk/drag-and-drop.h +30 -0
- package/native/gtk/file-dialogs.cpp +239 -0
- package/native/gtk/file-dialogs.h +21 -0
- package/native/gtk/file-system.cpp +212 -0
- package/native/gtk/file-system.h +25 -0
- package/native/gtk/focus.cpp +282 -0
- package/native/gtk/focus.h +37 -0
- package/native/gtk/fonts.cpp +89 -0
- package/native/gtk/fonts.h +22 -0
- package/native/gtk/gst-frames.cpp +150 -0
- package/native/gtk/gst-frames.h +47 -0
- package/native/gtk/gst-playback.cpp +496 -0
- package/native/gtk/gst-playback.h +81 -0
- package/native/gtk/gtk-backend.cpp +690 -0
- package/native/gtk/gtk-backend.h +134 -0
- package/native/gtk/host-sources.cpp +354 -0
- package/native/gtk/host-sources.h +46 -0
- package/native/gtk/image-manipulator.cpp +254 -0
- package/native/gtk/image-manipulator.h +30 -0
- package/native/gtk/image-view.cpp +256 -0
- package/native/gtk/image-view.h +54 -0
- package/native/gtk/input-replay.cpp +299 -0
- package/native/gtk/input-replay.h +36 -0
- package/native/gtk/launcher-badge.cpp +29 -0
- package/native/gtk/launcher-badge.h +21 -0
- package/native/gtk/locales.cpp +131 -0
- package/native/gtk/locales.h +23 -0
- package/native/gtk/location.cpp +274 -0
- package/native/gtk/location.h +19 -0
- package/native/gtk/main.cpp +1092 -0
- package/native/gtk/menus.cpp +447 -0
- package/native/gtk/menus.h +100 -0
- package/native/gtk/native-controls.cpp +831 -0
- package/native/gtk/native-controls.h +58 -0
- package/native/gtk/network-state.cpp +72 -0
- package/native/gtk/network-state.h +24 -0
- package/native/gtk/notifications.cpp +235 -0
- package/native/gtk/notifications.h +30 -0
- package/native/gtk/pango-text.cpp +274 -0
- package/native/gtk/pango-text.h +73 -0
- package/native/gtk/portal.cpp +451 -0
- package/native/gtk/portal.h +71 -0
- package/native/gtk/printing.cpp +338 -0
- package/native/gtk/printing.h +34 -0
- package/native/gtk/proxy-resolver.cpp +74 -0
- package/native/gtk/proxy-resolver.h +20 -0
- package/native/gtk/screens.cpp +1461 -0
- package/native/gtk/screens.h +274 -0
- package/native/gtk/scroll-view.cpp +414 -0
- package/native/gtk/scroll-view.h +82 -0
- package/native/gtk/secret-store.cpp +120 -0
- package/native/gtk/secret-store.h +27 -0
- package/native/gtk/settings-portal.cpp +129 -0
- package/native/gtk/settings-portal.h +47 -0
- package/native/gtk/split-view.cpp +1105 -0
- package/native/gtk/split-view.h +195 -0
- package/native/gtk/status-notifier.cpp +487 -0
- package/native/gtk/status-notifier.h +43 -0
- package/native/gtk/surface-input.cpp +251 -0
- package/native/gtk/surface-input.h +57 -0
- package/native/gtk/system-access.cpp +295 -0
- package/native/gtk/system-access.h +37 -0
- package/native/gtk/text-field.cpp +827 -0
- package/native/gtk/text-field.h +78 -0
- package/native/gtk/video.cpp +527 -0
- package/native/gtk/video.h +47 -0
- package/native/gtk/view-widget.cpp +431 -0
- package/native/gtk/view-widget.h +105 -0
- package/native/gtk/window-scale.cpp +95 -0
- package/native/gtk/window-scale.h +35 -0
- package/native/scripts/atspi-check.py +310 -0
- package/native/scripts/atspi-check.test.py +48 -0
- package/native/scripts/build.sh +20 -3
- package/native/scripts/compilers.sh +17 -0
- package/native/scripts/deb-depends-check.sh +22 -0
- package/native/scripts/fetch.sh +23 -2
- package/native/scripts/launch-cell.sh +157 -0
- package/native/scripts/launch-probe.sh +14 -3
- package/native/scripts/make-prebuilt.mjs +133 -44
- package/native/scripts/prebuilt-host-cache.mjs +71 -40
- package/native/scripts/reset-for-compilers.sh +44 -0
- package/native/scripts/start-xvfb.sh +35 -0
- package/native/shim/paragraph-platform/react/renderer/components/text/HostPlatformParagraphProps.h +35 -0
- package/native/shim/view-platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +5 -2
- package/native/shim/worklets/linux-reanimated-props.h +14 -0
- package/native/shim/worklets/linux-worklets.h +23 -0
- package/package.json +6 -3
- package/prebuilt.json +70 -6
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
// nativeBuildVersion (CFBundleVersion), applicationId (CFBundleIdentifier) and applicationName
|
|
6
6
|
// (CFBundleDisplayName, else CFBundleName). A dev run's binary has no bundle: its id and name are
|
|
7
7
|
// the app's own (app.json's), and its versions null.
|
|
8
|
-
// - NgNativeDevice: brand and manufacturer
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// - NgNativeDevice: brand and manufacturer (the OS's maker where it makes the machines, "Apple" on
|
|
9
|
+
// macOS, else the machine's own), modelName (the Mac's marketing name, else its model
|
|
10
|
+
// identifier), modelId ("Mac15,3"), osName ("macOS"), osVersion, osBuildId, deviceName,
|
|
11
|
+
// totalMemory, supportedCpuArchitectures, isDevice true (a desktop is never a simulator) and
|
|
11
12
|
// deviceType 3, expo-device's DESKTOP.
|
|
12
13
|
#pragma once
|
|
13
14
|
|
|
15
|
+
#include "ngn/host-os.h"
|
|
14
16
|
#include "ngn/native-module.h"
|
|
15
17
|
|
|
16
18
|
#include <cstdint>
|
|
19
|
+
#include <functional>
|
|
20
|
+
#include <map>
|
|
17
21
|
#include <memory>
|
|
18
22
|
#include <optional>
|
|
19
23
|
#include <string>
|
|
@@ -30,13 +34,16 @@ struct BundleFacts {
|
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
struct MachineFacts {
|
|
37
|
+
// The machine's maker, as its firmware names it ("LENOVO"): Device's brand where the OS has no
|
|
38
|
+
// maker of its own (HostOs::deviceMaker). Nothing where the firmware does not say.
|
|
39
|
+
std::optional<std::string> manufacturer;
|
|
33
40
|
// "MacBook Pro (14-inch, Nov 2023)"; nothing where the Mac does not say.
|
|
34
41
|
std::optional<std::string> marketingName;
|
|
35
|
-
// "Mac15,3"
|
|
42
|
+
// "Mac15,3"; on Linux, the firmware's product name.
|
|
36
43
|
std::string modelId;
|
|
37
|
-
// "26.1"
|
|
44
|
+
// "26.1"; on Linux, the distribution's version ("9.4").
|
|
38
45
|
std::string osVersion;
|
|
39
|
-
// "25B78"
|
|
46
|
+
// "25B78"; on Linux, the kernel's release.
|
|
40
47
|
std::string osBuildId;
|
|
41
48
|
// The name the user gave the Mac.
|
|
42
49
|
std::optional<std::string> deviceName;
|
|
@@ -45,9 +52,18 @@ struct MachineFacts {
|
|
|
45
52
|
std::vector<std::string> architectures;
|
|
46
53
|
};
|
|
47
54
|
|
|
55
|
+
// The bundle facts in a package's Info.plist keys (CFBundleShortVersionString, CFBundleVersion,
|
|
56
|
+
// CFBundleIdentifier, CFBundleDisplayName and CFBundleName), as `plist` answers them: a Linux
|
|
57
|
+
// package's metadata.json (packagedMetadata), which has no bundle of its own to read.
|
|
58
|
+
BundleFacts bundleFactsOf(const std::function<std::optional<std::string>(const std::string &)> &plist);
|
|
59
|
+
|
|
60
|
+
// The fields of an os-release file (`NAME="AlmaLinux"`), unquoted and unescaped; comments and
|
|
61
|
+
// lines that are not assignments are skipped.
|
|
62
|
+
std::map<std::string, std::string> osReleaseFields(const std::string &text);
|
|
63
|
+
|
|
48
64
|
// `appId` and `appName` stand in for what a bundle with no Info.plist does not have.
|
|
49
65
|
std::shared_ptr<NativeModule> makeApplicationModule(BundleFacts bundle, std::string appId, std::string appName);
|
|
50
|
-
// `
|
|
51
|
-
std::shared_ptr<NativeModule> makeDeviceModule(MachineFacts machine,
|
|
66
|
+
// `os` gives osName and, where the OS's maker makes the machine, the brand.
|
|
67
|
+
std::shared_ptr<NativeModule> makeDeviceModule(MachineFacts machine, const HostOs &os);
|
|
52
68
|
|
|
53
69
|
} // namespace ngn
|
|
@@ -43,6 +43,9 @@ enum class NavigationInput { MouseButton4, MouseButton5, SwipeLeft, SwipeRight }
|
|
|
43
43
|
// with text editing).
|
|
44
44
|
std::optional<NavigationDirection> navigationFor(NavigationInput input, bool rightToLeft = false);
|
|
45
45
|
std::optional<NavigationDirection> navigationFor(const KeyChord &chord, const HostOs &os);
|
|
46
|
+
// Whether a focused text input owns the press: the OS's primary modifier with Z, X, C, V or A, a
|
|
47
|
+
// letter in either case.
|
|
48
|
+
bool editingChord(const KeyChord &chord, const HostOs &os);
|
|
46
49
|
|
|
47
50
|
// A window's back and forward history, as the app's router reports it (`setHistory`): the titles
|
|
48
51
|
// of the entries behind and ahead, nearest first.
|
|
@@ -113,6 +116,10 @@ class MenuHost {
|
|
|
113
116
|
// A key press, before the menus and the focused view see it. True when the app's shortcut takes
|
|
114
117
|
// it, and the press goes no further.
|
|
115
118
|
bool keyDown(const KeyChord &chord, bool textInputFocused);
|
|
119
|
+
// What the Keyboard Shortcuts window lists: the keys of `bar` (the bar drawn), then each shortcut
|
|
120
|
+
// the app gave a label, in its group (a menu of the same title, or one of its own; the app's name
|
|
121
|
+
// for none).
|
|
122
|
+
std::vector<ShortcutGroup> keyboardShortcuts(const std::vector<MenuItem> &bar) const;
|
|
116
123
|
// Back or forward `steps` entries (one, but for a pick from the history menu).
|
|
117
124
|
void navigate(NavigationDirection direction, std::optional<SurfaceId> surface, int steps = 1);
|
|
118
125
|
|
|
@@ -133,7 +140,13 @@ class MenuHost {
|
|
|
133
140
|
std::shared_ptr<MenuBackend> backend_;
|
|
134
141
|
DefaultMenuOptions options_;
|
|
135
142
|
mutable std::mutex mutex_;
|
|
136
|
-
|
|
143
|
+
struct Shortcut {
|
|
144
|
+
std::string id;
|
|
145
|
+
KeyChord chord;
|
|
146
|
+
std::string label;
|
|
147
|
+
std::string group;
|
|
148
|
+
};
|
|
149
|
+
std::vector<Shortcut> shortcuts_;
|
|
137
150
|
std::map<SurfaceId, WindowHistory> histories_;
|
|
138
151
|
// A dropped handle waits for its listener's call in progress, so a module going with a reload
|
|
139
152
|
// is never called after.
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
// (a bundle that failed to load), they do what the OS would.
|
|
9
9
|
//
|
|
10
10
|
// Window frames autosave under the window's key (`main`, a route outlet, a `restoreKey`) in the
|
|
11
|
-
// app's preferences, and a window opened again with that key comes back where it was
|
|
11
|
+
// app's preferences, and a window opened again with that key comes back where it was: at its place
|
|
12
|
+
// and size on macOS, and at its size, maximised or full screen, on Linux, where an app does not
|
|
13
|
+
// place its windows. A reload
|
|
12
14
|
// keeps the windows with a key for the reloaded app to claim, and closes the rest.
|
|
13
15
|
#pragma once
|
|
14
16
|
|
|
@@ -31,12 +33,16 @@ using facebook::react::SurfaceId;
|
|
|
31
33
|
|
|
32
34
|
enum class TitleBar { Default, Transparent, Hidden };
|
|
33
35
|
|
|
34
|
-
// A window's content rectangle in the OS's screen coordinates, in points
|
|
36
|
+
// A window's content rectangle in the OS's screen coordinates, in points, and whether it fills
|
|
37
|
+
// the screen. A maximised or full-screen window's width and height are its size when it is
|
|
38
|
+
// neither, which it goes back to.
|
|
35
39
|
struct WindowFrame {
|
|
36
40
|
double x{0};
|
|
37
41
|
double y{0};
|
|
38
42
|
double width{0};
|
|
39
43
|
double height{0};
|
|
44
|
+
bool maximized{false};
|
|
45
|
+
bool fullScreen{false};
|
|
40
46
|
bool operator==(const WindowFrame &) const = default;
|
|
41
47
|
};
|
|
42
48
|
|
|
@@ -129,9 +135,16 @@ class WindowHost {
|
|
|
129
135
|
// The key window, or none when the app has none.
|
|
130
136
|
void focused(std::optional<SurfaceId> surface);
|
|
131
137
|
void resized(SurfaceId surface, const WindowFrame &frame, double scale);
|
|
138
|
+
// As above, where the frame to restore differs from the one on screen: a maximised or
|
|
139
|
+
// full-screen window on Linux saves the size it goes back to, and the app hears its size now.
|
|
140
|
+
void resized(SurfaceId surface, const WindowFrame &frame, double scale, const WindowFrame &saved);
|
|
132
141
|
void moved(SurfaceId surface, const WindowFrame &frame);
|
|
133
142
|
// The app was opened again, or its Dock icon clicked.
|
|
134
143
|
void reopen(bool hasVisibleWindows);
|
|
144
|
+
// The user closed the app's last window. True when the backend should quit now, as Linux apps do
|
|
145
|
+
// with their last window: no app is listening. An app that listens has decided already, by its
|
|
146
|
+
// `quitWhenLastWindowCloses`, when its AppWindows closed the window, as on macOS.
|
|
147
|
+
bool lastWindowClosed();
|
|
135
148
|
|
|
136
149
|
// --- reloads ---
|
|
137
150
|
// A runtime's module starts listening. After the first, the app has reloaded (from the menu or
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// The role a toolkit whose roles are WAI-ARIA's gives a view: GTK 4's GtkAccessibleRole, which a
|
|
2
|
+
// backend maps one to one. Keyed on the role name React Native goes by (roleName), not on AxRole,
|
|
3
|
+
// which is AppKit's shape: ARIA keeps distinctions AppKit has no role for (a landmark, a table and
|
|
4
|
+
// a grid, a toggle button), so the AppKit table would lose them on the way.
|
|
5
|
+
//
|
|
6
|
+
// Where ARIA's toolkit roles have no counterpart, the nearest stands in (complementary and
|
|
7
|
+
// contentinfo are a region, figure a group, term a label, summary a button), and the role
|
|
8
|
+
// description that AppKit would speak is dropped: AT-SPI does not pass one on, so a label has to
|
|
9
|
+
// say it.
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include "ngn/accessibility.h"
|
|
13
|
+
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace ngn {
|
|
17
|
+
|
|
18
|
+
enum class AriaRole {
|
|
19
|
+
// A view that is no element of its own: its children are read in its place.
|
|
20
|
+
Generic,
|
|
21
|
+
// An author's role="none" and role="presentation".
|
|
22
|
+
None,
|
|
23
|
+
Presentation,
|
|
24
|
+
Alert,
|
|
25
|
+
AlertDialog,
|
|
26
|
+
// GTK 4.14's ARTICLE; a toolkit without it takes Group.
|
|
27
|
+
Article,
|
|
28
|
+
Banner,
|
|
29
|
+
Button,
|
|
30
|
+
Cell,
|
|
31
|
+
Checkbox,
|
|
32
|
+
ColumnHeader,
|
|
33
|
+
ComboBox,
|
|
34
|
+
Dialog,
|
|
35
|
+
Document,
|
|
36
|
+
Feed,
|
|
37
|
+
Form,
|
|
38
|
+
Grid,
|
|
39
|
+
GridCell,
|
|
40
|
+
Group,
|
|
41
|
+
Heading,
|
|
42
|
+
Img,
|
|
43
|
+
// Static text.
|
|
44
|
+
Label,
|
|
45
|
+
Link,
|
|
46
|
+
List,
|
|
47
|
+
ListBox,
|
|
48
|
+
ListItem,
|
|
49
|
+
Log,
|
|
50
|
+
Main,
|
|
51
|
+
Marquee,
|
|
52
|
+
Math,
|
|
53
|
+
Menu,
|
|
54
|
+
MenuBar,
|
|
55
|
+
MenuItem,
|
|
56
|
+
MenuItemCheckbox,
|
|
57
|
+
MenuItemRadio,
|
|
58
|
+
Meter,
|
|
59
|
+
Navigation,
|
|
60
|
+
Note,
|
|
61
|
+
Option,
|
|
62
|
+
ProgressBar,
|
|
63
|
+
Radio,
|
|
64
|
+
RadioGroup,
|
|
65
|
+
Region,
|
|
66
|
+
Row,
|
|
67
|
+
RowGroup,
|
|
68
|
+
RowHeader,
|
|
69
|
+
Scrollbar,
|
|
70
|
+
SearchBox,
|
|
71
|
+
Separator,
|
|
72
|
+
Slider,
|
|
73
|
+
SpinButton,
|
|
74
|
+
Status,
|
|
75
|
+
Switch,
|
|
76
|
+
Tab,
|
|
77
|
+
TabList,
|
|
78
|
+
TabPanel,
|
|
79
|
+
Table,
|
|
80
|
+
Timer,
|
|
81
|
+
ToggleButton,
|
|
82
|
+
Toolbar,
|
|
83
|
+
Tooltip,
|
|
84
|
+
Tree,
|
|
85
|
+
TreeGrid,
|
|
86
|
+
TreeItem,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// The role of a view whose role name is `name` (roleName, empty for none) and whose accessibility
|
|
90
|
+
// the core read as `info` (accessibilityInfo, or paragraphAccessibilityInfo for a Paragraph).
|
|
91
|
+
// `none` and `presentation` are their own roles; any other view that is no element is Generic. An
|
|
92
|
+
// element with no role name, or one this table does not know, is static text when the core reads
|
|
93
|
+
// it as text (a Paragraph) and a group otherwise.
|
|
94
|
+
AriaRole ariaRole(const std::string &name, const AxInfo &info);
|
|
95
|
+
|
|
96
|
+
} // namespace ngn
|
|
@@ -101,6 +101,8 @@ class AudioRecording {
|
|
|
101
101
|
virtual double currentTime() = 0;
|
|
102
102
|
// The average power in dBFS, when metering.
|
|
103
103
|
virtual std::optional<double> metering() = 0;
|
|
104
|
+
// Once stopped: why the file was not finished, or empty when it was.
|
|
105
|
+
virtual std::string error() { return {}; }
|
|
104
106
|
};
|
|
105
107
|
|
|
106
108
|
class AudioInput {
|
|
@@ -203,6 +203,15 @@ struct PickerCamera {
|
|
|
203
203
|
folly::dynamic cameraPermissionOf(CameraHardware::Access access);
|
|
204
204
|
void requestCameraPermission(CameraHardware &hardware, bool noPrompts, JsPromise promise);
|
|
205
205
|
|
|
206
|
+
// What expo-image-picker's mediaTypes (a MediaType, a list of them, or the deprecated
|
|
207
|
+
// MediaTypeOptions) ask for. As on iOS, live photos are photos, and a request that names neither
|
|
208
|
+
// photos nor videos (left out, or an empty list) takes photos.
|
|
209
|
+
struct MediaKinds {
|
|
210
|
+
bool photos{false};
|
|
211
|
+
bool videos{false};
|
|
212
|
+
};
|
|
213
|
+
MediaKinds mediaKindsOf(const folly::dynamic &options);
|
|
214
|
+
|
|
206
215
|
// expo-image-picker's launchCameraAsync(options) over `camera`, shaped as iOS shapes a camera
|
|
207
216
|
// shot (no assetId and no fileName):
|
|
208
217
|
// - a photo, a JPEG at `quality` (1 by default), with base64 and exif only when asked;
|
|
@@ -54,12 +54,15 @@ class ControlSizes : public std::enable_shared_from_this<ControlSizes> {
|
|
|
54
54
|
std::function<bool()> onUiThread,
|
|
55
55
|
Relayout relayout = nullptr);
|
|
56
56
|
|
|
57
|
-
// Layout, any thread: the size of the control `tag` with `props`. `state` is the node's.
|
|
57
|
+
// Layout, any thread: the size of the control `tag` with `props`. `state` is the node's. A
|
|
58
|
+
// toolkit sizes its controls' text by the desktop's text scaling, so each `fontScale` (the
|
|
59
|
+
// layout's text size multiplier) has sizes of its own.
|
|
58
60
|
facebook::react::Size layoutSize(
|
|
59
61
|
Tag tag,
|
|
60
62
|
ControlKind kind,
|
|
61
63
|
std::shared_ptr<const NativeControlProps> props,
|
|
62
|
-
const facebook::react::State::Shared &state
|
|
64
|
+
const facebook::react::State::Shared &state,
|
|
65
|
+
float fontScale = 1);
|
|
63
66
|
|
|
64
67
|
// UI thread: measures every control layout queued, and asks each for a layout again.
|
|
65
68
|
void settle();
|
|
@@ -79,6 +82,8 @@ class ControlSizes : public std::enable_shared_from_this<ControlSizes> {
|
|
|
79
82
|
facebook::react::Size size{};
|
|
80
83
|
};
|
|
81
84
|
struct Queued {
|
|
85
|
+
// Its size key, the text size multiplier included.
|
|
86
|
+
std::string key;
|
|
82
87
|
ControlKind kind;
|
|
83
88
|
std::shared_ptr<const NativeControlProps> props;
|
|
84
89
|
facebook::react::State::Shared state;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// A crash report for a host whose OS keeps none of its own, as macOS keeps one in
|
|
2
|
+
// ~/Library/Logs/DiagnosticReports: on a fatal signal (SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGABRT)
|
|
3
|
+
// the host writes `crash.txt`, naming the signal and the native stack, and the same lines to its
|
|
4
|
+
// standard error, then dies of the signal as it would have. A test launch's report is in its state
|
|
5
|
+
// folder, where the launcher looks for it when the host is lost.
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <functional>
|
|
9
|
+
#include <optional>
|
|
10
|
+
#include <string>
|
|
11
|
+
|
|
12
|
+
namespace ngn {
|
|
13
|
+
|
|
14
|
+
// The account's home folder in the password database, for a process started without HOME.
|
|
15
|
+
std::optional<std::string> accountHomeDirectory();
|
|
16
|
+
|
|
17
|
+
// Where the report goes: `<stateDir>/crash.txt` for a test launch, else
|
|
18
|
+
// `$XDG_STATE_HOME/<appId>/crash.txt`, with `~/.local/state` for an unset XDG_STATE_HOME. The home
|
|
19
|
+
// folder is HOME, else `accountHome`'s, else the temporary folder. Resolved before a crash, as the
|
|
20
|
+
// signal handler can look nothing up.
|
|
21
|
+
std::string crashReportPath(
|
|
22
|
+
const std::string &appId,
|
|
23
|
+
const std::optional<std::string> &testStateDir,
|
|
24
|
+
const std::function<std::optional<std::string>(const std::string &name)> &env,
|
|
25
|
+
const std::function<std::optional<std::string>()> &accountHome = accountHomeDirectory);
|
|
26
|
+
|
|
27
|
+
// Makes the report's folder and handles the fatal signals from now on, on a stack of their own, so
|
|
28
|
+
// a stack overflow is reported too. `program` heads the report. Once for the process.
|
|
29
|
+
void installCrashReport(const std::string &path, const std::string &program);
|
|
30
|
+
|
|
31
|
+
} // namespace ngn
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// The network interface (network.h) over libcurl, for a backend whose OS has no HTTP and WebSocket
|
|
2
|
+
// client to build on: Linux. Built only with NGN_CURL, which the GTK backend turns on.
|
|
3
|
+
//
|
|
4
|
+
// One thread drives every request and connection through a curl_multi handle, so no call blocks
|
|
5
|
+
// its caller, and each request's or connection's callbacks run on that thread, in order. Two
|
|
6
|
+
// exceptions: a url that does not parse fails inside send() or connect(), on the caller's thread,
|
|
7
|
+
// before either returns (send() then returns no task, connect() no connection); and cancel()
|
|
8
|
+
// waits for a callback of that request that is running on the thread to return, so it must not
|
|
9
|
+
// be called holding a lock that callback takes. As
|
|
10
|
+
// NSURLSession does on macOS: redirects are followed, a request's timeout is the longest it may go
|
|
11
|
+
// without a byte in either direction (a header line counts once it is whole, as libcurl hands over
|
|
12
|
+
// only whole ones), compressed bodies arrive decoded, `file:` and `data:` urls
|
|
13
|
+
// answer 200 with no headers, and requests with credentials share one cookie store, which the
|
|
14
|
+
// cookie file keeps between launches as NSHTTPCookieStorage does. A proxy comes from libcurl's
|
|
15
|
+
// environment variables (`http_proxy`, `https_proxy`, `ALL_PROXY` and the rest) when any is set,
|
|
16
|
+
// else from the desktop's settings (desktopProxies), each request's for its url; `NO_PROXY` applies
|
|
17
|
+
// to either. A `file:` url that is not a regular file is refused. TLS is the system's
|
|
18
|
+
// OpenSSL, verifying against the certificates findCaCertificates() locates.
|
|
19
|
+
#pragma once
|
|
20
|
+
|
|
21
|
+
#include "ngn/network.h"
|
|
22
|
+
|
|
23
|
+
#include <functional>
|
|
24
|
+
#include <memory>
|
|
25
|
+
#include <optional>
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
namespace ngn {
|
|
30
|
+
|
|
31
|
+
struct CurlOptions {
|
|
32
|
+
// Where the cookie store is kept between launches, in libcurl's (Netscape's) cookie file format,
|
|
33
|
+
// readable by the user alone. Its lasting cookies are loaded at the start, and it is written again
|
|
34
|
+
// whenever a request or connection has finished and the store differs from the file: a session
|
|
35
|
+
// cookie, or one that has expired, is never written. Empty keeps the store in memory.
|
|
36
|
+
std::string cookieFile;
|
|
37
|
+
// The desktop's proxies for a url, best first, as GProxyResolver and the proxy portal answer
|
|
38
|
+
// (`direct://` for none). Asked as a request or WebSocket starts, on a thread of its own (it may
|
|
39
|
+
// block for seconds, and may run beside another lookup), once per origin every 30 seconds at most,
|
|
40
|
+
// unless a libcurl proxy variable is set, which wins. Unset, or answering nothing usable: libcurl's own
|
|
41
|
+
// choice, from the environment.
|
|
42
|
+
std::function<std::vector<std::string>(const std::string &url)> desktopProxies;
|
|
43
|
+
// The app's name and version, which lead the User-Agent (curlUserAgent).
|
|
44
|
+
std::string appName;
|
|
45
|
+
std::string appVersion;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// The User-Agent a request sends unless it sets its own: `<name>/<version> ng-native libcurl/<v>`,
|
|
49
|
+
// as CFNetwork's on macOS leads with the app's bundle name and version. The name is percent-encoded
|
|
50
|
+
// where an HTTP token cannot hold it; without a version it stands alone, and without a name only
|
|
51
|
+
// `ng-native libcurl/<v>` is sent.
|
|
52
|
+
std::string curlUserAgent(const std::string &appName, const std::string &appVersion);
|
|
53
|
+
|
|
54
|
+
// The proxy libcurl takes (CURLOPT_PROXY) for desktopProxies' answer: the first it can use, with
|
|
55
|
+
// the SOCKS 5 of GNOME's `socks://` and of `socks5://` as `socks5h://` (the proxy resolves the host,
|
|
56
|
+
// as GLib's does), and `direct://` as "" (none, whatever the environment says).
|
|
57
|
+
// Nothing when no entry is usable.
|
|
58
|
+
std::optional<std::string> curlProxyFor(const std::vector<std::string> &proxies);
|
|
59
|
+
|
|
60
|
+
// Whether any proxy variable libcurl reads is set, not empty: `http_proxy`, `https_proxy` or
|
|
61
|
+
// `HTTPS_PROXY`, `ws_proxy`, `wss_proxy` (or their upper case), `all_proxy` or `ALL_PROXY` (`NO_PROXY` only excludes hosts, so it is not one).
|
|
62
|
+
bool proxyEnvironmentSet(const std::function<std::optional<std::string>(const char *name)> &env);
|
|
63
|
+
|
|
64
|
+
// The two clients over one thread, which stops once both are gone.
|
|
65
|
+
struct CurlNetwork {
|
|
66
|
+
std::shared_ptr<Http> http;
|
|
67
|
+
std::shared_ptr<WebSockets> webSockets;
|
|
68
|
+
};
|
|
69
|
+
CurlNetwork makeCurlNetwork(CurlOptions options = {});
|
|
70
|
+
|
|
71
|
+
// Where TLS finds the trusted certificates: a bundle file, else a directory of hashed ones. Both
|
|
72
|
+
// empty leave it to OpenSSL's own default, which is the distribution's when its libcrypto is
|
|
73
|
+
// loaded.
|
|
74
|
+
struct CaCertificates {
|
|
75
|
+
std::string file;
|
|
76
|
+
std::string directory;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// What findCaCertificates reads: an environment variable, and whether a path is a readable file
|
|
80
|
+
// or a directory.
|
|
81
|
+
struct CaProbe {
|
|
82
|
+
std::function<std::optional<std::string>(const char *name)> env;
|
|
83
|
+
std::function<bool(const std::string &path)> isFile;
|
|
84
|
+
std::function<bool(const std::string &path)> isDirectory;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// OpenSSL's SSL_CERT_FILE and SSL_CERT_DIR when either is set, else the first bundle and then the
|
|
88
|
+
// first directory each distribution family keeps, in the order Go's crypto/x509 probes them.
|
|
89
|
+
CaCertificates findCaCertificates(const CaProbe &probe);
|
|
90
|
+
// The same over the real environment and file system.
|
|
91
|
+
CaCertificates findCaCertificates();
|
|
92
|
+
|
|
93
|
+
} // namespace ngn
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// A menu as the com.canonical.dbusmenu interface lays it out, for a Linux tray icon's menu
|
|
2
|
+
// (a StatusNotifierItem's): a tree under a root of id 0, each item numbered from 1 depth first, so a
|
|
3
|
+
// menu sent again keeps its numbers where its shape is the same. An item whose items are drawn in
|
|
4
|
+
// place (inlineItems) gives them to its parent between separators, as AppKit and GMenu sections draw
|
|
5
|
+
// them; a separator at either end, or beside another, is dropped.
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "ngn/default-menu.h"
|
|
9
|
+
|
|
10
|
+
#include <optional>
|
|
11
|
+
#include <string>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
namespace ngn {
|
|
15
|
+
|
|
16
|
+
struct DbusMenuNode {
|
|
17
|
+
int id{0};
|
|
18
|
+
// As dbusmenu shows it: an underscore marks a mnemonic, so the title's own are doubled.
|
|
19
|
+
std::string label;
|
|
20
|
+
bool separator{false};
|
|
21
|
+
bool enabled{true};
|
|
22
|
+
// A checked item is a checkmark toggle that is on; others are no toggle.
|
|
23
|
+
bool checked{false};
|
|
24
|
+
// The item the app knows (its MenuItem id), for a click to name; empty for a submenu or separator.
|
|
25
|
+
std::string itemId;
|
|
26
|
+
// The OS's command a click runs instead (a `menuRole` such as quit), or AppItem for the app's.
|
|
27
|
+
MenuCommand command{MenuCommand::AppItem};
|
|
28
|
+
std::vector<DbusMenuNode> children;
|
|
29
|
+
bool operator==(const DbusMenuNode &) const = default;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// The root (id 0) holding `items`.
|
|
33
|
+
DbusMenuNode dbusMenuLayout(const std::vector<MenuItem> &items);
|
|
34
|
+
// The node numbered `id` under `root`, or null.
|
|
35
|
+
const DbusMenuNode *findDbusMenuNode(const DbusMenuNode &root, int id);
|
|
36
|
+
// A title with its underscores doubled.
|
|
37
|
+
std::string dbusMenuLabel(const std::string &title);
|
|
38
|
+
|
|
39
|
+
} // namespace ngn
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include "ngn/host-os.h"
|
|
10
10
|
|
|
11
11
|
#include <string>
|
|
12
|
+
#include <string_view>
|
|
12
13
|
#include <vector>
|
|
13
14
|
|
|
14
15
|
namespace ngn {
|
|
@@ -42,6 +43,9 @@ enum class MenuCommand {
|
|
|
42
43
|
// Back and forward through the window's history: the app hears them as `navigate`.
|
|
43
44
|
Back,
|
|
44
45
|
Forward,
|
|
46
|
+
// Linux's Keyboard Shortcuts window: the host lists every key the menus and the app's shortcuts
|
|
47
|
+
// take (keyboardShortcuts).
|
|
48
|
+
KeyboardShortcuts,
|
|
45
49
|
// An app's own item: the app hears it as `menuSelect` with the item's id.
|
|
46
50
|
AppItem,
|
|
47
51
|
};
|
|
@@ -94,8 +98,40 @@ struct DefaultMenuOptions {
|
|
|
94
98
|
std::vector<MenuItem> defaultMenuBar(const DefaultMenuOptions &options);
|
|
95
99
|
// macOS's bar (HostOs's menuBar for macOS).
|
|
96
100
|
std::vector<MenuItem> macOSMenuBar(const DefaultMenuOptions &options);
|
|
101
|
+
// Linux's (HostOs's menuBar for Linux): the app's groups, then a menu named for the app with
|
|
102
|
+
// Keyboard Shortcuts (Ctrl+Shift+?), About and Quit. Preferences and Help join it once the app gives
|
|
103
|
+
// them a handler (the app's bar). None of macOS's Hide, Services, Minimize, Zoom or window list.
|
|
104
|
+
std::vector<MenuItem> linuxMenuBar(const DefaultMenuOptions &options);
|
|
105
|
+
|
|
106
|
+
// Where a window shows the app's menus on Linux: a menu bar under the header bar on KDE Plasma,
|
|
107
|
+
// whose apps have one, and the header bar's primary menu everywhere else, as GNOME's apps have it.
|
|
108
|
+
// `currentDesktop` is XDG_CURRENT_DESKTOP, a colon-separated list of desktop names, any of which
|
|
109
|
+
// may be KDE's.
|
|
110
|
+
enum class MenuPlacement { MenuBar, PrimaryMenu };
|
|
111
|
+
MenuPlacement linuxMenuPlacement(std::string_view currentDesktop);
|
|
97
112
|
|
|
98
113
|
// The item with this command anywhere in `menus`, or null.
|
|
99
114
|
const MenuItem *findMenuItem(const std::vector<MenuItem> &menus, MenuCommand command);
|
|
115
|
+
// The enabled item a key press chooses anywhere in `menus`, or null: its key, a letter in either
|
|
116
|
+
// case, with exactly its modifiers. A toolkit whose menus do not take their own keys (GTK's, drawn
|
|
117
|
+
// in a popover) looks a press up here.
|
|
118
|
+
const MenuItem *findMenuItem(const std::vector<MenuItem> &menus, const KeyChord &chord);
|
|
119
|
+
// One group of the Keyboard Shortcuts window: a title, and each entry with its key.
|
|
120
|
+
struct ShortcutEntry {
|
|
121
|
+
std::string title;
|
|
122
|
+
KeyChord chord;
|
|
123
|
+
bool operator==(const ShortcutEntry &) const = default;
|
|
124
|
+
};
|
|
125
|
+
struct ShortcutGroup {
|
|
126
|
+
std::string title;
|
|
127
|
+
std::vector<ShortcutEntry> entries;
|
|
128
|
+
bool operator==(const ShortcutGroup &) const = default;
|
|
129
|
+
};
|
|
130
|
+
// The Keyboard Shortcuts window's groups for `menus`: each menu with the enabled items in it, read
|
|
131
|
+
// through its submenus, that have a key, in order. A menu with none is left out.
|
|
132
|
+
std::vector<ShortcutGroup> menuShortcuts(const std::vector<MenuItem> &menus);
|
|
133
|
+
|
|
134
|
+
// Undo, Redo, Cut, Copy, Paste, Delete and Select All: what a focused text input does itself.
|
|
135
|
+
bool isEditingCommand(MenuCommand command);
|
|
100
136
|
|
|
101
137
|
} // namespace ngn
|
|
@@ -125,6 +125,10 @@ class FileDialogs {
|
|
|
125
125
|
// MIME types ("text/plain", "image/*"); empty for any file.
|
|
126
126
|
std::vector<std::string> types;
|
|
127
127
|
bool multiple{false};
|
|
128
|
+
// The panel's title and the types' filter's name, where the OS shows them; empty for the
|
|
129
|
+
// host's own ("Open File", the types listed).
|
|
130
|
+
std::string title;
|
|
131
|
+
std::string filterName;
|
|
128
132
|
};
|
|
129
133
|
struct SaveRequest {
|
|
130
134
|
std::string suggestedName;
|
|
@@ -182,7 +186,9 @@ class LocaleSource {
|
|
|
182
186
|
virtual CalendarFacts calendars() = 0;
|
|
183
187
|
};
|
|
184
188
|
|
|
185
|
-
// `regionCode` is the system's region ("GB"), which a language tag with no region of its own takes
|
|
189
|
+
// `regionCode` is the system's region ("GB"), which a language tag with no region of its own takes;
|
|
190
|
+
// empty when the system has none. A null `source` (a backend without one) answers English in that
|
|
191
|
+
// region on the Gregorian calendar, with no time zone.
|
|
186
192
|
std::shared_ptr<NativeModule> makeLocalizationModule(std::shared_ptr<LocaleSource> source, std::string regionCode);
|
|
187
193
|
|
|
188
194
|
} // namespace ngn
|
|
@@ -72,6 +72,7 @@ struct DesktopModuleSources {
|
|
|
72
72
|
|
|
73
73
|
std::shared_ptr<WindowHost> windows;
|
|
74
74
|
std::shared_ptr<MenuHost> menus;
|
|
75
|
+
// Null leaves NgNativeTray or NgNativeDock out, so the app's Tray or Dock reads as absent.
|
|
75
76
|
std::shared_ptr<TrayHost> tray;
|
|
76
77
|
std::shared_ptr<DockHost> dock;
|
|
77
78
|
|
|
@@ -104,6 +105,9 @@ struct DesktopModuleSources {
|
|
|
104
105
|
std::shared_ptr<CaptureShield> captureShield;
|
|
105
106
|
std::shared_ptr<SplashGate> splash;
|
|
106
107
|
std::shared_ptr<PhotoLibrary> photos;
|
|
108
|
+
// A picker with no photo library behind it (makeFilePhotoPicker), for ImagePicker's library half
|
|
109
|
+
// where there is no `photos`.
|
|
110
|
+
std::shared_ptr<PhotoPicker> photoPicker;
|
|
107
111
|
std::shared_ptr<CameraHardware> cameraHardware;
|
|
108
112
|
std::shared_ptr<CameraSheet> cameraSheet;
|
|
109
113
|
std::shared_ptr<TrackingAuthority> tracking;
|
|
@@ -114,6 +118,9 @@ struct DesktopModuleSources {
|
|
|
114
118
|
std::shared_ptr<AppleIdProvider> appleId;
|
|
115
119
|
std::shared_ptr<PrintSystem> printSystem;
|
|
116
120
|
std::shared_ptr<ReviewPrompt> reviewPrompt;
|
|
121
|
+
// True where the backend draws map views and joins them to DesktopModules::mapViews; false leaves
|
|
122
|
+
// NgNativeMaps out, so the app's MapView reads as absent.
|
|
123
|
+
bool mapViews{false};
|
|
117
124
|
std::shared_ptr<CryptoSource> crypto;
|
|
118
125
|
std::shared_ptr<LocaleSource> locales;
|
|
119
126
|
// The region the system is set to, read again as each runtime's Localization module starts.
|
|
@@ -137,8 +144,23 @@ struct DesktopModules {
|
|
|
137
144
|
std::shared_ptr<FontLibrary> fonts;
|
|
138
145
|
std::shared_ptr<CameraViews> cameraViews;
|
|
139
146
|
std::shared_ptr<MapViews> mapViews;
|
|
147
|
+
// The modules left out for want of a source, as NgNativeHost names them.
|
|
148
|
+
std::vector<std::string> absent;
|
|
140
149
|
};
|
|
141
150
|
|
|
151
|
+
// Registers each module whose source the backend gives (a module over the host's own objects,
|
|
152
|
+
// such as Processes or Asset, always), and NgNativeHost, whose `absentModules` constant names the
|
|
153
|
+
// ones left out. Store Review and Web Browser's auth session are the exceptions: a null prompt or
|
|
154
|
+
// session is an answer of their own (no rating prompt outside the Mac App Store).
|
|
142
155
|
DesktopModules addDesktopModules(ModuleRegistry ®istry, const DesktopModuleSources &sources);
|
|
143
156
|
|
|
157
|
+
// NgNativeImagePicker as addDesktopModules registers it, or null where it is left out: over the
|
|
158
|
+
// photo library with its camera, or over a picker with no library and the camera where there is
|
|
159
|
+
// one.
|
|
160
|
+
std::shared_ptr<NativeModule> makeDesktopImagePicker(const DesktopModuleSources &sources);
|
|
161
|
+
|
|
162
|
+
// NgNativeHost: `getConstants()` answers `{absentModules}`, the desktop modules this host leaves
|
|
163
|
+
// out by design, which JavaScript reads as absent rather than as a host to rebuild.
|
|
164
|
+
std::shared_ptr<NativeModule> makeHostModule(std::vector<std::string> absent);
|
|
165
|
+
|
|
144
166
|
} // namespace ngn
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#include <optional>
|
|
12
12
|
#include <string>
|
|
13
|
+
#include <vector>
|
|
13
14
|
|
|
14
15
|
namespace ngn {
|
|
15
16
|
|
|
@@ -24,6 +25,19 @@ enum class ScrollbarGutter { Auto, Stable };
|
|
|
24
25
|
// popover at its anchor.
|
|
25
26
|
enum class ModalPresentation { Sheet, Cover, Popover };
|
|
26
27
|
|
|
28
|
+
// The ARIA states and counts no React Native prop carries, as the components commit them: whether a
|
|
29
|
+
// field is required or invalid, an item's place in its set, and a grid's row and column counts.
|
|
30
|
+
struct AriaFields {
|
|
31
|
+
bool required{false};
|
|
32
|
+
bool invalid{false};
|
|
33
|
+
std::optional<int> posInSet;
|
|
34
|
+
std::optional<int> setSize;
|
|
35
|
+
std::optional<int> rowCount;
|
|
36
|
+
std::optional<int> columnCount;
|
|
37
|
+
|
|
38
|
+
bool operator==(const AriaFields &other) const = default;
|
|
39
|
+
};
|
|
40
|
+
|
|
27
41
|
struct DesktopProps {
|
|
28
42
|
// Unset means the toolkit's default for the component.
|
|
29
43
|
std::optional<bool> focusable;
|
|
@@ -53,6 +67,12 @@ struct DesktopProps {
|
|
|
53
67
|
std::string role;
|
|
54
68
|
// `accessibilityLevel` (`aria-level`): a heading's level, from 1.
|
|
55
69
|
std::optional<int> accessibilityLevel;
|
|
70
|
+
// `accessibilityDescribedBy` (`aria-describedby`): the nativeIDs of the views that describe this
|
|
71
|
+
// one (accessibility-relations.h). React Native's ViewProps has `accessibilityLabelledBy`.
|
|
72
|
+
std::vector<std::string> accessibilityDescribedBy;
|
|
73
|
+
// `accessibilityRequired` (`aria-required`) and the rest of the ARIA states and counts React
|
|
74
|
+
// Native's ViewProps lacks (accessibility.h AxInfo).
|
|
75
|
+
AriaFields aria;
|
|
56
76
|
// ModalHostView only.
|
|
57
77
|
ModalPresentation presentation{ModalPresentation::Sheet};
|
|
58
78
|
|
|
@@ -68,7 +88,7 @@ struct HasDesktopProps {
|
|
|
68
88
|
// hit test, the cursor and Tab order all read it, and a flattened view is not mounted.
|
|
69
89
|
inline bool formsStackingContext(const DesktopProps &props) {
|
|
70
90
|
return props.focusable.value_or(false) || props.tabIndex.has_value() || props.cursor.has_value() ||
|
|
71
|
-
!props.role.empty() || props.onDoubleClick || props.onContextMenu || props.onWheel || props.fileDrop || !props.dragItem.isNull() ||
|
|
91
|
+
!props.role.empty() || !props.accessibilityDescribedBy.empty() || props.onDoubleClick || props.onContextMenu || props.onWheel || props.fileDrop || !props.dragItem.isNull() ||
|
|
72
92
|
!props.contextMenu.isNull();
|
|
73
93
|
}
|
|
74
94
|
|
|
@@ -28,6 +28,12 @@ DesktopProps parseDesktopProps(
|
|
|
28
28
|
const DesktopProps &source,
|
|
29
29
|
const facebook::react::RawProps &rawProps);
|
|
30
30
|
|
|
31
|
+
// The ARIA states and counts an update sets, on top of `source`'s: a view's and a text input's.
|
|
32
|
+
AriaFields parseAriaFields(
|
|
33
|
+
const facebook::react::PropsParserContext &context,
|
|
34
|
+
const AriaFields &source,
|
|
35
|
+
const facebook::react::RawProps &rawProps);
|
|
36
|
+
|
|
31
37
|
class DesktopViewProps final : public facebook::react::ViewProps, public HasDesktopProps {
|
|
32
38
|
public:
|
|
33
39
|
DesktopViewProps() = default;
|