@legendapp/spark 0.0.2 → 0.0.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/init-template.cjs +7 -1
- package/package.json +10 -5
- package/patches/dependencies.json +252 -0
- package/patches/expo-application@55.0.19.patch +54 -0
- package/patches/expo-blur@55.0.18.patch +130 -0
- package/patches/expo-device@55.0.21.patch +149 -0
- package/patches/expo-font@55.0.8.patch +55 -0
- package/patches/expo-glass-effect@55.0.11.patch +304 -0
- package/patches/expo-haptics@55.0.18.patch +54 -0
- package/patches/expo-image-manipulator@55.0.21.patch +312 -0
- package/patches/expo-image-picker@55.0.24.patch +327 -0
- package/patches/expo-image@55.0.11.patch +158 -0
- package/patches/expo-keep-awake@55.0.8.patch +41 -0
- package/patches/expo-localization@55.0.19.patch +32 -0
- package/patches/expo-location@55.1.15.patch +190 -0
- package/patches/expo-symbols@55.0.9.patch +286 -0
- package/patches/expo-system-ui@55.0.22.patch +61 -0
- package/patches/expo-web-browser@55.0.20.patch +13 -0
- package/patches/react-native-app-logs@0.3.1.patch +20 -0
- package/patches/react-native-blurhash@2.1.3.patch +318 -0
- package/patches/react-native-community-blur@4.4.1.patch +415 -0
- package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
- package/patches/react-native-fast-image@10.9.9.patch +131 -0
- package/patches/react-native-graph@1.4.0.patch +157 -0
- package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
- package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
- package/patches/react-native-mmkv@4.3.2.patch +40 -0
- package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
- package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/react-native-quick-base64@3.0.1.patch +13 -0
- package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
- package/patches/react-native-release-profiler@0.4.5.patch +37 -0
- package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
- package/patches/react-native-screens@4.23.0.patch +160 -0
- package/patches/react-native-svg@15.15.3.patch +31 -0
- package/patches/react-native-unistyles@3.6.0.patch +203 -0
- package/patches/react-native-worklets-core@1.6.3.patch +13 -0
- package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
- package/patches/registry.json +615 -0
- package/patches/sentry-react-native@8.32.0.patch +76 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +150 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +85 -0
- package/skills/spark/ui.md +57 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +139 -104
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +10 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +20 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +20 -20
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +315 -68
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +26 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +418 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +5 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +63 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +12 -7
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +35 -13
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +39 -6
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
diff --git a/Unistyles.podspec b/Unistyles.podspec
|
|
2
|
+
index adf83bf..ba3ba7f 100644
|
|
3
|
+
--- a/Unistyles.podspec
|
|
4
|
+
+++ b/Unistyles.podspec
|
|
5
|
+
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.license = package["license"]
|
|
7
|
+
s.authors = package["author"]
|
|
8
|
+
|
|
9
|
+
- s.platforms = { :ios => min_ios_version_supported }
|
|
10
|
+
+ s.platforms = { :ios => min_ios_version_supported, :osx => "14.0" }
|
|
11
|
+
s.source = { :git => package["repository"], :tag => "#{s.version}" }
|
|
12
|
+
|
|
13
|
+
s.source_files = [
|
|
14
|
+
diff --git a/ios/Extensions.swift b/ios/Extensions.swift
|
|
15
|
+
index 9b38a32..a707de7 100644
|
|
16
|
+
--- a/ios/Extensions.swift
|
|
17
|
+
+++ b/ios/Extensions.swift
|
|
18
|
+
@@ -1,5 +1,7 @@
|
|
19
|
+
import Foundation
|
|
20
|
+
|
|
21
|
+
+#if os(iOS)
|
|
22
|
+
+
|
|
23
|
+
extension UIColor {
|
|
24
|
+
// int is universal way of color representation
|
|
25
|
+
// iOS API expects UIColor, so we need to translate it
|
|
26
|
+
@@ -11,3 +13,4 @@ extension UIColor {
|
|
27
|
+
return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
+#endif
|
|
31
|
+
diff --git a/ios/NativePlatform+keyboard.swift b/ios/NativePlatform+keyboard.swift
|
|
32
|
+
index 0237e76..b95f651 100644
|
|
33
|
+
--- a/ios/NativePlatform+keyboard.swift
|
|
34
|
+
+++ b/ios/NativePlatform+keyboard.swift
|
|
35
|
+
@@ -1,3 +1,4 @@
|
|
36
|
+
+#if os(iOS)
|
|
37
|
+
import Foundation
|
|
38
|
+
|
|
39
|
+
struct KeyboardAnimation {
|
|
40
|
+
@@ -103,3 +104,5 @@ extension NativeIOSPlatform {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
+
|
|
45
|
+
+#endif
|
|
46
|
+
diff --git a/ios/NativePlatform+macos.swift b/ios/NativePlatform+macos.swift
|
|
47
|
+
new file mode 100644
|
|
48
|
+
index 0000000..ac219cf
|
|
49
|
+
--- /dev/null
|
|
50
|
+
+++ b/ios/NativePlatform+macos.swift
|
|
51
|
+
@@ -0,0 +1,124 @@
|
|
52
|
+
+#if os(macOS)
|
|
53
|
+
+
|
|
54
|
+
+import AppKit
|
|
55
|
+
+import NitroModules
|
|
56
|
+
+
|
|
57
|
+
+// AppKit counterpart of NativeIOSPlatform: a desktop window has no safe-area, status bar,
|
|
58
|
+
+// navigation bar or software keyboard, so those report zero; the window is the "screen".
|
|
59
|
+
+class NativeMacOSPlatform: HybridNativePlatformSpec {
|
|
60
|
+
+ var miniRuntime: UnistylesNativeMiniRuntime?
|
|
61
|
+
+ var dependencyListeners: Array<(Array<UnistyleDependency>, UnistylesNativeMiniRuntime) -> Void> = []
|
|
62
|
+
+ var observers: [NSObjectProtocol] = []
|
|
63
|
+
+ var appearanceObservation: NSKeyValueObservation?
|
|
64
|
+
+
|
|
65
|
+
+ override init() {
|
|
66
|
+
+ super.init()
|
|
67
|
+
+ self.miniRuntime = onMain { self.buildMiniRuntime() }
|
|
68
|
+
+ let center = NotificationCenter.default
|
|
69
|
+
+ for name in [NSWindow.didResizeNotification, NSWindow.didBecomeMainNotification, NSWindow.didChangeBackingPropertiesNotification] {
|
|
70
|
+
+ observers.append(center.addObserver(forName: name, object: nil, queue: .main) { [weak self] _ in self?.onNativePlatformChange() })
|
|
71
|
+
+ }
|
|
72
|
+
+ appearanceObservation = NSApplication.shared.observe(\.effectiveAppearance) { [weak self] _, _ in
|
|
73
|
+
+ DispatchQueue.main.async { self?.onNativePlatformChange() }
|
|
74
|
+
+ }
|
|
75
|
+
+ }
|
|
76
|
+
+
|
|
77
|
+
+ deinit {
|
|
78
|
+
+ observers.forEach { NotificationCenter.default.removeObserver($0) }
|
|
79
|
+
+ }
|
|
80
|
+
+
|
|
81
|
+
+ func onMain<T>(_ body: () -> T) -> T {
|
|
82
|
+
+ Thread.isMainThread ? body() : DispatchQueue.main.sync(execute: body)
|
|
83
|
+
+ }
|
|
84
|
+
+
|
|
85
|
+
+ var mainWindow: NSWindow? { NSApplication.shared.mainWindow ?? NSApplication.shared.keyWindow ?? NSApplication.shared.windows.first { $0.isVisible } }
|
|
86
|
+
+
|
|
87
|
+
+ func buildMiniRuntime() -> UnistylesNativeMiniRuntime {
|
|
88
|
+
+ let screen = getScreenDimensions()
|
|
89
|
+
+ return UnistylesNativeMiniRuntime(
|
|
90
|
+
+ colorScheme: getColorScheme(),
|
|
91
|
+
+ screen: screen,
|
|
92
|
+
+ contentSizeCategory: getContentSizeCategory(),
|
|
93
|
+
+ insets: getInsets(),
|
|
94
|
+
+ pixelRatio: getPixelRatio(),
|
|
95
|
+
+ fontScale: getFontScale(),
|
|
96
|
+
+ rtl: getPrefersRtlDirection(),
|
|
97
|
+
+ statusBar: getStatusBarDimensions(),
|
|
98
|
+
+ navigationBar: getNavigationBarDimensions(),
|
|
99
|
+
+ isPortrait: screen.height >= screen.width,
|
|
100
|
+
+ isLandscape: screen.width > screen.height
|
|
101
|
+
+ )
|
|
102
|
+
+ }
|
|
103
|
+
+
|
|
104
|
+
+ func getMiniRuntime() -> UnistylesNativeMiniRuntime { miniRuntime! }
|
|
105
|
+
+
|
|
106
|
+
+ func getColorScheme() -> ColorScheme {
|
|
107
|
+
+ onMain { NSApplication.shared.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua ? .dark : .light }
|
|
108
|
+
+ }
|
|
109
|
+
+
|
|
110
|
+
+ func getFontScale() -> Double { 1 }
|
|
111
|
+
+
|
|
112
|
+
+ func getContentSizeCategory() -> String { "unspecified" }
|
|
113
|
+
+
|
|
114
|
+
+ func getScreenDimensions() -> Dimensions {
|
|
115
|
+
+ onMain {
|
|
116
|
+
+ let size = mainWindow?.contentView?.bounds.size ?? NSScreen.main?.frame.size ?? .zero
|
|
117
|
+
+ return Dimensions(width: size.width, height: size.height)
|
|
118
|
+
+ }
|
|
119
|
+
+ }
|
|
120
|
+
+
|
|
121
|
+
+ func getOrientation() -> Orientation {
|
|
122
|
+
+ let screen = getScreenDimensions()
|
|
123
|
+
+ return screen.width > screen.height ? .landscape : .portrait
|
|
124
|
+
+ }
|
|
125
|
+
+
|
|
126
|
+
+ func getInsets() -> Insets { Insets(top: 0, bottom: 0, left: 0, right: 0, ime: 0) }
|
|
127
|
+
+
|
|
128
|
+
+ func getPrefersRtlDirection() -> Bool {
|
|
129
|
+
+ onMain { UserDefaults.standard.bool(forKey: "RCTI18nUtil_forceRTL") || NSApplication.shared.userInterfaceLayoutDirection == .rightToLeft }
|
|
130
|
+
+ }
|
|
131
|
+
+
|
|
132
|
+
+ func getStatusBarDimensions() -> Dimensions { Dimensions(width: 0, height: 0) }
|
|
133
|
+
+
|
|
134
|
+
+ func getNavigationBarDimensions() -> Dimensions { Dimensions(width: 0, height: 0) }
|
|
135
|
+
+
|
|
136
|
+
+ func getPixelRatio() -> Double {
|
|
137
|
+
+ onMain { Double(mainWindow?.backingScaleFactor ?? NSScreen.main?.backingScaleFactor ?? 1) }
|
|
138
|
+
+ }
|
|
139
|
+
+
|
|
140
|
+
+ func setRootViewBackgroundColor(color: Double) throws {
|
|
141
|
+
+ let value = Int(color)
|
|
142
|
+
+ DispatchQueue.main.async {
|
|
143
|
+
+ self.mainWindow?.backgroundColor = NSColor(red: CGFloat((value >> 16) & 0xFF) / 255, green: CGFloat((value >> 8) & 0xFF) / 255, blue: CGFloat(value & 0xFF) / 255, alpha: 1)
|
|
144
|
+
+ }
|
|
145
|
+
+ }
|
|
146
|
+
+
|
|
147
|
+
+ func setStatusBarHidden(isHidden: Bool) throws {}
|
|
148
|
+
+
|
|
149
|
+
+ func setNavigationBarHidden(isHidden: Bool) throws {}
|
|
150
|
+
+
|
|
151
|
+
+ func setImmersiveMode(isEnabled: Bool) throws {}
|
|
152
|
+
+
|
|
153
|
+
+ func registerPlatformListener(callback: @escaping (Array<UnistyleDependency>, UnistylesNativeMiniRuntime) -> Void) throws {
|
|
154
|
+
+ dependencyListeners.append(callback)
|
|
155
|
+
+ }
|
|
156
|
+
+
|
|
157
|
+
+ // Desktop windows have no software keyboard, so the IME inset never changes.
|
|
158
|
+
+ func registerImeListener(callback: @escaping (UnistylesNativeMiniRuntime) -> Void) throws {}
|
|
159
|
+
+
|
|
160
|
+
+ func unregisterPlatformListeners() throws {
|
|
161
|
+
+ dependencyListeners.removeAll()
|
|
162
|
+
+ }
|
|
163
|
+
+
|
|
164
|
+
+ func onNativePlatformChange() {
|
|
165
|
+
+ guard let current = miniRuntime else { return }
|
|
166
|
+
+ let next = buildMiniRuntime()
|
|
167
|
+
+ let changed = UnistylesNativeMiniRuntime.diff(lhs: current, rhs: next)
|
|
168
|
+
+ if !changed.isEmpty {
|
|
169
|
+
+ miniRuntime = next
|
|
170
|
+
+ dependencyListeners.forEach { $0(changed, next) }
|
|
171
|
+
+ }
|
|
172
|
+
+ }
|
|
173
|
+
+}
|
|
174
|
+
+
|
|
175
|
+
+#endif
|
|
176
|
+
diff --git a/ios/NativePlatform.swift b/ios/NativePlatform.swift
|
|
177
|
+
index d8b86a1..90288a2 100644
|
|
178
|
+
--- a/ios/NativePlatform.swift
|
|
179
|
+
+++ b/ios/NativePlatform.swift
|
|
180
|
+
@@ -8,6 +8,8 @@ public class NativePlatform {
|
|
181
|
+
public static func create() -> HybridNativePlatformSpec_cxx {
|
|
182
|
+
#if os(iOS)
|
|
183
|
+
let nativePlatform = NativeIOSPlatform()
|
|
184
|
+
+ #elseif os(macOS)
|
|
185
|
+
+ let nativePlatform = NativeMacOSPlatform()
|
|
186
|
+
#else
|
|
187
|
+
throw PlatformError.UnsupportedPlatform
|
|
188
|
+
#endif
|
|
189
|
+
diff --git a/ios/NativePlatformListener+ios.swift b/ios/NativePlatformListener+ios.swift
|
|
190
|
+
index ac7db8f..8968117 100644
|
|
191
|
+
--- a/ios/NativePlatformListener+ios.swift
|
|
192
|
+
+++ b/ios/NativePlatformListener+ios.swift
|
|
193
|
+
@@ -1,3 +1,4 @@
|
|
194
|
+
+#if os(iOS)
|
|
195
|
+
import Foundation
|
|
196
|
+
import Combine
|
|
197
|
+
|
|
198
|
+
@@ -65,3 +66,5 @@ extension NativeIOSPlatform {
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
+
|
|
203
|
+
+#endif
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/react-native-worklets-core.podspec b/react-native-worklets-core.podspec
|
|
2
|
+
index f5b58d7..c9bcfea 100644
|
|
3
|
+
--- a/react-native-worklets-core.podspec
|
|
4
|
+
+++ b/react-native-worklets-core.podspec
|
|
5
|
+
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.license = package["license"]
|
|
7
|
+
s.authors = package["author"]
|
|
8
|
+
|
|
9
|
+
- s.platforms = { :ios => "11.0" }
|
|
10
|
+
+ s.platforms = { :ios => "11.0", :osx => "14.0" }
|
|
11
|
+
s.source = { :git => "https://github.com/margelo/react-native-worklets-core.git", :tag => "#{s.version}" }
|
|
12
|
+
|
|
13
|
+
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
diff --git a/lib/module/views/NativeStackView.macos.js b/lib/module/views/NativeStackView.macos.js
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..c42b5d6
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/lib/module/views/NativeStackView.macos.js
|
|
6
|
+
@@ -0,0 +1,2 @@
|
|
7
|
+
+// macOS has no native stack: use the JavaScript stack view, which draws headers with @react-navigation/elements.
|
|
8
|
+
+export * from "./NativeStackView.js";
|
|
9
|
+
diff --git a/src/views/NativeStackView.macos.tsx b/src/views/NativeStackView.macos.tsx
|
|
10
|
+
new file mode 100644
|
|
11
|
+
index 0000000..82511c8
|
|
12
|
+
--- /dev/null
|
|
13
|
+
+++ b/src/views/NativeStackView.macos.tsx
|
|
14
|
+
@@ -0,0 +1,2 @@
|
|
15
|
+
+// macOS has no native stack: use the JavaScript stack view, which draws headers with @react-navigation/elements.
|
|
16
|
+
+export * from './NativeStackView.tsx';
|