fancy-ui-vue 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PORTING.md +123 -2
- package/README.md +20 -15
- package/dist/components/accordion/Accordion.vue.d.ts +44 -0
- package/dist/components/accordion/Accordion.vue.js +88 -0
- package/dist/components/accordion/Accordion.vue2.js +4 -0
- package/dist/components/accordion/AccordionContent.vue.d.ts +25 -0
- package/dist/components/accordion/AccordionContent.vue.js +42 -0
- package/dist/components/accordion/AccordionContent.vue2.js +4 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +21 -0
- package/dist/components/accordion/AccordionItem.vue.js +66 -0
- package/dist/components/accordion/AccordionItem.vue2.js +4 -0
- package/dist/components/accordion/AccordionTrigger.vue.d.ts +24 -0
- package/dist/components/accordion/AccordionTrigger.vue.js +83 -0
- package/dist/components/accordion/AccordionTrigger.vue2.js +4 -0
- package/dist/components/accordion/accordion-core.d.ts +35 -0
- package/dist/components/accordion/accordion-core.js +44 -0
- package/dist/components/accordion/index.d.ts +11 -0
- package/dist/components/accordion/types.d.ts +45 -0
- package/dist/components/accordion/types.js +7 -0
- package/dist/components/alert-dialog/AlertDialog.vue.js +22 -3
- package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +3 -3
- package/dist/components/apple-card-carousel/AppleCard.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue.js +1 -1
- package/dist/components/autocomplete/Autocomplete.vue2.js +22 -15
- package/dist/components/avatar/Avatar.vue.d.ts +27 -0
- package/dist/components/avatar/Avatar.vue.js +119 -0
- package/dist/components/avatar/Avatar.vue2.js +4 -0
- package/dist/components/avatar/avatar-core.d.ts +40 -0
- package/dist/components/avatar/avatar-core.js +57 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/badge/Badge.vue.d.ts +21 -0
- package/dist/components/badge/Badge.vue.js +46 -0
- package/dist/components/badge/Badge.vue2.js +4 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/bento-grid/BentoFrame.vue.js +1 -1
- package/dist/components/bento-grid/BentoFrame.vue2.js +6 -5
- package/dist/components/bento-grid/BentoGrid.vue.js +1 -1
- package/dist/components/bento-grid/BentoGrid.vue2.js +12 -12
- package/dist/components/bento-grid/BentoGridCard.vue.js +6 -5
- package/dist/components/bento-grid/BentoGridItem.vue.js +6 -5
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.d.ts +1 -1
- package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +1 -1
- package/dist/components/bg-falling-stars/bg-falling-stars-core.js +47 -12
- package/dist/components/book/Book.vue.js +8 -9
- package/dist/components/book/BookDescription.vue.js +6 -5
- package/dist/components/book/BookHeader.vue.js +6 -5
- package/dist/components/book/BookTitle.vue.js +6 -5
- package/dist/components/box-reveal/BoxReveal.vue.js +6 -5
- package/dist/components/button/Button.vue.d.ts +6 -4
- package/dist/components/button/Button.vue.js +1 -1
- package/dist/components/button/Button.vue2.js +50 -22
- package/dist/components/card-3d/CardContainer.vue.js +1 -1
- package/dist/components/card-3d/CardItem.vue.js +1 -1
- package/dist/components/card-spotlight/CardSpotlight.vue.js +1 -1
- package/dist/components/chat-message/ChatMessageAction.vue.d.ts +4 -2
- package/dist/components/chat-message/ChatMessageAction.vue.js +4 -2
- package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/checkbox/Checkbox.vue.js +1 -1
- package/dist/components/checkbox/Checkbox.vue2.js +17 -7
- package/dist/components/collapsible/Collapsible.vue.d.ts +31 -0
- package/dist/components/collapsible/Collapsible.vue.js +60 -0
- package/dist/components/collapsible/Collapsible.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleContent.vue.d.ts +26 -0
- package/dist/components/collapsible/CollapsibleContent.vue.js +81 -0
- package/dist/components/collapsible/CollapsibleContent.vue2.js +4 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.d.ts +21 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue.js +57 -0
- package/dist/components/collapsible/CollapsibleTrigger.vue2.js +4 -0
- package/dist/components/collapsible/collapsible-core.d.ts +47 -0
- package/dist/components/collapsible/collapsible-core.js +40 -0
- package/dist/components/collapsible/index.d.ts +8 -0
- package/dist/components/collapsible/types.d.ts +24 -0
- package/dist/components/collapsible/types.js +5 -0
- package/dist/components/combobox/Combobox.vue.js +1 -1
- package/dist/components/combobox/Combobox.vue2.js +24 -16
- package/dist/components/command-menu/CommandMenu.vue.d.ts +5 -0
- package/dist/components/command-menu/CommandMenu.vue.js +1 -1
- package/dist/components/command-menu/CommandMenu.vue2.js +5 -2
- package/dist/components/compare/Compare.vue.d.ts +15 -5
- package/dist/components/compare/Compare.vue.js +1 -1
- package/dist/components/compare/Compare.vue2.js +28 -13
- package/dist/components/composer/ComposerInput.vue.js +1 -1
- package/dist/components/composer/ComposerInput.vue2.js +11 -11
- package/dist/components/composer/ComposerModelPicker.vue.d.ts +4 -0
- package/dist/components/composer/ComposerModelPicker.vue.js +1 -1
- package/dist/components/composer/ComposerModelPicker.vue2.js +29 -15
- package/dist/components/composer/ComposerSubmit.vue.d.ts +2 -0
- package/dist/components/composer/ComposerSubmit.vue.js +16 -15
- package/dist/components/confetti/ConfettiButton.vue.d.ts +9 -2
- package/dist/components/confetti/ConfettiButton.vue.js +24 -6
- package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
- package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +12 -13
- package/dist/components/copy-button/CopyButton.vue.d.ts +5 -0
- package/dist/components/copy-button/CopyButton.vue.js +1 -1
- package/dist/components/copy-button/CopyButton.vue2.js +72 -11
- package/dist/components/datamosh-transition/DatamoshTransition.vue.d.ts +6 -2
- package/dist/components/datamosh-transition/DatamoshTransition.vue.js +7 -4
- package/dist/components/date-picker/DatePicker.vue.js +1 -1
- package/dist/components/date-picker/DatePicker.vue2.js +27 -21
- package/dist/components/dialog/Dialog.vue.js +20 -1
- package/dist/components/dialog/DialogSurface.vue.js +1 -1
- package/dist/components/dialog/DialogSurface.vue2.js +5 -2
- package/dist/components/dialog/types.d.ts +2 -0
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue.js +1 -1
- package/dist/components/direction-aware-hover/DirectionAwareHover.vue2.js +9 -7
- package/dist/components/displacement-text/DisplacementText.vue.d.ts +4 -1
- package/dist/components/displacement-text/DisplacementText.vue.js +38 -11
- package/dist/components/displacement-text/displacement-text-core.d.ts +94 -4
- package/dist/components/displacement-text/displacement-text-core.js +287 -97
- package/dist/components/drawer/Drawer.vue.d.ts +5 -0
- package/dist/components/drawer/Drawer.vue.js +1 -1
- package/dist/components/drawer/Drawer.vue2.js +5 -2
- package/dist/components/dropdown-menu/DropdownMenuContent.vue.js +2 -1
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuItem.vue.js +17 -10
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +8 -0
- package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.js +28 -13
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +4 -0
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
- package/dist/components/dropdown-menu/DropdownMenuTrigger.vue2.js +20 -10
- package/dist/components/editorial-engine/EditorialEngine.vue.js +1 -1
- package/dist/components/editorial-engine/engine.js +13 -0
- package/dist/components/file-upload/FileUpload.vue.d.ts +2 -0
- package/dist/components/file-upload/FileUpload.vue.js +1 -1
- package/dist/components/file-upload/FileUpload.vue2.js +20 -10
- package/dist/components/fireworks-hdr/FireworksHdr.vue.js +2 -2
- package/dist/components/flickering-grid/FlickeringGrid.vue.d.ts +1 -1
- package/dist/components/flickering-grid/FlickeringGrid.vue.js +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.d.ts +1 -1
- package/dist/components/flickering-grid/flickering-grid-core.js +51 -9
- package/dist/components/flip-card/FlipCard.vue.d.ts +3 -1
- package/dist/components/flip-card/FlipCard.vue.js +1 -1
- package/dist/components/flip-card/FlipCard.vue2.js +5 -3
- package/dist/components/fluid-cursor/FluidCursor.vue.js +37 -9
- package/dist/components/fluid-cursor/fluid-cursor-core.js +3 -3
- package/dist/components/fluid-cursor/webgpu-engine.js +3 -3
- package/dist/components/focus/Focus.vue.js +1 -1
- package/dist/components/focus/Focus.vue2.js +2 -2
- package/dist/components/follow-button/FollowButton.vue.d.ts +69 -0
- package/dist/components/follow-button/FollowButton.vue.js +7 -0
- package/dist/components/follow-button/FollowButton.vue2.js +239 -0
- package/dist/components/follow-button/follow-core.d.ts +83 -0
- package/dist/components/follow-button/follow-core.js +92 -0
- package/dist/components/follow-button/index.d.ts +2 -0
- package/dist/components/frosted-glass/FrostedGlass.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue.js +1 -1
- package/dist/components/glare-card/GlareCard.vue2.js +4 -4
- package/dist/components/glowing-effect/GlowingEffect.vue.js +3 -3
- package/dist/components/glowing-effect/glowing-effect-core.js +4 -1
- package/dist/components/gradient-button/GradientButton.vue.d.ts +6 -4
- package/dist/components/gradient-button/GradientButton.vue.js +1 -1
- package/dist/components/gradient-button/GradientButton.vue2.js +13 -3
- package/dist/components/icon-button/IconButton.vue.d.ts +6 -4
- package/dist/components/icon-button/IconButton.vue.js +11 -8
- package/dist/components/image-trail-cursor/ImageTrailCursor.vue.js +17 -7
- package/dist/components/image-trail-cursor/trail-variants.js +3 -6
- package/dist/components/inline-citation/InlineCitation.vue.js +1 -1
- package/dist/components/inline-citation/InlineCitation.vue2.js +20 -14
- package/dist/components/input/Input.vue.js +1 -1
- package/dist/components/input/Input.vue2.js +18 -8
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue.js +1 -1
- package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue2.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.d.ts +6 -3
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.js +1 -1
- package/dist/components/interactive-hover-button/InteractiveHoverButton.vue2.js +12 -2
- package/dist/components/letter-pullup/LetterPullup.vue.js +4 -4
- package/dist/components/line-hover-link/LineHoverLink.vue.js +1 -1
- package/dist/components/line-hover-link/LineHoverLink.vue2.js +5 -6
- package/dist/components/link/Link.vue.d.ts +4 -2
- package/dist/components/link/Link.vue.js +1 -1
- package/dist/components/link/Link.vue2.js +11 -8
- package/dist/components/magnetic-field/MagnetPuck.vue.d.ts +51 -0
- package/dist/components/magnetic-field/MagnetPuck.vue.js +7 -0
- package/dist/components/magnetic-field/MagnetPuck.vue2.js +191 -0
- package/dist/components/magnetic-field/MagneticField.vue.d.ts +39 -0
- package/dist/components/magnetic-field/MagneticField.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticField.vue2.js +157 -0
- package/dist/components/magnetic-field/MagneticItem.vue.d.ts +28 -0
- package/dist/components/magnetic-field/MagneticItem.vue.js +7 -0
- package/dist/components/magnetic-field/MagneticItem.vue2.js +72 -0
- package/dist/components/magnetic-field/index.d.ts +10 -0
- package/dist/components/magnetic-field/magnetic-field-core.d.ts +163 -0
- package/dist/components/magnetic-field/magnetic-field-core.js +534 -0
- package/dist/components/magnetic-field/magnetic-field-source.d.ts +58 -0
- package/dist/components/magnetic-field/magnetic-field-source.js +58 -0
- package/dist/components/magnetic-field/types.d.ts +14 -0
- package/dist/components/magnetic-field/types.js +5 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.d.ts +6 -0
- package/dist/components/mosaic-glow/MosaicGlow.vue.js +53 -9
- package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +30 -0
- package/dist/components/mosaic-glow/mosaic-glow-core.js +27 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.d.ts +24 -0
- package/dist/components/mosaic-glow/mosaic-glow-hdr.js +200 -0
- package/dist/components/navbar/NavbarLink.vue.d.ts +4 -2
- package/dist/components/navbar/NavbarLink.vue.js +1 -1
- package/dist/components/navbar/NavbarLink.vue2.js +16 -13
- package/dist/components/navigation-menu/NavigationMenu.vue.js +6 -3
- package/dist/components/navigation-menu/NavigationMenuLink.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuLink.vue2.js +8 -8
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +15 -0
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue.js +1 -1
- package/dist/components/navigation-menu/NavigationMenuTrigger.vue2.js +36 -15
- package/dist/components/neon-border/NeonBorder.vue.js +1 -1
- package/dist/components/neon-border/NeonBorder.vue2.js +10 -11
- package/dist/components/number-input/NumberInput.vue.js +1 -1
- package/dist/components/number-input/NumberInput.vue2.js +22 -12
- package/dist/components/password-input/PasswordInput.vue.js +1 -1
- package/dist/components/password-input/PasswordInput.vue2.js +18 -11
- package/dist/components/pixel-loader/PixelLoader.vue.js +1 -1
- package/dist/components/pixel-loader/PixelLoader.vue2.js +6 -6
- package/dist/components/pixel-scene/PixelScene.vue.d.ts +60 -0
- package/dist/components/pixel-scene/PixelScene.vue.js +184 -0
- package/dist/components/pixel-scene/PixelScene.vue2.js +4 -0
- package/dist/components/pixel-scene/index.d.ts +4 -0
- package/dist/components/pixel-scene/pixel-scene-core.d.ts +256 -0
- package/dist/components/pixel-scene/pixel-scene-core.js +878 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.d.ts +68 -0
- package/dist/components/pixel-scene/pixel-scene-hdr.js +312 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.d.ts +31 -0
- package/dist/components/pixel-scene/pixel-scene-scenes.js +1074 -0
- package/dist/components/popover/Popover.vue.d.ts +4 -0
- package/dist/components/popover/Popover.vue.js +1 -1
- package/dist/components/popover/Popover.vue2.js +8 -6
- package/dist/components/popover/PopoverContent.vue.js +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.d.ts +6 -2
- package/dist/components/pulse-beam/PulseBeam.vue.js +1 -1
- package/dist/components/pulse-beam/PulseBeam.vue2.js +7 -4
- package/dist/components/radio-group/RadioGroup.vue.js +12 -11
- package/dist/components/radio-group/RadioGroupItem.vue.d.ts +2 -0
- package/dist/components/radio-group/RadioGroupItem.vue.js +1 -1
- package/dist/components/radio-group/RadioGroupItem.vue2.js +20 -7
- package/dist/components/rainbow-button/RainbowButton.vue.d.ts +11 -2
- package/dist/components/rainbow-button/RainbowButton.vue.js +1 -1
- package/dist/components/rainbow-button/RainbowButton.vue2.js +35 -18
- package/dist/components/ripple-button/RippleButton.vue.d.ts +6 -4
- package/dist/components/ripple-button/RippleButton.vue.js +1 -1
- package/dist/components/ripple-button/RippleButton.vue2.js +10 -5
- package/dist/components/search-input/SearchInput.vue.js +1 -1
- package/dist/components/search-input/SearchInput.vue2.js +19 -9
- package/dist/components/select/Select.vue.d.ts +1 -1
- package/dist/components/select/Select.vue.js +1 -1
- package/dist/components/select/Select.vue2.js +25 -17
- package/dist/components/sheet/Sheet.vue.d.ts +5 -0
- package/dist/components/sheet/Sheet.vue.js +5 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.d.ts +2 -2
- package/dist/components/shimmer-button/ShimmerButton.vue.js +1 -1
- package/dist/components/shimmer-button/ShimmerButton.vue2.js +14 -6
- package/dist/components/sidebar/SidebarItem.vue.d.ts +4 -2
- package/dist/components/sidebar/SidebarItem.vue.js +1 -1
- package/dist/components/sidebar/SidebarItem.vue2.js +4 -2
- package/dist/components/slider/Slider.vue.d.ts +4 -0
- package/dist/components/slider/Slider.vue.js +1 -1
- package/dist/components/slider/Slider.vue2.js +20 -8
- package/dist/components/sources/SourcesTrigger.vue.js +1 -1
- package/dist/components/sources/SourcesTrigger.vue2.js +11 -11
- package/dist/components/sparkles/sparkles-core.d.ts +1 -1
- package/dist/components/sparkles/sparkles-core.js +36 -2
- package/dist/components/story-thread/StoryNode.vue.d.ts +11 -0
- package/dist/components/story-thread/StoryNode.vue.js +7 -0
- package/dist/components/story-thread/StoryNode.vue2.js +23 -0
- package/dist/components/story-thread/StoryThread.vue.d.ts +56 -0
- package/dist/components/story-thread/StoryThread.vue.js +7 -0
- package/dist/components/story-thread/StoryThread.vue2.js +103 -0
- package/dist/components/story-thread/index.d.ts +5 -0
- package/dist/components/story-thread/story-thread-core.d.ts +119 -0
- package/dist/components/story-thread/story-thread-core.js +491 -0
- package/dist/components/story-thread/types.d.ts +1 -0
- package/dist/components/sun-switch/SunSwitch.vue.d.ts +61 -0
- package/dist/components/sun-switch/SunSwitch.vue.js +7 -0
- package/dist/components/sun-switch/SunSwitch.vue2.js +559 -0
- package/dist/components/sun-switch/index.d.ts +4 -0
- package/dist/components/sun-switch/pixel-wave-core.d.ts +82 -0
- package/dist/components/sun-switch/pixel-wave-core.js +508 -0
- package/dist/components/sun-switch/sun-switch-core.d.ts +251 -0
- package/dist/components/sun-switch/sun-switch-core.js +546 -0
- package/dist/components/sun-switch/sun-switch-hdr.d.ts +70 -0
- package/dist/components/sun-switch/sun-switch-hdr.js +311 -0
- package/dist/components/switch/Switch.vue.d.ts +2 -0
- package/dist/components/switch/Switch.vue.js +1 -1
- package/dist/components/switch/Switch.vue2.js +16 -6
- package/dist/components/tabs/TabsTrigger.vue.d.ts +6 -0
- package/dist/components/tabs/TabsTrigger.vue.js +1 -1
- package/dist/components/tabs/TabsTrigger.vue2.js +28 -15
- package/dist/components/terminal-block/TerminalBlock.vue.js +1 -1
- package/dist/components/terminal-block/TerminalBlock.vue2.js +10 -9
- package/dist/components/text-reveal-card/TextRevealCard.vue.js +1 -2
- package/dist/components/textarea/Textarea.vue.js +1 -1
- package/dist/components/textarea/Textarea.vue2.js +19 -12
- package/dist/components/tick-nav/TickNav.vue.d.ts +71 -0
- package/dist/components/tick-nav/TickNav.vue.js +7 -0
- package/dist/components/tick-nav/TickNav.vue2.js +285 -0
- package/dist/components/tick-nav/index.d.ts +3 -0
- package/dist/components/tick-nav/tick-nav-core.d.ts +102 -0
- package/dist/components/tick-nav/tick-nav-core.js +398 -0
- package/dist/components/tick-nav/tick-nav-hdr.d.ts +60 -0
- package/dist/components/tick-nav/tick-nav-hdr.js +284 -0
- package/dist/components/tick-nav/types.d.ts +13 -0
- package/dist/components/time-picker/TimePicker.vue.js +1 -1
- package/dist/components/time-picker/TimePicker.vue2.js +25 -17
- package/dist/components/toast/Toast.vue.js +1 -1
- package/dist/components/toast/Toast.vue2.js +16 -4
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/store.d.ts +23 -0
- package/dist/components/toast/store.js +35 -7
- package/dist/components/toggle/Toggle.vue.d.ts +12 -0
- package/dist/components/toggle/Toggle.vue.js +1 -1
- package/dist/components/toggle/Toggle.vue2.js +27 -11
- package/dist/components/toggle-group/ToggleGroup.vue.d.ts +11 -0
- package/dist/components/toggle-group/ToggleGroup.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroup.vue2.js +16 -3
- package/dist/components/toggle-group/ToggleGroupItem.vue.d.ts +6 -0
- package/dist/components/toggle-group/ToggleGroupItem.vue.js +1 -1
- package/dist/components/toggle-group/ToggleGroupItem.vue2.js +27 -14
- package/dist/components/tooltip/Tooltip.vue.js +13 -0
- package/dist/components/tracing-beam/TracingBeam.vue.d.ts +20 -1
- package/dist/components/tracing-beam/TracingBeam.vue.js +5 -164
- package/dist/components/tracing-beam/TracingBeam.vue2.js +168 -1
- package/dist/components/typing-indicator/TypingIndicator.vue.js +1 -1
- package/dist/components/typing-indicator/TypingIndicator.vue2.js +7 -6
- package/dist/index.d.ts +10 -0
- package/dist/index.js +466 -413
- package/dist/internals/anchor-position.js +3 -0
- package/dist/internals/call-listener.d.ts +11 -0
- package/dist/internals/call-listener.js +31 -0
- package/dist/internals/dismissable.d.ts +17 -0
- package/dist/internals/dismissable.js +44 -1
- package/dist/internals/env.d.ts +1 -0
- package/dist/internals/env.js +11 -0
- package/dist/internals/focus-trap.js +29 -4
- package/dist/internals/merge-ids.d.ts +6 -0
- package/dist/internals/merge-ids.js +11 -0
- package/dist/internals/motion/presence-core.d.ts +1 -1
- package/dist/sound/engine.js +23 -9
- package/dist/sound/themes.d.ts +4 -3
- package/dist/sound/themes.js +49 -211
- package/dist/sound/types.d.ts +9 -1
- package/dist/sound/types.js +2 -2
- package/dist/styles.css +1473 -571
- package/package.json +2 -2
- package/tailwind.css +9 -9
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { SUN_PALETTE, easeInOutCubic, parseInk, staircaseHoleClip, paintSheet, paintHalo, staircasePolygon, coverRadiusCells, staircaseRows, gridOffset } from "./sun-switch-core.js";
|
|
2
|
+
import { sunHdrAvailable, startSunHdr } from "./sun-switch-hdr.js";
|
|
3
|
+
const WAVE_ATTR = "data-fancy-sun-waving";
|
|
4
|
+
const WAVE_NAME = "fancy-sun-wave";
|
|
5
|
+
const LIVE_NAME = "fancy-sun-live";
|
|
6
|
+
const WAVE_HDR_NAME = "fancy-sun-wave-hdr";
|
|
7
|
+
const LIVE_HDR_NAME = "fancy-sun-live-hdr";
|
|
8
|
+
const WAVE_STYLE_ID = "fancy-sun-wave-styles";
|
|
9
|
+
const HALO_ATTR = "data-fancy-sun-halo";
|
|
10
|
+
const HALO_HDR_ATTR = "data-fancy-sun-halo-hdr";
|
|
11
|
+
const SHEET_ATTR = "data-fancy-sun-sheet";
|
|
12
|
+
const GHOST_ATTR = "data-fancy-sun-ghost";
|
|
13
|
+
const MAX_WAVE_CANVAS_PIXELS = 16e6;
|
|
14
|
+
function waveCanvasDpr(devicePixelRatio, W, H) {
|
|
15
|
+
const raw = devicePixelRatio > 0 ? devicePixelRatio : 1;
|
|
16
|
+
const dpr = Math.min(2, Math.max(1, Math.floor(raw)));
|
|
17
|
+
return W * H * dpr * dpr > MAX_WAVE_CANVAS_PIXELS ? 1 : dpr;
|
|
18
|
+
}
|
|
19
|
+
const WAVE_CSS = `html[${WAVE_ATTR}]::view-transition-group(root),
|
|
20
|
+
html[${WAVE_ATTR}]::view-transition-old(root),
|
|
21
|
+
html[${WAVE_ATTR}]::view-transition-new(root),
|
|
22
|
+
html[${WAVE_ATTR}]::view-transition-group(${WAVE_NAME}),
|
|
23
|
+
html[${WAVE_ATTR}]::view-transition-new(${WAVE_NAME}),
|
|
24
|
+
html[${WAVE_ATTR}]::view-transition-group(${LIVE_NAME}),
|
|
25
|
+
html[${WAVE_ATTR}]::view-transition-new(${LIVE_NAME}),
|
|
26
|
+
html[${WAVE_ATTR}]::view-transition-group(${WAVE_HDR_NAME}),
|
|
27
|
+
html[${WAVE_ATTR}]::view-transition-new(${WAVE_HDR_NAME}),
|
|
28
|
+
html[${WAVE_ATTR}]::view-transition-group(${LIVE_HDR_NAME}),
|
|
29
|
+
html[${WAVE_ATTR}]::view-transition-new(${LIVE_HDR_NAME}) {
|
|
30
|
+
animation: none;
|
|
31
|
+
mix-blend-mode: normal;
|
|
32
|
+
}
|
|
33
|
+
html[${WAVE_ATTR}]::view-transition-old(${WAVE_NAME}),
|
|
34
|
+
html[${WAVE_ATTR}]::view-transition-old(${LIVE_NAME}),
|
|
35
|
+
html[${WAVE_ATTR}]::view-transition-old(${WAVE_HDR_NAME}),
|
|
36
|
+
html[${WAVE_ATTR}]::view-transition-old(${LIVE_HDR_NAME}) {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
html[${WAVE_ATTR}]::view-transition-new(root) {
|
|
40
|
+
clip-path: polygon(0 0, 0 0, 0 0);
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const adopted = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
function ensureWaveStyles(doc) {
|
|
45
|
+
const d = doc;
|
|
46
|
+
const Sheet = doc.defaultView?.CSSStyleSheet;
|
|
47
|
+
if (Array.isArray(d.adoptedStyleSheets) && typeof Sheet === "function") {
|
|
48
|
+
const existing = adopted.get(doc);
|
|
49
|
+
if (existing && d.adoptedStyleSheets.includes(existing)) return;
|
|
50
|
+
try {
|
|
51
|
+
const sheet = existing ?? new Sheet();
|
|
52
|
+
if (!existing) sheet.replaceSync(WAVE_CSS);
|
|
53
|
+
d.adoptedStyleSheets = [...d.adoptedStyleSheets, sheet];
|
|
54
|
+
adopted.set(doc, sheet);
|
|
55
|
+
return;
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (doc.getElementById(WAVE_STYLE_ID)) return;
|
|
60
|
+
const el = doc.createElement("style");
|
|
61
|
+
el.id = WAVE_STYLE_ID;
|
|
62
|
+
el.textContent = WAVE_CSS;
|
|
63
|
+
(doc.head ?? doc.documentElement).append(el);
|
|
64
|
+
}
|
|
65
|
+
function supportsViewTransition(doc) {
|
|
66
|
+
return typeof doc.startViewTransition === "function";
|
|
67
|
+
}
|
|
68
|
+
function firstOpaqueBackground(el) {
|
|
69
|
+
const win = el.ownerDocument.defaultView;
|
|
70
|
+
if (!win) return "#fff";
|
|
71
|
+
const layers = [];
|
|
72
|
+
let base = null;
|
|
73
|
+
for (let n = el; n; n = n.parentElement) {
|
|
74
|
+
const bg = win.getComputedStyle(n).backgroundColor;
|
|
75
|
+
if (!bg) continue;
|
|
76
|
+
const p = parseInk(bg);
|
|
77
|
+
if (!p) {
|
|
78
|
+
if (bg === "transparent") continue;
|
|
79
|
+
base = bg;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
if (p.a >= 1) {
|
|
83
|
+
base = bg;
|
|
84
|
+
layers.push(p);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (p.a > 0) layers.push(p);
|
|
88
|
+
}
|
|
89
|
+
if (layers.length === 0) return base ?? "#fff";
|
|
90
|
+
const top = layers[0];
|
|
91
|
+
if (layers.length === 1 && top && top.a >= 1) return base ?? "#fff";
|
|
92
|
+
if (base && !parseInk(base)) return base;
|
|
93
|
+
let c = { r: 255, g: 255, b: 255 };
|
|
94
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
95
|
+
const l = layers[i];
|
|
96
|
+
if (!l) continue;
|
|
97
|
+
c = {
|
|
98
|
+
r: l.r * l.a + c.r * (1 - l.a),
|
|
99
|
+
g: l.g * l.a + c.g * (1 - l.a),
|
|
100
|
+
b: l.b * l.a + c.b * (1 - l.a)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return `rgb(${Math.round(c.r)}, ${Math.round(c.g)}, ${Math.round(c.b)})`;
|
|
104
|
+
}
|
|
105
|
+
const MIN_FLIP_MS = 334;
|
|
106
|
+
let lastFlipAt = -Infinity;
|
|
107
|
+
function flipWait(now) {
|
|
108
|
+
return Math.max(0, lastFlipAt + MIN_FLIP_MS - now);
|
|
109
|
+
}
|
|
110
|
+
function markFlip(now) {
|
|
111
|
+
lastFlipAt = now;
|
|
112
|
+
}
|
|
113
|
+
let active = null;
|
|
114
|
+
function isWaving() {
|
|
115
|
+
return active !== null;
|
|
116
|
+
}
|
|
117
|
+
function report(error) {
|
|
118
|
+
if (typeof console !== "undefined") console.error(error);
|
|
119
|
+
}
|
|
120
|
+
function pixelWave(o) {
|
|
121
|
+
let applied = false;
|
|
122
|
+
const runApply = () => {
|
|
123
|
+
if (applied) return;
|
|
124
|
+
applied = true;
|
|
125
|
+
try {
|
|
126
|
+
o.apply();
|
|
127
|
+
} catch (error) {
|
|
128
|
+
report(error);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
if (active) {
|
|
132
|
+
active.skip();
|
|
133
|
+
runApply();
|
|
134
|
+
return Promise.resolve();
|
|
135
|
+
}
|
|
136
|
+
const doc = typeof document === "undefined" ? null : document;
|
|
137
|
+
const win = doc?.defaultView ?? null;
|
|
138
|
+
if (!doc || !win || !doc.body) {
|
|
139
|
+
runApply();
|
|
140
|
+
return Promise.resolve();
|
|
141
|
+
}
|
|
142
|
+
const reduced = o.reducedMotion ?? (typeof win.matchMedia === "function" && win.matchMedia("(prefers-reduced-motion: reduce)").matches);
|
|
143
|
+
if (reduced) {
|
|
144
|
+
runApply();
|
|
145
|
+
return Promise.resolve();
|
|
146
|
+
}
|
|
147
|
+
const html = doc.documentElement;
|
|
148
|
+
const cell = o.cell && o.cell > 0 ? o.cell : 5;
|
|
149
|
+
const dot = Math.min(o.dot && o.dot > 0 ? o.dot : 4, cell);
|
|
150
|
+
const halo = o.haloCells !== void 0 && o.haloCells >= 0 ? o.haloCells : 9;
|
|
151
|
+
const duration = o.duration !== void 0 && o.duration >= 0 ? o.duration : 1300;
|
|
152
|
+
const palette = o.palette ?? SUN_PALETTE;
|
|
153
|
+
const ease = o.ease ?? easeInOutCubic;
|
|
154
|
+
const now = o.now ?? (() => win.performance.now());
|
|
155
|
+
const scope = (o.mode ?? "document") === "contained" ? o.scope ?? null : null;
|
|
156
|
+
const contained = (o.mode ?? "document") === "contained";
|
|
157
|
+
let W;
|
|
158
|
+
let H;
|
|
159
|
+
let boxLeft = 0;
|
|
160
|
+
let boxTop = 0;
|
|
161
|
+
if (scope) {
|
|
162
|
+
const r = scope.getBoundingClientRect();
|
|
163
|
+
boxLeft = r.left + scope.clientLeft;
|
|
164
|
+
boxTop = r.top + scope.clientTop;
|
|
165
|
+
W = scope.clientWidth;
|
|
166
|
+
H = scope.clientHeight;
|
|
167
|
+
} else {
|
|
168
|
+
W = win.innerWidth;
|
|
169
|
+
H = win.innerHeight;
|
|
170
|
+
}
|
|
171
|
+
const origin = { x: o.origin.x, y: o.origin.y };
|
|
172
|
+
const ox = gridOffset(origin.x - cell / 2, cell);
|
|
173
|
+
const oy = gridOffset(origin.y - cell / 2, cell);
|
|
174
|
+
const tx = (origin.x - ox) / cell;
|
|
175
|
+
const ty = (origin.y - oy) / cell;
|
|
176
|
+
const cover = coverRadiusCells(origin, W, H, cell, halo);
|
|
177
|
+
const dpr = waveCanvasDpr(win.devicePixelRatio, W, H);
|
|
178
|
+
const useVT = !contained && supportsViewTransition(doc) && typeof html.animate === "function";
|
|
179
|
+
const sheetColor = useVT ? "" : o.fill ?? firstOpaqueBackground(scope ?? doc.body);
|
|
180
|
+
const ghost = scope && !useVT ? makeGhost(scope, W, H, sheetColor) : null;
|
|
181
|
+
const canvas = doc.createElement("canvas");
|
|
182
|
+
canvas.setAttribute(HALO_ATTR, "");
|
|
183
|
+
if (!useVT && !ghost) canvas.setAttribute(SHEET_ATTR, "");
|
|
184
|
+
canvas.setAttribute("aria-hidden", "true");
|
|
185
|
+
canvas.width = Math.max(1, Math.round(W * dpr));
|
|
186
|
+
canvas.height = Math.max(1, Math.round(H * dpr));
|
|
187
|
+
const cs = canvas.style;
|
|
188
|
+
cs.position = scope ? "absolute" : "fixed";
|
|
189
|
+
cs.left = "0";
|
|
190
|
+
cs.top = "0";
|
|
191
|
+
cs.width = `${W}px`;
|
|
192
|
+
cs.height = `${H}px`;
|
|
193
|
+
cs.pointerEvents = "none";
|
|
194
|
+
cs.zIndex = "2147483647";
|
|
195
|
+
cs.margin = "0";
|
|
196
|
+
cs.padding = "0";
|
|
197
|
+
cs.border = "0";
|
|
198
|
+
cs.imageRendering = "pixelated";
|
|
199
|
+
let hdrCanvas = null;
|
|
200
|
+
let hdrLayer = null;
|
|
201
|
+
if (o.hdr !== false && sunHdrAvailable()) {
|
|
202
|
+
hdrCanvas = doc.createElement("canvas");
|
|
203
|
+
hdrCanvas.setAttribute(HALO_HDR_ATTR, "");
|
|
204
|
+
hdrCanvas.setAttribute("aria-hidden", "true");
|
|
205
|
+
hdrCanvas.width = canvas.width;
|
|
206
|
+
hdrCanvas.height = canvas.height;
|
|
207
|
+
hdrCanvas.style.cssText = cs.cssText;
|
|
208
|
+
}
|
|
209
|
+
let liveDraw = null;
|
|
210
|
+
if (!useVT && !ghost && o.live && o.live.tagName === "CANVAS") {
|
|
211
|
+
const lr = o.live.getBoundingClientRect();
|
|
212
|
+
liveDraw = {
|
|
213
|
+
el: o.live,
|
|
214
|
+
x: (lr.left - boxLeft) * dpr,
|
|
215
|
+
y: (lr.top - boxTop) * dpr,
|
|
216
|
+
w: lr.width * dpr,
|
|
217
|
+
h: lr.height * dpr
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const hasRaf = typeof win.requestAnimationFrame === "function";
|
|
221
|
+
const request = (cb) => hasRaf ? win.requestAnimationFrame(cb) : win.setTimeout(cb, 16);
|
|
222
|
+
const cancelFrame = (id) => {
|
|
223
|
+
if (!id) return;
|
|
224
|
+
if (hasRaf) win.cancelAnimationFrame(id);
|
|
225
|
+
else win.clearTimeout(id);
|
|
226
|
+
};
|
|
227
|
+
let ctx = null;
|
|
228
|
+
let raf = 0;
|
|
229
|
+
let t0 = null;
|
|
230
|
+
let clipping = useVT;
|
|
231
|
+
let prevAnim = null;
|
|
232
|
+
let lastPoly = "";
|
|
233
|
+
let liveName = "";
|
|
234
|
+
let livePriority = "";
|
|
235
|
+
let liveHdrName = "";
|
|
236
|
+
let liveHdrPriority = "";
|
|
237
|
+
let vt = null;
|
|
238
|
+
let loopDone = false;
|
|
239
|
+
let vtDone = !useVT;
|
|
240
|
+
let done = false;
|
|
241
|
+
let resolve = () => {
|
|
242
|
+
};
|
|
243
|
+
const promise = new Promise((r) => {
|
|
244
|
+
resolve = r;
|
|
245
|
+
});
|
|
246
|
+
const wave = {
|
|
247
|
+
skip() {
|
|
248
|
+
runApply();
|
|
249
|
+
clipping = false;
|
|
250
|
+
prevAnim?.cancel();
|
|
251
|
+
prevAnim = null;
|
|
252
|
+
if (vt) {
|
|
253
|
+
try {
|
|
254
|
+
vt.skipTransition();
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
cleanup();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
function cleanup() {
|
|
262
|
+
if (done) return;
|
|
263
|
+
done = true;
|
|
264
|
+
cancelFrame(raf);
|
|
265
|
+
raf = 0;
|
|
266
|
+
canvas.remove();
|
|
267
|
+
hdrCanvas?.remove();
|
|
268
|
+
hdrLayer?.destroy();
|
|
269
|
+
hdrLayer = null;
|
|
270
|
+
ghost?.remove();
|
|
271
|
+
if (useVT) {
|
|
272
|
+
html.removeAttribute(WAVE_ATTR);
|
|
273
|
+
if (o.live) {
|
|
274
|
+
if (liveName) o.live.style.setProperty("view-transition-name", liveName, livePriority);
|
|
275
|
+
else o.live.style.removeProperty("view-transition-name");
|
|
276
|
+
}
|
|
277
|
+
if (o.liveHdr) {
|
|
278
|
+
if (liveHdrName)
|
|
279
|
+
o.liveHdr.style.setProperty("view-transition-name", liveHdrName, liveHdrPriority);
|
|
280
|
+
else o.liveHdr.style.removeProperty("view-transition-name");
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (active === wave) active = null;
|
|
284
|
+
resolve();
|
|
285
|
+
}
|
|
286
|
+
function maybeFinish() {
|
|
287
|
+
if (loopDone && vtDone) cleanup();
|
|
288
|
+
}
|
|
289
|
+
function frame() {
|
|
290
|
+
raf = 0;
|
|
291
|
+
if (done) return;
|
|
292
|
+
const n = now();
|
|
293
|
+
if (t0 === null) t0 = n;
|
|
294
|
+
const t = duration > 0 ? Math.min(1, Math.max(0, (n - t0) / duration)) : 1;
|
|
295
|
+
const R = ease(t) * cover;
|
|
296
|
+
const rows = staircaseRows(tx, ty, R - halo + 0.5, cell, ox, oy);
|
|
297
|
+
if (ghost) ghost.style.setProperty("clip-path", staircaseHoleClip(rows, W, H));
|
|
298
|
+
if (ctx) {
|
|
299
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
300
|
+
if (!useVT && !ghost) {
|
|
301
|
+
paintSheet(ctx, sheetColor, W, H, dpr, rows);
|
|
302
|
+
if (liveDraw) drawLive(ctx, liveDraw);
|
|
303
|
+
}
|
|
304
|
+
const glow = hdrLayer?.sink ?? null;
|
|
305
|
+
glow?.clear();
|
|
306
|
+
paintHalo(ctx, { cx: tx, cy: ty, R, halo, cell, dot, ox, oy, W, H, palette, dpr, glow });
|
|
307
|
+
hdrLayer?.render(canvas.width, canvas.height, Math.max(1, Math.round(dot * dpr)));
|
|
308
|
+
}
|
|
309
|
+
const poly = clipping && vt ? staircasePolygon(rows) : "";
|
|
310
|
+
if (clipping && vt && poly !== lastPoly) {
|
|
311
|
+
try {
|
|
312
|
+
const keyframes = [{ clipPath: poly }, { clipPath: poly }];
|
|
313
|
+
if (!(prevAnim && setKeyframes(prevAnim, keyframes))) {
|
|
314
|
+
const a = html.animate(keyframes, {
|
|
315
|
+
duration: 1e6,
|
|
316
|
+
fill: "forwards",
|
|
317
|
+
pseudoElement: "::view-transition-new(root)"
|
|
318
|
+
});
|
|
319
|
+
prevAnim?.cancel();
|
|
320
|
+
prevAnim = a;
|
|
321
|
+
}
|
|
322
|
+
lastPoly = poly;
|
|
323
|
+
} catch {
|
|
324
|
+
clipping = false;
|
|
325
|
+
prevAnim?.cancel();
|
|
326
|
+
prevAnim = null;
|
|
327
|
+
try {
|
|
328
|
+
vt.skipTransition();
|
|
329
|
+
} catch {
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (o.onFront) {
|
|
334
|
+
try {
|
|
335
|
+
o.onFront(R, t);
|
|
336
|
+
} catch (error) {
|
|
337
|
+
report(error);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (done) return;
|
|
341
|
+
if (t < 1) {
|
|
342
|
+
raf = request(frame);
|
|
343
|
+
} else {
|
|
344
|
+
prevAnim?.finish();
|
|
345
|
+
loopDone = true;
|
|
346
|
+
maybeFinish();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
active = wave;
|
|
350
|
+
if (ghost && scope) scope.append(ghost);
|
|
351
|
+
(scope ?? doc.body).append(canvas);
|
|
352
|
+
if (hdrCanvas) {
|
|
353
|
+
canvas.after(hdrCanvas);
|
|
354
|
+
void startSunHdr(hdrCanvas).then((layer) => {
|
|
355
|
+
if (done) layer?.destroy();
|
|
356
|
+
else hdrLayer = layer;
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
ctx = typeof canvas.getContext === "function" ? canvas.getContext("2d") : null;
|
|
361
|
+
} catch {
|
|
362
|
+
ctx = null;
|
|
363
|
+
}
|
|
364
|
+
if (useVT) {
|
|
365
|
+
ensureWaveStyles(doc);
|
|
366
|
+
if (o.live) {
|
|
367
|
+
liveName = o.live.style.getPropertyValue("view-transition-name");
|
|
368
|
+
livePriority = o.live.style.getPropertyPriority("view-transition-name");
|
|
369
|
+
o.live.style.setProperty("view-transition-name", LIVE_NAME);
|
|
370
|
+
}
|
|
371
|
+
if (o.liveHdr) {
|
|
372
|
+
liveHdrName = o.liveHdr.style.getPropertyValue("view-transition-name");
|
|
373
|
+
liveHdrPriority = o.liveHdr.style.getPropertyPriority("view-transition-name");
|
|
374
|
+
o.liveHdr.style.setProperty("view-transition-name", LIVE_HDR_NAME);
|
|
375
|
+
}
|
|
376
|
+
canvas.style.setProperty("view-transition-name", WAVE_NAME);
|
|
377
|
+
hdrCanvas?.style.setProperty("view-transition-name", WAVE_HDR_NAME);
|
|
378
|
+
html.setAttribute(WAVE_ATTR, "");
|
|
379
|
+
try {
|
|
380
|
+
const start = doc.startViewTransition;
|
|
381
|
+
vt = start.call(doc, runApply);
|
|
382
|
+
} catch (error) {
|
|
383
|
+
report(error);
|
|
384
|
+
vt = null;
|
|
385
|
+
}
|
|
386
|
+
if (!vt) {
|
|
387
|
+
runApply();
|
|
388
|
+
cleanup();
|
|
389
|
+
return promise;
|
|
390
|
+
}
|
|
391
|
+
const settleVT = () => {
|
|
392
|
+
vtDone = true;
|
|
393
|
+
maybeFinish();
|
|
394
|
+
};
|
|
395
|
+
vt.finished.then(settleVT, settleVT);
|
|
396
|
+
vt.ready.then(
|
|
397
|
+
() => {
|
|
398
|
+
if (!done) raf = request(frame);
|
|
399
|
+
},
|
|
400
|
+
() => {
|
|
401
|
+
loopDone = true;
|
|
402
|
+
maybeFinish();
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
} else {
|
|
406
|
+
runApply();
|
|
407
|
+
frame();
|
|
408
|
+
}
|
|
409
|
+
return promise;
|
|
410
|
+
}
|
|
411
|
+
function setKeyframes(anim, keyframes) {
|
|
412
|
+
const effect = anim.effect;
|
|
413
|
+
if (!effect || typeof effect.setKeyframes !== "function") return false;
|
|
414
|
+
try {
|
|
415
|
+
effect.setKeyframes(keyframes);
|
|
416
|
+
return true;
|
|
417
|
+
} catch {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function drawLive(ctx, d) {
|
|
422
|
+
const c = ctx;
|
|
423
|
+
if (typeof c.drawImage !== "function" || !(d.w > 0 && d.h > 0)) return;
|
|
424
|
+
try {
|
|
425
|
+
c.globalCompositeOperation = "source-atop";
|
|
426
|
+
c.drawImage(d.el, d.x, d.y, d.w, d.h);
|
|
427
|
+
} catch {
|
|
428
|
+
} finally {
|
|
429
|
+
c.globalCompositeOperation = "source-over";
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const GHOST_DROP = "iframe, object, embed, video, audio, script";
|
|
433
|
+
function makeGhost(scope, W, H, background) {
|
|
434
|
+
const win = scope.ownerDocument.defaultView;
|
|
435
|
+
const css = win?.CSS;
|
|
436
|
+
try {
|
|
437
|
+
if (!css?.supports?.("clip-path", 'path(evenodd, "M0 0H1V1H0Z")')) return null;
|
|
438
|
+
const ghost = scope.cloneNode(true);
|
|
439
|
+
for (const el of Array.from(ghost.querySelectorAll(GHOST_DROP))) el.remove();
|
|
440
|
+
for (const el of [ghost, ...Array.from(ghost.querySelectorAll("[id], [name]"))]) {
|
|
441
|
+
el.removeAttribute("id");
|
|
442
|
+
el.removeAttribute("name");
|
|
443
|
+
}
|
|
444
|
+
const from = Array.from(scope.querySelectorAll("canvas"));
|
|
445
|
+
const to = Array.from(ghost.querySelectorAll("canvas"));
|
|
446
|
+
from.forEach((src, i) => {
|
|
447
|
+
const dst = to[i];
|
|
448
|
+
if (!dst) return;
|
|
449
|
+
try {
|
|
450
|
+
dst.width = src.width;
|
|
451
|
+
dst.height = src.height;
|
|
452
|
+
dst.getContext("2d")?.drawImage(src, 0, 0);
|
|
453
|
+
} catch {
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
ghost.setAttribute(GHOST_ATTR, "");
|
|
457
|
+
ghost.setAttribute("aria-hidden", "true");
|
|
458
|
+
ghost.setAttribute("inert", "");
|
|
459
|
+
const gs = ghost.style;
|
|
460
|
+
gs.position = "absolute";
|
|
461
|
+
gs.left = "0";
|
|
462
|
+
gs.top = "0";
|
|
463
|
+
gs.right = "auto";
|
|
464
|
+
gs.bottom = "auto";
|
|
465
|
+
gs.width = `${W}px`;
|
|
466
|
+
gs.height = `${H}px`;
|
|
467
|
+
gs.minWidth = "0";
|
|
468
|
+
gs.minHeight = "0";
|
|
469
|
+
gs.maxWidth = "none";
|
|
470
|
+
gs.maxHeight = "none";
|
|
471
|
+
gs.margin = "0";
|
|
472
|
+
gs.borderStyle = "none";
|
|
473
|
+
gs.boxSizing = "border-box";
|
|
474
|
+
gs.transform = "none";
|
|
475
|
+
gs.transition = "none";
|
|
476
|
+
gs.overflow = "hidden";
|
|
477
|
+
gs.pointerEvents = "none";
|
|
478
|
+
gs.zIndex = "2147483646";
|
|
479
|
+
if (background) gs.backgroundColor = background;
|
|
480
|
+
gs.setProperty("clip-path", staircaseHoleClip([], W, H));
|
|
481
|
+
return ghost;
|
|
482
|
+
} catch {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
export {
|
|
487
|
+
GHOST_ATTR,
|
|
488
|
+
HALO_ATTR,
|
|
489
|
+
HALO_HDR_ATTR,
|
|
490
|
+
LIVE_HDR_NAME,
|
|
491
|
+
LIVE_NAME,
|
|
492
|
+
MAX_WAVE_CANVAS_PIXELS,
|
|
493
|
+
MIN_FLIP_MS,
|
|
494
|
+
SHEET_ATTR,
|
|
495
|
+
WAVE_ATTR,
|
|
496
|
+
WAVE_CSS,
|
|
497
|
+
WAVE_HDR_NAME,
|
|
498
|
+
WAVE_NAME,
|
|
499
|
+
WAVE_STYLE_ID,
|
|
500
|
+
ensureWaveStyles,
|
|
501
|
+
firstOpaqueBackground,
|
|
502
|
+
flipWait,
|
|
503
|
+
isWaving,
|
|
504
|
+
markFlip,
|
|
505
|
+
pixelWave,
|
|
506
|
+
supportsViewTransition,
|
|
507
|
+
waveCanvasDpr
|
|
508
|
+
};
|