glacia-native 0.5.2 → 0.6.0
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/README.md +84 -17
- package/lib/module/Accordion.js +58 -0
- package/lib/module/ActionSheet.js +38 -0
- package/lib/module/Alert.js +23 -0
- package/lib/module/AlertDialog.js +47 -0
- package/lib/module/Avatar.js +48 -0
- package/lib/module/Badge.js +36 -0
- package/lib/module/Bars.js +13 -268
- package/lib/module/Button.js +57 -39
- package/lib/module/Card.js +31 -19
- package/lib/module/Checkbox.js +42 -0
- package/lib/module/Chip.js +80 -0
- package/lib/module/Collapsible.js +26 -0
- package/lib/module/ContextMenu.js +33 -0
- package/lib/module/Dialog.js +39 -123
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +10 -3
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +43 -38
- package/lib/module/Label.js +17 -0
- package/lib/module/MorphGroup.js +47 -0
- package/lib/module/Popover.js +29 -0
- package/lib/module/Progress.js +32 -0
- package/lib/module/RadioGroup.js +51 -0
- package/lib/module/Scrim.js +44 -0
- package/lib/module/SegmentedControl.js +70 -63
- package/lib/module/Select.js +51 -0
- package/lib/module/Separator.js +25 -0
- package/lib/module/Sheet.js +51 -0
- package/lib/module/Skeleton.js +48 -0
- package/lib/module/Slider.js +45 -34
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -55
- package/lib/module/TabBar.js +50 -44
- package/lib/module/Textarea.js +18 -0
- package/lib/module/Toast.js +55 -0
- package/lib/module/Toggle.js +47 -0
- package/lib/module/ToggleGroup.js +56 -0
- package/lib/module/Toolbar.js +37 -0
- package/lib/module/Tooltip.js +31 -0
- package/lib/module/glass-provider.js +28 -0
- package/lib/module/glass-stack.js +61 -0
- package/lib/module/index.js +78 -109
- package/lib/module/internal/GlassBackdrop.js +36 -0
- package/lib/module/internal/GlassView.js +43 -11
- package/lib/module/internal/blur-community.js +20 -0
- package/lib/module/internal/blur-community.web.js +9 -0
- package/lib/module/internal/blur.js +6 -9
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +16 -0
- package/lib/typescript/Accordion.d.ts +22 -0
- package/lib/typescript/ActionSheet.d.ts +24 -0
- package/lib/typescript/Alert.d.ts +15 -0
- package/lib/typescript/AlertDialog.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts +22 -0
- package/lib/typescript/Badge.d.ts +12 -0
- package/lib/typescript/Bars.d.ts +3 -188
- package/lib/typescript/Button.d.ts +44 -10
- package/lib/typescript/Card.d.ts +30 -3
- package/lib/typescript/Checkbox.d.ts +14 -0
- package/lib/typescript/Chip.d.ts +19 -0
- package/lib/typescript/Collapsible.d.ts +17 -0
- package/lib/typescript/ContextMenu.d.ts +23 -0
- package/lib/typescript/Dialog.d.ts +8 -68
- package/lib/typescript/DropdownMenu.d.ts +23 -0
- package/lib/typescript/Field.d.ts +19 -0
- package/lib/typescript/Glass.d.ts +11 -2
- package/lib/typescript/Group.d.ts +35 -0
- package/lib/typescript/IconButton.d.ts +21 -0
- package/lib/typescript/Input.d.ts +17 -18
- package/lib/typescript/Label.d.ts +14 -0
- package/lib/typescript/MorphGroup.d.ts +46 -0
- package/lib/typescript/Popover.d.ts +17 -0
- package/lib/typescript/Progress.d.ts +13 -0
- package/lib/typescript/RadioGroup.d.ts +21 -0
- package/lib/typescript/Scrim.d.ts +33 -0
- package/lib/typescript/SegmentedControl.d.ts +24 -13
- package/lib/typescript/Select.d.ts +19 -0
- package/lib/typescript/Separator.d.ts +10 -0
- package/lib/typescript/Sheet.d.ts +45 -0
- package/lib/typescript/Skeleton.d.ts +10 -0
- package/lib/typescript/Slider.d.ts +15 -7
- package/lib/typescript/Stepper.d.ts +49 -0
- package/lib/typescript/Switch.d.ts +19 -12
- package/lib/typescript/TabBar.d.ts +18 -6
- package/lib/typescript/Textarea.d.ts +6 -0
- package/lib/typescript/Toast.d.ts +40 -0
- package/lib/typescript/Toggle.d.ts +21 -0
- package/lib/typescript/ToggleGroup.d.ts +22 -0
- package/lib/typescript/Toolbar.d.ts +35 -0
- package/lib/typescript/Tooltip.d.ts +16 -0
- package/lib/typescript/glass-provider.d.ts +34 -0
- package/lib/typescript/glass-stack.d.ts +54 -0
- package/lib/typescript/index.d.ts +38 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +18 -2
- package/lib/typescript/internal/blur-community.d.ts +2 -0
- package/lib/typescript/internal/blur-community.web.d.ts +2 -0
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +11 -0
- package/package.json +4 -2
- package/src/Accordion.tsx +165 -0
- package/src/ActionSheet.tsx +149 -0
- package/src/Alert.tsx +85 -0
- package/src/AlertDialog.tsx +124 -0
- package/src/Avatar.tsx +102 -0
- package/src/Badge.tsx +80 -0
- package/src/Bars.tsx +10 -807
- package/src/Button.tsx +196 -67
- package/src/Card.tsx +105 -32
- package/src/Checkbox.tsx +98 -0
- package/src/Chip.tsx +149 -0
- package/src/Collapsible.tsx +66 -0
- package/src/ContextMenu.tsx +103 -0
- package/src/Dialog.tsx +85 -335
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +15 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +139 -87
- package/src/Label.tsx +56 -0
- package/src/MorphGroup.tsx +134 -0
- package/src/Popover.tsx +81 -0
- package/src/Progress.tsx +83 -0
- package/src/RadioGroup.tsx +122 -0
- package/src/Scrim.tsx +94 -0
- package/src/SegmentedControl.tsx +132 -99
- package/src/Select.tsx +136 -0
- package/src/Separator.tsx +52 -0
- package/src/Sheet.tsx +139 -0
- package/src/Skeleton.tsx +77 -0
- package/src/Slider.tsx +84 -47
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +81 -73
- package/src/TabBar.tsx +106 -93
- package/src/Textarea.tsx +34 -0
- package/src/Toast.tsx +131 -0
- package/src/Toggle.tsx +113 -0
- package/src/ToggleGroup.tsx +129 -0
- package/src/Toolbar.tsx +111 -0
- package/src/Tooltip.tsx +79 -0
- package/src/engine/CHANGELOG.md +430 -0
- package/src/engine/NOTICE +54 -0
- package/src/engine/README.md +975 -0
- package/src/engine/android/build.gradle +18 -0
- package/src/engine/android/src/main/AndroidManifest.xml +2 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
- package/src/engine/index.ts +24 -0
- package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
- package/src/engine/ios/Enums/GlassVariant.swift +86 -0
- package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
- package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
- package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
- package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
- package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
- package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
- package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
- package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
- package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
- package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
- package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
- package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
- package/src/engine/ios/Glass/StripCache.swift +545 -0
- package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
- package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
- package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
- package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
- package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
- package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
- package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
- package/src/engine/package.json +70 -0
- package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
- package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
- package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
- package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
- package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
- package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
- package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
- package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
- package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
- package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
- package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
- package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
- package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
- package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
- package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
- package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
- package/src/engine/src/components/index.ts +16 -0
- package/src/engine/src/constants/index.ts +4 -0
- package/src/engine/src/constants/metal.constants.ts +327 -0
- package/src/engine/src/constants/metrics.constants.ts +325 -0
- package/src/engine/src/constants/springs.constants.ts +107 -0
- package/src/engine/src/constants/styles.constants.ts +12 -0
- package/src/engine/src/context/glass-group.context.ts +65 -0
- package/src/engine/src/context/index.ts +6 -0
- package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
- package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
- package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
- package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
- package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
- package/src/engine/src/core/components/index.ts +4 -0
- package/src/engine/src/core/constants/glass.constants.ts +57 -0
- package/src/engine/src/core/constants/index.ts +20 -0
- package/src/engine/src/core/constants/native.constants.ts +16 -0
- package/src/engine/src/core/context/glass-stack.context.ts +30 -0
- package/src/engine/src/core/context/index.ts +4 -0
- package/src/engine/src/core/enum/index.ts +12 -0
- package/src/engine/src/core/index.ts +1 -0
- package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
- package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
- package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
- package/src/engine/src/core/interfaces/index.ts +31 -0
- package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
- package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
- package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
- package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
- package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
- package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
- package/src/engine/src/core/modules/index.ts +2 -0
- package/src/engine/src/core/root/index.ts +51 -0
- package/src/engine/src/core/types/glass.types.ts +25 -0
- package/src/engine/src/core/types/index.ts +8 -0
- package/src/engine/src/core/utils/debug.utils.ts +17 -0
- package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
- package/src/engine/src/core/utils/hdr.utils.ts +37 -0
- package/src/engine/src/core/utils/index.ts +5 -0
- package/src/engine/src/core/utils/native-view.utils.ts +33 -0
- package/src/engine/src/core/utils/platform.utils.ts +34 -0
- package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
- package/src/engine/src/core/views/index.ts +4 -0
- package/src/engine/src/hooks/index.ts +18 -0
- package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
- package/src/engine/src/hooks/use-damped-drag.ts +332 -0
- package/src/engine/src/hooks/use-echo-filter.ts +55 -0
- package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
- package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
- package/src/engine/src/hooks/use-press-progress.ts +44 -0
- package/src/engine/src/index.ts +120 -0
- package/src/engine/src/interfaces/index.ts +28 -0
- package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
- package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
- package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
- package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
- package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
- package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
- package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
- package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
- package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
- package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
- package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
- package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
- package/src/engine/src/theme/glass-ui-theme.ts +100 -0
- package/src/engine/src/theme/index.ts +2 -0
- package/src/engine/src/utils/button-press.utils.ts +63 -0
- package/src/engine/src/utils/index.ts +3 -0
- package/src/engine/src/utils/metal.utils.ts +164 -0
- package/src/glass-provider.tsx +60 -0
- package/src/glass-stack.tsx +115 -0
- package/src/index.ts +47 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +53 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +7 -8
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/initials.ts +7 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +23 -0
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -318
- package/lib/module/Feedback.js +0 -395
- package/lib/module/Form.js +0 -160
- package/lib/module/Forms2.js +0 -471
- package/lib/module/Message.js +0 -84
- package/lib/module/Overlays.js +0 -344
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -100
- package/lib/module/ai.js +0 -283
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -75
- package/lib/module/charts/FunnelChart.js +0 -50
- package/lib/module/charts/HeatmapChart.js +0 -71
- package/lib/module/charts/LineChart.js +0 -81
- package/lib/module/charts/PlotChart.js +0 -52
- package/lib/module/charts/RadarChart.js +0 -78
- package/lib/module/charts/RingChart.js +0 -52
- package/lib/module/charts/ScatterChart.js +0 -95
- package/lib/module/charts/WaterfallChart.js +0 -85
- package/lib/module/charts/advanced.js +0 -313
- package/lib/module/charts/extra.js +0 -108
- package/lib/module/charts/index.js +0 -50
- package/lib/module/charts/scales.js +0 -140
- package/lib/typescript/Carousel.d.ts +0 -47
- package/lib/typescript/Display.d.ts +0 -178
- package/lib/typescript/Feedback.d.ts +0 -196
- package/lib/typescript/Form.d.ts +0 -97
- package/lib/typescript/Forms2.d.ts +0 -209
- package/lib/typescript/Message.d.ts +0 -67
- package/lib/typescript/Overlays.d.ts +0 -146
- package/lib/typescript/Pickers.d.ts +0 -105
- package/lib/typescript/Table.d.ts +0 -64
- package/lib/typescript/ai.d.ts +0 -166
- package/lib/typescript/charts/AreaChart.d.ts +0 -44
- package/lib/typescript/charts/BarChart.d.ts +0 -19
- package/lib/typescript/charts/FunnelChart.d.ts +0 -25
- package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
- package/lib/typescript/charts/LineChart.d.ts +0 -30
- package/lib/typescript/charts/PlotChart.d.ts +0 -31
- package/lib/typescript/charts/RadarChart.d.ts +0 -27
- package/lib/typescript/charts/RingChart.d.ts +0 -28
- package/lib/typescript/charts/ScatterChart.d.ts +0 -34
- package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
- package/lib/typescript/charts/advanced.d.ts +0 -107
- package/lib/typescript/charts/extra.d.ts +0 -63
- package/lib/typescript/charts/index.d.ts +0 -13
- package/lib/typescript/charts/scales.d.ts +0 -35
- package/src/Carousel.tsx +0 -233
- package/src/Display.tsx +0 -781
- package/src/Feedback.tsx +0 -992
- package/src/Form.tsx +0 -445
- package/src/Forms2.tsx +0 -1055
- package/src/Message.tsx +0 -218
- package/src/Overlays.tsx +0 -704
- package/src/Pickers.tsx +0 -595
- package/src/Table.tsx +0 -232
- package/src/ai.tsx +0 -715
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -221
- package/src/charts/FunnelChart.tsx +0 -125
- package/src/charts/HeatmapChart.tsx +0 -155
- package/src/charts/LineChart.tsx +0 -247
- package/src/charts/PlotChart.tsx +0 -168
- package/src/charts/RadarChart.tsx +0 -208
- package/src/charts/RingChart.tsx +0 -133
- package/src/charts/ScatterChart.tsx +0 -223
- package/src/charts/WaterfallChart.tsx +0 -201
- package/src/charts/advanced.tsx +0 -676
- package/src/charts/extra.tsx +0 -242
- package/src/charts/index.ts +0 -86
- package/src/charts/scales.ts +0 -163
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
|
|
3
|
+
// Mirrors `src/core/interfaces/glass-metal.interface.ts` and the Android
|
|
4
|
+
// `records/GlassRecords.kt`. Every field is optional so "not supplied" stays distinguishable
|
|
5
|
+
// from a supplied value — the per-variant defaults apply only to fields the caller left out.
|
|
6
|
+
|
|
7
|
+
public struct GlassRefractionOptions: Record {
|
|
8
|
+
|
|
9
|
+
@Field public var amount: Double?
|
|
10
|
+
|
|
11
|
+
@Field public var width: Double?
|
|
12
|
+
|
|
13
|
+
@Field public var height: Double?
|
|
14
|
+
|
|
15
|
+
@Field public var depth: Double?
|
|
16
|
+
|
|
17
|
+
/// How far the edge refraction leans toward the highlight's light axis, unitless like
|
|
18
|
+
/// `depth`. Default 0 — measured real iOS 26 carries no lean. Clamped to [-1, 1].
|
|
19
|
+
@Field public var swirl: Double?
|
|
20
|
+
|
|
21
|
+
@Field public var curve: GlassRefractionCurve?
|
|
22
|
+
|
|
23
|
+
public init() {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public struct GlassDispersionOptions: Record {
|
|
27
|
+
|
|
28
|
+
@Field public var amount: Double?
|
|
29
|
+
|
|
30
|
+
@Field public var reach: Double?
|
|
31
|
+
|
|
32
|
+
/// How much of the fringe follows Kyant's quadrant weighting, 0..1. Default 0 — an even rim
|
|
33
|
+
/// fringe the whole way round.
|
|
34
|
+
@Field public var quadrant: Double?
|
|
35
|
+
|
|
36
|
+
public init() {}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public struct GlassHighlightOptions: Record {
|
|
40
|
+
|
|
41
|
+
@Field public var intensity: Double?
|
|
42
|
+
|
|
43
|
+
/// Degrees, screen-space with y increasing downward.
|
|
44
|
+
@Field public var angle: Double?
|
|
45
|
+
|
|
46
|
+
/// Depth of the glass border light, points. Default 0.75.
|
|
47
|
+
@Field public var width: Double?
|
|
48
|
+
|
|
49
|
+
/// Angular falloff exponent of the two light lobes. Default 1; floored at 0.01.
|
|
50
|
+
@Field public var falloff: Double?
|
|
51
|
+
|
|
52
|
+
public init() {}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public struct GlassBorderOptions: Record {
|
|
56
|
+
|
|
57
|
+
@Field public var width: Double?
|
|
58
|
+
|
|
59
|
+
@Field public var opacity: Double?
|
|
60
|
+
|
|
61
|
+
public init() {}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public struct GlassProgressiveBlurOptions: Record {
|
|
65
|
+
|
|
66
|
+
@Field public var startRadius: Double?
|
|
67
|
+
|
|
68
|
+
@Field public var endRadius: Double?
|
|
69
|
+
|
|
70
|
+
@Field public var direction: GlassBlurDirection?
|
|
71
|
+
|
|
72
|
+
@Field public var start: Double?
|
|
73
|
+
|
|
74
|
+
@Field public var end: Double?
|
|
75
|
+
|
|
76
|
+
public init() {}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public struct GlassShapeOptions: Record {
|
|
80
|
+
|
|
81
|
+
@Field public var x: Double?
|
|
82
|
+
|
|
83
|
+
@Field public var y: Double?
|
|
84
|
+
|
|
85
|
+
@Field public var width: Double?
|
|
86
|
+
|
|
87
|
+
@Field public var height: Double?
|
|
88
|
+
|
|
89
|
+
public init() {}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public struct GlassMorphOptions: Record {
|
|
93
|
+
|
|
94
|
+
@Field public var x: Double?
|
|
95
|
+
|
|
96
|
+
@Field public var y: Double?
|
|
97
|
+
|
|
98
|
+
@Field public var width: Double?
|
|
99
|
+
|
|
100
|
+
@Field public var height: Double?
|
|
101
|
+
|
|
102
|
+
@Field public var cornerRadius: Double?
|
|
103
|
+
|
|
104
|
+
@Field public var smoothing: Double?
|
|
105
|
+
|
|
106
|
+
public init() {}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// The inner shadow: a soft dark band along the inside of the silhouette, the shape minus itself
|
|
110
|
+
/// translated by the offset and blurred by the radius (Kyant's `InnerShadow`). `radius` 0 is off.
|
|
111
|
+
public struct GlassInnerShadowOptions: Record {
|
|
112
|
+
|
|
113
|
+
/// Blur radius, points. 0 disables.
|
|
114
|
+
@Field public var radius: Double?
|
|
115
|
+
|
|
116
|
+
/// Where the shadow is cast, points. Defaults: x 0, y = radius — lit from above, so the
|
|
117
|
+
/// pane's top lip shades the top inner edge.
|
|
118
|
+
@Field public var offsetX: Double?
|
|
119
|
+
|
|
120
|
+
@Field public var offsetY: Double?
|
|
121
|
+
|
|
122
|
+
/// Strength of the (black) shadow, 0..1. Default 0.15.
|
|
123
|
+
@Field public var opacity: Double?
|
|
124
|
+
|
|
125
|
+
public init() {}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// A press that happened somewhere else — the app-choreographed twin of `interactive`. The bar
|
|
129
|
+
/// hosting a dragged pill is the canonical case: the finger is on the pill, the bar lights up.
|
|
130
|
+
/// Non-nil takes over the press uniforms entirely; `interactive`'s own animator stops reaching
|
|
131
|
+
/// the shader until it goes back to nil. Never touches the view's transform.
|
|
132
|
+
public struct GlassGlowOptions: Record {
|
|
133
|
+
|
|
134
|
+
/// 0 = at rest and the shader's branch is off; 1 = fully lit.
|
|
135
|
+
@Field public var progress: Double = 0
|
|
136
|
+
|
|
137
|
+
/// Hotspot, view-local points. Both default to the view's centre.
|
|
138
|
+
@Field public var x: Double?
|
|
139
|
+
|
|
140
|
+
@Field public var y: Double?
|
|
141
|
+
|
|
142
|
+
/// Whether the press also bends the glass — the backdrop dent and the lens boost. Default
|
|
143
|
+
/// false: a surface hosting someone else's press should light up, not refract harder.
|
|
144
|
+
@Field public var lens: Bool = false
|
|
145
|
+
|
|
146
|
+
public init() {}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public struct GlassMetalOptions: Record {
|
|
150
|
+
|
|
151
|
+
@Field public var blurRadius: Double?
|
|
152
|
+
@Field public var captureQuality: Double?
|
|
153
|
+
@Field public var opacity: Double?
|
|
154
|
+
|
|
155
|
+
@Field public var frost: Double?
|
|
156
|
+
@Field public var saturation: Double?
|
|
157
|
+
@Field public var noise: Double?
|
|
158
|
+
@Field public var light: Double?
|
|
159
|
+
|
|
160
|
+
/// A whole-surface lens: the backdrop reads enlarged through the pane, contracting toward
|
|
161
|
+
/// the shape's center. 1 = none; clamped to [1, 4].
|
|
162
|
+
@Field public var magnification: Double?
|
|
163
|
+
|
|
164
|
+
@Field public var refraction: GlassRefractionOptions?
|
|
165
|
+
@Field public var dispersion: GlassDispersionOptions?
|
|
166
|
+
@Field public var highlight: GlassHighlightOptions?
|
|
167
|
+
@Field public var border: GlassBorderOptions?
|
|
168
|
+
@Field public var innerShadow: GlassInnerShadowOptions?
|
|
169
|
+
@Field public var shape: GlassShapeOptions?
|
|
170
|
+
@Field public var morph: GlassMorphOptions?
|
|
171
|
+
@Field public var progressiveBlur: GlassProgressiveBlurOptions?
|
|
172
|
+
|
|
173
|
+
/// The wash over the glass. Present, it overrides the view's own `tint` prop: a recipe
|
|
174
|
+
/// carries its own colour, so `lerpMetal` can crossfade it between two recipes on the UI
|
|
175
|
+
/// thread and a `metal` object fully describes a look. Arrives as a hex string or a
|
|
176
|
+
/// processed ARGB number, both of which the Color converter takes.
|
|
177
|
+
@Field public var tint: UIColor?
|
|
178
|
+
|
|
179
|
+
public init() {}
|
|
180
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
|
|
3
|
+
public struct GlassRefractionCurve: Record {
|
|
4
|
+
|
|
5
|
+
@Field public var power: Double = 1
|
|
6
|
+
|
|
7
|
+
@Field public var bias: Double = 0
|
|
8
|
+
|
|
9
|
+
public init() {}
|
|
10
|
+
|
|
11
|
+
var simd: SIMD2<Float> {
|
|
12
|
+
SIMD2<Float>(Float(power), Float(bias))
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
#include <metal_stdlib>
|
|
2
|
+
using namespace metal;
|
|
3
|
+
|
|
4
|
+
// =============================================================================================
|
|
5
|
+
// LiquidGlass.metal — the pre-iOS-26 renderer.
|
|
6
|
+
//
|
|
7
|
+
// The glass pass is kept line-for-line in step with the Android AGSL build
|
|
8
|
+
// (android/.../glass/GlassShaderSource.kt), which is where every remodel against real iOS 26
|
|
9
|
+
// glass was measured (docs/android-port/research/04): the continuous-corner SDF family, the
|
|
10
|
+
// additive two-lobe border light, longitudinal dispersion, the press dent and glow, the inner
|
|
11
|
+
// shadow and the whole-surface magnification. One algorithm, two languages; a divergence
|
|
12
|
+
// between them is a bug in whichever side moved last.
|
|
13
|
+
//
|
|
14
|
+
// Coordinate space: view-local POINTS, origin at the view's top-left, y down. Every length in
|
|
15
|
+
// GlassParams is in points. (Android works in device pixels and carries a `unitScale`; here a
|
|
16
|
+
// point IS the unit, so the hard-coded point values below need no conversion.)
|
|
17
|
+
//
|
|
18
|
+
// Portions of the Android build derive from AndroidLiquidGlass (Apache-2.0, (c) 2025 Kyant) —
|
|
19
|
+
// the rounded-rect SDF decomposition, the highlight's angular falloff model and the press glow;
|
|
20
|
+
// see NOTICE. Those came home to this file with the parity pass.
|
|
21
|
+
// =============================================================================================
|
|
22
|
+
|
|
23
|
+
struct VertexOut {
|
|
24
|
+
float4 position [[position]];
|
|
25
|
+
float2 uv;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct BlurParams {
|
|
29
|
+
|
|
30
|
+
float4 uvRect;
|
|
31
|
+
|
|
32
|
+
// The progressive ramp (metal.progressiveBlur). rampLine.xy is the view-local point (in
|
|
33
|
+
// points, y-down) where the ramp begins, rampLine.zw is the unit direction divided by the
|
|
34
|
+
// ramp's length so a dot() lands directly in 0..1. rampRadii holds the leading and trailing
|
|
35
|
+
// radii in texels; a negative x disables the ramp and the uniform `radius` applies.
|
|
36
|
+
float4 rampLine;
|
|
37
|
+
float2 rampRadii;
|
|
38
|
+
float2 paddedSize; // the padded region this pass covers, points
|
|
39
|
+
|
|
40
|
+
float2 texelStep;
|
|
41
|
+
float radius;
|
|
42
|
+
float padding; // points of padding on each side: viewPos = uv * paddedSize - padding
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Field order and types mirror GlassRenderContext.swift's GlassParams exactly: eight float4s,
|
|
46
|
+
// seven float2s, then seventeen floats — every member naturally aligned in both layouts, so
|
|
47
|
+
// neither compiler inserts interior padding and every offset agrees (252 bytes of fields, 256
|
|
48
|
+
// with the trailing alignment pad on both sides). Reorder one side and the shader reads garbage.
|
|
49
|
+
// docs/inspiration-port/tools/check-params-layout.py verifies the two against each other.
|
|
50
|
+
struct GlassParams {
|
|
51
|
+
float4 cornerExtents; // corner-cell extents, points, packed (BL, BR, TR, TL). E = r for a
|
|
52
|
+
// circular corner, up to 1.5287 r for a continuous one.
|
|
53
|
+
float4 cornerShapes; // superellipse exponent per corner, same packing. 2 = circular,
|
|
54
|
+
// 3.3418 = Apple's continuous corner (research/05).
|
|
55
|
+
float4 tintColor; // straight RGBA
|
|
56
|
+
float4 frostColor; // rgb = system background, a = frost amount
|
|
57
|
+
float4 sourceRect; // where this view sits in the sampled texture, UV
|
|
58
|
+
float4 morphRect; // the morph partner: xy = its center's offset from the SHAPE
|
|
59
|
+
// center, zw = its half extents. Points, like every length here.
|
|
60
|
+
float4 innerShadow; // rgb = shadow colour, a = its opacity. a <= 0 turns the band off.
|
|
61
|
+
float4 touch; // xy = press hotspot (view-local points), z = glow 0..1,
|
|
62
|
+
// w = the lens gate: 1 for a press on this glass, 0 for one
|
|
63
|
+
// reported from elsewhere (light only, no dent).
|
|
64
|
+
|
|
65
|
+
float2 morphShape; // (partner corner radius, smoothing); smoothing <= 0 = off
|
|
66
|
+
float2 viewSize;
|
|
67
|
+
float2 shapeSize; // the primary shape's size; == viewSize unless metal.shape insets it
|
|
68
|
+
float2 shapeOffset; // the shape center relative to the view center; zero by default
|
|
69
|
+
float2 refractionScale;
|
|
70
|
+
float2 highlightDir; // (cos angle, sin angle) — the per-pixel sin/cos pair, hoisted
|
|
71
|
+
float2 innerShadowOffset; // points
|
|
72
|
+
|
|
73
|
+
float refractionAmount;
|
|
74
|
+
float refractionSwirl; // lean of the displacement toward the light axis; 0 = none
|
|
75
|
+
float depthEffect;
|
|
76
|
+
float profilePower;
|
|
77
|
+
float profileBias;
|
|
78
|
+
float dispersionHeight;
|
|
79
|
+
float dispersionAmount;
|
|
80
|
+
float dispersionQuadrant; // 0 = even rim fringe (iOS), 1 = Kyant's corner weighting
|
|
81
|
+
float highlightIntensity;
|
|
82
|
+
float highlightWidth; // depth of the crisp border light, points
|
|
83
|
+
float highlightFalloff; // angular falloff exponent of the two lobes, >= 0.01
|
|
84
|
+
float lightIntensity;
|
|
85
|
+
float glassOpacity;
|
|
86
|
+
float saturation;
|
|
87
|
+
float noiseAmount;
|
|
88
|
+
float innerShadowRadius; // points; 0 = off
|
|
89
|
+
float magnification; // >= 1; 1 = none. Sampling contracts toward the shape center.
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
vertex VertexOut liquid_glass_vertex(const device float4 *vertices [[buffer(0)]],
|
|
93
|
+
uint vid [[vertex_id]]) {
|
|
94
|
+
VertexOut out;
|
|
95
|
+
out.position = float4(vertices[vid].xy, 0.0, 1.0);
|
|
96
|
+
out.uv = vertices[vid].zw;
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
constant float kNormEps = 1e-6;
|
|
101
|
+
constant int kBlurTaps = 8;
|
|
102
|
+
constant int kDispersionTaps = 16;
|
|
103
|
+
|
|
104
|
+
// The faint broad glow under the lit edges, points deep (research/04: ~7 pt on real iOS 26).
|
|
105
|
+
constant float kSheenDepth = 7.0;
|
|
106
|
+
|
|
107
|
+
constexpr sampler linearSampler(mag_filter::linear,
|
|
108
|
+
min_filter::linear,
|
|
109
|
+
address::clamp_to_edge);
|
|
110
|
+
|
|
111
|
+
// ----------------------------------------------------------------------------------- geometry
|
|
112
|
+
|
|
113
|
+
// NaN-free normalize. A ternary is not safe: if the compiler lowers `cond ? normalize(v) : fb`
|
|
114
|
+
// to an arithmetic select then normalize(0) = NaN is still multiplied by 0, and NaN * 0 = NaN.
|
|
115
|
+
// The division form cannot produce NaN for any finite v, because the denominator is floored.
|
|
116
|
+
inline float2 safeNormalize(float2 v, float2 fallback) {
|
|
117
|
+
float len = length(v);
|
|
118
|
+
float ok = step(kNormEps, len);
|
|
119
|
+
return mix(fallback, v / max(len, kNormEps), ok);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Quadrant-select any per-corner packed float4 (extents, shapes). The argument MUST be the
|
|
123
|
+
// CENTERED coordinate, y down.
|
|
124
|
+
inline float cornerParam(float2 c, float4 corners) {
|
|
125
|
+
if (c.x >= 0.0) {
|
|
126
|
+
return (c.y <= 0.0) ? corners.z : corners.y; // right-top : right-bottom
|
|
127
|
+
}
|
|
128
|
+
return (c.y <= 0.0) ? corners.w : corners.x; // left-top : left-bottom
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// The rounded-rect SDF, extended to the continuous-corner family (research/05): a corner is a
|
|
132
|
+
// superellipse quadrant in an E x E cell, and (E = r, n = 2) IS the circular corner — the
|
|
133
|
+
// else-branch is the original Euclidean SDF verbatim, with E in place of r. The edge and
|
|
134
|
+
// interior algebra cancels E exactly as it cancelled r, so straight edges stay exact for any
|
|
135
|
+
// extent.
|
|
136
|
+
//
|
|
137
|
+
// The corner branch is the n-norm field with a first-order Euclidean correction,
|
|
138
|
+
// sd ~ (g - E) / |grad g|. Measured against the true curve: error <= 0.11 px at 20 px depth,
|
|
139
|
+
// growing only where the refraction profile has already decayed to ~0. pow() is only ever
|
|
140
|
+
// called with a strictly positive base (the qp > 0 guards), so pow(x < 0) and pow(0, 0) are
|
|
141
|
+
// unreachable.
|
|
142
|
+
inline float sdGlassRect(float2 c, float2 halfSize, float4 extents, float4 shapes) {
|
|
143
|
+
// The host resolves the view's own extents; the min() is for rects it cannot see — a
|
|
144
|
+
// `metal.shape` smaller than the radii resolved against it. innerHalf < 0 breaks the SDF.
|
|
145
|
+
float E = min(cornerParam(c, extents), min(halfSize.x, halfSize.y));
|
|
146
|
+
float n = cornerParam(c, shapes);
|
|
147
|
+
float2 innerHalf = halfSize - float2(E);
|
|
148
|
+
float2 q = abs(c) - innerHalf;
|
|
149
|
+
float2 qp = max(q, float2(0.0));
|
|
150
|
+
float outside;
|
|
151
|
+
if (n > 2.001 && qp.x > 0.0 && qp.y > 0.0) {
|
|
152
|
+
float g = max(pow(pow(qp.x, n) + pow(qp.y, n), 1.0 / n), kNormEps);
|
|
153
|
+
float2 dg = pow(qp / g, float2(n - 1.0));
|
|
154
|
+
outside = (g - E) / max(length(dg), kNormEps);
|
|
155
|
+
} else {
|
|
156
|
+
outside = length(qp) - E;
|
|
157
|
+
}
|
|
158
|
+
float inside = min(max(q.x, q.y), 0.0);
|
|
159
|
+
return outside + inside;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Same extension for the gradient. In the corner cell the outward direction is the n-norm
|
|
163
|
+
// field's gradient (qp/g)^(n-1), which at n = 2 is qp itself — the original normalize direction.
|
|
164
|
+
inline float2 gradGlassRect(float2 c, float2 halfSize, float4 extents, float4 shapes) {
|
|
165
|
+
float E = min(cornerParam(c, extents), min(halfSize.x, halfSize.y));
|
|
166
|
+
float n = cornerParam(c, shapes);
|
|
167
|
+
float2 innerHalf = halfSize - float2(E);
|
|
168
|
+
float2 q = abs(c) - innerHalf;
|
|
169
|
+
|
|
170
|
+
float insideCorner = step(0.0, min(q.x, q.y));
|
|
171
|
+
float xMajor = step(q.y, q.x);
|
|
172
|
+
float2 gradEdge = float2(xMajor, 1.0 - xMajor);
|
|
173
|
+
float2 qp = max(q, float2(0.0));
|
|
174
|
+
float2 dir = qp;
|
|
175
|
+
if (n > 2.001) {
|
|
176
|
+
float g = max(pow(pow(qp.x, n) + pow(qp.y, n), 1.0 / n), kNormEps);
|
|
177
|
+
dir = pow(qp / g, float2(n - 1.0));
|
|
178
|
+
}
|
|
179
|
+
float2 gradCorner = safeNormalize(dir, float2(0.0));
|
|
180
|
+
return sign(c) * mix(gradEdge, gradCorner, insideCorner);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// KEEP the max(0.0, …): without it this returns NaN for |x| > 1.
|
|
184
|
+
inline float circleMap(float x) {
|
|
185
|
+
return 1.0 - sqrt(max(0.0, 1.0 - x * x));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
inline float hashNoise(float2 co) {
|
|
189
|
+
return fract(sin(dot(co, float2(12.9898, 78.233))) * 43758.5453);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// The merged field: the primary shape with the morph partner folded in by the polynomial
|
|
193
|
+
// smooth-min (I. Quilez's smin, published mid-2000s and folklore since). Everything downstream
|
|
194
|
+
// reads this field and its blended gradient, which is what fuses two nearby shapes into one
|
|
195
|
+
// pane of liquid instead of two panes overlapping. `morphH` comes out as the blend weight —
|
|
196
|
+
// 1.0 both when there is no partner and far on the primary's side — for the gradient blend.
|
|
197
|
+
//
|
|
198
|
+
// The partner's corners are circular (n = 2): its radius is a single scalar, and the
|
|
199
|
+
// continuous-corner family stays a primary-shape refinement.
|
|
200
|
+
inline float mergedSd(float2 centered, constant GlassParams ¶ms, thread float &morphH) {
|
|
201
|
+
float2 halfSize = params.shapeSize * 0.5;
|
|
202
|
+
float sd = sdGlassRect(centered, halfSize, params.cornerExtents, params.cornerShapes);
|
|
203
|
+
|
|
204
|
+
float2 morphHalf = params.morphRect.zw;
|
|
205
|
+
morphH = 1.0;
|
|
206
|
+
if (params.morphShape.y > 0.0 && morphHalf.x > 0.0 && morphHalf.y > 0.0) {
|
|
207
|
+
float2 morphCoord = centered - params.morphRect.xy;
|
|
208
|
+
float morphR = min(params.morphShape.x, min(morphHalf.x, morphHalf.y));
|
|
209
|
+
float sdB = sdGlassRect(morphCoord, morphHalf, float4(morphR), float4(2.0));
|
|
210
|
+
float k = params.morphShape.y;
|
|
211
|
+
morphH = clamp(0.5 + 0.5 * (sdB - sd) / k, 0.0, 1.0);
|
|
212
|
+
sd = mix(sdB, sd, morphH) - k * morphH * (1.0 - morphH);
|
|
213
|
+
}
|
|
214
|
+
return sd;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// ------------------------------------------------------------------------------------- blur
|
|
218
|
+
|
|
219
|
+
fragment float4 blurFragment(VertexOut in [[stage_in]],
|
|
220
|
+
texture2d<float> source [[texture(0)]],
|
|
221
|
+
constant BlurParams ¶ms [[buffer(1)]]) {
|
|
222
|
+
float2 base = params.uvRect.xy + in.uv * params.uvRect.zw;
|
|
223
|
+
|
|
224
|
+
float radius = params.radius;
|
|
225
|
+
if (params.rampRadii.x >= 0.0) {
|
|
226
|
+
// The local radius from a Hermite-eased ramp over view-local points. Both passes cover
|
|
227
|
+
// the same padded region, so in.uv maps identically in each.
|
|
228
|
+
float2 viewPos = in.uv * params.paddedSize - params.padding;
|
|
229
|
+
float t = clamp(dot(viewPos - params.rampLine.xy, params.rampLine.zw), 0.0, 1.0);
|
|
230
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
231
|
+
radius = mix(params.rampRadii.x, params.rampRadii.y, t);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (radius <= 0.01) {
|
|
235
|
+
return source.sample(linearSampler, base);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
float sigma = max(radius * 0.5, 0.0001);
|
|
239
|
+
float invTwoSigmaSq = -1.0 / (2.0 * sigma * sigma);
|
|
240
|
+
|
|
241
|
+
float stride = max(radius * 1.5 / float(kBlurTaps), 1.0);
|
|
242
|
+
// Per-pixel comb jitter — the sparse-tap plaid fix, measured on the Android port of this
|
|
243
|
+
// exact loop. Sub-pixel at the stride floor, so the small-radius look this pass has always
|
|
244
|
+
// had is untouched.
|
|
245
|
+
float jitter = hashNoise(in.uv * 587.0 + params.texelStep) - 0.5;
|
|
246
|
+
|
|
247
|
+
float4 sum = source.sample(linearSampler, base);
|
|
248
|
+
float weightSum = 1.0;
|
|
249
|
+
|
|
250
|
+
for (int i = 0; i < kBlurTaps; ++i) {
|
|
251
|
+
float offset = (float(i) + 0.5 + jitter) * stride;
|
|
252
|
+
float weight = exp2(offset * offset * invTwoSigmaSq * 1.4426950);
|
|
253
|
+
float2 delta = params.texelStep * offset;
|
|
254
|
+
|
|
255
|
+
sum += source.sample(linearSampler, base + delta) * weight;
|
|
256
|
+
sum += source.sample(linearSampler, base - delta) * weight;
|
|
257
|
+
weightSum += weight * 2.0;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return sum / weightSum;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ------------------------------------------------------------------------------------ glass
|
|
264
|
+
|
|
265
|
+
// Every backdrop read passes through here, which is what keeps the press dent coherent:
|
|
266
|
+
// samples near the finger are pulled toward it, so the interior, the rim band and every
|
|
267
|
+
// dispersion tap warp together as a magnifying bulge travelling with the touch, while geometry
|
|
268
|
+
// (sd, normals, t) stays un-warped. d == 0 at the touch point, so there is no normalize() and no
|
|
269
|
+
// NaN to guard. The branch is uniform-coherent — free while nothing is pressed.
|
|
270
|
+
inline float3 sampleBackdrop(texture2d<float> source,
|
|
271
|
+
float2 pixels,
|
|
272
|
+
constant GlassParams ¶ms) {
|
|
273
|
+
float lens = params.touch.z * params.touch.w;
|
|
274
|
+
if (lens > 0.0) {
|
|
275
|
+
float2 d = pixels - params.touch.xy;
|
|
276
|
+
float f = 1.0 - smoothstep(0.0, 0.6 * min(params.viewSize.x, params.viewSize.y), length(d));
|
|
277
|
+
pixels -= d * (f * f * 0.22 * lens);
|
|
278
|
+
}
|
|
279
|
+
float2 uv = pixels / params.viewSize;
|
|
280
|
+
float2 texUV = params.sourceRect.xy + uv * params.sourceRect.zw;
|
|
281
|
+
|
|
282
|
+
return source.sample(linearSampler, clamp(texUV, float2(0.0), float2(1.0))).rgb;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
fragment float4 glassFragment(VertexOut in [[stage_in]],
|
|
286
|
+
texture2d<float> source [[texture(0)]],
|
|
287
|
+
constant GlassParams ¶ms [[buffer(1)]]) {
|
|
288
|
+
float2 halfSize = params.shapeSize * 0.5;
|
|
289
|
+
float2 pixels = in.uv * params.viewSize;
|
|
290
|
+
// Shape-centered, not view-centered: with `metal.shape` unset the offset is zero and this is
|
|
291
|
+
// the historical line exactly. Sampling positions stay `pixels` — only geometry moves.
|
|
292
|
+
float2 centered = pixels - params.viewSize * 0.5 - params.shapeOffset;
|
|
293
|
+
|
|
294
|
+
// The SDF alone decides the early-out — before any gradient work, and on the MERGED field,
|
|
295
|
+
// because the smooth-min neck lies outside both source shapes: a coverage test on the
|
|
296
|
+
// primary SDF alone would discard exactly the pixels the merge exists to draw.
|
|
297
|
+
float morphH = 1.0;
|
|
298
|
+
float sd = mergedSd(centered, params, morphH);
|
|
299
|
+
|
|
300
|
+
float aa = max(fwidth(sd), 1e-4);
|
|
301
|
+
float shapeAlpha = 1.0 - smoothstep(-aa, aa, sd);
|
|
302
|
+
if (shapeAlpha <= 0.001) {
|
|
303
|
+
return float4(0.0);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Normals from corner cells inflated 1.5x — for circular corners that is exactly the
|
|
307
|
+
// original radius inflation, and for continuous ones it widens the same look-tuning band
|
|
308
|
+
// around the softer corner.
|
|
309
|
+
float4 maxGradExtent = float4(min(halfSize.x, halfSize.y));
|
|
310
|
+
float4 gradExtents = min(params.cornerExtents * 1.5, maxGradExtent);
|
|
311
|
+
float2 normal = safeNormalize(
|
|
312
|
+
gradGlassRect(centered, halfSize, gradExtents, params.cornerShapes),
|
|
313
|
+
float2(0.0, 1.0));
|
|
314
|
+
|
|
315
|
+
// The merged field's gradient: the two shapes' gradients blended by the same hermite
|
|
316
|
+
// weight — standard SDF practice (the exact derivative's dh terms are dropped), smooth
|
|
317
|
+
// everywhere the weight is. Only ever computed near the partner.
|
|
318
|
+
if (morphH < 1.0) {
|
|
319
|
+
float2 morphHalf = params.morphRect.zw;
|
|
320
|
+
float2 morphCoord = centered - params.morphRect.xy;
|
|
321
|
+
float morphR = min(params.morphShape.x, min(morphHalf.x, morphHalf.y));
|
|
322
|
+
float4 maxGradB = float4(min(morphHalf.x, morphHalf.y));
|
|
323
|
+
float4 gradExtentsB = min(float4(morphR) * 1.5, maxGradB);
|
|
324
|
+
float2 normalB = safeNormalize(
|
|
325
|
+
gradGlassRect(morphCoord, morphHalf, gradExtentsB, float4(2.0)),
|
|
326
|
+
float2(0.0, 1.0));
|
|
327
|
+
normal = safeNormalize(mix(normalB, normal, morphH), normal);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
float2 radial = safeNormalize(centered, float2(0.0));
|
|
331
|
+
|
|
332
|
+
// The light axis: highlightDir rotated +90 degrees — the same axis the border-light lobes
|
|
333
|
+
// sit on, so `highlight.angle` steers both. Mixing it into the displacement direction
|
|
334
|
+
// before normalizing leans the edge refraction toward the light — a stylisation knob, OFF
|
|
335
|
+
// by default: measured real iOS 26 glass carries no such lean (research/04, C8); its
|
|
336
|
+
// perceived twist is the radial term sweeping through the corners.
|
|
337
|
+
float2 lobeDir = float2(-params.highlightDir.y, params.highlightDir.x);
|
|
338
|
+
float2 direction = safeNormalize(
|
|
339
|
+
normal + params.depthEffect * radial + params.refractionSwirl * lobeDir, normal);
|
|
340
|
+
|
|
341
|
+
// Anisotropic refraction height: n^2 . refractionScale yields refractionScale.x on a
|
|
342
|
+
// vertical edge and .y on a horizontal one.
|
|
343
|
+
float2 limit = max(halfSize, float2(1e-3));
|
|
344
|
+
float2 scale2 = clamp(params.refractionScale, float2(1e-3), limit);
|
|
345
|
+
float scale = max(dot(normal * normal, scale2), 1e-3);
|
|
346
|
+
|
|
347
|
+
float t = clamp(-min(sd, 0.0) / scale, 0.0, 1.0);
|
|
348
|
+
float inside = -min(sd, 0.0);
|
|
349
|
+
|
|
350
|
+
// The press deepens the lens — Kyant's components animate their lens amount with press
|
|
351
|
+
// progress; this is that. 1.0 at rest, and 1.0 for a press reported from another view,
|
|
352
|
+
// which lights this glass without bending it further.
|
|
353
|
+
float glow = params.touch.z;
|
|
354
|
+
float touchBoost = 1.0 + 0.35 * glow * params.touch.w;
|
|
355
|
+
|
|
356
|
+
// The whole-surface lens (research/04, C16): sampling contracts toward the shape center by
|
|
357
|
+
// the magnification, so the backdrop reads enlarged through the pane. Geometry is untouched
|
|
358
|
+
// — the edge band still bends off the true silhouette — and >= 1 only ever samples inward.
|
|
359
|
+
float2 samplePx = pixels;
|
|
360
|
+
if (params.magnification > 1.0001) {
|
|
361
|
+
samplePx = pixels - centered * (1.0 - 1.0 / params.magnification);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
float3 color;
|
|
365
|
+
|
|
366
|
+
if (inside >= scale) {
|
|
367
|
+
color = sampleBackdrop(source, samplePx, params);
|
|
368
|
+
} else {
|
|
369
|
+
float profile = circleMap(pow(1.0 - t, max(params.profilePower, 1e-3)));
|
|
370
|
+
float amount = (profile + params.profileBias * (1.0 - t))
|
|
371
|
+
* params.refractionAmount * touchBoost;
|
|
372
|
+
float2 base = samplePx - amount * direction;
|
|
373
|
+
|
|
374
|
+
float dispersionT = clamp(inside / max(params.dispersionHeight, 1e-3), 0.0, 1.0);
|
|
375
|
+
float spread = circleMap(1.0 - dispersionT) * params.dispersionAmount * touchBoost;
|
|
376
|
+
|
|
377
|
+
// Kyant's quadrant weighting, blended in by `dispersionQuadrant`: the product of the
|
|
378
|
+
// normalized centered coordinates is 0 along both centre lines and +/-1 at the corners,
|
|
379
|
+
// so the fringe lives where the eye already reads the shape bending — a capsule's ends —
|
|
380
|
+
// and dies out along its flanks. Left signed on purpose: the sign flips between
|
|
381
|
+
// adjacent quadrants, which walks the taps the other way and reverses the hue order.
|
|
382
|
+
float2 quadrant = centered / max(halfSize, float2(1e-3));
|
|
383
|
+
spread *= mix(1.0, quadrant.x * quadrant.y, params.dispersionQuadrant);
|
|
384
|
+
// Magnitude from here down: a negative spread is a direction, not a smaller one.
|
|
385
|
+
float spreadMag = abs(spread);
|
|
386
|
+
|
|
387
|
+
if (spreadMag < 2.0) {
|
|
388
|
+
color = sampleBackdrop(source, base, params);
|
|
389
|
+
} else {
|
|
390
|
+
// LONGITUDINAL aberration: taps walk along the displacement axis itself — R sampled
|
|
391
|
+
// deepest, B shallowest, G centred. Per-channel phase solves of real iOS 26 measured
|
|
392
|
+
// the spread along the displacement direction with blue as the outermost fringe
|
|
393
|
+
// (research/04, C26); the tangent walk this pass used to do puts the fringe on the
|
|
394
|
+
// wrong axis. `base - direction * s` deepens the sample for positive s, so the R half
|
|
395
|
+
// of the mask (u > 0.5) lands deepest.
|
|
396
|
+
float3 accumulated = float3(0.0);
|
|
397
|
+
float3 weight = float3(0.0);
|
|
398
|
+
float maxI = min(spreadMag, float(kDispersionTaps)); // one tap per point
|
|
399
|
+
|
|
400
|
+
for (int i = 0; i < kDispersionTaps; ++i) {
|
|
401
|
+
float u = float(i) / maxI;
|
|
402
|
+
if (u > 1.0) break;
|
|
403
|
+
|
|
404
|
+
float3 tap = sampleBackdrop(source, base - direction * (u - 0.5) * spread, params);
|
|
405
|
+
float3 mask = float3(step(0.5, u),
|
|
406
|
+
step(0.25, u) * step(u, 0.75),
|
|
407
|
+
step(u, 0.5));
|
|
408
|
+
|
|
409
|
+
accumulated += tap * mask;
|
|
410
|
+
weight += mask;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
color = accumulated / max(weight, float3(1e-6));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
color = clamp(color, 0.0, 1.0);
|
|
418
|
+
|
|
419
|
+
float luma = dot(color, float3(0.2126, 0.7152, 0.0722));
|
|
420
|
+
color = mix(float3(luma), color, params.saturation);
|
|
421
|
+
color = mix(color, params.frostColor.rgb, params.frostColor.a);
|
|
422
|
+
color = mix(color, params.tintColor.rgb, params.tintColor.a);
|
|
423
|
+
|
|
424
|
+
// Keyed off `pixels`, which is view-local and stable, so the grain field does not jump when
|
|
425
|
+
// the drawable resizes mid-animation.
|
|
426
|
+
if (params.noiseAmount > 0.0) {
|
|
427
|
+
color += (hashNoise(pixels * 1e-3) - 0.5) * params.noiseAmount;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// The glass border light, and nothing else — remodeled against real iOS 26 glass. The signed
|
|
431
|
+
// multiplicative wash this pass used to carry (`sin(pos_angle - angle)` over the whole
|
|
432
|
+
// refraction band) darkened the quadrant opposite the light by up to 25 %, an inset shadow
|
|
433
|
+
// real glass does not have, and vanished over dark backdrops; the separate contour line on
|
|
434
|
+
// top was the over-thick edge. What remains: a thin ADDITIVE rim lighting both light-axis
|
|
435
|
+
// lobes — `pow(abs(dot(normal, light)), falloff)`, Kyant's falloff model — fading over its own
|
|
436
|
+
// `highlightWidth`, plus the faint broad sheen under the lit edges (~0.18x the rim's weight,
|
|
437
|
+
// measured +13/255 over ~25 px). `abs()` is what lights both lobes; `normal`, not the
|
|
438
|
+
// position angle, is what holds a long edge at constant intensity.
|
|
439
|
+
float rim = pow(abs(dot(normal, lobeDir)), params.highlightFalloff);
|
|
440
|
+
float rimT = clamp(inside / max(params.highlightWidth, 1e-3), 0.0, 1.0);
|
|
441
|
+
float rimBand = 1.0 - smoothstep(0.0, 1.0, rimT);
|
|
442
|
+
|
|
443
|
+
float sheenT = clamp(inside / kSheenDepth, 0.0, 1.0);
|
|
444
|
+
float sheen = 1.0 - smoothstep(0.0, 1.0, sheenT);
|
|
445
|
+
|
|
446
|
+
// Glass does not amplify what it merely transmits: the interior is pinned at 1 before the
|
|
447
|
+
// rim is added on top.
|
|
448
|
+
color = min(color * (1.0 + params.lightIntensity), float3(1.0));
|
|
449
|
+
color += rim * rimBand * params.highlightIntensity;
|
|
450
|
+
color += rim * sheen * params.highlightIntensity * 0.18;
|
|
451
|
+
|
|
452
|
+
// The inner shadow — Kyant's `InnerShadow`, as an SDF band: the blurred coverage of the
|
|
453
|
+
// shape minus itself translated by the offset, `S \ (S + o)`. Blur is linear and the blurred
|
|
454
|
+
// coverage of a set is a smoothstep of its SDF, so the band is ss(sd of S ∩ (S + o)) −
|
|
455
|
+
// ss(sd of S) with sd of the intersection = max of the two fields. Offset (0, +r) shades the
|
|
456
|
+
// top inner edge: light from above, and the pane's top lip casts inward. Evaluated on the
|
|
457
|
+
// merged field, so a morph partner shades as one piece.
|
|
458
|
+
if (params.innerShadow.a > 0.0 && params.innerShadowRadius > 0.0) {
|
|
459
|
+
float r = params.innerShadowRadius;
|
|
460
|
+
float shiftedH = 1.0;
|
|
461
|
+
float sdShifted = mergedSd(centered - params.innerShadowOffset, params, shiftedH);
|
|
462
|
+
float shade = smoothstep(-r, r, max(sd, sdShifted)) - smoothstep(-r, r, sd);
|
|
463
|
+
color = mix(color, params.innerShadow.rgb, clamp(shade, 0.0, 1.0) * params.innerShadow.a);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// The press glow, per Kyant's InteractiveHighlight: a flat 0.08 wash plus a 0.15 radial lobe,
|
|
467
|
+
// additive, radius 1.5x the view's min dimension, full strength inside half that radius.
|
|
468
|
+
// Uniform-coherent, so it costs nothing at rest.
|
|
469
|
+
if (glow > 0.0) {
|
|
470
|
+
float touchRadius = 1.5 * min(params.viewSize.x, params.viewSize.y);
|
|
471
|
+
float touchDist = distance(pixels, params.touch.xy);
|
|
472
|
+
float touchFalloff = 1.0 - smoothstep(touchRadius * 0.5, touchRadius, touchDist);
|
|
473
|
+
color += (0.08 + 0.15 * touchFalloff) * glow;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
color = clamp(color, 0.0, 1.0);
|
|
477
|
+
|
|
478
|
+
float alpha = shapeAlpha * params.glassOpacity;
|
|
479
|
+
return float4(color * alpha, alpha);
|
|
480
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Placeholder so CocoaPods creates ExpoLiquidGlassShaders.bundle.
|
|
2
|
+
|
|
3
|
+
The bundle's real payload is default.metallib, which the podspec's
|
|
4
|
+
"Bundle compiled Metal shaders" script phase copies in after Xcode
|
|
5
|
+
compiles Shaders/*.metal. A resource bundle needs at least one
|
|
6
|
+
pod-install-time file to exist, hence this marker.
|