godown 2.7.5 → 2.7.7
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,15 +1,29 @@
|
|
1
1
|
import { LitElement } from "lit";
|
2
|
-
import { EventsCollection } from "
|
3
|
-
import { deepQuerySelector, deepQuerySelectorAll } from "
|
2
|
+
import { EventsCollection } from "../lib/event-coll.js";
|
3
|
+
import { deepQuerySelector, deepQuerySelectorAll } from "../lib/utils.js";
|
4
4
|
/**
|
5
5
|
* Global element.
|
6
6
|
*/
|
7
|
-
class GodownElement extends LitElement {
|
7
|
+
export class GodownElement extends LitElement {
|
8
|
+
static define() {
|
9
|
+
if (!this.isDefined()) {
|
10
|
+
this.godownConfig.define(this.elementTagName, this);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
static isDefined() {
|
14
|
+
return !!customElements.get(this.elementTagName);
|
15
|
+
}
|
16
|
+
queryPart(p) {
|
17
|
+
return this.shadowRoot.querySelector(`[part=${p}]`);
|
18
|
+
}
|
19
|
+
get assignedElements() {
|
20
|
+
return this._slot?.assignedElements();
|
21
|
+
}
|
8
22
|
/**
|
9
23
|
* No named slot element's assignedElements, as HTMLElement[].
|
10
24
|
*/
|
11
25
|
get assigned() {
|
12
|
-
return this.
|
26
|
+
return this.assignedElements;
|
13
27
|
}
|
14
28
|
/**
|
15
29
|
* No named slot element's assignedElements, as Node[].
|
@@ -30,13 +44,13 @@ class GodownElement extends LitElement {
|
|
30
44
|
return [...this.shadowRoot.querySelectorAll("slot")];
|
31
45
|
}
|
32
46
|
/**
|
33
|
-
* Named
|
47
|
+
* Named slotted elements.
|
34
48
|
*/
|
35
49
|
get slottedChildren() {
|
36
50
|
return [...this.querySelectorAll("[slot]")];
|
37
51
|
}
|
38
52
|
/**
|
39
|
-
* Named
|
53
|
+
* Named slotted elements' slot attribute.
|
40
54
|
*/
|
41
55
|
get slottedNames() {
|
42
56
|
return this.slottedChildren.map((c) => c.getAttribute("slot")).filter((v) => v);
|
@@ -50,6 +64,9 @@ class GodownElement extends LitElement {
|
|
50
64
|
querySlot(slotName) {
|
51
65
|
return this.querySelector(`[slot=${slotName}]`);
|
52
66
|
}
|
67
|
+
get offsets() {
|
68
|
+
return this.offsetParent || document.body;
|
69
|
+
}
|
53
70
|
/**
|
54
71
|
* Width of (`this.offsetParent` or `document.body`).
|
55
72
|
*/
|
@@ -69,8 +86,8 @@ class GodownElement extends LitElement {
|
|
69
86
|
* this.addEvent(src, "type", listener)
|
70
87
|
* ```
|
71
88
|
*/
|
72
|
-
addEvent(src, type, listener, options
|
73
|
-
this.__events.addEvent(src, type, listener, options
|
89
|
+
addEvent(src, type, listener, options) {
|
90
|
+
return this.__events.addEvent(src, type, listener, options);
|
74
91
|
}
|
75
92
|
/**
|
76
93
|
* ```
|
@@ -79,30 +96,64 @@ class GodownElement extends LitElement {
|
|
79
96
|
* this.removeEvent(src, "type", listener)
|
80
97
|
* ```
|
81
98
|
*/
|
82
|
-
removeEvent(src, type,
|
83
|
-
this.__events.removeEvent(src, type,
|
99
|
+
removeEvent(src, type, listener) {
|
100
|
+
this.__events.removeEvent(src, type, listener);
|
84
101
|
}
|
85
102
|
removeAllEvents() {
|
86
103
|
this.__events.removeAllEvents();
|
87
104
|
}
|
88
|
-
|
105
|
+
get stylex() {
|
106
|
+
return this.__stylex.css;
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* Appends to `shadowRoot.adoptedStyleSheets` and overrides the initial style (constructor.styles).
|
110
|
+
*
|
111
|
+
* If there is no selector, it will be `:host`.
|
112
|
+
*
|
113
|
+
* Resetting will remove the previous stylex.
|
114
|
+
*
|
115
|
+
* @parma sx CSS string.
|
116
|
+
*
|
117
|
+
* @example
|
118
|
+
* ```html
|
119
|
+
* <custom-element stylex=":host{--key:value;}"></custom-element>
|
120
|
+
* <custom-element stylex="--key:value;"></custom-element>
|
121
|
+
* ```
|
122
|
+
*/
|
123
|
+
set stylex(sx) {
|
124
|
+
sx = sx.trim();
|
125
|
+
if (!/^(([\s\S]+)\{)(([\s\S]+)\})$/.test(sx)) {
|
126
|
+
sx = `:host{${sx}}`;
|
127
|
+
}
|
128
|
+
this.setAttribute("stylex", sx);
|
129
|
+
if (!this.shadowRoot) {
|
130
|
+
this.__stylex.lazy = sx;
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
if (this.__stylex.index) {
|
134
|
+
this.shadowRoot.adoptedStyleSheets.splice(this.__stylex.index, 1);
|
135
|
+
}
|
136
|
+
this.__stylex.css = sx;
|
137
|
+
this.__stylex.index = this.adoptStyles(sx);
|
138
|
+
}
|
139
|
+
constructor(assignInit) {
|
89
140
|
super();
|
90
141
|
this.__events = new EventsCollection();
|
91
|
-
this.
|
92
|
-
|
93
|
-
...assign,
|
142
|
+
this.__stylex = {};
|
143
|
+
this.assign = {
|
144
|
+
...(GodownElement.godownConfig?.assign || {}),
|
145
|
+
...assignInit,
|
94
146
|
};
|
95
147
|
}
|
96
148
|
connectedCallback() {
|
97
149
|
super.connectedCallback();
|
98
|
-
if (this.
|
99
|
-
this.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
Object.assign(this, this.__assign);
|
150
|
+
if (this.assign) {
|
151
|
+
Object.assign(this, this.assign);
|
152
|
+
this.assign = null;
|
153
|
+
}
|
154
|
+
const { lazy } = this.__stylex;
|
155
|
+
if (lazy) {
|
156
|
+
this.adoptStyles(lazy);
|
106
157
|
}
|
107
158
|
}
|
108
159
|
disconnectedCallback() {
|
@@ -128,7 +179,8 @@ class GodownElement extends LitElement {
|
|
128
179
|
/**
|
129
180
|
* Add styles to shadowRoot.
|
130
181
|
*
|
131
|
-
* @param styles
|
182
|
+
* @param styles CSS strings.
|
183
|
+
* @returns Index of injected style.
|
132
184
|
*
|
133
185
|
* @example
|
134
186
|
* ```
|
@@ -139,9 +191,13 @@ class GodownElement extends LitElement {
|
|
139
191
|
* ```
|
140
192
|
*/
|
141
193
|
adoptStyles(...styles) {
|
142
|
-
const
|
143
|
-
styles.
|
144
|
-
|
194
|
+
const stack = this.shadowRoot.adoptedStyleSheets;
|
195
|
+
if (styles.length) {
|
196
|
+
const sheet = new CSSStyleSheet();
|
197
|
+
styles.forEach((style) => sheet.insertRule(style.toString()));
|
198
|
+
stack.push(sheet);
|
199
|
+
}
|
200
|
+
return stack.length - 1;
|
145
201
|
}
|
146
202
|
}
|
147
203
|
export default GodownElement;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"godown-element.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/godown-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAEtD,OAAO,EAAmB,gBAAgB,EAAuC,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG1E;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAO3C,MAAM,CAAC,MAAM;QACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,MAAM,CAAC,SAAS;QACd,OAAO,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAED,SAAS,CAAwB,CAAS;QACxC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAI,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAmB,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAkB,kBAAkB,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,IAAI,MA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,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC9D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,aAAa,CAAC","sourcesContent":["import { LitElement, type PropertyValues } from \"lit\";\n\nimport { type AddOptions, EventsCollection, type EventsNames, type ListenerFunc } from \"../lib/event-coll.js\";\nimport { deepQuerySelector, deepQuerySelectorAll } from \"../lib/utils.js\";\nimport { type GodownConfig } from \"./godown-config\";\n\n/**\n * Global element.\n */\nexport class GodownElement extends LitElement {\n static godownConfig?: GodownConfig;\n\n static elementTagName?: string;\n\n static protoName?: string;\n\n static define() {\n if (!this.isDefined()) {\n this.godownConfig.define(this.elementTagName, this);\n }\n }\n\n static isDefined(): boolean {\n return !!customElements.get(this.elementTagName);\n }\n\n queryPart<E extends HTMLElement>(p: string) {\n return this.shadowRoot.querySelector<E>(`[part=${p}]`);\n }\n\n get assignedElements(): HTMLElement[] {\n return this._slot?.assignedElements() as HTMLElement[];\n }\n\n /**\n * No named slot element's assignedElements, as HTMLElement[].\n */\n get assigned(): HTMLElement[] {\n return this.assignedElements;\n }\n\n /**\n * No named slot element's assignedElements, as Node[].\n */\n get assignedNodes(): Node[] {\n return this._slot?.assignedNodes();\n }\n\n /**\n * No named slot element.\n */\n get _slot(): HTMLSlotElement {\n return this.shadowRoot.querySelector<HTMLSlotElement>(\"slot:not([name])\");\n }\n\n /**\n * Slot elements.\n */\n get _slots(): HTMLSlotElement[] {\n return [...this.shadowRoot.querySelectorAll<HTMLSlotElement>(\"slot\")];\n }\n\n /**\n * Named slotted elements.\n */\n get slottedChildren(): HTMLSlotElement[] {\n return [...this.querySelectorAll<HTMLSlotElement>(\"[slot]\")];\n }\n\n /**\n * Named slotted elements' slot attribute.\n */\n get slottedNames(): string[] {\n return this.slottedChildren.map((c) => c.getAttribute(\"slot\")).filter((v) => v);\n }\n\n /**\n * Query for a element with slot names\n *\n * @param slotName Slot name.\n * @returns Slot element.\n */\n querySlot(slotName: string): HTMLSlotElement | null {\n return this.querySelector<HTMLSlotElement>(`[slot=${slotName}]`);\n }\n\n get offsets() {\n return this.offsetParent || document.body;\n }\n\n /**\n * Width of (`this.offsetParent` or `document.body`).\n */\n get offsetsWidth(): number {\n return this.offsetParent?.clientWidth ?? document.body.offsetWidth;\n }\n\n /**\n * Height of (`this.offsetParent` or `document.body`).\n */\n get offsetsHeight(): number {\n return this.offsetParent?.clientHeight ?? document.body.offsetHeight;\n }\n\n private __events: EventsCollection;\n\n /**\n * ```\n * src.addEventListener(\"type\", listener)\n * //as\n * this.addEvent(src, \"type\", listener)\n * ```\n */\n addEvent<SRC extends EventTarget = HTMLElement>(\n src: SRC,\n type: EventsNames,\n listener: ListenerFunc,\n options?: AddOptions,\n ): ListenerFunc {\n return this.__events.addEvent(src, type, listener, options);\n }\n\n /**\n * ```\n * src.removeEventListener(\"type\", listener)\n * //as\n * this.removeEvent(src, \"type\", listener)\n * ```\n */\n removeEvent<SRC extends EventTarget = HTMLElement>(src: SRC, type: EventsNames, listener: ListenerFunc) {\n this.__events.removeEvent(src, type, listener);\n }\n\n removeAllEvents() {\n this.__events.removeAllEvents();\n }\n\n private assign: void | Record<string, any>;\n\n private __stylex: { css?: string; index?: number; lazy?: string };\n\n get stylex(): string | undefined {\n return this.__stylex.css;\n }\n\n /**\n * Appends to `shadowRoot.adoptedStyleSheets` and overrides the initial style (constructor.styles).\n *\n * If there is no selector, it will be `:host`.\n *\n * Resetting will remove the previous stylex.\n *\n * @parma sx CSS string.\n *\n * @example\n * ```html\n * <custom-element stylex=\":host{--key:value;}\"></custom-element>\n * <custom-element stylex=\"--key:value;\"></custom-element>\n * ```\n */\n set stylex(sx: string) {\n sx = sx.trim();\n if (!/^(([\\s\\S]+)\\{)(([\\s\\S]+)\\})$/.test(sx)) {\n sx = `:host{${sx}}`;\n }\n this.setAttribute(\"stylex\", sx);\n if (!this.shadowRoot) {\n this.__stylex.lazy = sx;\n return;\n }\n if (this.__stylex.index) {\n this.shadowRoot.adoptedStyleSheets.splice(this.__stylex.index, 1);\n }\n this.__stylex.css = sx;\n this.__stylex.index = this.adoptStyles(sx);\n }\n\n constructor(assignInit: typeof GodownElement.prototype.assign) {\n super();\n this.__events = new EventsCollection();\n this.__stylex = {};\n this.assign = {\n ...(GodownElement.godownConfig?.assign || {}),\n ...assignInit,\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.assign) {\n Object.assign(this, this.assign);\n this.assign = null;\n }\n const { lazy } = this.__stylex;\n if (lazy) {\n this.adoptStyles(lazy);\n }\n }\n\n disconnectedCallback() {\n this.removeAllEvents();\n }\n\n mount(arg?: PropertyValues) {\n this.firstUpdated(arg);\n }\n\n unmount() {\n this.disconnectedCallback();\n }\n\n remount(arg?: PropertyValues) {\n this.unmount();\n this.connectedCallback();\n this.mount(arg);\n }\n\n deepQuerySelector<E extends Element = HTMLElement>(\n selectors: Parameters<typeof deepQuerySelector>[0],\n root: Parameters<typeof deepQuerySelector>[1] = this,\n ): E {\n return deepQuerySelector<E>(selectors, root);\n }\n\n deepQuerySelectorAll<E extends Element = HTMLElement>(\n selectors: Parameters<typeof deepQuerySelectorAll>[0],\n root: Parameters<typeof deepQuerySelectorAll>[1] = this,\n ): E[] {\n return deepQuerySelectorAll<E>(selectors, root);\n }\n\n /**\n * Add styles to shadowRoot.\n *\n * @param styles CSS strings.\n * @returns Index of injected style.\n *\n * @example\n * ```\n * this.applyStyles(\n * \"...\",\n * css`...`,\n * )\n * ```\n */\n adoptStyles(...styles: LikeString[]): number {\n const stack = this.shadowRoot.adoptedStyleSheets;\n if (styles.length) {\n const sheet = new CSSStyleSheet();\n styles.forEach((style) => sheet.insertRule(style.toString()));\n stack.push(sheet);\n }\n return stack.length - 1;\n }\n}\n\nexport default GodownElement;\nexport interface LikeString {\n toString(): string;\n}\n\nexport type HTMLEvent<H = HTMLElement, E = Event> = {\n target: H;\n [key: string]: unknown;\n} & E;\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { GodownElement } from "./godown-element.js";
|
2
|
+
export declare class GodownSuperA extends GodownElement {
|
3
|
+
/**
|
4
|
+
* True when the href is in the same pathname as the location.
|
5
|
+
*/
|
6
|
+
active: boolean;
|
7
|
+
/**
|
8
|
+
* Href for a element.
|
9
|
+
*/
|
10
|
+
href: string;
|
11
|
+
/**
|
12
|
+
* Target for an element.
|
13
|
+
*/
|
14
|
+
target: "_blank" | "_self" | "_parent" | "_top";
|
15
|
+
/**
|
16
|
+
* Arrow type.
|
17
|
+
*/
|
18
|
+
arrow: "" | "link" | "delta" | "arrow" | "angle";
|
19
|
+
protected render(): import("lit").TemplateResult<1>;
|
20
|
+
protected _handleClick(_: MouseEvent): void;
|
21
|
+
private _arrowSwitcher;
|
22
|
+
connectedCallback(): void;
|
23
|
+
useActive(): {
|
24
|
+
url: URL;
|
25
|
+
sameOrigin: boolean;
|
26
|
+
active: boolean;
|
27
|
+
};
|
28
|
+
}
|
29
|
+
export default GodownSuperA;
|
30
|
+
//# sourceMappingURL=super-a.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-a.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-a.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBA2Da,YAAa,SAAQ,aAAa;IAC7C;;OAEG;IACyC,MAAM,UAAS;IAC3D;;OAEG;IACS,IAAI,EAAE,MAAM,CAAa;IACrC;;OAEG;IACS,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAW;IACtE;;OAEG;IACS,KAAK,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAM;IAElE,SAAS,CAAC,MAAM;IAQhB,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU;IAEpC,OAAO,CAAC,cAAc;IActB,iBAAiB,IAAI,IAAI;IAKzB,SAAS;;;;;CAYV;AAED,eAAe,YAAY,CAAC"}
|
package/proto/super-a.js
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { css, html, ifDefined, property } from "../_deps.js";
|
3
|
+
import { styles } from "../decorators/styles.js";
|
4
|
+
import { htmlSlot } from "../lib/directives.js";
|
5
|
+
import { svgArrow, svgDelta, svgLink } from "../lib/icons.js";
|
6
|
+
import { GodownElement } from "./godown-element.js";
|
7
|
+
let GodownSuperA = class GodownSuperA extends GodownElement {
|
8
|
+
constructor() {
|
9
|
+
super(...arguments);
|
10
|
+
/**
|
11
|
+
* True when the href is in the same pathname as the location.
|
12
|
+
*/
|
13
|
+
this.active = false;
|
14
|
+
/**
|
15
|
+
* Href for a element.
|
16
|
+
*/
|
17
|
+
this.href = undefined;
|
18
|
+
/**
|
19
|
+
* Target for an element.
|
20
|
+
*/
|
21
|
+
this.target = "_self";
|
22
|
+
/**
|
23
|
+
* Arrow type.
|
24
|
+
*/
|
25
|
+
this.arrow = "";
|
26
|
+
}
|
27
|
+
render() {
|
28
|
+
return html `<a part="root" href="${ifDefined(this.href)}" target="${this.target}" @click=${this._handleClick}>
|
29
|
+
${htmlSlot()}
|
30
|
+
<i part="arrow">${this._arrowSwitcher()}</i>
|
31
|
+
</a>`;
|
32
|
+
}
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
34
|
+
_handleClick(_) { }
|
35
|
+
_arrowSwitcher() {
|
36
|
+
switch (this.arrow) {
|
37
|
+
case "delta":
|
38
|
+
return svgDelta();
|
39
|
+
case "arrow":
|
40
|
+
return svgArrow(true);
|
41
|
+
case "angle":
|
42
|
+
return svgArrow();
|
43
|
+
case "link":
|
44
|
+
return svgLink();
|
45
|
+
default:
|
46
|
+
return htmlSlot("icon");
|
47
|
+
}
|
48
|
+
}
|
49
|
+
connectedCallback() {
|
50
|
+
super.connectedCallback();
|
51
|
+
this.useActive();
|
52
|
+
}
|
53
|
+
useActive() {
|
54
|
+
const url = new URL(this.href, location.href);
|
55
|
+
const sameOrigin = url.origin === location.origin;
|
56
|
+
if (sameOrigin) {
|
57
|
+
this.active = url.pathname === location.pathname;
|
58
|
+
}
|
59
|
+
return {
|
60
|
+
url,
|
61
|
+
sameOrigin,
|
62
|
+
active: this.active,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
};
|
66
|
+
__decorate([
|
67
|
+
property({ type: Boolean, reflect: true })
|
68
|
+
], GodownSuperA.prototype, "active", void 0);
|
69
|
+
__decorate([
|
70
|
+
property()
|
71
|
+
], GodownSuperA.prototype, "href", void 0);
|
72
|
+
__decorate([
|
73
|
+
property()
|
74
|
+
], GodownSuperA.prototype, "target", void 0);
|
75
|
+
__decorate([
|
76
|
+
property()
|
77
|
+
], GodownSuperA.prototype, "arrow", void 0);
|
78
|
+
GodownSuperA = __decorate([
|
79
|
+
styles([
|
80
|
+
css `
|
81
|
+
:host([arrow="delta"]) svg {
|
82
|
+
transform: rotate(-90deg);
|
83
|
+
}
|
84
|
+
|
85
|
+
:host {
|
86
|
+
display: inline-block;
|
87
|
+
color: currentColor;
|
88
|
+
text-decoration: none;
|
89
|
+
cursor: default;
|
90
|
+
}
|
91
|
+
|
92
|
+
:host([href]) {
|
93
|
+
cursor: pointer;
|
94
|
+
}
|
95
|
+
|
96
|
+
a {
|
97
|
+
width: 100%;
|
98
|
+
display: flex;
|
99
|
+
color: inherit;
|
100
|
+
text-decoration: inherit;
|
101
|
+
justify-content: space-between;
|
102
|
+
align-items: center;
|
103
|
+
}
|
104
|
+
|
105
|
+
i {
|
106
|
+
display: inline-flex;
|
107
|
+
border-radius: 20%;
|
108
|
+
font-style: normal;
|
109
|
+
}
|
110
|
+
|
111
|
+
i > svg {
|
112
|
+
width: 1em;
|
113
|
+
height: 1em;
|
114
|
+
border-radius: inherit;
|
115
|
+
}
|
116
|
+
|
117
|
+
:host(:hover) i {
|
118
|
+
animation: arrow 0.3s linear;
|
119
|
+
}
|
120
|
+
|
121
|
+
i:hover {
|
122
|
+
background-color: rgb(0 0 0 / 0.075);
|
123
|
+
}
|
124
|
+
|
125
|
+
@keyframes arrow {
|
126
|
+
from {
|
127
|
+
transform: translateX(0);
|
128
|
+
}
|
129
|
+
50% {
|
130
|
+
transform: translateX(0.05em);
|
131
|
+
}
|
132
|
+
to {
|
133
|
+
transform: translateX(0);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
`,
|
137
|
+
])
|
138
|
+
], GodownSuperA);
|
139
|
+
export { GodownSuperA };
|
140
|
+
export default GodownSuperA;
|
141
|
+
//# sourceMappingURL=super-a.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-a.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-a.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA6D7C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,aAAa;IAAxC;;QACL;;WAEG;QACyC,WAAM,GAAG,KAAK,CAAC;QAC3D;;WAEG;QACS,SAAI,GAAW,SAAS,CAAC;QACrC;;WAEG;QACS,WAAM,GAA4C,OAAO,CAAC;QACtE;;WAEG;QACS,UAAK,GAA8C,EAAE,CAAC;IA2CpE,CAAC;IAzCW,MAAM;QACd,OAAO,IAAI,CAAA,wBAAwB,SAAS,CAAC,IAAI,CAAC,IAAI,C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AY;IA3DxB,MAAM,CAAC;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDF;KACF,CAAC;GACW,YAAY,CA2DxB;;AAED,eAAe,YAAY,CAAC","sourcesContent":["import { css, html, ifDefined, property } from \"../_deps.js\";\nimport { styles } from \"../decorators/styles.js\";\nimport { htmlSlot } from \"../lib/directives.js\";\nimport { svgArrow, svgDelta, svgLink } from \"../lib/icons.js\";\nimport { GodownElement } from \"./godown-element.js\";\n\n@styles([\n css`\n :host([arrow=\"delta\"]) svg {\n transform: rotate(-90deg);\n }\n\n :host {\n display: inline-block;\n color: currentColor;\n text-decoration: none;\n cursor: default;\n }\n\n :host([href]) {\n cursor: pointer;\n }\n\n a {\n width: 100%;\n display: flex;\n color: inherit;\n text-decoration: inherit;\n justify-content: space-between;\n align-items: center;\n }\n\n i {\n display: inline-flex;\n border-radius: 20%;\n font-style: normal;\n }\n\n i > svg {\n width: 1em;\n height: 1em;\n border-radius: inherit;\n }\n\n :host(:hover) i {\n animation: arrow 0.3s linear;\n }\n\n i:hover {\n background-color: rgb(0 0 0 / 0.075);\n }\n\n @keyframes arrow {\n from {\n transform: translateX(0);\n }\n 50% {\n transform: translateX(0.05em);\n }\n to {\n transform: translateX(0);\n }\n }\n `,\n])\nexport class GodownSuperA extends GodownElement {\n /**\n * True when the href is in the same pathname as the location.\n */\n @property({ type: Boolean, reflect: true }) active = false;\n /**\n * Href for a element.\n */\n @property() href: string = undefined;\n /**\n * Target for an element.\n */\n @property() target: \"_blank\" | \"_self\" | \"_parent\" | \"_top\" = \"_self\";\n /**\n * Arrow type.\n */\n @property() arrow: \"\" | \"link\" | \"delta\" | \"arrow\" | \"angle\" = \"\";\n\n protected render() {\n return html`<a part=\"root\" href=\"${ifDefined(this.href)}\" target=\"${this.target}\" @click=${this._handleClick}>\n ${htmlSlot()}\n <i part=\"arrow\">${this._arrowSwitcher()}</i>\n </a>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function\n protected _handleClick(_: MouseEvent) {}\n\n private _arrowSwitcher() {\n switch (this.arrow) {\n case \"delta\":\n return svgDelta();\n case \"arrow\":\n return svgArrow(true);\n case \"angle\":\n return svgArrow();\n case \"link\":\n return svgLink();\n default:\n return htmlSlot(\"icon\");\n }\n }\n connectedCallback(): void {\n super.connectedCallback();\n this.useActive();\n }\n\n useActive() {\n const url = new URL(this.href, location.href);\n const sameOrigin = url.origin === location.origin;\n if (sameOrigin) {\n this.active = url.pathname === location.pathname;\n }\n return {\n url,\n sameOrigin,\n active: this.active,\n };\n }\n}\n\nexport default GodownSuperA;\n"]}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import type { HTMLEvent } from "./godown-element.js";
|
2
|
+
import { GodownElement } from "./godown-element.js";
|
3
|
+
export declare class GodownSuperInput extends GodownElement {
|
4
|
+
autofocus: boolean;
|
5
|
+
type: InputType;
|
6
|
+
placeholder: string;
|
7
|
+
label: string;
|
8
|
+
name: string;
|
9
|
+
autocomplete: string;
|
10
|
+
value: any;
|
11
|
+
default: any;
|
12
|
+
_input: HTMLInputElement;
|
13
|
+
compositing: boolean;
|
14
|
+
set defaultValue(value: typeof this.default);
|
15
|
+
get defaultValue(): typeof this.default;
|
16
|
+
makeId: string;
|
17
|
+
namevalue(): [string, any];
|
18
|
+
nameValue: () => [string, any];
|
19
|
+
reset(): void;
|
20
|
+
protected _handleInput(e: HTMLEvent<HTMLInputElement>): void;
|
21
|
+
connectedCallback(): void;
|
22
|
+
_connectedInit(): void;
|
23
|
+
protected _compositionInit(): void;
|
24
|
+
protected _changeInputType(t: InputType): void;
|
25
|
+
focus(options?: FocusOptions): void;
|
26
|
+
protected firstUpdated(): void;
|
27
|
+
protected targetValue(e: Event): string | any;
|
28
|
+
protected _renderSuffix(): import("lit").TemplateResult<1>;
|
29
|
+
/**
|
30
|
+
* @deprecated
|
31
|
+
*/
|
32
|
+
pla: string;
|
33
|
+
/**
|
34
|
+
* @deprecated
|
35
|
+
*/
|
36
|
+
def: string;
|
37
|
+
/**
|
38
|
+
* @deprecated
|
39
|
+
*/
|
40
|
+
compositionCheck: boolean;
|
41
|
+
}
|
42
|
+
export default GodownSuperInput;
|
43
|
+
export type InputType = "hidden" | "text" | "search" | "tel" | "url" | "email" | "password" | "datetime" | "date" | "month" | "week" | "time" | "datetime-local" | "number" | "range" | "color" | "checkbox" | "radio" | "file" | "image";
|
44
|
+
//# sourceMappingURL=super-input.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-input.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,qBAAa,gBAAiB,SAAQ,aAAa;IACL,SAAS,EAAE,OAAO,CAAC;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IAEV,MAAM,EAAE,gBAAgB,CAAC;IAExC,WAAW,EAAE,OAAO,CAAC;IAErB,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,OAAO,EAE1C;IAED,IAAI,YAAY,IAJQ,OAAO,IAAI,CAAC,OAAO,CAM1C;IAED,MAAM,SAAuC;IAE7C,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1B,SAAS,QAJI,CAAC,MAAM,EAAE,GAAG,CAAC,CAIC;IAE3B,KAAK;IAKL,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC;IAUrD,iBAAiB;IAIjB,cAAc;IAKd,SAAS,CAAC,gBAAgB;IAY1B,SAAS,CAAC,gBAAgB,CAAC,CAAC,EAAE,SAAS;IAIvC,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,SAAS,CAAC,YAAY;IAItB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,GAAG;IAQ7C,SAAS,CAAC,aAAa;IAqBvB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAe,gBAAgB,CAAC;AAChC,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,KAAK,GACL,KAAK,GACL,OAAO,GACP,UAAU,GACV,UAAU,GACV,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,QAAQ,GACR,OAAO,GACP,OAAO,GACP,UAAU,GACV,OAAO,GACP,MAAM,GACN,OAAO,CAAC"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { html, property } from "../_deps.js";
|
3
|
+
import { part } from "../decorators/part.js";
|
4
|
+
import { svgEye } from "../lib/icons.js";
|
5
|
+
import { GodownElement } from "./godown-element.js";
|
6
|
+
const PASSWORD = "password";
|
7
|
+
export class GodownSuperInput extends GodownElement {
|
8
|
+
constructor() {
|
9
|
+
super(...arguments);
|
10
|
+
this.makeId = Math.random().toString(36).slice(1);
|
11
|
+
this.nameValue = this.namevalue;
|
12
|
+
}
|
13
|
+
set defaultValue(value) {
|
14
|
+
this.default = value;
|
15
|
+
}
|
16
|
+
get defaultValue() {
|
17
|
+
return this.default;
|
18
|
+
}
|
19
|
+
namevalue() {
|
20
|
+
return [this.name, this.value];
|
21
|
+
}
|
22
|
+
reset() {
|
23
|
+
this.value = this.default;
|
24
|
+
this._input.value = this.default;
|
25
|
+
}
|
26
|
+
_handleInput(e) {
|
27
|
+
e.stopPropagation();
|
28
|
+
if (this.compositing) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
this.value = e.target.value?.trim();
|
32
|
+
this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
|
33
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
34
|
+
}
|
35
|
+
connectedCallback() {
|
36
|
+
super.connectedCallback();
|
37
|
+
this._connectedInit();
|
38
|
+
}
|
39
|
+
_connectedInit() {
|
40
|
+
this.default ??= this.value || "";
|
41
|
+
this.value ??= this.default;
|
42
|
+
}
|
43
|
+
_compositionInit() {
|
44
|
+
if (this._input) {
|
45
|
+
this.addEvent(this._input, "compositionstart", () => {
|
46
|
+
this.compositing = true;
|
47
|
+
});
|
48
|
+
this.addEvent(this._input, "compositionend", (e) => {
|
49
|
+
this.compositing = false;
|
50
|
+
this._handleInput(e);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
}
|
54
|
+
_changeInputType(t) {
|
55
|
+
this._input.type = t;
|
56
|
+
}
|
57
|
+
focus(options) {
|
58
|
+
this._input?.focus(options);
|
59
|
+
}
|
60
|
+
firstUpdated() {
|
61
|
+
this._compositionInit();
|
62
|
+
}
|
63
|
+
targetValue(e) {
|
64
|
+
const target = e.target;
|
65
|
+
if (typeof target.value === "string") {
|
66
|
+
return target.value.trim();
|
67
|
+
}
|
68
|
+
return target.value;
|
69
|
+
}
|
70
|
+
_renderSuffix() {
|
71
|
+
if (this.type === PASSWORD) {
|
72
|
+
return html `
|
73
|
+
<label for=${this.makeId} part="label">
|
74
|
+
<i
|
75
|
+
part="icon"
|
76
|
+
@mousedown="${() => this._changeInputType("text")}"
|
77
|
+
@mouseup="${() => {
|
78
|
+
this._changeInputType(PASSWORD);
|
79
|
+
}}"
|
80
|
+
@mouseleave="${() => {
|
81
|
+
this._changeInputType(PASSWORD);
|
82
|
+
}}"
|
83
|
+
>
|
84
|
+
${svgEye()}
|
85
|
+
</i>
|
86
|
+
</label>
|
87
|
+
`;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
__decorate([
|
92
|
+
property({ type: Boolean, reflect: true })
|
93
|
+
], GodownSuperInput.prototype, "autofocus", void 0);
|
94
|
+
__decorate([
|
95
|
+
property({ reflect: true })
|
96
|
+
], GodownSuperInput.prototype, "type", void 0);
|
97
|
+
__decorate([
|
98
|
+
property({ reflect: true })
|
99
|
+
], GodownSuperInput.prototype, "placeholder", void 0);
|
100
|
+
__decorate([
|
101
|
+
property({ reflect: true })
|
102
|
+
], GodownSuperInput.prototype, "label", void 0);
|
103
|
+
__decorate([
|
104
|
+
property({ reflect: true })
|
105
|
+
], GodownSuperInput.prototype, "name", void 0);
|
106
|
+
__decorate([
|
107
|
+
property()
|
108
|
+
], GodownSuperInput.prototype, "autocomplete", void 0);
|
109
|
+
__decorate([
|
110
|
+
property()
|
111
|
+
], GodownSuperInput.prototype, "value", void 0);
|
112
|
+
__decorate([
|
113
|
+
property()
|
114
|
+
], GodownSuperInput.prototype, "default", void 0);
|
115
|
+
__decorate([
|
116
|
+
part("input")
|
117
|
+
], GodownSuperInput.prototype, "_input", void 0);
|
118
|
+
export default GodownSuperInput;
|
119
|
+
//# sourceMappingURL=super-input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAAn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;wBACrC,GAAG,EAAE;gBACf,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;2BACc,GAAG,EAAE;gBAClB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;;cAEC,MAAM,EAAE;;;OAGf,CAAC;QACJ,CAAC;IACH,CAAC;CAcF;AAtH6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAAoB;AAClC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAiB;AAChB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDAAqB;AACpB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAe;AACd;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAc;AAC9B;IAAX,QAAQ,EAAE;sDAAsB;AACrB;IAAX,QAAQ,EAAE;+CAAY;AACX;IAAX,QAAQ,EAAE;iDAAc;AAEV;IAAd,IAAI,CAAC,OAAO,CAAC;gDAA0B;AA+G1C,eAAe,gBAAgB,CAAC","sourcesContent":["import { html, property } from \"../_deps.js\";\nimport { part } from \"../decorators/part.js\";\nimport { svgEye } from \"../lib/icons.js\";\nimport type { HTMLEvent } from \"./godown-element.js\";\nimport { GodownElement } from \"./godown-element.js\";\n\nconst PASSWORD = \"password\";\n\nexport class GodownSuperInput extends GodownElement {\n @property({ type: Boolean, reflect: true }) autofocus: boolean;\n @property({ reflect: true }) type: InputType;\n @property({ reflect: true }) placeholder: string;\n @property({ reflect: true }) label: string;\n @property({ reflect: true }) name: string;\n @property() autocomplete: string;\n @property() value: any;\n @property() default: any;\n\n @part(\"input\") _input: HTMLInputElement;\n\n compositing: boolean;\n\n set defaultValue(value: typeof this.default) {\n this.default = value;\n }\n\n get defaultValue() {\n return this.default;\n }\n\n makeId = Math.random().toString(36).slice(1);\n\n namevalue(): [string, any] {\n return [this.name, this.value];\n }\n\n nameValue = this.namevalue;\n\n reset() {\n this.value = this.default;\n this._input.value = this.default;\n }\n\n protected _handleInput(e: HTMLEvent<HTMLInputElement>) {\n e.stopPropagation();\n if (this.compositing) {\n return;\n }\n this.value = e.target.value?.trim();\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._connectedInit();\n }\n _connectedInit() {\n this.default ??= this.value || \"\";\n this.value ??= this.default;\n }\n\n protected _compositionInit() {\n if (this._input) {\n this.addEvent(this._input, \"compositionstart\", () => {\n this.compositing = true;\n });\n this.addEvent(this._input, \"compositionend\", (e: HTMLEvent<HTMLInputElement>) => {\n this.compositing = false;\n this._handleInput(e);\n });\n }\n }\n\n protected _changeInputType(t: InputType) {\n this._input.type = t;\n }\n\n focus(options?: FocusOptions) {\n this._input?.focus(options);\n }\n\n protected firstUpdated() {\n this._compositionInit();\n }\n\n protected targetValue(e: Event): string | any {\n const target = e.target as HTMLInputElement;\n if (typeof target.value === \"string\") {\n return target.value.trim();\n }\n return target.value;\n }\n\n protected _renderSuffix() {\n if (this.type === PASSWORD) {\n return html`\n <label for=${this.makeId} part=\"label\">\n <i\n part=\"icon\"\n @mousedown=\"${() => this._changeInputType(\"text\")}\"\n @mouseup=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n @mouseleave=\"${() => {\n this._changeInputType(PASSWORD);\n }}\"\n >\n ${svgEye()}\n </i>\n </label>\n `;\n }\n }\n\n /**\n * @deprecated\n */\n pla: string;\n /**\n * @deprecated\n */\n def: string;\n /**\n * @deprecated\n */\n compositionCheck: boolean;\n}\n\nexport default GodownSuperInput;\nexport type InputType =\n | \"hidden\"\n | \"text\"\n | \"search\"\n | \"tel\"\n | \"url\"\n | \"email\"\n | \"password\"\n | \"datetime\"\n | \"date\"\n | \"month\"\n | \"week\"\n | \"time\"\n | \"datetime-local\"\n | \"number\"\n | \"range\"\n | \"color\"\n | \"checkbox\"\n | \"radio\"\n | \"file\"\n | \"image\";\n"]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { type PropertyValueMap } from "../_deps.js";
|
2
|
+
import { GodownElement } from "./godown-element.js";
|
3
|
+
export declare class GodownSuperOpenable extends GodownElement {
|
4
|
+
/**
|
5
|
+
* Make the content float.
|
6
|
+
*/
|
7
|
+
float: boolean;
|
8
|
+
/**
|
9
|
+
* Open the content.
|
10
|
+
*/
|
11
|
+
open: boolean;
|
12
|
+
toggle(to?: boolean): void;
|
13
|
+
close(): void;
|
14
|
+
show(): void;
|
15
|
+
protected updated(changedProperties: PropertyValueMap<this>): void;
|
16
|
+
protected _handelClick(_: MouseEvent): void;
|
17
|
+
}
|
18
|
+
export default GodownSuperOpenable;
|
19
|
+
export type Direction4 = "left" | "right" | "top" | "bottom";
|
20
|
+
export type Direction5 = Direction4 | "center";
|
21
|
+
export type Direction8 = Direction4 | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
22
|
+
export type Direction9 = Direction8 | Direction5;
|
23
|
+
//# sourceMappingURL=super-openable.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-openable.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-openable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,mBAAoB,SAAQ,aAAa;IACpD;;OAEG;IACyC,KAAK,UAAS;IAC1D;;OAEG;IACyC,IAAI,UAAS;IAEzD,MAAM,CAAC,EAAE,UAAa;IAItB,KAAK;IAIL,IAAI;IAIJ,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAQ3D,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU;CAGrC;AAED,eAAe,mBAAmB,CAAC;AAEnC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { property } from "../_deps.js";
|
3
|
+
import { GodownElement } from "./godown-element.js";
|
4
|
+
export class GodownSuperOpenable extends GodownElement {
|
5
|
+
constructor() {
|
6
|
+
super(...arguments);
|
7
|
+
/**
|
8
|
+
* Make the content float.
|
9
|
+
*/
|
10
|
+
this.float = false;
|
11
|
+
/**
|
12
|
+
* Open the content.
|
13
|
+
*/
|
14
|
+
this.open = false;
|
15
|
+
}
|
16
|
+
toggle(to = !this.open) {
|
17
|
+
this.open = to;
|
18
|
+
}
|
19
|
+
close() {
|
20
|
+
this.open = false;
|
21
|
+
}
|
22
|
+
show() {
|
23
|
+
this.open = true;
|
24
|
+
}
|
25
|
+
updated(changedProperties) {
|
26
|
+
const open = changedProperties.get("open");
|
27
|
+
if (open !== undefined) {
|
28
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.open }));
|
29
|
+
}
|
30
|
+
}
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
32
|
+
_handelClick(_) {
|
33
|
+
this.toggle();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
__decorate([
|
37
|
+
property({ type: Boolean, reflect: true })
|
38
|
+
], GodownSuperOpenable.prototype, "float", void 0);
|
39
|
+
__decorate([
|
40
|
+
property({ type: Boolean, reflect: true })
|
41
|
+
], GodownSuperOpenable.prototype, "open", void 0);
|
42
|
+
export default GodownSuperOpenable;
|
43
|
+
//# sourceMappingURL=super-openable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"super-openable.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["proto/super-openable.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAAtD;;QACE;;WAEG;QACyC,UAAK,GAAG,KAAK,CAAC;QAC1D;;WAEG;QACyC,SAAI,GAAG,KAAK,CAAC;IAyB3D,CAAC;IAvBC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;QACpB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAES,OAAO,CAAC,iBAAyC;QACzD,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,6DAA6D;IACnD,YAAY,CAAC,CAAa;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF;AA7B6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAe;AAId;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAAc;AA2B3D,eAAe,mBAAmB,CAAC","sourcesContent":["import { property, type PropertyValueMap } from \"../_deps.js\";\nimport { GodownElement } from \"./godown-element.js\";\n\nexport class GodownSuperOpenable extends GodownElement {\n /**\n * Make the content float.\n */\n @property({ type: Boolean, reflect: true }) float = false;\n /**\n * Open the content.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n toggle(to = !this.open) {\n this.open = to;\n }\n\n close() {\n this.open = false;\n }\n\n show() {\n this.open = true;\n }\n\n protected updated(changedProperties: PropertyValueMap<this>) {\n const open = changedProperties.get(\"open\");\n if (open !== undefined) {\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.open }));\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected _handelClick(_: MouseEvent) {\n this.toggle();\n }\n}\n\nexport default GodownSuperOpenable;\n\nexport type Direction4 = \"left\" | \"right\" | \"top\" | \"bottom\";\n\nexport type Direction5 = Direction4 | \"center\";\n\nexport type Direction8 = Direction4 | \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n\nexport type Direction9 = Direction8 | Direction5;\n"]}
|
package/range-input.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import RangeInput from "./web-components/input/range-input.js";
|
2
|
+
export default RangeInput;
|
3
|
+
export * from "./web-components/input/range-input.js";
|
4
|
+
declare global {
|
5
|
+
interface HTMLElementTagNameMap {
|
6
|
+
"g-range-input": RangeInput;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=range-input.d.ts.map
|