godown 3.0.0-canary.8 → 3.0.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/README.md +38 -9
- package/alert.d.ts +1 -0
- package/alert.d.ts.map +1 -1
- package/alert.js +1 -5
- package/alert.js.map +1 -1
- package/avatar.d.ts +1 -0
- package/avatar.d.ts.map +1 -1
- package/avatar.js +1 -5
- package/avatar.js.map +1 -1
- package/badge.d.ts +9 -0
- package/badge.d.ts.map +1 -0
- package/badge.js +2 -0
- package/badge.js.map +1 -0
- package/breath.js +1 -5
- package/breath.js.map +1 -1
- package/build/godown+lit.iife.js +59 -0
- package/build/godown+lit.iife.js.map +1 -0
- package/build/godown+lit.js +59 -0
- package/build/godown+lit.js.map +1 -0
- package/build/godown+lit.umd.js +59 -0
- package/build/godown+lit.umd.js.map +1 -0
- package/build/godown.iife.js +47 -0
- package/build/godown.js +48 -0
- package/build/godown.js.map +1 -0
- package/build/godown.umd.js +48 -0
- package/build/godown.umd.js.map +1 -0
- package/button.d.ts +1 -0
- package/button.d.ts.map +1 -1
- package/button.js +1 -5
- package/button.js.map +1 -1
- package/card.d.ts +1 -0
- package/card.d.ts.map +1 -1
- package/card.js +1 -5
- package/card.js.map +1 -1
- package/carousel.d.ts +1 -0
- package/carousel.d.ts.map +1 -1
- package/carousel.js +1 -5
- package/carousel.js.map +1 -1
- package/components/alert.d.ts +4 -1
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +1 -176
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +8 -2
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -61
- package/components/avatar.js.map +1 -1
- package/components/badge.d.ts +23 -0
- package/components/badge.d.ts.map +1 -0
- package/components/badge.js +2 -0
- package/components/badge.js.map +1 -0
- package/components/breath.d.ts +7 -4
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -79
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +19 -10
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -165
- package/components/button.js.map +1 -1
- package/components/card.d.ts +3 -2
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -53
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +10 -5
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +1 -112
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +6 -2
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -49
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +8 -3
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -93
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +3 -3
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +1 -36
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +11 -9
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -109
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts +4 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +1 -54
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +3 -3
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -77
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +10 -3
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -55
- package/components/grid.js.map +1 -1
- package/components/heading.d.ts +29 -0
- package/components/heading.d.ts.map +1 -0
- package/components/heading.js +2 -0
- package/components/heading.js.map +1 -0
- package/components/input.d.ts +7 -3
- package/components/input.d.ts.map +1 -1
- package/components/input.js +1 -50
- package/components/input.js.map +1 -1
- package/components/layout.d.ts +8 -9
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -46
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +8 -1
- package/components/link.d.ts.map +1 -1
- package/components/link.js +1 -42
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +4 -11
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -67
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +22 -15
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -273
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +4 -2
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js +1 -56
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +20 -24
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -250
- package/components/router.js.map +1 -1
- package/components/select.d.ts +8 -4
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -212
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts +3 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +1 -54
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts +25 -2
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -128
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +8 -5
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +1 -92
- package/components/switch.js.map +1 -1
- package/components/text.d.ts +3 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +1 -43
- package/components/text.js.map +1 -1
- package/components/time.d.ts +8 -6
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -85
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +14 -2
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -66
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +8 -14
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -129
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts +2 -2
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -45
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts +2 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -38
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +6 -5
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -111
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -37
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/details.d.ts +1 -0
- package/details.d.ts.map +1 -1
- package/details.js +1 -5
- package/details.js.map +1 -1
- package/dev/alert.d.ts +1 -0
- package/dev/alert.d.ts.map +1 -1
- package/dev/alert.js +1 -0
- package/dev/alert.js.map +1 -1
- package/dev/avatar.d.ts +1 -0
- package/dev/avatar.d.ts.map +1 -1
- package/dev/avatar.js +1 -0
- package/dev/avatar.js.map +1 -1
- package/dev/badge.d.ts +9 -0
- package/dev/badge.d.ts.map +1 -0
- package/dev/badge.js +5 -0
- package/dev/badge.js.map +1 -0
- package/dev/button.d.ts +1 -0
- package/dev/button.d.ts.map +1 -1
- package/dev/button.js +1 -0
- package/dev/button.js.map +1 -1
- package/dev/card.d.ts +1 -0
- package/dev/card.d.ts.map +1 -1
- package/dev/card.js +1 -0
- package/dev/card.js.map +1 -1
- package/dev/carousel.d.ts +1 -0
- package/dev/carousel.d.ts.map +1 -1
- package/dev/carousel.js +1 -0
- package/dev/carousel.js.map +1 -1
- package/dev/components/alert.d.ts +4 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +20 -23
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +8 -2
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +23 -13
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts +23 -0
- package/dev/components/badge.d.ts.map +1 -0
- package/dev/components/badge.js +107 -0
- package/dev/components/badge.js.map +1 -0
- package/dev/components/breath.d.ts +7 -4
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +30 -26
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +19 -10
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +47 -28
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +3 -2
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +23 -33
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +10 -5
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +33 -26
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +6 -2
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +24 -26
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +8 -3
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +21 -17
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +3 -3
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +29 -17
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +11 -9
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +11 -4
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts +4 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +25 -9
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +3 -3
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +2 -5
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +10 -3
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +18 -10
- package/dev/components/grid.js.map +1 -1
- package/dev/components/heading.d.ts +29 -0
- package/dev/components/heading.d.ts.map +1 -0
- package/dev/components/heading.js +103 -0
- package/dev/components/heading.js.map +1 -0
- package/dev/components/input.d.ts +7 -3
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +18 -18
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +8 -9
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +38 -25
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts +8 -1
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +15 -3
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +4 -11
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +43 -49
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +22 -15
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +56 -61
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +4 -2
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +3 -5
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +20 -24
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +23 -36
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +8 -4
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +44 -32
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts +3 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +9 -9
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +25 -2
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +71 -38
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +8 -5
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +28 -31
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts +3 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +12 -15
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +8 -6
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +8 -14
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +14 -2
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +54 -24
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +8 -14
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +22 -37
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts +2 -2
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +18 -14
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts +2 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +25 -23
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +6 -5
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +43 -36
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dev/core/super-openable.js +2 -2
- package/dev/core/super-openable.js.map +1 -1
- package/dev/details.d.ts +1 -0
- package/dev/details.d.ts.map +1 -1
- package/dev/details.js +1 -0
- package/dev/details.js.map +1 -1
- package/dev/dialog.d.ts +1 -0
- package/dev/dialog.d.ts.map +1 -1
- package/dev/dialog.js +1 -0
- package/dev/dialog.js.map +1 -1
- package/dev/divider.d.ts +1 -0
- package/dev/divider.d.ts.map +1 -1
- package/dev/divider.js +1 -0
- package/dev/divider.js.map +1 -1
- package/dev/dragbox.d.ts +1 -0
- package/dev/dragbox.d.ts.map +1 -1
- package/dev/dragbox.js +1 -0
- package/dev/dragbox.js.map +1 -1
- package/dev/flex.d.ts +1 -0
- package/dev/flex.d.ts.map +1 -1
- package/dev/flex.js +1 -0
- package/dev/flex.js.map +1 -1
- package/dev/form.d.ts +1 -0
- package/dev/form.d.ts.map +1 -1
- package/dev/form.js +1 -0
- package/dev/form.js.map +1 -1
- package/dev/grid.d.ts +1 -0
- package/dev/grid.d.ts.map +1 -1
- package/dev/grid.js +1 -0
- package/dev/grid.js.map +1 -1
- package/dev/heading.d.ts +9 -0
- package/dev/heading.d.ts.map +1 -0
- package/dev/heading.js +5 -0
- package/dev/heading.js.map +1 -0
- package/dev/index.d.ts +2 -0
- package/dev/index.d.ts.map +1 -1
- package/dev/index.js +2 -0
- package/dev/index.js.map +1 -1
- package/dev/layout.d.ts.map +1 -1
- package/dev/progress.d.ts.map +1 -1
- package/dev/router.d.ts.map +1 -1
- package/dev/split.d.ts +1 -1
- package/dev/split.d.ts.map +1 -1
- package/dev/typewriter.d.ts +1 -0
- package/dev/typewriter.d.ts.map +1 -1
- package/dev/typewriter.js +1 -0
- package/dev/typewriter.js.map +1 -1
- package/dialog.d.ts +1 -0
- package/dialog.d.ts.map +1 -1
- package/dialog.js +1 -5
- package/dialog.js.map +1 -1
- package/divider.d.ts +1 -0
- package/divider.d.ts.map +1 -1
- package/divider.js +1 -5
- package/divider.js.map +1 -1
- package/dragbox.d.ts +1 -0
- package/dragbox.d.ts.map +1 -1
- package/dragbox.js +1 -5
- package/dragbox.js.map +1 -1
- package/flex.d.ts +1 -0
- package/flex.d.ts.map +1 -1
- package/flex.js +1 -5
- package/flex.js.map +1 -1
- package/form.d.ts +1 -0
- package/form.d.ts.map +1 -1
- package/form.js +1 -5
- package/form.js.map +1 -1
- package/grid.d.ts +1 -0
- package/grid.d.ts.map +1 -1
- package/grid.js +1 -5
- package/grid.js.map +1 -1
- package/heading.d.ts +9 -0
- package/heading.d.ts.map +1 -0
- package/heading.js +2 -0
- package/heading.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -56
- package/index.js.map +1 -1
- package/input.js +1 -5
- package/input.js.map +1 -1
- package/layout.d.ts.map +1 -1
- package/layout.js +1 -5
- package/layout.js.map +1 -1
- package/link.js +1 -5
- package/link.js.map +1 -1
- package/package.json +11 -6
- package/progress.d.ts.map +1 -1
- package/progress.js +1 -5
- package/progress.js.map +1 -1
- package/range.js +1 -5
- package/range.js.map +1 -1
- package/rotate.js +1 -5
- package/rotate.js.map +1 -1
- package/router.d.ts.map +1 -1
- package/router.js +1 -5
- package/router.js.map +1 -1
- package/select.js +1 -5
- package/select.js.map +1 -1
- package/skeleton.js +1 -5
- package/skeleton.js.map +1 -1
- package/split.d.ts +1 -1
- package/split.d.ts.map +1 -1
- package/split.js +1 -5
- package/split.js.map +1 -1
- package/src/alert.ts +2 -0
- package/src/avatar.ts +2 -0
- package/src/badge.ts +13 -0
- package/src/button.ts +2 -0
- package/src/card.ts +2 -0
- package/src/carousel.ts +2 -0
- package/src/components/alert.ts +26 -29
- package/src/components/avatar.ts +28 -17
- package/src/components/badge.ts +107 -0
- package/src/components/breath.ts +38 -31
- package/src/components/button.ts +55 -46
- package/src/components/card.ts +26 -34
- package/src/components/carousel.ts +48 -38
- package/src/components/details.ts +27 -28
- package/src/components/dialog.ts +30 -26
- package/src/components/divider.ts +29 -17
- package/src/components/dragbox.ts +25 -19
- package/src/components/flex.ts +26 -11
- package/src/components/form.ts +7 -9
- package/src/components/grid.ts +31 -13
- package/src/components/heading.ts +105 -0
- package/src/components/input.ts +23 -22
- package/src/components/layout.ts +26 -31
- package/src/components/link.ts +15 -4
- package/src/components/progress.ts +51 -52
- package/src/components/range.ts +82 -94
- package/src/components/rotate.ts +12 -11
- package/src/components/router.ts +59 -48
- package/src/components/select.ts +59 -47
- package/src/components/skeleton.ts +13 -11
- package/src/components/split.ts +90 -49
- package/src/components/switch.ts +38 -37
- package/src/components/text.ts +14 -21
- package/src/components/time.ts +20 -14
- package/src/components/tooltip.ts +54 -29
- package/src/components/typewriter.ts +41 -47
- package/src/core/global-style.ts +33 -19
- package/src/core/super-anchor.ts +30 -26
- package/src/core/super-input.ts +54 -54
- package/src/core/super-openable.ts +7 -7
- package/src/details.ts +2 -0
- package/src/dialog.ts +2 -0
- package/src/divider.ts +2 -0
- package/src/dragbox.ts +2 -0
- package/src/flex.ts +2 -0
- package/src/form.ts +2 -0
- package/src/grid.ts +2 -0
- package/src/heading.ts +13 -0
- package/src/index.ts +2 -0
- package/src/layout.ts +1 -0
- package/src/progress.ts +1 -0
- package/src/router.ts +1 -0
- package/src/split.ts +1 -1
- package/src/typewriter.ts +2 -0
- package/switch.js +1 -5
- package/switch.js.map +1 -1
- package/text.js +1 -5
- package/text.js.map +1 -1
- package/time.js +1 -5
- package/time.js.map +1 -1
- package/tooltip.js +1 -5
- package/tooltip.js.map +1 -1
- package/typewriter.d.ts +1 -0
- package/typewriter.d.ts.map +1 -1
- package/typewriter.js +1 -5
- package/typewriter.js.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/src/components/breath.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import {
|
3
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
4
|
-
import { css, html } from "lit";
|
1
|
+
import { attr, godown, htmlStyle, styles } from "@godown/element";
|
2
|
+
import { css, html, type TemplateResult } from "lit";
|
5
3
|
import { property } from "lit/decorators.js";
|
6
4
|
|
7
5
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -21,6 +19,7 @@ const cssScope = scopePrefix(defineName);
|
|
21
19
|
*
|
22
20
|
* Inspired by Vercel home page (2023).
|
23
21
|
*
|
22
|
+
* @slot - Breathing parts.
|
24
23
|
* @category effect
|
25
24
|
*/
|
26
25
|
@godown(defineName)
|
@@ -41,15 +40,22 @@ const cssScope = scopePrefix(defineName);
|
|
41
40
|
`,
|
42
41
|
css`
|
43
42
|
:host {
|
44
|
-
display: flex;
|
45
43
|
margin: auto;
|
46
|
-
width: -moz-fit-content;
|
47
44
|
width: fit-content;
|
48
45
|
font-size: 2em;
|
49
46
|
align-items: center;
|
50
47
|
direction: ltr;
|
51
48
|
}
|
52
49
|
|
50
|
+
:host,
|
51
|
+
:host([contents]) [part=root] {
|
52
|
+
display: flex;
|
53
|
+
}
|
54
|
+
|
55
|
+
[part=root] {
|
56
|
+
display: contents;
|
57
|
+
}
|
58
|
+
|
53
59
|
::selection {
|
54
60
|
background: none;
|
55
61
|
}
|
@@ -68,14 +74,16 @@ const cssScope = scopePrefix(defineName);
|
|
68
74
|
box-sizing: border-box;
|
69
75
|
display: inline-block;
|
70
76
|
animation-iteration-count: infinite;
|
71
|
-
|
77
|
+
color: transparent;
|
72
78
|
-webkit-background-clip: text !important;
|
73
79
|
background-clip: text !important;
|
74
80
|
}
|
81
|
+
|
75
82
|
.colorful {
|
76
83
|
opacity: 0;
|
77
84
|
animation-name: colorfulN;
|
78
85
|
}
|
86
|
+
|
79
87
|
.nocolor {
|
80
88
|
position: absolute;
|
81
89
|
top: 0;
|
@@ -91,21 +99,21 @@ class Breath extends GlobalStyle {
|
|
91
99
|
*/
|
92
100
|
@property()
|
93
101
|
text: string | string[];
|
102
|
+
|
94
103
|
/**
|
95
104
|
* Effect duration, ending in s or ms.
|
96
105
|
*/
|
97
106
|
@property()
|
98
107
|
duration: string;
|
99
108
|
|
100
|
-
protected render() {
|
109
|
+
protected render(): TemplateResult<1> {
|
101
110
|
const texts = this.getTexts();
|
102
|
-
return
|
103
|
-
|
104
|
-
|
105
|
-
];
|
111
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
112
|
+
${[texts.map(this.renderText), htmlStyle(this._computeStyle(texts.length))]}
|
113
|
+
</div>`;
|
106
114
|
}
|
107
115
|
|
108
|
-
protected renderText(text: string) {
|
116
|
+
protected renderText(text: string): TemplateResult<1> {
|
109
117
|
return html`<span class="rel">
|
110
118
|
<span class="nocolor">${text}</span>
|
111
119
|
<span class="colorful">${text}</span>
|
@@ -116,36 +124,35 @@ class Breath extends GlobalStyle {
|
|
116
124
|
return Array.isArray(this.text) ? this.text : (this.text || this.textContent).split(/\s+/).filter((x) => x);
|
117
125
|
}
|
118
126
|
|
119
|
-
protected
|
127
|
+
protected _computeStyle(len: number): string {
|
120
128
|
const gap = 100 / 2 / len;
|
121
129
|
const duration = this.parseDuration() || len * 2 + 2;
|
122
|
-
|
130
|
+
let style1 = "";
|
131
|
+
for (let number = 1; number <= len; number++) {
|
132
|
+
const delay = -duration / len * (len - number + 1);
|
133
|
+
const defaultNumber = ((number - 1) % 3) + 1;
|
134
|
+
style1 +=
|
135
|
+
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
136
|
+
}
|
123
137
|
return (
|
124
|
-
`.colorful{animation-duration:${duration}s;}
|
125
|
-
|
126
|
-
|
127
|
-
let style1 = "";
|
128
|
-
for (let number = 1; number <= len; number++) {
|
129
|
-
const delay = -duration / len * (len - number + 1);
|
130
|
-
const defaultNumber = ((number - 1) % 3) + 1;
|
131
|
-
style1 +=
|
132
|
-
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
133
|
-
}
|
134
|
-
return style1;
|
135
|
-
})()
|
138
|
+
`.colorful{animation-duration:${duration}s;}@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${
|
139
|
+
gap * 2
|
140
|
+
}%{opacity:1;}}${style1}`
|
136
141
|
);
|
137
142
|
}
|
138
143
|
|
139
|
-
protected parseDuration() {
|
144
|
+
protected parseDuration(): number | undefined {
|
140
145
|
const { duration } = this;
|
141
146
|
if (duration) {
|
142
147
|
if (duration.endsWith("s")) {
|
143
|
-
return parseFloat(duration.slice(0, -1));
|
144
|
-
}
|
145
|
-
|
148
|
+
return Number.parseFloat(duration.slice(0, -1));
|
149
|
+
}
|
150
|
+
if (duration.endsWith("ms")) {
|
151
|
+
return Number.parseFloat(duration.slice(0, -2)) / 1000;
|
146
152
|
}
|
147
153
|
}
|
148
154
|
}
|
149
155
|
}
|
150
156
|
|
151
157
|
export default Breath;
|
158
|
+
export { Breath };
|
package/src/components/button.ts
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import {
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
6
|
-
import { constructCSSObject, toVar } from "@godown/element/tools/css.js";
|
7
|
-
import { css, html } from "lit";
|
1
|
+
import { attr, constructCSSObject, godown, htmlSlot, htmlStyle, part, styles, toVar } from "@godown/element";
|
2
|
+
import { css, html, type TemplateResult } from "lit";
|
8
3
|
import { property } from "lit/decorators.js";
|
9
4
|
|
10
5
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -12,16 +7,17 @@ import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js
|
|
12
7
|
const protoName = "button";
|
13
8
|
const cssScope = scopePrefix(protoName);
|
14
9
|
|
15
|
-
const whiteFont = cssGlobalVars.
|
16
|
-
const blackFont = cssGlobalVars.
|
10
|
+
const whiteFont = cssGlobalVars.white;
|
11
|
+
const blackFont = cssGlobalVars.black;
|
17
12
|
|
18
|
-
|
13
|
+
type Colors = "teal" | "blue" | "green" | "red" | "purple" | "orange" | "yellow" | "pink" | "gray" | "white" | "black";
|
14
|
+
const colors: Record<Colors, string> = constructCSSObject(
|
19
15
|
["color", "background", "gradients"].map((k) => `${cssScope}--${k}`),
|
20
16
|
{
|
21
17
|
black: [
|
22
18
|
whiteFont, // color
|
23
19
|
cssGlobalVars._colors.darkgray[7], // background
|
24
|
-
cssGlobalVars._colors.darkgray[
|
20
|
+
cssGlobalVars._colors.darkgray[5], // gradients
|
25
21
|
],
|
26
22
|
gray: [
|
27
23
|
whiteFont, // color
|
@@ -74,14 +70,20 @@ const colors = constructCSSObject(
|
|
74
70
|
cssGlobalVars._colors.teal[4], // gradients
|
75
71
|
],
|
76
72
|
},
|
77
|
-
() =>
|
73
|
+
() => ":host",
|
78
74
|
(prop) => toVar(prop),
|
79
75
|
);
|
80
76
|
|
81
77
|
/**
|
82
78
|
* {@linkcode Button} renders a button.
|
83
79
|
*
|
84
|
-
*
|
80
|
+
* Create modal animation upon clicking.
|
81
|
+
*
|
82
|
+
* Available colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.
|
83
|
+
*
|
84
|
+
* Default color is `black`.
|
85
|
+
*
|
86
|
+
* Set the color to `none` to prevent applying styles.
|
85
87
|
*
|
86
88
|
* @category input
|
87
89
|
*/
|
@@ -112,7 +114,7 @@ const colors = constructCSSObject(
|
|
112
114
|
css`
|
113
115
|
:host {
|
114
116
|
${cssScope}--padding-x: .5em;
|
115
|
-
${cssScope}--padding-y: .
|
117
|
+
${cssScope}--padding-y: min(calc(var(${cssScope}--padding-x) / 2), .25em);
|
116
118
|
${cssScope}--padding: var(${cssScope}--padding-y) var(${cssScope}--padding-x);
|
117
119
|
${cssScope}--modal-animation-duration: 1s;
|
118
120
|
${cssScope}--ghost-width: .08em;
|
@@ -126,7 +128,6 @@ const colors = constructCSSObject(
|
|
126
128
|
var(${cssScope}--gradients, var(${cssScope}--background))
|
127
129
|
);
|
128
130
|
border-radius: 0.3em;
|
129
|
-
width: -moz-fit-content;
|
130
131
|
width: fit-content;
|
131
132
|
transition: 0.1s;
|
132
133
|
display: block;
|
@@ -136,7 +137,11 @@ const colors = constructCSSObject(
|
|
136
137
|
cursor: pointer;
|
137
138
|
}
|
138
139
|
|
139
|
-
[part=
|
140
|
+
:host([contents]) [part=root] {
|
141
|
+
width: fit-content;
|
142
|
+
}
|
143
|
+
|
144
|
+
[part=root] {
|
140
145
|
width: 100%;
|
141
146
|
height: 100%;
|
142
147
|
overflow: hidden;
|
@@ -147,7 +152,7 @@ const colors = constructCSSObject(
|
|
147
152
|
transition-duration: inherit;
|
148
153
|
}
|
149
154
|
|
150
|
-
[part=
|
155
|
+
[part=content] {
|
151
156
|
padding: var(${cssScope}--padding);
|
152
157
|
}
|
153
158
|
|
@@ -168,7 +173,7 @@ const colors = constructCSSObject(
|
|
168
173
|
@keyframes kf {
|
169
174
|
0% {
|
170
175
|
transform: scale(0) translate(-50%, -50%);
|
171
|
-
opacity: var(${cssScope}--modal-opacity, 0.
|
176
|
+
opacity: var(${cssScope}--modal-opacity, 0.1);
|
172
177
|
}
|
173
178
|
80% {
|
174
179
|
transform: scale(1) translate(-50%, -50%);
|
@@ -184,50 +189,54 @@ class Button extends GlobalStyle {
|
|
184
189
|
* Whether to disable this element.
|
185
190
|
*/
|
186
191
|
@property({ type: Boolean, reflect: true })
|
187
|
-
disabled
|
192
|
+
disabled = false;
|
193
|
+
|
188
194
|
/**
|
189
|
-
*
|
195
|
+
* Display ghost.
|
190
196
|
*/
|
191
197
|
@property({ type: Boolean, reflect: true })
|
192
|
-
ghost
|
198
|
+
ghost = false;
|
199
|
+
|
193
200
|
/**
|
194
201
|
* Whether this element is active or not.
|
195
202
|
*/
|
196
203
|
@property({ type: Boolean, reflect: true })
|
197
|
-
active
|
204
|
+
active = false;
|
205
|
+
|
198
206
|
/**
|
199
|
-
*
|
207
|
+
* Display rounded.
|
200
208
|
*/
|
201
209
|
@property({ type: Boolean, reflect: true })
|
202
|
-
round
|
210
|
+
round = false;
|
211
|
+
|
203
212
|
/**
|
204
213
|
* The primary color.
|
205
214
|
*/
|
206
215
|
@property({ reflect: true })
|
207
216
|
color: "none" | keyof typeof colors = "black";
|
217
|
+
|
208
218
|
/**
|
209
|
-
*
|
219
|
+
* Content text.
|
210
220
|
*/
|
211
221
|
@property()
|
212
|
-
|
222
|
+
content: string;
|
213
223
|
|
214
224
|
@part("modal-root")
|
215
|
-
_modalRoot: HTMLElement;
|
225
|
+
protected _modalRoot: HTMLElement;
|
216
226
|
@part("root")
|
217
|
-
_root: HTMLElement;
|
227
|
+
protected _root: HTMLElement;
|
218
228
|
|
219
|
-
protected render() {
|
229
|
+
protected render(): TemplateResult<1> {
|
220
230
|
const color = this.nextColor();
|
221
|
-
return
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
</div
|
226
|
-
|
227
|
-
];
|
231
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
232
|
+
<span part="modal-root"></span>
|
233
|
+
<div part="content">
|
234
|
+
${[this.content || htmlSlot(), htmlStyle(colors[color])]}
|
235
|
+
</div>
|
236
|
+
</div>`;
|
228
237
|
}
|
229
238
|
|
230
|
-
focus() {
|
239
|
+
focus(): void {
|
231
240
|
if (this.disabled) {
|
232
241
|
return;
|
233
242
|
}
|
@@ -235,16 +244,16 @@ class Button extends GlobalStyle {
|
|
235
244
|
super.focus();
|
236
245
|
}
|
237
246
|
|
238
|
-
blur() {
|
247
|
+
blur(): void {
|
239
248
|
this.active = false;
|
240
249
|
super.blur();
|
241
250
|
}
|
242
251
|
|
243
|
-
firstUpdated() {
|
252
|
+
firstUpdated(): void {
|
244
253
|
this.events.add(this, "click", this._handelClick, true);
|
245
254
|
}
|
246
255
|
|
247
|
-
protected _handelClick(e: MouseEvent) {
|
256
|
+
protected _handelClick(e: MouseEvent): void {
|
248
257
|
if (this.disabled) {
|
249
258
|
e.stopPropagation();
|
250
259
|
e.preventDefault();
|
@@ -253,12 +262,11 @@ class Button extends GlobalStyle {
|
|
253
262
|
this._handleModal(e);
|
254
263
|
}
|
255
264
|
|
256
|
-
protected _handleModal(e: MouseEvent) {
|
265
|
+
protected _handleModal(e: MouseEvent): void {
|
257
266
|
const modal = document.createElement("i");
|
258
|
-
const rect = this.getBoundingClientRect();
|
259
|
-
const
|
260
|
-
const
|
261
|
-
const size = `${Math.sqrt(h * h + w * w) * 2}px`;
|
267
|
+
const rect = this._root.getBoundingClientRect();
|
268
|
+
const { height, width } = rect;
|
269
|
+
const size = `${Math.sqrt(height * height + width * width) * 2}px`;
|
262
270
|
modal.style.height = size;
|
263
271
|
modal.style.width = size;
|
264
272
|
modal.style.left = `${e.clientX - rect.left}px`;
|
@@ -268,9 +276,10 @@ class Button extends GlobalStyle {
|
|
268
276
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
269
277
|
}
|
270
278
|
|
271
|
-
nextColor() {
|
279
|
+
nextColor(): Colors | "none" {
|
272
280
|
return this.color;
|
273
281
|
}
|
274
282
|
}
|
275
283
|
|
276
284
|
export default Button;
|
285
|
+
export { Button };
|
package/src/components/card.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import {
|
3
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { css, html } from "lit";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { css, html, type TemplateResult } from "lit";
|
5
3
|
import { property } from "lit/decorators.js";
|
6
4
|
|
7
5
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -26,60 +24,54 @@ const cssScope = scopePrefix(protoName);
|
|
26
24
|
@styles(
|
27
25
|
css`
|
28
26
|
:host {
|
29
|
-
${cssScope}--shadow-width: .0375em;
|
30
|
-
${cssScope}--shadow-color: transparent;
|
31
27
|
${cssScope}--background: var(${cssGlobalVars.background});
|
32
|
-
${cssScope}--
|
33
|
-
${cssScope}--
|
34
|
-
${cssScope}--
|
28
|
+
${cssScope}--border-width: .0375em;
|
29
|
+
${cssScope}--border-color: transparent;
|
30
|
+
${cssScope}--border-background: var(${cssGlobalVars.passive});
|
35
31
|
${cssScope}--padding: .75em;
|
36
32
|
color: var(${cssGlobalVars.foreground});
|
37
33
|
background: var(${cssScope}--background);
|
34
|
+
border-width: var(${cssScope}--border-width);
|
38
35
|
display: block;
|
39
36
|
flex-shrink: 0;
|
40
37
|
position: relative;
|
41
38
|
overflow: hidden;
|
42
39
|
box-sizing: border-box;
|
43
|
-
border-radius: 0.25em;
|
44
|
-
transition: box-shadow .1s ease-in-out;
|
45
|
-
}
|
46
|
-
|
47
|
-
:host([shadow="hover"]:hover),
|
48
|
-
:host([shadow="always"]) {
|
49
|
-
${cssScope}--shadow-color: var(${cssScope}--divider-background);
|
50
|
-
box-shadow: inset 0 0 0px var(${cssScope}--shadow-width) var(${cssScope}--shadow-color);
|
51
|
-
}
|
52
|
-
|
53
|
-
[part="divider"] {
|
54
|
-
margin: auto;
|
55
|
-
width: var(${cssScope}--divider-width);
|
56
|
-
height: var(${cssScope}--divider-height);
|
57
|
-
background: var(${cssScope}--divider-background);
|
58
40
|
}
|
59
41
|
|
60
42
|
slot {
|
61
43
|
display: block;
|
62
44
|
padding: var(${cssScope}--padding);
|
63
45
|
}
|
46
|
+
|
47
|
+
:host,
|
48
|
+
slot {
|
49
|
+
border-color: var(${cssScope}--border-background);
|
50
|
+
border-style: solid;
|
51
|
+
}
|
52
|
+
|
53
|
+
[name=footer] {
|
54
|
+
border-top-width: var(${cssScope}--border-width);
|
55
|
+
}
|
56
|
+
|
57
|
+
[name=header] {
|
58
|
+
border-bottom-width: var(${cssScope}--border-width);
|
59
|
+
}
|
64
60
|
`,
|
65
61
|
)
|
66
62
|
class Card extends GlobalStyle {
|
67
|
-
@property({ reflect: true })
|
68
|
-
shadow: "none" | "always" | "hover" = "hover";
|
69
|
-
|
70
63
|
@property({ type: Boolean })
|
71
64
|
footer = false;
|
65
|
+
|
72
66
|
@property({ type: Boolean })
|
73
67
|
header = false;
|
74
68
|
|
75
|
-
protected render() {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
htmlSlot(),
|
80
|
-
this.footer ? [hr, htmlSlot("footer")] : "",
|
81
|
-
];
|
69
|
+
protected render(): TemplateResult<1> {
|
70
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
71
|
+
${[this.header ? htmlSlot("header") : "", htmlSlot(), this.footer ? htmlSlot("footer") : ""]}
|
72
|
+
</div>`;
|
82
73
|
}
|
83
74
|
}
|
84
75
|
|
85
76
|
export default Card;
|
77
|
+
export { Card };
|
@@ -1,11 +1,7 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
1
|
+
import { attr, godown, htmlSlot, htmlStyle, part, styles } from "@godown/element";
|
6
2
|
import iconChevronLeft from "@godown/f7-icon/icons/chevron-left.js";
|
7
3
|
import iconChevronRight from "@godown/f7-icon/icons/chevron-right.js";
|
8
|
-
import { css, html } from "lit";
|
4
|
+
import { css, html, type TemplateResult } from "lit";
|
9
5
|
import { property } from "lit/decorators.js";
|
10
6
|
|
11
7
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -22,6 +18,8 @@ const protoName = "carousel";
|
|
22
18
|
*
|
23
19
|
* If no width, it will be the width of the first element.
|
24
20
|
*
|
21
|
+
* @slot - Carousel items, should maintain the same size.
|
22
|
+
* @fires change - Fired when the index changes.
|
25
23
|
* @category display
|
26
24
|
*/
|
27
25
|
@godown(protoName)
|
@@ -32,12 +30,13 @@ const protoName = "carousel";
|
|
32
30
|
transition: .3s;
|
33
31
|
}
|
34
32
|
|
35
|
-
[part=
|
33
|
+
[part=root] {
|
34
|
+
direction: ltr;
|
36
35
|
overflow: hidden;
|
37
36
|
}
|
38
37
|
|
39
|
-
[part=
|
40
|
-
[part=
|
38
|
+
[part=root],
|
39
|
+
[part=move-root] {
|
41
40
|
height: 100%;
|
42
41
|
width: 100%;
|
43
42
|
display: flex;
|
@@ -45,8 +44,8 @@ const protoName = "carousel";
|
|
45
44
|
transition: inherit;
|
46
45
|
}
|
47
46
|
|
48
|
-
[part=
|
49
|
-
[part=
|
47
|
+
[part=prev],
|
48
|
+
[part=next] {
|
50
49
|
height: 100%;
|
51
50
|
width: 1.5em;
|
52
51
|
z-index: 1;
|
@@ -57,11 +56,11 @@ const protoName = "carousel";
|
|
57
56
|
user-select: none;
|
58
57
|
}
|
59
58
|
|
60
|
-
[part=
|
59
|
+
[part=prev] {
|
61
60
|
left: 0;
|
62
61
|
}
|
63
62
|
|
64
|
-
[part=
|
63
|
+
[part=next] {
|
65
64
|
right: 0;
|
66
65
|
}
|
67
66
|
|
@@ -76,11 +75,13 @@ class Carousel extends GlobalStyle {
|
|
76
75
|
*/
|
77
76
|
@property({ type: Number })
|
78
77
|
index = 0;
|
78
|
+
|
79
79
|
/**
|
80
80
|
* If autoChange > 0, the rotation will be automated.
|
81
81
|
*/
|
82
82
|
@property({ type: Number })
|
83
83
|
autoChange = 0;
|
84
|
+
|
84
85
|
/**
|
85
86
|
* Element width.
|
86
87
|
*/
|
@@ -88,26 +89,24 @@ class Carousel extends GlobalStyle {
|
|
88
89
|
width: string;
|
89
90
|
|
90
91
|
@part("move-root")
|
91
|
-
_moveRoot: HTMLElement;
|
92
|
+
protected _moveRoot: HTMLElement;
|
92
93
|
|
93
|
-
intervalID: number;
|
94
|
+
protected intervalID: number;
|
94
95
|
|
95
|
-
_cloneFirst: HTMLElement | undefined;
|
96
|
+
private _cloneFirst: HTMLElement | undefined;
|
96
97
|
|
97
|
-
_cloneLast: HTMLElement | undefined;
|
98
|
+
private _cloneLast: HTMLElement | undefined;
|
98
99
|
|
99
|
-
protected render() {
|
100
|
-
return
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
</div
|
106
|
-
htmlStyle(`:host{width:${this.width};}`),
|
107
|
-
];
|
100
|
+
protected render(): TemplateResult<1> {
|
101
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
102
|
+
<i part="prev" @click="${this.prev}"> ${iconChevronLeft()} </i>
|
103
|
+
<div part="move-root" style="transform:${`translateX(-${this.index + 1}00%)`}">${htmlSlot()}</div>
|
104
|
+
<i part="next" @click="${this.next}"> ${iconChevronRight()} </i>
|
105
|
+
${htmlStyle(`:host,:host([contents]) [part=root]{width:${this.width};}`)}
|
106
|
+
</div>`;
|
108
107
|
}
|
109
108
|
|
110
|
-
protected async firstUpdated() {
|
109
|
+
protected async firstUpdated(): Promise<void> {
|
111
110
|
await this.updateComplete;
|
112
111
|
|
113
112
|
if (this.children.length) {
|
@@ -121,46 +120,57 @@ class Carousel extends GlobalStyle {
|
|
121
120
|
this.insertBefore(this._cloneFirst, this.firstElementChild);
|
122
121
|
this.show(this.index);
|
123
122
|
}
|
124
|
-
|
125
|
-
this.intervalID = window.setInterval(() => {
|
126
|
-
this.next();
|
127
|
-
}, this.autoChange);
|
128
|
-
}
|
123
|
+
this.checkInterval();
|
129
124
|
}
|
130
125
|
|
131
|
-
disconnectedCallback() {
|
126
|
+
disconnectedCallback(): void {
|
132
127
|
clearInterval(this.intervalID);
|
133
128
|
}
|
134
129
|
|
135
|
-
show(i: number) {
|
130
|
+
show(i: number): void {
|
136
131
|
this.index = i;
|
132
|
+
this.dispatchEvent(new CustomEvent("change", { detail: i, composed: true }));
|
137
133
|
}
|
138
134
|
|
139
|
-
next() {
|
135
|
+
next(): void {
|
140
136
|
if (this.index === this.childElementCount - 3) {
|
141
137
|
this._doTranslateX("0", true);
|
142
138
|
this.show(0);
|
143
139
|
} else {
|
144
140
|
this.show(this.index + 1);
|
145
141
|
}
|
142
|
+
this.checkInterval();
|
146
143
|
}
|
147
144
|
|
148
|
-
prev() {
|
145
|
+
prev(): void {
|
149
146
|
if (this.index === 0) {
|
150
147
|
this._doTranslateX(`-${this.childElementCount - 1}00%`, true);
|
151
148
|
this.show(this.children.length - 3);
|
152
149
|
} else {
|
153
150
|
this.show(this.index - 1);
|
154
151
|
}
|
152
|
+
this.checkInterval();
|
155
153
|
}
|
156
154
|
|
157
|
-
protected _doTranslateX(xValue: string, noTransition?: boolean) {
|
155
|
+
protected _doTranslateX(xValue: string, noTransition?: boolean): void {
|
158
156
|
this._moveRoot.style.transform = `translateX(${xValue})`;
|
159
157
|
if (noTransition) {
|
160
|
-
this._moveRoot.style.transition =
|
158
|
+
this._moveRoot.style.transition = "none";
|
161
159
|
}
|
162
160
|
this._moveRoot.getBoundingClientRect();
|
163
161
|
}
|
162
|
+
|
163
|
+
checkInterval(): void {
|
164
|
+
if (this.autoChange) {
|
165
|
+
if (this.intervalID) {
|
166
|
+
clearInterval(this.intervalID);
|
167
|
+
}
|
168
|
+
this.intervalID = setInterval(() => {
|
169
|
+
this.next();
|
170
|
+
}, this.autoChange);
|
171
|
+
}
|
172
|
+
}
|
164
173
|
}
|
165
174
|
|
166
175
|
export default Carousel;
|
176
|
+
export { Carousel };
|