glacia-native 0.5.2 → 0.6.1
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 +156 -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 +12 -10
- 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 +212 -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
package/src/ai.tsx
DELETED
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState, type ReactNode } from "react";
|
|
2
|
-
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Glass } from "./Glass";
|
|
5
|
-
import { colors, radii } from "./internal/tokens";
|
|
6
|
-
import { primitives } from "./internal/primitives";
|
|
7
|
-
import { useIsDark } from "./internal/motion";
|
|
8
|
-
import { SelectedLens, lensFill } from "./internal/lens";
|
|
9
|
-
import { useReducedMotion } from "./internal/a11y";
|
|
10
|
-
|
|
11
|
-
export interface NativePlanStep {
|
|
12
|
-
id: string;
|
|
13
|
-
title: string;
|
|
14
|
-
detail?: string;
|
|
15
|
-
status: "pending" | "running" | "done" | "failed";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface NativePlanProps {
|
|
19
|
-
title?: string;
|
|
20
|
-
steps: NativePlanStep[];
|
|
21
|
-
isDark?: boolean;
|
|
22
|
-
style?: any;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The ordered steps a model intends to take.
|
|
27
|
-
*
|
|
28
|
-
* Each step carries its own status, so a half-finished plan is legible instead
|
|
29
|
-
* of appearing blank until the whole thing completes.
|
|
30
|
-
*/
|
|
31
|
-
export function NativePlan({ title = "Plan", steps, isDark: isDarkProp, style }: NativePlanProps) {
|
|
32
|
-
const isDark = useIsDark(isDarkProp);
|
|
33
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
34
|
-
const { View, Text } = primitives();
|
|
35
|
-
const done = steps.filter((step) => step.status === "done").length;
|
|
36
|
-
|
|
37
|
-
const markerColor = (status: NativePlanStep["status"]) =>
|
|
38
|
-
status === "done"
|
|
39
|
-
? "#34c759"
|
|
40
|
-
: status === "failed"
|
|
41
|
-
? theme.destructive
|
|
42
|
-
: status === "running"
|
|
43
|
-
? theme.fill
|
|
44
|
-
: theme.muted;
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
|
|
48
|
-
<View
|
|
49
|
-
style={{
|
|
50
|
-
flexDirection: "row",
|
|
51
|
-
justifyContent: "space-between",
|
|
52
|
-
alignItems: "center",
|
|
53
|
-
marginBottom: 8,
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
<Text style={{ fontSize: 13, fontWeight: "600", color: theme.foreground }}>{title}</Text>
|
|
57
|
-
<Text style={{ fontSize: 11, color: theme.muted }}>
|
|
58
|
-
{done}/{steps.length}
|
|
59
|
-
</Text>
|
|
60
|
-
</View>
|
|
61
|
-
|
|
62
|
-
{steps.map((step) => (
|
|
63
|
-
<View
|
|
64
|
-
key={step.id}
|
|
65
|
-
accessibilityRole="text"
|
|
66
|
-
accessibilityLabel={`${step.title}: ${step.status}`}
|
|
67
|
-
style={{ flexDirection: "row", alignItems: "flex-start", gap: 9, marginBottom: 8 }}
|
|
68
|
-
>
|
|
69
|
-
<View
|
|
70
|
-
style={{
|
|
71
|
-
width: 16,
|
|
72
|
-
height: 16,
|
|
73
|
-
borderRadius: 8,
|
|
74
|
-
borderWidth: step.status === "pending" ? 1.5 : 0,
|
|
75
|
-
borderColor: theme.edge,
|
|
76
|
-
backgroundColor: step.status === "pending" ? "transparent" : markerColor(step.status),
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
justifyContent: "center",
|
|
79
|
-
marginTop: 1,
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{step.status !== "pending" && (
|
|
83
|
-
<Text style={{ fontSize: 9, color: "#fff", fontWeight: "700" }}>
|
|
84
|
-
{step.status === "done" ? "✓" : step.status === "failed" ? "!" : "•"}
|
|
85
|
-
</Text>
|
|
86
|
-
)}
|
|
87
|
-
</View>
|
|
88
|
-
|
|
89
|
-
<View style={{ flex: 1 }}>
|
|
90
|
-
<Text
|
|
91
|
-
style={{
|
|
92
|
-
fontSize: 13,
|
|
93
|
-
color: step.status === "pending" ? theme.muted : theme.foreground,
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
{step.title}
|
|
97
|
-
</Text>
|
|
98
|
-
{step.detail && (
|
|
99
|
-
<Text style={{ fontSize: 11, color: theme.muted, marginTop: 2 }}>{step.detail}</Text>
|
|
100
|
-
)}
|
|
101
|
-
</View>
|
|
102
|
-
</View>
|
|
103
|
-
))}
|
|
104
|
-
</Glass>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface NativeSource {
|
|
109
|
-
id: string;
|
|
110
|
-
title: string;
|
|
111
|
-
url: string;
|
|
112
|
-
snippet?: string;
|
|
113
|
-
domain?: string;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface NativeSourcesProps {
|
|
117
|
-
sources: NativeSource[];
|
|
118
|
-
title?: string;
|
|
119
|
-
isDark?: boolean;
|
|
120
|
-
style?: any;
|
|
121
|
-
onSourcePress?: (source: NativeSource) => void;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Citations behind an answer, so a claim can be traced to its origin.
|
|
126
|
-
*
|
|
127
|
-
* Native has no anchor element, so a row hands the source to the caller's
|
|
128
|
-
* `onSourcePress` instead of opening a browser the component cannot control.
|
|
129
|
-
*/
|
|
130
|
-
export function NativeSources({
|
|
131
|
-
sources,
|
|
132
|
-
title = "Sources",
|
|
133
|
-
isDark: isDarkProp,
|
|
134
|
-
style,
|
|
135
|
-
onSourcePress,
|
|
136
|
-
}: NativeSourcesProps) {
|
|
137
|
-
const isDark = useIsDark(isDarkProp);
|
|
138
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
139
|
-
const { View, Text, Pressable } = primitives();
|
|
140
|
-
|
|
141
|
-
if (sources.length === 0) return null;
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
|
|
145
|
-
<Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
|
|
146
|
-
{title}
|
|
147
|
-
</Text>
|
|
148
|
-
|
|
149
|
-
{sources.map((source, index) => (
|
|
150
|
-
<Pressable
|
|
151
|
-
key={source.id}
|
|
152
|
-
accessibilityRole="link"
|
|
153
|
-
accessibilityLabel={source.title}
|
|
154
|
-
onPress={() => onSourcePress?.(source)}
|
|
155
|
-
style={{
|
|
156
|
-
flexDirection: "row",
|
|
157
|
-
gap: 9,
|
|
158
|
-
paddingVertical: 7,
|
|
159
|
-
paddingHorizontal: 10,
|
|
160
|
-
borderRadius: radii.md,
|
|
161
|
-
borderWidth: 1,
|
|
162
|
-
borderColor: theme.edge,
|
|
163
|
-
marginBottom: 6,
|
|
164
|
-
}}
|
|
165
|
-
>
|
|
166
|
-
<Text style={{ fontSize: 10, color: theme.muted, marginTop: 1 }}>{index + 1}</Text>
|
|
167
|
-
<View style={{ flex: 1 }}>
|
|
168
|
-
<Text style={{ fontSize: 12, color: theme.foreground, fontWeight: "500" }}>
|
|
169
|
-
{source.title}
|
|
170
|
-
</Text>
|
|
171
|
-
{source.snippet && (
|
|
172
|
-
<Text style={{ fontSize: 11, color: theme.muted, marginTop: 2 }}>
|
|
173
|
-
{source.snippet}
|
|
174
|
-
</Text>
|
|
175
|
-
)}
|
|
176
|
-
{source.domain && (
|
|
177
|
-
<Text style={{ fontSize: 10, color: theme.muted, marginTop: 3 }}>
|
|
178
|
-
{source.domain}
|
|
179
|
-
</Text>
|
|
180
|
-
)}
|
|
181
|
-
</View>
|
|
182
|
-
</Pressable>
|
|
183
|
-
))}
|
|
184
|
-
</Glass>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface NativeResponseProps {
|
|
189
|
-
text: string;
|
|
190
|
-
/** Characters to reveal. Omit to show the whole string. */
|
|
191
|
-
revealed?: number;
|
|
192
|
-
streaming?: boolean;
|
|
193
|
-
isDark?: boolean;
|
|
194
|
-
style?: any;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Text revealed progressively as a streamed answer arrives.
|
|
199
|
-
*
|
|
200
|
-
* The caller owns the streaming clock (usually a network stream); this only
|
|
201
|
-
* renders the first `revealed` characters and shows a caret while incomplete.
|
|
202
|
-
*/
|
|
203
|
-
export function NativeResponse({
|
|
204
|
-
text,
|
|
205
|
-
revealed,
|
|
206
|
-
streaming,
|
|
207
|
-
isDark: isDarkProp,
|
|
208
|
-
style,
|
|
209
|
-
}: NativeResponseProps) {
|
|
210
|
-
const isDark = useIsDark(isDarkProp);
|
|
211
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
212
|
-
const { View, Text } = primitives();
|
|
213
|
-
|
|
214
|
-
const shown = revealed == null ? text : text.slice(0, Math.max(0, revealed));
|
|
215
|
-
const isStreaming = streaming ?? (revealed != null && revealed < text.length);
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
<Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
|
|
219
|
-
<Text
|
|
220
|
-
accessibilityRole="text"
|
|
221
|
-
accessibilityLabel={shown}
|
|
222
|
-
style={{ fontSize: 14, lineHeight: 21, color: theme.foreground }}
|
|
223
|
-
>
|
|
224
|
-
{shown}
|
|
225
|
-
{isStreaming ? "▍" : ""}
|
|
226
|
-
</Text>
|
|
227
|
-
{/* Announced as a status so screen readers know it is still arriving. */}
|
|
228
|
-
<Text accessibilityRole="alert" style={{ height: 0, opacity: 0, fontSize: 0 }}>
|
|
229
|
-
{isStreaming ? "Response streaming" : "Response complete"}
|
|
230
|
-
</Text>
|
|
231
|
-
</Glass>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface NativeTaskProps {
|
|
236
|
-
task: {
|
|
237
|
-
/** 0–1, or omit for an indeterminate task. */
|
|
238
|
-
progress?: number;
|
|
239
|
-
label?: string;
|
|
240
|
-
detail?: string;
|
|
241
|
-
status?: "running" | "done" | "failed" | "queued";
|
|
242
|
-
};
|
|
243
|
-
isDark?: boolean;
|
|
244
|
-
style?: any;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/** Progress of a long-running background task. */
|
|
248
|
-
export function NativeTask({ task, isDark: isDarkProp, style }: NativeTaskProps) {
|
|
249
|
-
const isDark = useIsDark(isDarkProp);
|
|
250
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
251
|
-
const { View, Text } = primitives();
|
|
252
|
-
|
|
253
|
-
const percent =
|
|
254
|
-
task.progress == null ? null : Math.round(Math.min(1, Math.max(0, task.progress)) * 100);
|
|
255
|
-
const status = task.status ?? "running";
|
|
256
|
-
const fillColor =
|
|
257
|
-
status === "failed" ? theme.destructive : status === "done" ? "#34c759" : theme.fill;
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<Glass
|
|
261
|
-
surface="panel"
|
|
262
|
-
isDark={isDark}
|
|
263
|
-
accessibilityRole="progressbar"
|
|
264
|
-
accessibilityLabel={task.label ?? "Task progress"}
|
|
265
|
-
// Without the value, a screen reader only reads the label and never says
|
|
266
|
-
// how far along the task is.
|
|
267
|
-
accessibilityValue={percent == null ? undefined : { min: 0, max: 100, now: percent }}
|
|
268
|
-
accessibilityState={{
|
|
269
|
-
disabled: false,
|
|
270
|
-
}}
|
|
271
|
-
style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style as StyleProp<ViewStyle>]}
|
|
272
|
-
>
|
|
273
|
-
<View
|
|
274
|
-
style={{ flexDirection: "row", justifyContent: "space-between", marginBottom: 6 }}
|
|
275
|
-
>
|
|
276
|
-
<Text style={{ fontSize: 12, fontWeight: "500", color: theme.foreground }}>
|
|
277
|
-
{task.label ?? "Task"}
|
|
278
|
-
</Text>
|
|
279
|
-
<Text style={{ fontSize: 11, color: theme.muted }}>
|
|
280
|
-
{percent == null ? "…" : `${percent}%`}
|
|
281
|
-
</Text>
|
|
282
|
-
</View>
|
|
283
|
-
|
|
284
|
-
<View
|
|
285
|
-
style={{
|
|
286
|
-
height: 6,
|
|
287
|
-
borderRadius: 3,
|
|
288
|
-
backgroundColor: isDark ? "rgba(235,235,245,0.15)" : "rgba(0,0,0,0.08)",
|
|
289
|
-
overflow: "hidden",
|
|
290
|
-
}}
|
|
291
|
-
>
|
|
292
|
-
<View
|
|
293
|
-
style={{
|
|
294
|
-
// An indeterminate task fills partially rather than pretending 0%.
|
|
295
|
-
width: percent == null ? "35%" : `${percent}%`,
|
|
296
|
-
height: "100%",
|
|
297
|
-
borderRadius: 3,
|
|
298
|
-
backgroundColor: fillColor,
|
|
299
|
-
opacity: percent == null ? 0.6 : 1,
|
|
300
|
-
}}
|
|
301
|
-
/>
|
|
302
|
-
</View>
|
|
303
|
-
|
|
304
|
-
{task.detail && (
|
|
305
|
-
<Text style={{ fontSize: 11, color: theme.muted, marginTop: 6 }}>{task.detail}</Text>
|
|
306
|
-
)}
|
|
307
|
-
</Glass>
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface NativeSoundwaveProps {
|
|
312
|
-
levels?: number[];
|
|
313
|
-
bars?: number;
|
|
314
|
-
active?: boolean;
|
|
315
|
-
height?: number;
|
|
316
|
-
color?: string;
|
|
317
|
-
isDark?: boolean;
|
|
318
|
-
style?: any;
|
|
319
|
-
label?: string;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* A waveform driven by real amplitude.
|
|
324
|
-
*
|
|
325
|
-
* Bars follow `levels` when supplied, so it can show live microphone input.
|
|
326
|
-
* Without levels it rests at a low, static profile instead of animating:
|
|
327
|
-
* continuous motion with no audio behind it would be decorative noise.
|
|
328
|
-
*/
|
|
329
|
-
export function NativeSoundwave({
|
|
330
|
-
levels,
|
|
331
|
-
bars = 28,
|
|
332
|
-
active = true,
|
|
333
|
-
height = 40,
|
|
334
|
-
color,
|
|
335
|
-
isDark: isDarkProp,
|
|
336
|
-
style,
|
|
337
|
-
label = "Audio level",
|
|
338
|
-
}: NativeSoundwaveProps) {
|
|
339
|
-
const isDark = useIsDark(isDarkProp);
|
|
340
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
341
|
-
const { View } = primitives();
|
|
342
|
-
|
|
343
|
-
const count = levels?.length || bars;
|
|
344
|
-
const tint = color ?? theme.foreground;
|
|
345
|
-
|
|
346
|
-
return (
|
|
347
|
-
<View
|
|
348
|
-
accessibilityRole="image"
|
|
349
|
-
accessibilityLabel={label}
|
|
350
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 2, height, ...style }}
|
|
351
|
-
>
|
|
352
|
-
{Array.from({ length: count }, (_, i) => {
|
|
353
|
-
const level = levels ? levels[i] ?? 0 : 0;
|
|
354
|
-
// Idle bars taper at the edges so the shape still reads as a wave.
|
|
355
|
-
const idle = 0.12 + Math.sin((i / count) * Math.PI) * 0.1;
|
|
356
|
-
const scale = Math.max(0.06, Math.min(1, active && levels ? level : idle));
|
|
357
|
-
return (
|
|
358
|
-
<View
|
|
359
|
-
key={i}
|
|
360
|
-
style={{
|
|
361
|
-
width: 3,
|
|
362
|
-
height: height * scale,
|
|
363
|
-
borderRadius: 2,
|
|
364
|
-
backgroundColor: tint,
|
|
365
|
-
opacity: active ? 0.85 : 0.35,
|
|
366
|
-
}}
|
|
367
|
-
/>
|
|
368
|
-
);
|
|
369
|
-
})}
|
|
370
|
-
</View>
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
export interface NativeThinkingOrbProps {
|
|
375
|
-
label?: string;
|
|
376
|
-
size?: number;
|
|
377
|
-
paused?: boolean;
|
|
378
|
-
isDark?: boolean;
|
|
379
|
-
style?: any;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* A pulsing indicator shown while a model is working.
|
|
384
|
-
*
|
|
385
|
-
* Purely decorative, so it is hidden from screen readers and the label is
|
|
386
|
-
* exposed as text instead of relying on the motion being perceived.
|
|
387
|
-
*/
|
|
388
|
-
export function NativeThinkingOrb({
|
|
389
|
-
label = "Thinking",
|
|
390
|
-
size = 22,
|
|
391
|
-
paused = false,
|
|
392
|
-
isDark: isDarkProp,
|
|
393
|
-
style,
|
|
394
|
-
}: NativeThinkingOrbProps) {
|
|
395
|
-
const isDark = useIsDark(isDarkProp);
|
|
396
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
397
|
-
const { View, Text } = primitives();
|
|
398
|
-
const reducedMotion = useReducedMotion();
|
|
399
|
-
const [tick, setTick] = useState(0);
|
|
400
|
-
|
|
401
|
-
// Reduce Motion: the orb stops pulsing and holds a steady size. The label is
|
|
402
|
-
// what carries the meaning, so nothing is lost by not moving.
|
|
403
|
-
const still = paused || reducedMotion;
|
|
404
|
-
|
|
405
|
-
useEffect(() => {
|
|
406
|
-
if (still) return;
|
|
407
|
-
const timer = setInterval(() => setTick((value) => value + 1), 700);
|
|
408
|
-
return () => clearInterval(timer);
|
|
409
|
-
}, [still]);
|
|
410
|
-
|
|
411
|
-
const scale = still ? 1 : [1, 1.12, 1][tick % 3]!;
|
|
412
|
-
|
|
413
|
-
return (
|
|
414
|
-
<View
|
|
415
|
-
accessibilityRole="text"
|
|
416
|
-
accessibilityLabel={label}
|
|
417
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 8, ...style }}
|
|
418
|
-
>
|
|
419
|
-
<View
|
|
420
|
-
style={{
|
|
421
|
-
width: size,
|
|
422
|
-
height: size,
|
|
423
|
-
borderRadius: size / 2,
|
|
424
|
-
backgroundColor: theme.fill,
|
|
425
|
-
opacity: paused ? 0.5 : 0.85,
|
|
426
|
-
transform: [{ scale }],
|
|
427
|
-
}}
|
|
428
|
-
/>
|
|
429
|
-
<Text style={{ fontSize: 12, color: theme.muted }}>{label}</Text>
|
|
430
|
-
</View>
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
export interface NativePanelNavItem {
|
|
435
|
-
id: string;
|
|
436
|
-
label: string;
|
|
437
|
-
count?: number;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export interface NativePanelsideProps {
|
|
441
|
-
items: NativePanelNavItem[];
|
|
442
|
-
value?: string;
|
|
443
|
-
onValueChange?: (id: string) => void;
|
|
444
|
-
isDark?: boolean;
|
|
445
|
-
style?: any;
|
|
446
|
-
title?: string;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* A rail for an AI workspace: conversations, saved prompts or tasks.
|
|
451
|
-
*
|
|
452
|
-
* Selection is a press rather than navigation because the panel's content is
|
|
453
|
-
* client state; the caller decides what a selection means.
|
|
454
|
-
*/
|
|
455
|
-
export function NativePanelside({
|
|
456
|
-
items,
|
|
457
|
-
value,
|
|
458
|
-
onValueChange,
|
|
459
|
-
isDark: isDarkProp,
|
|
460
|
-
style,
|
|
461
|
-
title,
|
|
462
|
-
}: NativePanelsideProps) {
|
|
463
|
-
const isDark = useIsDark(isDarkProp);
|
|
464
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
465
|
-
const { View, Text, Pressable } = primitives();
|
|
466
|
-
|
|
467
|
-
return (
|
|
468
|
-
<Glass surface="panel" isDark={isDark} style={[{ paddingHorizontal: 14, paddingVertical: 12, borderRadius: radii.lg }, style]}>
|
|
469
|
-
{title && (
|
|
470
|
-
<Text style={{ fontSize: 11, fontWeight: "600", color: theme.muted, marginBottom: 6 }}>
|
|
471
|
-
{title}
|
|
472
|
-
</Text>
|
|
473
|
-
)}
|
|
474
|
-
|
|
475
|
-
{items.map((item) => {
|
|
476
|
-
const isActive = item.id === value;
|
|
477
|
-
return (
|
|
478
|
-
<Pressable
|
|
479
|
-
key={item.id}
|
|
480
|
-
accessibilityRole="button"
|
|
481
|
-
accessibilityState={{ selected: isActive }}
|
|
482
|
-
accessibilityLabel={item.label}
|
|
483
|
-
onPress={() => onValueChange?.(item.id)}
|
|
484
|
-
style={{
|
|
485
|
-
flexDirection: "row",
|
|
486
|
-
alignItems: "center",
|
|
487
|
-
justifyContent: "space-between",
|
|
488
|
-
paddingVertical: 9,
|
|
489
|
-
paddingHorizontal: 11,
|
|
490
|
-
borderRadius: radii.md,
|
|
491
|
-
backgroundColor: "transparent",
|
|
492
|
-
marginBottom: 2,
|
|
493
|
-
}}
|
|
494
|
-
>
|
|
495
|
-
{isActive ? <SelectedLens radius={radii.md} isDark={isDark} style={lensFill} /> : null}
|
|
496
|
-
<Text
|
|
497
|
-
style={{
|
|
498
|
-
fontSize: 13,
|
|
499
|
-
color: isActive ? theme.foreground : theme.muted,
|
|
500
|
-
fontWeight: isActive ? "600" : "400",
|
|
501
|
-
}}
|
|
502
|
-
>
|
|
503
|
-
{item.label}
|
|
504
|
-
</Text>
|
|
505
|
-
{item.count != null && (
|
|
506
|
-
<Text style={{ fontSize: 10, color: theme.muted }}>{item.count}</Text>
|
|
507
|
-
)}
|
|
508
|
-
</Pressable>
|
|
509
|
-
);
|
|
510
|
-
})}
|
|
511
|
-
</Glass>
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
export interface NativeAIInputProps {
|
|
516
|
-
/** Controlled text. Omit it and the composer keeps its own. */
|
|
517
|
-
value?: string;
|
|
518
|
-
/** Starting text for uncontrolled use. */
|
|
519
|
-
defaultValue?: string;
|
|
520
|
-
onChangeText?: (text: string) => void;
|
|
521
|
-
onSubmit?: () => void;
|
|
522
|
-
placeholder?: string;
|
|
523
|
-
disabled?: boolean;
|
|
524
|
-
/** Shown as a spinner-free label while a response is pending. */
|
|
525
|
-
busy?: boolean;
|
|
526
|
-
sendLabel?: string;
|
|
527
|
-
isDark?: boolean;
|
|
528
|
-
style?: any;
|
|
529
|
-
footer?: ReactNode;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* The composer for an AI conversation.
|
|
534
|
-
*
|
|
535
|
-
* Send stays disabled until there is non-whitespace to send, which is the rule
|
|
536
|
-
* that prevents empty submissions rather than a validation message afterwards.
|
|
537
|
-
*/
|
|
538
|
-
export function NativeAIInput({
|
|
539
|
-
value: valueProp,
|
|
540
|
-
defaultValue,
|
|
541
|
-
onChangeText,
|
|
542
|
-
onSubmit,
|
|
543
|
-
placeholder = "Ask anything",
|
|
544
|
-
disabled = false,
|
|
545
|
-
busy = false,
|
|
546
|
-
sendLabel = "Send",
|
|
547
|
-
isDark: isDarkProp,
|
|
548
|
-
style,
|
|
549
|
-
footer,
|
|
550
|
-
}: NativeAIInputProps) {
|
|
551
|
-
const isDark = useIsDark(isDarkProp);
|
|
552
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
553
|
-
const { View, Text, TextInput, Pressable } = primitives();
|
|
554
|
-
|
|
555
|
-
// Uncontrolled support: the composer owns its text when no `value` is given,
|
|
556
|
-
// which is what makes typed text appear in plain uncontrolled use.
|
|
557
|
-
const [internalText, setInternalText] = useState(defaultValue ?? "");
|
|
558
|
-
const value = valueProp !== undefined ? valueProp : internalText;
|
|
559
|
-
const handleChangeText = (next: string) => {
|
|
560
|
-
if (valueProp === undefined) setInternalText(next);
|
|
561
|
-
onChangeText?.(next);
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
const canSend = !disabled && !busy && value.trim().length > 0;
|
|
565
|
-
// The themed placeholder is drawn as a Text, matching Input: the OS default
|
|
566
|
-
// placeholder colour ignores the theme.
|
|
567
|
-
const showPlaceholder = !value && Boolean(placeholder);
|
|
568
|
-
|
|
569
|
-
return (
|
|
570
|
-
<View style={style as StyleProp<ViewStyle>}>
|
|
571
|
-
<Glass
|
|
572
|
-
surface="field"
|
|
573
|
-
isDark={isDark}
|
|
574
|
-
style={{
|
|
575
|
-
flexDirection: "row",
|
|
576
|
-
alignItems: "flex-end",
|
|
577
|
-
gap: 8,
|
|
578
|
-
paddingVertical: 6,
|
|
579
|
-
paddingRight: 6,
|
|
580
|
-
paddingLeft: 16,
|
|
581
|
-
borderRadius: radii.pill,
|
|
582
|
-
opacity: disabled ? 0.5 : 1,
|
|
583
|
-
}}
|
|
584
|
-
>
|
|
585
|
-
<View style={{ flex: 1, justifyContent: "center" }}>
|
|
586
|
-
{showPlaceholder && (
|
|
587
|
-
<Text
|
|
588
|
-
pointerEvents="none"
|
|
589
|
-
numberOfLines={1}
|
|
590
|
-
style={{
|
|
591
|
-
position: "absolute",
|
|
592
|
-
left: 6,
|
|
593
|
-
fontSize: 14,
|
|
594
|
-
color: theme.muted,
|
|
595
|
-
}}
|
|
596
|
-
>
|
|
597
|
-
{placeholder}
|
|
598
|
-
</Text>
|
|
599
|
-
)}
|
|
600
|
-
|
|
601
|
-
<TextInput
|
|
602
|
-
value={value}
|
|
603
|
-
onChangeText={handleChangeText}
|
|
604
|
-
editable={!disabled}
|
|
605
|
-
multiline
|
|
606
|
-
numberOfLines={3}
|
|
607
|
-
accessibilityLabel={placeholder}
|
|
608
|
-
accessibilityState={{ disabled }}
|
|
609
|
-
style={{
|
|
610
|
-
minHeight: 34,
|
|
611
|
-
maxHeight: 120,
|
|
612
|
-
paddingHorizontal: 6,
|
|
613
|
-
paddingVertical: 7,
|
|
614
|
-
fontSize: 14,
|
|
615
|
-
color: theme.foreground,
|
|
616
|
-
}}
|
|
617
|
-
/>
|
|
618
|
-
</View>
|
|
619
|
-
|
|
620
|
-
<Pressable
|
|
621
|
-
accessibilityRole="button"
|
|
622
|
-
accessibilityLabel={sendLabel}
|
|
623
|
-
accessibilityState={{ disabled: !canSend }}
|
|
624
|
-
disabled={!canSend}
|
|
625
|
-
onPress={() => canSend && onSubmit?.()}
|
|
626
|
-
style={{
|
|
627
|
-
height: 34,
|
|
628
|
-
paddingHorizontal: 14,
|
|
629
|
-
alignItems: "center",
|
|
630
|
-
justifyContent: "center",
|
|
631
|
-
borderRadius: radii.pill,
|
|
632
|
-
backgroundColor: canSend ? theme.fill : theme.edge,
|
|
633
|
-
}}
|
|
634
|
-
>
|
|
635
|
-
<Text style={{ fontSize: 13, fontWeight: "600", color: canSend ? "#fff" : theme.muted }}>
|
|
636
|
-
{busy ? "…" : sendLabel}
|
|
637
|
-
</Text>
|
|
638
|
-
</Pressable>
|
|
639
|
-
</Glass>
|
|
640
|
-
|
|
641
|
-
{footer}
|
|
642
|
-
</View>
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
export interface NativeGeneratedImage {
|
|
647
|
-
url: string;
|
|
648
|
-
alt: string;
|
|
649
|
-
width?: number;
|
|
650
|
-
height?: number;
|
|
651
|
-
/** Shown under the image while generation is still running. */
|
|
652
|
-
progress?: number;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
export interface NativeImageGenerationProps {
|
|
656
|
-
image?: NativeGeneratedImage;
|
|
657
|
-
prompt?: string;
|
|
658
|
-
status?: "queued" | "generating" | "done" | "failed";
|
|
659
|
-
isDark?: boolean;
|
|
660
|
-
style?: any;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* A generated image with its prompt and state.
|
|
665
|
-
*
|
|
666
|
-
* While generating, a placeholder with the same aspect ratio holds the space so
|
|
667
|
-
* the layout does not jump when the image arrives.
|
|
668
|
-
*/
|
|
669
|
-
export function NativeImageGeneration({
|
|
670
|
-
image,
|
|
671
|
-
prompt,
|
|
672
|
-
status = "queued",
|
|
673
|
-
isDark: isDarkProp,
|
|
674
|
-
style,
|
|
675
|
-
}: NativeImageGenerationProps) {
|
|
676
|
-
const isDark = useIsDark(isDarkProp);
|
|
677
|
-
const theme = isDark ? colors.dark : colors.light;
|
|
678
|
-
const { View, Text, Image } = primitives();
|
|
679
|
-
|
|
680
|
-
const width = image?.width ?? 320;
|
|
681
|
-
const height = image?.height ?? 200;
|
|
682
|
-
const showImage = image && status === "done";
|
|
683
|
-
|
|
684
|
-
return (
|
|
685
|
-
<View style={style}>
|
|
686
|
-
<View
|
|
687
|
-
style={{
|
|
688
|
-
width: "100%",
|
|
689
|
-
aspectRatio: width / height,
|
|
690
|
-
borderRadius: radii.md,
|
|
691
|
-
overflow: "hidden",
|
|
692
|
-
backgroundColor: isDark ? "rgba(235,235,245,0.08)" : "rgba(0,0,0,0.05)",
|
|
693
|
-
alignItems: "center",
|
|
694
|
-
justifyContent: "center",
|
|
695
|
-
}}
|
|
696
|
-
>
|
|
697
|
-
{showImage ? (
|
|
698
|
-
<Image
|
|
699
|
-
source={{ uri: image.url }}
|
|
700
|
-
accessibilityLabel={image.alt}
|
|
701
|
-
style={{ width: "100%", height: "100%" }}
|
|
702
|
-
/>
|
|
703
|
-
) : (
|
|
704
|
-
<Text style={{ fontSize: 12, color: theme.muted }}>
|
|
705
|
-
{status === "failed" ? "Generation failed" : "Generating…"}
|
|
706
|
-
</Text>
|
|
707
|
-
)}
|
|
708
|
-
</View>
|
|
709
|
-
|
|
710
|
-
{prompt && (
|
|
711
|
-
<Text style={{ fontSize: 11, color: theme.muted, marginTop: 6 }}>{prompt}</Text>
|
|
712
|
-
)}
|
|
713
|
-
</View>
|
|
714
|
-
);
|
|
715
|
-
}
|