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,224 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
export interface SpringConfig {
|
|
5
|
+
/** Controls how quickly the animation settles (default: 45) */
|
|
6
|
+
damping?: number;
|
|
7
|
+
/** Controls the spring stiffness (default: 400) */
|
|
8
|
+
stiffness?: number;
|
|
9
|
+
/** Controls the virtual mass of the animated object (default: 1) */
|
|
10
|
+
mass?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SmoothCursorProps {
|
|
14
|
+
/** Custom cursor snippet to replace the default arrow cursor */
|
|
15
|
+
cursor?: Snippet;
|
|
16
|
+
/** Spring physics configuration */
|
|
17
|
+
springConfig?: SpringConfig;
|
|
18
|
+
/** Additional CSS classes */
|
|
19
|
+
class?: string;
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { onMount } from "svelte";
|
|
25
|
+
import { cn } from "../../utils.js";
|
|
26
|
+
|
|
27
|
+
let { cursor, springConfig = {}, class: className = "" }: SmoothCursorProps = $props();
|
|
28
|
+
|
|
29
|
+
const config = $derived({
|
|
30
|
+
damping: springConfig.damping ?? 45,
|
|
31
|
+
stiffness: springConfig.stiffness ?? 400,
|
|
32
|
+
mass: springConfig.mass ?? 1,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
let cursorEl: HTMLDivElement;
|
|
36
|
+
let visible = $state(false);
|
|
37
|
+
let reducedMotion = $state(false);
|
|
38
|
+
|
|
39
|
+
// Spring state
|
|
40
|
+
let posX = 0;
|
|
41
|
+
let posY = 0;
|
|
42
|
+
let velX = 0;
|
|
43
|
+
let velY = 0;
|
|
44
|
+
let targetX = 0;
|
|
45
|
+
let targetY = 0;
|
|
46
|
+
|
|
47
|
+
// Rotation state
|
|
48
|
+
let rotation = 0;
|
|
49
|
+
let prevX = 0;
|
|
50
|
+
let prevY = 0;
|
|
51
|
+
|
|
52
|
+
let rafId: number | null = null;
|
|
53
|
+
let lastTime = 0;
|
|
54
|
+
|
|
55
|
+
function startAnimation() {
|
|
56
|
+
if (rafId === null) {
|
|
57
|
+
lastTime = 0;
|
|
58
|
+
rafId = requestAnimationFrame(animate);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function stopAnimation() {
|
|
63
|
+
if (rafId !== null) {
|
|
64
|
+
cancelAnimationFrame(rafId);
|
|
65
|
+
rafId = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function snapToTarget() {
|
|
70
|
+
posX = targetX;
|
|
71
|
+
posY = targetY;
|
|
72
|
+
velX = 0;
|
|
73
|
+
velY = 0;
|
|
74
|
+
if (cursorEl) {
|
|
75
|
+
cursorEl.style.transform = `translate3d(${posX}px, ${posY}px, 0)`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onMouseMove(e: MouseEvent) {
|
|
80
|
+
targetX = e.clientX;
|
|
81
|
+
targetY = e.clientY;
|
|
82
|
+
|
|
83
|
+
if (!visible) {
|
|
84
|
+
posX = targetX;
|
|
85
|
+
posY = targetY;
|
|
86
|
+
prevX = targetX;
|
|
87
|
+
prevY = targetY;
|
|
88
|
+
visible = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (reducedMotion) {
|
|
92
|
+
snapToTarget();
|
|
93
|
+
} else {
|
|
94
|
+
startAnimation();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function onMouseLeave() {
|
|
99
|
+
visible = false;
|
|
100
|
+
stopAnimation();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function onMouseEnter(e: MouseEvent) {
|
|
104
|
+
targetX = e.clientX;
|
|
105
|
+
targetY = e.clientY;
|
|
106
|
+
posX = targetX;
|
|
107
|
+
posY = targetY;
|
|
108
|
+
prevX = targetX;
|
|
109
|
+
prevY = targetY;
|
|
110
|
+
visible = true;
|
|
111
|
+
|
|
112
|
+
if (!reducedMotion) {
|
|
113
|
+
startAnimation();
|
|
114
|
+
} else {
|
|
115
|
+
snapToTarget();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function animate(time: number) {
|
|
120
|
+
if (!visible) {
|
|
121
|
+
rafId = null;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
rafId = requestAnimationFrame(animate);
|
|
126
|
+
|
|
127
|
+
if (lastTime === 0) {
|
|
128
|
+
lastTime = time;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const dt = Math.min((time - lastTime) / 1000, 0.064);
|
|
133
|
+
lastTime = time;
|
|
134
|
+
|
|
135
|
+
const { stiffness, damping, mass } = config;
|
|
136
|
+
|
|
137
|
+
// Spring physics: F = -k * displacement - c * velocity
|
|
138
|
+
const forceX = -stiffness * (posX - targetX) - damping * velX;
|
|
139
|
+
const forceY = -stiffness * (posY - targetY) - damping * velY;
|
|
140
|
+
|
|
141
|
+
const accX = forceX / mass;
|
|
142
|
+
const accY = forceY / mass;
|
|
143
|
+
|
|
144
|
+
velX += accX * dt;
|
|
145
|
+
velY += accY * dt;
|
|
146
|
+
|
|
147
|
+
posX += velX * dt;
|
|
148
|
+
posY += velY * dt;
|
|
149
|
+
|
|
150
|
+
// Calculate rotation based on movement direction
|
|
151
|
+
const dx = posX - prevX;
|
|
152
|
+
const dy = posY - prevY;
|
|
153
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
154
|
+
|
|
155
|
+
if (distance > 0.1) {
|
|
156
|
+
const targetRotation = Math.atan2(dy, dx) * (180 / Math.PI) + 90;
|
|
157
|
+
let diff = targetRotation - rotation;
|
|
158
|
+
while (diff > 180) diff -= 360;
|
|
159
|
+
while (diff < -180) diff += 360;
|
|
160
|
+
rotation += diff * 0.3;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
prevX = posX;
|
|
164
|
+
prevY = posY;
|
|
165
|
+
|
|
166
|
+
if (cursorEl) {
|
|
167
|
+
cursorEl.style.transform = `translate3d(${posX}px, ${posY}px, 0) rotate(${rotation}deg)`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onMount(() => {
|
|
172
|
+
const motionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
173
|
+
reducedMotion = motionQuery.matches;
|
|
174
|
+
|
|
175
|
+
function onMotionChange(e: MediaQueryListEvent) {
|
|
176
|
+
reducedMotion = e.matches;
|
|
177
|
+
if (reducedMotion) {
|
|
178
|
+
stopAnimation();
|
|
179
|
+
snapToTarget();
|
|
180
|
+
} else if (visible) {
|
|
181
|
+
startAnimation();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
motionQuery.addEventListener("change", onMotionChange);
|
|
186
|
+
|
|
187
|
+
document.body.style.cursor = "none";
|
|
188
|
+
|
|
189
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
190
|
+
document.documentElement.addEventListener("mouseleave", onMouseLeave);
|
|
191
|
+
document.documentElement.addEventListener("mouseenter", onMouseEnter);
|
|
192
|
+
|
|
193
|
+
return () => {
|
|
194
|
+
document.body.style.cursor = "";
|
|
195
|
+
motionQuery.removeEventListener("change", onMotionChange);
|
|
196
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
197
|
+
document.documentElement.removeEventListener("mouseleave", onMouseLeave);
|
|
198
|
+
document.documentElement.removeEventListener("mouseenter", onMouseEnter);
|
|
199
|
+
stopAnimation();
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<div
|
|
205
|
+
bind:this={cursorEl}
|
|
206
|
+
class={cn(
|
|
207
|
+
"pointer-events-none fixed top-0 left-0 z-[9999]",
|
|
208
|
+
visible ? "opacity-100" : "opacity-0",
|
|
209
|
+
className
|
|
210
|
+
)}
|
|
211
|
+
style="will-change: transform; translate: -50% -50%;"
|
|
212
|
+
>
|
|
213
|
+
{#if cursor}
|
|
214
|
+
{@render cursor()}
|
|
215
|
+
{:else}
|
|
216
|
+
<!-- Default cursor: arrow SVG -->
|
|
217
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
218
|
+
<path
|
|
219
|
+
fill="currentColor"
|
|
220
|
+
d="M9.391 2.32C8.42 1.56 7 2.253 7 3.486V28.41c0 1.538 1.966 2.18 2.874.938l6.225-8.523a2 2 0 0 1 1.615-.82h9.69c1.512 0 2.17-1.912.978-2.844z"
|
|
221
|
+
/>
|
|
222
|
+
</svg>
|
|
223
|
+
{/if}
|
|
224
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export interface SpringConfig {
|
|
3
|
+
/** Controls how quickly the animation settles (default: 45) */
|
|
4
|
+
damping?: number;
|
|
5
|
+
/** Controls the spring stiffness (default: 400) */
|
|
6
|
+
stiffness?: number;
|
|
7
|
+
/** Controls the virtual mass of the animated object (default: 1) */
|
|
8
|
+
mass?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SmoothCursorProps {
|
|
11
|
+
/** Custom cursor snippet to replace the default arrow cursor */
|
|
12
|
+
cursor?: Snippet;
|
|
13
|
+
/** Spring physics configuration */
|
|
14
|
+
springConfig?: SpringConfig;
|
|
15
|
+
/** Additional CSS classes */
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const SmoothCursor: import("svelte").Component<SmoothCursorProps, {}, "">;
|
|
19
|
+
type SmoothCursor = ReturnType<typeof SmoothCursor>;
|
|
20
|
+
export default SmoothCursor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SmoothCursor } from "./SmoothCursor.svelte";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Sparkles
|
|
2
|
+
|
|
3
|
+
Canvas-based floating particle sparkle effect.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
|------|------|---------|-------------|
|
|
9
|
+
| `background` | `string` | `'#0d47a1'` | Background color |
|
|
10
|
+
| `particleColor` | `string` | `'#ffffff'` | Particle color |
|
|
11
|
+
| `minSize` | `number` | `1` | Minimum particle size |
|
|
12
|
+
| `maxSize` | `number` | `3` | Maximum particle size |
|
|
13
|
+
| `speed` | `number` | `4` | Particle movement speed |
|
|
14
|
+
| `particleDensity` | `number` | `120` | Number of particles |
|
|
15
|
+
| `class` | `string` | `''` | Additional CSS classes |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from "../../utils";
|
|
3
|
+
import { onMount } from "svelte";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
background?: string;
|
|
7
|
+
particleColor?: string;
|
|
8
|
+
minSize?: number;
|
|
9
|
+
maxSize?: number;
|
|
10
|
+
speed?: number;
|
|
11
|
+
particleDensity?: number;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
background = "#0d47a1",
|
|
17
|
+
particleColor = "#ffffff",
|
|
18
|
+
minSize = 1,
|
|
19
|
+
maxSize = 3,
|
|
20
|
+
speed = 4,
|
|
21
|
+
particleDensity = 120,
|
|
22
|
+
class: className = "",
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
interface Particle {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
size: number;
|
|
29
|
+
opacity: number;
|
|
30
|
+
vx: number;
|
|
31
|
+
vy: number;
|
|
32
|
+
phase: number;
|
|
33
|
+
phaseSpeed: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let containerRef: HTMLDivElement;
|
|
37
|
+
let canvasRef: HTMLCanvasElement;
|
|
38
|
+
let particles: Particle[] = [];
|
|
39
|
+
let ctx: CanvasRenderingContext2D | null = null;
|
|
40
|
+
let rafId: number;
|
|
41
|
+
|
|
42
|
+
function resizeCanvas() {
|
|
43
|
+
if (!canvasRef || !containerRef) return;
|
|
44
|
+
const dpr = window.devicePixelRatio || 1;
|
|
45
|
+
const rect = containerRef.getBoundingClientRect();
|
|
46
|
+
canvasRef.width = rect.width * dpr;
|
|
47
|
+
canvasRef.height = rect.height * dpr;
|
|
48
|
+
ctx = canvasRef.getContext("2d");
|
|
49
|
+
if (ctx) ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function generateParticles() {
|
|
53
|
+
particles = [];
|
|
54
|
+
for (let i = 0; i < particleDensity; i++) {
|
|
55
|
+
const baseSpeed = 0.05;
|
|
56
|
+
const speedVariance = Math.random() * 0.3 + 0.7;
|
|
57
|
+
particles.push({
|
|
58
|
+
x: Math.random() * 100,
|
|
59
|
+
y: Math.random() * 100,
|
|
60
|
+
size: Math.random() * (maxSize - minSize) + minSize,
|
|
61
|
+
opacity: Math.random() * 0.5 + 0.3,
|
|
62
|
+
vx: (Math.random() - 0.5) * baseSpeed * speedVariance * speed,
|
|
63
|
+
vy: ((Math.random() - 0.5) * baseSpeed - baseSpeed * 0.3) * speedVariance * speed,
|
|
64
|
+
phase: Math.random() * Math.PI * 2,
|
|
65
|
+
phaseSpeed: 0.015,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function updateAndDraw() {
|
|
71
|
+
if (!ctx || !canvasRef) return;
|
|
72
|
+
ctx.clearRect(0, 0, canvasRef.width, canvasRef.height);
|
|
73
|
+
|
|
74
|
+
for (const p of particles) {
|
|
75
|
+
p.x += p.vx;
|
|
76
|
+
p.y += p.vy;
|
|
77
|
+
if (p.x < -2) p.x = 102;
|
|
78
|
+
if (p.x > 102) p.x = -2;
|
|
79
|
+
if (p.y < -2) p.y = 102;
|
|
80
|
+
if (p.y > 102) p.y = -2;
|
|
81
|
+
p.phase = (p.phase + p.phaseSpeed) % (Math.PI * 2);
|
|
82
|
+
const opacity = 0.3 + (Math.sin(p.phase) * 0.3 + 0.3);
|
|
83
|
+
|
|
84
|
+
ctx.beginPath();
|
|
85
|
+
ctx.arc(
|
|
86
|
+
(p.x * canvasRef.width) / 100,
|
|
87
|
+
(p.y * canvasRef.height) / 100,
|
|
88
|
+
p.size,
|
|
89
|
+
0,
|
|
90
|
+
Math.PI * 2
|
|
91
|
+
);
|
|
92
|
+
ctx.fillStyle = `${particleColor}${Math.floor(opacity * 255)
|
|
93
|
+
.toString(16)
|
|
94
|
+
.padStart(2, "0")}`;
|
|
95
|
+
ctx.fill();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
rafId = requestAnimationFrame(updateAndDraw);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onMount(() => {
|
|
102
|
+
ctx = canvasRef.getContext("2d");
|
|
103
|
+
resizeCanvas();
|
|
104
|
+
generateParticles();
|
|
105
|
+
rafId = requestAnimationFrame(updateAndDraw);
|
|
106
|
+
|
|
107
|
+
const resizeObserver = new ResizeObserver(resizeCanvas);
|
|
108
|
+
resizeObserver.observe(containerRef);
|
|
109
|
+
|
|
110
|
+
return () => {
|
|
111
|
+
cancelAnimationFrame(rafId);
|
|
112
|
+
resizeObserver.disconnect();
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<div
|
|
118
|
+
bind:this={containerRef}
|
|
119
|
+
class={cn("relative size-full overflow-hidden will-change-transform", className)}
|
|
120
|
+
style:background
|
|
121
|
+
>
|
|
122
|
+
<canvas bind:this={canvasRef} class="absolute inset-0 size-full" aria-hidden="true"></canvas>
|
|
123
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
background?: string;
|
|
3
|
+
particleColor?: string;
|
|
4
|
+
minSize?: number;
|
|
5
|
+
maxSize?: number;
|
|
6
|
+
speed?: number;
|
|
7
|
+
particleDensity?: number;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Sparkles: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Sparkles = ReturnType<typeof Sparkles>;
|
|
12
|
+
export default Sparkles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { render, cleanup } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
|
|
3
|
+
import Sparkles from "./Sparkles.svelte";
|
|
4
|
+
describe("Sparkles", () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.stubGlobal("ResizeObserver", class {
|
|
7
|
+
observe() { }
|
|
8
|
+
unobserve() { }
|
|
9
|
+
disconnect() { }
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
cleanup();
|
|
14
|
+
vi.restoreAllMocks();
|
|
15
|
+
});
|
|
16
|
+
it("renders container div", () => {
|
|
17
|
+
const { container } = render(Sparkles);
|
|
18
|
+
const div = container.firstElementChild;
|
|
19
|
+
expect(div).toBeInTheDocument();
|
|
20
|
+
expect(div.tagName).toBe("DIV");
|
|
21
|
+
});
|
|
22
|
+
it("renders canvas element inside container", () => {
|
|
23
|
+
const { container } = render(Sparkles);
|
|
24
|
+
const canvas = container.querySelector("canvas");
|
|
25
|
+
expect(canvas).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
it("applies default background style", () => {
|
|
28
|
+
const { container } = render(Sparkles);
|
|
29
|
+
const div = container.firstElementChild;
|
|
30
|
+
const style = div?.getAttribute("style") ?? "";
|
|
31
|
+
expect(style).toContain("background");
|
|
32
|
+
// jsdom converts hex to rgb
|
|
33
|
+
expect(style).toMatch(/background.*rgb\(13,\s*71,\s*161\)|#0d47a1/);
|
|
34
|
+
});
|
|
35
|
+
it("applies custom background style", () => {
|
|
36
|
+
const { container } = render(Sparkles, {
|
|
37
|
+
props: { background: "#ff0000" },
|
|
38
|
+
});
|
|
39
|
+
const div = container.firstElementChild;
|
|
40
|
+
const style = div?.getAttribute("style") ?? "";
|
|
41
|
+
expect(style).toMatch(/rgb\(255,\s*0,\s*0\)|#ff0000/);
|
|
42
|
+
});
|
|
43
|
+
it("applies custom class", () => {
|
|
44
|
+
const { container } = render(Sparkles, { props: { class: "my-sparkles" } });
|
|
45
|
+
const div = container.firstElementChild;
|
|
46
|
+
expect(div?.className).toContain("my-sparkles");
|
|
47
|
+
});
|
|
48
|
+
it("has overflow-hidden class", () => {
|
|
49
|
+
const { container } = render(Sparkles);
|
|
50
|
+
const div = container.firstElementChild;
|
|
51
|
+
expect(div?.className).toContain("overflow-hidden");
|
|
52
|
+
});
|
|
53
|
+
it("preserves base classes when custom class is added", () => {
|
|
54
|
+
const { container } = render(Sparkles, { props: { class: "extra" } });
|
|
55
|
+
const div = container.firstElementChild;
|
|
56
|
+
expect(div?.className).toContain("relative");
|
|
57
|
+
expect(div?.className).toContain("overflow-hidden");
|
|
58
|
+
expect(div?.className).toContain("will-change-transform");
|
|
59
|
+
});
|
|
60
|
+
it("canvas has absolute positioning classes", () => {
|
|
61
|
+
const { container } = render(Sparkles);
|
|
62
|
+
const canvas = container.querySelector("canvas");
|
|
63
|
+
expect(canvas?.className).toContain("absolute");
|
|
64
|
+
expect(canvas?.className).toContain("inset-0");
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Sparkles } from "./Sparkles.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Sparkles } from "./Sparkles.svelte";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# SparklesText
|
|
2
|
+
|
|
3
|
+
Text with animated sparkle star overlay. SVG stars animate with fade/scale/rotation effects and regenerate periodically.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| --------------- | ---------------------------------- | -------------------------------------------- | -------------------------- |
|
|
9
|
+
| `text` | `string` | required | Text to display |
|
|
10
|
+
| `sparklesCount` | `number` | `10` | Number of sparkle stars |
|
|
11
|
+
| `colors` | `{ first: string; second: string }`| `{ first: '#9E7AFF', second: '#FE8BBB' }` | Two colors for sparkles |
|
|
12
|
+
| `class` | `string` | `''` | Additional CSS classes |
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```svelte
|
|
17
|
+
<SparklesText text="Sparkle!" />
|
|
18
|
+
<SparklesText text="Golden" colors={{ first: '#FFD700', second: '#FFA500' }} />
|
|
19
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* SparklesText - Text with animated sparkle stars
|
|
4
|
+
*
|
|
5
|
+
* Renders text with SVG sparkle stars overlaid that animate with
|
|
6
|
+
* fade/scale/rotation effects. Sparkles regenerate periodically.
|
|
7
|
+
*/
|
|
8
|
+
export interface SparklesTextProps {
|
|
9
|
+
/** Text to display */
|
|
10
|
+
text: string;
|
|
11
|
+
/** Number of sparkle stars */
|
|
12
|
+
sparklesCount?: number;
|
|
13
|
+
/** Two colors for sparkle stars */
|
|
14
|
+
colors?: { first: string; second: string };
|
|
15
|
+
/** Additional CSS classes */
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Sparkle {
|
|
20
|
+
id: string;
|
|
21
|
+
x: string;
|
|
22
|
+
y: string;
|
|
23
|
+
color: string;
|
|
24
|
+
delay: number;
|
|
25
|
+
scale: number;
|
|
26
|
+
lifespan: number;
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
import { cn } from "../../utils.js";
|
|
32
|
+
import { onMount } from "svelte";
|
|
33
|
+
|
|
34
|
+
let {
|
|
35
|
+
text,
|
|
36
|
+
sparklesCount = 10,
|
|
37
|
+
colors = { first: "#9E7AFF", second: "#FE8BBB" },
|
|
38
|
+
class: className,
|
|
39
|
+
}: SparklesTextProps = $props();
|
|
40
|
+
|
|
41
|
+
let sparkles = $state<Sparkle[]>([]);
|
|
42
|
+
|
|
43
|
+
function generateStar(): Sparkle {
|
|
44
|
+
const x = `${Math.random() * 100}%`;
|
|
45
|
+
const y = `${Math.random() * 100}%`;
|
|
46
|
+
const color = Math.random() > 0.5 ? colors.first : colors.second;
|
|
47
|
+
const delay = Math.random() * 2;
|
|
48
|
+
const scale = Math.random() * 1 + 0.3;
|
|
49
|
+
const lifespan = Math.random() * 10 + 5;
|
|
50
|
+
const id = `${x}-${y}-${Date.now()}-${Math.random()}`;
|
|
51
|
+
return { id, x, y, color, delay, scale, lifespan };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function initializeStars() {
|
|
55
|
+
sparkles = Array.from({ length: sparklesCount }, generateStar);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function updateStars() {
|
|
59
|
+
sparkles = sparkles.map((star) => {
|
|
60
|
+
if (star.lifespan <= 0) {
|
|
61
|
+
return generateStar();
|
|
62
|
+
}
|
|
63
|
+
return { ...star, lifespan: star.lifespan - 0.1 };
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
initializeStars();
|
|
68
|
+
|
|
69
|
+
onMount(() => {
|
|
70
|
+
const intervalId = setInterval(updateStars, 100);
|
|
71
|
+
return () => clearInterval(intervalId);
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<div class={cn("sparkles-text text-6xl font-bold", className)}>
|
|
76
|
+
<span class="relative inline-block">
|
|
77
|
+
{#each sparkles as sparkle (sparkle.id)}
|
|
78
|
+
<svg
|
|
79
|
+
class="sparkles-star pointer-events-none absolute z-20"
|
|
80
|
+
style="left:{sparkle.x};top:{sparkle.y};--sparkle-scale:{sparkle.scale};animation:sparkleAnim 0.8s ease-in-out {sparkle.delay}s infinite;transform:scale(0) rotate(75deg);opacity:0"
|
|
81
|
+
width="21"
|
|
82
|
+
height="21"
|
|
83
|
+
viewBox="0 0 21 21"
|
|
84
|
+
>
|
|
85
|
+
<path
|
|
86
|
+
d="M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z"
|
|
87
|
+
fill={sparkle.color}
|
|
88
|
+
/>
|
|
89
|
+
</svg>
|
|
90
|
+
{/each}
|
|
91
|
+
{text}
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
:global {
|
|
97
|
+
@keyframes sparkleAnim {
|
|
98
|
+
0% {
|
|
99
|
+
opacity: 0;
|
|
100
|
+
transform: scale(0) rotate(75deg);
|
|
101
|
+
}
|
|
102
|
+
50% {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
transform: scale(var(--sparkle-scale, 1)) rotate(120deg);
|
|
105
|
+
}
|
|
106
|
+
100% {
|
|
107
|
+
opacity: 0;
|
|
108
|
+
transform: scale(0) rotate(150deg);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SparklesText - Text with animated sparkle stars
|
|
3
|
+
*
|
|
4
|
+
* Renders text with SVG sparkle stars overlaid that animate with
|
|
5
|
+
* fade/scale/rotation effects. Sparkles regenerate periodically.
|
|
6
|
+
*/
|
|
7
|
+
export interface SparklesTextProps {
|
|
8
|
+
/** Text to display */
|
|
9
|
+
text: string;
|
|
10
|
+
/** Number of sparkle stars */
|
|
11
|
+
sparklesCount?: number;
|
|
12
|
+
/** Two colors for sparkle stars */
|
|
13
|
+
colors?: {
|
|
14
|
+
first: string;
|
|
15
|
+
second: string;
|
|
16
|
+
};
|
|
17
|
+
/** Additional CSS classes */
|
|
18
|
+
class?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const SparklesText: import("svelte").Component<SparklesTextProps, {}, "">;
|
|
21
|
+
type SparklesText = ReturnType<typeof SparklesText>;
|
|
22
|
+
export default SparklesText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { render, cleanup } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, describe, it, expect } from "vitest";
|
|
3
|
+
import SparklesText from "./SparklesText.svelte";
|
|
4
|
+
describe("SparklesText", () => {
|
|
5
|
+
afterEach(cleanup);
|
|
6
|
+
it("renders the text content", () => {
|
|
7
|
+
const { container } = render(SparklesText, { props: { text: "Hello" } });
|
|
8
|
+
const wrapper = container.querySelector(".sparkles-text");
|
|
9
|
+
expect(wrapper?.textContent).toContain("Hello");
|
|
10
|
+
});
|
|
11
|
+
it("renders sparkle SVG elements", () => {
|
|
12
|
+
const { container } = render(SparklesText, {
|
|
13
|
+
props: { text: "Test", sparklesCount: 5 },
|
|
14
|
+
});
|
|
15
|
+
const stars = container.querySelectorAll(".sparkles-star");
|
|
16
|
+
expect(stars.length).toBe(5);
|
|
17
|
+
});
|
|
18
|
+
it("renders default 10 sparkles", () => {
|
|
19
|
+
const { container } = render(SparklesText, { props: { text: "Test" } });
|
|
20
|
+
const stars = container.querySelectorAll(".sparkles-star");
|
|
21
|
+
expect(stars.length).toBe(10);
|
|
22
|
+
});
|
|
23
|
+
it("applies custom class names", () => {
|
|
24
|
+
const { container } = render(SparklesText, {
|
|
25
|
+
props: { text: "Hi", class: "my-sparkle" },
|
|
26
|
+
});
|
|
27
|
+
const wrapper = container.querySelector(".sparkles-text");
|
|
28
|
+
expect(wrapper?.className).toContain("my-sparkle");
|
|
29
|
+
});
|
|
30
|
+
it("sparkle SVGs have animation styles", () => {
|
|
31
|
+
const { container } = render(SparklesText, {
|
|
32
|
+
props: { text: "X", sparklesCount: 1 },
|
|
33
|
+
});
|
|
34
|
+
const star = container.querySelector(".sparkles-star");
|
|
35
|
+
const style = star?.getAttribute("style") ?? "";
|
|
36
|
+
expect(style).toContain("animation");
|
|
37
|
+
expect(style).toContain("sparkleAnim");
|
|
38
|
+
});
|
|
39
|
+
it("uses custom colors on sparkle paths", () => {
|
|
40
|
+
const { container } = render(SparklesText, {
|
|
41
|
+
props: {
|
|
42
|
+
text: "X",
|
|
43
|
+
sparklesCount: 20,
|
|
44
|
+
colors: { first: "#FF0000", second: "#00FF00" },
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const paths = container.querySelectorAll(".sparkles-star path");
|
|
48
|
+
const fills = Array.from(paths).map((p) => p.getAttribute("fill"));
|
|
49
|
+
const hasRed = fills.some((f) => f === "#FF0000");
|
|
50
|
+
const hasGreen = fills.some((f) => f === "#00FF00");
|
|
51
|
+
// With 20 sparkles and 50/50 chance, at least one of each should appear
|
|
52
|
+
expect(hasRed || hasGreen).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
});
|