@legendapp/spark 0.0.1-next.2 → 0.0.1-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/camera.ts +13 -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 +93 -15
- package/patches/camera/react-native-nitro-image.patch +320 -0
- package/patches/camera/react-native-nitro-modules.patch +50 -0
- package/patches/camera/react-native-vision-camera.patch +2662 -0
- package/patches/camera/upstream.json +22 -0
- package/patches/dependencies.json +8 -0
- package/patches/react-native-enriched-markdown@1.0.2.patch +8684 -0
- package/postinstall.cjs +1 -0
- 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-swipe.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 +145 -59
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +61 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +10 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +37 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/credentials.js +86 -25
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +132 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +13 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +13 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +100 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
- 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-native.cjs +5 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-node.js +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/helpers.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +52 -44
- package/vendor/node_modules/@legendapp/spark-cli/dist/json.js +16 -0
- 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 +86 -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/process.js +7 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +90 -32
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.js +86 -5
- 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/universal.cjs +2 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/updates.js +41 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +5 -9
- 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 +12 -10
- 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 +14 -12
- 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 +14 -12
- 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 +116 -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 +18 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +89 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/expo.cjs +1 -0
- 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/native-patches.cjs +106 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +7 -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 +3169 -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 +146 -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 +51 -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 +1419 -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/swipe-actions/RNSwipeActions.h +10 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/swipe-actions/RNSwipeActions.mm +422 -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 +17 -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 +37 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +86 -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/swipe-actions/SwipeActionsNativeComponent.ts +11 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/swipe-actions/index.tsx +41 -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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LegendApp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Legend Spark adds native desktop APIs and a managed development workflow to Reac
|
|
|
6
6
|
|
|
7
7
|
## Try the experimental release
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Requires Node 24.19.0 or newer. The single `@legendapp/spark` npm package contains the CLI and private implementation modules; no separate Spark module installs are needed. Bun is optional.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npx @legendapp/spark@next create MyApp
|
|
@@ -14,8 +14,14 @@ cd MyApp
|
|
|
14
14
|
npm run macos
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
The published CLI uses matching GitHub release assets for patched native dependencies and automatically downloads the macOS ARM64 Spark Runner on first desktop launch. JavaScript edits use Fast Refresh. Native changes require a compatible runtime rebuild and native build tools.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Source/local archives without embedded release metadata require a registered local SDK; see the repository setup guide.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
macOS 14+ on Apple Silicon is the primary experimental target. Windows development implementations still need native acceptance; Windows production builds and a downloadable Windows Runner are not supplied by this prerelease workflow. Mobile and web use Expo workflows with selected shared adapters.
|
|
22
|
+
|
|
23
|
+
[Documentation](https://legend.so/spark) · [Source and setup guide](https://github.com/LegendApp/legend-spark) · [Known Windows limitations](https://github.com/LegendApp/legend-spark/blob/main/docs/windows-issues.md)
|
|
24
|
+
|
|
25
|
+
[Desktop application capabilities](https://github.com/LegendApp/legend-spark/blob/main/docs/desktop-capabilities.md)
|
|
26
|
+
cover managed windows, document helpers, routed commands, native controls,
|
|
27
|
+
settings windows, and the shared desktop integrations.
|
package/ai-codex.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vendor/node_modules/@legendapp/spark-codex";
|
package/ai.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vendor/node_modules/@legendapp/spark-ai";
|
package/app-documents.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vendor/node_modules/@legendapp/spark-documents/src/index.tsx";
|
package/camera.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Camera, VisionCamera, getCameraDevice, getAllCameraDevices, getDefaultCameraDevice,
|
|
3
|
+
addOnCameraDevicesChangedListener, useCamera, useCameraDevice, useCameraDevices,
|
|
4
|
+
useCameraPermission, useMicrophonePermission, usePhotoOutput, useVideoOutput,
|
|
5
|
+
} from "react-native-vision-camera";
|
|
6
|
+
export type {
|
|
7
|
+
CameraDevice, CameraRef, CameraViewProps, CameraProps, CameraSession,
|
|
8
|
+
CameraSessionConfig, CameraSessionConfiguration, CameraController, CameraFactory,
|
|
9
|
+
CameraPhotoOutput, CameraVideoOutput, PhotoOutputOptions, VideoOutputOptions,
|
|
10
|
+
Photo, Recorder, PermissionStatus, PermissionState, Constraint,
|
|
11
|
+
} from "react-native-vision-camera";
|
|
12
|
+
export { NitroImage } from "react-native-nitro-image";
|
|
13
|
+
export type { Image } from "react-native-nitro-image";
|
package/contracts.ts
ADDED
package/diagnostics.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getStartupTiming, type StartupTiming } from "./vendor/node_modules/@legendapp/spark-desktop-windows/src/diagnostics";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withSparkExpo } from "./vendor/node_modules/@legendapp/spark-desktop-config/expo.cjs";
|
package/metro.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const { withDesktop } = require("./vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs");
|
|
2
|
+
const { getDefaultConfig, withSparkMetro } = require("./vendor/node_modules/@legendapp/spark-cli/dist/expo-metro.cjs");
|
|
3
|
+
const { metroConfig } = require("./vendor/node_modules/@legendapp/spark-cli/dist/universal.cjs");
|
|
4
|
+
module.exports = { withDesktop, metroConfig, getDefaultConfig, withSparkMetro };
|
package/metro.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { getDefaultConfig as expoDefaults } from "expo/metro-config";
|
|
2
|
+
export interface DesktopMetroOptions { runtimes?: boolean; watch?: boolean }
|
|
3
|
+
export type MetroConfiguration = ReturnType<typeof expoDefaults>;
|
|
4
|
+
/** Spark-owned project: chooses target defaults and installs desktop/runtime integration. */
|
|
5
|
+
export function metroConfig(root: string): MetroConfiguration;
|
|
6
|
+
/** Existing Expo project: obtain defaults before applying application customizations. */
|
|
7
|
+
export const getDefaultConfig: typeof expoDefaults;
|
|
8
|
+
/** Complete an existing Expo project's composition after application customizations. */
|
|
9
|
+
export function withSparkMetro<T extends Partial<MetroConfiguration>>(config: T): T;
|
|
10
|
+
export function withSparkMetro<T extends Partial<MetroConfiguration>>(config: Promise<T>): Promise<T>;
|
|
11
|
+
/** Advanced integration of an already configured desktop Metro instance. */
|
|
12
|
+
export function withDesktop<T extends Partial<MetroConfiguration>>(config: T, options?: DesktopMetroOptions): T;
|
package/native.cjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
const { nativeConfig } = require("./vendor/node_modules/@legendapp/spark-cli/dist/universal.cjs");
|
|
2
|
+
const { withSparkNative } = require("./vendor/node_modules/@legendapp/spark-cli/dist/expo-native.cjs");
|
|
3
|
+
module.exports = { nativeConfig, withSparkNative };
|
package/native.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UserConfig } from "@react-native-community/cli-types";
|
|
2
|
+
export type NativeConfiguration = Pick<Partial<UserConfig>, "platforms" | "dependencies">;
|
|
3
|
+
/** Spark-owned project: generate native discovery configuration. */
|
|
4
|
+
export function nativeConfig(root: string): NativeConfiguration;
|
|
5
|
+
/** Existing Expo project: compose with its React Native CLI configuration. */
|
|
6
|
+
export function withSparkNative<T extends Partial<UserConfig>>(config: T, root: string): T & NativeConfiguration;
|
package/package.json
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/LegendApp/legend-spark.git",
|
|
8
|
+
"directory": "packages/desktop"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/LegendApp/legend-spark#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/LegendApp/legend-spark/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"react-native",
|
|
16
|
+
"expo",
|
|
17
|
+
"desktop",
|
|
18
|
+
"macos",
|
|
19
|
+
"windows",
|
|
20
|
+
"native"
|
|
21
|
+
],
|
|
5
22
|
"exports": {
|
|
6
23
|
"./dialogs": "./dialogs.ts",
|
|
7
24
|
"./menus": "./menus.ts",
|
|
@@ -20,7 +37,6 @@
|
|
|
20
37
|
"./updates": "./updates.ts",
|
|
21
38
|
"./processes": "./processes.ts",
|
|
22
39
|
"./system": "./system.ts",
|
|
23
|
-
"./message-dialog": "./message-dialog.ts",
|
|
24
40
|
"./global-shortcuts": "./global-shortcuts.ts",
|
|
25
41
|
"./drag-drop": "./drag-drop.ts",
|
|
26
42
|
"./webview": "./webview.ts",
|
|
@@ -33,38 +49,60 @@
|
|
|
33
49
|
"./config-plugin": "./config-plugin.cjs",
|
|
34
50
|
"./expo-config": "./expo-config.cjs",
|
|
35
51
|
"./metro": "./metro.cjs",
|
|
36
|
-
"./expo-metro": "./expo-metro.cjs",
|
|
37
|
-
"./universal": "./universal.cjs",
|
|
38
52
|
"./runtime-entry": "./runtime-entry.cjs",
|
|
39
53
|
"./metro-gate": "./metro-gate.cjs",
|
|
40
54
|
"./init-template": "./init-template.cjs",
|
|
41
55
|
"./native": "./native.cjs",
|
|
42
56
|
"./cli": "./bin/spark.cjs",
|
|
43
|
-
"./schema.json": "./schema.json"
|
|
57
|
+
"./schema.json": "./schema.json",
|
|
58
|
+
"./ui/split-view": "./ui-split-view.ts",
|
|
59
|
+
"./ui/sidebar": "./ui-sidebar.ts",
|
|
60
|
+
"./app/documents": "./app-documents.ts",
|
|
61
|
+
"./shortcuts/commands": "./shortcuts-commands.ts",
|
|
62
|
+
"./shortcuts/keyboard": "./shortcuts-keyboard.ts",
|
|
63
|
+
"./ui/glass": "./ui-glass.ts",
|
|
64
|
+
"./ui/swipe": "./ui-swipe.ts",
|
|
65
|
+
"./ui/symbol": "./ui-symbol.ts",
|
|
66
|
+
"./ui/search": "./ui-search.ts",
|
|
67
|
+
"./settings/window": "./settings-window.ts",
|
|
68
|
+
"./settings/observable": "./settings-observable.ts",
|
|
69
|
+
"./ui/classnames": "./ui-classnames.ts",
|
|
70
|
+
"./contracts": "./contracts.ts",
|
|
71
|
+
"./windows/macos": "./windows-macos.ts",
|
|
72
|
+
"./diagnostics": "./diagnostics.ts",
|
|
73
|
+
"./ai": "./ai.ts",
|
|
74
|
+
"./ai/codex": "./ai-codex.ts",
|
|
75
|
+
"./camera": "./camera.ts"
|
|
44
76
|
},
|
|
45
77
|
"files": [
|
|
46
78
|
"*.ts",
|
|
47
79
|
"*.cjs",
|
|
48
80
|
"schema.json",
|
|
49
81
|
"bin",
|
|
50
|
-
"*.d.cts"
|
|
82
|
+
"*.d.cts",
|
|
83
|
+
"patches"
|
|
51
84
|
],
|
|
52
85
|
"dependencies": {
|
|
53
86
|
"base64-js": "1.5.1",
|
|
54
|
-
"ws": "8.
|
|
55
|
-
"expo-desktop": "1.0.0
|
|
56
|
-
"npm": "11.
|
|
87
|
+
"ws": "8.21.0",
|
|
88
|
+
"expo-desktop": "1.0.0",
|
|
89
|
+
"npm": "11.21.0",
|
|
57
90
|
"typescript": "5.9.3",
|
|
58
91
|
"cross-spawn": "7.0.6",
|
|
59
|
-
"
|
|
92
|
+
"react-native-nitro-modules": "0.37.0",
|
|
93
|
+
"@legendapp/state": "^3.0.0-beta.42",
|
|
94
|
+
"expo-desktop-config-plugins": "1.2.0",
|
|
60
95
|
"@expo/config-plugins": "54.0.5",
|
|
96
|
+
"@expo/config-types": "54.0.10",
|
|
97
|
+
"diff": "8.0.2",
|
|
61
98
|
"@react-native-runtimes/core": "0.1.0-alpha.2",
|
|
62
|
-
"react-native-
|
|
63
|
-
"
|
|
64
|
-
"react": "
|
|
65
|
-
"react-native": "0.
|
|
66
|
-
"react-dom": "19.1.4",
|
|
99
|
+
"@react-native-community/cli-types": "20.1.3",
|
|
100
|
+
"react-native-vision-camera": "5.2.3",
|
|
101
|
+
"react-native-nitro-image": "0.15.2",
|
|
102
|
+
"react-native-enriched-markdown": "1.0.2",
|
|
67
103
|
"@op-engineering/op-sqlite": "18.2.1",
|
|
104
|
+
"clsx": "^2.1.1",
|
|
105
|
+
"tailwind-merge": "^3.4.0",
|
|
68
106
|
"react-native-webview": "16.0.0"
|
|
69
107
|
},
|
|
70
108
|
"description": "Legend Spark — native applications with React Native and Expo",
|
|
@@ -85,6 +123,7 @@
|
|
|
85
123
|
"react-dom": "19.1.4",
|
|
86
124
|
"expo-linking": "~8.0.12",
|
|
87
125
|
"expo-secure-store": "~15.0.8",
|
|
126
|
+
"@legendapp/list": ">=3.3.0",
|
|
88
127
|
"@expo/ui": "0.2.0-beta.9",
|
|
89
128
|
"uniwind": "^1.6.3",
|
|
90
129
|
"react-native-windows": "0.81.35"
|
|
@@ -125,12 +164,49 @@
|
|
|
125
164
|
"access": "public",
|
|
126
165
|
"tag": "next"
|
|
127
166
|
},
|
|
167
|
+
"scripts": {
|
|
168
|
+
"postinstall": "node postinstall.cjs"
|
|
169
|
+
},
|
|
128
170
|
"spark": {
|
|
171
|
+
"nativePatchRequirements": {
|
|
172
|
+
"schema": 1,
|
|
173
|
+
"frameworkVersion": "0.0.1-next.4",
|
|
174
|
+
"packages": {
|
|
175
|
+
"@react-native-runtimes/core": {
|
|
176
|
+
"version": "0.1.0-alpha.2",
|
|
177
|
+
"patchHash": "985164a87eb04010a8d849f5b0ca22a76548dc3f73a64a6183683ca90932ec2c",
|
|
178
|
+
"upstreamRevision": "58710c25c6e505dcc1292ee54d855408a6f7a42d"
|
|
179
|
+
},
|
|
180
|
+
"react-native-nitro-modules": {
|
|
181
|
+
"version": "0.37.0",
|
|
182
|
+
"patchHash": "bd582f6bd686bd9058a2eae193854e86a1f66d0d8334fbcafd2b0cab16dadaa4",
|
|
183
|
+
"upstreamIntegrity": "sha512-ULS2CBZcdwGw5d4Y35EV/tbCOsNsQOnQ9LC9CehMhDNm5c90lwF/LxRamzKuFpjI547G7teTQgD0peqYSGnP9g=="
|
|
184
|
+
},
|
|
185
|
+
"@op-engineering/op-sqlite": {
|
|
186
|
+
"version": "18.2.1",
|
|
187
|
+
"patchHash": "d535dcd20aa0f5bcf8860086eb6484c73b1e84d8a586ea9fe74dca76085955a0",
|
|
188
|
+
"upstreamIntegrity": "sha512-atVOtXyFzO0e454eVS27AMwRs515URCKrkvLLG+mGKcyiF5UPfC53oukpNp2UmVzlLebyTEXNkTYs6n0dVGd0g=="
|
|
189
|
+
},
|
|
190
|
+
"react-native-webview": {
|
|
191
|
+
"version": "16.0.0",
|
|
192
|
+
"patchHash": "43cfd2d36780e085223bc7497719c7c64ec1bea1da82362e751f9937a0349e1a",
|
|
193
|
+
"upstreamIntegrity": "sha512-KIg5Yhy04lQfHdXC1JQPM+0kftMfPnH6AqDH7v6YskQ9kzfUacooofOFRmbaZHASq/0WY87Fx0peiFETFjOcCg=="
|
|
194
|
+
},
|
|
195
|
+
"expo-audio": {
|
|
196
|
+
"version": "1.1.1",
|
|
197
|
+
"patchHash": "e9348063295113222c6d03e5bf8cac2c3a7a0b283e40166c257fad60b423dd14",
|
|
198
|
+
"upstreamIntegrity": "sha512-CPCpJ+0AEHdzWROc0f00Zh6e+irLSl2ALos/LPvxEeIcJw1APfBa4DuHPkL4CQCWsVe7EnUjFpdwpqsEUWcP0g=="
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
129
202
|
"bundledModules": [
|
|
203
|
+
"@legendapp/spark-ai",
|
|
130
204
|
"@legendapp/spark-audio",
|
|
131
205
|
"@legendapp/spark-auth-session",
|
|
132
206
|
"@legendapp/spark-cli",
|
|
133
207
|
"@legendapp/spark-clipboard",
|
|
208
|
+
"@legendapp/spark-codex",
|
|
209
|
+
"@legendapp/spark-commands",
|
|
134
210
|
"@legendapp/spark-desktop-config",
|
|
135
211
|
"@legendapp/spark-context-menu",
|
|
136
212
|
"@legendapp/spark-desktop-app",
|
|
@@ -138,6 +214,7 @@
|
|
|
138
214
|
"@legendapp/spark-desktop-links",
|
|
139
215
|
"@legendapp/spark-desktop-shortcuts",
|
|
140
216
|
"@legendapp/spark-desktop-windows",
|
|
217
|
+
"@legendapp/spark-documents",
|
|
141
218
|
"@legendapp/spark-drag-drop",
|
|
142
219
|
"@legendapp/spark-file-dialog",
|
|
143
220
|
"@legendapp/spark-file-system",
|
|
@@ -148,6 +225,7 @@
|
|
|
148
225
|
"@legendapp/spark-processes",
|
|
149
226
|
"@legendapp/spark-secure-storage",
|
|
150
227
|
"@legendapp/spark-settings",
|
|
228
|
+
"@legendapp/spark-settings-ui",
|
|
151
229
|
"@legendapp/spark-sqlite",
|
|
152
230
|
"@legendapp/spark-system",
|
|
153
231
|
"@legendapp/spark-tray",
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
diff --git a/NitroImage.podspec b/NitroImage.podspec
|
|
2
|
+
index 4b8f577..6aa9982 100644
|
|
3
|
+
--- a/NitroImage.podspec
|
|
4
|
+
+++ b/NitroImage.podspec
|
|
5
|
+
@@ -10,14 +10,18 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.license = package["license"]
|
|
7
|
+
s.authors = package["author"]
|
|
8
|
+
|
|
9
|
+
- s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
10
|
+
+ s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0, :osx => "14.0" }
|
|
11
|
+
+ s.osx.prefix_header_contents = "#include <CoreGraphics/CoreGraphics.h>"
|
|
12
|
+
s.source = { :git => "https://github.com/mrousavy/nitro.git", :tag => "#{s.version}" }
|
|
13
|
+
|
|
14
|
+
+ s.ios.source_files = "ios/**/*.{swift,m,mm}"
|
|
15
|
+
+ s.visionos.source_files = "ios/**/*.{swift,m,mm}"
|
|
16
|
+
+ s.osx.source_files = "macos/**/*.swift"
|
|
17
|
+
s.source_files = [
|
|
18
|
+
# Implementation (Swift)
|
|
19
|
+
- "ios/**/*.{swift}",
|
|
20
|
+
+
|
|
21
|
+
# Autolinking/Registration (Objective-C++)
|
|
22
|
+
- "ios/**/*.{m,mm}",
|
|
23
|
+
+
|
|
24
|
+
# Implementation (C++ objects)
|
|
25
|
+
"cpp/**/*.{hpp,cpp}",
|
|
26
|
+
]
|
|
27
|
+
diff --git a/macos/MacImage.swift b/macos/MacImage.swift
|
|
28
|
+
new file mode 100644
|
|
29
|
+
index 0000000..3c5623e
|
|
30
|
+
--- /dev/null
|
|
31
|
+
+++ b/macos/MacImage.swift
|
|
32
|
+
@@ -0,0 +1,183 @@
|
|
33
|
+
+import AppKit
|
|
34
|
+
+import CoreGraphics
|
|
35
|
+
+import CoreImage
|
|
36
|
+
+import ImageIO
|
|
37
|
+
+import UniformTypeIdentifiers
|
|
38
|
+
+import NitroModules
|
|
39
|
+
+
|
|
40
|
+
+public protocol NativeImage { var cgImage: CGImage { get } }
|
|
41
|
+
+
|
|
42
|
+
+private func bitmap(_ width: Double, _ height: Double) throws -> CGContext {
|
|
43
|
+
+ guard width.isFinite, height.isFinite, width > 0, height > 0, width <= 32768, height <= 32768,
|
|
44
|
+
+ let context = CGContext(data: nil, width: Int(width.rounded(.up)), height: Int(height.rounded(.up)), bitsPerComponent: 8, bytesPerRow: Int(width.rounded(.up)) * 4, space: CGColorSpace(name: CGColorSpace.sRGB)!, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else {
|
|
45
|
+
+ throw RuntimeError.error(withMessage: "Invalid image dimensions")
|
|
46
|
+
+ }
|
|
47
|
+
+ return context
|
|
48
|
+
+}
|
|
49
|
+
+
|
|
50
|
+
+public final class HybridCGImage: HybridImageSpec, NativeImage {
|
|
51
|
+
+ public let cgImage: CGImage
|
|
52
|
+
+ public init(cgImage: CGImage) { self.cgImage = cgImage; super.init() }
|
|
53
|
+
+ public var width: Double { Double(cgImage.width) }
|
|
54
|
+
+ public var height: Double { Double(cgImage.height) }
|
|
55
|
+
+ public var memorySize: Int { cgImage.bytesPerRow * cgImage.height }
|
|
56
|
+
+ private func render(_ width: Double, _ height: Double, draw: (CGContext) -> Void) throws -> any HybridImageSpec {
|
|
57
|
+
+ let context = try bitmap(width, height); draw(context)
|
|
58
|
+
+ guard let image = context.makeImage() else { throw RuntimeError.error(withMessage: "Failed to render image") }
|
|
59
|
+
+ return HybridCGImage(cgImage: image)
|
|
60
|
+
+ }
|
|
61
|
+
+ public func toRawPixelData(allowGpu: Bool?) throws -> RawPixelData {
|
|
62
|
+
+ let context = try bitmap(width, height)
|
|
63
|
+
+ context.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height))
|
|
64
|
+
+ guard let pointer = context.data else { throw RuntimeError.error(withMessage: "Missing pixel data") }
|
|
65
|
+
+ let data = Data(bytes: pointer, count: context.bytesPerRow * context.height)
|
|
66
|
+
+ return RawPixelData(buffer: try ArrayBuffer.copy(data: data), width: width, height: height, pixelFormat: .rgba)
|
|
67
|
+
+ }
|
|
68
|
+
+ public func toRawPixelDataAsync(allowGpu: Bool?) throws -> Promise<RawPixelData> { Promise.async { try self.toRawPixelData(allowGpu: allowGpu) } }
|
|
69
|
+
+ public func toEncodedImageData(format: ImageFormat, quality: Double?) throws -> EncodedImageData {
|
|
70
|
+
+ let type: CFString
|
|
71
|
+
+ switch format { case .jpg: type = UTType.jpeg.identifier as CFString; case .png: type = UTType.png.identifier as CFString; case .heic: type = UTType.heic.identifier as CFString }
|
|
72
|
+
+ let data = NSMutableData()
|
|
73
|
+
+ guard let destination = CGImageDestinationCreateWithData(data, type, 1, nil) else { throw RuntimeError.error(withMessage: "Image encoder is unavailable") }
|
|
74
|
+
+ CGImageDestinationAddImage(destination, cgImage, [kCGImageDestinationLossyCompressionQuality: max(0, min(100, quality ?? 100)) / 100] as CFDictionary)
|
|
75
|
+
+ guard CGImageDestinationFinalize(destination) else { throw RuntimeError.error(withMessage: "Image encoding failed") }
|
|
76
|
+
+ return EncodedImageData(buffer: try ArrayBuffer.copy(data: data as Data), width: width, height: height, imageFormat: format)
|
|
77
|
+
+ }
|
|
78
|
+
+ public func toEncodedImageDataAsync(format: ImageFormat, quality: Double?) throws -> Promise<EncodedImageData> { Promise.async { try self.toEncodedImageData(format: format, quality: quality) } }
|
|
79
|
+
+ public func resize(width: Double, height: Double) throws -> any HybridImageSpec {
|
|
80
|
+
+ try render(width, height) { $0.interpolationQuality = .high; $0.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height)) }
|
|
81
|
+
+ }
|
|
82
|
+
+ public func resizeAsync(width: Double, height: Double) throws -> Promise<any HybridImageSpec> { Promise.async { try self.resize(width: width, height: height) } }
|
|
83
|
+
+ public func rotate(degrees: Double, allowFastFlagRotation: Bool?) throws -> any HybridImageSpec {
|
|
84
|
+
+ guard degrees.isFinite else { throw RuntimeError.error(withMessage: "Invalid rotation") }
|
|
85
|
+
+ let radians = degrees * .pi / 180
|
|
86
|
+
+ let bounds = CGRect(x: 0, y: 0, width: width, height: height).applying(CGAffineTransform(rotationAngle: radians))
|
|
87
|
+
+ return try render(abs(bounds.width), abs(bounds.height)) { context in
|
|
88
|
+
+ context.translateBy(x: abs(bounds.width) / 2, y: abs(bounds.height) / 2); context.rotate(by: -radians)
|
|
89
|
+
+ context.draw(cgImage, in: CGRect(x: -width / 2, y: -height / 2, width: width, height: height))
|
|
90
|
+
+ }
|
|
91
|
+
+ }
|
|
92
|
+
+ public func rotateAsync(degrees: Double, allowFastFlagRotation: Bool?) throws -> Promise<any HybridImageSpec> { Promise.async { try self.rotate(degrees: degrees, allowFastFlagRotation: allowFastFlagRotation) } }
|
|
93
|
+
+ public func crop(startX: Double, startY: Double, endX: Double, endY: Double) throws -> any HybridImageSpec {
|
|
94
|
+
+ guard startX >= 0, startY >= 0, endX <= width, endY <= height, endX > startX, endY > startY,
|
|
95
|
+
+ let image = cgImage.cropping(to: CGRect(x: startX, y: startY, width: endX - startX, height: endY - startY)) else { throw RuntimeError.error(withMessage: "Invalid crop rectangle") }
|
|
96
|
+
+ return HybridCGImage(cgImage: image)
|
|
97
|
+
+ }
|
|
98
|
+
+ public func cropAsync(startX: Double, startY: Double, endX: Double, endY: Double) throws -> Promise<any HybridImageSpec> { Promise.async { try self.crop(startX: startX, startY: startY, endX: endX, endY: endY) } }
|
|
99
|
+
+ public func mirrorHorizontally() throws -> any HybridImageSpec { try render(width, height) { $0.translateBy(x: width, y: 0); $0.scaleBy(x: -1, y: 1); $0.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height)) } }
|
|
100
|
+
+ public func mirrorHorizontallyAsync() throws -> Promise<any HybridImageSpec> { Promise.async { try self.mirrorHorizontally() } }
|
|
101
|
+
+ public func saveToFileAsync(path: String, format: ImageFormat, quality: Double?) throws -> Promise<Void> {
|
|
102
|
+
+ Promise.async {
|
|
103
|
+
+ let url = path.hasPrefix("file://") ? URL(string: path)! : URL(fileURLWithPath: path)
|
|
104
|
+
+ try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
|
|
105
|
+
+ let encoded = try self.toEncodedImageData(format: format, quality: quality)
|
|
106
|
+
+ try encoded.buffer.toData(copyIfNeeded: false).write(to: url, options: .atomic)
|
|
107
|
+
+ }
|
|
108
|
+
+ }
|
|
109
|
+
+ public func saveToTemporaryFileAsync(format: ImageFormat, quality: Double?) throws -> Promise<String> {
|
|
110
|
+
+ Promise.async {
|
|
111
|
+
+ let path = FileManager.default.temporaryDirectory.appendingPathComponent("\(UUID()).\(format.stringValue)").path
|
|
112
|
+
+ let encoded = try self.toEncodedImageData(format: format, quality: quality)
|
|
113
|
+
+ try encoded.buffer.toData(copyIfNeeded: false).write(to: URL(fileURLWithPath: path), options: .atomic)
|
|
114
|
+
+ return path
|
|
115
|
+
+ }
|
|
116
|
+
+ }
|
|
117
|
+
+ public func toThumbHash() throws -> ArrayBuffer { throw RuntimeError.error(withMessage: "ThumbHash is not implemented in the macOS prototype") }
|
|
118
|
+
+ public func toThumbHashAsync() throws -> Promise<ArrayBuffer> { Promise.async { try self.toThumbHash() } }
|
|
119
|
+
+ public func renderInto(image: any HybridImageSpec, x: Double, y: Double, width: Double, height: Double) throws -> any HybridImageSpec {
|
|
120
|
+
+ guard let target = image as? NativeImage else { throw RuntimeError.error(withMessage: "Expected a native macOS image") }
|
|
121
|
+
+ return try render(image.width, image.height) { context in
|
|
122
|
+
+ context.draw(target.cgImage, in: CGRect(x: 0, y: 0, width: image.width, height: image.height))
|
|
123
|
+
+ context.draw(cgImage, in: CGRect(x: x, y: image.height - y - height, width: width, height: height))
|
|
124
|
+
+ }
|
|
125
|
+
+ }
|
|
126
|
+
+ public func renderIntoAsync(image: any HybridImageSpec, x: Double, y: Double, width: Double, height: Double) throws -> Promise<any HybridImageSpec> { Promise.async { try self.renderInto(image: image, x: x, y: y, width: width, height: height) } }
|
|
127
|
+
+}
|
|
128
|
+
+
|
|
129
|
+
+final class HybridImageFactory: HybridImageFactorySpec {
|
|
130
|
+
+ func createBlankImage(width: Double, height: Double, enableAlpha: Bool, fill: Color?) throws -> any HybridImageSpec {
|
|
131
|
+
+ let context = try bitmap(width, height)
|
|
132
|
+
+ context.setFillColor(red: fill?.r ?? 0, green: fill?.g ?? 0, blue: fill?.b ?? 0, alpha: enableAlpha ? (fill?.a ?? 0) : 1)
|
|
133
|
+
+ context.fill(CGRect(x: 0, y: 0, width: width, height: height))
|
|
134
|
+
+ return HybridCGImage(cgImage: context.makeImage()!)
|
|
135
|
+
+ }
|
|
136
|
+
+ func createBlankImageAsync(width: Double, height: Double, enableAlpha: Bool, fill: Color?) throws -> Promise<any HybridImageSpec> { Promise.async { try self.createBlankImage(width: width, height: height, enableAlpha: enableAlpha, fill: fill) } }
|
|
137
|
+
+ func loadFromFile(filePath: String) throws -> any HybridImageSpec {
|
|
138
|
+
+ let url = filePath.hasPrefix("file://") ? URL(string: filePath)! : URL(fileURLWithPath: filePath)
|
|
139
|
+
+ return try decode(Data(contentsOf: url))
|
|
140
|
+
+ }
|
|
141
|
+
+ private func decode(_ data: Data) throws -> any HybridImageSpec {
|
|
142
|
+
+ guard let source = CGImageSourceCreateWithData(data as CFData, nil), let image = CGImageSourceCreateImageAtIndex(source, 0, nil) else { throw RuntimeError.error(withMessage: "Failed to decode image") }
|
|
143
|
+
+ let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any]
|
|
144
|
+
+ let orientation = (properties?[kCGImagePropertyOrientation] as? NSNumber)?.int32Value ?? 1
|
|
145
|
+
+ let oriented = CIImage(cgImage: image).oriented(forExifOrientation: orientation)
|
|
146
|
+
+ guard let result = CIContext().createCGImage(oriented, from: oriented.extent) else { throw RuntimeError.error(withMessage: "Failed to orient image") }
|
|
147
|
+
+ return HybridCGImage(cgImage: result)
|
|
148
|
+
+ }
|
|
149
|
+
+ func loadFromFileAsync(filePath: String) throws -> Promise<any HybridImageSpec> { Promise.async { try self.loadFromFile(filePath: filePath) } }
|
|
150
|
+
+ func loadFromResources(name: String) throws -> any HybridImageSpec {
|
|
151
|
+
+ guard let url = Bundle.main.url(forResource: name, withExtension: nil) else { throw RuntimeError.error(withMessage: "Image resource not found: \(name)") }
|
|
152
|
+
+ return try loadFromFile(filePath: url.path)
|
|
153
|
+
+ }
|
|
154
|
+
+ func loadFromResourcesAsync(name: String) throws -> Promise<any HybridImageSpec> { Promise.async { try self.loadFromResources(name: name) } }
|
|
155
|
+
+ func loadFromSymbol(symbolName: String) throws -> any HybridImageSpec {
|
|
156
|
+
+ guard let image = NSImage(systemSymbolName: symbolName, accessibilityDescription: nil), let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil) else { throw RuntimeError.error(withMessage: "Symbol not found: \(symbolName)") }
|
|
157
|
+
+ return HybridCGImage(cgImage: cgImage)
|
|
158
|
+
+ }
|
|
159
|
+
+ func loadFromRawPixelData(data: RawPixelData, allowGpu: Bool?) throws -> any HybridImageSpec {
|
|
160
|
+
+ guard data.pixelFormat == .rgba, data.width > 0, data.height > 0, data.width <= 32768, data.height <= 32768, data.width.rounded() == data.width, data.height.rounded() == data.height else { throw RuntimeError.error(withMessage: "The macOS prototype accepts RGBA pixel data with integer dimensions") }
|
|
161
|
+
+ let bytes = data.buffer.toData(copyIfNeeded: true)
|
|
162
|
+
+ guard bytes.count == Int(data.width) * Int(data.height) * 4,
|
|
163
|
+
+ let provider = CGDataProvider(data: bytes as CFData),
|
|
164
|
+
+ let image = CGImage(width: Int(data.width), height: Int(data.height), bitsPerComponent: 8, bitsPerPixel: 32, bytesPerRow: Int(data.width) * 4, space: CGColorSpace(name: CGColorSpace.sRGB)!, bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue), provider: provider, decode: nil, shouldInterpolate: true, intent: .defaultIntent) else { throw RuntimeError.error(withMessage: "Invalid raw pixel buffer") }
|
|
165
|
+
+ return HybridCGImage(cgImage: image)
|
|
166
|
+
+ }
|
|
167
|
+
+ func loadFromRawPixelDataAsync(data: RawPixelData, allowGpu: Bool?) throws -> Promise<any HybridImageSpec> { Promise.async { try self.loadFromRawPixelData(data: data, allowGpu: allowGpu) } }
|
|
168
|
+
+ func loadFromEncodedImageData(data: EncodedImageData) throws -> any HybridImageSpec { try decode(data.buffer.toData(copyIfNeeded: true)) }
|
|
169
|
+
+ func loadFromEncodedImageDataAsync(data: EncodedImageData) throws -> Promise<any HybridImageSpec> { Promise.async { try self.loadFromEncodedImageData(data: data) } }
|
|
170
|
+
+ func loadFromThumbHash(thumbhash: ArrayBuffer) throws -> any HybridImageSpec { throw RuntimeError.error(withMessage: "ThumbHash is not implemented in the macOS prototype") }
|
|
171
|
+
+ func loadFromThumbHashAsync(thumbhash: ArrayBuffer) throws -> Promise<any HybridImageSpec> { Promise.async { try self.loadFromThumbHash(thumbhash: thumbhash) } }
|
|
172
|
+
+}
|
|
173
|
+
+
|
|
174
|
+
+final class HybridImageUtils: HybridImageUtilsSpec {
|
|
175
|
+
+ var supportsHeicLoading: Bool { (CGImageSourceCopyTypeIdentifiers() as! [String]).contains(UTType.heic.identifier) }
|
|
176
|
+
+ var supportsHeicWriting: Bool { (CGImageDestinationCopyTypeIdentifiers() as! [String]).contains(UTType.heic.identifier) }
|
|
177
|
+
+ func thumbHashToBase64String(thumbhash: ArrayBuffer) throws -> String { thumbhash.toData(copyIfNeeded: false).base64EncodedString() }
|
|
178
|
+
+ func thumbhashFromBase64String(thumbhashBase64: String) throws -> ArrayBuffer {
|
|
179
|
+
+ guard let data = Data(base64Encoded: thumbhashBase64) else { throw RuntimeError.error(withMessage: "Invalid base64") }
|
|
180
|
+
+ return try ArrayBuffer.copy(data: data)
|
|
181
|
+
+ }
|
|
182
|
+
+}
|
|
183
|
+
+
|
|
184
|
+
+final class HybridImageLoader: HybridImageLoaderSpec {
|
|
185
|
+
+ let load: () throws -> any HybridImageSpec
|
|
186
|
+
+ init(load: @escaping () throws -> any HybridImageSpec) { self.load = load; super.init() }
|
|
187
|
+
+ func loadImage() throws -> Promise<any HybridImageSpec> { Promise.async { try self.load() } }
|
|
188
|
+
+ func requestImage(forView: any HybridNitroImageViewSpec) throws { DispatchQueue.main.async { (forView as? HybridImageView)?.load(self) } }
|
|
189
|
+
+ func dropImage(forView: any HybridNitroImageViewSpec) throws { DispatchQueue.main.async { (forView as? HybridImageView)?.clear() } }
|
|
190
|
+
+}
|
|
191
|
+
+final class HybridImageLoaderFactory: HybridImageLoaderFactorySpec {
|
|
192
|
+
+ let factory = HybridImageFactory()
|
|
193
|
+
+ func createFileImageLoader(filePath: String) throws -> any HybridImageLoaderSpec { HybridImageLoader { try self.factory.loadFromFile(filePath: filePath) } }
|
|
194
|
+
+ func createResourceImageLoader(name: String) throws -> any HybridImageLoaderSpec { HybridImageLoader { try self.factory.loadFromResources(name: name) } }
|
|
195
|
+
+ func createSymbolImageLoader(symbolName: String) throws -> any HybridImageLoaderSpec { HybridImageLoader { try self.factory.loadFromSymbol(symbolName: symbolName) } }
|
|
196
|
+
+ func createRawPixelDataImageLoader(data: RawPixelData) throws -> any HybridImageLoaderSpec { HybridImageLoader { try self.factory.loadFromRawPixelData(data: data, allowGpu: false) } }
|
|
197
|
+
+ func createEncodedImageDataImageLoader(data: EncodedImageData) throws -> any HybridImageLoaderSpec { HybridImageLoader { try self.factory.loadFromEncodedImageData(data: data) } }
|
|
198
|
+
+}
|
|
199
|
+
+final class HybridImageView: HybridNitroImageViewSpec {
|
|
200
|
+
+ let view = NSView()
|
|
201
|
+
+ private var generation = 0
|
|
202
|
+
+ var resizeMode: ResizeMode? { didSet { view.layer?.contentsGravity = resizeMode == .contain ? .resizeAspect : resizeMode == .stretch ? .resize : resizeMode == .center ? .center : .resizeAspectFill } }
|
|
203
|
+
+ var recyclingKey: String? { didSet { if recyclingKey != oldValue { clear() } } }
|
|
204
|
+
+ var image: Variant__any_HybridImageSpec___any_HybridImageLoaderSpec_? { didSet {
|
|
205
|
+
+ clear()
|
|
206
|
+
+ switch image { case .first(let image): view.layer?.contents = (image as? NativeImage)?.cgImage; case .second(let loader): load(loader); case nil: break }
|
|
207
|
+
+ } }
|
|
208
|
+
+ override init() { super.init(); view.wantsLayer = true; view.layer?.masksToBounds = true; view.layer?.contentsGravity = .resizeAspectFill }
|
|
209
|
+
+ func clear() { generation += 1; view.layer?.contents = nil }
|
|
210
|
+
+ func load(_ loader: any HybridImageLoaderSpec) {
|
|
211
|
+
+ generation += 1; let token = generation
|
|
212
|
+
+ do { try loader.loadImage().then { [weak self] image in DispatchQueue.main.async { guard let self, self.generation == token else { return }; self.view.layer?.contents = (image as? NativeImage)?.cgImage } }.catch { [weak self] _ in DispatchQueue.main.async { guard let self, self.generation == token else { return }; self.clear() } } } catch { clear() }
|
|
213
|
+
+ }
|
|
214
|
+
+ func onDropView() { clear() }
|
|
215
|
+
+}
|
|
216
|
+
diff --git a/nitrogen/generated/ios/NitroImage+autolinking.rb b/nitrogen/generated/ios/NitroImage+autolinking.rb
|
|
217
|
+
index 06be8b7..2114874 100644
|
|
218
|
+
--- a/nitrogen/generated/ios/NitroImage+autolinking.rb
|
|
219
|
+
+++ b/nitrogen/generated/ios/NitroImage+autolinking.rb
|
|
220
|
+
@@ -54,6 +54,8 @@ def add_nitrogen_files(spec)
|
|
221
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
222
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
223
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
224
|
+
+ # Nitro's Fabric-only templates must not enter its Swift umbrella.
|
|
225
|
+
+ "HEADER_SEARCH_PATHS" => "$(inherited) $(PODS_ROOT)/Headers/Private",
|
|
226
|
+
# Enables stricter modular headers
|
|
227
|
+
"DEFINES_MODULE" => "YES",
|
|
228
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
229
|
+
diff --git a/nitrogen/generated/ios/c++/views/HybridNitroImageViewComponent.mm b/nitrogen/generated/ios/c++/views/HybridNitroImageViewComponent.mm
|
|
230
|
+
index 34ef3c1..b45a8b2 100644
|
|
231
|
+
--- a/nitrogen/generated/ios/c++/views/HybridNitroImageViewComponent.mm
|
|
232
|
+
+++ b/nitrogen/generated/ios/c++/views/HybridNitroImageViewComponent.mm
|
|
233
|
+
@@ -12,7 +12,12 @@
|
|
234
|
+
#import <React/RCTComponentViewFactory.h>
|
|
235
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
236
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
237
|
+
+#import <TargetConditionals.h>
|
|
238
|
+
+#if TARGET_OS_OSX
|
|
239
|
+
+#import <AppKit/AppKit.h>
|
|
240
|
+
+#else
|
|
241
|
+
#import <UIKit/UIKit.h>
|
|
242
|
+
+#endif
|
|
243
|
+
|
|
244
|
+
#import "HybridNitroImageViewSpecSwift.hpp"
|
|
245
|
+
#import "NitroImage-Swift-Cxx-Umbrella.hpp"
|
|
246
|
+
@@ -65,12 +70,21 @@ - (void) updateView {
|
|
247
|
+
|
|
248
|
+
// 2. Get UIView*
|
|
249
|
+
void* viewUnsafe = swiftPart.getView();
|
|
250
|
+
+ #if TARGET_OS_OSX
|
|
251
|
+
+ NSView* view = (__bridge_transfer NSView*) viewUnsafe;
|
|
252
|
+
+#else
|
|
253
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
254
|
+
+#endif
|
|
255
|
+
|
|
256
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
257
|
+
[self setContentView:view];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
+// RN < 0.82 does not call invalidate for views which opt out of recycling.
|
|
261
|
+
+- (void) dealloc {
|
|
262
|
+
+ if (_hybridView != nullptr) [self notifyOnDropView];
|
|
263
|
+
+}
|
|
264
|
+
+
|
|
265
|
+
- (void) notifyOnDropView {
|
|
266
|
+
// A recycled component can later be invalidated. Notify only once per mount.
|
|
267
|
+
if (_didDropView) {
|
|
268
|
+
diff --git a/nitrogen/generated/shared/c++/views/HybridNitroImageViewComponent.cpp b/nitrogen/generated/shared/c++/views/HybridNitroImageViewComponent.cpp
|
|
269
|
+
index a65f0aa..1de5350 100644
|
|
270
|
+
--- a/nitrogen/generated/shared/c++/views/HybridNitroImageViewComponent.cpp
|
|
271
|
+
+++ b/nitrogen/generated/shared/c++/views/HybridNitroImageViewComponent.cpp
|
|
272
|
+
@@ -7,6 +7,9 @@
|
|
273
|
+
|
|
274
|
+
#include "HybridNitroImageViewComponent.hpp"
|
|
275
|
+
|
|
276
|
+
+#if defined(__APPLE__)
|
|
277
|
+
+#include <TargetConditionals.h>
|
|
278
|
+
+#endif
|
|
279
|
+
#include <NitroModules/NitroHash.hpp>
|
|
280
|
+
#include <NitroModules/ReactProp.hpp>
|
|
281
|
+
|
|
282
|
+
@@ -19,7 +22,11 @@ namespace margelo::nitro::image::views {
|
|
283
|
+
HybridNitroImageViewProps::HybridNitroImageViewProps(const react::PropsParserContext& context,
|
|
284
|
+
const HybridNitroImageViewProps& sourceProps,
|
|
285
|
+
const react::RawProps& rawProps):
|
|
286
|
+
- react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
287
|
+
+ react::ViewProps(context, sourceProps, rawProps
|
|
288
|
+
+ #if !TARGET_OS_OSX
|
|
289
|
+
+ , filterObjectKeys
|
|
290
|
+
+ #endif
|
|
291
|
+
+ ),
|
|
292
|
+
image(nitro::ReactProp<std::optional<std::variant<std::shared_ptr<HybridImageSpec>, std::shared_ptr<HybridImageLoaderSpec>>>>::fromRawValue("NitroImageView", "image", rawProps, sourceProps.image)),
|
|
293
|
+
resizeMode(nitro::ReactProp<std::optional<ResizeMode>>::fromRawValue("NitroImageView", "resizeMode", rawProps, sourceProps.resizeMode)),
|
|
294
|
+
recyclingKey(nitro::ReactProp<std::optional<std::string>>::fromRawValue("NitroImageView", "recyclingKey", rawProps, sourceProps.recyclingKey)),
|
|
295
|
+
diff --git a/package.json b/package.json
|
|
296
|
+
index f22fe12..94be214 100644
|
|
297
|
+
--- a/package.json
|
|
298
|
+
+++ b/package.json
|
|
299
|
+
@@ -28,7 +28,8 @@
|
|
300
|
+
"app.plugin.js",
|
|
301
|
+
"nitro.json",
|
|
302
|
+
"*.podspec",
|
|
303
|
+
- "README.md"
|
|
304
|
+
+ "README.md",
|
|
305
|
+
+ "macos/**/*.swift"
|
|
306
|
+
],
|
|
307
|
+
"scripts": {
|
|
308
|
+
"build": "rm -rf tsconfig.tsbuildinfo && rm -rf lib && bun typecheck && bob build",
|
|
309
|
+
diff --git a/react-native.config.js b/react-native.config.js
|
|
310
|
+
index 3fdf8ea..9c4bc69 100644
|
|
311
|
+
--- a/react-native.config.js
|
|
312
|
+
+++ b/react-native.config.js
|
|
313
|
+
@@ -7,6 +7,7 @@ module.exports = {
|
|
314
|
+
* @type {import('@react-native-community/cli-types').IOSDependencyParams}
|
|
315
|
+
*/
|
|
316
|
+
ios: {},
|
|
317
|
+
+ macos: { podspecPath: __dirname + "/NitroImage.podspec" },
|
|
318
|
+
/**
|
|
319
|
+
* @type {import('@react-native-community/cli-types').AndroidDependencyParams}
|
|
320
|
+
*/
|