@legendapp/spark 0.0.3 → 0.0.5
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 +11 -6
- package/patches/dependencies.json +4 -4
- package/patches/react-native-mmkv@4.3.2.patch +2 -2
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/registry.json +615 -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 +174 -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 +59 -0
- package/skills/spark/ui.md +83 -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 +157 -106
- 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 +3 -0
- 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/package.js +4 -8
- 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 +8 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +32 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +17 -17
- package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
- 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.h +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
- 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 +300 -71
- 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/rpaths.cjs +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -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 +17 -5
- 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-settings-ui/src/index.tsx +122 -334
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +183 -0
- 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 +28 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
- 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 +438 -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 +6 -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 +72 -20
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +18 -12
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +21 -15
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +40 -16
- 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/native-select/NativeSelectNativeComponent.ts +1 -0
- 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/select.ts +4 -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/switch.tsx +13 -0
- 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 +52 -7
- 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
- /package/{settings-window.ts → ui-settings.ts} +0 -0
|
@@ -29,6 +29,54 @@ history; do not use a moving main-branch document to decide an installed API.
|
|
|
29
29
|
and tests. Rebuild custom runtimes (`spark build --dev`) for native changes and
|
|
30
30
|
exercise affected desktop flows. Commit source/config and the lockfile.
|
|
31
31
|
|
|
32
|
+
## Migrate at the installed version
|
|
33
|
+
|
|
34
|
+
Use the app's installed CLI when Spark is already installed and dependency
|
|
35
|
+
versions must stay fixed:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
spark migrate --project <app-directory> --dry-run
|
|
39
|
+
spark migrate --project <app-directory>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This command resolves Spark from the target project's `package.json`, including
|
|
43
|
+
ancestor `node_modules` for generated consumers sharing a root install. It never
|
|
44
|
+
queries the registry, changes dependency pins, or runs an installer. The preview
|
|
45
|
+
prints every pending migration in semantic-version order, planned paths, and
|
|
46
|
+
manual steps without writing anything. With no receipt, it considers all migration
|
|
47
|
+
history through the installed version. Apply preserves user instructions and
|
|
48
|
+
outstanding `.spark/upgrade-notes.md` entries. The receipt advances only after a
|
|
49
|
+
successful apply; partial file-write failures keep the old receipt for retry.
|
|
50
|
+
Running it again is safe. Malformed receipts and downgrades are rejected.
|
|
51
|
+
|
|
52
|
+
If a migration needs dependency installation, install-input edits, template
|
|
53
|
+
initialization, or configuration changes, apply refuses before writing any files.
|
|
54
|
+
Resolve the reported requirements in their owning project, then retry; use
|
|
55
|
+
`spark upgrade` when you intend to update release inputs and install. Manual
|
|
56
|
+
API/native/data review remains recorded in `.spark/upgrade-notes.md`; a successful
|
|
57
|
+
receipt does not certify those application decisions.
|
|
58
|
+
|
|
59
|
+
### Generated projects
|
|
60
|
+
|
|
61
|
+
`spark create` and direct Spark template initialization stamp the installed
|
|
62
|
+
version after initialization succeeds. A new `spark add desktop` integration
|
|
63
|
+
also establishes that baseline after installation succeeds.
|
|
64
|
+
|
|
65
|
+
External generators must finish writing a project using the installed version's
|
|
66
|
+
configuration/source, then call:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
spark migrate --init --project <generated-directory>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`--init` explicitly attests that this is a newly generated baseline. It creates
|
|
73
|
+
AI pointers and `.spark/version` without replaying historical migrations; do not
|
|
74
|
+
use it to skip upgrades in an existing app. It accepts an absent receipt or the
|
|
75
|
+
same installed version, rejects older/newer/malformed receipts, and supports
|
|
76
|
+
`--dry-run`. Resolve `@legendapp/spark/cli` relative to the generated project's
|
|
77
|
+
`package.json` and invoke that file with Node when the generator shares a root
|
|
78
|
+
install rather than a local CLI binary. No consumer install is needed.
|
|
79
|
+
|
|
32
80
|
## 0.0.1-next.2
|
|
33
81
|
|
|
34
82
|
Baseline preview for this history. Dependency archives now travel with the app
|
|
@@ -98,7 +146,7 @@ if (paths) await load(paths[0]);
|
|
|
98
146
|
```
|
|
99
147
|
After:
|
|
100
148
|
```ts
|
|
101
|
-
const result = await openFileDialog({ selection: "files", multiple: true, filters: [{
|
|
149
|
+
const result = await openFileDialog({ selection: "files", multiple: true, filters: [{ extensions: ["txt"] }] });
|
|
102
150
|
if (!result.canceled) await load(result.paths[0]);
|
|
103
151
|
// saveFileDialog likewise returns { canceled: true } or { canceled: false, path }.
|
|
104
152
|
```
|
|
@@ -439,3 +487,128 @@ custom runtimes with `spark build --dev`, then exercise installed desktop-librar
|
|
|
439
487
|
flows, permissions and storage persistence on each app target. The CLI now caches
|
|
440
488
|
native compatibility inputs between dev refreshes to reduce idle CPU work
|
|
441
489
|
(#535); no app source change is required for that cache.
|
|
490
|
+
|
|
491
|
+
## 0.0.4
|
|
492
|
+
|
|
493
|
+
Breaking: yes.
|
|
494
|
+
|
|
495
|
+
Quit older builds, back up app data, keep bundle identifiers stable, and rebuild
|
|
496
|
+
custom hosts before upgrading. Persistent macOS file and MMKV stores move to
|
|
497
|
+
`~/Library/Application Support/<bundle id>/Spark` (#541). First launch
|
|
498
|
+
atomically migrates an owned legacy project-hash or display-name folder when the
|
|
499
|
+
new destination is absent. Unmarked data migrates only for the configured default
|
|
500
|
+
bundle ID; foreign folders remain untouched and existing destinations are never
|
|
501
|
+
overwritten. Ambiguous legacy sources and IO errors stop startup; resolve the
|
|
502
|
+
reported ownership/data conflict before retrying. App clones use independent
|
|
503
|
+
launch locks and stores; custom hosts embed the default ID in
|
|
504
|
+
`SparkDefaultBundleIdentifier`.
|
|
505
|
+
|
|
506
|
+
The default MMKV store therefore moves from `<Spark namespace>/mmkv` (0.0.3) to
|
|
507
|
+
`~/Library/Application Support/<bundle id>/Spark/mmkv`, using the same
|
|
508
|
+
ownership-checked migration. An explicit custom MMKV path is unaffected.
|
|
509
|
+
|
|
510
|
+
New CLI commands need no app change: `spark migrate` applies pending migrations at
|
|
511
|
+
the installed version (see "Migrate at the installed version" above), `spark
|
|
512
|
+
prebuild --platform macos` installs or repairs Pods without building, and `spark
|
|
513
|
+
patch <lib>` saves an app patch layered on Spark's patch. Existing
|
|
514
|
+
patch-package or Bun/pnpm `patchedDependencies` patches for Spark-patched
|
|
515
|
+
libraries now apply after Spark's patch; regenerate any that fail with `spark
|
|
516
|
+
patch`.
|
|
517
|
+
|
|
518
|
+
Run `spark upgrade`, `spark doctor`, and the app's typecheck and tests. Rebuild
|
|
519
|
+
custom hosts with `spark build --dev`, then verify settings/file/MMKV data and
|
|
520
|
+
relaunch persistence on each app target.
|
|
521
|
+
|
|
522
|
+
`expo-clipboard` original imports work on macOS for text, HTML and PNG images
|
|
523
|
+
(#547). Unsupported JPEG/quality options, URL methods, listeners and synchronous
|
|
524
|
+
writes reject explicitly. `spark doctor` reports stale/missing/conflicting app
|
|
525
|
+
patches with fixes (#545); source/package CI runs only on macOS (#544).
|
|
526
|
+
|
|
527
|
+
`expo-document-picker` original imports also work on macOS (#546). Picks return
|
|
528
|
+
Expo-shaped assets and copy to app Caches by default; use
|
|
529
|
+
`copyToCacheDirectory: false` to keep the original file URI. Common MIME filters
|
|
530
|
+
and multiple selection are supported; unsupported MIME filters and options reject.
|
|
531
|
+
|
|
532
|
+
Unsupported runtime options and invalid package metadata now reject explicitly
|
|
533
|
+
(#548). From `package.json.spark`, remove unused `pod`, `platforms` and
|
|
534
|
+
`windowsAdapter` fields; `nativeModules` accepts only `true`, with binding names owned by codegen.
|
|
535
|
+
Review toolbar/dialog combinations, nested keys and hook options against the
|
|
536
|
+
packaged references. Unavailable AppKit symbols reject instead of falling back to
|
|
537
|
+
labels. Platform-specific values still override shared settings, and valid
|
|
538
|
+
inactive-target configuration remains accepted.
|
|
539
|
+
|
|
540
|
+
### Native dependencies and controls
|
|
541
|
+
|
|
542
|
+
- Install and native preparation check exact library versions against the SHA-pinned patch registry and use bundled recipes offline. Run `spark doctor` and follow its `Fix:` commands for unsupported versions. If an app owns desktop compatibility for a library, `package.json` can set `spark.patches.<library>` to `false`. Doctor stays read-only and rejects invalid receipts and downgrades (`c14c68bc`, `8864a5de`).
|
|
543
|
+
- Both `react-native-nitro-zxing` 0.3.0 and 0.3.1 have recipes. If moving to 0.3.1, review any app patch pinned to 0.3.0 and rebuild the native runtime (`612f0ebe`).
|
|
544
|
+
- `SFSymbol` accepts dynamic `PlatformColor` tints without crashing. Check system colors in both appearances (`15d1fbdb`).
|
|
545
|
+
- Use `Checkbox` for controlled toggles, `Button variant="disclosure"` with `expanded` for disclosure and `SegmentedControl` `size` or `distribution` to adjust segments. Recheck macOS button and checkbox layouts that relied on the old default frame. Set `style.width` or `style.height` where the frame must stay fixed. Use `Sidebar listStyle="plain"` for content lists (#550).
|
|
546
|
+
- `macos.subtitle` adds a subtitle and a `progress` toolbar item displays a bar or spinner. `Button` accepts `symbol` and `size`; `@legendapp/spark/ui/progress` provides `ProgressIndicator`. Check disabled toolbar actions and window size after repeated toolbar updates. Use `regular` or `small` for a progress bar (#553).
|
|
547
|
+
- Use Sidebar row `children` or `SidebarItem parentId` for a tree, `group` for nonselectable headings, `collapsedIds` and `onExpandedChange` for collapsible sections, and `count` for trailing totals. Existing single selection can keep `selectedId` and read `id`; use `selectedIds` and the callback's `ids` for multiple selection. `onDoubleClick` reports the row ID (#554).
|
|
548
|
+
- Import `Popover` from `@legendapp/spark/ui/popover` and `RadioGroup` from `@legendapp/spark/ui`. Update controlled popover visibility in `onClose` after native dismissal. Set `macos.tabbing` with a shared `identifier` to group windows, and recheck collapsing toolbar search beside other items (#555).
|
|
549
|
+
- Use a `popup` toolbar item for a choice with a displayed value, and `TextInput` `placeholder` and `multiline` for empty hints and wrapped inputs. Import `Table` and `Sheet` from `@legendapp/spark/ui/table` and `@legendapp/spark/ui/sheet`. Set Sheet `visible` to `false` in `onCancel` to close it. Use `SidebarSplitView inspector` for a trailing pane (#556).
|
|
550
|
+
- Test Checkbox and multiline input on Windows. Controlled multiline values use `\n`; normalize any app code that expected WinUI's `\r`. Verify Sheet content stays visible through dismissal and is released after the native `onDismiss` or parent window close (#557).
|
|
551
|
+
- Test clicks on controls inside `DragDropView` and use `onDragStart` for native session initiation. `dragPreview="snapshot"` captures the source on macOS; `"default"` uses the system image, as Windows does for either setting (#558, `37386cfc`).
|
|
552
|
+
- Navigator open overrides now keep nested registered window defaults. For example, overriding only `macos.titleBar.tintColor` keeps the other registered title-bar options. Pass `undefined` explicitly to clear an inherited value for one open. Arrays replace the registered array (#558).
|
|
553
|
+
- Use `@legendapp/spark/ui/split-view` for nested resizable panes and Table `onColumnResize` to persist a user's column width. Exercise nested `SidebarSplitView` resizing, especially if `onResize` feeds dimensions back into the component (#559).
|
|
554
|
+
|
|
555
|
+
The SecureStore original-import adapter remains held for verification and is not
|
|
556
|
+
included in 0.0.4.
|
|
557
|
+
|
|
558
|
+
## 0.0.5
|
|
559
|
+
|
|
560
|
+
Breaking: yes. macOS settings windows move from
|
|
561
|
+
`@legendapp/spark/settings/window` to `@legendapp/spark/ui/settings` (#561).
|
|
562
|
+
|
|
563
|
+
1. Change settings window imports and re-exports to the new path. Install
|
|
564
|
+
`@legendapp/list` in the app if it is missing. Keep the window registration
|
|
565
|
+
with `createSettingsWindowOptions()` and pass the registered `windowId`.
|
|
566
|
+
2. Replace the `pages` array and render callbacks with `SettingsPage` children.
|
|
567
|
+
Keep each page's ID and title, and add an SF Symbol name as `icon`. Remove any
|
|
568
|
+
`backgroundClassName`, `contentBackgroundClassName`, `contentMinWidth`,
|
|
569
|
+
`sidebarMinWidth` and `estimatedItemSize` props from the window. Move any page
|
|
570
|
+
actions into the page content.
|
|
571
|
+
3. Place rows in `SettingsSection` cards in place of `SettingsCard` and
|
|
572
|
+
`SettingsRowGroup`. Change row `title` to `label` and put custom controls in
|
|
573
|
+
the row's children in place of `control`. Built-in switch, select, segmented
|
|
574
|
+
and image choice rows take the app's `value` and `onValueChange`.
|
|
575
|
+
|
|
576
|
+
**Before**
|
|
577
|
+
|
|
578
|
+
```tsx
|
|
579
|
+
import { SettingsRow, SettingsWindow } from "@legendapp/spark/settings/window";
|
|
580
|
+
|
|
581
|
+
<SettingsWindow windowId="settings" pages={[
|
|
582
|
+
{ id: "general", title: "General", render: () => <SettingsRow title="Theme" control={<ThemePicker />} /> },
|
|
583
|
+
]} />
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
**After**
|
|
587
|
+
|
|
588
|
+
```tsx
|
|
589
|
+
import { SettingsPage, SettingsRow, SettingsSection, SettingsWindow } from "@legendapp/spark/ui/settings";
|
|
590
|
+
|
|
591
|
+
<SettingsWindow windowId="settings">
|
|
592
|
+
<SettingsPage id="general" title="General" icon="gearshape">
|
|
593
|
+
<SettingsSection title="Appearance">
|
|
594
|
+
<SettingsRow label="Theme"><ThemePicker /></SettingsRow>
|
|
595
|
+
</SettingsSection>
|
|
596
|
+
</SettingsPage>
|
|
597
|
+
</SettingsWindow>
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
Standalone forms can import `Switch` from `@legendapp/spark/ui` with a boolean
|
|
601
|
+
`value`, `onValueChange` and an accessibility label. Use
|
|
602
|
+
`Select variant="borderless"` on macOS and web.
|
|
603
|
+
|
|
604
|
+
Run `spark upgrade`, `spark doctor`, and the app's typecheck and tests. Rebuild
|
|
605
|
+
custom macOS hosts and check sidebar selection, scrolling between pages, and
|
|
606
|
+
settings value persistence after reopening the window.
|
|
607
|
+
|
|
608
|
+
- macOS driver flows isolate app state and reattach after the main React host
|
|
609
|
+
reloads. Use the per-flow failure bundle to diagnose errors (#560).
|
|
610
|
+
- macOS packaging verifies the signed app's load paths, signing settings and
|
|
611
|
+
bundle contents. Check apps with custom native dependencies using
|
|
612
|
+
`bun run release:check <project-directory> <signed.app>` from the Spark
|
|
613
|
+
source checkout. Local rebuilds keep the last complete output available until
|
|
614
|
+
the new app is ready (#562).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# AI tools and app customization
|
|
2
|
+
|
|
3
|
+
Exports: `@legendapp/spark/ai`, `/ai/codex`, `/customize`.
|
|
4
|
+
|
|
5
|
+
## Running Claude/Codex CLIs (`/ai`, `/ai/codex`)
|
|
6
|
+
|
|
7
|
+
- `/ai` runs the user's installed `claude` or `codex` command-line tools through Spark processes. Installing and logging in is the user's job; check `getAICommandAvailability()` first and explain what is missing.
|
|
8
|
+
- Availability is advisory and never runs a prompt. Results are untrusted text: use `parseAIJson` / `extractJsonCandidate` and validate the shape yourself.
|
|
9
|
+
- `/ai/codex` talks to Codex directly (`runCodexPrompt`, `cancelActiveCodexRuns`, `shutdownCodex`); call `shutdownCodex()` on app teardown. Prefer it over `runAITool({ tool: 'codex' })` when you need Codex-specific options (`developerInstructions`, `outputSchema`, `reasoningEffort`) or the thread/turn IDs; `runAITool` is a one-shot CLI call that works with either tool.
|
|
10
|
+
- `/ai` needs Spark processes (macOS, Windows dev builds); availability reports both tools missing elsewhere. `/ai/codex` is macOS only (`E_UNSUPPORTED_PLATFORM` elsewhere). Neither runs on mobile/web.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { getAICommandAvailability, parseAIJson, runAITool } from '@legendapp/spark/ai';
|
|
14
|
+
|
|
15
|
+
const availability = await getAICommandAvailability({ preferredTool: 'codex' });
|
|
16
|
+
if (availability.preferredTool) {
|
|
17
|
+
const result = await runAITool({ tool: availability.preferredTool, prompt: 'Return a JSON object containing a greeting.' });
|
|
18
|
+
console.log(parseAIJson(result.output));
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`result.output` is decoded stdout (or stderr when stdout is empty); `result.exit` reports the exit status.
|
|
23
|
+
|
|
24
|
+
## In-app customization (`/customize`)
|
|
25
|
+
|
|
26
|
+
Opt-in feature for directly distributed macOS apps: users describe a change, review a compiled candidate and apply it without a native rebuild. Configure `customize.repository` in `desktop.config.json`; the toolkit downloads on first use. Workspaces live under `~/Library/Application Support/<bundle id>/SparkCustomize/`. Not for the App Store; no automatic data migration. Use `showEditor()` to open the UI and `useCustomizeState` / `getCustomizeState` to reflect status. For providers, a custom UI, monorepos and PR submission, read `docs/customize-apps.md` in the Spark repository.
|
|
27
|
+
|
|
28
|
+
The minimum is a GitHub repository whose tag `v<app version>` holds the released source, plus an explicit list of source paths (no hidden files, `node_modules` or native projects):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{ "customize": { "repository": "your-org/your-app", "files": ["package.json", "desktop.config.json", "metro.config.js", "index.ts", "src", "assets"] } }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { showEditor } from '@legendapp/spark/customize';
|
|
36
|
+
|
|
37
|
+
// From a menu item such as "Customize…":
|
|
38
|
+
await showEditor();
|
|
39
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# App lifecycle and documents
|
|
2
|
+
|
|
3
|
+
Exports: `@legendapp/spark/app`, `/app/documents`, `/links`.
|
|
4
|
+
|
|
5
|
+
## App lifecycle (`/app`)
|
|
6
|
+
|
|
7
|
+
- `activate()` brings the app forward; `hide()` hides its windows. To show a window from a tray or menu-bar click, prefer `showWindow(id, { activate: true })` (see [windows.md](windows.md)).
|
|
8
|
+
- Save data in a `beforeQuit` guard, not after `await quit()`: once quit is approved the JS runtime may stop before your continuation runs. Every guard must return `true`; `false`, a throw, or the 30 s deadline vetoes.
|
|
9
|
+
- `willQuit` is a notification only; it is not an async cleanup opportunity.
|
|
10
|
+
- One process runs per project. A second launch forwards to the running app: you get `reopen`, then `secondInstance`, then its files/URLs as ordinary open requests. `secondInstance` is live-only; files/URLs are replayed through `/app/documents`.
|
|
11
|
+
- `relaunch()` runs the same quit guards and resolves `{ quitRequested: false, reason: 'vetoed' }` when vetoed.
|
|
12
|
+
- Safe mode (`--spark-safe-mode` or Shift at launch) skips Spark's window restoration. Check `getAppContext().launch.safeMode` before restoring your own state (open documents, navigation).
|
|
13
|
+
- Startup `macos.lifecycle.mainWindow.glass` uses plain React content before macOS 26 and the public `NSGlassEffectView` on newer systems.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { beforeQuit, quit } from '@legendapp/spark/app';
|
|
17
|
+
|
|
18
|
+
declare const documentStore: { flush(): Promise<void> };
|
|
19
|
+
declare function showUnsavedWork(): void;
|
|
20
|
+
|
|
21
|
+
const guard = await beforeQuit(async () => {
|
|
22
|
+
await documentStore.flush();
|
|
23
|
+
return true;
|
|
24
|
+
});
|
|
25
|
+
const result = await quit();
|
|
26
|
+
if (!result.quitRequested) showUnsavedWork();
|
|
27
|
+
await guard.remove();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Opening files and URLs (`/app/documents`)
|
|
31
|
+
|
|
32
|
+
- Use `subscribeToOpenRequests` for Finder/Explorer opens, Dock drops and deep links. Requests are `{ type: 'file', id, path }` or `{ type: 'url', id, url }`; paths are already decoded native paths, so do not parse file URLs yourself.
|
|
33
|
+
- A new subscription replays retained launch requests. Exactly-once import (across subscriptions) is your job: deduplicate by `id` or by your own state.
|
|
34
|
+
- `noteRecentDocument(path)` / `getRecentDocuments()` / `clearRecentDocuments()` manage project-scoped history (standalone macOS apps also feed the system Recent menu).
|
|
35
|
+
- For document-style apps, `createDocumentAppController` (service) or `useDocumentAppController` (component) owns the open-request listener, the app menu and the document window's open state. `watchDocumentReload` / `useWatchedDocumentReload` debounce file changes into reloads; `onError` is required.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { subscribeToOpenRequests } from '@legendapp/spark/app/documents';
|
|
39
|
+
|
|
40
|
+
declare function loadDocument(path: string): void;
|
|
41
|
+
declare function handleDeepLink(url: string): void;
|
|
42
|
+
|
|
43
|
+
const subscription = await subscribeToOpenRequests(request => {
|
|
44
|
+
if (request.type === 'file') loadDocument(request.path);
|
|
45
|
+
else handleDeepLink(request.url);
|
|
46
|
+
});
|
|
47
|
+
subscription.remove();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Links (`/links`)
|
|
51
|
+
|
|
52
|
+
Expo Linking subset: `openURL`, `canOpenURL`, `getInitialURL`, `addEventListener('url', …)`, plus desktop `openPath(path)` to open a file with its default app. Subscribe before awaiting `getInitialURL()`. The live listener excludes launch replay and file opens; use `/app/documents` when you need both. URL scheme associations need a custom build (the generic Spark Runner does not own your scheme).
|
|
53
|
+
|
|
54
|
+
## Platforms
|
|
55
|
+
|
|
56
|
+
`/app`: macOS and Windows. `/app/documents`: macOS and Windows hosts. `/links`: macOS, Windows (live URL activation pending), and iOS/Android/web through `expo-linking`.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Integrated external libraries
|
|
2
|
+
|
|
3
|
+
## Versioned patch registry
|
|
4
|
+
|
|
5
|
+
Spark keeps exact tested versions in `patches/registry.json`, including redirect-only adapters and the minimum Spark version for each patch. Old versions and their patch files are retained. Run `bun scripts/patch-registry.ts` after adding a version; validation rejects missing files, changed hashes, ranges and unknown metadata. Preserve an existing patch file when adding a newer recipe; give the new recipe a distinct file and `minSpark` entry.
|
|
6
|
+
|
|
7
|
+
Install, `spark prebuild`, `spark dev` and `spark build` check installed libraries before native work. Spark reads the latest registry and patches from `LegendApp/legend-spark` main over HTTPS, pins all files to one commit SHA, and caches that set by SHA. If the fetch fails, it prints a one-line notice and uses the patches bundled with the installed SDK. Build receipts record `runtime.patchSourceSHA` as that commit or `bundled`.
|
|
8
|
+
|
|
9
|
+
Spark selects the newest patch for the exact installed library version whose `minSpark` supports the installed Spark. If a newer recipe needs a newer Spark, it offers `spark upgrade`; declining keeps the compatible recipe. If no compatible patch exists, a terminal lists patched versions with the newest compatible version as the default. Accepting updates `package.json` and reinstalls; declining stops. CI and piped commands fail with an exact install command. Shared `node_modules` installations prompt and repair at their shared root.
|
|
10
|
+
|
|
11
|
+
Use `"spark": { "patches": { "<library>": false } }` in `package.json` to skip a library's check and Spark patch. A shared-root opt-out applies to its apps. `spark doctor` reports the same version findings with a `Fix:` line without prompts, migrations or filesystem writes. App patches still layer after Spark's selected recipe. SDK-owned native archives retain their provenance checks; use the matching SDK archive overrides when installing them.
|
|
12
|
+
|
|
13
|
+
No new Expo-owned packages are added to this registry. Existing Expo patches and the existing Clipboard/Document Picker redirects remain supported.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Version-matched copy of the integration table for this Spark release. Import each library from its own package and use its upstream documentation; this table lists the version Spark patches and tested, and what changes on desktop. Install exactly that version: patches apply to exact versions, and other versions build unpatched.
|
|
17
|
+
|
|
18
|
+
| Starting application | Intended path |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| Expo mobile app adding desktop | Keep supported upstream imports; adopt framework adapters for individual missing cross-platform capabilities. |
|
|
21
|
+
| Electron desktop app | Map native capabilities to framework APIs and adapt the UI/runtime deliberately. Do not promise Electron's process, preload, `webContents`, or general Node runtime compatibility. |
|
|
22
|
+
| Existing Electron desktop and React Native mobile apps | Share application logic through capability contracts incrementally. An Electron backend could support staged adoption, but none is implemented or committed to by this policy. |
|
|
23
|
+
| Library | Upstream import | Desktop integration |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| [Margelo Runtimes](https://github.com/margelo/react-native-runtimes) | `@react-native-runtimes/core` | Independent Hermes workers; SDK pins and macOS/Windows adapters; automatic Metro/host setup; prebuilt inclusion and production pruning. |
|
|
26
|
+
| [React Native WebView](https://github.com/react-native-webview/react-native-webview) | `react-native-webview` | macOS WebKit and upstream Windows Fabric WebView2; pinned SDK version with explicit Windows fixes. |
|
|
27
|
+
| [OP-SQLite](https://github.com/OP-Engineering/op-sqlite) | `@op-engineering/op-sqlite` | Native SQLite; Windows RNW JSI adapter with Unicode paths and per-runtime installation state; macOS production selection. |
|
|
28
|
+
| [VisionCamera](https://github.com/mrousavy/react-native-vision-camera) | `react-native-vision-camera` | App-owned dependency with automatic version-pinned macOS patches for VisionCamera, Nitro Image, and shared Nitro. |
|
|
29
|
+
| [MMKV](https://github.com/mrousavy/react-native-mmkv) | `react-native-mmkv` | Install 4.3.2 in the app. Spark patches its macOS storage folder from `~/Documents/mmkv` to the app's namespaced Application Support folder; other versions build unpatched. |
|
|
30
|
+
| [Unistyles](https://github.com/jpudysz/react-native-unistyles) | `react-native-unistyles` | Install 3.6.0 in the app. Spark patches in an AppKit runtime: window size, backing scale, appearance (adaptive themes) and RTL; insets, status/navigation bars and the keyboard report zero. |
|
|
31
|
+
| [Quick Crypto](https://github.com/margelo/react-native-quick-crypto) | `react-native-quick-crypto` | Install 1.1.9 with `react-native-quick-base64` 3.0.1. Spark patches Quick Crypto's PBKDF2 `endian.h` include for macOS and adds macOS to Quick Base64's podspec. |
|
|
32
|
+
| [Nitro Fetch](https://github.com/margelo/react-native-nitro-fetch) | `react-native-nitro-fetch` | Install 1.9.0. Spark adds macOS to its podspec and runs its launch prefetch on `NSApplicationDidFinishLaunching`. Its peer range asks for Nitro 0.37.1; it runs on Spark's 0.37.0. |
|
|
33
|
+
| [Blur](https://github.com/Kureev/react-native-blur) | `@react-native-community/blur` | Install 4.4.1. Spark patches in AppKit `BlurView`/`VibrancyView` on `NSVisualEffectView` materials (`blurAmount` has no macOS equivalent; materials follow the window's active state; `VibrancyView` children mount inside the material, but React Native views don't opt into AppKit vibrancy, so they draw unblended) and declares the components in its codegen config instead of relying on React Native's deprecated source scan. |
|
|
34
|
+
| [Worklets Core](https://github.com/margelo/react-native-worklets-core) | `react-native-worklets-core` | Install 1.6.3. Spark adds macOS to its podspec; the native code is platform-neutral, and on the bridgeless host it reaches the runtime through React Native's deprecated `RCTBridgeProxy` interop. Its Babel plugin needs `@babel/plugin-transform-shorthand-properties`, `@babel/plugin-transform-arrow-functions`, `@babel/plugin-proposal-optional-chaining`, `@babel/plugin-proposal-nullish-coalescing-operator` and `@babel/plugin-transform-template-literals` installed, as on iOS; scope it to your worklet files if the app also uses Skia without Reanimated. |
|
|
35
|
+
| [FastImage](https://github.com/DylanVann/react-native-fast-image) | `react-native-fast-image` | Install 10.9.9. Its native view is UIKit only, so on macOS Spark adds a JavaScript stand-in on React Native's `Image`: sources, `objectFit`, `tintColor`, placeholders while loading, load events, `reload()` and `preload`. Its own caches, thumbhash/blurhash placeholders, transitions and cache APIs are not available on macOS. |
|
|
36
|
+
| [Release Profiler](https://github.com/margelo/react-native-release-profiler) | `react-native-release-profiler` | Install 0.4.5. Spark adds macOS to its podspec and writes traces to the app's namespaced Caches folder instead of the shared `~/Library/Caches`. |
|
|
37
|
+
| [Tracking Transparency](https://github.com/mrousavy/react-native-tracking-transparency) | `react-native-tracking-transparency` | Works on macOS without a patch: it reports `unavailable`. App Tracking Transparency is a no-op on the Mac (Apple's header: the status is always `not-determined` and requests never prompt), so there is nothing native to enable. |
|
|
38
|
+
| [Skia](https://github.com/Shopify/react-native-skia) | `@shopify/react-native-skia` | Supports macOS upstream (2.14.0 verified, no patch). Without Reanimated, keep other worklet Babel plugins (such as Worklets Core's) off Skia's sources: they read Skia's optional Reanimated proxy at load and the app never renders. |
|
|
39
|
+
| [Blurhash](https://github.com/mrousavy/react-native-blurhash) | `react-native-blurhash` | Install 2.1.3. Spark patches in an AppKit view (layer contents with `resizeMode` as contents gravity), the NSImage decoder and encoder, and the codegen component provider. |
|
|
40
|
+
| [Screen Corner Radius](https://github.com/mrousavy/react-native-screen-corner-radius) | `react-native-screen-corner-radius` | Install 0.2.3. Its native module is iOS only; Spark's patch makes the import report 0 instead of throwing where the module is missing. |
|
|
41
|
+
| [Nitro SQLite](https://github.com/margelo/react-native-nitro-sqlite) | `react-native-nitro-sqlite` | Supports macOS upstream (10.2.0 verified, no patch). Databases live in `~/Library/Application Support/<bundle id>`. Its SQLite symbols are prefixed, so it links beside Spark's OP-SQLite. |
|
|
42
|
+
| [App Logs](https://github.com/kirillzyusko/react-native-app-logs) | `react-native-app-logs` | Install 0.3.1. Spark adds macOS 14+ to its podspec and points macOS at its iOS bindings; it reads the app's own entries from OSLogStore. |
|
|
43
|
+
| [Nitro ZXing](https://github.com/margelo/react-native-vision-camera-zxing) | `react-native-nitro-zxing` | Install 0.3.1. Spark adds macOS to its podspec; it builds on Spark's patched VisionCamera 5 and Nitro Image (its peers; Spark pins them, so declare them only to import them directly), and scans still images (verified) and camera frames. |
|
|
44
|
+
| [Safe Area Context](https://github.com/AppAndFlow/react-native-safe-area-context) | `react-native-safe-area-context` | Supports macOS upstream (5.6.2, Expo SDK 55's pin, verified; no patch). Insets come from the provider view's `NSView.safeAreaInsets`: 0 in a standard window. |
|
|
45
|
+
| [Keep Awake](https://docs.expo.dev/versions/latest/sdk/keep-awake/) | `expo-keep-awake` | Declare 55.0.8 in the app. Upstream builds on macOS but does nothing there; Spark's patch holds a `ProcessInfo` activity that disables idle display and system sleep while activated. |
|
|
46
|
+
| [Screens](https://github.com/software-mansion/react-native-screens) | `react-native-screens` | Install 4.23.0. Its native containers are UIKit only; on macOS Spark points every component with a web version at that plain-view implementation, and keeps the iOS-only pod out of codegen. |
|
|
47
|
+
| [Reanimated](https://github.com/software-mansion/react-native-reanimated) | `react-native-reanimated`, `react-native-worklets` | Supports macOS upstream (4.2.1 and 0.7.4, Expo SDK 55's pins, verified; no patch). `babel-preset-expo` adds the worklets Babel plugin when `react-native-worklets` is installed. |
|
|
48
|
+
| [Gesture Handler](https://github.com/software-mansion/react-native-gesture-handler) | `react-native-gesture-handler` | Supports macOS upstream (2.30.0, Expo SDK 55's pin; no patch). Verified registration and mounting; pointer gestures were checked by hand only. |
|
|
49
|
+
| [React Navigation](https://reactnavigation.org) | `@react-navigation/native`, `@react-navigation/native-stack`, `@react-navigation/bottom-tabs` | Install 7.5.1 / 7.21.0 / 7.21.0 with Screens and Safe Area Context. Spark points native-stack at its JavaScript stack view on macOS, which draws headers; the native one relies on UIKit headers. |
|
|
50
|
+
| [Expo Crypto](https://docs.expo.dev/versions/latest/sdk/crypto/) | `expo-crypto` | Supports macOS upstream (55.0.19 verified; no patch). |
|
|
51
|
+
| [Expo Linear Gradient](https://docs.expo.dev/versions/latest/sdk/linear-gradient/) | `expo-linear-gradient` | Supports macOS upstream (55.0.18 verified; no patch). |
|
|
52
|
+
| [Expo Web Browser](https://docs.expo.dev/versions/latest/sdk/webbrowser/) | `expo-web-browser` | Declare 55.0.20 in the app. It opens pages in an in-app WebKit window on macOS upstream; Spark's patch makes `dismissBrowser` resolve `openBrowserAsync` with `dismiss`, as on iOS, instead of `cancel`. |
|
|
53
|
+
| [Expo Application](https://docs.expo.dev/versions/latest/sdk/application/) | `expo-application` | Declare 55.0.19 in the app. Spark adds macOS to its podspec; installation time comes from the app bundle (not `~/Documents`), the vendor ID is `null` and the release type `UNKNOWN`. |
|
|
54
|
+
| [Expo Device](https://docs.expo.dev/versions/latest/sdk/device/) | `expo-device` | Declare 55.0.21 in the app. Spark adds macOS answers: model ID from `hw.model`, `macOS` and its version, the computer name, desktop device type. `modelName` and `deviceYearClass` are `null`. |
|
|
55
|
+
| [Expo Localization](https://docs.expo.dev/versions/latest/sdk/localization/) | `expo-localization` | Declare 55.0.19 in the app. Spark adds macOS to its podspec and listens for time-zone changes in place of iOS's significant-time-change notification. |
|
|
56
|
+
| [Expo Haptics](https://docs.expo.dev/versions/latest/sdk/haptics/) | `expo-haptics` | Declare 55.0.18 in the app. Unpatched, every call rejects as unavailable on macOS; Spark's patch plays them through `NSHapticFeedbackManager` (felt on Force Touch trackpads). |
|
|
57
|
+
| [SVG](https://github.com/software-mansion/react-native-svg) | `react-native-svg` | Install 15.15.3. It targets macOS, but with React Native macOS 0.83 it neither compiled (a missing `RCTAssert` import) nor drew (component views update their layer, so AppKit skipped its `drawRect:`); Spark's patch fixes both. |
|
|
58
|
+
| [NetInfo](https://github.com/react-native-netinfo/react-native-netinfo) | `@react-native-community/netinfo` | Supports macOS upstream (11.5.2 verified; no patch). |
|
|
59
|
+
| [Expo Font](https://docs.expo.dev/versions/latest/sdk/font/) | `expo-font` | Declare 55.0.8 in the app. On macOS upstream didn't resolve font-family aliases (its swizzle is UIKit-only), so a font loaded as `material-community` fell back to the system font; Spark's patch resolves aliases through `NSFontManager`. |
|
|
60
|
+
| [Vector Icons](https://docs.expo.dev/guides/icons/) | `@expo/vector-icons` | Works on macOS (15.1.1) with Spark's expo-font patch; icon sets whose font family differs from their alias (Material Community Icons and others) need it. |
|
|
61
|
+
| [Drawer Layout](https://github.com/react-navigation/react-navigation/tree/main/packages/react-native-drawer-layout) | `react-native-drawer-layout` | JavaScript on Reanimated and Gesture Handler; works on macOS (4.2.12 verified). |
|
|
62
|
+
| [Bottom Sheet](https://github.com/gorhom/react-native-bottom-sheet) | `@gorhom/bottom-sheet` | JavaScript on Reanimated and Gesture Handler; works on macOS (5.2.14 verified). |
|
|
63
|
+
| [Expo Blur](https://docs.expo.dev/versions/latest/sdk/blur-view/) | `expo-blur` | Declare 55.0.18 in the app. Upstream is iOS, Android and web only; Spark's patch backs `BlurView` on macOS with `NSVisualEffectView`, mapping `tint` to a material and appearance and `intensity` to opacity. `blurReductionFactor` and `experimentalBlurMethod` are Android-only. |
|
|
64
|
+
| [Expo Clipboard](https://docs.expo.dev/versions/latest/sdk/clipboard/) | `expo-clipboard` | Declare 55.0.17 in the app. On macOS Spark redirects the original import to its clipboard backend: text/HTML and PNG images (base64 input, data URI plus dimensions on read). JPEG, image quality options, URL-specific calls, listeners and synchronous writes reject with `ERR_UNAVAILABLE`; `isPasteButtonAvailable` is false. |
|
|
65
|
+
| [Expo Image](https://docs.expo.dev/versions/latest/sdk/image/) | `expo-image` | Declare 55.0.11 in the app. Its native view is UIKit only, so on macOS Spark adds a JavaScript stand-in on React Native's `Image`: sources (the largest of several sizes), placeholders while loading, `contentFit`, `tintColor`, load events, `reloadAsync` and `Image.prefetch`. Its SDWebImage caches, blurhash, thumbhash and SF Symbol sources (these report `onError`), `contentPosition`, transitions, `useImage`/`Image.loadAsync` and hash generation are not available on macOS, and a tint fills the whole view rather than only the fitted image. |
|
|
66
|
+
| [Expo Symbols](https://docs.expo.dev/versions/latest/sdk/symbols/) | `expo-symbols` | Declare 55.0.9 in the app. Spark's patch draws `SymbolView` with AppKit's SF Symbols: names, sizes, weights, scales, tint, the monochrome, hierarchical, palette and multicolor types, and symbol effects. `NSImageView` only stretches, fits or draws at natural size, so `resizeMode` `scaleAspectFill` fits and the edge-aligned modes draw centered. |
|
|
67
|
+
| [Masked View](https://github.com/react-native-masked-view/masked-view) | `@react-native-masked-view/masked-view` | Declare 0.3.2 in the app. AppKit has no `maskView`, so Spark's patch keeps the mask element drawing in an invisible host and renders it into the children's layer mask once per display frame while the view is on screen; masks follow the mask element's alpha, including text and animated masks, at the cost of one offscreen render per frame. |
|
|
68
|
+
| [Graph](https://github.com/margelo/react-native-graph) | `react-native-graph` | Declare 1.4.0 in the app. Upstream builds its paths with Skia 1's mutable `SkPath`, which Skia 2 removed, so it threw on any platform with Spark's Skia; Spark's patch builds them with `Skia.PathBuilder`. Static and animated graphs, gradient fills and the pan gesture use the package's own code. |
|
|
69
|
+
| [Expo Glass Effect](https://docs.expo.dev/versions/latest/sdk/glass-effect/) | `expo-glass-effect` | Declare 55.0.11 in the app. Spark's patch hosts `GlassView` in AppKit's `NSGlassEffectView` and `GlassContainer` in `NSGlassEffectContainerView` on macOS 26 (earlier macOS shows the children without glass): regular and clear styles, `none`, tint, color scheme, corner radius (one radius; per-corner values use the largest) and container spacing. `isInteractive` and style animations have no AppKit equivalent. Spark's own `@legendapp/spark/ui/glass` covers the same view. |
|
|
70
|
+
| [Splash Screen](https://docs.expo.dev/versions/latest/sdk/splash-screen/) | `expo-splash-screen` | Works on macOS (55.0.25) without a patch: a desktop app has no launch splash, so `setOptions`, `preventAutoHideAsync`, `hide` and `hideAsync` resolve without effect. |
|
|
71
|
+
| [System UI](https://docs.expo.dev/versions/latest/sdk/system-ui/) | `expo-system-ui` | Declare 55.0.22 in the app. Spark's patch sets and reads the main window's background color on macOS (the app delegate's window, as on iOS); `null` restores the default window background. Other windows keep Spark's `backgroundColor` window option. |
|
|
72
|
+
| [Document Picker](https://docs.expo.dev/versions/latest/sdk/document-picker/) | `expo-document-picker` | Declare 55.0.17 in the app and exclude it from macOS autolinking (its native module has no macOS build). On macOS Spark redirects the import to an open panel: `getDocumentAsync` with `type`, `multiple` and `copyToCacheDirectory` returns Expo's `{ canceled, assets }` with name, `file://` URI, size, last-modified time and MIME type. Copies go to a `DocumentPicker` folder in the app's Caches (the default, as on iOS); `copyToCacheDirectory: false` returns the picked file's own URI. Common MIME types and `image/*`, `audio/*`, `video/*`, `text/*` map to extensions; other MIME types, `base64` and unknown options reject with `ERR_UNAVAILABLE`. |
|
|
73
|
+
| [Image Picker](https://docs.expo.dev/versions/latest/sdk/imagepicker/) | `expo-image-picker` | Declare 55.0.24 in the app. macOS has no photo library or camera picker, so Spark's patch picks image and movie files with an open panel (sheet on the key window): `mediaTypes`, `allowsMultipleSelection`, `selectionLimit` and `base64` apply, and assets carry the picked file's URI, size, dimensions, MIME type and video duration. The library permission is always granted; camera permission reports AVFoundation's status, and `launchCameraAsync` rejects as unavailable. Editing, quality, EXIF and video export options don't apply. |
|
|
74
|
+
| [Image Manipulator](https://docs.expo.dev/versions/latest/sdk/imagemanipulator/) | `expo-image-manipulator` | Declare 55.0.21 in the app. Spark's patch draws with CoreGraphics on macOS: resize, rotate, flip, crop and saving as JPEG, PNG or WebP (with base64) work, EXIF orientation is applied on load, and saved files go to a per-app folder in Caches. Photo library (`ph://`) sources are iOS only. |
|
|
75
|
+
| [Location](https://docs.expo.dev/versions/latest/sdk/location/) | `expo-location` | Declare 55.1.15 in the app and add `NSLocationWhenInUseUsageDescription` to the macOS Info.plist before requesting permission; without it, permission reports denied. Spark's patch builds it for macOS's CoreLocation: permissions, Location Services and provider status, current and watched positions, and geocoding. Macs have no compass, so heading rejects; background-only options (`activityType`, `pausesUpdatesAutomatically`, the background indicator) have no macOS equivalent, and macOS reports only "always" authorization. |
|
|
76
|
+
| [Date Time Picker](https://github.com/react-native-datetimepicker/datetimepicker) | `@react-native-community/datetimepicker` | Install 9.2.2. Spark's patch hosts the picker in AppKit's `NSDatePicker`: date, time and date-and-time modes, `display="inline"` as a calendar and clock, minimum and maximum dates, locale, time zone, text color, theme variant and `disabled`. Countdown mode shows a time picker; spinner and compact show the stepper field; `minuteInterval`, `accentColor` and `onDismiss` have no macOS equivalent. |
|
|
77
|
+
| [Keyboard Controller](https://github.com/kirillzyusko/react-native-keyboard-controller) | `react-native-keyboard-controller` | Install 1.22.9. Its native module is iOS and Android only and threw at import on macOS; Spark's patch selects the package's own web bindings there, so its components and hooks render and report the keyboard hidden. A Mac has no software keyboard to avoid, so keyboard events never fire. |
|
|
78
|
+
| [Sentry](https://docs.sentry.io/platforms/react-native/) | `@sentry/react-native` | Declare 8.32.0 in the app. Its native module and sentry-cocoa build for macOS; Spark's patch keeps the session replay mask views as plain containers there, because codegen still registers them and a missing class aborted the app at launch. Errors carry native macOS device and OS context; session replay is iOS only. |
|
|
79
|
+
| [Expo Router](https://docs.expo.dev/router/introduction/) | `expo-router` | Works on macOS (55.0.18) without a patch: file-based routes, `Stack`, dynamic segments, search params and `Link` run on React Navigation and Spark's react-native-screens patch. Its native module (native tabs, toolbar, link previews, `expo-router/head`) is iOS only. Wrap layouts in React Navigation's `ThemeProvider` to follow the app's appearance. |
|
|
80
|
+
|
|
81
|
+
## Optional backend dependencies
|
|
82
|
+
|
|
83
|
+
Apps using `/markdown`, `/html`, `/webview`, or `/sqlite` must install the matching optional peer: `react-native-enriched-markdown@1.1.1`, `react-native-enriched-html@1.1.1`, `react-native-webview@16.0.0`, or `@op-engineering/op-sqlite@18.2.1`, and keep the SDK's overrides for WebView and SQLite (see [UPGRADING.md](UPGRADING.md)). `spark doctor` reports missing declarations. Universal apps targeting Windows exclude `react-native-enriched-html` and `react-native-enriched-markdown` in `expoByPlatform.windows.autolinking.exclude` in `desktop.config.json`; they have no Windows implementation. Spark applies the Enriched Markdown/HTML compatibility patches automatically; no package-manager patch declaration is needed.
|
|
84
|
+
|
|
85
|
+
## Windows
|
|
86
|
+
|
|
87
|
+
Windows supplies an adapter for `react-native-nitro-modules` 0.37.0 (the Nitro C++ runtime through RNW JSI). A Nitro library with only Swift/Kotlin implementations still needs its own Windows implementation. Windows external-library integrations are implemented in source but not yet verified on x64 and ARM64 hardware; WebView follows upstream Windows prop coverage.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Files, dialogs and drag and drop
|
|
2
|
+
|
|
3
|
+
Exports: `@legendapp/spark/files`, `/dialogs`, `/drag-drop`.
|
|
4
|
+
|
|
5
|
+
## Where data goes
|
|
6
|
+
|
|
7
|
+
- Use `getDirectory('data' | 'cache' | 'temp')` for app-owned storage. On macOS `data` is under `~/Library/Application Support/<bundle id>/Spark`; Spark's settings and SQLite use the same place. Do not write app data to `~/Documents` or next to the app bundle.
|
|
8
|
+
- Third-party storage libraries Spark patches (MMKV, Nitro SQLite, Release Profiler) are also moved to the app's Application Support or Caches folder; see [library-compat.md](library-compat.md).
|
|
9
|
+
|
|
10
|
+
## Files (`/files`)
|
|
11
|
+
|
|
12
|
+
- All IO is async. Paths are absolute native paths; local `file://` URLs are accepted and decoded once. Don't hand-encode spaces or `%`.
|
|
13
|
+
- Binary IO uses `Uint8Array` (`readBytes`/`writeBytes`), never base64. Use `readChunks`/`writeChunks`/`openFile` for large files.
|
|
14
|
+
- Whole-file writes are atomic. `writeTextIfUnchanged(path, previous, next)` returns `{ written: false }` on conflict.
|
|
15
|
+
- `remove` is non-recursive by default and succeeds when the path is absent; `mkdir` is recursive by default. `copy`/`move` reject an existing destination unless `{ overwrite: true }`. Prefer `trash` for user-visible deletes.
|
|
16
|
+
- `watch` notifications mean "re-read"; they are not an exact change log. Remove watches when done.
|
|
17
|
+
- `scanFiles` (macOS) enumerates large trees in batches with `AbortSignal` support.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { getDirectory, list, mkdir, readText, writeText } from '@legendapp/spark/files';
|
|
21
|
+
|
|
22
|
+
const directory = `${await getDirectory('data')}/notes`;
|
|
23
|
+
await mkdir(directory);
|
|
24
|
+
await writeText(`${directory}/first.md`, '# Hello');
|
|
25
|
+
for (const entry of await list(directory)) console.log(entry.name, await readText(entry.path));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Dialogs (`/dialogs`)
|
|
29
|
+
|
|
30
|
+
- `openFileDialog` / `saveFileDialog` return `{ canceled: true }` or the paths; always check `canceled`. Filters are extensions without dots. Omit filter `name` on macOS (names reject there); nonempty filters reject for directory-only selection. `macos` dialog options reject on other targets.
|
|
31
|
+
- A direct `expo-document-picker` import (declared in the app) also works on macOS: Spark redirects `getDocumentAsync` to this open panel and copies picks into the app's Caches unless `copyToCacheDirectory: false`. Unsupported MIME filters and options reject.
|
|
32
|
+
- Pass `windowId` to attach as a sheet to that window; omit it for an app-modal dialog.
|
|
33
|
+
- `showMessage` returns the chosen button ID (`null` on dismissal); `confirm` and `showPrompt` cover the common cases. `showAboutPanel` shows the standard About panel.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { openFileDialog } from '@legendapp/spark/dialogs';
|
|
37
|
+
import { readText } from '@legendapp/spark/files';
|
|
38
|
+
|
|
39
|
+
const result = await openFileDialog({ windowId: 'main', filters: [{ extensions: ['md'] }] });
|
|
40
|
+
if (!result.canceled) console.log(await readText(result.paths[0]!));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Drag and drop (`/drag-drop`)
|
|
44
|
+
|
|
45
|
+
One `DragDropView` is both source and destination. Built-in payloads: `files` (absolute paths), `text`, `urls`; custom data uses lowercase MIME names you opt into with `acceptedTypes`. Source-enabled views own the mouse gesture, so use a dedicated drag handle instead of wrapping interactive controls. A drop's `accepted: true` is OS negotiation, not proof your app persisted anything; a `move` means you delete the source yourself. File promises are not implemented.
|
|
46
|
+
|
|
47
|
+
Set `dragPreview="snapshot"` on a source to show its visible contents on macOS. Windows uses its standard system preview.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { DragDropView } from '@legendapp/spark/drag-drop';
|
|
51
|
+
import { Text } from 'react-native';
|
|
52
|
+
|
|
53
|
+
declare function importFiles(paths: string[]): void;
|
|
54
|
+
|
|
55
|
+
export const DropZone = () => (
|
|
56
|
+
<DragDropView onDrop={({ files }) => files && importFiles([...files])} onError={console.error}>
|
|
57
|
+
<Text>Drop files here</Text>
|
|
58
|
+
</DragDropView>
|
|
59
|
+
);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Platforms
|
|
63
|
+
|
|
64
|
+
macOS: all. Windows (dev builds): files, dialogs and drag-drop have backends; `scanFiles` and dialog accessory controls are macOS-only; Windows recursive watches need an existing directory. Mobile/web: not covered; use Expo FileSystem / DocumentPicker there.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# OS integrations
|
|
2
|
+
|
|
3
|
+
Exports: `@legendapp/spark/notifications`, `/clipboard`, `/system`, `/updates`, `/processes`, `/auth-session`, `/audio`. Links and document opens are in [app-and-documents.md](app-and-documents.md); Dock/Jump List menus in [menus-tray-dock.md](menus-tray-dock.md).
|
|
4
|
+
|
|
5
|
+
## Notifications
|
|
6
|
+
|
|
7
|
+
- Ask for permission from a user action (an "Enable notifications" button), not at launch. `getNotificationPermission()` reads without prompting. Showing without permission rejects `E_PERMISSION_DENIED`.
|
|
8
|
+
- `showNotification({ id, content })` posts now; `scheduleNotification({ id, content, trigger: { type: 'delay', delaySeconds } })` schedules. `cancel*` affects pending, `dismiss*` delivered.
|
|
9
|
+
- Subscribe with `onNotificationResponse` early: it replays responses retained from a cold launch (latest 100).
|
|
10
|
+
- The Spark Runner shares its host's notification identity and can't cold-launch your project from a notification; test that in a custom standalone build. No remote push/APNs.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { onNotificationResponse, requestNotificationPermission, showNotification } from '@legendapp/spark/notifications';
|
|
14
|
+
|
|
15
|
+
const responses = await onNotificationResponse(response => console.log(response.action, response.data));
|
|
16
|
+
const permission = await requestNotificationPermission();
|
|
17
|
+
if (permission.granted) {
|
|
18
|
+
await showNotification({ id: 'export-finished', content: { title: 'Export finished', body: 'Your document is ready.' } });
|
|
19
|
+
}
|
|
20
|
+
responses.remove();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Clipboard
|
|
24
|
+
|
|
25
|
+
Expo Clipboard subset (`getStringAsync`, `setStringAsync`, `hasStringAsync`) works on desktop, mobile and web. `setStringAsync` resolves `false` when the platform declines. Desktop adds `readClipboard` / `writeClipboard` for HTML, PNG (`{ format: 'png', bytes: Uint8Array }`) and file lists; check `getRichClipboardAvailability()`.
|
|
26
|
+
|
|
27
|
+
The original `expo-clipboard` import is redirected on macOS when declared by the app. It adds Expo-shaped PNG `setImageAsync`, `getImageAsync({ format: "png" })` and `hasImageAsync` to the text/HTML subset. JPEG/quality options, URL methods, listeners and synchronous writes reject with `ERR_UNAVAILABLE`; `isPasteButtonAvailable` is false.
|
|
28
|
+
|
|
29
|
+
## System (`/system`)
|
|
30
|
+
|
|
31
|
+
- `preventSleep({ reason, kind })` returns a registration: always remove it in `finally`.
|
|
32
|
+
- `setAppBadge('3')` (Windows takes text only; numbers are macOS-only). `setAppProgress({ state: 'normal', value })` and `null` to clear (macOS only).
|
|
33
|
+
- `requestAttention`, `onSystemEvent`, `getSystemInfo`, `getAppearancePreferences` (macOS; accent color, reduce motion, etc.). Use `PlatformColor('controlAccentColor')` etc. for colors that follow appearance.
|
|
34
|
+
- `setLaunchAtLogin` needs a standalone distributed macOS app; Windows reports unavailable.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { preventSleep } from '@legendapp/spark/system';
|
|
38
|
+
|
|
39
|
+
declare function exportVideo(): Promise<void>;
|
|
40
|
+
|
|
41
|
+
const blocker = await preventSleep({ reason: 'Exporting video', kind: 'display' });
|
|
42
|
+
try { await exportVideo(); } finally { await blocker.remove(); }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## App updates (`/updates`)
|
|
46
|
+
|
|
47
|
+
Sparkle-based whole-app updates for distributed macOS Release builds; no JS OTA. Run `spark updates init <https feed .xml>` once, then call `startUpdates()` when the app is ready and wire a "Check for Updates…" menu item to `checkForUpdates()`. In the Runner and Debug builds every command rejects `E_UNAVAILABLE`; read `getUpdateStatus()` / `getUpdateAvailability()` instead of assuming. Bump `expo.macos.buildNumber` every release. Windows: unsupported.
|
|
48
|
+
|
|
49
|
+
## Processes and helpers (`/processes`)
|
|
50
|
+
|
|
51
|
+
- Targets are explicit: `{ type: 'executable', path }`, `{ type: 'helper', name }` (a binary bundled through `desktop.config.json` `helpers`) or `{ type: 'command', name }` (resolved on PATH; `resolveCommand(name)` checks first).
|
|
52
|
+
- `runCommand` buffers output; `spawn` returns a handle with `write`, `closeInput`, `terminate` and `exited`, streaming through `onOutput`. Output is `Uint8Array`, so decode it yourself. Capture is capped (`captureLimitBytes`, at most 8 MiB per stream); streaming stays complete.
|
|
53
|
+
- Arguments are passed without a shell. A nonzero exit is a result (`exit: { type: 'exited', code }`), not a rejection. `pty` runs the child on a pseudo-terminal (macOS).
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { runCommand } from '@legendapp/spark/processes';
|
|
57
|
+
|
|
58
|
+
const result = await runCommand({ target: { type: 'executable', path: '/usr/bin/uname' }, args: ['-a'] });
|
|
59
|
+
if (result.exit.type === 'exited' && result.exit.code === 0) console.log(new TextDecoder().decode(result.stdout));
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Auth and audio
|
|
63
|
+
|
|
64
|
+
- `/auth-session` only opens the system browser and receives the redirect (loopback on desktop). Build the OAuth request, PKCE and token exchange with your auth library. Always `dismiss()` the session in `finally`.
|
|
65
|
+
- `/audio`: `createAudioPlayer({ uri })` / `useAudioPlayer`, positions in seconds; `remove()` the player when its owner is done. `createMediaSession` for Now Playing / media keys. Windows has a native player and media session (system media controls).
|
|
66
|
+
|
|
67
|
+
## Platforms
|
|
68
|
+
|
|
69
|
+
macOS: all. Windows (dev builds): notifications (no in-app permission prompt), clipboard text/HTML, most of `/system` (no Dock progress or appearance preferences), processes; updates unsupported. iOS/Android/web: only the Expo-shaped subsets (clipboard, auth-session, audio adapters) apply. `/auth-session` runs on `expo-web-browser` and `expo-crypto` on iOS/Android/web (call `maybeCompleteAuthSession()` on the web redirect page). `/audio` runs on `expo-audio` on iOS/Android, where `createMediaSession` reports unavailable, and on HTML audio plus `navigator.mediaSession` on web.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Keyboard shortcuts and commands
|
|
2
|
+
|
|
3
|
+
Exports: `@legendapp/spark/shortcuts`, `/shortcuts/commands`, `/shortcuts/keyboard`, `/global-shortcuts`.
|
|
4
|
+
|
|
5
|
+
## Pick the right layer
|
|
6
|
+
|
|
7
|
+
| Need | Use |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Shortcut shown in the menu bar | A menu item `shortcut` ([menus-tray-dock.md](menus-tray-dock.md)) |
|
|
10
|
+
| Named, user-rebindable commands scoped to a window or the app | `createHotkeyRouter` / `useRoutedHotkeys` from `/shortcuts/commands` |
|
|
11
|
+
| One focused-app accelerator | `registerShortcut(accelerator, handler, { windowId? })` from `/shortcuts` |
|
|
12
|
+
| Works while another app is frontmost | `registerGlobalShortcut` from `/global-shortcuts` |
|
|
13
|
+
| Raw key events / physical key codes | `addKeyboardListener` from `/shortcuts/keyboard` |
|
|
14
|
+
|
|
15
|
+
All share one accelerator syntax: `CmdOrCtrl+S`, `Alt+Left`, `Shift+Up`, `F5`.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
18
|
+
|
|
19
|
+
- `defaultBindings` is always an array; an empty array disables the command.
|
|
20
|
+
- Window-scoped registrations (priority 100) run before app-scoped ones (0). A handler returning `false` passes to the next Spark handler, but cannot hand the key back to AppKit: native consumption is decided before JS runs.
|
|
21
|
+
- Only definitions with `repeat: true` fire on key repeat.
|
|
22
|
+
- `setEnabled`, `suspend` and `remove` resolve after native matching acknowledges; await them before assuming the key is free.
|
|
23
|
+
- Global shortcuts that conflict with another app reject `E_BUSY`. Keys resolve with the layout at registration time; re-register after a layout change if needed.
|
|
24
|
+
- Persist user bindings with the commands module's hotkey store/file helpers rather than inventing a format.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createHotkeyRouter } from '@legendapp/spark/shortcuts/commands';
|
|
28
|
+
|
|
29
|
+
declare function saveDocument(): void;
|
|
30
|
+
|
|
31
|
+
const definitions = [{ id: 'save', title: 'Save', defaultBindings: ['CmdOrCtrl+S'] }] as const;
|
|
32
|
+
const router = createHotkeyRouter();
|
|
33
|
+
const registration = await router.register({
|
|
34
|
+
definitions,
|
|
35
|
+
scope: { kind: 'window', windowId: 'editor' },
|
|
36
|
+
handlers: { save: () => { saveDocument(); } },
|
|
37
|
+
});
|
|
38
|
+
await registration.remove();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { registerGlobalShortcut } from '@legendapp/spark/global-shortcuts';
|
|
43
|
+
|
|
44
|
+
declare function togglePanel(): void;
|
|
45
|
+
|
|
46
|
+
const shortcut = await registerGlobalShortcut('Cmd+Shift+K', () => togglePanel());
|
|
47
|
+
await shortcut.remove();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If a global shortcut opens a window while another app is frontmost, show it with `activate: true` ([windows.md](windows.md)).
|
|
51
|
+
|
|
52
|
+
## Platforms
|
|
53
|
+
|
|
54
|
+
macOS: all. Windows (dev builds): `/shortcuts`, `/global-shortcuts` and `/shortcuts/commands` (bindings display `Ctrl`/`Win`); `/shortcuts/keyboard` is macOS only and reports `unsupported-platform`. The macOS-only command keys (`Home`, `End`, `PageUp`, `PageDown`, media keys, `Fn`/`CapsLock`) reject on other surfaces. Mobile/web: not covered.
|