@expo/ui 0.2.0-alpha.0 → 0.2.0-alpha.2
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/CHANGELOG.md +15 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AlertDialogView.kt +3 -1
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +6 -6
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +4 -3
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +88 -0
- package/android/src/main/java/expo/modules/ui/Modifiers.kt +15 -0
- package/android/src/main/java/expo/modules/ui/PickerView.kt +7 -2
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +8 -4
- package/android/src/main/java/expo/modules/ui/ShapeView.kt +3 -2
- package/android/src/main/java/expo/modules/ui/SliderView.kt +4 -2
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +3 -2
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +4 -2
- package/android/src/main/java/expo/modules/ui/button/Button.kt +17 -8
- package/build/jetpack-compose/AlertDialog/index.d.ts +3 -0
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/AlertDialog/index.js +3 -1
- package/build/jetpack-compose/AlertDialog/index.js.map +1 -1
- package/build/jetpack-compose/Button/index.d.ts +3 -1
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Button/index.js +2 -0
- package/build/jetpack-compose/Button/index.js.map +1 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +3 -0
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +1 -1
- package/build/jetpack-compose/ContextMenu/index.js +3 -1
- package/build/jetpack-compose/ContextMenu/index.js.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +3 -1
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.js +2 -0
- package/build/jetpack-compose/DatePicker/index.js.map +1 -1
- package/build/jetpack-compose/Picker/index.d.ts +5 -0
- package/build/jetpack-compose/Picker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Picker/index.js +4 -0
- package/build/jetpack-compose/Picker/index.js.map +1 -1
- package/build/jetpack-compose/Progress/index.d.ts +5 -0
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/Progress/index.js +4 -2
- package/build/jetpack-compose/Progress/index.js.map +1 -1
- package/build/jetpack-compose/Shape/index.d.ts +4 -1
- package/build/jetpack-compose/Shape/index.d.ts.map +1 -1
- package/build/jetpack-compose/Shape/index.js +3 -1
- package/build/jetpack-compose/Shape/index.js.map +1 -1
- package/build/jetpack-compose/Slider/index.d.ts +3 -1
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Slider/index.js +2 -0
- package/build/jetpack-compose/Slider/index.js.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +3 -0
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/Switch/index.js +2 -0
- package/build/jetpack-compose/Switch/index.js.map +1 -1
- package/build/jetpack-compose/TextInput/index.d.ts +3 -1
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextInput/index.js +2 -0
- package/build/jetpack-compose/TextInput/index.js.map +1 -1
- package/build/jetpack-compose/index.d.ts +1 -0
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.js +1 -0
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/jetpack-compose/modifiers.d.ts +14 -0
- package/build/jetpack-compose/modifiers.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers.js +15 -0
- package/build/jetpack-compose/modifiers.js.map +1 -0
- package/build/swift-ui/BottomSheet/index.d.ts +2 -14
- package/build/swift-ui/BottomSheet/index.d.ts.map +1 -1
- package/build/swift-ui/BottomSheet/index.js +7 -15
- package/build/swift-ui/BottomSheet/index.js.map +1 -1
- package/build/swift-ui/Button/index.d.ts +6 -11
- package/build/swift-ui/Button/index.d.ts.map +1 -1
- package/build/swift-ui/Button/index.js +7 -14
- package/build/swift-ui/Button/index.js.map +1 -1
- package/build/swift-ui/ColorPicker/index.d.ts +3 -10
- package/build/swift-ui/ColorPicker/index.d.ts.map +1 -1
- package/build/swift-ui/ColorPicker/index.js +5 -14
- package/build/swift-ui/ColorPicker/index.js.map +1 -1
- package/build/{swift-ui-primitives/ContentUnavailableView.d.ts → swift-ui/ContentUnavailableView/index.d.ts} +3 -8
- package/build/swift-ui/ContentUnavailableView/index.d.ts.map +1 -0
- package/build/swift-ui/ContentUnavailableView/index.js +19 -0
- package/build/swift-ui/ContentUnavailableView/index.js.map +1 -0
- package/build/swift-ui/ContextMenu/Submenu.d.ts +21 -0
- package/build/swift-ui/ContextMenu/Submenu.d.ts.map +1 -0
- package/build/swift-ui/ContextMenu/Submenu.js +8 -0
- package/build/swift-ui/ContextMenu/Submenu.js.map +1 -0
- package/build/swift-ui/ContextMenu/index.d.ts +6 -87
- package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
- package/build/swift-ui/ContextMenu/index.js +11 -26
- package/build/swift-ui/ContextMenu/index.js.map +1 -1
- package/build/swift-ui/ContextMenu/types.d.ts +36 -0
- package/build/swift-ui/ContextMenu/types.d.ts.map +1 -0
- package/build/swift-ui/ContextMenu/types.js.map +1 -0
- package/build/swift-ui/ContextMenu/utils.d.ts +4 -4
- package/build/swift-ui/ContextMenu/utils.d.ts.map +1 -1
- package/build/swift-ui/ContextMenu/utils.js +7 -7
- package/build/swift-ui/ContextMenu/utils.js.map +1 -1
- package/build/swift-ui/DatePicker/index.d.ts +3 -21
- package/build/swift-ui/DatePicker/index.d.ts.map +1 -1
- package/build/swift-ui/DatePicker/index.js +6 -28
- package/build/swift-ui/DatePicker/index.js.map +1 -1
- package/build/{swift-ui-primitives/DisclosureGroup.d.ts → swift-ui/DisclosureGroup/index.d.ts} +2 -8
- package/build/swift-ui/DisclosureGroup/index.d.ts.map +1 -0
- package/build/swift-ui/DisclosureGroup/index.js +16 -0
- package/build/swift-ui/DisclosureGroup/index.js.map +1 -0
- package/build/{swift-ui-primitives/Form.d.ts → swift-ui/Form/index.d.ts} +2 -2
- package/build/swift-ui/Form/index.d.ts.map +1 -0
- package/build/swift-ui/Form/index.js +15 -0
- package/build/swift-ui/Form/index.js.map +1 -0
- package/build/swift-ui/Gauge/index.d.ts +4 -10
- package/build/swift-ui/Gauge/index.d.ts.map +1 -1
- package/build/swift-ui/Gauge/index.js +4 -20
- package/build/swift-ui/Gauge/index.js.map +1 -1
- package/build/swift-ui/Host/index.d.ts +2 -1
- package/build/swift-ui/Host/index.d.ts.map +1 -1
- package/build/swift-ui/Host/index.js +3 -2
- package/build/swift-ui/Host/index.js.map +1 -1
- package/build/{swift-ui-primitives/Image.d.ts → swift-ui/Image/index.d.ts} +2 -2
- package/build/swift-ui/Image/index.d.ts.map +1 -0
- package/build/{swift-ui-primitives/Image.js → swift-ui/Image/index.js} +5 -2
- package/build/swift-ui/Image/index.js.map +1 -0
- package/build/swift-ui/Label/index.d.ts +3 -10
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/Label/index.js +3 -11
- package/build/swift-ui/Label/index.js.map +1 -1
- package/build/{swift-ui-primitives/Layout.d.ts → swift-ui/Layout/index.d.ts} +3 -3
- package/build/swift-ui/Layout/index.d.ts.map +1 -0
- package/build/{swift-ui-primitives/Layout.js → swift-ui/Layout/index.js} +15 -3
- package/build/swift-ui/Layout/index.js.map +1 -0
- package/build/swift-ui/List/index.d.ts +3 -34
- package/build/swift-ui/List/index.d.ts.map +1 -1
- package/build/swift-ui/List/index.js +7 -16
- package/build/swift-ui/List/index.js.map +1 -1
- package/build/swift-ui/Picker/index.d.ts +3 -16
- package/build/swift-ui/Picker/index.d.ts.map +1 -1
- package/build/swift-ui/Picker/index.js +7 -16
- package/build/swift-ui/Picker/index.js.map +1 -1
- package/build/swift-ui/Progress/index.d.ts +6 -19
- package/build/swift-ui/Progress/index.d.ts.map +1 -1
- package/build/swift-ui/Progress/index.js +5 -21
- package/build/swift-ui/Progress/index.js.map +1 -1
- package/build/swift-ui/Section/index.d.ts +4 -11
- package/build/swift-ui/Section/index.d.ts.map +1 -1
- package/build/swift-ui/Section/index.js +3 -11
- package/build/swift-ui/Section/index.js.map +1 -1
- package/build/swift-ui/SecureField/index.d.ts +3 -14
- package/build/swift-ui/SecureField/index.d.ts.map +1 -1
- package/build/swift-ui/SecureField/index.js +5 -14
- package/build/swift-ui/SecureField/index.js.map +1 -1
- package/build/swift-ui/ShareLink/index.d.ts +3 -10
- package/build/swift-ui/ShareLink/index.d.ts.map +1 -1
- package/build/swift-ui/ShareLink/index.js +3 -11
- package/build/swift-ui/ShareLink/index.js.map +1 -1
- package/build/swift-ui/Slider/index.d.ts +3 -15
- package/build/swift-ui/Slider/index.d.ts.map +1 -1
- package/build/swift-ui/Slider/index.js +7 -12
- package/build/swift-ui/Slider/index.js.map +1 -1
- package/build/{swift-ui-primitives/Spacer.d.ts → swift-ui/Spacer/index.d.ts} +2 -2
- package/build/swift-ui/Spacer/index.d.ts.map +1 -0
- package/build/swift-ui/Spacer/index.js +15 -0
- package/build/swift-ui/Spacer/index.js.map +1 -0
- package/build/swift-ui/Switch/index.d.ts +3 -20
- package/build/swift-ui/Switch/index.d.ts.map +1 -1
- package/build/swift-ui/Switch/index.js +7 -16
- package/build/swift-ui/Switch/index.js.map +1 -1
- package/build/{swift-ui-primitives/Text.d.ts → swift-ui/Text/index.d.ts} +2 -2
- package/build/swift-ui/Text/index.d.ts.map +1 -0
- package/build/{swift-ui-primitives/Text.js → swift-ui/Text/index.js} +5 -2
- package/build/swift-ui/Text/index.js.map +1 -0
- package/build/swift-ui/TextField/index.d.ts +4 -11
- package/build/swift-ui/TextField/index.d.ts.map +1 -1
- package/build/swift-ui/TextField/index.js +5 -14
- package/build/swift-ui/TextField/index.js.map +1 -1
- package/build/swift-ui/index.d.ts +7 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/index.js +7 -0
- package/build/swift-ui/index.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +259 -0
- package/build/swift-ui/modifiers/index.d.ts.map +1 -0
- package/build/swift-ui/modifiers/index.js +224 -0
- package/build/swift-ui/modifiers/index.js.map +1 -0
- package/build/swift-ui/modifiers/utils.d.ts +15 -0
- package/build/swift-ui/modifiers/utils.d.ts.map +1 -0
- package/build/swift-ui/modifiers/utils.js +23 -0
- package/build/swift-ui/modifiers/utils.js.map +1 -0
- package/build/{swift-ui-primitives → swift-ui}/types.d.ts +47 -4
- package/build/swift-ui/types.d.ts.map +1 -0
- package/build/swift-ui/types.js +2 -0
- package/build/swift-ui/types.js.map +1 -0
- package/build/types.d.ts +3 -0
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +9 -1
- package/ios/Button/Button.swift +1 -0
- package/ios/Button/ButtonProps.swift +7 -2
- package/ios/ColorPickerView.swift +8 -1
- package/ios/ContentUnavailableView.swift +3 -1
- package/ios/ContextMenu/ContextMenu.swift +5 -0
- package/ios/ContextMenu/ContextMenuRecords.swift +19 -3
- package/ios/DateTimePickerView.swift +8 -1
- package/ios/DisclosureGroupView.swift +4 -2
- package/ios/ExpoUIModule.swift +25 -28
- package/ios/FormView.swift +3 -1
- package/ios/Gauge/Gauge.swift +1 -0
- package/ios/Gauge/GaugeProps.swift +7 -1
- package/ios/GroupView.swift +3 -1
- package/ios/HStackView.swift +3 -1
- package/ios/HostView.swift +1 -1
- package/ios/ImageView.swift +3 -1
- package/ios/Label.swift +9 -2
- package/ios/List.swift +8 -2
- package/ios/Modifiers/CommonViewModifiers.swift +6 -3
- package/ios/Modifiers/View+ModifierArray.swift +27 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +718 -0
- package/ios/PickerView.swift +8 -1
- package/ios/ProgressView.swift +8 -1
- package/ios/SectionView.swift +9 -20
- package/ios/SecureField/SecureFieldView.swift +10 -2
- package/ios/ShareLinkView.swift +9 -1
- package/ios/SliderView.swift +8 -1
- package/ios/SpacerView.swift +3 -1
- package/ios/SwitchView.swift +8 -1
- package/ios/TextField/TextFieldView.swift +8 -1
- package/ios/TextView.swift +3 -1
- package/ios/VStackView.swift +3 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.module → 0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.pom → 0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +4 -4
- package/src/jetpack-compose/AlertDialog/index.tsx +12 -1
- package/src/jetpack-compose/Button/index.tsx +6 -1
- package/src/jetpack-compose/ContextMenu/index.tsx +6 -0
- package/src/jetpack-compose/DatePicker/index.tsx +5 -1
- package/src/jetpack-compose/Picker/index.tsx +10 -0
- package/src/jetpack-compose/Progress/index.tsx +20 -2
- package/src/jetpack-compose/Shape/index.tsx +17 -2
- package/src/jetpack-compose/Slider/index.tsx +6 -1
- package/src/jetpack-compose/Switch/index.tsx +7 -0
- package/src/jetpack-compose/TextInput/index.tsx +6 -1
- package/src/jetpack-compose/{index.tsx → index.ts} +1 -0
- package/src/jetpack-compose/modifiers.ts +19 -0
- package/src/swift-ui/BottomSheet/index.tsx +10 -19
- package/src/swift-ui/Button/index.tsx +11 -20
- package/src/swift-ui/ColorPicker/index.tsx +10 -18
- package/src/{swift-ui-primitives/ContentUnavailableView.tsx → swift-ui/ContentUnavailableView/index.tsx} +16 -9
- package/src/swift-ui/ContextMenu/Submenu.tsx +25 -0
- package/src/swift-ui/ContextMenu/index.tsx +23 -100
- package/src/swift-ui/ContextMenu/types.ts +47 -0
- package/src/swift-ui/ContextMenu/utils.ts +8 -13
- package/src/swift-ui/DatePicker/index.tsx +10 -40
- package/src/{swift-ui-primitives/DisclosureGroup.tsx → swift-ui/DisclosureGroup/index.tsx} +12 -6
- package/src/swift-ui/Form/index.tsx +30 -0
- package/src/swift-ui/Gauge/index.tsx +12 -23
- package/src/swift-ui/Host/index.tsx +7 -2
- package/src/{swift-ui-primitives/Image.tsx → swift-ui/Image/index.tsx} +6 -3
- package/src/swift-ui/Label/index.tsx +10 -15
- package/src/{swift-ui-primitives/Layout.tsx → swift-ui/Layout/index.tsx} +17 -4
- package/src/swift-ui/List/index.tsx +16 -28
- package/src/swift-ui/Picker/index.tsx +10 -22
- package/src/swift-ui/Progress/index.tsx +21 -28
- package/src/swift-ui/Section/index.tsx +11 -16
- package/src/swift-ui/SecureField/index.tsx +10 -22
- package/src/swift-ui/ShareLink/index.tsx +10 -15
- package/src/swift-ui/Slider/index.tsx +10 -18
- package/src/{swift-ui-primitives/Spacer.tsx → swift-ui/Spacer/index.tsx} +12 -2
- package/src/swift-ui/Switch/index.tsx +12 -22
- package/src/{swift-ui-primitives/Text.tsx → swift-ui/Text/index.tsx} +6 -2
- package/src/swift-ui/TextField/index.tsx +9 -21
- package/src/swift-ui/index.tsx +7 -0
- package/src/swift-ui/modifiers/index.ts +374 -0
- package/src/swift-ui/modifiers/utils.ts +33 -0
- package/src/{swift-ui-primitives → swift-ui}/types.ts +48 -4
- package/src/types.ts +4 -0
- package/swift-ui/index.d.ts +1 -0
- package/swift-ui/index.js +1 -0
- package/swift-ui/modifiers.d.ts +1 -0
- package/swift-ui/modifiers.js +1 -0
- package/build/swift-ui-primitives/ContentUnavailableView.d.ts.map +0 -1
- package/build/swift-ui-primitives/ContentUnavailableView.js +0 -15
- package/build/swift-ui-primitives/ContentUnavailableView.js.map +0 -1
- package/build/swift-ui-primitives/DisclosureGroup.d.ts.map +0 -1
- package/build/swift-ui-primitives/DisclosureGroup.js +0 -10
- package/build/swift-ui-primitives/DisclosureGroup.js.map +0 -1
- package/build/swift-ui-primitives/Form.d.ts.map +0 -1
- package/build/swift-ui-primitives/Form.js +0 -6
- package/build/swift-ui-primitives/Form.js.map +0 -1
- package/build/swift-ui-primitives/Image.d.ts.map +0 -1
- package/build/swift-ui-primitives/Image.js.map +0 -1
- package/build/swift-ui-primitives/Layout.d.ts.map +0 -1
- package/build/swift-ui-primitives/Layout.js.map +0 -1
- package/build/swift-ui-primitives/Section.d.ts +0 -6
- package/build/swift-ui-primitives/Section.d.ts.map +0 -1
- package/build/swift-ui-primitives/Section.js +0 -6
- package/build/swift-ui-primitives/Section.js.map +0 -1
- package/build/swift-ui-primitives/Spacer.d.ts.map +0 -1
- package/build/swift-ui-primitives/Spacer.js +0 -6
- package/build/swift-ui-primitives/Spacer.js.map +0 -1
- package/build/swift-ui-primitives/Text.d.ts.map +0 -1
- package/build/swift-ui-primitives/Text.js.map +0 -1
- package/build/swift-ui-primitives/index.d.ts +0 -24
- package/build/swift-ui-primitives/index.d.ts.map +0 -1
- package/build/swift-ui-primitives/index.js +0 -24
- package/build/swift-ui-primitives/index.js.map +0 -1
- package/build/swift-ui-primitives/types.d.ts.map +0 -1
- package/build/swift-ui-primitives/types.js.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.0/expo.modules.ui-0.2.0-alpha.0.pom.sha512 +0 -1
- package/src/swift-ui-primitives/Form.tsx +0 -20
- package/src/swift-ui-primitives/Section.tsx +0 -15
- package/src/swift-ui-primitives/index.tsx +0 -27
- package/swift-ui-primitives.d.ts +0 -1
- package/swift-ui-primitives.js +0 -1
- package/swift-ui.d.ts +0 -1
- package/swift-ui.js +0 -1
- /package/build/{swift-ui-primitives → swift-ui/ContextMenu}/types.js +0 -0
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import ExpoModulesCore
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
// MARK: - Individual ViewModifier Structs
|
|
7
|
+
|
|
8
|
+
internal struct BackgroundModifier: ViewModifier {
|
|
9
|
+
let color: Color?
|
|
10
|
+
|
|
11
|
+
func body(content: Content) -> some View {
|
|
12
|
+
if let color = color {
|
|
13
|
+
content.background(color)
|
|
14
|
+
} else {
|
|
15
|
+
content
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
internal struct CornerRadiusModifier: ViewModifier {
|
|
21
|
+
let radius: CGFloat
|
|
22
|
+
|
|
23
|
+
func body(content: Content) -> some View {
|
|
24
|
+
content.cornerRadius(radius)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
internal struct ShadowModifier: ViewModifier {
|
|
29
|
+
let color: Color
|
|
30
|
+
let radius: CGFloat
|
|
31
|
+
let x: CGFloat
|
|
32
|
+
let y: CGFloat
|
|
33
|
+
|
|
34
|
+
func body(content: Content) -> some View {
|
|
35
|
+
content.shadow(color: color, radius: radius, x: x, y: y)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
internal struct FrameModifier: ViewModifier {
|
|
40
|
+
let width: CGFloat?
|
|
41
|
+
let height: CGFloat?
|
|
42
|
+
let minWidth: CGFloat?
|
|
43
|
+
let maxWidth: CGFloat?
|
|
44
|
+
let minHeight: CGFloat?
|
|
45
|
+
let maxHeight: CGFloat?
|
|
46
|
+
let idealWidth: CGFloat?
|
|
47
|
+
let idealHeight: CGFloat?
|
|
48
|
+
let alignment: Alignment
|
|
49
|
+
|
|
50
|
+
func body(content: Content) -> some View {
|
|
51
|
+
content
|
|
52
|
+
.frame(
|
|
53
|
+
minWidth: minWidth,
|
|
54
|
+
idealWidth: idealWidth,
|
|
55
|
+
maxWidth: maxWidth,
|
|
56
|
+
minHeight: minHeight,
|
|
57
|
+
idealHeight: idealHeight,
|
|
58
|
+
maxHeight: maxHeight,
|
|
59
|
+
alignment: alignment
|
|
60
|
+
)
|
|
61
|
+
.frame(width: width, height: height, alignment: alignment)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
internal struct PaddingModifier: ViewModifier {
|
|
66
|
+
let edgeInsets: EdgeInsets
|
|
67
|
+
|
|
68
|
+
func body(content: Content) -> some View {
|
|
69
|
+
content.padding(edgeInsets)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
internal struct OpacityModifier: ViewModifier {
|
|
74
|
+
let value: Double
|
|
75
|
+
|
|
76
|
+
func body(content: Content) -> some View {
|
|
77
|
+
content.opacity(value)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
internal struct ScaleEffectModifier: ViewModifier {
|
|
82
|
+
let scale: CGFloat
|
|
83
|
+
|
|
84
|
+
func body(content: Content) -> some View {
|
|
85
|
+
content.scaleEffect(scale)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
internal struct RotationEffectModifier: ViewModifier {
|
|
90
|
+
let angle: Double
|
|
91
|
+
|
|
92
|
+
func body(content: Content) -> some View {
|
|
93
|
+
content.rotationEffect(.degrees(angle))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
internal struct OffsetModifier: ViewModifier {
|
|
98
|
+
let x: CGFloat
|
|
99
|
+
let y: CGFloat
|
|
100
|
+
|
|
101
|
+
func body(content: Content) -> some View {
|
|
102
|
+
content.offset(x: x, y: y)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
internal struct ForegroundColorModifier: ViewModifier {
|
|
107
|
+
let color: Color?
|
|
108
|
+
|
|
109
|
+
func body(content: Content) -> some View {
|
|
110
|
+
if let color = color {
|
|
111
|
+
content.foregroundColor(color)
|
|
112
|
+
} else {
|
|
113
|
+
content
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
internal struct TintModifier: ViewModifier {
|
|
119
|
+
let color: Color?
|
|
120
|
+
|
|
121
|
+
func body(content: Content) -> some View {
|
|
122
|
+
if let color = color {
|
|
123
|
+
content.tint(color)
|
|
124
|
+
} else {
|
|
125
|
+
content
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
internal struct HiddenModifier: ViewModifier {
|
|
131
|
+
let hidden: Bool
|
|
132
|
+
|
|
133
|
+
func body(content: Content) -> some View {
|
|
134
|
+
if hidden {
|
|
135
|
+
content.hidden()
|
|
136
|
+
} else {
|
|
137
|
+
content
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
internal struct ZIndexModifier: ViewModifier {
|
|
143
|
+
let index: Double
|
|
144
|
+
|
|
145
|
+
func body(content: Content) -> some View {
|
|
146
|
+
content.zIndex(index)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
internal struct BlurModifier: ViewModifier {
|
|
151
|
+
let radius: CGFloat
|
|
152
|
+
|
|
153
|
+
func body(content: Content) -> some View {
|
|
154
|
+
content.blur(radius: radius)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
internal struct BrightnessModifier: ViewModifier {
|
|
159
|
+
let amount: Double
|
|
160
|
+
|
|
161
|
+
func body(content: Content) -> some View {
|
|
162
|
+
content.brightness(amount)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
internal struct ContrastModifier: ViewModifier {
|
|
167
|
+
let amount: Double
|
|
168
|
+
|
|
169
|
+
func body(content: Content) -> some View {
|
|
170
|
+
content.contrast(amount)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
internal struct SaturationModifier: ViewModifier {
|
|
175
|
+
let amount: Double
|
|
176
|
+
|
|
177
|
+
func body(content: Content) -> some View {
|
|
178
|
+
content.saturation(amount)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
internal struct ColorInvertModifier: ViewModifier {
|
|
183
|
+
let inverted: Bool
|
|
184
|
+
|
|
185
|
+
func body(content: Content) -> some View {
|
|
186
|
+
if inverted {
|
|
187
|
+
content.colorInvert()
|
|
188
|
+
} else {
|
|
189
|
+
content
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
internal struct GrayscaleModifier: ViewModifier {
|
|
195
|
+
let amount: Double
|
|
196
|
+
|
|
197
|
+
func body(content: Content) -> some View {
|
|
198
|
+
content.grayscale(amount)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
internal struct BorderModifier: ViewModifier {
|
|
203
|
+
let color: Color
|
|
204
|
+
let width: CGFloat
|
|
205
|
+
|
|
206
|
+
func body(content: Content) -> some View {
|
|
207
|
+
content.border(color, width: width)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
internal struct ClipShapeModifier: ViewModifier {
|
|
212
|
+
let shape: String
|
|
213
|
+
let cornerRadius: CGFloat
|
|
214
|
+
|
|
215
|
+
func body(content: Content) -> some View {
|
|
216
|
+
switch shape {
|
|
217
|
+
case "circle":
|
|
218
|
+
return AnyView(content.clipShape(Circle()))
|
|
219
|
+
case "roundedRectangle":
|
|
220
|
+
return AnyView(content.clipShape(RoundedRectangle(cornerRadius: cornerRadius)))
|
|
221
|
+
default:
|
|
222
|
+
return AnyView(content.clipShape(Rectangle()))
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
internal struct OnTapGestureModifier: ViewModifier {
|
|
228
|
+
let eventDispatcher: EventDispatcher
|
|
229
|
+
|
|
230
|
+
func body(content: Content) -> some View {
|
|
231
|
+
content.onTapGesture {
|
|
232
|
+
eventDispatcher(["onTapGesture": [:]])
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
internal struct OnLongPressGestureModifier: ViewModifier {
|
|
238
|
+
let minimumDuration: Double
|
|
239
|
+
let eventDispatcher: EventDispatcher
|
|
240
|
+
|
|
241
|
+
func body(content: Content) -> some View {
|
|
242
|
+
content.onLongPressGesture(minimumDuration: minimumDuration) {
|
|
243
|
+
eventDispatcher(["onLongPressGesture": [:]])
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
internal struct HueRotationModifier: ViewModifier {
|
|
249
|
+
let angle: Double
|
|
250
|
+
|
|
251
|
+
func body(content: Content) -> some View {
|
|
252
|
+
content.hueRotation(.degrees(angle))
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
internal struct AccessibilityLabelModifier: ViewModifier {
|
|
257
|
+
let label: String?
|
|
258
|
+
|
|
259
|
+
func body(content: Content) -> some View {
|
|
260
|
+
if let label = label {
|
|
261
|
+
content.accessibilityLabel(label)
|
|
262
|
+
} else {
|
|
263
|
+
content
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
internal struct AccessibilityHintModifier: ViewModifier {
|
|
269
|
+
let hint: String?
|
|
270
|
+
|
|
271
|
+
func body(content: Content) -> some View {
|
|
272
|
+
if let hint = hint {
|
|
273
|
+
content.accessibilityHint(hint)
|
|
274
|
+
} else {
|
|
275
|
+
content
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
internal struct AccessibilityValueModifier: ViewModifier {
|
|
281
|
+
let value: String?
|
|
282
|
+
|
|
283
|
+
func body(content: Content) -> some View {
|
|
284
|
+
if let value = value {
|
|
285
|
+
content.accessibilityValue(value)
|
|
286
|
+
} else {
|
|
287
|
+
content
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
internal struct LayoutPriorityModifier: ViewModifier {
|
|
293
|
+
let priority: Double
|
|
294
|
+
|
|
295
|
+
func body(content: Content) -> some View {
|
|
296
|
+
content.layoutPriority(priority)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
internal struct AspectRatioModifier: ViewModifier {
|
|
301
|
+
let ratio: Double
|
|
302
|
+
let contentMode: ContentMode
|
|
303
|
+
|
|
304
|
+
func body(content: Content) -> some View {
|
|
305
|
+
content.aspectRatio(ratio, contentMode: contentMode)
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
internal struct ClippedModifier: ViewModifier {
|
|
310
|
+
let clipped: Bool
|
|
311
|
+
|
|
312
|
+
func body(content: Content) -> some View {
|
|
313
|
+
if clipped {
|
|
314
|
+
content.clipped()
|
|
315
|
+
} else {
|
|
316
|
+
content
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
internal struct MaskModifier: ViewModifier {
|
|
322
|
+
let shape: String
|
|
323
|
+
let cornerRadius: CGFloat
|
|
324
|
+
|
|
325
|
+
func body(content: Content) -> some View {
|
|
326
|
+
switch shape {
|
|
327
|
+
case "circle":
|
|
328
|
+
return AnyView(content.mask(Circle()))
|
|
329
|
+
case "roundedRectangle":
|
|
330
|
+
return AnyView(content.mask(RoundedRectangle(cornerRadius: cornerRadius)))
|
|
331
|
+
default:
|
|
332
|
+
return AnyView(content.mask(Rectangle()))
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
internal struct OverlayModifier: ViewModifier {
|
|
338
|
+
let color: Color?
|
|
339
|
+
let alignment: Alignment
|
|
340
|
+
|
|
341
|
+
func body(content: Content) -> some View {
|
|
342
|
+
if let color = color {
|
|
343
|
+
content.overlay(color, alignment: alignment)
|
|
344
|
+
} else {
|
|
345
|
+
content
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
internal struct BackgroundOverlayModifier: ViewModifier {
|
|
351
|
+
let color: Color?
|
|
352
|
+
let alignment: Alignment
|
|
353
|
+
|
|
354
|
+
func body(content: Content) -> some View {
|
|
355
|
+
if let color = color {
|
|
356
|
+
content.background(color, alignment: alignment)
|
|
357
|
+
} else {
|
|
358
|
+
content
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* A type-erased wrapper for `ViewModifier`
|
|
365
|
+
*/
|
|
366
|
+
internal struct AnyViewModifier: ViewModifier {
|
|
367
|
+
private let _body: (Content) -> AnyView
|
|
368
|
+
|
|
369
|
+
init<T: ViewModifier>(_ modifier: T) {
|
|
370
|
+
_body = { content in
|
|
371
|
+
AnyView(content.modifier(modifier))
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
func body(content: Content) -> some View {
|
|
376
|
+
_body(content)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// MARK: - Registry
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Registry for SwiftUI view modifiers that can be applied from React Native.
|
|
384
|
+
* This system uses ViewModifier structs for better performance than AnyView wrapping.
|
|
385
|
+
*/
|
|
386
|
+
internal class ViewModifierRegistry {
|
|
387
|
+
static let shared = ViewModifierRegistry()
|
|
388
|
+
|
|
389
|
+
internal typealias ModiferFactory = ([String: Any], EventDispatcher) -> any ViewModifier
|
|
390
|
+
private(set) internal var modifierFactories: [String: ModiferFactory] = [:]
|
|
391
|
+
|
|
392
|
+
private init() {
|
|
393
|
+
registerBuiltInModifiers()
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Registers a new modifier with the given type name.
|
|
398
|
+
* The modifier factory creates a ViewModifier from parameters.
|
|
399
|
+
*/
|
|
400
|
+
func register(
|
|
401
|
+
_ type: String,
|
|
402
|
+
factory: @escaping ModiferFactory
|
|
403
|
+
) {
|
|
404
|
+
modifierFactories[type] = factory
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Applies a modifier to an AnyView by type name and parameters.
|
|
409
|
+
* Returns the original view if the modifier type is not found.
|
|
410
|
+
* This method handles the type erasure properly for extensibility.
|
|
411
|
+
*/
|
|
412
|
+
func applyModifier(_ type: String, to view: AnyView, globalEventDispatcher: EventDispatcher, params: [String: Any]) -> AnyView {
|
|
413
|
+
guard let viewModifier = modifierFactories[type]?(params, globalEventDispatcher) else {
|
|
414
|
+
return view
|
|
415
|
+
}
|
|
416
|
+
return AnyView(view.modifier(AnyViewModifier(viewModifier)))
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Checks if a modifier type is registered.
|
|
421
|
+
*/
|
|
422
|
+
func hasModifier(_ type: String) -> Bool {
|
|
423
|
+
return modifierFactories[type] != nil
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Returns all registered modifier types.
|
|
428
|
+
*/
|
|
429
|
+
func registeredTypes() -> [String] {
|
|
430
|
+
return Array(modifierFactories.keys)
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// MARK: - Built-in Modifier Registration
|
|
435
|
+
|
|
436
|
+
// swiftlint:disable:next no_grouping_extension
|
|
437
|
+
extension ViewModifierRegistry {
|
|
438
|
+
private func registerBuiltInModifiers() {
|
|
439
|
+
register("background") { params, _ in
|
|
440
|
+
let color = (params["color"] as? String).map { Color(hex: $0) }
|
|
441
|
+
return BackgroundModifier(color: color)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
register("cornerRadius") { params, _ in
|
|
445
|
+
let radius = params["radius"] as? Double ?? 0
|
|
446
|
+
return CornerRadiusModifier(radius: CGFloat(radius))
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
register("shadow") { params, _ in
|
|
450
|
+
let radius = params["radius"] as? Double ?? 0
|
|
451
|
+
let x = params["x"] as? Double ?? 0
|
|
452
|
+
let y = params["y"] as? Double ?? 0
|
|
453
|
+
let colorString = params["color"] as? String ?? "#000000"
|
|
454
|
+
let color = Color(hex: colorString)
|
|
455
|
+
|
|
456
|
+
return ShadowModifier(
|
|
457
|
+
color: color,
|
|
458
|
+
radius: CGFloat(radius),
|
|
459
|
+
x: CGFloat(x),
|
|
460
|
+
y: CGFloat(y)
|
|
461
|
+
)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
register("frame") { params, _ in
|
|
465
|
+
let width = (params["width"] as? Double).map { CGFloat($0) }
|
|
466
|
+
let height = (params["height"] as? Double).map { CGFloat($0) }
|
|
467
|
+
let minWidth = (params["minWidth"] as? Double).map { CGFloat($0) }
|
|
468
|
+
let maxWidth = (params["maxWidth"] as? Double).map { CGFloat($0) }
|
|
469
|
+
let minHeight = (params["minHeight"] as? Double).map { CGFloat($0) }
|
|
470
|
+
let maxHeight = (params["maxHeight"] as? Double).map { CGFloat($0) }
|
|
471
|
+
let idealWidth = (params["idealWidth"] as? Double).map { CGFloat($0) }
|
|
472
|
+
let idealHeight = (params["idealHeight"] as? Double).map { CGFloat($0) }
|
|
473
|
+
let alignmentString = params["alignment"] as? String ?? "center"
|
|
474
|
+
let alignment = parseAlignment(alignmentString)
|
|
475
|
+
|
|
476
|
+
return FrameModifier(
|
|
477
|
+
width: width,
|
|
478
|
+
height: height,
|
|
479
|
+
minWidth: minWidth,
|
|
480
|
+
maxWidth: maxWidth,
|
|
481
|
+
minHeight: minHeight,
|
|
482
|
+
maxHeight: maxHeight,
|
|
483
|
+
idealWidth: idealWidth,
|
|
484
|
+
idealHeight: idealHeight,
|
|
485
|
+
alignment: alignment
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
register("padding") { params, _ in
|
|
490
|
+
var edgeInsets = EdgeInsets()
|
|
491
|
+
|
|
492
|
+
if let all = params["all"] as? Double {
|
|
493
|
+
edgeInsets = EdgeInsets(top: CGFloat(all), leading: CGFloat(all), bottom: CGFloat(all), trailing: CGFloat(all))
|
|
494
|
+
} else if let horizontal = params["horizontal"] as? Double, let vertical = params["vertical"] as? Double {
|
|
495
|
+
edgeInsets = EdgeInsets(top: CGFloat(vertical), leading: CGFloat(horizontal), bottom: CGFloat(vertical), trailing: CGFloat(horizontal))
|
|
496
|
+
} else if let horizontal = params["horizontal"] as? Double {
|
|
497
|
+
edgeInsets = EdgeInsets(top: 0, leading: CGFloat(horizontal), bottom: 0, trailing: CGFloat(horizontal))
|
|
498
|
+
} else if let vertical = params["vertical"] as? Double {
|
|
499
|
+
edgeInsets = EdgeInsets(top: CGFloat(vertical), leading: 0, bottom: CGFloat(vertical), trailing: 0)
|
|
500
|
+
} else {
|
|
501
|
+
edgeInsets = EdgeInsets(
|
|
502
|
+
top: CGFloat(params["top"] as? Double ?? 0),
|
|
503
|
+
leading: CGFloat(params["leading"] as? Double ?? 0),
|
|
504
|
+
bottom: CGFloat(params["bottom"] as? Double ?? 0),
|
|
505
|
+
trailing: CGFloat(params["trailing"] as? Double ?? 0)
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
return PaddingModifier(edgeInsets: edgeInsets)
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
register("opacity") { params, _ in
|
|
513
|
+
let value = params["value"] as? Double ?? 1.0
|
|
514
|
+
return OpacityModifier(value: value)
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
register("scaleEffect") { params, _ in
|
|
518
|
+
let scale = params["scale"] as? Double ?? 1.0
|
|
519
|
+
return ScaleEffectModifier(scale: CGFloat(scale))
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
register("rotationEffect") { params, _ in
|
|
523
|
+
let angle = params["angle"] as? Double ?? 0.0
|
|
524
|
+
return RotationEffectModifier(angle: angle)
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
register("offset") { params, _ in
|
|
528
|
+
let x = params["x"] as? Double ?? 0
|
|
529
|
+
let y = params["y"] as? Double ?? 0
|
|
530
|
+
return OffsetModifier(x: CGFloat(x), y: CGFloat(y))
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
register("foregroundColor") { params, _ in
|
|
534
|
+
let color = (params["color"] as? String).map { Color(hex: $0) }
|
|
535
|
+
return ForegroundColorModifier(color: color)
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
register("tint") { params, _ in
|
|
539
|
+
let color = (params["color"] as? String).map { Color(hex: $0) }
|
|
540
|
+
return TintModifier(color: color)
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
register("hidden") { params, _ in
|
|
544
|
+
let hidden = params["hidden"] as? Bool ?? true
|
|
545
|
+
return HiddenModifier(hidden: hidden)
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
register("zIndex") { params, _ in
|
|
549
|
+
let index = params["index"] as? Double ?? 0
|
|
550
|
+
return ZIndexModifier(index: index)
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
register("blur") { params, _ in
|
|
554
|
+
let radius = params["radius"] as? Double ?? 0
|
|
555
|
+
return BlurModifier(radius: CGFloat(radius))
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
register("brightness") { params, _ in
|
|
559
|
+
let amount = params["amount"] as? Double ?? 0
|
|
560
|
+
return BrightnessModifier(amount: amount)
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
register("contrast") { params, _ in
|
|
564
|
+
let amount = params["amount"] as? Double ?? 1
|
|
565
|
+
return ContrastModifier(amount: amount)
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
register("saturation") { params, _ in
|
|
569
|
+
let amount = params["amount"] as? Double ?? 1
|
|
570
|
+
return SaturationModifier(amount: amount)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
register("colorInvert") { params, _ in
|
|
574
|
+
let inverted = params["inverted"] as? Bool ?? true
|
|
575
|
+
return ColorInvertModifier(inverted: inverted)
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
register("grayscale") { params, _ in
|
|
579
|
+
let amount = params["amount"] as? Double ?? 0
|
|
580
|
+
return GrayscaleModifier(amount: amount)
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
register("border") { params, _ in
|
|
584
|
+
let colorString = params["color"] as? String ?? "#000000"
|
|
585
|
+
let width = params["width"] as? Double ?? 1.0
|
|
586
|
+
let color = Color(hex: colorString)
|
|
587
|
+
|
|
588
|
+
return BorderModifier(color: color, width: CGFloat(width))
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
register("clipShape") { params, _ in
|
|
592
|
+
let shape = params["shape"] as? String ?? "rectangle"
|
|
593
|
+
let cornerRadius = params["cornerRadius"] as? Double ?? 8
|
|
594
|
+
|
|
595
|
+
return ClipShapeModifier(shape: shape, cornerRadius: CGFloat(cornerRadius))
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
register("onTapGesture") { _, eventDispatcher in
|
|
599
|
+
return OnTapGestureModifier(eventDispatcher: eventDispatcher)
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
register("onLongPressGesture") { params, eventDispatcher in
|
|
603
|
+
let minimumDuration = params["minimumDuration"] as? Double ?? 0.5
|
|
604
|
+
return OnLongPressGestureModifier(minimumDuration: minimumDuration, eventDispatcher: eventDispatcher)
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
register("hueRotation") { params, _ in
|
|
608
|
+
let angle = params["angle"] as? Double ?? 0
|
|
609
|
+
return HueRotationModifier(angle: angle)
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
register("accessibilityLabel") { params, _ in
|
|
613
|
+
let label = params["label"] as? String
|
|
614
|
+
return AccessibilityLabelModifier(label: label)
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
register("accessibilityHint") { params, _ in
|
|
618
|
+
let hint = params["hint"] as? String
|
|
619
|
+
return AccessibilityHintModifier(hint: hint)
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
register("accessibilityValue") { params, _ in
|
|
623
|
+
let value = params["value"] as? String
|
|
624
|
+
return AccessibilityValueModifier(value: value)
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
register("layoutPriority") { params, _ in
|
|
628
|
+
let priority = params["priority"] as? Double ?? 0
|
|
629
|
+
return LayoutPriorityModifier(priority: priority)
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
register("aspectRatio") { params, _ in
|
|
633
|
+
let ratio = params["ratio"] as? Double ?? 1.0
|
|
634
|
+
let contentMode = params["contentMode"] as? String ?? "fit"
|
|
635
|
+
let mode: ContentMode = contentMode == "fill" ? .fill : .fit
|
|
636
|
+
return AspectRatioModifier(ratio: ratio, contentMode: mode)
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
register("clipped") { params, _ in
|
|
640
|
+
let clipped = params["clipped"] as? Bool ?? true
|
|
641
|
+
return ClippedModifier(clipped: clipped)
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
register("mask") { params, _ in
|
|
645
|
+
let shape = params["shape"] as? String ?? "rectangle"
|
|
646
|
+
let cornerRadius = params["cornerRadius"] as? Double ?? 8
|
|
647
|
+
return MaskModifier(shape: shape, cornerRadius: CGFloat(cornerRadius))
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
register("overlay") { params, _ in
|
|
651
|
+
let color = (params["color"] as? String).map { Color(hex: $0) }
|
|
652
|
+
let alignmentString = params["alignment"] as? String ?? "center"
|
|
653
|
+
let alignment = parseAlignment(alignmentString)
|
|
654
|
+
return OverlayModifier(color: color, alignment: alignment)
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
register("backgroundOverlay") { params, _ in
|
|
658
|
+
let color = (params["color"] as? String).map { Color(hex: $0) }
|
|
659
|
+
let alignmentString = params["alignment"] as? String ?? "center"
|
|
660
|
+
let alignment = parseAlignment(alignmentString)
|
|
661
|
+
return BackgroundOverlayModifier(color: color, alignment: alignment)
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// MARK: - Utility Functions
|
|
667
|
+
|
|
668
|
+
private func parseAlignment(_ alignmentString: String) -> Alignment {
|
|
669
|
+
switch alignmentString {
|
|
670
|
+
case "leading":
|
|
671
|
+
return .leading
|
|
672
|
+
case "trailing":
|
|
673
|
+
return .trailing
|
|
674
|
+
case "top":
|
|
675
|
+
return .top
|
|
676
|
+
case "bottom":
|
|
677
|
+
return .bottom
|
|
678
|
+
case "topLeading":
|
|
679
|
+
return .topLeading
|
|
680
|
+
case "topTrailing":
|
|
681
|
+
return .topTrailing
|
|
682
|
+
case "bottomLeading":
|
|
683
|
+
return .bottomLeading
|
|
684
|
+
case "bottomTrailing":
|
|
685
|
+
return .bottomTrailing
|
|
686
|
+
default:
|
|
687
|
+
return .center
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// MARK: - Color Extension
|
|
692
|
+
|
|
693
|
+
internal extension Color {
|
|
694
|
+
init(hex: String) {
|
|
695
|
+
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
|
696
|
+
var int: UInt64 = 0
|
|
697
|
+
Scanner(string: hex).scanHexInt64(&int)
|
|
698
|
+
let a, r, g, b: UInt64
|
|
699
|
+
switch hex.count {
|
|
700
|
+
case 3: // RGB (12-bit)
|
|
701
|
+
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
|
|
702
|
+
case 6: // RGB (24-bit)
|
|
703
|
+
(a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
|
|
704
|
+
case 8: // ARGB (32-bit)
|
|
705
|
+
(a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
|
|
706
|
+
default:
|
|
707
|
+
(a, r, g, b) = (1, 1, 1, 0)
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
self.init(
|
|
711
|
+
.sRGB,
|
|
712
|
+
red: Double(r) / 255,
|
|
713
|
+
green: Double(g) / 255,
|
|
714
|
+
blue: Double(b) / 255,
|
|
715
|
+
opacity: Double(a) / 255
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
}
|