godown 3.0.0 → 3.0.1
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/build/godown+lit.iife.js +12 -12
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +12 -12
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +12 -12
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +11 -11
- package/build/godown.js +11 -11
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +11 -11
- package/build/godown.umd.js.map +1 -1
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +1 -1
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -1
- package/components/avatar.js.map +1 -1
- package/components/badge.d.ts.map +1 -1
- package/components/badge.js +1 -1
- package/components/badge.js.map +1 -1
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -1
- package/components/breath.js.map +1 -1
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -1
- package/components/button.js.map +1 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -1
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +1 -1
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -1
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +1 -1
- package/components/divider.js.map +1 -1
- 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.map +1 -1
- package/components/flex.js.map +1 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js.map +1 -1
- package/components/heading.d.ts.map +1 -1
- package/components/heading.js +1 -1
- package/components/heading.js.map +1 -1
- package/components/input.d.ts.map +1 -1
- package/components/input.js +1 -1
- package/components/input.js.map +1 -1
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -1
- package/components/layout.js.map +1 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -1
- package/components/progress.js.map +1 -1
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -1
- package/components/range.js.map +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 +20 -25
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -1
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +1 -1
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -1
- package/components/split.js.map +1 -1
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +1 -1
- package/components/switch.js.map +1 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +1 -1
- package/components/text.js.map +1 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -1
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -1
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -1
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -1
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -1
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +82 -69
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +52 -36
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts.map +1 -1
- package/dev/components/badge.js +57 -50
- package/dev/components/badge.js.map +1 -1
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +20 -14
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +13 -10
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +40 -35
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +63 -43
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +72 -61
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +61 -57
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +28 -23
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +19 -17
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +16 -11
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +4 -4
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +16 -11
- package/dev/components/grid.js.map +1 -1
- package/dev/components/heading.d.ts.map +1 -1
- package/dev/components/heading.js +62 -40
- package/dev/components/heading.js.map +1 -1
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +32 -24
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +43 -30
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.js +1 -1
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +51 -42
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +33 -30
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +12 -5
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +20 -25
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +17 -17
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +65 -57
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +65 -61
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +66 -58
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +88 -79
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +51 -45
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +13 -2
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +31 -23
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +35 -27
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +9 -9
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +27 -26
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +83 -68
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dev/core/super-openable.js +1 -2
- package/dev/core/super-openable.js.map +1 -1
- package/package.json +5 -5
- package/src/components/alert.ts +84 -75
- package/src/components/avatar.ts +54 -40
- package/src/components/badge.ts +68 -65
- package/src/components/breath.ts +23 -19
- package/src/components/button.ts +14 -11
- package/src/components/card.ts +42 -40
- package/src/components/carousel.ts +65 -47
- package/src/components/details.ts +74 -65
- package/src/components/dialog.ts +64 -62
- package/src/components/divider.ts +33 -30
- package/src/components/dragbox.ts +22 -22
- package/src/components/flex.ts +31 -28
- package/src/components/form.ts +7 -9
- package/src/components/grid.ts +31 -28
- package/src/components/heading.ts +67 -49
- package/src/components/input.ts +37 -31
- package/src/components/layout.ts +45 -34
- package/src/components/link.ts +1 -1
- package/src/components/progress.ts +53 -46
- package/src/components/range.ts +58 -52
- package/src/components/rotate.ts +15 -10
- package/src/components/router.ts +40 -45
- package/src/components/select.ts +74 -70
- package/src/components/skeleton.ts +67 -65
- package/src/components/split.ts +73 -69
- package/src/components/switch.ts +90 -83
- package/src/components/text.ts +53 -49
- package/src/components/time.ts +14 -3
- package/src/components/tooltip.ts +32 -24
- package/src/components/typewriter.ts +37 -31
- package/src/core/global-style.ts +11 -12
- package/src/core/super-anchor.ts +29 -30
- package/src/core/super-input.ts +86 -73
- package/src/core/super-openable.ts +2 -8
- package/web-types.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { css, html
|
1
|
+
import { type EventListenerFunc, attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -12,19 +12,17 @@ const protoName = "dragbox";
|
|
12
12
|
* @category wrapper
|
13
13
|
*/
|
14
14
|
@godown(protoName)
|
15
|
-
@styles(
|
16
|
-
|
17
|
-
:
|
18
|
-
|
19
|
-
|
20
|
-
}
|
15
|
+
@styles(css`
|
16
|
+
:host {
|
17
|
+
position: absolute;
|
18
|
+
display: block;
|
19
|
+
}
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
21
|
+
:host(:active) {
|
22
|
+
-webkit-user-select: none;
|
23
|
+
user-select: none;
|
24
|
+
}
|
25
|
+
`)
|
28
26
|
class Dragbox extends GlobalStyle {
|
29
27
|
/**
|
30
28
|
* Width of (`this.offsetParent` or `document.body`).
|
@@ -59,14 +57,16 @@ class Dragbox extends GlobalStyle {
|
|
59
57
|
y = "auto";
|
60
58
|
|
61
59
|
protected render(): TemplateResult<1> {
|
62
|
-
return html
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
60
|
+
return html`
|
61
|
+
<div
|
62
|
+
part="root"
|
63
|
+
${attr(this.observedRecord)}
|
64
|
+
@mousedown="${this._handleDragStart}"
|
65
|
+
@mouseup="${this._handleDragEnd}"
|
66
|
+
>
|
67
|
+
${htmlSlot()}
|
68
|
+
</div>
|
69
|
+
`;
|
70
70
|
}
|
71
71
|
|
72
72
|
protected firstUpdated(): void {
|
package/src/components/flex.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, htmlStyle, joinRules, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -13,18 +13,16 @@ const protoName = "flex";
|
|
13
13
|
* @category layout
|
14
14
|
*/
|
15
15
|
@godown(protoName)
|
16
|
-
@styles(
|
17
|
-
|
18
|
-
|
19
|
-
:
|
20
|
-
|
21
|
-
}
|
16
|
+
@styles(css`
|
17
|
+
:host,
|
18
|
+
:host([contents]) [part="root"] {
|
19
|
+
display: flex;
|
20
|
+
}
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
22
|
+
[part="root"] {
|
23
|
+
display: contents;
|
24
|
+
}
|
25
|
+
`)
|
28
26
|
class Flex extends GlobalStyle {
|
29
27
|
/**
|
30
28
|
* CSS property `flex-flow` (`flex-direction flex-wrap`).
|
@@ -57,22 +55,27 @@ class Flex extends GlobalStyle {
|
|
57
55
|
vertical = false;
|
58
56
|
|
59
57
|
protected render(): TemplateResult<1> {
|
60
|
-
return html
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
58
|
+
return html`
|
59
|
+
<div
|
60
|
+
part="root"
|
61
|
+
${attr(this.observedRecord)}
|
62
|
+
>
|
63
|
+
${[
|
64
|
+
htmlSlot(),
|
65
|
+
htmlStyle(
|
66
|
+
joinRules({
|
67
|
+
":host": {
|
68
|
+
gap: this.gap,
|
69
|
+
"flex-flow": this.flexFlow,
|
70
|
+
"flex-direction": this.vertical && "column",
|
71
|
+
"align-items": this.items,
|
72
|
+
"justify-content": this.content,
|
73
|
+
},
|
74
|
+
}),
|
75
|
+
),
|
76
|
+
]}
|
77
|
+
</div>
|
78
|
+
`;
|
76
79
|
}
|
77
80
|
}
|
78
81
|
|
package/src/components/form.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import {
|
2
|
+
import { type TemplateResult, css } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -13,13 +13,11 @@ const protoName = "form";
|
|
13
13
|
* @category form
|
14
14
|
*/
|
15
15
|
@godown(protoName)
|
16
|
-
@styles(
|
17
|
-
|
18
|
-
:
|
19
|
-
|
20
|
-
|
21
|
-
`,
|
22
|
-
)
|
16
|
+
@styles(css`
|
17
|
+
:host {
|
18
|
+
display: block;
|
19
|
+
}
|
20
|
+
`)
|
23
21
|
class Form<T = object> extends GlobalStyle {
|
24
22
|
@property()
|
25
23
|
name = "";
|
@@ -35,7 +33,7 @@ class Form<T = object> extends GlobalStyle {
|
|
35
33
|
}
|
36
34
|
|
37
35
|
reset(): void {
|
38
|
-
this.deepQuerySelectorAll<HTMLElement & { reset?: () => void
|
36
|
+
this.deepQuerySelectorAll<HTMLElement & { reset?: () => void }>("*").forEach((el) => {
|
39
37
|
if (el.tagName === this.tagName) {
|
40
38
|
return;
|
41
39
|
}
|
package/src/components/grid.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, htmlStyle, isNumerical, joinRules, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -13,18 +13,16 @@ const protoName = "grid";
|
|
13
13
|
* @category layout
|
14
14
|
*/
|
15
15
|
@godown(protoName)
|
16
|
-
@styles(
|
17
|
-
|
18
|
-
|
19
|
-
:
|
20
|
-
|
21
|
-
}
|
16
|
+
@styles(css`
|
17
|
+
:host,
|
18
|
+
:host([contents]) [part="root"] {
|
19
|
+
display: grid;
|
20
|
+
}
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
22
|
+
[part="root"] {
|
23
|
+
display: contents;
|
24
|
+
}
|
25
|
+
`)
|
28
26
|
class Grid extends GlobalStyle {
|
29
27
|
/**
|
30
28
|
* CSS property `gap`.
|
@@ -61,22 +59,27 @@ class Grid extends GlobalStyle {
|
|
61
59
|
items: string;
|
62
60
|
|
63
61
|
protected render(): TemplateResult<1> {
|
64
|
-
return html
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
62
|
+
return html`
|
63
|
+
<div
|
64
|
+
part="root"
|
65
|
+
${attr(this.observedRecord)}
|
66
|
+
>
|
67
|
+
${[
|
68
|
+
htmlSlot(),
|
69
|
+
htmlStyle(
|
70
|
+
joinRules({
|
71
|
+
":host": {
|
72
|
+
gap: this.gap,
|
73
|
+
"grid-template-columns": isNumerical(this.columns) ? `repeat(${this.columns},1fr)` : this.columns,
|
74
|
+
"grid-template-rows": isNumerical(this.rows) ? `repeat(${this.rows},1fr)` : this.rows,
|
75
|
+
"place-content": this.content,
|
76
|
+
"place-items": this.items,
|
77
|
+
},
|
78
|
+
}),
|
79
|
+
),
|
80
|
+
]}
|
81
|
+
</div>
|
82
|
+
`;
|
80
83
|
}
|
81
84
|
}
|
82
85
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import { css, html, nothing
|
2
|
+
import { type TemplateResult, css, html, nothing } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -15,44 +15,42 @@ const protoName = "heading";
|
|
15
15
|
* @category layout
|
16
16
|
*/
|
17
17
|
@godown(protoName)
|
18
|
-
@styles(
|
19
|
-
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
}
|
18
|
+
@styles(css`
|
19
|
+
:host {
|
20
|
+
display: block;
|
21
|
+
text-align: start;
|
22
|
+
}
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
[part="anchor"] {
|
25
|
+
position: absolute;
|
26
|
+
text-align: center;
|
27
|
+
min-width: 1.25em;
|
28
|
+
right: 100%;
|
29
|
+
}
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
[side="left"] [part="anchor"] {
|
32
|
+
right: 100%;
|
33
|
+
}
|
34
|
+
[side="right"] [part="anchor"] {
|
35
|
+
left: 100%;
|
36
|
+
}
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
a {
|
39
|
+
color: inherit;
|
40
|
+
}
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
)
|
42
|
+
h1,
|
43
|
+
h2,
|
44
|
+
h3,
|
45
|
+
h4,
|
46
|
+
h5,
|
47
|
+
h6 {
|
48
|
+
direction: ltr;
|
49
|
+
font-size: revert;
|
50
|
+
position: relative;
|
51
|
+
width: fit-content;
|
52
|
+
}
|
53
|
+
`)
|
56
54
|
class Heading extends GlobalStyle {
|
57
55
|
/**
|
58
56
|
* The heading level.
|
@@ -73,30 +71,50 @@ class Heading extends GlobalStyle {
|
|
73
71
|
side: "left" | "right" = "left";
|
74
72
|
|
75
73
|
protected render(): TemplateResult<1> {
|
76
|
-
return html
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
return html`
|
75
|
+
<a
|
76
|
+
part="root"
|
77
|
+
href="${this.id ? "#" + this.id : nothing}"
|
78
|
+
${attr(this.observedRecord)}
|
79
|
+
>
|
80
|
+
${this.wrapHeading(
|
81
|
+
htmlSlot(),
|
82
|
+
this.id
|
83
|
+
? html`
|
84
|
+
<i part="anchor">${this.anchor}</i>
|
85
|
+
`
|
86
|
+
: "",
|
87
|
+
)}
|
88
|
+
</a>
|
89
|
+
`;
|
84
90
|
}
|
85
91
|
|
86
92
|
protected wrapHeading(...children: any[]): TemplateResult<1> {
|
87
93
|
switch (this.as) {
|
88
94
|
case "h2":
|
89
|
-
return html
|
95
|
+
return html`
|
96
|
+
<h2>${children}</h2>
|
97
|
+
`;
|
90
98
|
case "h3":
|
91
|
-
return html
|
99
|
+
return html`
|
100
|
+
<h3>${children}</h3>
|
101
|
+
`;
|
92
102
|
case "h4":
|
93
|
-
return html
|
103
|
+
return html`
|
104
|
+
<h4>${children}</h4>
|
105
|
+
`;
|
94
106
|
case "h5":
|
95
|
-
return html
|
107
|
+
return html`
|
108
|
+
<h5>${children}</h5>
|
109
|
+
`;
|
96
110
|
case "h6":
|
97
|
-
return html
|
111
|
+
return html`
|
112
|
+
<h6>${children}</h6>
|
113
|
+
`;
|
98
114
|
default:
|
99
|
-
return html
|
115
|
+
return html`
|
116
|
+
<h1>${children}</h1>
|
117
|
+
`;
|
100
118
|
}
|
101
119
|
}
|
102
120
|
}
|
package/src/components/input.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, classList, godown, part, styles } from "@godown/element";
|
2
|
-
import { css, html, nothing
|
2
|
+
import { type TemplateResult, css, html, nothing } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { cssGlobalVars } from "../core/global-style.js";
|
@@ -15,18 +15,16 @@ const protoName = "input";
|
|
15
15
|
* @category input
|
16
16
|
*/
|
17
17
|
@godown(protoName)
|
18
|
-
@styles(
|
19
|
-
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
`,
|
29
|
-
)
|
18
|
+
@styles(css`
|
19
|
+
:host {
|
20
|
+
width: var(${cssGlobalVars.input}-width);
|
21
|
+
height: var(${cssGlobalVars.input}-height);
|
22
|
+
color: var(${cssGlobalVars.foreground});
|
23
|
+
background: var(${cssGlobalVars.input}-background);
|
24
|
+
border-radius: var(${cssGlobalVars.input}-radius);
|
25
|
+
display: block;
|
26
|
+
}
|
27
|
+
`)
|
30
28
|
class Input extends SuperInput {
|
31
29
|
type: "text" | "search" | "tel" | "url" | "email" | "password" = "text";
|
32
30
|
|
@@ -42,24 +40,32 @@ class Input extends SuperInput {
|
|
42
40
|
protected _input: HTMLInputElement;
|
43
41
|
|
44
42
|
protected render(): TemplateResult<1> {
|
45
|
-
return html
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
43
|
+
return html`
|
44
|
+
<div
|
45
|
+
part="root"
|
46
|
+
${attr(this.observedRecord)}
|
47
|
+
class="${classList("input-field", this.variant)}"
|
48
|
+
>
|
49
|
+
${[
|
50
|
+
this._renderPrefix(),
|
51
|
+
html`
|
52
|
+
<input
|
53
|
+
part="input"
|
54
|
+
type="${this.type}"
|
55
|
+
.value="${this.value}"
|
56
|
+
?autofocus="${this.autofocus}"
|
57
|
+
?disabled="${this.disabled}"
|
58
|
+
autocapitalize="${this.autocapitalize || nothing}"
|
59
|
+
autocomplete="${this.autocomplete || nothing}"
|
60
|
+
placeholder="${this.placeholder || nothing}"
|
61
|
+
id="${this.makeId}"
|
62
|
+
@input="${this._handleInput}"
|
63
|
+
/>
|
64
|
+
`,
|
65
|
+
this._renderSuffix(),
|
66
|
+
]}
|
67
|
+
</div>
|
68
|
+
`;
|
63
69
|
}
|
64
70
|
|
65
71
|
reset(): void {
|
package/src/components/layout.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -15,38 +15,36 @@ const protoName = "layout";
|
|
15
15
|
* @category layout
|
16
16
|
*/
|
17
17
|
@godown(protoName)
|
18
|
-
@styles(
|
19
|
-
|
20
|
-
|
21
|
-
:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
18
|
+
@styles(css`
|
19
|
+
:host,
|
20
|
+
:host([contents]) [part="root"] {
|
21
|
+
min-height: 100%;
|
22
|
+
display: flex;
|
23
|
+
flex-direction: column;
|
24
|
+
}
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
[part="root"] {
|
27
|
+
display: contents;
|
28
|
+
}
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
[sticky] header {
|
31
|
+
position: sticky;
|
32
|
+
top: 0;
|
33
|
+
z-index: 1;
|
34
|
+
}
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
[part="main"] {
|
37
|
+
position: relative;
|
38
|
+
flex: 1;
|
39
|
+
width: 100%;
|
40
|
+
}
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
)
|
42
|
+
header,
|
43
|
+
main,
|
44
|
+
footer {
|
45
|
+
width: 100%;
|
46
|
+
}
|
47
|
+
`)
|
50
48
|
class Layout extends GlobalStyle {
|
51
49
|
/**
|
52
50
|
* If true, remove the header slot.
|
@@ -67,11 +65,24 @@ class Layout extends GlobalStyle {
|
|
67
65
|
sticky = false;
|
68
66
|
|
69
67
|
protected render(): TemplateResult<1> {
|
70
|
-
return html
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
return html`
|
69
|
+
<div
|
70
|
+
part="root"
|
71
|
+
${attr(this.observedRecord)}
|
72
|
+
>
|
73
|
+
${!this.noHeader
|
74
|
+
? html`
|
75
|
+
<header part="header">${htmlSlot("header")}</header>
|
76
|
+
`
|
77
|
+
: ""}
|
78
|
+
<main part="main">${htmlSlot()}</main>
|
79
|
+
${!this.noFooter
|
80
|
+
? html`
|
81
|
+
<footer part="footer">${htmlSlot("footer")}</footer>
|
82
|
+
`
|
83
|
+
: ""}
|
84
|
+
</div>
|
85
|
+
`;
|
75
86
|
}
|
76
87
|
}
|
77
88
|
|
package/src/components/link.ts
CHANGED
@@ -35,7 +35,7 @@ class Link extends SuperAnchor {
|
|
35
35
|
protected _handleClick(e: MouseEvent): void {
|
36
36
|
if (this.type === "push" || this.type === "replace") {
|
37
37
|
e.preventDefault();
|
38
|
-
|
38
|
+
history[`${this.type}State`](null, "", this.href);
|
39
39
|
if (!this.suppress) {
|
40
40
|
Router.updateAll();
|
41
41
|
}
|