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,115 @@
|
|
|
1
|
+
import { Children, forwardRef, isValidElement } from "react";
|
|
2
|
+
import type { ComponentType, ReactNode } from "react";
|
|
3
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
4
|
+
|
|
5
|
+
import { defaultRouter } from "./internal/glass-routing";
|
|
6
|
+
import { primitives } from "./internal/primitives";
|
|
7
|
+
|
|
8
|
+
export interface GlassStackLayerProps {
|
|
9
|
+
/** The layer's content. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** The layer's own layout. Layers all share the stack's box; this insets or pads inside it. */
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
/** Passed through so a layer is findable in tests and on-device inspectors. */
|
|
14
|
+
testID?: string;
|
|
15
|
+
[prop: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A marker, not a wrapper. `GlassStack` reads the layer props off these elements
|
|
20
|
+
* and builds the real (provider-nested) tree itself, so a bare `Layer` renders
|
|
21
|
+
* its content in a plain view.
|
|
22
|
+
*/
|
|
23
|
+
const GlassStackLayer = ({ children, style, ...props }: GlassStackLayerProps) => {
|
|
24
|
+
const { View } = primitives();
|
|
25
|
+
return (
|
|
26
|
+
<View pointerEvents="box-none" style={style} {...props}>
|
|
27
|
+
{children}
|
|
28
|
+
</View>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
GlassStackLayer.displayName = "GlassStack.Layer";
|
|
32
|
+
|
|
33
|
+
export interface GlassStackProps {
|
|
34
|
+
/** The layers, bottom to top. Bare children are treated as layers of their own. */
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* The stack's box. Layers are absolute, so the stack must own a size — pass
|
|
38
|
+
* `flex: 1` or a fixed height. Defaults to `flex: 1`.
|
|
39
|
+
*/
|
|
40
|
+
style?: StyleProp<ViewStyle>;
|
|
41
|
+
/** Passed to the underlying stack so tests can find it. */
|
|
42
|
+
testID?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Declarative stacked glass — glass that refracts other glass.
|
|
47
|
+
*
|
|
48
|
+
* Layers go bottom to top. Glass inside layer *k* automatically reads a backdrop
|
|
49
|
+
* containing everything below it, including lower layers' finished glass, so a
|
|
50
|
+
* sheet over a glass pill shows the pill's frost re-refracted through its own
|
|
51
|
+
* lens. Layers are direct children of the stack; mount and unmount *content
|
|
52
|
+
* inside* a layer rather than the layer list itself.
|
|
53
|
+
*
|
|
54
|
+
* Every layer occupies the stack's box once, at an explicit z-order — the fix
|
|
55
|
+
* for the smeared, overlapping layers in the lab demo (§7.2). Below every glass
|
|
56
|
+
* tier the layers still render, as plain views, so a stack is never blank.
|
|
57
|
+
*/
|
|
58
|
+
const GlassStackBase = forwardRef<any, GlassStackProps>(function GlassStack(
|
|
59
|
+
{ children, style, testID }: GlassStackProps,
|
|
60
|
+
ref: any,
|
|
61
|
+
) {
|
|
62
|
+
const decision = defaultRouter();
|
|
63
|
+
const Stack = decision.LiquidGlassStack;
|
|
64
|
+
|
|
65
|
+
const all = Children.toArray(children);
|
|
66
|
+
const layers = all.map((child) =>
|
|
67
|
+
isValidElement(child) && child.type === GlassStackLayer
|
|
68
|
+
? (child.props as GlassStackLayerProps)
|
|
69
|
+
: ({ children: child } as GlassStackLayerProps),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// Without a stack there is nothing to build; render the layers as plain
|
|
73
|
+
// views in order, so the content is visible rather than dropped.
|
|
74
|
+
if (!Stack) {
|
|
75
|
+
const { View } = primitives();
|
|
76
|
+
return (
|
|
77
|
+
<View ref={ref} testID={testID} style={style}>
|
|
78
|
+
{layers.map((layer, index) => (
|
|
79
|
+
<View key={index} pointerEvents="box-none" style={layer.style}>
|
|
80
|
+
{layer.children}
|
|
81
|
+
</View>
|
|
82
|
+
))}
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The engine's stack reads its layers off elements typed as its own Layer
|
|
88
|
+
// component. Glacia's markers are translated into those, and bare children are
|
|
89
|
+
// wrapped here too, so the engine never sees a child it would drop.
|
|
90
|
+
const EngineLayer = (Stack as any).Layer as ComponentType<any> | undefined;
|
|
91
|
+
const engineLayers = EngineLayer
|
|
92
|
+
? layers.map((layer, index) => (
|
|
93
|
+
<EngineLayer key={index} style={layer.style}>
|
|
94
|
+
{layer.children}
|
|
95
|
+
</EngineLayer>
|
|
96
|
+
))
|
|
97
|
+
: (layers.map((layer) => layer.children) as ReactNode[]);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Stack ref={ref} style={style} testID={testID}>
|
|
101
|
+
{engineLayers}
|
|
102
|
+
</Stack>
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The stacked-glass primitive. Renders the engine's stack, which builds the
|
|
108
|
+
* nested provider topology for its layers; below every glass tier it renders
|
|
109
|
+
* the plain layer views.
|
|
110
|
+
*/
|
|
111
|
+
export const GlassStack = Object.assign(GlassStackBase, {
|
|
112
|
+
Layer: GlassStackLayer,
|
|
113
|
+
}) as typeof GlassStackBase & { Layer: typeof GlassStackLayer };
|
|
114
|
+
|
|
115
|
+
GlassStack.displayName = "GlassStack";
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
export { Glass, type GlassProps } from "./Glass";
|
|
1
|
+
export { Glass, GlassView, type GlassProps, type GlassViewProps } from "./Glass";
|
|
2
|
+
export { isGlassSupported } from "./internal/GlassView";
|
|
3
|
+
export {
|
|
4
|
+
supportsGlass,
|
|
5
|
+
supportsNativeGlass,
|
|
6
|
+
readCapabilities,
|
|
7
|
+
loadEngineControl,
|
|
8
|
+
ENGINE_CONTROL_NAMES,
|
|
9
|
+
type GlassCapabilities,
|
|
10
|
+
} from "./internal/glass-routing";
|
|
2
11
|
export type { SurfaceProfile } from "./internal/material";
|
|
12
|
+
export { GlassContainer, type NativeGlassContainerProps } from "./internal/GlassContainer";
|
|
13
|
+
export { GlassProvider, type GlassProviderProps } from "./glass-provider";
|
|
14
|
+
export { GlassBackdrop, type GlassBackdropProps } from "./internal/GlassBackdrop";
|
|
15
|
+
export { GlassStack, type GlassStackProps } from "./glass-stack";
|
|
3
16
|
export { Button, type ButtonProps } from "./Button";
|
|
4
17
|
export { Switch, type SwitchProps } from "./Switch";
|
|
5
18
|
export { Slider, type SliderProps } from "./Slider";
|
|
@@ -20,206 +33,50 @@ export {
|
|
|
20
33
|
type CardProps,
|
|
21
34
|
} from "./Card";
|
|
22
35
|
// Forms.
|
|
23
|
-
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "./
|
|
29
|
-
export {
|
|
30
|
-
Label,
|
|
31
|
-
Field,
|
|
32
|
-
Checkbox,
|
|
33
|
-
RadioGroup,
|
|
34
|
-
Select,
|
|
35
|
-
type LabelProps,
|
|
36
|
-
type FieldProps,
|
|
37
|
-
type CheckboxProps,
|
|
38
|
-
type RadioOption,
|
|
39
|
-
type RadioGroupProps,
|
|
40
|
-
type SelectOption,
|
|
41
|
-
type SelectProps,
|
|
42
|
-
} from "./Form";
|
|
36
|
+
export { Input, type InputProps } from "./Input";
|
|
37
|
+
export { Textarea, type TextareaProps } from "./Textarea";
|
|
38
|
+
export { Label, type LabelProps } from "./Label";
|
|
39
|
+
export { Field, type FieldProps } from "./Field";
|
|
40
|
+
export { Checkbox, type CheckboxProps } from "./Checkbox";
|
|
41
|
+
export { RadioGroup, type RadioOption, type RadioGroupProps } from "./RadioGroup";
|
|
42
|
+
export { Select, type SelectOption, type SelectProps } from "./Select";
|
|
43
43
|
// Overlays.
|
|
44
|
-
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from "./Dialog";
|
|
54
|
-
// AI conversation primitives.
|
|
55
|
-
export {
|
|
56
|
-
NativePlan,
|
|
57
|
-
NativeSources,
|
|
58
|
-
NativeResponse,
|
|
59
|
-
NativeTask,
|
|
60
|
-
NativeSoundwave,
|
|
61
|
-
NativeThinkingOrb,
|
|
62
|
-
NativePanelside,
|
|
63
|
-
NativeAIInput,
|
|
64
|
-
NativeImageGeneration,
|
|
65
|
-
type NativePlanProps,
|
|
66
|
-
type NativePlanStep,
|
|
67
|
-
type NativeSourcesProps,
|
|
68
|
-
type NativeSource,
|
|
69
|
-
type NativeResponseProps,
|
|
70
|
-
type NativeTaskProps,
|
|
71
|
-
type NativeSoundwaveProps,
|
|
72
|
-
type NativeThinkingOrbProps,
|
|
73
|
-
type NativePanelsideProps,
|
|
74
|
-
type NativePanelNavItem,
|
|
75
|
-
type NativeAIInputProps,
|
|
76
|
-
type NativeImageGenerationProps,
|
|
77
|
-
type NativeGeneratedImage,
|
|
78
|
-
} from "./ai";
|
|
79
|
-
// Data display.
|
|
80
|
-
export {
|
|
81
|
-
NativeTable,
|
|
82
|
-
NativeScrollArea,
|
|
83
|
-
type NativeTableProps,
|
|
84
|
-
type NativeTableColumn,
|
|
85
|
-
type NativeTableRow,
|
|
86
|
-
type NativeScrollAreaProps,
|
|
87
|
-
} from "./Table";
|
|
88
|
-
// Charts, drawn with react-native-svg using the same maths as the web package.
|
|
89
|
-
export * from "./charts";
|
|
44
|
+
export { Dialog, DialogTrigger, type DialogProps, type DialogTriggerProps } from "./Dialog";
|
|
45
|
+
export { AlertDialog, type AlertDialogProps } from "./AlertDialog";
|
|
46
|
+
export { Alert, type AlertProps, type AlertTone } from "./Alert";
|
|
47
|
+
export { ActionSheet, type ActionSheetProps, type ActionSheetOption } from "./ActionSheet";
|
|
48
|
+
export { Collapsible, type CollapsibleProps } from "./Collapsible";
|
|
49
|
+
export { ContextMenu, type ContextMenuProps, type ContextMenuItem } from "./ContextMenu";
|
|
50
|
+
export { DropdownMenu, type DropdownMenuProps, type DropdownMenuItem } from "./DropdownMenu";
|
|
51
|
+
export { Popover, type PopoverProps } from "./Popover";
|
|
52
|
+
export { Tooltip, type TooltipProps } from "./Tooltip";
|
|
90
53
|
// Basics.
|
|
91
54
|
export { Text, type TextProps, type TextVariant } from "./Text";
|
|
92
|
-
export {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
initialsOf,
|
|
100
|
-
type AvatarProps,
|
|
101
|
-
type AvatarSize,
|
|
102
|
-
type BadgeProps,
|
|
103
|
-
type SeparatorProps,
|
|
104
|
-
type SkeletonProps,
|
|
105
|
-
type SpinnerProps,
|
|
106
|
-
type SpinnerSize,
|
|
107
|
-
type ProgressProps,
|
|
108
|
-
type ProgressVariant,
|
|
109
|
-
Rating,
|
|
110
|
-
type RatingProps,
|
|
111
|
-
NativeImage,
|
|
112
|
-
type NativeImageProps,
|
|
113
|
-
} from "./Display";
|
|
114
|
-
// Feedback and display.
|
|
115
|
-
export {
|
|
116
|
-
Toast,
|
|
117
|
-
Banner,
|
|
118
|
-
List,
|
|
119
|
-
ListItem,
|
|
120
|
-
ListSection,
|
|
121
|
-
Accordion,
|
|
122
|
-
ToastViewport,
|
|
123
|
-
type ToastProps,
|
|
124
|
-
type ToastAction,
|
|
125
|
-
type ToastItem,
|
|
126
|
-
type ToastViewportProps,
|
|
127
|
-
type BannerProps,
|
|
128
|
-
type ListProps,
|
|
129
|
-
type ListItemProps,
|
|
130
|
-
type ListSwipeAction,
|
|
131
|
-
type ListSectionProps,
|
|
132
|
-
type AccordionProps,
|
|
133
|
-
type AccordionSection,
|
|
134
|
-
} from "./Feedback";
|
|
55
|
+
export { Avatar, initialsOf, type AvatarProps, type AvatarSize } from "./Avatar";
|
|
56
|
+
export { Badge, type BadgeProps } from "./Badge";
|
|
57
|
+
export { Separator, type SeparatorProps } from "./Separator";
|
|
58
|
+
export { Skeleton, type SkeletonProps } from "./Skeleton";
|
|
59
|
+
export { Progress, type ProgressProps, type ProgressVariant } from "./Progress";
|
|
60
|
+
export { Toast, type ToastProps } from "./Toast";
|
|
61
|
+
export { Accordion, type AccordionProps, type AccordionSection } from "./Accordion";
|
|
135
62
|
// Bars, buttons and navigation.
|
|
136
63
|
export {
|
|
137
|
-
SearchBar,
|
|
138
64
|
Chip,
|
|
139
|
-
FAB,
|
|
140
65
|
IconButton,
|
|
141
|
-
|
|
142
|
-
type SearchBarProps,
|
|
66
|
+
Toolbar,
|
|
143
67
|
type ChipProps,
|
|
144
|
-
type FABProps,
|
|
145
68
|
type IconButtonProps,
|
|
146
|
-
type
|
|
147
|
-
type AppBarAction,
|
|
148
|
-
FABGroup,
|
|
149
|
-
type FABGroupProps,
|
|
150
|
-
type FABGroupAction,
|
|
69
|
+
type ToolbarProps,
|
|
151
70
|
} from "./Bars";
|
|
152
|
-
//
|
|
153
|
-
export {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
anchorPopover,
|
|
158
|
-
resolveSnapPoint,
|
|
159
|
-
nearestSnapPoint,
|
|
160
|
-
type MenuProps,
|
|
161
|
-
type MenuItem,
|
|
162
|
-
type SheetProps,
|
|
163
|
-
type DrawerProps,
|
|
164
|
-
} from "./Overlays";
|
|
165
|
-
// Carousel.
|
|
166
|
-
export {
|
|
167
|
-
Carousel,
|
|
168
|
-
PageControl,
|
|
169
|
-
type CarouselProps,
|
|
170
|
-
type PageControlProps,
|
|
171
|
-
} from "./Carousel";
|
|
71
|
+
// Glass composition primitives ported from the engine this wave.
|
|
72
|
+
export { Group, type GroupProps } from "./Group";
|
|
73
|
+
export { MorphGroup, type MorphGroupProps, type MorphGroupItem } from "./MorphGroup";
|
|
74
|
+
export { Scrim, type ScrimProps } from "./Scrim";
|
|
75
|
+
export { Sheet, type SheetProps } from "./Sheet";
|
|
172
76
|
// Forms and pickers.
|
|
173
|
-
export {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
ToggleGroup,
|
|
177
|
-
InputOTP,
|
|
178
|
-
ButtonGroup,
|
|
179
|
-
type StepperProps,
|
|
180
|
-
type ToggleProps,
|
|
181
|
-
type ToggleGroupProps,
|
|
182
|
-
type ToggleGroupItem,
|
|
183
|
-
type InputOTPProps,
|
|
184
|
-
type ButtonGroupProps,
|
|
185
|
-
type ButtonGroupItem,
|
|
186
|
-
ColorPicker,
|
|
187
|
-
DEFAULT_PALETTE,
|
|
188
|
-
hexToRgb,
|
|
189
|
-
rgbToHex,
|
|
190
|
-
hueGradientColors,
|
|
191
|
-
type ColorPickerProps,
|
|
192
|
-
Combobox,
|
|
193
|
-
type ComboboxProps,
|
|
194
|
-
type ComboboxOption,
|
|
195
|
-
} from "./Forms2";
|
|
196
|
-
export {
|
|
197
|
-
Calendar,
|
|
198
|
-
DatePicker,
|
|
199
|
-
TimePicker,
|
|
200
|
-
monthGrid,
|
|
201
|
-
startOfDay,
|
|
202
|
-
sameDay,
|
|
203
|
-
parseTime,
|
|
204
|
-
formatTime,
|
|
205
|
-
WEEKDAYS,
|
|
206
|
-
MONTHS,
|
|
207
|
-
type CalendarProps,
|
|
208
|
-
type CalendarCell,
|
|
209
|
-
type DatePickerProps,
|
|
210
|
-
type TimePickerProps,
|
|
211
|
-
} from "./Pickers";
|
|
212
|
-
// Chat. Bubbles are flat tints; the composer (NativeAIInput) is the glass.
|
|
213
|
-
export {
|
|
214
|
-
Message,
|
|
215
|
-
MessageBubble,
|
|
216
|
-
MessageAttachment,
|
|
217
|
-
type MessageProps,
|
|
218
|
-
type MessageBubbleProps,
|
|
219
|
-
type MessageAttachmentProps,
|
|
220
|
-
} from "./Message";
|
|
221
|
-
export { isGlassSupported } from "./internal/GlassView";
|
|
222
|
-
export { GlassContainer, type NativeGlassContainerProps } from "./internal/GlassContainer";
|
|
77
|
+
export { Stepper, type StepperProps } from "./Stepper";
|
|
78
|
+
export { Toggle, type ToggleProps } from "./Toggle";
|
|
79
|
+
export { ToggleGroup, type ToggleGroupProps, type ToggleGroupItem } from "./ToggleGroup";
|
|
223
80
|
export {
|
|
224
81
|
colors,
|
|
225
82
|
controlSizes,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { primitives } from "./primitives";
|
|
5
|
+
import { loadBackdropScope } from "./glass-routing";
|
|
6
|
+
|
|
7
|
+
export interface GlassBackdropProps {
|
|
8
|
+
/**
|
|
9
|
+
* The scroll view inside this subtree whose content the glass photographs in
|
|
10
|
+
* content coordinates. Usually left out: the first scroll view found in the
|
|
11
|
+
* subtree is the one tracked, which is what a list screen wants.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
testID?: string;
|
|
16
|
+
[prop: string]: any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A bounded backdrop scope for glass that sits over scrolling content.
|
|
21
|
+
*
|
|
22
|
+
* Inside a `GlassBackdrop`, glass photographs the scroll content in CONTENT
|
|
23
|
+
* coordinates rather than photographing the window. A pane dragged over a list
|
|
24
|
+
* then keeps refracting the right rows while it moves, instead of showing a
|
|
25
|
+
* still frame of where the list used to be until the finger lifts.
|
|
26
|
+
*
|
|
27
|
+
* **iOS 16.4–25 with Metal only.** iOS 26+ uses Apple's own glass, which reads
|
|
28
|
+
* the live window and needs no scope; Android has its own provider contract
|
|
29
|
+
* and this component is a plain wrapper there; below the floor it is the
|
|
30
|
+
* fallback surface and a plain wrapper here. On every platform it lays out its
|
|
31
|
+
* children exactly once, so wrapping is free where it does nothing.
|
|
32
|
+
*
|
|
33
|
+
* The scope is a hint, not a guarantee. Sticky headers, parallax, nested
|
|
34
|
+
* scrollers, video and async image loads do not fit the content-space model;
|
|
35
|
+
* the renderer detects what it can and falls back to fresh window captures for
|
|
36
|
+
* that scope rather than showing stale rows.
|
|
37
|
+
*/
|
|
38
|
+
export const GlassBackdrop = forwardRef<any, GlassBackdropProps>(
|
|
39
|
+
function GlassBackdrop({ children, style, testID, ...props }, ref) {
|
|
40
|
+
const { View } = primitives();
|
|
41
|
+
|
|
42
|
+
const NativeView = loadBackdropScope();
|
|
43
|
+
|
|
44
|
+
// No native scope (iOS 26+, Android, web, Expo Go): a wrapper that changes
|
|
45
|
+
// nothing, so the same tree runs everywhere.
|
|
46
|
+
if (!NativeView) {
|
|
47
|
+
return (
|
|
48
|
+
<View ref={ref} style={style} testID={testID} {...props}>
|
|
49
|
+
{children}
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<NativeView ref={ref} style={style} testID={testID} {...props}>
|
|
56
|
+
{children}
|
|
57
|
+
</NativeView>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
@@ -2,7 +2,7 @@ import { forwardRef, type ReactNode } from "react";
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { FallbackGlassView } from "./fallback";
|
|
5
|
-
import { defaultRouter } from "./glass-routing";
|
|
5
|
+
import { defaultRouter, type GlassRouter, type GlassCapabilities } from "./glass-routing";
|
|
6
6
|
import type { SurfaceProfile } from "./material";
|
|
7
7
|
import { useIsDark } from "./motion";
|
|
8
8
|
|
|
@@ -40,13 +40,12 @@ export interface NativeGlassProps {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* The installed
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* import order, which is what makes both branches reachable in tests.
|
|
43
|
+
* The installed engine module's routing decision, memoised on first use, rather
|
|
44
|
+
* than at module load, so the decision is taken when a surface first renders.
|
|
45
|
+
* On a device that is the same answer either way — the engine's capability flag
|
|
46
|
+
* is a constant of the installed build — but it keeps the choice a property of
|
|
47
|
+
* the module rather than of import order, which is what makes both branches
|
|
48
|
+
* reachable in tests.
|
|
50
49
|
*/
|
|
51
50
|
let cachedRouter: ReturnType<typeof defaultRouter> | null = null;
|
|
52
51
|
|
|
@@ -60,13 +59,35 @@ export function resetGlassRouter() {
|
|
|
60
59
|
cachedRouter = null;
|
|
61
60
|
}
|
|
62
61
|
|
|
62
|
+
/**
|
|
63
|
+
* The memoised routing decision — the package's single source of truth for
|
|
64
|
+
* which glass surface a component may mount. Read through the same router the
|
|
65
|
+
* surface itself uses, so a component and its surface can never disagree about
|
|
66
|
+
* the mount tier.
|
|
67
|
+
*/
|
|
68
|
+
export function glassDecision(): GlassRouter {
|
|
69
|
+
return router();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The capability verdicts the package switches on, read through the same
|
|
74
|
+
* memoised decision as the surface — the one place a component's engine branch
|
|
75
|
+
* and its fallback floor are chosen from.
|
|
76
|
+
*/
|
|
77
|
+
export function glassCapabilities(): GlassCapabilities {
|
|
78
|
+
const decision = router();
|
|
79
|
+
return { supported: decision.supported, native: decision.native === true };
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
/** Whether this build renders Apple's glass. */
|
|
64
83
|
export const isGlassSupported = defaultRouter().supported;
|
|
65
84
|
|
|
66
85
|
/**
|
|
67
86
|
* Platform Glass View — the single place a glass surface is chosen:
|
|
68
|
-
* - iOS 26+: Real UIGlassEffect via
|
|
69
|
-
* - iOS
|
|
87
|
+
* - iOS 26+: Real `UIGlassEffect` via the vendored engine's native view
|
|
88
|
+
* - iOS 16.4–25: the engine's Metal renderer over a captured backdrop
|
|
89
|
+
* - Android 13+: the engine's AGSL renderer over a recorded backdrop
|
|
90
|
+
* - Everywhere else: Glacia's own glass fallback of identical shape
|
|
70
91
|
*
|
|
71
92
|
* Reduce Transparency is honoured on the fallback branch only: there the
|
|
72
93
|
* translucent tint is replaced by the theme's solid glass colour, with the same
|
|
@@ -93,23 +114,37 @@ export const GlassView = forwardRef<any, NativeGlassProps>(function GlassView(
|
|
|
93
114
|
) {
|
|
94
115
|
const isDark = useIsDark(isDarkProp);
|
|
95
116
|
const decision = router();
|
|
96
|
-
|
|
117
|
+
|
|
118
|
+
// A deliberate "no surface here" (a ghost button) never mounts a material:
|
|
119
|
+
// the engine has no none-variant and the fallback paints nothing, so the
|
|
120
|
+
// content renders bare in both.
|
|
121
|
+
const bare = effect === "none";
|
|
122
|
+
|
|
123
|
+
if (!bare && decision.supported && decision.LiquidGlassView) {
|
|
97
124
|
const LiquidGlassView = decision.LiquidGlassView;
|
|
125
|
+
const variant = effect === "clear" ? "clear" : "regular";
|
|
126
|
+
const glow = pressed === undefined ? props.glow : { progress: pressed ? 1 : 0, lens: true };
|
|
127
|
+
|
|
128
|
+
// The engine owns the material; Glacia's own surface parameters stop at
|
|
129
|
+
// the branch. Everything else (accessibility contract, provider pairing,
|
|
130
|
+
// the adaptive sensor, an externally driven press) rides through.
|
|
98
131
|
return (
|
|
99
132
|
<LiquidGlassView
|
|
133
|
+
{...props}
|
|
100
134
|
ref={ref}
|
|
101
|
-
|
|
102
|
-
|
|
135
|
+
variant={variant}
|
|
136
|
+
tint={tintColor}
|
|
103
137
|
interactive={interactive}
|
|
104
|
-
|
|
138
|
+
glow={glow}
|
|
105
139
|
style={style}
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</LiquidGlassView>
|
|
140
|
+
testID={testID}
|
|
141
|
+
children={children}
|
|
142
|
+
/>
|
|
110
143
|
);
|
|
111
144
|
}
|
|
112
145
|
|
|
146
|
+
// Unsupported, or a deliberate "no surface": the fallback floor renders —
|
|
147
|
+
// with the same shape, states and materials as the glass would have.
|
|
113
148
|
return (
|
|
114
149
|
<FallbackGlassView
|
|
115
150
|
ref={ref}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// The bare-React-Native blur backend, isolated so platform resolution can
|
|
2
|
+
// choose whether this file exists at all.
|
|
3
|
+
//
|
|
4
|
+
// `@react-native-community/blur` ships BlurView.ios.js / BlurView.android.js
|
|
5
|
+
// with no web build, so a web bundle that statically requires it fails to
|
|
6
|
+
// resolve `./components/BlurView`. Metro uses `blur-community.web.ts` for the
|
|
7
|
+
// web platform instead, and this module is only ever bundled natively.
|
|
8
|
+
|
|
9
|
+
declare const require: any;
|
|
10
|
+
|
|
11
|
+
/** The community `BlurView`, or null when the package is not installed. */
|
|
12
|
+
export function loadCommunityBlurView(): any | null {
|
|
13
|
+
try {
|
|
14
|
+
const community = require("@react-native-community/blur");
|
|
15
|
+
return community?.BlurView ?? null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/internal/blur.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
declare const require: any;
|
|
17
17
|
|
|
18
|
+
import { loadCommunityBlurView } from "./blur-community";
|
|
19
|
+
|
|
18
20
|
export type BlurKind = "expo" | "community";
|
|
19
21
|
|
|
20
22
|
interface ResolvedBlur {
|
|
@@ -43,15 +45,12 @@ export function resolveBlurView(): ResolvedBlur | null {
|
|
|
43
45
|
// Not installed: try the bare-React-Native backend below.
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return resolved;
|
|
51
|
-
}
|
|
52
|
-
} catch {
|
|
53
|
-
// Neither backend is installed; the fallback renders tint, rim and shadow.
|
|
48
|
+
const communityView = loadCommunityBlurView();
|
|
49
|
+
if (communityView) {
|
|
50
|
+
resolved = { kind: "community", View: communityView };
|
|
51
|
+
return resolved;
|
|
54
52
|
}
|
|
53
|
+
// Neither backend is installed; the fallback renders tint, rim and shadow.
|
|
55
54
|
|
|
56
55
|
resolved = null;
|
|
57
56
|
return resolved;
|