@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.
Files changed (202) hide show
  1. package/init-template.cjs +7 -1
  2. package/package.json +11 -6
  3. package/patches/dependencies.json +4 -4
  4. package/patches/react-native-mmkv@4.3.2.patch +2 -2
  5. package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
  6. package/patches/registry.json +615 -0
  7. package/patches/workspace/expo-audio@55.0.18.patch +159 -0
  8. package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
  9. package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
  10. package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
  11. package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
  12. package/postinstall.cjs +10 -1
  13. package/skills/spark/SKILL.md +37 -4
  14. package/skills/spark/UPGRADING.md +174 -1
  15. package/skills/spark/ai-customize.md +39 -0
  16. package/skills/spark/app-and-documents.md +56 -0
  17. package/skills/spark/external-libraries.md +87 -0
  18. package/skills/spark/files.md +64 -0
  19. package/skills/spark/integrations.md +69 -0
  20. package/skills/spark/keyboard.md +54 -0
  21. package/skills/spark/library-compat.md +76 -0
  22. package/skills/spark/menus-tray-dock.md +83 -0
  23. package/skills/spark/storage-settings.md +59 -0
  24. package/skills/spark/ui.md +83 -0
  25. package/skills/spark/windows.md +91 -0
  26. package/ui-popover.ts +1 -0
  27. package/ui-progress.ts +1 -0
  28. package/ui-sheet.ts +1 -0
  29. package/ui-split-view.ts +1 -0
  30. package/ui-table.ts +1 -0
  31. package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
  32. package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
  33. package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
  34. package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
  35. package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +157 -106
  36. package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
  37. package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
  38. package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
  39. package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
  40. package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +3 -0
  41. package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
  42. package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
  43. package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
  44. package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
  45. package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
  46. package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
  47. package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
  48. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
  49. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
  50. package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
  51. package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
  52. package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -8
  53. package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
  54. package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
  55. package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +8 -1
  56. package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +32 -0
  57. package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
  58. package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +17 -17
  59. package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
  60. package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
  61. package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
  62. package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
  63. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
  64. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
  65. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
  66. package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
  67. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
  68. package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
  69. package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
  70. package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
  71. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
  72. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
  73. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
  74. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
  75. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
  76. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +2 -0
  77. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
  78. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
  79. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
  80. package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
  81. package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
  82. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +300 -71
  83. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
  84. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
  85. package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
  86. package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
  87. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.cjs +20 -0
  88. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -0
  89. package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
  90. package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
  91. package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +17 -5
  92. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
  93. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
  94. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
  95. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
  96. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
  97. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
  98. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
  99. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
  100. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
  101. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
  102. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
  103. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
  104. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
  105. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
  106. package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
  107. package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
  108. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
  109. package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
  110. package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
  111. package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
  112. package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
  113. package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
  114. package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
  115. package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
  116. package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
  117. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
  118. package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
  119. package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
  120. package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
  121. package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
  122. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
  123. package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
  124. package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
  125. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
  126. package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
  127. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
  128. package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
  129. package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
  130. package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
  131. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
  132. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
  133. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  134. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
  135. package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +122 -334
  136. package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +183 -0
  137. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
  138. package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
  139. package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
  140. package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
  141. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
  142. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
  143. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
  144. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
  145. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
  146. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
  147. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
  148. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
  149. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
  150. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +28 -13
  151. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
  152. package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
  153. package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
  154. package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
  155. package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
  156. package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
  157. package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
  158. package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
  159. package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
  160. package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
  161. package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +438 -102
  162. package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
  163. package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
  164. package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
  165. package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
  166. package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
  167. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
  168. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
  169. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
  170. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
  171. package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +6 -4
  172. package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
  173. package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
  174. package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +72 -20
  175. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +18 -12
  176. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +21 -15
  177. package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +40 -16
  178. package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
  179. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
  180. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +1 -0
  181. package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
  182. package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
  183. package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
  184. package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
  185. package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
  186. package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +4 -0
  187. package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
  188. package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
  189. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
  190. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
  191. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
  192. package/vendor/node_modules/@legendapp/spark-ui/src/switch.tsx +13 -0
  193. package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
  194. package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
  195. package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +52 -7
  196. package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
  197. package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
  198. package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
  199. package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
  200. package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
  201. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  202. /package/{settings-window.ts → ui-settings.ts} +0 -0
@@ -11,6 +11,7 @@ export interface DragDropViewProps extends ViewProps, DragOptions {
11
11
  onDragEnter?: (event: DropEvent) => void;
12
12
  onDragOver?: (event: DragOverEvent) => void;
13
13
  onDragLeave?: () => void;
14
+ onDragStart?: () => void;
14
15
  onDragEnd?: (event: DragEndEvent) => void;
15
16
  onError?: (error: SparkError) => void;
16
17
  }
@@ -19,11 +20,11 @@ export function getDragDropAvailability(): Availability {
19
20
  return UIManager.hasViewManagerConfig("DesktopDragView") ? { available: true } : { available: false, reason: "missing-module" };
20
21
  }
21
22
  type Event = NativeSyntheticEvent<{ json: string }>;
22
- export function DragDropView({ source, sourceOperations, acceptedOperations, acceptedTypes, disabled = false, onDrop, onDragEnter, onDragOver, onDragLeave, onDragEnd, onError = console.error, ...props }: DragDropViewProps) {
23
- const optionsJson = dragOptions({ sourceOperations, acceptedOperations, acceptedTypes });
23
+ export function DragDropView({ source, sourceOperations, acceptedOperations, acceptedTypes, dragPreview, disabled = false, onDrop, onDragEnter, onDragOver, onDragLeave, onDragStart, onDragEnd, onError = console.error, ...props }: DragDropViewProps) {
24
+ const optionsJson = dragOptions({ sourceOperations, acceptedOperations, acceptedTypes, dragPreview }, Platform.OS);
24
25
  const sourceJson = source === undefined ? "" : JSON.stringify(dragSource(source, Platform.OS));
25
26
  if (typeof disabled !== "boolean") throw new SparkError("E_INVALID_ARGUMENT", "Expected disabled to be a boolean");
26
- for (const handler of [onDrop, onDragEnter, onDragOver, onDragLeave, onDragEnd, onError]) if (handler !== undefined && typeof handler !== "function") throw new SparkError("E_INVALID_ARGUMENT", "Expected a drag event callback");
27
+ for (const handler of [onDrop, onDragEnter, onDragOver, onDragLeave, onDragStart, onDragEnd, onError]) if (handler !== undefined && typeof handler !== "function") throw new SparkError("E_INVALID_ARGUMENT", "Expected a drag event callback");
27
28
  const availability = getDragDropAvailability();
28
29
  const [failed, setFailed] = useState(false);
29
30
  const mounted = useRef(false), reported = useRef<string | undefined>(undefined);
@@ -56,5 +57,6 @@ export function DragDropView({ source, sourceOperations, acceptedOperations, acc
56
57
  onDragEnter={event => receive(event, json => dragDrop(json, Platform.OS), onDragEnter)}
57
58
  onDragOver={onDragOver ? event => receive(event, dragPosition, onDragOver) : undefined}
58
59
  onDragLeave={() => { if (mounted.current && !disabled && !failed) onDragLeave?.(); }}
60
+ onDragStart={onDragStart ? () => { if (mounted.current && !disabled && !failed) onDragStart(); } : undefined}
59
61
  onDragEnd={event => receive(event, dragEnd, onDragEnd)} />;
60
62
  }
@@ -106,7 +106,12 @@ struct DragView : implements<DragView, Windows::Foundation::IInspectable> {
106
106
  }
107
107
  data.SetStorageItems(items);
108
108
  }
109
- if (mounted && !disabled && root == session) resultOperation = co_await operation.StartAsync(session->manager, point);
109
+ if (mounted && !disabled && root == session) {
110
+ auto drag = operation.StartAsync(session->manager, point);
111
+ auto status = drag.Status();
112
+ if (status == Windows::Foundation::AsyncStatus::Started || status == Windows::Foundation::AsyncStatus::Completed) Emit(L"dragStart");
113
+ resultOperation = co_await drag;
114
+ }
110
115
  } catch (hresult_error const &error) { if (error.code() != E_ABORT && error.code() != HRESULT_FROM_WIN32(ERROR_CANCELLED)) Fail(error); }
111
116
  if (auto strong = view.get()) strong.ReleasePointerCapture(pointer);
112
117
  if (operation) { try { operation.Close(); } catch (...) {} operation = nullptr; }
@@ -0,0 +1,44 @@
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+
4
+ const libraries = ["clipboard", "document-picker"];
5
+
6
+ exports.withExpoCompat = config => {
7
+ const root = path.resolve(config.projectRoot || process.cwd());
8
+ const manifest = path.join(root, "package.json");
9
+ const app = fs.existsSync(manifest) ? JSON.parse(fs.readFileSync(manifest, "utf8")) : {};
10
+ const dependencies = { ...app.dependencies, ...app.devDependencies, ...app.optionalDependencies };
11
+ const redirects = new Map(libraries.filter(name => dependencies[`expo-${name}`])
12
+ .map(name => [`expo-${name}`, path.join(__dirname, "src", `${name}.ts`)]));
13
+ if (!redirects.size) return config;
14
+
15
+ const owners = new Map();
16
+ function sparkOwns(file) {
17
+ let directory = path.dirname(file);
18
+ const visited = [];
19
+ while (!owners.has(directory)) {
20
+ visited.push(directory);
21
+ const manifest = path.join(directory, "package.json");
22
+ if (fs.existsSync(manifest)) {
23
+ const { name } = JSON.parse(fs.readFileSync(manifest, "utf8"));
24
+ owners.set(directory, /^@legendapp\/spark(?:-|$)/.test(name || ""));
25
+ break;
26
+ }
27
+ const parent = path.dirname(directory);
28
+ if (parent === directory) { owners.set(directory, false); break; }
29
+ directory = parent;
30
+ }
31
+ const owned = owners.get(directory);
32
+ for (const location of visited) owners.set(location, owned);
33
+ return owned;
34
+ }
35
+ const resolve = config.resolver?.resolveRequest;
36
+ return { ...config, resolver: { ...config.resolver, resolveRequest(context, name, platform) {
37
+ // Spark's mobile adapters must keep importing the upstream implementation,
38
+ // including when Metro crawls their sources from a workspace or vendor tree.
39
+ if (platform === "macos" && redirects.has(name) && !sparkOwns(context.originModulePath)) {
40
+ return { type: "sourceFile", filePath: redirects.get(name) };
41
+ }
42
+ return resolve ? resolve(context, name, platform) : context.resolveRequest(context, name, platform);
43
+ } } };
44
+ };
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@legendapp/spark-expo-compat",
3
+ "version": "0.0.5",
4
+ "private": true,
5
+ "license": "MIT",
6
+ "files": [
7
+ "src",
8
+ "metro.cjs"
9
+ ],
10
+ "dependencies": {
11
+ "@legendapp/spark-clipboard": "0.0.5",
12
+ "base64-js": "1.5.1",
13
+ "@legendapp/spark-file-dialog": "0.0.5",
14
+ "@legendapp/spark-file-system": "0.0.5"
15
+ },
16
+ "peerDependencies": {
17
+ "react": "^19.2.0",
18
+ "react-native": "0.83.10"
19
+ }
20
+ }
@@ -0,0 +1,40 @@
1
+ import { fromByteArray, toByteArray } from "base64-js";
2
+ import { readClipboard, writeClipboard } from "@legendapp/spark-clipboard";
3
+ export { getStringAsync, setStringAsync, hasStringAsync, StringFormat } from "@legendapp/spark-clipboard";
4
+ export type { GetStringOptions, SetStringOptions } from "@legendapp/spark-clipboard";
5
+ export enum ContentType { PLAIN_TEXT = "plain-text", HTML = "html", IMAGE = "image", URL = "url" }
6
+ export interface ClipboardEvent { contentTypes: ContentType[] }
7
+ export interface Subscription { remove(): void }
8
+ export interface GetImageOptions { format: "png" | "jpeg"; jpegQuality?: number }
9
+ export interface ClipboardImage { data: string; size: { width: number; height: number } }
10
+ function unavailable(feature: string): never {
11
+ throw Object.assign(new Error(`Clipboard.${feature} is unavailable on macOS`), { code: "ERR_UNAVAILABLE" });
12
+ }
13
+ function size(bytes: Uint8Array) {
14
+ const signature = [137, 80, 78, 71, 13, 10, 26, 10];
15
+ if (bytes.length < 24 || signature.some((value, index) => bytes[index] !== value) || String.fromCharCode(...bytes.subarray(12, 16)) !== "IHDR") throw new TypeError("Clipboard expects PNG image data");
16
+ const header = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17
+ const width = header.getUint32(16), height = header.getUint32(20);
18
+ if (!width || !height) throw new TypeError("Invalid PNG dimensions");
19
+ return { width, height };
20
+ }
21
+ export async function getImageAsync(options: GetImageOptions): Promise<ClipboardImage | null> {
22
+ if (options?.format !== "png" || Object.keys(options).some(key => key !== "format")) unavailable("getImageAsync: only PNG is supported");
23
+ const image = (await readClipboard()).image;
24
+ return image ? { data: `data:image/png;base64,${fromByteArray(image.bytes)}`, size: size(image.bytes) } : null;
25
+ }
26
+ export async function setImageAsync(base64Image: string): Promise<void> {
27
+ if (typeof base64Image !== "string" || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(base64Image)) throw new TypeError("Expected base64 PNG data without a MIME prefix");
28
+ const bytes = toByteArray(base64Image);
29
+ size(bytes);
30
+ await writeClipboard({ image: { format: "png", bytes } });
31
+ }
32
+ export async function hasImageAsync(): Promise<boolean> { return !!(await readClipboard()).image; }
33
+ export function addClipboardListener(_listener: (event: ClipboardEvent) => void): never { return unavailable("addClipboardListener"); }
34
+ export function removeClipboardListener(subscription: Subscription): void { subscription.remove(); }
35
+ export function setString(_text: string): never { return unavailable("setString: use setStringAsync"); }
36
+ export async function getUrlAsync(): Promise<string | null> { return unavailable("getUrlAsync"); }
37
+ export async function setUrlAsync(_url: string): Promise<void> { return unavailable("setUrlAsync"); }
38
+ export async function hasUrlAsync(): Promise<boolean> { return unavailable("hasUrlAsync"); }
39
+ export const isPasteButtonAvailable = false;
40
+ export function ClipboardPasteButton(): never { return unavailable("ClipboardPasteButton"); }
@@ -0,0 +1,52 @@
1
+ import { openFileDialog } from "@legendapp/spark-file-dialog";
2
+ import * as files from "@legendapp/spark-file-system";
3
+ import type { DocumentPickerOptions, DocumentPickerResult } from "expo-document-picker";
4
+ export type { DocumentPickerOptions, DocumentPickerAsset, DocumentPickerResult, DocumentPickerSuccessResult, DocumentPickerCanceledResult } from "expo-document-picker";
5
+
6
+ // File-dialog filters use extensions; never silently widen an unknown MIME filter.
7
+ const mimeExtensions: Record<string, string[]> = {
8
+ "text/plain": ["txt", "text"], "text/markdown": ["md", "markdown"], "text/csv": ["csv"], "text/html": ["html", "htm"],
9
+ "application/json": ["json"], "application/pdf": ["pdf"], "application/zip": ["zip"],
10
+ "application/msword": ["doc"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"],
11
+ "image/png": ["png"], "image/jpeg": ["jpg", "jpeg"], "image/gif": ["gif"], "image/webp": ["webp"],
12
+ "image/heic": ["heic"], "image/heif": ["heif"], "image/tiff": ["tif", "tiff"], "image/bmp": ["bmp"], "image/svg+xml": ["svg"], "image/avif": ["avif"],
13
+ "audio/mpeg": ["mp3"], "audio/wav": ["wav"], "audio/mp4": ["m4a"], "audio/aac": ["aac"], "audio/flac": ["flac"],
14
+ "video/mp4": ["mp4", "m4v"], "video/quicktime": ["mov"], "video/webm": ["webm"],
15
+ };
16
+ let nextCopy = 0;
17
+ function invalid(message: string): never { throw Object.assign(new TypeError(message), { code: "ERR_INVALID_ARGUMENT" }); }
18
+ function unavailable(message: string): never { throw Object.assign(new Error(message), { code: "ERR_UNAVAILABLE" }); }
19
+ function filters(type: string | string[]) {
20
+ const types = typeof type === "string" ? [type] : type;
21
+ if (!Array.isArray(types) || !types.length || types.some(value => typeof value !== "string" || !/^[\w.+*-]+\/[\w.+*-]+$/.test(value))) invalid("Expected document MIME types");
22
+ if (types.includes("*/*")) return undefined;
23
+ const extensions = types.flatMap(mime => {
24
+ if (mimeExtensions[mime]) return mimeExtensions[mime];
25
+ if (["image/*", "audio/*", "video/*", "text/*"].includes(mime)) return Object.entries(mimeExtensions).filter(([key]) => key.startsWith(mime.slice(0, -1))).flatMap(([, values]) => values);
26
+ return unavailable(`DocumentPicker does not support MIME filter ${mime} on macOS`);
27
+ });
28
+ return [{ extensions: [...new Set(extensions)] }];
29
+ }
30
+
31
+ export async function getDocumentAsync(options: DocumentPickerOptions = {}): Promise<DocumentPickerResult> {
32
+ if (!options || typeof options !== "object" || Array.isArray(options)) invalid("Expected document picker options");
33
+ for (const key of Object.keys(options)) if (!["type", "multiple", "copyToCacheDirectory", "base64"].includes(key)) unavailable(`Unsupported DocumentPicker option: ${key}`);
34
+ for (const key of ["multiple", "copyToCacheDirectory", "base64"] as const) if (options[key] !== undefined && typeof options[key] !== "boolean") invalid(`${key} must be a boolean`);
35
+ if (options.base64 === true) unavailable("DocumentPicker base64 is available only on web");
36
+ const result = await openFileDialog({ multiple: options.multiple ?? false, filters: filters(options.type ?? "*/*") });
37
+ if (result.canceled) return { canceled: true, assets: null };
38
+ const cache = options.copyToCacheDirectory === false ? undefined : `${await files.getDirectory("cache")}/DocumentPicker`;
39
+ if (cache) await files.mkdir(cache);
40
+ const assets = [];
41
+ for (const source of result.paths) {
42
+ const name = source.slice(source.lastIndexOf("/") + 1);
43
+ const info = await files.stat(source);
44
+ if (info.type !== "file") unavailable("DocumentPicker supports regular files on macOS");
45
+ const path = cache ? `${cache}/${Date.now()}-${++nextCopy}-${name}` : source;
46
+ if (cache) await files.copy(source, path);
47
+ const extension = name.slice(name.lastIndexOf(".") + 1).toLowerCase();
48
+ const mimeType = Object.entries(mimeExtensions).find(([, extensions]) => extensions.includes(extension))?.[0];
49
+ assets.push({ name, uri: `file://${path.split("/").map(encodeURIComponent).join("/")}`, size: info.size, lastModified: info.modifiedAt, ...(mimeType && { mimeType }) });
50
+ }
51
+ return { canceled: false, assets };
52
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-file-dialog",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "main": "src/index",
5
5
  "react-native": "src/index",
6
6
  "codegenConfig": {
@@ -31,20 +31,13 @@
31
31
  ],
32
32
  "spark": {
33
33
  "sdk": true,
34
- "nativeModules": [
35
- "NativeFileDialog"
36
- ],
37
- "pod": "RNFileDialog",
38
- "platforms": [
39
- "macos",
40
- "windows"
41
- ],
34
+ "nativeModules": true,
42
35
  "requires": [
43
36
  "@legendapp/spark-desktop-app"
44
37
  ]
45
38
  },
46
39
  "private": true,
47
40
  "dependencies": {
48
- "@legendapp/spark-desktop-app": "0.0.3"
41
+ "@legendapp/spark-desktop-app": "0.0.5"
49
42
  }
50
43
  }
@@ -59,6 +59,7 @@ export function dialogOptions(options: OpenFileDialogOptions | SaveFileDialogOpt
59
59
  filters = [];
60
60
  for (const filter of options.filters) {
61
61
  if (!filter || Object.keys(filter).some(key => key !== "name" && key !== "extensions") || (filter.name !== undefined && (typeof filter.name !== "string" || !filter.name.trim() || filter.name.includes("\0"))) || !Array.isArray(filter.extensions) || !filter.extensions.length || filter.extensions.some((ext: unknown) => typeof ext !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(ext))) throw new SparkError("E_INVALID_ARGUMENT", "Filters need file extensions without dots, MIME types, or wildcards, and a name without NULs when given");
62
+ if (platform === "macos" && filter.name !== undefined) throw new SparkError("E_UNSUPPORTED_OPTION", "macOS file dialogs do not display filter names; omit filters[].name");
62
63
  filters.push({ ...(filter.name === undefined ? {} : { name: filter.name }), extensions: [...filter.extensions] });
63
64
  }
64
65
  }
@@ -68,7 +69,9 @@ export function dialogOptions(options: OpenFileDialogOptions | SaveFileDialogOpt
68
69
  const open = options as OpenFileDialogOptions;
69
70
  if (open.selection !== undefined && !["files", "directories"].includes(open.selection)) throw new SparkError("E_INVALID_ARGUMENT", "selection must be files or directories");
70
71
  if (open.multiple !== undefined && typeof open.multiple !== "boolean") throw new SparkError("E_INVALID_ARGUMENT", "multiple must be boolean");
71
- if (platform === "macos" && open.macos !== undefined && (!open.macos || typeof open.macos !== "object" || Object.keys(open.macos).some(key => key !== "mixedSelection") || (open.macos.mixedSelection !== undefined && typeof open.macos.mixedSelection !== "boolean"))) throw new SparkError("E_INVALID_ARGUMENT", "Invalid macOS dialog options");
72
- const mixed = platform === "macos" && open.macos?.mixedSelection === true;
72
+ if (open.macos !== undefined && platform !== "macos") throw new SparkError("E_UNSUPPORTED_OPTION", "macos dialog options require macOS");
73
+ if (open.macos !== undefined && (!open.macos || typeof open.macos !== "object" || Object.keys(open.macos).some(key => key !== "mixedSelection") || (open.macos.mixedSelection !== undefined && typeof open.macos.mixedSelection !== "boolean"))) throw new SparkError("E_INVALID_ARGUMENT", "Invalid macOS dialog options");
74
+ const mixed = open.macos?.mixedSelection === true;
75
+ if (open.selection === "directories" && !mixed && filters?.length) throw new SparkError("E_UNSUPPORTED_OPTION", "Directory-only dialogs cannot apply file filters; omit filters");
73
76
  return { windowId, directoryURL: directory, filters, allowedFileTypes, canChooseFiles: mixed || open.selection !== "directories", canChooseDirectories: mixed || open.selection === "directories", allowsMultipleSelection: open.multiple ?? false, title: open.title, message: open.message, prompt: open.prompt, accessory };
74
77
  }
@@ -1,6 +1,6 @@
1
1
  /** Filters accept extensions without a dot (for example "txt"). MIME types and UTIs are not supported. */
2
2
  export interface FileFilter {
3
- /** Display label for the filter group. Windows presents one labeled group per filter; macOS combines all extensions into one allowed set, so the label is ignored there. */
3
+ /** Display label for a Windows filter group. macOS rejects names; omit this field there. */
4
4
  name?: string;
5
5
  extensions: readonly string[];
6
6
  }
@@ -22,7 +22,7 @@ export interface FileDialogOptions {
22
22
  windowId?: string;
23
23
  /** Absolute starting path. A directory starts there; for save it may name a file, which also suggests `defaultName`. */
24
24
  defaultPath?: string;
25
- /** macOS combines filters into one allowed-extension set; Windows keeps each labeled group. An empty array allows all files. */
25
+ /** macOS combines filters into one allowed-extension set; Windows keeps each labeled group. An empty array allows all files. Nonempty filters reject for directory-only selection. */
26
26
  filters?: readonly FileFilter[];
27
27
  /** 1–8 controls shown below the file browser (macOS). Check `getFileDialogAvailability("accessory")`; other targets reject E_UNSUPPORTED_OPTION. */
28
28
  accessory?: readonly DialogAccessoryControl[];
@@ -33,7 +33,7 @@ export interface OpenFileDialogOptions extends FileDialogOptions {
33
33
  title?: string;
34
34
  message?: string;
35
35
  prompt?: string;
36
- /** macOS can select files and directories in the same panel. Ignored on other targets. */
36
+ /** macOS can select files and directories in the same panel. Other targets reject E_UNSUPPORTED_OPTION. */
37
37
  macos?: { mixedSelection?: boolean };
38
38
  }
39
39
  export interface SaveFileDialogOptions extends FileDialogOptions { defaultName?: string }
@@ -95,7 +95,7 @@ RCT_EXPORT_MODULE(NativeDesktopFileSystem)
95
95
  else if ([kind isEqual:@"cache"]) base = [fm URLForDirectory:NSCachesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&error];
96
96
  else if ([kind isEqual:@"temp"]) base = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES];
97
97
  else { SparkInvalid(reject, @"Unknown directory kind"); return; }
98
- NSURL *url = [base URLByAppendingPathComponent:SparkNamespace() isDirectory:YES];
98
+ NSURL *url = [base URLByAppendingPathComponent:SparkStorageNamespace() isDirectory:YES];
99
99
  if (!error) [fm createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:&error];
100
100
  result = url.path;
101
101
  } else if ([method isEqual:@"unwatch"]) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-file-system",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -29,21 +29,13 @@
29
29
  },
30
30
  "spark": {
31
31
  "sdk": true,
32
- "nativeModules": [
33
- "NativeDesktopFileSystem",
34
- "NativeFileScanner"
35
- ],
36
- "pod": "RNDesktopFileSystem",
37
- "platforms": [
38
- "macos",
39
- "windows"
40
- ],
32
+ "nativeModules": true,
41
33
  "requires": [
42
34
  "@legendapp/spark-desktop-app"
43
35
  ]
44
36
  },
45
37
  "dependencies": {
46
- "@legendapp/spark-desktop-app": "0.0.3"
38
+ "@legendapp/spark-desktop-app": "0.0.5"
47
39
  },
48
40
  "private": true
49
41
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-global-shortcuts",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -28,20 +28,13 @@
28
28
  },
29
29
  "spark": {
30
30
  "sdk": true,
31
- "nativeModules": [
32
- "NativeDesktopGlobalShortcuts"
33
- ],
34
- "pod": "RNDesktopGlobalShortcuts",
35
- "platforms": [
36
- "macos",
37
- "windows"
38
- ],
31
+ "nativeModules": true,
39
32
  "requires": [
40
33
  "@legendapp/spark-desktop-app"
41
34
  ]
42
35
  },
43
36
  "dependencies": {
44
- "@legendapp/spark-desktop-app": "0.0.3"
37
+ "@legendapp/spark-desktop-app": "0.0.5"
45
38
  },
46
39
  "private": true
47
40
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-html",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "main": "src/index.ts",
@@ -14,7 +14,7 @@
14
14
  "react-native-enriched-html": "1.1.1"
15
15
  },
16
16
  "dependencies": {
17
- "@legendapp/spark-rich-text": "0.0.3"
17
+ "@legendapp/spark-rich-text": "0.0.5"
18
18
  },
19
19
  "peerDependenciesMeta": {
20
20
  "react-native-enriched-html": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-markdown",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "main": "src/index.ts",
@@ -14,7 +14,7 @@
14
14
  "react-native-enriched-markdown": "1.1.1"
15
15
  },
16
16
  "dependencies": {
17
- "@legendapp/spark-rich-text": "0.0.3"
17
+ "@legendapp/spark-rich-text": "0.0.5"
18
18
  },
19
19
  "peerDependenciesMeta": {
20
20
  "react-native-enriched-markdown": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-message-dialog",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -27,20 +27,13 @@
27
27
  },
28
28
  "spark": {
29
29
  "sdk": true,
30
- "nativeModules": [
31
- "NativeDesktopMessageDialog"
32
- ],
33
- "pod": "RNDesktopMessageDialog",
34
- "platforms": [
35
- "macos",
36
- "windows"
37
- ],
30
+ "nativeModules": true,
38
31
  "requires": [
39
32
  "@legendapp/spark-desktop-app"
40
33
  ]
41
34
  },
42
35
  "dependencies": {
43
- "@legendapp/spark-desktop-app": "0.0.3"
36
+ "@legendapp/spark-desktop-app": "0.0.5"
44
37
  },
45
38
  "private": true
46
39
  }
@@ -100,6 +100,7 @@ export async function showMessage(options: MessageDialogOptions): Promise<Messag
100
100
  knownKeys(options, ["title", "message", "kind", "buttons", "defaultButtonId", "cancelButtonId", "windowId", "checkbox"], "dialog");
101
101
  const buttons = options.buttons ?? [{ id: "ok", label: "OK" }];
102
102
  if (!validString(options.title) || !Array.isArray(buttons) || !buttons.length || buttons.length > 4 || buttons.some(value => !value || !validString(value.id) || !validString(value.label))) throw new SparkError("E_INVALID_ARGUMENT", "Dialog needs a title and 1–4 buttons with IDs and labels");
103
+ for (const button of buttons) knownKeys(button, ["id", "label"], "dialog button");
103
104
  const ids = buttons.map(button => button.id);
104
105
  if (new Set(ids).size !== ids.length) throw new SparkError("E_INVALID_ARGUMENT", "Dialog button IDs must be unique");
105
106
  for (const id of [options.defaultButtonId, options.cancelButtonId]) if (id !== undefined && !ids.includes(id)) throw new SparkError("E_INVALID_ARGUMENT", "Dialog button ID must identify a button");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-native-menu",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "main": "src/index",
5
5
  "react-native": "src/index",
6
6
  "codegenConfig": {
@@ -30,17 +30,11 @@
30
30
  ],
31
31
  "spark": {
32
32
  "sdk": true,
33
- "nativeModules": [
34
- "NativeMenu"
35
- ],
36
- "pod": "RNNativeMenu",
37
- "platforms": [
38
- "macos"
39
- ],
33
+ "nativeModules": true,
40
34
  "requires": []
41
35
  },
42
36
  "private": true,
43
37
  "dependencies": {
44
- "@legendapp/spark-desktop-app": "0.0.3"
38
+ "@legendapp/spark-desktop-app": "0.0.5"
45
39
  }
46
40
  }
@@ -1,3 +1,4 @@
1
+ import { SparkError } from "@legendapp/spark-desktop-app/src/contracts";
1
2
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
2
3
  import { createMenu, type Menu, type MenuOptions, type MenuAction, type MenuLifecycleEvent } from "./api";
3
4
  export interface UseMenuOptions extends MenuOptions { onError?: (error: unknown) => void; onCleanupError?: (error: unknown, menu: Menu) => void }
@@ -6,6 +7,9 @@ interface Lifetime { menu?: Menu; removing?: Promise<void>; blocker?: Lifetime;
6
7
  const lifetimes = new Map<string, Lifetime>();
7
8
  /** Callback changes do not recreate native menus. Structural updates use the same handle. */
8
9
  export function useMenu(options: UseMenuOptions): MenuState {
10
+ if (!options || typeof options !== "object" || Array.isArray(options)) throw new SparkError("E_INVALID_ARGUMENT", "Expected menu options");
11
+ for (const key of Object.keys(options)) if (!["id", "items", "onAction", "onOpen", "onClose", "onError", "onCleanupError"].includes(key)) throw new SparkError("E_UNSUPPORTED_OPTION", `Unsupported menu option: ${key}`);
12
+ for (const key of ["onAction", "onOpen", "onClose", "onError", "onCleanupError"] as const) if (options[key] !== undefined && typeof options[key] !== "function") throw new SparkError("E_INVALID_ARGUMENT", `Expected ${key} callback`);
9
13
  const [state, setState] = useState<MenuState>({ status: "loading" });
10
14
  const callbacks = useRef(options);
11
15
  useLayoutEffect(() => { callbacks.current = options; });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-notifications",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -27,20 +27,13 @@
27
27
  },
28
28
  "spark": {
29
29
  "sdk": true,
30
- "nativeModules": [
31
- "NativeDesktopNotifications"
32
- ],
33
- "pod": "RNDesktopNotifications",
34
- "platforms": [
35
- "macos",
36
- "windows"
37
- ],
30
+ "nativeModules": true,
38
31
  "requires": [
39
32
  "@legendapp/spark-desktop-app"
40
33
  ]
41
34
  },
42
35
  "dependencies": {
43
- "@legendapp/spark-desktop-app": "0.0.3"
36
+ "@legendapp/spark-desktop-app": "0.0.5"
44
37
  },
45
38
  "private": true
46
39
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-processes",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -28,20 +28,13 @@
28
28
  },
29
29
  "spark": {
30
30
  "sdk": true,
31
- "nativeModules": [
32
- "NativeDesktopProcesses"
33
- ],
34
- "pod": "RNDesktopProcesses",
35
- "platforms": [
36
- "macos",
37
- "windows"
38
- ],
31
+ "nativeModules": true,
39
32
  "requires": [
40
33
  "@legendapp/spark-desktop-app"
41
34
  ]
42
35
  },
43
36
  "dependencies": {
44
- "@legendapp/spark-desktop-app": "0.0.3"
37
+ "@legendapp/spark-desktop-app": "0.0.5"
45
38
  },
46
39
  "private": true
47
40
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-rich-text",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "main": "src/index.ts",
@@ -13,6 +13,6 @@
13
13
  "react-native": "0.83.10"
14
14
  },
15
15
  "dependencies": {
16
- "@legendapp/spark-desktop-shortcuts": "0.0.3"
16
+ "@legendapp/spark-desktop-shortcuts": "0.0.5"
17
17
  }
18
18
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-secure-storage",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index",
6
6
  "react-native": "src/index",
@@ -28,20 +28,13 @@
28
28
  },
29
29
  "spark": {
30
30
  "sdk": true,
31
- "nativeModules": [
32
- "NativeDesktopSecureStorage"
33
- ],
34
- "pod": "RNDesktopSecureStorage",
35
- "platforms": [
36
- "macos",
37
- "windows"
38
- ],
31
+ "nativeModules": true,
39
32
  "requires": [
40
33
  "@legendapp/spark-desktop-app"
41
34
  ]
42
35
  },
43
36
  "dependencies": {
44
- "@legendapp/spark-desktop-app": "0.0.3"
37
+ "@legendapp/spark-desktop-app": "0.0.5"
45
38
  },
46
39
  "peerDependenciesMeta": {
47
40
  "expo-secure-store": {
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@legendapp/spark-settings",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "files": [
7
7
  "src"
8
8
  ],
9
9
  "dependencies": {
10
- "@legendapp/spark-file-system": "0.0.3",
10
+ "@legendapp/spark-file-system": "0.0.5",
11
11
  "@legendapp/state": "^3.0.0-beta.42",
12
- "@legendapp/spark-desktop-app": "0.0.3"
12
+ "@legendapp/spark-desktop-app": "0.0.5"
13
13
  },
14
14
  "private": true,
15
15
  "spark": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-settings-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "main": "src/index.tsx",
@@ -8,9 +8,9 @@
8
8
  "src"
9
9
  ],
10
10
  "dependencies": {
11
- "@legendapp/spark-ui": "0.0.3",
12
- "@legendapp/spark-desktop-windows": "0.0.3",
13
- "@legendapp/spark-desktop-app": "0.0.3"
11
+ "@legendapp/spark-ui": "0.0.5",
12
+ "@legendapp/spark-desktop-windows": "0.0.5",
13
+ "@legendapp/spark-desktop-app": "0.0.5"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "react": "^19.2.0",