godown 2.7.4 → 2.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -45
- package/{.deps.d.ts → _deps.d.ts} +1 -2
- package/{.deps.d.ts.map → _deps.d.ts.map} +1 -1
- package/{.deps.js → _deps.js} +1 -2
- package/_deps.js.map +1 -0
- package/alert.d.ts +8 -1
- package/alert.d.ts.map +1 -1
- package/alert.js +4 -1
- package/alert.js.map +1 -1
- package/avatar-group.d.ts +8 -1
- package/avatar-group.d.ts.map +1 -1
- package/avatar-group.js +4 -1
- package/avatar-group.js.map +1 -1
- package/avatar.d.ts +8 -1
- package/avatar.d.ts.map +1 -1
- package/avatar.js +4 -1
- package/avatar.js.map +1 -1
- package/button.d.ts +8 -1
- package/button.d.ts.map +1 -1
- package/button.js +4 -1
- package/button.js.map +1 -1
- package/card.d.ts +8 -1
- package/card.d.ts.map +1 -1
- package/card.js +4 -1
- package/card.js.map +1 -1
- package/carousel.d.ts +8 -1
- package/carousel.d.ts.map +1 -1
- package/carousel.js +4 -1
- package/carousel.js.map +1 -1
- package/components.json +194 -0
- package/conf.d.ts +6 -75
- package/conf.d.ts.map +1 -1
- package/conf.js +8 -34
- package/conf.js.map +1 -1
- package/decorators/godown.d.ts +4 -0
- package/decorators/godown.d.ts.map +1 -0
- package/decorators/godown.js +9 -0
- package/decorators/godown.js.map +1 -0
- package/decorators/part.d.ts +7 -0
- package/decorators/part.d.ts.map +1 -0
- package/decorators/part.js +8 -0
- package/decorators/part.js.map +1 -0
- package/decorators/styles.d.ts +3 -0
- package/decorators/styles.d.ts.map +1 -0
- package/decorators/styles.js +8 -0
- package/decorators/styles.js.map +1 -0
- package/details.d.ts +8 -1
- package/details.d.ts.map +1 -1
- package/details.js +4 -1
- package/details.js.map +1 -1
- package/dialog.d.ts +8 -1
- package/dialog.d.ts.map +1 -1
- package/dialog.js +4 -1
- package/dialog.js.map +1 -1
- package/divider.d.ts +8 -1
- package/divider.d.ts.map +1 -1
- package/divider.js +4 -1
- package/divider.js.map +1 -1
- package/dragbox.d.ts +8 -1
- package/dragbox.d.ts.map +1 -1
- package/dragbox.js +4 -1
- package/dragbox.js.map +1 -1
- package/flex-flow.d.ts +8 -1
- package/flex-flow.d.ts.map +1 -1
- package/flex-flow.js +4 -1
- package/flex-flow.js.map +1 -1
- package/form.d.ts +8 -1
- package/form.d.ts.map +1 -1
- package/form.js +4 -1
- package/form.js.map +1 -1
- package/grid-flow.d.ts +9 -0
- package/grid-flow.d.ts.map +1 -0
- package/grid-flow.js +5 -0
- package/grid-flow.js.map +1 -0
- package/index.d.ts +32 -3
- package/index.d.ts.map +1 -1
- package/index.js +32 -3
- package/index.js.map +1 -1
- package/input.d.ts +8 -1
- package/input.d.ts.map +1 -1
- package/input.js +4 -1
- package/input.js.map +1 -1
- package/label-input.d.ts +8 -1
- package/label-input.d.ts.map +1 -1
- package/label-input.js +4 -1
- package/label-input.js.map +1 -1
- package/layout.d.ts +9 -0
- package/layout.d.ts.map +1 -0
- package/layout.js +5 -0
- package/layout.js.map +1 -0
- package/lib/css.d.ts +13 -0
- package/lib/css.d.ts.map +1 -0
- package/lib/css.js +29 -0
- package/lib/css.js.map +1 -0
- package/lib/directives.d.ts +16 -20
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js +33 -31
- package/lib/directives.js.map +1 -1
- package/lib/event-coll.d.ts +13 -0
- package/lib/event-coll.d.ts.map +1 -0
- package/lib/event-coll.js +45 -0
- package/lib/event-coll.js.map +1 -0
- package/lib/{templates.d.ts → icons.d.ts} +1 -17
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +73 -0
- package/lib/icons.js.map +1 -0
- package/lib/jsx.d.ts +4 -0
- package/lib/jsx.d.ts.map +1 -0
- package/lib/jsx.js +52 -0
- package/lib/jsx.js.map +1 -0
- package/lib/route-tree.d.ts +5 -5
- package/lib/route-tree.js +5 -5
- package/lib/route-tree.js.map +1 -1
- package/lib/utils.d.ts +6 -46
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +25 -110
- package/lib/utils.js.map +1 -1
- package/link.d.ts +9 -0
- package/link.d.ts.map +1 -0
- package/link.js +5 -0
- package/link.js.map +1 -0
- package/overbreath.d.ts +8 -1
- package/overbreath.d.ts.map +1 -1
- package/overbreath.js +4 -1
- package/overbreath.js.map +1 -1
- package/package.json +20 -25
- package/progress.d.ts +8 -1
- package/progress.d.ts.map +1 -1
- package/progress.js +4 -1
- package/progress.js.map +1 -1
- package/proto/godown-config.d.ts +41 -0
- package/proto/godown-config.d.ts.map +1 -0
- package/proto/godown-config.js +27 -0
- package/proto/godown-config.js.map +1 -0
- package/{godown-element.d.ts → proto/godown-element.d.ts} +48 -16
- package/proto/godown-element.d.ts.map +1 -0
- package/{godown-element.js → proto/godown-element.js} +82 -26
- package/proto/godown-element.js.map +1 -0
- package/proto/super-a.d.ts +30 -0
- package/proto/super-a.d.ts.map +1 -0
- package/proto/super-a.js +141 -0
- package/proto/super-a.js.map +1 -0
- package/proto/super-input.d.ts +44 -0
- package/proto/super-input.d.ts.map +1 -0
- package/proto/super-input.js +119 -0
- package/proto/super-input.js.map +1 -0
- package/proto/super-openable.d.ts +23 -0
- package/proto/super-openable.d.ts.map +1 -0
- package/proto/super-openable.js +43 -0
- package/proto/super-openable.js.map +1 -0
- package/range-input.d.ts +9 -0
- package/range-input.d.ts.map +1 -0
- package/range-input.js +5 -0
- package/range-input.js.map +1 -0
- package/react/create.d.ts.map +1 -1
- package/react/create.js +4 -1
- package/react/create.js.map +1 -1
- package/react/index.d.ts +64 -34
- package/react/index.d.ts.map +1 -1
- package/react/index.js +78 -51
- package/react/index.js.map +1 -1
- package/rotate.d.ts +9 -0
- package/rotate.d.ts.map +1 -0
- package/rotate.js +5 -0
- package/rotate.js.map +1 -0
- package/router-link.d.ts +9 -0
- package/router-link.d.ts.map +1 -0
- package/router-link.js +5 -0
- package/router-link.js.map +1 -0
- package/router.d.ts +8 -1
- package/router.d.ts.map +1 -1
- package/router.js +4 -1
- package/router.js.map +1 -1
- package/search-input.d.ts +8 -1
- package/search-input.d.ts.map +1 -1
- package/search-input.js +4 -1
- package/search-input.js.map +1 -1
- package/select-input.d.ts +8 -1
- package/select-input.d.ts.map +1 -1
- package/select-input.js +4 -1
- package/select-input.js.map +1 -1
- package/skeleton.d.ts +8 -1
- package/skeleton.d.ts.map +1 -1
- package/skeleton.js +4 -1
- package/skeleton.js.map +1 -1
- package/split-input.d.ts +8 -1
- package/split-input.d.ts.map +1 -1
- package/split-input.js +4 -1
- package/split-input.js.map +1 -1
- package/styles/colors/presets.d.ts +13 -0
- package/styles/colors/presets.d.ts.map +1 -0
- package/styles/colors/presets.js +6 -0
- package/styles/colors/presets.js.map +1 -0
- package/styles/colors/presetsRGB.d.ts +16 -0
- package/styles/colors/presetsRGB.d.ts.map +1 -0
- package/styles/colors/presetsRGB.js +134 -0
- package/styles/colors/presetsRGB.js.map +1 -0
- package/styles/global.d.ts +18 -0
- package/styles/global.d.ts.map +1 -0
- package/styles/global.js +78 -0
- package/styles/global.js.map +1 -0
- package/styles/inputStyle.d.ts +3 -0
- package/styles/inputStyle.d.ts.map +1 -0
- package/styles/inputStyle.js +59 -0
- package/styles/inputStyle.js.map +1 -0
- package/switch-input.d.ts +8 -1
- package/switch-input.d.ts.map +1 -1
- package/switch-input.js +4 -1
- package/switch-input.js.map +1 -1
- package/text.d.ts +8 -1
- package/text.d.ts.map +1 -1
- package/text.js +4 -1
- package/text.js.map +1 -1
- package/time.d.ts +8 -1
- package/time.d.ts.map +1 -1
- package/time.js +4 -1
- package/time.js.map +1 -1
- package/tooltip.d.ts +8 -1
- package/tooltip.d.ts.map +1 -1
- package/tooltip.js +4 -1
- package/tooltip.js.map +1 -1
- package/typewriter.d.ts +8 -1
- package/typewriter.d.ts.map +1 -1
- package/typewriter.js +4 -1
- package/typewriter.js.map +1 -1
- package/web-components/alert/alert.d.ts +2 -10
- package/web-components/alert/alert.d.ts.map +1 -1
- package/web-components/alert/alert.js +93 -91
- package/web-components/alert/alert.js.map +1 -1
- package/web-components/avatar/avatar-group.d.ts +21 -0
- package/web-components/avatar/avatar-group.d.ts.map +1 -0
- package/web-components/avatar/avatar-group.js +86 -0
- package/web-components/avatar/avatar-group.js.map +1 -0
- package/web-components/avatar/avatar.d.ts +5 -18
- package/web-components/avatar/avatar.d.ts.map +1 -1
- package/web-components/avatar/avatar.js +70 -85
- package/web-components/avatar/avatar.js.map +1 -1
- package/web-components/button/button.d.ts +10 -43
- package/web-components/button/button.d.ts.map +1 -1
- package/web-components/button/button.js +183 -226
- package/web-components/button/button.js.map +1 -1
- package/web-components/card/card.d.ts +2 -27
- package/web-components/card/card.d.ts.map +1 -1
- package/web-components/card/card.js +57 -132
- package/web-components/card/card.js.map +1 -1
- package/web-components/carousel/carousel.d.ts +5 -16
- package/web-components/carousel/carousel.d.ts.map +1 -1
- package/web-components/carousel/carousel.js +102 -106
- package/web-components/carousel/carousel.js.map +1 -1
- package/web-components/details/details.d.ts +4 -15
- package/web-components/details/details.d.ts.map +1 -1
- package/web-components/details/details.js +91 -97
- package/web-components/details/details.js.map +1 -1
- package/web-components/dialog/dialog.d.ts +6 -17
- package/web-components/dialog/dialog.d.ts.map +1 -1
- package/web-components/dialog/dialog.js +87 -137
- package/web-components/dialog/dialog.js.map +1 -1
- package/web-components/divider/divider.d.ts +13 -0
- package/web-components/divider/divider.d.ts.map +1 -0
- package/web-components/divider/divider.js +95 -0
- package/web-components/divider/divider.js.map +1 -0
- package/web-components/form/form.d.ts +15 -22
- package/web-components/form/form.d.ts.map +1 -1
- package/web-components/form/form.js +47 -117
- package/web-components/form/form.js.map +1 -1
- package/web-components/input/input.d.ts +5 -18
- package/web-components/input/input.d.ts.map +1 -1
- package/web-components/input/input.js +74 -169
- package/web-components/input/input.js.map +1 -1
- package/web-components/input/label-input.d.ts +5 -19
- package/web-components/input/label-input.d.ts.map +1 -1
- package/web-components/input/label-input.js +74 -141
- package/web-components/input/label-input.js.map +1 -1
- package/web-components/input/range-input.d.ts +53 -0
- package/web-components/input/range-input.d.ts.map +1 -0
- package/web-components/input/range-input.js +316 -0
- package/web-components/input/range-input.js.map +1 -0
- package/web-components/input/search-input.d.ts +4 -12
- package/web-components/input/search-input.d.ts.map +1 -1
- package/web-components/input/search-input.js +118 -113
- package/web-components/input/search-input.js.map +1 -1
- package/web-components/input/select-input.d.ts +17 -32
- package/web-components/input/select-input.d.ts.map +1 -1
- package/web-components/input/select-input.js +154 -286
- package/web-components/input/select-input.js.map +1 -1
- package/web-components/input/split-input.d.ts +8 -15
- package/web-components/input/split-input.d.ts.map +1 -1
- package/web-components/input/split-input.js +82 -72
- package/web-components/input/split-input.js.map +1 -1
- package/web-components/input/switch-input.d.ts +8 -17
- package/web-components/input/switch-input.d.ts.map +1 -1
- package/web-components/input/switch-input.js +122 -158
- package/web-components/input/switch-input.js.map +1 -1
- package/web-components/layout/flex-flow.d.ts +11 -19
- package/web-components/layout/flex-flow.d.ts.map +1 -1
- package/web-components/layout/flex-flow.js +57 -35
- package/web-components/layout/flex-flow.js.map +1 -1
- package/web-components/layout/grid-flow.d.ts +14 -0
- package/web-components/layout/grid-flow.d.ts.map +1 -0
- package/web-components/layout/grid-flow.js +56 -0
- package/web-components/layout/grid-flow.js.map +1 -0
- package/web-components/layout/layout.d.ts +18 -0
- package/web-components/layout/layout.d.ts.map +1 -0
- package/web-components/layout/layout.js +76 -0
- package/web-components/layout/layout.js.map +1 -0
- package/web-components/link/link.d.ts +10 -0
- package/web-components/link/link.d.ts.map +1 -0
- package/web-components/link/link.js +17 -0
- package/web-components/link/link.js.map +1 -0
- package/web-components/link/router-link.d.ts +19 -0
- package/web-components/link/router-link.d.ts.map +1 -0
- package/web-components/link/router-link.js +60 -0
- package/web-components/link/router-link.js.map +1 -0
- package/web-components/progress/progress.d.ts +2 -12
- package/web-components/progress/progress.d.ts.map +1 -1
- package/web-components/progress/progress.js +52 -48
- package/web-components/progress/progress.js.map +1 -1
- package/web-components/router/router.d.ts +15 -21
- package/web-components/router/router.d.ts.map +1 -1
- package/web-components/router/router.js +35 -37
- package/web-components/router/router.js.map +1 -1
- package/web-components/skeleton/skeleton.d.ts +5 -12
- package/web-components/skeleton/skeleton.d.ts.map +1 -1
- package/web-components/skeleton/skeleton.js +90 -98
- package/web-components/skeleton/skeleton.js.map +1 -1
- package/web-components/text/overbreath.d.ts +15 -20
- package/web-components/text/overbreath.d.ts.map +1 -1
- package/web-components/text/overbreath.js +108 -202
- package/web-components/text/overbreath.js.map +1 -1
- package/web-components/text/text.d.ts +5 -18
- package/web-components/text/text.d.ts.map +1 -1
- package/web-components/text/text.js +70 -80
- package/web-components/text/text.js.map +1 -1
- package/web-components/text/time.d.ts +5 -14
- package/web-components/text/time.d.ts.map +1 -1
- package/web-components/text/time.js +32 -31
- package/web-components/text/time.js.map +1 -1
- package/web-components/text/typewriter.d.ts +3 -11
- package/web-components/text/typewriter.d.ts.map +1 -1
- package/web-components/text/typewriter.js +42 -40
- package/web-components/text/typewriter.js.map +1 -1
- package/web-components/tooltip/tooltip.d.ts +21 -17
- package/web-components/tooltip/tooltip.d.ts.map +1 -1
- package/web-components/tooltip/tooltip.js +98 -60
- package/web-components/tooltip/tooltip.js.map +1 -1
- package/web-components/wrapper/dragbox.d.ts +5 -10
- package/web-components/wrapper/dragbox.d.ts.map +1 -1
- package/web-components/wrapper/dragbox.js +40 -31
- package/web-components/wrapper/dragbox.js.map +1 -1
- package/web-components/wrapper/rotate.d.ts +30 -0
- package/web-components/wrapper/rotate.d.ts.map +1 -0
- package/web-components/wrapper/rotate.js +92 -0
- package/web-components/wrapper/rotate.js.map +1 -0
- package/.deps.js.map +0 -1
- package/a.d.ts +0 -2
- package/a.d.ts.map +0 -1
- package/a.js +0 -2
- package/a.js.map +0 -1
- package/clip.d.ts +0 -2
- package/clip.d.ts.map +0 -1
- package/clip.js +0 -2
- package/clip.js.map +0 -1
- package/decorators/define.d.ts +0 -7
- package/decorators/define.d.ts.map +0 -1
- package/decorators/define.js +0 -11
- package/decorators/define.js.map +0 -1
- package/details-group.d.ts +0 -2
- package/details-group.d.ts.map +0 -1
- package/details-group.js +0 -2
- package/details-group.js.map +0 -1
- package/godown-element.d.ts.map +0 -1
- package/godown-element.js.map +0 -1
- package/lib/event-collection.d.ts +0 -14
- package/lib/event-collection.d.ts.map +0 -1
- package/lib/event-collection.js +0 -71
- package/lib/event-collection.js.map +0 -1
- package/lib/templates.d.ts.map +0 -1
- package/lib/templates.js +0 -76
- package/lib/templates.js.map +0 -1
- package/naming.d.ts +0 -91
- package/naming.d.ts.map +0 -1
- package/naming.js +0 -67
- package/naming.js.map +0 -1
- package/nav-layout.d.ts +0 -2
- package/nav-layout.d.ts.map +0 -1
- package/nav-layout.js +0 -2
- package/nav-layout.js.map +0 -1
- package/open-offset.d.ts +0 -2
- package/open-offset.d.ts.map +0 -1
- package/open-offset.js +0 -2
- package/open-offset.js.map +0 -1
- package/router-a.d.ts +0 -2
- package/router-a.d.ts.map +0 -1
- package/router-a.js +0 -2
- package/router-a.js.map +0 -1
- package/supers/anchor.d.ts +0 -26
- package/supers/anchor.d.ts.map +0 -1
- package/supers/anchor.js +0 -124
- package/supers/anchor.js.map +0 -1
- package/supers/input.d.ts +0 -28
- package/supers/input.d.ts.map +0 -1
- package/supers/input.js +0 -117
- package/supers/input.js.map +0 -1
- package/supers/openable.d.ts +0 -38
- package/supers/openable.d.ts.map +0 -1
- package/supers/openable.js +0 -77
- package/supers/openable.js.map +0 -1
- package/supers/root.d.ts +0 -18
- package/supers/root.d.ts.map +0 -1
- package/supers/root.js +0 -76
- package/supers/root.js.map +0 -1
- package/tabs.d.ts +0 -2
- package/tabs.d.ts.map +0 -1
- package/tabs.js +0 -2
- package/tabs.js.map +0 -1
- package/web-components/a/a.d.ts +0 -16
- package/web-components/a/a.d.ts.map +0 -1
- package/web-components/a/a.js +0 -17
- package/web-components/a/a.js.map +0 -1
- package/web-components/group/avatar-group.d.ts +0 -29
- package/web-components/group/avatar-group.d.ts.map +0 -1
- package/web-components/group/avatar-group.js +0 -88
- package/web-components/group/avatar-group.js.map +0 -1
- package/web-components/group/details-group.d.ts +0 -28
- package/web-components/group/details-group.d.ts.map +0 -1
- package/web-components/group/details-group.js +0 -59
- package/web-components/group/details-group.js.map +0 -1
- package/web-components/index.d.ts +0 -35
- package/web-components/index.d.ts.map +0 -1
- package/web-components/index.js +0 -35
- package/web-components/index.js.map +0 -1
- package/web-components/layout/divider.d.ts +0 -22
- package/web-components/layout/divider.d.ts.map +0 -1
- package/web-components/layout/divider.js +0 -85
- package/web-components/layout/divider.js.map +0 -1
- package/web-components/layout/nav-layout.d.ts +0 -38
- package/web-components/layout/nav-layout.d.ts.map +0 -1
- package/web-components/layout/nav-layout.js +0 -69
- package/web-components/layout/nav-layout.js.map +0 -1
- package/web-components/offset/open-offset.d.ts +0 -27
- package/web-components/offset/open-offset.d.ts.map +0 -1
- package/web-components/offset/open-offset.js +0 -130
- package/web-components/offset/open-offset.js.map +0 -1
- package/web-components/router/router-a.d.ts +0 -25
- package/web-components/router/router-a.d.ts.map +0 -1
- package/web-components/router/router-a.js +0 -70
- package/web-components/router/router-a.js.map +0 -1
- package/web-components/tabs/tabs.d.ts +0 -52
- package/web-components/tabs/tabs.d.ts.map +0 -1
- package/web-components/tabs/tabs.js +0 -165
- package/web-components/tabs/tabs.js.map +0 -1
- package/web-components/text/clip.d.ts +0 -22
- package/web-components/text/clip.d.ts.map +0 -1
- package/web-components/text/clip.js +0 -45
- package/web-components/text/clip.js.map +0 -1
- package/web-components/wrapper/wrapper.d.ts +0 -27
- package/web-components/wrapper/wrapper.d.ts.map +0 -1
- package/web-components/wrapper/wrapper.js +0 -95
- package/web-components/wrapper/wrapper.js.map +0 -1
- package/wrapper.d.ts +0 -2
- package/wrapper.d.ts.map +0 -1
- package/wrapper.js +0 -2
- package/wrapper.js.map +0 -1
package/lib/css.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
import { notNil } from "./utils.js";
|
2
|
+
/**
|
3
|
+
* Call Object.values and join "".
|
4
|
+
*/
|
5
|
+
export function constructCSS(vars, props, selectorFunc) {
|
6
|
+
return Object.values(constructCSSObject(vars, props, selectorFunc)).join("");
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* Create a CSS style object based on the provided variable name array and property object
|
10
|
+
* @param vars - Variable name array
|
11
|
+
* @param props - Property object containing style values for each variable
|
12
|
+
* @param selectorFunc (Optional) Function to process selector names
|
13
|
+
* @return CSS style object with selectors as keys and corresponding styles as values
|
14
|
+
*/
|
15
|
+
export function constructCSSObject(vars, props, selectorFunc) {
|
16
|
+
const cssObject = {};
|
17
|
+
Object.keys(props).forEach((sel) => {
|
18
|
+
const rules = vars.reduce((acc, key, index) => {
|
19
|
+
const value = props[sel][index];
|
20
|
+
if (notNil(value)) {
|
21
|
+
acc.push(`${key}:${value}`);
|
22
|
+
}
|
23
|
+
return acc;
|
24
|
+
}, []);
|
25
|
+
cssObject[sel] = `${selectorFunc ? selectorFunc(sel) : sel}{${rules.join(";")}}`;
|
26
|
+
});
|
27
|
+
return cssObject;
|
28
|
+
}
|
29
|
+
//# sourceMappingURL=css.js.map
|
package/lib/css.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAc,EACd,KAA0C,EAC1C,YAAsC;IAEtC,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAc,EACd,KAAqB,EACrB,YAAsC;IAEtC,MAAM,SAAS,GAAG,EAAO,CAAC;IAC1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;YACtD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAM,CAAC;YACrC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClB,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACnF,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { notNil } from \"./utils.js\";\n\n/**\n * Call Object.values and join \"\".\n */\nexport function constructCSS(\n vars: string[],\n props: Record<string, (string | number)[]>,\n selectorFunc?: (raw: string) => string,\n): string {\n return Object.values(constructCSSObject(vars, props, selectorFunc)).join(\"\");\n}\n\n/**\n * Create a CSS style object based on the provided variable name array and property object\n * @param vars - Variable name array\n * @param props - Property object containing style values for each variable\n * @param selectorFunc (Optional) Function to process selector names\n * @return CSS style object with selectors as keys and corresponding styles as values\n */\nexport function constructCSSObject<K extends string, V = string | number, R = Record<K, string>>(\n vars: string[],\n props: Record<K, V[]>,\n selectorFunc?: (raw: string) => string,\n): R {\n const cssObject = {} as R;\n Object.keys(props).forEach((sel) => {\n const rules = vars.reduce((acc: string[], key, index) => {\n const value = props[sel][index] as V;\n if (notNil(value)) {\n acc.push(`${key}:${value}`);\n }\n return acc;\n }, []);\n cssObject[sel] = `${selectorFunc ? selectorFunc(sel) : sel}{${rules.join(\";\")}}`;\n });\n return cssObject;\n}\n"]}
|
package/lib/directives.d.ts
CHANGED
@@ -1,29 +1,25 @@
|
|
1
|
+
import { html } from "lit";
|
2
|
+
export type HTMLTemplate = ReturnType<typeof html> | ReturnType<typeof html>[];
|
1
3
|
interface RenderIf {
|
2
4
|
<A, B>(value: unknown, a: A, b: B): A | B;
|
3
5
|
<A>(value: unknown, a: A): A;
|
4
6
|
}
|
5
|
-
export declare const ifValue: RenderIf;
|
6
7
|
/**
|
7
8
|
*
|
8
|
-
* @param value
|
9
|
-
* @param
|
10
|
-
* @param
|
11
|
-
* @
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
* ],
|
22
|
-
* `${key}: ${value}.`,
|
23
|
-
* )
|
24
|
-
* }
|
25
|
-
* ```
|
9
|
+
* @param value Condition.
|
10
|
+
* @param a Return when the condition is true.
|
11
|
+
* @param b Return when the condition is false.
|
12
|
+
* @returns a || b || nothing
|
13
|
+
*/
|
14
|
+
export declare const ifValue: RenderIf;
|
15
|
+
export declare const combine: (map: Record<string, any>, init?: string, join?: string) => string;
|
16
|
+
export declare const htmlSlot: (name?: string) => import("lit").TemplateResult<1>;
|
17
|
+
export declare const htmlStyle: (style?: string) => import("lit").TemplateResult<1>;
|
18
|
+
/**
|
19
|
+
* @param fill undefined: "currentColor". zero value: "none".
|
20
|
+
* @param stroke undefined: "currentColor". zero value: "none".
|
21
|
+
* @returns Function returns path needs d.
|
26
22
|
*/
|
27
|
-
export declare const
|
23
|
+
export declare const path: (fill?: string | void | number, stroke?: string | void | number, strokeWidth?: string | void | number) => (d: string) => import("lit").TemplateResult<2>;
|
28
24
|
export {};
|
29
25
|
//# sourceMappingURL=directives.d.ts.map
|
package/lib/directives.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"directives.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/directives.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,KAAK,CAAC;AACzC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC;AAE/E,UAAU,QAAQ;IAChB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CAC9B;AACD;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,QAErB,CAAC;AAEF,eAAO,MAAM,OAAO,QAAS,OAAO,MAAM,EAAE,GAAG,CAAC,yCAO/C,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,MAAM,oCAErC,CAAC;AAEF,eAAO,MAAM,SAAS,WAAY,MAAM,oCAOvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,IAAI,UACT,MAAM,GAAG,IAAI,GAAG,MAAM,WACpB,MAAM,GAAG,IAAI,GAAG,MAAM,gBACjB,MAAM,GAAG,IAAI,GAAG,MAAM,SAIxB,MAAM,oCAGlB,CAAC"}
|
package/lib/directives.js
CHANGED
@@ -1,38 +1,40 @@
|
|
1
|
-
import { nothing } from "lit";
|
1
|
+
import { html, nothing, svg } from "lit";
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* @param value Condition.
|
5
|
+
* @param a Return when the condition is true.
|
6
|
+
* @param b Return when the condition is false.
|
7
|
+
* @returns a || b || nothing
|
8
|
+
*/
|
2
9
|
export const ifValue = (value, a, b) => {
|
3
10
|
return (value && a) || b || nothing;
|
4
11
|
};
|
12
|
+
export const combine = (map, init = "", join = " ") => {
|
13
|
+
return Object.entries(map).reduce((acc, [key, value]) => {
|
14
|
+
if (value) {
|
15
|
+
acc += acc ? join + key : key;
|
16
|
+
}
|
17
|
+
return acc;
|
18
|
+
}, init);
|
19
|
+
};
|
20
|
+
export const htmlSlot = (name) => {
|
21
|
+
return name ? html `<slot name="${name}" part="slot-${name}"></slot>` : html `<slot></slot>`;
|
22
|
+
};
|
23
|
+
export const htmlStyle = (style) => {
|
24
|
+
return ifValue(style, html `<style>
|
25
|
+
${style}
|
26
|
+
</style>`);
|
27
|
+
};
|
5
28
|
/**
|
6
|
-
*
|
7
|
-
* @param value
|
8
|
-
* @
|
9
|
-
* @param defaultCase Default.
|
10
|
-
* @example
|
11
|
-
* ```ts
|
12
|
-
* for (const [key, value] of Object.entries(obj)){
|
13
|
-
* choose(
|
14
|
-
* keys,
|
15
|
-
* [
|
16
|
-
* [
|
17
|
-
* "type", `${value} type.`,
|
18
|
-
* ],
|
19
|
-
* ["target"],
|
20
|
-
* ],
|
21
|
-
* `${key}: ${value}.`,
|
22
|
-
* )
|
23
|
-
* }
|
24
|
-
* ```
|
29
|
+
* @param fill undefined: "currentColor". zero value: "none".
|
30
|
+
* @param stroke undefined: "currentColor". zero value: "none".
|
31
|
+
* @returns Function returns path needs d.
|
25
32
|
*/
|
26
|
-
export const
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
31
|
-
|
32
|
-
if (value && caseValue === value) {
|
33
|
-
return c[1];
|
34
|
-
}
|
35
|
-
}
|
36
|
-
return defaultCase;
|
33
|
+
export const path = (fill = "currentColor", stroke = "currentColor", strokeWidth = 3) => {
|
34
|
+
fill = fill || "none";
|
35
|
+
stroke = stroke || "none";
|
36
|
+
return (d) => {
|
37
|
+
return svg `<path d="${d}" fill="${fill}" stroke="${stroke}" stroke-width="${strokeWidth}" stroke-linecap="round" stroke-linejoin="round"></path>`;
|
38
|
+
};
|
37
39
|
};
|
38
40
|
//# sourceMappingURL=directives.js.map
|
package/lib/directives.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAOzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAa,CAAO,KAAc,EAAE,CAAI,EAAE,CAAK,EAAE,EAAE;IACrE,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAwB,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,GAAG,EAAE,EAAE;IACzE,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACtD,IAAI,KAAK,EAAE,CAAC;YACV,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAChC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAa,EAAE,EAAE;IACxC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,eAAe,IAAI,gBAAgB,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,eAAe,CAAC;AAC7F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE;IAC1C,OAAO,OAAO,CACZ,KAAK,EACL,IAAI,CAAA;QACA,KAAK;aACA,CACV,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,OAA+B,cAAc,EAC7C,SAAiC,cAAc,EAC/C,cAAsC,CAAC,EACvC,EAAE;IACF,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC;IACtB,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC;IAC1B,OAAO,CAAC,CAAS,EAAE,EAAE;QACnB,OAAO,GAAG,CAAA,YAAY,CAAC,WAAW,IAAI,aAAa,MAAM,mBAAmB,WAAW,0DAA0D,CAAC;IACpJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { html, nothing, svg } from \"lit\";\nexport type HTMLTemplate = ReturnType<typeof html> | ReturnType<typeof html>[];\n\ninterface RenderIf {\n <A, B>(value: unknown, a: A, b: B): A | B;\n <A>(value: unknown, a: A): A;\n}\n/**\n *\n * @param value Condition.\n * @param a Return when the condition is true.\n * @param b Return when the condition is false.\n * @returns a || b || nothing\n */\nexport const ifValue: RenderIf = <A, B>(value: unknown, a: A, b?: B) => {\n return (value && a) || b || nothing;\n};\n\nexport const combine = (map: Record<string, any>, init = \"\", join = \" \") => {\n return Object.entries(map).reduce((acc, [key, value]) => {\n if (value) {\n acc += acc ? join + key : key;\n }\n return acc;\n }, init);\n};\n\nexport const htmlSlot = (name?: string) => {\n return name ? html`<slot name=\"${name}\" part=\"slot-${name}\"></slot>` : html`<slot></slot>`;\n};\n\nexport const htmlStyle = (style?: string) => {\n return ifValue(\n style,\n html`<style>\n ${style}\n </style>`,\n );\n};\n\n/**\n * @param fill undefined: \"currentColor\". zero value: \"none\".\n * @param stroke undefined: \"currentColor\". zero value: \"none\".\n * @returns Function returns path needs d.\n */\nexport const path = (\n fill: string | void | number = \"currentColor\",\n stroke: string | void | number = \"currentColor\",\n strokeWidth: string | void | number = 3,\n) => {\n fill = fill || \"none\";\n stroke = stroke || \"none\";\n return (d: string) => {\n return svg`<path d=\"${d}\" fill=\"${fill}\" stroke=\"${stroke}\" stroke-width=\"${strokeWidth}\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>`;\n };\n};\n"]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export type EventsMaps = WindowEventMap & DocumentEventMap;
|
2
|
+
export type EventsNames = keyof EventsMaps;
|
3
|
+
export type EventsHandler = GlobalEventHandlersEventMap[keyof GlobalEventHandlersEventMap];
|
4
|
+
export type ListenerFunc = (event?: EventsHandler) => any | EventListenerOrEventListenerObject;
|
5
|
+
export type AddOptions = boolean | AddEventListenerOptions;
|
6
|
+
export declare class EventsCollection {
|
7
|
+
private coll;
|
8
|
+
addEvent<SRC extends EventTarget = HTMLElement>(src: SRC, type: EventsNames, listener: ListenerFunc, options?: AddOptions): ListenerFunc;
|
9
|
+
removeEvent<SRC extends EventTarget = HTMLElement>(src: SRC, type: EventsNames, listener: ListenerFunc, option?: EventListenerOptions): void;
|
10
|
+
removeAllEvents(): void;
|
11
|
+
}
|
12
|
+
export default EventsCollection;
|
13
|
+
//# sourceMappingURL=event-coll.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-coll.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/event-coll.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC;AAC3C,MAAM,MAAM,aAAa,GAAG,2BAA2B,CAAC,MAAM,2BAA2B,CAAC,CAAC;AAC3F,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,EAAE,aAAa,KAAK,GAAG,GAAG,kCAAkC,CAAC;AAC/F,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,uBAAuB,CAAC;AAE3D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,IAAI,CAA+D;IAE3E,QAAQ,CAAC,GAAG,SAAS,WAAW,GAAG,WAAW,EAC5C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,UAAU;IAatB,WAAW,CAAC,GAAG,SAAS,WAAW,GAAG,WAAW,EAC/C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,YAAY,EACtB,MAAM,CAAC,EAAE,oBAAoB;IAoB/B,eAAe;CAWhB;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export class EventsCollection {
|
2
|
+
constructor() {
|
3
|
+
this.coll = new Map();
|
4
|
+
}
|
5
|
+
addEvent(src, type, listener, options) {
|
6
|
+
const eType = this.coll.get(type) || new Map();
|
7
|
+
const eElem = eType.get(src) || new Set();
|
8
|
+
eElem.add(listener);
|
9
|
+
eType.set(src, eElem);
|
10
|
+
this.coll.set(type, eType);
|
11
|
+
src.addEventListener(type, listener, options);
|
12
|
+
return listener;
|
13
|
+
}
|
14
|
+
removeEvent(src, type, listener, option) {
|
15
|
+
if (listener) {
|
16
|
+
const eType = this.coll.get(type);
|
17
|
+
if (eType) {
|
18
|
+
const eElem = eType.get(src);
|
19
|
+
if (eElem) {
|
20
|
+
eElem.delete(listener);
|
21
|
+
if (!eElem.size) {
|
22
|
+
eType.delete(src);
|
23
|
+
if (!eType.size) {
|
24
|
+
this.coll.delete(type);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
src.removeEventListener(type, listener, option);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
removeAllEvents() {
|
33
|
+
this.coll.forEach((typeMap, type) => {
|
34
|
+
typeMap.forEach((eventListeners, src) => {
|
35
|
+
eventListeners.forEach((listener) => {
|
36
|
+
src.removeEventListener(type, listener);
|
37
|
+
});
|
38
|
+
});
|
39
|
+
typeMap.clear();
|
40
|
+
this.coll.delete(type);
|
41
|
+
});
|
42
|
+
}
|
43
|
+
}
|
44
|
+
export default EventsCollection;
|
45
|
+
//# sourceMappingURL=event-coll.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-coll.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/event-coll.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,gBAAgB;IAA7B;QACU,SAAI,GAAG,IAAI,GAAG,EAAoD,CAAC;IAsD7E,CAAC;IApDC,QAAQ,CACN,GAAQ,EACR,IAAiB,EACjB,QAAsB,EACtB,OAAoB;QAEpB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAA0B,CAAC;QACvE,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAgB,CAAC;QAExD,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE3B,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,WAAW,CACT,GAAQ,EACR,IAAiB,EACjB,QAAsB,EACtB,MAA6B;QAE7B,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC7B,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACvB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;wBAChB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;wBAClB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;4BAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBACzB,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YACD,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;YAClC,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,GAAG,EAAE,EAAE;gBACtC,cAAc,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAClC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC1C,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["export type EventsMaps = WindowEventMap & DocumentEventMap;\nexport type EventsNames = keyof EventsMaps;\nexport type EventsHandler = GlobalEventHandlersEventMap[keyof GlobalEventHandlersEventMap];\nexport type ListenerFunc = (event?: EventsHandler) => any | EventListenerOrEventListenerObject;\nexport type AddOptions = boolean | AddEventListenerOptions;\n\nexport class EventsCollection {\n private coll = new Map<EventsNames, Map<EventTarget, Set<ListenerFunc>>>();\n\n addEvent<SRC extends EventTarget = HTMLElement>(\n src: SRC,\n type: EventsNames,\n listener: ListenerFunc,\n options?: AddOptions,\n ) {\n const eType = this.coll.get(type) || new Map<any, Set<ListenerFunc>>();\n const eElem = eType.get(src) || new Set<ListenerFunc>();\n\n eElem.add(listener);\n eType.set(src, eElem);\n this.coll.set(type, eType);\n\n src.addEventListener(type, listener, options);\n return listener;\n }\n\n removeEvent<SRC extends EventTarget = HTMLElement>(\n src: SRC,\n type: EventsNames,\n listener: ListenerFunc,\n option?: EventListenerOptions,\n ) {\n if (listener) {\n const eType = this.coll.get(type);\n if (eType) {\n const eElem = eType.get(src);\n if (eElem) {\n eElem.delete(listener);\n if (!eElem.size) {\n eType.delete(src);\n if (!eType.size) {\n this.coll.delete(type);\n }\n }\n }\n }\n src.removeEventListener(type, listener, option);\n }\n }\n\n removeAllEvents() {\n this.coll.forEach((typeMap, type) => {\n typeMap.forEach((eventListeners, src) => {\n eventListeners.forEach((listener) => {\n src.removeEventListener(type, listener);\n });\n });\n typeMap.clear();\n this.coll.delete(type);\n });\n }\n}\n\nexport default EventsCollection;\n"]}
|
@@ -1,18 +1,3 @@
|
|
1
|
-
import { html } from "lit";
|
2
|
-
export type HTMLTemplate = ReturnType<typeof html>;
|
3
|
-
/**
|
4
|
-
* @param fill undefined: "currentColor". zero value: "none".
|
5
|
-
* @param stroke undefined: "currentColor". zero value: "none".
|
6
|
-
* @returns Function returns path needs d.
|
7
|
-
*/
|
8
|
-
export declare const path: (fill?: string | void | number, stroke?: string | void | number, strokeWidth?: string | void | number) => (d: string) => import("lit").TemplateResult<2>;
|
9
|
-
interface HtmlSlot {
|
10
|
-
(): HTMLTemplate;
|
11
|
-
(name: string): HTMLTemplate;
|
12
|
-
<T>(name: string, feedback: T, node: ParentNode): T | HTMLTemplate;
|
13
|
-
}
|
14
|
-
export declare const htmlSlot: HtmlSlot;
|
15
|
-
export declare const htmlStyle: (css: string) => import("lit").TemplateResult<1>;
|
16
1
|
export declare const svgDelta: () => import("lit").TemplateResult<1>;
|
17
2
|
export declare const svgDeltaSmooth: () => import("lit").TemplateResult<1>;
|
18
3
|
export declare const svgArrow: (body?: boolean) => import("lit").TemplateResult<1>;
|
@@ -37,5 +22,4 @@ export declare const icons: {
|
|
37
22
|
sun: () => import("lit").TemplateResult<1>;
|
38
23
|
link: () => import("lit").TemplateResult<1>;
|
39
24
|
};
|
40
|
-
|
41
|
-
//# sourceMappingURL=templates.d.ts.map
|
25
|
+
//# sourceMappingURL=icons.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/icons.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,uCAMpB,CAAC;AAEF,eAAO,MAAM,cAAc,uCAS1B,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,OAAO,oCAKtC,CAAC;AAEF,eAAO,MAAM,SAAS,uCAMrB,CAAC;AAEF,eAAO,MAAM,MAAM,uCAUlB,CAAC;AAEF,eAAO,MAAM,IAAI,uCAIhB,CAAC;AAEF,eAAO,MAAM,QAAQ,uCASpB,CAAC;AAEF,eAAO,MAAM,MAAM,uCAUlB,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,OAAO,oCAgBrC,CAAC;AAEF,eAAO,MAAM,OAAO,uCAMnB,CAAC;AAEF,eAAO,MAAM,KAAK;;;mBAlFc,OAAO;;;;;;kBAwDR,OAAO;;;;CAuCrC,CAAC"}
|
package/lib/icons.js
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
import { html } from "lit";
|
2
|
+
import { path } from "./directives.js";
|
3
|
+
// SVG ICONS.
|
4
|
+
export const svgDelta = () => {
|
5
|
+
return html `<svg part="icon-delta" viewBox="0 0 1024 1024" fill="none">
|
6
|
+
${path()("M472.205 772.103l-441.229-440.485c-35.531-35.47-10.41-96.189 39.795-96.189h882.46c50.204 0 75.325 60.718 39.794 96.189l-441.231 440.485c-21.988 21.953-57.6 21.953-79.589 0z")}
|
7
|
+
</svg>`;
|
8
|
+
};
|
9
|
+
export const svgDeltaSmooth = () => {
|
10
|
+
return html `<svg part="icon-delta" viewBox="0 0 16 16" fill="currentColor">
|
11
|
+
${path(undefined, 0)("m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z")}
|
12
|
+
</svg>`;
|
13
|
+
};
|
14
|
+
export const svgArrow = (body) => {
|
15
|
+
const d = body ? "M24 12L36 24L24 36" : "M19 12L31 24L19 36";
|
16
|
+
return html `<svg part="icon=arrow" viewBox="0 0 48 48" fill="none">
|
17
|
+
${body && path()("M36 24.0083H12")} ${path("none")(d)}
|
18
|
+
</svg>`;
|
19
|
+
};
|
20
|
+
export const svgSearch = () => {
|
21
|
+
return html `<svg part="icon-search" viewBox="0 0 1024 1024">
|
22
|
+
${path()("M950.6 899.8L726.2 675.4c-1.6-1.6-1.8-4.2-0.4-6 21.7-26.9 39.4-56.5 53-88.5 19.4-46 29.2-94.7 29.2-144.9s-9.8-98.9-29.2-144.8C760 246.9 733.2 207.1 699 173c-34.2-34.2-73.9-61-118.2-79.7C534.9 73.8 486.2 64 436 64s-98.9 9.8-144.8 29.2C246.9 112 207.1 138.8 173 173c-34.2 34.2-61 73.9-79.7 118.2C73.8 337.1 64 385.8 64 436s9.8 98.9 29.2 144.8C112 625.1 138.8 664.9 173 699c34.2 34.2 73.9 61 118.2 79.7C337.1 798.2 385.8 808 436 808s98.9-9.8 144.8-29.2c32-13.5 61.6-31.3 88.5-53 1.8-1.5 4.4-1.3 6 0.4l224.4 224.4c12.5 12.5 32.7 12.5 45.2 0l5.6-5.6c12.6-12.5 12.6-32.7 0.1-45.2zM436 736c-165.4 0-300-134.6-300-300S270.6 136 436 136 736 270.6 736 436 601.4 736 436 736z")}
|
23
|
+
</svg>`;
|
24
|
+
};
|
25
|
+
export const svgEye = () => {
|
26
|
+
return html `<svg part="icon-eye" viewBox="0 0 48 48">
|
27
|
+
${path(0)("M9.85786 18C6.23858 21 4 24 4 24C4 24 12.9543 36 24 36C25.3699 36 26.7076 35.8154 28 35.4921M20.0318 12.5C21.3144 12.1816 22.6414 12 24 12C35.0457 12 44 24 44 24C44 24 41.7614 27 38.1421 30")}
|
28
|
+
${path(0)("M20.3142 20.6211C19.4981 21.5109 19 22.6972 19 23.9998C19 26.7612 21.2386 28.9998 24 28.9998C25.3627 28.9998 26.5981 28.4546 27.5 27.5705")}
|
29
|
+
${path()("M42 42L6 6")}
|
30
|
+
</svg>`;
|
31
|
+
};
|
32
|
+
export const svgX = () => {
|
33
|
+
return html `<svg part="icon-x" viewBox="0 0 48 48" fill="none">
|
34
|
+
${path()("M12 12L36 36")} ${path()("M12 36L36 12")}
|
35
|
+
</svg>`;
|
36
|
+
};
|
37
|
+
export const svgImage = () => {
|
38
|
+
return html `<svg part="icon-image" viewBox="0 0 1098 1024">
|
39
|
+
${path(undefined, 0)("M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z")}
|
40
|
+
</svg>`;
|
41
|
+
};
|
42
|
+
export const svgSun = () => {
|
43
|
+
return html `<svg part="icon-sun" viewBox="0 0 16 16">
|
44
|
+
${path(undefined, 0, 1)("M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z")}
|
45
|
+
</svg>`;
|
46
|
+
};
|
47
|
+
export const svgMoon = (star) => {
|
48
|
+
return html `<svg part="icon-moon" viewBox="0 0 16 16">
|
49
|
+
${path(undefined, 0)("M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z")}
|
50
|
+
${star &&
|
51
|
+
path(undefined, 0)("M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z")}
|
52
|
+
</svg>`;
|
53
|
+
};
|
54
|
+
export const svgLink = () => {
|
55
|
+
return html `<svg part="icon-link" viewBox="0 0 48 48" fill="none">
|
56
|
+
${path(0)("M28 6H42V20")}${path(0)("M42 29.4737V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9C6 7.34315 7.34315 6 9 6L18 6")}${path()("M25.7998 22.1999L41.0998 6.8999")}
|
57
|
+
</svg>`;
|
58
|
+
};
|
59
|
+
export const icons = {
|
60
|
+
delta: svgDelta,
|
61
|
+
"delta-smooth": svgDeltaSmooth,
|
62
|
+
arrow: svgArrow,
|
63
|
+
"arrow-body": () => svgArrow(true),
|
64
|
+
search: svgSearch,
|
65
|
+
eye: svgEye,
|
66
|
+
x: svgX,
|
67
|
+
image: svgImage,
|
68
|
+
moon: svgMoon,
|
69
|
+
"moon-star": () => svgMoon(true),
|
70
|
+
sun: svgSun,
|
71
|
+
link: svgLink,
|
72
|
+
};
|
73
|
+
//# sourceMappingURL=icons.js.map
|
package/lib/icons.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"https://github.com/startracex/godown/tree/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,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,OAAO;CACd,CAAC","sourcesContent":["import { html } from \"lit\";\n\nimport { path } from \"./directives.js\";\n\n// SVG ICONS.\n\nexport const svgDelta = () => {\n return html`<svg part=\"icon-delta\" viewBox=\"0 0 1024 1024\" fill=\"none\">\n ${path()(\n \"M472.205 772.103l-441.229-440.485c-35.531-35.47-10.41-96.189 39.795-96.189h882.46c50.204 0 75.325 60.718 39.794 96.189l-441.231 440.485c-21.988 21.953-57.6 21.953-79.589 0z\",\n )}\n </svg>`;\n};\n\nexport const svgDeltaSmooth = () => {\n return html`<svg part=\"icon-delta\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n ${path(\n undefined,\n 0,\n )(\n \"m3.86 8.753 5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z\",\n )}\n </svg>`;\n};\n\nexport const svgArrow = (body?: boolean) => {\n const d = body ? \"M24 12L36 24L24 36\" : \"M19 12L31 24L19 36\";\n return html`<svg part=\"icon=arrow\" viewBox=\"0 0 48 48\" fill=\"none\">\n ${body && path()(\"M36 24.0083H12\")} ${path(\"none\")(d)}\n </svg>`;\n};\n\nexport const svgSearch = () => {\n return html`<svg part=\"icon-search\" viewBox=\"0 0 1024 1024\">\n ${path()(\n \"M950.6 899.8L726.2 675.4c-1.6-1.6-1.8-4.2-0.4-6 21.7-26.9 39.4-56.5 53-88.5 19.4-46 29.2-94.7 29.2-144.9s-9.8-98.9-29.2-144.8C760 246.9 733.2 207.1 699 173c-34.2-34.2-73.9-61-118.2-79.7C534.9 73.8 486.2 64 436 64s-98.9 9.8-144.8 29.2C246.9 112 207.1 138.8 173 173c-34.2 34.2-61 73.9-79.7 118.2C73.8 337.1 64 385.8 64 436s9.8 98.9 29.2 144.8C112 625.1 138.8 664.9 173 699c34.2 34.2 73.9 61 118.2 79.7C337.1 798.2 385.8 808 436 808s98.9-9.8 144.8-29.2c32-13.5 61.6-31.3 88.5-53 1.8-1.5 4.4-1.3 6 0.4l224.4 224.4c12.5 12.5 32.7 12.5 45.2 0l5.6-5.6c12.6-12.5 12.6-32.7 0.1-45.2zM436 736c-165.4 0-300-134.6-300-300S270.6 136 436 136 736 270.6 736 436 601.4 736 436 736z\",\n )}\n </svg>`;\n};\n\nexport const svgEye = () => {\n return html`<svg part=\"icon-eye\" viewBox=\"0 0 48 48\">\n ${path(0)(\n \"M9.85786 18C6.23858 21 4 24 4 24C4 24 12.9543 36 24 36C25.3699 36 26.7076 35.8154 28 35.4921M20.0318 12.5C21.3144 12.1816 22.6414 12 24 12C35.0457 12 44 24 44 24C44 24 41.7614 27 38.1421 30\",\n )}\n ${path(0)(\n \"M20.3142 20.6211C19.4981 21.5109 19 22.6972 19 23.9998C19 26.7612 21.2386 28.9998 24 28.9998C25.3627 28.9998 26.5981 28.4546 27.5 27.5705\",\n )}\n ${path()(\"M42 42L6 6\")}\n </svg>`;\n};\n\nexport const svgX = () => {\n return html`<svg part=\"icon-x\" viewBox=\"0 0 48 48\" fill=\"none\">\n ${path()(\"M12 12L36 36\")} ${path()(\"M12 36L36 12\")}\n </svg>`;\n};\n\nexport const svgImage = () => {\n return html`<svg part=\"icon-image\" viewBox=\"0 0 1098 1024\">\n ${path(\n undefined,\n 0,\n )(\n \"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z\",\n )}\n </svg>`;\n};\n\nexport const svgSun = () => {\n return html`<svg part=\"icon-sun\" viewBox=\"0 0 16 16\">\n ${path(\n undefined,\n 0,\n 1,\n )(\n \"M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z\",\n )}\n </svg>`;\n};\n\nexport const svgMoon = (star?: boolean) => {\n return html`<svg part=\"icon-moon\" viewBox=\"0 0 16 16\">\n ${path(\n undefined,\n 0,\n )(\n \"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z\",\n )}\n ${star &&\n path(\n undefined,\n 0,\n )(\n \"M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z\",\n )}\n </svg>`;\n};\n\nexport const svgLink = () => {\n return html`<svg part=\"icon-link\" viewBox=\"0 0 48 48\" fill=\"none\">\n ${path(0)(\"M28 6H42V20\")}${path(0)(\n \"M42 29.4737V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9C6 7.34315 7.34315 6 9 6L18 6\",\n )}${path()(\"M25.7998 22.1999L41.0998 6.8999\")}\n </svg>`;\n};\n\nexport const icons = {\n delta: svgDelta,\n \"delta-smooth\": svgDeltaSmooth,\n arrow: svgArrow,\n \"arrow-body\": () => svgArrow(true),\n search: svgSearch,\n eye: svgEye,\n x: svgX,\n image: svgImage,\n moon: svgMoon,\n \"moon-star\": () => svgMoon(true),\n sun: svgSun,\n link: svgLink,\n};\n"]}
|
package/lib/jsx.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare function factory(tag: string | typeof fragment, props?: null | Record<string, any>, ...children: any[]): HTMLElement;
|
2
|
+
export declare function factory<T extends typeof HTMLElement>(tag: string | T, props?: null | (Partial<Record<keyof T, T[keyof T]>> & Record<string, any>), ...children: any[]): InstanceType<T>;
|
3
|
+
export declare function fragment(_: any, ...children: any[]): any[];
|
4
|
+
//# sourceMappingURL=jsx.d.ts.map
|
package/lib/jsx.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/jsx.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,GAAG,OAAO,QAAQ,EAC7B,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,GAAG,QAAQ,EAAE,GAAG,EAAE,GACjB,WAAW,CAAC;AAEf,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,WAAW,EAClD,GAAG,EAAE,MAAM,GAAG,CAAC,EACf,KAAK,CAAC,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC3E,GAAG,QAAQ,EAAE,GAAG,EAAE,GACjB,YAAY,CAAC,CAAC,CAAC,CAAC;AA0CnB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,SAElD"}
|
package/lib/jsx.js
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
export function factory(tag, props, ...children) {
|
2
|
+
let element;
|
3
|
+
if (typeof tag === "string") {
|
4
|
+
element = document.createElement(tag);
|
5
|
+
}
|
6
|
+
else if (tag.prototype instanceof HTMLElement) {
|
7
|
+
element = new tag();
|
8
|
+
}
|
9
|
+
else if (typeof tag === "function") {
|
10
|
+
return tag(props, children);
|
11
|
+
}
|
12
|
+
if (props) {
|
13
|
+
Object.entries(props).forEach(([key, value]) => {
|
14
|
+
if (key === "style") {
|
15
|
+
Object.assign(element.style, value);
|
16
|
+
}
|
17
|
+
else if (key === "class") {
|
18
|
+
element.className = value;
|
19
|
+
}
|
20
|
+
else if (key.startsWith("on") && key.length > 2) {
|
21
|
+
const type = key.slice(2);
|
22
|
+
if (type) {
|
23
|
+
element.addEventListener(type.toLowerCase(), value);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
if (key.startsWith("data-") || Object.prototype.hasOwnProperty.call(element, key)) {
|
28
|
+
element.setAttribute(key, value);
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
element[key] = value;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
});
|
35
|
+
}
|
36
|
+
children.forEach((child) => {
|
37
|
+
append(element, child);
|
38
|
+
});
|
39
|
+
return element;
|
40
|
+
}
|
41
|
+
export function fragment(_, ...children) {
|
42
|
+
return children;
|
43
|
+
}
|
44
|
+
function append(parent, child) {
|
45
|
+
if (Array.isArray(child)) {
|
46
|
+
child.forEach((nestedChild) => append(parent, nestedChild));
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
parent.appendChild(typeof child === "string" ? document.createTextNode(child) : child);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
//# sourceMappingURL=jsx.js.map
|
package/lib/jsx.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jsx.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/jsx.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,OAAO,CACrB,GAAiC,EACjC,KAAiG,EACjG,GAAG,QAAe;IAElB,IAAI,OAAoB,CAAC;IACzB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;Q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CAAC,GAAG,KAAK,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,CAAM,EAAE,GAAG,QAAe;IACjD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,MAAM,CAAC,MAAmB,EAAE,KAAoB;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,WAAW,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzF,CAAC;AACH,CAAC","sourcesContent":["export function factory(\n tag: string | typeof fragment,\n props?: null | Record<string, any>,\n ...children: any[]\n): HTMLElement;\n\nexport function factory<T extends typeof HTMLElement>(\n tag: string | T,\n props?: null | (Partial<Record<keyof T, T[keyof T]>> & Record<string, any>),\n ...children: any[]\n): InstanceType<T>;\n\nexport function factory<T extends typeof HTMLElement>(\n tag: string | typeof fragment | T,\n props?: null | Record<string, any> | (Partial<Record<keyof T, T[keyof T]>> & Record<string, any>),\n ...children: any[]\n) {\n let element: HTMLElement;\n if (typeof tag === \"string\") {\n element = document.createElement(tag);\n } else if (tag.prototype instanceof HTMLElement) {\n element = new (tag as T)();\n } else if (typeof tag === \"function\") {\n return (tag as typeof fragment)(props, children);\n }\n if (props) {\n Object.entries(props).forEach(([key, value]) => {\n if (key === \"style\") {\n Object.assign(element.style, value);\n } else if (key === \"class\") {\n element.className = value;\n } else if (key.startsWith(\"on\") && key.length > 2) {\n const type = key.slice(2);\n if (type) {\n element.addEventListener(type.toLowerCase(), value);\n }\n } else {\n if (key.startsWith(\"data-\") || Object.prototype.hasOwnProperty.call(element, key)) {\n element.setAttribute(key, value);\n } else {\n element[key] = value;\n }\n }\n });\n }\n children.forEach((child) => {\n append(element, child);\n });\n\n return element;\n}\n\nexport function fragment(_: any, ...children: any[]) {\n return children;\n}\n\nfunction append(parent: HTMLElement, child: Node | string) {\n if (Array.isArray(child)) {\n child.forEach((nestedChild) => append(parent, nestedChild));\n } else {\n parent.appendChild(typeof child === \"string\" ? document.createTextNode(child) : child);\n }\n}\n"]}
|
package/lib/route-tree.d.ts
CHANGED
@@ -10,11 +10,11 @@ export declare class RouteTree {
|
|
10
10
|
static split(s: string): string[];
|
11
11
|
/**
|
12
12
|
*
|
13
|
-
* @param s Pattern, may contains dynamic matching parameters
|
14
|
-
* @returns {object} key, carry, multi
|
15
|
-
* @property {string} key - Dynamic key
|
16
|
-
* @property {number} carry - The length of the modifier symbol for the dynamic prefix
|
17
|
-
* @property {boolean} multi - Ignore after
|
13
|
+
* @param s Pattern, may contains dynamic matching parameters.
|
14
|
+
* @returns {object} key, carry, multi.
|
15
|
+
* @property {string} key - Dynamic key.
|
16
|
+
* @property {number} carry - The length of the modifier symbol for the dynamic prefix.
|
17
|
+
* @property {boolean} multi - Ignore after.
|
18
18
|
*/
|
19
19
|
static dynamic(s: string): {
|
20
20
|
key: string;
|
package/lib/route-tree.js
CHANGED
@@ -63,11 +63,11 @@ export class RouteTree {
|
|
63
63
|
}
|
64
64
|
/**
|
65
65
|
*
|
66
|
-
* @param s Pattern, may contains dynamic matching parameters
|
67
|
-
* @returns {object} key, carry, multi
|
68
|
-
* @property {string} key - Dynamic key
|
69
|
-
* @property {number} carry - The length of the modifier symbol for the dynamic prefix
|
70
|
-
* @property {boolean} multi - Ignore after
|
66
|
+
* @param s Pattern, may contains dynamic matching parameters.
|
67
|
+
* @returns {object} key, carry, multi.
|
68
|
+
* @property {string} key - Dynamic key.
|
69
|
+
* @property {number} carry - The length of the modifier symbol for the dynamic prefix.
|
70
|
+
* @property {boolean} multi - Ignore after.
|
71
71
|
*/
|
72
72
|
static dynamic(s) {
|
73
73
|
if (s[0] === "{" && s[s.length - 1] === "}") {
|
package/lib/route-tree.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"route-tree.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/route-tree.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAAtB;QACE,YAAO,GAAG,EAAE,CAAC;QACb,SAAI,GAAG,EAAE,CAAC;QACV,aAAQ,GAAgB,EAAE,CAAC;QAC3B,WAAM,GAAG,KAAK,CAAC;IAgJjB,CAAC;IA9IC,MAAM,CAAC,OAAe,EAAE,QAA8B,SAAS,EAAE,MAAM,GAAG,CAAC;QACzE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,OAAO;QACT,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAC9B,I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AE,CAAC;gBACT,SAAS;YACX,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AACD,eAAe,SAAS,CAAC","sourcesContent":["export class RouteTree {\n pattern = \"\";\n part = \"\";\n children: RouteTree[] = [];\n isWild = false;\n\n insert(pattern: string, parts: string[] | undefined = undefined, height = 0): void {\n if (!parts) {\n parts = RouteTree.split(pattern);\n }\n if (parts.length === height) {\n this.pattern = pattern;\n return;\n }\n const part = parts[height];\n let child = this.matchChild(part);\n if (child === null) {\n child = new RouteTree();\n child.part = part;\n const { carry } = RouteTree.dynamic(part);\n child.isWild = Boolean(carry);\n this.children.push(child);\n }\n child.insert(pattern, parts, height + 1);\n }\n\n search(parts: string[], height = 0): RouteTree | null {\n if (parts.length === height || this.part.startsWith(\"*\")) {\n if (this.pattern === \"\") {\n return null;\n }\n return this;\n }\n const part = parts[height];\n const children = this.matchChildren(part);\n for (const child of children) {\n const result = child.search(parts, height + 1);\n if (result !== null) {\n return result;\n }\n }\n return null;\n }\n\n matchChild(part: string): RouteTree | null {\n for (const child of this.children) {\n if (child.part === part || child.isWild) {\n return child;\n }\n }\n return null;\n }\n\n matchChildren(part: string): RouteTree[] {\n const nodes: RouteTree[] = [];\n for (const child of this.children) {\n if (child.part === part || child.isWild) {\n nodes.push(child);\n }\n }\n return nodes;\n }\n\n static split(s: string): string[] {\n return s.split(\"/\").filter((a) => a);\n }\n\n /**\n *\n * @param s Pattern, may contains dynamic matching parameters
|
1
|
+
{"version":3,"file":"route-tree.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/route-tree.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAAtB;QACE,YAAO,GAAG,EAAE,CAAC;QACb,SAAI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QACJ,CAAC;QACD,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,CAAS;QAChB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,EAAE,CAAC;YACN,OAAO,CAAC,CAAC,OAAO,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,CAAS,EAAE,OAAe;QACpC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,SAAS;YACX,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AACD,eAAe,SAAS,CAAC","sourcesContent":["export class RouteTree {\n pattern = \"\";\n part = \"\";\n children: RouteTree[] = [];\n isWild = false;\n\n insert(pattern: string, parts: string[] | undefined = undefined, height = 0): void {\n if (!parts) {\n parts = RouteTree.split(pattern);\n }\n if (parts.length === height) {\n this.pattern = pattern;\n return;\n }\n const part = parts[height];\n let child = this.matchChild(part);\n if (child === null) {\n child = new RouteTree();\n child.part = part;\n const { carry } = RouteTree.dynamic(part);\n child.isWild = Boolean(carry);\n this.children.push(child);\n }\n child.insert(pattern, parts, height + 1);\n }\n\n search(parts: string[], height = 0): RouteTree | null {\n if (parts.length === height || this.part.startsWith(\"*\")) {\n if (this.pattern === \"\") {\n return null;\n }\n return this;\n }\n const part = parts[height];\n const children = this.matchChildren(part);\n for (const child of children) {\n const result = child.search(parts, height + 1);\n if (result !== null) {\n return result;\n }\n }\n return null;\n }\n\n matchChild(part: string): RouteTree | null {\n for (const child of this.children) {\n if (child.part === part || child.isWild) {\n return child;\n }\n }\n return null;\n }\n\n matchChildren(part: string): RouteTree[] {\n const nodes: RouteTree[] = [];\n for (const child of this.children) {\n if (child.part === part || child.isWild) {\n nodes.push(child);\n }\n }\n return nodes;\n }\n\n static split(s: string): string[] {\n return s.split(\"/\").filter((a) => a);\n }\n\n /**\n *\n * @param s Pattern, may contains dynamic matching parameters.\n * @returns {object} key, carry, multi.\n * @property {string} key - Dynamic key.\n * @property {number} carry - The length of the modifier symbol for the dynamic prefix.\n * @property {boolean} multi - Ignore after.\n */\n static dynamic(s: string): {\n key: string;\n carry: number;\n multi: boolean;\n } {\n if (s[0] === \"{\" && s[s.length - 1] === \"}\") {\n s = s.substring(1, s.length - 1);\n if (s[0] !== \":\" && s[0] !== \"*\" && s[0] !== \".\") {\n return {\n key: s,\n carry: 0,\n multi: false,\n };\n }\n }\n if (s[0] === \"[\" && s[s.length - 1] === \"]\") {\n s = s.substring(1, s.length - 1);\n }\n const s1 = s.substring(0, 1);\n if (s1 === \":\") {\n return {\n key: s,\n carry: 1,\n multi: false,\n };\n }\n if (s1 === \"*\") {\n return {\n key: s,\n carry: 1,\n multi: true,\n };\n }\n const s3 = s.substring(0, 3);\n if (s3 === \"...\") {\n return {\n key: s,\n carry: 3,\n multi: true,\n };\n }\n return {\n key: \"\",\n carry: 0,\n multi: false,\n };\n }\n\n useWhich(s: string): string | null {\n const sp = RouteTree.split(s);\n const t = this.search(sp);\n if (t) {\n return t.pattern;\n }\n return null;\n }\n\n parseParams(s: string, pattern: string): Record<string, string> {\n const sSplit = RouteTree.split(s);\n const patternSplit = RouteTree.split(pattern);\n const params: Record<string, string> = {};\n for (const index in patternSplit) {\n const { key, carry, multi } = RouteTree.dynamic(patternSplit[index]);\n if (!key) {\n continue;\n }\n params[key.substring(carry)] = sSplit[index];\n if (multi) {\n break;\n }\n }\n return params;\n }\n}\nexport default RouteTree;\n"]}
|
package/lib/utils.d.ts
CHANGED
@@ -1,50 +1,10 @@
|
|
1
|
+
export declare function isNil(n: any): boolean;
|
2
|
+
export declare function notNil(n: any): boolean;
|
3
|
+
export declare function numerical(n?: string | number): boolean;
|
4
|
+
export declare function random(m?: number, n?: number): number;
|
5
|
+
export declare function joinRules(rules: Record<string, Record<string, string | number>>): string;
|
6
|
+
export declare function joinProperties(prop: Record<string, string | number>): string;
|
1
7
|
export declare function debounce(func: (_: any) => any, timeout: number): () => void;
|
2
8
|
export declare function deepQuerySelectorAll<E extends Element = HTMLElement>(selectors: string, root?: E | ParentNode): E[];
|
3
9
|
export declare function deepQuerySelector<E extends Element = HTMLElement>(selectors: string, root?: E | ParentNode): E;
|
4
|
-
export declare function each(node: Node, callback: (node: Node) => void): void;
|
5
|
-
export declare function random(m?: number, n?: number): number;
|
6
|
-
/**
|
7
|
-
* Create element from args append to target.
|
8
|
-
* @param target Appended target element, target or document.querySelector(target) or document.body.
|
9
|
-
* @param args Arguments
|
10
|
-
*/
|
11
|
-
export declare function append(target: string | HTMLElement, args: string | EleArgs | HTMLElement): void;
|
12
|
-
/**
|
13
|
-
* Create element from args.
|
14
|
-
* @param args Arguments.
|
15
|
-
*/
|
16
|
-
export declare function create(args: string | EleArgs | HTMLElement): HTMLElement;
|
17
|
-
/**
|
18
|
-
* Replace elements.
|
19
|
-
* @param matched Elements.
|
20
|
-
* @param args Arguments.
|
21
|
-
*/
|
22
|
-
export declare function retag(matched: HTMLElement[], args: string | EleArgs | HTMLElement): void;
|
23
|
-
/**
|
24
|
-
* tag: tag name. \
|
25
|
-
* props: attribute. \
|
26
|
-
* children: appended chindren.
|
27
|
-
*/
|
28
|
-
interface EleArgs {
|
29
|
-
tag: string;
|
30
|
-
props?: Record<string, any>;
|
31
|
-
children?: (string | HTMLElement | EleArgs)[];
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* @param vars CSS properties key array.
|
35
|
-
* @param selectorProperties Keys: selector. values: CSS properties value array.
|
36
|
-
* @param selectorFunc Change to a a new selector.
|
37
|
-
* @param propertyFunc Form key and value into new key:value; pairs.
|
38
|
-
* @returns CSS text
|
39
|
-
*/
|
40
|
-
export declare function constructCSS(vars: LikeString[], selectorProperties: Record<string, LikeString[]>, selectorFunc?: (raw: LikeString) => string, propertyFunc?: (k: LikeString, v: LikeString) => string): string;
|
41
|
-
/**
|
42
|
-
* Can be a string.
|
43
|
-
*/
|
44
|
-
export interface LikeString {
|
45
|
-
toString(): string;
|
46
|
-
}
|
47
|
-
export declare function dashToCamel(str: string, upperFirst?: boolean): string;
|
48
|
-
export declare function camelToDash(str: string): string;
|
49
|
-
export {};
|
50
10
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["lib/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,WAG3B;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,WAE5B;AAED,wBAAgB,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,WAE5C;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAI,EAAE,CAAC,SAAI,UAElC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,UAK/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,UAKnE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,IAAI,CAU3E;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,EAClE,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,CAAC,GAAG,UAA0B,GACnC,CAAC,EAAE,CAmBL;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,WAAW,EAC/D,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,CAAC,GAAG,UAA0B,GACnC,CAAC,CAkBH"}
|