@legendapp/spark 0.0.1-next.2 → 0.0.1-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -4
- package/ai-codex.ts +1 -0
- package/ai.ts +1 -0
- package/app-documents.ts +1 -0
- package/config-plugin.d.cts +2 -0
- package/contracts.ts +2 -0
- package/diagnostics.ts +1 -0
- package/expo-config.d.cts +1 -0
- package/metro.cjs +4 -1
- package/metro.d.cts +12 -0
- package/native.cjs +3 -1
- package/native.d.cts +6 -0
- package/package.json +82 -14
- package/schema.json +276 -58
- package/settings-observable.ts +1 -0
- package/settings-window.ts +1 -0
- package/shortcuts-commands.ts +1 -0
- package/shortcuts-keyboard.ts +3 -0
- package/ui-classnames.ts +1 -0
- package/ui-glass.ts +1 -0
- package/ui-search.ts +1 -0
- package/ui-sidebar.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-symbol.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +19 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/availability.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/index.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/invocations.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/output.ts +62 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/run.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-ai/src/types.ts +16 -0
- package/vendor/node_modules/@legendapp/spark-audio/macos/RNSparkAudio.h +2 -1
- package/vendor/node_modules/@legendapp/spark-audio/macos/RNSparkAudio.mm +126 -24
- package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -2
- package/vendor/node_modules/@legendapp/spark-audio/src/NativeSparkAudio.ts +5 -1
- package/vendor/node_modules/@legendapp/spark-audio/src/desktop.ts +36 -32
- package/vendor/node_modules/@legendapp/spark-audio/src/events.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/hooks.ts +65 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/index.web.ts +92 -33
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session-unavailable.ts +6 -4
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session.ts +52 -19
- package/vendor/node_modules/@legendapp/spark-audio/src/media-session.web.ts +18 -10
- package/vendor/node_modules/@legendapp/spark-audio/src/media-types.ts +40 -13
- package/vendor/node_modules/@legendapp/spark-audio/src/mobile.ts +40 -32
- package/vendor/node_modules/@legendapp/spark-audio/src/player.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-audio/src/status-listeners.ts +21 -15
- package/vendor/node_modules/@legendapp/spark-audio/src/types.ts +9 -4
- package/vendor/node_modules/@legendapp/spark-audio/windows/SparkAudio/SparkAudio.h +67 -20
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-auth-session/src/core.ts +60 -42
- package/vendor/node_modules/@legendapp/spark-auth-session/src/index.ts +28 -12
- package/vendor/node_modules/@legendapp/spark-auth-session/src/mobile.ts +97 -41
- package/vendor/node_modules/@legendapp/spark-auth-session/src/types.ts +20 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +50 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/build-mode.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +83 -48
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +60 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +7 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +31 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/credentials.js +69 -23
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +12 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +12 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-metro.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-node.js +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +10 -38
- package/vendor/node_modules/@legendapp/spark-cli/dist/local.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +26 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-metadata.js +26 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +84 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-preparation.js +88 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/notary-profiles.js +75 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/platform.js +16 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +66 -13
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.js +84 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +23 -18
- package/vendor/node_modules/@legendapp/spark-cli/dist/runner-install.js +145 -31
- package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +4 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/updates.js +41 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/package.json +7 -6
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/App.tsx +6 -12
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +5 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +11 -9
- package/vendor/node_modules/@legendapp/spark-cli/templates/diff-lite/Git.macos.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/Integration.macos.tsx +23 -21
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/Integration.windows.tsx +23 -21
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/io.desktop.ts +11 -8
- package/vendor/node_modules/@legendapp/spark-cli/templates/document-editor/io.macos.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/Lifecycle.desktop.tsx +8 -14
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/OpenFiles.desktop.tsx +5 -10
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/io.desktop.ts +11 -8
- package/vendor/node_modules/@legendapp/spark-cli/templates/example-shared/io.macos.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/music-lite/assets.desktop.ts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/Activation.desktop.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/Desktop.desktop.ts +37 -15
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/session.ts +5 -6
- package/vendor/node_modules/@legendapp/spark-cli/templates/notes-lite/window-session.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +5 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/metro.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +13 -11
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/react-native.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +13 -11
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/react-native.config.js +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +10 -16
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/src/NativeDesktopClipboard.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +55 -31
- package/vendor/node_modules/@legendapp/spark-clipboard/src/expo.ts +21 -11
- package/vendor/node_modules/@legendapp/spark-clipboard/src/options.ts +8 -0
- package/vendor/node_modules/@legendapp/spark-clipboard/src/types.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.h +38 -15
- package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-codex/RNCodex.podspec +22 -0
- package/vendor/node_modules/@legendapp/spark-codex/cpp/HybridCodexAppServer.hpp +23 -0
- package/vendor/node_modules/@legendapp/spark-codex/cpp/HybridCodexAppServer.mm +1529 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitro.json +21 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/.gitattributes +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex+autolinking.rb +62 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Bridge.cpp +17 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Bridge.hpp +27 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodex-Swift-Cxx-Umbrella.hpp +38 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodexAutolinking.mm +35 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/ios/RNCodexAutolinking.swift +16 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/CodexAvailability.hpp +95 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/CodexRunResult.hpp +99 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/HybridCodexAppServerSpec.cpp +24 -0
- package/vendor/node_modules/@legendapp/spark-codex/nitrogen/generated/shared/c++/HybridCodexAppServerSpec.hpp +71 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +35 -0
- package/vendor/node_modules/@legendapp/spark-codex/react-native.config.js +11 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/Codex.nitro.ts +30 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/index.ts +65 -0
- package/vendor/node_modules/@legendapp/spark-codex/src/native.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-commands/package.json +21 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/bindings.ts +90 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/index.tsx +400 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/router.ts +138 -0
- package/vendor/node_modules/@legendapp/spark-commands/src/storage.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-context-menu/macos/RNContextMenu.mm +7 -8
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-context-menu/src/NativeContextMenu.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-context-menu/src/index.ts +26 -26
- package/vendor/node_modules/@legendapp/spark-context-menu/windows/SparkContextMenu/SparkContextMenu.h +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/RNDesktopApp.podspec +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/cpp/SparkBinaryJSI.hpp +89 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/cpp/SparkBinaryWindows.hpp +22 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/RNDesktopApp.mm +13 -7
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkBinaryJSI.h +48 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +33 -33
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktopError.h +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkLifecycle.h +26 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkLifecycle.mm +49 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkQuitCoordinator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkQuitCoordinator.mm +70 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkWindow.mm +9 -6
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/recent-documents/RNRecentDocumentController.mm +55 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +5 -3
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/NativeDesktopApp.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/api.ts +86 -40
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/accelerator.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/index.ts +56 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/menu.ts +114 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/native-buffer.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/contracts/path.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/events.ts +75 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/index.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/index.windows.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/open-requests.ts +43 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/restoration.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/src/transport.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +10 -5
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.d.cts +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +35 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +16 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +89 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/expo.d.cts +3 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/lifecycle.cjs +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +6 -5
- package/vendor/node_modules/@legendapp/spark-desktop-config/schema.json +276 -58
- package/vendor/node_modules/@legendapp/spark-desktop-config/updates.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +35 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +129 -11
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-host/windows/application.inc +277 -121
- package/vendor/node_modules/@legendapp/spark-desktop-links/common/AuthLoopback.h +5 -7
- package/vendor/node_modules/@legendapp/spark-desktop-links/macos/RNDesktopLinks.mm +10 -9
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/NativeDesktopLinks.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/api.ts +27 -33
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/expo.ts +3 -4
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/native.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-links/windows/SparkLinks/SparkLinks.h +22 -22
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/RNDesktopShortcuts.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/RNDesktopShortcuts.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.h +9 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/macos/keyboard-manager/RNKeyboardManager.mm +307 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +8 -5
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/NativeDesktopShortcuts.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/api.ts +39 -14
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/NativeKeyboardManager.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/codes.ts +108 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/keyboard-manager/index.ts +99 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/RNDesktopWindows.podspec +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +229 -103
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/SparkWindowGeometry.h +63 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/LegendWindowRegistry.h +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/LegendWindowRegistry.mm +27 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.h +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +3130 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManagerStartup.mm +31 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/SidebarStartupFallbacks.mm +14 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +10 -6
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/NativeDesktopWindowManager.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +144 -70
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/diagnostics.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/index.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/index.windows.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +53 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos.ts +51 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/transport.ts +41 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +140 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +162 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/window-manager/NativeWindowManager.ts +28 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/WindowProvider.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +78 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/index.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/types.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +18 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-documents/package.json +22 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/controller.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/documentTransition.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/hooks.ts +139 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/index.tsx +50 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/reload.ts +39 -0
- package/vendor/node_modules/@legendapp/spark-documents/src/requests.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +73 -18
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +58 -15
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +14 -8
- package/vendor/node_modules/@legendapp/spark-file-dialog/ios/RNFileDialog.mm +34 -121
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +12 -5
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/NativeFileDialog.ts +1 -5
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/index.ts +19 -84
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/native.ts +12 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +34 -14
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +26 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/windows/SparkFileDialog/SparkFileDialog.h +42 -58
- package/vendor/node_modules/@legendapp/spark-file-system/RNDesktopFileSystem.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +32 -21
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.h +24 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/SparkFileMutations.mm +215 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScanner.h +9 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScanner.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScannerCore.h +47 -0
- package/vendor/node_modules/@legendapp/spark-file-system/macos/file-scanner/RNFileScannerCore.mm +306 -0
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +8 -6
- package/vendor/node_modules/@legendapp/spark-file-system/src/NativeDesktopFileSystem.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/src/file-scanner/NativeFileScanner.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-file-system/src/file-scanner/index.ts +93 -0
- package/vendor/node_modules/@legendapp/spark-file-system/src/handles.ts +48 -14
- package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +134 -45
- package/vendor/node_modules/@legendapp/spark-file-system/src/path.ts +1 -9
- package/vendor/node_modules/@legendapp/spark-file-system/windows/SparkFileSystem/SparkFileSystem.h +102 -26
- package/vendor/node_modules/@legendapp/spark-file-system/windows/SparkFileSystem/SparkFileSystem.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/RNDesktopGlobalShortcuts.podspec +1 -0
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/macos/RNDesktopGlobalShortcuts.mm +7 -4
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/NativeDesktopGlobalShortcuts.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/index.ts +39 -10
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/windows/SparkGlobalShortcuts/SparkGlobalShortcuts.h +5 -4
- package/vendor/node_modules/@legendapp/spark-message-dialog/macos/RNDesktopMessageDialog.mm +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/NativeDesktopMessageDialog.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +48 -11
- package/vendor/node_modules/@legendapp/spark-native-menu/ios/RNNativeMenu.mm +141 -609
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +9 -4
- package/vendor/node_modules/@legendapp/spark-native-menu/src/NativeMenu.ts +2 -7
- package/vendor/node_modules/@legendapp/spark-native-menu/src/api.ts +76 -121
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +97 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/src/windows-menus.ts +43 -37
- package/vendor/node_modules/@legendapp/spark-notifications/macos/RNDesktopNotifications.mm +75 -30
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-notifications/src/NativeDesktopNotifications.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-notifications/src/index.ts +130 -42
- package/vendor/node_modules/@legendapp/spark-notifications/windows/SparkNotifications/SparkNotifications.h +46 -8
- package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +94 -21
- package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -3
- package/vendor/node_modules/@legendapp/spark-processes/src/NativeDesktopProcesses.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +124 -28
- package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +34 -0
- package/vendor/node_modules/@legendapp/spark-processes/windows/SparkProcesses/SparkProcesses.h +83 -34
- package/vendor/node_modules/@legendapp/spark-processes/windows/SparkProcesses/SparkProcesses.vcxproj +2 -0
- package/vendor/node_modules/@legendapp/spark-secure-storage/macos/RNDesktopSecureStorage.mm +49 -40
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/NativeDesktopSecureStorage.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/desktop.ts +16 -14
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/expo.ts +0 -1
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/options.ts +3 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/unavailable.ts +6 -3
- package/vendor/node_modules/@legendapp/spark-settings/package.json +10 -3
- package/vendor/node_modules/@legendapp/spark-settings/src/fileStorage.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-settings/src/index.ts +7 -9
- package/vendor/node_modules/@legendapp/spark-settings/src/storage/index.ts +142 -0
- package/vendor/node_modules/@legendapp/spark-settings/src/store.ts +63 -21
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +436 -0
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/options.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-sqlite/src/database.ts +182 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/src/index.ts +19 -6
- package/vendor/node_modules/@legendapp/spark-sqlite/src/types.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-system/macos/RNDesktopSystem.mm +36 -11
- package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-system/src/NativeDesktopSystem.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-system/src/index.ts +89 -32
- package/vendor/node_modules/@legendapp/spark-system/windows/SparkSystem/SparkSystem.h +8 -4
- package/vendor/node_modules/@legendapp/spark-tray/macos/RNDesktopTray.mm +20 -8
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-tray/src/NativeDesktopTray.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +91 -34
- package/vendor/node_modules/@legendapp/spark-tray/windows/SparkTray/SparkTray.h +45 -15
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +1182 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/glass-effect-view/RNGlassEffectView.mm +72 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +194 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +180 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +155 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.h +18 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +645 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/text-input-search/RNTextInputSearch.h +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/text-input-search/RNTextInputSearch.mm +164 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +16 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkSelectNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +6 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +31 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +77 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +10 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/classnames/index.ts +8 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +42 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +56 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/glass-effect-view/index.tsx +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +35 -21
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +55 -26
- package/vendor/node_modules/@legendapp/spark-ui/src/index.tsx +1 -27
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +45 -14
- package/vendor/node_modules/@legendapp/spark-ui/src/index.windows.tsx +1 -42
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +5 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/sf-symbol/SFSymbolNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sf-symbol/index.tsx +27 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +25 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +24 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +104 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/specialized.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/text-input-search/TextInputSearchNativeComponent.ts +33 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/text-input-search/index.tsx +34 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +30 -19
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +16 -11
- package/vendor/node_modules/@legendapp/spark-updates/macos/RNDesktopUpdates.mm +21 -8
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-updates/src/NativeDesktopUpdates.ts +3 -2
- package/vendor/node_modules/@legendapp/spark-updates/src/index.ts +71 -15
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/src/WebView.tsx +11 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/adapter.ts +55 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/index.ts +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/src/types.ts +32 -0
- package/vendor/node_modules/@legendapp/spark-webview/src/view-props.ts +28 -0
- package/vendor/node_modules/@legendapp/spark-window-options/index.cjs +51 -14
- package/vendor/node_modules/@legendapp/spark-window-options/index.d.ts +21 -8
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- package/windows-macos.ts +1 -0
- package/expo-metro.cjs +0 -1
- package/message-dialog.ts +0 -1
- package/universal.cjs +0 -1
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/src/accelerator.ts +0 -22
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows-options.ts +0 -11
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/index.windows.ts +0 -15
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/src/accelerator.ts +0 -22
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkSelect.h +0 -4
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkSelect.mm +0 -53
|
@@ -1,39 +1,63 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
+
import { callBinary, nativeBytes } from "@legendapp/spark-desktop-app/src/contracts/native-buffer";
|
|
3
|
+
import { SparkError, parseNativeResult, invokeNative, type Availability } from "@legendapp/spark-desktop-app/src/contracts";
|
|
4
|
+
import { nativePath } from "@legendapp/spark-desktop-app/src/contracts/path";
|
|
2
5
|
import Native from "./NativeDesktopClipboard";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const writeClipboardText = (text: string) => call("writeText", { text });
|
|
6
|
-
export const hasClipboardText = () => call<boolean>("hasText");
|
|
7
|
-
|
|
8
|
-
export type ClipboardContent = { text?: string; html?: string; rtf?: string; imagePNG?: string; files?: string[] };
|
|
9
|
-
/** imagePNG contains base64-encoded PNG bytes. */
|
|
10
|
-
export async function readClipboard(): Promise<ClipboardContent> { return JSON.parse(await Native.call("read", "{}")); }
|
|
11
|
-
export async function getClipboardFormats(): Promise<string[]> { return JSON.parse(await Native.call("formats", "{}")); }
|
|
12
|
-
export async function clearClipboard() { await Native.call("clear", "{}"); }
|
|
13
|
-
export async function writeClipboard(content: ClipboardContent) {
|
|
14
|
-
for (const key of Object.keys(content)) if (!["text", "html", "rtf", "imagePNG", "files"].includes(key)) throw new Error(`Unknown clipboard format: ${key}`);
|
|
15
|
-
if (content.files && (Object.keys(content).length !== 1 || content.files.some(file => Platform.OS === "windows" ? !/^(?:[a-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+)/i.test(file) : !file.startsWith("/")))) throw new Error("Files must be absolute paths and written separately from other formats");
|
|
16
|
-
for (const key of ["text", "html", "rtf", "imagePNG"] as const) if (content[key] !== undefined && typeof content[key] !== "string") throw new Error(`Invalid clipboard ${key}`);
|
|
17
|
-
await Native.call("write", JSON.stringify(content));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
import { StringFormat } from "./formats";
|
|
6
|
+
import { stringOptions } from "./options";
|
|
7
|
+
import type { ClipboardContent, ClipboardWriteContent, GetStringOptions, SetStringOptions } from "./types";
|
|
21
8
|
export { StringFormat } from "./formats";
|
|
22
|
-
export type
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
export type { ClipboardContent, ClipboardWriteContent, ClipboardImage, GetStringOptions, SetStringOptions } from "./types";
|
|
10
|
+
export function getRichClipboardAvailability(): Availability {
|
|
11
|
+
if (Platform.OS !== "macos" && Platform.OS !== "windows") return { available: false, reason: "unsupported-platform" };
|
|
12
|
+
return Native ? { available: true } : { available: false, reason: "missing-module" };
|
|
13
|
+
}
|
|
14
|
+
function native() {
|
|
15
|
+
const availability = getRichClipboardAvailability();
|
|
16
|
+
if (!availability.available) throw new SparkError(availability.reason === "unsupported-platform" ? "E_UNSUPPORTED_PLATFORM" : "E_MODULE_UNAVAILABLE", "Desktop clipboard module is unavailable");
|
|
17
|
+
return Native!;
|
|
18
|
+
}
|
|
19
|
+
async function call<T>(method: string, args: object, validate: (value: unknown) => value is T): Promise<T> {
|
|
20
|
+
return parseNativeResult(await invokeNative(() => native().call(method, JSON.stringify(args))), validate);
|
|
29
21
|
}
|
|
30
|
-
|
|
22
|
+
const isVoid = (value: unknown): value is null => value === null;
|
|
23
|
+
const isBoolean = (value: unknown): value is boolean => typeof value === "boolean";
|
|
24
|
+
/** Expo-compatible text/HTML subset. */
|
|
31
25
|
export async function getStringAsync(options: GetStringOptions = {}): Promise<string> {
|
|
32
|
-
return call("getString", { format: stringOptions(options, "preferredFormat") });
|
|
26
|
+
return call("getString", { format: stringOptions(options, "preferredFormat") }, (value): value is string => typeof value === "string");
|
|
33
27
|
}
|
|
34
28
|
export async function setStringAsync(text: string, options: SetStringOptions = {}): Promise<boolean> {
|
|
35
|
-
if (typeof text !== "string") throw new
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
if (typeof text !== "string") throw new SparkError("E_INVALID_ARGUMENT", "Clipboard text must be a string");
|
|
30
|
+
return call("setString", { text, format: stringOptions(options, "inputFormat") }, isBoolean);
|
|
31
|
+
}
|
|
32
|
+
export async function hasStringAsync(): Promise<boolean> { return call("hasString", {}, (value): value is boolean => typeof value === "boolean"); }
|
|
33
|
+
export async function readClipboard(): Promise<ClipboardContent> {
|
|
34
|
+
const raw = await invokeNative(() => callBinary(native(), "__sparkClipboardBinary", "read", {})) as Record<string, unknown>;
|
|
35
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new SparkError("E_INVALID_DATA", "Invalid clipboard content");
|
|
36
|
+
const result: ClipboardContent = {};
|
|
37
|
+
for (const key of ["text", "html", "rtf"] as const) {
|
|
38
|
+
if (raw[key] !== undefined && typeof raw[key] !== "string") throw new SparkError("E_INVALID_DATA", `Invalid clipboard ${key}`);
|
|
39
|
+
if (typeof raw[key] === "string") result[key] = raw[key];
|
|
40
|
+
}
|
|
41
|
+
if (raw.files !== undefined) {
|
|
42
|
+
if (!Array.isArray(raw.files) || raw.files.some(value => typeof value !== "string")) throw new SparkError("E_INVALID_DATA", "Invalid clipboard files");
|
|
43
|
+
try { result.files = raw.files.map(value => nativePath(value, Platform.OS)); }
|
|
44
|
+
catch (cause) { throw new SparkError("E_INVALID_DATA", "Invalid clipboard file paths", { cause }); }
|
|
45
|
+
}
|
|
46
|
+
if (raw.imagePNG !== undefined) {
|
|
47
|
+
result.image = { format: "png", bytes: nativeBytes(raw.imagePNG) };
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
export async function getClipboardFormats(): Promise<string[]> { return call("formats", {}, (value): value is string[] => Array.isArray(value) && value.every(format => typeof format === "string")); }
|
|
52
|
+
export async function clearClipboard(): Promise<void> { await call("clear", {}, isVoid); }
|
|
53
|
+
export async function writeClipboard(content: ClipboardWriteContent): Promise<void> {
|
|
54
|
+
if (!content || typeof content !== "object" || Array.isArray(content)) throw new SparkError("E_INVALID_ARGUMENT", "Expected clipboard content");
|
|
55
|
+
for (const key of Object.keys(content)) if (!["text", "html", "rtf", "image", "files"].includes(key)) throw new SparkError("E_UNSUPPORTED_OPTION", `Unknown clipboard format: ${key}`);
|
|
56
|
+
for (const key of ["text", "html", "rtf"] as const) if (content[key] !== undefined && typeof content[key] !== "string") throw new SparkError("E_INVALID_ARGUMENT", `Invalid clipboard ${key}`);
|
|
57
|
+
if (content.files !== undefined && (!Array.isArray(content.files) || Object.entries(content).some(([key, value]) => key !== "files" && value !== undefined))) throw new SparkError("E_INVALID_ARGUMENT", "Files must be written separately from other formats");
|
|
58
|
+
const files = content.files?.map(path => nativePath(path, Platform.OS));
|
|
59
|
+
const { image, ...rest } = content;
|
|
60
|
+
if (image !== undefined && (!image || image.format !== "png" || !(image.bytes instanceof Uint8Array))) throw new SparkError("E_INVALID_ARGUMENT", "Expected PNG image bytes");
|
|
61
|
+
const response = await invokeNative(() => callBinary(native(), "__sparkClipboardBinary", "write", { ...rest, files }, image?.bytes));
|
|
62
|
+
if (response !== null) throw new SparkError("E_INVALID_DATA", "Invalid native clipboard response");
|
|
38
63
|
}
|
|
39
|
-
export const hasStringAsync = (): Promise<boolean> => call("hasString");
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import * as Clipboard from "expo-clipboard";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
2
|
+
import { SparkError, type Availability } from "@legendapp/spark-desktop-app/src/contracts";
|
|
3
|
+
import { StringFormat } from "./formats";
|
|
4
|
+
import { stringOptions } from "./options";
|
|
5
|
+
import type { ClipboardContent, ClipboardWriteContent, GetStringOptions, SetStringOptions } from "./types";
|
|
6
|
+
export { StringFormat } from "./formats";
|
|
7
|
+
export type { ClipboardContent, ClipboardWriteContent, ClipboardImage, GetStringOptions, SetStringOptions } from "./types";
|
|
8
|
+
export async function getStringAsync(options: GetStringOptions = {}): Promise<string> {
|
|
9
|
+
const format = stringOptions(options, "preferredFormat");
|
|
10
|
+
return Clipboard.getStringAsync({ preferredFormat: format === StringFormat.HTML ? Clipboard.StringFormat.HTML : Clipboard.StringFormat.PLAIN_TEXT });
|
|
11
|
+
}
|
|
12
|
+
export async function setStringAsync(text: string, options: SetStringOptions = {}): Promise<boolean> {
|
|
13
|
+
const format = stringOptions(options, "inputFormat");
|
|
14
|
+
return Clipboard.setStringAsync(text, { inputFormat: format === StringFormat.HTML ? Clipboard.StringFormat.HTML : Clipboard.StringFormat.PLAIN_TEXT });
|
|
15
|
+
}
|
|
16
|
+
export const hasStringAsync = Clipboard.hasStringAsync;
|
|
17
|
+
export function getRichClipboardAvailability(): Availability { return { available: false, reason: "unsupported-platform" }; }
|
|
18
|
+
function unavailable(): never { throw new SparkError("E_UNSUPPORTED_PLATFORM", "Rich clipboard operations require a desktop host"); }
|
|
19
|
+
export async function readClipboard(): Promise<ClipboardContent> { return unavailable(); }
|
|
20
|
+
export async function getClipboardFormats(): Promise<string[]> { return unavailable(); }
|
|
21
|
+
export async function clearClipboard(): Promise<void> { return unavailable(); }
|
|
22
|
+
export async function writeClipboard(_content: ClipboardWriteContent): Promise<void> { return unavailable(); }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SparkError } from "@legendapp/spark-desktop-app/src/contracts";
|
|
2
|
+
import { StringFormat } from "./formats";
|
|
3
|
+
export function stringOptions(options: object, key: string): StringFormat {
|
|
4
|
+
if (!options || typeof options !== "object" || Object.keys(options).some(name => name !== key)) throw new SparkError("E_UNSUPPORTED_OPTION", "Unsupported clipboard option");
|
|
5
|
+
const format = (options as Record<string, unknown>)[key] ?? StringFormat.PLAIN_TEXT;
|
|
6
|
+
if (format !== StringFormat.PLAIN_TEXT && format !== StringFormat.HTML) throw new SparkError("E_INVALID_ARGUMENT", "Invalid clipboard string format");
|
|
7
|
+
return format;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StringFormat } from "./formats";
|
|
2
|
+
export type GetStringOptions = { preferredFormat?: StringFormat };
|
|
3
|
+
export type SetStringOptions = { inputFormat?: StringFormat };
|
|
4
|
+
export interface ClipboardImage { format: "png"; bytes: Uint8Array }
|
|
5
|
+
/** Reading preserves all OS representations, which can coexist. */
|
|
6
|
+
export interface ClipboardContent { text?: string; html?: string; rtf?: string; image?: ClipboardImage; files?: readonly string[] }
|
|
7
|
+
/** File lists must be written separately from text/image representations. */
|
|
8
|
+
export type ClipboardWriteContent =
|
|
9
|
+
| { files: readonly string[]; text?: never; html?: never; rtf?: never; image?: never }
|
|
10
|
+
| { files?: never; text?: string; html?: string; rtf?: string; image?: ClipboardImage };
|
package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.h
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
#include "NativeModules.h"
|
|
3
|
+
#include <SparkBinaryWindows.hpp>
|
|
3
4
|
#include <winrt/Windows.ApplicationModel.DataTransfer.h>
|
|
4
5
|
#include <winrt/Windows.Data.Json.h>
|
|
5
6
|
#include <winrt/Windows.Data.Html.h>
|
|
@@ -35,14 +36,21 @@ inline hstring HTML(hstring const &text) {
|
|
|
35
36
|
for (auto c : text) { switch(c) { case L'&': value += L"&"; break; case L'<': value += L"<"; break; case L'>': value += L">"; break; case L'\n': value += L"<br>"; break; default: value += c; } }
|
|
36
37
|
return hstring(value + L"</div>");
|
|
37
38
|
}
|
|
39
|
+
class ClipboardBytes final : public spark::binary::jsi::MutableBuffer {
|
|
40
|
+
com_array<uint8_t> bytes;
|
|
41
|
+
public:
|
|
42
|
+
explicit ClipboardBytes(com_array<uint8_t> value) : bytes(std::move(value)) {}
|
|
43
|
+
size_t size() const override { return bytes.size(); }
|
|
44
|
+
uint8_t *data() override { return bytes.data(); }
|
|
45
|
+
};
|
|
38
46
|
REACT_MODULE(SparkClipboard, L"NativeDesktopClipboard")
|
|
39
47
|
struct SparkClipboard {
|
|
40
48
|
React::ReactContext context;
|
|
41
49
|
REACT_INIT(Initialize) void Initialize(React::ReactContext const &value) noexcept { context = value; }
|
|
42
|
-
static fire_and_forget Invoke(std::string method, std::string encoded,
|
|
50
|
+
static fire_and_forget Invoke(std::string method, std::string encoded, spark::binary::NativePromise promise, std::optional<std::vector<uint8_t>> input = {}, bool binary = false) {
|
|
43
51
|
try {
|
|
44
52
|
auto args = Json::JsonObject::Parse(to_hstring(encoded));
|
|
45
|
-
if (method == "write" || method == "setString"
|
|
53
|
+
if (method == "write" || method == "setString") {
|
|
46
54
|
if (method != "write") {
|
|
47
55
|
Json::JsonObject content; content.SetNamedValue(args.GetNamedString(L"format", L"plainText") == L"html" ? L"html" : L"text", args.GetNamedValue(L"text")); args = content;
|
|
48
56
|
}
|
|
@@ -62,34 +70,38 @@ struct SparkClipboard {
|
|
|
62
70
|
}
|
|
63
71
|
data.SetStorageItems(items); data.RequestedOperation(Transfer::DataPackageOperation::Copy);
|
|
64
72
|
}
|
|
65
|
-
if (
|
|
66
|
-
auto bytes = CryptographicBuffer::
|
|
73
|
+
if (input) {
|
|
74
|
+
auto bytes = CryptographicBuffer::CreateFromByteArray(*input);
|
|
67
75
|
Streams::InMemoryRandomAccessStream stream; co_await stream.WriteAsync(bytes); stream.Seek(0);
|
|
68
76
|
auto decoder = co_await Imaging::BitmapDecoder::CreateAsync(stream);
|
|
69
77
|
if (decoder.DecoderInformation().CodecId() != Imaging::BitmapDecoder::PngDecoderId()) throw hresult_invalid_argument(L"Clipboard image must be PNG");
|
|
70
78
|
data.SetBitmap(Streams::RandomAccessStreamReference::CreateFromStream(stream));
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
bool written = true;
|
|
81
|
+
// The image is carried separately from the JSON metadata. An image-only
|
|
82
|
+
// write therefore has an empty object but is still non-empty content.
|
|
83
|
+
if (args.Size() == 0 && !input) Transfer::Clipboard::Clear();
|
|
84
|
+
else { Transfer::Clipboard::SetContent(data); written = Transfer::Clipboard::Flush(); }
|
|
85
|
+
// setString mirrors Expo's boolean result; write keeps reporting failure by exception only.
|
|
86
|
+
promise.Resolve(method == "setString" ? (written ? "true" : "false") : "null");
|
|
75
87
|
} else if (method == "clear") { Transfer::Clipboard::Clear(); promise.Resolve("null"); }
|
|
76
88
|
else {
|
|
77
89
|
auto data = Transfer::Clipboard::GetContent();
|
|
78
90
|
const bool text = data.Contains(Transfer::StandardDataFormats::Text()), html = data.Contains(Transfer::StandardDataFormats::Html()), rtf = data.Contains(Transfer::StandardDataFormats::Rtf());
|
|
79
|
-
if (method == "hasString"
|
|
91
|
+
if (method == "hasString") promise.Resolve((text || html || rtf) ? "true" : "false");
|
|
80
92
|
else if (method == "formats") { Json::JsonArray formats; for (auto const &format : data.AvailableFormats()) formats.Append(Json::JsonValue::CreateStringValue(format)); promise.Resolve(to_string(formats.Stringify())); }
|
|
81
|
-
else if (method == "getString"
|
|
93
|
+
else if (method == "getString") {
|
|
82
94
|
hstring value; const bool preferHTML = args.GetNamedString(L"format", L"plainText") == L"html";
|
|
83
|
-
if (
|
|
95
|
+
if (preferHTML && html) value = Transfer::HtmlFormatHelper::GetStaticFragment(co_await data.GetHtmlFormatAsync());
|
|
84
96
|
else {
|
|
85
97
|
if (text) value = co_await data.GetTextAsync();
|
|
86
|
-
else if (
|
|
87
|
-
else if (
|
|
98
|
+
else if (html) value = Windows::Data::Html::HtmlUtilities::ConvertToText(Transfer::HtmlFormatHelper::GetStaticFragment(co_await data.GetHtmlFormatAsync()));
|
|
99
|
+
else if (rtf) value = PlainRTF(co_await data.GetRtfAsync());
|
|
88
100
|
if (preferHTML && !value.empty()) value = HTML(value);
|
|
89
101
|
}
|
|
90
102
|
promise.Resolve(to_string(Json::JsonValue::CreateStringValue(value).Stringify()));
|
|
91
103
|
} else if (method == "read") {
|
|
92
|
-
Json::JsonObject result;
|
|
104
|
+
Json::JsonObject result; std::shared_ptr<ClipboardBytes> image;
|
|
93
105
|
if (text) result.SetNamedValue(L"text", Json::JsonValue::CreateStringValue(co_await data.GetTextAsync()));
|
|
94
106
|
if (html) result.SetNamedValue(L"html", Json::JsonValue::CreateStringValue(Transfer::HtmlFormatHelper::GetStaticFragment(co_await data.GetHtmlFormatAsync())));
|
|
95
107
|
if (rtf) result.SetNamedValue(L"rtf", Json::JsonValue::CreateStringValue(co_await data.GetRtfAsync()));
|
|
@@ -105,13 +117,24 @@ struct SparkClipboard {
|
|
|
105
117
|
encoder.SetSoftwareBitmap(bitmap); co_await encoder.FlushAsync(); output.Seek(0);
|
|
106
118
|
if (output.Size() > UINT32_MAX) throw hresult_invalid_argument(L"Clipboard image is too large");
|
|
107
119
|
Streams::Buffer bytes(static_cast<uint32_t>(output.Size())); auto read = co_await output.ReadAsync(bytes, bytes.Capacity(), Streams::InputStreamOptions::None);
|
|
108
|
-
|
|
120
|
+
com_array<uint8_t> owned; CryptographicBuffer::CopyToByteArray(read, owned); image = std::make_shared<ClipboardBytes>(std::move(owned));
|
|
109
121
|
}
|
|
110
|
-
|
|
122
|
+
spark::binary::Response response{to_string(result.Stringify()), {}, {}}; if (image) response.fields["imagePNG"] = image; promise.Resolve(std::move(response));
|
|
111
123
|
} else throw hresult_invalid_argument(L"Unsupported Windows clipboard operation");
|
|
112
124
|
}
|
|
113
125
|
} catch (hresult_error const &error) { promise.Reject(React::ReactError{"E_CLIPBOARD", to_string(error.message())}); }
|
|
114
126
|
}
|
|
127
|
+
REACT_SYNC_METHOD(installBinary) std::optional<std::string> installBinary() noexcept {
|
|
128
|
+
try {
|
|
129
|
+
spark::binary::Install(context, "__sparkClipboardBinary", [context = context](std::string method, std::string encoded, std::optional<std::vector<uint8_t>> bytes, spark::binary::Completion finish) {
|
|
130
|
+
context.UIDispatcher().Post([method = std::move(method), encoded = std::move(encoded), bytes = std::move(bytes), promise = spark::binary::NativePromise(finish)]() mutable { Invoke(std::move(method), std::move(encoded), promise, std::move(bytes), true); });
|
|
131
|
+
});
|
|
132
|
+
return std::nullopt;
|
|
133
|
+
} catch (std::exception const &error) { return error.what(); }
|
|
134
|
+
catch (hresult_error const &error) { return to_string(error.message()); }
|
|
135
|
+
catch (...) { return "Could not install native binary transport"; }
|
|
136
|
+
}
|
|
137
|
+
|
|
115
138
|
REACT_METHOD(call) void call(std::string method, std::string args, React::ReactPromise<std::string> promise) noexcept {
|
|
116
139
|
context.UIDispatcher().Post([method = std::move(method), args = std::move(args), promise]() { Invoke(method, args, promise); });
|
|
117
140
|
}
|
package/vendor/node_modules/@legendapp/spark-clipboard/windows/SparkClipboard/SparkClipboard.vcxproj
CHANGED
|
@@ -80,6 +80,8 @@
|
|
|
80
80
|
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
81
81
|
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
|
82
82
|
<AdditionalIncludeDirectories>
|
|
83
|
+
$(MSBuildThisFileDirectory)..\..\..\spark-desktop-app\cpp;
|
|
84
|
+
$(MSBuildThisFileDirectory)..\..\..\desktop-app\cpp;
|
|
83
85
|
$(MSBuildThisFileDirectory);
|
|
84
86
|
%(AdditionalIncludeDirectories)
|
|
85
87
|
</AdditionalIncludeDirectories>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RNCodex"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = "Per-app Codex app-server client"
|
|
9
|
+
s.license = { :type => "MIT" }
|
|
10
|
+
s.author = "Legend"
|
|
11
|
+
s.homepage = "https://legendapp.com"
|
|
12
|
+
s.source = { :path => "." }
|
|
13
|
+
s.platforms = { :osx => "14.0" }
|
|
14
|
+
s.source_files = "cpp/**/*.{h,hpp,cpp,mm}"
|
|
15
|
+
s.pod_target_xcconfig = {
|
|
16
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
17
|
+
}
|
|
18
|
+
s.frameworks = "Foundation"
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
load "nitrogen/generated/ios/RNCodex+autolinking.rb"
|
|
21
|
+
add_nitrogen_files(s)
|
|
22
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "../nitrogen/generated/shared/c++/HybridCodexAppServerSpec.hpp"
|
|
4
|
+
|
|
5
|
+
namespace margelo::nitro::legendapps::codex {
|
|
6
|
+
|
|
7
|
+
class HybridCodexAppServer final : public HybridCodexAppServerSpec {
|
|
8
|
+
public:
|
|
9
|
+
HybridCodexAppServer();
|
|
10
|
+
|
|
11
|
+
std::shared_ptr<Promise<CodexAvailability>> getAvailability() override;
|
|
12
|
+
std::shared_ptr<Promise<CodexRunResult>> runPrompt(
|
|
13
|
+
const std::string& prompt,
|
|
14
|
+
const std::string& cwd,
|
|
15
|
+
const std::string& reasoningEffort,
|
|
16
|
+
double timeoutMs,
|
|
17
|
+
const std::string& outputSchemaJson,
|
|
18
|
+
const std::string& developerInstructions) override;
|
|
19
|
+
double cancelActiveRuns() override;
|
|
20
|
+
double shutdown() override;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::legendapps::codex
|