glacia-native 0.5.1 → 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/LICENSE +29 -4
- package/README.md +111 -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 -267
- package/lib/module/Button.js +57 -36
- package/lib/module/Card.js +32 -20
- 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 -124
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +12 -5
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +47 -40
- 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 +74 -58
- 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 +60 -40
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -43
- package/lib/module/TabBar.js +62 -50
- package/lib/module/Tabs.js +3 -2
- 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 +45 -13
- 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 +75 -0
- package/lib/module/internal/fallback.js +110 -20
- package/lib/module/internal/glass-routing.js +154 -30
- package/lib/module/internal/glow.js +36 -0
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/lens.js +70 -0
- package/lib/module/internal/material.js +64 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +17 -0
- package/lib/module/internal/rim.js +35 -0
- package/lib/module/internal/tokens.js +34 -2
- 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 +39 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +31 -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/blur.d.ts +24 -0
- package/lib/typescript/internal/fallback.d.ts +27 -2
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/glow.d.ts +11 -0
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/lens.d.ts +47 -0
- package/lib/typescript/internal/material.d.ts +27 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +13 -0
- package/lib/typescript/internal/rim.d.ts +16 -0
- package/lib/typescript/internal/tokens.d.ts +36 -0
- package/package.json +15 -4
- 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 -797
- package/src/Button.tsx +196 -60
- package/src/Card.tsx +106 -33
- 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 +86 -325
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +19 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +143 -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 +147 -90
- 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 +100 -54
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +80 -58
- package/src/TabBar.tsx +118 -84
- package/src/Tabs.tsx +5 -0
- 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 +48 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +70 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +89 -0
- package/src/internal/fallback.tsx +158 -20
- package/src/internal/glass-routing.ts +211 -34
- package/src/internal/glow.tsx +62 -0
- package/src/internal/initials.ts +7 -0
- package/src/internal/lens.tsx +105 -0
- package/src/internal/material.ts +92 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +26 -0
- package/src/internal/rim.tsx +79 -0
- package/src/internal/tokens.ts +34 -1
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -317
- package/lib/module/Feedback.js +0 -386
- package/lib/module/Form.js +0 -164
- package/lib/module/Forms2.js +0 -454
- package/lib/module/Message.js +0 -88
- package/lib/module/Overlays.js +0 -328
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -99
- package/lib/module/ai.js +0 -280
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -67
- 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 -71
- 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 -778
- package/src/Feedback.tsx +0 -969
- package/src/Form.tsx +0 -425
- package/src/Forms2.tsx +0 -1014
- package/src/Message.tsx +0 -219
- package/src/Overlays.tsx +0 -685
- package/src/Pickers.tsx +0 -590
- package/src/Table.tsx +0 -231
- package/src/ai.tsx +0 -707
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -183
- 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,116 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import type { GlassMetalOptions } from "../core";
|
|
5
|
+
|
|
6
|
+
interface ILiquidGlassTabIconState {
|
|
7
|
+
focused: boolean;
|
|
8
|
+
/** The resolved accent (focused) or inactive color, ready to pass to an icon component. */
|
|
9
|
+
color: string;
|
|
10
|
+
size: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ILiquidGlassTabItem {
|
|
14
|
+
key: string;
|
|
15
|
+
/** Label under the icon, and the accessibility label. Omit for icon-only tabs. */
|
|
16
|
+
title?: string;
|
|
17
|
+
icon?: (state: ILiquidGlassTabIconState) => ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface ILiquidGlassTabBarProps {
|
|
21
|
+
tabs: ILiquidGlassTabItem[];
|
|
22
|
+
selectedIndex: number;
|
|
23
|
+
/** Fires on tap, and on drag-release when the pill lands on a new tab. */
|
|
24
|
+
onTabSelected: (index: number) => void;
|
|
25
|
+
/** Focused item color. Defaults to the scheme's system blue. */
|
|
26
|
+
accentColor?: string;
|
|
27
|
+
inactiveColor?: string;
|
|
28
|
+
/** Wash over the bar's glass. Defaults to the scheme's bar surface. */
|
|
29
|
+
tint?: ColorValue;
|
|
30
|
+
/**
|
|
31
|
+
* Adaptive glass: the bar reads the backdrop under it and switches its whole dress — surface
|
|
32
|
+
* wash, accent, inactive colour, the pill's lift — to the palette that reads over it, with the
|
|
33
|
+
* frost crossfading natively and the labels crossfading with it. Over a light card in a dark
|
|
34
|
+
* app the bar goes light with dark labels, and back. Shader renderers only; explicit `tint`,
|
|
35
|
+
* `accentColor`, `inactiveColor` and `pillTint` still win. Defaults to `false`.
|
|
36
|
+
*/
|
|
37
|
+
adaptive?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* How much material the bar wears. Defaults to `"regular"`.
|
|
41
|
+
*
|
|
42
|
+
* `"regular"` is the catalog's bar: a 42% container fill under the lens, which is what keeps a
|
|
43
|
+
* label readable over *anything* behind it. `"clear"` pulls that fill back to a hint and lets
|
|
44
|
+
* the glass carry the look — the right choice over photos and video, where a scrim reads as a
|
|
45
|
+
* grey slab, and the wrong one over dense or high-contrast content, where the labels go with it.
|
|
46
|
+
*
|
|
47
|
+
* It switches the whole dress at once: the bar's material, the surface wash, and the accent
|
|
48
|
+
* strip behind the pill. `barMetal` and `tint` still override either.
|
|
49
|
+
*/
|
|
50
|
+
variant?: "regular" | "clear";
|
|
51
|
+
/** Bar height. Defaults to 64. */
|
|
52
|
+
height?: number;
|
|
53
|
+
/**
|
|
54
|
+
* The bar's own glass. The reference runs `vibrancy -> blur(8dp) -> lens(24dp, 24dp)` here
|
|
55
|
+
* **permanently**. On Android the accent clone the pill reads through wears this exact recipe
|
|
56
|
+
* and the bar's shape, so whatever lens the bar carries runs on under the pill rather than
|
|
57
|
+
* stopping at its edge — a strong `refraction` here is just as strong through the pill. May
|
|
58
|
+
* carry `tint` — a recipe's own wash wins over the bar's `tint` prop.
|
|
59
|
+
*/
|
|
60
|
+
barMetal?: GlassMetalOptions;
|
|
61
|
+
/**
|
|
62
|
+
* The bar's blur, dp — the one dial most apps want without rewriting `barMetal`. The accent
|
|
63
|
+
* clone the pill reads through takes the bar's whole recipe, this included, so the resting
|
|
64
|
+
* pill stays the same frost as the bar around it. Defaults to the reference's 8. An explicit
|
|
65
|
+
* `barMetal` still wins.
|
|
66
|
+
*/
|
|
67
|
+
blurRadius?: number;
|
|
68
|
+
/**
|
|
69
|
+
* The pill's glass at rest. The reference attaches *no render effect at all* here — its
|
|
70
|
+
* `lens()` early-returns at zero — leaving a flat wash over the bar exactly as it renders.
|
|
71
|
+
*
|
|
72
|
+
* May carry `tint`: the pill's own wash, in place of `pillTint`, crossfaded to
|
|
73
|
+
* `pillDraggedMetal.tint` (or to nothing) as the pill lifts. The bar does **not** put a pill
|
|
74
|
+
* tint on the pill's glass — the active glyph reaches the eye *through* that glass, and a
|
|
75
|
+
* wash on it dims the glyph — but paints it beneath the glyphs, where the resting chip lives.
|
|
76
|
+
* `{ ...GLASS_PILL_METAL, tint: "#0088FFB3" }` with `accentColor="#FFFFFF"` is a blue pill.
|
|
77
|
+
*/
|
|
78
|
+
pillMetal?: GlassMetalOptions;
|
|
79
|
+
/**
|
|
80
|
+
* The pill's glass while grabbed: a lens across its whole face with the colour split riding it
|
|
81
|
+
* (iOS 26's, wider than the reference's rim band — see `GLASS_PILL_DRAGGED_METAL`). No blur, no
|
|
82
|
+
* saturation boost — those belong to the bar. Its `tint`, if any, is the
|
|
83
|
+
* wash the pill takes on in the hand — `{ ...GLASS_PILL_DRAGGED_METAL, tint: "#0088FFAA" }`
|
|
84
|
+
* is a pill that goes blue as it lifts — painted under the glyphs like the resting one.
|
|
85
|
+
*/
|
|
86
|
+
pillDraggedMetal?: GlassMetalOptions;
|
|
87
|
+
/**
|
|
88
|
+
* The resting pill's wash — the chip. Defaults to the scheme's indicator surface (white at
|
|
89
|
+
* 0.55 light / 0.30 dark: a light pill in either scheme). A `pillMetal` with its own `tint`
|
|
90
|
+
* wins over this.
|
|
91
|
+
*/
|
|
92
|
+
pillTint?: ColorValue;
|
|
93
|
+
/** Pill height. Defaults to 56 — the reference's, in a 64 bar. */
|
|
94
|
+
pillHeight?: number;
|
|
95
|
+
/** Pill scale while dragged. Defaults to the reference's `78 / 56`. */
|
|
96
|
+
pillPressedScale?: number;
|
|
97
|
+
/**
|
|
98
|
+
* How much the bar lights up under the grabbed pill, 0..1 — the reference's
|
|
99
|
+
* `InteractiveHighlight` (a flat additive wash over the bar plus a soft lobe centred on the
|
|
100
|
+
* pill, on its own bouncier spring) scaled. Defaults to **0.1**: iOS 26 lightens the bar under
|
|
101
|
+
* the grab only faintly (iPhone 14 Pro Max, 2026-09-07), and the full wash spent the bar's
|
|
102
|
+
* headroom — a light bar pushed toward white leaves the chip and the lifted pill nowhere
|
|
103
|
+
* lighter to go. `1` is Kyant's highlight at full strength; `0` is none.
|
|
104
|
+
*/
|
|
105
|
+
pressLight?: number;
|
|
106
|
+
/** Android only — which `LiquidGlassProvider` supplies the backdrop. */
|
|
107
|
+
providerId?: string;
|
|
108
|
+
style?: StyleProp<ViewStyle>;
|
|
109
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type {
|
|
113
|
+
ILiquidGlassTabBarProps,
|
|
114
|
+
ILiquidGlassTabItem,
|
|
115
|
+
ILiquidGlassTabIconState,
|
|
116
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
ColorValue,
|
|
4
|
+
StyleProp,
|
|
5
|
+
TextInputProps,
|
|
6
|
+
TextStyle,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import type { LiquidGlassViewProps } from "../core";
|
|
10
|
+
|
|
11
|
+
interface ILiquidGlassTextInputProps
|
|
12
|
+
extends Omit<TextInputProps, "style"> {
|
|
13
|
+
/** Capsule height; the corner radius follows it. Defaults to 48. */
|
|
14
|
+
height?: number;
|
|
15
|
+
/** Surface wash over the glass. */
|
|
16
|
+
tint?: ColorValue;
|
|
17
|
+
variant?: LiquidGlassViewProps["variant"];
|
|
18
|
+
/**
|
|
19
|
+
* Native touch response on the glass frame. The inner `TextInput` consumes most touches, so
|
|
20
|
+
* this mainly lights up the capsule's edges — and the whole field on iOS 26+. Defaults to
|
|
21
|
+
* `true`.
|
|
22
|
+
*/
|
|
23
|
+
interactive?: boolean;
|
|
24
|
+
/** Android only — which `LiquidGlassProvider` supplies the backdrop. */
|
|
25
|
+
providerId?: string;
|
|
26
|
+
/** Rendered before the input inside the capsule — an icon, a prefix. */
|
|
27
|
+
leading?: ReactNode;
|
|
28
|
+
/** Rendered after the input inside the capsule — a clear button, a unit. */
|
|
29
|
+
trailing?: ReactNode;
|
|
30
|
+
/** Accent ring that springs in on focus. Defaults to `true`. */
|
|
31
|
+
focusRing?: boolean;
|
|
32
|
+
/** Ring color. Defaults to the scheme's system blue. */
|
|
33
|
+
accentColor?: ColorValue;
|
|
34
|
+
/** The outer glass frame. Give the field a width or `flex` when inside a row. */
|
|
35
|
+
style?: StyleProp<ViewStyle>;
|
|
36
|
+
/** The inner row (padding, gap). */
|
|
37
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
38
|
+
/** The `TextInput` itself. */
|
|
39
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { ILiquidGlassTextInputProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import type { GlassMetalOptions, LiquidGlassViewProps } from "../core";
|
|
5
|
+
import type { ILiquidGlassButtonIconState } from "./liquid-glass-button.interface";
|
|
6
|
+
|
|
7
|
+
interface ILiquidGlassToastProps {
|
|
8
|
+
/** Shown while `true`; springs out when it turns `false`. */
|
|
9
|
+
visible: boolean;
|
|
10
|
+
/** The text. */
|
|
11
|
+
message: string;
|
|
12
|
+
/** Rendered before the message; a function receives the label colour and a glyph size. */
|
|
13
|
+
icon?: ReactNode | ((state: ILiquidGlassButtonIconState) => ReactNode);
|
|
14
|
+
/**
|
|
15
|
+
* Called when the toast wants to go — after `duration`, or on a tap. The app flips `visible`;
|
|
16
|
+
* the toast never hides itself.
|
|
17
|
+
*/
|
|
18
|
+
onDismiss?: () => void;
|
|
19
|
+
/** Auto-dismiss after this many ms of being visible. `0` keeps it up. Defaults to 2600. */
|
|
20
|
+
duration?: number;
|
|
21
|
+
/** Which screen edge it slides in from. Defaults to `"top"`. */
|
|
22
|
+
edge?: "top" | "bottom";
|
|
23
|
+
/** Distance from that edge, dp. Defaults to 60. */
|
|
24
|
+
offset?: number;
|
|
25
|
+
/** Surface wash. Defaults to the scheme's bar surface. */
|
|
26
|
+
tint?: ColorValue;
|
|
27
|
+
variant?: LiquidGlassViewProps["variant"];
|
|
28
|
+
/** The toast's glass. Defaults to the kit's button recipe. */
|
|
29
|
+
metal?: GlassMetalOptions;
|
|
30
|
+
/** Android only — which `LiquidGlassProvider` supplies the backdrop. */
|
|
31
|
+
providerId?: string | string[];
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
textStyle?: StyleProp<TextStyle>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { ILiquidGlassToastProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import type { GlassMetalOptions, LiquidGlassViewProps } from "../core";
|
|
5
|
+
|
|
6
|
+
interface ILiquidGlassToolbarProps {
|
|
7
|
+
/**
|
|
8
|
+
* The title. A string is set in a glass capsule of its own between the two ends; a node is
|
|
9
|
+
* rendered as given.
|
|
10
|
+
*/
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** Controls at the leading end — a back button, a menu. They merge when pressed. */
|
|
13
|
+
leading?: ReactNode;
|
|
14
|
+
/** Controls at the trailing end — actions. They merge when pressed. */
|
|
15
|
+
trailing?: ReactNode;
|
|
16
|
+
/** The merge distance for each end's group, dp. Defaults to 28. */
|
|
17
|
+
spacing?: number;
|
|
18
|
+
/** Gap between controls at either end, dp. Defaults to 12. */
|
|
19
|
+
gap?: number;
|
|
20
|
+
/** Bar height, dp. Defaults to 48. */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** The title capsule's wash. Defaults to the scheme's bar surface. */
|
|
23
|
+
tint?: ColorValue;
|
|
24
|
+
variant?: LiquidGlassViewProps["variant"];
|
|
25
|
+
/** The title capsule's glass. Defaults to the kit's button recipe. */
|
|
26
|
+
metal?: GlassMetalOptions;
|
|
27
|
+
/** Android only — which `LiquidGlassProvider` supplies the backdrop. */
|
|
28
|
+
providerId?: string | string[];
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type { ILiquidGlassToolbarProps };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useColorScheme } from "react-native";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The iOS system palette the reference components use, one set per scheme. Values are plain
|
|
5
|
+
* strings (not `PlatformColor`) because several of them feed `Animated` color interpolation,
|
|
6
|
+
* which only understands parseable color strings.
|
|
7
|
+
*/
|
|
8
|
+
interface IGlassUIPalette {
|
|
9
|
+
/** System blue — tab bar selection. */
|
|
10
|
+
accent: string;
|
|
11
|
+
/** System green — switch on-state. */
|
|
12
|
+
green: string;
|
|
13
|
+
label: string;
|
|
14
|
+
/** Unselected tab items, secondary content. */
|
|
15
|
+
inactive: string;
|
|
16
|
+
placeholder: string;
|
|
17
|
+
/** Switch track in the off position. */
|
|
18
|
+
switchTrack: string;
|
|
19
|
+
/** Wash drawn over the tab bar's glass. */
|
|
20
|
+
tabBarSurface: string;
|
|
21
|
+
/**
|
|
22
|
+
* The same wash for `variant="clear"` — a hint rather than a scrim, so the glass carries
|
|
23
|
+
* legibility instead of the fill. Roughly a quarter of [tabBarSurface]'s alpha.
|
|
24
|
+
*/
|
|
25
|
+
tabBarSurfaceClear: string;
|
|
26
|
+
/**
|
|
27
|
+
* The resting tab indicator's wash, and the only thing separating it from the bar — the pill
|
|
28
|
+
* carries no lens of its own to give it an edge.
|
|
29
|
+
*
|
|
30
|
+
* Painted into the accent layer *beneath* the accent icons, not over the pill's glass. The pill
|
|
31
|
+
* is a window onto that layer, so a film on top of the lens washes the very glyph the lens is
|
|
32
|
+
* displaying: at 20% white it turned `#0088FF` into `#38A0FD`. Recorded underneath, it lifts the
|
|
33
|
+
* strip and leaves the glyph at `#0088FF`. (A pill recipe's `metal.tint` takes the same route —
|
|
34
|
+
* see the tab bar.)
|
|
35
|
+
*
|
|
36
|
+
* **A chip, not a hint.** The first round ran this at 0.20 / 0.10, which on the phone read as a
|
|
37
|
+
* faint lift of the bar's frost rather than a selection — the capsule resolved to whatever the
|
|
38
|
+
* page under it happened to be, and mine-app's iOS build had to paint its own 0.92 ground to
|
|
39
|
+
* hold contrast. The user's call on 2026-09-07 is a resting pill that is *almost always a light
|
|
40
|
+
* white pill*: opaque enough to be a surface in either scheme, still translucent enough that
|
|
41
|
+
* the frost shows through and the grab, which fades it out, reads as the chip going clear.
|
|
42
|
+
*
|
|
43
|
+
* **Lightens in both schemes**, which is a deliberate departure from the reference: Kyant sinks
|
|
44
|
+
* the light-theme pill with `Color.Black.copy(0.1f)` and lifts the dark-theme one with
|
|
45
|
+
* `Color.White.copy(0.1f)`. Measured on device, sinking it reads as a hole punched through the
|
|
46
|
+
* bar's shade rather than as a selected chip — the pill already shows a slightly cooler, darker
|
|
47
|
+
* image than the bar beside it (it is a 56dp strip against a 64dp one), so a darkening wash
|
|
48
|
+
* compounds a gap instead of creating one. Lifting both makes the selection read the same way
|
|
49
|
+
* in either scheme: raised.
|
|
50
|
+
*
|
|
51
|
+
* Pass `pillTint` (or a `pillMetal` with a `tint`) to override per app.
|
|
52
|
+
*/
|
|
53
|
+
tabIndicatorSurface: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const GLASS_UI_PALETTE: Record<"light" | "dark", IGlassUIPalette> = {
|
|
57
|
+
light: {
|
|
58
|
+
accent: "#0088FF",
|
|
59
|
+
green: "#34C759",
|
|
60
|
+
label: "#000000",
|
|
61
|
+
inactive: "rgba(60,60,67,0.6)",
|
|
62
|
+
placeholder: "rgba(60,60,67,0.6)",
|
|
63
|
+
switchTrack: "rgba(120,120,120,0.2)",
|
|
64
|
+
// Tuned on device: the light pair needs a hair more of both washes than the dark one to
|
|
65
|
+
// hold the same separation.
|
|
66
|
+
tabBarSurface: "rgba(250,250,250,0.42)",
|
|
67
|
+
tabBarSurfaceClear: "rgba(250,250,250,0.10)",
|
|
68
|
+
tabIndicatorSurface: "rgba(255,255,255,0.55)",
|
|
69
|
+
},
|
|
70
|
+
dark: {
|
|
71
|
+
accent: "#0091FF",
|
|
72
|
+
green: "#30D158",
|
|
73
|
+
label: "#FFFFFF",
|
|
74
|
+
inactive: "rgba(235,235,245,0.6)",
|
|
75
|
+
placeholder: "rgba(235,235,245,0.6)",
|
|
76
|
+
switchTrack: "rgba(120,120,128,0.36)",
|
|
77
|
+
tabBarSurface: "rgba(18,18,18,0.4)",
|
|
78
|
+
tabBarSurfaceClear: "rgba(18,18,18,0.12)",
|
|
79
|
+
tabIndicatorSurface: "rgba(255,255,255,0.30)",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
interface IGlassUITheme {
|
|
84
|
+
scheme: "light" | "dark";
|
|
85
|
+
colors: IGlassUIPalette;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The palette for the OS colour scheme — or, given `override`, for a scheme the caller chose.
|
|
90
|
+
* Adaptive glass passes the polarity the backdrop settled on: dark content wants the dark
|
|
91
|
+
* palette's light label over its dark frost, whatever the OS setting says.
|
|
92
|
+
*/
|
|
93
|
+
function useGlassUITheme(override?: "light" | "dark"): IGlassUITheme {
|
|
94
|
+
const system = useColorScheme() === "dark" ? "dark" : "light";
|
|
95
|
+
const scheme = override ?? system;
|
|
96
|
+
return { scheme, colors: GLASS_UI_PALETTE[scheme] };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { GLASS_UI_PALETTE, useGlassUITheme };
|
|
100
|
+
export type { IGlassUIPalette, IGlassUITheme };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BUTTON_FOLLOW_DERIVATIVE } from "../constants";
|
|
2
|
+
|
|
3
|
+
interface IButtonPressTransform {
|
|
4
|
+
translateX: number;
|
|
5
|
+
translateY: number;
|
|
6
|
+
scaleX: number;
|
|
7
|
+
scaleY: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The reference's `InteractiveHighlight` geometry as one worklet: the grow-on-press, the
|
|
12
|
+
* rubber-band follow toward the finger and the stretch along the drag axis, for a control of
|
|
13
|
+
* `width` x `height` at press `progress` with the finger `offsetX`/`offsetY` from where it
|
|
14
|
+
* landed.
|
|
15
|
+
*
|
|
16
|
+
* Shared between the button — which applies it as a `transform` — and `LiquidGlassGroup`'s
|
|
17
|
+
* canvas, which needs the *same* inflated, carried rect to draw the merged silhouette from. The
|
|
18
|
+
* two must agree to the pixel or the canvas pane and the button's own pane would part company
|
|
19
|
+
* during the crossfade.
|
|
20
|
+
*
|
|
21
|
+
* - Follow: slope `BUTTON_FOLLOW_DERIVATIVE` near zero, saturating at one min-dimension of
|
|
22
|
+
* travel through a tanh.
|
|
23
|
+
* - Stretch: on a wide control X takes full weight and Y is attenuated by `h/w`, so the pane
|
|
24
|
+
* spreads along the drag axis instead of ballooning.
|
|
25
|
+
*/
|
|
26
|
+
const buttonPressTransform = (
|
|
27
|
+
width: number,
|
|
28
|
+
height: number,
|
|
29
|
+
growth: number,
|
|
30
|
+
progress: number,
|
|
31
|
+
offsetX: number,
|
|
32
|
+
offsetY: number
|
|
33
|
+
): IButtonPressTransform => {
|
|
34
|
+
"worklet";
|
|
35
|
+
const w = Math.max(width, 1);
|
|
36
|
+
const h = Math.max(height, 1);
|
|
37
|
+
const minDim = Math.min(w, h);
|
|
38
|
+
const maxDim = Math.max(w, h);
|
|
39
|
+
const scale = 1 + (growth / h) * progress;
|
|
40
|
+
|
|
41
|
+
const translateX =
|
|
42
|
+
minDim * Math.tanh((BUTTON_FOLLOW_DERIVATIVE * offsetX) / minDim);
|
|
43
|
+
const translateY =
|
|
44
|
+
minDim * Math.tanh((BUTTON_FOLLOW_DERIVATIVE * offsetY) / minDim);
|
|
45
|
+
|
|
46
|
+
const angle = Math.atan2(offsetY, offsetX);
|
|
47
|
+
const maxDragScale = growth / h;
|
|
48
|
+
const scaleX =
|
|
49
|
+
scale +
|
|
50
|
+
maxDragScale *
|
|
51
|
+
Math.abs((Math.cos(angle) * offsetX) / maxDim) *
|
|
52
|
+
Math.min(w / h, 1);
|
|
53
|
+
const scaleY =
|
|
54
|
+
scale +
|
|
55
|
+
maxDragScale *
|
|
56
|
+
Math.abs((Math.sin(angle) * offsetY) / maxDim) *
|
|
57
|
+
Math.min(h / w, 1);
|
|
58
|
+
|
|
59
|
+
return { translateX, translateY, scaleX, scaleY };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { buttonPressTransform };
|
|
63
|
+
export type { IButtonPressTransform };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { ColorValue } from "react-native";
|
|
2
|
+
import { interpolateColor, processColor } from "react-native-reanimated";
|
|
3
|
+
|
|
4
|
+
import type { GlassMetalOptions } from "../core";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Blending between two glass recipes, on the UI thread.
|
|
8
|
+
*
|
|
9
|
+
* The reference animates its material directly — `lens(24dp * progress, 24dp * progress)`,
|
|
10
|
+
* `Highlight.Default.copy(alpha = progress)` — recomposing the effect chain on every frame of a
|
|
11
|
+
* press. Nothing in a React prop can follow that: a `useState` swap is one JS render behind the
|
|
12
|
+
* gesture, and it lands at whatever moment the JS thread gets to it.
|
|
13
|
+
*
|
|
14
|
+
* {@link lerpMetal} is a worklet, so `useAnimatedProps` can rebuild the recipe from a shared value
|
|
15
|
+
* each frame and hand it to the native view without JS ever waking up. The native side re-uploads
|
|
16
|
+
* uniforms and redraws; it does not rebuild geometry, re-record the backdrop or resize the padded
|
|
17
|
+
* render node, so this is genuinely cheap to run at display rate.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* One field.
|
|
22
|
+
*
|
|
23
|
+
* Absent on both sides means "never mentioned" — it stays absent so the native default applies,
|
|
24
|
+
* rather than being invented as 0 (which would be a real value for `saturation` and `opacity`, and
|
|
25
|
+
* the wrong one). Absent on one side means "constant across the blend", which is what lets a recipe
|
|
26
|
+
* name only the fields it actually animates.
|
|
27
|
+
*/
|
|
28
|
+
const blend = (
|
|
29
|
+
from: number | undefined,
|
|
30
|
+
to: number | undefined,
|
|
31
|
+
t: number
|
|
32
|
+
): number | undefined => {
|
|
33
|
+
"worklet";
|
|
34
|
+
if (from == null && to == null) return undefined;
|
|
35
|
+
const a = from ?? (to as number);
|
|
36
|
+
const b = to ?? (from as number);
|
|
37
|
+
return a + (b - a) * t;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** A colour as the platform's ARGB number: a string through Reanimated's `processColor`, a
|
|
41
|
+
* number taken as already processed (which is what the wrapper and this blend produce). */
|
|
42
|
+
const argbOf = (color: string | number): number | null => {
|
|
43
|
+
"worklet";
|
|
44
|
+
if (typeof color === "number") return color >>> 0;
|
|
45
|
+
const n = processColor(color);
|
|
46
|
+
return n == null ? null : n >>> 0;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** `rgba()` text for an ARGB number, optionally at another alpha. */
|
|
50
|
+
const rgbaOf = (argb: number, alpha?: number): string => {
|
|
51
|
+
"worklet";
|
|
52
|
+
const a = ((argb >>> 24) & 0xff) / 255;
|
|
53
|
+
const r = (argb >>> 16) & 0xff;
|
|
54
|
+
const g = (argb >>> 8) & 0xff;
|
|
55
|
+
const b = argb & 0xff;
|
|
56
|
+
return `rgba(${r},${g},${b},${alpha ?? a})`;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The wash. Unlike the numeric fields, a side without a tint is not "constant": it is *no wash*,
|
|
61
|
+
* so the blend runs from the other colour at alpha 0 — a pill with no tint at rest and blue in
|
|
62
|
+
* `pillDraggedMetal` fades blue in as it lifts, and fades it out again on release.
|
|
63
|
+
*
|
|
64
|
+
* `interpolateColor` is fed `rgba()` strings, never numbers: Reanimated treats a numeric input
|
|
65
|
+
* as unprocessed RGBA and rotates it, which is how a blue came out magenta. Inside a worklet
|
|
66
|
+
* the result is already the platform's ARGB number; on the JS thread — the initial props — it
|
|
67
|
+
* is an `rgba()` string, converted once here.
|
|
68
|
+
*/
|
|
69
|
+
const blendTint = (
|
|
70
|
+
from: ColorValue | undefined,
|
|
71
|
+
to: ColorValue | undefined,
|
|
72
|
+
t: number
|
|
73
|
+
): ColorValue | undefined => {
|
|
74
|
+
"worklet";
|
|
75
|
+
const fa = from != null ? argbOf(from as string | number) : null;
|
|
76
|
+
const ta = to != null ? argbOf(to as string | number) : null;
|
|
77
|
+
if (fa == null && ta == null) return undefined;
|
|
78
|
+
const fromText = fa != null ? rgbaOf(fa) : rgbaOf(ta as number, 0);
|
|
79
|
+
const toText = ta != null ? rgbaOf(ta) : rgbaOf(fa as number, 0);
|
|
80
|
+
const mixed = interpolateColor(
|
|
81
|
+
Math.min(1, Math.max(0, t)),
|
|
82
|
+
[0, 1],
|
|
83
|
+
[fromText, toText]
|
|
84
|
+
);
|
|
85
|
+
const out = typeof mixed === "number" ? mixed : processColor(mixed as string);
|
|
86
|
+
return out as unknown as ColorValue;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* `from` at `t = 0`, `to` at `t = 1`, linear in between. Every numeric field is blended; the
|
|
91
|
+
* non-numeric ones (`android.quality`, `android.maxTier`) are taken from `to`, because a quality
|
|
92
|
+
* tier has no midpoint and swapping it mid-gesture would recompile the shader.
|
|
93
|
+
*
|
|
94
|
+
* `t` is not clamped — an overshooting spring is allowed to overshoot the material with it, which
|
|
95
|
+
* is the whole point of driving this from a spring rather than a timing curve.
|
|
96
|
+
*/
|
|
97
|
+
const lerpMetal = (
|
|
98
|
+
from: GlassMetalOptions,
|
|
99
|
+
to: GlassMetalOptions,
|
|
100
|
+
t: number
|
|
101
|
+
): GlassMetalOptions => {
|
|
102
|
+
"worklet";
|
|
103
|
+
return {
|
|
104
|
+
tint: blendTint(from.tint, to.tint, t),
|
|
105
|
+
blurRadius: blend(from.blurRadius, to.blurRadius, t),
|
|
106
|
+
opacity: blend(from.opacity, to.opacity, t),
|
|
107
|
+
frost: blend(from.frost, to.frost, t),
|
|
108
|
+
saturation: blend(from.saturation, to.saturation, t),
|
|
109
|
+
noise: blend(from.noise, to.noise, t),
|
|
110
|
+
light: blend(from.light, to.light, t),
|
|
111
|
+
magnification: blend(from.magnification, to.magnification, t),
|
|
112
|
+
refraction: {
|
|
113
|
+
amount: blend(from.refraction?.amount, to.refraction?.amount, t),
|
|
114
|
+
width: blend(from.refraction?.width, to.refraction?.width, t),
|
|
115
|
+
height: blend(from.refraction?.height, to.refraction?.height, t),
|
|
116
|
+
depth: blend(from.refraction?.depth, to.refraction?.depth, t),
|
|
117
|
+
swirl: blend(from.refraction?.swirl, to.refraction?.swirl, t),
|
|
118
|
+
// `curve` is all-or-nothing on the native side: supplying the object at all replaces the
|
|
119
|
+
// variant's whole profile with the Record's defaults for anything left out. So a blend
|
|
120
|
+
// between two recipes that never mentioned a curve must not invent one.
|
|
121
|
+
curve:
|
|
122
|
+
from.refraction?.curve == null && to.refraction?.curve == null
|
|
123
|
+
? undefined
|
|
124
|
+
: {
|
|
125
|
+
power: blend(
|
|
126
|
+
from.refraction?.curve?.power,
|
|
127
|
+
to.refraction?.curve?.power,
|
|
128
|
+
t
|
|
129
|
+
),
|
|
130
|
+
bias: blend(
|
|
131
|
+
from.refraction?.curve?.bias,
|
|
132
|
+
to.refraction?.curve?.bias,
|
|
133
|
+
t
|
|
134
|
+
),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
dispersion: {
|
|
138
|
+
amount: blend(from.dispersion?.amount, to.dispersion?.amount, t),
|
|
139
|
+
reach: blend(from.dispersion?.reach, to.dispersion?.reach, t),
|
|
140
|
+
quadrant: blend(from.dispersion?.quadrant, to.dispersion?.quadrant, t),
|
|
141
|
+
},
|
|
142
|
+
highlight: {
|
|
143
|
+
intensity: blend(from.highlight?.intensity, to.highlight?.intensity, t),
|
|
144
|
+
angle: blend(from.highlight?.angle, to.highlight?.angle, t),
|
|
145
|
+
width: blend(from.highlight?.width, to.highlight?.width, t),
|
|
146
|
+
falloff: blend(from.highlight?.falloff, to.highlight?.falloff, t),
|
|
147
|
+
},
|
|
148
|
+
border: {
|
|
149
|
+
width: blend(from.border?.width, to.border?.width, t),
|
|
150
|
+
opacity: blend(from.border?.opacity, to.border?.opacity, t),
|
|
151
|
+
},
|
|
152
|
+
// Radius and opacity both ramp, so a recipe that names `{ radius: 0, opacity: 0 }` at rest
|
|
153
|
+
// and Kyant's `{ radius: 8, opacity: 0.15 }` held fades the band in rather than popping it.
|
|
154
|
+
innerShadow: {
|
|
155
|
+
radius: blend(from.innerShadow?.radius, to.innerShadow?.radius, t),
|
|
156
|
+
offsetX: blend(from.innerShadow?.offsetX, to.innerShadow?.offsetX, t),
|
|
157
|
+
offsetY: blend(from.innerShadow?.offsetY, to.innerShadow?.offsetY, t),
|
|
158
|
+
opacity: blend(from.innerShadow?.opacity, to.innerShadow?.opacity, t),
|
|
159
|
+
},
|
|
160
|
+
android: to.android,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export { lerpMetal };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { defaultRouter } from "./internal/glass-routing";
|
|
5
|
+
import { primitives } from "./internal/primitives";
|
|
6
|
+
|
|
7
|
+
export interface GlassProviderProps {
|
|
8
|
+
/**
|
|
9
|
+
* The content whose backdrop the glass behind it samples. On Android this is
|
|
10
|
+
* the single direct child of the provider — the one content child — and glass
|
|
11
|
+
* views are its siblings, never its children.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Layout style of the recording container, if any. */
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
/**
|
|
17
|
+
* Pairs this provider with the glass views that read its backdrop. Defaults to
|
|
18
|
+
* the engine's `"default"`.
|
|
19
|
+
*/
|
|
20
|
+
providerId?: string;
|
|
21
|
+
isDark?: boolean;
|
|
22
|
+
/** Passed through to the underlying container so tests can find it. */
|
|
23
|
+
testID?: string;
|
|
24
|
+
[prop: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Marks the content that should show through the glass.
|
|
29
|
+
*
|
|
30
|
+
* The engine's provider records the backdrop for the glass views that read it.
|
|
31
|
+
* On Android it is the backdrop source itself — content sits inside it as its
|
|
32
|
+
* one direct child and glass views are its siblings, never inside it, so a glass
|
|
33
|
+
* can never end up refracting its own output. On iOS and on platforms without a
|
|
34
|
+
* glass renderer it renders a plain view, so it is safe to wrap unconditionally.
|
|
35
|
+
*
|
|
36
|
+
* On iOS the default is whole-window capture; the scoped `GlassBackdrop` provider
|
|
37
|
+
* arrives with the strip-cache work (§6 of the rebuild brief).
|
|
38
|
+
*/
|
|
39
|
+
export const GlassProvider = forwardRef<any, GlassProviderProps>(function GlassProvider(
|
|
40
|
+
{ children, style, providerId, isDark, testID, ...props },
|
|
41
|
+
ref,
|
|
42
|
+
) {
|
|
43
|
+
const decision = defaultRouter();
|
|
44
|
+
|
|
45
|
+
if (decision.supported && decision.LiquidGlassProvider) {
|
|
46
|
+
const LiquidGlassProvider = decision.LiquidGlassProvider;
|
|
47
|
+
return (
|
|
48
|
+
<LiquidGlassProvider ref={ref} providerId={providerId} style={style} {...props}>
|
|
49
|
+
{children}
|
|
50
|
+
</LiquidGlassProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { View } = primitives();
|
|
55
|
+
return (
|
|
56
|
+
<View ref={ref} testID={testID} style={style} {...props}>
|
|
57
|
+
{children}
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
60
|
+
});
|