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,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, computed, createElementBlock, openBlock, mergeProps, unref, renderSlot, createCommentVNode, createElementVNode } from "vue";
|
|
2
2
|
import { cn } from "../../utils.js";
|
|
3
3
|
import { useSoundCue } from "../../sound/use-sound.js";
|
|
4
4
|
const _hoisted_1 = ["href", "target", "aria-label", "rel"];
|
|
@@ -41,14 +41,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
41
|
playCue("press");
|
|
42
42
|
}
|
|
43
43
|
return (_ctx, _cache) => {
|
|
44
|
-
return openBlock(), createElementBlock("a", {
|
|
44
|
+
return openBlock(), createElementBlock("a", mergeProps({ onClick: handleClick }, _ctx.$attrs, {
|
|
45
45
|
href: __props.href,
|
|
46
46
|
target: __props.target,
|
|
47
47
|
"aria-label": __props.ariaLabel,
|
|
48
48
|
rel: relValue.value,
|
|
49
|
-
class:
|
|
50
|
-
|
|
51
|
-
}, [
|
|
49
|
+
class: unref(cn)("link-hover", `link-hover--${__props.variant}`, __props.class)
|
|
50
|
+
}), [
|
|
52
51
|
needsSpan.value ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
53
52
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
54
53
|
])) : renderSlot(_ctx.$slots, "default", {}, void 0, true, 1),
|
|
@@ -63,7 +62,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
63
62
|
pathLength: "1"
|
|
64
63
|
}, null, -1)
|
|
65
64
|
])])) : createCommentVNode("", true)
|
|
66
|
-
],
|
|
65
|
+
], 16, _hoisted_1);
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
});
|
|
@@ -15,8 +15,10 @@ export interface LinkProps {
|
|
|
15
15
|
* required whenever `target` opens a new browsing context — any value other than
|
|
16
16
|
* `_self`, `_parent`, or `_top` (case-insensitively), not just `_blank` */
|
|
17
17
|
rel?: string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/** Click handler, called after the sound cue. `@click` reaches it. */
|
|
19
|
+
onClick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
20
|
+
/** @deprecated Use `@click` / `onClick`. Only called when `onClick` is absent. */
|
|
21
|
+
onclick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
20
22
|
/** Additional CSS classes */
|
|
21
23
|
class?: HTMLAttributes["class"];
|
|
22
24
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./Link.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const Link = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const Link = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-615ee652"]]);
|
|
5
5
|
export {
|
|
6
6
|
Link as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, computed, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, useTemplateRef, computed, createElementBlock, openBlock, mergeProps, renderSlot, createCommentVNode, Fragment, createElementVNode, toDisplayString } 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 = ["href", "target", "rel"];
|
|
@@ -12,7 +13,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
13
|
underline: { default: "hover" },
|
|
13
14
|
target: {},
|
|
14
15
|
rel: {},
|
|
15
|
-
|
|
16
|
+
onClick: { type: [Function, Array] },
|
|
17
|
+
onclick: { type: [Function, Array] },
|
|
16
18
|
class: { type: [Boolean, null, String, Object, Array] },
|
|
17
19
|
sound: { type: Boolean, default: false }
|
|
18
20
|
},
|
|
@@ -41,18 +43,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
43
|
);
|
|
42
44
|
function handleClick(event) {
|
|
43
45
|
if (__props.sound) sound.play("press");
|
|
44
|
-
__props.onclick
|
|
46
|
+
callListener(__props.onClick ?? __props.onclick, event);
|
|
45
47
|
}
|
|
46
48
|
return (_ctx, _cache) => {
|
|
47
|
-
return openBlock(), createElementBlock("a", {
|
|
49
|
+
return openBlock(), createElementBlock("a", mergeProps({
|
|
48
50
|
ref_key: "el",
|
|
49
51
|
ref: el,
|
|
52
|
+
onClick: handleClick
|
|
53
|
+
}, _ctx.$attrs, {
|
|
50
54
|
href: __props.href,
|
|
51
55
|
target: computedTarget.value,
|
|
52
56
|
rel: computedRel.value,
|
|
53
|
-
class:
|
|
54
|
-
|
|
55
|
-
}, [
|
|
57
|
+
class: classes.value
|
|
58
|
+
}), [
|
|
56
59
|
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
57
60
|
__props.external ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
58
61
|
_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
@@ -72,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
72
75
|
], -1)),
|
|
73
76
|
_cache[1] || (_cache[1] = createElementVNode("span", { class: "sr-only" }, toDisplayString(" ") + "(opens in a new tab)", -1))
|
|
74
77
|
], 64)) : createCommentVNode("", true)
|
|
75
|
-
],
|
|
78
|
+
], 16, _hoisted_1);
|
|
76
79
|
};
|
|
77
80
|
}
|
|
78
81
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
import type { MagneticPoint } from "./magnetic-field-core.js";
|
|
3
|
+
/**
|
|
4
|
+
* The puck's centre is the `position` model (`v-model:position`): in px,
|
|
5
|
+
* relative to its positioned parent (the field's padding box when it sits
|
|
6
|
+
* inside a `MagneticField`, where the field must be that parent: no
|
|
7
|
+
* positioned element in between). Dragging and the arrow keys update it.
|
|
8
|
+
*/
|
|
9
|
+
export interface MagnetPuckProps {
|
|
10
|
+
/** Called with each new position while the puck is dragged or moved with the keyboard. */
|
|
11
|
+
onPositionChange?: (position: MagneticPoint) => void;
|
|
12
|
+
/** Diameter in px. */
|
|
13
|
+
size?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the puck keeps attracting once released. By default it attracts
|
|
16
|
+
* only while held, and the items spring back when it is let go.
|
|
17
|
+
*/
|
|
18
|
+
sticky?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Accessible name. The puck is also described by a built-in hint naming
|
|
21
|
+
* its keys; pass `aria-describedby` to replace it.
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/** Called when the puck is picked up (pointer down, or Space/Enter) and put down. */
|
|
25
|
+
onHeldChange?: (held: boolean) => void;
|
|
26
|
+
/** Additional CSS classes. */
|
|
27
|
+
class?: HTMLAttributes["class"];
|
|
28
|
+
}
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MagnetPuckProps & {
|
|
32
|
+
/** The puck's centre, px. */
|
|
33
|
+
position?: MagneticPoint;
|
|
34
|
+
}, {
|
|
35
|
+
ref: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
36
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
"update:position": (value: MagneticPoint) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<MagnetPuckProps & {
|
|
39
|
+
/** The puck's centre, px. */
|
|
40
|
+
position?: MagneticPoint;
|
|
41
|
+
}> & Readonly<{
|
|
42
|
+
"onUpdate:position"?: ((value: MagneticPoint) => any) | undefined;
|
|
43
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
44
|
+
/** A custom face. Leave it out for the default black disc. */
|
|
45
|
+
default?(): unknown;
|
|
46
|
+
}>;
|
|
47
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./MagnetPuck.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const MagnetPuck = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-23664b5a"]]);
|
|
5
|
+
export {
|
|
6
|
+
MagnetPuck as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { defineComponent, mergeModels, useAttrs, useModel, useTemplateRef, ref, computed, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, mergeProps, unref, renderSlot, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { useFancyId } from "../../internals/use-id.js";
|
|
4
|
+
import { MAGNETIC_FIELD_KEY } from "./types.js";
|
|
5
|
+
const _hoisted_1 = ["aria-label", "aria-describedby", "aria-pressed", "data-held"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{ name: "MagnetPuck", inheritAttrs: false },
|
|
8
|
+
__name: "MagnetPuck",
|
|
9
|
+
props: /* @__PURE__ */ mergeModels({
|
|
10
|
+
onPositionChange: { type: Function },
|
|
11
|
+
size: { default: 40 },
|
|
12
|
+
sticky: { type: Boolean, default: false },
|
|
13
|
+
label: { default: "Magnet" },
|
|
14
|
+
onHeldChange: { type: Function },
|
|
15
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
16
|
+
}, {
|
|
17
|
+
"position": { default: () => ({ x: 48, y: 48 }) },
|
|
18
|
+
"positionModifiers": {}
|
|
19
|
+
}),
|
|
20
|
+
emits: ["update:position"],
|
|
21
|
+
setup(__props, { expose: __expose }) {
|
|
22
|
+
const KEY_HINT = "Space or Enter picks it up and puts it down; the arrow keys move it.";
|
|
23
|
+
const KEY_STEP = 8;
|
|
24
|
+
const KEY_STEP_LARGE = 32;
|
|
25
|
+
const attrs = useAttrs();
|
|
26
|
+
const hintId = `${useFancyId()}-hint`;
|
|
27
|
+
const position = useModel(__props, "position");
|
|
28
|
+
const el = useTemplateRef("el");
|
|
29
|
+
__expose({ ref: el });
|
|
30
|
+
const ctx = MAGNETIC_FIELD_KEY.useOptional();
|
|
31
|
+
const holder = ref(null);
|
|
32
|
+
const held = computed(() => holder.value !== null);
|
|
33
|
+
let activePointerId = null;
|
|
34
|
+
let dragStartX = 0;
|
|
35
|
+
let dragStartY = 0;
|
|
36
|
+
let dragOrigin = { x: 0, y: 0 };
|
|
37
|
+
const puckStyle = computed(() => ({
|
|
38
|
+
width: `${__props.size}px`,
|
|
39
|
+
height: `${__props.size}px`,
|
|
40
|
+
transform: `translate3d(${position.value.x - __props.size / 2}px, ${position.value.y - __props.size / 2}px, 0)`
|
|
41
|
+
}));
|
|
42
|
+
function setHolder(next) {
|
|
43
|
+
const was = holder.value !== null;
|
|
44
|
+
holder.value = next;
|
|
45
|
+
if (was !== (next !== null)) __props.onHeldChange?.(next !== null);
|
|
46
|
+
}
|
|
47
|
+
function clampToParent(p) {
|
|
48
|
+
const node = el.value;
|
|
49
|
+
const parent = node?.offsetParent ?? node?.parentElement ?? null;
|
|
50
|
+
if (!parent) return p;
|
|
51
|
+
const half = __props.size / 2;
|
|
52
|
+
const w = parent.clientWidth;
|
|
53
|
+
const h = parent.clientHeight;
|
|
54
|
+
return {
|
|
55
|
+
x: w > 0 ? Math.min(Math.max(p.x, half), Math.max(half, w - half)) : p.x,
|
|
56
|
+
y: h > 0 ? Math.min(Math.max(p.y, half), Math.max(half, h - half)) : p.y
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function moveTo(p) {
|
|
60
|
+
const next = clampToParent(p);
|
|
61
|
+
if (next.x === position.value.x && next.y === position.value.y) return;
|
|
62
|
+
position.value = next;
|
|
63
|
+
__props.onPositionChange?.(next);
|
|
64
|
+
}
|
|
65
|
+
function releasePointer() {
|
|
66
|
+
if (activePointerId === null) return;
|
|
67
|
+
const id = activePointerId;
|
|
68
|
+
activePointerId = null;
|
|
69
|
+
el.value?.releasePointerCapture?.(id);
|
|
70
|
+
}
|
|
71
|
+
function release() {
|
|
72
|
+
releasePointer();
|
|
73
|
+
setHolder(null);
|
|
74
|
+
}
|
|
75
|
+
function handlePointerDown(event) {
|
|
76
|
+
if (event.pointerType === "mouse" && event.button !== 0) return;
|
|
77
|
+
if (activePointerId !== null) return;
|
|
78
|
+
activePointerId = event.pointerId;
|
|
79
|
+
dragStartX = event.clientX;
|
|
80
|
+
dragStartY = event.clientY;
|
|
81
|
+
dragOrigin = { x: position.value.x, y: position.value.y };
|
|
82
|
+
el.value?.setPointerCapture?.(event.pointerId);
|
|
83
|
+
setHolder("pointer");
|
|
84
|
+
}
|
|
85
|
+
function handlePointerMove(event) {
|
|
86
|
+
if (event.pointerId !== activePointerId) return;
|
|
87
|
+
moveTo({
|
|
88
|
+
x: dragOrigin.x + event.clientX - dragStartX,
|
|
89
|
+
y: dragOrigin.y + event.clientY - dragStartY
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function handlePointerEnd(event) {
|
|
93
|
+
if (event.pointerId !== activePointerId) return;
|
|
94
|
+
release();
|
|
95
|
+
}
|
|
96
|
+
function handleKeyDown(event) {
|
|
97
|
+
const step = event.shiftKey ? KEY_STEP_LARGE : KEY_STEP;
|
|
98
|
+
let dx = 0;
|
|
99
|
+
let dy = 0;
|
|
100
|
+
switch (event.key) {
|
|
101
|
+
case "ArrowLeft":
|
|
102
|
+
dx = -step;
|
|
103
|
+
break;
|
|
104
|
+
case "ArrowRight":
|
|
105
|
+
dx = step;
|
|
106
|
+
break;
|
|
107
|
+
case "ArrowUp":
|
|
108
|
+
dy = -step;
|
|
109
|
+
break;
|
|
110
|
+
case "ArrowDown":
|
|
111
|
+
dy = step;
|
|
112
|
+
break;
|
|
113
|
+
case " ":
|
|
114
|
+
case "Enter":
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
if (event.repeat) return;
|
|
117
|
+
if (held.value) release();
|
|
118
|
+
else setHolder("keyboard");
|
|
119
|
+
return;
|
|
120
|
+
case "Escape":
|
|
121
|
+
if (!held.value) return;
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
release();
|
|
124
|
+
return;
|
|
125
|
+
default:
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
moveTo({ x: position.value.x + dx, y: position.value.y + dy });
|
|
130
|
+
}
|
|
131
|
+
function handleBlur() {
|
|
132
|
+
if (holder.value === "keyboard") release();
|
|
133
|
+
}
|
|
134
|
+
function syncSource() {
|
|
135
|
+
if (!ctx) return;
|
|
136
|
+
const { x, y } = position.value;
|
|
137
|
+
ctx.setSource(held.value || __props.sticky ? { x, y } : null, "puck");
|
|
138
|
+
}
|
|
139
|
+
onMounted(syncSource);
|
|
140
|
+
watch([() => position.value.x, () => position.value.y, held, () => __props.sticky], syncSource, {
|
|
141
|
+
flush: "post"
|
|
142
|
+
});
|
|
143
|
+
watch(
|
|
144
|
+
held,
|
|
145
|
+
(isHeld, _old, onCleanup) => {
|
|
146
|
+
if (!isHeld) return;
|
|
147
|
+
const onBlur = () => release();
|
|
148
|
+
window.addEventListener("blur", onBlur);
|
|
149
|
+
onCleanup(() => window.removeEventListener("blur", onBlur));
|
|
150
|
+
},
|
|
151
|
+
{ flush: "post" }
|
|
152
|
+
);
|
|
153
|
+
onBeforeUnmount(() => ctx?.setSource(null, "puck"));
|
|
154
|
+
return (_ctx, _cache) => {
|
|
155
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
156
|
+
ref_key: "el",
|
|
157
|
+
ref: el,
|
|
158
|
+
onPointerdown: handlePointerDown,
|
|
159
|
+
onPointermove: handlePointerMove,
|
|
160
|
+
onPointerup: handlePointerEnd,
|
|
161
|
+
onPointercancel: handlePointerEnd,
|
|
162
|
+
onLostpointercapture: handlePointerEnd,
|
|
163
|
+
onKeydown: handleKeyDown,
|
|
164
|
+
onBlur: handleBlur
|
|
165
|
+
}, unref(attrs), {
|
|
166
|
+
class: unref(cn)("ft-magnet-puck", __props.class),
|
|
167
|
+
role: "button",
|
|
168
|
+
tabindex: "0",
|
|
169
|
+
"aria-label": __props.label,
|
|
170
|
+
"aria-describedby": unref(attrs)["aria-describedby"] ?? hintId,
|
|
171
|
+
"aria-pressed": held.value ? "true" : "false",
|
|
172
|
+
"data-held": held.value || void 0,
|
|
173
|
+
style: puckStyle.value
|
|
174
|
+
}), [
|
|
175
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
176
|
+
_cache[0] || (_cache[0] = createElementVNode("span", {
|
|
177
|
+
class: "ft-magnet-puck-face",
|
|
178
|
+
"aria-hidden": "true"
|
|
179
|
+
}, null, -1))
|
|
180
|
+
], true),
|
|
181
|
+
createElementVNode("span", {
|
|
182
|
+
id: hintId,
|
|
183
|
+
class: "ft-magnet-puck-hint"
|
|
184
|
+
}, toDisplayString(KEY_HINT))
|
|
185
|
+
], 16, _hoisted_1);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
export {
|
|
190
|
+
_sfc_main as default
|
|
191
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
import type { MagneticFieldSource, MagneticPoint, MagneticSpring, MagneticSpringPreset } from "./magnetic-field-core.js";
|
|
3
|
+
export interface MagneticFieldProps {
|
|
4
|
+
/** Where the magnet comes from. `"pointer"` follows a mouse or pen anywhere within `radius` of an item (touch is ignored); `"manual"` reads `position` instead. A `MagnetPuck` placed inside the field drives it in either mode while it is held. */
|
|
5
|
+
source?: MagneticFieldSource;
|
|
6
|
+
/** The magnet's position in px, relative to the field's padding box, used when `source` is `"manual"`. `null` means no magnet, and the items spring back to rest. */
|
|
7
|
+
position?: MagneticPoint | null;
|
|
8
|
+
/** Falloff distance from the item's edge, in px: an item pulls hardest when the magnet touches or overlaps it, and not at all once the magnet is `radius` px beyond its nearest edge. */
|
|
9
|
+
radius?: number;
|
|
10
|
+
/** Global pull multiplier, applied on top of each item's own `strength`. `0` turns the effect off without detaching anything. */
|
|
11
|
+
strength?: number;
|
|
12
|
+
/** Largest distance, in px, that any item travels toward the magnet. */
|
|
13
|
+
maxTranslate?: number;
|
|
14
|
+
/** Largest lean, in degrees. Items lean toward the magnet's side like a crowd turning its head: clockwise when it is to their left, counter-clockwise when it is to their right. */
|
|
15
|
+
maxRotate?: number;
|
|
16
|
+
/** How items move and settle: `"soft"`, `"default"` or `"snappy"`, or your own `{ stiffness, damping, mass }` (missing keys come from `"default"`). */
|
|
17
|
+
spring?: MagneticSpringPreset | Partial<MagneticSpring>;
|
|
18
|
+
/** `1` attracts and `-1` repels. Only translation flips; the lean stays the same. */
|
|
19
|
+
polarity?: 1 | -1;
|
|
20
|
+
/** Detaches every listener and springs each item back to rest. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Called when the field wakes up (a magnet is engaged or an item is still settling) and when it goes back to sleep. */
|
|
23
|
+
onActiveChange?: (active: boolean) => void;
|
|
24
|
+
/** Additional CSS classes. */
|
|
25
|
+
class?: HTMLAttributes["class"];
|
|
26
|
+
}
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MagneticFieldProps, {
|
|
30
|
+
ref: Readonly<import("vue").ShallowRef<HTMLDivElement | null>>;
|
|
31
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagneticFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
32
|
+
/** The content. Wrap each element that should react in a `MagneticItem`. */
|
|
33
|
+
default?(): unknown;
|
|
34
|
+
}>;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./MagneticField.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const MagneticField = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f13a642d"]]);
|
|
5
|
+
export {
|
|
6
|
+
MagneticField as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, shallowRef, ref, onMounted, onBeforeUnmount, watch, createElementBlock, openBlock, mergeProps, unref, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { inView } from "../../internals/motion/in-view.js";
|
|
4
|
+
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
5
|
+
import { MAGNETIC_FIELD_DEFAULTS, createMagneticFieldHub, createMagneticFieldCore, resolveSpring } from "./magnetic-field-core.js";
|
|
6
|
+
import { attachLayoutInvalidation, attachPointerSource } from "./magnetic-field-source.js";
|
|
7
|
+
import { MAGNETIC_FIELD_KEY } from "./types.js";
|
|
8
|
+
const _hoisted_1 = ["data-source", "data-active"];
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
...{ name: "MagneticField", inheritAttrs: false },
|
|
11
|
+
__name: "MagneticField",
|
|
12
|
+
props: {
|
|
13
|
+
source: { default: "pointer" },
|
|
14
|
+
position: { default: null },
|
|
15
|
+
radius: { default: () => MAGNETIC_FIELD_DEFAULTS.radius },
|
|
16
|
+
strength: { default: () => MAGNETIC_FIELD_DEFAULTS.strength },
|
|
17
|
+
maxTranslate: { default: () => MAGNETIC_FIELD_DEFAULTS.maxTranslate },
|
|
18
|
+
maxRotate: { default: () => MAGNETIC_FIELD_DEFAULTS.maxRotate },
|
|
19
|
+
spring: { default: "default" },
|
|
20
|
+
polarity: { default: 1 },
|
|
21
|
+
disabled: { type: Boolean, default: false },
|
|
22
|
+
onActiveChange: { type: Function },
|
|
23
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
24
|
+
},
|
|
25
|
+
setup(__props, { expose: __expose }) {
|
|
26
|
+
const attrs = useAttrs();
|
|
27
|
+
const root = useTemplateRef("root");
|
|
28
|
+
__expose({ ref: root });
|
|
29
|
+
const hub = createMagneticFieldHub();
|
|
30
|
+
const context = hub;
|
|
31
|
+
MAGNETIC_FIELD_KEY.provide(context);
|
|
32
|
+
const reduced = useReducedMotion();
|
|
33
|
+
const core = shallowRef(null);
|
|
34
|
+
const active = ref(false);
|
|
35
|
+
function handleActive(next) {
|
|
36
|
+
active.value = next;
|
|
37
|
+
__props.onActiveChange?.(next);
|
|
38
|
+
}
|
|
39
|
+
function currentOptions() {
|
|
40
|
+
return {
|
|
41
|
+
radius: __props.radius,
|
|
42
|
+
strength: __props.strength,
|
|
43
|
+
maxTranslate: __props.maxTranslate,
|
|
44
|
+
maxRotate: __props.maxRotate,
|
|
45
|
+
spring: resolveSpring(__props.spring),
|
|
46
|
+
polarity: __props.polarity,
|
|
47
|
+
reducedMotion: reduced.value,
|
|
48
|
+
disabled: __props.disabled,
|
|
49
|
+
onActiveChange: handleActive
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function syncManual() {
|
|
53
|
+
const point = __props.source === "manual" && __props.position ? { x: __props.position.x, y: __props.position.y } : null;
|
|
54
|
+
hub.setSource(point, "manual");
|
|
55
|
+
}
|
|
56
|
+
let teardownSources = null;
|
|
57
|
+
let onVisible = null;
|
|
58
|
+
let teardownObserver = null;
|
|
59
|
+
function buildObserver() {
|
|
60
|
+
teardownObserver?.();
|
|
61
|
+
teardownObserver = null;
|
|
62
|
+
const node = root.value;
|
|
63
|
+
if (!node || !onVisible) return;
|
|
64
|
+
const io = inView(node, {
|
|
65
|
+
once: false,
|
|
66
|
+
threshold: 0,
|
|
67
|
+
rootMargin: `${__props.radius}px`,
|
|
68
|
+
onChange: onVisible
|
|
69
|
+
});
|
|
70
|
+
teardownObserver = () => io?.destroy?.();
|
|
71
|
+
}
|
|
72
|
+
function buildSources() {
|
|
73
|
+
teardownSources?.();
|
|
74
|
+
teardownSources = null;
|
|
75
|
+
const c = core.value;
|
|
76
|
+
const node = root.value;
|
|
77
|
+
if (!c || !node) return;
|
|
78
|
+
const usePointer = __props.source === "pointer";
|
|
79
|
+
if (__props.disabled || reduced.value || !usePointer) c.clearSource("pointer");
|
|
80
|
+
if (__props.disabled || reduced.value) return;
|
|
81
|
+
let detachPointer = null;
|
|
82
|
+
let detachLayout = null;
|
|
83
|
+
onVisible = (visible) => {
|
|
84
|
+
if (visible) {
|
|
85
|
+
detachLayout ??= attachLayoutInvalidation(c);
|
|
86
|
+
if (usePointer) detachPointer ??= attachPointerSource(c, node.ownerDocument, node);
|
|
87
|
+
} else {
|
|
88
|
+
detachPointer?.();
|
|
89
|
+
detachPointer = null;
|
|
90
|
+
detachLayout?.();
|
|
91
|
+
detachLayout = null;
|
|
92
|
+
c.clearSource("pointer");
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
buildObserver();
|
|
96
|
+
teardownSources = () => {
|
|
97
|
+
teardownObserver?.();
|
|
98
|
+
teardownObserver = null;
|
|
99
|
+
onVisible = null;
|
|
100
|
+
detachPointer?.();
|
|
101
|
+
detachLayout?.();
|
|
102
|
+
c.clearSource("pointer");
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
onMounted(() => {
|
|
106
|
+
syncManual();
|
|
107
|
+
const node = root.value;
|
|
108
|
+
if (!node) return;
|
|
109
|
+
const next = createMagneticFieldCore(node, currentOptions());
|
|
110
|
+
core.value = next;
|
|
111
|
+
hub.attach(next);
|
|
112
|
+
buildSources();
|
|
113
|
+
});
|
|
114
|
+
onBeforeUnmount(() => {
|
|
115
|
+
teardownSources?.();
|
|
116
|
+
teardownSources = null;
|
|
117
|
+
const c = core.value;
|
|
118
|
+
if (!c) return;
|
|
119
|
+
hub.detach();
|
|
120
|
+
c.destroy();
|
|
121
|
+
core.value = null;
|
|
122
|
+
active.value = false;
|
|
123
|
+
});
|
|
124
|
+
watch(
|
|
125
|
+
[
|
|
126
|
+
() => __props.radius,
|
|
127
|
+
() => __props.strength,
|
|
128
|
+
() => __props.maxTranslate,
|
|
129
|
+
() => __props.maxRotate,
|
|
130
|
+
() => __props.spring,
|
|
131
|
+
() => __props.polarity,
|
|
132
|
+
() => __props.disabled,
|
|
133
|
+
reduced
|
|
134
|
+
],
|
|
135
|
+
() => core.value?.update(currentOptions()),
|
|
136
|
+
{ flush: "post" }
|
|
137
|
+
);
|
|
138
|
+
watch([() => __props.source, () => __props.position?.x, () => __props.position?.y], syncManual, { flush: "post" });
|
|
139
|
+
watch([() => __props.source, () => __props.disabled, reduced], buildSources, { flush: "post" });
|
|
140
|
+
watch(() => __props.radius, buildObserver, { flush: "post" });
|
|
141
|
+
return (_ctx, _cache) => {
|
|
142
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
143
|
+
ref_key: "root",
|
|
144
|
+
ref: root,
|
|
145
|
+
class: unref(cn)("ft-magnetic-field", __props.class)
|
|
146
|
+
}, unref(attrs), {
|
|
147
|
+
"data-source": __props.source,
|
|
148
|
+
"data-active": active.value || void 0
|
|
149
|
+
}), [
|
|
150
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
151
|
+
], 16, _hoisted_1);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
_sfc_main as default
|
|
157
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
export interface MagneticItemProps {
|
|
3
|
+
/** How heavy the item is. Above 1 it moves and leans less and settles more slowly; below 1 it is livelier. */
|
|
4
|
+
mass?: number;
|
|
5
|
+
/** Per-item pull multiplier, applied on top of the field's `strength`. */
|
|
6
|
+
strength?: number;
|
|
7
|
+
/** Whether the item moves toward the magnet. */
|
|
8
|
+
pull?: boolean;
|
|
9
|
+
/** Whether the item leans toward the magnet. */
|
|
10
|
+
rotate?: boolean;
|
|
11
|
+
/** Renders `<span>` wrappers with `display: inline-block` instead of block `<div>`s, for items that sit inside a line of text or an inline row. */
|
|
12
|
+
inline?: boolean;
|
|
13
|
+
/** Additional CSS classes, on the static outer wrapper. */
|
|
14
|
+
class?: HTMLAttributes["class"];
|
|
15
|
+
}
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MagneticItemProps, {
|
|
19
|
+
ref: Readonly<import("vue").ShallowRef<HTMLElement | null>>;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagneticItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
21
|
+
/** The element that reacts. */
|
|
22
|
+
default?(): unknown;
|
|
23
|
+
}>;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./MagneticItem.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const MagneticItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-19627aa5"]]);
|
|
5
|
+
export {
|
|
6
|
+
MagneticItem as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, computed, onMounted, watch, onBeforeUnmount, createBlock, openBlock, resolveDynamicComponent, mergeProps, unref, withCtx, renderSlot } from "vue";
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
import { MAGNETIC_FIELD_KEY } from "./types.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
...{ name: "MagneticItem", inheritAttrs: false },
|
|
6
|
+
__name: "MagneticItem",
|
|
7
|
+
props: {
|
|
8
|
+
mass: { default: 1 },
|
|
9
|
+
strength: { default: 1 },
|
|
10
|
+
pull: { type: Boolean, default: true },
|
|
11
|
+
rotate: { type: Boolean, default: true },
|
|
12
|
+
inline: { type: Boolean, default: false },
|
|
13
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
14
|
+
},
|
|
15
|
+
setup(__props, { expose: __expose }) {
|
|
16
|
+
const attrs = useAttrs();
|
|
17
|
+
const outer = useTemplateRef("outer");
|
|
18
|
+
const inner = useTemplateRef("inner");
|
|
19
|
+
__expose({ ref: outer });
|
|
20
|
+
const ctx = MAGNETIC_FIELD_KEY.useOptional();
|
|
21
|
+
const tag = computed(() => __props.inline ? "span" : "div");
|
|
22
|
+
let unregister = null;
|
|
23
|
+
function registerNodes() {
|
|
24
|
+
unregister?.();
|
|
25
|
+
unregister = null;
|
|
26
|
+
const o = outer.value;
|
|
27
|
+
const i = inner.value;
|
|
28
|
+
if (!ctx || !o || !i) return;
|
|
29
|
+
unregister = ctx.register(o, i, { mass: __props.mass, strength: __props.strength, pull: __props.pull, rotate: __props.rotate });
|
|
30
|
+
}
|
|
31
|
+
onMounted(registerNodes);
|
|
32
|
+
watch(tag, registerNodes, { flush: "post" });
|
|
33
|
+
onBeforeUnmount(() => {
|
|
34
|
+
unregister?.();
|
|
35
|
+
unregister = null;
|
|
36
|
+
});
|
|
37
|
+
watch(
|
|
38
|
+
[() => __props.mass, () => __props.strength, () => __props.pull, () => __props.rotate],
|
|
39
|
+
() => {
|
|
40
|
+
const node = outer.value;
|
|
41
|
+
if (ctx && node) ctx.updateItem(node, { mass: __props.mass, strength: __props.strength, pull: __props.pull, rotate: __props.rotate });
|
|
42
|
+
},
|
|
43
|
+
{ flush: "post" }
|
|
44
|
+
);
|
|
45
|
+
return (_ctx, _cache) => {
|
|
46
|
+
return openBlock(), createBlock(resolveDynamicComponent(tag.value), mergeProps({
|
|
47
|
+
ref_key: "outer",
|
|
48
|
+
ref: outer,
|
|
49
|
+
class: unref(cn)("ft-magnetic-item", __props.class)
|
|
50
|
+
}, unref(attrs), {
|
|
51
|
+
"data-inline": __props.inline || void 0
|
|
52
|
+
}), {
|
|
53
|
+
default: withCtx(() => [
|
|
54
|
+
(openBlock(), createBlock(resolveDynamicComponent(tag.value), {
|
|
55
|
+
ref_key: "inner",
|
|
56
|
+
ref: inner,
|
|
57
|
+
class: "ft-magnetic-item-inner"
|
|
58
|
+
}, {
|
|
59
|
+
default: withCtx(() => [
|
|
60
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
61
|
+
]),
|
|
62
|
+
_: 3
|
|
63
|
+
}, 512))
|
|
64
|
+
]),
|
|
65
|
+
_: 3
|
|
66
|
+
}, 16, ["class", "data-inline"]);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
_sfc_main as default
|
|
72
|
+
};
|