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
|
@@ -2,7 +2,7 @@ import _sfc_main from "./FlipCard.vue2.js";
|
|
|
2
2
|
import { flipDirection, showsBack } from "./FlipCard.vue2.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const FlipCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const FlipCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-72cdc6c1"]]);
|
|
6
6
|
export {
|
|
7
7
|
FlipCard as default,
|
|
8
8
|
flipDirection,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, mergeModels, useModel, ref, computed, useTemplateRef, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
3
4
|
import { useReducedMotion } from "../../internals/motion/use-media-query.js";
|
|
4
5
|
const _hoisted_1 = ["data-axis", "data-flipped", "data-trigger", "role", "aria-pressed", "aria-label"];
|
|
@@ -31,7 +32,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
32
|
rotate: { default: "y" },
|
|
32
33
|
trigger: { default: "hover" },
|
|
33
34
|
flipped: { type: Boolean },
|
|
34
|
-
|
|
35
|
+
onFlip: { type: [Function, Array] },
|
|
36
|
+
onflip: { type: [Function, Array] },
|
|
35
37
|
duration: { default: 700 },
|
|
36
38
|
glare: { type: Boolean, default: true },
|
|
37
39
|
label: {},
|
|
@@ -53,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
55
|
angle.value += 180 * direction;
|
|
54
56
|
const next = showsBack(angle.value);
|
|
55
57
|
flipped.value = next;
|
|
56
|
-
__props.onflip
|
|
58
|
+
callListener(__props.onFlip ?? __props.onflip, next);
|
|
57
59
|
lift();
|
|
58
60
|
}
|
|
59
61
|
function lift() {
|
|
@@ -86,7 +88,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
86
88
|
(want) => {
|
|
87
89
|
if (want !== showsBack(angle.value)) {
|
|
88
90
|
angle.value += 180;
|
|
89
|
-
__props.onflip
|
|
91
|
+
callListener(__props.onFlip ?? __props.onflip, want);
|
|
90
92
|
lift();
|
|
91
93
|
}
|
|
92
94
|
},
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, onMounted,
|
|
1
|
+
import { defineComponent, useTemplateRef, onMounted, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, unref } from "vue";
|
|
2
|
+
import { createReducedMotion } from "../../internals/motion/media-query.js";
|
|
2
3
|
import { cn } from "../../utils.js";
|
|
4
|
+
import { isDev } from "../../internals/env.js";
|
|
3
5
|
import { createFluidCursor } from "./fluid-cursor-core.js";
|
|
4
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
7
|
...{ name: "FluidCursor", inheritAttrs: false },
|
|
@@ -38,12 +40,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
38
40
|
onReady: { type: Function }
|
|
39
41
|
},
|
|
40
42
|
setup(__props) {
|
|
41
|
-
const DEV = false;
|
|
42
43
|
const canvasRef = useTemplateRef("canvas");
|
|
43
44
|
let engine = null;
|
|
44
|
-
|
|
45
|
+
const reducedMotion = createReducedMotion();
|
|
46
|
+
let stopReducedMotion = null;
|
|
47
|
+
let engineCanvas = null;
|
|
48
|
+
function stopEngine() {
|
|
49
|
+
engine?.destroy();
|
|
50
|
+
engine = null;
|
|
51
|
+
engineCanvas = null;
|
|
52
|
+
}
|
|
53
|
+
function syncEngine() {
|
|
45
54
|
const canvas = canvasRef.value;
|
|
46
|
-
if (!canvas)
|
|
55
|
+
if (reducedMotion.current || !canvas) {
|
|
56
|
+
stopEngine();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (engine && engineCanvas === canvas) return;
|
|
60
|
+
stopEngine();
|
|
61
|
+
engineCanvas = canvas;
|
|
47
62
|
engine = createFluidCursor(
|
|
48
63
|
{ canvas },
|
|
49
64
|
{
|
|
@@ -77,13 +92,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
77
92
|
ditherPixelSize: __props.ditherPixelSize,
|
|
78
93
|
ditherLevels: __props.ditherLevels,
|
|
79
94
|
onReady: __props.onReady,
|
|
80
|
-
dev:
|
|
95
|
+
dev: isDev
|
|
81
96
|
}
|
|
82
97
|
);
|
|
98
|
+
}
|
|
99
|
+
onMounted(() => {
|
|
100
|
+
stopReducedMotion = reducedMotion.start();
|
|
101
|
+
syncEngine();
|
|
83
102
|
});
|
|
103
|
+
watch(
|
|
104
|
+
[() => reducedMotion.current, canvasRef],
|
|
105
|
+
() => {
|
|
106
|
+
syncEngine();
|
|
107
|
+
},
|
|
108
|
+
{ flush: "post" }
|
|
109
|
+
);
|
|
84
110
|
onBeforeUnmount(() => {
|
|
85
|
-
|
|
86
|
-
|
|
111
|
+
stopReducedMotion?.();
|
|
112
|
+
stopReducedMotion = null;
|
|
113
|
+
stopEngine();
|
|
87
114
|
});
|
|
88
115
|
watch(
|
|
89
116
|
() => ({ fluidColor: __props.fluidColor, fluidColors: __props.fluidColors, contained: __props.contained, interactive: __props.interactive, allowMultiple: __props.allowMultiple, onReady: __props.onReady }),
|
|
@@ -101,10 +128,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
101
128
|
)
|
|
102
129
|
)
|
|
103
130
|
}, [
|
|
104
|
-
|
|
131
|
+
(openBlock(), createElementBlock("canvas", {
|
|
132
|
+
key: unref(reducedMotion).current ? "static" : "live",
|
|
105
133
|
ref: "canvas",
|
|
106
134
|
class: normalizeClass(__props.contained ? "block h-full w-full" : "block h-screen w-screen")
|
|
107
|
-
}, null, 2)
|
|
135
|
+
}, null, 2))
|
|
108
136
|
], 2);
|
|
109
137
|
};
|
|
110
138
|
}
|
|
@@ -1386,9 +1386,9 @@ function createFluidCursor(el, options, random = Math.random) {
|
|
|
1386
1386
|
window.addEventListener("mouseup", handlePointerUp);
|
|
1387
1387
|
document.body.addEventListener("mousemove", handleFirstMouseMove);
|
|
1388
1388
|
window.addEventListener("mousemove", handleMouseMove);
|
|
1389
|
-
document.body.addEventListener("touchstart", handleFirstTouchStart);
|
|
1390
|
-
window.addEventListener("touchstart", handleTouchStart,
|
|
1391
|
-
window.addEventListener("touchmove", handleTouchMove,
|
|
1389
|
+
document.body.addEventListener("touchstart", handleFirstTouchStart, { passive: true });
|
|
1390
|
+
window.addEventListener("touchstart", handleTouchStart, { passive: true });
|
|
1391
|
+
window.addEventListener("touchmove", handleTouchMove, { passive: true });
|
|
1392
1392
|
window.addEventListener("touchend", handlePointerUp);
|
|
1393
1393
|
window.addEventListener("touchcancel", handlePointerUp);
|
|
1394
1394
|
}
|
|
@@ -821,9 +821,9 @@ async function startWebGpuFluid(canvas, opts) {
|
|
|
821
821
|
window.addEventListener("mouseup", handlePointerUp);
|
|
822
822
|
document.body.addEventListener("mousemove", handleFirstMouseMove);
|
|
823
823
|
window.addEventListener("mousemove", handleMouseMove);
|
|
824
|
-
document.body.addEventListener("touchstart", handleFirstTouchStart);
|
|
825
|
-
window.addEventListener("touchstart", handleTouchStart,
|
|
826
|
-
window.addEventListener("touchmove", handleTouchMove,
|
|
824
|
+
document.body.addEventListener("touchstart", handleFirstTouchStart, { passive: true });
|
|
825
|
+
window.addEventListener("touchstart", handleTouchStart, { passive: true });
|
|
826
|
+
window.addEventListener("touchmove", handleTouchMove, { passive: true });
|
|
827
827
|
window.addEventListener("touchend", handlePointerUp);
|
|
828
828
|
window.addEventListener("touchcancel", handlePointerUp);
|
|
829
829
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./Focus.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const Focus = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const Focus = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6f187539"]]);
|
|
5
5
|
export {
|
|
6
6
|
Focus as default
|
|
7
7
|
};
|
|
@@ -94,7 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
94
|
class: normalizeClass(["focus-word", { manual: __props.manualMode, active: index === currentIndex.value && !__props.manualMode }]),
|
|
95
95
|
style: normalizeStyle({
|
|
96
96
|
filter: index === currentIndex.value ? "blur(0px)" : `blur(${__props.blurAmount}px)`,
|
|
97
|
-
|
|
97
|
+
"--focus-duration": `${__props.animationDuration}s`,
|
|
98
98
|
"--border-color": __props.borderColor
|
|
99
99
|
}),
|
|
100
100
|
onMouseenter: ($event) => handleMouseEnter(index),
|
|
@@ -108,7 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
108
108
|
width: `${focusRect.value.width}px`,
|
|
109
109
|
height: `${focusRect.value.height}px`,
|
|
110
110
|
opacity: currentIndex.value >= 0 ? 1 : 0,
|
|
111
|
-
|
|
111
|
+
"--focus-duration": `${__props.animationDuration}s`,
|
|
112
112
|
"--border-color": __props.borderColor
|
|
113
113
|
})
|
|
114
114
|
}, [..._cache[0] || (_cache[0] = [
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "vue";
|
|
2
|
+
import type { ButtonVariant, ButtonSize } from "../button/types.js";
|
|
3
|
+
import type { FollowLabels } from "./follow-core.js";
|
|
4
|
+
export type { FollowLabels };
|
|
5
|
+
export interface FollowButtonProps {
|
|
6
|
+
/**
|
|
7
|
+
* Called with the committed value, once per successful attempt. Not called
|
|
8
|
+
* for a rolled-back or superseded one. The value itself is
|
|
9
|
+
* `v-model:following`.
|
|
10
|
+
*/
|
|
11
|
+
onFollowingChange?: (following: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Called with the value the click asks for. Return nothing to commit at
|
|
14
|
+
* once, or a promise: resolve commits, reject (or throw) rolls back, shows
|
|
15
|
+
* the error and announces it. Clicking again after a failure retries.
|
|
16
|
+
*/
|
|
17
|
+
onToggle?: (next: boolean) => void | Promise<unknown>;
|
|
18
|
+
/** Stable accessible name, e.g. "Follow Rama". Defaults to the idle label. */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Visible text per state; unset keys keep the defaults. */
|
|
21
|
+
labels?: Partial<FollowLabels>;
|
|
22
|
+
/** Visible text and announcement after a failed attempt */
|
|
23
|
+
errorLabel?: string;
|
|
24
|
+
/** How long the error state holds before reverting, in milliseconds */
|
|
25
|
+
resetMs?: number;
|
|
26
|
+
/** Button variant. By default the idle state is `primary` and the following state `outline`. */
|
|
27
|
+
variant?: ButtonVariant;
|
|
28
|
+
/** Passed straight through to the underlying Button */
|
|
29
|
+
size?: ButtonSize;
|
|
30
|
+
/** Disables the button and blocks the toggle */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Drops the visible text, keeping the accessible name */
|
|
33
|
+
iconOnly?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Plays the matching interface cue (toggle-on, toggle-off, error) and the
|
|
36
|
+
* error vibration. Off by default; only audible once the user has enabled sound.
|
|
37
|
+
*/
|
|
38
|
+
sound?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Fires on activation, after the toggle has started. Never called while
|
|
41
|
+
* `disabled` or pending. `@click` reaches it.
|
|
42
|
+
*/
|
|
43
|
+
onClick?: ((event: MouseEvent) => void) | ((event: MouseEvent) => void)[];
|
|
44
|
+
/** Additional CSS classes */
|
|
45
|
+
class?: HTMLAttributes["class"];
|
|
46
|
+
}
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
declare const __VLS_export: import("vue").DefineComponent<FollowButtonProps & {
|
|
50
|
+
/**
|
|
51
|
+
* Whether the viewer follows, `v-model:following`. The committed value is
|
|
52
|
+
* written back when `onToggle` resolves, never before. A write from the parent
|
|
53
|
+
* while an attempt is pending wins and drops that attempt.
|
|
54
|
+
*/
|
|
55
|
+
following?: boolean;
|
|
56
|
+
}, {
|
|
57
|
+
ref: import("vue").ComputedRef<HTMLButtonElement | HTMLAnchorElement | null>;
|
|
58
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
+
"update:following": (value: boolean) => any;
|
|
60
|
+
}, string, import("vue").PublicProps, Readonly<FollowButtonProps & {
|
|
61
|
+
/**
|
|
62
|
+
* Whether the viewer follows, `v-model:following`. The committed value is
|
|
63
|
+
* written back when `onToggle` resolves, never before. A write from the parent
|
|
64
|
+
* while an attempt is pending wins and drops that attempt.
|
|
65
|
+
*/
|
|
66
|
+
following?: boolean;
|
|
67
|
+
}> & Readonly<{
|
|
68
|
+
"onUpdate:following"?: ((value: boolean) => any) | undefined;
|
|
69
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FollowButton.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const FollowButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-89e2104a"]]);
|
|
5
|
+
export {
|
|
6
|
+
FollowButton as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { defineComponent, mergeModels, useModel, useAttrs, useTemplateRef, computed, shallowRef, watch, onBeforeUnmount, watchEffect, ref, createBlock, openBlock, unref, mergeProps, withCtx, createElementBlock, createCommentVNode, createElementVNode, toDisplayString, createVNode } from "vue";
|
|
2
|
+
import { callListener } from "../../internals/call-listener.js";
|
|
3
|
+
import { cn } from "../../utils.js";
|
|
4
|
+
import { sound } from "../../sound/sound.js";
|
|
5
|
+
import { prefersReducedMotion } from "../../internals/motion/anchored.js";
|
|
6
|
+
import { createFollowState, adopt, cancel, resolveLabels, shownFollowing, visibleLabel, clearError, announcement, morphState, press, isThenable, settle } from "./follow-core.js";
|
|
7
|
+
import Button from "../button/Button.vue.js";
|
|
8
|
+
import StatusMorph from "../status-morph/StatusMorph.vue.js";
|
|
9
|
+
const _hoisted_1 = {
|
|
10
|
+
class: "size-full",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
"stroke-width": "2",
|
|
15
|
+
"stroke-linecap": "round",
|
|
16
|
+
"stroke-linejoin": "round",
|
|
17
|
+
"aria-hidden": "true"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_2 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
d: "M20 6 9 17l-5-5"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_3 = {
|
|
24
|
+
key: 1,
|
|
25
|
+
d: "M12 5v14M5 12h14"
|
|
26
|
+
};
|
|
27
|
+
const _hoisted_4 = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "ft-follow__label"
|
|
30
|
+
};
|
|
31
|
+
const _hoisted_5 = {
|
|
32
|
+
class: "ft-follow__ghost",
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_6 = {
|
|
36
|
+
class: "ft-follow__ghost",
|
|
37
|
+
"aria-hidden": "true"
|
|
38
|
+
};
|
|
39
|
+
const _hoisted_7 = {
|
|
40
|
+
class: "ft-follow__ghost",
|
|
41
|
+
"aria-hidden": "true"
|
|
42
|
+
};
|
|
43
|
+
const _hoisted_8 = {
|
|
44
|
+
class: "ft-follow__ghost",
|
|
45
|
+
"aria-hidden": "true"
|
|
46
|
+
};
|
|
47
|
+
const _hoisted_9 = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "ft-follow__leave",
|
|
50
|
+
"aria-hidden": "true"
|
|
51
|
+
};
|
|
52
|
+
const _hoisted_10 = ["data-swapped", "data-preview"];
|
|
53
|
+
const _hoisted_11 = { class: "ft-follow__rest" };
|
|
54
|
+
const _hoisted_12 = {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "ft-follow__preview",
|
|
57
|
+
"aria-hidden": "true"
|
|
58
|
+
};
|
|
59
|
+
const LEAVE_MS = 80;
|
|
60
|
+
const MORPH_STYLE = {
|
|
61
|
+
width: "1rem",
|
|
62
|
+
height: "1rem",
|
|
63
|
+
fontSize: "calc(1rem - 1px)",
|
|
64
|
+
"--ft-statusmorph-error": "var(--ft-status-error, light-dark(oklch(0.577 0.245 27.325), oklch(0.704 0.191 22.216)))"
|
|
65
|
+
};
|
|
66
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
67
|
+
...{ name: "FollowButton", inheritAttrs: false },
|
|
68
|
+
__name: "FollowButton",
|
|
69
|
+
props: /* @__PURE__ */ mergeModels({
|
|
70
|
+
onFollowingChange: { type: Function },
|
|
71
|
+
onToggle: { type: Function },
|
|
72
|
+
label: {},
|
|
73
|
+
labels: {},
|
|
74
|
+
errorLabel: { default: "Try again" },
|
|
75
|
+
resetMs: { default: 2e3 },
|
|
76
|
+
variant: {},
|
|
77
|
+
size: { default: "md" },
|
|
78
|
+
disabled: { type: Boolean, default: false },
|
|
79
|
+
iconOnly: { type: Boolean, default: false },
|
|
80
|
+
sound: { type: Boolean, default: false },
|
|
81
|
+
onClick: { type: [Function, Array] },
|
|
82
|
+
class: { type: [Boolean, null, String, Object, Array] }
|
|
83
|
+
}, {
|
|
84
|
+
"following": { type: Boolean, ...{ default: false } },
|
|
85
|
+
"followingModifiers": {}
|
|
86
|
+
}),
|
|
87
|
+
emits: ["update:following"],
|
|
88
|
+
setup(__props, { expose: __expose }) {
|
|
89
|
+
const following = useModel(__props, "following");
|
|
90
|
+
const attrs = useAttrs();
|
|
91
|
+
const btn = useTemplateRef("btn");
|
|
92
|
+
__expose({ ref: computed(() => btn.value?.ref ?? null) });
|
|
93
|
+
const core = shallowRef(createFollowState(following.value));
|
|
94
|
+
watch(following, (value) => {
|
|
95
|
+
if (value !== core.value.following) core.value = adopt(core.value, value);
|
|
96
|
+
});
|
|
97
|
+
onBeforeUnmount(() => {
|
|
98
|
+
core.value = cancel(core.value);
|
|
99
|
+
});
|
|
100
|
+
const resolvedLabels = computed(() => resolveLabels(__props.labels));
|
|
101
|
+
const shown = computed(() => shownFollowing(core.value));
|
|
102
|
+
const currentLabel = computed(() => visibleLabel(core.value, resolvedLabels.value, __props.errorLabel));
|
|
103
|
+
const showsPreview = computed(() => core.value.phase === "idle" && core.value.following);
|
|
104
|
+
const failed = computed(() => core.value.phase === "error");
|
|
105
|
+
const classes = computed(() => {
|
|
106
|
+
const reserveBorder = __props.variant === void 0;
|
|
107
|
+
return cn(
|
|
108
|
+
"ft-follow",
|
|
109
|
+
(failed.value || reserveBorder) && "border",
|
|
110
|
+
reserveBorder && !shown.value && !failed.value && "border-transparent",
|
|
111
|
+
failed.value && "ft-follow--failed",
|
|
112
|
+
__props.class
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
function accessibleName() {
|
|
116
|
+
return __props.label ?? attrs["aria-label"] ?? resolvedLabels.value.follow;
|
|
117
|
+
}
|
|
118
|
+
watchEffect((onCleanup) => {
|
|
119
|
+
if (core.value.phase !== "error") return;
|
|
120
|
+
const armed = core.value.ticket;
|
|
121
|
+
const timer = setTimeout(
|
|
122
|
+
() => {
|
|
123
|
+
core.value = clearError(core.value, armed);
|
|
124
|
+
},
|
|
125
|
+
__props.resetMs > 0 ? __props.resetMs : 1
|
|
126
|
+
);
|
|
127
|
+
onCleanup(() => clearTimeout(timer));
|
|
128
|
+
});
|
|
129
|
+
function finish(ticket, ok) {
|
|
130
|
+
const result = settle(core.value, ticket, ok);
|
|
131
|
+
if (result.outcome === "stale") return;
|
|
132
|
+
core.value = result.state;
|
|
133
|
+
if (ok) {
|
|
134
|
+
following.value = result.state.following;
|
|
135
|
+
if (__props.sound) sound.play(result.state.following ? "toggle-on" : "toggle-off");
|
|
136
|
+
__props.onFollowingChange?.(result.state.following);
|
|
137
|
+
} else if (__props.sound) {
|
|
138
|
+
sound.play("error");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function handleClick(event) {
|
|
142
|
+
const started = press(core.value);
|
|
143
|
+
if (!started) return;
|
|
144
|
+
if (__props.sound && sound.enabled) void sound.unlock();
|
|
145
|
+
core.value = started.state;
|
|
146
|
+
const ticket = started.ticket;
|
|
147
|
+
let result;
|
|
148
|
+
let threw = false;
|
|
149
|
+
try {
|
|
150
|
+
result = __props.onToggle?.(started.next);
|
|
151
|
+
} catch {
|
|
152
|
+
threw = true;
|
|
153
|
+
}
|
|
154
|
+
if (threw) finish(ticket, false);
|
|
155
|
+
else if (isThenable(result)) {
|
|
156
|
+
result.then(
|
|
157
|
+
() => finish(ticket, true),
|
|
158
|
+
() => finish(ticket, false)
|
|
159
|
+
);
|
|
160
|
+
} else finish(ticket, true);
|
|
161
|
+
callListener(__props.onClick, event);
|
|
162
|
+
}
|
|
163
|
+
const swapped = ref(false);
|
|
164
|
+
const leaving = ref(null);
|
|
165
|
+
let leaveTimer;
|
|
166
|
+
watch(currentLabel, (next, previous) => {
|
|
167
|
+
if (next === previous) return;
|
|
168
|
+
swapped.value = true;
|
|
169
|
+
if (leaving.value !== null) return;
|
|
170
|
+
clearTimeout(leaveTimer);
|
|
171
|
+
if (prefersReducedMotion()) {
|
|
172
|
+
leaving.value = null;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
leaving.value = previous;
|
|
176
|
+
leaveTimer = setTimeout(() => {
|
|
177
|
+
leaving.value = null;
|
|
178
|
+
}, LEAVE_MS);
|
|
179
|
+
});
|
|
180
|
+
onBeforeUnmount(() => clearTimeout(leaveTimer));
|
|
181
|
+
return (_ctx, _cache) => {
|
|
182
|
+
return openBlock(), createBlock(unref(Button), mergeProps({
|
|
183
|
+
ref_key: "btn",
|
|
184
|
+
ref: btn
|
|
185
|
+
}, unref(attrs), {
|
|
186
|
+
type: "button",
|
|
187
|
+
variant: __props.variant ?? (shown.value ? "outline" : "primary"),
|
|
188
|
+
size: __props.size,
|
|
189
|
+
disabled: __props.disabled,
|
|
190
|
+
label: accessibleName(),
|
|
191
|
+
class: classes.value,
|
|
192
|
+
"aria-pressed": shown.value,
|
|
193
|
+
"aria-busy": core.value.phase === "pending" ? "true" : void 0,
|
|
194
|
+
"data-state": core.value.phase,
|
|
195
|
+
onClick: handleClick
|
|
196
|
+
}), {
|
|
197
|
+
iconStart: withCtx(() => [
|
|
198
|
+
createVNode(unref(StatusMorph), {
|
|
199
|
+
state: unref(morphState)(core.value),
|
|
200
|
+
tone: "semantic",
|
|
201
|
+
"reset-after": 0,
|
|
202
|
+
haptic: __props.sound,
|
|
203
|
+
labels: { loading: "", success: "", error: unref(announcement)(accessibleName(), __props.errorLabel) },
|
|
204
|
+
style: MORPH_STYLE
|
|
205
|
+
}, {
|
|
206
|
+
idle: withCtx(() => [
|
|
207
|
+
(openBlock(), createElementBlock("svg", _hoisted_1, [
|
|
208
|
+
shown.value ? (openBlock(), createElementBlock("path", _hoisted_2)) : (openBlock(), createElementBlock("path", _hoisted_3))
|
|
209
|
+
]))
|
|
210
|
+
]),
|
|
211
|
+
_: 1
|
|
212
|
+
}, 8, ["state", "haptic", "labels"])
|
|
213
|
+
]),
|
|
214
|
+
default: withCtx(() => [
|
|
215
|
+
!__props.iconOnly ? (openBlock(), createElementBlock("span", _hoisted_4, [
|
|
216
|
+
createElementVNode("span", _hoisted_5, toDisplayString(resolvedLabels.value.follow), 1),
|
|
217
|
+
createElementVNode("span", _hoisted_6, toDisplayString(resolvedLabels.value.following), 1),
|
|
218
|
+
createElementVNode("span", _hoisted_7, toDisplayString(resolvedLabels.value.unfollow), 1),
|
|
219
|
+
createElementVNode("span", _hoisted_8, toDisplayString(__props.errorLabel), 1),
|
|
220
|
+
leaving.value !== null ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(leaving.value), 1)) : createCommentVNode("", true),
|
|
221
|
+
(openBlock(), createElementBlock("span", {
|
|
222
|
+
key: currentLabel.value,
|
|
223
|
+
class: "ft-follow__live",
|
|
224
|
+
"data-swapped": swapped.value ? "" : void 0,
|
|
225
|
+
"data-preview": showsPreview.value ? "" : void 0
|
|
226
|
+
}, [
|
|
227
|
+
createElementVNode("span", _hoisted_11, toDisplayString(currentLabel.value), 1),
|
|
228
|
+
showsPreview.value ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(resolvedLabels.value.unfollow), 1)) : createCommentVNode("", true)
|
|
229
|
+
], 8, _hoisted_10))
|
|
230
|
+
])) : createCommentVNode("", true)
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 16, ["variant", "size", "disabled", "label", "class", "aria-pressed", "aria-busy", "data-state"]);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
export {
|
|
238
|
+
_sfc_main as default
|
|
239
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure state machine behind FollowButton, shared byte for byte by the Svelte,
|
|
3
|
+
* React and Vue ports. No framework, no timers, no DOM: every function takes a
|
|
4
|
+
* snapshot and returns the next one, so the three components only translate
|
|
5
|
+
* "a click", "a promise settled" and "the parent wrote a value" into calls and
|
|
6
|
+
* paint the result.
|
|
7
|
+
*
|
|
8
|
+
* Three things live here because getting any of them subtly different in one
|
|
9
|
+
* port would be a bug no single port's tests could see:
|
|
10
|
+
*
|
|
11
|
+
* - The attempt ticket. Every press, every parent write and every cancel bumps
|
|
12
|
+
* `ticket`; a promise that settles under an older ticket changes nothing.
|
|
13
|
+
* That one rule covers a parent that answers faster than the server, a retry
|
|
14
|
+
* after a failure, and an unmount with a request still in flight.
|
|
15
|
+
* - The optimistic read. While an attempt is pending the button SHOWS the
|
|
16
|
+
* value it asked for, while `following` still holds the last value anybody
|
|
17
|
+
* committed, which is what a rollback returns to.
|
|
18
|
+
* - The label vocabulary (what is shown, what is announced), so a port cannot
|
|
19
|
+
* drift on which text goes with which state.
|
|
20
|
+
*/
|
|
21
|
+
/** Where the control is in one attempt. `error` holds until a timer, a retry or the parent clears it. */
|
|
22
|
+
export type FollowPhase = "idle" | "pending" | "error";
|
|
23
|
+
export interface FollowState {
|
|
24
|
+
/** The last committed value: what a rollback returns to. */
|
|
25
|
+
readonly following: boolean;
|
|
26
|
+
readonly phase: FollowPhase;
|
|
27
|
+
/** The value the in-flight attempt asked for. Meaningful only while `phase` is `pending`. */
|
|
28
|
+
readonly target: boolean;
|
|
29
|
+
/** Identifies the current attempt; bumped by every press, parent write and cancel. */
|
|
30
|
+
readonly ticket: number;
|
|
31
|
+
}
|
|
32
|
+
export interface FollowLabels {
|
|
33
|
+
/** Visible and default accessible text while not following. */
|
|
34
|
+
follow: string;
|
|
35
|
+
/** Visible text while following. */
|
|
36
|
+
following: string;
|
|
37
|
+
/** Text previewed while following, on hover or keyboard focus of a fine pointer. */
|
|
38
|
+
unfollow: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const DEFAULT_FOLLOW_LABELS: Readonly<FollowLabels>;
|
|
41
|
+
/** The glyph state StatusMorph is driven with. */
|
|
42
|
+
export type FollowMorphState = "idle" | "loading" | "error";
|
|
43
|
+
export type FollowOutcome = "commit" | "rollback" | "stale";
|
|
44
|
+
export declare function createFollowState(following: boolean): FollowState;
|
|
45
|
+
/** The value the control paints: the requested one while pending, the committed one otherwise. */
|
|
46
|
+
export declare function shownFollowing(state: FollowState): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* A user activation. Returns the pending state plus the value to hand to
|
|
49
|
+
* `onToggle`, or `null` while an attempt is already in flight (the click is
|
|
50
|
+
* swallowed, never queued). A press out of `error` is the retry.
|
|
51
|
+
*/
|
|
52
|
+
export declare function press(state: FollowState): {
|
|
53
|
+
state: FollowState;
|
|
54
|
+
ticket: number;
|
|
55
|
+
next: boolean;
|
|
56
|
+
} | null;
|
|
57
|
+
/**
|
|
58
|
+
* The attempt `ticket` finished. `ok` commits the requested value; failure
|
|
59
|
+
* keeps the committed one and parks the control in `error`. A ticket that is no
|
|
60
|
+
* longer current changes nothing and reports `stale`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function settle(state: FollowState, ticket: number, ok: boolean): {
|
|
63
|
+
state: FollowState;
|
|
64
|
+
outcome: FollowOutcome;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The parent wrote a value. It always wins: a pending attempt or a standing
|
|
68
|
+
* error is dropped and its ticket invalidated. Re-asserting what is already
|
|
69
|
+
* shown while idle is a no-op, so an echo of our own commit costs nothing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function adopt(state: FollowState, following: boolean): FollowState;
|
|
72
|
+
/** The error window ended. Only clears the error `ticket` armed it for, never a newer attempt. */
|
|
73
|
+
export declare function clearError(state: FollowState, ticket: number): FollowState;
|
|
74
|
+
/** Unmount: nothing in flight may write anything afterwards. */
|
|
75
|
+
export declare function cancel(state: FollowState): FollowState;
|
|
76
|
+
export declare function morphState(state: FollowState): FollowMorphState;
|
|
77
|
+
export declare function resolveLabels(labels?: Partial<FollowLabels> | null): FollowLabels;
|
|
78
|
+
/** The visible text for a state. The unfollow preview is a hover/focus overlay, not a state. */
|
|
79
|
+
export declare function visibleLabel(state: FollowState, labels: FollowLabels, errorLabel: string): string;
|
|
80
|
+
/** `name: outcome`, the single assertive announcement of a failed attempt. */
|
|
81
|
+
export declare function announcement(name: string, outcome: string): string;
|
|
82
|
+
/** A value `await` would wait for. A plain return commits synchronously instead. */
|
|
83
|
+
export declare function isThenable(value: unknown): value is PromiseLike<unknown>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const DEFAULT_FOLLOW_LABELS = {
|
|
2
|
+
follow: "Follow",
|
|
3
|
+
following: "Following",
|
|
4
|
+
unfollow: "Unfollow"
|
|
5
|
+
};
|
|
6
|
+
function createFollowState(following) {
|
|
7
|
+
return { following, phase: "idle", target: following, ticket: 0 };
|
|
8
|
+
}
|
|
9
|
+
function shownFollowing(state) {
|
|
10
|
+
return state.phase === "pending" ? state.target : state.following;
|
|
11
|
+
}
|
|
12
|
+
function press(state) {
|
|
13
|
+
if (state.phase === "pending") return null;
|
|
14
|
+
const next = !state.following;
|
|
15
|
+
const ticket = state.ticket + 1;
|
|
16
|
+
return {
|
|
17
|
+
state: { following: state.following, phase: "pending", target: next, ticket },
|
|
18
|
+
ticket,
|
|
19
|
+
next
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function settle(state, ticket, ok) {
|
|
23
|
+
if (state.phase !== "pending" || ticket !== state.ticket) return { state, outcome: "stale" };
|
|
24
|
+
if (ok) {
|
|
25
|
+
return {
|
|
26
|
+
state: { following: state.target, phase: "idle", target: state.target, ticket: state.ticket },
|
|
27
|
+
outcome: "commit"
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
state: {
|
|
32
|
+
following: state.following,
|
|
33
|
+
phase: "error",
|
|
34
|
+
target: state.following,
|
|
35
|
+
ticket: state.ticket
|
|
36
|
+
},
|
|
37
|
+
outcome: "rollback"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function adopt(state, following) {
|
|
41
|
+
if (state.phase === "idle" && state.following === following) return state;
|
|
42
|
+
return { following, phase: "idle", target: following, ticket: state.ticket + 1 };
|
|
43
|
+
}
|
|
44
|
+
function clearError(state, ticket) {
|
|
45
|
+
if (state.phase !== "error" || state.ticket !== ticket) return state;
|
|
46
|
+
return { ...state, phase: "idle" };
|
|
47
|
+
}
|
|
48
|
+
function cancel(state) {
|
|
49
|
+
return {
|
|
50
|
+
following: state.following,
|
|
51
|
+
phase: "idle",
|
|
52
|
+
target: state.following,
|
|
53
|
+
ticket: state.ticket + 1
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function morphState(state) {
|
|
57
|
+
return state.phase === "pending" ? "loading" : state.phase === "error" ? "error" : "idle";
|
|
58
|
+
}
|
|
59
|
+
function resolveLabels(labels) {
|
|
60
|
+
const resolved = { ...DEFAULT_FOLLOW_LABELS };
|
|
61
|
+
if (!labels) return resolved;
|
|
62
|
+
for (const key of Object.keys(DEFAULT_FOLLOW_LABELS)) {
|
|
63
|
+
const value = labels[key];
|
|
64
|
+
if (value !== void 0) resolved[key] = value;
|
|
65
|
+
}
|
|
66
|
+
return resolved;
|
|
67
|
+
}
|
|
68
|
+
function visibleLabel(state, labels, errorLabel) {
|
|
69
|
+
if (state.phase === "error") return errorLabel;
|
|
70
|
+
return shownFollowing(state) ? labels.following : labels.follow;
|
|
71
|
+
}
|
|
72
|
+
function announcement(name, outcome) {
|
|
73
|
+
return `${name}: ${outcome}`;
|
|
74
|
+
}
|
|
75
|
+
function isThenable(value) {
|
|
76
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
DEFAULT_FOLLOW_LABELS,
|
|
80
|
+
adopt,
|
|
81
|
+
announcement,
|
|
82
|
+
cancel,
|
|
83
|
+
clearError,
|
|
84
|
+
createFollowState,
|
|
85
|
+
isThenable,
|
|
86
|
+
morphState,
|
|
87
|
+
press,
|
|
88
|
+
resolveLabels,
|
|
89
|
+
settle,
|
|
90
|
+
shownFollowing,
|
|
91
|
+
visibleLabel
|
|
92
|
+
};
|