@legendapp/spark 0.0.2 → 0.0.4
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/init-template.cjs +7 -1
- package/package.json +10 -5
- package/patches/dependencies.json +252 -0
- package/patches/expo-application@55.0.19.patch +54 -0
- package/patches/expo-blur@55.0.18.patch +130 -0
- package/patches/expo-device@55.0.21.patch +149 -0
- package/patches/expo-font@55.0.8.patch +55 -0
- package/patches/expo-glass-effect@55.0.11.patch +304 -0
- package/patches/expo-haptics@55.0.18.patch +54 -0
- package/patches/expo-image-manipulator@55.0.21.patch +312 -0
- package/patches/expo-image-picker@55.0.24.patch +327 -0
- package/patches/expo-image@55.0.11.patch +158 -0
- package/patches/expo-keep-awake@55.0.8.patch +41 -0
- package/patches/expo-localization@55.0.19.patch +32 -0
- package/patches/expo-location@55.1.15.patch +190 -0
- package/patches/expo-symbols@55.0.9.patch +286 -0
- package/patches/expo-system-ui@55.0.22.patch +61 -0
- package/patches/expo-web-browser@55.0.20.patch +13 -0
- package/patches/react-native-app-logs@0.3.1.patch +20 -0
- package/patches/react-native-blurhash@2.1.3.patch +318 -0
- package/patches/react-native-community-blur@4.4.1.patch +415 -0
- package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
- package/patches/react-native-fast-image@10.9.9.patch +131 -0
- package/patches/react-native-graph@1.4.0.patch +157 -0
- package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
- package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
- package/patches/react-native-mmkv@4.3.2.patch +40 -0
- package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
- package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/react-native-quick-base64@3.0.1.patch +13 -0
- package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
- package/patches/react-native-release-profiler@0.4.5.patch +37 -0
- package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
- package/patches/react-native-screens@4.23.0.patch +160 -0
- package/patches/react-native-svg@15.15.3.patch +31 -0
- package/patches/react-native-unistyles@3.6.0.patch +203 -0
- package/patches/react-native-worklets-core@1.6.3.patch +13 -0
- package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
- package/patches/registry.json +615 -0
- package/patches/sentry-react-native@8.32.0.patch +76 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +150 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +85 -0
- package/skills/spark/ui.md +57 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +139 -104
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +10 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +20 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +20 -20
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +315 -68
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +26 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +418 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +63 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +35 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +39 -6
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "SparkTestDriver.h"
|
|
2
|
+
#import <CoreGraphics/CoreGraphics.h>
|
|
2
3
|
#import <QuartzCore/QuartzCore.h>
|
|
3
4
|
#include <atomic>
|
|
4
5
|
#include <fcntl.h>
|
|
@@ -17,6 +18,8 @@ static int directoryFD = -1, listenFD = -1;
|
|
|
17
18
|
static NSString *socketPath;
|
|
18
19
|
static NSData *token;
|
|
19
20
|
static id activity;
|
|
21
|
+
static NSMutableArray<dispatch_block_t> *pointerRestores;
|
|
22
|
+
static NSInteger pointerEventNumber = 0;
|
|
20
23
|
static std::atomic<bool> authenticated{false};
|
|
21
24
|
static CFTimeInterval lastMount = 0;
|
|
22
25
|
static const CFTimeInterval SparkSettleInterval = 0.1;
|
|
@@ -30,7 +33,7 @@ static void SparkDriverTerminate(void) { ending = YES; [NSApp terminate:nil]; }
|
|
|
30
33
|
BOOL SparkTestDriverActive(void) { return active; }
|
|
31
34
|
BOOL SparkTestDriverEnding(void) { return ending; }
|
|
32
35
|
void SparkTestDriverDidMount(void) { lastMount = CACurrentMediaTime(); }
|
|
33
|
-
static NSArray<NSString *> *const SparkBuiltInCommands = @[@"ping", @"navigate", @"openFile", @"waitFor", @"setAppAppearance", @"capture", @"quit"];
|
|
36
|
+
static NSArray<NSString *> *const SparkBuiltInCommands = @[@"ping", @"navigate", @"openFile", @"waitFor", @"setAppAppearance", @"capture", @"pointerEvents", @"restorePointer", @"quit"];
|
|
34
37
|
static NSMutableDictionary<NSString *, SparkTestDriverHandler> *SparkModuleCommands(void) {
|
|
35
38
|
static NSMutableDictionary *commands;
|
|
36
39
|
static dispatch_once_t once;
|
|
@@ -228,6 +231,63 @@ static void SparkOpenURL(NSURL *url, NSDictionary *request, SparkDriverReply rep
|
|
|
228
231
|
reply(@{ @"ok": @YES });
|
|
229
232
|
});
|
|
230
233
|
}
|
|
234
|
+
static void SparkRestorePointer(void) {
|
|
235
|
+
for (dispatch_block_t restore in pointerRestores.reverseObjectEnumerator) restore();
|
|
236
|
+
pointerRestores = nil;
|
|
237
|
+
}
|
|
238
|
+
static void SparkPreparePointer(NSWindow *window, NSNumber *x, NSNumber *y, SparkDriverReply reply) {
|
|
239
|
+
if (!pointerRestores) {
|
|
240
|
+
pointerRestores = [NSMutableArray new];
|
|
241
|
+
NSApplicationActivationPolicy policy = NSApp.activationPolicy;
|
|
242
|
+
NSRunningApplication *previous = NSWorkspace.sharedWorkspace.frontmostApplication;
|
|
243
|
+
[pointerRestores addObject:[^{
|
|
244
|
+
[NSApp setActivationPolicy:policy];
|
|
245
|
+
if (previous.processIdentifier != getpid()) [previous activateWithOptions:0];
|
|
246
|
+
} copy]];
|
|
247
|
+
if (policy == NSApplicationActivationPolicyProhibited) [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
|
248
|
+
}
|
|
249
|
+
// Pointer input opts into foreground clicks; ordinary driver windows stay hidden.
|
|
250
|
+
if (!window.isVisible) {
|
|
251
|
+
NSWindowAnimationBehavior animation = window.animationBehavior;
|
|
252
|
+
[pointerRestores addObject:[^{ [window orderOut:nil]; window.animationBehavior = animation; } copy]];
|
|
253
|
+
window.animationBehavior = NSWindowAnimationBehaviorNone;
|
|
254
|
+
}
|
|
255
|
+
[window makeKeyAndOrderFront:nil];
|
|
256
|
+
if (!NSApp.isActive) [NSApp activateIgnoringOtherApps:YES];
|
|
257
|
+
[window layoutIfNeeded];
|
|
258
|
+
NSView *root = SparkFrameView(window);
|
|
259
|
+
if ([x doubleValue] < 0 || [y doubleValue] < 0 || [x doubleValue] >= NSWidth(root.bounds) || [y doubleValue] >= NSHeight(root.bounds)) {
|
|
260
|
+
reply(SparkFailure(@"E_INVALID_ARGUMENT", @"pointerEvents expects x,y inside the captured window frame (top-left points)")); return;
|
|
261
|
+
}
|
|
262
|
+
NSPoint local = NSMakePoint(NSMinX(root.bounds) + [x doubleValue], root.isFlipped ? NSMinY(root.bounds) + [y doubleValue] : NSMaxY(root.bounds) - [y doubleValue]);
|
|
263
|
+
NSPoint windowPoint = [root convertPoint:local toView:nil];
|
|
264
|
+
NSMutableArray<NSString *> *events = [NSMutableArray new];
|
|
265
|
+
NSTimeInterval now = NSProcessInfo.processInfo.systemUptime;
|
|
266
|
+
NSInteger eventNumber = ++pointerEventNumber;
|
|
267
|
+
for (NSUInteger i = 0; i < 2; i++) {
|
|
268
|
+
NSEvent *event = [NSEvent mouseEventWithType:i == 0 ? NSEventTypeLeftMouseDown : NSEventTypeLeftMouseUp location:windowPoint modifierFlags:0 timestamp:now + i * 0.05 windowNumber:window.windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:i == 0 ? 1 : 0];
|
|
269
|
+
NSData *data = event.CGEvent ? CFBridgingRelease(CGEventCreateData(NULL, event.CGEvent)) : nil;
|
|
270
|
+
if (!data) { reply(SparkFailure(@"E_EVENT", @"Could not encode mouse events for the target window")); return; }
|
|
271
|
+
[events addObject:[data base64EncodedStringWithOptions:0]];
|
|
272
|
+
}
|
|
273
|
+
reply(@{ @"ok": @YES, @"pid": @(getpid()), @"down": events[0], @"up": events[1] });
|
|
274
|
+
}
|
|
275
|
+
static void SparkPointerEvents(NSDictionary *request, SparkDriverReply reply) {
|
|
276
|
+
NSString *failure = nil;
|
|
277
|
+
NSWindow *window = SparkResolveWindow(request[@"window"], &failure);
|
|
278
|
+
if (!window) { reply(SparkFailure(@"E_NO_WINDOW", failure)); return; }
|
|
279
|
+
id x = request[@"x"], y = request[@"y"];
|
|
280
|
+
if (![x isKindOfClass:NSNumber.class] || ![y isKindOfClass:NSNumber.class] ||
|
|
281
|
+
!isfinite([x doubleValue]) || !isfinite([y doubleValue])) {
|
|
282
|
+
reply(SparkFailure(@"E_INVALID_ARGUMENT", @"pointerEvents expects finite x,y")); return;
|
|
283
|
+
}
|
|
284
|
+
// Gesture recognizers attach after their views mount; do not click mid-mount. A zero timeout skips the wait.
|
|
285
|
+
NSTimeInterval timeout = SparkTimeout(request[@"timeoutMs"], 5);
|
|
286
|
+
SparkWaitUntil(timeout, ^{ return (BOOL)(timeout == 0 || SparkSettled()); }, ^(BOOL settled) {
|
|
287
|
+
if (!settled) { reply(SparkFailure(@"E_NOT_SETTLED", @"The UI kept mounting changes until the timeout")); return; }
|
|
288
|
+
SparkPreparePointer(window, x, y, reply);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
231
291
|
static void SparkExecute(NSDictionary *request, SparkDriverReply reply) {
|
|
232
292
|
NSString *command = request[@"command"];
|
|
233
293
|
if ([command isEqual:@"ping"]) reply(@{ @"ok": @YES });
|
|
@@ -261,6 +321,8 @@ static void SparkExecute(NSDictionary *request, SparkDriverReply reply) {
|
|
|
261
321
|
}
|
|
262
322
|
else if ([command isEqual:@"setAppAppearance"]) SparkSetAppearance(request, reply);
|
|
263
323
|
else if ([command isEqual:@"capture"]) SparkCapture(request, reply);
|
|
324
|
+
else if ([command isEqual:@"pointerEvents"]) SparkPointerEvents(request, reply);
|
|
325
|
+
else if ([command isEqual:@"restorePointer"]) { SparkRestorePointer(); reply(@{ @"ok": @YES }); }
|
|
264
326
|
else if ([command isKindOfClass:NSString.class] && SparkModuleCommands()[command]) SparkModuleCommands()[command](request, reply);
|
|
265
327
|
else reply(SparkFailure(@"E_UNKNOWN_COMMAND", [NSString stringWithFormat:@"Unknown command %@", command]));
|
|
266
328
|
}
|
|
@@ -318,7 +380,7 @@ static void SparkServe(void) {
|
|
|
318
380
|
}
|
|
319
381
|
close(listenFD);
|
|
320
382
|
unlink(socketPath.fileSystemRepresentation);
|
|
321
|
-
dispatch_async(dispatch_get_main_queue(), ^{ SparkDriverTerminate(); });
|
|
383
|
+
dispatch_async(dispatch_get_main_queue(), ^{ SparkRestorePointer(); SparkDriverTerminate(); });
|
|
322
384
|
}
|
|
323
385
|
|
|
324
386
|
BOOL SparkTestDriverStart(void) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -28,13 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"spark": {
|
|
30
30
|
"sdk": false,
|
|
31
|
-
"nativeModules":
|
|
32
|
-
"NativeDesktopApp"
|
|
33
|
-
],
|
|
34
|
-
"pod": "RNDesktopApp",
|
|
35
|
-
"platforms": [
|
|
36
|
-
"macos"
|
|
37
|
-
],
|
|
31
|
+
"nativeModules": true,
|
|
38
32
|
"requires": []
|
|
39
33
|
},
|
|
40
34
|
"private": true
|
|
@@ -35,8 +35,9 @@ function installAutolinkingPatch(root) {
|
|
|
35
35
|
// Packages such as Codex declare iOS for the desktop autolinker in their own
|
|
36
36
|
// react-native.config.js, so pass the native selection's exclusions to its CLI.
|
|
37
37
|
function excludeNativeModules(podfile, excluded) {
|
|
38
|
-
const call = /use_native_modules!\(config_command(?: \+ \[[^\]]*\])
|
|
38
|
+
const call = /use_native_modules!\(config_command(?: \+ \[[^\]]*\])*\)/;
|
|
39
39
|
if (!call.test(podfile)) throw new Error("The macOS Podfile no longer calls use_native_modules!(config_command); review spark's native selection.");
|
|
40
|
-
|
|
40
|
+
// RN writes the filtered codegen input beneath sourceDir; Expo's iOS default points at the wrong tree.
|
|
41
|
+
return podfile.replace(call, `use_native_modules!(config_command + ["--source-dir", __dir__] + ${JSON.stringify(excluded.flatMap(name => ["--exclude", name]))})`);
|
|
41
42
|
}
|
|
42
43
|
module.exports = { patchAutolinkingSource, installAutolinkingPatch, excludeNativeModules };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
const { validateOwned, validatePlatforms } = require("./validation.cjs");
|
|
1
|
+
const { validateOwned, validatePlatforms, validateSettings } = require("./validation.cjs");
|
|
2
2
|
const fs = require("node:fs");
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const { createHash } = require("node:crypto");
|
|
5
|
-
const { validateWindow } = require("@legendapp/spark-window-options");
|
|
6
5
|
const { identity } = require("./identity.cjs");
|
|
7
6
|
const filename = "desktop.config.json";
|
|
8
7
|
const managedConfig = "// Generated by spark: universal Expo configuration";
|
|
@@ -51,7 +50,9 @@ function readConfig(root, target = process.env.SPARK_PLATFORM) {
|
|
|
51
50
|
if (!fs.existsSync(file)) {
|
|
52
51
|
const value = JSON.parse(fs.readFileSync(path.join(root, "app.json"), "utf8"));
|
|
53
52
|
if (!value?.expo || typeof value.expo !== "object" || Array.isArray(value.expo)) throw new Error("app.json needs an expo configuration object");
|
|
54
|
-
|
|
53
|
+
const platforms = validatePlatforms(value.expo.platforms ?? ["macos"]);
|
|
54
|
+
if (value.expo.extra?.spark !== undefined) validateSettings(value.expo.extra.spark, selectTarget(platforms, target));
|
|
55
|
+
return { ...value, expo: { ...value.expo, platforms } };
|
|
55
56
|
}
|
|
56
57
|
const result = toExpo(JSON.parse(fs.readFileSync(file, "utf8")), target);
|
|
57
58
|
return result;
|
|
@@ -93,15 +94,12 @@ function toExpo(value, target) {
|
|
|
93
94
|
for (const key of ["name", "projectId", "version"]) if (typeof value[key] !== "string" || !value[key].trim()) throw new Error(`Desktop config needs ${key}`);
|
|
94
95
|
const platforms = value.platforms ?? ["macos"];
|
|
95
96
|
validatePlatforms(platforms);
|
|
96
|
-
validateOwned(value);
|
|
97
|
+
validateOwned({ macos: value.macos });
|
|
97
98
|
const selected = selectTarget(platforms, target);
|
|
98
99
|
if (platforms.includes("macos") && (!value.macos || typeof value.macos.bundleIdentifier !== "string" || !/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(value.macos.bundleIdentifier))) throw new Error("macos.bundleIdentifier must be a reverse-DNS identifier");
|
|
99
|
-
validateWindow(value.window ?? {});
|
|
100
|
-
if (value.include !== undefined && (!Array.isArray(value.include) || value.include.some(x => typeof x !== "string"))) throw new Error("include must be a list of package names");
|
|
101
|
-
require("./helpers.cjs").validateHelpers(value.helpers);
|
|
102
|
-
require("./customize.cjs").validateCustomize(value.customize);
|
|
103
100
|
const extra = { projectId: value.projectId };
|
|
104
101
|
for (const key of ["window", "documentTypes", "menuBarOnly", "updates", "include", "signing", "helpers", "customize"]) if (value[key] !== undefined) extra[key] = value[key];
|
|
102
|
+
validateSettings(extra, selected);
|
|
105
103
|
const overrides = value.expoByPlatform ?? {};
|
|
106
104
|
if (!overrides || typeof overrides !== "object" || Array.isArray(overrides) || Object.keys(overrides).some(p => !platforms.includes(p))) throw new Error("expoByPlatform keys must be supported platforms");
|
|
107
105
|
const backend = merge(value.expo ?? {}, overrides[selected] ?? {});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { nativeWindowOptions } = require("@legendapp/spark-window-options");
|
|
2
2
|
const { updatePlist } = require("./updates.cjs");
|
|
3
3
|
function identity(config) {
|
|
4
|
+
require("./validation.cjs").validateSettings(config.extra?.spark, "macos");
|
|
4
5
|
const projectId = config.extra?.spark?.projectId ?? config.macos?.bundleIdentifier;
|
|
5
6
|
if (typeof projectId !== "string" || !projectId.length || projectId.length > 200) throw new Error("Set extra.spark.projectId to a stable project identifier");
|
|
6
7
|
const schemes = config.scheme === undefined ? [] : Array.isArray(config.scheme) ? config.scheme : [config.scheme];
|
|
@@ -16,6 +17,7 @@ function identity(config) {
|
|
|
16
17
|
LSUIElement: config.extra?.spark?.menuBarOnly === true,
|
|
17
18
|
SparkMenuBarOnly: config.extra?.spark?.menuBarOnly === true,
|
|
18
19
|
SparkProjectIdentifier: projectId,
|
|
20
|
+
SparkDefaultBundleIdentifier: config.macos?.bundleIdentifier,
|
|
19
21
|
SparkLifecycleConfiguration: require("./lifecycle.cjs").validateLifecycle(config.macos?.lifecycle),
|
|
20
22
|
SparkWindowConfiguration: nativeWindowOptions(config.extra?.spark?.window ?? {}),
|
|
21
23
|
...updatePlist(config),
|