godown 2.7.6 → 3.0.0-canary.0
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 +44 -80
- package/alert.d.ts +2 -3
- package/alert.d.ts.map +1 -1
- package/alert.js +5 -4
- package/alert.js.map +1 -1
- package/avatar.d.ts +2 -3
- package/avatar.d.ts.map +1 -1
- package/avatar.js +5 -4
- package/avatar.js.map +1 -1
- package/breath.d.ts +9 -0
- package/breath.d.ts.map +1 -0
- package/breath.js +6 -0
- package/breath.js.map +1 -0
- package/button.d.ts +2 -3
- package/button.d.ts.map +1 -1
- package/button.js +5 -4
- package/button.js.map +1 -1
- package/card.d.ts +2 -3
- package/card.d.ts.map +1 -1
- package/card.js +5 -4
- package/card.js.map +1 -1
- package/carousel.d.ts +2 -3
- package/carousel.d.ts.map +1 -1
- package/carousel.js +5 -4
- package/carousel.js.map +1 -1
- package/components/alert.d.ts +50 -0
- package/components/alert.d.ts.map +1 -0
- package/components/alert.js +167 -0
- package/components/alert.js.map +1 -0
- package/components/avatar.d.ts +26 -0
- package/components/avatar.d.ts.map +1 -0
- package/components/avatar.js +62 -0
- package/components/avatar.js.map +1 -0
- package/components/breath.d.ts +34 -0
- package/components/breath.d.ts.map +1 -0
- package/components/breath.js +80 -0
- package/components/breath.js.map +1 -0
- package/{web-components/button → components}/button.d.ts +6 -5
- package/components/button.d.ts.map +1 -0
- package/components/button.js +167 -0
- package/components/button.js.map +1 -0
- package/components/card.d.ts +20 -0
- package/components/card.d.ts.map +1 -0
- package/components/card.js +55 -0
- package/components/card.js.map +1 -0
- package/components/carousel.d.ts +40 -0
- package/components/carousel.d.ts.map +1 -0
- package/components/carousel.js +113 -0
- package/components/carousel.js.map +1 -0
- package/{web-components/details → components}/details.d.ts +5 -3
- package/components/details.d.ts.map +1 -0
- package/components/details.js +50 -0
- package/components/details.js.map +1 -0
- package/components/dialog.d.ts +33 -0
- package/components/dialog.d.ts.map +1 -0
- package/components/dialog.js +92 -0
- package/components/dialog.js.map +1 -0
- package/components/divider.d.ts +17 -0
- package/components/divider.d.ts.map +1 -0
- package/components/divider.js +37 -0
- package/components/divider.js.map +1 -0
- package/{web-components/wrapper → components}/dragbox.d.ts +15 -5
- package/components/dragbox.d.ts.map +1 -0
- package/{web-components/wrapper → components}/dragbox.js +32 -27
- package/components/dragbox.js.map +1 -0
- package/components/flex.d.ts +31 -0
- package/components/flex.d.ts.map +1 -0
- package/components/flex.js +55 -0
- package/components/flex.js.map +1 -0
- package/{web-components/form → components}/form.d.ts +4 -2
- package/components/form.d.ts.map +1 -0
- package/{web-components/form → components}/form.js +16 -17
- package/components/form.js.map +1 -0
- package/components/grid.d.ts +31 -0
- package/components/grid.d.ts.map +1 -0
- package/components/grid.js +56 -0
- package/components/grid.js.map +1 -0
- package/components/input.d.ts +20 -0
- package/components/input.d.ts.map +1 -0
- package/components/input.js +54 -0
- package/components/input.js.map +1 -0
- package/components/layout.d.ts +29 -0
- package/components/layout.d.ts.map +1 -0
- package/components/layout.js +48 -0
- package/components/layout.js.map +1 -0
- package/components/link.d.ts +20 -0
- package/components/link.d.ts.map +1 -0
- package/components/link.js +43 -0
- package/components/link.js.map +1 -0
- package/{web-components/progress → components}/progress.d.ts +5 -3
- package/components/progress.d.ts.map +1 -0
- package/components/progress.js +68 -0
- package/components/progress.js.map +1 -0
- package/components/range.d.ts +60 -0
- package/components/range.d.ts.map +1 -0
- package/components/range.js +193 -0
- package/components/range.js.map +1 -0
- package/{web-components/wrapper → components}/rotate.d.ts +4 -8
- package/components/rotate.d.ts.map +1 -0
- package/components/rotate.js +57 -0
- package/components/rotate.js.map +1 -0
- package/components/router.d.ts +121 -0
- package/components/router.d.ts.map +1 -0
- package/components/router.js +251 -0
- package/components/router.js.map +1 -0
- package/components/select.d.ts +50 -0
- package/components/select.d.ts.map +1 -0
- package/components/select.js +211 -0
- package/components/select.js.map +1 -0
- package/{web-components/skeleton → components}/skeleton.d.ts +6 -6
- package/components/skeleton.d.ts.map +1 -0
- package/components/skeleton.js +56 -0
- package/components/skeleton.js.map +1 -0
- package/components/split.d.ts +32 -0
- package/components/split.d.ts.map +1 -0
- package/components/split.js +121 -0
- package/components/split.js.map +1 -0
- package/{web-components/input/switch-input.d.ts → components/switch.d.ts} +9 -10
- package/components/switch.d.ts.map +1 -0
- package/components/switch.js +93 -0
- package/components/switch.js.map +1 -0
- package/{web-components/text → components}/text.d.ts +5 -3
- package/components/text.d.ts.map +1 -0
- package/components/text.js +44 -0
- package/components/text.js.map +1 -0
- package/{web-components/text → components}/time.d.ts +5 -3
- package/components/time.d.ts.map +1 -0
- package/{web-components/text → components}/time.js +18 -21
- package/components/time.js.map +1 -0
- package/components/tooltip.d.ts +38 -0
- package/components/tooltip.d.ts.map +1 -0
- package/components/tooltip.js +67 -0
- package/components/tooltip.js.map +1 -0
- package/{web-components/text → components}/typewriter.d.ts +5 -3
- package/components/typewriter.d.ts.map +1 -0
- package/{web-components/text → components}/typewriter.js +24 -48
- package/components/typewriter.js.map +1 -0
- package/core/global-style.d.ts +21 -0
- package/core/global-style.d.ts.map +1 -0
- package/core/global-style.js +46 -0
- package/core/global-style.js.map +1 -0
- package/core/super-anchor.d.ts +15 -0
- package/core/super-anchor.d.ts.map +1 -0
- package/core/super-anchor.js +39 -0
- package/core/super-anchor.js.map +1 -0
- package/core/super-input.d.ts +39 -0
- package/core/super-input.d.ts.map +1 -0
- package/core/super-input.js +115 -0
- package/core/super-input.js.map +1 -0
- package/{proto → core}/super-openable.d.ts +4 -8
- package/core/super-openable.d.ts.map +1 -0
- package/{proto → core}/super-openable.js +10 -15
- package/core/super-openable.js.map +1 -0
- package/custom-elements.json +1 -0
- package/details.d.ts +2 -3
- package/details.d.ts.map +1 -1
- package/details.js +5 -4
- package/details.js.map +1 -1
- package/dialog.d.ts +2 -3
- package/dialog.d.ts.map +1 -1
- package/dialog.js +5 -4
- package/dialog.js.map +1 -1
- package/divider.d.ts +2 -3
- package/divider.d.ts.map +1 -1
- package/divider.js +5 -4
- package/divider.js.map +1 -1
- package/dragbox.d.ts +2 -3
- package/dragbox.d.ts.map +1 -1
- package/dragbox.js +5 -4
- package/dragbox.js.map +1 -1
- package/flex.d.ts +8 -0
- package/flex.d.ts.map +1 -0
- package/flex.js +6 -0
- package/flex.js.map +1 -0
- package/form.d.ts +2 -3
- package/form.d.ts.map +1 -1
- package/form.js +5 -4
- package/form.js.map +1 -1
- package/grid.d.ts +8 -0
- package/grid.d.ts.map +1 -0
- package/grid.js +6 -0
- package/grid.js.map +1 -0
- package/index.d.ts +28 -32
- package/index.d.ts.map +1 -1
- package/index.js +57 -33
- package/index.js.map +1 -1
- package/input.d.ts +3 -3
- package/input.d.ts.map +1 -1
- package/input.js +5 -4
- package/input.js.map +1 -1
- package/layout.d.ts +3 -3
- package/layout.d.ts.map +1 -1
- package/layout.js +5 -4
- package/layout.js.map +1 -1
- package/link.d.ts +3 -3
- package/link.d.ts.map +1 -1
- package/link.js +5 -4
- package/link.js.map +1 -1
- package/package.json +42 -81
- package/progress.d.ts +3 -3
- package/progress.d.ts.map +1 -1
- package/progress.js +5 -4
- package/progress.js.map +1 -1
- package/range.d.ts +9 -0
- package/range.d.ts.map +1 -0
- package/range.js +6 -0
- package/range.js.map +1 -0
- package/rotate.d.ts +3 -3
- package/rotate.d.ts.map +1 -1
- package/rotate.js +5 -4
- package/rotate.js.map +1 -1
- package/router.d.ts +3 -3
- package/router.d.ts.map +1 -1
- package/router.js +5 -4
- package/router.js.map +1 -1
- package/select.d.ts +9 -0
- package/select.d.ts.map +1 -0
- package/select.js +6 -0
- package/select.js.map +1 -0
- package/skeleton.d.ts +3 -3
- package/skeleton.d.ts.map +1 -1
- package/skeleton.js +5 -4
- package/skeleton.js.map +1 -1
- package/split.d.ts +9 -0
- package/split.d.ts.map +1 -0
- package/split.js +6 -0
- package/split.js.map +1 -0
- package/switch.d.ts +9 -0
- package/switch.d.ts.map +1 -0
- package/switch.js +6 -0
- package/switch.js.map +1 -0
- package/text.d.ts +3 -3
- package/text.d.ts.map +1 -1
- package/text.js +5 -4
- package/text.js.map +1 -1
- package/time.d.ts +3 -3
- package/time.d.ts.map +1 -1
- package/time.js +5 -4
- package/time.js.map +1 -1
- package/tooltip.d.ts +3 -3
- package/tooltip.d.ts.map +1 -1
- package/tooltip.js +5 -4
- package/tooltip.js.map +1 -1
- package/typewriter.d.ts +2 -3
- package/typewriter.d.ts.map +1 -1
- package/typewriter.js +5 -4
- package/typewriter.js.map +1 -1
- package/vscode.css-custom-data.json +1 -0
- package/vscode.html-custom-data.json +1 -0
- package/web-types.json +1 -0
- package/_deps.d.ts +0 -4
- package/_deps.d.ts.map +0 -1
- package/_deps.js +0 -4
- package/_deps.js.map +0 -1
- package/avatar-group.d.ts +0 -9
- package/avatar-group.d.ts.map +0 -1
- package/avatar-group.js +0 -5
- package/avatar-group.js.map +0 -1
- package/components.json +0 -194
- package/conf.d.ts +0 -12
- package/conf.d.ts.map +0 -1
- package/conf.js +0 -24
- package/conf.js.map +0 -1
- package/decorators/godown.d.ts +0 -4
- package/decorators/godown.d.ts.map +0 -1
- package/decorators/godown.js +0 -9
- package/decorators/godown.js.map +0 -1
- package/decorators/part.d.ts +0 -7
- package/decorators/part.d.ts.map +0 -1
- package/decorators/part.js +0 -8
- package/decorators/part.js.map +0 -1
- package/decorators/styles.d.ts +0 -3
- package/decorators/styles.d.ts.map +0 -1
- package/decorators/styles.js +0 -8
- package/decorators/styles.js.map +0 -1
- package/flex-flow.d.ts +0 -9
- package/flex-flow.d.ts.map +0 -1
- package/flex-flow.js +0 -5
- package/flex-flow.js.map +0 -1
- package/grid-flow.d.ts +0 -9
- package/grid-flow.d.ts.map +0 -1
- package/grid-flow.js +0 -5
- package/grid-flow.js.map +0 -1
- package/label-input.d.ts +0 -9
- package/label-input.d.ts.map +0 -1
- package/label-input.js +0 -5
- package/label-input.js.map +0 -1
- package/lib/css.d.ts +0 -13
- package/lib/css.d.ts.map +0 -1
- package/lib/css.js +0 -29
- package/lib/css.js.map +0 -1
- package/lib/directives.d.ts +0 -25
- package/lib/directives.d.ts.map +0 -1
- package/lib/directives.js +0 -40
- package/lib/directives.js.map +0 -1
- package/lib/event-coll.d.ts +0 -13
- package/lib/event-coll.d.ts.map +0 -1
- package/lib/event-coll.js +0 -45
- package/lib/event-coll.js.map +0 -1
- package/lib/icons.d.ts +0 -25
- package/lib/icons.d.ts.map +0 -1
- package/lib/icons.js +0 -73
- package/lib/icons.js.map +0 -1
- package/lib/jsx.d.ts +0 -4
- package/lib/jsx.d.ts.map +0 -1
- package/lib/jsx.js +0 -52
- package/lib/jsx.js.map +0 -1
- package/lib/route-tree.d.ts +0 -28
- package/lib/route-tree.d.ts.map +0 -1
- package/lib/route-tree.js +0 -141
- package/lib/route-tree.js.map +0 -1
- package/lib/utils.d.ts +0 -10
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -71
- package/lib/utils.js.map +0 -1
- package/overbreath.d.ts +0 -9
- package/overbreath.d.ts.map +0 -1
- package/overbreath.js +0 -5
- package/overbreath.js.map +0 -1
- package/proto/godown-config.d.ts +0 -41
- package/proto/godown-config.d.ts.map +0 -1
- package/proto/godown-config.js +0 -27
- package/proto/godown-config.js.map +0 -1
- package/proto/godown-element.d.ts +0 -125
- package/proto/godown-element.d.ts.map +0 -1
- package/proto/godown-element.js +0 -204
- package/proto/godown-element.js.map +0 -1
- package/proto/super-a.d.ts +0 -30
- package/proto/super-a.d.ts.map +0 -1
- package/proto/super-a.js +0 -141
- package/proto/super-a.js.map +0 -1
- package/proto/super-input.d.ts +0 -44
- package/proto/super-input.d.ts.map +0 -1
- package/proto/super-input.js +0 -119
- package/proto/super-input.js.map +0 -1
- package/proto/super-openable.d.ts.map +0 -1
- package/proto/super-openable.js.map +0 -1
- package/range-input.d.ts +0 -9
- package/range-input.d.ts.map +0 -1
- package/range-input.js +0 -5
- package/range-input.js.map +0 -1
- package/react/create.d.ts +0 -5
- package/react/create.d.ts.map +0 -1
- package/react/create.js +0 -16
- package/react/create.js.map +0 -1
- package/react/index.d.ts +0 -65
- package/react/index.d.ts.map +0 -1
- package/react/index.js +0 -132
- package/react/index.js.map +0 -1
- package/router-link.d.ts +0 -9
- package/router-link.d.ts.map +0 -1
- package/router-link.js +0 -5
- package/router-link.js.map +0 -1
- package/search-input.d.ts +0 -9
- package/search-input.d.ts.map +0 -1
- package/search-input.js +0 -5
- package/search-input.js.map +0 -1
- package/select-input.d.ts +0 -9
- package/select-input.d.ts.map +0 -1
- package/select-input.js +0 -5
- package/select-input.js.map +0 -1
- package/split-input.d.ts +0 -9
- package/split-input.d.ts.map +0 -1
- package/split-input.js +0 -5
- package/split-input.js.map +0 -1
- package/styles/colors/presets.d.ts +0 -13
- package/styles/colors/presets.d.ts.map +0 -1
- package/styles/colors/presets.js +0 -6
- package/styles/colors/presets.js.map +0 -1
- package/styles/colors/presetsRGB.d.ts +0 -16
- package/styles/colors/presetsRGB.d.ts.map +0 -1
- package/styles/colors/presetsRGB.js +0 -134
- package/styles/colors/presetsRGB.js.map +0 -1
- package/styles/global.d.ts +0 -18
- package/styles/global.d.ts.map +0 -1
- package/styles/global.js +0 -78
- package/styles/global.js.map +0 -1
- package/styles/inputStyle.d.ts +0 -3
- package/styles/inputStyle.d.ts.map +0 -1
- package/styles/inputStyle.js +0 -59
- package/styles/inputStyle.js.map +0 -1
- package/switch-input.d.ts +0 -9
- package/switch-input.d.ts.map +0 -1
- package/switch-input.js +0 -5
- package/switch-input.js.map +0 -1
- package/web-components/alert/alert.d.ts +0 -36
- package/web-components/alert/alert.d.ts.map +0 -1
- package/web-components/alert/alert.js +0 -161
- package/web-components/alert/alert.js.map +0 -1
- package/web-components/avatar/avatar-group.d.ts +0 -21
- package/web-components/avatar/avatar-group.d.ts.map +0 -1
- package/web-components/avatar/avatar-group.js +0 -86
- package/web-components/avatar/avatar-group.js.map +0 -1
- package/web-components/avatar/avatar.d.ts +0 -28
- package/web-components/avatar/avatar.d.ts.map +0 -1
- package/web-components/avatar/avatar.js +0 -120
- package/web-components/avatar/avatar.js.map +0 -1
- package/web-components/button/button.d.ts.map +0 -1
- package/web-components/button/button.js +0 -256
- package/web-components/button/button.js.map +0 -1
- package/web-components/card/card.d.ts +0 -9
- package/web-components/card/card.d.ts.map +0 -1
- package/web-components/card/card.js +0 -75
- package/web-components/card/card.js.map +0 -1
- package/web-components/carousel/carousel.d.ts +0 -29
- package/web-components/carousel/carousel.d.ts.map +0 -1
- package/web-components/carousel/carousel.js +0 -185
- package/web-components/carousel/carousel.js.map +0 -1
- package/web-components/details/details.d.ts.map +0 -1
- package/web-components/details/details.js +0 -124
- package/web-components/details/details.js.map +0 -1
- package/web-components/dialog/dialog.d.ts +0 -31
- package/web-components/dialog/dialog.d.ts.map +0 -1
- package/web-components/dialog/dialog.js +0 -143
- package/web-components/dialog/dialog.js.map +0 -1
- package/web-components/divider/divider.d.ts +0 -13
- package/web-components/divider/divider.d.ts.map +0 -1
- package/web-components/divider/divider.js +0 -95
- package/web-components/divider/divider.js.map +0 -1
- package/web-components/form/form.d.ts.map +0 -1
- package/web-components/form/form.js.map +0 -1
- package/web-components/input/input.d.ts +0 -37
- package/web-components/input/input.d.ts.map +0 -1
- package/web-components/input/input.js +0 -152
- package/web-components/input/input.js.map +0 -1
- package/web-components/input/label-input.d.ts +0 -15
- package/web-components/input/label-input.d.ts.map +0 -1
- package/web-components/input/label-input.js +0 -96
- package/web-components/input/label-input.js.map +0 -1
- package/web-components/input/range-input.d.ts +0 -53
- package/web-components/input/range-input.d.ts.map +0 -1
- package/web-components/input/range-input.js +0 -316
- package/web-components/input/range-input.js.map +0 -1
- package/web-components/input/search-input.d.ts +0 -42
- package/web-components/input/search-input.d.ts.map +0 -1
- package/web-components/input/search-input.js +0 -214
- package/web-components/input/search-input.js.map +0 -1
- package/web-components/input/select-input.d.ts +0 -36
- package/web-components/input/select-input.d.ts.map +0 -1
- package/web-components/input/select-input.js +0 -210
- package/web-components/input/select-input.js.map +0 -1
- package/web-components/input/split-input.d.ts +0 -29
- package/web-components/input/split-input.d.ts.map +0 -1
- package/web-components/input/split-input.js +0 -184
- package/web-components/input/split-input.js.map +0 -1
- package/web-components/input/switch-input.d.ts.map +0 -1
- package/web-components/input/switch-input.js +0 -189
- package/web-components/input/switch-input.js.map +0 -1
- package/web-components/layout/flex-flow.d.ts +0 -17
- package/web-components/layout/flex-flow.d.ts.map +0 -1
- package/web-components/layout/flex-flow.js +0 -73
- package/web-components/layout/flex-flow.js.map +0 -1
- package/web-components/layout/grid-flow.d.ts +0 -14
- package/web-components/layout/grid-flow.d.ts.map +0 -1
- package/web-components/layout/grid-flow.js +0 -56
- package/web-components/layout/grid-flow.js.map +0 -1
- package/web-components/layout/layout.d.ts +0 -18
- package/web-components/layout/layout.d.ts.map +0 -1
- package/web-components/layout/layout.js +0 -76
- package/web-components/layout/layout.js.map +0 -1
- package/web-components/link/link.d.ts +0 -10
- package/web-components/link/link.d.ts.map +0 -1
- package/web-components/link/link.js +0 -17
- package/web-components/link/link.js.map +0 -1
- package/web-components/link/router-link.d.ts +0 -19
- package/web-components/link/router-link.d.ts.map +0 -1
- package/web-components/link/router-link.js +0 -60
- package/web-components/link/router-link.js.map +0 -1
- package/web-components/progress/progress.d.ts.map +0 -1
- package/web-components/progress/progress.js +0 -107
- package/web-components/progress/progress.js.map +0 -1
- package/web-components/router/router.d.ts +0 -86
- package/web-components/router/router.d.ts.map +0 -1
- package/web-components/router/router.js +0 -246
- package/web-components/router/router.js.map +0 -1
- package/web-components/skeleton/skeleton.d.ts.map +0 -1
- package/web-components/skeleton/skeleton.js +0 -130
- package/web-components/skeleton/skeleton.js.map +0 -1
- package/web-components/text/overbreath.d.ts +0 -22
- package/web-components/text/overbreath.d.ts.map +0 -1
- package/web-components/text/overbreath.js +0 -132
- package/web-components/text/overbreath.js.map +0 -1
- package/web-components/text/text.d.ts.map +0 -1
- package/web-components/text/text.js +0 -94
- package/web-components/text/text.js.map +0 -1
- package/web-components/text/time.d.ts.map +0 -1
- package/web-components/text/time.js.map +0 -1
- package/web-components/text/typewriter.d.ts.map +0 -1
- package/web-components/text/typewriter.js.map +0 -1
- package/web-components/tooltip/tooltip.d.ts +0 -30
- package/web-components/tooltip/tooltip.d.ts.map +0 -1
- package/web-components/tooltip/tooltip.js +0 -123
- package/web-components/tooltip/tooltip.js.map +0 -1
- package/web-components/wrapper/dragbox.d.ts.map +0 -1
- package/web-components/wrapper/dragbox.js.map +0 -1
- package/web-components/wrapper/rotate.d.ts.map +0 -1
- package/web-components/wrapper/rotate.js +0 -92
- package/web-components/wrapper/rotate.js.map +0 -1
@@ -1,316 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"range-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/range-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC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Q,QAAQ;;;;;;;;;;;;;;sBAcZ,QAAQ;;;;;;;;;;;0BAWJ,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;+BAgBd,QAAQ;0BACb,aAAa,CAAC,KAAK;4BACjB,aAAa,CAAC,KAAK;;GAE5C;QACD,GAAG,CAAA;;;qBAGgB,QAAQ;;;;;;;;;;;;;GAa1B;QACD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBF;KACF,CAAC;GACW,UAAU,CA2LtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { part } from \"../../decorators/part.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine, htmlSlot } from \"../../lib/directives.js\";\nimport { isNil, joinProperties, notNil } from \"../../lib/utils.js\";\nimport GodownInput from \"../../proto/super-input.js\";\nimport { createScope, cssGlobalVars } from \"../../styles/global.js\";\nimport { inputStyle } from \"../../styles/inputStyle.js\";\n\nconst protoName = \"range-input\";\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode RangeInput }.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n css`\n :host {\n background: var(--${cssGlobalVars.input}--background);\n margin: 0.25em var(--${cssGlobalVars.input}--outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n border-radius: var(--${cssGlobalVars.input}--radius);\n --${cssScope}--handle-active: rgb(0 118 200);\n --${cssScope}--track-width: .5em;\n display: inline-block;\n width: var(--${cssGlobalVars.input}--width);\n }\n\n :host([vertical]) {\n height: var(--${cssGlobalVars.input}--width);\n width: -moz-fit-content;\n width: fit-content;\n }\n\n i:hover {\n --${cssScope}--handle-scale:1.08;\n }\n\n i:active {\n --${cssScope}--handle-scale:1.05;\n background: var(--${cssScope}--handle-active);\n }\n\n .last-focus {\n z-index: 2;\n }\n\n [part=\"root\"] {\n min-height:inherit;\n position: relative;\n border-radius: inherit;\n width: 100%;\n --start: 0%;\n --end: 50%;\n height: var(--${cssScope}--track-width);\n }\n\n [part=\"track\"] {\n min-height:inherit;\n display: flex;\n position: absolute;\n pointer-events: none;\n border-radius: inherit;\n justify-content: space-between;\n left: min(var(--start), var(--end));\n background: var(--${cssGlobalVars.input}--true);\n width: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));\n }\n\n [part=handle] {\n width: 1em;\n height: 1em;\n display: flex;\n align-items: center;\n justify-content: center;\n -webkit-user-select: none;\n user-select: none;\n position: absolute;\n border: 0.1em solid;\n border-radius: 50%;\n transform-origin: 0% 25%;\n transform: scale(var(--${cssScope}--handle-scale, 1)) translate(-50%, -25%);\n background: var(--${cssGlobalVars.input}--true);\n border-color: var(--${cssGlobalVars.input}--control);\n }\n `,\n css`\n .vertical {\n height: 100%;\n width: var(--${cssScope}--track-width);\n }\n\n .vertical i {\n transform: translate(-25%, -50%);\n }\n\n .vertical [part=\"track\"] {\n width: 100%;\n height: max(calc(var(--end) - var(--start)), calc(var(--start) - var(--end)));\n top: min(var(--start), var(--end));\n left: 0;\n }\n `,\n css`\n :host(:not([range])) .start {\n visibility: hidden;\n }\n\n .start {\n left: var(--start);\n top: 0;\n }\n\n .end {\n left: var(--end);\n top: 0;\n }\n\n .vertical .start {\n top: var(--start);\n left: 0;\n }\n\n .vertical .end {\n top: var(--end);\n left: 0;\n }\n `,\n])\nexport class RangeInput extends GodownInput {\n /**\n * Minimum value.\n */\n @property({ type: Number }) min = 0;\n /**\n * Maximum value.\n */\n @property({ type: Number }) max = 100;\n /**\n * Sliding step length.\n */\n @property({ type: Number }) step = 1;\n /**\n * Enable range sliding.\n */\n @property({ type: Boolean, reflect: true }) range: boolean;\n\n @property({ type: Boolean, reflect: true }) vertical: boolean;\n\n /**\n * When `this.range` is true, it should be [number, number], otherwise number.\n */\n @property({ type: Array }) value: number | [number, number];\n /**\n * The default of `this.value`.\n */\n @property({ type: Array }) default: number | [number, number];\n\n @part(\"root\") _root: HTMLElement;\n\n lastFocus: undefined | 1 | 2;\n\n /**\n * Returns true when the second number is greater than the first number\n */\n get reverse() {\n return this.range ? this.value[0] > this.value[1] : false;\n }\n\n render() {\n const [from, to] = (this.range ? this.value : [0, this.value]) as [number, number];\n const gap = this.max - this.min;\n const style = joinProperties({\n \"--start\": `${((from - this.min) / gap) * 100}%`,\n \"--end\": `${((to - this.min) / gap) * 100}%`,\n });\n return html`<div\n part=\"root\"\n class=\"${combine({\n vertical: this.vertical,\n range: this.range,\n reverse: this.reverse,\n })}\"\n @mousedown=\"${this._handleMousedownRoot}\"\n style=\"${style}\"\n >\n <div part=\"track\"></div>\n <i\n part=\"handle\"\n class=\"${combine(\n {\n \"last-focus\": this.lastFocus === 1,\n },\n \"start\",\n )}\"\n @mousedown=\"${this._handleMousedownStart}\"\n >\n ${htmlSlot(\"start\")}\n </i>\n <i\n part=\"handle\"\n class=\"${combine(\n {\n \"last-focus\": this.lastFocus === 2,\n },\n \"end\",\n )}\"\n @mousedown=\"${this._handleMousedownEnd}\"\n >\n ${htmlSlot(\"end\")}\n </i>\n </div>`;\n }\n\n _handleMousedownStart(e: MouseEvent) {\n this.createMousedownListener(this.setStart)(e);\n }\n _handleMousedownEnd(e: MouseEvent) {\n this.createMousedownListener(this.setEnd)(e);\n }\n\n setStart(value: number) {\n this.lastFocus = 1;\n const i = this.value[1];\n this.value = this.range ? [value, i] : value;\n }\n\n setEnd(value: number) {\n this.lastFocus = 2;\n const i = this.value[0];\n this.value = this.range ? [i, value] : value;\n }\n\n _computeValue(e: MouseEvent) {\n const rect = this._root.getBoundingClientRect();\n const div = this.vertical ? (e.clientY - rect.top) / rect.height : (e.clientX - rect.left) / rect.width;\n let value = Math.round((div * (this.max - this.min)) / this.step) * this.step;\n if (value > this.max) {\n value -= this.step;\n } else if (value < this.min) {\n value += this.step;\n }\n return value;\n }\n\n _handleMousedownRoot(e: MouseEvent) {\n const value = this._computeValue(e);\n if (!this.range || Math.abs(value - this.value[0]) > Math.abs(value - this.value[1])) {\n this.setEnd(value);\n this._handleMousedownEnd(e);\n } else {\n this.setStart(value);\n this._handleMousedownStart(e);\n }\n }\n\n createMousedownListener(mouseMoveCallback: (arg0: number) => void) {\n return (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n const move = this.createMousemoveListener(mouseMoveCallback);\n document.addEventListener(\"mousemove\", move);\n const stop = () => {\n document.removeEventListener(\"mousemove\", move);\n document.removeEventListener(\"mouseup\", stop);\n };\n document.addEventListener(\"mouseup\", stop);\n };\n }\n\n createMousemoveListener(callback: (arg0: number) => void) {\n return (e: MouseEvent) => {\n const value = this._computeValue(e);\n if (value > this.max || value < this.min) {\n return;\n }\n callback?.call(this, value);\n };\n }\n\n _connectedInit() {\n const gap = this.max - this.min;\n this.step ||= gap / 100;\n if (notNil(this.default) && isNil(this.value)) {\n this.value = this.default;\n } else if (isNil(this.default) && notNil(this.value)) {\n this.default = this.value;\n } else {\n const mid = Math.round(gap / 2 / this.step) * this.step;\n this.default = this.range ? [0, mid] : mid;\n this.value = this.default;\n }\n }\n\n reset() {\n this.value = this.default;\n }\n\n swap() {\n if (this.range) {\n const [a, b] = this.value as [number, number];\n this.value = [b, a];\n }\n }\n\n sort() {\n this.value = this.toSorted();\n }\n\n toSorted(): number | [number, number] {\n if (this.range) {\n const [a, b] = this.value as [number, number];\n return a > b ? [b, a] : [a, b];\n }\n return this.value;\n }\n}\n\nexport default RangeInput;\n"]}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import GodownInput from "../../proto/super-input.js";
|
2
|
-
/**
|
3
|
-
* {@linkcode SearchInput} used for search behavior.
|
4
|
-
*/
|
5
|
-
export declare class SearchInput extends GodownInput {
|
6
|
-
/**
|
7
|
-
* Query selectors.
|
8
|
-
*/
|
9
|
-
query: string;
|
10
|
-
/**
|
11
|
-
* Target selectors.
|
12
|
-
*/
|
13
|
-
target: string;
|
14
|
-
/**
|
15
|
-
* @deprecated
|
16
|
-
*/
|
17
|
-
infer: boolean;
|
18
|
-
/**
|
19
|
-
* Float result.
|
20
|
-
*/
|
21
|
-
float: boolean;
|
22
|
-
/**
|
23
|
-
* Form action.
|
24
|
-
*/
|
25
|
-
action: string;
|
26
|
-
/**
|
27
|
-
* Form method.
|
28
|
-
*/
|
29
|
-
method: "get" | "post";
|
30
|
-
/**
|
31
|
-
* Form name.
|
32
|
-
*/
|
33
|
-
name: string;
|
34
|
-
variant: "default" | "outline";
|
35
|
-
_input: HTMLInputElement;
|
36
|
-
protected render(): import("lit").TemplateResult<1>;
|
37
|
-
protected _handleSubmit(e: Event): void;
|
38
|
-
protected _handleInput(e: Event): void;
|
39
|
-
searchElements(s: string): void;
|
40
|
-
}
|
41
|
-
export default SearchInput;
|
42
|
-
//# sourceMappingURL=search-input.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"search-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/search-input.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAQrD;;GAEG;AACH,qBAoFa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACS,KAAK,SAAM;IACvB;;OAEG;IACS,MAAM,SAAM;IACxB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACyC,KAAK,UAAS;IAC1D;;OAEG;IACS,MAAM,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACS,MAAM,EAAE,KAAK,GAAG,MAAM,CAAS;IAC3C;;OAEG;IACS,IAAI,SAAO;IAEX,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IAEvC,MAAM,EAAG,gBAAgB,CAAC;IAE1C,SAAS,CAAC,MAAM;IA2BhB,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK;IAOhC,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK;IAiB/B,cAAc,CAAC,CAAC,EAAE,MAAM;CAezB;AAED,eAAe,WAAW,CAAC"}
|
@@ -1,214 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import { css, html, ifDefined, property, query } 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 { htmlSlot } from "../../lib/directives.js";
|
7
|
-
import { svgSearch } from "../../lib/icons.js";
|
8
|
-
import GodownInput from "../../proto/super-input.js";
|
9
|
-
import { createScope, cssGlobalVars } from "../../styles/global.js";
|
10
|
-
import { fieldStyle, inputStyle } from "../../styles/inputStyle.js";
|
11
|
-
const protoName = "search-input";
|
12
|
-
const cssScope = createScope(protoName);
|
13
|
-
/**
|
14
|
-
* {@linkcode SearchInput} used for search behavior.
|
15
|
-
*/
|
16
|
-
let SearchInput = class SearchInput extends GodownInput {
|
17
|
-
constructor() {
|
18
|
-
super(...arguments);
|
19
|
-
/**
|
20
|
-
* Query selectors.
|
21
|
-
*/
|
22
|
-
this.query = "";
|
23
|
-
/**
|
24
|
-
* Target selectors.
|
25
|
-
*/
|
26
|
-
this.target = "";
|
27
|
-
/**
|
28
|
-
* Float result.
|
29
|
-
*/
|
30
|
-
this.float = false;
|
31
|
-
/**
|
32
|
-
* Form method.
|
33
|
-
*/
|
34
|
-
this.method = "get";
|
35
|
-
/**
|
36
|
-
* Form name.
|
37
|
-
*/
|
38
|
-
this.name = "q";
|
39
|
-
this.variant = "default";
|
40
|
-
}
|
41
|
-
render() {
|
42
|
-
return html `<form
|
43
|
-
part="root"
|
44
|
-
class="${combine({
|
45
|
-
outline: this.variant === "outline",
|
46
|
-
}, "input-field")}"
|
47
|
-
action="${ifDefined(this.action)}"
|
48
|
-
method="${this.method}"
|
49
|
-
>
|
50
|
-
<div class="search">
|
51
|
-
<input
|
52
|
-
.value="${this.value}"
|
53
|
-
?autofocus="${this.autofocus}"
|
54
|
-
name="${this.name}"
|
55
|
-
@focus="${this._handleInput}"
|
56
|
-
@input="${this._handleInput}"
|
57
|
-
placeholder="${this.placeholder}"
|
58
|
-
/>
|
59
|
-
<div class="icon" @click="${this._handleSubmit}">${svgSearch()}</div>
|
60
|
-
</div>
|
61
|
-
<div class="result">${htmlSlot()}</div>
|
62
|
-
</form>`;
|
63
|
-
}
|
64
|
-
_handleSubmit(e) {
|
65
|
-
if (!this.action) {
|
66
|
-
e.preventDefault();
|
67
|
-
}
|
68
|
-
this.dispatchEvent(new CustomEvent("submit", { detail: this.value }));
|
69
|
-
}
|
70
|
-
_handleInput(e) {
|
71
|
-
e.stopPropagation();
|
72
|
-
const value = this.targetValue(e);
|
73
|
-
if (value === this.value) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
this.value = value;
|
77
|
-
if (this.compositing) {
|
78
|
-
return;
|
79
|
-
}
|
80
|
-
if (this.target && this.query) {
|
81
|
-
this.searchElements(this.value);
|
82
|
-
}
|
83
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
|
84
|
-
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
85
|
-
}
|
86
|
-
searchElements(s) {
|
87
|
-
const targetElement = document.body.querySelector(this.target);
|
88
|
-
const queryElementsCollection = document.body.querySelectorAll(this.query);
|
89
|
-
if (!targetElement) {
|
90
|
-
return;
|
91
|
-
}
|
92
|
-
targetElement.replaceChildren();
|
93
|
-
if (s && queryElementsCollection.length) {
|
94
|
-
for (const e of queryElementsCollection) {
|
95
|
-
if (e.textContent.includes(this.value)) {
|
96
|
-
targetElement.appendChild(e.cloneNode(true));
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
};
|
102
|
-
__decorate([
|
103
|
-
property()
|
104
|
-
], SearchInput.prototype, "query", void 0);
|
105
|
-
__decorate([
|
106
|
-
property()
|
107
|
-
], SearchInput.prototype, "target", void 0);
|
108
|
-
__decorate([
|
109
|
-
property({ type: Boolean, reflect: true })
|
110
|
-
], SearchInput.prototype, "float", void 0);
|
111
|
-
__decorate([
|
112
|
-
property()
|
113
|
-
], SearchInput.prototype, "action", void 0);
|
114
|
-
__decorate([
|
115
|
-
property()
|
116
|
-
], SearchInput.prototype, "method", void 0);
|
117
|
-
__decorate([
|
118
|
-
property()
|
119
|
-
], SearchInput.prototype, "name", void 0);
|
120
|
-
__decorate([
|
121
|
-
property()
|
122
|
-
], SearchInput.prototype, "variant", void 0);
|
123
|
-
__decorate([
|
124
|
-
query("input")
|
125
|
-
], SearchInput.prototype, "_input", void 0);
|
126
|
-
SearchInput = __decorate([
|
127
|
-
godown(protoName),
|
128
|
-
styles([
|
129
|
-
inputStyle,
|
130
|
-
fieldStyle,
|
131
|
-
css `
|
132
|
-
:host {
|
133
|
-
--${cssScope}--width:var(--${cssGlobalVars.input}--width);
|
134
|
-
width: var(--${cssGlobalVars.input}--width);
|
135
|
-
margin: var(--${cssGlobalVars.input}-outline-width);
|
136
|
-
border-radius: var(--${cssGlobalVars.input}--radius);
|
137
|
-
background: var(--${cssGlobalVars.input}--background);
|
138
|
-
color: var(--${cssGlobalVars.foreground});
|
139
|
-
display: block;
|
140
|
-
}
|
141
|
-
|
142
|
-
.search {
|
143
|
-
width: 100%;
|
144
|
-
flex: 1;
|
145
|
-
display: flex;
|
146
|
-
z-index: 2;
|
147
|
-
height: var(--${cssGlobalVars.input}--height);
|
148
|
-
}
|
149
|
-
|
150
|
-
form {
|
151
|
-
min-height: 100%;
|
152
|
-
outline: 0.145em solid transparent;
|
153
|
-
display: flex;
|
154
|
-
flex-direction: column;
|
155
|
-
border-radius: inherit;
|
156
|
-
padding: 0;
|
157
|
-
width: 100%;
|
158
|
-
margin: 0;
|
159
|
-
position: relative;
|
160
|
-
overflow: hidden;
|
161
|
-
}
|
162
|
-
|
163
|
-
:host([float]) form {
|
164
|
-
overflow: visible;
|
165
|
-
}
|
166
|
-
|
167
|
-
.result {
|
168
|
-
list-style: none;
|
169
|
-
width: 100%;
|
170
|
-
pointer-events: none;
|
171
|
-
border-radius: inherit;
|
172
|
-
z-index: 2;
|
173
|
-
}
|
174
|
-
|
175
|
-
:host([float]) div.result {
|
176
|
-
background: var(--${cssGlobalVars.input}--background);
|
177
|
-
padding-top: 1.5em;
|
178
|
-
position: absolute;
|
179
|
-
z-index: 1;
|
180
|
-
top: 0;
|
181
|
-
}
|
182
|
-
|
183
|
-
:host([float]:focus) form {
|
184
|
-
outline: none;
|
185
|
-
}
|
186
|
-
|
187
|
-
:host([float]:focus) .result {
|
188
|
-
outline: var(--${cssGlobalVars.input}--outline);
|
189
|
-
}
|
190
|
-
|
191
|
-
.icon {
|
192
|
-
height: inherit;
|
193
|
-
display: flex;
|
194
|
-
align-items: center;
|
195
|
-
background: none;
|
196
|
-
padding-right: 0.25em;
|
197
|
-
}
|
198
|
-
|
199
|
-
input {
|
200
|
-
flex: 1;
|
201
|
-
min-width: 0;
|
202
|
-
box-sizing: border-box;
|
203
|
-
}
|
204
|
-
|
205
|
-
svg {
|
206
|
-
height: 1em;
|
207
|
-
width: 1em;
|
208
|
-
}
|
209
|
-
`,
|
210
|
-
])
|
211
|
-
], SearchInput);
|
212
|
-
export { SearchInput };
|
213
|
-
export default SearchInput;
|
214
|
-
//# sourceMappingURL=search-input.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"search-input.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/search-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAA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,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACvC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAhGa;IAAX,QAAQ,EAAE;0CAAY;AAIX;IAAX,QAAQ,EAAE;2CAAa;AAQoB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAI9C;IAAX,QAAQ,EAAE;2CAAgB;AAIf;IAAX,QAAQ,EAAE;2CAAgC;AAI/B;IAAX,QAAQ,EAAE;yCAAY;AAEX;IAAX,QAAQ,EAAE;4CAA4C;AAEvC;IAAf,KAAK,CAAC,OAAO,CAAC;2CAA2B;AAhC/B,WAAW;IApFvB,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC;QACN,UAAU;QACV,UAAU;QACV,GAAG,CAAA;;UAEK,QAAQ,iBAAiB,aAAa,CAAC,KAAK;qBACjC,aAAa,CAAC,KAAK;sBAClB,aAAa,CAAC,KAAK;6BACZ,aAAa,CAAC,KAAK;0BACtB,aAAa,CAAC,KAAK;qBACxB,aAAa,CAAC,UAAU;;;;;;;;;sBASvB,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6Bf,aAAa,CAAC,KAAK;;;;;;;;;;;;uBAYtB,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;;;;;;GAqBvC;KACF,CAAC;GACW,WAAW,CAoGvB;;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { css, html, ifDefined, property, query } from \"../../_deps.js\";\nimport { godown } from \"../../decorators/godown.js\";\nimport { styles } from \"../../decorators/styles.js\";\nimport { combine } from \"../../lib/directives.js\";\nimport { htmlSlot } from \"../../lib/directives.js\";\nimport { svgSearch } from \"../../lib/icons.js\";\nimport GodownInput from \"../../proto/super-input.js\";\nimport { createScope, cssGlobalVars } from \"../../styles/global.js\";\nimport { fieldStyle, inputStyle } from \"../../styles/inputStyle.js\";\n\nconst protoName = \"search-input\";\n\nconst cssScope = createScope(protoName);\n\n/**\n * {@linkcode SearchInput} used for search behavior.\n */\n@godown(protoName)\n@styles([\n inputStyle,\n fieldStyle,\n css`\n :host {\n --${cssScope}--width:var(--${cssGlobalVars.input}--width);\n width: var(--${cssGlobalVars.input}--width);\n margin: var(--${cssGlobalVars.input}-outline-width);\n border-radius: var(--${cssGlobalVars.input}--radius);\n background: var(--${cssGlobalVars.input}--background);\n color: var(--${cssGlobalVars.foreground});\n display: block;\n }\n\n .search {\n width: 100%;\n flex: 1;\n display: flex;\n z-index: 2;\n height: var(--${cssGlobalVars.input}--height);\n }\n\n form {\n min-height: 100%;\n outline: 0.145em solid transparent;\n display: flex;\n flex-direction: column;\n border-radius: inherit;\n padding: 0;\n width: 100%;\n margin: 0;\n position: relative;\n overflow: hidden;\n }\n\n :host([float]) form {\n overflow: visible;\n }\n\n .result {\n list-style: none;\n width: 100%;\n pointer-events: none;\n border-radius: inherit;\n z-index: 2;\n }\n\n :host([float]) div.result {\n background: var(--${cssGlobalVars.input}--background);\n padding-top: 1.5em;\n position: absolute;\n z-index: 1;\n top: 0;\n }\n\n :host([float]:focus) form {\n outline: none;\n }\n\n :host([float]:focus) .result {\n outline: var(--${cssGlobalVars.input}--outline);\n }\n\n .icon {\n height: inherit;\n display: flex;\n align-items: center;\n background: none;\n padding-right: 0.25em;\n }\n\n input {\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n }\n\n svg {\n height: 1em;\n width: 1em;\n }\n `,\n])\nexport class SearchInput extends GodownInput {\n /**\n * Query selectors.\n */\n @property() query = \"\";\n /**\n * Target selectors.\n */\n @property() target = \"\";\n /**\n * @deprecated\n */\n infer: boolean;\n /**\n * Float result.\n */\n @property({ type: Boolean, reflect: true }) float = false;\n /**\n * Form action.\n */\n @property() action: string;\n /**\n * Form method.\n */\n @property() method: \"get\" | \"post\" = \"get\";\n /**\n * Form name.\n */\n @property() name = \"q\";\n\n @property() variant: \"default\" | \"outline\" = \"default\";\n\n @query(\"input\") _input!: HTMLInputElement;\n\n protected render() {\n return html`<form\n part=\"root\"\n class=\"${combine(\n {\n outline: this.variant === \"outline\",\n },\n \"input-field\",\n )}\"\n action=\"${ifDefined(this.action)}\"\n method=\"${this.method}\"\n >\n <div class=\"search\">\n <input\n .value=\"${this.value}\"\n ?autofocus=\"${this.autofocus}\"\n name=\"${this.name}\"\n @focus=\"${this._handleInput}\"\n @input=\"${this._handleInput}\"\n placeholder=\"${this.placeholder}\"\n />\n <div class=\"icon\" @click=\"${this._handleSubmit}\">${svgSearch()}</div>\n </div>\n <div class=\"result\">${htmlSlot()}</div>\n </form>`;\n }\n\n protected _handleSubmit(e: Event) {\n if (!this.action) {\n e.preventDefault();\n }\n this.dispatchEvent(new CustomEvent(\"submit\", { detail: this.value }));\n }\n\n protected _handleInput(e: Event) {\n e.stopPropagation();\n const value: string = this.targetValue(e);\n if (value === this.value) {\n return;\n }\n this.value = value;\n if (this.compositing) {\n return;\n }\n if (this.target && this.query) {\n this.searchElements(this.value);\n }\n this.dispatchEvent(new CustomEvent(\"input\", { detail: this.value, bubbles: true, composed: true }));\n this.dispatchEvent(new CustomEvent(\"change\", { detail: this.value, composed: true }));\n }\n\n searchElements(s: string) {\n const targetElement = document.body.querySelector(this.target);\n const queryElementsCollection = document.body.querySelectorAll(this.query);\n if (!targetElement) {\n return;\n }\n targetElement.replaceChildren();\n if (s && queryElementsCollection.length) {\n for (const e of queryElementsCollection) {\n if (e.textContent.includes(this.value)) {\n targetElement.appendChild(e.cloneNode(true));\n }\n }\n }\n }\n}\n\nexport default SearchInput;\n"]}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import GodownInput from "../../proto/super-input.js";
|
2
|
-
/**
|
3
|
-
* {@linkcode SelectInput} select matched elements.
|
4
|
-
*
|
5
|
-
* This will not support multi-selection operations.
|
6
|
-
*
|
7
|
-
* @slot - Options.
|
8
|
-
*/
|
9
|
-
export declare class SelectInput extends GodownInput {
|
10
|
-
/**
|
11
|
-
* Open content.
|
12
|
-
*/
|
13
|
-
open: boolean;
|
14
|
-
/**
|
15
|
-
* Selected texts.
|
16
|
-
*/
|
17
|
-
text: string;
|
18
|
-
/**
|
19
|
-
* Selected texts.
|
20
|
-
*/
|
21
|
-
defaultText: string;
|
22
|
-
protected render(): import("lit").TemplateResult<1>;
|
23
|
-
protected firstUpdated(): void;
|
24
|
-
select(value: string, text?: string): void;
|
25
|
-
filter(value?: string): void;
|
26
|
-
reset(): void;
|
27
|
-
protected _handleInput(): void;
|
28
|
-
focus(options?: FocusOptions): void;
|
29
|
-
getOptionValue(option: Element): string;
|
30
|
-
/**
|
31
|
-
* @deprecated
|
32
|
-
*/
|
33
|
-
only: boolean;
|
34
|
-
}
|
35
|
-
export default SelectInput;
|
36
|
-
//# sourceMappingURL=select-input.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"select-input.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/input/select-input.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAMrD;;;;;;GAMG;AACH,qBAgFa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACyC,IAAI,UAAS;IAEzD;;OAEG;IACS,IAAI,EAAE,MAAM,CAAC;IACzB;;OAEG;IAIH,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,MAAM;IA6BhB,SAAS,CAAC,YAAY;IAetB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAQnC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM;IAgBrB,KAAK;IAML,SAAS,CAAC,YAAY;IAKtB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAK5B,cAAc,CAAC,MAAM,EAAE,OAAO;IAG9B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAe,WAAW,CAAC"}
|