godown 3.0.0-canary.9 → 3.0.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/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 +7 -2
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -62
- 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 +6 -4
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -80
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +8 -5
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -168
- package/components/button.js.map +1 -1
- package/components/card.d.ts +3 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -48
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +5 -1
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +1 -113
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +4 -3
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -52
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +4 -2
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -96
- 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 +4 -2
- 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 +3 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +1 -62
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +3 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -75
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +3 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -56
- 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 +5 -1
- 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 +6 -4
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -58
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +5 -0
- package/components/link.d.ts.map +1 -1
- package/components/link.js +1 -44
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +3 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -58
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +10 -4
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -266
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +3 -1
- 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 +27 -34
- 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 +7 -2
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -211
- 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 +8 -2
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -153
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +5 -2
- 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 +4 -2
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -77
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +4 -2
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -80
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +6 -12
- 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 -52
- 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 +4 -3
- 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 +87 -77
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +7 -2
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +60 -32
- 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 +114 -0
- package/dev/components/badge.js.map +1 -0
- package/dev/components/breath.d.ts +6 -4
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +40 -31
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +8 -5
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +38 -21
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +3 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +43 -41
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +5 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +81 -55
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +4 -3
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +76 -70
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +4 -2
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +65 -60
- 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 +27 -10
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +4 -2
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +22 -13
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts +3 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +22 -9
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +3 -1
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +6 -7
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +3 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +22 -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 +125 -0
- package/dev/components/heading.js.map +1 -0
- package/dev/components/input.d.ts +5 -1
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +36 -28
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +6 -4
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +53 -39
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts +5 -0
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +13 -3
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +3 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +20 -8
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +10 -4
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +69 -64
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +3 -1
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +14 -9
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +27 -34
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +25 -38
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +7 -2
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +79 -58
- 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 +67 -63
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +8 -2
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +67 -51
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +5 -2
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +91 -85
- 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 +56 -53
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +4 -2
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +19 -6
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +4 -2
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +45 -27
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +6 -12
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +48 -54
- 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 +19 -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 +15 -12
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +4 -3
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +64 -42
- 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 +1 -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 +13 -8
- 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 +92 -86
- package/src/components/avatar.ts +65 -39
- package/src/components/badge.ts +110 -0
- package/src/components/breath.ts +47 -38
- package/src/components/button.ts +38 -36
- package/src/components/card.ts +45 -46
- package/src/components/carousel.ts +91 -66
- package/src/components/details.ts +79 -75
- package/src/components/dialog.ts +74 -73
- package/src/components/divider.ts +28 -13
- package/src/components/dragbox.ts +30 -25
- package/src/components/flex.ts +35 -22
- package/src/components/form.ts +12 -15
- package/src/components/grid.ts +35 -23
- package/src/components/heading.ts +123 -0
- package/src/components/input.ts +43 -37
- package/src/components/layout.ts +52 -44
- package/src/components/link.ts +13 -4
- package/src/components/progress.ts +22 -10
- package/src/components/range.ts +107 -108
- package/src/components/rotate.ts +24 -18
- package/src/components/router.ts +64 -67
- package/src/components/select.ts +94 -78
- package/src/components/skeleton.ts +70 -68
- package/src/components/split.ts +81 -67
- package/src/components/switch.ts +97 -93
- package/src/components/text.ts +55 -58
- package/src/components/time.ts +26 -13
- package/src/components/tooltip.ts +44 -32
- package/src/components/typewriter.ts +54 -61
- package/src/core/global-style.ts +34 -21
- package/src/core/super-anchor.ts +17 -14
- package/src/core/super-input.ts +76 -63
- package/src/core/super-openable.ts +8 -14
- 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/button.ts
CHANGED
@@ -1,13 +1,8 @@
|
|
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 { type TemplateResult, css, html } from "lit";
|
8
3
|
import { property } from "lit/decorators.js";
|
9
4
|
|
10
|
-
import {
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
11
6
|
|
12
7
|
const protoName = "button";
|
13
8
|
const cssScope = scopePrefix(protoName);
|
@@ -15,7 +10,8 @@ const cssScope = scopePrefix(protoName);
|
|
15
10
|
const whiteFont = cssGlobalVars.white;
|
16
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: [
|
@@ -74,7 +70,7 @@ 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
|
|
@@ -110,7 +106,7 @@ const colors = constructCSSObject(
|
|
110
106
|
|
111
107
|
:host([ghost]) {
|
112
108
|
${cssScope}--modal-background: var(${cssScope}--ghost-color);
|
113
|
-
box-shadow:inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
109
|
+
box-shadow: inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
114
110
|
color: var(${cssScope}--ghost-color);
|
115
111
|
background: transparent;
|
116
112
|
}
|
@@ -118,7 +114,7 @@ const colors = constructCSSObject(
|
|
118
114
|
css`
|
119
115
|
:host {
|
120
116
|
${cssScope}--padding-x: .5em;
|
121
|
-
${cssScope}--padding-y: .
|
117
|
+
${cssScope}--padding-y: min(calc(var(${cssScope}--padding-x) / 2), .25em);
|
122
118
|
${cssScope}--padding: var(${cssScope}--padding-y) var(${cssScope}--padding-x);
|
123
119
|
${cssScope}--modal-animation-duration: 1s;
|
124
120
|
${cssScope}--ghost-width: .08em;
|
@@ -132,7 +128,6 @@ const colors = constructCSSObject(
|
|
132
128
|
var(${cssScope}--gradients, var(${cssScope}--background))
|
133
129
|
);
|
134
130
|
border-radius: 0.3em;
|
135
|
-
width: -moz-fit-content;
|
136
131
|
width: fit-content;
|
137
132
|
transition: 0.1s;
|
138
133
|
display: block;
|
@@ -142,6 +137,10 @@ const colors = constructCSSObject(
|
|
142
137
|
cursor: pointer;
|
143
138
|
}
|
144
139
|
|
140
|
+
:host([contents]) [part="root"] {
|
141
|
+
width: fit-content;
|
142
|
+
}
|
143
|
+
|
145
144
|
[part="root"] {
|
146
145
|
width: 100%;
|
147
146
|
height: 100%;
|
@@ -153,7 +152,7 @@ const colors = constructCSSObject(
|
|
153
152
|
transition-duration: inherit;
|
154
153
|
}
|
155
154
|
|
156
|
-
[part="
|
155
|
+
[part="content"] {
|
157
156
|
padding: var(${cssScope}--padding);
|
158
157
|
}
|
159
158
|
|
@@ -190,25 +189,25 @@ class Button extends GlobalStyle {
|
|
190
189
|
* Whether to disable this element.
|
191
190
|
*/
|
192
191
|
@property({ type: Boolean, reflect: true })
|
193
|
-
disabled
|
192
|
+
disabled = false;
|
194
193
|
|
195
194
|
/**
|
196
|
-
*
|
195
|
+
* Display ghost.
|
197
196
|
*/
|
198
197
|
@property({ type: Boolean, reflect: true })
|
199
|
-
ghost
|
198
|
+
ghost = false;
|
200
199
|
|
201
200
|
/**
|
202
201
|
* Whether this element is active or not.
|
203
202
|
*/
|
204
203
|
@property({ type: Boolean, reflect: true })
|
205
|
-
active
|
204
|
+
active = false;
|
206
205
|
|
207
206
|
/**
|
208
|
-
*
|
207
|
+
* Display rounded.
|
209
208
|
*/
|
210
209
|
@property({ type: Boolean, reflect: true })
|
211
|
-
round
|
210
|
+
round = false;
|
212
211
|
|
213
212
|
/**
|
214
213
|
* The primary color.
|
@@ -227,17 +226,20 @@ class Button extends GlobalStyle {
|
|
227
226
|
@part("root")
|
228
227
|
protected _root: HTMLElement;
|
229
228
|
|
230
|
-
protected render() {
|
229
|
+
protected render(): TemplateResult<1> {
|
231
230
|
const color = this.nextColor();
|
232
|
-
return html
|
233
|
-
<
|
234
|
-
|
235
|
-
${
|
231
|
+
return html`
|
232
|
+
<div
|
233
|
+
part="root"
|
234
|
+
${attr(this.observedRecord)}
|
235
|
+
>
|
236
|
+
<span part="modal-root"></span>
|
237
|
+
<div part="content">${[this.content || htmlSlot(), htmlStyle(colors[color])]}</div>
|
236
238
|
</div>
|
237
|
-
|
239
|
+
`;
|
238
240
|
}
|
239
241
|
|
240
|
-
focus() {
|
242
|
+
focus(): void {
|
241
243
|
if (this.disabled) {
|
242
244
|
return;
|
243
245
|
}
|
@@ -245,16 +247,16 @@ class Button extends GlobalStyle {
|
|
245
247
|
super.focus();
|
246
248
|
}
|
247
249
|
|
248
|
-
blur() {
|
250
|
+
blur(): void {
|
249
251
|
this.active = false;
|
250
252
|
super.blur();
|
251
253
|
}
|
252
254
|
|
253
|
-
firstUpdated() {
|
255
|
+
firstUpdated(): void {
|
254
256
|
this.events.add(this, "click", this._handelClick, true);
|
255
257
|
}
|
256
258
|
|
257
|
-
protected _handelClick(e: MouseEvent) {
|
259
|
+
protected _handelClick(e: MouseEvent): void {
|
258
260
|
if (this.disabled) {
|
259
261
|
e.stopPropagation();
|
260
262
|
e.preventDefault();
|
@@ -263,12 +265,11 @@ class Button extends GlobalStyle {
|
|
263
265
|
this._handleModal(e);
|
264
266
|
}
|
265
267
|
|
266
|
-
protected _handleModal(e: MouseEvent) {
|
268
|
+
protected _handleModal(e: MouseEvent): void {
|
267
269
|
const modal = document.createElement("i");
|
268
|
-
const rect = this.getBoundingClientRect();
|
269
|
-
const
|
270
|
-
const
|
271
|
-
const size = `${Math.sqrt(h * h + w * w) * 2}px`;
|
270
|
+
const rect = this._root.getBoundingClientRect();
|
271
|
+
const { height, width } = rect;
|
272
|
+
const size = `${Math.sqrt(height * height + width * width) * 2}px`;
|
272
273
|
modal.style.height = size;
|
273
274
|
modal.style.width = size;
|
274
275
|
modal.style.left = `${e.clientX - rect.left}px`;
|
@@ -278,9 +279,10 @@ class Button extends GlobalStyle {
|
|
278
279
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
279
280
|
}
|
280
281
|
|
281
|
-
nextColor() {
|
282
|
+
nextColor(): Colors | "none" {
|
282
283
|
return this.color;
|
283
284
|
}
|
284
285
|
}
|
285
286
|
|
286
287
|
export default Button;
|
288
|
+
export { Button };
|
package/src/components/card.ts
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import {
|
3
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { css } from "lit";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
5
3
|
import { property } from "lit/decorators.js";
|
6
4
|
|
7
|
-
import {
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
9
6
|
import type Layout from "../layout.js";
|
10
7
|
|
11
8
|
const protoName = "card";
|
@@ -23,44 +20,42 @@ const cssScope = scopePrefix(protoName);
|
|
23
20
|
* @category display
|
24
21
|
*/
|
25
22
|
@godown(protoName)
|
26
|
-
@styles(
|
27
|
-
|
28
|
-
:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}
|
23
|
+
@styles(css`
|
24
|
+
:host {
|
25
|
+
${cssScope}--background: var(${cssGlobalVars.background});
|
26
|
+
${cssScope}--border-width: .0375em;
|
27
|
+
${cssScope}--border-color: transparent;
|
28
|
+
${cssScope}--border-background: var(${cssGlobalVars.passive});
|
29
|
+
${cssScope}--padding: .75em;
|
30
|
+
color: var(${cssGlobalVars.foreground});
|
31
|
+
background: var(${cssScope}--background);
|
32
|
+
border-width: var(${cssScope}--border-width);
|
33
|
+
display: block;
|
34
|
+
flex-shrink: 0;
|
35
|
+
position: relative;
|
36
|
+
overflow: hidden;
|
37
|
+
box-sizing: border-box;
|
38
|
+
}
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
slot {
|
41
|
+
display: block;
|
42
|
+
padding: var(${cssScope}--padding);
|
43
|
+
}
|
48
44
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
:host,
|
46
|
+
slot {
|
47
|
+
border-color: var(${cssScope}--border-background);
|
48
|
+
border-style: solid;
|
49
|
+
}
|
54
50
|
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
[name="footer"] {
|
52
|
+
border-top-width: var(${cssScope}--border-width);
|
53
|
+
}
|
58
54
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
)
|
55
|
+
[name="header"] {
|
56
|
+
border-bottom-width: var(${cssScope}--border-width);
|
57
|
+
}
|
58
|
+
`)
|
64
59
|
class Card extends GlobalStyle {
|
65
60
|
@property({ type: Boolean })
|
66
61
|
footer = false;
|
@@ -68,13 +63,17 @@ class Card extends GlobalStyle {
|
|
68
63
|
@property({ type: Boolean })
|
69
64
|
header = false;
|
70
65
|
|
71
|
-
protected render() {
|
72
|
-
return
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
protected render(): TemplateResult<1> {
|
67
|
+
return html`
|
68
|
+
<div
|
69
|
+
part="root"
|
70
|
+
${attr(this.observedRecord)}
|
71
|
+
>
|
72
|
+
${[this.header ? htmlSlot("header") : "", htmlSlot(), this.footer ? htmlSlot("footer") : ""]}
|
73
|
+
</div>
|
74
|
+
`;
|
77
75
|
}
|
78
76
|
}
|
79
77
|
|
80
78
|
export default Card;
|
79
|
+
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 { type TemplateResult, css, html } from "lit";
|
9
5
|
import { property } from "lit/decorators.js";
|
10
6
|
|
11
7
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -23,54 +19,54 @@ const protoName = "carousel";
|
|
23
19
|
* If no width, it will be the width of the first element.
|
24
20
|
*
|
25
21
|
* @slot - Carousel items, should maintain the same size.
|
22
|
+
* @fires change - Fired when the index changes.
|
26
23
|
* @category display
|
27
24
|
*/
|
28
25
|
@godown(protoName)
|
29
|
-
@styles(
|
30
|
-
|
31
|
-
:
|
32
|
-
|
33
|
-
|
34
|
-
}
|
26
|
+
@styles(css`
|
27
|
+
:host {
|
28
|
+
display: block;
|
29
|
+
transition: 0.3s;
|
30
|
+
}
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
[part="root"] {
|
33
|
+
direction: ltr;
|
34
|
+
overflow: hidden;
|
35
|
+
}
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
[part="root"],
|
38
|
+
[part="move-root"] {
|
39
|
+
height: 100%;
|
40
|
+
width: 100%;
|
41
|
+
display: flex;
|
42
|
+
position: relative;
|
43
|
+
transition: inherit;
|
44
|
+
}
|
48
45
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
46
|
+
[part="prev"],
|
47
|
+
[part="next"] {
|
48
|
+
height: 100%;
|
49
|
+
width: 1.5em;
|
50
|
+
z-index: 1;
|
51
|
+
position: absolute;
|
52
|
+
display: flex;
|
53
|
+
align-items: center;
|
54
|
+
justify-content: center;
|
55
|
+
user-select: none;
|
56
|
+
}
|
60
57
|
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
[part="prev"] {
|
59
|
+
left: 0;
|
60
|
+
}
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
[part="next"] {
|
63
|
+
right: 0;
|
64
|
+
}
|
68
65
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
)
|
66
|
+
slot::slotted(*) {
|
67
|
+
flex-shrink: 0 !important;
|
68
|
+
}
|
69
|
+
`)
|
74
70
|
class Carousel extends GlobalStyle {
|
75
71
|
/**
|
76
72
|
* The index of the element is displayed for the first time.
|
@@ -99,18 +95,36 @@ class Carousel extends GlobalStyle {
|
|
99
95
|
|
100
96
|
private _cloneLast: HTMLElement | undefined;
|
101
97
|
|
102
|
-
protected render() {
|
103
|
-
return
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
98
|
+
protected render(): TemplateResult<1> {
|
99
|
+
return html`
|
100
|
+
<div
|
101
|
+
part="root"
|
102
|
+
${attr(this.observedRecord)}
|
103
|
+
>
|
104
|
+
<i
|
105
|
+
part="prev"
|
106
|
+
@click="${this.prev}"
|
107
|
+
>
|
108
|
+
${iconChevronLeft()}
|
109
|
+
</i>
|
110
|
+
<div
|
111
|
+
part="move-root"
|
112
|
+
style="transform:${`translateX(-${this.index + 1}00%)`}"
|
113
|
+
>
|
114
|
+
${htmlSlot()}
|
115
|
+
</div>
|
116
|
+
<i
|
117
|
+
part="next"
|
118
|
+
@click="${this.next}"
|
119
|
+
>
|
120
|
+
${iconChevronRight()}
|
121
|
+
</i>
|
122
|
+
${htmlStyle(`:host,:host([contents]) [part=root]{width:${this.width};}`)}
|
123
|
+
</div>
|
124
|
+
`;
|
111
125
|
}
|
112
126
|
|
113
|
-
protected async firstUpdated() {
|
127
|
+
protected async firstUpdated(): Promise<void> {
|
114
128
|
await this.updateComplete;
|
115
129
|
|
116
130
|
if (this.children.length) {
|
@@ -124,46 +138,57 @@ class Carousel extends GlobalStyle {
|
|
124
138
|
this.insertBefore(this._cloneFirst, this.firstElementChild);
|
125
139
|
this.show(this.index);
|
126
140
|
}
|
127
|
-
|
128
|
-
this.intervalID = window.setInterval(() => {
|
129
|
-
this.next();
|
130
|
-
}, this.autoChange);
|
131
|
-
}
|
141
|
+
this.checkInterval();
|
132
142
|
}
|
133
143
|
|
134
|
-
disconnectedCallback() {
|
144
|
+
disconnectedCallback(): void {
|
135
145
|
clearInterval(this.intervalID);
|
136
146
|
}
|
137
147
|
|
138
|
-
show(i: number) {
|
148
|
+
show(i: number): void {
|
139
149
|
this.index = i;
|
150
|
+
this.dispatchEvent(new CustomEvent("change", { detail: i, composed: true }));
|
140
151
|
}
|
141
152
|
|
142
|
-
next() {
|
153
|
+
next(): void {
|
143
154
|
if (this.index === this.childElementCount - 3) {
|
144
155
|
this._doTranslateX("0", true);
|
145
156
|
this.show(0);
|
146
157
|
} else {
|
147
158
|
this.show(this.index + 1);
|
148
159
|
}
|
160
|
+
this.checkInterval();
|
149
161
|
}
|
150
162
|
|
151
|
-
prev() {
|
163
|
+
prev(): void {
|
152
164
|
if (this.index === 0) {
|
153
165
|
this._doTranslateX(`-${this.childElementCount - 1}00%`, true);
|
154
166
|
this.show(this.children.length - 3);
|
155
167
|
} else {
|
156
168
|
this.show(this.index - 1);
|
157
169
|
}
|
170
|
+
this.checkInterval();
|
158
171
|
}
|
159
172
|
|
160
|
-
protected _doTranslateX(xValue: string, noTransition?: boolean) {
|
173
|
+
protected _doTranslateX(xValue: string, noTransition?: boolean): void {
|
161
174
|
this._moveRoot.style.transform = `translateX(${xValue})`;
|
162
175
|
if (noTransition) {
|
163
|
-
this._moveRoot.style.transition =
|
176
|
+
this._moveRoot.style.transition = "none";
|
164
177
|
}
|
165
178
|
this._moveRoot.getBoundingClientRect();
|
166
179
|
}
|
180
|
+
|
181
|
+
checkInterval(): void {
|
182
|
+
if (this.autoChange) {
|
183
|
+
if (this.intervalID) {
|
184
|
+
clearInterval(this.intervalID);
|
185
|
+
}
|
186
|
+
this.intervalID = setInterval(() => {
|
187
|
+
this.next();
|
188
|
+
}, this.autoChange);
|
189
|
+
}
|
190
|
+
}
|
167
191
|
}
|
168
192
|
|
169
193
|
export default Carousel;
|
194
|
+
export { Carousel };
|