fancy-ui-vue 0.2.0 → 0.4.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/PORTING.md +123 -2
- package/README.md +20 -15
- package/dist/components/accordion/Accordion.vue.d.ts +44 -0
- package/dist/components/accordion/Accordion.vue.js +88 -0
- package/dist/components/accordion/Accordion.vue2.js +4 -0
- package/dist/components/accordion/AccordionContent.vue.d.ts +25 -0
- package/dist/components/accordion/AccordionContent.vue.js +42 -0
- package/dist/components/accordion/AccordionContent.vue2.js +4 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +21 -0
- package/dist/components/accordion/AccordionItem.vue.js +66 -0
- package/dist/components/accordion/AccordionItem.vue2.js +4 -0
- package/dist/components/accordion/AccordionTrigger.vue.d.ts +24 -0
- package/dist/components/accordion/AccordionTrigger.vue.js +83 -0
- package/dist/components/accordion/AccordionTrigger.vue2.js +4 -0
- package/dist/components/accordion/accordion-core.d.ts +35 -0
- package/dist/components/accordion/accordion-core.js +44 -0
- package/dist/components/accordion/index.d.ts +11 -0
- package/dist/components/accordion/types.d.ts +45 -0
- package/dist/components/accordion/types.js +7 -0
- package/dist/components/alert-dialog/AlertDialog.vue.js +22 -3
- package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +3 -3
- package/dist/components/apple-card-carousel/AppleCard.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue2.js +22 -15
- package/dist/components/avatar/Avatar.vue.d.ts +27 -0
- package/dist/components/avatar/Avatar.vue.js +119 -0
- package/dist/components/avatar/Avatar.vue2.js +4 -0
- package/dist/components/avatar/avatar-core.d.ts +40 -0
- package/dist/components/avatar/avatar-core.js +57 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.vue.d.ts +21 -0
- package/dist/components/badge/Badge.vue.js +46 -0
- package/dist/components/badge/Badge.vue2.js +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/bento-grid/BentoFrame.vue.js +1 -1
- package/dist/components/bento-grid/BentoFrame.vue2.js +6 -5
- package/dist/components/bento-grid/BentoGrid.vue.js +1 -1
- package/dist/components/bento-grid/BentoGrid.vue2.js +12 -12
- package/dist/components/bento-grid/BentoGridCard.vue.js +6 -5
- package/dist/components/bento-grid/BentoGridItem.vue.js +6 -5
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.d.ts +1 -1
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +47 -12
- package/dist/components/book/Book.vue.js +8 -9
- package/dist/components/book/BookDescription.vue.js +6 -5
- package/dist/components/book/BookHeader.vue.js +6 -5
- package/dist/components/book/BookTitle.vue.js +6 -5
- package/dist/components/box-reveal/BoxReveal.vue.js +6 -5
- package/dist/components/button/Button.vue.d.ts +6 -4
- package/dist/components/button/Button.vue.js +1 -1
- package/dist/components/button/Button.vue2.js +50 -22
- package/dist/components/card-3d/CardContainer.vue.js +1 -1
- package/dist/components/card-3d/CardItem.vue.js +1 -1
- package/dist/components/card-spotlight/CardSpotlight.vue.js +1 -1
- package/dist/components/chat-message/ChatMessageAction.vue.d.ts +4 -2
- package/dist/components/chat-message/ChatMessageAction.vue.js +4 -2
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.vue.js +1 -1
- package/dist/components/checkbox/Checkbox.vue2.js +17 -7
- package/dist/components/collapsible/Collapsible.vue.d.ts +31 -0
- package/dist/components/collapsible/Collapsible.vue.js +60 -0
- package/dist/components/collapsible/Collapsible.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleContent.vue.d.ts +26 -0
- package/dist/components/collapsible/CollapsibleContent.vue.js +81 -0
- package/dist/components/collapsible/CollapsibleContent.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.d.ts +21 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.js +57 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue2.js +4 -0
- package/dist/components/collapsible/collapsible-core.d.ts +47 -0
- package/dist/components/collapsible/collapsible-core.js +40 -0
- package/dist/components/collapsible/index.d.ts +8 -0
- package/dist/components/collapsible/types.d.ts +24 -0
- package/dist/components/collapsible/types.js +5 -0
- package/dist/components/combobox/Combobox.vue.js +1 -1
- package/dist/components/combobox/Combobox.vue2.js +24 -16
- package/dist/components/command-menu/CommandMenu.vue.d.ts +5 -0
- package/dist/components/command-menu/CommandMenu.vue.js +1 -1
- package/dist/components/command-menu/CommandMenu.vue2.js +5 -2
- package/dist/components/compare/Compare.vue.d.ts +15 -5
- package/dist/components/compare/Compare.vue.js +1 -1
- package/dist/components/compare/Compare.vue2.js +28 -13
- package/dist/components/composer/ComposerInput.vue.js +1 -1
- package/dist/components/composer/ComposerInput.vue2.js +11 -11
- package/dist/components/composer/ComposerModelPicker.vue.d.ts +4 -0
- package/dist/components/composer/ComposerModelPicker.vue.js +1 -1
- package/dist/components/composer/ComposerModelPicker.vue2.js +29 -15
- package/dist/components/composer/ComposerSubmit.vue.d.ts +2 -0
- package/dist/components/composer/ComposerSubmit.vue.js +16 -15
- package/dist/components/confetti/ConfettiButton.vue.d.ts +9 -2
- package/dist/components/confetti/ConfettiButton.vue.js +24 -6
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +12 -13
- package/dist/components/copy-button/CopyButton.vue.d.ts +5 -0
- package/dist/components/copy-button/CopyButton.vue.js +1 -1
- package/dist/components/copy-button/CopyButton.vue2.js +72 -11
- package/dist/components/datamosh-transition/DatamoshTransition.vue.d.ts +6 -2
- package/dist/components/datamosh-transition/DatamoshTransition.vue.js +7 -4
- package/dist/components/date-picker/DatePicker.vue.js +1 -1
- package/dist/components/date-picker/DatePicker.vue2.js +27 -21
- package/dist/components/dialog/Dialog.vue.js +20 -1
- package/dist/components/dialog/DialogSurface.vue.js +1 -1
- package/dist/components/dialog/DialogSurface.vue2.js +5 -2
- package/dist/components/dialog/types.d.ts +2 -0
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue.js +1 -1
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue2.js +9 -7
- package/dist/components/displacement-text/DisplacementText.vue.d.ts +4 -1
- package/dist/components/displacement-text/DisplacementText.vue.js +38 -11
- package/dist/components/displacement-text/displacement-text-core.d.ts +94 -4
- package/dist/components/displacement-text/displacement-text-core.js +287 -97
- package/dist/components/drawer/Drawer.vue.d.ts +5 -0
- package/dist/components/drawer/Drawer.vue.js +1 -1
- package/dist/components/drawer/Drawer.vue2.js +5 -2
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.js +2 -1
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.js +17 -10
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +8 -0
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.js +28 -13
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue2.js +20 -10
- package/dist/components/editorial-engine/EditorialEngine.vue.js +1 -1
- package/dist/components/editorial-engine/engine.js +13 -0
- package/dist/components/file-upload/FileUpload.vue.d.ts +2 -0
- package/dist/components/file-upload/FileUpload.vue.js +1 -1
- package/dist/components/file-upload/FileUpload.vue2.js +20 -10
- package/dist/components/fireworks-hdr/FireworksHdr.vue.js +2 -2
- package/dist/components/flickering-grid/FlickeringGrid.vue.d.ts +1 -1
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.js +51 -9
- package/dist/components/flip-card/FlipCard.vue.d.ts +3 -1
- package/dist/components/flip-card/FlipCard.vue.js +1 -1
- package/dist/components/flip-card/FlipCard.vue2.js +5 -3
- package/dist/components/fluid-cursor/FluidCursor.vue.js +37 -9
- package/dist/components/fluid-cursor/fluid-cursor-core.js +3 -3
- package/dist/components/fluid-cursor/webgpu-engine.js +3 -3
- package/dist/components/focus/Focus.vue.js +1 -1
- package/dist/components/focus/Focus.vue2.js +2 -2
- package/dist/components/follow-button/FollowButton.vue.d.ts +69 -0
- package/dist/components/follow-button/FollowButton.vue.js +7 -0
- package/dist/components/follow-button/FollowButton.vue2.js +239 -0
- package/dist/components/follow-button/follow-core.d.ts +83 -0
- package/dist/components/follow-button/follow-core.js +92 -0
- package/dist/components/follow-button/index.d.ts +2 -0
- package/dist/components/frosted-glass/FrostedGlass.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue2.js +4 -4
- package/dist/components/glowing-effect/GlowingEffect.vue.js +3 -3
- package/dist/components/glowing-effect/glowing-effect-core.js +4 -1
- package/dist/components/gradient-button/GradientButton.vue.d.ts +6 -4
- package/dist/components/gradient-button/GradientButton.vue.js +1 -1
- package/dist/components/gradient-button/GradientButton.vue2.js +13 -3
- package/dist/components/icon-button/IconButton.vue.d.ts +6 -4
- package/dist/components/icon-button/IconButton.vue.js +11 -8
- package/dist/components/image-trail-cursor/ImageTrailCursor.vue.js +17 -7
- package/dist/components/image-trail-cursor/trail-variants.js +3 -6
- package/dist/components/inline-citation/InlineCitation.vue.js +1 -1
- package/dist/components/inline-citation/InlineCitation.vue2.js +20 -14
- package/dist/components/input/Input.vue.js +1 -1
- package/dist/components/input/Input.vue2.js +18 -8
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue.js +1 -1
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue2.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.d.ts +6 -3
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue2.js +12 -2
- package/dist/components/letter-pullup/LetterPullup.vue.js +4 -4
- package/dist/components/line-hover-link/LineHoverLink.vue.js +1 -1
- package/dist/components/line-hover-link/LineHoverLink.vue2.js +5 -6
- package/dist/components/link/Link.vue.d.ts +4 -2
- package/dist/components/link/Link.vue.js +1 -1
- package/dist/components/link/Link.vue2.js +11 -8
- package/dist/components/magnetic-field/MagnetPuck.vue.d.ts +51 -0
- package/dist/components/magnetic-field/MagnetPuck.vue.js +7 -0
- package/dist/components/magnetic-field/MagnetPuck.vue2.js +191 -0
- package/dist/components/magnetic-field/MagneticField.vue.d.ts +39 -0
- package/dist/components/magnetic-field/MagneticField.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticField.vue2.js +157 -0
- package/dist/components/magnetic-field/MagneticItem.vue.d.ts +28 -0
- package/dist/components/magnetic-field/MagneticItem.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticItem.vue2.js +72 -0
- package/dist/components/magnetic-field/index.d.ts +10 -0
- package/dist/components/magnetic-field/magnetic-field-core.d.ts +163 -0
- package/dist/components/magnetic-field/magnetic-field-core.js +534 -0
- package/dist/components/magnetic-field/magnetic-field-source.d.ts +58 -0
- package/dist/components/magnetic-field/magnetic-field-source.js +58 -0
- package/dist/components/magnetic-field/types.d.ts +14 -0
- package/dist/components/magnetic-field/types.js +5 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.d.ts +6 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.js +53 -9
- package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +30 -0
- package/dist/components/mosaic-glow/mosaic-glow-core.js +27 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.d.ts +24 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.js +200 -0
- package/dist/components/navbar/NavbarLink.vue.d.ts +4 -2
- package/dist/components/navbar/NavbarLink.vue.js +1 -1
- package/dist/components/navbar/NavbarLink.vue2.js +16 -13
- package/dist/components/navigation-menu/NavigationMenu.vue.js +6 -3
- package/dist/components/navigation-menu/NavigationMenuLink.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuLink.vue2.js +8 -8
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +15 -0
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue2.js +36 -15
- package/dist/components/neon-border/NeonBorder.vue.js +1 -1
- package/dist/components/neon-border/NeonBorder.vue2.js +10 -11
- package/dist/components/number-input/NumberInput.vue.js +1 -1
- package/dist/components/number-input/NumberInput.vue2.js +22 -12
- package/dist/components/password-input/PasswordInput.vue.js +1 -1
- package/dist/components/password-input/PasswordInput.vue2.js +18 -11
- package/dist/components/pixel-loader/PixelLoader.vue.js +1 -1
- package/dist/components/pixel-loader/PixelLoader.vue2.js +6 -6
- package/dist/components/pixel-scene/PixelScene.vue.d.ts +60 -0
- package/dist/components/pixel-scene/PixelScene.vue.js +184 -0
- package/dist/components/pixel-scene/PixelScene.vue2.js +4 -0
- package/dist/components/pixel-scene/index.d.ts +4 -0
- package/dist/components/pixel-scene/pixel-scene-core.d.ts +256 -0
- package/dist/components/pixel-scene/pixel-scene-core.js +878 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.d.ts +68 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.js +312 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.d.ts +31 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.js +1074 -0
- package/dist/components/popover/Popover.vue.d.ts +4 -0
- package/dist/components/popover/Popover.vue.js +1 -1
- package/dist/components/popover/Popover.vue2.js +8 -6
- package/dist/components/popover/PopoverContent.vue.js +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.d.ts +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.js +1 -1
- package/dist/components/pulse-beam/PulseBeam.vue2.js +7 -4
- package/dist/components/radio-group/RadioGroup.vue.js +12 -11
- package/dist/components/radio-group/RadioGroupItem.vue.d.ts +2 -0
- package/dist/components/radio-group/RadioGroupItem.vue.js +1 -1
- package/dist/components/radio-group/RadioGroupItem.vue2.js +20 -7
- package/dist/components/rainbow-button/RainbowButton.vue.d.ts +11 -2
- package/dist/components/rainbow-button/RainbowButton.vue.js +1 -1
- package/dist/components/rainbow-button/RainbowButton.vue2.js +35 -18
- package/dist/components/ripple-button/RippleButton.vue.d.ts +6 -4
- package/dist/components/ripple-button/RippleButton.vue.js +1 -1
- package/dist/components/ripple-button/RippleButton.vue2.js +10 -5
- package/dist/components/search-input/SearchInput.vue.js +1 -1
- package/dist/components/search-input/SearchInput.vue2.js +19 -9
- package/dist/components/select/Select.vue.d.ts +1 -1
- package/dist/components/select/Select.vue.js +1 -1
- package/dist/components/select/Select.vue2.js +25 -17
- package/dist/components/sheet/Sheet.vue.d.ts +5 -0
- package/dist/components/sheet/Sheet.vue.js +5 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.d.ts +2 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.js +1 -1
- package/dist/components/shimmer-button/ShimmerButton.vue2.js +14 -6
- package/dist/components/sidebar/SidebarItem.vue.d.ts +4 -2
- package/dist/components/sidebar/SidebarItem.vue.js +1 -1
- package/dist/components/sidebar/SidebarItem.vue2.js +4 -2
- package/dist/components/slider/Slider.vue.d.ts +4 -0
- package/dist/components/slider/Slider.vue.js +1 -1
- package/dist/components/slider/Slider.vue2.js +20 -8
- package/dist/components/sources/SourcesTrigger.vue.js +1 -1
- package/dist/components/sources/SourcesTrigger.vue2.js +11 -11
- package/dist/components/sparkles/sparkles-core.d.ts +1 -1
- package/dist/components/sparkles/sparkles-core.js +36 -2
- package/dist/components/story-thread/StoryNode.vue.d.ts +11 -0
- package/dist/components/story-thread/StoryNode.vue.js +7 -0
- package/dist/components/story-thread/StoryNode.vue2.js +23 -0
- package/dist/components/story-thread/StoryThread.vue.d.ts +56 -0
- package/dist/components/story-thread/StoryThread.vue.js +7 -0
- package/dist/components/story-thread/StoryThread.vue2.js +103 -0
- package/dist/components/story-thread/index.d.ts +5 -0
- package/dist/components/story-thread/story-thread-core.d.ts +119 -0
- package/dist/components/story-thread/story-thread-core.js +491 -0
- package/dist/components/story-thread/types.d.ts +1 -0
- package/dist/components/sun-switch/SunSwitch.vue.d.ts +61 -0
- package/dist/components/sun-switch/SunSwitch.vue.js +7 -0
- package/dist/components/sun-switch/SunSwitch.vue2.js +559 -0
- package/dist/components/sun-switch/index.d.ts +4 -0
- package/dist/components/sun-switch/pixel-wave-core.d.ts +82 -0
- package/dist/components/sun-switch/pixel-wave-core.js +508 -0
- package/dist/components/sun-switch/sun-switch-core.d.ts +251 -0
- package/dist/components/sun-switch/sun-switch-core.js +546 -0
- package/dist/components/sun-switch/sun-switch-hdr.d.ts +70 -0
- package/dist/components/sun-switch/sun-switch-hdr.js +311 -0
- package/dist/components/switch/Switch.vue.d.ts +2 -0
- package/dist/components/switch/Switch.vue.js +1 -1
- package/dist/components/switch/Switch.vue2.js +16 -6
- package/dist/components/tabs/TabsTrigger.vue.d.ts +6 -0
- package/dist/components/tabs/TabsTrigger.vue.js +1 -1
- package/dist/components/tabs/TabsTrigger.vue2.js +28 -15
- package/dist/components/terminal-block/TerminalBlock.vue.js +1 -1
- package/dist/components/terminal-block/TerminalBlock.vue2.js +10 -9
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +1 -2
- package/dist/components/textarea/Textarea.vue.js +1 -1
- package/dist/components/textarea/Textarea.vue2.js +19 -12
- package/dist/components/tick-nav/TickNav.vue.d.ts +71 -0
- package/dist/components/tick-nav/TickNav.vue.js +7 -0
- package/dist/components/tick-nav/TickNav.vue2.js +285 -0
- package/dist/components/tick-nav/index.d.ts +3 -0
- package/dist/components/tick-nav/tick-nav-core.d.ts +102 -0
- package/dist/components/tick-nav/tick-nav-core.js +398 -0
- package/dist/components/tick-nav/tick-nav-hdr.d.ts +60 -0
- package/dist/components/tick-nav/tick-nav-hdr.js +284 -0
- package/dist/components/tick-nav/types.d.ts +13 -0
- package/dist/components/time-picker/TimePicker.vue.js +1 -1
- package/dist/components/time-picker/TimePicker.vue2.js +25 -17
- package/dist/components/toast/Toast.vue.js +1 -1
- package/dist/components/toast/Toast.vue2.js +16 -4
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/store.d.ts +23 -0
- package/dist/components/toast/store.js +35 -7
- package/dist/components/toggle/Toggle.vue.d.ts +12 -0
- package/dist/components/toggle/Toggle.vue.js +1 -1
- package/dist/components/toggle/Toggle.vue2.js +27 -11
- package/dist/components/toggle-group/ToggleGroup.vue.d.ts +11 -0
- package/dist/components/toggle-group/ToggleGroup.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.vue2.js +16 -3
- package/dist/components/toggle-group/ToggleGroupItem.vue.d.ts +6 -0
- package/dist/components/toggle-group/ToggleGroupItem.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroupItem.vue2.js +27 -14
- package/dist/components/tooltip/Tooltip.vue.js +13 -0
- package/dist/components/tracing-beam/TracingBeam.vue.d.ts +20 -1
- package/dist/components/tracing-beam/TracingBeam.vue.js +5 -164
- package/dist/components/tracing-beam/TracingBeam.vue2.js +168 -1
- package/dist/components/typing-indicator/TypingIndicator.vue.js +1 -1
- package/dist/components/typing-indicator/TypingIndicator.vue2.js +7 -6
- package/dist/index.d.ts +10 -0
- package/dist/index.js +466 -413
- package/dist/internals/anchor-position.js +3 -0
- package/dist/internals/call-listener.d.ts +11 -0
- package/dist/internals/call-listener.js +31 -0
- package/dist/internals/dismissable.d.ts +17 -0
- package/dist/internals/dismissable.js +44 -1
- package/dist/internals/env.d.ts +1 -0
- package/dist/internals/env.js +11 -0
- package/dist/internals/focus-trap.js +29 -4
- package/dist/internals/merge-ids.d.ts +6 -0
- package/dist/internals/merge-ids.js +11 -0
- package/dist/internals/motion/presence-core.d.ts +1 -1
- package/dist/sound/engine.js +23 -9
- package/dist/sound/themes.d.ts +4 -3
- package/dist/sound/themes.js +49 -211
- package/dist/sound/types.d.ts +9 -1
- package/dist/sound/types.js +2 -2
- package/dist/styles.css +1473 -571
- package/package.json +2 -2
- package/tailwind.css +9 -9
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, useTemplateRef, computed, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, mergeModels, useAttrs, useModel, useTemplateRef, computed, createElementBlock, openBlock, mergeProps, unref, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
3
4
|
import { sound } from "../../sound/sound.js";
|
|
4
5
|
const _hoisted_1 = ["aria-pressed", "aria-label", "disabled"];
|
|
6
|
+
const _hoisted_2 = ["name", "value", "form"];
|
|
5
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
8
|
...{ name: "Toggle", inheritAttrs: false },
|
|
7
9
|
__name: "Toggle",
|
|
@@ -12,13 +14,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
14
|
variant: { default: "ghost" },
|
|
13
15
|
label: {},
|
|
14
16
|
class: { type: [Boolean, null, String, Object, Array] },
|
|
15
|
-
sound: { type: Boolean, default: false }
|
|
17
|
+
sound: { type: Boolean, default: false },
|
|
18
|
+
name: {},
|
|
19
|
+
value: {},
|
|
20
|
+
form: {},
|
|
21
|
+
onClick: {}
|
|
16
22
|
}, {
|
|
17
23
|
"pressed": { type: Boolean, ...{ default: false } },
|
|
18
24
|
"pressedModifiers": {}
|
|
19
25
|
}),
|
|
20
26
|
emits: ["update:pressed"],
|
|
21
27
|
setup(__props, { expose: __expose }) {
|
|
28
|
+
const attrs = useAttrs();
|
|
22
29
|
const props = __props;
|
|
23
30
|
const pressed = useModel(__props, "pressed");
|
|
24
31
|
const ref = useTemplateRef("ref");
|
|
@@ -44,26 +51,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
51
|
props.class
|
|
45
52
|
)
|
|
46
53
|
);
|
|
47
|
-
function toggle() {
|
|
54
|
+
function toggle(event) {
|
|
48
55
|
if (props.disabled) return;
|
|
49
56
|
const next = !pressed.value;
|
|
50
57
|
pressed.value = next;
|
|
51
58
|
if (props.sound) sound.play(next ? "toggle-on" : "toggle-off");
|
|
52
59
|
props.onPressedChange?.(next);
|
|
60
|
+
callListener(props.onClick, event);
|
|
53
61
|
}
|
|
54
62
|
return (_ctx, _cache) => {
|
|
55
|
-
return openBlock(), createElementBlock("button", {
|
|
63
|
+
return openBlock(), createElementBlock("button", mergeProps({
|
|
56
64
|
ref_key: "ref",
|
|
57
65
|
ref,
|
|
66
|
+
onClick: toggle
|
|
67
|
+
}, unref(attrs), {
|
|
58
68
|
type: "button",
|
|
59
|
-
class:
|
|
69
|
+
class: classes.value,
|
|
60
70
|
"aria-pressed": pressed.value,
|
|
61
|
-
"aria-label": __props.label,
|
|
62
|
-
disabled: __props.disabled
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
"aria-label": __props.label ?? unref(attrs)["aria-label"],
|
|
72
|
+
disabled: __props.disabled
|
|
73
|
+
}), [
|
|
74
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
75
|
+
__props.name && pressed.value && !__props.disabled ? (openBlock(), createElementBlock("input", {
|
|
76
|
+
key: 0,
|
|
77
|
+
type: "hidden",
|
|
78
|
+
name: __props.name,
|
|
79
|
+
value: __props.value ?? "on",
|
|
80
|
+
form: __props.form
|
|
81
|
+
}, null, 8, _hoisted_2)) : createCommentVNode("", true)
|
|
82
|
+
], 16, _hoisted_1);
|
|
67
83
|
};
|
|
68
84
|
}
|
|
69
85
|
});
|
|
@@ -19,6 +19,17 @@ export interface ToggleGroupProps {
|
|
|
19
19
|
* default; only audible once the user has enabled sound.
|
|
20
20
|
*/
|
|
21
21
|
sound?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Form field name. When set, one hidden input named `name` is rendered per
|
|
24
|
+
* selected value, so a single group submits its value and a multiple group
|
|
25
|
+
* submits every selected one. Items are `type="button"` and never submit.
|
|
26
|
+
* A disabled group submits nothing. The selection is the group's data, so a
|
|
27
|
+
* selected item that is disabled on its own still submits: disabling an item
|
|
28
|
+
* locks that choice, it does not retract it.
|
|
29
|
+
*/
|
|
30
|
+
name?: string;
|
|
31
|
+
/** `id` of the `<form>` the hidden inputs belong to, when not nested in it. */
|
|
32
|
+
form?: string;
|
|
22
33
|
}
|
|
23
34
|
declare const _default: typeof __VLS_export;
|
|
24
35
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./ToggleGroup.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const ToggleGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const ToggleGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d179c149"]]);
|
|
5
5
|
export {
|
|
6
6
|
ToggleGroup as default
|
|
7
7
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, useModel, useTemplateRef, computed, ref, createElementBlock, openBlock, normalizeClass, unref, renderSlot } from "vue";
|
|
1
|
+
import { defineComponent, mergeModels, useModel, useTemplateRef, computed, ref, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createCommentVNode, Fragment, renderList } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
3
|
import { sound } from "../../sound/sound.js";
|
|
4
4
|
import { TOGGLE_GROUP_KEY } from "./types.js";
|
|
5
5
|
const _hoisted_1 = ["data-orientation", "aria-label"];
|
|
6
|
+
const _hoisted_2 = ["name", "value", "form", "disabled"];
|
|
6
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
8
|
...{ name: "ToggleGroup", inheritAttrs: false },
|
|
8
9
|
__name: "ToggleGroup",
|
|
@@ -14,7 +15,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
15
|
orientation: { default: "horizontal" },
|
|
15
16
|
label: {},
|
|
16
17
|
class: { type: [Boolean, null, String, Object, Array] },
|
|
17
|
-
sound: { type: Boolean, default: false }
|
|
18
|
+
sound: { type: Boolean, default: false },
|
|
19
|
+
name: { default: () => void 0 },
|
|
20
|
+
form: { default: () => void 0 }
|
|
18
21
|
}, {
|
|
19
22
|
"value": { default: "" },
|
|
20
23
|
"valueModifiers": {}
|
|
@@ -140,7 +143,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
140
143
|
role: "group",
|
|
141
144
|
"aria-label": __props.label
|
|
142
145
|
}, [
|
|
143
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
146
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
147
|
+
__props.name ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selected.value, (picked) => {
|
|
148
|
+
return openBlock(), createElementBlock("input", {
|
|
149
|
+
key: picked,
|
|
150
|
+
type: "hidden",
|
|
151
|
+
name: __props.name,
|
|
152
|
+
value: picked,
|
|
153
|
+
form: __props.form,
|
|
154
|
+
disabled: __props.disabled || void 0
|
|
155
|
+
}, null, 8, _hoisted_2);
|
|
156
|
+
}), 128)) : createCommentVNode("", true)
|
|
144
157
|
], 10, _hoisted_1);
|
|
145
158
|
};
|
|
146
159
|
}
|
|
@@ -8,6 +8,12 @@ export interface ToggleGroupItemProps {
|
|
|
8
8
|
label?: string;
|
|
9
9
|
/** Additional CSS classes */
|
|
10
10
|
class?: HTMLAttributes["class"];
|
|
11
|
+
/** Called after the component's own handling, never while disabled. */
|
|
12
|
+
onClick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
13
|
+
/** Called after the component's own handling, never while disabled. */
|
|
14
|
+
onFocus?: ((event: FocusEvent) => void) | ((event: FocusEvent) => void)[];
|
|
15
|
+
/** Called after the component's own handling, never while disabled. */
|
|
16
|
+
onKeydown?: ((event: KeyboardEvent) => void) | ((event: KeyboardEvent) => void)[];
|
|
11
17
|
}
|
|
12
18
|
declare const _default: typeof __VLS_export;
|
|
13
19
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./ToggleGroupItem.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const ToggleGroupItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const ToggleGroupItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-463035bc"]]);
|
|
5
5
|
export {
|
|
6
6
|
ToggleGroupItem as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, computed, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, mergeProps, unref, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
3
4
|
import { TOGGLE_GROUP_KEY } from "./types.js";
|
|
4
5
|
const _hoisted_1 = ["data-value", "data-size", "disabled", "aria-pressed", "aria-label", "tabindex"];
|
|
@@ -9,9 +10,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9
10
|
value: {},
|
|
10
11
|
disabled: { type: Boolean, default: false },
|
|
11
12
|
label: {},
|
|
12
|
-
class: { type: [Boolean, null, String, Object, Array] }
|
|
13
|
+
class: { type: [Boolean, null, String, Object, Array] },
|
|
14
|
+
onClick: { type: [Function, Array] },
|
|
15
|
+
onFocus: { type: [Function, Array] },
|
|
16
|
+
onKeydown: { type: [Function, Array] }
|
|
13
17
|
},
|
|
14
18
|
setup(__props, { expose: __expose }) {
|
|
19
|
+
const attrs = useAttrs();
|
|
15
20
|
const el = useTemplateRef("el");
|
|
16
21
|
__expose({ ref: el });
|
|
17
22
|
const group = TOGGLE_GROUP_KEY.useOptional();
|
|
@@ -60,18 +65,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
65
|
},
|
|
61
66
|
{ flush: "post" }
|
|
62
67
|
);
|
|
63
|
-
function handleClick() {
|
|
68
|
+
function handleClick(event) {
|
|
64
69
|
if (isDisabled.value) return;
|
|
65
70
|
group?.toggle(__props.value);
|
|
66
71
|
group?.focus(__props.value);
|
|
67
72
|
el.value?.focus();
|
|
73
|
+
callListener(__props.onClick, event);
|
|
68
74
|
}
|
|
69
|
-
function handleFocus() {
|
|
75
|
+
function handleFocus(event) {
|
|
70
76
|
if (isDisabled.value) return;
|
|
71
77
|
group?.focus(__props.value);
|
|
78
|
+
callListener(__props.onFocus, event);
|
|
72
79
|
}
|
|
73
80
|
function handleKeydown(event) {
|
|
74
|
-
if (
|
|
81
|
+
if (isDisabled.value) return;
|
|
82
|
+
handleNavigationKey(event);
|
|
83
|
+
callListener(__props.onKeydown, event);
|
|
84
|
+
}
|
|
85
|
+
function handleNavigationKey(event) {
|
|
86
|
+
if (!group) return;
|
|
75
87
|
switch (event.key) {
|
|
76
88
|
case "ArrowRight":
|
|
77
89
|
case "ArrowDown":
|
|
@@ -94,26 +106,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
106
|
}
|
|
95
107
|
}
|
|
96
108
|
return (_ctx, _cache) => {
|
|
97
|
-
return openBlock(), createElementBlock("button", {
|
|
109
|
+
return openBlock(), createElementBlock("button", mergeProps({
|
|
98
110
|
ref_key: "el",
|
|
99
111
|
ref: el,
|
|
112
|
+
onClick: handleClick,
|
|
113
|
+
onFocus: handleFocus,
|
|
114
|
+
onKeydown: handleKeydown
|
|
115
|
+
}, unref(attrs), {
|
|
100
116
|
type: "button",
|
|
101
117
|
"data-ft-toggle-item": "",
|
|
102
118
|
"data-value": __props.value,
|
|
103
119
|
"data-size": size.value,
|
|
104
|
-
class:
|
|
120
|
+
class: classes.value,
|
|
105
121
|
disabled: isDisabled.value,
|
|
106
122
|
"aria-pressed": isSelected.value,
|
|
107
|
-
"aria-label": __props.label,
|
|
108
|
-
tabindex: tabIndexAttr.value
|
|
109
|
-
|
|
110
|
-
onFocus: handleFocus,
|
|
111
|
-
onKeydown: handleKeydown
|
|
112
|
-
}, [
|
|
123
|
+
"aria-label": __props.label ?? unref(attrs)["aria-label"],
|
|
124
|
+
tabindex: tabIndexAttr.value ?? unref(attrs).tabindex
|
|
125
|
+
}), [
|
|
113
126
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
114
127
|
createTextVNode(toDisplayString(__props.label ?? __props.value), 1)
|
|
115
128
|
], true)
|
|
116
|
-
],
|
|
129
|
+
], 16, _hoisted_1);
|
|
117
130
|
};
|
|
118
131
|
}
|
|
119
132
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, shallowRef, useTemplateRef, watch, onBeforeUnmount, computed, createElementBlock, openBlock, Fragment, createElementVNode, createBlock, createCommentVNode, normalizeClass, renderSlot, withCtx, normalizeStyle, unref, toDisplayString } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
|
+
import { isDev } from "../../internals/env.js";
|
|
3
4
|
import _sfc_main$1 from "../../internals/Portal.vue.js";
|
|
4
5
|
import { useFancyId } from "../../internals/use-id.js";
|
|
5
6
|
import { useAnchorPosition } from "../../internals/use-anchor-position.js";
|
|
@@ -7,6 +8,13 @@ import { useDismissable } from "../../internals/use-dismissable.js";
|
|
|
7
8
|
import { anchored, originFor } from "../../internals/motion/anchored.js";
|
|
8
9
|
import { runTransition } from "../../internals/motion/animate.js";
|
|
9
10
|
const _hoisted_1 = ["id", "data-side", "data-align"];
|
|
11
|
+
function isFocusable(el) {
|
|
12
|
+
if (el.disabled) return false;
|
|
13
|
+
if (["BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(el.tagName)) return true;
|
|
14
|
+
if (el.tagName === "A" && el.hasAttribute("href")) return true;
|
|
15
|
+
const tabindex = el.getAttribute("tabindex");
|
|
16
|
+
return tabindex !== null && tabindex !== "-1";
|
|
17
|
+
}
|
|
10
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
19
|
...{ name: "Tooltip", inheritAttrs: false },
|
|
12
20
|
__name: "Tooltip",
|
|
@@ -137,6 +145,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
137
145
|
updateVisibility();
|
|
138
146
|
}
|
|
139
147
|
if (!el) return;
|
|
148
|
+
if (isDev && !isFocusable(el)) {
|
|
149
|
+
console.warn(
|
|
150
|
+
"[Tooltip] The first element rendered by `children` is not focusable, so this tooltip is unreachable by keyboard even though it will still open on hover. Render a real interactive element (a <button>, <a href>, or similar) as the first thing inside `children`."
|
|
151
|
+
);
|
|
152
|
+
}
|
|
140
153
|
el.addEventListener("pointerenter", handlePointerEnter);
|
|
141
154
|
el.addEventListener("pointerleave", handlePointerLeave);
|
|
142
155
|
el.addEventListener("focus", handleFocus);
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import type { HTMLAttributes } from "vue";
|
|
2
2
|
export interface TracingBeamProps {
|
|
3
|
-
/** Additional CSS classes */
|
|
3
|
+
/** Additional CSS classes for the outer wrapper */
|
|
4
4
|
class?: HTMLAttributes["class"];
|
|
5
|
+
/**
|
|
6
|
+
* Colour of the lamp, its trail and the lit markers. Any CSS colour.
|
|
7
|
+
* Unset, it follows the theme's `--primary` token and falls back to a
|
|
8
|
+
* soft violet when no theme is present. Also settable from CSS via
|
|
9
|
+
* `--tracing-beam-accent`.
|
|
10
|
+
*/
|
|
11
|
+
accent?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Where the reader's eye is assumed to be, as a fraction of the viewport
|
|
14
|
+
* height from the top. The lamp sits on that line, clamped to the content.
|
|
15
|
+
*/
|
|
16
|
+
readingLine?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Draw a marker on the rail for every heading (`h1`–`h4`) inside the
|
|
19
|
+
* content — or, when there is none, for every direct child. Markers light
|
|
20
|
+
* up as the lamp passes them.
|
|
21
|
+
*/
|
|
22
|
+
markers?: boolean;
|
|
5
23
|
}
|
|
6
24
|
declare const _default: typeof __VLS_export;
|
|
7
25
|
export default _default;
|
|
8
26
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<TracingBeamProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TracingBeamProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
27
|
+
/** Long-form content the beam reads alongside */
|
|
9
28
|
default?(): unknown;
|
|
10
29
|
}>;
|
|
11
30
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,166 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const _hoisted_2 = ["viewBox", "height"];
|
|
6
|
-
const _hoisted_3 = ["d"];
|
|
7
|
-
const _hoisted_4 = ["d", "stroke"];
|
|
8
|
-
const _hoisted_5 = ["y1", "y2"];
|
|
9
|
-
function mapRange(value, inMin, inMax, outMin, outMax) {
|
|
10
|
-
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
11
|
-
}
|
|
12
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
-
...{ name: "TracingBeam", inheritAttrs: false },
|
|
14
|
-
__name: "TracingBeam",
|
|
15
|
-
props: {
|
|
16
|
-
class: { type: [Boolean, null, String, Object, Array], default: "" }
|
|
17
|
-
},
|
|
18
|
-
setup(__props) {
|
|
19
|
-
const gradientId = `${useFancyId()}-gradient`;
|
|
20
|
-
const tracingBeamRef = useTemplateRef("tracingBeamRef");
|
|
21
|
-
const contentRef = useTemplateRef("contentRef");
|
|
22
|
-
const svgHeight = ref(0);
|
|
23
|
-
const scrollYProgress = ref(0);
|
|
24
|
-
const scrollPercentage = ref(0);
|
|
25
|
-
const springY1 = ref(0);
|
|
26
|
-
const springY2 = ref(0);
|
|
27
|
-
let springVelY1 = 0;
|
|
28
|
-
let springVelY2 = 0;
|
|
29
|
-
const targetY1 = computed(
|
|
30
|
-
() => mapRange(scrollYProgress.value, 0, 0.8, scrollYProgress.value, svgHeight.value) * (1.4 - scrollPercentage.value)
|
|
31
|
-
);
|
|
32
|
-
const targetY2 = computed(
|
|
33
|
-
() => mapRange(scrollYProgress.value, 0, 1, scrollYProgress.value, svgHeight.value - 500) * (1.4 - scrollPercentage.value)
|
|
34
|
-
);
|
|
35
|
-
const circleHasShadow = computed(() => scrollYProgress.value <= 0);
|
|
36
|
-
const circleBg = computed(() => scrollYProgress.value > 0 ? "bg-white" : "bg-emerald-500");
|
|
37
|
-
const circleBorder = computed(
|
|
38
|
-
() => scrollYProgress.value > 0 ? "border-neutral-300" : "border-emerald-600"
|
|
39
|
-
);
|
|
40
|
-
const svgPath = computed(
|
|
41
|
-
() => `M 1 0V -36 l 18 24 V ${svgHeight.value * 0.8} l -18 24V ${svgHeight.value}`
|
|
42
|
-
);
|
|
43
|
-
let rafId = 0;
|
|
44
|
-
function updateSpring() {
|
|
45
|
-
const tension = 80;
|
|
46
|
-
const friction = 26;
|
|
47
|
-
const precision = 0.01;
|
|
48
|
-
const forceY1 = tension * (targetY1.value - springY1.value);
|
|
49
|
-
springVelY1 = (springVelY1 + forceY1 * 1e-3) * (1 - friction * 1e-3);
|
|
50
|
-
springY1.value += springVelY1;
|
|
51
|
-
const forceY2 = tension * (targetY2.value - springY2.value);
|
|
52
|
-
springVelY2 = (springVelY2 + forceY2 * 1e-3) * (1 - friction * 1e-3);
|
|
53
|
-
springY2.value += springVelY2;
|
|
54
|
-
const settled = Math.abs(springVelY1) < precision && Math.abs(targetY1.value - springY1.value) < precision && Math.abs(springVelY2) < precision && Math.abs(targetY2.value - springY2.value) < precision;
|
|
55
|
-
if (!settled) {
|
|
56
|
-
rafId = requestAnimationFrame(updateSpring);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function updateScrollProgress() {
|
|
60
|
-
const el = tracingBeamRef.value;
|
|
61
|
-
if (!el) return;
|
|
62
|
-
const rect = el.getBoundingClientRect();
|
|
63
|
-
const windowHeight = window.innerHeight;
|
|
64
|
-
const elementHeight = rect.height;
|
|
65
|
-
scrollPercentage.value = (windowHeight - rect.top) / (windowHeight + elementHeight);
|
|
66
|
-
scrollYProgress.value = rect.y / windowHeight * -1;
|
|
67
|
-
cancelAnimationFrame(rafId);
|
|
68
|
-
rafId = requestAnimationFrame(updateSpring);
|
|
69
|
-
}
|
|
70
|
-
function updateSVGHeight() {
|
|
71
|
-
const el = contentRef.value;
|
|
72
|
-
if (!el) return;
|
|
73
|
-
svgHeight.value = el.offsetHeight;
|
|
74
|
-
}
|
|
75
|
-
let resizeObserver;
|
|
76
|
-
onMounted(() => {
|
|
77
|
-
window.addEventListener("scroll", updateScrollProgress, { passive: true });
|
|
78
|
-
window.addEventListener("resize", updateScrollProgress, { passive: true });
|
|
79
|
-
updateScrollProgress();
|
|
80
|
-
resizeObserver = new ResizeObserver(updateSVGHeight);
|
|
81
|
-
if (contentRef.value) {
|
|
82
|
-
resizeObserver.observe(contentRef.value);
|
|
83
|
-
}
|
|
84
|
-
updateSVGHeight();
|
|
85
|
-
});
|
|
86
|
-
onBeforeUnmount(() => {
|
|
87
|
-
cancelAnimationFrame(rafId);
|
|
88
|
-
window.removeEventListener("scroll", updateScrollProgress);
|
|
89
|
-
window.removeEventListener("resize", updateScrollProgress);
|
|
90
|
-
resizeObserver?.disconnect();
|
|
91
|
-
});
|
|
92
|
-
return (_ctx, _cache) => {
|
|
93
|
-
return openBlock(), createElementBlock("div", {
|
|
94
|
-
ref_key: "tracingBeamRef",
|
|
95
|
-
ref: tracingBeamRef,
|
|
96
|
-
class: normalizeClass(unref(cn)("relative mx-auto h-full w-full max-w-4xl", __props.class))
|
|
97
|
-
}, [
|
|
98
|
-
createElementVNode("div", _hoisted_1, [
|
|
99
|
-
createElementVNode("div", {
|
|
100
|
-
class: "ml-[27px] flex size-4 items-center justify-center rounded-full border border-neutral-200 shadow-sm",
|
|
101
|
-
style: normalizeStyle({ boxShadow: circleHasShadow.value ? "rgba(0, 0, 0, 0.24) 0px 3px 8px" : "none" })
|
|
102
|
-
}, [
|
|
103
|
-
createElementVNode("div", {
|
|
104
|
-
class: normalizeClass(unref(cn)("size-2 rounded-full border", circleBg.value, circleBorder.value))
|
|
105
|
-
}, null, 2)
|
|
106
|
-
], 4),
|
|
107
|
-
(openBlock(), createElementBlock("svg", {
|
|
108
|
-
viewBox: `0 0 20 ${svgHeight.value}`,
|
|
109
|
-
width: "20",
|
|
110
|
-
height: svgHeight.value,
|
|
111
|
-
class: "ml-4 block",
|
|
112
|
-
"aria-hidden": "true"
|
|
113
|
-
}, [
|
|
114
|
-
createElementVNode("path", {
|
|
115
|
-
d: svgPath.value,
|
|
116
|
-
fill: "none",
|
|
117
|
-
stroke: "#9091A0",
|
|
118
|
-
"stroke-opacity": "0.16"
|
|
119
|
-
}, null, 8, _hoisted_3),
|
|
120
|
-
createElementVNode("path", {
|
|
121
|
-
d: svgPath.value,
|
|
122
|
-
fill: "none",
|
|
123
|
-
stroke: `url(#${gradientId})`,
|
|
124
|
-
"stroke-width": "1.25",
|
|
125
|
-
class: "motion-reduce:hidden"
|
|
126
|
-
}, null, 8, _hoisted_4),
|
|
127
|
-
createElementVNode("defs", null, [
|
|
128
|
-
createElementVNode("linearGradient", {
|
|
129
|
-
id: gradientId,
|
|
130
|
-
gradientUnits: "userSpaceOnUse",
|
|
131
|
-
x1: "0",
|
|
132
|
-
x2: "0",
|
|
133
|
-
y1: springY1.value,
|
|
134
|
-
y2: springY2.value
|
|
135
|
-
}, [..._cache[0] || (_cache[0] = [
|
|
136
|
-
createElementVNode("stop", {
|
|
137
|
-
"stop-color": "#18CCFC",
|
|
138
|
-
"stop-opacity": "0"
|
|
139
|
-
}, null, -1),
|
|
140
|
-
createElementVNode("stop", { "stop-color": "#18CCFC" }, null, -1),
|
|
141
|
-
createElementVNode("stop", {
|
|
142
|
-
offset: "0.325",
|
|
143
|
-
"stop-color": "#6344F5"
|
|
144
|
-
}, null, -1),
|
|
145
|
-
createElementVNode("stop", {
|
|
146
|
-
offset: "1",
|
|
147
|
-
"stop-color": "#AE48FF",
|
|
148
|
-
"stop-opacity": "0"
|
|
149
|
-
}, null, -1)
|
|
150
|
-
])], 8, _hoisted_5)
|
|
151
|
-
])
|
|
152
|
-
], 8, _hoisted_2))
|
|
153
|
-
]),
|
|
154
|
-
createElementVNode("div", {
|
|
155
|
-
ref_key: "contentRef",
|
|
156
|
-
ref: contentRef
|
|
157
|
-
}, [
|
|
158
|
-
renderSlot(_ctx.$slots, "default")
|
|
159
|
-
], 512)
|
|
160
|
-
], 2);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
1
|
+
import _sfc_main from "./TracingBeam.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const TracingBeam = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-297de2d4"]]);
|
|
164
5
|
export {
|
|
165
|
-
|
|
6
|
+
TracingBeam as default
|
|
166
7
|
};
|
|
@@ -1,4 +1,171 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, useTemplateRef, ref, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, Fragment, renderList, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { rafThrottle } from "../../internals/motion/raf.js";
|
|
4
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
5
|
+
const _hoisted_1 = ["data-motion"];
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
class: "tb-gutter",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = ["data-lit"];
|
|
11
|
+
const _hoisted_4 = ["data-ready"];
|
|
12
|
+
const TENSION = 120;
|
|
13
|
+
const FRICTION = 22;
|
|
14
|
+
const PRECISION = 0.05;
|
|
15
|
+
const MAX_DT = 1 / 30;
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...{ name: "TracingBeam", inheritAttrs: false },
|
|
18
|
+
__name: "TracingBeam",
|
|
19
|
+
props: {
|
|
20
|
+
class: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
21
|
+
accent: {},
|
|
22
|
+
readingLine: { default: 0.38 },
|
|
23
|
+
markers: { type: Boolean, default: true }
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
const reduced = useReducedMotion();
|
|
27
|
+
const contentRef = useTemplateRef("contentRef");
|
|
28
|
+
const height = ref(0);
|
|
29
|
+
const ticks = ref([]);
|
|
30
|
+
const head = ref(0);
|
|
31
|
+
const ready = ref(false);
|
|
32
|
+
let target = 0;
|
|
33
|
+
let velocity = 0;
|
|
34
|
+
let rafId = 0;
|
|
35
|
+
let lastTime = 0;
|
|
36
|
+
function isLit(offset) {
|
|
37
|
+
return offset <= head.value + 0.5;
|
|
38
|
+
}
|
|
39
|
+
function clamp(value, min, max) {
|
|
40
|
+
return Math.min(max, Math.max(min, value));
|
|
41
|
+
}
|
|
42
|
+
function localScale(el, rect) {
|
|
43
|
+
const layout = el.offsetHeight;
|
|
44
|
+
if (layout <= 0 || rect.height <= 0 || Math.abs(rect.height - layout) < 1) return 1;
|
|
45
|
+
return rect.height / layout;
|
|
46
|
+
}
|
|
47
|
+
function step(time) {
|
|
48
|
+
const dt = Math.min(MAX_DT, (time - lastTime) / 1e3 || 0);
|
|
49
|
+
lastTime = time;
|
|
50
|
+
const force = TENSION * (target - head.value) - FRICTION * velocity;
|
|
51
|
+
velocity += force * dt;
|
|
52
|
+
head.value += velocity * dt;
|
|
53
|
+
if (Math.abs(velocity) < PRECISION && Math.abs(target - head.value) < PRECISION) {
|
|
54
|
+
head.value = target;
|
|
55
|
+
velocity = 0;
|
|
56
|
+
rafId = 0;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
rafId = requestAnimationFrame(step);
|
|
60
|
+
}
|
|
61
|
+
function place() {
|
|
62
|
+
const el = contentRef.value;
|
|
63
|
+
if (!el) return;
|
|
64
|
+
const rect = el.getBoundingClientRect();
|
|
65
|
+
const scale = localScale(el, rect);
|
|
66
|
+
const line = window.innerHeight * clamp(__props.readingLine, 0, 1);
|
|
67
|
+
target = clamp((line - rect.top) / scale, 0, Math.max(0, rect.height / scale));
|
|
68
|
+
ready.value = true;
|
|
69
|
+
if (reduced.value) {
|
|
70
|
+
cancelAnimationFrame(rafId);
|
|
71
|
+
rafId = 0;
|
|
72
|
+
velocity = 0;
|
|
73
|
+
head.value = target;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!rafId) {
|
|
77
|
+
lastTime = performance.now();
|
|
78
|
+
rafId = requestAnimationFrame(step);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function measure() {
|
|
82
|
+
const el = contentRef.value;
|
|
83
|
+
if (!el) return;
|
|
84
|
+
const rect = el.getBoundingClientRect();
|
|
85
|
+
const scale = localScale(el, rect);
|
|
86
|
+
height.value = rect.height / scale;
|
|
87
|
+
if (__props.markers) {
|
|
88
|
+
const headings = el.querySelectorAll("h1, h2, h3, h4");
|
|
89
|
+
const anchors = headings.length ? [...headings] : [...el.children];
|
|
90
|
+
ticks.value = anchors.filter((node) => node instanceof HTMLElement).map((node) => {
|
|
91
|
+
const box = node.getBoundingClientRect();
|
|
92
|
+
return (box.top + box.height / 2 - rect.top) / scale;
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
ticks.value = [];
|
|
96
|
+
}
|
|
97
|
+
place();
|
|
98
|
+
}
|
|
99
|
+
onMounted(() => {
|
|
100
|
+
const onScroll = rafThrottle(place);
|
|
101
|
+
const onResize = rafThrottle(measure);
|
|
102
|
+
const resizeObserver = new ResizeObserver(() => onResize());
|
|
103
|
+
if (contentRef.value) resizeObserver.observe(contentRef.value);
|
|
104
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
105
|
+
window.addEventListener("resize", onResize, { passive: true });
|
|
106
|
+
measure();
|
|
107
|
+
onBeforeUnmount(() => {
|
|
108
|
+
onScroll.cancel();
|
|
109
|
+
onResize.cancel();
|
|
110
|
+
cancelAnimationFrame(rafId);
|
|
111
|
+
rafId = 0;
|
|
112
|
+
resizeObserver.disconnect();
|
|
113
|
+
window.removeEventListener("scroll", onScroll);
|
|
114
|
+
window.removeEventListener("resize", onResize);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
watch(
|
|
118
|
+
() => [__props.markers, __props.readingLine, reduced.value],
|
|
119
|
+
() => {
|
|
120
|
+
if (contentRef.value) queueMicrotask(measure);
|
|
121
|
+
},
|
|
122
|
+
{ flush: "post" }
|
|
123
|
+
);
|
|
124
|
+
return (_ctx, _cache) => {
|
|
125
|
+
return openBlock(), createElementBlock("div", {
|
|
126
|
+
class: normalizeClass(unref(cn)("tb-root relative mx-auto w-full max-w-4xl", __props.class)),
|
|
127
|
+
style: normalizeStyle({
|
|
128
|
+
"--tracing-beam-accent": __props.accent,
|
|
129
|
+
"--tb-progress": `${head.value}px`,
|
|
130
|
+
"--tb-height": `${height.value}px`
|
|
131
|
+
}),
|
|
132
|
+
"data-motion": unref(reduced) ? "reduced" : "full",
|
|
133
|
+
"data-tracing-beam": ""
|
|
134
|
+
}, [
|
|
135
|
+
createElementVNode("div", _hoisted_2, [
|
|
136
|
+
_cache[1] || (_cache[1] = createElementVNode("div", { class: "tb-rail" }, [
|
|
137
|
+
createElementVNode("span", { class: "tb-hair" }),
|
|
138
|
+
createElementVNode("span", { class: "tb-trail" })
|
|
139
|
+
], -1)),
|
|
140
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(ticks.value, (offset, index) => {
|
|
141
|
+
return openBlock(), createElementBlock("span", {
|
|
142
|
+
key: index,
|
|
143
|
+
class: "tb-tick",
|
|
144
|
+
style: normalizeStyle({ top: `${offset}px` }),
|
|
145
|
+
"data-tracing-beam-marker": "",
|
|
146
|
+
"data-lit": String(isLit(offset))
|
|
147
|
+
}, null, 12, _hoisted_3);
|
|
148
|
+
}), 128)),
|
|
149
|
+
createElementVNode("div", {
|
|
150
|
+
class: "tb-head",
|
|
151
|
+
"data-tracing-beam-head": "",
|
|
152
|
+
"data-ready": String(ready.value)
|
|
153
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
154
|
+
createElementVNode("span", { class: "tb-spill" }, null, -1),
|
|
155
|
+
createElementVNode("span", { class: "tb-lamp" }, null, -1)
|
|
156
|
+
])], 8, _hoisted_4)
|
|
157
|
+
]),
|
|
158
|
+
createElementVNode("div", {
|
|
159
|
+
ref_key: "contentRef",
|
|
160
|
+
ref: contentRef,
|
|
161
|
+
class: "tb-content"
|
|
162
|
+
}, [
|
|
163
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
164
|
+
], 512)
|
|
165
|
+
], 14, _hoisted_1);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
2
169
|
export {
|
|
3
170
|
_sfc_main as default
|
|
4
171
|
};
|