@legendapp/spark 0.0.1 → 0.0.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/native.d.cts +6 -3
- package/package.json +36 -28
- 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-enriched-markdown@1.1.1.patch +141 -10
- 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-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/sentry-react-native@8.32.0.patch +76 -0
- package/skills/spark/UPGRADING.md +122 -3
- package/vendor/node_modules/@legendapp/spark-ai/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-audio/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-audio/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-auth-session/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +17 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/create.js +8 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +45 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +15 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/examples.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-patch.cjs +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-dev-preload.cjs +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +26 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +3 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +20 -5
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +10 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +28 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-runner-root.js +108 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +13 -13
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/watchman.js +12 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows-geometry.js +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/desktop.config.json +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +27 -25
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/desktop.config.json +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +35 -33
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +29 -27
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-clipboard/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-commands/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/accessibility-state.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +12 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +7 -6
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/fabric-lifecycle.cjs +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/keyboard-events.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/macos-host.cjs +39 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +73 -20
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +8 -6
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-scroll-view.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-alignment.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/rtl-text-input-alignment.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/text-input-accessibility.cjs +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/AppDelegate.h +6 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/Main.storyboard +684 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/macos/main.m +5 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-desktop-links/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +68 -17
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +9 -9
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +14 -5
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-system/src/index.ts +1 -1
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-html/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-processes/macos/RNDesktopProcesses.mm +110 -19
- package/vendor/node_modules/@legendapp/spark-processes/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-processes/src/index.ts +17 -3
- package/vendor/node_modules/@legendapp/spark-processes/src/types.ts +6 -0
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-secure-storage/src/index.macos.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +12 -5
- package/vendor/node_modules/@legendapp/spark-system/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-tray/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +82 -18
- package/vendor/node_modules/@legendapp/spark-ui/package.json +6 -6
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +11 -9
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +20 -10
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +15 -10
- package/vendor/node_modules/@legendapp/spark-ui/src/index.macos.tsx +1 -0
- package/vendor/node_modules/@legendapp/spark-updates/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-webview/package.json +11 -4
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- package/camera.ts +0 -13
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
diff --git a/ios/DeviceModule.swift b/ios/DeviceModule.swift
|
|
2
|
+
index 899b214..c5a3d45 100644
|
|
3
|
+
--- a/ios/DeviceModule.swift
|
|
4
|
+
+++ b/ios/DeviceModule.swift
|
|
5
|
+
@@ -1,5 +1,9 @@
|
|
6
|
+
import ExpoModulesCore
|
|
7
|
+
+#if canImport(UIKit)
|
|
8
|
+
import UIKit
|
|
9
|
+
+#else
|
|
10
|
+
+import SystemConfiguration
|
|
11
|
+
+#endif
|
|
12
|
+
import MachO
|
|
13
|
+
|
|
14
|
+
public class DeviceModule: Module {
|
|
15
|
+
@@ -19,15 +23,27 @@ public class DeviceModule: Module {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
Constant("modelId") {
|
|
19
|
+
+#if os(macOS)
|
|
20
|
+
+ sysctlString("hw.model")
|
|
21
|
+
+#else
|
|
22
|
+
UIDevice.modelIdentifier
|
|
23
|
+
+#endif
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Constant("modelName") {
|
|
27
|
+
+#if os(macOS)
|
|
28
|
+
+ nil as String?
|
|
29
|
+
+#else
|
|
30
|
+
UIDevice.DeviceMap.modelName
|
|
31
|
+
+#endif
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Constant("deviceYearClass") {
|
|
35
|
+
+#if os(macOS)
|
|
36
|
+
+ nil as Int?
|
|
37
|
+
+#else
|
|
38
|
+
UIDevice.DeviceMap.deviceYearClass
|
|
39
|
+
+#endif
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Constant("totalMemory") {
|
|
43
|
+
@@ -35,11 +51,19 @@ public class DeviceModule: Module {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Constant("osName") {
|
|
47
|
+
+#if os(macOS)
|
|
48
|
+
+ "macOS"
|
|
49
|
+
+#else
|
|
50
|
+
UIDevice.current.systemName
|
|
51
|
+
+#endif
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
Constant("osVersion") {
|
|
55
|
+
+#if os(macOS)
|
|
56
|
+
+ ProcessInfo.processInfo.operatingSystemVersion.versionString
|
|
57
|
+
+#else
|
|
58
|
+
UIDevice.current.systemVersion
|
|
59
|
+
+#endif
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Constant("osBuildId") {
|
|
63
|
+
@@ -51,7 +75,11 @@ public class DeviceModule: Module {
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Constant("deviceName") {
|
|
67
|
+
+#if os(macOS)
|
|
68
|
+
+ SCDynamicStoreCopyComputerName(nil, nil) as String?
|
|
69
|
+
+#else
|
|
70
|
+
UIDevice.current.name
|
|
71
|
+
+#endif
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Constant("deviceType") {
|
|
75
|
+
@@ -72,12 +100,19 @@ public class DeviceModule: Module {
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
AsyncFunction("isRootedExperimentalAsync") { () -> Bool in
|
|
79
|
+
+#if os(macOS)
|
|
80
|
+
+ return false
|
|
81
|
+
+#else
|
|
82
|
+
return UIDevice.current.isJailbroken
|
|
83
|
+
+#endif
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
func getDeviceType() -> Int {
|
|
89
|
+
+ #if os(macOS)
|
|
90
|
+
+ return DeviceType.desktop.rawValue
|
|
91
|
+
+ #else
|
|
92
|
+
// if it's a macOS Catalyst app
|
|
93
|
+
if ProcessInfo.processInfo.isMacCatalystApp {
|
|
94
|
+
return DeviceType.desktop.rawValue
|
|
95
|
+
@@ -100,6 +135,7 @@ func getDeviceType() -> Int {
|
|
96
|
+
default:
|
|
97
|
+
return DeviceType.unknown.rawValue
|
|
98
|
+
}
|
|
99
|
+
+ #endif
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
func isDevice() -> Bool {
|
|
103
|
+
@@ -141,6 +177,20 @@ func cpuArchitectures() -> [String]? {
|
|
104
|
+
return [String(cString: archRaw)]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
+#if os(macOS)
|
|
108
|
+
+func sysctlString(_ name: String) -> String? {
|
|
109
|
+
+ var size = 0
|
|
110
|
+
+ guard sysctlbyname(name, nil, &size, nil, 0) == 0, size > 0 else { return nil }
|
|
111
|
+
+ var buffer = [CChar](repeating: 0, count: size)
|
|
112
|
+
+ guard sysctlbyname(name, &buffer, &size, nil, 0) == 0 else { return nil }
|
|
113
|
+
+ return String(cString: buffer)
|
|
114
|
+
+}
|
|
115
|
+
+
|
|
116
|
+
+extension OperatingSystemVersion {
|
|
117
|
+
+ var versionString: String { "\(majorVersion).\(minorVersion).\(patchVersion)" }
|
|
118
|
+
+}
|
|
119
|
+
+#endif
|
|
120
|
+
+
|
|
121
|
+
enum DeviceType: Int {
|
|
122
|
+
case unknown = 0
|
|
123
|
+
case phone = 1
|
|
124
|
+
diff --git a/ios/ExpoDevice.podspec b/ios/ExpoDevice.podspec
|
|
125
|
+
index 1b0c81f..0283bf0 100644
|
|
126
|
+
--- a/ios/ExpoDevice.podspec
|
|
127
|
+
+++ b/ios/ExpoDevice.podspec
|
|
128
|
+
@@ -12,6 +12,7 @@ Pod::Spec.new do |s|
|
|
129
|
+
s.homepage = package['homepage']
|
|
130
|
+
s.platforms = {
|
|
131
|
+
:ios => '15.1',
|
|
132
|
+
+ :osx => '14.0',
|
|
133
|
+
:tvos => '15.1'
|
|
134
|
+
}
|
|
135
|
+
s.swift_version = '5.9'
|
|
136
|
+
diff --git a/ios/UIDevice.swift b/ios/UIDevice.swift
|
|
137
|
+
index 336c648..709c496 100644
|
|
138
|
+
--- a/ios/UIDevice.swift
|
|
139
|
+
+++ b/ios/UIDevice.swift
|
|
140
|
+
@@ -1,3 +1,4 @@
|
|
141
|
+
+#if !os(macOS)
|
|
142
|
+
import UIKit
|
|
143
|
+
|
|
144
|
+
struct ExpoDeviceType {
|
|
145
|
+
@@ -305,3 +306,4 @@ private struct JailbreakHelper {
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
+#endif
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
diff --git a/ios/FontFamilyAliasManager.swift b/ios/FontFamilyAliasManager.swift
|
|
2
|
+
index f785185..7766c11 100644
|
|
3
|
+
--- a/ios/FontFamilyAliasManager.swift
|
|
4
|
+
+++ b/ios/FontFamilyAliasManager.swift
|
|
5
|
+
@@ -67,6 +67,16 @@ private func maybeSwizzleUIFont() {
|
|
6
|
+
} else {
|
|
7
|
+
log.error("expo-font is unable to swizzle `UIFont.fontNames(forFamilyName:)`")
|
|
8
|
+
}
|
|
9
|
+
+#else
|
|
10
|
+
+ // React Native macOS resolves font families through NSFontManager.
|
|
11
|
+
+ let originalMembersMethod = class_getInstanceMethod(NSFontManager.self, #selector(NSFontManager.availableMembers(ofFontFamily:)))
|
|
12
|
+
+ let newMembersMethod = class_getInstanceMethod(NSFontManager.self, #selector(NSFontManager._expo_availableMembers(ofFontFamily:)))
|
|
13
|
+
+
|
|
14
|
+
+ if let originalMembersMethod, let newMembersMethod {
|
|
15
|
+
+ method_exchangeImplementations(originalMembersMethod, newMembersMethod)
|
|
16
|
+
+ } else {
|
|
17
|
+
+ log.error("expo-font is unable to swizzle `NSFontManager.availableMembers(ofFontFamily:)`")
|
|
18
|
+
+ }
|
|
19
|
+
#endif
|
|
20
|
+
hasSwizzled = true
|
|
21
|
+
}
|
|
22
|
+
diff --git a/ios/UIFont+FontFamilyAlias.swift b/ios/UIFont+FontFamilyAlias.swift
|
|
23
|
+
index a5e3bf1..222a717 100644
|
|
24
|
+
--- a/ios/UIFont+FontFamilyAlias.swift
|
|
25
|
+
+++ b/ios/UIFont+FontFamilyAlias.swift
|
|
26
|
+
@@ -26,4 +26,29 @@ public extension UIFont {
|
|
27
|
+
return fontNames
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
+#else
|
|
31
|
+
+/**
|
|
32
|
+
+ An extension to ``NSFontManager`` that adds a custom implementation of `availableMembers(ofFontFamily:)` that supports aliasing font families.
|
|
33
|
+
+ */
|
|
34
|
+
+public extension NSFontManager {
|
|
35
|
+
+ /**
|
|
36
|
+
+ Returns the members of the specified font family or of the font its alias names. React Native reads the
|
|
37
|
+
+ PostScript name, the first element of each member.
|
|
38
|
+
+ */
|
|
39
|
+
+ @objc
|
|
40
|
+
+ dynamic func _expo_availableMembers(ofFontFamily familyName: String) -> [[Any]]? {
|
|
41
|
+
+ // Get members from the original function.
|
|
42
|
+
+ let members = _expo_availableMembers(ofFontFamily: familyName)
|
|
43
|
+
+
|
|
44
|
+
+ // If no members were found, let's try with the alias.
|
|
45
|
+
+ if members?.isEmpty ?? true, let postScriptName = FontFamilyAliasManager.familyName(forAlias: familyName) {
|
|
46
|
+
+ if let family = NSFont(name: postScriptName, size: 12)?.familyName, let members = _expo_availableMembers(ofFontFamily: family), !members.isEmpty {
|
|
47
|
+
+ return members
|
|
48
|
+
+ }
|
|
49
|
+
+ return [[postScriptName]]
|
|
50
|
+
+ }
|
|
51
|
+
+
|
|
52
|
+
+ return members
|
|
53
|
+
+ }
|
|
54
|
+
+}
|
|
55
|
+
#endif
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
diff --git a/build/GlassContainer.macos.js b/build/GlassContainer.macos.js
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..7218bec
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/build/GlassContainer.macos.js
|
|
6
|
+
@@ -0,0 +1,3 @@
|
|
7
|
+
+// macOS uses the native glass views, like iOS.
|
|
8
|
+
+export * from './GlassContainer.ios';
|
|
9
|
+
+export { default } from './GlassContainer.ios';
|
|
10
|
+
diff --git a/build/GlassView.macos.js b/build/GlassView.macos.js
|
|
11
|
+
new file mode 100644
|
|
12
|
+
index 0000000..181ff73
|
|
13
|
+
--- /dev/null
|
|
14
|
+
+++ b/build/GlassView.macos.js
|
|
15
|
+
@@ -0,0 +1,3 @@
|
|
16
|
+
+// macOS uses the native glass views, like iOS.
|
|
17
|
+
+export * from './GlassView.ios';
|
|
18
|
+
+export { default } from './GlassView.ios';
|
|
19
|
+
diff --git a/build/isGlassEffectAPIAvailable.macos.js b/build/isGlassEffectAPIAvailable.macos.js
|
|
20
|
+
new file mode 100644
|
|
21
|
+
index 0000000..561ff57
|
|
22
|
+
--- /dev/null
|
|
23
|
+
+++ b/build/isGlassEffectAPIAvailable.macos.js
|
|
24
|
+
@@ -0,0 +1,2 @@
|
|
25
|
+
+// macOS uses the native glass views, like iOS.
|
|
26
|
+
+export * from './isGlassEffectAPIAvailable.ios';
|
|
27
|
+
diff --git a/build/isLiquidGlassAvailable.macos.js b/build/isLiquidGlassAvailable.macos.js
|
|
28
|
+
new file mode 100644
|
|
29
|
+
index 0000000..178f450
|
|
30
|
+
--- /dev/null
|
|
31
|
+
+++ b/build/isLiquidGlassAvailable.macos.js
|
|
32
|
+
@@ -0,0 +1,2 @@
|
|
33
|
+
+// macOS uses the native glass views, like iOS.
|
|
34
|
+
+export * from './isLiquidGlassAvailable.ios';
|
|
35
|
+
diff --git a/ios/ExpoGlassEffect.podspec b/ios/ExpoGlassEffect.podspec
|
|
36
|
+
index c05b50d..241f6b2 100644
|
|
37
|
+
--- a/ios/ExpoGlassEffect.podspec
|
|
38
|
+
+++ b/ios/ExpoGlassEffect.podspec
|
|
39
|
+
@@ -13,6 +13,7 @@ Pod::Spec.new do |s|
|
|
40
|
+
s.platforms = {
|
|
41
|
+
:ios => '15.1',
|
|
42
|
+
:tvos => '15.1',
|
|
43
|
+
+ :osx => '14.0',
|
|
44
|
+
}
|
|
45
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
46
|
+
|
|
47
|
+
diff --git a/ios/GlassContainer.swift b/ios/GlassContainer.swift
|
|
48
|
+
index 61fb67c..3866f84 100644
|
|
49
|
+
--- a/ios/GlassContainer.swift
|
|
50
|
+
+++ b/ios/GlassContainer.swift
|
|
51
|
+
@@ -1,5 +1,6 @@
|
|
52
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
53
|
+
|
|
54
|
+
+#if !os(macOS)
|
|
55
|
+
import ExpoModulesCore
|
|
56
|
+
|
|
57
|
+
public final class GlassContainer: ExpoView {
|
|
58
|
+
@@ -54,3 +55,4 @@ public final class GlassContainer: ExpoView {
|
|
59
|
+
childComponentView.removeFromSuperview()
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
+#endif
|
|
63
|
+
diff --git a/ios/GlassEffectModule.swift b/ios/GlassEffectModule.swift
|
|
64
|
+
index e036302..2e47cfa 100644
|
|
65
|
+
--- a/ios/GlassEffectModule.swift
|
|
66
|
+
+++ b/ios/GlassEffectModule.swift
|
|
67
|
+
@@ -23,6 +23,9 @@ public final class GlassEffectModule: Module {
|
|
68
|
+
Constant("isGlassEffectAPIAvailable") {
|
|
69
|
+
#if compiler(>=6.2)
|
|
70
|
+
if #available(iOS 26.0, tvOS 26.0, macOS 26.0, *) {
|
|
71
|
+
+ #if os(macOS)
|
|
72
|
+
+ return NSClassFromString("NSGlassEffectView") != nil
|
|
73
|
+
+ #endif
|
|
74
|
+
guard let glassEffectClass = NSClassFromString("UIGlassEffect") as? NSObject.Type else {
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
diff --git a/ios/GlassStyle.swift b/ios/GlassStyle.swift
|
|
78
|
+
index bfd913c..239e7d2 100644
|
|
79
|
+
--- a/ios/GlassStyle.swift
|
|
80
|
+
+++ b/ios/GlassStyle.swift
|
|
81
|
+
@@ -1,12 +1,14 @@
|
|
82
|
+
import ExpoModulesCore
|
|
83
|
+
+#if !os(macOS)
|
|
84
|
+
import UIKit
|
|
85
|
+
+#endif
|
|
86
|
+
|
|
87
|
+
public enum GlassStyle: String, Enumerable {
|
|
88
|
+
case clear
|
|
89
|
+
case regular
|
|
90
|
+
case none
|
|
91
|
+
|
|
92
|
+
- #if compiler(>=6.2) // Xcode 26
|
|
93
|
+
+ #if compiler(>=6.2) && !os(macOS) // Xcode 26
|
|
94
|
+
@available(iOS 26.0, tvOS 26.0, macOS 26.0, *)
|
|
95
|
+
func toUIGlassEffectStyle() -> UIGlassEffect.Style? {
|
|
96
|
+
switch self {
|
|
97
|
+
@@ -37,6 +39,18 @@ internal enum GlassColorScheme: String, Enumerable {
|
|
98
|
+
case light
|
|
99
|
+
case dark
|
|
100
|
+
|
|
101
|
+
+ #if os(macOS)
|
|
102
|
+
+ func toAppearance() -> NSAppearance? {
|
|
103
|
+
+ switch self {
|
|
104
|
+
+ case .auto:
|
|
105
|
+
+ return nil
|
|
106
|
+
+ case .light:
|
|
107
|
+
+ return NSAppearance(named: .aqua)
|
|
108
|
+
+ case .dark:
|
|
109
|
+
+ return NSAppearance(named: .darkAqua)
|
|
110
|
+
+ }
|
|
111
|
+
+ }
|
|
112
|
+
+ #else
|
|
113
|
+
func toUIUserInterfaceStyle() -> UIUserInterfaceStyle {
|
|
114
|
+
switch self {
|
|
115
|
+
case .auto:
|
|
116
|
+
@@ -47,4 +61,5 @@ internal enum GlassColorScheme: String, Enumerable {
|
|
117
|
+
return .dark
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
+ #endif
|
|
121
|
+
}
|
|
122
|
+
diff --git a/ios/GlassView.swift b/ios/GlassView.swift
|
|
123
|
+
index 35cd8f3..23d9a01 100644
|
|
124
|
+
--- a/ios/GlassView.swift
|
|
125
|
+
+++ b/ios/GlassView.swift
|
|
126
|
+
@@ -1,5 +1,6 @@
|
|
127
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
128
|
+
|
|
129
|
+
+#if !os(macOS)
|
|
130
|
+
import ExpoModulesCore
|
|
131
|
+
import React
|
|
132
|
+
|
|
133
|
+
@@ -279,3 +280,4 @@ public final class GlassView: ExpoView {
|
|
134
|
+
childComponentView.removeFromSuperview()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
+#endif
|
|
138
|
+
diff --git a/ios/GlassViewMacOS.swift b/ios/GlassViewMacOS.swift
|
|
139
|
+
new file mode 100644
|
|
140
|
+
index 0000000..3e3816c
|
|
141
|
+
--- /dev/null
|
|
142
|
+
+++ b/ios/GlassViewMacOS.swift
|
|
143
|
+
@@ -0,0 +1,161 @@
|
|
144
|
+
+// macOS: NSGlassEffectView (macOS 26) hosts the children; earlier systems show them without glass.
|
|
145
|
+
+#if os(macOS)
|
|
146
|
+
+import ExpoModulesCore
|
|
147
|
+
+
|
|
148
|
+
+// React frames children from the top-left, so their container must be flipped.
|
|
149
|
+
+final class GlassContentView: NSView {
|
|
150
|
+
+ override var isFlipped: Bool { true }
|
|
151
|
+
+}
|
|
152
|
+
+
|
|
153
|
+
+public final class GlassView: ExpoView {
|
|
154
|
+
+ private let contentView = GlassContentView()
|
|
155
|
+
+ private var glassView: NSView?
|
|
156
|
+
+ private var glassStyle: GlassStyle = .regular
|
|
157
|
+
+ private var glassTintColor: NSColor?
|
|
158
|
+
+ private var radius: CGFloat?
|
|
159
|
+
+ private var cornerRadii = [String: CGFloat]()
|
|
160
|
+
+
|
|
161
|
+
+ public required init(appContext: AppContext? = nil) {
|
|
162
|
+
+ super.init(appContext: appContext)
|
|
163
|
+
+ contentView.autoresizingMask = [.width, .height]
|
|
164
|
+
+ #if compiler(>=6.2)
|
|
165
|
+
+ if #available(macOS 26.0, *) {
|
|
166
|
+
+ let glass = NSGlassEffectView(frame: bounds)
|
|
167
|
+
+ glass.autoresizingMask = [.width, .height]
|
|
168
|
+
+ glass.contentView = contentView
|
|
169
|
+
+ glassView = glass
|
|
170
|
+
+ addSubview(glass)
|
|
171
|
+
+ return
|
|
172
|
+
+ }
|
|
173
|
+
+ #endif
|
|
174
|
+
+ addSubview(contentView)
|
|
175
|
+
+ }
|
|
176
|
+
+
|
|
177
|
+
+ // Children are framed by React; size the glass and its content to this view explicitly.
|
|
178
|
+
+ public override func layoutSubviews() {
|
|
179
|
+
+ super.layoutSubviews()
|
|
180
|
+
+ glassView?.frame = bounds
|
|
181
|
+
+ contentView.frame = glassView?.bounds ?? bounds
|
|
182
|
+
+ }
|
|
183
|
+
+
|
|
184
|
+
+ func setGlassStyle(_ config: GlassEffectStyleConfig) {
|
|
185
|
+
+ setGlassStyle(config.style)
|
|
186
|
+
+ }
|
|
187
|
+
+
|
|
188
|
+
+ func setGlassStyle(_ style: GlassStyle) {
|
|
189
|
+
+ glassStyle = style
|
|
190
|
+
+ updateEffect()
|
|
191
|
+
+ }
|
|
192
|
+
+
|
|
193
|
+
+ func setTintColor(_ color: NSColor?) {
|
|
194
|
+
+ glassTintColor = color
|
|
195
|
+
+ updateEffect()
|
|
196
|
+
+ }
|
|
197
|
+
+
|
|
198
|
+
+ // AppKit glass has no interactive variant.
|
|
199
|
+
+ func setInteractive(_ interactive: Bool) {}
|
|
200
|
+
+
|
|
201
|
+
+ func setColorScheme(_ colorScheme: GlassColorScheme) {
|
|
202
|
+
+ glassView?.appearance = colorScheme.toAppearance()
|
|
203
|
+
+ }
|
|
204
|
+
+
|
|
205
|
+
+ // NSGlassEffectView has one corner radius; per-corner radii use the largest given.
|
|
206
|
+
+ func setBorderRadius(_ radius: CGFloat?) {
|
|
207
|
+
+ self.radius = radius
|
|
208
|
+
+ updateEffect()
|
|
209
|
+
+ }
|
|
210
|
+
+ func setBorderCurve(_: String?) {}
|
|
211
|
+
+ func setBorderBottomLeftRadius(_ radius: CGFloat?) { setCornerRadius("bottomLeft", radius) }
|
|
212
|
+
+ func setBorderBottomRightRadius(_ radius: CGFloat?) { setCornerRadius("bottomRight", radius) }
|
|
213
|
+
+ func setBorderTopLeftRadius(_ radius: CGFloat?) { setCornerRadius("topLeft", radius) }
|
|
214
|
+
+ func setBorderTopRightRadius(_ radius: CGFloat?) { setCornerRadius("topRight", radius) }
|
|
215
|
+
+ func setBorderBottomStartRadius(_ radius: CGFloat?) { setCornerRadius("bottomStart", radius) }
|
|
216
|
+
+ func setBorderBottomEndRadius(_ radius: CGFloat?) { setCornerRadius("bottomEnd", radius) }
|
|
217
|
+
+ func setBorderTopStartRadius(_ radius: CGFloat?) { setCornerRadius("topStart", radius) }
|
|
218
|
+
+ func setBorderTopEndRadius(_ radius: CGFloat?) { setCornerRadius("topEnd", radius) }
|
|
219
|
+
+
|
|
220
|
+
+ private func setCornerRadius(_ corner: String, _ value: CGFloat?) {
|
|
221
|
+
+ cornerRadii[corner] = value
|
|
222
|
+
+ updateEffect()
|
|
223
|
+
+ }
|
|
224
|
+
+
|
|
225
|
+
+ private func updateEffect() {
|
|
226
|
+
+ #if compiler(>=6.2)
|
|
227
|
+
+ if #available(macOS 26.0, *), let glass = glassView as? NSGlassEffectView {
|
|
228
|
+
+ // `none` keeps the children but drops the glass.
|
|
229
|
+
+ if glassStyle == .none {
|
|
230
|
+
+ glass.contentView = nil
|
|
231
|
+
+ contentView.frame = bounds
|
|
232
|
+
+ addSubview(contentView)
|
|
233
|
+
+ } else if glass.contentView !== contentView {
|
|
234
|
+
+ contentView.removeFromSuperview()
|
|
235
|
+
+ glass.contentView = contentView
|
|
236
|
+
+ }
|
|
237
|
+
+ glass.isHidden = glassStyle == .none
|
|
238
|
+
+ glass.style = glassStyle == .clear ? .clear : .regular
|
|
239
|
+
+ glass.tintColor = glassTintColor
|
|
240
|
+
+ glass.cornerRadius = radius ?? cornerRadii.values.max() ?? 0
|
|
241
|
+
+ }
|
|
242
|
+
+ #endif
|
|
243
|
+
+ }
|
|
244
|
+
+
|
|
245
|
+
+ public override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
246
|
+
+ if index < contentView.subviews.count {
|
|
247
|
+
+ contentView.addSubview(childComponentView, positioned: .below, relativeTo: contentView.subviews[index])
|
|
248
|
+
+ } else {
|
|
249
|
+
+ contentView.addSubview(childComponentView)
|
|
250
|
+
+ }
|
|
251
|
+
+ }
|
|
252
|
+
+
|
|
253
|
+
+ public override func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
254
|
+
+ childComponentView.removeFromSuperview()
|
|
255
|
+
+ }
|
|
256
|
+
+}
|
|
257
|
+
+
|
|
258
|
+
+public final class GlassContainer: ExpoView {
|
|
259
|
+
+ private let contentView = GlassContentView()
|
|
260
|
+
+ private var containerView: NSView?
|
|
261
|
+
+
|
|
262
|
+
+ public required init(appContext: AppContext? = nil) {
|
|
263
|
+
+ super.init(appContext: appContext)
|
|
264
|
+
+ contentView.autoresizingMask = [.width, .height]
|
|
265
|
+
+ #if compiler(>=6.2)
|
|
266
|
+
+ if #available(macOS 26.0, *) {
|
|
267
|
+
+ let container = NSGlassEffectContainerView(frame: bounds)
|
|
268
|
+
+ container.autoresizingMask = [.width, .height]
|
|
269
|
+
+ container.contentView = contentView
|
|
270
|
+
+ containerView = container
|
|
271
|
+
+ addSubview(container)
|
|
272
|
+
+ return
|
|
273
|
+
+ }
|
|
274
|
+
+ #endif
|
|
275
|
+
+ addSubview(contentView)
|
|
276
|
+
+ }
|
|
277
|
+
+
|
|
278
|
+
+ public override func layoutSubviews() {
|
|
279
|
+
+ super.layoutSubviews()
|
|
280
|
+
+ containerView?.frame = bounds
|
|
281
|
+
+ contentView.frame = bounds
|
|
282
|
+
+ }
|
|
283
|
+
+
|
|
284
|
+
+ func setSpacing(_ spacing: CGFloat?) {
|
|
285
|
+
+ #if compiler(>=6.2)
|
|
286
|
+
+ if #available(macOS 26.0, *), let container = containerView as? NSGlassEffectContainerView {
|
|
287
|
+
+ container.spacing = spacing ?? 0
|
|
288
|
+
+ }
|
|
289
|
+
+ #endif
|
|
290
|
+
+ }
|
|
291
|
+
+
|
|
292
|
+
+ public override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
293
|
+
+ if index < contentView.subviews.count {
|
|
294
|
+
+ contentView.addSubview(childComponentView, positioned: .below, relativeTo: contentView.subviews[index])
|
|
295
|
+
+ } else {
|
|
296
|
+
+ contentView.addSubview(childComponentView)
|
|
297
|
+
+ }
|
|
298
|
+
+ }
|
|
299
|
+
+
|
|
300
|
+
+ public override func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
|
|
301
|
+
+ childComponentView.removeFromSuperview()
|
|
302
|
+
+ }
|
|
303
|
+
+}
|
|
304
|
+
+#endif
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
diff --git a/ios/ExpoHaptics.podspec b/ios/ExpoHaptics.podspec
|
|
2
|
+
index a7f5bc7..93bb683 100644
|
|
3
|
+
--- a/ios/ExpoHaptics.podspec
|
|
4
|
+
+++ b/ios/ExpoHaptics.podspec
|
|
5
|
+
@@ -11,7 +11,8 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.author = package['author']
|
|
7
|
+
s.homepage = package['homepage']
|
|
8
|
+
s.platforms = {
|
|
9
|
+
- :ios => '15.1'
|
|
10
|
+
+ :ios => '15.1',
|
|
11
|
+
+ :osx => '14.0'
|
|
12
|
+
}
|
|
13
|
+
s.swift_version = '5.9'
|
|
14
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
15
|
+
diff --git a/ios/HapticsModule.swift b/ios/HapticsModule.swift
|
|
16
|
+
index 41659a0..e07500b 100644
|
|
17
|
+
--- a/ios/HapticsModule.swift
|
|
18
|
+
+++ b/ios/HapticsModule.swift
|
|
19
|
+
@@ -1,5 +1,30 @@
|
|
20
|
+
import ExpoModulesCore
|
|
21
|
+
|
|
22
|
+
+#if os(macOS)
|
|
23
|
+
+import AppKit
|
|
24
|
+
+
|
|
25
|
+
+// Macs give haptic feedback through Force Touch trackpads, while the user's finger rests on one.
|
|
26
|
+
+public class HapticsModule: Module {
|
|
27
|
+
+ public func definition() -> ModuleDefinition {
|
|
28
|
+
+ Name("ExpoHaptics")
|
|
29
|
+
+
|
|
30
|
+
+ AsyncFunction("notificationAsync") { (_: String) in
|
|
31
|
+
+ NSHapticFeedbackManager.defaultPerformer.perform(.levelChange, performanceTime: .now)
|
|
32
|
+
+ }
|
|
33
|
+
+ .runOnQueue(.main)
|
|
34
|
+
+
|
|
35
|
+
+ AsyncFunction("impactAsync") { (_: String) in
|
|
36
|
+
+ NSHapticFeedbackManager.defaultPerformer.perform(.generic, performanceTime: .now)
|
|
37
|
+
+ }
|
|
38
|
+
+ .runOnQueue(.main)
|
|
39
|
+
+
|
|
40
|
+
+ AsyncFunction("selectionAsync") {
|
|
41
|
+
+ NSHapticFeedbackManager.defaultPerformer.perform(.alignment, performanceTime: .now)
|
|
42
|
+
+ }
|
|
43
|
+
+ .runOnQueue(.main)
|
|
44
|
+
+ }
|
|
45
|
+
+}
|
|
46
|
+
+#else
|
|
47
|
+
public class HapticsModule: Module {
|
|
48
|
+
public func definition() -> ModuleDefinition {
|
|
49
|
+
Name("ExpoHaptics")
|
|
50
|
+
@@ -66,3 +91,4 @@ public class HapticsModule: Module {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
+#endif
|