godown 3.0.0-canary.16 → 3.0.0-canary.17
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/badge.d.ts +9 -0
- package/badge.d.ts.map +1 -0
- package/badge.js +2 -0
- package/badge.js.map +1 -0
- 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 +19 -0
- package/components/badge.d.ts.map +1 -0
- package/components/badge.js +2 -0
- package/components/badge.js.map +1 -0
- 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 +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 +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 +1 -1
- package/components/flex.js.map +1 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -1
- package/components/form.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -1
- package/components/grid.js.map +1 -1
- package/components/heading.d.ts +19 -0
- package/components/heading.d.ts.map +1 -0
- package/components/heading.js +2 -0
- package/components/heading.js.map +1 -0
- 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 +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.map +1 -1
- package/components/router.js +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts +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 +2 -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 +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 +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 +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/custom-elements.json +1 -1
- package/dev/badge.d.ts +9 -0
- package/dev/badge.d.ts.map +1 -0
- package/dev/badge.js +5 -0
- package/dev/badge.js.map +1 -0
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +1 -6
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +1 -5
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts +19 -0
- package/dev/components/badge.d.ts.map +1 -0
- package/dev/components/badge.js +106 -0
- package/dev/components/badge.js.map +1 -0
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +1 -4
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +4 -12
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +1 -4
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +1 -6
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +1 -4
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +1 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +1 -4
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +1 -2
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +1 -1
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +1 -4
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +1 -6
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +1 -3
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +1 -7
- package/dev/components/grid.js.map +1 -1
- package/dev/components/heading.d.ts +19 -0
- package/dev/components/heading.d.ts.map +1 -0
- package/dev/components/heading.js +86 -0
- package/dev/components/heading.js.map +1 -0
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +1 -5
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +1 -4
- 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 +1 -4
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +1 -7
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +1 -4
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +1 -4
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +2 -7
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +1 -4
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +2 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +2 -4
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +1 -3
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +1 -5
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +1 -3
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +1 -4
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +1 -6
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +1 -3
- 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 +3 -6
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +1 -1
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +1 -3
- package/dev/core/super-input.js.map +1 -1
- package/dev/heading.d.ts +9 -0
- package/dev/heading.d.ts.map +1 -0
- package/dev/heading.js +5 -0
- package/dev/heading.js.map +1 -0
- package/dev/index.d.ts +2 -0
- package/dev/index.d.ts.map +1 -1
- package/dev/index.js +2 -0
- package/dev/index.js.map +1 -1
- package/heading.d.ts +9 -0
- package/heading.d.ts.map +1 -0
- package/heading.js +2 -0
- package/heading.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +3 -3
- package/split.js +1 -1
- package/split.js.map +1 -1
- package/src/badge.ts +13 -0
- package/src/components/alert.ts +1 -6
- package/src/components/avatar.ts +1 -5
- package/src/components/badge.ts +104 -0
- package/src/components/breath.ts +1 -4
- package/src/components/button.ts +4 -12
- package/src/components/card.ts +1 -4
- package/src/components/carousel.ts +1 -6
- package/src/components/details.ts +1 -4
- package/src/components/dialog.ts +1 -5
- package/src/components/divider.ts +1 -2
- package/src/components/dragbox.ts +1 -5
- package/src/components/flex.ts +1 -6
- package/src/components/form.ts +1 -3
- package/src/components/grid.ts +1 -7
- package/src/components/heading.ts +89 -0
- package/src/components/input.ts +1 -5
- package/src/components/layout.ts +1 -4
- package/src/components/link.ts +1 -1
- package/src/components/progress.ts +1 -4
- package/src/components/range.ts +1 -7
- package/src/components/rotate.ts +1 -4
- package/src/components/router.ts +1 -4
- package/src/components/select.ts +2 -8
- package/src/components/skeleton.ts +1 -4
- package/src/components/split.ts +2 -5
- package/src/components/switch.ts +1 -3
- package/src/components/text.ts +1 -5
- package/src/components/time.ts +1 -3
- package/src/components/tooltip.ts +1 -4
- package/src/components/typewriter.ts +1 -6
- package/src/core/global-style.ts +1 -3
- package/src/core/super-anchor.ts +3 -6
- package/src/core/super-input.ts +1 -4
- package/src/heading.ts +13 -0
- package/src/index.ts +2 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
@@ -0,0 +1,104 @@
|
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { css, html, type TemplateResult } from "lit";
|
3
|
+
import { property } from "lit/decorators.js";
|
4
|
+
|
5
|
+
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
6
|
+
|
7
|
+
type Position = "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
8
|
+
|
9
|
+
const protoName = "badge";
|
10
|
+
const cssScope = scopePrefix(protoName);
|
11
|
+
|
12
|
+
/**
|
13
|
+
* {@linkcode Badge} renders a badge.
|
14
|
+
*
|
15
|
+
* @category display
|
16
|
+
*/
|
17
|
+
@godown(protoName)
|
18
|
+
@styles(
|
19
|
+
css`
|
20
|
+
:host {
|
21
|
+
${cssScope}--background: var(${cssGlobalVars.active});
|
22
|
+
${cssScope}--offset: 0;
|
23
|
+
${cssScope}--offset-x: var(${cssScope}--offset);
|
24
|
+
${cssScope}--offset-y: var(${cssScope}--offset);
|
25
|
+
}
|
26
|
+
|
27
|
+
:host,
|
28
|
+
:host([contents]) [part=root] {
|
29
|
+
display: inline-block;
|
30
|
+
}
|
31
|
+
|
32
|
+
[part=root] {
|
33
|
+
position: relative;
|
34
|
+
}
|
35
|
+
|
36
|
+
[part=badge] {
|
37
|
+
position: absolute;
|
38
|
+
border-radius: calc(infinity * 1px);
|
39
|
+
background: var(${cssScope}--background);
|
40
|
+
font-size: 75%;
|
41
|
+
padding: 0 0.5em;
|
42
|
+
transform: translate(-50%, -50%);
|
43
|
+
}
|
44
|
+
|
45
|
+
[part=badge]:empty {
|
46
|
+
width: 0.5em;
|
47
|
+
height: 0.5em;
|
48
|
+
font-size: 100%;
|
49
|
+
padding: 0;
|
50
|
+
border-radius: 50%;
|
51
|
+
}
|
52
|
+
|
53
|
+
[position^=top] {
|
54
|
+
--top: calc(0% + var(${cssScope}--offset-y));
|
55
|
+
}
|
56
|
+
|
57
|
+
[position$=right] {
|
58
|
+
--left: calc(100% - var(${cssScope}--offset-x));
|
59
|
+
}
|
60
|
+
|
61
|
+
[position^=bottom] {
|
62
|
+
--top: calc(100% - var(${cssScope}--offset-y));
|
63
|
+
}
|
64
|
+
|
65
|
+
[position$=left] {
|
66
|
+
--left: calc(0% + var(${cssScope}--offset-x));
|
67
|
+
}
|
68
|
+
|
69
|
+
[part=badge] {
|
70
|
+
left: var(--left);
|
71
|
+
top: var(--top);
|
72
|
+
}
|
73
|
+
`,
|
74
|
+
)
|
75
|
+
class Badge extends GlobalStyle {
|
76
|
+
@property({ type: String })
|
77
|
+
position: Position = "top-right";
|
78
|
+
|
79
|
+
@property({ type: Number })
|
80
|
+
value = 0;
|
81
|
+
|
82
|
+
@property({ type: Boolean })
|
83
|
+
dot = false;
|
84
|
+
|
85
|
+
@property({ type: Number })
|
86
|
+
max = 99;
|
87
|
+
|
88
|
+
private formatValue(value: number): string {
|
89
|
+
return value > this.max ? this.max + "+" : value + "";
|
90
|
+
}
|
91
|
+
|
92
|
+
render(): TemplateResult<1> {
|
93
|
+
if (this.value === 0 && !this.dot) {
|
94
|
+
return htmlSlot();
|
95
|
+
}
|
96
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
97
|
+
${htmlSlot()}
|
98
|
+
<div part="badge">${this.dot ? "" : this.formatValue(this.value)}</div>
|
99
|
+
</div>`;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
export default Badge;
|
104
|
+
export { Badge };
|
package/src/components/breath.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
1
|
+
import { attr, godown, htmlStyle, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
import { property } from "lit/decorators.js";
|
7
4
|
|
package/src/components/button.ts
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { attr } from "@godown/element/directives/attr.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";
|
1
|
+
import { attr, constructCSSObject, godown, htmlSlot, htmlStyle, part, styles, toVar } from "@godown/element";
|
8
2
|
import { css, html, type TemplateResult } from "lit";
|
9
3
|
import { property } from "lit/decorators.js";
|
10
4
|
|
@@ -134,7 +128,6 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
134
128
|
var(${cssScope}--gradients, var(${cssScope}--background))
|
135
129
|
);
|
136
130
|
border-radius: 0.3em;
|
137
|
-
width: -moz-fit-content;
|
138
131
|
width: fit-content;
|
139
132
|
transition: 0.1s;
|
140
133
|
display: block;
|
@@ -271,10 +264,9 @@ class Button extends GlobalStyle {
|
|
271
264
|
|
272
265
|
protected _handleModal(e: MouseEvent): void {
|
273
266
|
const modal = document.createElement("i");
|
274
|
-
const rect = this.getBoundingClientRect();
|
275
|
-
const
|
276
|
-
const
|
277
|
-
const size = `${Math.sqrt(h * h + w * w) * 2}px`;
|
267
|
+
const rect = this._root.getBoundingClientRect();
|
268
|
+
const { height, width } = rect;
|
269
|
+
const size = `${Math.sqrt(height * height + width * width) * 2}px`;
|
278
270
|
modal.style.height = size;
|
279
271
|
modal.style.width = size;
|
280
272
|
modal.style.left = `${e.clientX - rect.left}px`;
|
package/src/components/card.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
import { property } from "lit/decorators.js";
|
7
4
|
|
@@ -1,9 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { attr } from "@godown/element/directives/attr.js";
|
5
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
6
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
1
|
+
import { attr, godown, htmlSlot, htmlStyle, part, styles } from "@godown/element";
|
7
2
|
import iconChevronLeft from "@godown/f7-icon/icons/chevron-left.js";
|
8
3
|
import iconChevronRight from "@godown/f7-icon/icons/chevron-right.js";
|
9
4
|
import { css, html, type TemplateResult } from "lit";
|
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
5
2
|
import svgCaretDown from "@godown/f7-icon/icons/chevron-down.js";
|
6
3
|
import { css, html, type TemplateResult } from "lit";
|
7
4
|
import { property } from "lit/decorators.js";
|
package/src/components/dialog.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
import type
|
2
|
-
import { godown } from "@godown/element/decorators/godown.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { attr } from "@godown/element/directives/attr.js";
|
5
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, type HandlerEvent, htmlSlot, styles } from "@godown/element";
|
6
2
|
import { css, html, type PropertyValues, type TemplateResult } from "lit";
|
7
3
|
import { property } from "lit/decorators.js";
|
8
4
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { godown, styles } from "@godown/element
|
2
|
-
import { attr } from "@godown/element/directives/attr.js";
|
1
|
+
import { attr, godown, styles } from "@godown/element";
|
3
2
|
import { css, html, type TemplateResult } from "lit";
|
4
3
|
import { property } from "lit/decorators.js";
|
5
4
|
|
@@ -1,8 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import type { EventListenerFunc } from "@godown/element/tools/events.js";
|
1
|
+
import { attr, type EventListenerFunc, godown, htmlSlot, styles } from "@godown/element";
|
6
2
|
import { css, html, type TemplateResult } from "lit";
|
7
3
|
import { property } from "lit/decorators.js";
|
8
4
|
|
package/src/components/flex.ts
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
6
|
-
import { joinRules } from "@godown/element/tools/css.js";
|
1
|
+
import { attr, godown, htmlSlot, htmlStyle, joinRules, styles } from "@godown/element";
|
7
2
|
import { css, html, type TemplateResult } from "lit";
|
8
3
|
import { property } from "lit/decorators.js";
|
9
4
|
|
package/src/components/form.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { godown, htmlSlot, styles } from "@godown/element";
|
4
2
|
import { css, type TemplateResult } from "lit";
|
5
3
|
import { property } from "lit/decorators.js";
|
6
4
|
|
package/src/components/grid.ts
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
6
|
-
import { joinRules } from "@godown/element/tools/css.js";
|
7
|
-
import { isNumerical } from "@godown/element/tools/lib.js";
|
1
|
+
import { attr, godown, htmlSlot, htmlStyle, isNumerical, joinRules, styles } from "@godown/element";
|
8
2
|
import { css, html, type TemplateResult } from "lit";
|
9
3
|
import { property } from "lit/decorators.js";
|
10
4
|
|
@@ -0,0 +1,89 @@
|
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { css, html, type TemplateResult } from "lit";
|
3
|
+
import { property } from "lit/decorators.js";
|
4
|
+
|
5
|
+
import { GlobalStyle } from "../core/global-style.js";
|
6
|
+
|
7
|
+
const protoName = "heading";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* {@linkcode Heading} renders a heading.
|
11
|
+
*
|
12
|
+
* If the id is provided, the anchor will be displayed.
|
13
|
+
*
|
14
|
+
* @slot - The content of the heading.
|
15
|
+
* @category layout
|
16
|
+
*/
|
17
|
+
@godown(protoName)
|
18
|
+
@styles(
|
19
|
+
css`
|
20
|
+
:host {
|
21
|
+
display: block;
|
22
|
+
text-align: start;
|
23
|
+
}
|
24
|
+
|
25
|
+
[part=root] {
|
26
|
+
position: relative;
|
27
|
+
}
|
28
|
+
|
29
|
+
a {
|
30
|
+
color: inherit;
|
31
|
+
position: absolute;
|
32
|
+
inset: 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
[part=anchor] {
|
36
|
+
position: absolute;
|
37
|
+
text-align: center;
|
38
|
+
min-width: 1.25em;
|
39
|
+
right: 100%;
|
40
|
+
}
|
41
|
+
|
42
|
+
h1,
|
43
|
+
h2,
|
44
|
+
h3,
|
45
|
+
h4,
|
46
|
+
h5,
|
47
|
+
h6 {
|
48
|
+
font-size: revert;
|
49
|
+
}
|
50
|
+
`,
|
51
|
+
)
|
52
|
+
class Heading extends GlobalStyle {
|
53
|
+
@property({ type: String })
|
54
|
+
as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" = "h1";
|
55
|
+
|
56
|
+
@property({ type: String })
|
57
|
+
anchor = "#";
|
58
|
+
|
59
|
+
protected render(): TemplateResult<1> {
|
60
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
61
|
+
${
|
62
|
+
this.wrapHeading(
|
63
|
+
this.id ? html`<a href="#${this.id}"><i part="anchor">${this.anchor}</i></a>` : "",
|
64
|
+
html`<p>${htmlSlot()}</p>`,
|
65
|
+
)
|
66
|
+
}
|
67
|
+
</div> `;
|
68
|
+
}
|
69
|
+
|
70
|
+
protected wrapHeading(...children: any[]): TemplateResult<1> {
|
71
|
+
switch (this.as) {
|
72
|
+
case "h2":
|
73
|
+
return html`<h2>${children}</h2>`;
|
74
|
+
case "h3":
|
75
|
+
return html`<h3>${children}</h3>`;
|
76
|
+
case "h4":
|
77
|
+
return html`<h4>${children}</h4>`;
|
78
|
+
case "h5":
|
79
|
+
return html`<h5>${children}</h5>`;
|
80
|
+
case "h6":
|
81
|
+
return html`<h6>${children}</h6>`;
|
82
|
+
default:
|
83
|
+
return html`<h1>${children}</h1>`;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
export default Heading;
|
89
|
+
export { Heading };
|
package/src/components/input.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { attr } from "@godown/element/directives/attr.js";
|
5
|
-
import { classList } from "@godown/element/directives/class-list.js";
|
1
|
+
import { attr, classList, godown, part, styles } from "@godown/element";
|
6
2
|
import { css, html, nothing, type TemplateResult } from "lit";
|
7
3
|
import { property } from "lit/decorators.js";
|
8
4
|
|
package/src/components/layout.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
import { property } from "lit/decorators.js";
|
7
4
|
|
package/src/components/link.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { isNil } from "@godown/element/tools/lib.js";
|
1
|
+
import { attr, godown, isNil, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
import { property } from "lit/decorators.js";
|
7
4
|
|
package/src/components/range.ts
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { attr } from "@godown/element/directives/attr.js";
|
5
|
-
import { classList } from "@godown/element/directives/class-list.js";
|
6
|
-
import { joinProperties } from "@godown/element/tools/css.js";
|
7
|
-
import { isNil } from "@godown/element/tools/lib.js";
|
1
|
+
import { attr, classList, godown, isNil, joinProperties, part, styles } from "@godown/element";
|
8
2
|
import { css, html, type TemplateResult } from "lit";
|
9
3
|
import { property, queryAll, state } from "lit/decorators.js";
|
10
4
|
|
package/src/components/rotate.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { part } from "@godown/element/decorators/part.js";
|
3
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { godown, htmlSlot, part, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
|
7
4
|
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
package/src/components/router.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { RouteTree } from "@godown/element/tools/route-tree.js";
|
1
|
+
import { godown, htmlSlot, RouteTree, styles } from "@godown/element";
|
5
2
|
import { css, type PropertyValueMap, type TemplateResult } from "lit";
|
6
3
|
import { property, state } from "lit/decorators.js";
|
7
4
|
|
package/src/components/select.ts
CHANGED
@@ -1,13 +1,7 @@
|
|
1
|
-
import type
|
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 { attr } from "@godown/element/directives/attr.js";
|
6
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, type HandlerEvent, htmlSlot, part, styles } from "@godown/element";
|
7
2
|
import svgCaretDown from "@godown/f7-icon/icons/chevron-down.js";
|
8
3
|
import { css, html, nothing, type TemplateResult } from "lit";
|
9
4
|
import { property, state } from "lit/decorators.js";
|
10
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
11
5
|
|
12
6
|
import Input from "./input.js";
|
13
7
|
|
@@ -122,7 +116,7 @@ class Select extends Input {
|
|
122
116
|
this._renderPrefix(),
|
123
117
|
html`<input
|
124
118
|
part="input"
|
125
|
-
dir="${
|
119
|
+
dir="${this.dir || nothing}"
|
126
120
|
id="${this.makeId}"
|
127
121
|
.value="${this.text}"
|
128
122
|
type="${this.type}"
|
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
5
2
|
import iconPhoto from "@godown/f7-icon/icons/photo.js";
|
6
3
|
import { css, html, type TemplateResult } from "lit";
|
7
4
|
import { property, state } from "lit/decorators.js";
|
package/src/components/split.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { classList } from "@godown/element/directives/class-list.js";
|
5
|
-
import type { HandlerEvent } from "@godown/element/element.js";
|
1
|
+
import { attr, classList, godown, type HandlerEvent, styles } from "@godown/element";
|
6
2
|
import { css, html, nothing, type TemplateResult } from "lit";
|
7
3
|
import { property, state } from "lit/decorators.js";
|
8
4
|
|
@@ -232,3 +228,4 @@ class Split extends SuperInput {
|
|
232
228
|
}
|
233
229
|
|
234
230
|
export default Split;
|
231
|
+
export { Split };
|
package/src/components/switch.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
1
|
+
import { attr, godown, styles } from "@godown/element";
|
4
2
|
import { css, html, type TemplateResult } from "lit";
|
5
3
|
import { property, query } from "lit/decorators.js";
|
6
4
|
|
package/src/components/text.ts
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { classList } from "@godown/element/directives/class-list.js";
|
5
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, classList, godown, htmlSlot, styles } from "@godown/element";
|
6
2
|
import { css, html, type TemplateResult } from "lit";
|
7
3
|
import { property } from "lit/decorators.js";
|
8
4
|
|
package/src/components/time.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
1
|
+
import { attr, godown, styles } from "@godown/element";
|
4
2
|
import fmtime from "fmtime";
|
5
3
|
import { css, html, type PropertyValues, type TemplateResult } from "lit";
|
6
4
|
import { property } from "lit/decorators.js";
|
@@ -1,7 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
5
2
|
import { css, html, type TemplateResult } from "lit";
|
6
3
|
import { property } from "lit/decorators.js";
|
7
4
|
|
@@ -1,9 +1,4 @@
|
|
1
|
-
import { godown } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { attr } from "@godown/element/directives/attr.js";
|
4
|
-
import { classList } from "@godown/element/directives/class-list.js";
|
5
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
6
|
-
import { random } from "@godown/element/tools/lib.js";
|
1
|
+
import { attr, classList, godown, htmlSlot, random, styles } from "@godown/element";
|
7
2
|
import { css, html, type PropertyValueMap, type TemplateResult } from "lit";
|
8
3
|
import { property, query, state } from "lit/decorators.js";
|
9
4
|
|
package/src/core/global-style.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { type Gradients, presetsRGB } from "@godown/colors/presets-rgb.js";
|
2
2
|
import { travel } from "@godown/colors/travel.js";
|
3
|
-
import GodownElement from "@godown/element";
|
4
|
-
import { joinProperties } from "@godown/element/tools/css.js";
|
5
|
-
import { trim } from "@godown/element/tools/lib.js";
|
3
|
+
import { GodownElement, joinProperties, trim } from "@godown/element";
|
6
4
|
import { css, type CSSResult, unsafeCSS } from "lit";
|
7
5
|
|
8
6
|
export class GlobalStyle extends GodownElement {
|
package/src/core/super-anchor.ts
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
import { styles } from "@godown/element
|
2
|
-
import {
|
3
|
-
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { css, html, type TemplateResult } from "lit";
|
1
|
+
import { attr, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { css, html, nothing, type TemplateResult } from "lit";
|
5
3
|
import { property } from "lit/decorators.js";
|
6
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
7
4
|
|
8
5
|
import { GlobalStyle } from "./global-style.js";
|
9
6
|
|
@@ -44,7 +41,7 @@ class SuperAnchor extends GlobalStyle {
|
|
44
41
|
return html`<a
|
45
42
|
part="root"
|
46
43
|
${attr(this.observedRecord)}
|
47
|
-
href="${
|
44
|
+
href="${this.href || nothing}"
|
48
45
|
target="${this.target}"
|
49
46
|
@click=${this._handleClick}
|
50
47
|
>
|
package/src/core/super-input.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import { part } from "@godown/element
|
2
|
-
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import { htmlSlot } from "@godown/element/directives/index.js";
|
4
|
-
import type { HandlerEvent } from "@godown/element/element.js";
|
1
|
+
import { type HandlerEvent, htmlSlot, part, styles } from "@godown/element";
|
5
2
|
import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
|
6
3
|
import { css, html, type TemplateResult } from "lit";
|
7
4
|
import { property } from "lit/decorators.js";
|
package/src/heading.ts
ADDED
package/src/index.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export { default as Alert } from "./alert.js";
|
2
2
|
export { default as Avatar } from "./avatar.js";
|
3
|
+
export { default as Badge } from "./badge.js";
|
3
4
|
export { default as Breath } from "./breath.js";
|
4
5
|
export { default as Button } from "./button.js";
|
5
6
|
export { default as Card } from "./card.js";
|
@@ -11,6 +12,7 @@ export { default as Dragbox } from "./dragbox.js";
|
|
11
12
|
export { default as Flex } from "./flex.js";
|
12
13
|
export { default as Form } from "./form.js";
|
13
14
|
export { default as Grid } from "./grid.js";
|
15
|
+
export { default as Heading } from "./heading.js";
|
14
16
|
export { default as Input } from "./input.js";
|
15
17
|
export { default as Layout } from "./layout.js";
|
16
18
|
export { default as Link } from "./link.js";
|