@legendapp/spark 0.0.2 → 0.0.3
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/package.json +2 -2
- 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-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/sentry-react-native@8.32.0.patch +76 -0
- package/skills/spark/UPGRADING.md +34 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +6 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +7 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +13 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +11 -11
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
- 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/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-codex/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +28 -10
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +2 -2
- 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 +2 -2
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-processes/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- 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 +2 -2
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { realpathSync, statSync, watch } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { installedPackages, nativePackages } from "./project.js";
|
|
5
|
+
import { isExpoProject } from "@legendapp/spark-desktop-config/config.cjs";
|
|
6
|
+
/** Native compatibility inputs stay stable until a source or resolution path changes. */
|
|
7
|
+
export function createRuntimeInputCache(root) {
|
|
8
|
+
let value;
|
|
9
|
+
let dirty = true;
|
|
10
|
+
let disabled = false;
|
|
11
|
+
let watchers = [];
|
|
12
|
+
let resolutionPaths = new Map();
|
|
13
|
+
let observedRoots = "";
|
|
14
|
+
let readiness;
|
|
15
|
+
function identity(location) {
|
|
16
|
+
try {
|
|
17
|
+
const stat = statSync(location, { throwIfNoEntry: false });
|
|
18
|
+
return stat ? `${stat.dev}:${stat.ino}` : null;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error.code === "ENOTDIR")
|
|
22
|
+
return null;
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function stop() {
|
|
27
|
+
clearImmediate(readiness);
|
|
28
|
+
readiness = undefined;
|
|
29
|
+
for (const watcher of watchers)
|
|
30
|
+
watcher.close();
|
|
31
|
+
watchers = [];
|
|
32
|
+
}
|
|
33
|
+
const invalidate = () => { dirty = true; };
|
|
34
|
+
function fail() {
|
|
35
|
+
disabled = true;
|
|
36
|
+
dirty = true;
|
|
37
|
+
stop();
|
|
38
|
+
}
|
|
39
|
+
const calculate = () => ({ native: nativePackages(root) });
|
|
40
|
+
function observe(installed) {
|
|
41
|
+
const realRoot = realpathSync(root);
|
|
42
|
+
const requested = new Map();
|
|
43
|
+
const add = (location, recursive) => {
|
|
44
|
+
const directory = realpathSync(location);
|
|
45
|
+
requested.set(directory, recursive || requested.get(directory) || false);
|
|
46
|
+
};
|
|
47
|
+
const paths = new Map();
|
|
48
|
+
for (const pkg of [{ root, json: {} }, ...installed]) {
|
|
49
|
+
add(pkg.root, true);
|
|
50
|
+
add(path.dirname(pkg.root), false);
|
|
51
|
+
const context = path.join(pkg.root, pkg.json.spark?.bundledModuleRoot ?? ".", "package.json");
|
|
52
|
+
for (const search of createRequire(context).resolve.paths("__spark_runtime_inputs__") ?? []) {
|
|
53
|
+
if (!paths.has(search)) {
|
|
54
|
+
const current = identity(search);
|
|
55
|
+
paths.set(search, current);
|
|
56
|
+
if (current !== null)
|
|
57
|
+
add(search, true);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const recursiveRoots = [...requested].filter(([, recursive]) => recursive).map(([directory]) => directory);
|
|
62
|
+
const roots = [...requested].filter(([directory]) => !recursiveRoots.some(parent => parent !== directory && directory.startsWith(parent + path.sep)));
|
|
63
|
+
const key = JSON.stringify(roots.map(([directory, recursive]) => [directory, recursive, identity(directory)]));
|
|
64
|
+
if (key === observedRoots) {
|
|
65
|
+
resolutionPaths = paths;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const next = [];
|
|
69
|
+
try {
|
|
70
|
+
for (const [directory, recursive] of roots) {
|
|
71
|
+
const watcher = watch(directory, { recursive }, (_event, filename) => {
|
|
72
|
+
const relative = filename === null ? null : path.relative(realRoot, path.join(directory, String(filename))).split(path.sep).join("/");
|
|
73
|
+
// Session status is output of the check, never an input to it.
|
|
74
|
+
if (relative && /^\.spark\/(?:platforms\/[^/]+\/)?session\.json(?:\.\d+\.tmp)?$/.test(relative))
|
|
75
|
+
return;
|
|
76
|
+
invalidate();
|
|
77
|
+
});
|
|
78
|
+
watcher.on("error", fail);
|
|
79
|
+
next.push(watcher);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
for (const watcher of next)
|
|
84
|
+
watcher.close();
|
|
85
|
+
fail();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
stop();
|
|
89
|
+
watchers = next;
|
|
90
|
+
resolutionPaths = paths;
|
|
91
|
+
observedRoots = key;
|
|
92
|
+
// A watch may start asynchronously. Recheck after its first event-loop turn.
|
|
93
|
+
readiness = setImmediate(() => { readiness = undefined; invalidate(); });
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
invalidate,
|
|
97
|
+
read() {
|
|
98
|
+
// Expo configuration can depend on arbitrary external modules or environment.
|
|
99
|
+
if (disabled || isExpoProject(root))
|
|
100
|
+
return calculate();
|
|
101
|
+
if (!dirty) {
|
|
102
|
+
try {
|
|
103
|
+
// Installs can replace a watched directory before its event is delivered.
|
|
104
|
+
for (const [location, previous] of resolutionPaths) {
|
|
105
|
+
if (identity(location) !== previous) {
|
|
106
|
+
dirty = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
fail();
|
|
113
|
+
return calculate();
|
|
114
|
+
}
|
|
115
|
+
if (!dirty)
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
dirty = false;
|
|
119
|
+
try {
|
|
120
|
+
const installed = installedPackages(root);
|
|
121
|
+
try {
|
|
122
|
+
observe(installed);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
fail();
|
|
126
|
+
}
|
|
127
|
+
value = calculate();
|
|
128
|
+
// A concurrent graph change needs a fresh set of source watches next poll.
|
|
129
|
+
if (JSON.stringify(installed) !== JSON.stringify(installedPackages(root)))
|
|
130
|
+
dirty = true;
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
dirty = true;
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
close() { disabled = true; stop(); },
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"node": ">=24.19.0"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@legendapp/spark-desktop-config": "0.0.
|
|
14
|
+
"@legendapp/spark-desktop-config": "0.0.3",
|
|
15
15
|
"ws": "8.21.0",
|
|
16
16
|
"expo-desktop": "1.0.6",
|
|
17
17
|
"npm": "11.21.1",
|
|
18
18
|
"typescript": "5.9.3",
|
|
19
19
|
"cross-spawn": "7.0.6",
|
|
20
|
-
"@legendapp/spark-window-options": "0.0.
|
|
20
|
+
"@legendapp/spark-window-options": "0.0.3",
|
|
21
21
|
"diff": "8.0.4",
|
|
22
22
|
"yaml": "2.9.1"
|
|
23
23
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spark-template-blank-typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"postinstall": "node node_modules/@legendapp/spark/init-template.cjs"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@legendapp/spark": "0.0.
|
|
16
|
+
"@legendapp/spark": "0.0.3",
|
|
17
17
|
"expo": "55.0.32",
|
|
18
18
|
"expo-desktop": "1.0.6",
|
|
19
19
|
"expo-desktop-prebuild-config": "1.1.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spark-template-universal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-native-web": "0.21.0",
|
|
42
42
|
"uniwind": "1.6.3",
|
|
43
43
|
"tailwindcss": "4.2.4",
|
|
44
|
-
"@legendapp/spark": "0.0.
|
|
44
|
+
"@legendapp/spark": "0.0.3"
|
|
45
45
|
},
|
|
46
46
|
"overrides": {
|
|
47
47
|
"expo": "55.0.32",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spark-template-windows",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react-native-windows": "0.83.2",
|
|
29
29
|
"expo-desktop-modules-core": "55.0.2",
|
|
30
30
|
"expo-desktop-stubs": "55.0.2",
|
|
31
|
-
"@legendapp/spark": "0.0.
|
|
31
|
+
"@legendapp/spark": "0.0.3"
|
|
32
32
|
},
|
|
33
33
|
"overrides": {
|
|
34
34
|
"expo": "55.0.32",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-clipboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
44
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"expo-clipboard": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-codex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
13
|
+
"@legendapp/spark-desktop-app": "0.0.3",
|
|
14
14
|
"react-native-nitro-modules": "0.37.0"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-commands",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.tsx",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-ui": "0.0.
|
|
12
|
-
"@legendapp/spark-desktop-shortcuts": "0.0.
|
|
13
|
-
"@legendapp/spark-settings": "0.0.
|
|
11
|
+
"@legendapp/spark-ui": "0.0.3",
|
|
12
|
+
"@legendapp/spark-desktop-shortcuts": "0.0.3",
|
|
13
|
+
"@legendapp/spark-settings": "0.0.3",
|
|
14
14
|
"@legendapp/state": "^3.0.0-beta.42",
|
|
15
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
15
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "^19.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-context-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
44
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
45
45
|
},
|
|
46
46
|
"private": true
|
|
47
47
|
}
|
|
@@ -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) {
|
|
@@ -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 };
|
|
@@ -10,6 +10,17 @@ function readManifest(file) {
|
|
|
10
10
|
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Find a package's manifest even when its exports map hides package.json, as Node finds the package.
|
|
14
|
+
function resolveManifest(req, name) {
|
|
15
|
+
try { return req.resolve(`${name}/package.json`); }
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error.code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") throw error;
|
|
18
|
+
const file = (req.resolve.paths(name) ?? []).map(directory => path.join(directory, name, "package.json")).find(fs.existsSync);
|
|
19
|
+
if (!file) throw error;
|
|
20
|
+
return file;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
function prepareNativePatches(root, installed = []) {
|
|
14
25
|
const manifestFile = path.join(root, "package.json");
|
|
15
26
|
if (!fs.existsSync(manifestFile)) return {};
|
|
@@ -51,7 +62,7 @@ function prepareNativePatches(root, installed = []) {
|
|
|
51
62
|
for (const name of active) {
|
|
52
63
|
if (optionalOnly && name !== "react-native-nitro-modules" && !cameraPackages.includes(name) && !optionalBackends.includes(name)) continue;
|
|
53
64
|
let file;
|
|
54
|
-
try { file = req
|
|
65
|
+
try { file = resolveManifest(req, name); }
|
|
55
66
|
catch (error) {
|
|
56
67
|
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
57
68
|
continue;
|
|
@@ -60,10 +71,14 @@ function prepareNativePatches(root, installed = []) {
|
|
|
60
71
|
const packageRoot = fs.realpathSync(path.dirname(file));
|
|
61
72
|
if (visited.has(packageRoot)) continue;
|
|
62
73
|
visited.add(packageRoot);
|
|
63
|
-
packages[name] = { root: packageRoot };
|
|
64
|
-
queue.push({ req: createRequire(file), optionalOnly });
|
|
65
74
|
const manifest = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
66
75
|
const pin = pins[name];
|
|
76
|
+
if (pin.optional && manifest.version !== pin.version) {
|
|
77
|
+
console.warn(`Spark's desktop patch for ${name} needs ${pin.version}; found ${manifest.version}, so it stays unpatched.`);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
packages[name] = { root: packageRoot };
|
|
81
|
+
queue.push({ req: createRequire(file), optionalOnly });
|
|
67
82
|
if (manifest.version !== pin.version) {
|
|
68
83
|
const owner = readManifest(req.resolve("./package.json"));
|
|
69
84
|
throw new Error(`Spark needs ${name}@${pin.version}; found ${manifest.version} at ${packageRoot}, required by ${owner.name ?? root}. Add an override/resolution for the pinned version.`);
|
|
@@ -82,12 +97,15 @@ function prepareNativePatches(root, installed = []) {
|
|
|
82
97
|
writes.push([target, next]);
|
|
83
98
|
continue;
|
|
84
99
|
}
|
|
85
|
-
|
|
100
|
+
// The receipt rewrites package.json with two-space JSON, so its patch hunks target that form.
|
|
101
|
+
if (relative === "package.json") {
|
|
86
102
|
const original = JSON.parse(current);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
if (manifest.spark?.dependencyPatch) {
|
|
104
|
+
delete original.spark.dependencyPatch;
|
|
105
|
+
delete original.spark.sdk;
|
|
106
|
+
delete original.spark.requires;
|
|
107
|
+
if (!Object.keys(original.spark).length) delete original.spark;
|
|
108
|
+
}
|
|
91
109
|
current = JSON.stringify(original, null, 2) + "\n";
|
|
92
110
|
}
|
|
93
111
|
if (applyPatch(current, reversePatch(patch)) !== false) continue;
|
|
@@ -103,7 +121,7 @@ function prepareNativePatches(root, installed = []) {
|
|
|
103
121
|
}
|
|
104
122
|
const patched = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
105
123
|
patched.spark ??= {};
|
|
106
|
-
if (name !== "react-native-nitro-modules") {
|
|
124
|
+
if (name !== "react-native-nitro-modules" && !pin.optional) {
|
|
107
125
|
patched.spark.sdk = true;
|
|
108
126
|
patched.spark.requires = pin.requires ?? [];
|
|
109
127
|
}
|
|
@@ -119,7 +137,7 @@ function prepareNativePatches(root, installed = []) {
|
|
|
119
137
|
}
|
|
120
138
|
}
|
|
121
139
|
for (const name of active) {
|
|
122
|
-
if (!packages[name]) throw new Error(`Spark needs ${name}@${pins[name].version}. Finish installing dependencies before native preparation.`);
|
|
140
|
+
if (!packages[name] && !pins[name].optional) throw new Error(`Spark needs ${name}@${pins[name].version}. Finish installing dependencies before native preparation.`);
|
|
123
141
|
}
|
|
124
142
|
return packages;
|
|
125
143
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "app.plugin.cjs",
|
|
6
6
|
"files": [
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"expo-desktop-config-plugins": "1.3.2",
|
|
14
|
-
"@legendapp/spark-desktop-host": "0.0.
|
|
15
|
-
"@legendapp/spark-window-options": "0.0.
|
|
14
|
+
"@legendapp/spark-desktop-host": "0.0.3",
|
|
15
|
+
"@legendapp/spark-window-options": "0.0.3",
|
|
16
16
|
"@expo/config-plugins": "55.0.12",
|
|
17
17
|
"diff": "8.0.4"
|
|
18
18
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-host",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"AppDelegate.mm",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"SparkCustomize.mm"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
12
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
13
13
|
},
|
|
14
14
|
"private": true
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-links",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
45
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"expo-linking": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-shortcuts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
43
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
44
44
|
},
|
|
45
45
|
"private": true
|
|
46
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-desktop-windows",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
44
|
-
"@legendapp/spark-window-options": "0.0.
|
|
43
|
+
"@legendapp/spark-desktop-app": "0.0.3",
|
|
44
|
+
"@legendapp/spark-window-options": "0.0.3",
|
|
45
45
|
"@legendapp/state": "^3.0.0-beta.42"
|
|
46
46
|
},
|
|
47
47
|
"private": true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-documents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.tsx",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-file-dialog": "0.0.
|
|
12
|
-
"@legendapp/spark-file-system": "0.0.
|
|
13
|
-
"@legendapp/spark-native-menu": "0.0.
|
|
14
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
15
|
-
"@legendapp/spark-desktop-windows": "0.0.
|
|
16
|
-
"@legendapp/spark-desktop-links": "0.0.
|
|
11
|
+
"@legendapp/spark-file-dialog": "0.0.3",
|
|
12
|
+
"@legendapp/spark-file-system": "0.0.3",
|
|
13
|
+
"@legendapp/spark-native-menu": "0.0.3",
|
|
14
|
+
"@legendapp/spark-desktop-app": "0.0.3",
|
|
15
|
+
"@legendapp/spark-desktop-windows": "0.0.3",
|
|
16
|
+
"@legendapp/spark-desktop-links": "0.0.3"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^19.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-drag-drop",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"react-native": "src/index.tsx",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
42
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
43
43
|
},
|
|
44
44
|
"private": true
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-file-dialog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "src/index",
|
|
5
5
|
"react-native": "src/index",
|
|
6
6
|
"codegenConfig": {
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"private": true,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
48
|
+
"@legendapp/spark-desktop-app": "0.0.3"
|
|
49
49
|
}
|
|
50
50
|
}
|