godown 2.7.4 → 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 +20 -25
- 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 +1 @@
|
|
1
|
-
{"version":3,"file":"label-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"label-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;;;;;;GAOG;AACH,qBA+Ca,UAAW,SAAQ,WAAW;IAC7B,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IAEvD,SAAS,CAAC,MAAM;CAkBjB;AAED,eAAe,UAAU,CAAC"}
|
@@ -1,162 +1,95 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { css, html, property
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
justify-content: flex-start;
|
11
|
-
flex-direction: column;
|
12
|
-
align-items: inherit;
|
13
|
-
width: fit-content;
|
14
|
-
}
|
15
|
-
:host {
|
16
|
-
width: var(${cssvarValues.input}--width);
|
17
|
-
margin: auto;
|
18
|
-
}
|
19
|
-
`;
|
20
|
-
const styleNoLabel = css `
|
21
|
-
:host {
|
22
|
-
width: var(${cssvarValues.input}--width);
|
23
|
-
}
|
24
|
-
`;
|
25
|
-
const styleWithLabel = css `
|
26
|
-
:host {
|
27
|
-
width: calc(var(${cssvarValues.input}--width) * 2);
|
28
|
-
}
|
29
|
-
`;
|
30
|
-
const defineName = "label-input";
|
2
|
+
import { css, html, property } from "../../_deps.js";
|
3
|
+
import { godown } from "../../decorators/godown.js";
|
4
|
+
import { styles } from "../../decorators/styles.js";
|
5
|
+
import { combine, htmlSlot } from "../../lib/directives.js";
|
6
|
+
import GodownInput from "../../proto/super-input.js";
|
7
|
+
import { cssGlobalVars } from "../../styles/global.js";
|
8
|
+
import { fieldStyle, inputStyle } from "../../styles/inputStyle.js";
|
9
|
+
const protoName = "label-input";
|
31
10
|
/**
|
32
11
|
* {@linkcode LabelInput } renders label and input.
|
33
12
|
*
|
34
13
|
* When there is a label, the layout will be adjusted according to the width of the screen.
|
35
14
|
*
|
36
|
-
* Otherwise it behaves similarly to the `
|
15
|
+
* Otherwise it behaves similarly to the `Input`.
|
16
|
+
*
|
37
17
|
*/
|
38
18
|
let LabelInput = class LabelInput extends GodownInput {
|
39
19
|
constructor() {
|
40
20
|
super(...arguments);
|
41
|
-
|
42
|
-
* Conditions for adjust layout.
|
43
|
-
*/
|
44
|
-
this.mobile = "540px";
|
21
|
+
this.variant = "default";
|
45
22
|
}
|
46
23
|
render() {
|
47
|
-
const
|
48
|
-
|
49
|
-
<
|
50
|
-
${this.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
${
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
}
|
64
|
-
renderSuf() {
|
65
|
-
if (this.type === PASSWORD) {
|
66
|
-
return html `<i
|
67
|
-
@mousedown="${this._passwordSwitcher}"
|
68
|
-
@mouseup="${() => {
|
69
|
-
this._changeInputType(PASSWORD);
|
70
|
-
}}"
|
71
|
-
@mouseleave="${() => {
|
72
|
-
this._changeInputType(PASSWORD);
|
73
|
-
}}"
|
74
|
-
>
|
75
|
-
${htmlSlot("suf", svgEye(), this)}
|
76
|
-
</i>`;
|
77
|
-
}
|
78
|
-
else {
|
79
|
-
return html `<i>${htmlSlot("suf")}</i>`;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
_passwordSwitcher() {
|
83
|
-
if (this._input.type === PASSWORD) {
|
84
|
-
this._changeInputType("text");
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
this._changeInputType(PASSWORD);
|
88
|
-
}
|
24
|
+
const { makeId: htmlFor } = this;
|
25
|
+
return html `<label for="${htmlFor}" part="label">
|
26
|
+
<span part="label">${this.label}${htmlSlot()}</span>
|
27
|
+
<div class="${combine({ "input-field": true, outline: this.variant === "outline" })}">
|
28
|
+
<input
|
29
|
+
part="input"
|
30
|
+
id="${htmlFor}"
|
31
|
+
type="${this.type}"
|
32
|
+
?autofocus="${this.autofocus}"
|
33
|
+
placeholder="${this.placeholder}"
|
34
|
+
class="${this.type}"
|
35
|
+
@input="${this._handleInput}"
|
36
|
+
/>
|
37
|
+
${this._renderSuffix()}
|
38
|
+
</div>
|
39
|
+
</label>`;
|
89
40
|
}
|
90
41
|
};
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
white-space: nowrap;
|
112
|
-
}
|
113
|
-
|
114
|
-
input {
|
115
|
-
padding: 0 0.25em;
|
116
|
-
background-color: transparent;
|
117
|
-
border-radius: inherit;
|
118
|
-
flex: 1;
|
119
|
-
width: 100%;
|
120
|
-
height: inherit;
|
121
|
-
}
|
42
|
+
__decorate([
|
43
|
+
property()
|
44
|
+
], LabelInput.prototype, "variant", void 0);
|
45
|
+
LabelInput = __decorate([
|
46
|
+
godown(protoName),
|
47
|
+
styles([
|
48
|
+
inputStyle,
|
49
|
+
fieldStyle,
|
50
|
+
css `
|
51
|
+
:host {
|
52
|
+
--${cssGlobalVars.input}--label-width: var(--${cssGlobalVars.input}--width);
|
53
|
+
width: calc(var(--${cssGlobalVars.input}--width) + var(--${cssGlobalVars.input}--label-width));
|
54
|
+
height: var(--${cssGlobalVars.input}--height);
|
55
|
+
margin: var(--${cssGlobalVars.input}--outline-width);
|
56
|
+
border-radius: var(--${cssGlobalVars.input}--radius);
|
57
|
+
margin: var(--${cssGlobalVars.input}--outline-width);
|
58
|
+
border-radius: var(--${cssGlobalVars.input}--radius);
|
59
|
+
justify-content: space-between;
|
60
|
+
display: flex;
|
61
|
+
}
|
122
62
|
|
123
|
-
|
124
|
-
|
125
|
-
}
|
63
|
+
div {
|
64
|
+
height: inherit;
|
65
|
+
width: var(--${cssGlobalVars.input}--width);
|
66
|
+
}
|
126
67
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
}
|
68
|
+
label {
|
69
|
+
display: contents;
|
70
|
+
border-radius: inherit;
|
71
|
+
height: inherit;
|
72
|
+
}
|
133
73
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
74
|
+
span {
|
75
|
+
flex: 1;
|
76
|
+
white-space: nowrap;
|
77
|
+
width: var(--${cssGlobalVars.input}--width);
|
78
|
+
}
|
139
79
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
property()
|
154
|
-
], LabelInput.prototype, "mobile", void 0);
|
155
|
-
__decorate([
|
156
|
-
query("input")
|
157
|
-
], LabelInput.prototype, "_input", void 0);
|
158
|
-
LabelInput = __decorate([
|
159
|
-
define(defineName)
|
80
|
+
input {
|
81
|
+
flex: 1;
|
82
|
+
width: 100%;
|
83
|
+
height: inherit;
|
84
|
+
background: transparent;
|
85
|
+
border-radius: inherit;
|
86
|
+
color: var(--${cssGlobalVars.foreground});
|
87
|
+
}
|
88
|
+
.input-field {
|
89
|
+
background: var(--${cssGlobalVars.input}--background);
|
90
|
+
}
|
91
|
+
`,
|
92
|
+
])
|
160
93
|
], LabelInput);
|
161
94
|
export { LabelInput };
|
162
95
|
export default LabelInput;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,
|
1
|
+
{"version":3,"file":"label-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/label-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,SAAS,GAAG,aAAa,CAAC;AAEhC;;;;;;;GAOG;AAgDI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAApC;;QACO,YAAO,GAA0B,SAAS,CAAC;IAoBzD,CAAC;IAlBW,MAAM;QACd,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAA,eAAe,OAAO;2BACV,IAAI,CAAC,KAAK,GAAG,QAAQ,EAAE;oBAC9B,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;;;gBAGzE,OAAO;kBACL,IAAI,CAAC,IAAI;wBACH,IAAI,CAAC,SAAS;yBACb,IAAI,CAAC,WAAW;mBACtB,IAAI,CAAC,IAAI;oBACR,IAAI,CAAC,YAAY;;UAE3B,IAAI,CAAC,aAAa,EAAE;;aAEjB,CAAC;IACZ,CAAC;CACF,CAAA;AApBa;IAAX,QAAQ,EAAE;2CAA4C;AAD5C,UAAU;IA/CtB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,UAAU;QACV,UAAU;QACV,GAAG,CAAA;;UAEK,aAAa,CAAC,KAAK,wBAAwB,aAAa,CAAC,KAAK;0BAC9C,aAAa,CAAC,KAAK,oBAAoB,aAAa,CAAC,KAAK;sBAC9D,aAAa,CAAC,KAAK;sBACnB,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;sBAC1B,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;;;;;;;qBAO3B,aAAa,CAAC,KAAK;;;;;;;;;;;;qBAYnB,aAAa,CAAC,KAAK;;;;;;;;;qBASnB,aAAa,CAAC,UAAU;;;0BAGnB,aAAa,CAAC,KAAK;;GAE1C;KACF,CAAC;GACW,UAAU,CAqBtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine, htmlSlot } from \"../../lib/directives.js\";\nimport GodownInput from \"../../proto/super-input.js\";\nimport { cssGlobalVars } from \"../../styles/global.js\";\nimport { fieldStyle, inputStyle } from \"../../styles/inputStyle.js\";\n\nconst protoName = \"label-input\";\n\n/**\n * {@linkcode LabelInput } renders label and input.\n *\n * When there is a label, the layout will be adjusted according to the width of the screen.\n *\n * Otherwise it behaves similarly to the `Input`.\n *\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n --${cssGlobalVars.input}--label-width: var(--${cssGlobalVars.input}--width);\n width: calc(var(--${cssGlobalVars.input}--width) + var(--${cssGlobalVars.input}--label-width));\n height: var(--${cssGlobalVars.input}--height);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n justify-content: space-between;\n display: flex;\n }\n\n div {\n height: inherit;\n width: var(--${cssGlobalVars.input}--width);\n }\n\n label {\n display: contents;\n border-radius: inherit;\n height: inherit;\n }\n\n span {\n flex: 1;\n white-space: nowrap;\n width: var(--${cssGlobalVars.input}--width);\n }\n\n input {\n flex: 1;\n width: 100%;\n height: inherit;\n background: transparent;\n border-radius: inherit;\n color: var(--${cssGlobalVars.foreground});\n }\n .input-field {\n background: var(--${cssGlobalVars.input}--background);\n }\n `,\n])\nexport class LabelInput extends GodownInput {\n @property() variant: \"default\" | \"outline\" = \"default\";\n\n protected render() {\n const { makeId: htmlFor } = this;\n return html`<label for=\"${htmlFor}\" part=\"label\">\n <span part=\"label\">${this.label}${htmlSlot()}</span>\n <div class=\"${combine({ \"input-field\": true, outline: this.variant === \"outline\" })}\">\n <input\n part=\"input\"\n id=\"${htmlFor}\"\n type=\"${this.type}\"\n ?autofocus=\"${this.autofocus}\"\n placeholder=\"${this.placeholder}\"\n class=\"${this.type}\"\n @input=\"${this._handleInput}\"\n />\n ${this._renderSuffix()}\n </div>\n </label>`;\n }\n}\n\nexport default LabelInput;\n"]}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import GodownInput from "../../proto/super-input.js";
|
2
|
+
/**
|
3
|
+
* {@linkcode RangeInput }.
|
4
|
+
*/
|
5
|
+
export declare class RangeInput extends GodownInput {
|
6
|
+
/**
|
7
|
+
* Minimum value.
|
8
|
+
*/
|
9
|
+
min: number;
|
10
|
+
/**
|
11
|
+
* Maximum value.
|
12
|
+
*/
|
13
|
+
max: number;
|
14
|
+
/**
|
15
|
+
* Sliding step length.
|
16
|
+
*/
|
17
|
+
step: number;
|
18
|
+
/**
|
19
|
+
* Enable range sliding.
|
20
|
+
*/
|
21
|
+
range: boolean;
|
22
|
+
vertical: boolean;
|
23
|
+
/**
|
24
|
+
* When `this.range` is true, it should be [number, number], otherwise number.
|
25
|
+
*/
|
26
|
+
value: number | [number, number];
|
27
|
+
/**
|
28
|
+
* The default of `this.value`.
|
29
|
+
*/
|
30
|
+
default: number | [number, number];
|
31
|
+
_root: HTMLElement;
|
32
|
+
lastFocus: undefined | 1 | 2;
|
33
|
+
/**
|
34
|
+
* Returns true when the second number is greater than the first number
|
35
|
+
*/
|
36
|
+
get reverse(): boolean;
|
37
|
+
render(): import("lit").TemplateResult<1>;
|
38
|
+
_handleMousedownStart(e: MouseEvent): void;
|
39
|
+
_handleMousedownEnd(e: MouseEvent): void;
|
40
|
+
setStart(value: number): void;
|
41
|
+
setEnd(value: number): void;
|
42
|
+
_computeValue(e: MouseEvent): number;
|
43
|
+
_handleMousedownRoot(e: MouseEvent): void;
|
44
|
+
createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
|
45
|
+
createMousemoveListener(callback: (arg0: number) => void): (e: MouseEvent) => void;
|
46
|
+
_connectedInit(): void;
|
47
|
+
reset(): void;
|
48
|
+
swap(): void;
|
49
|
+
sort(): void;
|
50
|
+
toSorted(): number | [number, number];
|
51
|
+
}
|
52
|
+
export default RangeInput;
|
53
|
+
//# sourceMappingURL=range-input.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"range-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/range-input.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAOrD;;GAEG;AACH,qBAoHa,UAAW,SAAQ,WAAW;IACzC;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,IAAI,SAAK;IACrC;;OAEG;IACyC,KAAK,EAAE,OAAO,CAAC;IAEf,QAAQ,EAAE,OAAO,CAAC;IAE9D;;OAEG;IACwB,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5D;;OAEG;IACwB,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhD,KAAK,EAAE,WAAW,CAAC;IAEjC,SAAS,EAAE,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;IAE7B;;OAEG;IACH,IAAI,OAAO,YAEV;IAED,MAAM;IA6CN,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAGnC,mBAAmB,CAAC,CAAC,EAAE,UAAU;IAIjC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAMtB,MAAM,CAAC,KAAK,EAAE,MAAM;IAMpB,aAAa,CAAC,CAAC,EAAE,UAAU;IAY3B,oBAAoB,CAAC,CAAC,EAAE,UAAU;IAWlC,uBAAuB,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,OACpD,UAAU;IAavB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,OAC3C,UAAU;IASvB,cAAc;IAcd,KAAK;IAIL,IAAI;IAOJ,IAAI;IAIJ,QAAQ,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAOtC;AAED,eAAe,UAAU,CAAC"}
|
@@ -0,0 +1,316 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { css, html, property } from "../../_deps.js";
|
3
|
+
import { godown } from "../../decorators/godown.js";
|
4
|
+
import { part } from "../../decorators/part.js";
|
5
|
+
import { styles } from "../../decorators/styles.js";
|
6
|
+
import { combine, htmlSlot } from "../../lib/directives.js";
|
7
|
+
import { isNil, joinProperties, notNil } from "../../lib/utils.js";
|
8
|
+
import GodownInput from "../../proto/super-input.js";
|
9
|
+
import { createScope, cssGlobalVars } from "../../styles/global.js";
|
10
|
+
import { inputStyle } from "../../styles/inputStyle.js";
|
11
|
+
const protoName = "range-input";
|
12
|
+
const cssScope = createScope(protoName);
|
13
|
+
/**
|
14
|
+
* {@linkcode RangeInput }.
|
15
|
+
*/
|
16
|
+
let RangeInput = class RangeInput extends GodownInput {
|
17
|
+
constructor() {
|
18
|
+
super(...arguments);
|
19
|
+
/**
|
20
|
+
* Minimum value.
|
21
|
+
*/
|
22
|
+
this.min = 0;
|
23
|
+
/**
|
24
|
+
* Maximum value.
|
25
|
+
*/
|
26
|
+
this.max = 100;
|
27
|
+
/**
|
28
|
+
* Sliding step length.
|
29
|
+
*/
|
30
|
+
this.step = 1;
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Returns true when the second number is greater than the first number
|
34
|
+
*/
|
35
|
+
get reverse() {
|
36
|
+
return this.range ? this.value[0] > this.value[1] : false;
|
37
|
+
}
|
38
|
+
render() {
|
39
|
+
const [from, to] = (this.range ? this.value : [0, this.value]);
|
40
|
+
const gap = this.max - this.min;
|
41
|
+
const style = joinProperties({
|
42
|
+
"--start": `${((from - this.min) / gap) * 100}%`,
|
43
|
+
"--end": `${((to - this.min) / gap) * 100}%`,
|
44
|
+
});
|
45
|
+
return html `<div
|
46
|
+
part="root"
|
47
|
+
class="${combine({
|
48
|
+
vertical: this.vertical,
|
49
|
+
range: this.range,
|
50
|
+
reverse: this.reverse,
|
51
|
+
})}"
|
52
|
+
@mousedown="${this._handleMousedownRoot}"
|
53
|
+
style="${style}"
|
54
|
+
>
|
55
|
+
<div part="track"></div>
|
56
|
+
<i
|
57
|
+
part="handle"
|
58
|
+
class="${combine({
|
59
|
+
"last-focus": this.lastFocus === 1,
|
60
|
+
}, "start")}"
|
61
|
+
@mousedown="${this._handleMousedownStart}"
|
62
|
+
>
|
63
|
+
${htmlSlot("start")}
|
64
|
+
</i>
|
65
|
+
<i
|
66
|
+
part="handle"
|
67
|
+
class="${combine({
|
68
|
+
"last-focus": this.lastFocus === 2,
|
69
|
+
}, "end")}"
|
70
|
+
@mousedown="${this._handleMousedownEnd}"
|
71
|
+
>
|
72
|
+
${htmlSlot("end")}
|
73
|
+
</i>
|
74
|
+
</div>`;
|
75
|
+
}
|
76
|
+
_handleMousedownStart(e) {
|
77
|
+
this.createMousedownListener(this.setStart)(e);
|
78
|
+
}
|
79
|
+
_handleMousedownEnd(e) {
|
80
|
+
this.createMousedownListener(this.setEnd)(e);
|
81
|
+
}
|
82
|
+
setStart(value) {
|
83
|
+
this.lastFocus = 1;
|
84
|
+
const i = this.value[1];
|
85
|
+
this.value = this.range ? [value, i] : value;
|
86
|
+
}
|
87
|
+
setEnd(value) {
|
88
|
+
this.lastFocus = 2;
|
89
|
+
const i = this.value[0];
|
90
|
+
this.value = this.range ? [i, value] : value;
|
91
|
+
}
|
92
|
+
_computeValue(e) {
|
93
|
+
const rect = this._root.getBoundingClientRect();
|
94
|
+
const div = this.vertical ? (e.clientY - rect.top) / rect.height : (e.clientX - rect.left) / rect.width;
|
95
|
+
let value = Math.round((div * (this.max - this.min)) / this.step) * this.step;
|
96
|
+
if (value > this.max) {
|
97
|
+
value -= this.step;
|
98
|
+
}
|
99
|
+
else if (value < this.min) {
|
100
|
+
value += this.step;
|
101
|
+
}
|
102
|
+
return value;
|
103
|
+
}
|
104
|
+
_handleMousedownRoot(e) {
|
105
|
+
const value = this._computeValue(e);
|
106
|
+
if (!this.range || Math.abs(value - this.value[0]) > Math.abs(value - this.value[1])) {
|
107
|
+
this.setEnd(value);
|
108
|
+
this._handleMousedownEnd(e);
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
this.setStart(value);
|
112
|
+
this._handleMousedownStart(e);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
createMousedownListener(mouseMoveCallback) {
|
116
|
+
return (e) => {
|
117
|
+
e.preventDefault();
|
118
|
+
e.stopPropagation();
|
119
|
+
const move = this.createMousemoveListener(mouseMoveCallback);
|
120
|
+
document.addEventListener("mousemove", move);
|
121
|
+
const stop = () => {
|
122
|
+
document.removeEventListener("mousemove", move);
|
123
|
+
document.removeEventListener("mouseup", stop);
|
124
|
+
};
|
125
|
+
document.addEventListener("mouseup", stop);
|
126
|
+
};
|
127
|
+
}
|
128
|
+
createMousemoveListener(callback) {
|
129
|
+
return (e) => {
|
130
|
+
const value = this._computeValue(e);
|
131
|
+
if (value > this.max || value < this.min) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
callback?.call(this, value);
|
135
|
+
};
|
136
|
+
}
|
137
|
+
_connectedInit() {
|
138
|
+
const gap = this.max - this.min;
|
139
|
+
this.step ||= gap / 100;
|
140
|
+
if (notNil(this.default) && isNil(this.value)) {
|
141
|
+
this.value = this.default;
|
142
|
+
}
|
143
|
+
else if (isNil(this.default) && notNil(this.value)) {
|
144
|
+
this.default = this.value;
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
const mid = Math.round(gap / 2 / this.step) * this.step;
|
148
|
+
this.default = this.range ? [0, mid] : mid;
|
149
|
+
this.value = this.default;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
reset() {
|
153
|
+
this.value = this.default;
|
154
|
+
}
|
155
|
+
swap() {
|
156
|
+
if (this.range) {
|
157
|
+
const [a, b] = this.value;
|
158
|
+
this.value = [b, a];
|
159
|
+
}
|
160
|
+
}
|
161
|
+
sort() {
|
162
|
+
this.value = this.toSorted();
|
163
|
+
}
|
164
|
+
toSorted() {
|
165
|
+
if (this.range) {
|
166
|
+
const [a, b] = this.value;
|
167
|
+
return a > b ? [b, a] : [a, b];
|
168
|
+
}
|
169
|
+
return this.value;
|
170
|
+
}
|
171
|
+
};
|
172
|
+
__decorate([
|
173
|
+
property({ type: Number })
|
174
|
+
], RangeInput.prototype, "min", void 0);
|
175
|
+
__decorate([
|
176
|
+
property({ type: Number })
|
177
|
+
], RangeInput.prototype, "max", void 0);
|
178
|
+
__decorate([
|
179
|
+
property({ type: Number })
|
180
|
+
], RangeInput.prototype, "step", void 0);
|
181
|
+
__decorate([
|
182
|
+
property({ type: Boolean, reflect: true })
|
183
|
+
], RangeInput.prototype, "range", void 0);
|
184
|
+
__decorate([
|
185
|
+
property({ type: Boolean, reflect: true })
|
186
|
+
], RangeInput.prototype, "vertical", void 0);
|
187
|
+
__decorate([
|
188
|
+
property({ type: Array })
|
189
|
+
], RangeInput.prototype, "value", void 0);
|
190
|
+
__decorate([
|
191
|
+
property({ type: Array })
|
192
|
+
], RangeInput.prototype, "default", void 0);
|
193
|
+
__decorate([
|
194
|
+
part("root")
|
195
|
+
], RangeInput.prototype, "_root", void 0);
|
196
|
+
RangeInput = __decorate([
|
197
|
+
godown(protoName),
|
198
|
+
styles([
|
199
|
+
inputStyle,
|
200
|
+
css `
|
201
|
+
:host {
|
202
|
+
background: var(--${cssGlobalVars.input}--background);
|
203
|
+
margin: 0.25em var(--${cssGlobalVars.input}--outline-width);
|
204
|
+
border-radius: var(--${cssGlobalVars.input}--radius);
|
205
|
+
border-radius: var(--${cssGlobalVars.input}--radius);
|
206
|
+
--${cssScope}--handle-active: rgb(0 118 200);
|
207
|
+
--${cssScope}--track-width: .5em;
|
208
|
+
display: inline-block;
|
209
|
+
width: var(--${cssGlobalVars.input}--width);
|
210
|
+
}
|
211
|
+
|
212
|
+
:host([vertical]) {
|
213
|
+
height: var(--${cssGlobalVars.input}--width);
|
214
|
+
width: -moz-fit-content;
|
215
|
+
width: fit-content;
|
216
|
+
}
|
217
|
+
|
218
|
+
i:hover {
|
219
|
+
--${cssScope}--handle-scale:1.08;
|
220
|
+
}
|
221
|
+
|
222
|
+
i:active {
|
223
|
+
--${cssScope}--handle-scale:1.05;
|
224
|
+
background: var(--${cssScope}--handle-active);
|
225
|
+
}
|
226
|
+
|
227
|
+
.last-focus {
|
228
|
+
z-index: 2;
|
229
|
+
}
|
230
|
+
|
231
|
+
[part="root"] {
|
232
|
+
min-height:inherit;
|
233
|
+
position: relative;
|
234
|
+
border-radius: inherit;
|
235
|
+
width: 100%;
|
236
|
+
--start: 0%;
|
237
|
+
--end: 50%;
|
238
|
+
height: var(--${cssScope}--track-width);
|
239
|
+
}
|
240
|
+
|
241
|
+
[part="track"] {
|
242
|
+
min-height:inherit;
|
243
|
+
display: flex;
|
244
|
+
position: absolute;
|
245
|
+
pointer-events: none;
|
246
|
+
border-radius: inherit;
|
247
|
+
justify-content: space-between;
|
248
|
+
left: min(var(--start), var(--end));
|
249
|
+
background: var(--${cssGlobalVars.input}--true);
|
250
|
+
width: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));
|
251
|
+
}
|
252
|
+
|
253
|
+
[part=handle] {
|
254
|
+
width: 1em;
|
255
|
+
height: 1em;
|
256
|
+
display: flex;
|
257
|
+
align-items: center;
|
258
|
+
justify-content: center;
|
259
|
+
-webkit-user-select: none;
|
260
|
+
user-select: none;
|
261
|
+
position: absolute;
|
262
|
+
border: 0.1em solid;
|
263
|
+
border-radius: 50%;
|
264
|
+
transform-origin: 0% 25%;
|
265
|
+
transform: scale(var(--${cssScope}--handle-scale, 1)) translate(-50%, -25%);
|
266
|
+
background: var(--${cssGlobalVars.input}--true);
|
267
|
+
border-color: var(--${cssGlobalVars.input}--control);
|
268
|
+
}
|
269
|
+
`,
|
270
|
+
css `
|
271
|
+
.vertical {
|
272
|
+
height: 100%;
|
273
|
+
width: var(--${cssScope}--track-width);
|
274
|
+
}
|
275
|
+
|
276
|
+
.vertical i {
|
277
|
+
transform: translate(-25%, -50%);
|
278
|
+
}
|
279
|
+
|
280
|
+
.vertical [part="track"] {
|
281
|
+
width: 100%;
|
282
|
+
height: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));
|
283
|
+
top: min(var(--start), var(--end));
|
284
|
+
left: 0;
|
285
|
+
}
|
286
|
+
`,
|
287
|
+
css `
|
288
|
+
:host(:not([range])) .start {
|
289
|
+
visibility: hidden;
|
290
|
+
}
|
291
|
+
|
292
|
+
.start {
|
293
|
+
left: var(--start);
|
294
|
+
top: 0;
|
295
|
+
}
|
296
|
+
|
297
|
+
.end {
|
298
|
+
left: var(--end);
|
299
|
+
top: 0;
|
300
|
+
}
|
301
|
+
|
302
|
+
.vertical .start {
|
303
|
+
top: var(--start);
|
304
|
+
left: 0;
|
305
|
+
}
|
306
|
+
|
307
|
+
.vertical .end {
|
308
|
+
top: var(--end);
|
309
|
+
left: 0;
|
310
|
+
}
|
311
|
+
`,
|
312
|
+
])
|
313
|
+
], RangeInput);
|
314
|
+
export { RangeInput };
|
315
|
+
export default RangeInput;
|
316
|
+
//# sourceMappingURL=range-input.js.map
|