fancy-ui-svelte 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/fancy-ui/_template/Component.svelte +110 -0
- package/dist/fancy-ui/_template/Component.svelte.d.ts +16 -0
- package/dist/fancy-ui/_template/README.md +279 -0
- package/dist/fancy-ui/_template/index.d.ts +13 -0
- package/dist/fancy-ui/_template/index.js +27 -0
- package/dist/fancy-ui/_template/types.d.ts +53 -0
- package/dist/fancy-ui/_template/types.js +12 -0
- package/dist/fancy-ui/animated-beam/AnimatedBeam.svelte +166 -0
- package/dist/fancy-ui/animated-beam/AnimatedBeam.svelte.d.ts +4 -0
- package/dist/fancy-ui/animated-beam/AnimatedBeam.test.d.ts +1 -0
- package/dist/fancy-ui/animated-beam/AnimatedBeam.test.js +49 -0
- package/dist/fancy-ui/animated-beam/README.md +38 -0
- package/dist/fancy-ui/animated-beam/index.d.ts +2 -0
- package/dist/fancy-ui/animated-beam/index.js +1 -0
- package/dist/fancy-ui/animated-beam/types.d.ts +19 -0
- package/dist/fancy-ui/animated-beam/types.js +1 -0
- package/dist/fancy-ui/animated-testimonials/AnimatedTestimonials.svelte +196 -0
- package/dist/fancy-ui/animated-testimonials/AnimatedTestimonials.svelte.d.ts +29 -0
- package/dist/fancy-ui/animated-testimonials/AnimatedTestimonials.test.d.ts +1 -0
- package/dist/fancy-ui/animated-testimonials/AnimatedTestimonials.test.js +92 -0
- package/dist/fancy-ui/animated-testimonials/index.d.ts +2 -0
- package/dist/fancy-ui/animated-testimonials/index.js +1 -0
- package/dist/fancy-ui/animated-tooltip/AnimatedTooltip.svelte +97 -0
- package/dist/fancy-ui/animated-tooltip/AnimatedTooltip.svelte.d.ts +15 -0
- package/dist/fancy-ui/animated-tooltip/AnimatedTooltip.test.d.ts +1 -0
- package/dist/fancy-ui/animated-tooltip/AnimatedTooltip.test.js +67 -0
- package/dist/fancy-ui/animated-tooltip/index.d.ts +2 -0
- package/dist/fancy-ui/animated-tooltip/index.js +1 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCard.svelte +226 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCard.svelte.d.ts +27 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCardCarousel.svelte +49 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCardCarousel.svelte.d.ts +11 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCardCarousel.test.d.ts +1 -0
- package/dist/fancy-ui/apple-card-carousel/AppleCardCarousel.test.js +85 -0
- package/dist/fancy-ui/apple-card-carousel/index.d.ts +3 -0
- package/dist/fancy-ui/apple-card-carousel/index.js +2 -0
- package/dist/fancy-ui/bento-grid/BentoGrid.svelte +21 -0
- package/dist/fancy-ui/bento-grid/BentoGrid.svelte.d.ts +7 -0
- package/dist/fancy-ui/bento-grid/BentoGridCard.svelte +70 -0
- package/dist/fancy-ui/bento-grid/BentoGridCard.svelte.d.ts +12 -0
- package/dist/fancy-ui/bento-grid/BentoGridItem.svelte +39 -0
- package/dist/fancy-ui/bento-grid/BentoGridItem.svelte.d.ts +10 -0
- package/dist/fancy-ui/bento-grid/README.md +51 -0
- package/dist/fancy-ui/bento-grid/index.d.ts +3 -0
- package/dist/fancy-ui/bento-grid/index.js +3 -0
- package/dist/fancy-ui/bg-falling-stars/FallingStarsBg.svelte +163 -0
- package/dist/fancy-ui/bg-falling-stars/FallingStarsBg.svelte.d.ts +11 -0
- package/dist/fancy-ui/bg-falling-stars/FallingStarsBg.test.d.ts +1 -0
- package/dist/fancy-ui/bg-falling-stars/FallingStarsBg.test.js +50 -0
- package/dist/fancy-ui/bg-falling-stars/README.md +22 -0
- package/dist/fancy-ui/bg-falling-stars/index.d.ts +2 -0
- package/dist/fancy-ui/bg-falling-stars/index.js +1 -0
- package/dist/fancy-ui/bg-stars/README.md +41 -0
- package/dist/fancy-ui/bg-stars/StarsBackground.svelte +205 -0
- package/dist/fancy-ui/bg-stars/StarsBackground.svelte.d.ts +33 -0
- package/dist/fancy-ui/bg-stars/StarsBackground.test.d.ts +1 -0
- package/dist/fancy-ui/bg-stars/StarsBackground.test.js +46 -0
- package/dist/fancy-ui/bg-stars/index.d.ts +1 -0
- package/dist/fancy-ui/bg-stars/index.js +1 -0
- package/dist/fancy-ui/blur-reveal/BlurReveal.svelte +126 -0
- package/dist/fancy-ui/blur-reveal/BlurReveal.svelte.d.ts +18 -0
- package/dist/fancy-ui/blur-reveal/BlurReveal.test.d.ts +1 -0
- package/dist/fancy-ui/blur-reveal/BlurReveal.test.js +47 -0
- package/dist/fancy-ui/blur-reveal/README.md +41 -0
- package/dist/fancy-ui/blur-reveal/index.d.ts +2 -0
- package/dist/fancy-ui/blur-reveal/index.js +2 -0
- package/dist/fancy-ui/book/Book.svelte +89 -0
- package/dist/fancy-ui/book/Book.svelte.d.ts +15 -0
- package/dist/fancy-ui/book/Book.test.d.ts +1 -0
- package/dist/fancy-ui/book/Book.test.js +47 -0
- package/dist/fancy-ui/book/BookDescription.svelte +17 -0
- package/dist/fancy-ui/book/BookDescription.svelte.d.ts +8 -0
- package/dist/fancy-ui/book/BookHeader.svelte +17 -0
- package/dist/fancy-ui/book/BookHeader.svelte.d.ts +8 -0
- package/dist/fancy-ui/book/BookTitle.svelte +17 -0
- package/dist/fancy-ui/book/BookTitle.svelte.d.ts +8 -0
- package/dist/fancy-ui/book/README.md +34 -0
- package/dist/fancy-ui/book/index.d.ts +128 -0
- package/dist/fancy-ui/book/index.js +46 -0
- package/dist/fancy-ui/border-beam/BorderBeam.svelte +85 -0
- package/dist/fancy-ui/border-beam/BorderBeam.svelte.d.ts +27 -0
- package/dist/fancy-ui/border-beam/BorderBeam.test.d.ts +1 -0
- package/dist/fancy-ui/border-beam/BorderBeam.test.js +64 -0
- package/dist/fancy-ui/border-beam/index.d.ts +2 -0
- package/dist/fancy-ui/border-beam/index.js +2 -0
- package/dist/fancy-ui/box-reveal/BoxReveal.svelte +73 -0
- package/dist/fancy-ui/box-reveal/BoxReveal.svelte.d.ts +24 -0
- package/dist/fancy-ui/box-reveal/BoxReveal.test.d.ts +1 -0
- package/dist/fancy-ui/box-reveal/BoxReveal.test.js +66 -0
- package/dist/fancy-ui/box-reveal/README.md +24 -0
- package/dist/fancy-ui/box-reveal/index.d.ts +2 -0
- package/dist/fancy-ui/box-reveal/index.js +2 -0
- package/dist/fancy-ui/card-3d/CardBody.svelte +16 -0
- package/dist/fancy-ui/card-3d/CardBody.svelte.d.ts +7 -0
- package/dist/fancy-ui/card-3d/CardContainer.svelte +53 -0
- package/dist/fancy-ui/card-3d/CardContainer.svelte.d.ts +8 -0
- package/dist/fancy-ui/card-3d/CardItem.svelte +49 -0
- package/dist/fancy-ui/card-3d/CardItem.svelte.d.ts +14 -0
- package/dist/fancy-ui/card-3d/README.md +52 -0
- package/dist/fancy-ui/card-3d/index.d.ts +3 -0
- package/dist/fancy-ui/card-3d/index.js +3 -0
- package/dist/fancy-ui/card-spotlight/CardSpotlight.svelte +59 -0
- package/dist/fancy-ui/card-spotlight/CardSpotlight.svelte.d.ts +11 -0
- package/dist/fancy-ui/card-spotlight/README.md +24 -0
- package/dist/fancy-ui/card-spotlight/index.d.ts +1 -0
- package/dist/fancy-ui/card-spotlight/index.js +1 -0
- package/dist/fancy-ui/colourful-text/ColourfulText.svelte +78 -0
- package/dist/fancy-ui/colourful-text/ColourfulText.svelte.d.ts +22 -0
- package/dist/fancy-ui/colourful-text/ColourfulText.test.d.ts +1 -0
- package/dist/fancy-ui/colourful-text/ColourfulText.test.js +53 -0
- package/dist/fancy-ui/colourful-text/README.md +21 -0
- package/dist/fancy-ui/colourful-text/index.d.ts +2 -0
- package/dist/fancy-ui/colourful-text/index.js +2 -0
- package/dist/fancy-ui/compare/Compare.svelte +304 -0
- package/dist/fancy-ui/compare/Compare.svelte.d.ts +25 -0
- package/dist/fancy-ui/compare/Compare.test.d.ts +1 -0
- package/dist/fancy-ui/compare/Compare.test.js +57 -0
- package/dist/fancy-ui/compare/README.md +97 -0
- package/dist/fancy-ui/compare/StarField.svelte +108 -0
- package/dist/fancy-ui/compare/StarField.svelte.d.ts +7 -0
- package/dist/fancy-ui/compare/index.d.ts +2 -0
- package/dist/fancy-ui/compare/index.js +2 -0
- package/dist/fancy-ui/confetti/Confetti.svelte +60 -0
- package/dist/fancy-ui/confetti/Confetti.svelte.d.ts +14 -0
- package/dist/fancy-ui/confetti/Confetti.test.d.ts +1 -0
- package/dist/fancy-ui/confetti/Confetti.test.js +39 -0
- package/dist/fancy-ui/confetti/ConfettiButton.svelte +41 -0
- package/dist/fancy-ui/confetti/ConfettiButton.svelte.d.ts +9 -0
- package/dist/fancy-ui/confetti/README.md +22 -0
- package/dist/fancy-ui/confetti/index.d.ts +2 -0
- package/dist/fancy-ui/confetti/index.js +2 -0
- package/dist/fancy-ui/container-scroll/ContainerScroll.svelte +82 -0
- package/dist/fancy-ui/container-scroll/ContainerScroll.svelte.d.ts +9 -0
- package/dist/fancy-ui/container-scroll/ContainerScroll.test.d.ts +1 -0
- package/dist/fancy-ui/container-scroll/ContainerScroll.test.js +34 -0
- package/dist/fancy-ui/container-scroll/README.md +28 -0
- package/dist/fancy-ui/container-scroll/index.d.ts +1 -0
- package/dist/fancy-ui/container-scroll/index.js +1 -0
- package/dist/fancy-ui/container-text-flip/ContainerTextFlip.svelte +78 -0
- package/dist/fancy-ui/container-text-flip/ContainerTextFlip.svelte.d.ts +10 -0
- package/dist/fancy-ui/container-text-flip/ContainerTextFlip.test.d.ts +1 -0
- package/dist/fancy-ui/container-text-flip/ContainerTextFlip.test.js +46 -0
- package/dist/fancy-ui/container-text-flip/README.md +22 -0
- package/dist/fancy-ui/container-text-flip/index.d.ts +1 -0
- package/dist/fancy-ui/container-text-flip/index.js +1 -0
- package/dist/fancy-ui/direction-aware-hover/DirectionAwareHover.svelte +232 -0
- package/dist/fancy-ui/direction-aware-hover/DirectionAwareHover.svelte.d.ts +11 -0
- package/dist/fancy-ui/direction-aware-hover/DirectionAwareHover.test.d.ts +1 -0
- package/dist/fancy-ui/direction-aware-hover/DirectionAwareHover.test.js +78 -0
- package/dist/fancy-ui/direction-aware-hover/README.md +47 -0
- package/dist/fancy-ui/direction-aware-hover/index.d.ts +1 -0
- package/dist/fancy-ui/direction-aware-hover/index.js +1 -0
- package/dist/fancy-ui/displacement-text/DisplacementText.svelte +224 -0
- package/dist/fancy-ui/displacement-text/DisplacementText.svelte.d.ts +19 -0
- package/dist/fancy-ui/displacement-text/DisplacementText.test.d.ts +1 -0
- package/dist/fancy-ui/displacement-text/DisplacementText.test.js +144 -0
- package/dist/fancy-ui/displacement-text/index.d.ts +2 -0
- package/dist/fancy-ui/displacement-text/index.js +1 -0
- package/dist/fancy-ui/dock/Dock.svelte +87 -0
- package/dist/fancy-ui/dock/Dock.svelte.d.ts +12 -0
- package/dist/fancy-ui/dock/Dock.test.d.ts +1 -0
- package/dist/fancy-ui/dock/Dock.test.js +51 -0
- package/dist/fancy-ui/dock/DockIcon.svelte +50 -0
- package/dist/fancy-ui/dock/DockIcon.svelte.d.ts +7 -0
- package/dist/fancy-ui/dock/DockSeparator.svelte +21 -0
- package/dist/fancy-ui/dock/DockSeparator.svelte.d.ts +6 -0
- package/dist/fancy-ui/dock/README.md +57 -0
- package/dist/fancy-ui/dock/index.d.ts +4 -0
- package/dist/fancy-ui/dock/index.js +4 -0
- package/dist/fancy-ui/dock/types.d.ts +14 -0
- package/dist/fancy-ui/dock/types.js +1 -0
- package/dist/fancy-ui/flickering-grid/FlickeringGrid.svelte +154 -0
- package/dist/fancy-ui/flickering-grid/FlickeringGrid.svelte.d.ts +27 -0
- package/dist/fancy-ui/flickering-grid/FlickeringGrid.test.d.ts +1 -0
- package/dist/fancy-ui/flickering-grid/FlickeringGrid.test.js +34 -0
- package/dist/fancy-ui/flickering-grid/README.md +24 -0
- package/dist/fancy-ui/flickering-grid/index.d.ts +2 -0
- package/dist/fancy-ui/flickering-grid/index.js +2 -0
- package/dist/fancy-ui/flip-card/FlipCard.svelte +48 -0
- package/dist/fancy-ui/flip-card/FlipCard.svelte.d.ts +10 -0
- package/dist/fancy-ui/flip-card/FlipCard.test.d.ts +1 -0
- package/dist/fancy-ui/flip-card/FlipCard.test.js +36 -0
- package/dist/fancy-ui/flip-card/README.md +26 -0
- package/dist/fancy-ui/flip-card/index.d.ts +1 -0
- package/dist/fancy-ui/flip-card/index.js +1 -0
- package/dist/fancy-ui/flip-words/FlipWords.svelte +135 -0
- package/dist/fancy-ui/flip-words/FlipWords.svelte.d.ts +18 -0
- package/dist/fancy-ui/flip-words/FlipWords.test.d.ts +1 -0
- package/dist/fancy-ui/flip-words/FlipWords.test.js +50 -0
- package/dist/fancy-ui/flip-words/README.md +17 -0
- package/dist/fancy-ui/flip-words/index.d.ts +2 -0
- package/dist/fancy-ui/flip-words/index.js +2 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.svelte +1378 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.svelte.d.ts +25 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.test.d.ts +1 -0
- package/dist/fancy-ui/fluid-cursor/FluidCursor.test.js +41 -0
- package/dist/fancy-ui/fluid-cursor/README.md +34 -0
- package/dist/fancy-ui/fluid-cursor/index.d.ts +1 -0
- package/dist/fancy-ui/fluid-cursor/index.js +1 -0
- package/dist/fancy-ui/focus/Focus.svelte +177 -0
- package/dist/fancy-ui/focus/Focus.svelte.d.ts +12 -0
- package/dist/fancy-ui/focus/Focus.test.d.ts +1 -0
- package/dist/fancy-ui/focus/Focus.test.js +48 -0
- package/dist/fancy-ui/focus/README.md +21 -0
- package/dist/fancy-ui/focus/index.d.ts +1 -0
- package/dist/fancy-ui/focus/index.js +1 -0
- package/dist/fancy-ui/glare-card/GlareCard.svelte +133 -0
- package/dist/fancy-ui/glare-card/GlareCard.svelte.d.ts +8 -0
- package/dist/fancy-ui/glare-card/GlareCard.test.d.ts +1 -0
- package/dist/fancy-ui/glare-card/GlareCard.test.js +40 -0
- package/dist/fancy-ui/glare-card/README.md +24 -0
- package/dist/fancy-ui/glare-card/index.d.ts +1 -0
- package/dist/fancy-ui/glare-card/index.js +1 -0
- package/dist/fancy-ui/glow-border/GlowBorder.svelte +67 -0
- package/dist/fancy-ui/glow-border/GlowBorder.svelte.d.ts +10 -0
- package/dist/fancy-ui/glow-border/GlowBorder.test.d.ts +1 -0
- package/dist/fancy-ui/glow-border/GlowBorder.test.js +57 -0
- package/dist/fancy-ui/glow-border/README.md +54 -0
- package/dist/fancy-ui/glow-border/index.d.ts +1 -0
- package/dist/fancy-ui/glow-border/index.js +1 -0
- package/dist/fancy-ui/glowing-effect/GlowingEffect.svelte +182 -0
- package/dist/fancy-ui/glowing-effect/GlowingEffect.svelte.d.ts +15 -0
- package/dist/fancy-ui/glowing-effect/GlowingEffect.test.d.ts +1 -0
- package/dist/fancy-ui/glowing-effect/GlowingEffect.test.js +68 -0
- package/dist/fancy-ui/glowing-effect/README.md +29 -0
- package/dist/fancy-ui/glowing-effect/index.d.ts +1 -0
- package/dist/fancy-ui/glowing-effect/index.js +1 -0
- package/dist/fancy-ui/gradient-button/GradientButton.svelte +103 -0
- package/dist/fancy-ui/gradient-button/GradientButton.svelte.d.ts +24 -0
- package/dist/fancy-ui/gradient-button/GradientButton.test.d.ts +1 -0
- package/dist/fancy-ui/gradient-button/GradientButton.test.js +65 -0
- package/dist/fancy-ui/gradient-button/README.md +10 -0
- package/dist/fancy-ui/gradient-button/index.d.ts +2 -0
- package/dist/fancy-ui/gradient-button/index.js +2 -0
- package/dist/fancy-ui/hyper-text/HyperText.svelte +112 -0
- package/dist/fancy-ui/hyper-text/HyperText.svelte.d.ts +20 -0
- package/dist/fancy-ui/hyper-text/HyperText.test.d.ts +1 -0
- package/dist/fancy-ui/hyper-text/HyperText.test.js +39 -0
- package/dist/fancy-ui/hyper-text/README.md +19 -0
- package/dist/fancy-ui/hyper-text/index.d.ts +2 -0
- package/dist/fancy-ui/hyper-text/index.js +2 -0
- package/dist/fancy-ui/image-trail-cursor/ImageTrailCursor.svelte +89 -0
- package/dist/fancy-ui/image-trail-cursor/ImageTrailCursor.svelte.d.ts +9 -0
- package/dist/fancy-ui/image-trail-cursor/ImageTrailCursor.test.d.ts +1 -0
- package/dist/fancy-ui/image-trail-cursor/ImageTrailCursor.test.js +60 -0
- package/dist/fancy-ui/image-trail-cursor/README.md +36 -0
- package/dist/fancy-ui/image-trail-cursor/index.d.ts +3 -0
- package/dist/fancy-ui/image-trail-cursor/index.js +1 -0
- package/dist/fancy-ui/image-trail-cursor/trail-variants.d.ts +107 -0
- package/dist/fancy-ui/image-trail-cursor/trail-variants.js +703 -0
- package/dist/fancy-ui/index.d.ts +52 -0
- package/dist/fancy-ui/index.js +64 -0
- package/dist/fancy-ui/interactive-grid-pattern/InteractiveGridPattern.svelte +71 -0
- package/dist/fancy-ui/interactive-grid-pattern/InteractiveGridPattern.svelte.d.ts +15 -0
- package/dist/fancy-ui/interactive-grid-pattern/InteractiveGridPattern.test.d.ts +1 -0
- package/dist/fancy-ui/interactive-grid-pattern/InteractiveGridPattern.test.js +47 -0
- package/dist/fancy-ui/interactive-grid-pattern/README.md +30 -0
- package/dist/fancy-ui/interactive-grid-pattern/index.d.ts +2 -0
- package/dist/fancy-ui/interactive-grid-pattern/index.js +2 -0
- package/dist/fancy-ui/interactive-hover-button/InteractiveHoverButton.svelte +75 -0
- package/dist/fancy-ui/interactive-hover-button/InteractiveHoverButton.svelte.d.ts +14 -0
- package/dist/fancy-ui/interactive-hover-button/InteractiveHoverButton.test.d.ts +1 -0
- package/dist/fancy-ui/interactive-hover-button/InteractiveHoverButton.test.js +64 -0
- package/dist/fancy-ui/interactive-hover-button/README.md +28 -0
- package/dist/fancy-ui/interactive-hover-button/index.d.ts +2 -0
- package/dist/fancy-ui/interactive-hover-button/index.js +2 -0
- package/dist/fancy-ui/letter-pullup/LetterPullup.svelte +58 -0
- package/dist/fancy-ui/letter-pullup/LetterPullup.svelte.d.ts +17 -0
- package/dist/fancy-ui/letter-pullup/LetterPullup.test.d.ts +1 -0
- package/dist/fancy-ui/letter-pullup/LetterPullup.test.js +49 -0
- package/dist/fancy-ui/letter-pullup/README.md +18 -0
- package/dist/fancy-ui/letter-pullup/index.d.ts +2 -0
- package/dist/fancy-ui/letter-pullup/index.js +2 -0
- package/dist/fancy-ui/line-hover-link/LineHoverLink.svelte +450 -0
- package/dist/fancy-ui/line-hover-link/LineHoverLink.svelte.d.ts +35 -0
- package/dist/fancy-ui/line-hover-link/LineHoverLink.test.d.ts +1 -0
- package/dist/fancy-ui/line-hover-link/LineHoverLink.test.js +55 -0
- package/dist/fancy-ui/line-hover-link/index.d.ts +2 -0
- package/dist/fancy-ui/line-hover-link/index.js +1 -0
- package/dist/fancy-ui/line-shadow-text/LineShadowText.svelte +63 -0
- package/dist/fancy-ui/line-shadow-text/LineShadowText.svelte.d.ts +9 -0
- package/dist/fancy-ui/line-shadow-text/LineShadowText.test.d.ts +1 -0
- package/dist/fancy-ui/line-shadow-text/LineShadowText.test.js +59 -0
- package/dist/fancy-ui/line-shadow-text/README.md +12 -0
- package/dist/fancy-ui/line-shadow-text/index.d.ts +2 -0
- package/dist/fancy-ui/line-shadow-text/index.js +1 -0
- package/dist/fancy-ui/liquid-glass/LiquidGlass.svelte +204 -0
- package/dist/fancy-ui/liquid-glass/LiquidGlass.svelte.d.ts +23 -0
- package/dist/fancy-ui/liquid-glass/LiquidGlass.test.d.ts +1 -0
- package/dist/fancy-ui/liquid-glass/LiquidGlass.test.js +48 -0
- package/dist/fancy-ui/liquid-glass/README.md +34 -0
- package/dist/fancy-ui/liquid-glass/index.d.ts +1 -0
- package/dist/fancy-ui/liquid-glass/index.js +1 -0
- package/dist/fancy-ui/logo-cloud/AnimatedLogoCloud.svelte +61 -0
- package/dist/fancy-ui/logo-cloud/AnimatedLogoCloud.svelte.d.ts +15 -0
- package/dist/fancy-ui/logo-cloud/AnimatedLogoCloud.test.d.ts +1 -0
- package/dist/fancy-ui/logo-cloud/AnimatedLogoCloud.test.js +59 -0
- package/dist/fancy-ui/logo-cloud/IconLogoCloud.svelte +31 -0
- package/dist/fancy-ui/logo-cloud/IconLogoCloud.svelte.d.ts +11 -0
- package/dist/fancy-ui/logo-cloud/README.md +41 -0
- package/dist/fancy-ui/logo-cloud/StaticLogoCloud.svelte +31 -0
- package/dist/fancy-ui/logo-cloud/StaticLogoCloud.svelte.d.ts +11 -0
- package/dist/fancy-ui/logo-cloud/index.d.ts +4 -0
- package/dist/fancy-ui/logo-cloud/index.js +4 -0
- package/dist/fancy-ui/marquee/Marquee.svelte +70 -0
- package/dist/fancy-ui/marquee/Marquee.svelte.d.ts +11 -0
- package/dist/fancy-ui/marquee/Marquee.test.d.ts +1 -0
- package/dist/fancy-ui/marquee/Marquee.test.js +46 -0
- package/dist/fancy-ui/marquee/ReviewCard.svelte +25 -0
- package/dist/fancy-ui/marquee/ReviewCard.svelte.d.ts +9 -0
- package/dist/fancy-ui/marquee/index.d.ts +2 -0
- package/dist/fancy-ui/marquee/index.js +2 -0
- package/dist/fancy-ui/meteors/Meteors.svelte +59 -0
- package/dist/fancy-ui/meteors/Meteors.svelte.d.ts +15 -0
- package/dist/fancy-ui/meteors/Meteors.test.d.ts +1 -0
- package/dist/fancy-ui/meteors/Meteors.test.js +48 -0
- package/dist/fancy-ui/meteors/README.md +18 -0
- package/dist/fancy-ui/meteors/index.d.ts +2 -0
- package/dist/fancy-ui/meteors/index.js +2 -0
- package/dist/fancy-ui/neon-border/NeonBorder.svelte +135 -0
- package/dist/fancy-ui/neon-border/NeonBorder.svelte.d.ts +24 -0
- package/dist/fancy-ui/neon-border/NeonBorder.test.d.ts +1 -0
- package/dist/fancy-ui/neon-border/NeonBorder.test.js +80 -0
- package/dist/fancy-ui/neon-border/README.md +27 -0
- package/dist/fancy-ui/neon-border/index.d.ts +2 -0
- package/dist/fancy-ui/neon-border/index.js +2 -0
- package/dist/fancy-ui/number-ticker/NumberTicker.svelte +126 -0
- package/dist/fancy-ui/number-ticker/NumberTicker.svelte.d.ts +24 -0
- package/dist/fancy-ui/number-ticker/NumberTicker.test.d.ts +1 -0
- package/dist/fancy-ui/number-ticker/NumberTicker.test.js +64 -0
- package/dist/fancy-ui/number-ticker/README.md +22 -0
- package/dist/fancy-ui/number-ticker/index.d.ts +2 -0
- package/dist/fancy-ui/number-ticker/index.js +2 -0
- package/dist/fancy-ui/rainbow-button/RainbowButton.svelte +96 -0
- package/dist/fancy-ui/rainbow-button/RainbowButton.svelte.d.ts +18 -0
- package/dist/fancy-ui/rainbow-button/RainbowButton.test.d.ts +1 -0
- package/dist/fancy-ui/rainbow-button/RainbowButton.test.js +51 -0
- package/dist/fancy-ui/rainbow-button/index.d.ts +2 -0
- package/dist/fancy-ui/rainbow-button/index.js +2 -0
- package/dist/fancy-ui/registry.d.ts +72 -0
- package/dist/fancy-ui/registry.js +643 -0
- package/dist/fancy-ui/ripple/README.md +16 -0
- package/dist/fancy-ui/ripple/Ripple.svelte +64 -0
- package/dist/fancy-ui/ripple/Ripple.svelte.d.ts +13 -0
- package/dist/fancy-ui/ripple/Ripple.test.d.ts +1 -0
- package/dist/fancy-ui/ripple/Ripple.test.js +81 -0
- package/dist/fancy-ui/ripple/index.d.ts +1 -0
- package/dist/fancy-ui/ripple/index.js +1 -0
- package/dist/fancy-ui/ripple-button/RippleButton.svelte +111 -0
- package/dist/fancy-ui/ripple-button/RippleButton.svelte.d.ts +15 -0
- package/dist/fancy-ui/ripple-button/RippleButton.test.d.ts +1 -0
- package/dist/fancy-ui/ripple-button/RippleButton.test.js +44 -0
- package/dist/fancy-ui/ripple-button/index.d.ts +2 -0
- package/dist/fancy-ui/ripple-button/index.js +2 -0
- package/dist/fancy-ui/shimmer-button/README.md +10 -0
- package/dist/fancy-ui/shimmer-button/ShimmerButton.svelte +115 -0
- package/dist/fancy-ui/shimmer-button/ShimmerButton.svelte.d.ts +22 -0
- package/dist/fancy-ui/shimmer-button/ShimmerButton.test.d.ts +1 -0
- package/dist/fancy-ui/shimmer-button/ShimmerButton.test.js +69 -0
- package/dist/fancy-ui/shimmer-button/index.d.ts +2 -0
- package/dist/fancy-ui/shimmer-button/index.js +2 -0
- package/dist/fancy-ui/smooth-cursor/README.md +23 -0
- package/dist/fancy-ui/smooth-cursor/SmoothCursor.svelte +224 -0
- package/dist/fancy-ui/smooth-cursor/SmoothCursor.svelte.d.ts +20 -0
- package/dist/fancy-ui/smooth-cursor/index.d.ts +2 -0
- package/dist/fancy-ui/smooth-cursor/index.js +1 -0
- package/dist/fancy-ui/sparkles/README.md +15 -0
- package/dist/fancy-ui/sparkles/Sparkles.svelte +123 -0
- package/dist/fancy-ui/sparkles/Sparkles.svelte.d.ts +12 -0
- package/dist/fancy-ui/sparkles/Sparkles.test.d.ts +1 -0
- package/dist/fancy-ui/sparkles/Sparkles.test.js +66 -0
- package/dist/fancy-ui/sparkles/index.d.ts +1 -0
- package/dist/fancy-ui/sparkles/index.js +1 -0
- package/dist/fancy-ui/sparkles-text/README.md +19 -0
- package/dist/fancy-ui/sparkles-text/SparklesText.svelte +112 -0
- package/dist/fancy-ui/sparkles-text/SparklesText.svelte.d.ts +22 -0
- package/dist/fancy-ui/sparkles-text/SparklesText.test.d.ts +1 -0
- package/dist/fancy-ui/sparkles-text/SparklesText.test.js +54 -0
- package/dist/fancy-ui/sparkles-text/index.d.ts +2 -0
- package/dist/fancy-ui/sparkles-text/index.js +2 -0
- package/dist/fancy-ui/tailwind.css +3 -0
- package/dist/fancy-ui/text-generate-effect/README.md +14 -0
- package/dist/fancy-ui/text-generate-effect/TextGenerateEffect.svelte +66 -0
- package/dist/fancy-ui/text-generate-effect/TextGenerateEffect.svelte.d.ts +11 -0
- package/dist/fancy-ui/text-generate-effect/TextGenerateEffect.test.d.ts +1 -0
- package/dist/fancy-ui/text-generate-effect/TextGenerateEffect.test.js +73 -0
- package/dist/fancy-ui/text-generate-effect/index.d.ts +2 -0
- package/dist/fancy-ui/text-generate-effect/index.js +1 -0
- package/dist/fancy-ui/text-reveal-card/README.md +36 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealCard.svelte +112 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealCard.svelte.d.ts +12 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealCard.test.d.ts +1 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealCard.test.js +34 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealStars.svelte +76 -0
- package/dist/fancy-ui/text-reveal-card/TextRevealStars.svelte.d.ts +7 -0
- package/dist/fancy-ui/text-reveal-card/index.d.ts +2 -0
- package/dist/fancy-ui/text-reveal-card/index.js +2 -0
- package/dist/fancy-ui/timeline/README.md +56 -0
- package/dist/fancy-ui/timeline/Timeline.svelte +141 -0
- package/dist/fancy-ui/timeline/Timeline.svelte.d.ts +20 -0
- package/dist/fancy-ui/timeline/Timeline.test.d.ts +1 -0
- package/dist/fancy-ui/timeline/Timeline.test.js +63 -0
- package/dist/fancy-ui/timeline/index.d.ts +2 -0
- package/dist/fancy-ui/timeline/index.js +2 -0
- package/dist/fancy-ui/tracing-beam/README.md +24 -0
- package/dist/fancy-ui/tracing-beam/TracingBeam.svelte +156 -0
- package/dist/fancy-ui/tracing-beam/TracingBeam.svelte.d.ts +8 -0
- package/dist/fancy-ui/tracing-beam/TracingBeam.test.d.ts +1 -0
- package/dist/fancy-ui/tracing-beam/TracingBeam.test.js +61 -0
- package/dist/fancy-ui/tracing-beam/index.d.ts +1 -0
- package/dist/fancy-ui/tracing-beam/index.js +1 -0
- package/dist/types.d.ts +87 -0
- package/dist/types.js +6 -0
- package/dist/utils.d.ts +12 -0
- package/dist/utils.js +5 -0
- package/package.json +105 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import { fade } from "svelte/transition";
|
|
5
|
+
|
|
6
|
+
type Direction = "top" | "bottom" | "left" | "right";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
imageUrl: string;
|
|
10
|
+
imageAlt?: string;
|
|
11
|
+
childrenClass?: string;
|
|
12
|
+
imageClass?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
children?: import("svelte").Snippet;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
imageUrl,
|
|
19
|
+
imageAlt = "image",
|
|
20
|
+
childrenClass: childrenClassProp = "",
|
|
21
|
+
imageClass: imageClassProp = "",
|
|
22
|
+
class: className = "",
|
|
23
|
+
children,
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
let divRef: HTMLDivElement;
|
|
27
|
+
let direction = $state<Direction | null>(null);
|
|
28
|
+
let isTouched = $state(false);
|
|
29
|
+
let isMobile = $state(false);
|
|
30
|
+
let touchTimer: ReturnType<typeof setTimeout> | null = null;
|
|
31
|
+
|
|
32
|
+
function detectMobile() {
|
|
33
|
+
isMobile = window.matchMedia("(max-width: 768px)").matches || "ontouchstart" in window;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getDirection(
|
|
37
|
+
ev: MouseEvent | { clientX: number; clientY: number },
|
|
38
|
+
obj: HTMLElement
|
|
39
|
+
): number {
|
|
40
|
+
const { width: w, height: h, left, top } = obj.getBoundingClientRect();
|
|
41
|
+
const x = ev.clientX - left - (w / 2) * (w > h ? h / w : 1);
|
|
42
|
+
const y = ev.clientY - top - (h / 2) * (h > w ? w / h : 1);
|
|
43
|
+
const d = Math.round(Math.atan2(y, x) / 1.57079633 + 5) % 4;
|
|
44
|
+
return d;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function mapDirection(d: number): Direction {
|
|
48
|
+
switch (d) {
|
|
49
|
+
case 0:
|
|
50
|
+
return "top";
|
|
51
|
+
case 1:
|
|
52
|
+
return "right";
|
|
53
|
+
case 2:
|
|
54
|
+
return "bottom";
|
|
55
|
+
case 3:
|
|
56
|
+
return "left";
|
|
57
|
+
default:
|
|
58
|
+
return "left";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function handleMouseEnter(event: MouseEvent) {
|
|
63
|
+
if (isMobile) return;
|
|
64
|
+
if (!divRef) return;
|
|
65
|
+
|
|
66
|
+
const fetchedDirection = getDirection(event, divRef);
|
|
67
|
+
direction = mapDirection(fetchedDirection);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function handleMouseLeave() {
|
|
71
|
+
if (isMobile) return;
|
|
72
|
+
direction = null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function handleTouchStart(event: TouchEvent) {
|
|
76
|
+
if (!isMobile) return;
|
|
77
|
+
|
|
78
|
+
isTouched = true;
|
|
79
|
+
|
|
80
|
+
if (!divRef) return;
|
|
81
|
+
const touch = event.touches[0];
|
|
82
|
+
const fetchedDirection = getDirection(
|
|
83
|
+
{ clientX: touch.clientX, clientY: touch.clientY },
|
|
84
|
+
divRef
|
|
85
|
+
);
|
|
86
|
+
direction = mapDirection(fetchedDirection);
|
|
87
|
+
|
|
88
|
+
// Auto-hide after 3 seconds on mobile
|
|
89
|
+
if (touchTimer) clearTimeout(touchTimer);
|
|
90
|
+
touchTimer = setTimeout(() => {
|
|
91
|
+
handleTouchEnd();
|
|
92
|
+
}, 3000);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function handleTouchEnd() {
|
|
96
|
+
if (touchTimer) {
|
|
97
|
+
clearTimeout(touchTimer);
|
|
98
|
+
touchTimer = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
direction = null;
|
|
103
|
+
isTouched = false;
|
|
104
|
+
}, 300);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let containerClass = $derived(
|
|
108
|
+
cn(
|
|
109
|
+
"group/card relative overflow-hidden rounded-lg bg-transparent transition-all duration-300",
|
|
110
|
+
"h-48 w-48",
|
|
111
|
+
"sm:h-64 sm:w-64",
|
|
112
|
+
"md:h-80 md:w-80",
|
|
113
|
+
"lg:h-96 lg:w-96",
|
|
114
|
+
"xl:h-[28rem] xl:w-[28rem]",
|
|
115
|
+
"touch-manipulation",
|
|
116
|
+
"active:scale-[0.98]",
|
|
117
|
+
"md:active:scale-100",
|
|
118
|
+
className
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
let imageClass = $derived(
|
|
123
|
+
cn(
|
|
124
|
+
"h-full w-full object-cover transition-transform duration-300",
|
|
125
|
+
"scale-125",
|
|
126
|
+
"sm:scale-[1.35]",
|
|
127
|
+
"md:scale-150",
|
|
128
|
+
imageClassProp
|
|
129
|
+
)
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
let childrenClass = $derived(
|
|
133
|
+
cn(
|
|
134
|
+
"absolute z-40 text-white transition-opacity duration-300",
|
|
135
|
+
"bottom-2 left-2 text-sm",
|
|
136
|
+
"sm:bottom-3 sm:left-3 sm:text-base",
|
|
137
|
+
"md:bottom-4 md:left-4 md:text-lg",
|
|
138
|
+
childrenClassProp
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
let overlayClass = $derived.by(() => {
|
|
143
|
+
const baseClasses = "absolute inset-0 z-10 transition-all duration-300";
|
|
144
|
+
const backgroundClasses = "bg-black/40 dark:bg-black/60";
|
|
145
|
+
|
|
146
|
+
let transformClasses = "";
|
|
147
|
+
switch (direction) {
|
|
148
|
+
case "top":
|
|
149
|
+
transformClasses = "-translate-y-full group-hover/card:translate-y-0";
|
|
150
|
+
break;
|
|
151
|
+
case "bottom":
|
|
152
|
+
transformClasses = "translate-y-full group-hover/card:translate-y-0";
|
|
153
|
+
break;
|
|
154
|
+
case "left":
|
|
155
|
+
transformClasses = "-translate-x-full group-hover/card:translate-x-0";
|
|
156
|
+
break;
|
|
157
|
+
case "right":
|
|
158
|
+
transformClasses = "translate-x-full group-hover/card:translate-x-0";
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
transformClasses = "";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return cn(baseClasses, backgroundClasses, transformClasses);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
let imageContainerClass = $derived(
|
|
168
|
+
cn("relative size-full bg-gray-50 transition-transform duration-300 dark:bg-black", {
|
|
169
|
+
"translate-y-2 md:translate-y-5": direction === "top",
|
|
170
|
+
"-translate-y-2 md:-translate-y-5": direction === "bottom",
|
|
171
|
+
"translate-x-2 md:translate-x-5": direction === "left",
|
|
172
|
+
"-translate-x-2 md:-translate-x-5": direction === "right",
|
|
173
|
+
})
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
onMount(() => {
|
|
177
|
+
detectMobile();
|
|
178
|
+
window.addEventListener("resize", detectMobile);
|
|
179
|
+
|
|
180
|
+
return () => {
|
|
181
|
+
window.removeEventListener("resize", detectMobile);
|
|
182
|
+
if (touchTimer) {
|
|
183
|
+
clearTimeout(touchTimer);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<div
|
|
190
|
+
bind:this={divRef}
|
|
191
|
+
class={containerClass}
|
|
192
|
+
onmouseenter={handleMouseEnter}
|
|
193
|
+
onmouseleave={handleMouseLeave}
|
|
194
|
+
ontouchstart={handleTouchStart}
|
|
195
|
+
ontouchend={handleTouchEnd}
|
|
196
|
+
role="figure"
|
|
197
|
+
>
|
|
198
|
+
<div class="relative size-full overflow-hidden">
|
|
199
|
+
{#if direction !== null}
|
|
200
|
+
<div class={overlayClass} transition:fade={{ duration: 300 }}></div>
|
|
201
|
+
{/if}
|
|
202
|
+
|
|
203
|
+
<div class={imageContainerClass}>
|
|
204
|
+
<img src={imageUrl} alt={imageAlt} class={imageClass} width="1000" height="1000" />
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
{#if direction !== null || isTouched}
|
|
208
|
+
<div class={childrenClass} transition:fade={{ duration: 300 }}>
|
|
209
|
+
{#if children}
|
|
210
|
+
{@render children()}
|
|
211
|
+
{/if}
|
|
212
|
+
</div>
|
|
213
|
+
{/if}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<style>
|
|
218
|
+
/* Enhanced mobile touch targets */
|
|
219
|
+
@media (max-width: 768px) {
|
|
220
|
+
:global(.group\/card) {
|
|
221
|
+
min-height: 44px;
|
|
222
|
+
min-width: 44px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Smooth transitions for reduced motion preference */
|
|
227
|
+
@media (prefers-reduced-motion: reduce) {
|
|
228
|
+
:global(*) {
|
|
229
|
+
transition-duration: 0.1s !important;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
imageUrl: string;
|
|
3
|
+
imageAlt?: string;
|
|
4
|
+
childrenClass?: string;
|
|
5
|
+
imageClass?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: import("svelte").Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const DirectionAwareHover: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type DirectionAwareHover = ReturnType<typeof DirectionAwareHover>;
|
|
11
|
+
export default DirectionAwareHover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { render, cleanup } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
|
|
3
|
+
import DirectionAwareHover from "./DirectionAwareHover.svelte";
|
|
4
|
+
describe("DirectionAwareHover", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
// Mock window.matchMedia (not available in jsdom)
|
|
7
|
+
Object.defineProperty(window, "matchMedia", {
|
|
8
|
+
writable: true,
|
|
9
|
+
value: vi.fn().mockImplementation((query) => ({
|
|
10
|
+
matches: false,
|
|
11
|
+
media: query,
|
|
12
|
+
onchange: null,
|
|
13
|
+
addListener: vi.fn(),
|
|
14
|
+
removeListener: vi.fn(),
|
|
15
|
+
addEventListener: vi.fn(),
|
|
16
|
+
removeEventListener: vi.fn(),
|
|
17
|
+
dispatchEvent: vi.fn(),
|
|
18
|
+
})),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
afterEach(cleanup);
|
|
22
|
+
it("renders a figure container", () => {
|
|
23
|
+
const { container } = render(DirectionAwareHover, {
|
|
24
|
+
props: { imageUrl: "/test.jpg" },
|
|
25
|
+
});
|
|
26
|
+
const figure = container.querySelector('[role="figure"]');
|
|
27
|
+
expect(figure).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
it("renders an image with correct src", () => {
|
|
30
|
+
const { container } = render(DirectionAwareHover, {
|
|
31
|
+
props: { imageUrl: "/test.jpg" },
|
|
32
|
+
});
|
|
33
|
+
const img = container.querySelector("img");
|
|
34
|
+
expect(img).toHaveAttribute("src", "/test.jpg");
|
|
35
|
+
});
|
|
36
|
+
it("renders an image with correct alt", () => {
|
|
37
|
+
const { container } = render(DirectionAwareHover, {
|
|
38
|
+
props: { imageUrl: "/test.jpg", imageAlt: "My image" },
|
|
39
|
+
});
|
|
40
|
+
const img = container.querySelector("img");
|
|
41
|
+
expect(img).toHaveAttribute("alt", "My image");
|
|
42
|
+
});
|
|
43
|
+
it("uses default alt text", () => {
|
|
44
|
+
const { container } = render(DirectionAwareHover, {
|
|
45
|
+
props: { imageUrl: "/test.jpg" },
|
|
46
|
+
});
|
|
47
|
+
const img = container.querySelector("img");
|
|
48
|
+
expect(img).toHaveAttribute("alt", "image");
|
|
49
|
+
});
|
|
50
|
+
it("has overflow-hidden class on the container", () => {
|
|
51
|
+
const { container } = render(DirectionAwareHover, {
|
|
52
|
+
props: { imageUrl: "/test.jpg" },
|
|
53
|
+
});
|
|
54
|
+
const figure = container.querySelector('[role="figure"]');
|
|
55
|
+
expect(figure?.className).toContain("overflow-hidden");
|
|
56
|
+
});
|
|
57
|
+
it("has rounded-lg class on the container", () => {
|
|
58
|
+
const { container } = render(DirectionAwareHover, {
|
|
59
|
+
props: { imageUrl: "/test.jpg" },
|
|
60
|
+
});
|
|
61
|
+
const figure = container.querySelector('[role="figure"]');
|
|
62
|
+
expect(figure?.className).toContain("rounded-lg");
|
|
63
|
+
});
|
|
64
|
+
it("applies custom class names", () => {
|
|
65
|
+
const { container } = render(DirectionAwareHover, {
|
|
66
|
+
props: { imageUrl: "/test.jpg", class: "custom-hover" },
|
|
67
|
+
});
|
|
68
|
+
const figure = container.querySelector('[role="figure"]');
|
|
69
|
+
expect(figure?.className).toContain("custom-hover");
|
|
70
|
+
});
|
|
71
|
+
it("image has object-cover class", () => {
|
|
72
|
+
const { container } = render(DirectionAwareHover, {
|
|
73
|
+
props: { imageUrl: "/test.jpg" },
|
|
74
|
+
});
|
|
75
|
+
const img = container.querySelector("img");
|
|
76
|
+
expect(img?.className).toContain("object-cover");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# DirectionAwareHover
|
|
2
|
+
|
|
3
|
+
An image card that reveals an overlay sliding in from the direction the mouse entered.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Direction detection**: Overlay slides in from the direction the cursor enters
|
|
8
|
+
- **Image parallax**: Image shifts slightly opposite to the hover direction
|
|
9
|
+
- **Touch support**: Tap on mobile to reveal, auto-hides after 3 seconds
|
|
10
|
+
- **Responsive**: Scales from mobile to desktop with appropriate sizing
|
|
11
|
+
- **Reduced motion**: Respects `prefers-reduced-motion`
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
|------|------|---------|-------------|
|
|
17
|
+
| `imageUrl` | `string` | (required) | URL of the image to display |
|
|
18
|
+
| `imageAlt` | `string` | `'image'` | Alt text for the image |
|
|
19
|
+
| `class` | `string` | `''` | Additional CSS classes for the container |
|
|
20
|
+
| `imageClass` | `string` | `''` | Additional CSS classes for the image |
|
|
21
|
+
| `childrenClass` | `string` | `''` | Additional CSS classes for the content overlay |
|
|
22
|
+
|
|
23
|
+
## Snippets
|
|
24
|
+
|
|
25
|
+
| Snippet | Description |
|
|
26
|
+
|---------|-------------|
|
|
27
|
+
| `children` | Content to display on hover overlay |
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script>
|
|
33
|
+
import { DirectionAwareHover } from '$lib/fancy-ui/direction-aware-hover';
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<DirectionAwareHover imageUrl="/photo.jpg">
|
|
37
|
+
<p class="font-bold">Title</p>
|
|
38
|
+
<p class="text-sm">Subtitle</p>
|
|
39
|
+
</DirectionAwareHover>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Implementation Notes
|
|
43
|
+
|
|
44
|
+
- Replaced Vue `Transition` with Svelte `transition:fade`
|
|
45
|
+
- Replaced Vue computed with Svelte `$derived`
|
|
46
|
+
- Extracted `mapDirection` helper to avoid repeated switch blocks
|
|
47
|
+
- Used plain object for `getDirection` touch coordinates instead of constructing a `MouseEvent`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DirectionAwareHover } from "./DirectionAwareHover.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DirectionAwareHover } from "./DirectionAwareHover.svelte";
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface DisplacementTextProps {
|
|
3
|
+
/** Text to display */
|
|
4
|
+
text?: string;
|
|
5
|
+
/** Font size in pixels */
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
/** Font family */
|
|
8
|
+
font?: string;
|
|
9
|
+
/** Fixed text color (overrides theme colors) */
|
|
10
|
+
color?: string;
|
|
11
|
+
/** Text color in light mode */
|
|
12
|
+
lightColor?: string;
|
|
13
|
+
/** Text color in dark mode */
|
|
14
|
+
darkColor?: string;
|
|
15
|
+
/** Additional CSS classes */
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import * as THREE from "three";
|
|
22
|
+
import { cn } from "../../utils.js";
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
text = "Hover Me",
|
|
26
|
+
fontSize = 200,
|
|
27
|
+
font = "Inter, sans-serif",
|
|
28
|
+
color,
|
|
29
|
+
lightColor = "#000000",
|
|
30
|
+
darkColor = "#ffffff",
|
|
31
|
+
class: className = "",
|
|
32
|
+
}: DisplacementTextProps = $props();
|
|
33
|
+
|
|
34
|
+
let container: HTMLDivElement;
|
|
35
|
+
|
|
36
|
+
const vertexShader = `
|
|
37
|
+
varying vec2 vUv;
|
|
38
|
+
uniform vec3 uDisplacement;
|
|
39
|
+
|
|
40
|
+
float easeInOutCubic(float x) {
|
|
41
|
+
return x < 0.5 ? 4.0 * x * x * x : 1.0 - pow(-2.0 * x + 2.0, 3.0) / 2.0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
float map(float value, float min1, float max1, float min2, float max2) {
|
|
45
|
+
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void main() {
|
|
49
|
+
vUv = uv;
|
|
50
|
+
vec3 displaced = position;
|
|
51
|
+
vec4 worldPosition = modelMatrix * vec4(position, 1.0);
|
|
52
|
+
float dist = length(uDisplacement - worldPosition.rgb);
|
|
53
|
+
float minDistance = 3.0;
|
|
54
|
+
|
|
55
|
+
if (dist < minDistance) {
|
|
56
|
+
float mapped = map(dist, 0.0, minDistance, 1.0, 0.0);
|
|
57
|
+
displaced.z += easeInOutCubic(mapped);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(displaced, 1.0);
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
const fragmentShader = `
|
|
65
|
+
varying vec2 vUv;
|
|
66
|
+
uniform sampler2D uTexture;
|
|
67
|
+
|
|
68
|
+
void main() {
|
|
69
|
+
gl_FragColor = texture2D(uTexture, vUv);
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
function createTextTexture(t: string, size: number, f: string, c: string): THREE.Texture {
|
|
74
|
+
const canvas = document.createElement("canvas");
|
|
75
|
+
canvas.width = 2048;
|
|
76
|
+
canvas.height = 2048;
|
|
77
|
+
const ctx = canvas.getContext("2d");
|
|
78
|
+
if (!ctx) return new THREE.CanvasTexture(canvas);
|
|
79
|
+
|
|
80
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
81
|
+
ctx.font = `bold ${size}px ${f}`;
|
|
82
|
+
ctx.fillStyle = c;
|
|
83
|
+
ctx.textAlign = "center";
|
|
84
|
+
ctx.textBaseline = "middle";
|
|
85
|
+
ctx.fillText(t, canvas.width / 2, canvas.height / 2);
|
|
86
|
+
|
|
87
|
+
const texture = new THREE.CanvasTexture(canvas);
|
|
88
|
+
texture.needsUpdate = true;
|
|
89
|
+
return texture;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
$effect(() => {
|
|
93
|
+
if (!container) return;
|
|
94
|
+
|
|
95
|
+
const _text = text;
|
|
96
|
+
const _fontSize = fontSize;
|
|
97
|
+
const _font = font;
|
|
98
|
+
const _color = color;
|
|
99
|
+
const _lightColor = lightColor;
|
|
100
|
+
const _darkColor = darkColor;
|
|
101
|
+
|
|
102
|
+
const rect = container.getBoundingClientRect();
|
|
103
|
+
const width = rect.width || 1;
|
|
104
|
+
const height = rect.height || 1;
|
|
105
|
+
if (height === 0) return;
|
|
106
|
+
|
|
107
|
+
const scene = new THREE.Scene();
|
|
108
|
+
scene.background = null;
|
|
109
|
+
|
|
110
|
+
const cameraDistance = 8;
|
|
111
|
+
const aspect = width / height;
|
|
112
|
+
const camera = new THREE.OrthographicCamera(
|
|
113
|
+
-cameraDistance * aspect,
|
|
114
|
+
cameraDistance * aspect,
|
|
115
|
+
cameraDistance,
|
|
116
|
+
-cameraDistance,
|
|
117
|
+
0.01,
|
|
118
|
+
1000
|
|
119
|
+
);
|
|
120
|
+
camera.position.set(0, -10, 5);
|
|
121
|
+
camera.lookAt(0, 0, 0);
|
|
122
|
+
|
|
123
|
+
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
|
|
124
|
+
renderer.setClearColor(0x000000, 0);
|
|
125
|
+
renderer.setPixelRatio(window.devicePixelRatio);
|
|
126
|
+
renderer.setSize(width, height, false);
|
|
127
|
+
renderer.domElement.style.width = "100%";
|
|
128
|
+
renderer.domElement.style.height = "100%";
|
|
129
|
+
container.appendChild(renderer.domElement);
|
|
130
|
+
|
|
131
|
+
const geometry = new THREE.PlaneGeometry(15, 15, 100, 100);
|
|
132
|
+
const getActiveColor = () =>
|
|
133
|
+
_color || (document.documentElement.classList.contains("dark") ? _darkColor : _lightColor);
|
|
134
|
+
|
|
135
|
+
let currentColor = getActiveColor();
|
|
136
|
+
let textTexture = createTextTexture(_text, _fontSize, _font, currentColor);
|
|
137
|
+
|
|
138
|
+
const shaderMaterial = new THREE.ShaderMaterial({
|
|
139
|
+
uniforms: {
|
|
140
|
+
uTexture: { value: textTexture },
|
|
141
|
+
uDisplacement: { value: new THREE.Vector3(0, 0, 0) },
|
|
142
|
+
},
|
|
143
|
+
vertexShader,
|
|
144
|
+
fragmentShader,
|
|
145
|
+
transparent: true,
|
|
146
|
+
depthWrite: false,
|
|
147
|
+
side: THREE.DoubleSide,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const plane = new THREE.Mesh(geometry, shaderMaterial);
|
|
151
|
+
plane.rotation.z = Math.PI / 4;
|
|
152
|
+
scene.add(plane);
|
|
153
|
+
|
|
154
|
+
const hitGeometry = new THREE.PlaneGeometry(500, 500);
|
|
155
|
+
const hitMaterial = new THREE.MeshBasicMaterial({ transparent: true, opacity: 0 });
|
|
156
|
+
const hitPlane = new THREE.Mesh(hitGeometry, hitMaterial);
|
|
157
|
+
scene.add(hitPlane);
|
|
158
|
+
|
|
159
|
+
const raycaster = new THREE.Raycaster();
|
|
160
|
+
const pointer = new THREE.Vector2();
|
|
161
|
+
|
|
162
|
+
const onPointerMove = (e: PointerEvent) => {
|
|
163
|
+
const bounds = container.getBoundingClientRect();
|
|
164
|
+
pointer.x = ((e.clientX - bounds.left) / bounds.width) * 2 - 1;
|
|
165
|
+
pointer.y = -((e.clientY - bounds.top) / bounds.height) * 2 + 1;
|
|
166
|
+
raycaster.setFromCamera(pointer, camera);
|
|
167
|
+
const [hit] = raycaster.intersectObject(hitPlane);
|
|
168
|
+
if (hit) (shaderMaterial.uniforms.uDisplacement.value as THREE.Vector3).copy(hit.point);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
container.addEventListener("pointermove", onPointerMove);
|
|
172
|
+
|
|
173
|
+
const handleResize = () => {
|
|
174
|
+
const r = container.getBoundingClientRect();
|
|
175
|
+
if (r.height === 0) return;
|
|
176
|
+
const a = r.width / r.height;
|
|
177
|
+
camera.left = -cameraDistance * a;
|
|
178
|
+
camera.right = cameraDistance * a;
|
|
179
|
+
camera.updateProjectionMatrix();
|
|
180
|
+
renderer.setSize(r.width, r.height, false);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
window.addEventListener("resize", handleResize);
|
|
184
|
+
|
|
185
|
+
let animationId = 0;
|
|
186
|
+
const animate = () => {
|
|
187
|
+
animationId = requestAnimationFrame(animate);
|
|
188
|
+
renderer.render(scene, camera);
|
|
189
|
+
};
|
|
190
|
+
animate();
|
|
191
|
+
|
|
192
|
+
const observer = new MutationObserver(() => {
|
|
193
|
+
const next = getActiveColor();
|
|
194
|
+
if (next !== currentColor) {
|
|
195
|
+
const tex = createTextTexture(_text, _fontSize, _font, next);
|
|
196
|
+
shaderMaterial.uniforms.uTexture.value = tex;
|
|
197
|
+
textTexture.dispose();
|
|
198
|
+
textTexture = tex;
|
|
199
|
+
currentColor = next;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
if (!_color)
|
|
203
|
+
observer.observe(document.documentElement, {
|
|
204
|
+
attributes: true,
|
|
205
|
+
attributeFilter: ["class"],
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
return () => {
|
|
209
|
+
window.removeEventListener("resize", handleResize);
|
|
210
|
+
container.removeEventListener("pointermove", onPointerMove);
|
|
211
|
+
cancelAnimationFrame(animationId);
|
|
212
|
+
observer.disconnect();
|
|
213
|
+
if (renderer.domElement.parentNode === container) container.removeChild(renderer.domElement);
|
|
214
|
+
renderer.dispose();
|
|
215
|
+
textTexture.dispose();
|
|
216
|
+
geometry.dispose();
|
|
217
|
+
shaderMaterial.dispose();
|
|
218
|
+
hitGeometry.dispose();
|
|
219
|
+
hitMaterial.dispose();
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
</script>
|
|
223
|
+
|
|
224
|
+
<div bind:this={container} class={cn("relative h-[400px] w-full", className)}></div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DisplacementTextProps {
|
|
2
|
+
/** Text to display */
|
|
3
|
+
text?: string;
|
|
4
|
+
/** Font size in pixels */
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
/** Font family */
|
|
7
|
+
font?: string;
|
|
8
|
+
/** Fixed text color (overrides theme colors) */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** Text color in light mode */
|
|
11
|
+
lightColor?: string;
|
|
12
|
+
/** Text color in dark mode */
|
|
13
|
+
darkColor?: string;
|
|
14
|
+
/** Additional CSS classes */
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const DisplacementText: import("svelte").Component<DisplacementTextProps, {}, "">;
|
|
18
|
+
type DisplacementText = ReturnType<typeof DisplacementText>;
|
|
19
|
+
export default DisplacementText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|