@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,286 @@
|
|
|
1
|
+
diff --git a/build/SymbolView.macos.js b/build/SymbolView.macos.js
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..27f2612
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/build/SymbolView.macos.js
|
|
6
|
+
@@ -0,0 +1,2 @@
|
|
7
|
+
+// macOS renders SF Symbols natively, like iOS.
|
|
8
|
+
+export * from './SymbolView.ios';
|
|
9
|
+
diff --git a/build/materialImageSource.macos.js b/build/materialImageSource.macos.js
|
|
10
|
+
new file mode 100644
|
|
11
|
+
index 0000000..770d07d
|
|
12
|
+
--- /dev/null
|
|
13
|
+
+++ b/build/materialImageSource.macos.js
|
|
14
|
+
@@ -0,0 +1,2 @@
|
|
15
|
+
+// macOS renders SF Symbols natively, like iOS.
|
|
16
|
+
+export * from './materialImageSource.ios';
|
|
17
|
+
diff --git a/build/utils.macos.js b/build/utils.macos.js
|
|
18
|
+
new file mode 100644
|
|
19
|
+
index 0000000..cd5ed0b
|
|
20
|
+
--- /dev/null
|
|
21
|
+
+++ b/build/utils.macos.js
|
|
22
|
+
@@ -0,0 +1,2 @@
|
|
23
|
+
+// macOS renders SF Symbols natively, like iOS.
|
|
24
|
+
+export * from './utils.ios';
|
|
25
|
+
diff --git a/ios/ExpoSymbols.podspec b/ios/ExpoSymbols.podspec
|
|
26
|
+
index 21fe2d7..a40eae2 100644
|
|
27
|
+
--- a/ios/ExpoSymbols.podspec
|
|
28
|
+
+++ b/ios/ExpoSymbols.podspec
|
|
29
|
+
@@ -12,7 +12,8 @@ Pod::Spec.new do |s|
|
|
30
|
+
s.homepage = package['homepage']
|
|
31
|
+
s.platforms = {
|
|
32
|
+
:ios => '15.1',
|
|
33
|
+
- :tvos => '15.1'
|
|
34
|
+
+ :tvos => '15.1',
|
|
35
|
+
+ :osx => '14.0'
|
|
36
|
+
}
|
|
37
|
+
s.swift_version = '5.9'
|
|
38
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
39
|
+
diff --git a/ios/SymbolEffects.swift b/ios/SymbolEffects.swift
|
|
40
|
+
index dcfac39..c07d278 100644
|
|
41
|
+
--- a/ios/SymbolEffects.swift
|
|
42
|
+
+++ b/ios/SymbolEffects.swift
|
|
43
|
+
@@ -1,6 +1,6 @@
|
|
44
|
+
@available(iOS 17.0, tvOS 17.0, *)
|
|
45
|
+
internal protocol EffectAdding {
|
|
46
|
+
- func add(to view: UIImageView, with options: SymbolEffectOptions)
|
|
47
|
+
+ func add(to view: SymbolImageView, with options: SymbolEffectOptions)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@available(iOS 17.0, tvOS 17.0, *)
|
|
51
|
+
@@ -9,7 +9,7 @@ internal struct BounceEffect: EffectAdding {
|
|
52
|
+
let wholeSymbol: Bool?
|
|
53
|
+
let direction: AnimationDirection?
|
|
54
|
+
|
|
55
|
+
- func add(to view: UIImageView, with options: SymbolEffectOptions) {
|
|
56
|
+
+ func add(to view: SymbolImageView, with options: SymbolEffectOptions) {
|
|
57
|
+
var finalEffect = effect
|
|
58
|
+
if wholeSymbol ?? false {
|
|
59
|
+
finalEffect = finalEffect.wholeSymbol
|
|
60
|
+
@@ -28,7 +28,7 @@ internal struct PulseEffect: EffectAdding {
|
|
61
|
+
private let effect: PulseSymbolEffect = .pulse
|
|
62
|
+
let wholeSymbol: Bool?
|
|
63
|
+
|
|
64
|
+
- func add(to view: UIImageView, with options: SymbolEffectOptions) {
|
|
65
|
+
+ func add(to view: SymbolImageView, with options: SymbolEffectOptions) {
|
|
66
|
+
var finalEffect = effect
|
|
67
|
+
if wholeSymbol ?? false {
|
|
68
|
+
finalEffect = finalEffect.wholeSymbol
|
|
69
|
+
@@ -43,7 +43,7 @@ internal struct ScaleEffect: EffectAdding {
|
|
70
|
+
let wholeSymbol: Bool?
|
|
71
|
+
let direction: AnimationDirection?
|
|
72
|
+
|
|
73
|
+
- func add(to view: UIImageView, with options: SymbolEffectOptions) {
|
|
74
|
+
+ func add(to view: SymbolImageView, with options: SymbolEffectOptions) {
|
|
75
|
+
var finalEffect = effect
|
|
76
|
+
if wholeSymbol ?? false {
|
|
77
|
+
finalEffect = finalEffect.wholeSymbol
|
|
78
|
+
diff --git a/ios/SymbolModule.swift b/ios/SymbolModule.swift
|
|
79
|
+
index 304cde1..fa273d7 100644
|
|
80
|
+
--- a/ios/SymbolModule.swift
|
|
81
|
+
+++ b/ios/SymbolModule.swift
|
|
82
|
+
@@ -14,7 +14,11 @@ public class SymbolModule: Module {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Prop("scale") { (view, scale: SymbolScale?) in
|
|
86
|
+
+ #if os(macOS)
|
|
87
|
+
+ view.scale = scale?.imageSymbolScale()
|
|
88
|
+
+ #else
|
|
89
|
+
view.scale = scale?.imageSymbolScale() ?? .unspecified
|
|
90
|
+
+ #endif
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
Prop("tintColor") { (view, color: UIColor?) in
|
|
94
|
+
@@ -34,7 +38,11 @@ public class SymbolModule: Module {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Prop("resizeMode") { (view, resizeMode: SymbolContentMode?) in
|
|
98
|
+
+ #if os(macOS)
|
|
99
|
+
+ view.imageContentMode = resizeMode?.toContentMode() ?? .scaleProportionallyUpOrDown
|
|
100
|
+
+ #else
|
|
101
|
+
view.imageContentMode = resizeMode?.toContentMode() ?? .scaleAspectFit
|
|
102
|
+
+ #endif
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Prop("animationSpec") { (view, spec: AnimationSpec?) in
|
|
106
|
+
diff --git a/ios/SymbolRecords.swift b/ios/SymbolRecords.swift
|
|
107
|
+
index f276485..5f978a1 100644
|
|
108
|
+
--- a/ios/SymbolRecords.swift
|
|
109
|
+
+++ b/ios/SymbolRecords.swift
|
|
110
|
+
@@ -7,6 +7,20 @@ enum SymbolScale: String, Enumerable {
|
|
111
|
+
case medium
|
|
112
|
+
case large
|
|
113
|
+
|
|
114
|
+
+ #if os(macOS)
|
|
115
|
+
+ func imageSymbolScale() -> NSImage.SymbolScale? {
|
|
116
|
+
+ switch self {
|
|
117
|
+
+ case .small:
|
|
118
|
+
+ return .small
|
|
119
|
+
+ case .medium:
|
|
120
|
+
+ return .medium
|
|
121
|
+
+ case .large:
|
|
122
|
+
+ return .large
|
|
123
|
+
+ case .default, .unspecified:
|
|
124
|
+
+ return nil
|
|
125
|
+
+ }
|
|
126
|
+
+ }
|
|
127
|
+
+ #else
|
|
128
|
+
func imageSymbolScale() -> UIImage.SymbolScale {
|
|
129
|
+
switch self {
|
|
130
|
+
case .default:
|
|
131
|
+
@@ -21,6 +35,7 @@ enum SymbolScale: String, Enumerable {
|
|
132
|
+
return .unspecified
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
+ #endif
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
enum SymbolWeight: String, Enumerable {
|
|
139
|
+
@@ -35,10 +50,20 @@ enum SymbolWeight: String, Enumerable {
|
|
140
|
+
case heavy
|
|
141
|
+
case black
|
|
142
|
+
|
|
143
|
+
- func imageSymbolWeight() -> UIImage.SymbolWeight {
|
|
144
|
+
+ #if os(macOS)
|
|
145
|
+
+ typealias ImageSymbolWeight = NSFont.Weight
|
|
146
|
+
+ #else
|
|
147
|
+
+ typealias ImageSymbolWeight = UIImage.SymbolWeight
|
|
148
|
+
+ #endif
|
|
149
|
+
+
|
|
150
|
+
+ func imageSymbolWeight() -> ImageSymbolWeight {
|
|
151
|
+
switch self {
|
|
152
|
+
case .unspecified:
|
|
153
|
+
+ #if os(macOS)
|
|
154
|
+
+ return .regular
|
|
155
|
+
+ #else
|
|
156
|
+
return .unspecified
|
|
157
|
+
+ #endif
|
|
158
|
+
case .ultraLight:
|
|
159
|
+
return .ultraLight
|
|
160
|
+
case .thin:
|
|
161
|
+
@@ -76,6 +101,19 @@ enum SymbolContentMode: String, Enumerable {
|
|
162
|
+
case bottomLeft
|
|
163
|
+
case bottomRight
|
|
164
|
+
|
|
165
|
+
+ #if os(macOS)
|
|
166
|
+
+ // NSImageView can only stretch, fit, or draw at its natural size.
|
|
167
|
+
+ func toContentMode() -> NSImageScaling {
|
|
168
|
+
+ switch self {
|
|
169
|
+
+ case .scaleToFill:
|
|
170
|
+
+ return .scaleAxesIndependently
|
|
171
|
+
+ case .scaleAspectFit, .scaleAspectFill:
|
|
172
|
+
+ return .scaleProportionallyUpOrDown
|
|
173
|
+
+ default:
|
|
174
|
+
+ return .scaleNone
|
|
175
|
+
+ }
|
|
176
|
+
+ }
|
|
177
|
+
+ #else
|
|
178
|
+
func toContentMode() -> UIView.ContentMode {
|
|
179
|
+
switch self {
|
|
180
|
+
case .scaleToFill:
|
|
181
|
+
@@ -106,6 +144,7 @@ enum SymbolContentMode: String, Enumerable {
|
|
182
|
+
return .bottomRight
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
+ #endif
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
enum SymbolType: String, Enumerable {
|
|
189
|
+
diff --git a/ios/SymbolView.swift b/ios/SymbolView.swift
|
|
190
|
+
index 5e59ad5..edfb848 100644
|
|
191
|
+
--- a/ios/SymbolView.swift
|
|
192
|
+
+++ b/ios/SymbolView.swift
|
|
193
|
+
@@ -1,13 +1,25 @@
|
|
194
|
+
import ExpoModulesCore
|
|
195
|
+
|
|
196
|
+
+#if os(macOS)
|
|
197
|
+
+typealias SymbolImageView = NSImageView
|
|
198
|
+
+#else
|
|
199
|
+
+typealias SymbolImageView = UIImageView
|
|
200
|
+
+#endif
|
|
201
|
+
+
|
|
202
|
+
class SymbolView: ExpoView {
|
|
203
|
+
- let imageView = UIImageView()
|
|
204
|
+
+ let imageView = SymbolImageView()
|
|
205
|
+
|
|
206
|
+
// MARK: Properties
|
|
207
|
+
var name: String = ""
|
|
208
|
+
+ #if os(macOS)
|
|
209
|
+
+ var weight: NSFont.Weight = .regular
|
|
210
|
+
+ var scale: NSImage.SymbolScale?
|
|
211
|
+
+ var imageContentMode: NSImageScaling = .scaleAxesIndependently
|
|
212
|
+
+ #else
|
|
213
|
+
var weight: UIImage.SymbolWeight = .unspecified
|
|
214
|
+
var scale: UIImage.SymbolScale = .default
|
|
215
|
+
var imageContentMode: UIView.ContentMode = .scaleToFill
|
|
216
|
+
+ #endif
|
|
217
|
+
var symbolType: SymbolType = .monochrome
|
|
218
|
+
var tint: UIColor?
|
|
219
|
+
var animationSpec: AnimationSpec?
|
|
220
|
+
@@ -23,6 +35,44 @@ class SymbolView: ExpoView {
|
|
221
|
+
imageView.frame = bounds
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
+ #if os(macOS)
|
|
225
|
+
+ func reloadSymbol() {
|
|
226
|
+
+ guard let image = NSImage(systemSymbolName: name, accessibilityDescription: nil) else {
|
|
227
|
+
+ return
|
|
228
|
+
+ }
|
|
229
|
+
+ imageView.imageScaling = imageContentMode
|
|
230
|
+
+ imageView.symbolConfiguration = getSymbolConfig()
|
|
231
|
+
+ // AppKit tints template images through the view rather than the image.
|
|
232
|
+
+ imageView.contentTintColor = symbolType == .hierarchical ? nil : tint
|
|
233
|
+
+ imageView.image = image
|
|
234
|
+
+
|
|
235
|
+
+ // Effects need to be added last
|
|
236
|
+
+ imageView.removeAllSymbolEffects()
|
|
237
|
+
+ if animated {
|
|
238
|
+
+ addSymbolEffects()
|
|
239
|
+
+ }
|
|
240
|
+
+ }
|
|
241
|
+
+
|
|
242
|
+
+ private func getSymbolConfig() -> NSImage.SymbolConfiguration {
|
|
243
|
+
+ var config = scale.map { NSImage.SymbolConfiguration(pointSize: NSFont.systemFontSize, weight: weight, scale: $0) }
|
|
244
|
+
+ ?? NSImage.SymbolConfiguration(pointSize: NSFont.systemFontSize, weight: weight)
|
|
245
|
+
+
|
|
246
|
+
+ switch symbolType {
|
|
247
|
+
+ case .monochrome:
|
|
248
|
+
+ config = config.applying(.preferringMonochrome())
|
|
249
|
+
+ case .hierarchical:
|
|
250
|
+
+ config = config.applying(NSImage.SymbolConfiguration(hierarchicalColor: tint ?? .systemBlue))
|
|
251
|
+
+ case .palette:
|
|
252
|
+
+ if palette.count > 1 {
|
|
253
|
+
+ config = config.applying(NSImage.SymbolConfiguration(paletteColors: palette))
|
|
254
|
+
+ }
|
|
255
|
+
+ case .multicolor:
|
|
256
|
+
+ config = config.applying(.preferringMulticolor())
|
|
257
|
+
+ }
|
|
258
|
+
+
|
|
259
|
+
+ return config
|
|
260
|
+
+ }
|
|
261
|
+
+ #else
|
|
262
|
+
func reloadSymbol() {
|
|
263
|
+
guard let image = UIImage(systemName: name) else {
|
|
264
|
+
return
|
|
265
|
+
@@ -45,6 +95,7 @@ class SymbolView: ExpoView {
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
+ #endif
|
|
270
|
+
|
|
271
|
+
@available(iOS 17.0, tvOS 17.0, *)
|
|
272
|
+
private func addSymbolEffects() {
|
|
273
|
+
@@ -71,6 +122,7 @@ class SymbolView: ExpoView {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
+ #if !os(macOS)
|
|
278
|
+
private func getSymbolConfig() -> UIImage.SymbolConfiguration {
|
|
279
|
+
#if os(tvOS)
|
|
280
|
+
var config = UIImage.SymbolConfiguration(pointSize: 18.0, weight: weight, scale: scale)
|
|
281
|
+
@@ -95,4 +147,5 @@ class SymbolView: ExpoView {
|
|
282
|
+
|
|
283
|
+
return config
|
|
284
|
+
}
|
|
285
|
+
+ #endif
|
|
286
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
diff --git a/ios/ExpoSystemUI/ExpoSystemUIModule.swift b/ios/ExpoSystemUI/ExpoSystemUIModule.swift
|
|
2
|
+
index 79e7b61..703babf 100644
|
|
3
|
+
--- a/ios/ExpoSystemUI/ExpoSystemUIModule.swift
|
|
4
|
+
+++ b/ios/ExpoSystemUI/ExpoSystemUIModule.swift
|
|
5
|
+
@@ -28,6 +28,36 @@ public class ExpoSystemUIModule: Module {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
+ #if os(macOS)
|
|
10
|
+
+ // The app delegate owns the main window, as on iOS.
|
|
11
|
+
+ static var mainWindow: NSWindow? {
|
|
12
|
+
+ guard let delegate = NSApp.delegate as? NSObject, delegate.responds(to: Selector(("window"))) else {
|
|
13
|
+
+ return nil
|
|
14
|
+
+ }
|
|
15
|
+
+ return delegate.value(forKey: "window") as? NSWindow
|
|
16
|
+
+ }
|
|
17
|
+
+
|
|
18
|
+
+ static func getBackgroundColor() -> String? {
|
|
19
|
+
+ var color: String?
|
|
20
|
+
+ EXUtilities.performSynchronously {
|
|
21
|
+
+ if let backgroundColor = mainWindow?.backgroundColor.usingColorSpace(.sRGB)?.cgColor {
|
|
22
|
+
+ color = EXUtilities.hexString(with: backgroundColor)
|
|
23
|
+
+ }
|
|
24
|
+
+ }
|
|
25
|
+
+ return color
|
|
26
|
+
+ }
|
|
27
|
+
+
|
|
28
|
+
+ static func setBackgroundColorAsync(color: Int?) {
|
|
29
|
+
+ EXUtilities.performSynchronously {
|
|
30
|
+
+ if let color {
|
|
31
|
+
+ UserDefaults.standard.set(color, forKey: colorKey)
|
|
32
|
+
+ } else {
|
|
33
|
+
+ UserDefaults.standard.removeObject(forKey: colorKey)
|
|
34
|
+
+ }
|
|
35
|
+
+ mainWindow?.backgroundColor = color.flatMap { EXUtilities.uiColor($0) } ?? .windowBackgroundColor
|
|
36
|
+
+ }
|
|
37
|
+
+ }
|
|
38
|
+
+ #else
|
|
39
|
+
static func getBackgroundColor() -> String? {
|
|
40
|
+
var color: String?
|
|
41
|
+
EXUtilities.performSynchronously {
|
|
42
|
+
@@ -70,4 +100,5 @@ public class ExpoSystemUIModule: Module {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
+ #endif
|
|
47
|
+
}
|
|
48
|
+
diff --git a/ios/ExpoSystemUI.podspec b/ios/ExpoSystemUI.podspec
|
|
49
|
+
index 6cf5c56..0723ef6 100644
|
|
50
|
+
--- a/ios/ExpoSystemUI.podspec
|
|
51
|
+
+++ b/ios/ExpoSystemUI.podspec
|
|
52
|
+
@@ -12,7 +12,8 @@ Pod::Spec.new do |s|
|
|
53
|
+
s.homepage = package['homepage']
|
|
54
|
+
s.platforms = {
|
|
55
|
+
:ios => '15.1',
|
|
56
|
+
- :tvos => '15.1'
|
|
57
|
+
+ :tvos => '15.1',
|
|
58
|
+
+ :osx => '14.0'
|
|
59
|
+
}
|
|
60
|
+
s.swift_version = '5.9'
|
|
61
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/ios/WebBrowserSession.swift b/ios/WebBrowserSession.swift
|
|
2
|
+
index d3d2981..1ac7c6b 100644
|
|
3
|
+
--- a/ios/WebBrowserSession.swift
|
|
4
|
+
+++ b/ios/WebBrowserSession.swift
|
|
5
|
+
@@ -126,6 +126,8 @@ internal class WebBrowserSession: NSObject, WKNavigationDelegate, WKUIDelegate,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
func dismiss(completion: ((String) -> Void)? = nil) {
|
|
9
|
+
+ // Closing reports "cancel" through windowWillClose, as for the user; a dismiss reports "dismiss", as on iOS.
|
|
10
|
+
+ window?.delegate = nil
|
|
11
|
+
window?.close()
|
|
12
|
+
let type = "dismiss"
|
|
13
|
+
finish(type: type)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
diff --git a/react-native-app-logs.podspec b/react-native-app-logs.podspec
|
|
2
|
+
index 9ce28e8..d815df0 100644
|
|
3
|
+
--- a/react-native-app-logs.podspec
|
|
4
|
+
+++ b/react-native-app-logs.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 => "https://github.com/kirillzyusko/react-native-app-logs.git", :tag => "#{s.version}" }
|
|
12
|
+
|
|
13
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
14
|
+
diff --git a/src/bindings.macos.ts b/src/bindings.macos.ts
|
|
15
|
+
new file mode 100644
|
|
16
|
+
index 0000000..2d2a485
|
|
17
|
+
--- /dev/null
|
|
18
|
+
+++ b/src/bindings.macos.ts
|
|
19
|
+
@@ -0,0 +1 @@
|
|
20
|
+
+export { default } from './bindings.ios';
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
diff --git a/ios/BlurhashModule.mm b/ios/BlurhashModule.mm
|
|
2
|
+
index 189b790..a5b24bd 100644
|
|
3
|
+
--- a/ios/BlurhashModule.mm
|
|
4
|
+
+++ b/ios/BlurhashModule.mm
|
|
5
|
+
@@ -1,7 +1,9 @@
|
|
6
|
+
#import "BlurhashModule.h"
|
|
7
|
+
|
|
8
|
+
#import <React/RCTUtils.h>
|
|
9
|
+
+#if !TARGET_OS_OSX
|
|
10
|
+
#import <UIKit/UIKit.h>
|
|
11
|
+
+#endif
|
|
12
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
13
|
+
#import <blurhash_codegen/blurhash_codegen.h>
|
|
14
|
+
#endif
|
|
15
|
+
diff --git a/ios/BlurhashModuleImpl.swift b/ios/BlurhashModuleImpl.swift
|
|
16
|
+
index dc5f62e..ca0f795 100644
|
|
17
|
+
--- a/ios/BlurhashModuleImpl.swift
|
|
18
|
+
+++ b/ios/BlurhashModuleImpl.swift
|
|
19
|
+
@@ -7,7 +7,11 @@
|
|
20
|
+
//
|
|
21
|
+
|
|
22
|
+
import Foundation
|
|
23
|
+
+#if canImport(UIKit)
|
|
24
|
+
import UIKit
|
|
25
|
+
+#else
|
|
26
|
+
+import AppKit
|
|
27
|
+
+#endif
|
|
28
|
+
|
|
29
|
+
@objc
|
|
30
|
+
public final class BlurhashModuleImpl: NSObject {
|
|
31
|
+
diff --git a/ios/BlurhashPlatform.swift b/ios/BlurhashPlatform.swift
|
|
32
|
+
new file mode 100644
|
|
33
|
+
index 0000000..b9a3e49
|
|
34
|
+
--- /dev/null
|
|
35
|
+
+++ b/ios/BlurhashPlatform.swift
|
|
36
|
+
@@ -0,0 +1,6 @@
|
|
37
|
+
+#if os(macOS)
|
|
38
|
+
+import AppKit
|
|
39
|
+
+
|
|
40
|
+
+// The decoder and encoder extend UIImage; on macOS that is NSImage.
|
|
41
|
+
+public typealias UIImage = NSImage
|
|
42
|
+
+#endif
|
|
43
|
+
diff --git a/ios/BlurhashView.swift b/ios/BlurhashView.swift
|
|
44
|
+
index 795e58e..45a3ace 100644
|
|
45
|
+
--- a/ios/BlurhashView.swift
|
|
46
|
+
+++ b/ios/BlurhashView.swift
|
|
47
|
+
@@ -7,7 +7,13 @@
|
|
48
|
+
//
|
|
49
|
+
|
|
50
|
+
import Foundation
|
|
51
|
+
+#if os(macOS)
|
|
52
|
+
+import AppKit
|
|
53
|
+
+public typealias BlurhashPlatformView = NSView
|
|
54
|
+
+#else
|
|
55
|
+
import UIKit
|
|
56
|
+
+public typealias BlurhashPlatformView = UIView
|
|
57
|
+
+#endif
|
|
58
|
+
|
|
59
|
+
@objc
|
|
60
|
+
public protocol BlurhashViewDelegate {
|
|
61
|
+
@@ -16,12 +22,17 @@ public protocol BlurhashViewDelegate {
|
|
62
|
+
func blurhashViewLoadDidError(_ message: String?)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
-public final class BlurhashView: UIView {
|
|
66
|
+
+public final class BlurhashView: BlurhashPlatformView {
|
|
67
|
+
@objc public var blurhash: String?
|
|
68
|
+
@objc public var decodeWidth: Int = 32
|
|
69
|
+
@objc public var decodeHeight: Int = 32
|
|
70
|
+
@objc public var decodePunch: Float = 1
|
|
71
|
+
@objc public var decodeAsync: Bool = false
|
|
72
|
+
+#if os(macOS)
|
|
73
|
+
+ @objc public var contentsGravity: CALayerContentsGravity = .resizeAspectFill {
|
|
74
|
+
+ didSet { layer?.contentsGravity = contentsGravity }
|
|
75
|
+
+ }
|
|
76
|
+
+#else
|
|
77
|
+
@objc override public var contentMode: ContentMode {
|
|
78
|
+
get {
|
|
79
|
+
imageContainer.contentMode
|
|
80
|
+
@@ -30,10 +41,19 @@ public final class BlurhashView: UIView {
|
|
81
|
+
imageContainer.contentMode = newValue
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
+#endif
|
|
85
|
+
|
|
86
|
+
@objc public weak var delegate: BlurhashViewDelegate?
|
|
87
|
+
|
|
88
|
+
private var lastState: BlurhashCache?
|
|
89
|
+
+#if os(macOS)
|
|
90
|
+
+ override public init(frame: CGRect) {
|
|
91
|
+
+ super.init(frame: frame)
|
|
92
|
+
+ wantsLayer = true
|
|
93
|
+
+ layer?.masksToBounds = true
|
|
94
|
+
+ layer?.contentsGravity = contentsGravity
|
|
95
|
+
+ }
|
|
96
|
+
+#else
|
|
97
|
+
private let imageContainer: UIImageView
|
|
98
|
+
|
|
99
|
+
override public init(frame: CGRect) {
|
|
100
|
+
@@ -44,6 +64,7 @@ public final class BlurhashView: UIView {
|
|
101
|
+
super.init(frame: frame)
|
|
102
|
+
addSubview(imageContainer)
|
|
103
|
+
}
|
|
104
|
+
+#endif
|
|
105
|
+
|
|
106
|
+
@available(*, unavailable)
|
|
107
|
+
required init?(coder _: NSCoder) {
|
|
108
|
+
@@ -119,12 +140,15 @@ public final class BlurhashView: UIView {
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private final func setImageContainerImage(image: UIImage?) {
|
|
112
|
+
+#if os(macOS)
|
|
113
|
+
+ let show: () -> Void = { self.layer?.contents = image?.cgImage(forProposedRect: nil, context: nil, hints: nil) }
|
|
114
|
+
+#else
|
|
115
|
+
+ let show: () -> Void = { self.imageContainer.image = image }
|
|
116
|
+
+#endif
|
|
117
|
+
if Thread.isMainThread {
|
|
118
|
+
- imageContainer.image = image
|
|
119
|
+
+ show()
|
|
120
|
+
} else {
|
|
121
|
+
- DispatchQueue.main.async {
|
|
122
|
+
- self.imageContainer.image = image
|
|
123
|
+
- }
|
|
124
|
+
+ DispatchQueue.main.async(execute: show)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
diff --git a/ios/BlurhashViewComponentView.h b/ios/BlurhashViewComponentView.h
|
|
129
|
+
index 51c9a3a..93a78eb 100644
|
|
130
|
+
--- a/ios/BlurhashViewComponentView.h
|
|
131
|
+
+++ b/ios/BlurhashViewComponentView.h
|
|
132
|
+
@@ -1,6 +1,8 @@
|
|
133
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
134
|
+
|
|
135
|
+
+#if !TARGET_OS_OSX
|
|
136
|
+
#import <UIKit/UIKit.h>
|
|
137
|
+
+#endif
|
|
138
|
+
|
|
139
|
+
#import <React/RCTViewComponentView.h>
|
|
140
|
+
|
|
141
|
+
diff --git a/ios/BlurhashViewComponentView.mm b/ios/BlurhashViewComponentView.mm
|
|
142
|
+
index e483bfb..ccc38ab 100644
|
|
143
|
+
--- a/ios/BlurhashViewComponentView.mm
|
|
144
|
+
+++ b/ios/BlurhashViewComponentView.mm
|
|
145
|
+
@@ -18,6 +18,21 @@
|
|
146
|
+
|
|
147
|
+
using namespace facebook::react;
|
|
148
|
+
|
|
149
|
+
+#if TARGET_OS_OSX
|
|
150
|
+
+static CALayerContentsGravity convertResizeMode(const BlurhashViewResizeMode &resizeMode)
|
|
151
|
+
+{
|
|
152
|
+
+ switch (resizeMode) {
|
|
153
|
+
+ case BlurhashViewResizeMode::Contain:
|
|
154
|
+
+ return kCAGravityResizeAspect;
|
|
155
|
+
+ case BlurhashViewResizeMode::Cover:
|
|
156
|
+
+ return kCAGravityResizeAspectFill;
|
|
157
|
+
+ case BlurhashViewResizeMode::Stretch:
|
|
158
|
+
+ return kCAGravityResize;
|
|
159
|
+
+ case BlurhashViewResizeMode::Center:
|
|
160
|
+
+ return kCAGravityCenter;
|
|
161
|
+
+ }
|
|
162
|
+
+}
|
|
163
|
+
+#else
|
|
164
|
+
static UIViewContentMode convertResizeMode(const BlurhashViewResizeMode &resizeMode)
|
|
165
|
+
{
|
|
166
|
+
switch (resizeMode) {
|
|
167
|
+
@@ -31,6 +46,7 @@ static UIViewContentMode convertResizeMode(const BlurhashViewResizeMode &resizeM
|
|
168
|
+
return UIViewContentMode::UIViewContentModeCenter;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
+#endif
|
|
172
|
+
|
|
173
|
+
@interface BlurhashViewComponentView () <RCTBlurhashViewViewProtocol, BlurhashViewDelegate>
|
|
174
|
+
@end
|
|
175
|
+
@@ -81,7 +97,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
|
|
176
|
+
_blurhashView.decodeAsync = newViewProps.decodeAsync;
|
|
177
|
+
}
|
|
178
|
+
if (oldViewProps.resizeMode != newViewProps.resizeMode) {
|
|
179
|
+
+#if TARGET_OS_OSX
|
|
180
|
+
+ _blurhashView.contentsGravity = convertResizeMode(newViewProps.resizeMode);
|
|
181
|
+
+#else
|
|
182
|
+
_blurhashView.contentMode = convertResizeMode(newViewProps.resizeMode);
|
|
183
|
+
+#endif
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
[super updateProps:props oldProps:oldProps];
|
|
187
|
+
diff --git a/ios/BlurhashViewManager.m b/ios/BlurhashViewManager.m
|
|
188
|
+
index 318c955..16292b7 100644
|
|
189
|
+
--- a/ios/BlurhashViewManager.m
|
|
190
|
+
+++ b/ios/BlurhashViewManager.m
|
|
191
|
+
@@ -1,3 +1,5 @@
|
|
192
|
+
+#include <TargetConditionals.h>
|
|
193
|
+
+#if !TARGET_OS_OSX
|
|
194
|
+
#import "BlurhashBridge.h"
|
|
195
|
+
#import <React/RCTViewManager.h>
|
|
196
|
+
|
|
197
|
+
@@ -17,3 +19,4 @@ @interface RCT_EXTERN_REMAP_MODULE (BlurhashView, BlurhashViewManager,
|
|
198
|
+
RCT_EXPORT_VIEW_PROPERTY(onLoadError, RCTDirectEventBlock);
|
|
199
|
+
|
|
200
|
+
@end
|
|
201
|
+
+#endif
|
|
202
|
+
diff --git a/ios/BlurhashViewManager.swift b/ios/BlurhashViewManager.swift
|
|
203
|
+
index c1abb62..6b5c6b1 100644
|
|
204
|
+
--- a/ios/BlurhashViewManager.swift
|
|
205
|
+
+++ b/ios/BlurhashViewManager.swift
|
|
206
|
+
@@ -6,6 +6,7 @@
|
|
207
|
+
// Copyright © 2020 Facebook. All rights reserved.
|
|
208
|
+
//
|
|
209
|
+
|
|
210
|
+
+#if !os(macOS)
|
|
211
|
+
import Foundation
|
|
212
|
+
import UIKit
|
|
213
|
+
|
|
214
|
+
@@ -151,3 +152,5 @@ final class BlurhashViewManager: RCTViewManager {
|
|
215
|
+
return true
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
+
|
|
219
|
+
+#endif
|
|
220
|
+
diff --git a/ios/UIImage+BlurhashDecode.swift b/ios/UIImage+BlurhashDecode.swift
|
|
221
|
+
index 7076215..a79516c 100644
|
|
222
|
+
--- a/ios/UIImage+BlurhashDecode.swift
|
|
223
|
+
+++ b/ios/UIImage+BlurhashDecode.swift
|
|
224
|
+
@@ -7,7 +7,11 @@
|
|
225
|
+
//
|
|
226
|
+
|
|
227
|
+
import Foundation
|
|
228
|
+
+#if canImport(UIKit)
|
|
229
|
+
import UIKit
|
|
230
|
+
+#else
|
|
231
|
+
+import AppKit
|
|
232
|
+
+#endif
|
|
233
|
+
|
|
234
|
+
public extension UIImage {
|
|
235
|
+
convenience init?(blurHash: String, size: CGSize, punch: Float = 1) {
|
|
236
|
+
@@ -95,6 +99,10 @@ public extension UIImage {
|
|
237
|
+
shouldInterpolate: true,
|
|
238
|
+
intent: .defaultIntent) else { return nil }
|
|
239
|
+
|
|
240
|
+
+#if os(macOS)
|
|
241
|
+
+ self.init(cgImage: cgImage, size: NSSize(width: width, height: height))
|
|
242
|
+
+#else
|
|
243
|
+
self.init(cgImage: cgImage)
|
|
244
|
+
+#endif
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
diff --git a/ios/UIImage+BlurhashEncode.swift b/ios/UIImage+BlurhashEncode.swift
|
|
248
|
+
index bc68c95..c32c4af 100644
|
|
249
|
+
--- a/ios/UIImage+BlurhashEncode.swift
|
|
250
|
+
+++ b/ios/UIImage+BlurhashEncode.swift
|
|
251
|
+
@@ -7,12 +7,22 @@
|
|
252
|
+
//
|
|
253
|
+
|
|
254
|
+
import Foundation
|
|
255
|
+
+#if canImport(UIKit)
|
|
256
|
+
import UIKit
|
|
257
|
+
+#else
|
|
258
|
+
+import AppKit
|
|
259
|
+
+#endif
|
|
260
|
+
|
|
261
|
+
extension UIImage {
|
|
262
|
+
public func encodeBlurhash(numberOfComponents components: (Int, Int)) -> String? {
|
|
263
|
+
+#if os(macOS)
|
|
264
|
+
+ guard let source = cgImage(forProposedRect: nil, context: nil, hints: nil) else { return nil }
|
|
265
|
+
+ let pixelWidth = source.width
|
|
266
|
+
+ let pixelHeight = source.height
|
|
267
|
+
+#else
|
|
268
|
+
let pixelWidth = Int(round(size.width * scale))
|
|
269
|
+
let pixelHeight = Int(round(size.height * scale))
|
|
270
|
+
+#endif
|
|
271
|
+
|
|
272
|
+
let context = CGContext(
|
|
273
|
+
data: nil,
|
|
274
|
+
@@ -23,12 +33,16 @@ extension UIImage {
|
|
275
|
+
space: CGColorSpace(name: CGColorSpace.sRGB)!,
|
|
276
|
+
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
|
|
277
|
+
)!
|
|
278
|
+
+#if os(macOS)
|
|
279
|
+
+ context.draw(source, in: CGRect(x: 0, y: 0, width: pixelWidth, height: pixelHeight))
|
|
280
|
+
+#else
|
|
281
|
+
context.scaleBy(x: scale, y: -scale)
|
|
282
|
+
context.translateBy(x: 0, y: -size.height)
|
|
283
|
+
|
|
284
|
+
UIGraphicsPushContext(context)
|
|
285
|
+
draw(at: .zero)
|
|
286
|
+
UIGraphicsPopContext()
|
|
287
|
+
+#endif
|
|
288
|
+
|
|
289
|
+
guard let cgImage = context.makeImage(),
|
|
290
|
+
let dataProvider = cgImage.dataProvider,
|
|
291
|
+
diff --git a/package.json b/package.json
|
|
292
|
+
index dcc1bf5..6edaa33 100644
|
|
293
|
+
--- a/package.json
|
|
294
|
+
+++ b/package.json
|
|
295
|
+
@@ -108,6 +108,11 @@
|
|
296
|
+
"name": "blurhash_codegen",
|
|
297
|
+
"type": "all",
|
|
298
|
+
"jsSrcsDir": "./src/specs",
|
|
299
|
+
+ "ios": {
|
|
300
|
+
+ "componentProvider": {
|
|
301
|
+
+ "BlurhashView": "BlurhashViewComponentView"
|
|
302
|
+
+ }
|
|
303
|
+
+ },
|
|
304
|
+
"android": {
|
|
305
|
+
"javaPackageName": "com.mrousavy.blurhash"
|
|
306
|
+
}
|
|
307
|
+
diff --git a/react-native-blurhash.podspec b/react-native-blurhash.podspec
|
|
308
|
+
index bb6ea68..ae7198c 100644
|
|
309
|
+
--- a/react-native-blurhash.podspec
|
|
310
|
+
+++ b/react-native-blurhash.podspec
|
|
311
|
+
@@ -17,6 +17,7 @@ Pod::Spec.new do |s|
|
|
312
|
+
s.authors = { "Marc Rousavy" => "marcrousavy@hotmail.com" }
|
|
313
|
+
s.ios.deployment_target = '9.0'
|
|
314
|
+
s.tvos.deployment_target = '9.0'
|
|
315
|
+
+ s.osx.deployment_target = '14.0'
|
|
316
|
+
s.source = { :git => "https://github.com/mrousavy/react-native-blurhash.git", :tag => "#{s.version}" }
|
|
317
|
+
|
|
318
|
+
s.source_files = "ios/**/*.{h,c,m,mm,swift}"
|