godown 2.7.5 → 2.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -45
- package/{.deps.d.ts → _deps.d.ts} +1 -2
- package/{.deps.d.ts.map → _deps.d.ts.map} +1 -1
- package/{.deps.js → _deps.js} +1 -2
- package/_deps.js.map +1 -0
- package/alert.d.ts +8 -1
- package/alert.d.ts.map +1 -1
- package/alert.js +4 -1
- package/alert.js.map +1 -1
- package/avatar-group.d.ts +8 -1
- package/avatar-group.d.ts.map +1 -1
- package/avatar-group.js +4 -1
- package/avatar-group.js.map +1 -1
- package/avatar.d.ts +8 -1
- package/avatar.d.ts.map +1 -1
- package/avatar.js +4 -1
- package/avatar.js.map +1 -1
- package/button.d.ts +8 -1
- package/button.d.ts.map +1 -1
- package/button.js +4 -1
- package/button.js.map +1 -1
- package/card.d.ts +8 -1
- package/card.d.ts.map +1 -1
- package/card.js +4 -1
- package/card.js.map +1 -1
- package/carousel.d.ts +8 -1
- package/carousel.d.ts.map +1 -1
- package/carousel.js +4 -1
- package/carousel.js.map +1 -1
- package/components.json +194 -0
- package/conf.d.ts +6 -75
- package/conf.d.ts.map +1 -1
- package/conf.js +8 -34
- package/conf.js.map +1 -1
- package/decorators/godown.d.ts +4 -0
- package/decorators/godown.d.ts.map +1 -0
- package/decorators/godown.js +9 -0
- package/decorators/godown.js.map +1 -0
- package/decorators/part.d.ts +7 -0
- package/decorators/part.d.ts.map +1 -0
- package/decorators/part.js +8 -0
- package/decorators/part.js.map +1 -0
- package/decorators/styles.d.ts +3 -0
- package/decorators/styles.d.ts.map +1 -0
- package/decorators/styles.js +8 -0
- package/decorators/styles.js.map +1 -0
- package/details.d.ts +8 -1
- package/details.d.ts.map +1 -1
- package/details.js +4 -1
- package/details.js.map +1 -1
- package/dialog.d.ts +8 -1
- package/dialog.d.ts.map +1 -1
- package/dialog.js +4 -1
- package/dialog.js.map +1 -1
- package/divider.d.ts +8 -1
- package/divider.d.ts.map +1 -1
- package/divider.js +4 -1
- package/divider.js.map +1 -1
- package/dragbox.d.ts +8 -1
- package/dragbox.d.ts.map +1 -1
- package/dragbox.js +4 -1
- package/dragbox.js.map +1 -1
- package/flex-flow.d.ts +8 -1
- package/flex-flow.d.ts.map +1 -1
- package/flex-flow.js +4 -1
- package/flex-flow.js.map +1 -1
- package/form.d.ts +8 -1
- package/form.d.ts.map +1 -1
- package/form.js +4 -1
- package/form.js.map +1 -1
- package/grid-flow.d.ts +9 -0
- package/grid-flow.d.ts.map +1 -0
- package/grid-flow.js +5 -0
- package/grid-flow.js.map +1 -0
- package/index.d.ts +32 -3
- package/index.d.ts.map +1 -1
- package/index.js +32 -3
- package/index.js.map +1 -1
- package/input.d.ts +8 -1
- package/input.d.ts.map +1 -1
- package/input.js +4 -1
- package/input.js.map +1 -1
- package/label-input.d.ts +8 -1
- package/label-input.d.ts.map +1 -1
- package/label-input.js +4 -1
- package/label-input.js.map +1 -1
- package/layout.d.ts +9 -0
- package/layout.d.ts.map +1 -0
- package/layout.js +5 -0
- package/layout.js.map +1 -0
- package/lib/css.d.ts +13 -0
- package/lib/css.d.ts.map +1 -0
- package/lib/css.js +29 -0
- package/lib/css.js.map +1 -0
- package/lib/directives.d.ts +16 -20
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js +33 -31
- package/lib/directives.js.map +1 -1
- package/lib/event-coll.d.ts +13 -0
- package/lib/event-coll.d.ts.map +1 -0
- package/lib/event-coll.js +45 -0
- package/lib/event-coll.js.map +1 -0
- package/lib/{templates.d.ts → icons.d.ts} +1 -17
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +73 -0
- package/lib/icons.js.map +1 -0
- package/lib/jsx.d.ts +4 -0
- package/lib/jsx.d.ts.map +1 -0
- package/lib/jsx.js +52 -0
- package/lib/jsx.js.map +1 -0
- package/lib/route-tree.d.ts +5 -5
- package/lib/route-tree.js +5 -5
- package/lib/route-tree.js.map +1 -1
- package/lib/utils.d.ts +6 -46
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +25 -110
- package/lib/utils.js.map +1 -1
- package/link.d.ts +9 -0
- package/link.d.ts.map +1 -0
- package/link.js +5 -0
- package/link.js.map +1 -0
- package/overbreath.d.ts +8 -1
- package/overbreath.d.ts.map +1 -1
- package/overbreath.js +4 -1
- package/overbreath.js.map +1 -1
- package/package.json +18 -23
- package/progress.d.ts +8 -1
- package/progress.d.ts.map +1 -1
- package/progress.js +4 -1
- package/progress.js.map +1 -1
- package/proto/godown-config.d.ts +41 -0
- package/proto/godown-config.d.ts.map +1 -0
- package/proto/godown-config.js +27 -0
- package/proto/godown-config.js.map +1 -0
- package/{godown-element.d.ts → proto/godown-element.d.ts} +48 -16
- package/proto/godown-element.d.ts.map +1 -0
- package/{godown-element.js → proto/godown-element.js} +82 -26
- package/proto/godown-element.js.map +1 -0
- package/proto/super-a.d.ts +30 -0
- package/proto/super-a.d.ts.map +1 -0
- package/proto/super-a.js +141 -0
- package/proto/super-a.js.map +1 -0
- package/proto/super-input.d.ts +44 -0
- package/proto/super-input.d.ts.map +1 -0
- package/proto/super-input.js +119 -0
- package/proto/super-input.js.map +1 -0
- package/proto/super-openable.d.ts +23 -0
- package/proto/super-openable.d.ts.map +1 -0
- package/proto/super-openable.js +43 -0
- package/proto/super-openable.js.map +1 -0
- package/range-input.d.ts +9 -0
- package/range-input.d.ts.map +1 -0
- package/range-input.js +5 -0
- package/range-input.js.map +1 -0
- package/react/create.d.ts.map +1 -1
- package/react/create.js +4 -1
- package/react/create.js.map +1 -1
- package/react/index.d.ts +64 -34
- package/react/index.d.ts.map +1 -1
- package/react/index.js +78 -51
- package/react/index.js.map +1 -1
- package/rotate.d.ts +9 -0
- package/rotate.d.ts.map +1 -0
- package/rotate.js +5 -0
- package/rotate.js.map +1 -0
- package/router-link.d.ts +9 -0
- package/router-link.d.ts.map +1 -0
- package/router-link.js +5 -0
- package/router-link.js.map +1 -0
- package/router.d.ts +8 -1
- package/router.d.ts.map +1 -1
- package/router.js +4 -1
- package/router.js.map +1 -1
- package/search-input.d.ts +8 -1
- package/search-input.d.ts.map +1 -1
- package/search-input.js +4 -1
- package/search-input.js.map +1 -1
- package/select-input.d.ts +8 -1
- package/select-input.d.ts.map +1 -1
- package/select-input.js +4 -1
- package/select-input.js.map +1 -1
- package/skeleton.d.ts +8 -1
- package/skeleton.d.ts.map +1 -1
- package/skeleton.js +4 -1
- package/skeleton.js.map +1 -1
- package/split-input.d.ts +8 -1
- package/split-input.d.ts.map +1 -1
- package/split-input.js +4 -1
- package/split-input.js.map +1 -1
- package/styles/colors/presets.d.ts +13 -0
- package/styles/colors/presets.d.ts.map +1 -0
- package/styles/colors/presets.js +6 -0
- package/styles/colors/presets.js.map +1 -0
- package/styles/colors/presetsRGB.d.ts +16 -0
- package/styles/colors/presetsRGB.d.ts.map +1 -0
- package/styles/colors/presetsRGB.js +134 -0
- package/styles/colors/presetsRGB.js.map +1 -0
- package/styles/global.d.ts +18 -0
- package/styles/global.d.ts.map +1 -0
- package/styles/global.js +78 -0
- package/styles/global.js.map +1 -0
- package/styles/inputStyle.d.ts +3 -0
- package/styles/inputStyle.d.ts.map +1 -0
- package/styles/inputStyle.js +59 -0
- package/styles/inputStyle.js.map +1 -0
- package/switch-input.d.ts +8 -1
- package/switch-input.d.ts.map +1 -1
- package/switch-input.js +4 -1
- package/switch-input.js.map +1 -1
- package/text.d.ts +8 -1
- package/text.d.ts.map +1 -1
- package/text.js +4 -1
- package/text.js.map +1 -1
- package/time.d.ts +8 -1
- package/time.d.ts.map +1 -1
- package/time.js +4 -1
- package/time.js.map +1 -1
- package/tooltip.d.ts +8 -1
- package/tooltip.d.ts.map +1 -1
- package/tooltip.js +4 -1
- package/tooltip.js.map +1 -1
- package/typewriter.d.ts +8 -1
- package/typewriter.d.ts.map +1 -1
- package/typewriter.js +4 -1
- package/typewriter.js.map +1 -1
- package/web-components/alert/alert.d.ts +2 -10
- package/web-components/alert/alert.d.ts.map +1 -1
- package/web-components/alert/alert.js +93 -91
- package/web-components/alert/alert.js.map +1 -1
- package/web-components/avatar/avatar-group.d.ts +21 -0
- package/web-components/avatar/avatar-group.d.ts.map +1 -0
- package/web-components/avatar/avatar-group.js +86 -0
- package/web-components/avatar/avatar-group.js.map +1 -0
- package/web-components/avatar/avatar.d.ts +5 -18
- package/web-components/avatar/avatar.d.ts.map +1 -1
- package/web-components/avatar/avatar.js +70 -85
- package/web-components/avatar/avatar.js.map +1 -1
- package/web-components/button/button.d.ts +10 -43
- package/web-components/button/button.d.ts.map +1 -1
- package/web-components/button/button.js +183 -226
- package/web-components/button/button.js.map +1 -1
- package/web-components/card/card.d.ts +2 -27
- package/web-components/card/card.d.ts.map +1 -1
- package/web-components/card/card.js +57 -132
- package/web-components/card/card.js.map +1 -1
- package/web-components/carousel/carousel.d.ts +5 -16
- package/web-components/carousel/carousel.d.ts.map +1 -1
- package/web-components/carousel/carousel.js +102 -106
- package/web-components/carousel/carousel.js.map +1 -1
- package/web-components/details/details.d.ts +4 -15
- package/web-components/details/details.d.ts.map +1 -1
- package/web-components/details/details.js +91 -97
- package/web-components/details/details.js.map +1 -1
- package/web-components/dialog/dialog.d.ts +6 -17
- package/web-components/dialog/dialog.d.ts.map +1 -1
- package/web-components/dialog/dialog.js +87 -137
- package/web-components/dialog/dialog.js.map +1 -1
- package/web-components/divider/divider.d.ts +13 -0
- package/web-components/divider/divider.d.ts.map +1 -0
- package/web-components/divider/divider.js +95 -0
- package/web-components/divider/divider.js.map +1 -0
- package/web-components/form/form.d.ts +15 -22
- package/web-components/form/form.d.ts.map +1 -1
- package/web-components/form/form.js +47 -117
- package/web-components/form/form.js.map +1 -1
- package/web-components/input/input.d.ts +5 -18
- package/web-components/input/input.d.ts.map +1 -1
- package/web-components/input/input.js +74 -169
- package/web-components/input/input.js.map +1 -1
- package/web-components/input/label-input.d.ts +5 -19
- package/web-components/input/label-input.d.ts.map +1 -1
- package/web-components/input/label-input.js +74 -141
- package/web-components/input/label-input.js.map +1 -1
- package/web-components/input/range-input.d.ts +53 -0
- package/web-components/input/range-input.d.ts.map +1 -0
- package/web-components/input/range-input.js +316 -0
- package/web-components/input/range-input.js.map +1 -0
- package/web-components/input/search-input.d.ts +4 -12
- package/web-components/input/search-input.d.ts.map +1 -1
- package/web-components/input/search-input.js +118 -113
- package/web-components/input/search-input.js.map +1 -1
- package/web-components/input/select-input.d.ts +17 -32
- package/web-components/input/select-input.d.ts.map +1 -1
- package/web-components/input/select-input.js +154 -286
- package/web-components/input/select-input.js.map +1 -1
- package/web-components/input/split-input.d.ts +8 -15
- package/web-components/input/split-input.d.ts.map +1 -1
- package/web-components/input/split-input.js +82 -72
- package/web-components/input/split-input.js.map +1 -1
- package/web-components/input/switch-input.d.ts +8 -17
- package/web-components/input/switch-input.d.ts.map +1 -1
- package/web-components/input/switch-input.js +122 -158
- package/web-components/input/switch-input.js.map +1 -1
- package/web-components/layout/flex-flow.d.ts +11 -19
- package/web-components/layout/flex-flow.d.ts.map +1 -1
- package/web-components/layout/flex-flow.js +57 -35
- package/web-components/layout/flex-flow.js.map +1 -1
- package/web-components/layout/grid-flow.d.ts +14 -0
- package/web-components/layout/grid-flow.d.ts.map +1 -0
- package/web-components/layout/grid-flow.js +56 -0
- package/web-components/layout/grid-flow.js.map +1 -0
- package/web-components/layout/layout.d.ts +18 -0
- package/web-components/layout/layout.d.ts.map +1 -0
- package/web-components/layout/layout.js +76 -0
- package/web-components/layout/layout.js.map +1 -0
- package/web-components/link/link.d.ts +10 -0
- package/web-components/link/link.d.ts.map +1 -0
- package/web-components/link/link.js +17 -0
- package/web-components/link/link.js.map +1 -0
- package/web-components/link/router-link.d.ts +19 -0
- package/web-components/link/router-link.d.ts.map +1 -0
- package/web-components/link/router-link.js +60 -0
- package/web-components/link/router-link.js.map +1 -0
- package/web-components/progress/progress.d.ts +2 -12
- package/web-components/progress/progress.d.ts.map +1 -1
- package/web-components/progress/progress.js +52 -48
- package/web-components/progress/progress.js.map +1 -1
- package/web-components/router/router.d.ts +15 -21
- package/web-components/router/router.d.ts.map +1 -1
- package/web-components/router/router.js +35 -37
- package/web-components/router/router.js.map +1 -1
- package/web-components/skeleton/skeleton.d.ts +5 -12
- package/web-components/skeleton/skeleton.d.ts.map +1 -1
- package/web-components/skeleton/skeleton.js +90 -98
- package/web-components/skeleton/skeleton.js.map +1 -1
- package/web-components/text/overbreath.d.ts +15 -20
- package/web-components/text/overbreath.d.ts.map +1 -1
- package/web-components/text/overbreath.js +108 -202
- package/web-components/text/overbreath.js.map +1 -1
- package/web-components/text/text.d.ts +5 -18
- package/web-components/text/text.d.ts.map +1 -1
- package/web-components/text/text.js +70 -80
- package/web-components/text/text.js.map +1 -1
- package/web-components/text/time.d.ts +5 -14
- package/web-components/text/time.d.ts.map +1 -1
- package/web-components/text/time.js +32 -31
- package/web-components/text/time.js.map +1 -1
- package/web-components/text/typewriter.d.ts +3 -11
- package/web-components/text/typewriter.d.ts.map +1 -1
- package/web-components/text/typewriter.js +42 -40
- package/web-components/text/typewriter.js.map +1 -1
- package/web-components/tooltip/tooltip.d.ts +21 -17
- package/web-components/tooltip/tooltip.d.ts.map +1 -1
- package/web-components/tooltip/tooltip.js +98 -60
- package/web-components/tooltip/tooltip.js.map +1 -1
- package/web-components/wrapper/dragbox.d.ts +5 -10
- package/web-components/wrapper/dragbox.d.ts.map +1 -1
- package/web-components/wrapper/dragbox.js +40 -31
- package/web-components/wrapper/dragbox.js.map +1 -1
- package/web-components/wrapper/rotate.d.ts +30 -0
- package/web-components/wrapper/rotate.d.ts.map +1 -0
- package/web-components/wrapper/rotate.js +92 -0
- package/web-components/wrapper/rotate.js.map +1 -0
- package/.deps.js.map +0 -1
- package/a.d.ts +0 -2
- package/a.d.ts.map +0 -1
- package/a.js +0 -2
- package/a.js.map +0 -1
- package/clip.d.ts +0 -2
- package/clip.d.ts.map +0 -1
- package/clip.js +0 -2
- package/clip.js.map +0 -1
- package/decorators/define.d.ts +0 -7
- package/decorators/define.d.ts.map +0 -1
- package/decorators/define.js +0 -11
- package/decorators/define.js.map +0 -1
- package/details-group.d.ts +0 -2
- package/details-group.d.ts.map +0 -1
- package/details-group.js +0 -2
- package/details-group.js.map +0 -1
- package/godown-element.d.ts.map +0 -1
- package/godown-element.js.map +0 -1
- package/lib/event-collection.d.ts +0 -14
- package/lib/event-collection.d.ts.map +0 -1
- package/lib/event-collection.js +0 -71
- package/lib/event-collection.js.map +0 -1
- package/lib/templates.d.ts.map +0 -1
- package/lib/templates.js +0 -76
- package/lib/templates.js.map +0 -1
- package/naming.d.ts +0 -91
- package/naming.d.ts.map +0 -1
- package/naming.js +0 -67
- package/naming.js.map +0 -1
- package/nav-layout.d.ts +0 -2
- package/nav-layout.d.ts.map +0 -1
- package/nav-layout.js +0 -2
- package/nav-layout.js.map +0 -1
- package/open-offset.d.ts +0 -2
- package/open-offset.d.ts.map +0 -1
- package/open-offset.js +0 -2
- package/open-offset.js.map +0 -1
- package/router-a.d.ts +0 -2
- package/router-a.d.ts.map +0 -1
- package/router-a.js +0 -2
- package/router-a.js.map +0 -1
- package/supers/anchor.d.ts +0 -26
- package/supers/anchor.d.ts.map +0 -1
- package/supers/anchor.js +0 -124
- package/supers/anchor.js.map +0 -1
- package/supers/input.d.ts +0 -28
- package/supers/input.d.ts.map +0 -1
- package/supers/input.js +0 -117
- package/supers/input.js.map +0 -1
- package/supers/openable.d.ts +0 -38
- package/supers/openable.d.ts.map +0 -1
- package/supers/openable.js +0 -77
- package/supers/openable.js.map +0 -1
- package/supers/root.d.ts +0 -18
- package/supers/root.d.ts.map +0 -1
- package/supers/root.js +0 -76
- package/supers/root.js.map +0 -1
- package/tabs.d.ts +0 -2
- package/tabs.d.ts.map +0 -1
- package/tabs.js +0 -2
- package/tabs.js.map +0 -1
- package/web-components/a/a.d.ts +0 -16
- package/web-components/a/a.d.ts.map +0 -1
- package/web-components/a/a.js +0 -17
- package/web-components/a/a.js.map +0 -1
- package/web-components/group/avatar-group.d.ts +0 -29
- package/web-components/group/avatar-group.d.ts.map +0 -1
- package/web-components/group/avatar-group.js +0 -88
- package/web-components/group/avatar-group.js.map +0 -1
- package/web-components/group/details-group.d.ts +0 -28
- package/web-components/group/details-group.d.ts.map +0 -1
- package/web-components/group/details-group.js +0 -59
- package/web-components/group/details-group.js.map +0 -1
- package/web-components/index.d.ts +0 -35
- package/web-components/index.d.ts.map +0 -1
- package/web-components/index.js +0 -35
- package/web-components/index.js.map +0 -1
- package/web-components/layout/divider.d.ts +0 -22
- package/web-components/layout/divider.d.ts.map +0 -1
- package/web-components/layout/divider.js +0 -85
- package/web-components/layout/divider.js.map +0 -1
- package/web-components/layout/nav-layout.d.ts +0 -38
- package/web-components/layout/nav-layout.d.ts.map +0 -1
- package/web-components/layout/nav-layout.js +0 -69
- package/web-components/layout/nav-layout.js.map +0 -1
- package/web-components/offset/open-offset.d.ts +0 -27
- package/web-components/offset/open-offset.d.ts.map +0 -1
- package/web-components/offset/open-offset.js +0 -130
- package/web-components/offset/open-offset.js.map +0 -1
- package/web-components/router/router-a.d.ts +0 -25
- package/web-components/router/router-a.d.ts.map +0 -1
- package/web-components/router/router-a.js +0 -70
- package/web-components/router/router-a.js.map +0 -1
- package/web-components/tabs/tabs.d.ts +0 -52
- package/web-components/tabs/tabs.d.ts.map +0 -1
- package/web-components/tabs/tabs.js +0 -165
- package/web-components/tabs/tabs.js.map +0 -1
- package/web-components/text/clip.d.ts +0 -22
- package/web-components/text/clip.d.ts.map +0 -1
- package/web-components/text/clip.js +0 -45
- package/web-components/text/clip.js.map +0 -1
- package/web-components/wrapper/wrapper.d.ts +0 -27
- package/web-components/wrapper/wrapper.d.ts.map +0 -1
- package/web-components/wrapper/wrapper.js +0 -95
- package/web-components/wrapper/wrapper.js.map +0 -1
- package/wrapper.d.ts +0 -2
- package/wrapper.d.ts.map +0 -1
- package/wrapper.js +0 -2
- package/wrapper.js.map +0 -1
@@ -1,148 +1,78 @@
|
|
1
|
+
var Form_1;
|
1
2
|
import { __decorate } from "tslib";
|
2
|
-
import { css,
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { GodownElement } from "../../
|
3
|
+
import { css, property } from "../../_deps.js";
|
4
|
+
import { godown } from "../../decorators/godown.js";
|
5
|
+
import { styles } from "../../decorators/styles.js";
|
6
|
+
import { htmlSlot } from "../../lib/directives.js";
|
7
|
+
import { GodownElement } from "../../proto/godown-element.js";
|
8
|
+
const protoName = "form";
|
7
9
|
/**
|
8
|
-
* {@linkcode Form}
|
10
|
+
* {@linkcode Form} Gets child element key-value object,
|
11
|
+
* which will be nested if the child element is the same as this element.
|
12
|
+
*
|
13
|
+
* @slot - Child elements.
|
9
14
|
*/
|
10
|
-
let Form = class Form extends GodownElement {
|
15
|
+
let Form = Form_1 = class Form extends GodownElement {
|
11
16
|
constructor() {
|
12
17
|
super(...arguments);
|
13
18
|
this.name = "";
|
14
|
-
this.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*/
|
19
|
-
this.enctype = "multipart/form-data";
|
19
|
+
this.nameValue = this.namevalue;
|
20
|
+
}
|
21
|
+
get value() {
|
22
|
+
return Form_1.buildValue(this._slot.assignedElements());
|
20
23
|
}
|
21
24
|
render() {
|
22
|
-
return
|
23
|
-
${htmlSlot("pre")}
|
24
|
-
<main>${htmlSlot()}</main>
|
25
|
-
${htmlSlot("suf")}
|
26
|
-
</form>`;
|
25
|
+
return htmlSlot();
|
27
26
|
}
|
28
27
|
reset() {
|
29
|
-
|
30
|
-
if (
|
31
|
-
|
28
|
+
this.deepQuerySelectorAll("*").forEach((el) => {
|
29
|
+
if (el.tagName === this.tagName) {
|
30
|
+
return;
|
32
31
|
}
|
33
|
-
|
34
|
-
|
35
|
-
for (const slot of this.shadowRoot.querySelectorAll("slot")) {
|
36
|
-
for (const i of slot.assignedNodes()) {
|
37
|
-
if (i.reset) {
|
38
|
-
i.reset();
|
39
|
-
}
|
40
|
-
form.appendChild(i.cloneNode(true));
|
32
|
+
if (el.reset) {
|
33
|
+
el.reset();
|
41
34
|
}
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
if (i.name && form[i.name]) {
|
47
|
-
i.value = form[i.name].value;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
form.remove();
|
35
|
+
});
|
36
|
+
}
|
37
|
+
namevalue() {
|
38
|
+
return [this.name, this.value];
|
52
39
|
}
|
53
|
-
|
40
|
+
static buildValue(elements) {
|
54
41
|
const result = {};
|
55
|
-
const
|
56
|
-
|
57
|
-
|
58
|
-
for (const i of slot.assignedNodes()) {
|
59
|
-
if (i.namevalue) {
|
60
|
-
const [name, value] = i.namevalue();
|
61
|
-
if (name) {
|
62
|
-
result[name] = value;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
tempForm.appendChild(i.cloneNode(true));
|
67
|
-
}
|
42
|
+
for (const el of elements) {
|
43
|
+
if (el.tagName === "FORM") {
|
44
|
+
Object.assign(result, Object.fromEntries(new FormData(el).entries()));
|
68
45
|
}
|
69
|
-
|
70
|
-
|
71
|
-
for (const [key, value] of formData) {
|
72
|
-
result[key] = value;
|
73
|
-
}
|
74
|
-
each(this._form, (node) => {
|
75
|
-
if (node.namevalue) {
|
76
|
-
const [name, value] = node.namevalue();
|
46
|
+
else if (el.namevalue) {
|
47
|
+
const [name, value] = el.namevalue();
|
77
48
|
if (name) {
|
78
49
|
result[name] = value;
|
79
50
|
}
|
80
51
|
}
|
81
|
-
|
82
|
-
|
83
|
-
return [this.name, result];
|
84
|
-
}
|
85
|
-
FormData() {
|
86
|
-
const temp = {};
|
87
|
-
const tempForm = document.createElement("form");
|
88
|
-
tempForm.enctype = this.enctype;
|
89
|
-
for (const slot of this._slots) {
|
90
|
-
for (const i of slot.assignedNodes()) {
|
91
|
-
if (i.FormData) {
|
92
|
-
for (const [key, value] of i.FormData()) {
|
93
|
-
temp[key] = value;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
else {
|
97
|
-
tempForm.appendChild(i.cloneNode(true));
|
98
|
-
}
|
52
|
+
else if (el.name && el.value !== undefined) {
|
53
|
+
result[el.name] = el.value;
|
99
54
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
if (node.namevalue) {
|
104
|
-
const [name, value] = node.namevalue();
|
105
|
-
if (name) {
|
106
|
-
formData.append(name, value);
|
55
|
+
else if (el.shadowRoot) {
|
56
|
+
for (const slot of el.shadowRoot.querySelectorAll("slot")) {
|
57
|
+
Object.assign(result, this.buildValue(slot.assignedElements()));
|
107
58
|
}
|
108
59
|
}
|
109
|
-
});
|
110
|
-
for (const key in temp) {
|
111
|
-
formData.append(key, temp[key]);
|
112
60
|
}
|
113
|
-
|
114
|
-
return formData;
|
61
|
+
return result;
|
115
62
|
}
|
116
63
|
};
|
117
|
-
Form.styles = [
|
118
|
-
css `
|
119
|
-
form {
|
120
|
-
display: flex;
|
121
|
-
flex-direction: column;
|
122
|
-
align-items: center;
|
123
|
-
margin: 0;
|
124
|
-
}
|
125
|
-
|
126
|
-
main {
|
127
|
-
display: flex;
|
128
|
-
flex-direction: column;
|
129
|
-
}
|
130
|
-
`,
|
131
|
-
];
|
132
64
|
__decorate([
|
133
65
|
property()
|
134
66
|
], Form.prototype, "name", void 0);
|
135
|
-
__decorate([
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
]
|
144
|
-
Form = __decorate([
|
145
|
-
define("form")
|
67
|
+
Form = Form_1 = __decorate([
|
68
|
+
godown(protoName),
|
69
|
+
styles([
|
70
|
+
css `
|
71
|
+
:host {
|
72
|
+
display: block;
|
73
|
+
}
|
74
|
+
`,
|
75
|
+
])
|
146
76
|
], Form);
|
147
77
|
export { Form };
|
148
78
|
export default Form;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/form/form.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"https://github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AE,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;gBAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,EAAqB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC3F,CAAC;iBAAM,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;gBACxB,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;gBACrC,IAAI,IAAI,EAAE,CAAC;oBACT,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBACvB,CAAC;YACH,CAAC;iBAAM,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC7C,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;YAC7B,CAAC;iBAAM,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;gBACzB,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AApDa;IAAX,QAAQ,EAAE;kCAAW;AADX,IAAI;IARhB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,GAAG,CAAA;;;;GAIF;KACF,CAAC;GACW,IAAI,CAqDhB;;AAED,eAAe,IAAI,CAAC","sourcesContent":["import { css, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { GodownElement } from \"../../proto/godown-element.js\";\n\nconst protoName = \"form\";\n/**\n * {@linkcode Form} Gets child element key-value object,\n * which will be nested if the child element is the same as this element.\n *\n * @slot - Child elements.\n */\n@godown(protoName)\n@styles([\n css`\n :host {\n display: block;\n }\n `,\n])\nexport class Form<T = object> extends GodownElement {\n @property() name = \"\";\n get value(): T {\n return Form.buildValue(this._slot.assignedElements()) as T;\n }\n\n nameValue = this.namevalue;\n\n protected render() {\n return htmlSlot();\n }\n\n reset() {\n this.deepQuerySelectorAll<HTMLElement & { reset?: () => void }>(\"*\").forEach((el) => {\n if (el.tagName === this.tagName) {\n return;\n }\n if (el.reset) {\n el.reset();\n }\n });\n }\n\n namevalue(): [string, T] {\n return [this.name, this.value];\n }\n\n static buildValue(\n elements: (Element & {\n name?: string;\n value?: unknown;\n namevalue?: () => [string, unknown];\n })[],\n ): Record<string, any> {\n const result = {};\n for (const el of elements) {\n if (el.tagName === \"FORM\") {\n Object.assign(result, Object.fromEntries(new FormData(el as HTMLFormElement).entries()));\n } else if (el.namevalue) {\n const [name, value] = el.namevalue();\n if (name) {\n result[name] = value;\n }\n } else if (el.name && el.value !== undefined) {\n result[el.name] = el.value;\n } else if (el.shadowRoot) {\n for (const slot of el.shadowRoot.querySelectorAll(\"slot\")) {\n Object.assign(result, this.buildValue(slot.assignedElements()));\n }\n }\n }\n return result;\n }\n}\n\nexport default Form;\n"]}
|
@@ -1,14 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import { type HTMLTemplate } from "../../lib/templates.js";
|
3
|
-
import { GodownInput } from "../../supers/input.js";
|
1
|
+
import GodownInput from "../../proto/super-input.js";
|
4
2
|
/**
|
5
3
|
* {@linkcode Input }.
|
6
4
|
*/
|
7
5
|
export declare class Input extends GodownInput {
|
6
|
+
variant: "default" | "outline";
|
8
7
|
/**
|
9
|
-
* Input
|
8
|
+
* Input accept.
|
10
9
|
*/
|
11
|
-
accept:
|
10
|
+
accept: string;
|
12
11
|
/**
|
13
12
|
* Value.
|
14
13
|
*/
|
@@ -29,22 +28,10 @@ export declare class Input extends GodownInput {
|
|
29
28
|
* Input step.
|
30
29
|
*/
|
31
30
|
step: number;
|
32
|
-
|
33
|
-
_ranged: HTMLElement;
|
34
|
-
static styles: CSSResultGroup;
|
35
|
-
protected render(): HTMLTemplate;
|
31
|
+
protected render(): import("lit").TemplateResult<1>;
|
36
32
|
connectedCallback(): void;
|
37
|
-
protected firstUpdated(): void;
|
38
|
-
protected _handleRange(e: any | Event): void;
|
39
33
|
protected _handleFile(e: any | Event): void;
|
40
34
|
reset(): void;
|
41
|
-
protected _typeSwitcher(): HTMLTemplate;
|
42
35
|
}
|
43
36
|
export default Input;
|
44
|
-
declare global {
|
45
|
-
interface HTMLElementTagNameMap {
|
46
|
-
"base-input": Input;
|
47
|
-
"g-input": Input;
|
48
|
-
}
|
49
|
-
}
|
50
37
|
//# sourceMappingURL=input.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;GAEG;AACH,qBAyCa,KAAM,SAAQ,WAAW;IACxB,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IACvD;;OAEG;IACS,MAAM,EAAE,MAAM,CAAa;IACvC;;OAEG;IACS,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAa;IACxD;;OAEG;IAC0B,IAAI,UAAS;IAC1C;;OAEG;IACyB,GAAG,SAAK;IACpC;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,IAAI,SAAK;IAErC,SAAS,CAAC,MAAM;IAkBhB,iBAAiB;IAajB,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAKpC,KAAK;CAQN;AAED,eAAe,KAAK,CAAC"}
|
@@ -1,18 +1,21 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { css, html, property
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
|
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 } 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 = "input";
|
8
10
|
/**
|
9
11
|
* {@linkcode Input }.
|
10
12
|
*/
|
11
13
|
let Input = class Input extends GodownInput {
|
12
14
|
constructor() {
|
13
15
|
super(...arguments);
|
16
|
+
this.variant = "default";
|
14
17
|
/**
|
15
|
-
* Input
|
18
|
+
* Input accept.
|
16
19
|
*/
|
17
20
|
this.accept = undefined;
|
18
21
|
/**
|
@@ -37,16 +40,21 @@ let Input = class Input extends GodownInput {
|
|
37
40
|
this.step = 1;
|
38
41
|
}
|
39
42
|
render() {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
|
43
|
+
return html `<div part="root" class="${combine({ "input-field": true, outline: this.variant === "outline" })}">
|
44
|
+
<input
|
45
|
+
part="input"
|
46
|
+
class="input"
|
47
|
+
id=${this.makeId}
|
48
|
+
.value="${this.value}"
|
49
|
+
?autofocus="${this.autofocus}"
|
50
|
+
type="${this.type}"
|
51
|
+
placeholder="${this.placeholder}"
|
52
|
+
min="${this.min}"
|
53
|
+
max="${this.max}"
|
54
|
+
@input="${this._handleInput}"
|
55
|
+
/>
|
56
|
+
${this._renderSuffix()}
|
57
|
+
</div>`;
|
50
58
|
}
|
51
59
|
connectedCallback() {
|
52
60
|
super.connectedCallback();
|
@@ -54,25 +62,13 @@ let Input = class Input extends GodownInput {
|
|
54
62
|
this.value = null;
|
55
63
|
}
|
56
64
|
else {
|
57
|
-
if (!this.
|
58
|
-
this.
|
65
|
+
if (!this.default) {
|
66
|
+
this.default = this.value || "";
|
59
67
|
}
|
60
68
|
if (!this.value) {
|
61
|
-
this.value = this.
|
69
|
+
this.value = this.default;
|
62
70
|
}
|
63
71
|
}
|
64
|
-
this._initName();
|
65
|
-
}
|
66
|
-
firstUpdated() {
|
67
|
-
super.firstUpdated();
|
68
|
-
if (this.type === "range") {
|
69
|
-
this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
|
70
|
-
}
|
71
|
-
}
|
72
|
-
_handleRange(e) {
|
73
|
-
this.value = e.target.value;
|
74
|
-
this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + "%";
|
75
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.value }));
|
76
72
|
}
|
77
73
|
_handleFile(e) {
|
78
74
|
this.value = !this.only ? e.target.files : e.target.files[0];
|
@@ -83,138 +79,13 @@ let Input = class Input extends GodownInput {
|
|
83
79
|
this.value = null;
|
84
80
|
return;
|
85
81
|
}
|
86
|
-
|
87
|
-
|
88
|
-
this.value = this._input.value;
|
89
|
-
this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + "%";
|
90
|
-
}
|
91
|
-
else {
|
92
|
-
this._input.value = this.def.toString();
|
93
|
-
this.value = this.def;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
_typeSwitcher() {
|
97
|
-
switch (this.type) {
|
98
|
-
case "file":
|
99
|
-
return html `<input id="input" class="input" type="file" accept="${this.accept}" ?multiple="${!this.only}" @change="${this._handleFile}" />${htmlSlot()}`;
|
100
|
-
case "number":
|
101
|
-
return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="number" placeholder="${this.pla}" min="${this.min}" max="${this.max}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
|
102
|
-
default:
|
103
|
-
return html `<input .value="${this.value}" ?autofocus="${this.autofocus}" id="input" class="input" type="${this.type}" placeholder="${this.pla}" @input="${this._handleInput}" @change="${this._handleChange}" />`;
|
104
|
-
}
|
82
|
+
this._input.value = this.default.toString();
|
83
|
+
this.value = this.default;
|
105
84
|
}
|
106
85
|
};
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
:host {
|
111
|
-
width: var(${cssvarValues.input}--width);
|
112
|
-
height: var(${cssvarValues.input}--height);
|
113
|
-
background: var(${cssvarValues.input}--background);
|
114
|
-
margin: var(${cssvarValues.input}--outline-width);
|
115
|
-
outline: var(${cssvarValues.input}--outline);
|
116
|
-
border-radius: var(${cssvarValues.input}--radius);
|
117
|
-
}
|
118
|
-
|
119
|
-
input[type="file"] {
|
120
|
-
display: none;
|
121
|
-
}
|
122
|
-
|
123
|
-
label,
|
124
|
-
div {
|
125
|
-
width: 100%;
|
126
|
-
display: flex;
|
127
|
-
align-items: center;
|
128
|
-
}
|
129
|
-
|
130
|
-
* {
|
131
|
-
border-radius: inherit;
|
132
|
-
cursor: inherit;
|
133
|
-
}
|
134
|
-
|
135
|
-
input {
|
136
|
-
box-sizing: border-box;
|
137
|
-
height: 100%;
|
138
|
-
width: 100%;
|
139
|
-
margin: 0;
|
140
|
-
color: inherit;
|
141
|
-
background: transparent;
|
142
|
-
padding: 0 0.25em;
|
143
|
-
border-radius: 0.25em;
|
144
|
-
}
|
145
|
-
`,
|
146
|
-
css `
|
147
|
-
:host([type="range"]) {
|
148
|
-
height: auto !important;
|
149
|
-
margin: 0.3em 0;
|
150
|
-
background: var(${cssvarValues.input}--false);
|
151
|
-
border-radius: 2em;
|
152
|
-
}
|
153
|
-
|
154
|
-
.range b:nth-of-type(1) {
|
155
|
-
width: 1em;
|
156
|
-
left: 0;
|
157
|
-
background: var(${cssvarValues.input}--true);
|
158
|
-
border-top-right-radius: 0;
|
159
|
-
border-bottom-right-radius: 0;
|
160
|
-
}
|
161
|
-
|
162
|
-
.range b {
|
163
|
-
pointer-events: none;
|
164
|
-
width: calc(100% - 1em);
|
165
|
-
height: 100%;
|
166
|
-
left: 1em;
|
167
|
-
position: absolute;
|
168
|
-
}
|
169
|
-
|
170
|
-
.range {
|
171
|
-
height: fit-content;
|
172
|
-
position: relative;
|
173
|
-
display: inline-flex;
|
174
|
-
justify-content: center;
|
175
|
-
align-items: center;
|
176
|
-
}
|
177
|
-
|
178
|
-
.range input {
|
179
|
-
padding: 0;
|
180
|
-
height: 0.6em;
|
181
|
-
margin: 0px -0.5em;
|
182
|
-
appearance: none;
|
183
|
-
-webkit-appearance: none;
|
184
|
-
outline: none;
|
185
|
-
background: transparent;
|
186
|
-
}
|
187
|
-
|
188
|
-
.range i {
|
189
|
-
position: absolute;
|
190
|
-
left: 0;
|
191
|
-
width: 50%;
|
192
|
-
height: 100%;
|
193
|
-
pointer-events: none;
|
194
|
-
background: var(${cssvarValues.input}--true);
|
195
|
-
border-top-left-radius: 0;
|
196
|
-
border-bottom-left-radius: 0;
|
197
|
-
}
|
198
|
-
|
199
|
-
.range input::-webkit-slider-runnable-track {
|
200
|
-
height: 0.6em;
|
201
|
-
}
|
202
|
-
|
203
|
-
.range input::-webkit-slider-thumb {
|
204
|
-
z-index: 1;
|
205
|
-
appearance: none;
|
206
|
-
-webkit-appearance: none;
|
207
|
-
position: relative;
|
208
|
-
height: 1.2em;
|
209
|
-
width: 1.2em;
|
210
|
-
margin-top: -0.3em;
|
211
|
-
background: var(${cssvarValues.input}--control);
|
212
|
-
border-radius: 50%;
|
213
|
-
border: solid 0.125em var(${cssvarValues.input}--control-edge);
|
214
|
-
box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);
|
215
|
-
}
|
216
|
-
`,
|
217
|
-
];
|
86
|
+
__decorate([
|
87
|
+
property()
|
88
|
+
], Input.prototype, "variant", void 0);
|
218
89
|
__decorate([
|
219
90
|
property()
|
220
91
|
], Input.prototype, "accept", void 0);
|
@@ -233,14 +104,48 @@ __decorate([
|
|
233
104
|
__decorate([
|
234
105
|
property({ type: Number })
|
235
106
|
], Input.prototype, "step", void 0);
|
236
|
-
__decorate([
|
237
|
-
query("#input")
|
238
|
-
], Input.prototype, "_input", void 0);
|
239
|
-
__decorate([
|
240
|
-
query(".range i")
|
241
|
-
], Input.prototype, "_ranged", void 0);
|
242
107
|
Input = __decorate([
|
243
|
-
|
108
|
+
godown(protoName),
|
109
|
+
styles([
|
110
|
+
inputStyle,
|
111
|
+
fieldStyle,
|
112
|
+
css `
|
113
|
+
:host {
|
114
|
+
width: var(--${cssGlobalVars.input}--width);
|
115
|
+
height: var(--${cssGlobalVars.input}--height);
|
116
|
+
color: var(--${cssGlobalVars.foreground});
|
117
|
+
background: var(--${cssGlobalVars.input}--background);
|
118
|
+
margin: var(--${cssGlobalVars.input}--outline-width);
|
119
|
+
border-radius: var(--${cssGlobalVars.input}--radius);
|
120
|
+
display: block;
|
121
|
+
}
|
122
|
+
|
123
|
+
input[type="file"] {
|
124
|
+
display: none;
|
125
|
+
}
|
126
|
+
|
127
|
+
[part="root"] {
|
128
|
+
width: 100%;
|
129
|
+
display: flex;
|
130
|
+
align-items: center;
|
131
|
+
}
|
132
|
+
|
133
|
+
* {
|
134
|
+
border-radius: inherit;
|
135
|
+
cursor: inherit;
|
136
|
+
}
|
137
|
+
|
138
|
+
input {
|
139
|
+
box-sizing: border-box;
|
140
|
+
height: 100%;
|
141
|
+
width: 100%;
|
142
|
+
margin: 0;
|
143
|
+
color: inherit;
|
144
|
+
background: transparent;
|
145
|
+
border-radius: 0.25em;
|
146
|
+
}
|
147
|
+
`,
|
148
|
+
])
|
244
149
|
], Input);
|
245
150
|
export { Input };
|
246
151
|
export default Input;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,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Q,CAAC;qCAA0B;AACvB;IAAlB,KAAK,CAAC,UAAU,CAAC;sCAAsB;AA3B7B,KAAK;IADjB,MAAM,CAAC,UAAU,CAAC;GACN,KAAK,CAsNjB;;AAED,eAAe,KAAK,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../.deps.js\";\nimport { define } from \"../../decorators/define.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { GodownInput } from \"../../supers/input.js\";\nimport { cssvar, cssvarValues } from \"../../supers/root.js\";\n\nconst defineName = \"input\";\n\n/**\n * {@linkcode Input }.\n */\n@define(defineName)\nexport class Input extends GodownInput {\n /**\n * Input sccept.\n */\n @property() accept = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n @query(\"#input\") _input: HTMLInputElement;\n @query(\".range i\") _ranged: HTMLElement;\n\n static styles = [\n GodownInput.styles,\n css`\n :host {\n width: var(${cssvarValues.input}--width);\n height: var(${cssvarValues.input}--height);\n background: var(${cssvarValues.input}--background);\n margin: var(${cssvarValues.input}--outline-width);\n outline: var(${cssvarValues.input}--outline);\n border-radius: var(${cssvarValues.input}--radius);\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n label,\n div {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n padding: 0 0.25em;\n border-radius: 0.25em;\n }\n `,\n css`\n :host([type=\"range\"]) {\n height: auto !important;\n margin: 0.3em 0;\n background: var(${cssvarValues.input}--false);\n border-radius: 2em;\n }\n\n .range b:nth-of-type(1) {\n width: 1em;\n left: 0;\n background: var(${cssvarValues.input}--true);\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .range b {\n pointer-events: none;\n width: calc(100% - 1em);\n height: 100%;\n left: 1em;\n position: absolute;\n }\n\n .range {\n height: fit-content;\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n }\n\n .range input {\n padding: 0;\n height: 0.6em;\n margin: 0px -0.5em;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n }\n\n .range i {\n position: absolute;\n left: 0;\n width: 50%;\n height: 100%;\n pointer-events: none;\n background: var(${cssvarValues.input}--true);\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n .range input::-webkit-slider-runnable-track {\n height: 0.6em;\n }\n\n .range input::-webkit-slider-thumb {\n z-index: 1;\n appearance: none;\n -webkit-appearance: none;\n position: relative;\n height: 1.2em;\n width: 1.2em;\n margin-top: -0.3em;\n background: var(${cssvarValues.input}--control);\n border-radius: 50%;\n border: solid 0.125em var(${cssvarValues.input}--control-edge);\n box-shadow: 0 0.1em 0.1em var(${cssvar}--shadow);\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n if (this.type === \"range\") {\n return html`<div class=\"range\">\n <input id=\"input\" type=\"range\" min=\"${this.min}\" max=\"${this.max}\" step=\"${this.step}\" @input=\"${this._handleRange}\" @change=\"${this._handleRange}\" />\n <b></b>\n <b>\n <i></i>\n </b>\n </div>`;\n }\n return html`<label for=\"input\"> ${htmlSlot(\"pre\")} ${this._typeSwitcher()} ${htmlSlot(\"suf\")} </label>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.def) {\n this.def = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.def;\n }\n }\n this._initName();\n }\n\n protected firstUpdated() {\n super.firstUpdated();\n if (this.type === \"range\") {\n this._ranged.style.width = 100 * (parseInt(this.value as string) / (this.max - this.min)) + \"%\";\n }\n }\n\n protected _handleRange(e: any | Event) {\n this.value = e.target.value;\n this._ranged.style.width = (100 * parseInt(e.target.value)) / (this.max - this.min) + \"%\";\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value }));\n }\n\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n if (this.type === \"range\") {\n this._input.value = this.def || ((this.max - this.min) / 2).toString();\n this.value = this._input.value;\n this._ranged.style.width = 100 * (parseInt(this.value) / (this.max - this.min)) + \"%\";\n } else {\n this._input.value = this.def.toString();\n this.value = this.def;\n }\n }\n\n protected _typeSwitcher(): HTMLTemplate {\n switch (this.type) {\n case \"file\":\n return html`<input id=\"input\" class=\"input\" type=\"file\" accept=\"${this.accept}\" ?multiple=\"${!this.only}\" @change=\"${this._handleFile}\" />${htmlSlot()}`;\n\n case \"number\":\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"number\" placeholder=\"${this.pla}\" min=\"${this.min}\" max=\"${this.max}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n\n default:\n return html`<input .value=\"${this.value}\" ?autofocus=\"${this.autofocus}\" id=\"input\" class=\"input\" type=\"${this.type}\" placeholder=\"${this.pla}\" @input=\"${this._handleInput}\" @change=\"${this._handleChange}\" />`;\n }\n }\n}\n\nexport default Input;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-input\": Input;\n \"g-input\": Input;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/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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AE,MAAM,EAAE,CAAC;mCAAU;AAzB1B,KAAK;IAzCjB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,UAAU;QACV,UAAU;QACV,GAAG,CAAA;;qBAEgB,aAAa,CAAC,KAAK;sBAClB,aAAa,CAAC,KAAK;qBACpB,aAAa,CAAC,UAAU;0BACnB,aAAa,CAAC,KAAK;sBACvB,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4B7C;KACF,CAAC;GACW,KAAK,CAuEjB;;AAED,eAAe,KAAK,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine } 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 = \"input\";\n\n/**\n * {@linkcode Input }.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n width: var(--${cssGlobalVars.input}--width);\n height: var(--${cssGlobalVars.input}--height);\n color: var(--${cssGlobalVars.foreground});\n background: var(--${cssGlobalVars.input}--background);\n margin: var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n display: block;\n }\n\n input[type=\"file\"] {\n display: none;\n }\n\n [part=\"root\"] {\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n * {\n border-radius: inherit;\n cursor: inherit;\n }\n\n input {\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n margin: 0;\n color: inherit;\n background: transparent;\n border-radius: 0.25em;\n }\n `,\n])\nexport class Input extends GodownInput {\n @property() variant: \"default\" | \"outline\" = \"default\";\n /**\n * Input accept.\n */\n @property() accept: string = undefined;\n /**\n * Value.\n */\n @property() value: string | File | FileList = undefined;\n /**\n * Only single files are allowed to be selected.\n */\n @property({ type: Boolean }) only = false;\n /**\n * Input min.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input max.\n */\n @property({ type: Number }) max = 100;\n /**\n * Input step.\n */\n @property({ type: Number }) step = 1;\n\n protected render() {\n return html`<div part=\"root\" class=\"${combine({ \"input-field\": true, outline: this.variant === \"outline\" })}\">\n <input\n part=\"input\"\n class=\"input\"\n id=${this.makeId}\n .value=\"${this.value as string}\"\n ?autofocus=\"${this.autofocus}\"\n type=\"${this.type}\"\n placeholder=\"${this.placeholder}\"\n min=\"${this.min}\"\n max=\"${this.max}\"\n @input=\"${this._handleInput}\"\n />\n ${this._renderSuffix()}\n </div>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n if (this.type === \"file\") {\n this.value = null;\n } else {\n if (!this.default) {\n this.default = (this.value as string) || \"\";\n }\n if (!this.value) {\n this.value = this.default;\n }\n }\n }\n protected _handleFile(e: any | Event) {\n this.value = !this.only ? e.target.files : e.target.files[0];\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value }));\n }\n\n reset() {\n if (this.type === \"file\") {\n this.value = null;\n return;\n }\n this._input.value = this.default.toString();\n this.value = this.default;\n }\n}\n\nexport default Input;\n"]}
|
@@ -1,29 +1,15 @@
|
|
1
|
-
import
|
2
|
-
import { type HTMLTemplate } from "../../lib/templates.js";
|
3
|
-
import { GodownInput } from "../../supers/input.js";
|
1
|
+
import GodownInput from "../../proto/super-input.js";
|
4
2
|
/**
|
5
3
|
* {@linkcode LabelInput } renders label and input.
|
6
4
|
*
|
7
5
|
* When there is a label, the layout will be adjusted according to the width of the screen.
|
8
6
|
*
|
9
|
-
* Otherwise it behaves similarly to the `
|
7
|
+
* Otherwise it behaves similarly to the `Input`.
|
8
|
+
*
|
10
9
|
*/
|
11
10
|
export declare class LabelInput extends GodownInput {
|
12
|
-
|
13
|
-
|
14
|
-
*/
|
15
|
-
mobile: string;
|
16
|
-
_input: HTMLInputElement;
|
17
|
-
static styles: CSSResultGroup;
|
18
|
-
protected render(): HTMLTemplate[];
|
19
|
-
private renderSuf;
|
20
|
-
protected _passwordSwitcher(): void;
|
11
|
+
variant: "default" | "outline";
|
12
|
+
protected render(): import("lit").TemplateResult<1>;
|
21
13
|
}
|
22
14
|
export default LabelInput;
|
23
|
-
declare global {
|
24
|
-
interface HTMLElementTagNameMap {
|
25
|
-
"label-input": LabelInput;
|
26
|
-
"g-label-input": LabelInput;
|
27
|
-
}
|
28
|
-
}
|
29
15
|
//# sourceMappingURL=label-input.d.ts.map
|