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,135 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { godown } from "@godown/element/decorators/godown.js";
|
3
|
+
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
+
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
5
|
+
import { css, html } from "lit";
|
6
|
+
import { property } from "lit/decorators.js";
|
7
|
+
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
8
|
+
const defineName = "breath";
|
9
|
+
const cssScope = scopePrefix(defineName);
|
10
|
+
/**
|
11
|
+
* {@linkcode Breath} render the text with a breathing effect.
|
12
|
+
*
|
13
|
+
* Dynamically generate a breathing effect based on the length of the split text.
|
14
|
+
*
|
15
|
+
* If there is not enough CSS variable, overrun elements will use the.
|
16
|
+
*
|
17
|
+
* godown was a css library in its earliest days,
|
18
|
+
* and this is the component version of its first effect.
|
19
|
+
*
|
20
|
+
* Inspired by Vercel home page (2023).
|
21
|
+
*
|
22
|
+
* @slot - Breathing parts.
|
23
|
+
* @category effect
|
24
|
+
*/
|
25
|
+
let Breath = class Breath extends GlobalStyle {
|
26
|
+
render() {
|
27
|
+
const texts = this.getTexts();
|
28
|
+
return [
|
29
|
+
texts.map(this.renderText),
|
30
|
+
htmlStyle(this.computeStyle(texts.length)),
|
31
|
+
];
|
32
|
+
}
|
33
|
+
renderText(text) {
|
34
|
+
return html `<span class="rel">
|
35
|
+
<span class="nocolor">${text}</span>
|
36
|
+
<span class="colorful">${text}</span>
|
37
|
+
</span>`;
|
38
|
+
}
|
39
|
+
getTexts() {
|
40
|
+
return Array.isArray(this.text) ? this.text : (this.text || this.textContent).split(/\s+/).filter((x) => x);
|
41
|
+
}
|
42
|
+
computeStyle(len) {
|
43
|
+
const gap = 100 / 2 / len;
|
44
|
+
const duration = this.parseDuration() || len * 2 + 2;
|
45
|
+
return (`.colorful{animation-duration:${duration}s;}`
|
46
|
+
+ `@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${gap * 2}%{opacity:1;}}`
|
47
|
+
+ (() => {
|
48
|
+
let style1 = "";
|
49
|
+
for (let number = 1; number <= len; number++) {
|
50
|
+
const delay = -duration / len * (len - number + 1);
|
51
|
+
const defaultNumber = ((number - 1) % 3) + 1;
|
52
|
+
style1 +=
|
53
|
+
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
54
|
+
}
|
55
|
+
return style1;
|
56
|
+
})());
|
57
|
+
}
|
58
|
+
parseDuration() {
|
59
|
+
const { duration } = this;
|
60
|
+
if (duration) {
|
61
|
+
if (duration.endsWith("s")) {
|
62
|
+
return parseFloat(duration.slice(0, -1));
|
63
|
+
}
|
64
|
+
else if (duration.endsWith("ms")) {
|
65
|
+
return parseFloat(duration.slice(0, -2)) / 1000;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
};
|
70
|
+
__decorate([
|
71
|
+
property()
|
72
|
+
], Breath.prototype, "text", void 0);
|
73
|
+
__decorate([
|
74
|
+
property()
|
75
|
+
], Breath.prototype, "duration", void 0);
|
76
|
+
Breath = __decorate([
|
77
|
+
godown(defineName),
|
78
|
+
styles(css `
|
79
|
+
:host {
|
80
|
+
${cssScope}--deg: 60deg;
|
81
|
+
${cssScope}--1-1: var(${cssGlobalVars._colors.red[5]});
|
82
|
+
${cssScope}--1-2: var(${cssGlobalVars._colors.yellow[5]});
|
83
|
+
${cssScope}--2-1: var(${cssGlobalVars._colors.green[5]});
|
84
|
+
${cssScope}--2-2: var(${cssGlobalVars._colors.purple[5]});
|
85
|
+
${cssScope}--3-1: var(${cssGlobalVars._colors.blue[5]});
|
86
|
+
${cssScope}--3-2: var(${cssGlobalVars._colors.pink[5]});
|
87
|
+
${cssScope}--1: linear-gradient(var(${cssScope}--deg), var(${cssScope}--1-1), var(${cssScope}--1-2));
|
88
|
+
${cssScope}--2: linear-gradient(var(${cssScope}--deg), var(${cssScope}--2-1), var(${cssScope}--2-2));
|
89
|
+
${cssScope}--3: linear-gradient(var(${cssScope}--deg), var(${cssScope}--3-1), var(${cssScope}--3-2));
|
90
|
+
}
|
91
|
+
`, css `
|
92
|
+
:host {
|
93
|
+
display: flex;
|
94
|
+
margin: auto;
|
95
|
+
width: -moz-fit-content;
|
96
|
+
width: fit-content;
|
97
|
+
font-size: 2em;
|
98
|
+
align-items: center;
|
99
|
+
direction: ltr;
|
100
|
+
}
|
101
|
+
|
102
|
+
::selection {
|
103
|
+
background: none;
|
104
|
+
}
|
105
|
+
|
106
|
+
.rel {
|
107
|
+
position: relative;
|
108
|
+
font-weight: 800;
|
109
|
+
font-size: inherit;
|
110
|
+
letter-spacing: -0.05em;
|
111
|
+
}
|
112
|
+
`, css `
|
113
|
+
.nocolor,
|
114
|
+
.colorful {
|
115
|
+
padding: 0 0.05em;
|
116
|
+
box-sizing: border-box;
|
117
|
+
display: inline-block;
|
118
|
+
animation-iteration-count: infinite;
|
119
|
+
-webkit-text-fill-color: transparent;
|
120
|
+
-webkit-background-clip: text !important;
|
121
|
+
background-clip: text !important;
|
122
|
+
}
|
123
|
+
.colorful {
|
124
|
+
opacity: 0;
|
125
|
+
animation-name: colorfulN;
|
126
|
+
}
|
127
|
+
.nocolor {
|
128
|
+
position: absolute;
|
129
|
+
top: 0;
|
130
|
+
background: var(${cssGlobalVars.clipBackground});
|
131
|
+
}
|
132
|
+
`)
|
133
|
+
], Breath);
|
134
|
+
export default Breath;
|
135
|
+
//# sourceMappingURL=breath.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"breath.js","sourceRoot":"","sources":["../../src/components/breath.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,aAAa,E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Ac,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;QAC1F,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;QAC1F,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;;GAE/F,EACD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;GAqBF,EACD,GAAG,CAAA;;;;;;;;;;;;;;;;;;wBAkBmB,aAAa,CAAC,cAAc;;GAEjD,CACF;GACK,MAAM,CAgEX;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { GlobalStyle } from "../core/global-style.js";
|
2
|
+
declare const colors: Record<"teal" | "blue" | "green" | "red" | "purple" | "orange" | "yellow" | "pink" | "gray" | "white" | "black", string>;
|
3
|
+
/**
|
4
|
+
* {@linkcode Button} renders a button.
|
5
|
+
*
|
6
|
+
* Create modal animation upon clicking.
|
7
|
+
*
|
8
|
+
* Available colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.
|
9
|
+
*
|
10
|
+
* Default color is `black`.
|
11
|
+
*
|
12
|
+
* Set the color to `none` to prevent applying styles.
|
13
|
+
*
|
14
|
+
* @category input
|
15
|
+
*/
|
16
|
+
declare class Button extends GlobalStyle {
|
17
|
+
/**
|
18
|
+
* Whether to disable this element.
|
19
|
+
*/
|
20
|
+
disabled: boolean;
|
21
|
+
/**
|
22
|
+
* Display ghost.
|
23
|
+
*/
|
24
|
+
ghost: boolean;
|
25
|
+
/**
|
26
|
+
* Whether this element is active or not.
|
27
|
+
*/
|
28
|
+
active: boolean;
|
29
|
+
/**
|
30
|
+
* Display rounded.
|
31
|
+
*/
|
32
|
+
round: boolean;
|
33
|
+
/**
|
34
|
+
* The primary color.
|
35
|
+
*/
|
36
|
+
color: "none" | keyof typeof colors;
|
37
|
+
/**
|
38
|
+
* Content text.
|
39
|
+
*/
|
40
|
+
content: string;
|
41
|
+
protected _modalRoot: HTMLElement;
|
42
|
+
protected _root: HTMLElement;
|
43
|
+
protected render(): import("lit").TemplateResult<1>;
|
44
|
+
focus(): void;
|
45
|
+
blur(): void;
|
46
|
+
firstUpdated(): void;
|
47
|
+
protected _handelClick(e: MouseEvent): void;
|
48
|
+
protected _handleModal(e: MouseEvent): void;
|
49
|
+
nextColor(): "teal" | "blue" | "green" | "red" | "purple" | "orange" | "yellow" | "pink" | "gray" | "white" | "black" | "none";
|
50
|
+
}
|
51
|
+
export default Button;
|
52
|
+
//# sourceMappingURL=button.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.ts"],"names":[],"mappings":"AASA,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAQlF,QAAA,MAAM,MAAM,0HA6DX,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,cA8FM,MAAO,SAAQ,WAAW;IAC9B;;OAEG;IAEH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IAEH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IAEH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IAEH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IAEH,KAAK,EAAE,MAAM,GAAG,MAAM,OAAO,MAAM,CAAW;IAE9C;;OAEG;IAEH,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;IAElC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM;IAUhB,KAAK;IAQL,IAAI;IAKJ,YAAY;IAIZ,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU;IASpC,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU;IAepC,SAAS;CAGV;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,260 @@
|
|
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 { htmlStyle } from "@godown/element/directives/html-style.js";
|
7
|
+
import { constructCSSObject, toVar } from "@godown/element/tools/css.js";
|
8
|
+
import { css, html } from "lit";
|
9
|
+
import { property } from "lit/decorators.js";
|
10
|
+
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
11
|
+
const protoName = "button";
|
12
|
+
const cssScope = scopePrefix(protoName);
|
13
|
+
const whiteFont = cssGlobalVars.white;
|
14
|
+
const blackFont = cssGlobalVars.black;
|
15
|
+
const colors = constructCSSObject(["color", "background", "gradients"].map((k) => `${cssScope}--${k}`), {
|
16
|
+
black: [
|
17
|
+
whiteFont, // color
|
18
|
+
cssGlobalVars._colors.darkgray[7], // background
|
19
|
+
cssGlobalVars._colors.darkgray[5], // gradients
|
20
|
+
],
|
21
|
+
gray: [
|
22
|
+
whiteFont, // color
|
23
|
+
cssGlobalVars._colors.darkgray[1], // background
|
24
|
+
cssGlobalVars._colors.lightgray[8], // gradients
|
25
|
+
],
|
26
|
+
white: [
|
27
|
+
blackFont, // color
|
28
|
+
cssGlobalVars._colors.lightgray[3], // background
|
29
|
+
cssGlobalVars._colors.lightgray[0], // gradients
|
30
|
+
],
|
31
|
+
blue: [
|
32
|
+
whiteFont, // color
|
33
|
+
cssGlobalVars._colors.blue[6], // background
|
34
|
+
cssGlobalVars._colors.blue[4], // gradients
|
35
|
+
],
|
36
|
+
green: [
|
37
|
+
whiteFont, // color
|
38
|
+
cssGlobalVars._colors.green[6], // background
|
39
|
+
cssGlobalVars._colors.green[4], // gradients
|
40
|
+
],
|
41
|
+
red: [
|
42
|
+
whiteFont, // color
|
43
|
+
cssGlobalVars._colors.red[6], // background
|
44
|
+
cssGlobalVars._colors.red[4], // gradients
|
45
|
+
],
|
46
|
+
orange: [
|
47
|
+
whiteFont, // color
|
48
|
+
cssGlobalVars._colors.orange[6], // background
|
49
|
+
cssGlobalVars._colors.orange[4], // gradients
|
50
|
+
],
|
51
|
+
pink: [
|
52
|
+
whiteFont, // color
|
53
|
+
cssGlobalVars._colors.pink[6], // background
|
54
|
+
cssGlobalVars._colors.pink[4], // gradients
|
55
|
+
],
|
56
|
+
purple: [
|
57
|
+
whiteFont, // color
|
58
|
+
cssGlobalVars._colors.purple[6], // background
|
59
|
+
cssGlobalVars._colors.purple[4], // gradients
|
60
|
+
],
|
61
|
+
yellow: [
|
62
|
+
blackFont, // color
|
63
|
+
cssGlobalVars._colors.yellow[6], // background
|
64
|
+
cssGlobalVars._colors.yellow[4], // gradients
|
65
|
+
],
|
66
|
+
teal: [
|
67
|
+
whiteFont, // color
|
68
|
+
cssGlobalVars._colors.teal[6], // background
|
69
|
+
cssGlobalVars._colors.teal[4], // gradients
|
70
|
+
],
|
71
|
+
}, () => `:host`, (prop) => toVar(prop));
|
72
|
+
/**
|
73
|
+
* {@linkcode Button} renders a button.
|
74
|
+
*
|
75
|
+
* Create modal animation upon clicking.
|
76
|
+
*
|
77
|
+
* Available colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.
|
78
|
+
*
|
79
|
+
* Default color is `black`.
|
80
|
+
*
|
81
|
+
* Set the color to `none` to prevent applying styles.
|
82
|
+
*
|
83
|
+
* @category input
|
84
|
+
*/
|
85
|
+
let Button = class Button extends GlobalStyle {
|
86
|
+
constructor() {
|
87
|
+
super(...arguments);
|
88
|
+
/**
|
89
|
+
* The primary color.
|
90
|
+
*/
|
91
|
+
this.color = "black";
|
92
|
+
}
|
93
|
+
render() {
|
94
|
+
const color = this.nextColor();
|
95
|
+
return html `<div part="root">
|
96
|
+
<span part="modal-root"></span>
|
97
|
+
<div part="content">
|
98
|
+
${[this.content || htmlSlot(), htmlStyle(colors[color])]}
|
99
|
+
</div>
|
100
|
+
</div>`;
|
101
|
+
}
|
102
|
+
focus() {
|
103
|
+
if (this.disabled) {
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
this.active = true;
|
107
|
+
super.focus();
|
108
|
+
}
|
109
|
+
blur() {
|
110
|
+
this.active = false;
|
111
|
+
super.blur();
|
112
|
+
}
|
113
|
+
firstUpdated() {
|
114
|
+
this.events.add(this, "click", this._handelClick, true);
|
115
|
+
}
|
116
|
+
_handelClick(e) {
|
117
|
+
if (this.disabled) {
|
118
|
+
e.stopPropagation();
|
119
|
+
e.preventDefault();
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
this._handleModal(e);
|
123
|
+
}
|
124
|
+
_handleModal(e) {
|
125
|
+
const modal = document.createElement("i");
|
126
|
+
const rect = this.getBoundingClientRect();
|
127
|
+
const h = rect.height;
|
128
|
+
const w = rect.width;
|
129
|
+
const size = `${Math.sqrt(h * h + w * w) * 2}px`;
|
130
|
+
modal.style.height = size;
|
131
|
+
modal.style.width = size;
|
132
|
+
modal.style.left = `${e.clientX - rect.left}px`;
|
133
|
+
modal.style.top = `${e.clientY - rect.y}px`;
|
134
|
+
modal.style.animationName = "kf";
|
135
|
+
this._modalRoot.appendChild(modal);
|
136
|
+
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
137
|
+
}
|
138
|
+
nextColor() {
|
139
|
+
return this.color;
|
140
|
+
}
|
141
|
+
};
|
142
|
+
__decorate([
|
143
|
+
property({ type: Boolean, reflect: true })
|
144
|
+
], Button.prototype, "disabled", void 0);
|
145
|
+
__decorate([
|
146
|
+
property({ type: Boolean, reflect: true })
|
147
|
+
], Button.prototype, "ghost", void 0);
|
148
|
+
__decorate([
|
149
|
+
property({ type: Boolean, reflect: true })
|
150
|
+
], Button.prototype, "active", void 0);
|
151
|
+
__decorate([
|
152
|
+
property({ type: Boolean, reflect: true })
|
153
|
+
], Button.prototype, "round", void 0);
|
154
|
+
__decorate([
|
155
|
+
property({ reflect: true })
|
156
|
+
], Button.prototype, "color", void 0);
|
157
|
+
__decorate([
|
158
|
+
property()
|
159
|
+
], Button.prototype, "content", void 0);
|
160
|
+
__decorate([
|
161
|
+
part("modal-root")
|
162
|
+
], Button.prototype, "_modalRoot", void 0);
|
163
|
+
__decorate([
|
164
|
+
part("root")
|
165
|
+
], Button.prototype, "_root", void 0);
|
166
|
+
Button = __decorate([
|
167
|
+
godown(protoName),
|
168
|
+
styles(css `
|
169
|
+
:host(:not([disabled]):active) {
|
170
|
+
transform: scale(var(${cssScope}--focus-scale));
|
171
|
+
}
|
172
|
+
|
173
|
+
:host([round]) {
|
174
|
+
${cssScope}--padding-x: .75em;
|
175
|
+
border-radius: calc(infinity * 1px);
|
176
|
+
}
|
177
|
+
|
178
|
+
:host([disabled]) {
|
179
|
+
cursor: not-allowed;
|
180
|
+
filter: brightness(0.85);
|
181
|
+
}
|
182
|
+
|
183
|
+
:host([ghost]) {
|
184
|
+
${cssScope}--modal-background: var(${cssScope}--ghost-color);
|
185
|
+
box-shadow:inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
186
|
+
color: var(${cssScope}--ghost-color);
|
187
|
+
background: transparent;
|
188
|
+
}
|
189
|
+
`, css `
|
190
|
+
:host {
|
191
|
+
${cssScope}--padding-x: .5em;
|
192
|
+
${cssScope}--padding-y: .15em;
|
193
|
+
${cssScope}--padding: var(${cssScope}--padding-y) var(${cssScope}--padding-x);
|
194
|
+
${cssScope}--modal-animation-duration: 1s;
|
195
|
+
${cssScope}--ghost-width: .08em;
|
196
|
+
${cssScope}--focus-scale: .97;
|
197
|
+
${cssScope}--deg: 45deg;
|
198
|
+
${cssScope}--ghost-color:var(${cssScope}--background);
|
199
|
+
color: var(${cssScope}--color, inherit);
|
200
|
+
background: linear-gradient(
|
201
|
+
var(${cssScope}--deg),
|
202
|
+
var(${cssScope}--background),
|
203
|
+
var(${cssScope}--gradients, var(${cssScope}--background))
|
204
|
+
);
|
205
|
+
border-radius: 0.3em;
|
206
|
+
width: -moz-fit-content;
|
207
|
+
width: fit-content;
|
208
|
+
transition: 0.1s;
|
209
|
+
display: block;
|
210
|
+
overflow: hidden;
|
211
|
+
text-align: center;
|
212
|
+
padding: 0 !important;
|
213
|
+
cursor: pointer;
|
214
|
+
}
|
215
|
+
|
216
|
+
[part=root] {
|
217
|
+
width: 100%;
|
218
|
+
height: 100%;
|
219
|
+
overflow: hidden;
|
220
|
+
position: relative;
|
221
|
+
transition: none;
|
222
|
+
user-select: none;
|
223
|
+
border-radius: inherit;
|
224
|
+
transition-duration: inherit;
|
225
|
+
}
|
226
|
+
|
227
|
+
[part=content] {
|
228
|
+
padding: var(${cssScope}--padding);
|
229
|
+
}
|
230
|
+
|
231
|
+
i {
|
232
|
+
position: absolute;
|
233
|
+
inset: 0;
|
234
|
+
opacity: 0;
|
235
|
+
width: 100%;
|
236
|
+
height: 100%;
|
237
|
+
border-radius: 50%;
|
238
|
+
visibility: visible;
|
239
|
+
pointer-events: none;
|
240
|
+
transform-origin: 0 0;
|
241
|
+
background: var(${cssScope}--modal-background, currentColor);
|
242
|
+
animation-duration: var(${cssScope}--modal-animation-duration);
|
243
|
+
}
|
244
|
+
|
245
|
+
@keyframes kf {
|
246
|
+
0% {
|
247
|
+
transform: scale(0) translate(-50%, -50%);
|
248
|
+
opacity: var(${cssScope}--modal-opacity, 0.1);
|
249
|
+
}
|
250
|
+
80% {
|
251
|
+
transform: scale(1) translate(-50%, -50%);
|
252
|
+
}
|
253
|
+
to {
|
254
|
+
opacity: 0;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
`)
|
258
|
+
], Button);
|
259
|
+
export default Button;
|
260
|
+
//# sourceMappingURL=button.js.map
|
@@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QAAQ;;;;;;;;;GAS5B,CACF;GACK,MAAM,CAgGX;AAED,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { GlobalStyle } from "../core/global-style.js";
|
2
|
+
/**
|
3
|
+
* {@linkcode Card} renders a card.
|
4
|
+
*
|
5
|
+
* This may be similar to {@linkcode Layout},
|
6
|
+
* but it needs to be specified to enable header and footer.
|
7
|
+
*
|
8
|
+
* @slot - The main content of the card.
|
9
|
+
* @slot header - The header of the card.
|
10
|
+
* @slot footer - The footer of the card.
|
11
|
+
* @category display
|
12
|
+
*/
|
13
|
+
declare class Card extends GlobalStyle {
|
14
|
+
footer: boolean;
|
15
|
+
header: boolean;
|
16
|
+
protected render(): (string | import("lit").TemplateResult<1>)[];
|
17
|
+
}
|
18
|
+
export default Card;
|
19
|
+
//# sourceMappingURL=card.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAOlF;;;;;;;;;;GAUG;AACH,cAuCM,IAAK,SAAQ,WAAW;IAE5B,MAAM,UAAS;IAGf,MAAM,UAAS;IAEf,SAAS,CAAC,MAAM;CAOjB;AAED,eAAe,IAAI,CAAC"}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { godown } from "@godown/element/decorators/godown.js";
|
3
|
+
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
+
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
+
import { css } from "lit";
|
6
|
+
import { property } from "lit/decorators.js";
|
7
|
+
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
8
|
+
const protoName = "card";
|
9
|
+
const cssScope = scopePrefix(protoName);
|
10
|
+
/**
|
11
|
+
* {@linkcode Card} renders a card.
|
12
|
+
*
|
13
|
+
* This may be similar to {@linkcode Layout},
|
14
|
+
* but it needs to be specified to enable header and footer.
|
15
|
+
*
|
16
|
+
* @slot - The main content of the card.
|
17
|
+
* @slot header - The header of the card.
|
18
|
+
* @slot footer - The footer of the card.
|
19
|
+
* @category display
|
20
|
+
*/
|
21
|
+
let Card = class Card extends GlobalStyle {
|
22
|
+
constructor() {
|
23
|
+
super(...arguments);
|
24
|
+
this.footer = false;
|
25
|
+
this.header = false;
|
26
|
+
}
|
27
|
+
render() {
|
28
|
+
return [
|
29
|
+
this.header ? htmlSlot("header") : "",
|
30
|
+
htmlSlot(),
|
31
|
+
this.footer ? htmlSlot("footer") : "",
|
32
|
+
];
|
33
|
+
}
|
34
|
+
};
|
35
|
+
__decorate([
|
36
|
+
property({ type: Boolean })
|
37
|
+
], Card.prototype, "footer", void 0);
|
38
|
+
__decorate([
|
39
|
+
property({ type: Boolean })
|
40
|
+
], Card.prototype, "header", void 0);
|
41
|
+
Card = __decorate([
|
42
|
+
godown(protoName),
|
43
|
+
styles(css `
|
44
|
+
:host {
|
45
|
+
${cssScope}--background: var(${cssGlobalVars.background});
|
46
|
+
${cssScope}--border-width: .0375em;
|
47
|
+
${cssScope}--border-color: transparent;
|
48
|
+
${cssScope}--border-background: var(${cssGlobalVars.passive});
|
49
|
+
${cssScope}--padding: .75em;
|
50
|
+
color: var(${cssGlobalVars.foreground});
|
51
|
+
background: var(${cssScope}--background);
|
52
|
+
border-width: var(${cssScope}--border-width);
|
53
|
+
display: block;
|
54
|
+
flex-shrink: 0;
|
55
|
+
position: relative;
|
56
|
+
overflow: hidden;
|
57
|
+
box-sizing: border-box;
|
58
|
+
}
|
59
|
+
|
60
|
+
slot {
|
61
|
+
display: block;
|
62
|
+
padding: var(${cssScope}--padding);
|
63
|
+
}
|
64
|
+
|
65
|
+
:host,
|
66
|
+
slot {
|
67
|
+
border-color: var(${cssScope}--border-background);
|
68
|
+
border-style: solid;
|
69
|
+
}
|
70
|
+
|
71
|
+
[name=footer]{
|
72
|
+
border-top-width: var(${cssScope}--border-width);
|
73
|
+
}
|
74
|
+
|
75
|
+
[name=header]{
|
76
|
+
border-bottom-width: var(${cssScope}--border-width);
|
77
|
+
}
|
78
|
+
`)
|
79
|
+
], Card);
|
80
|
+
export default Card;
|
81
|
+
//# sourceMappingURL=card.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/components/card.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,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAIlF,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAExC;;;;;;;;;;GAUG;AAwCH,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,WAAW;IAA9B;;QAEE,WAAM,GAAG,KAAK,CAAC;QAGf,WAAM,GAAG,KAAK,CAAC;IASjB,CAAC;IAPW,MAAM;QACd,OAAO;YACL,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;YACrC,QAAQ,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;SACtC,CAAC;IACJ,CAAC;CACF,CAAA;AAZC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCACb;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oCACb;AALX,IAAI;IAvCT,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CACL,GAAG,CAAA;;QAEG,QAAQ,qBAAqB,aAAa,CAAC,UAAU;QACrD,QAAQ;QACR,QAAQ;QACR,QAAQ,4BAA4B,aAAa,CAAC,OAAO;QACzD,QAAQ;mBACG,aAAa,CAAC,UAAU;wBACnB,QAAQ;0BACN,QAAQ;;;;;;;;;;qBAUb,QAAQ;;;;;0BAKH,QAAQ;;;;;8BAKJ,QAAQ;;;;iCAIL,QAAQ;;GAEtC,CACF;GACK,IAAI,CAcT;AAED,eAAe,IAAI,CAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { GlobalStyle } from "../core/global-style.js";
|
2
|
+
/**
|
3
|
+
* {@linkcode Carousel} make the content display as a carousel.
|
4
|
+
*
|
5
|
+
* When this component is `firstUpdated`,
|
6
|
+
* clone the first and last element and make the matching element visible when switching index.
|
7
|
+
*
|
8
|
+
* Child elements should maintain the same size.
|
9
|
+
*
|
10
|
+
* If no width, it will be the width of the first element.
|
11
|
+
*
|
12
|
+
* @slot - Carousel items, should maintain the same size.
|
13
|
+
* @category display
|
14
|
+
*/
|
15
|
+
declare class Carousel extends GlobalStyle {
|
16
|
+
/**
|
17
|
+
* The index of the element is displayed for the first time.
|
18
|
+
*/
|
19
|
+
index: number;
|
20
|
+
/**
|
21
|
+
* If autoChange > 0, the rotation will be automated.
|
22
|
+
*/
|
23
|
+
autoChange: number;
|
24
|
+
/**
|
25
|
+
* Element width.
|
26
|
+
*/
|
27
|
+
width: string;
|
28
|
+
protected _moveRoot: HTMLElement;
|
29
|
+
protected intervalID: number;
|
30
|
+
private _cloneFirst;
|
31
|
+
private _cloneLast;
|
32
|
+
protected render(): (symbol | import("lit").TemplateResult<1>)[];
|
33
|
+
protected firstUpdated(): Promise<void>;
|
34
|
+
disconnectedCallback(): void;
|
35
|
+
show(i: number): void;
|
36
|
+
next(): void;
|
37
|
+
prev(): void;
|
38
|
+
protected _doTranslateX(xValue: string, noTransition?: boolean): void;
|
39
|
+
}
|
40
|
+
export default Carousel;
|
41
|
+
//# sourceMappingURL=carousel.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/components/carousel.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;;;;;;;;;;GAYG;AACH,cA8CM,QAAS,SAAQ,WAAW;IAChC;;OAEG;IAEH,KAAK,SAAK;IAEV;;OAEG;IAEH,UAAU,SAAK;IAEf;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAC;IAGd,SAAS,CAAC,SAAS,EAAE,WAAW,CAAC;IAEjC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,WAAW,CAA0B;IAE7C,OAAO,CAAC,UAAU,CAA0B;IAE5C,SAAS,CAAC,MAAM;cAWA,YAAY;IAqB5B,oBAAoB;IAIpB,IAAI,CAAC,CAAC,EAAE,MAAM;IAId,IAAI;IASJ,IAAI;IASJ,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO;CAO/D;AAED,eAAe,QAAQ,CAAC"}
|