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,144 @@
|
|
|
1
|
+
import { render, cleanup } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
|
|
3
|
+
import DisplacementText from "./DisplacementText.svelte";
|
|
4
|
+
// Holds the last renderer instance created by the mock
|
|
5
|
+
const lastMock = { renderer: null };
|
|
6
|
+
// Three.js uses WebGL which is not available in jsdom — mock the module
|
|
7
|
+
vi.mock("three", () => {
|
|
8
|
+
function Vector2() {
|
|
9
|
+
return { x: 0, y: 0 };
|
|
10
|
+
}
|
|
11
|
+
function Vector3() {
|
|
12
|
+
return { x: 0, y: 0, z: 0, copy: vi.fn() };
|
|
13
|
+
}
|
|
14
|
+
function CanvasTexture() {
|
|
15
|
+
return { needsUpdate: false, dispose: vi.fn() };
|
|
16
|
+
}
|
|
17
|
+
function ShaderMaterial() {
|
|
18
|
+
return {
|
|
19
|
+
uniforms: { uTexture: { value: null }, uDisplacement: { value: { copy: vi.fn() } } },
|
|
20
|
+
dispose: vi.fn(),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function PlaneGeometry() {
|
|
24
|
+
return { dispose: vi.fn() };
|
|
25
|
+
}
|
|
26
|
+
function MeshBasicMaterial() {
|
|
27
|
+
return { dispose: vi.fn() };
|
|
28
|
+
}
|
|
29
|
+
function Mesh() {
|
|
30
|
+
return { rotation: { z: 0 } };
|
|
31
|
+
}
|
|
32
|
+
function Scene() {
|
|
33
|
+
return { background: null, add: vi.fn() };
|
|
34
|
+
}
|
|
35
|
+
function OrthographicCamera() {
|
|
36
|
+
return {
|
|
37
|
+
position: { set: vi.fn() },
|
|
38
|
+
left: 0,
|
|
39
|
+
right: 0,
|
|
40
|
+
updateProjectionMatrix: vi.fn(),
|
|
41
|
+
lookAt: vi.fn(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Raycaster() {
|
|
45
|
+
return {
|
|
46
|
+
setFromCamera: vi.fn(),
|
|
47
|
+
intersectObject: vi.fn(() => []),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function WebGLRenderer() {
|
|
51
|
+
const instance = {
|
|
52
|
+
setClearColor: vi.fn(),
|
|
53
|
+
setPixelRatio: vi.fn(),
|
|
54
|
+
setSize: vi.fn(),
|
|
55
|
+
render: vi.fn(),
|
|
56
|
+
dispose: vi.fn(),
|
|
57
|
+
domElement: Object.assign(document.createElement("canvas"), {
|
|
58
|
+
style: { width: "", height: "" },
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
lastMock.renderer = instance;
|
|
62
|
+
return instance;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
Scene,
|
|
66
|
+
OrthographicCamera,
|
|
67
|
+
WebGLRenderer,
|
|
68
|
+
PlaneGeometry,
|
|
69
|
+
ShaderMaterial,
|
|
70
|
+
Mesh,
|
|
71
|
+
MeshBasicMaterial,
|
|
72
|
+
Raycaster,
|
|
73
|
+
Vector2,
|
|
74
|
+
Vector3,
|
|
75
|
+
CanvasTexture,
|
|
76
|
+
DoubleSide: 2,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
describe("DisplacementText", () => {
|
|
80
|
+
afterEach(cleanup);
|
|
81
|
+
it("renders a div container", () => {
|
|
82
|
+
const { container } = render(DisplacementText);
|
|
83
|
+
expect(container.querySelector("div")).toBeTruthy();
|
|
84
|
+
});
|
|
85
|
+
it("applies default height class", () => {
|
|
86
|
+
const { container } = render(DisplacementText);
|
|
87
|
+
expect(container.querySelector("div")?.className).toContain("h-[400px]");
|
|
88
|
+
});
|
|
89
|
+
it("applies additional class", () => {
|
|
90
|
+
const { container } = render(DisplacementText, { props: { class: "h-[600px]" } });
|
|
91
|
+
expect(container.querySelector("div")?.className).toContain("h-[600px]");
|
|
92
|
+
});
|
|
93
|
+
it("renders with custom text prop", () => {
|
|
94
|
+
const { container } = render(DisplacementText, { props: { text: "FancyUI" } });
|
|
95
|
+
expect(container.querySelector("div")).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
describe("cleanup on unmount", () => {
|
|
98
|
+
it("removes resize listener", () => {
|
|
99
|
+
const spy = vi.spyOn(window, "removeEventListener");
|
|
100
|
+
const { unmount } = render(DisplacementText);
|
|
101
|
+
unmount();
|
|
102
|
+
expect(spy).toHaveBeenCalledWith("resize", expect.any(Function));
|
|
103
|
+
spy.mockRestore();
|
|
104
|
+
});
|
|
105
|
+
it("cancels animation frame", () => {
|
|
106
|
+
const spy = vi.spyOn(window, "cancelAnimationFrame");
|
|
107
|
+
const { unmount } = render(DisplacementText);
|
|
108
|
+
unmount();
|
|
109
|
+
expect(spy).toHaveBeenCalled();
|
|
110
|
+
spy.mockRestore();
|
|
111
|
+
});
|
|
112
|
+
it("disposes renderer", () => {
|
|
113
|
+
const { unmount } = render(DisplacementText);
|
|
114
|
+
const renderer = lastMock.renderer;
|
|
115
|
+
unmount();
|
|
116
|
+
expect(renderer.dispose).toHaveBeenCalled();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe("theme observer", () => {
|
|
120
|
+
let originalMutationObserver;
|
|
121
|
+
beforeEach(() => {
|
|
122
|
+
originalMutationObserver = global.MutationObserver;
|
|
123
|
+
});
|
|
124
|
+
afterEach(() => {
|
|
125
|
+
global.MutationObserver = originalMutationObserver;
|
|
126
|
+
});
|
|
127
|
+
it("does not observe document when color prop is provided", () => {
|
|
128
|
+
const observeSpy = vi.fn();
|
|
129
|
+
global.MutationObserver = function MutationObserver() {
|
|
130
|
+
return { observe: observeSpy, disconnect: vi.fn() };
|
|
131
|
+
};
|
|
132
|
+
render(DisplacementText, { props: { color: "#ff0000" } });
|
|
133
|
+
expect(observeSpy).not.toHaveBeenCalled();
|
|
134
|
+
});
|
|
135
|
+
it("observes document when no fixed color is provided", () => {
|
|
136
|
+
const observeSpy = vi.fn();
|
|
137
|
+
global.MutationObserver = function MutationObserver() {
|
|
138
|
+
return { observe: observeSpy, disconnect: vi.fn() };
|
|
139
|
+
};
|
|
140
|
+
render(DisplacementText);
|
|
141
|
+
expect(observeSpy).toHaveBeenCalledWith(document.documentElement, expect.objectContaining({ attributes: true, attributeFilter: ["class"] }));
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DisplacementText } from "./DisplacementText.svelte";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { setContext } from "svelte";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import {
|
|
5
|
+
DOCK_CONTEXT_KEY,
|
|
6
|
+
type DataOrientation,
|
|
7
|
+
type Direction,
|
|
8
|
+
type DockContext,
|
|
9
|
+
} from "./types";
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
class?: string;
|
|
13
|
+
magnification?: number;
|
|
14
|
+
distance?: number;
|
|
15
|
+
direction?: Direction;
|
|
16
|
+
orientation?: DataOrientation;
|
|
17
|
+
children?: import("svelte").Snippet;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
class: className = "",
|
|
22
|
+
magnification = 60,
|
|
23
|
+
distance = 140,
|
|
24
|
+
direction = "middle",
|
|
25
|
+
orientation = "horizontal",
|
|
26
|
+
children,
|
|
27
|
+
}: Props = $props();
|
|
28
|
+
|
|
29
|
+
// Use object with `current` property so children can read reactive updates
|
|
30
|
+
let mouseX = $state({ current: Infinity });
|
|
31
|
+
let mouseY = $state({ current: Infinity });
|
|
32
|
+
|
|
33
|
+
const context: DockContext = {
|
|
34
|
+
get mouseX() {
|
|
35
|
+
return mouseX;
|
|
36
|
+
},
|
|
37
|
+
get mouseY() {
|
|
38
|
+
return mouseY;
|
|
39
|
+
},
|
|
40
|
+
get magnification() {
|
|
41
|
+
return magnification;
|
|
42
|
+
},
|
|
43
|
+
get distance() {
|
|
44
|
+
return distance;
|
|
45
|
+
},
|
|
46
|
+
get orientation() {
|
|
47
|
+
return orientation;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
setContext(DOCK_CONTEXT_KEY, context);
|
|
52
|
+
|
|
53
|
+
function onMouseMove(e: MouseEvent) {
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
mouseX.current = e.pageX;
|
|
56
|
+
mouseY.current = e.pageY;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function onMouseLeave() {
|
|
61
|
+
requestAnimationFrame(() => {
|
|
62
|
+
mouseX.current = Infinity;
|
|
63
|
+
mouseY.current = Infinity;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let directionClass = $derived(
|
|
68
|
+
direction === "top" ? "items-start" : direction === "bottom" ? "items-end" : "items-center"
|
|
69
|
+
);
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
class={cn(
|
|
74
|
+
"mx-auto flex h-[58px] w-max gap-4 rounded-2xl border p-2 backdrop-blur-md transition-all supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10",
|
|
75
|
+
orientation === "vertical" && "h-max w-[58px] flex-col",
|
|
76
|
+
directionClass,
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
onmousemove={onMouseMove}
|
|
80
|
+
onmouseleave={onMouseLeave}
|
|
81
|
+
role="toolbar"
|
|
82
|
+
tabindex="0"
|
|
83
|
+
>
|
|
84
|
+
{#if children}
|
|
85
|
+
{@render children()}
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DataOrientation, type Direction } from "./types";
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
magnification?: number;
|
|
5
|
+
distance?: number;
|
|
6
|
+
direction?: Direction;
|
|
7
|
+
orientation?: DataOrientation;
|
|
8
|
+
children?: import("svelte").Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const Dock: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Dock = ReturnType<typeof Dock>;
|
|
12
|
+
export default Dock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { render, cleanup } from "@testing-library/svelte";
|
|
2
|
+
import { afterEach, describe, it, expect } from "vitest";
|
|
3
|
+
import Dock from "./Dock.svelte";
|
|
4
|
+
describe("Dock", () => {
|
|
5
|
+
afterEach(cleanup);
|
|
6
|
+
it("renders a toolbar element", () => {
|
|
7
|
+
const { container } = render(Dock);
|
|
8
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
9
|
+
expect(toolbar).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
it("has backdrop-blur-md class", () => {
|
|
12
|
+
const { container } = render(Dock);
|
|
13
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
14
|
+
expect(toolbar?.className).toContain("backdrop-blur-md");
|
|
15
|
+
});
|
|
16
|
+
it("has rounded-2xl class", () => {
|
|
17
|
+
const { container } = render(Dock);
|
|
18
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
19
|
+
expect(toolbar?.className).toContain("rounded-2xl");
|
|
20
|
+
});
|
|
21
|
+
it("applies custom class names", () => {
|
|
22
|
+
const { container } = render(Dock, { props: { class: "my-dock" } });
|
|
23
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
24
|
+
expect(toolbar?.className).toContain("my-dock");
|
|
25
|
+
});
|
|
26
|
+
it("uses vertical layout when orientation is vertical", () => {
|
|
27
|
+
const { container } = render(Dock, { props: { orientation: "vertical" } });
|
|
28
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
29
|
+
expect(toolbar?.className).toContain("flex-col");
|
|
30
|
+
});
|
|
31
|
+
it("applies items-end class for bottom direction", () => {
|
|
32
|
+
const { container } = render(Dock, { props: { direction: "bottom" } });
|
|
33
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
34
|
+
expect(toolbar?.className).toContain("items-end");
|
|
35
|
+
});
|
|
36
|
+
it("applies items-start class for top direction", () => {
|
|
37
|
+
const { container } = render(Dock, { props: { direction: "top" } });
|
|
38
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
39
|
+
expect(toolbar?.className).toContain("items-start");
|
|
40
|
+
});
|
|
41
|
+
it("applies items-center class for middle direction (default)", () => {
|
|
42
|
+
const { container } = render(Dock);
|
|
43
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
44
|
+
expect(toolbar?.className).toContain("items-center");
|
|
45
|
+
});
|
|
46
|
+
it("has flex class for layout", () => {
|
|
47
|
+
const { container } = render(Dock);
|
|
48
|
+
const toolbar = container.querySelector('[role="toolbar"]');
|
|
49
|
+
expect(toolbar?.className).toContain("flex");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
import { DOCK_CONTEXT_KEY, type DockContext } from "./types";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: import("svelte").Snippet;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { class: className = "", children }: Props = $props();
|
|
11
|
+
|
|
12
|
+
const context = getContext<DockContext>(DOCK_CONTEXT_KEY);
|
|
13
|
+
|
|
14
|
+
let iconRef: HTMLDivElement | undefined = $state();
|
|
15
|
+
|
|
16
|
+
function calculateDistance(): number {
|
|
17
|
+
if (!iconRef) return Infinity;
|
|
18
|
+
|
|
19
|
+
const bounds = iconRef.getBoundingClientRect();
|
|
20
|
+
|
|
21
|
+
if (context.orientation === "vertical") {
|
|
22
|
+
return context.mouseY.current - bounds.y - bounds.height / 2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return context.mouseX.current - bounds.x - bounds.width / 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let iconWidth = $derived.by(() => {
|
|
29
|
+
const distanceCalc = calculateDistance();
|
|
30
|
+
|
|
31
|
+
if (!context.distance || !context.magnification) return 40;
|
|
32
|
+
|
|
33
|
+
if (Math.abs(distanceCalc) < context.distance) {
|
|
34
|
+
return (1 - Math.abs(distanceCalc) / context.distance) * context.magnification + 40;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return 40;
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
bind:this={iconRef}
|
|
43
|
+
class="flex aspect-square cursor-pointer items-center justify-center rounded-full transition-all duration-200 ease-out {className}"
|
|
44
|
+
style:width="{iconWidth}px"
|
|
45
|
+
style:height="{iconWidth}px"
|
|
46
|
+
>
|
|
47
|
+
{#if children}
|
|
48
|
+
{@render children()}
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
import { cn } from "../../utils";
|
|
4
|
+
import { DOCK_CONTEXT_KEY, type DockContext } from "./types";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { class: className = "" }: Props = $props();
|
|
11
|
+
|
|
12
|
+
const context = getContext<DockContext>(DOCK_CONTEXT_KEY);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class={cn(
|
|
17
|
+
"bg-secondary relative block",
|
|
18
|
+
context.orientation === "vertical" ? "h-0.5 w-4/5" : "h-4/5 w-0.5",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
></div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Dock
|
|
2
|
+
|
|
3
|
+
A macOS-style dock component with icon magnification on hover.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
- `Dock` - Main container that tracks mouse position
|
|
8
|
+
- `DockIcon` - Individual dock item with magnification effect
|
|
9
|
+
- `DockSeparator` - Visual separator between icon groups
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```svelte
|
|
14
|
+
<script>
|
|
15
|
+
import { Dock, DockIcon, DockSeparator } from '$lib/fancy-ui/dock';
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Dock>
|
|
19
|
+
<DockIcon>
|
|
20
|
+
<img src="/icon1.svg" class="size-full" alt="Icon" />
|
|
21
|
+
</DockIcon>
|
|
22
|
+
<DockSeparator />
|
|
23
|
+
<DockIcon>
|
|
24
|
+
<img src="/icon2.svg" class="size-full" alt="Icon" />
|
|
25
|
+
</DockIcon>
|
|
26
|
+
</Dock>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
### Dock
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Default | Description |
|
|
34
|
+
|------|------|---------|-------------|
|
|
35
|
+
| `class` | `string` | `''` | Additional CSS classes |
|
|
36
|
+
| `magnification` | `number` | `60` | Maximum size increase in pixels |
|
|
37
|
+
| `distance` | `number` | `140` | Mouse distance for magnification effect |
|
|
38
|
+
| `direction` | `'top' \| 'middle' \| 'bottom'` | `'middle'` | Vertical alignment of icons |
|
|
39
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Dock orientation |
|
|
40
|
+
|
|
41
|
+
### DockIcon
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Default | Description |
|
|
44
|
+
|------|------|---------|-------------|
|
|
45
|
+
| `class` | `string` | `''` | Additional CSS classes |
|
|
46
|
+
|
|
47
|
+
### DockSeparator
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
|------|------|---------|-------------|
|
|
51
|
+
| `class` | `string` | `''` | Additional CSS classes |
|
|
52
|
+
|
|
53
|
+
## Implementation Notes
|
|
54
|
+
|
|
55
|
+
- Uses Svelte context (`setContext`/`getContext`) instead of Vue's provide/inject
|
|
56
|
+
- Mouse position stored in reactive objects (`{ current: number }`) for child reactivity
|
|
57
|
+
- Base icon size is 40px, magnification adds to this
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DataOrientation = "vertical" | "horizontal";
|
|
2
|
+
export type Direction = "top" | "middle" | "bottom";
|
|
3
|
+
export interface DockContext {
|
|
4
|
+
mouseX: {
|
|
5
|
+
current: number;
|
|
6
|
+
};
|
|
7
|
+
mouseY: {
|
|
8
|
+
current: number;
|
|
9
|
+
};
|
|
10
|
+
magnification: number;
|
|
11
|
+
distance: number;
|
|
12
|
+
orientation: DataOrientation;
|
|
13
|
+
}
|
|
14
|
+
export declare const DOCK_CONTEXT_KEY: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DOCK_CONTEXT_KEY = Symbol("dock-context");
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
/**
|
|
3
|
+
* FlickeringGrid - Canvas-based grid with flickering opacity squares
|
|
4
|
+
*
|
|
5
|
+
* Uses ResizeObserver, IntersectionObserver, and requestAnimationFrame
|
|
6
|
+
* for performant rendering with automatic pause when off-screen.
|
|
7
|
+
*/
|
|
8
|
+
export interface FlickeringGridProps {
|
|
9
|
+
/** Size of each grid square in pixels */
|
|
10
|
+
squareSize?: number;
|
|
11
|
+
/** Gap between squares in pixels */
|
|
12
|
+
gridGap?: number;
|
|
13
|
+
/** Probability of a square changing opacity each second (0-1) */
|
|
14
|
+
flickerChance?: number;
|
|
15
|
+
/** Color of the squares (hex format) */
|
|
16
|
+
color?: string;
|
|
17
|
+
/** Maximum opacity of squares (0-1) */
|
|
18
|
+
maxOpacity?: number;
|
|
19
|
+
/** Fixed width in pixels (defaults to container width) */
|
|
20
|
+
width?: number;
|
|
21
|
+
/** Fixed height in pixels (defaults to container height) */
|
|
22
|
+
height?: number;
|
|
23
|
+
/** Additional CSS classes */
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import { cn } from "../../utils.js";
|
|
30
|
+
import { onMount } from "svelte";
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
squareSize = 4,
|
|
34
|
+
gridGap = 6,
|
|
35
|
+
flickerChance = 0.3,
|
|
36
|
+
color = "#000000",
|
|
37
|
+
maxOpacity = 0.3,
|
|
38
|
+
width,
|
|
39
|
+
height,
|
|
40
|
+
class: className,
|
|
41
|
+
}: FlickeringGridProps = $props();
|
|
42
|
+
|
|
43
|
+
let containerEl: HTMLDivElement;
|
|
44
|
+
let canvasEl: HTMLCanvasElement;
|
|
45
|
+
|
|
46
|
+
function hexToRgba(hex: string): string {
|
|
47
|
+
const clean = hex.replace(/^#/, "");
|
|
48
|
+
const bigint = Number.parseInt(clean, 16);
|
|
49
|
+
const r = (bigint >> 16) & 255;
|
|
50
|
+
const g = (bigint >> 8) & 255;
|
|
51
|
+
const b = bigint & 255;
|
|
52
|
+
return `rgba(${r}, ${g}, ${b},`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onMount(() => {
|
|
56
|
+
const ctx = canvasEl.getContext("2d");
|
|
57
|
+
if (!ctx) return;
|
|
58
|
+
|
|
59
|
+
let isInView = false;
|
|
60
|
+
let animationFrameId: number | undefined;
|
|
61
|
+
let lastTime = 0;
|
|
62
|
+
let cols = 0;
|
|
63
|
+
let rows = 0;
|
|
64
|
+
let squares: Float32Array;
|
|
65
|
+
let dpr = 1;
|
|
66
|
+
|
|
67
|
+
function setupCanvas(w: number, h: number) {
|
|
68
|
+
dpr = window.devicePixelRatio || 1;
|
|
69
|
+
canvasEl.width = w * dpr;
|
|
70
|
+
canvasEl.height = h * dpr;
|
|
71
|
+
canvasEl.style.width = `${w}px`;
|
|
72
|
+
canvasEl.style.height = `${h}px`;
|
|
73
|
+
|
|
74
|
+
cols = Math.floor(w / (squareSize + gridGap));
|
|
75
|
+
rows = Math.floor(h / (squareSize + gridGap));
|
|
76
|
+
|
|
77
|
+
squares = new Float32Array(cols * rows);
|
|
78
|
+
for (let i = 0; i < squares.length; i++) {
|
|
79
|
+
squares[i] = Math.random() * maxOpacity;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function updateSquares(deltaTime: number) {
|
|
84
|
+
for (let i = 0; i < squares.length; i++) {
|
|
85
|
+
if (Math.random() < flickerChance * deltaTime) {
|
|
86
|
+
squares[i] = Math.random() * maxOpacity;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function drawGrid() {
|
|
92
|
+
const colorPrefix = hexToRgba(color);
|
|
93
|
+
ctx!.clearRect(0, 0, canvasEl.width, canvasEl.height);
|
|
94
|
+
for (let i = 0; i < cols; i++) {
|
|
95
|
+
for (let j = 0; j < rows; j++) {
|
|
96
|
+
const opacity = squares[i * rows + j];
|
|
97
|
+
ctx!.fillStyle = `${colorPrefix}${opacity})`;
|
|
98
|
+
ctx!.fillRect(
|
|
99
|
+
i * (squareSize + gridGap) * dpr,
|
|
100
|
+
j * (squareSize + gridGap) * dpr,
|
|
101
|
+
squareSize * dpr,
|
|
102
|
+
squareSize * dpr
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function updateCanvasSize() {
|
|
109
|
+
const w = width ?? containerEl.clientWidth;
|
|
110
|
+
const h = height ?? containerEl.clientHeight;
|
|
111
|
+
setupCanvas(w, h);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function animate(time: number) {
|
|
115
|
+
if (!isInView) return;
|
|
116
|
+
|
|
117
|
+
const deltaTime = (time - lastTime) / 1000;
|
|
118
|
+
lastTime = time;
|
|
119
|
+
|
|
120
|
+
updateSquares(deltaTime);
|
|
121
|
+
drawGrid();
|
|
122
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
updateCanvasSize();
|
|
126
|
+
|
|
127
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
128
|
+
updateCanvasSize();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const intersectionObserver = new IntersectionObserver(
|
|
132
|
+
([entry]) => {
|
|
133
|
+
isInView = entry.isIntersecting;
|
|
134
|
+
if (isInView) {
|
|
135
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{ threshold: 0 }
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
resizeObserver.observe(containerEl);
|
|
142
|
+
intersectionObserver.observe(canvasEl);
|
|
143
|
+
|
|
144
|
+
return () => {
|
|
145
|
+
if (animationFrameId) cancelAnimationFrame(animationFrameId);
|
|
146
|
+
resizeObserver.disconnect();
|
|
147
|
+
intersectionObserver.disconnect();
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<div bind:this={containerEl} class={cn("h-full w-full", className)}>
|
|
153
|
+
<canvas bind:this={canvasEl} class="pointer-events-none"></canvas>
|
|
154
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlickeringGrid - Canvas-based grid with flickering opacity squares
|
|
3
|
+
*
|
|
4
|
+
* Uses ResizeObserver, IntersectionObserver, and requestAnimationFrame
|
|
5
|
+
* for performant rendering with automatic pause when off-screen.
|
|
6
|
+
*/
|
|
7
|
+
export interface FlickeringGridProps {
|
|
8
|
+
/** Size of each grid square in pixels */
|
|
9
|
+
squareSize?: number;
|
|
10
|
+
/** Gap between squares in pixels */
|
|
11
|
+
gridGap?: number;
|
|
12
|
+
/** Probability of a square changing opacity each second (0-1) */
|
|
13
|
+
flickerChance?: number;
|
|
14
|
+
/** Color of the squares (hex format) */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Maximum opacity of squares (0-1) */
|
|
17
|
+
maxOpacity?: number;
|
|
18
|
+
/** Fixed width in pixels (defaults to container width) */
|
|
19
|
+
width?: number;
|
|
20
|
+
/** Fixed height in pixels (defaults to container height) */
|
|
21
|
+
height?: number;
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
class?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const FlickeringGrid: import("svelte").Component<FlickeringGridProps, {}, "">;
|
|
26
|
+
type FlickeringGrid = ReturnType<typeof FlickeringGrid>;
|
|
27
|
+
export default FlickeringGrid;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|