godown 3.0.0-canary.0 → 3.0.0-canary.10
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 +37 -8
- package/components/alert.d.ts +5 -3
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +24 -14
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +5 -1
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +7 -3
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +2 -1
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +5 -4
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +16 -9
- package/components/button.d.ts.map +1 -1
- package/components/button.js +22 -20
- package/components/button.js.map +1 -1
- package/components/card.d.ts +1 -2
- package/components/card.d.ts.map +1 -1
- package/components/card.js +5 -11
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +6 -5
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +3 -2
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +5 -2
- package/components/details.d.ts.map +1 -1
- package/components/details.js +5 -2
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +8 -4
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +17 -12
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +1 -1
- package/components/divider.js +1 -1
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +7 -7
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -1
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts +2 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +8 -0
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +0 -2
- package/components/form.d.ts.map +1 -1
- package/components/form.js +0 -2
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +8 -3
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -0
- package/components/grid.js.map +1 -1
- package/components/input.d.ts +2 -3
- package/components/input.d.ts.map +1 -1
- package/components/input.js +3 -6
- package/components/input.js.map +1 -1
- package/components/layout.d.ts +3 -6
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +21 -10
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +3 -1
- package/components/link.d.ts.map +1 -1
- package/components/link.js +3 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +2 -11
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +6 -15
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +43 -17
- package/components/range.d.ts.map +1 -1
- package/components/range.js +132 -58
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +1 -1
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js +1 -1
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +6 -8
- package/components/router.d.ts.map +1 -1
- package/components/router.js +10 -10
- package/components/router.js.map +1 -1
- package/components/select.d.ts +4 -8
- package/components/select.d.ts.map +1 -1
- package/components/select.js +42 -41
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +3 -4
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts +18 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +52 -19
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +4 -4
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +6 -6
- package/components/switch.js.map +1 -1
- package/components/text.js +3 -3
- package/components/text.js.map +1 -1
- package/components/time.d.ts +4 -20
- package/components/time.d.ts.map +1 -1
- package/components/time.js +5 -66
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +11 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +23 -5
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +2 -2
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +2 -2
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +8 -1
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.js +1 -1
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +2 -3
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +3 -6
- package/core/super-input.js.map +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/alert.d.ts +8 -0
- package/dev/alert.d.ts.map +1 -0
- package/dev/alert.js +4 -0
- package/dev/alert.js.map +1 -0
- package/dev/avatar.d.ts +8 -0
- package/dev/avatar.d.ts.map +1 -0
- package/dev/avatar.js +4 -0
- package/dev/avatar.js.map +1 -0
- package/dev/breath.d.ts +9 -0
- package/dev/breath.d.ts.map +1 -0
- package/dev/breath.js +5 -0
- package/dev/breath.js.map +1 -0
- package/dev/button.d.ts +8 -0
- package/dev/button.d.ts.map +1 -0
- package/dev/button.js +4 -0
- package/dev/button.js.map +1 -0
- package/dev/card.d.ts +8 -0
- package/dev/card.d.ts.map +1 -0
- package/dev/card.js +4 -0
- package/dev/card.js.map +1 -0
- package/dev/carousel.d.ts +8 -0
- package/dev/carousel.d.ts.map +1 -0
- package/dev/carousel.js +4 -0
- package/dev/carousel.js.map +1 -0
- package/dev/components/alert.d.ts +52 -0
- package/dev/components/alert.d.ts.map +1 -0
- package/dev/components/alert.js +245 -0
- package/dev/components/alert.js.map +1 -0
- package/dev/components/avatar.d.ts +30 -0
- package/dev/components/avatar.d.ts.map +1 -0
- package/dev/components/avatar.js +92 -0
- package/dev/components/avatar.js.map +1 -0
- package/dev/components/breath.d.ts +35 -0
- package/dev/components/breath.d.ts.map +1 -0
- package/dev/components/breath.js +135 -0
- package/dev/components/breath.js.map +1 -0
- package/dev/components/button.d.ts +52 -0
- package/dev/components/button.d.ts.map +1 -0
- package/dev/components/button.js +260 -0
- package/dev/components/button.js.map +1 -0
- package/dev/components/card.d.ts +19 -0
- package/dev/components/card.d.ts.map +1 -0
- package/dev/components/card.js +81 -0
- package/dev/components/card.js.map +1 -0
- package/dev/components/carousel.d.ts +41 -0
- package/dev/components/carousel.d.ts.map +1 -0
- package/dev/components/carousel.js +157 -0
- package/dev/components/carousel.js.map +1 -0
- package/dev/components/details.d.ts +23 -0
- package/dev/components/details.d.ts.map +1 -0
- package/dev/components/details.js +118 -0
- package/dev/components/details.js.map +1 -0
- package/dev/components/dialog.d.ts +37 -0
- package/dev/components/dialog.d.ts.map +1 -0
- package/dev/components/dialog.js +159 -0
- package/dev/components/dialog.js.map +1 -0
- package/dev/components/divider.d.ts +17 -0
- package/dev/components/divider.d.ts.map +1 -0
- package/dev/components/divider.js +46 -0
- package/dev/components/divider.js.map +1 -0
- package/dev/components/dragbox.d.ts +40 -0
- package/dev/components/dragbox.d.ts.map +1 -0
- package/dev/components/dragbox.js +117 -0
- package/dev/components/dragbox.js.map +1 -0
- package/dev/components/flex.d.ts +32 -0
- package/dev/components/flex.d.ts.map +1 -0
- package/dev/components/flex.js +60 -0
- package/dev/components/flex.js.map +1 -0
- package/dev/components/form.d.ts +22 -0
- package/dev/components/form.d.ts.map +1 -0
- package/dev/components/form.js +77 -0
- package/dev/components/form.js.map +1 -0
- package/dev/components/grid.d.ts +36 -0
- package/dev/components/grid.d.ts.map +1 -0
- package/dev/components/grid.js +54 -0
- package/dev/components/grid.js.map +1 -0
- package/dev/components/input.d.ts +19 -0
- package/dev/components/input.d.ts.map +1 -0
- package/dev/components/input.js +70 -0
- package/dev/components/input.js.map +1 -0
- package/dev/components/layout.d.ts +26 -0
- package/dev/components/layout.d.ts.map +1 -0
- package/dev/components/layout.js +82 -0
- package/dev/components/layout.js.map +1 -0
- package/dev/components/link.d.ts +22 -0
- package/dev/components/link.d.ts.map +1 -0
- package/dev/components/link.js +42 -0
- package/dev/components/link.js.map +1 -0
- package/dev/components/progress.d.ts +21 -0
- package/dev/components/progress.d.ts.map +1 -0
- package/dev/components/progress.js +99 -0
- package/dev/components/progress.js.map +1 -0
- package/dev/components/range.d.ts +86 -0
- package/dev/components/range.d.ts.map +1 -0
- package/dev/components/range.js +364 -0
- package/dev/components/range.js.map +1 -0
- package/dev/components/rotate.d.ts +26 -0
- package/dev/components/rotate.d.ts.map +1 -0
- package/dev/components/rotate.js +86 -0
- package/dev/components/rotate.js.map +1 -0
- package/dev/components/router.d.ts +119 -0
- package/dev/components/router.d.ts.map +1 -0
- package/dev/components/router.js +248 -0
- package/dev/components/router.js.map +1 -0
- package/dev/components/select.d.ts +46 -0
- package/dev/components/select.d.ts.map +1 -0
- package/dev/components/select.js +245 -0
- package/dev/components/select.js.map +1 -0
- package/dev/components/skeleton.d.ts +26 -0
- package/dev/components/skeleton.d.ts.map +1 -0
- package/dev/components/skeleton.js +118 -0
- package/dev/components/skeleton.js.map +1 -0
- package/dev/components/split.d.ts +49 -0
- package/dev/components/split.d.ts.map +1 -0
- package/dev/components/split.js +206 -0
- package/dev/components/split.js.map +1 -0
- package/dev/components/switch.d.ts +39 -0
- package/dev/components/switch.d.ts.map +1 -0
- package/dev/components/switch.js +182 -0
- package/dev/components/switch.js.map +1 -0
- package/dev/components/text.d.ts +19 -0
- package/dev/components/text.d.ts.map +1 -0
- package/dev/components/text.js +93 -0
- package/dev/components/text.js.map +1 -0
- package/dev/components/time.d.ts +37 -0
- package/dev/components/time.d.ts.map +1 -0
- package/dev/components/time.js +75 -0
- package/dev/components/time.js.map +1 -0
- package/dev/components/tooltip.d.ts +48 -0
- package/dev/components/tooltip.d.ts.map +1 -0
- package/dev/components/tooltip.js +137 -0
- package/dev/components/tooltip.js.map +1 -0
- package/dev/components/typewriter.d.ts +55 -0
- package/dev/components/typewriter.d.ts.map +1 -0
- package/dev/components/typewriter.js +155 -0
- package/dev/components/typewriter.js.map +1 -0
- package/dev/core/global-style.d.ts +21 -0
- package/dev/core/global-style.d.ts.map +1 -0
- package/dev/core/global-style.js +76 -0
- package/dev/core/global-style.js.map +1 -0
- package/dev/core/super-anchor.d.ts +15 -0
- package/dev/core/super-anchor.d.ts.map +1 -0
- package/dev/core/super-anchor.js +58 -0
- package/dev/core/super-anchor.js.map +1 -0
- package/dev/core/super-input.d.ts +38 -0
- package/dev/core/super-input.d.ts.map +1 -0
- package/dev/core/super-input.js +182 -0
- package/dev/core/super-input.js.map +1 -0
- package/dev/core/super-openable.d.ts +19 -0
- package/dev/core/super-openable.d.ts.map +1 -0
- package/dev/core/super-openable.js +36 -0
- package/dev/core/super-openable.js.map +1 -0
- package/dev/details.d.ts +8 -0
- package/dev/details.d.ts.map +1 -0
- package/dev/details.js +4 -0
- package/dev/details.js.map +1 -0
- package/dev/dialog.d.ts +8 -0
- package/dev/dialog.d.ts.map +1 -0
- package/dev/dialog.js +4 -0
- package/dev/dialog.js.map +1 -0
- package/dev/divider.d.ts +8 -0
- package/dev/divider.d.ts.map +1 -0
- package/dev/divider.js +4 -0
- package/dev/divider.js.map +1 -0
- package/dev/dragbox.d.ts +8 -0
- package/dev/dragbox.d.ts.map +1 -0
- package/dev/dragbox.js +4 -0
- package/dev/dragbox.js.map +1 -0
- package/dev/flex.d.ts +8 -0
- package/dev/flex.d.ts.map +1 -0
- package/dev/flex.js +4 -0
- package/dev/flex.js.map +1 -0
- package/dev/form.d.ts +8 -0
- package/dev/form.d.ts.map +1 -0
- package/dev/form.js +4 -0
- package/dev/form.js.map +1 -0
- package/dev/grid.d.ts +8 -0
- package/dev/grid.d.ts.map +1 -0
- package/dev/grid.js +4 -0
- package/dev/grid.js.map +1 -0
- package/dev/index.d.ts +29 -0
- package/dev/index.d.ts.map +1 -0
- package/dev/index.js +29 -0
- package/dev/index.js.map +1 -0
- package/dev/input.d.ts +9 -0
- package/dev/input.d.ts.map +1 -0
- package/dev/input.js +5 -0
- package/dev/input.js.map +1 -0
- package/dev/layout.d.ts +9 -0
- package/dev/layout.d.ts.map +1 -0
- package/dev/layout.js +5 -0
- package/dev/layout.js.map +1 -0
- package/dev/link.d.ts +9 -0
- package/dev/link.d.ts.map +1 -0
- package/dev/link.js +5 -0
- package/dev/link.js.map +1 -0
- package/dev/progress.d.ts +9 -0
- package/dev/progress.d.ts.map +1 -0
- package/dev/progress.js +5 -0
- package/dev/progress.js.map +1 -0
- package/dev/range.d.ts +9 -0
- package/dev/range.d.ts.map +1 -0
- package/dev/range.js +5 -0
- package/dev/range.js.map +1 -0
- package/dev/rotate.d.ts +9 -0
- package/dev/rotate.d.ts.map +1 -0
- package/dev/rotate.js +5 -0
- package/dev/rotate.js.map +1 -0
- package/dev/router.d.ts +9 -0
- package/dev/router.d.ts.map +1 -0
- package/dev/router.js +5 -0
- package/dev/router.js.map +1 -0
- package/dev/select.d.ts +9 -0
- package/dev/select.d.ts.map +1 -0
- package/dev/select.js +5 -0
- package/dev/select.js.map +1 -0
- package/dev/skeleton.d.ts +9 -0
- package/dev/skeleton.d.ts.map +1 -0
- package/dev/skeleton.js +5 -0
- package/dev/skeleton.js.map +1 -0
- package/dev/split.d.ts +9 -0
- package/dev/split.d.ts.map +1 -0
- package/dev/split.js +5 -0
- package/dev/split.js.map +1 -0
- package/dev/switch.d.ts +9 -0
- package/dev/switch.d.ts.map +1 -0
- package/dev/switch.js +5 -0
- package/dev/switch.js.map +1 -0
- package/dev/text.d.ts +9 -0
- package/dev/text.d.ts.map +1 -0
- package/dev/text.js +5 -0
- package/dev/text.js.map +1 -0
- package/dev/time.d.ts +9 -0
- package/dev/time.d.ts.map +1 -0
- package/dev/time.js +5 -0
- package/dev/time.js.map +1 -0
- package/dev/tooltip.d.ts +9 -0
- package/dev/tooltip.d.ts.map +1 -0
- package/dev/tooltip.js +5 -0
- package/dev/tooltip.js.map +1 -0
- package/dev/typewriter.d.ts +8 -0
- package/dev/typewriter.d.ts.map +1 -0
- package/dev/typewriter.js +4 -0
- package/dev/typewriter.js.map +1 -0
- package/index.js +13 -13
- package/package.json +10 -8
- package/range.d.ts +1 -1
- package/range.d.ts.map +1 -1
- package/src/alert.ts +11 -0
- package/src/avatar.ts +11 -0
- package/src/breath.ts +13 -0
- package/src/button.ts +11 -0
- package/src/card.ts +11 -0
- package/src/carousel.ts +11 -0
- package/src/components/alert.ts +282 -0
- package/src/components/avatar.ts +95 -0
- package/src/components/breath.ts +153 -0
- package/src/components/button.ts +286 -0
- package/src/components/card.ts +80 -0
- package/src/components/carousel.ts +169 -0
- package/src/components/details.ts +116 -0
- package/src/components/dialog.ts +165 -0
- package/src/components/divider.ts +44 -0
- package/src/components/dragbox.ts +127 -0
- package/src/components/flex.ts +70 -0
- package/src/components/form.ts +82 -0
- package/src/components/grid.ts +75 -0
- package/src/components/input.ts +72 -0
- package/src/components/layout.ts +82 -0
- package/src/components/link.ts +38 -0
- package/src/components/progress.ts +95 -0
- package/src/components/range.ts +404 -0
- package/src/components/rotate.ts +92 -0
- package/src/components/router.ts +273 -0
- package/src/components/select.ts +268 -0
- package/src/components/skeleton.ts +118 -0
- package/src/components/split.ts +221 -0
- package/src/components/switch.ts +180 -0
- package/src/components/text.ts +95 -0
- package/src/components/time.ts +81 -0
- package/src/components/tooltip.ts +138 -0
- package/src/components/typewriter.ts +154 -0
- package/src/core/global-style.ts +86 -0
- package/src/core/super-anchor.ts +52 -0
- package/src/core/super-input.ts +230 -0
- package/src/core/super-openable.ts +51 -0
- package/src/details.ts +11 -0
- package/src/dialog.ts +11 -0
- package/src/divider.ts +11 -0
- package/src/dragbox.ts +11 -0
- package/src/flex.ts +11 -0
- package/src/form.ts +11 -0
- package/src/grid.ts +11 -0
- package/src/index.ts +28 -0
- package/src/input.ts +13 -0
- package/src/layout.ts +12 -0
- package/src/link.ts +13 -0
- package/src/progress.ts +12 -0
- package/src/range.ts +13 -0
- package/src/rotate.ts +13 -0
- package/src/router.ts +12 -0
- package/src/select.ts +13 -0
- package/src/skeleton.ts +13 -0
- package/src/split.ts +13 -0
- package/src/switch.ts +13 -0
- package/src/text.ts +13 -0
- package/src/time.ts +13 -0
- package/src/tooltip.ts +13 -0
- package/src/typewriter.ts +11 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
@@ -0,0 +1,26 @@
|
|
1
|
+
import { GlobalStyle } from "../core/global-style.js";
|
2
|
+
/**
|
3
|
+
* {@linkcode Rotate} Make child elements rotate.
|
4
|
+
*
|
5
|
+
* @category wrapper
|
6
|
+
*/
|
7
|
+
declare class Rotate extends GlobalStyle {
|
8
|
+
protected _root: HTMLElement;
|
9
|
+
protected render(): import("lit").TemplateResult<1>;
|
10
|
+
reset(): void;
|
11
|
+
protected _handleRotate(e: MouseEvent): void;
|
12
|
+
/**
|
13
|
+
* Compute offset.
|
14
|
+
* ```
|
15
|
+
* `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
|
16
|
+
* ```
|
17
|
+
* @param e Mouse move event.
|
18
|
+
* @returns rotateX, rotateY
|
19
|
+
*/
|
20
|
+
_computeOffset(e: MouseEvent): {
|
21
|
+
rotateX: number;
|
22
|
+
rotateY: number;
|
23
|
+
};
|
24
|
+
}
|
25
|
+
export default Rotate;
|
26
|
+
//# sourceMappingURL=rotate.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../../src/components/rotate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE;;;;GAIG;AACH,cAiCM,MAAO,SAAQ,WAAW;IAE9B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM;IAOhB,KAAK;IAKL,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU;IAMrC;;;;;;;OAOG;IACH,cAAc,CAAC,CAAC,EAAE,UAAU;;;;CAU7B;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { godown } from "@godown/element/decorators/godown.js";
|
3
|
+
import { part } from "@godown/element/decorators/part.js";
|
4
|
+
import { styles } from "@godown/element/decorators/styles.js";
|
5
|
+
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
6
|
+
import { css, html } from "lit";
|
7
|
+
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
8
|
+
const protoName = "rotate";
|
9
|
+
const cssScope = scopePrefix(protoName);
|
10
|
+
/**
|
11
|
+
* {@linkcode Rotate} Make child elements rotate.
|
12
|
+
*
|
13
|
+
* @category wrapper
|
14
|
+
*/
|
15
|
+
let Rotate = class Rotate extends GlobalStyle {
|
16
|
+
render() {
|
17
|
+
return html `<div part="root">
|
18
|
+
<div part="slot" @mousemove="${this._handleRotate}">${htmlSlot()}</div>
|
19
|
+
<i @mouseleave="${this.reset}"></i>
|
20
|
+
</div>`;
|
21
|
+
}
|
22
|
+
reset() {
|
23
|
+
this._root.style.removeProperty("transform");
|
24
|
+
this._root.style.removeProperty("transition");
|
25
|
+
}
|
26
|
+
_handleRotate(e) {
|
27
|
+
const { rotateX, rotateY } = this._computeOffset(e);
|
28
|
+
this._root.style.setProperty("transform", `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`);
|
29
|
+
this._root.style.setProperty("transition", "0s");
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Compute offset.
|
33
|
+
* ```
|
34
|
+
* `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
|
35
|
+
* ```
|
36
|
+
* @param e Mouse move event.
|
37
|
+
* @returns rotateX, rotateY
|
38
|
+
*/
|
39
|
+
_computeOffset(e) {
|
40
|
+
const { left, top, width, height } = this._root.getBoundingClientRect();
|
41
|
+
const { clientX, clientY } = e;
|
42
|
+
const offsetX = clientX - left;
|
43
|
+
const offsetY = clientY - top;
|
44
|
+
const rotateX = -(offsetY - height / 2) / height / 2;
|
45
|
+
const rotateY = (offsetX - width / 2) / width / 2;
|
46
|
+
return { rotateX, rotateY };
|
47
|
+
}
|
48
|
+
};
|
49
|
+
__decorate([
|
50
|
+
part("root")
|
51
|
+
], Rotate.prototype, "_root", void 0);
|
52
|
+
Rotate = __decorate([
|
53
|
+
godown(protoName),
|
54
|
+
styles(css `
|
55
|
+
:host {
|
56
|
+
display: block;
|
57
|
+
width: -moz-fit-content;
|
58
|
+
width: fit-content;
|
59
|
+
transition: all 0.5s ease-in-out;
|
60
|
+
${cssScope}--padding: .75em;
|
61
|
+
${cssScope}--offset: .5em;
|
62
|
+
}
|
63
|
+
|
64
|
+
div {
|
65
|
+
position: relative;
|
66
|
+
transition: inherit;
|
67
|
+
transition-property: transform;
|
68
|
+
}
|
69
|
+
|
70
|
+
i {
|
71
|
+
width: 100%;
|
72
|
+
height: 100%;
|
73
|
+
position: absolute;
|
74
|
+
top: 0;
|
75
|
+
box-sizing: content-box;
|
76
|
+
padding: var(${cssScope}--offset);
|
77
|
+
margin: calc(-1 * var(${cssScope}--offset));
|
78
|
+
}
|
79
|
+
|
80
|
+
[part=slot]{
|
81
|
+
z-index: 2;
|
82
|
+
}
|
83
|
+
`)
|
84
|
+
], Rotate);
|
85
|
+
export default Rotate;
|
86
|
+
//# sourceMappingURL=rotate.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rotate.js","sourceRoot":"","sources":["../../src/components/rotate.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAExC;;;;GAIG;AAkCH,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,WAAW;IAIpB,MAAM;QACd,OAAO,IAAI,CAAA;qCACsB,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE;wBAC9C,IAAI,CAAC,KAAK;WACvB,CAAC;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AQ;;;;;;;;;;;;;;;mBAeK,QAAQ;4BACC,QAAQ;;;;;;CAMnC,CACA;GACK,MAAM,CAwCX;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import { type PropertyValueMap, type TemplateResult } from "lit";
|
2
|
+
import { GlobalStyle } from "../core/global-style.js";
|
3
|
+
/**
|
4
|
+
* {@linkcode Router} has basic routing control.
|
5
|
+
*
|
6
|
+
* To switch routes, use `router-link component`.
|
7
|
+
*
|
8
|
+
* It has two methods to collect routes.
|
9
|
+
*
|
10
|
+
* 1. From field `routes`, an array, each elements require "path" and "component".
|
11
|
+
* 2. From child elements, which have the slot attribute for matching routes.
|
12
|
+
*
|
13
|
+
* If only the method 1 is used, set `type` to `"field"`.
|
14
|
+
*
|
15
|
+
* If only the method 2 is used, set `type` to `"slotted"`.
|
16
|
+
*
|
17
|
+
* `type` defaults to `"united"`, which will try method 1, then method 2.
|
18
|
+
*
|
19
|
+
* If no routes are matched, the default value (no named slot) will be rendered.
|
20
|
+
*
|
21
|
+
* @slot - Display slot when there is no match.
|
22
|
+
* @slot * - Matching slot will be displayed.
|
23
|
+
* @category navigation
|
24
|
+
*/
|
25
|
+
declare class Router<C = unknown> extends GlobalStyle {
|
26
|
+
static routerInstances: Set<Router<unknown>>;
|
27
|
+
private __fieldRouteTree;
|
28
|
+
private __slottedRouteTree;
|
29
|
+
private __cacheRecord;
|
30
|
+
private __routes;
|
31
|
+
/**
|
32
|
+
* Render result.
|
33
|
+
*/
|
34
|
+
component: C | TemplateResult;
|
35
|
+
/**
|
36
|
+
* Dynamic parameters record.
|
37
|
+
*/
|
38
|
+
params: Record<string, string>;
|
39
|
+
/**
|
40
|
+
* Value of matched path in routes.
|
41
|
+
*/
|
42
|
+
path: string;
|
43
|
+
/**
|
44
|
+
* Current pathname (equals to location.pathname).
|
45
|
+
*/
|
46
|
+
pathname: string;
|
47
|
+
/**
|
48
|
+
* Path prefix.
|
49
|
+
*/
|
50
|
+
baseURL: string;
|
51
|
+
/**
|
52
|
+
* Rendered content when there is no match.
|
53
|
+
*/
|
54
|
+
default: TemplateResult;
|
55
|
+
/**
|
56
|
+
* The type of routing sources.
|
57
|
+
*
|
58
|
+
* If field, it won't collect the slot attribute of the child elements.
|
59
|
+
*
|
60
|
+
* This property should not be changed after the rendering is complete.
|
61
|
+
*/
|
62
|
+
type: "united" | "slotted" | "field";
|
63
|
+
/**
|
64
|
+
* Cache accessed records.
|
65
|
+
*
|
66
|
+
* Emptied at each re-collection.
|
67
|
+
*/
|
68
|
+
cache: boolean;
|
69
|
+
set routes(value: (Record<string, any> & {
|
70
|
+
path: string;
|
71
|
+
component?: C;
|
72
|
+
})[]);
|
73
|
+
get routes(): (Record<string, any> & {
|
74
|
+
path: string;
|
75
|
+
component?: C;
|
76
|
+
})[];
|
77
|
+
clear(): void;
|
78
|
+
protected render(): C | TemplateResult;
|
79
|
+
connectedCallback(): void;
|
80
|
+
disconnectedCallback(): void;
|
81
|
+
useRouter(): {
|
82
|
+
pathname: string;
|
83
|
+
params: Record<string, string>;
|
84
|
+
path: string;
|
85
|
+
component: C | TemplateResult;
|
86
|
+
};
|
87
|
+
/**
|
88
|
+
* Callback function when the route changes.
|
89
|
+
*/
|
90
|
+
routeChangeCallback: (params: {
|
91
|
+
pathname: string;
|
92
|
+
params: Record<string, string>;
|
93
|
+
path: string;
|
94
|
+
component: C | TemplateResult;
|
95
|
+
}, first: boolean) => void;
|
96
|
+
protected updated(changedProperties: PropertyValueMap<this>): void;
|
97
|
+
/**
|
98
|
+
* Get component from {@linkcode routes} by query.
|
99
|
+
*/
|
100
|
+
fieldComponent(query?: string): C;
|
101
|
+
/**
|
102
|
+
* Get component from slotted elements by query.
|
103
|
+
*/
|
104
|
+
slottedComponent(usedRouteTemplate?: string): TemplateResult<1>;
|
105
|
+
/**
|
106
|
+
* Reset the route tree, clear cache, collect routes from child elements.
|
107
|
+
*/
|
108
|
+
collectSlottedRoutes(): void;
|
109
|
+
/**
|
110
|
+
* Reset the route tree, clear cache, collect routes from value.
|
111
|
+
*/
|
112
|
+
collectFieldRoutes(value: typeof this.routes): void;
|
113
|
+
useWhich(path: string): string;
|
114
|
+
parseParams(routeTemplate: string, path: string): Record<string, string>;
|
115
|
+
static updateAll(): void;
|
116
|
+
handlePopstate: () => void;
|
117
|
+
}
|
118
|
+
export default Router;
|
119
|
+
//# sourceMappingURL=router.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/components/router.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,cAEM,MAAM,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,WAAW;IAC3C,MAAM,CAAC,eAAe,uBAAqB;IAE3C,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,aAAa,CAAwD;IAC7E,OAAO,CAAC,QAAQ,CAMZ;IAEJ;;OAEG;IAEH,SAAS,EAAE,CAAC,GAAG,cAAc,CAAQ;IAErC;;OAEG;IAEH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IAEpC;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IAEH,QAAQ,SAAM;IAEd;;OAEG;IAEH,OAAO,SAAM;IAEb;;OAEG;IAEH,OAAO,EAAE,cAAc,CAAc;IAErC;;;;;;OAMG;IAEH,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAY;IAEhD;;;;OAIG;IAEH,KAAK,UAAS;IAEd,IACI,MAAM,CAAC,KAAK;cA5DN,MAAM;oBACA,CAAC;QA2DD,EAGf;IAED,IAAI,MAAM;cAjEA,MAAM;oBACA,CAAC;SAkEhB;IAED,KAAK;IAIL,SAAS,CAAC,MAAM;IAsBhB,iBAAiB;IAgBjB,oBAAoB;IAKpB,SAAS;;;;;;IAST;;OAEG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,CAAC,GAAG,cAAc,CAAC;KAC/B,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAQ;IAElC,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC;IAa3D;;OAEG;IACH,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM;IAgB7B;;OAEG;IACH,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,MAAM;IAiB3C;;OAEG;IACH,oBAAoB;IAQpB;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,MAAM;IAQ5C,QAAQ,CAAC,IAAI,EAAE,MAAM;IAIrB,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAI/C,MAAM,CAAC,SAAS;IAMhB,cAAc,EAER,MAAM,IAAI,CAAC;CAClB;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,248 @@
|
|
1
|
+
var Router_1;
|
2
|
+
import { __decorate } from "tslib";
|
3
|
+
import { godown } from "@godown/element/decorators/godown.js";
|
4
|
+
import { styles } from "@godown/element/decorators/styles.js";
|
5
|
+
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
6
|
+
import { RouteTree } from "@godown/element/tools/route-tree.js";
|
7
|
+
import { css } from "lit";
|
8
|
+
import { property, state } from "lit/decorators.js";
|
9
|
+
import { GlobalStyle } from "../core/global-style.js";
|
10
|
+
const protoName = "router";
|
11
|
+
/**
|
12
|
+
* {@linkcode Router} has basic routing control.
|
13
|
+
*
|
14
|
+
* To switch routes, use `router-link component`.
|
15
|
+
*
|
16
|
+
* It has two methods to collect routes.
|
17
|
+
*
|
18
|
+
* 1. From field `routes`, an array, each elements require "path" and "component".
|
19
|
+
* 2. From child elements, which have the slot attribute for matching routes.
|
20
|
+
*
|
21
|
+
* If only the method 1 is used, set `type` to `"field"`.
|
22
|
+
*
|
23
|
+
* If only the method 2 is used, set `type` to `"slotted"`.
|
24
|
+
*
|
25
|
+
* `type` defaults to `"united"`, which will try method 1, then method 2.
|
26
|
+
*
|
27
|
+
* If no routes are matched, the default value (no named slot) will be rendered.
|
28
|
+
*
|
29
|
+
* @slot - Display slot when there is no match.
|
30
|
+
* @slot * - Matching slot will be displayed.
|
31
|
+
* @category navigation
|
32
|
+
*/
|
33
|
+
let Router = Router_1 = class Router extends GlobalStyle {
|
34
|
+
constructor() {
|
35
|
+
super(...arguments);
|
36
|
+
this.__fieldRouteTree = new RouteTree();
|
37
|
+
this.__slottedRouteTree = new RouteTree();
|
38
|
+
this.__cacheRecord = new Map();
|
39
|
+
/**
|
40
|
+
* Render result.
|
41
|
+
*/
|
42
|
+
this.component = null;
|
43
|
+
/**
|
44
|
+
* Dynamic parameters record.
|
45
|
+
*/
|
46
|
+
this.params = {};
|
47
|
+
/**
|
48
|
+
* Current pathname (equals to location.pathname).
|
49
|
+
*/
|
50
|
+
this.pathname = "";
|
51
|
+
/**
|
52
|
+
* Path prefix.
|
53
|
+
*/
|
54
|
+
this.baseURL = "";
|
55
|
+
/**
|
56
|
+
* Rendered content when there is no match.
|
57
|
+
*/
|
58
|
+
this.default = htmlSlot();
|
59
|
+
/**
|
60
|
+
* The type of routing sources.
|
61
|
+
*
|
62
|
+
* If field, it won't collect the slot attribute of the child elements.
|
63
|
+
*
|
64
|
+
* This property should not be changed after the rendering is complete.
|
65
|
+
*/
|
66
|
+
this.type = "united";
|
67
|
+
/**
|
68
|
+
* Cache accessed records.
|
69
|
+
*
|
70
|
+
* Emptied at each re-collection.
|
71
|
+
*/
|
72
|
+
this.cache = false;
|
73
|
+
/**
|
74
|
+
* Callback function when the route changes.
|
75
|
+
*/
|
76
|
+
this.routeChangeCallback = null;
|
77
|
+
this.handlePopstate = this.events.add(window, "popstate", () => {
|
78
|
+
this.pathname = location.pathname;
|
79
|
+
});
|
80
|
+
}
|
81
|
+
set routes(value) {
|
82
|
+
this.__routes = value;
|
83
|
+
this.collectFieldRoutes(value);
|
84
|
+
}
|
85
|
+
get routes() {
|
86
|
+
return this.__routes;
|
87
|
+
}
|
88
|
+
clear() {
|
89
|
+
this.__cacheRecord.clear();
|
90
|
+
}
|
91
|
+
render() {
|
92
|
+
this.params = {};
|
93
|
+
if (this.cache) {
|
94
|
+
const cached = this.__cacheRecord.get(this.pathname);
|
95
|
+
if (cached) {
|
96
|
+
Object.assign(this, cached);
|
97
|
+
return this.component;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
switch (this.type) {
|
101
|
+
case "field":
|
102
|
+
this.component = this.fieldComponent();
|
103
|
+
break;
|
104
|
+
case "slotted":
|
105
|
+
this.component = this.slottedComponent();
|
106
|
+
break;
|
107
|
+
default:
|
108
|
+
this.component = this.fieldComponent() ?? this.slottedComponent();
|
109
|
+
}
|
110
|
+
return this.component ?? this.default ?? null;
|
111
|
+
}
|
112
|
+
connectedCallback() {
|
113
|
+
super.connectedCallback();
|
114
|
+
Router_1.routerInstances.add(this);
|
115
|
+
this.pathname ??= location.pathname;
|
116
|
+
if (this.type !== "field") {
|
117
|
+
const mutationObserver = new MutationObserver(this.collectSlottedRoutes);
|
118
|
+
mutationObserver.observe(this, {
|
119
|
+
attributeFilter: ["slot"],
|
120
|
+
attributes: true,
|
121
|
+
subtree: true,
|
122
|
+
});
|
123
|
+
this.collectSlottedRoutes();
|
124
|
+
}
|
125
|
+
}
|
126
|
+
disconnectedCallback() {
|
127
|
+
super.disconnectedCallback();
|
128
|
+
Router_1.routerInstances.delete(this);
|
129
|
+
}
|
130
|
+
useRouter() {
|
131
|
+
return {
|
132
|
+
pathname: this.pathname,
|
133
|
+
params: this.params,
|
134
|
+
path: this.path,
|
135
|
+
component: this.component,
|
136
|
+
};
|
137
|
+
}
|
138
|
+
updated(changedProperties) {
|
139
|
+
const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
|
140
|
+
if (shouldDispatch) {
|
141
|
+
const ur = this.useRouter();
|
142
|
+
const noRecord = !this.__cacheRecord.has(this.pathname);
|
143
|
+
if (noRecord) {
|
144
|
+
this.__cacheRecord.set(this.pathname, ur);
|
145
|
+
}
|
146
|
+
this.routeChangeCallback?.(ur, noRecord);
|
147
|
+
this.dispatchEvent(new CustomEvent("change", { detail: ur }));
|
148
|
+
}
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* Get component from {@linkcode routes} by query.
|
152
|
+
*/
|
153
|
+
fieldComponent(query) {
|
154
|
+
query ||= this.useWhich(this.pathname);
|
155
|
+
this.path = query;
|
156
|
+
if (!query) {
|
157
|
+
return null;
|
158
|
+
}
|
159
|
+
this.params = this.parseParams(this.path, this.pathname);
|
160
|
+
const route = this.routes.find((r) => r.path === query);
|
161
|
+
if (!route) {
|
162
|
+
return null;
|
163
|
+
}
|
164
|
+
return route.component;
|
165
|
+
}
|
166
|
+
/**
|
167
|
+
* Get component from slotted elements by query.
|
168
|
+
*/
|
169
|
+
slottedComponent(usedRouteTemplate) {
|
170
|
+
const slottedPaths = this._slottedNames;
|
171
|
+
usedRouteTemplate ||= this.__slottedRouteTree.useWhich(this.pathname);
|
172
|
+
this.path = usedRouteTemplate;
|
173
|
+
if (!usedRouteTemplate) {
|
174
|
+
return null;
|
175
|
+
}
|
176
|
+
this.path = slottedPaths.find((s) => s === usedRouteTemplate);
|
177
|
+
if (!this.path) {
|
178
|
+
return null;
|
179
|
+
}
|
180
|
+
this.params = this.parseParams(usedRouteTemplate, this.pathname);
|
181
|
+
return htmlSlot(this.path);
|
182
|
+
}
|
183
|
+
/**
|
184
|
+
* Reset the route tree, clear cache, collect routes from child elements.
|
185
|
+
*/
|
186
|
+
collectSlottedRoutes() {
|
187
|
+
this.__slottedRouteTree = new RouteTree();
|
188
|
+
this.clear();
|
189
|
+
this._slottedNames.forEach(slotName => {
|
190
|
+
this.__slottedRouteTree.insert(slotName);
|
191
|
+
});
|
192
|
+
}
|
193
|
+
/**
|
194
|
+
* Reset the route tree, clear cache, collect routes from value.
|
195
|
+
*/
|
196
|
+
collectFieldRoutes(value) {
|
197
|
+
this.__fieldRouteTree = new RouteTree();
|
198
|
+
this.clear();
|
199
|
+
value.forEach(({ path }) => {
|
200
|
+
this.__fieldRouteTree.insert(path);
|
201
|
+
});
|
202
|
+
}
|
203
|
+
useWhich(path) {
|
204
|
+
return this.__fieldRouteTree.useWhich(this.baseURL + path);
|
205
|
+
}
|
206
|
+
parseParams(routeTemplate, path) {
|
207
|
+
return this.__fieldRouteTree.parseParams(path, routeTemplate);
|
208
|
+
}
|
209
|
+
static updateAll() {
|
210
|
+
this.routerInstances.forEach((i) => {
|
211
|
+
i.handlePopstate();
|
212
|
+
});
|
213
|
+
}
|
214
|
+
};
|
215
|
+
Router.routerInstances = new Set();
|
216
|
+
__decorate([
|
217
|
+
state()
|
218
|
+
], Router.prototype, "component", void 0);
|
219
|
+
__decorate([
|
220
|
+
state()
|
221
|
+
], Router.prototype, "params", void 0);
|
222
|
+
__decorate([
|
223
|
+
state()
|
224
|
+
], Router.prototype, "path", void 0);
|
225
|
+
__decorate([
|
226
|
+
property()
|
227
|
+
], Router.prototype, "pathname", void 0);
|
228
|
+
__decorate([
|
229
|
+
property()
|
230
|
+
], Router.prototype, "baseURL", void 0);
|
231
|
+
__decorate([
|
232
|
+
state()
|
233
|
+
], Router.prototype, "default", void 0);
|
234
|
+
__decorate([
|
235
|
+
property()
|
236
|
+
], Router.prototype, "type", void 0);
|
237
|
+
__decorate([
|
238
|
+
property({ type: Boolean })
|
239
|
+
], Router.prototype, "cache", void 0);
|
240
|
+
__decorate([
|
241
|
+
state()
|
242
|
+
], Router.prototype, "routes", null);
|
243
|
+
Router = Router_1 = __decorate([
|
244
|
+
godown(protoName),
|
245
|
+
styles(css `:host{display:contents;}`)
|
246
|
+
], Router);
|
247
|
+
export default Router;
|
248
|
+
//# sourceMappingURL=router.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/components/router.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,GAAG,EAA8C,MAAM,KAAK,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,IAAM,MAAM,cAAZ,MAAM,MAAoB,SAAQ,WAAW;IAA7C;;QAGU,qBAAgB,GAAc,IAAI,SAAS,EAAE,CAAC;QAC9C,uBAAkB,GAAc,IAAI,SAAS,EAAE,CAAC;QAChD,kBAAa,GAAG,IAAI,GAAG,EAA6C,CAAC;QAS7E;;WAEG;QAEH,cAAS,GAAuB,IAAI,CAAC;QAErC;;WAEG;QAEH,WAAM,GAA2B,EAAE,CAAC;QAQpC;;WAEG;QAEH,aAAQ,GAAG,EAAE,CAAC;QAEd;;WAEG;QAEH,YAAO,GAAG,EAAE,CAAC;QAEb;;WAEG;QAEH,YAAO,GAAmB,QAAQ,EAAE,CAAC;QAErC;;;;;;WAMG;QAEH,SAAI,GAAmC,QAAQ,CAAC;QAEhD;;;;WAIG;QAEH,UAAK,GAAG,KAAK,CAAC;QAoEd;;WAEG;QACH,w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AAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;;AArOM,sBAAe,GAAG,IAAI,GAAG,EAAU,AAApB,CAAqB;AAiB3C;IADC,KAAK,EAAE;yCAC6B;AAMrC;IADC,KAAK,EAAE;sCAC4B;AAMpC;IADC,KAAK,EAAE;oCACK;AAMb;IADC,QAAQ,EAAE;wCACG;AAMd;IADC,QAAQ,EAAE;uCACE;AAMb;IADC,KAAK,EAAE;uCAC6B;AAUrC;IADC,QAAQ,EAAE;oCACqC;AAQhD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACd;AAGd;IADC,KAAK,EAAE;oCAIP;AAxEG,MAAM;IAFX,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA,0BAA0B,CAAC;GAChC,MAAM,CA2OX;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { HandlerEvent } from "@godown/element";
|
2
|
+
import Input from "./input.js";
|
3
|
+
/**
|
4
|
+
* {@linkcode Select} is similar to `<select>`.
|
5
|
+
*
|
6
|
+
* Elements with the value attribute/property can be used as options.
|
7
|
+
*
|
8
|
+
* The checked attribute will be added to the selected element.
|
9
|
+
*
|
10
|
+
* Multi-selected state looks the same as single-selected.
|
11
|
+
*
|
12
|
+
* Input will filter the element.
|
13
|
+
*
|
14
|
+
* @slot - Options.
|
15
|
+
* @category input
|
16
|
+
*/
|
17
|
+
declare class Select extends Input {
|
18
|
+
value: string | string[];
|
19
|
+
/**
|
20
|
+
* Selected texts.
|
21
|
+
*/
|
22
|
+
text: string;
|
23
|
+
protected _content: HTMLElement;
|
24
|
+
direction: "top" | "bottom" | undefined;
|
25
|
+
multiple: boolean;
|
26
|
+
visible: boolean;
|
27
|
+
protected autoDirection: "top" | "bottom";
|
28
|
+
protected lastChecked: HTMLElement;
|
29
|
+
protected defaultText: string;
|
30
|
+
protected defaultChecked: HTMLElement[];
|
31
|
+
private _store;
|
32
|
+
protected render(): import("lit").TemplateResult<1>;
|
33
|
+
protected _handleFocus(): void;
|
34
|
+
protected firstUpdated(): void;
|
35
|
+
protected _connectedInit(): void;
|
36
|
+
reset(): void;
|
37
|
+
select(value: string, text?: string): 0 | 1;
|
38
|
+
filter(query?: string): void;
|
39
|
+
filterCallback(element: HTMLElement, match: boolean, query: string): void;
|
40
|
+
protected _handleInput(e: HandlerEvent<HTMLInputElement>): void;
|
41
|
+
focus(options?: FocusOptions): void;
|
42
|
+
blur(): void;
|
43
|
+
optionValue(option: HTMLElement): string;
|
44
|
+
}
|
45
|
+
export default Select;
|
46
|
+
//# sourceMappingURL=select.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,OAAO,KAAK,MAAM,YAAY,CAAC;AAyB/B;;;;;;;;;;;;;GAaG;AACH,cAqBM,MAAO,SAAQ,KAAK;IAExB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAGhC,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IAGxC,QAAQ,EAAE,OAAO,CAAC;IAGlB,OAAO,EAAE,OAAO,CAAC;IAGjB,SAAS,CAAC,aAAa,EAAE,KAAK,GAAG,QAAQ,CAAY;IAErD,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC;IACxC,OAAO,CAAC,MAAM,CAA0C;IAExD,SAAS,CAAC,MAAM;IA4BhB,SAAS,CAAC,YAAY;IAYtB,SAAS,CAAC,YAAY;IA0BtB,SAAS,CAAC,cAAc;IAs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