basalt-core 0.0.0-rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cli/basalt.d.ts +3 -0
- package/dist/cli/basalt.d.ts.map +1 -0
- package/dist/cli/basalt.js +47 -0
- package/dist/cli/basalt.js.map +1 -0
- package/dist/cli/bundle-cli.d.ts +12 -0
- package/dist/cli/bundle-cli.d.ts.map +1 -0
- package/dist/cli/bundle-cli.js +124 -0
- package/dist/cli/bundle-cli.js.map +1 -0
- package/dist/cli/bundleWithAssets.d.ts +79 -0
- package/dist/cli/bundleWithAssets.d.ts.map +1 -0
- package/dist/cli/bundleWithAssets.js +198 -0
- package/dist/cli/bundleWithAssets.js.map +1 -0
- package/dist/cli/desktop.d.ts +339 -0
- package/dist/cli/desktop.d.ts.map +1 -0
- package/dist/cli/desktop.js +1029 -0
- package/dist/cli/desktop.js.map +1 -0
- package/dist/cli/doctor.d.ts +31 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +283 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init.d.ts +77 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +442 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/metro.d.ts +49 -0
- package/dist/cli/metro.d.ts.map +1 -0
- package/dist/cli/metro.js +148 -0
- package/dist/cli/metro.js.map +1 -0
- package/dist/cli/packageApp.d.ts +102 -0
- package/dist/cli/packageApp.d.ts.map +1 -0
- package/dist/cli/packageApp.js +319 -0
- package/dist/cli/packageApp.js.map +1 -0
- package/dist/cli/steps.d.ts +34 -0
- package/dist/cli/steps.d.ts.map +1 -0
- package/dist/cli/steps.js +53 -0
- package/dist/cli/steps.js.map +1 -0
- package/dist/metro-config.d.ts +168 -0
- package/dist/metro-config.d.ts.map +1 -0
- package/dist/metro-config.js +671 -0
- package/dist/metro-config.js.map +1 -0
- package/dist/react-native.config.d.ts +7 -0
- package/dist/react-native.config.d.ts.map +1 -0
- package/dist/react-native.config.js +80 -0
- package/dist/react-native.config.js.map +1 -0
- package/dist/src/DragSource.d.ts +52 -0
- package/dist/src/DragSource.d.ts.map +1 -0
- package/dist/src/DragSource.js +97 -0
- package/dist/src/DragSource.js.map +1 -0
- package/dist/src/DropTarget.d.ts +58 -0
- package/dist/src/DropTarget.d.ts.map +1 -0
- package/dist/src/DropTarget.js +131 -0
- package/dist/src/DropTarget.js.map +1 -0
- package/dist/src/KeyHandler.d.ts +57 -0
- package/dist/src/KeyHandler.d.ts.map +1 -0
- package/dist/src/KeyHandler.js +48 -0
- package/dist/src/KeyHandler.js.map +1 -0
- package/dist/src/Menu.d.ts +72 -0
- package/dist/src/Menu.d.ts.map +1 -0
- package/dist/src/Menu.js +179 -0
- package/dist/src/Menu.js.map +1 -0
- package/dist/src/TitleBar.d.ts +75 -0
- package/dist/src/TitleBar.d.ts.map +1 -0
- package/dist/src/TitleBar.js +236 -0
- package/dist/src/TitleBar.js.map +1 -0
- package/dist/src/Window.d.ts +87 -0
- package/dist/src/Window.d.ts.map +1 -0
- package/dist/src/Window.js +248 -0
- package/dist/src/Window.js.map +1 -0
- package/dist/src/closeRequest.d.ts +55 -0
- package/dist/src/closeRequest.d.ts.map +1 -0
- package/dist/src/closeRequest.js +134 -0
- package/dist/src/closeRequest.js.map +1 -0
- package/dist/src/index.d.ts +45 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +92 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/overrides/Alert.d.ts +69 -0
- package/dist/src/overrides/Alert.d.ts.map +1 -0
- package/dist/src/overrides/Alert.js +112 -0
- package/dist/src/overrides/Alert.js.map +1 -0
- package/dist/src/overrides/BaseViewConfig.d.ts +28 -0
- package/dist/src/overrides/BaseViewConfig.d.ts.map +1 -0
- package/dist/src/overrides/BaseViewConfig.js +72 -0
- package/dist/src/overrides/BaseViewConfig.js.map +1 -0
- package/dist/src/overrides/Platform.linux.d.ts +10 -0
- package/dist/src/overrides/Platform.linux.d.ts.map +1 -0
- package/dist/src/overrides/Platform.linux.js +15 -0
- package/dist/src/overrides/Platform.linux.js.map +1 -0
- package/dist/src/overrides/Platform.macos.d.ts +10 -0
- package/dist/src/overrides/Platform.macos.d.ts.map +1 -0
- package/dist/src/overrides/Platform.macos.js +15 -0
- package/dist/src/overrides/Platform.macos.js.map +1 -0
- package/dist/src/overrides/Platform.windows.d.ts +10 -0
- package/dist/src/overrides/Platform.windows.d.ts.map +1 -0
- package/dist/src/overrides/Platform.windows.js +15 -0
- package/dist/src/overrides/Platform.windows.js.map +1 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts +24 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.d.ts.map +1 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.js +30 -0
- package/dist/src/overrides/ReactDevToolsSettingsManager.js.map +1 -0
- package/dist/src/overrides/RefreshControl.d.ts +52 -0
- package/dist/src/overrides/RefreshControl.d.ts.map +1 -0
- package/dist/src/overrides/RefreshControl.js +92 -0
- package/dist/src/overrides/RefreshControl.js.map +1 -0
- package/dist/src/overrides/ScrollView.d.ts +39 -0
- package/dist/src/overrides/ScrollView.d.ts.map +1 -0
- package/dist/src/overrides/ScrollView.js +59 -0
- package/dist/src/overrides/ScrollView.js.map +1 -0
- package/dist/src/overrides/Share.d.ts +96 -0
- package/dist/src/overrides/Share.d.ts.map +1 -0
- package/dist/src/overrides/Share.js +97 -0
- package/dist/src/overrides/Share.js.map +1 -0
- package/dist/src/overrides/TextInput.d.ts +81 -0
- package/dist/src/overrides/TextInput.d.ts.map +1 -0
- package/dist/src/overrides/TextInput.js +213 -0
- package/dist/src/overrides/TextInput.js.map +1 -0
- package/dist/src/overrides/View.d.ts +36 -0
- package/dist/src/overrides/View.d.ts.map +1 -0
- package/dist/src/overrides/View.js +99 -0
- package/dist/src/overrides/View.js.map +1 -0
- package/dist/src/overrides/createPlatform.d.ts +32 -0
- package/dist/src/overrides/createPlatform.d.ts.map +1 -0
- package/dist/src/overrides/createPlatform.js +84 -0
- package/dist/src/overrides/createPlatform.js.map +1 -0
- package/dist/src/overrides/setUpDeveloperTools.d.ts +28 -0
- package/dist/src/overrides/setUpDeveloperTools.d.ts.map +1 -0
- package/dist/src/overrides/setUpDeveloperTools.js +84 -0
- package/dist/src/overrides/setUpDeveloperTools.js.map +1 -0
- package/dist/src/overrides/setUpXHR.d.ts +46 -0
- package/dist/src/overrides/setUpXHR.d.ts.map +1 -0
- package/dist/src/overrides/setUpXHR.js +236 -0
- package/dist/src/overrides/setUpXHR.js.map +1 -0
- package/dist/src/quitRequest.d.ts +55 -0
- package/dist/src/quitRequest.d.ts.map +1 -0
- package/dist/src/quitRequest.js +121 -0
- package/dist/src/quitRequest.js.map +1 -0
- package/dist/src/resourcePath.d.ts +18 -0
- package/dist/src/resourcePath.d.ts.map +1 -0
- package/dist/src/resourcePath.js +31 -0
- package/dist/src/resourcePath.js.map +1 -0
- package/dist/src/responseBody.d.ts +76 -0
- package/dist/src/responseBody.d.ts.map +1 -0
- package/dist/src/responseBody.js +94 -0
- package/dist/src/responseBody.js.map +1 -0
- package/dist/src/responseHeaders.d.ts +40 -0
- package/dist/src/responseHeaders.d.ts.map +1 -0
- package/dist/src/responseHeaders.js +75 -0
- package/dist/src/responseHeaders.js.map +1 -0
- package/dist/src/titleBarState.d.ts +43 -0
- package/dist/src/titleBarState.d.ts.map +1 -0
- package/dist/src/titleBarState.js +77 -0
- package/dist/src/titleBarState.js.map +1 -0
- package/dist/src/useContextMenu.d.ts +113 -0
- package/dist/src/useContextMenu.d.ts.map +1 -0
- package/dist/src/useContextMenu.js +109 -0
- package/dist/src/useContextMenu.js.map +1 -0
- package/dist/src/useDialog.d.ts +98 -0
- package/dist/src/useDialog.d.ts.map +1 -0
- package/dist/src/useDialog.js +112 -0
- package/dist/src/useDialog.js.map +1 -0
- package/dist/src/useDisplays.d.ts +70 -0
- package/dist/src/useDisplays.d.ts.map +1 -0
- package/dist/src/useDisplays.js +118 -0
- package/dist/src/useDisplays.js.map +1 -0
- package/dist/src/useHandledKeys.d.ts +38 -0
- package/dist/src/useHandledKeys.d.ts.map +1 -0
- package/dist/src/useHandledKeys.js +70 -0
- package/dist/src/useHandledKeys.js.map +1 -0
- package/dist/src/useWindow.d.ts +140 -0
- package/dist/src/useWindow.d.ts.map +1 -0
- package/dist/src/useWindow.js +233 -0
- package/dist/src/useWindow.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/native/CMakeLists.txt +355 -0
- package/native/bootstrap.sh +613 -0
- package/native/cmake/CompilerFlags.cmake +49 -0
- package/native/cmake/Expo.cmake +125 -0
- package/native/cmake/ReactNativeCore.cmake +612 -0
- package/native/cmake/Reanimated.cmake +108 -0
- package/native/cmake/Skia.cmake +379 -0
- package/native/cmake/ThirdParty.cmake +290 -0
- package/native/cmake/Worklets.cmake +67 -0
- package/native/cmake/codegen/CMakeLists.txt +32 -0
- package/native/core/AppIdentity.cpp +85 -0
- package/native/core/AppIdentity.h +59 -0
- package/native/core/AppPaths.cpp +96 -0
- package/native/core/AppPaths.h +53 -0
- package/native/core/AppearanceModule.cpp +60 -0
- package/native/core/AppearanceModule.h +40 -0
- package/native/core/Backface.h +59 -0
- package/native/core/BlobModule.cpp +283 -0
- package/native/core/BlobModule.h +76 -0
- package/native/core/BlobRegistry.cpp +75 -0
- package/native/core/BlobRegistry.h +44 -0
- package/native/core/ColorScheme.cpp +105 -0
- package/native/core/ColorScheme.h +59 -0
- package/native/core/ComponentRegistry.h +30 -0
- package/native/core/ControlMetrics.h +37 -0
- package/native/core/CoreModules.cpp +592 -0
- package/native/core/CoreModules.h +308 -0
- package/native/core/DebuggingOverlay.cpp +106 -0
- package/native/core/DebuggingOverlay.h +65 -0
- package/native/core/DesktopControls.cpp +232 -0
- package/native/core/DesktopControls.h +170 -0
- package/native/core/DevBundle.cpp +108 -0
- package/native/core/DevBundle.h +69 -0
- package/native/core/DevMenu.cpp +99 -0
- package/native/core/DevMenu.h +75 -0
- package/native/core/DialogModule.cpp +150 -0
- package/native/core/DialogModule.h +51 -0
- package/native/core/DragAndDrop.cpp +45 -0
- package/native/core/DragAndDrop.h +225 -0
- package/native/core/ExpoImageComponent.cpp +79 -0
- package/native/core/ExpoImageComponent.h +80 -0
- package/native/core/ExpoModules.cpp +415 -0
- package/native/core/ExpoModules.h +115 -0
- package/native/core/ExpoRuntime.cpp +366 -0
- package/native/core/ExpoRuntime.h +42 -0
- package/native/core/FocusRing.h +36 -0
- package/native/core/FontRegistry.h +51 -0
- package/native/core/GestureHandlerModule.cpp +136 -0
- package/native/core/GestureHandlerModule.h +71 -0
- package/native/core/Gestures.cpp +533 -0
- package/native/core/Gestures.h +145 -0
- package/native/core/HoverTracker.cpp +69 -0
- package/native/core/HoverTracker.h +109 -0
- package/native/core/HttpClient.cpp +282 -0
- package/native/core/ImageBytes.cpp +205 -0
- package/native/core/ImageBytes.h +29 -0
- package/native/core/ImageCache.cpp +51 -0
- package/native/core/ImageCache.h +89 -0
- package/native/core/JsRuntimeAccess.cpp +70 -0
- package/native/core/JsRuntimeAccess.h +60 -0
- package/native/core/JsiPromise.h +51 -0
- package/native/core/KeyEvents.cpp +116 -0
- package/native/core/KeyEvents.h +144 -0
- package/native/core/LogBoxSurface.cpp +46 -0
- package/native/core/LogBoxSurface.h +68 -0
- package/native/core/MenuModel.h +117 -0
- package/native/core/MenuModule.cpp +209 -0
- package/native/core/MenuModule.h +66 -0
- package/native/core/MountingWalk.h +524 -0
- package/native/core/PackageModules.cpp.in +25 -0
- package/native/core/PackageModules.h +50 -0
- package/native/core/PlatformConstantsModule.cpp +63 -0
- package/native/core/PlatformConstantsModule.h +64 -0
- package/native/core/PlatformServices.h +213 -0
- package/native/core/PointerButtons.h +63 -0
- package/native/core/PullToRefresh.cpp +57 -0
- package/native/core/PullToRefresh.h +73 -0
- package/native/core/ReanimatedCompat.h +47 -0
- package/native/core/ReanimatedModule.cpp +203 -0
- package/native/core/ReanimatedModule.h +55 -0
- package/native/core/ScrollAnimation.cpp +59 -0
- package/native/core/ScrollAnimation.h +70 -0
- package/native/core/ScrollBounds.cpp +26 -0
- package/native/core/ScrollBounds.h +68 -0
- package/native/core/ScrollIndicator.cpp +50 -0
- package/native/core/ScrollIndicator.h +69 -0
- package/native/core/ScrollMomentum.cpp +71 -0
- package/native/core/ScrollMomentum.h +73 -0
- package/native/core/ScrollSnap.cpp +123 -0
- package/native/core/ScrollSnap.h +80 -0
- package/native/core/ShareFallback.cpp +101 -0
- package/native/core/ShareFallback.h +45 -0
- package/native/core/SkiaPictureViewComponent.cpp +11 -0
- package/native/core/SkiaPictureViewComponent.h +47 -0
- package/native/core/SourceCodeModule.cpp +55 -0
- package/native/core/SourceCodeModule.h +53 -0
- package/native/core/StatusBarModule.cpp +23 -0
- package/native/core/StatusBarModule.h +42 -0
- package/native/core/TestDialog.cpp +148 -0
- package/native/core/TestDialog.h +96 -0
- package/native/core/TestKeys.cpp +78 -0
- package/native/core/TestKeys.h +50 -0
- package/native/core/TestQuitFile.cpp +33 -0
- package/native/core/TestQuitFile.h +60 -0
- package/native/core/TestSettle.h +192 -0
- package/native/core/TitleBarRegions.h +31 -0
- package/native/core/TurboModuleProxy.cpp +51 -0
- package/native/core/TurboModuleProxy.h +46 -0
- package/native/core/UIManagerAccess.cpp +43 -0
- package/native/core/UIManagerAccess.h +43 -0
- package/native/core/WindowBoundsCache.cpp +319 -0
- package/native/core/WindowControl.h +235 -0
- package/native/core/WindowHost.h +158 -0
- package/native/core/WindowMethods.cpp +167 -0
- package/native/core/WindowMethods.h +84 -0
- package/native/core/WindowsModule.cpp +448 -0
- package/native/core/WindowsModule.h +133 -0
- package/native/core/WorkletsModule.cpp +199 -0
- package/native/core/WorkletsModule.h +57 -0
- package/native/core/portability_probe.cpp +210 -0
- package/native/tests/EventRecorder.h +124 -0
- package/native/tests/TestHarness.cpp +109 -0
- package/native/tests/TestHarness.h +89 -0
- package/native/tests/TreeDump.h +49 -0
- package/native/tests/test_app_identity.cpp +114 -0
- package/native/tests/test_app_paths.cpp +48 -0
- package/native/tests/test_appearance.cpp +107 -0
- package/native/tests/test_backface.cpp +79 -0
- package/native/tests/test_blobs.cpp +157 -0
- package/native/tests/test_controls.cpp +185 -0
- package/native/tests/test_devbundle.cpp +103 -0
- package/native/tests/test_drag_and_drop.cpp +143 -0
- package/native/tests/test_gestures.cpp +331 -0
- package/native/tests/test_hover.cpp +92 -0
- package/native/tests/test_image_cache.cpp +109 -0
- package/native/tests/test_js_runtime_access.cpp +137 -0
- package/native/tests/test_key_events.cpp +235 -0
- package/native/tests/test_momentum.cpp +138 -0
- package/native/tests/test_quit_file.cpp +104 -0
- package/native/tests/test_scroll_animation.cpp +120 -0
- package/native/tests/test_scroll_bounds.cpp +66 -0
- package/native/tests/test_scroll_indicator.cpp +149 -0
- package/native/tests/test_scroll_snap.cpp +112 -0
- package/native/tests/test_settle.cpp +115 -0
- package/native/tests/test_share.cpp +75 -0
- package/native/tests/test_sourcecode.cpp +62 -0
- package/native/tests/test_window_close.cpp +119 -0
- package/native/tests/test_window_limits.cpp +123 -0
- package/package.json +43 -0
- package/react-native.config.js +86 -0
- package/supported-versions.json +66 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
// The core React Native modules ReactCxxPlatform does not provide.
|
|
2
|
+
//
|
|
3
|
+
// Upstream supplies fifteen -- Animated, AppState, DeviceInfo, DevSettings,
|
|
4
|
+
// ImageLoader, LogBox, ExceptionsManager, the observers, Networking,
|
|
5
|
+
// PlatformConstants, SourceCode, WebSocket. What is here is the set a real app
|
|
6
|
+
// reaches for and finds missing, and it splits in two ways that matter.
|
|
7
|
+
//
|
|
8
|
+
// **How they fail.** `Clipboard` and `Vibration` are looked up with
|
|
9
|
+
// `getEnforcing`, so their absence *throws at import* -- an app that so much as
|
|
10
|
+
// imports Clipboard dies at startup with no render. The rest are looked up with
|
|
11
|
+
// `get`, which returns null, so React Native's JavaScript falls back or quietly
|
|
12
|
+
// does nothing: `Alert.alert()` was a dialog that never appeared and
|
|
13
|
+
// `Linking.openURL()` a link that never opened, with no error either way. The
|
|
14
|
+
// second kind is worse to debug and was less obviously urgent, which is why
|
|
15
|
+
// this file does both at once.
|
|
16
|
+
//
|
|
17
|
+
// **What they need.** Six modules, three of which touch an operating system --
|
|
18
|
+
// clipboard, opening a URL, showing a dialog -- and three of which answer
|
|
19
|
+
// rather than act. The first three go through `PlatformServices.h`; the other
|
|
20
|
+
// three are portable in full.
|
|
21
|
+
//
|
|
22
|
+
// One file because they are a set and each is small. Splitting them would mean
|
|
23
|
+
// six headers saying very little and one seam between them.
|
|
24
|
+
|
|
25
|
+
#pragma once
|
|
26
|
+
|
|
27
|
+
#include "PlatformServices.h"
|
|
28
|
+
|
|
29
|
+
#include <FBReactNativeSpec/FBReactNativeSpecJSI.h>
|
|
30
|
+
|
|
31
|
+
#include <optional>
|
|
32
|
+
#include <string>
|
|
33
|
+
|
|
34
|
+
namespace basalt {
|
|
35
|
+
|
|
36
|
+
// Throws at import without this: `Clipboard` is a getEnforcing lookup.
|
|
37
|
+
class DesktopClipboardModule
|
|
38
|
+
: public facebook::react::NativeClipboardCxxSpec<DesktopClipboardModule> {
|
|
39
|
+
public:
|
|
40
|
+
explicit DesktopClipboardModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
41
|
+
: NativeClipboardCxxSpec(std::move(jsInvoker)) {}
|
|
42
|
+
|
|
43
|
+
static constexpr const char *kModuleName = "Clipboard";
|
|
44
|
+
|
|
45
|
+
facebook::jsi::Object getConstants(facebook::jsi::Runtime &rt);
|
|
46
|
+
facebook::jsi::Value getString(facebook::jsi::Runtime &rt);
|
|
47
|
+
void setString(facebook::jsi::Runtime &rt, facebook::jsi::String content);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Also a getEnforcing lookup, and meaningless on a desktop -- so the module
|
|
51
|
+
// exists and does nothing, which is the truthful implementation rather than a
|
|
52
|
+
// placeholder. A machine with no vibration motor cannot be made to buzz by
|
|
53
|
+
// anything this file could contain.
|
|
54
|
+
class DesktopVibrationModule
|
|
55
|
+
: public facebook::react::NativeVibrationCxxSpec<DesktopVibrationModule> {
|
|
56
|
+
public:
|
|
57
|
+
explicit DesktopVibrationModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
58
|
+
: NativeVibrationCxxSpec(std::move(jsInvoker)) {}
|
|
59
|
+
|
|
60
|
+
static constexpr const char *kModuleName = "Vibration";
|
|
61
|
+
|
|
62
|
+
facebook::jsi::Object getConstants(facebook::jsi::Runtime &rt);
|
|
63
|
+
void vibrate(facebook::jsi::Runtime &rt, double pattern);
|
|
64
|
+
void vibrateByPattern(facebook::jsi::Runtime &rt,
|
|
65
|
+
facebook::jsi::Array pattern,
|
|
66
|
+
double repeat);
|
|
67
|
+
void cancel(facebook::jsi::Runtime &rt);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// `Alert.alert()`, which until now did nothing at all -- a confirmation dialog
|
|
71
|
+
// that never appeared and never reported a choice, so the code after it simply
|
|
72
|
+
// never ran.
|
|
73
|
+
class DesktopAlertModule
|
|
74
|
+
: public facebook::react::NativeAlertManagerCxxSpec<DesktopAlertModule> {
|
|
75
|
+
public:
|
|
76
|
+
explicit DesktopAlertModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
77
|
+
: NativeAlertManagerCxxSpec(std::move(jsInvoker)) {}
|
|
78
|
+
|
|
79
|
+
static constexpr const char *kModuleName = "AlertManager";
|
|
80
|
+
|
|
81
|
+
void alertWithArgs(facebook::jsi::Runtime &rt,
|
|
82
|
+
facebook::jsi::Object args,
|
|
83
|
+
facebook::jsi::Function callback);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// `Linking.openURL()`, which until now opened nothing.
|
|
87
|
+
// The URL an application was launched with, for `Linking.getInitialURL()`.
|
|
88
|
+
//
|
|
89
|
+
// A desktop hands one over on the command line -- a `.desktop` entry's `%u`, a
|
|
90
|
+
// registered scheme on macOS, a shell association on Windows -- so a host
|
|
91
|
+
// records whatever argument looked like one and this answers with it. Set
|
|
92
|
+
// before the surface starts, which is before any JavaScript can ask.
|
|
93
|
+
//
|
|
94
|
+
// What this is not is a URL delivered to an application that is *already*
|
|
95
|
+
// running. That needs single-instance activation on each desktop -- a
|
|
96
|
+
// GApplication with G_APPLICATION_HANDLES_OPEN, an Apple Event handler, a named
|
|
97
|
+
// pipe -- and is a separate piece of work; see docs/BACKLOG.md.
|
|
98
|
+
void setInitialUrl(const std::string &url);
|
|
99
|
+
const std::string &initialUrl();
|
|
100
|
+
|
|
101
|
+
class DesktopLinkingModule
|
|
102
|
+
: public facebook::react::NativeLinkingManagerCxxSpec<DesktopLinkingModule> {
|
|
103
|
+
public:
|
|
104
|
+
explicit DesktopLinkingModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
105
|
+
: NativeLinkingManagerCxxSpec(std::move(jsInvoker)) {}
|
|
106
|
+
|
|
107
|
+
static constexpr const char *kModuleName = "LinkingManager";
|
|
108
|
+
|
|
109
|
+
facebook::jsi::Value getInitialURL(facebook::jsi::Runtime &rt);
|
|
110
|
+
facebook::jsi::Value canOpenURL(facebook::jsi::Runtime &rt, facebook::jsi::String url);
|
|
111
|
+
facebook::jsi::Value openURL(facebook::jsi::Runtime &rt, facebook::jsi::String url);
|
|
112
|
+
facebook::jsi::Value openSettings(facebook::jsi::Runtime &rt);
|
|
113
|
+
void addListener(facebook::jsi::Runtime &rt, facebook::jsi::String eventName);
|
|
114
|
+
void removeListeners(facebook::jsi::Runtime &rt, double count);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// `Share.share()`.
|
|
118
|
+
//
|
|
119
|
+
// The last of React Native's core modules that was throwing, and the one whose
|
|
120
|
+
// JavaScript had to be replaced as well: `Share.js` branches on `Platform.OS`
|
|
121
|
+
// being exactly `android` or `ios` and rejects with "Unsupported platform"
|
|
122
|
+
// otherwise, so the module was never reached at all. See
|
|
123
|
+
// src/overrides/Share.js.
|
|
124
|
+
//
|
|
125
|
+
// Shaped like Android's `ShareModule` rather than iOS's action sheet, because
|
|
126
|
+
// the Android one is the promise-shaped API and the iOS one is a callback pair
|
|
127
|
+
// on `ActionSheetManager`. It takes what Android's does plus a `url`, which
|
|
128
|
+
// React Native marks as iOS-only and a desktop has no reason to refuse.
|
|
129
|
+
//
|
|
130
|
+
// The promise settles when the picker does, which may be a long time: this is
|
|
131
|
+
// the first asynchronous thing on this platform that is genuinely asynchronous
|
|
132
|
+
// underneath, so it is the first to need a promise that is not already settled.
|
|
133
|
+
// `AsyncPromise` is ReactCommon's, and it handles the thread hop back.
|
|
134
|
+
class DesktopShareModule : public facebook::react::NativeShareModuleCxxSpec<DesktopShareModule> {
|
|
135
|
+
public:
|
|
136
|
+
explicit DesktopShareModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
137
|
+
: NativeShareModuleCxxSpec(std::move(jsInvoker)) {}
|
|
138
|
+
|
|
139
|
+
static constexpr const char *kModuleName = "ShareModule";
|
|
140
|
+
|
|
141
|
+
facebook::jsi::Object getConstants(facebook::jsi::Runtime &rt);
|
|
142
|
+
facebook::jsi::Value share(facebook::jsi::Runtime &rt,
|
|
143
|
+
facebook::jsi::Object content,
|
|
144
|
+
std::optional<facebook::jsi::String> dialogTitle);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Right-to-left layout. Portable in full: Yoga already does the work, and this
|
|
148
|
+
// is the switch that turns it on.
|
|
149
|
+
class DesktopI18nManagerModule
|
|
150
|
+
: public facebook::react::NativeI18nManagerCxxSpec<DesktopI18nManagerModule> {
|
|
151
|
+
public:
|
|
152
|
+
explicit DesktopI18nManagerModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
153
|
+
: NativeI18nManagerCxxSpec(std::move(jsInvoker)) {}
|
|
154
|
+
|
|
155
|
+
static constexpr const char *kModuleName = "I18nManager";
|
|
156
|
+
|
|
157
|
+
facebook::jsi::Object getConstants(facebook::jsi::Runtime &rt);
|
|
158
|
+
void allowRTL(facebook::jsi::Runtime &rt, bool allowRTL);
|
|
159
|
+
void forceRTL(facebook::jsi::Runtime &rt, bool forceRTL);
|
|
160
|
+
void swapLeftAndRightInRTL(facebook::jsi::Runtime &rt, bool flipStyles);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// What assistive technology is doing, as *iOS* names it.
|
|
164
|
+
//
|
|
165
|
+
// The Android spec, `AccessibilityInfo`, is implemented below as well, and this
|
|
166
|
+
// is the one that gets used. `AccessibilityInfo.js` branches on
|
|
167
|
+
// `Platform.OS === 'android'` in eight places and a third platform takes the
|
|
168
|
+
// else branch every time -- which is the iOS path, calling
|
|
169
|
+
// `NativeAccessibilityManagerIOS`. So implementing only the Android module left
|
|
170
|
+
// `isScreenReaderEnabled()` throwing "NativeAccessibilityManagerIOS is not
|
|
171
|
+
// available", which is how this was found.
|
|
172
|
+
//
|
|
173
|
+
// The same shape as `Image`'s view config in phase 26 and `TextInput`'s render
|
|
174
|
+
// in phase 09: React Native branching two ways on a platform that is neither,
|
|
175
|
+
// and landing on iOS. Worth expecting rather than rediscovering.
|
|
176
|
+
//
|
|
177
|
+
// Each getter takes (onSuccess, onError) rather than returning.
|
|
178
|
+
class DesktopAccessibilityManagerModule
|
|
179
|
+
: public facebook::react::NativeAccessibilityManagerCxxSpec<DesktopAccessibilityManagerModule> {
|
|
180
|
+
public:
|
|
181
|
+
explicit DesktopAccessibilityManagerModule(
|
|
182
|
+
std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
183
|
+
: NativeAccessibilityManagerCxxSpec(std::move(jsInvoker)) {}
|
|
184
|
+
|
|
185
|
+
static constexpr const char *kModuleName = "AccessibilityManager";
|
|
186
|
+
|
|
187
|
+
void getCurrentBoldTextState(facebook::jsi::Runtime &rt,
|
|
188
|
+
facebook::jsi::Function onSuccess,
|
|
189
|
+
facebook::jsi::Function onError);
|
|
190
|
+
void getCurrentGrayscaleState(facebook::jsi::Runtime &rt,
|
|
191
|
+
facebook::jsi::Function onSuccess,
|
|
192
|
+
facebook::jsi::Function onError);
|
|
193
|
+
void getCurrentInvertColorsState(facebook::jsi::Runtime &rt,
|
|
194
|
+
facebook::jsi::Function onSuccess,
|
|
195
|
+
facebook::jsi::Function onError);
|
|
196
|
+
void getCurrentReduceMotionState(facebook::jsi::Runtime &rt,
|
|
197
|
+
facebook::jsi::Function onSuccess,
|
|
198
|
+
facebook::jsi::Function onError);
|
|
199
|
+
void getCurrentDarkerSystemColorsState(facebook::jsi::Runtime &rt,
|
|
200
|
+
facebook::jsi::Function onSuccess,
|
|
201
|
+
facebook::jsi::Function onError);
|
|
202
|
+
void getCurrentPrefersCrossFadeTransitionsState(facebook::jsi::Runtime &rt,
|
|
203
|
+
facebook::jsi::Function onSuccess,
|
|
204
|
+
facebook::jsi::Function onError);
|
|
205
|
+
void getCurrentReduceTransparencyState(facebook::jsi::Runtime &rt,
|
|
206
|
+
facebook::jsi::Function onSuccess,
|
|
207
|
+
facebook::jsi::Function onError);
|
|
208
|
+
void getCurrentVoiceOverState(facebook::jsi::Runtime &rt,
|
|
209
|
+
facebook::jsi::Function onSuccess,
|
|
210
|
+
facebook::jsi::Function onError);
|
|
211
|
+
|
|
212
|
+
void setAccessibilityContentSizeMultipliers(
|
|
213
|
+
facebook::jsi::Runtime &rt,
|
|
214
|
+
facebook::jsi::Object jsMultipliers);
|
|
215
|
+
void setAccessibilityFocus(facebook::jsi::Runtime &rt, double reactTag);
|
|
216
|
+
void announceForAccessibility(facebook::jsi::Runtime &rt, facebook::jsi::String announcement);
|
|
217
|
+
void announceForAccessibilityWithOptions(facebook::jsi::Runtime &rt,
|
|
218
|
+
facebook::jsi::String announcement,
|
|
219
|
+
facebook::jsi::Object options);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// The Android spelling of the same thing. Kept because an app can reach it
|
|
223
|
+
// directly and because which one React Native picks is a JavaScript decision
|
|
224
|
+
// that could change.
|
|
225
|
+
class DesktopAccessibilityInfoModule
|
|
226
|
+
: public facebook::react::NativeAccessibilityInfoCxxSpec<DesktopAccessibilityInfoModule> {
|
|
227
|
+
public:
|
|
228
|
+
explicit DesktopAccessibilityInfoModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
229
|
+
: NativeAccessibilityInfoCxxSpec(std::move(jsInvoker)) {}
|
|
230
|
+
|
|
231
|
+
static constexpr const char *kModuleName = "AccessibilityInfo";
|
|
232
|
+
|
|
233
|
+
void isReduceMotionEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
234
|
+
void isInvertColorsEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
235
|
+
void isHighTextContrastEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
236
|
+
void isTouchExplorationEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
237
|
+
void isAccessibilityServiceEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
238
|
+
void isGrayscaleEnabled(facebook::jsi::Runtime &rt, facebook::jsi::Function onSuccess);
|
|
239
|
+
void setAccessibilityFocus(facebook::jsi::Runtime &rt, double reactTag);
|
|
240
|
+
void announceForAccessibility(facebook::jsi::Runtime &rt, facebook::jsi::String announcement);
|
|
241
|
+
void getRecommendedTimeoutMillis(facebook::jsi::Runtime &rt,
|
|
242
|
+
double mSec,
|
|
243
|
+
facebook::jsi::Function onSuccess);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// `ToastAndroid`, which is a getEnforcing lookup and so throws at import.
|
|
247
|
+
//
|
|
248
|
+
// Android's toast is a transient message that appears over the app and fades.
|
|
249
|
+
// A desktop has no such thing built in: the nearest equivalent is a system
|
|
250
|
+
// notification, which is a different thing with a different lifetime and needs
|
|
251
|
+
// a notification API neither platform has wired up.
|
|
252
|
+
//
|
|
253
|
+
// So the message is logged rather than shown. That is not a good answer and it
|
|
254
|
+
// is a better one than throwing: an app that shows a toast is telling the user
|
|
255
|
+
// something, and losing it silently is worse than losing it visibly in a log.
|
|
256
|
+
// See docs/BACKLOG.md.
|
|
257
|
+
class DesktopToastModule
|
|
258
|
+
: public facebook::react::NativeToastAndroidCxxSpec<DesktopToastModule> {
|
|
259
|
+
public:
|
|
260
|
+
explicit DesktopToastModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
261
|
+
: NativeToastAndroidCxxSpec(std::move(jsInvoker)) {}
|
|
262
|
+
|
|
263
|
+
static constexpr const char *kModuleName = "ToastAndroid";
|
|
264
|
+
|
|
265
|
+
facebook::jsi::Object getConstants(facebook::jsi::Runtime &rt);
|
|
266
|
+
void show(facebook::jsi::Runtime &rt, facebook::jsi::String message, double duration);
|
|
267
|
+
void showWithGravity(facebook::jsi::Runtime &rt,
|
|
268
|
+
facebook::jsi::String message,
|
|
269
|
+
double duration,
|
|
270
|
+
double gravity);
|
|
271
|
+
void showWithGravityAndOffset(facebook::jsi::Runtime &rt,
|
|
272
|
+
facebook::jsi::String message,
|
|
273
|
+
double duration,
|
|
274
|
+
double gravity,
|
|
275
|
+
double xOffset,
|
|
276
|
+
double yOffset);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// `DevSettings`, which is a getEnforcing lookup -- and which upstream provides
|
|
280
|
+
// *only when a dev server exists*.
|
|
281
|
+
//
|
|
282
|
+
// So in a release bundle it is absent and `DevSettings.reload()` throws, which
|
|
283
|
+
// is a production crash reachable from ordinary code. This module exists to
|
|
284
|
+
// fill that gap and must therefore be offered only when upstream's is not:
|
|
285
|
+
// the host passes `enableDevMode` and skips this in dev, where the real one can
|
|
286
|
+
// actually reload.
|
|
287
|
+
class DesktopDevSettingsModule
|
|
288
|
+
: public facebook::react::NativeDevSettingsCxxSpec<DesktopDevSettingsModule> {
|
|
289
|
+
public:
|
|
290
|
+
explicit DesktopDevSettingsModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker)
|
|
291
|
+
: NativeDevSettingsCxxSpec(std::move(jsInvoker)) {}
|
|
292
|
+
|
|
293
|
+
static constexpr const char *kModuleName = "DevSettings";
|
|
294
|
+
|
|
295
|
+
void reload(facebook::jsi::Runtime &rt);
|
|
296
|
+
void reloadWithReason(facebook::jsi::Runtime &rt, facebook::jsi::String reason);
|
|
297
|
+
void onFastRefresh(facebook::jsi::Runtime &rt);
|
|
298
|
+
void setHotLoadingEnabled(facebook::jsi::Runtime &rt, bool isHotLoadingEnabled);
|
|
299
|
+
void setProfilingEnabled(facebook::jsi::Runtime &rt, bool isProfilingEnabled);
|
|
300
|
+
void toggleElementInspector(facebook::jsi::Runtime &rt);
|
|
301
|
+
void addMenuItem(facebook::jsi::Runtime &rt, facebook::jsi::String title);
|
|
302
|
+
void openDebugger(facebook::jsi::Runtime &rt);
|
|
303
|
+
void addListener(facebook::jsi::Runtime &rt, facebook::jsi::String eventName);
|
|
304
|
+
void removeListeners(facebook::jsi::Runtime &rt, double count);
|
|
305
|
+
void setIsShakeToShowDevMenuEnabled(facebook::jsi::Runtime &rt, bool enabled);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
} // namespace basalt
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#include "DebuggingOverlay.h"
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
|
|
5
|
+
namespace basalt {
|
|
6
|
+
|
|
7
|
+
namespace {
|
|
8
|
+
|
|
9
|
+
// DevTools' own blue, which React Native draws an inspected element in on iOS
|
|
10
|
+
// and Android. Hard-coded rather than themed: the point of the colour is that
|
|
11
|
+
// it is recognisably DevTools' rather than the app's.
|
|
12
|
+
constexpr float kInspectorBlue[4] = {0.102F, 0.624F, 0.980F, 0.45F};
|
|
13
|
+
|
|
14
|
+
// The colour a trace update falls back to when DevTools sent none.
|
|
15
|
+
constexpr float kTraceFallback[4] = {0.0F, 0.78F, 0.33F, 1.0F};
|
|
16
|
+
|
|
17
|
+
float numberAt(const folly::dynamic &object, const char *key) {
|
|
18
|
+
const auto *value = object.get_ptr(key);
|
|
19
|
+
return value != nullptr && value->isNumber() ? static_cast<float>(value->asDouble()) : 0.0F;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// A processed colour: React Native's JavaScript sends these as one integer in
|
|
23
|
+
// 0xAARRGGBB, which is what `processColor` produces and what every other colour
|
|
24
|
+
// crossing this boundary looks like.
|
|
25
|
+
bool readProcessedColor(const folly::dynamic &object, const char *key, float out[4]) {
|
|
26
|
+
const auto *value = object.get_ptr(key);
|
|
27
|
+
if (value == nullptr || !value->isNumber()) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const auto packed = static_cast<uint32_t>(value->asInt());
|
|
31
|
+
out[0] = static_cast<float>((packed >> 16) & 0xFFU) / 255.0F;
|
|
32
|
+
out[1] = static_cast<float>((packed >> 8) & 0xFFU) / 255.0F;
|
|
33
|
+
out[2] = static_cast<float>(packed & 0xFFU) / 255.0F;
|
|
34
|
+
out[3] = static_cast<float>((packed >> 24) & 0xFFU) / 255.0F;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void readRectangle(const folly::dynamic &source, Highlight &highlight) {
|
|
39
|
+
highlight.x = numberAt(source, "x");
|
|
40
|
+
highlight.y = numberAt(source, "y");
|
|
41
|
+
highlight.width = numberAt(source, "width");
|
|
42
|
+
highlight.height = numberAt(source, "height");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The first argument, as a list. A command's payload is an array of arguments
|
|
46
|
+
// and every one of these takes a single array.
|
|
47
|
+
const folly::dynamic *firstArray(const folly::dynamic &args) {
|
|
48
|
+
if (args.isArray() && !args.empty() && args[0].isArray()) {
|
|
49
|
+
return &args[0];
|
|
50
|
+
}
|
|
51
|
+
// Also accepts the list itself, which is what a caller that unwrapped the
|
|
52
|
+
// arguments already would send -- and what the tests find easier to write.
|
|
53
|
+
return args.isArray() ? &args : nullptr;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
} // namespace
|
|
57
|
+
|
|
58
|
+
std::vector<Highlight> parseTraceUpdates(const folly::dynamic &args) {
|
|
59
|
+
std::vector<Highlight> highlights;
|
|
60
|
+
const folly::dynamic *list = firstArray(args);
|
|
61
|
+
if (list == nullptr) {
|
|
62
|
+
return highlights;
|
|
63
|
+
}
|
|
64
|
+
for (const auto &entry : *list) {
|
|
65
|
+
if (!entry.isObject()) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
Highlight highlight;
|
|
69
|
+
const auto *rectangle = entry.get_ptr("rectangle");
|
|
70
|
+
if (rectangle == nullptr || !rectangle->isObject()) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
readRectangle(*rectangle, highlight);
|
|
74
|
+
if (!readProcessedColor(entry, "color", highlight.color)) {
|
|
75
|
+
for (int i = 0; i < 4; i++) {
|
|
76
|
+
highlight.color[i] = kTraceFallback[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
highlight.filled = false;
|
|
80
|
+
highlights.push_back(highlight);
|
|
81
|
+
}
|
|
82
|
+
return highlights;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
std::vector<Highlight> parseElementHighlights(const folly::dynamic &args) {
|
|
86
|
+
std::vector<Highlight> highlights;
|
|
87
|
+
const folly::dynamic *list = firstArray(args);
|
|
88
|
+
if (list == nullptr) {
|
|
89
|
+
return highlights;
|
|
90
|
+
}
|
|
91
|
+
for (const auto &entry : *list) {
|
|
92
|
+
if (!entry.isObject()) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
Highlight highlight;
|
|
96
|
+
readRectangle(entry, highlight);
|
|
97
|
+
for (int i = 0; i < 4; i++) {
|
|
98
|
+
highlight.color[i] = kInspectorBlue[i];
|
|
99
|
+
}
|
|
100
|
+
highlight.filled = true;
|
|
101
|
+
highlights.push_back(highlight);
|
|
102
|
+
}
|
|
103
|
+
return highlights;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
} // namespace basalt
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// React DevTools' element highlighter.
|
|
2
|
+
//
|
|
3
|
+
// `DebuggingOverlay` is the view React Native mounts over an app when DevTools
|
|
4
|
+
// asks it to draw attention to something. Two things use it, and they look
|
|
5
|
+
// different on purpose:
|
|
6
|
+
//
|
|
7
|
+
// highlightTraceUpdates "Highlight updates when components render" -- a
|
|
8
|
+
// coloured outline around everything that just
|
|
9
|
+
// re-rendered, in the colour DevTools chose for how
|
|
10
|
+
// often it has. It is meant to flash, so it clears
|
|
11
|
+
// itself; nothing tells it to.
|
|
12
|
+
//
|
|
13
|
+
// highlightElements The blue box over the component being inspected,
|
|
14
|
+
// which stays until `clearElementsHighlights`.
|
|
15
|
+
//
|
|
16
|
+
// The rectangles arrive as command arguments rather than as props, which is why
|
|
17
|
+
// this is a parser rather than another prop reader: a command's payload is
|
|
18
|
+
// `folly::dynamic` and every host would otherwise walk it itself.
|
|
19
|
+
//
|
|
20
|
+
// The drawing is not here. A rectangle with a colour is the same idea on three
|
|
21
|
+
// desktops and three snapshot routines are not, so each view layer draws these
|
|
22
|
+
// the way it draws everything else.
|
|
23
|
+
|
|
24
|
+
#pragma once
|
|
25
|
+
|
|
26
|
+
#include "ControlMetrics.h"
|
|
27
|
+
|
|
28
|
+
#include <folly/dynamic.h>
|
|
29
|
+
|
|
30
|
+
#include <vector>
|
|
31
|
+
|
|
32
|
+
namespace basalt {
|
|
33
|
+
|
|
34
|
+
struct Highlight {
|
|
35
|
+
float x{0.0F};
|
|
36
|
+
float y{0.0F};
|
|
37
|
+
float width{0.0F};
|
|
38
|
+
float height{0.0F};
|
|
39
|
+
// Premultiplied-free 0..1, as every colour in this project's view layers is.
|
|
40
|
+
float color[4]{0.0F, 0.0F, 0.0F, 0.0F};
|
|
41
|
+
// Whether to fill as well as outline. An inspected element is filled and a
|
|
42
|
+
// trace update is not, which is what tells them apart at a glance.
|
|
43
|
+
bool filled{false};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// `highlightTraceUpdates(updates)`: `[{id, rectangle: {x, y, width, height},
|
|
47
|
+
// color}]`, where the colour is a processed one -- an integer, not a string.
|
|
48
|
+
//
|
|
49
|
+
// An update with no colour keeps DevTools' own default rather than being
|
|
50
|
+
// dropped: the rectangle is the information, and the colour is how often it
|
|
51
|
+
// has re-rendered.
|
|
52
|
+
std::vector<Highlight> parseTraceUpdates(const folly::dynamic &args);
|
|
53
|
+
|
|
54
|
+
// `highlightElements(elements)`: `[{x, y, width, height}]`, with no colour --
|
|
55
|
+
// DevTools' blue is the platform's to choose, and all three choose the same one
|
|
56
|
+
// so that a screenshot of an inspected element is the same picture everywhere.
|
|
57
|
+
std::vector<Highlight> parseElementHighlights(const folly::dynamic &args);
|
|
58
|
+
|
|
59
|
+
// How long a trace update stays up. React Native's own overlay clears them for
|
|
60
|
+
// itself rather than waiting to be told, because the point is that they flash:
|
|
61
|
+
// a box left behind after a component stopped re-rendering says the opposite of
|
|
62
|
+
// what it means.
|
|
63
|
+
inline constexpr double kTraceUpdateLifetimeMs = 1500.0;
|
|
64
|
+
|
|
65
|
+
} // namespace basalt
|