godown 2.7.5 → 2.7.6
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 +18 -45
- package/{.deps.d.ts → _deps.d.ts} +1 -2
- package/{.deps.d.ts.map → _deps.d.ts.map} +1 -1
- package/{.deps.js → _deps.js} +1 -2
- package/_deps.js.map +1 -0
- package/alert.d.ts +8 -1
- package/alert.d.ts.map +1 -1
- package/alert.js +4 -1
- package/alert.js.map +1 -1
- package/avatar-group.d.ts +8 -1
- package/avatar-group.d.ts.map +1 -1
- package/avatar-group.js +4 -1
- package/avatar-group.js.map +1 -1
- package/avatar.d.ts +8 -1
- package/avatar.d.ts.map +1 -1
- package/avatar.js +4 -1
- package/avatar.js.map +1 -1
- package/button.d.ts +8 -1
- package/button.d.ts.map +1 -1
- package/button.js +4 -1
- package/button.js.map +1 -1
- package/card.d.ts +8 -1
- package/card.d.ts.map +1 -1
- package/card.js +4 -1
- package/card.js.map +1 -1
- package/carousel.d.ts +8 -1
- package/carousel.d.ts.map +1 -1
- package/carousel.js +4 -1
- package/carousel.js.map +1 -1
- package/components.json +194 -0
- package/conf.d.ts +6 -75
- package/conf.d.ts.map +1 -1
- package/conf.js +8 -34
- package/conf.js.map +1 -1
- package/decorators/godown.d.ts +4 -0
- package/decorators/godown.d.ts.map +1 -0
- package/decorators/godown.js +9 -0
- package/decorators/godown.js.map +1 -0
- package/decorators/part.d.ts +7 -0
- package/decorators/part.d.ts.map +1 -0
- package/decorators/part.js +8 -0
- package/decorators/part.js.map +1 -0
- package/decorators/styles.d.ts +3 -0
- package/decorators/styles.d.ts.map +1 -0
- package/decorators/styles.js +8 -0
- package/decorators/styles.js.map +1 -0
- package/details.d.ts +8 -1
- package/details.d.ts.map +1 -1
- package/details.js +4 -1
- package/details.js.map +1 -1
- package/dialog.d.ts +8 -1
- package/dialog.d.ts.map +1 -1
- package/dialog.js +4 -1
- package/dialog.js.map +1 -1
- package/divider.d.ts +8 -1
- package/divider.d.ts.map +1 -1
- package/divider.js +4 -1
- package/divider.js.map +1 -1
- package/dragbox.d.ts +8 -1
- package/dragbox.d.ts.map +1 -1
- package/dragbox.js +4 -1
- package/dragbox.js.map +1 -1
- package/flex-flow.d.ts +8 -1
- package/flex-flow.d.ts.map +1 -1
- package/flex-flow.js +4 -1
- package/flex-flow.js.map +1 -1
- package/form.d.ts +8 -1
- package/form.d.ts.map +1 -1
- package/form.js +4 -1
- package/form.js.map +1 -1
- package/grid-flow.d.ts +9 -0
- package/grid-flow.d.ts.map +1 -0
- package/grid-flow.js +5 -0
- package/grid-flow.js.map +1 -0
- package/index.d.ts +32 -3
- package/index.d.ts.map +1 -1
- package/index.js +32 -3
- package/index.js.map +1 -1
- package/input.d.ts +8 -1
- package/input.d.ts.map +1 -1
- package/input.js +4 -1
- package/input.js.map +1 -1
- package/label-input.d.ts +8 -1
- package/label-input.d.ts.map +1 -1
- package/label-input.js +4 -1
- package/label-input.js.map +1 -1
- package/layout.d.ts +9 -0
- package/layout.d.ts.map +1 -0
- package/layout.js +5 -0
- package/layout.js.map +1 -0
- package/lib/css.d.ts +13 -0
- package/lib/css.d.ts.map +1 -0
- package/lib/css.js +29 -0
- package/lib/css.js.map +1 -0
- package/lib/directives.d.ts +16 -20
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js +33 -31
- package/lib/directives.js.map +1 -1
- package/lib/event-coll.d.ts +13 -0
- package/lib/event-coll.d.ts.map +1 -0
- package/lib/event-coll.js +45 -0
- package/lib/event-coll.js.map +1 -0
- package/lib/{templates.d.ts → icons.d.ts} +1 -17
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +73 -0
- package/lib/icons.js.map +1 -0
- package/lib/jsx.d.ts +4 -0
- package/lib/jsx.d.ts.map +1 -0
- package/lib/jsx.js +52 -0
- package/lib/jsx.js.map +1 -0
- package/lib/route-tree.d.ts +5 -5
- package/lib/route-tree.js +5 -5
- package/lib/route-tree.js.map +1 -1
- package/lib/utils.d.ts +6 -46
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +25 -110
- package/lib/utils.js.map +1 -1
- package/link.d.ts +9 -0
- package/link.d.ts.map +1 -0
- package/link.js +5 -0
- package/link.js.map +1 -0
- package/overbreath.d.ts +8 -1
- package/overbreath.d.ts.map +1 -1
- package/overbreath.js +4 -1
- package/overbreath.js.map +1 -1
- package/package.json +18 -23
- package/progress.d.ts +8 -1
- package/progress.d.ts.map +1 -1
- package/progress.js +4 -1
- package/progress.js.map +1 -1
- package/proto/godown-config.d.ts +41 -0
- package/proto/godown-config.d.ts.map +1 -0
- package/proto/godown-config.js +27 -0
- package/proto/godown-config.js.map +1 -0
- package/{godown-element.d.ts → proto/godown-element.d.ts} +48 -16
- package/proto/godown-element.d.ts.map +1 -0
- package/{godown-element.js → proto/godown-element.js} +82 -26
- package/proto/godown-element.js.map +1 -0
- package/proto/super-a.d.ts +30 -0
- package/proto/super-a.d.ts.map +1 -0
- package/proto/super-a.js +141 -0
- package/proto/super-a.js.map +1 -0
- package/proto/super-input.d.ts +44 -0
- package/proto/super-input.d.ts.map +1 -0
- package/proto/super-input.js +119 -0
- package/proto/super-input.js.map +1 -0
- package/proto/super-openable.d.ts +23 -0
- package/proto/super-openable.d.ts.map +1 -0
- package/proto/super-openable.js +43 -0
- package/proto/super-openable.js.map +1 -0
- package/range-input.d.ts +9 -0
- package/range-input.d.ts.map +1 -0
- package/range-input.js +5 -0
- package/range-input.js.map +1 -0
- package/react/create.d.ts.map +1 -1
- package/react/create.js +4 -1
- package/react/create.js.map +1 -1
- package/react/index.d.ts +64 -34
- package/react/index.d.ts.map +1 -1
- package/react/index.js +78 -51
- package/react/index.js.map +1 -1
- package/rotate.d.ts +9 -0
- package/rotate.d.ts.map +1 -0
- package/rotate.js +5 -0
- package/rotate.js.map +1 -0
- package/router-link.d.ts +9 -0
- package/router-link.d.ts.map +1 -0
- package/router-link.js +5 -0
- package/router-link.js.map +1 -0
- package/router.d.ts +8 -1
- package/router.d.ts.map +1 -1
- package/router.js +4 -1
- package/router.js.map +1 -1
- package/search-input.d.ts +8 -1
- package/search-input.d.ts.map +1 -1
- package/search-input.js +4 -1
- package/search-input.js.map +1 -1
- package/select-input.d.ts +8 -1
- package/select-input.d.ts.map +1 -1
- package/select-input.js +4 -1
- package/select-input.js.map +1 -1
- package/skeleton.d.ts +8 -1
- package/skeleton.d.ts.map +1 -1
- package/skeleton.js +4 -1
- package/skeleton.js.map +1 -1
- package/split-input.d.ts +8 -1
- package/split-input.d.ts.map +1 -1
- package/split-input.js +4 -1
- package/split-input.js.map +1 -1
- package/styles/colors/presets.d.ts +13 -0
- package/styles/colors/presets.d.ts.map +1 -0
- package/styles/colors/presets.js +6 -0
- package/styles/colors/presets.js.map +1 -0
- package/styles/colors/presetsRGB.d.ts +16 -0
- package/styles/colors/presetsRGB.d.ts.map +1 -0
- package/styles/colors/presetsRGB.js +134 -0
- package/styles/colors/presetsRGB.js.map +1 -0
- package/styles/global.d.ts +18 -0
- package/styles/global.d.ts.map +1 -0
- package/styles/global.js +78 -0
- package/styles/global.js.map +1 -0
- package/styles/inputStyle.d.ts +3 -0
- package/styles/inputStyle.d.ts.map +1 -0
- package/styles/inputStyle.js +59 -0
- package/styles/inputStyle.js.map +1 -0
- package/switch-input.d.ts +8 -1
- package/switch-input.d.ts.map +1 -1
- package/switch-input.js +4 -1
- package/switch-input.js.map +1 -1
- package/text.d.ts +8 -1
- package/text.d.ts.map +1 -1
- package/text.js +4 -1
- package/text.js.map +1 -1
- package/time.d.ts +8 -1
- package/time.d.ts.map +1 -1
- package/time.js +4 -1
- package/time.js.map +1 -1
- package/tooltip.d.ts +8 -1
- package/tooltip.d.ts.map +1 -1
- package/tooltip.js +4 -1
- package/tooltip.js.map +1 -1
- package/typewriter.d.ts +8 -1
- package/typewriter.d.ts.map +1 -1
- package/typewriter.js +4 -1
- package/typewriter.js.map +1 -1
- package/web-components/alert/alert.d.ts +2 -10
- package/web-components/alert/alert.d.ts.map +1 -1
- package/web-components/alert/alert.js +93 -91
- package/web-components/alert/alert.js.map +1 -1
- package/web-components/avatar/avatar-group.d.ts +21 -0
- package/web-components/avatar/avatar-group.d.ts.map +1 -0
- package/web-components/avatar/avatar-group.js +86 -0
- package/web-components/avatar/avatar-group.js.map +1 -0
- package/web-components/avatar/avatar.d.ts +5 -18
- package/web-components/avatar/avatar.d.ts.map +1 -1
- package/web-components/avatar/avatar.js +70 -85
- package/web-components/avatar/avatar.js.map +1 -1
- package/web-components/button/button.d.ts +10 -43
- package/web-components/button/button.d.ts.map +1 -1
- package/web-components/button/button.js +183 -226
- package/web-components/button/button.js.map +1 -1
- package/web-components/card/card.d.ts +2 -27
- package/web-components/card/card.d.ts.map +1 -1
- package/web-components/card/card.js +57 -132
- package/web-components/card/card.js.map +1 -1
- package/web-components/carousel/carousel.d.ts +5 -16
- package/web-components/carousel/carousel.d.ts.map +1 -1
- package/web-components/carousel/carousel.js +102 -106
- package/web-components/carousel/carousel.js.map +1 -1
- package/web-components/details/details.d.ts +4 -15
- package/web-components/details/details.d.ts.map +1 -1
- package/web-components/details/details.js +91 -97
- package/web-components/details/details.js.map +1 -1
- package/web-components/dialog/dialog.d.ts +6 -17
- package/web-components/dialog/dialog.d.ts.map +1 -1
- package/web-components/dialog/dialog.js +87 -137
- package/web-components/dialog/dialog.js.map +1 -1
- package/web-components/divider/divider.d.ts +13 -0
- package/web-components/divider/divider.d.ts.map +1 -0
- package/web-components/divider/divider.js +95 -0
- package/web-components/divider/divider.js.map +1 -0
- package/web-components/form/form.d.ts +15 -22
- package/web-components/form/form.d.ts.map +1 -1
- package/web-components/form/form.js +47 -117
- package/web-components/form/form.js.map +1 -1
- package/web-components/input/input.d.ts +5 -18
- package/web-components/input/input.d.ts.map +1 -1
- package/web-components/input/input.js +74 -169
- package/web-components/input/input.js.map +1 -1
- package/web-components/input/label-input.d.ts +5 -19
- package/web-components/input/label-input.d.ts.map +1 -1
- package/web-components/input/label-input.js +74 -141
- package/web-components/input/label-input.js.map +1 -1
- package/web-components/input/range-input.d.ts +53 -0
- package/web-components/input/range-input.d.ts.map +1 -0
- package/web-components/input/range-input.js +316 -0
- package/web-components/input/range-input.js.map +1 -0
- package/web-components/input/search-input.d.ts +4 -12
- package/web-components/input/search-input.d.ts.map +1 -1
- package/web-components/input/search-input.js +118 -113
- package/web-components/input/search-input.js.map +1 -1
- package/web-components/input/select-input.d.ts +17 -32
- package/web-components/input/select-input.d.ts.map +1 -1
- package/web-components/input/select-input.js +154 -286
- package/web-components/input/select-input.js.map +1 -1
- package/web-components/input/split-input.d.ts +8 -15
- package/web-components/input/split-input.d.ts.map +1 -1
- package/web-components/input/split-input.js +82 -72
- package/web-components/input/split-input.js.map +1 -1
- package/web-components/input/switch-input.d.ts +8 -17
- package/web-components/input/switch-input.d.ts.map +1 -1
- package/web-components/input/switch-input.js +122 -158
- package/web-components/input/switch-input.js.map +1 -1
- package/web-components/layout/flex-flow.d.ts +11 -19
- package/web-components/layout/flex-flow.d.ts.map +1 -1
- package/web-components/layout/flex-flow.js +57 -35
- package/web-components/layout/flex-flow.js.map +1 -1
- package/web-components/layout/grid-flow.d.ts +14 -0
- package/web-components/layout/grid-flow.d.ts.map +1 -0
- package/web-components/layout/grid-flow.js +56 -0
- package/web-components/layout/grid-flow.js.map +1 -0
- package/web-components/layout/layout.d.ts +18 -0
- package/web-components/layout/layout.d.ts.map +1 -0
- package/web-components/layout/layout.js +76 -0
- package/web-components/layout/layout.js.map +1 -0
- package/web-components/link/link.d.ts +10 -0
- package/web-components/link/link.d.ts.map +1 -0
- package/web-components/link/link.js +17 -0
- package/web-components/link/link.js.map +1 -0
- package/web-components/link/router-link.d.ts +19 -0
- package/web-components/link/router-link.d.ts.map +1 -0
- package/web-components/link/router-link.js +60 -0
- package/web-components/link/router-link.js.map +1 -0
- package/web-components/progress/progress.d.ts +2 -12
- package/web-components/progress/progress.d.ts.map +1 -1
- package/web-components/progress/progress.js +52 -48
- package/web-components/progress/progress.js.map +1 -1
- package/web-components/router/router.d.ts +15 -21
- package/web-components/router/router.d.ts.map +1 -1
- package/web-components/router/router.js +35 -37
- package/web-components/router/router.js.map +1 -1
- package/web-components/skeleton/skeleton.d.ts +5 -12
- package/web-components/skeleton/skeleton.d.ts.map +1 -1
- package/web-components/skeleton/skeleton.js +90 -98
- package/web-components/skeleton/skeleton.js.map +1 -1
- package/web-components/text/overbreath.d.ts +15 -20
- package/web-components/text/overbreath.d.ts.map +1 -1
- package/web-components/text/overbreath.js +108 -202
- package/web-components/text/overbreath.js.map +1 -1
- package/web-components/text/text.d.ts +5 -18
- package/web-components/text/text.d.ts.map +1 -1
- package/web-components/text/text.js +70 -80
- package/web-components/text/text.js.map +1 -1
- package/web-components/text/time.d.ts +5 -14
- package/web-components/text/time.d.ts.map +1 -1
- package/web-components/text/time.js +32 -31
- package/web-components/text/time.js.map +1 -1
- package/web-components/text/typewriter.d.ts +3 -11
- package/web-components/text/typewriter.d.ts.map +1 -1
- package/web-components/text/typewriter.js +42 -40
- package/web-components/text/typewriter.js.map +1 -1
- package/web-components/tooltip/tooltip.d.ts +21 -17
- package/web-components/tooltip/tooltip.d.ts.map +1 -1
- package/web-components/tooltip/tooltip.js +98 -60
- package/web-components/tooltip/tooltip.js.map +1 -1
- package/web-components/wrapper/dragbox.d.ts +5 -10
- package/web-components/wrapper/dragbox.d.ts.map +1 -1
- package/web-components/wrapper/dragbox.js +40 -31
- package/web-components/wrapper/dragbox.js.map +1 -1
- package/web-components/wrapper/rotate.d.ts +30 -0
- package/web-components/wrapper/rotate.d.ts.map +1 -0
- package/web-components/wrapper/rotate.js +92 -0
- package/web-components/wrapper/rotate.js.map +1 -0
- package/.deps.js.map +0 -1
- package/a.d.ts +0 -2
- package/a.d.ts.map +0 -1
- package/a.js +0 -2
- package/a.js.map +0 -1
- package/clip.d.ts +0 -2
- package/clip.d.ts.map +0 -1
- package/clip.js +0 -2
- package/clip.js.map +0 -1
- package/decorators/define.d.ts +0 -7
- package/decorators/define.d.ts.map +0 -1
- package/decorators/define.js +0 -11
- package/decorators/define.js.map +0 -1
- package/details-group.d.ts +0 -2
- package/details-group.d.ts.map +0 -1
- package/details-group.js +0 -2
- package/details-group.js.map +0 -1
- package/godown-element.d.ts.map +0 -1
- package/godown-element.js.map +0 -1
- package/lib/event-collection.d.ts +0 -14
- package/lib/event-collection.d.ts.map +0 -1
- package/lib/event-collection.js +0 -71
- package/lib/event-collection.js.map +0 -1
- package/lib/templates.d.ts.map +0 -1
- package/lib/templates.js +0 -76
- package/lib/templates.js.map +0 -1
- package/naming.d.ts +0 -91
- package/naming.d.ts.map +0 -1
- package/naming.js +0 -67
- package/naming.js.map +0 -1
- package/nav-layout.d.ts +0 -2
- package/nav-layout.d.ts.map +0 -1
- package/nav-layout.js +0 -2
- package/nav-layout.js.map +0 -1
- package/open-offset.d.ts +0 -2
- package/open-offset.d.ts.map +0 -1
- package/open-offset.js +0 -2
- package/open-offset.js.map +0 -1
- package/router-a.d.ts +0 -2
- package/router-a.d.ts.map +0 -1
- package/router-a.js +0 -2
- package/router-a.js.map +0 -1
- package/supers/anchor.d.ts +0 -26
- package/supers/anchor.d.ts.map +0 -1
- package/supers/anchor.js +0 -124
- package/supers/anchor.js.map +0 -1
- package/supers/input.d.ts +0 -28
- package/supers/input.d.ts.map +0 -1
- package/supers/input.js +0 -117
- package/supers/input.js.map +0 -1
- package/supers/openable.d.ts +0 -38
- package/supers/openable.d.ts.map +0 -1
- package/supers/openable.js +0 -77
- package/supers/openable.js.map +0 -1
- package/supers/root.d.ts +0 -18
- package/supers/root.d.ts.map +0 -1
- package/supers/root.js +0 -76
- package/supers/root.js.map +0 -1
- package/tabs.d.ts +0 -2
- package/tabs.d.ts.map +0 -1
- package/tabs.js +0 -2
- package/tabs.js.map +0 -1
- package/web-components/a/a.d.ts +0 -16
- package/web-components/a/a.d.ts.map +0 -1
- package/web-components/a/a.js +0 -17
- package/web-components/a/a.js.map +0 -1
- package/web-components/group/avatar-group.d.ts +0 -29
- package/web-components/group/avatar-group.d.ts.map +0 -1
- package/web-components/group/avatar-group.js +0 -88
- package/web-components/group/avatar-group.js.map +0 -1
- package/web-components/group/details-group.d.ts +0 -28
- package/web-components/group/details-group.d.ts.map +0 -1
- package/web-components/group/details-group.js +0 -59
- package/web-components/group/details-group.js.map +0 -1
- package/web-components/index.d.ts +0 -35
- package/web-components/index.d.ts.map +0 -1
- package/web-components/index.js +0 -35
- package/web-components/index.js.map +0 -1
- package/web-components/layout/divider.d.ts +0 -22
- package/web-components/layout/divider.d.ts.map +0 -1
- package/web-components/layout/divider.js +0 -85
- package/web-components/layout/divider.js.map +0 -1
- package/web-components/layout/nav-layout.d.ts +0 -38
- package/web-components/layout/nav-layout.d.ts.map +0 -1
- package/web-components/layout/nav-layout.js +0 -69
- package/web-components/layout/nav-layout.js.map +0 -1
- package/web-components/offset/open-offset.d.ts +0 -27
- package/web-components/offset/open-offset.d.ts.map +0 -1
- package/web-components/offset/open-offset.js +0 -130
- package/web-components/offset/open-offset.js.map +0 -1
- package/web-components/router/router-a.d.ts +0 -25
- package/web-components/router/router-a.d.ts.map +0 -1
- package/web-components/router/router-a.js +0 -70
- package/web-components/router/router-a.js.map +0 -1
- package/web-components/tabs/tabs.d.ts +0 -52
- package/web-components/tabs/tabs.d.ts.map +0 -1
- package/web-components/tabs/tabs.js +0 -165
- package/web-components/tabs/tabs.js.map +0 -1
- package/web-components/text/clip.d.ts +0 -22
- package/web-components/text/clip.d.ts.map +0 -1
- package/web-components/text/clip.js +0 -45
- package/web-components/text/clip.js.map +0 -1
- package/web-components/wrapper/wrapper.d.ts +0 -27
- package/web-components/wrapper/wrapper.d.ts.map +0 -1
- package/web-components/wrapper/wrapper.js +0 -95
- package/web-components/wrapper/wrapper.js.map +0 -1
- package/wrapper.d.ts +0 -2
- package/wrapper.d.ts.map +0 -1
- package/wrapper.js +0 -2
- package/wrapper.js.map +0 -1
@@ -1,14 +1,16 @@
|
|
1
|
-
var Alert_1;
|
2
1
|
import { __decorate } from "tslib";
|
3
|
-
import { css, html, property, unsafeCSS } from "
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { constructCSS } from "../../lib/
|
7
|
-
import {
|
8
|
-
|
9
|
-
|
2
|
+
import { css, html, property, unsafeCSS } from "../../_deps.js";
|
3
|
+
import { godown } from "../../decorators/godown.js";
|
4
|
+
import { styles } from "../../decorators/styles.js";
|
5
|
+
import { constructCSS } from "../../lib/css.js";
|
6
|
+
import { htmlSlot } from "../../lib/directives.js";
|
7
|
+
import { svgX } from "../../lib/icons.js";
|
8
|
+
import { GodownElement } from "../../proto/godown-element.js";
|
9
|
+
import { createScope } from "../../styles/global.js";
|
10
|
+
const protoName = "alert";
|
11
|
+
const cssScope = createScope(protoName);
|
10
12
|
const currentColor = "currentColor";
|
11
|
-
const vars = ["color", "background", "border", "super"].map((v) =>
|
13
|
+
const vars = ["color", "background", "border", "super"].map((v) => `--${cssScope}--${v}`);
|
12
14
|
const colors = {
|
13
15
|
success: ["#3c763d", "#dff0d8", "#d6e9c6", "#2b542c"],
|
14
16
|
info: ["#31708f", "#d9edf7", "#bce8f1", "#245269"],
|
@@ -21,7 +23,7 @@ const colors = {
|
|
21
23
|
*
|
22
24
|
* Inspired by Ant-design.
|
23
25
|
*/
|
24
|
-
let Alert =
|
26
|
+
let Alert = class Alert extends GodownElement {
|
25
27
|
constructor() {
|
26
28
|
super(...arguments);
|
27
29
|
/**
|
@@ -45,13 +47,13 @@ let Alert = Alert_1 = class Alert extends GodownElement {
|
|
45
47
|
if (this.autoclose) {
|
46
48
|
setTimeout(() => this.close(), this.autoclose);
|
47
49
|
}
|
48
|
-
return html `<
|
49
|
-
<div>
|
50
|
-
<strong> ${this.title || htmlSlot("title")}</strong>
|
50
|
+
return html `<div part="root" class="${this.call} alert">
|
51
|
+
<div class="flex-1">
|
52
|
+
<strong part="title" class="title"> ${this.title || htmlSlot("title")}</strong>
|
51
53
|
${this.content || htmlSlot()}
|
52
54
|
</div>
|
53
|
-
<
|
54
|
-
</
|
55
|
+
<i class="close" @click="${this.close}">${svgX()}</i>
|
56
|
+
</div>`;
|
55
57
|
}
|
56
58
|
close() {
|
57
59
|
this.shadowRoot.querySelector(".alert").classList.add("hide");
|
@@ -60,85 +62,12 @@ let Alert = Alert_1 = class Alert extends GodownElement {
|
|
60
62
|
}, 250);
|
61
63
|
}
|
62
64
|
static alert(root, option) {
|
63
|
-
const ai = new
|
65
|
+
const ai = new this();
|
64
66
|
Object.assign(ai, option);
|
65
67
|
root.appendChild(ai);
|
66
68
|
return ai;
|
67
69
|
}
|
68
70
|
};
|
69
|
-
Alert.styles = [
|
70
|
-
unsafeCSS(constructCSS(vars, colors, (raw) => {
|
71
|
-
return `.${raw}`;
|
72
|
-
})),
|
73
|
-
css `
|
74
|
-
:host {
|
75
|
-
${cssvarScope}--padding: .05em .25em .05em .35em;
|
76
|
-
${cssvarScope}--border-width: 0.15em;
|
77
|
-
${cssvarScope}--border-radius: 0.4em;
|
78
|
-
border-radius: var(${cssvarScope}--border-radius);
|
79
|
-
margin: 0 auto;
|
80
|
-
display: block;
|
81
|
-
}
|
82
|
-
|
83
|
-
.hide {
|
84
|
-
opacity: 0;
|
85
|
-
transform: translateY(-100%);
|
86
|
-
}
|
87
|
-
|
88
|
-
.alert {
|
89
|
-
transition: 0.25s;
|
90
|
-
display: flex;
|
91
|
-
justify-content: space-between;
|
92
|
-
padding: var(${cssvarScope}--padding);
|
93
|
-
border-radius: inherit;
|
94
|
-
border: var(${cssvarScope}--border-width) solid var(${cssvarScope}--border);
|
95
|
-
color: var(${cssvarScope}--color);
|
96
|
-
background: var(${cssvarScope}--background);
|
97
|
-
animation: alert 0.25s ease-in-out;
|
98
|
-
}
|
99
|
-
|
100
|
-
@keyframes alert {
|
101
|
-
0% {
|
102
|
-
opacity: 0;
|
103
|
-
transform: translateY(-50%);
|
104
|
-
}
|
105
|
-
100% {
|
106
|
-
opacity: 1;
|
107
|
-
transform: none;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
div {
|
112
|
-
min-height: 1.5em;
|
113
|
-
line-height: 1.5em;
|
114
|
-
}
|
115
|
-
|
116
|
-
.close {
|
117
|
-
height: fit-content;
|
118
|
-
width: fit-content;
|
119
|
-
border-radius: 50%;
|
120
|
-
transition: inherit;
|
121
|
-
}
|
122
|
-
|
123
|
-
.close:hover {
|
124
|
-
backdrop-filter: contrast(115%);
|
125
|
-
}
|
126
|
-
|
127
|
-
svg {
|
128
|
-
display: block;
|
129
|
-
height: 1.6em;
|
130
|
-
width: 1.6em;
|
131
|
-
}
|
132
|
-
|
133
|
-
.close:hover path {
|
134
|
-
stroke: var(${cssvarScope}--super);
|
135
|
-
}
|
136
|
-
|
137
|
-
path {
|
138
|
-
stroke: var(${cssvarScope}--color);
|
139
|
-
}
|
140
|
-
`,
|
141
|
-
];
|
142
71
|
__decorate([
|
143
72
|
property()
|
144
73
|
], Alert.prototype, "call", void 0);
|
@@ -151,8 +80,81 @@ __decorate([
|
|
151
80
|
__decorate([
|
152
81
|
property()
|
153
82
|
], Alert.prototype, "content", void 0);
|
154
|
-
Alert =
|
155
|
-
|
83
|
+
Alert = __decorate([
|
84
|
+
godown(protoName),
|
85
|
+
styles([
|
86
|
+
unsafeCSS(constructCSS(vars, colors, (raw) => `.${raw}`)),
|
87
|
+
css `
|
88
|
+
:host {
|
89
|
+
border-radius: var(--${cssScope}--border-radius);
|
90
|
+
--${cssScope}--border-radius: 0.4em;
|
91
|
+
--${cssScope}--border-width: 0.15em;
|
92
|
+
--${cssScope}--padding: .1em;
|
93
|
+
margin: 0 auto;
|
94
|
+
display: block;
|
95
|
+
}
|
96
|
+
|
97
|
+
.hide {
|
98
|
+
opacity: 0;
|
99
|
+
transform: translateY(-100%);
|
100
|
+
}
|
101
|
+
|
102
|
+
.alert {
|
103
|
+
transition: 0.25s;
|
104
|
+
display: flex;
|
105
|
+
justify-content: space-between;
|
106
|
+
padding: var(--${cssScope}--padding);
|
107
|
+
border-radius: inherit;
|
108
|
+
border: var(--${cssScope}--border-width) solid var(--${cssScope}--border);
|
109
|
+
color: var(--${cssScope}--color);
|
110
|
+
background: var(--${cssScope}--background);
|
111
|
+
animation: alert 0.25s ease-in-out;
|
112
|
+
}
|
113
|
+
|
114
|
+
@keyframes alert {
|
115
|
+
0% {
|
116
|
+
opacity: 0;
|
117
|
+
transform: translateY(-50%);
|
118
|
+
}
|
119
|
+
100% {
|
120
|
+
opacity: 1;
|
121
|
+
transform: none;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
.close {
|
126
|
+
height: -moz-fit-content;
|
127
|
+
height: fit-content;
|
128
|
+
width: -moz-fit-content;
|
129
|
+
width: fit-content;
|
130
|
+
border-radius: 50%;
|
131
|
+
transition: inherit;
|
132
|
+
}
|
133
|
+
|
134
|
+
.close:hover {
|
135
|
+
-webkit-backdrop-filter: contrast(115%);
|
136
|
+
backdrop-filter: contrast(115%);
|
137
|
+
}
|
138
|
+
|
139
|
+
.title {
|
140
|
+
line-height: 1.5em;
|
141
|
+
}
|
142
|
+
.close:hover path {
|
143
|
+
stroke: var(--${cssScope}--super);
|
144
|
+
}
|
145
|
+
.flex-1 {
|
146
|
+
flex: 1;
|
147
|
+
}
|
148
|
+
svg {
|
149
|
+
display: block;
|
150
|
+
height: 1.5em;
|
151
|
+
width: 1.5em;
|
152
|
+
}
|
153
|
+
path {
|
154
|
+
stroke: var(--${cssScope}--color);
|
155
|
+
}
|
156
|
+
`,
|
157
|
+
])
|
156
158
|
], Alert);
|
157
159
|
export { Alert };
|
158
160
|
export default Alert;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/alert/alert.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/alert/alert.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,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EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QACzD,GAAG,CAAA;;6BAEwB,QAAQ;UAC3B,QAAQ;UACR,QAAQ;UACR,QAAQ;;;;;;;;;;;;;;uBAcK,QAAQ;;sBAET,QAAQ,+BAA+B,QAAQ;qBAChD,QAAQ;0BACH,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAiCZ,QAAQ;;;;;;;;;;;sBAWR,QAAQ;;GAE3B;KACF,CAAC;GACW,KAAK,CA4CjB;;AAED,eAAe,KAAK,CAAC","sourcesContent":["import { css, html, property, unsafeCSS } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { constructCSS } from \"../../lib/css.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { svgX } from \"../../lib/icons.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\nimport { createScope } from \"../../styles/global.js\";\n\nconst protoName = \"alert\";\nconst cssScope = createScope(protoName);\n\nconst currentColor = \"currentColor\";\n\nconst vars = [\"color\", \"background\", \"border\", \"super\"].map((v) => `--${cssScope}--${v}`);\nconst colors = {\n success: [\"#3c763d\", \"#dff0d8\", \"#d6e9c6\", \"#2b542c\"],\n info: [\"#31708f\", \"#d9edf7\", \"#bce8f1\", \"#245269\"],\n warning: [\"#8a6d3b\", \"#fcf8e3\", \"#faebcc\", \"#66512c\"],\n danger: [\"#a94442\", \"#f2dede\", \"#ebccd1\", \"#843534\"],\n inherit: [currentColor, \"inherit\", currentColor, currentColor],\n};\n\n/**\n * {@linkcode Alert} renders a alert.\n *\n * Inspired by Ant-design.\n */\n@godown(protoName)\n@styles([\n unsafeCSS(constructCSS(vars, colors, (raw) => `.${raw}`)),\n css`\n :host {\n border-radius: var(--${cssScope}--border-radius);\n --${cssScope}--border-radius: 0.4em;\n --${cssScope}--border-width: 0.15em;\n --${cssScope}--padding: .1em;\n margin: 0 auto;\n display: block;\n }\n\n .hide {\n opacity: 0;\n transform: translateY(-100%);\n }\n\n .alert {\n transition: 0.25s;\n display: flex;\n justify-content: space-between;\n padding: var(--${cssScope}--padding);\n border-radius: inherit;\n border: var(--${cssScope}--border-width) solid var(--${cssScope}--border);\n color: var(--${cssScope}--color);\n background: var(--${cssScope}--background);\n animation: alert 0.25s ease-in-out;\n }\n\n @keyframes alert {\n 0% {\n opacity: 0;\n transform: translateY(-50%);\n }\n 100% {\n opacity: 1;\n transform: none;\n }\n }\n\n .close {\n height: -moz-fit-content;\n height: fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 50%;\n transition: inherit;\n }\n\n .close:hover {\n -webkit-backdrop-filter: contrast(115%);\n backdrop-filter: contrast(115%);\n }\n\n .title {\n line-height: 1.5em;\n }\n .close:hover path {\n stroke: var(--${cssScope}--super);\n }\n .flex-1 {\n flex: 1;\n }\n svg {\n display: block;\n height: 1.5em;\n width: 1.5em;\n }\n path {\n stroke: var(--${cssScope}--color);\n }\n `,\n])\nexport class Alert extends GodownElement {\n /**\n * Type of performance.\n */\n @property() call: keyof typeof colors | \"hide\" = \"info\";\n /**\n * Close delay.\n */\n @property({ type: Number }) autoclose = 3000;\n /**\n * Alert title.\n */\n @property() title = \"\";\n /**\n * Alert content.\n */\n @property() content = \"\";\n\n protected render() {\n if (this.autoclose) {\n setTimeout(() => this.close(), this.autoclose);\n }\n return html`<div part=\"root\" class=\"${this.call} alert\">\n <div class=\"flex-1\">\n <strong part=\"title\" class=\"title\"> ${this.title || htmlSlot(\"title\")}</strong>\n ${this.content || htmlSlot()}\n </div>\n <i class=\"close\" @click=\"${this.close}\">${svgX()}</i>\n </div>`;\n }\n\n close() {\n this.shadowRoot.querySelector(\".alert\").classList.add(\"hide\");\n setTimeout(() => {\n this.remove();\n }, 250);\n }\n\n static alert(root: HTMLElement, option: Partial<Alert>): Alert {\n const ai = new this();\n Object.assign(ai, option);\n root.appendChild(ai);\n return ai;\n }\n}\n\nexport default Alert;\n"]}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { GodownElement } from "../../proto/godown-element.js";
|
2
|
+
import Avatar from "./avatar.js";
|
3
|
+
/**
|
4
|
+
* {@linkcode AvatarGroup} used to limit the number of subcomponents.
|
5
|
+
*/
|
6
|
+
export declare class AvatarGroup extends GodownElement {
|
7
|
+
/**
|
8
|
+
* Maximum number of child elements acceptable.
|
9
|
+
*/
|
10
|
+
max: number;
|
11
|
+
/**
|
12
|
+
* Exceeded quantity.
|
13
|
+
*/
|
14
|
+
more: number;
|
15
|
+
protected render(): (import("lit").TemplateResult<1> | (import("lit").TemplateResult<1> | Avatar)[])[];
|
16
|
+
connectedCallback(): void;
|
17
|
+
push(a: Avatar): void;
|
18
|
+
pop(): void;
|
19
|
+
}
|
20
|
+
export default AvatarGroup;
|
21
|
+
//# sourceMappingURL=avatar-group.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"avatar-group.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/avatar/avatar-group.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,MAAM,MAAM,aAAa,CAAC;AAIjC;;GAEG;AACH,qBASa,WAAY,SAAQ,aAAa;IAC5C;;OAEG;IACyB,GAAG,SAAM;IAErC;;OAEG;IACM,IAAI,SAAK;IAElB,SAAS,CAAC,MAAM;IAUhB,iBAAiB,IAAI,IAAI;IAOzB,IAAI,CAAC,CAAC,EAAE,MAAM;IASd,GAAG;CAUJ;AAED,eAAe,WAAW,CAAC"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { css, property, state } from "../../_deps.js";
|
3
|
+
import { godown } from "../../decorators/godown.js";
|
4
|
+
import { styles } from "../../decorators/styles.js";
|
5
|
+
import { ifValue } from "../../lib/directives.js";
|
6
|
+
import { htmlSlot } from "../../lib/directives.js";
|
7
|
+
import { htmlStyle } from "../../lib/directives.js";
|
8
|
+
import { GodownElement } from "../../proto/godown-element.js";
|
9
|
+
import Avatar from "./avatar.js";
|
10
|
+
const protoName = "avatar-group";
|
11
|
+
/**
|
12
|
+
* {@linkcode AvatarGroup} used to limit the number of subcomponents.
|
13
|
+
*/
|
14
|
+
let AvatarGroup = class AvatarGroup extends GodownElement {
|
15
|
+
constructor() {
|
16
|
+
super(...arguments);
|
17
|
+
/**
|
18
|
+
* Maximum number of child elements acceptable.
|
19
|
+
*/
|
20
|
+
this.max = 99;
|
21
|
+
/**
|
22
|
+
* Exceeded quantity.
|
23
|
+
*/
|
24
|
+
this.more = 0;
|
25
|
+
}
|
26
|
+
render() {
|
27
|
+
return [
|
28
|
+
htmlSlot(),
|
29
|
+
ifValue(this.more > 0, [
|
30
|
+
htmlStyle(`slot::slotted(:nth-of-type(n+${this.max})){display: none;}`),
|
31
|
+
new Avatar({ innerText: `+${this.more}` }),
|
32
|
+
]),
|
33
|
+
];
|
34
|
+
}
|
35
|
+
connectedCallback() {
|
36
|
+
super.connectedCallback();
|
37
|
+
if (this.children.length > this.max) {
|
38
|
+
this.more = this.children.length - this.max;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
push(a) {
|
42
|
+
if (this.assigned.length === this.max) {
|
43
|
+
this.more = 2;
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
this.more += 1;
|
47
|
+
}
|
48
|
+
this.appendChild(a);
|
49
|
+
}
|
50
|
+
pop() {
|
51
|
+
if (this.assigned.length) {
|
52
|
+
this.assigned.pop().remove();
|
53
|
+
if (this.more === 2) {
|
54
|
+
this.more = 0;
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
this.more -= 1;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
};
|
62
|
+
__decorate([
|
63
|
+
property({ type: Number })
|
64
|
+
], AvatarGroup.prototype, "max", void 0);
|
65
|
+
__decorate([
|
66
|
+
state()
|
67
|
+
], AvatarGroup.prototype, "more", void 0);
|
68
|
+
AvatarGroup = __decorate([
|
69
|
+
godown(protoName),
|
70
|
+
styles([
|
71
|
+
css `
|
72
|
+
:host {
|
73
|
+
display: flex;
|
74
|
+
width: 100%;
|
75
|
+
}
|
76
|
+
`,
|
77
|
+
])
|
78
|
+
], AvatarGroup);
|
79
|
+
export { AvatarGroup };
|
80
|
+
export default AvatarGroup;
|
81
|
+
// declare global {
|
82
|
+
// interface HTMLElementTagNameMap {
|
83
|
+
// ["godown-avatar-group"]: AvatarGroup;
|
84
|
+
// }
|
85
|
+
// }
|
86
|
+
//# sourceMappingURL=avatar-group.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"avatar-group.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/avatar/avatar-group.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC;;GAEG;AAUI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,aAAa;IAAvC;;QACL;;WAEG;QACyB,QAAG,GAAG,EAAE,CAAC;QAErC;;WAEG;QACM,SAAI,GAAG,CAAC,CAAC;IAsCpB,CAAC;IApCW,MAAM;QACd,OAAO;YACL,QAAQ,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC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,CAAA;;;;;GAKF;KACF,CAAC;GACW,WAAW,CA+CvB;;AAED,eAAe,WAAW,CAAC;AAE3B,mBAAmB;AACnB,sCAAsC;AACtC,4CAA4C;AAC5C,MAAM;AACN,IAAI","sourcesContent":["import { css, property, state } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { ifValue } from \"../../lib/directives.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { htmlStyle } from \"../../lib/directives.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\nimport Avatar from \"./avatar.js\";\n\nconst protoName = \"avatar-group\";\n\n/**\n * {@linkcode AvatarGroup} used to limit the number of subcomponents.\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n display: flex;\n width: 100%;\n }\n `,\n])\nexport class AvatarGroup extends GodownElement {\n /**\n * Maximum number of child elements acceptable.\n */\n @property({ type: Number }) max = 99;\n\n /**\n * Exceeded quantity.\n */\n @state() more = 0;\n\n protected render() {\n return [\n htmlSlot(),\n ifValue(this.more > 0, [\n htmlStyle(`slot::slotted(:nth-of-type(n+${this.max})){display: none;}`),\n new Avatar({ innerText: `+${this.more}` }),\n ]),\n ];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (this.children.length > this.max) {\n this.more = this.children.length - this.max;\n }\n }\n\n push(a: Avatar) {\n if (this.assigned.length === this.max) {\n this.more = 2;\n } else {\n this.more += 1;\n }\n this.appendChild(a);\n }\n\n pop() {\n if (this.assigned.length) {\n this.assigned.pop().remove();\n if (this.more === 2) {\n this.more = 0;\n } else {\n this.more -= 1;\n }\n }\n }\n}\n\nexport default AvatarGroup;\n\n// declare global {\n// interface HTMLElementTagNameMap {\n// [\"godown-avatar-group\"]: AvatarGroup;\n// }\n// }\n"]}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import GodownAnchor from "../../supers/anchor.js";
|
1
|
+
import GodownAnchor from "../../proto/super-a.js";
|
3
2
|
/**
|
4
3
|
* {@linkcode Avatar} renders the avatar or name and has a href.
|
5
4
|
*/
|
@@ -11,31 +10,19 @@ export declare class Avatar extends GodownAnchor {
|
|
11
10
|
/**
|
12
11
|
* Default image src.
|
13
12
|
*/
|
14
|
-
|
13
|
+
default: string;
|
15
14
|
/**
|
16
15
|
* Link href.
|
17
16
|
*/
|
18
17
|
href: any;
|
19
18
|
/**
|
20
|
-
* If the image is not available, the {@linkcode Avatar.
|
19
|
+
* If the image is not available, the {@linkcode Avatar.format} will be displayed.
|
21
20
|
*/
|
22
21
|
name: string;
|
23
|
-
|
24
|
-
* If there is a value, the {@linkcode Avatar.avaMore} will be displayed.
|
25
|
-
*/
|
26
|
-
more: number;
|
27
|
-
static styles: import("lit").CSSResult[];
|
28
|
-
protected render(): HTMLTemplate;
|
22
|
+
protected render(): import("lit").TemplateResult<1>;
|
29
23
|
private renderAva;
|
30
|
-
|
31
|
-
avaName(): string;
|
24
|
+
format(): string;
|
32
25
|
imgOnError(e: ErrorEvent): void;
|
33
26
|
}
|
34
27
|
export default Avatar;
|
35
|
-
declare global {
|
36
|
-
interface HTMLElementTagNameMap {
|
37
|
-
"avatar-a": Avatar;
|
38
|
-
"g-avatar": Avatar;
|
39
|
-
}
|
40
|
-
}
|
41
28
|
//# sourceMappingURL=avatar.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/avatar/avatar.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/avatar/avatar.ts"],"names":[],"mappings":"AAIA,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAMlD;;GAEG;AACH,qBA8Ca,MAAO,SAAQ,YAAY;IACtC;;OAEG;IACS,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACS,OAAO,EAAE,MAAM,CAAa;IACxC;;OAEG;IACS,IAAI,MAAa;IAC7B;;OAEG;IACS,IAAI,SAAM;IAEtB,SAAS,CAAC,MAAM;IAIhB,OAAO,CAAC,SAAS;IAUjB,MAAM,IAAI,MAAM;IAIhB,UAAU,CAAC,CAAC,EAAE,UAAU;CAOzB;AAED,eAAe,MAAM,CAAC"}
|
@@ -1,135 +1,120 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { css, html, ifDefined, property } from "
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import
|
6
|
-
import
|
7
|
-
|
8
|
-
const
|
2
|
+
import { css, html, ifDefined, property } from "../../_deps.js";
|
3
|
+
import { godown } from "../../decorators/godown.js";
|
4
|
+
import { styles } from "../../decorators/styles.js";
|
5
|
+
import { htmlSlot } from "../../lib/directives.js";
|
6
|
+
import GodownAnchor from "../../proto/super-a.js";
|
7
|
+
import { createScope } from "../../styles/global.js";
|
8
|
+
const protoName = "avatar";
|
9
|
+
const cssScope = createScope(protoName);
|
9
10
|
/**
|
10
11
|
* {@linkcode Avatar} renders the avatar or name and has a href.
|
11
12
|
*/
|
12
13
|
let Avatar = class Avatar extends GodownAnchor {
|
13
14
|
constructor() {
|
14
15
|
super(...arguments);
|
15
|
-
/**
|
16
|
-
* Image src.
|
17
|
-
*/
|
18
|
-
this.src = "";
|
19
16
|
/**
|
20
17
|
* Default image src.
|
21
18
|
*/
|
22
|
-
this.
|
19
|
+
this.default = undefined;
|
23
20
|
/**
|
24
21
|
* Link href.
|
25
22
|
*/
|
26
23
|
this.href = undefined;
|
27
24
|
/**
|
28
|
-
* If the image is not available, the {@linkcode Avatar.
|
25
|
+
* If the image is not available, the {@linkcode Avatar.format} will be displayed.
|
29
26
|
*/
|
30
27
|
this.name = "";
|
31
|
-
/**
|
32
|
-
* If there is a value, the {@linkcode Avatar.avaMore} will be displayed.
|
33
|
-
*/
|
34
|
-
this.more = 0;
|
35
28
|
}
|
36
29
|
render() {
|
37
|
-
return html
|
38
|
-
<a href="${ifDefined(this.href)}"> ${this.renderAva()} ${htmlSlot("mask")} </a>
|
39
|
-
${htmlSlot()}
|
40
|
-
`;
|
30
|
+
return html `<a part="root" href="${ifDefined(this.href)}"> ${this.renderAva()} ${htmlSlot("mask")}</a> `;
|
41
31
|
}
|
42
32
|
renderAva() {
|
43
|
-
if (this.more) {
|
44
|
-
return html `<span>${this.avaMore()}</span>`;
|
45
|
-
}
|
46
33
|
if (this.src) {
|
47
|
-
return html `<img src="${this.src}" @error=${this.imgOnError} alt="" />`;
|
34
|
+
return html `<img part="image" src="${this.src}" @error=${this.imgOnError} alt="${this.name}" />`;
|
48
35
|
}
|
49
36
|
if (this.name) {
|
50
|
-
return html `<span>${this.
|
51
|
-
}
|
52
|
-
return htmlSlot("avatar");
|
53
|
-
}
|
54
|
-
avaMore() {
|
55
|
-
if (this.more < 0) {
|
56
|
-
return "+";
|
37
|
+
return html `<span part="name">${this.format()}</span>`;
|
57
38
|
}
|
58
|
-
return (
|
39
|
+
return htmlSlot();
|
59
40
|
}
|
60
|
-
|
61
|
-
|
62
|
-
return name[0].toUpperCase() + name.slice(1);
|
41
|
+
format() {
|
42
|
+
return this.name;
|
63
43
|
}
|
64
44
|
imgOnError(e) {
|
65
|
-
if (this.
|
66
|
-
e.target.src = this.
|
45
|
+
if (this.default) {
|
46
|
+
e.target.src = this.default;
|
67
47
|
}
|
68
48
|
else {
|
69
49
|
this.src = undefined;
|
70
50
|
}
|
71
51
|
}
|
72
52
|
};
|
73
|
-
Avatar.styles = [
|
74
|
-
css `
|
75
|
-
:host {
|
76
|
-
${cssvarScope}--ava: 1.5em;
|
77
|
-
display: inline-flex;
|
78
|
-
align-items: center;
|
79
|
-
}
|
80
|
-
|
81
|
-
* {
|
82
|
-
border-radius: inherit;
|
83
|
-
}
|
84
|
-
|
85
|
-
img {
|
86
|
-
width: 100%;
|
87
|
-
height: 100%;
|
88
|
-
}
|
89
|
-
|
90
|
-
a {
|
91
|
-
height: var(${cssvarScope}--ava);
|
92
|
-
width: var(${cssvarScope}--ava);
|
93
|
-
color: inherit;
|
94
|
-
display: flex;
|
95
|
-
position: relative;
|
96
|
-
align-items: inherit;
|
97
|
-
}
|
98
|
-
|
99
|
-
span {
|
100
|
-
position: absolute;
|
101
|
-
width: 100%;
|
102
|
-
text-align: center;
|
103
|
-
}
|
104
|
-
|
105
|
-
slot[name="mask"] {
|
106
|
-
position: absolute;
|
107
|
-
display: flex;
|
108
|
-
width: 100%;
|
109
|
-
height: 100%;
|
110
|
-
align-items: center;
|
111
|
-
justify-content: center;
|
112
|
-
}
|
113
|
-
`,
|
114
|
-
];
|
115
53
|
__decorate([
|
116
54
|
property()
|
117
55
|
], Avatar.prototype, "src", void 0);
|
118
56
|
__decorate([
|
119
57
|
property()
|
120
|
-
], Avatar.prototype, "
|
58
|
+
], Avatar.prototype, "default", void 0);
|
121
59
|
__decorate([
|
122
60
|
property()
|
123
61
|
], Avatar.prototype, "href", void 0);
|
124
62
|
__decorate([
|
125
63
|
property()
|
126
64
|
], Avatar.prototype, "name", void 0);
|
127
|
-
__decorate([
|
128
|
-
property({ type: Number })
|
129
|
-
], Avatar.prototype, "more", void 0);
|
130
65
|
Avatar = __decorate([
|
131
|
-
|
66
|
+
godown(protoName),
|
67
|
+
styles([
|
68
|
+
css `
|
69
|
+
:host {
|
70
|
+
--${cssScope}--avatar-size: 2.4em;
|
71
|
+
display: inline-block;
|
72
|
+
}
|
73
|
+
|
74
|
+
img {
|
75
|
+
width: 100%;
|
76
|
+
height: 100%;
|
77
|
+
object-fit: cover;
|
78
|
+
}
|
79
|
+
|
80
|
+
a {
|
81
|
+
display: block;
|
82
|
+
color: inherit;
|
83
|
+
overflow: hidden;
|
84
|
+
position: relative;
|
85
|
+
border-radius: inherit;
|
86
|
+
width: var(--${cssScope}--avatar-size);
|
87
|
+
height: var(--${cssScope}--avatar-size);
|
88
|
+
}
|
89
|
+
|
90
|
+
span {
|
91
|
+
position: absolute;
|
92
|
+
width: 100%;
|
93
|
+
}
|
94
|
+
|
95
|
+
a,
|
96
|
+
[part="name"] {
|
97
|
+
display: flex;
|
98
|
+
align-items: center;
|
99
|
+
justify-content: center;
|
100
|
+
}
|
101
|
+
|
102
|
+
[part="mask"] {
|
103
|
+
position: absolute;
|
104
|
+
display: flex;
|
105
|
+
width: 100%;
|
106
|
+
height: 100%;
|
107
|
+
align-items: center;
|
108
|
+
justify-content: center;
|
109
|
+
}
|
110
|
+
`,
|
111
|
+
])
|
132
112
|
], Avatar);
|
133
113
|
export { Avatar };
|
134
114
|
export default Avatar;
|
115
|
+
// declare global {
|
116
|
+
// interface HTMLElementTagNameMap {
|
117
|
+
// ["godown-avatar"]: Avatar
|
118
|
+
// }
|
119
|
+
// }
|
135
120
|
//# sourceMappingURL=avatar.js.map
|