@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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#import <AppKit/AppKit.h>
|
|
2
|
+
#import <React/RCTConvert.h>
|
|
3
|
+
#import <React/RCTView.h>
|
|
4
|
+
#import <React/RCTViewManager.h>
|
|
5
|
+
|
|
6
|
+
@interface SparkGlassView : RCTView
|
|
7
|
+
@property (nonatomic, copy) NSString *glassStyle;
|
|
8
|
+
@property (nonatomic, strong) NSColor *tintColor;
|
|
9
|
+
@end
|
|
10
|
+
|
|
11
|
+
@implementation SparkGlassView {
|
|
12
|
+
NSView *_contentContainer;
|
|
13
|
+
NSView *_glassEffectView;
|
|
14
|
+
}
|
|
15
|
+
- (instancetype)initWithFrame:(NSRect)frame {
|
|
16
|
+
if ((self = [super initWithFrame:frame])) {
|
|
17
|
+
_glassStyle = @"regular";
|
|
18
|
+
_contentContainer = [[NSView alloc] initWithFrame:self.bounds];
|
|
19
|
+
_contentContainer.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
20
|
+
if (@available(macOS 26.0, *)) {
|
|
21
|
+
NSGlassEffectView *glass = [[NSGlassEffectView alloc] initWithFrame:self.bounds];
|
|
22
|
+
glass.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
23
|
+
glass.contentView = _contentContainer;
|
|
24
|
+
_glassEffectView = glass;
|
|
25
|
+
[self addSubview:glass];
|
|
26
|
+
} else {
|
|
27
|
+
[self addSubview:_contentContainer];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
- (BOOL)isFlipped { return YES; }
|
|
33
|
+
- (BOOL)mouseDownCanMoveWindow { return YES; }
|
|
34
|
+
- (void)layout {
|
|
35
|
+
[super layout];
|
|
36
|
+
_contentContainer.frame = self.bounds;
|
|
37
|
+
_glassEffectView.frame = self.bounds;
|
|
38
|
+
}
|
|
39
|
+
- (void)insertReactSubview:(NSView *)subview atIndex:(NSInteger)index {
|
|
40
|
+
[super insertReactSubview:subview atIndex:index];
|
|
41
|
+
[_contentContainer addSubview:subview];
|
|
42
|
+
}
|
|
43
|
+
- (void)didUpdateReactSubviews {
|
|
44
|
+
// React children are hosted by the native glass content view.
|
|
45
|
+
}
|
|
46
|
+
- (void)setGlassStyle:(NSString *)style {
|
|
47
|
+
_glassStyle = [style copy];
|
|
48
|
+
if (@available(macOS 26.0, *)) {
|
|
49
|
+
((NSGlassEffectView *)_glassEffectView).style = [style isEqualToString:@"clear"] ? NSGlassEffectViewStyleClear : NSGlassEffectViewStyleRegular;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
- (void)setTintColor:(NSColor *)color {
|
|
53
|
+
_tintColor = color;
|
|
54
|
+
if (@available(macOS 26.0, *)) ((NSGlassEffectView *)_glassEffectView).tintColor = color;
|
|
55
|
+
}
|
|
56
|
+
@end
|
|
57
|
+
|
|
58
|
+
@interface RNGlassEffectView : RCTViewManager
|
|
59
|
+
@end
|
|
60
|
+
@implementation RNGlassEffectView
|
|
61
|
+
RCT_EXPORT_MODULE()
|
|
62
|
+
+ (BOOL)requiresMainQueueSetup { return YES; }
|
|
63
|
+
- (NSView *)view { return [[SparkGlassView alloc] initWithFrame:NSZeroRect]; }
|
|
64
|
+
|
|
65
|
+
RCT_EXPORT_VIEW_PROPERTY(glassStyle, NSString)
|
|
66
|
+
// UIColor metadata makes React Native process ColorValue before NSColor conversion.
|
|
67
|
+
RCT_CUSTOM_VIEW_PROPERTY(tintColor, UIColor, SparkGlassView)
|
|
68
|
+
{
|
|
69
|
+
view.tintColor = json ? [RCTConvert NSColor:json] : nil;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@end
|
package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <TargetConditionals.h>
|
|
3
|
+
|
|
4
|
+
#if TARGET_OS_OSX
|
|
5
|
+
#import <AppKit/AppKit.h>
|
|
6
|
+
#else
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface RNNativeSegmentedControl : RCTViewComponentView
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_END
|
package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#import "RNNativeSegmentedControl.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNSparkUISpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/RNSparkUISpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/RNSparkUISpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/RNSparkUISpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
@interface RNNativeSegmentedControl () <RCTNativeSegmentedControlViewProtocol>
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation RNNativeSegmentedControl {
|
|
14
|
+
#if TARGET_OS_OSX
|
|
15
|
+
NSSegmentedControl *_segmentedControl;
|
|
16
|
+
NSArray<NSString *> *_values;
|
|
17
|
+
NSString *_segmentsJson;
|
|
18
|
+
NSString *_value;
|
|
19
|
+
BOOL _isUpdatingSelection;
|
|
20
|
+
#else
|
|
21
|
+
UIView *_segmentedControl;
|
|
22
|
+
#endif
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
- (instancetype)init
|
|
26
|
+
{
|
|
27
|
+
if (self = [super init]) {
|
|
28
|
+
_props = std::make_shared<const NativeSegmentedControlProps>();
|
|
29
|
+
#if TARGET_OS_OSX
|
|
30
|
+
_values = @[];
|
|
31
|
+
_segmentsJson = @"";
|
|
32
|
+
_value = @"";
|
|
33
|
+
_segmentedControl = [[NSSegmentedControl alloc] initWithFrame:NSZeroRect];
|
|
34
|
+
_segmentedControl.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
35
|
+
_segmentedControl.controlSize = NSControlSizeRegular;
|
|
36
|
+
_segmentedControl.segmentStyle = NSSegmentStyleAutomatic;
|
|
37
|
+
_segmentedControl.trackingMode = NSSegmentSwitchTrackingSelectOne;
|
|
38
|
+
_segmentedControl.target = self;
|
|
39
|
+
_segmentedControl.action = @selector(handleSelectionChange:);
|
|
40
|
+
[self addSubview:_segmentedControl];
|
|
41
|
+
#else
|
|
42
|
+
_segmentedControl = [UIView new];
|
|
43
|
+
[self addSubview:_segmentedControl];
|
|
44
|
+
#endif
|
|
45
|
+
}
|
|
46
|
+
return self;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#if TARGET_OS_OSX
|
|
50
|
+
- (BOOL)isFlipped
|
|
51
|
+
{
|
|
52
|
+
return YES;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (NSArray<NSDictionary *> *)parseSegmentsJson:(NSString *)segmentsJson
|
|
56
|
+
{
|
|
57
|
+
NSData *data = [segmentsJson dataUsingEncoding:NSUTF8StringEncoding];
|
|
58
|
+
if (!data) {
|
|
59
|
+
return @[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
id parsedSegments = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
63
|
+
return [parsedSegments isKindOfClass:NSArray.class] ? parsedSegments : @[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)reloadSegments:(NSArray<NSDictionary *> *)segments
|
|
67
|
+
{
|
|
68
|
+
NSMutableArray<NSString *> *values = [NSMutableArray new];
|
|
69
|
+
NSMutableArray<NSString *> *labels = [NSMutableArray new];
|
|
70
|
+
|
|
71
|
+
for (NSDictionary *segment in segments) {
|
|
72
|
+
if (![segment isKindOfClass:NSDictionary.class]) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
NSString *label = [segment[@"label"] isKindOfClass:NSString.class] ? segment[@"label"] : @"";
|
|
77
|
+
NSString *value = [segment[@"value"] isKindOfClass:NSString.class] ? segment[@"value"] : label;
|
|
78
|
+
if (label.length == 0 && value.length == 0) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[labels addObject:label.length > 0 ? label : value];
|
|
83
|
+
[values addObject:value];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_values = values;
|
|
87
|
+
_segmentedControl.segmentCount = labels.count;
|
|
88
|
+
|
|
89
|
+
CGFloat totalWidth = 0;
|
|
90
|
+
NSFont *font = _segmentedControl.font ?: [NSFont systemFontOfSize:[NSFont systemFontSize]];
|
|
91
|
+
for (NSInteger index = 0; index < labels.count; index += 1) {
|
|
92
|
+
NSString *label = labels[index];
|
|
93
|
+
[_segmentedControl setLabel:label forSegment:index];
|
|
94
|
+
CGFloat segmentWidth = MAX(64, [label sizeWithAttributes:@{NSFontAttributeName: font}].width + 28);
|
|
95
|
+
[_segmentedControl setWidth:segmentWidth forSegment:index];
|
|
96
|
+
totalWidth += segmentWidth;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
CGRect frame = _segmentedControl.frame;
|
|
100
|
+
frame.size.width = totalWidth;
|
|
101
|
+
frame.size.height = MAX(28, _segmentedControl.fittingSize.height);
|
|
102
|
+
_segmentedControl.frame = frame;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
- (void)selectValue:(NSString *)value
|
|
106
|
+
{
|
|
107
|
+
_isUpdatingSelection = YES;
|
|
108
|
+
NSInteger selectedIndex = -1;
|
|
109
|
+
for (NSInteger index = 0; index < _values.count; index += 1) {
|
|
110
|
+
if ([_values[index] isEqualToString:value]) {
|
|
111
|
+
selectedIndex = index;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_segmentedControl.selectedSegment = selectedIndex >= 0 ? selectedIndex : (_values.count > 0 ? 0 : -1);
|
|
117
|
+
_isUpdatingSelection = NO;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
- (void)handleSelectionChange:(id)sender
|
|
121
|
+
{
|
|
122
|
+
if (_isUpdatingSelection || !_segmentedControl.enabled) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
NSInteger selectedIndex = _segmentedControl.selectedSegment;
|
|
127
|
+
NSString *value = selectedIndex >= 0 && selectedIndex < _values.count ? _values[selectedIndex] : @"";
|
|
128
|
+
_value = value ?: @"";
|
|
129
|
+
|
|
130
|
+
const auto eventEmitter = std::static_pointer_cast<const NativeSegmentedControlEventEmitter>(_eventEmitter);
|
|
131
|
+
if (eventEmitter) {
|
|
132
|
+
eventEmitter->onValueChange(NativeSegmentedControlEventEmitter::OnValueChange{.value = _value.UTF8String ?: ""});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
#endif
|
|
136
|
+
|
|
137
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
138
|
+
{
|
|
139
|
+
const auto &newProps = *std::static_pointer_cast<NativeSegmentedControlProps const>(props);
|
|
140
|
+
#if TARGET_OS_OSX
|
|
141
|
+
NSString *nextSegmentsJson = [NSString stringWithUTF8String:newProps.segmentsJson.c_str()];
|
|
142
|
+
NSString *nextValue = [NSString stringWithUTF8String:newProps.value.c_str()];
|
|
143
|
+
BOOL segmentsDidChange = ![_segmentsJson isEqualToString:nextSegmentsJson];
|
|
144
|
+
|
|
145
|
+
if (segmentsDidChange) {
|
|
146
|
+
_segmentsJson = nextSegmentsJson;
|
|
147
|
+
[self reloadSegments:[self parseSegmentsJson:_segmentsJson]];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (segmentsDidChange || ![_value isEqualToString:nextValue]) {
|
|
151
|
+
_value = nextValue;
|
|
152
|
+
[self selectValue:_value];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_segmentedControl.enabled = newProps.enabled;
|
|
156
|
+
_segmentedControl.accessibilityLabel = [NSString stringWithUTF8String:newProps.accessibilityLabel.c_str()];
|
|
157
|
+
_segmentedControl.accessibilityIdentifier = [NSString stringWithUTF8String:newProps.testId.c_str()];
|
|
158
|
+
#endif
|
|
159
|
+
[super updateProps:props oldProps:oldProps];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (void)prepareForRecycle
|
|
163
|
+
{
|
|
164
|
+
[super prepareForRecycle];
|
|
165
|
+
#if TARGET_OS_OSX
|
|
166
|
+
_values = @[];
|
|
167
|
+
_segmentsJson = @"";
|
|
168
|
+
_value = @"";
|
|
169
|
+
_isUpdatingSelection = NO;
|
|
170
|
+
_segmentedControl.segmentCount = 0;
|
|
171
|
+
_segmentedControl.enabled = YES;
|
|
172
|
+
_segmentedControl.accessibilityLabel = nil; _segmentedControl.accessibilityIdentifier = nil;
|
|
173
|
+
#endif
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (void)layoutSubviews
|
|
177
|
+
{
|
|
178
|
+
[super layoutSubviews];
|
|
179
|
+
_segmentedControl.frame = self.bounds;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
183
|
+
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
184
|
+
{
|
|
185
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
186
|
+
[self layoutSubviews];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
190
|
+
{
|
|
191
|
+
return concreteComponentDescriptorProvider<NativeSegmentedControlComponentDescriptor>();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <TargetConditionals.h>
|
|
3
|
+
|
|
4
|
+
#if TARGET_OS_OSX
|
|
5
|
+
#import <AppKit/AppKit.h>
|
|
6
|
+
#else
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface RNNativeSelect : RCTViewComponentView
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#import "RNNativeSelect.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNSparkUISpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/RNSparkUISpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/RNSparkUISpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/RNSparkUISpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
@interface RNNativeSelect () <RCTNativeSelectViewProtocol>
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation RNNativeSelect {
|
|
14
|
+
#if TARGET_OS_OSX
|
|
15
|
+
NSPopUpButton *_popUpButton;
|
|
16
|
+
NSString *_itemsJson;
|
|
17
|
+
NSString *_value;
|
|
18
|
+
BOOL _isUpdatingSelection;
|
|
19
|
+
#else
|
|
20
|
+
UIView *_popUpButton;
|
|
21
|
+
#endif
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (instancetype)init
|
|
25
|
+
{
|
|
26
|
+
if (self = [super init]) {
|
|
27
|
+
_props = std::make_shared<const NativeSelectProps>();
|
|
28
|
+
#if TARGET_OS_OSX
|
|
29
|
+
_itemsJson = @"";
|
|
30
|
+
_value = @"";
|
|
31
|
+
_popUpButton = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO];
|
|
32
|
+
_popUpButton.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
33
|
+
_popUpButton.bordered = YES;
|
|
34
|
+
_popUpButton.controlSize = NSControlSizeRegular;
|
|
35
|
+
_popUpButton.font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
|
|
36
|
+
_popUpButton.target = self;
|
|
37
|
+
_popUpButton.action = @selector(handleSelectionChange:);
|
|
38
|
+
[self addSubview:_popUpButton];
|
|
39
|
+
#else
|
|
40
|
+
_popUpButton = [UIView new];
|
|
41
|
+
[self addSubview:_popUpButton];
|
|
42
|
+
#endif
|
|
43
|
+
}
|
|
44
|
+
return self;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#if TARGET_OS_OSX
|
|
48
|
+
- (BOOL)isFlipped
|
|
49
|
+
{
|
|
50
|
+
return YES;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
- (NSArray<NSDictionary *> *)parseItemsJson:(NSString *)itemsJson
|
|
54
|
+
{
|
|
55
|
+
NSData *data = [itemsJson dataUsingEncoding:NSUTF8StringEncoding];
|
|
56
|
+
if (!data) {
|
|
57
|
+
return @[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
id parsedItems = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
61
|
+
return [parsedItems isKindOfClass:NSArray.class] ? parsedItems : @[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)reloadItems:(NSArray<NSDictionary *> *)items
|
|
65
|
+
{
|
|
66
|
+
[_popUpButton removeAllItems];
|
|
67
|
+
|
|
68
|
+
for (NSDictionary *item in items) {
|
|
69
|
+
if (![item isKindOfClass:NSDictionary.class]) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
NSString *label = [item[@"label"] isKindOfClass:NSString.class] ? item[@"label"] : @"";
|
|
74
|
+
NSString *value = [item[@"value"] isKindOfClass:NSString.class] ? item[@"value"] : label;
|
|
75
|
+
if (label.length == 0 && value.length == 0) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// addItemWithTitle deduplicates labels; identity belongs to the value.
|
|
80
|
+
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:label action:nil keyEquivalent:@""];
|
|
81
|
+
menuItem.representedObject = value;
|
|
82
|
+
[_popUpButton.menu addItem:menuItem];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)selectValue:(NSString *)value
|
|
87
|
+
{
|
|
88
|
+
_isUpdatingSelection = YES;
|
|
89
|
+
NSInteger selectedIndex = -1;
|
|
90
|
+
for (NSInteger index = 0; index < _popUpButton.numberOfItems; index += 1) {
|
|
91
|
+
NSMenuItem *item = [_popUpButton itemAtIndex:index];
|
|
92
|
+
NSString *itemValue = [item.representedObject isKindOfClass:NSString.class] ? item.representedObject : @"";
|
|
93
|
+
if ([itemValue isEqualToString:value]) {
|
|
94
|
+
selectedIndex = index;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (selectedIndex >= 0) {
|
|
100
|
+
[_popUpButton selectItemAtIndex:selectedIndex];
|
|
101
|
+
} else if (_popUpButton.numberOfItems > 0) {
|
|
102
|
+
[_popUpButton selectItemAtIndex:0];
|
|
103
|
+
}
|
|
104
|
+
_isUpdatingSelection = NO;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)handleSelectionChange:(id)sender
|
|
108
|
+
{
|
|
109
|
+
if (_isUpdatingSelection || !_popUpButton.enabled) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
NSMenuItem *selectedItem = _popUpButton.selectedItem;
|
|
114
|
+
NSString *value = [selectedItem.representedObject isKindOfClass:NSString.class] ? selectedItem.representedObject : @"";
|
|
115
|
+
_value = value ?: @"";
|
|
116
|
+
|
|
117
|
+
const auto eventEmitter = std::static_pointer_cast<const NativeSelectEventEmitter>(_eventEmitter);
|
|
118
|
+
if (eventEmitter) {
|
|
119
|
+
eventEmitter->onValueChange(NativeSelectEventEmitter::OnValueChange{.value = _value.UTF8String ?: ""});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
#endif
|
|
123
|
+
|
|
124
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
125
|
+
{
|
|
126
|
+
const auto &newProps = *std::static_pointer_cast<NativeSelectProps const>(props);
|
|
127
|
+
#if TARGET_OS_OSX
|
|
128
|
+
NSString *nextItemsJson = [NSString stringWithUTF8String:newProps.itemsJson.c_str()];
|
|
129
|
+
NSString *nextValue = [NSString stringWithUTF8String:newProps.value.c_str()];
|
|
130
|
+
BOOL itemsDidChange = ![_itemsJson isEqualToString:nextItemsJson];
|
|
131
|
+
|
|
132
|
+
if (itemsDidChange) {
|
|
133
|
+
_itemsJson = nextItemsJson;
|
|
134
|
+
[self reloadItems:[self parseItemsJson:_itemsJson]];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (itemsDidChange || ![_value isEqualToString:nextValue]) {
|
|
138
|
+
_value = nextValue;
|
|
139
|
+
[self selectValue:_value];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_popUpButton.enabled = newProps.enabled;
|
|
143
|
+
_popUpButton.accessibilityLabel = [NSString stringWithUTF8String:newProps.accessibilityLabel.c_str()];
|
|
144
|
+
_popUpButton.accessibilityIdentifier = [NSString stringWithUTF8String:newProps.testId.c_str()];
|
|
145
|
+
#endif
|
|
146
|
+
[super updateProps:props oldProps:oldProps];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void)prepareForRecycle
|
|
150
|
+
{
|
|
151
|
+
[super prepareForRecycle];
|
|
152
|
+
#if TARGET_OS_OSX
|
|
153
|
+
_itemsJson = @"";
|
|
154
|
+
_value = @"";
|
|
155
|
+
_isUpdatingSelection = NO;
|
|
156
|
+
[_popUpButton removeAllItems];
|
|
157
|
+
_popUpButton.enabled = YES;
|
|
158
|
+
_popUpButton.accessibilityLabel = nil; _popUpButton.accessibilityIdentifier = nil;
|
|
159
|
+
#endif
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
- (void)layoutSubviews
|
|
163
|
+
{
|
|
164
|
+
[super layoutSubviews];
|
|
165
|
+
_popUpButton.frame = self.bounds;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
169
|
+
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
170
|
+
{
|
|
171
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
172
|
+
[self layoutSubviews];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
176
|
+
{
|
|
177
|
+
return concreteComponentDescriptorProvider<NativeSelectComponentDescriptor>();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <TargetConditionals.h>
|
|
3
|
+
|
|
4
|
+
#if TARGET_OS_OSX
|
|
5
|
+
#import <AppKit/AppKit.h>
|
|
6
|
+
#else
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface RNSFSymbol : RCTViewComponentView
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#import "RNSFSymbol.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/RNSparkUISpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/RNSparkUISpec/Props.h>
|
|
5
|
+
#import <react/renderer/components/RNSparkUISpec/EventEmitters.h>
|
|
6
|
+
#import <react/renderer/components/RNSparkUISpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
@interface RNSFSymbol () <RCTSFSymbolViewProtocol>
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation RNSFSymbol {
|
|
14
|
+
#if TARGET_OS_OSX
|
|
15
|
+
NSImageView *_imageView;
|
|
16
|
+
#else
|
|
17
|
+
UIImageView *_imageView;
|
|
18
|
+
#endif
|
|
19
|
+
NSString *_symbolName;
|
|
20
|
+
NSString *_reportedMissingName;
|
|
21
|
+
CGFloat _size;
|
|
22
|
+
CGFloat _yOffset;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
- (instancetype)init
|
|
26
|
+
{
|
|
27
|
+
if (self = [super init]) {
|
|
28
|
+
_props = std::make_shared<const SFSymbolProps>();
|
|
29
|
+
_symbolName = @"";
|
|
30
|
+
_size = 24;
|
|
31
|
+
_yOffset = 0;
|
|
32
|
+
#if TARGET_OS_OSX
|
|
33
|
+
_imageView = [NSImageView new];
|
|
34
|
+
_imageView.imageScaling = NSImageScaleProportionallyDown;
|
|
35
|
+
#else
|
|
36
|
+
_imageView = [UIImageView new];
|
|
37
|
+
_imageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
38
|
+
#endif
|
|
39
|
+
[self addSubview:_imageView];
|
|
40
|
+
}
|
|
41
|
+
return self;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
45
|
+
{
|
|
46
|
+
const auto &newProps = *std::static_pointer_cast<SFSymbolProps const>(props);
|
|
47
|
+
_symbolName = [NSString stringWithUTF8String:newProps.name.c_str()];
|
|
48
|
+
_size = newProps.size == 0 ? 24 : newProps.size;
|
|
49
|
+
_yOffset = newProps.yOffset;
|
|
50
|
+
|
|
51
|
+
#if TARGET_OS_OSX
|
|
52
|
+
NSString *scale = [NSString stringWithUTF8String:newProps.scale.c_str()];
|
|
53
|
+
NSImageSymbolScale symbolScale = NSImageSymbolScaleMedium;
|
|
54
|
+
if ([scale isEqualToString:@"small"]) {
|
|
55
|
+
symbolScale = NSImageSymbolScaleSmall;
|
|
56
|
+
} else if ([scale isEqualToString:@"large"]) {
|
|
57
|
+
symbolScale = NSImageSymbolScaleLarge;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
NSImage *image = _symbolName.length > 0
|
|
61
|
+
? [NSImage imageWithSystemSymbolName:_symbolName accessibilityDescription:newProps.accessibilityLabel.empty() ? nil : [NSString stringWithUTF8String:newProps.accessibilityLabel.c_str()]]
|
|
62
|
+
: nil;
|
|
63
|
+
[image setTemplate:YES];
|
|
64
|
+
_imageView.image = image;
|
|
65
|
+
_imageView.symbolConfiguration = [NSImageSymbolConfiguration configurationWithPointSize:_size
|
|
66
|
+
weight:NSFontWeightRegular
|
|
67
|
+
scale:symbolScale];
|
|
68
|
+
_imageView.contentTintColor = newProps.color
|
|
69
|
+
? [NSColor colorWithRed:(CGFloat)redFromColor(newProps.color) / 255.0
|
|
70
|
+
green:(CGFloat)greenFromColor(newProps.color) / 255.0
|
|
71
|
+
blue:(CGFloat)blueFromColor(newProps.color) / 255.0
|
|
72
|
+
alpha:(CGFloat)alphaFromColor(newProps.color) / 255.0]
|
|
73
|
+
: NSColor.labelColor;
|
|
74
|
+
#else
|
|
75
|
+
if (@available(iOS 13.0, *)) {
|
|
76
|
+
UIImageSymbolScale symbolScale = UIImageSymbolScaleMedium;
|
|
77
|
+
NSString *scale = [NSString stringWithUTF8String:newProps.scale.c_str()];
|
|
78
|
+
if ([scale isEqualToString:@"small"]) {
|
|
79
|
+
symbolScale = UIImageSymbolScaleSmall;
|
|
80
|
+
} else if ([scale isEqualToString:@"large"]) {
|
|
81
|
+
symbolScale = UIImageSymbolScaleLarge;
|
|
82
|
+
}
|
|
83
|
+
UIImageSymbolConfiguration *configuration =
|
|
84
|
+
[UIImageSymbolConfiguration configurationWithPointSize:_size weight:UIImageSymbolWeightRegular scale:symbolScale];
|
|
85
|
+
_imageView.image = [[[UIImage systemImageNamed:_symbolName] imageWithConfiguration:configuration]
|
|
86
|
+
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
|
87
|
+
_imageView.tintColor = newProps.color
|
|
88
|
+
? [UIColor colorWithRed:(CGFloat)redFromColor(newProps.color) / 255.0
|
|
89
|
+
green:(CGFloat)greenFromColor(newProps.color) / 255.0
|
|
90
|
+
blue:(CGFloat)blueFromColor(newProps.color) / 255.0
|
|
91
|
+
alpha:(CGFloat)alphaFromColor(newProps.color) / 255.0]
|
|
92
|
+
: UIColor.labelColor;
|
|
93
|
+
}
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
[self setNeedsLayout:YES];
|
|
97
|
+
[super updateProps:props oldProps:oldProps];
|
|
98
|
+
[self reportMissingSymbol];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (void)reportMissingSymbol
|
|
102
|
+
{
|
|
103
|
+
if (_imageView.image) { _reportedMissingName = nil; return; }
|
|
104
|
+
if (!_symbolName.length || [_reportedMissingName isEqualToString:_symbolName]) return;
|
|
105
|
+
const auto emitter = std::static_pointer_cast<const SFSymbolEventEmitter>(_eventEmitter);
|
|
106
|
+
if (!emitter) return;
|
|
107
|
+
_reportedMissingName = [_symbolName copy];
|
|
108
|
+
NSString *message = [@"SF Symbol is unavailable on this OS: " stringByAppendingString:_symbolName];
|
|
109
|
+
emitter->onSymbolError({ .name = _symbolName.UTF8String ?: "", .message = message.UTF8String ?: "" });
|
|
110
|
+
}
|
|
111
|
+
- (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
|
|
112
|
+
{
|
|
113
|
+
[super updateEventEmitter:eventEmitter];
|
|
114
|
+
[self reportMissingSymbol];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (void)prepareForRecycle
|
|
118
|
+
{
|
|
119
|
+
[super prepareForRecycle];
|
|
120
|
+
|
|
121
|
+
_symbolName = @""; _reportedMissingName = nil;
|
|
122
|
+
_size = 24;
|
|
123
|
+
_yOffset = 0;
|
|
124
|
+
_imageView.image = nil;
|
|
125
|
+
#if TARGET_OS_OSX
|
|
126
|
+
_imageView.symbolConfiguration = nil;
|
|
127
|
+
_imageView.contentTintColor = NSColor.labelColor;
|
|
128
|
+
#else
|
|
129
|
+
_imageView.tintColor = UIColor.labelColor;
|
|
130
|
+
#endif
|
|
131
|
+
[self setNeedsLayout:YES];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
- (void)layoutSubviews
|
|
135
|
+
{
|
|
136
|
+
[super layoutSubviews];
|
|
137
|
+
CGFloat side = MIN(self.bounds.size.width, self.bounds.size.height);
|
|
138
|
+
CGFloat x = (self.bounds.size.width - side) / 2;
|
|
139
|
+
CGFloat y = (self.bounds.size.height - side) / 2 + _yOffset;
|
|
140
|
+
_imageView.frame = CGRectMake(x, y, side, side);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
|
|
144
|
+
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
|
|
145
|
+
{
|
|
146
|
+
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
|
|
147
|
+
[self layoutSubviews];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
151
|
+
{
|
|
152
|
+
return concreteComponentDescriptorProvider<SFSymbolComponentDescriptor>();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <TargetConditionals.h>
|
|
3
|
+
|
|
4
|
+
#if TARGET_OS_OSX
|
|
5
|
+
#import <AppKit/AppKit.h>
|
|
6
|
+
#else
|
|
7
|
+
#import <UIKit/UIKit.h>
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface RNSidebar : RCTViewComponentView
|
|
13
|
+
@end
|
|
14
|
+
|
|
15
|
+
@interface RNSidebarItem : RCTViewComponentView
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
NS_ASSUME_NONNULL_END
|