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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "godown",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.1",
|
4
4
|
"description": "Non Composite Web Components Library",
|
5
5
|
"type": "module",
|
6
6
|
"main": "index.js",
|
@@ -33,8 +33,8 @@
|
|
33
33
|
"lit": "^3.0.0",
|
34
34
|
"tslib": "^2.7.0",
|
35
35
|
"@godown/colors": "^1.0.0",
|
36
|
-
"@godown/
|
37
|
-
"@godown/
|
36
|
+
"@godown/f7-icon": "^1.0.0",
|
37
|
+
"@godown/element": "^1.0.0"
|
38
38
|
},
|
39
39
|
"publishConfig": {
|
40
40
|
"access": "public"
|
@@ -55,8 +55,8 @@
|
|
55
55
|
"clean": "tsc --build tsconfig.prod.json --clean",
|
56
56
|
"build": "tsc && tsx build.ts",
|
57
57
|
"build:ts": "tsc",
|
58
|
-
"fmt": "
|
59
|
-
"lint": "
|
58
|
+
"fmt": "prettier src --write",
|
59
|
+
"lint": "biome lint",
|
60
60
|
"manifest": "tsx manifest.ts"
|
61
61
|
}
|
62
62
|
}
|
package/src/components/alert.ts
CHANGED
@@ -5,12 +5,12 @@ import iconInfoCircle from "@godown/f7-icon/icons/info-circle.js";
|
|
5
5
|
import iconLightbulb from "@godown/f7-icon/icons/lightbulb.js";
|
6
6
|
import iconQuestionCircle from "@godown/f7-icon/icons/question-circle.js";
|
7
7
|
import iconSlashCircle from "@godown/f7-icon/icons/slash-circle.js";
|
8
|
-
import iconXmark from "@godown/f7-icon/icons/xmark.js";
|
9
8
|
import iconXmarkCircle from "@godown/f7-icon/icons/xmark-circle.js";
|
10
|
-
import
|
9
|
+
import iconXmark from "@godown/f7-icon/icons/xmark.js";
|
10
|
+
import { type TemplateResult, css, html } from "lit";
|
11
11
|
import { property } from "lit/decorators.js";
|
12
12
|
|
13
|
-
import {
|
13
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
14
14
|
|
15
15
|
const protoName = "alert";
|
16
16
|
const cssScope = scopePrefix(protoName);
|
@@ -110,74 +110,72 @@ const calls = {
|
|
110
110
|
* @category feedback
|
111
111
|
*/
|
112
112
|
@godown(protoName)
|
113
|
-
@styles(
|
114
|
-
|
115
|
-
|
116
|
-
:
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
113
|
+
@styles(css`
|
114
|
+
:host,
|
115
|
+
:where(:host([contents]) [part="root"]) {
|
116
|
+
border-radius: var(${cssScope}--border-radius);
|
117
|
+
${cssScope}--border-radius: .25em;
|
118
|
+
${cssScope}--border-width: .075em;
|
119
|
+
${cssScope}--blockquote-width: .2em;
|
120
|
+
${cssScope}--padding: .5em;
|
121
|
+
display: block;
|
122
|
+
width: 100%;
|
123
|
+
}
|
125
124
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
125
|
+
[part="root"] {
|
126
|
+
--color: var(${cssScope}--color);
|
127
|
+
color: var(--color);
|
128
|
+
width: 100%;
|
129
|
+
transition: 0.25s;
|
130
|
+
display: flex;
|
131
|
+
justify-content: space-between;
|
132
|
+
padding: var(${cssScope}--padding);
|
133
|
+
border-radius: inherit;
|
134
|
+
border: var(${cssScope}--border-width) solid var(--color);
|
135
|
+
background: var(${cssScope}--background);
|
136
|
+
}
|
138
137
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
138
|
+
[variant="blockquote"] {
|
139
|
+
border-radius: 0;
|
140
|
+
border-left: var(${cssScope}--blockquote-width) solid var(--color);
|
141
|
+
border-bottom: none;
|
142
|
+
border-right: none;
|
143
|
+
border-top: none;
|
144
|
+
background: transparent;
|
145
|
+
}
|
147
146
|
|
148
|
-
|
149
|
-
|
150
|
-
|
147
|
+
[part="content"] {
|
148
|
+
color: var(--color);
|
149
|
+
}
|
151
150
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
151
|
+
[part="root"] {
|
152
|
+
display: grid;
|
153
|
+
align-items: center;
|
154
|
+
grid-template-columns: auto 1fr auto;
|
155
|
+
grid-template-rows: auto 1fr;
|
156
|
+
}
|
158
157
|
|
159
|
-
|
160
|
-
|
161
|
-
|
158
|
+
[part="title"] {
|
159
|
+
line-height: 2em;
|
160
|
+
}
|
162
161
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
[part="icon"] {
|
163
|
+
display: inline-grid;
|
164
|
+
align-items: center;
|
165
|
+
height: 2em;
|
166
|
+
}
|
168
167
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
168
|
+
[part="icon"] svg {
|
169
|
+
margin-right: 0.5em;
|
170
|
+
width: 1.25em;
|
171
|
+
height: 1.25em;
|
172
|
+
}
|
174
173
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
)
|
174
|
+
[part="content"] {
|
175
|
+
grid-row: span 2 / span 2;
|
176
|
+
line-height: 1.5em;
|
177
|
+
}
|
178
|
+
`)
|
181
179
|
class Alert extends GlobalStyle {
|
182
180
|
/**
|
183
181
|
* If it is a legal value, the icon and preset color will be rendered.
|
@@ -241,19 +239,30 @@ class Alert extends GlobalStyle {
|
|
241
239
|
protected render(): TemplateResult<1> {
|
242
240
|
const color = calls[this.call]?.color || this.color;
|
243
241
|
const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
|
244
|
-
return html
|
245
|
-
<div
|
246
|
-
|
247
|
-
|
248
|
-
|
242
|
+
return html`
|
243
|
+
<div
|
244
|
+
part="root"
|
245
|
+
${attr(this.observedRecord)}
|
246
|
+
>
|
247
|
+
<div part="icon">${icon}</div>
|
248
|
+
<div part="content">
|
249
|
+
<strong part="title">${this.title || htmlSlot("title")}</strong>
|
250
|
+
${this.content || htmlSlot()}
|
251
|
+
</div>
|
252
|
+
${this.hideClose || this.variant === "blockquote"
|
253
|
+
? ""
|
254
|
+
: html`
|
255
|
+
<div
|
256
|
+
part="close"
|
257
|
+
tabindex="0"
|
258
|
+
@click="${this.close}"
|
259
|
+
>
|
260
|
+
${iconXmark()}
|
261
|
+
</div>
|
262
|
+
`}
|
263
|
+
${htmlStyle(this.variant === "dark" ? darkStyles[color] : lightStyles[color])}
|
249
264
|
</div>
|
250
|
-
|
251
|
-
!this.hideClose && this.variant !== "blockquote"
|
252
|
-
? html`<div part="close" tabindex="0" @click="${this.close}">${iconXmark()}</div>`
|
253
|
-
: ""
|
254
|
-
}
|
255
|
-
${htmlStyle(this.variant === "light" ? lightStyles[color] : darkStyles[color])}
|
256
|
-
</div>`;
|
265
|
+
`;
|
257
266
|
}
|
258
267
|
|
259
268
|
close(): void {
|
package/src/components/avatar.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, omit, 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, scopePrefix } from "../core/global-style.js";
|
@@ -17,47 +17,45 @@ const cssScope = scopePrefix(protoName);
|
|
17
17
|
* @category display
|
18
18
|
*/
|
19
19
|
@godown(protoName)
|
20
|
-
@styles(
|
21
|
-
|
22
|
-
:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
20
|
+
@styles(css`
|
21
|
+
:host {
|
22
|
+
${cssScope}--size: 2em;
|
23
|
+
width: var(${cssScope}--size);
|
24
|
+
height: var(${cssScope}--size);
|
25
|
+
vertical-align: bottom;
|
26
|
+
}
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
:host,
|
29
|
+
[part="root"] {
|
30
|
+
display: inline-flex;
|
31
|
+
}
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
:host([contents]) [part="root"] {
|
34
|
+
display: inline-flex;
|
35
|
+
width: inherit;
|
36
|
+
height: inherit;
|
37
|
+
}
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
:host([round]) {
|
40
|
+
border-radius: 50%;
|
41
|
+
}
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
[part="image"] {
|
44
|
+
width: 100%;
|
45
|
+
height: 100%;
|
46
|
+
object-fit: cover;
|
47
|
+
}
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
)
|
49
|
+
[part="root"] {
|
50
|
+
overflow: hidden;
|
51
|
+
position: relative;
|
52
|
+
border-radius: inherit;
|
53
|
+
width: 100%;
|
54
|
+
height: 100%;
|
55
|
+
align-items: center;
|
56
|
+
justify-content: center;
|
57
|
+
}
|
58
|
+
`)
|
61
59
|
class Avatar extends GlobalStyle {
|
62
60
|
/**
|
63
61
|
* Image src.
|
@@ -78,15 +76,31 @@ class Avatar extends GlobalStyle {
|
|
78
76
|
round = false;
|
79
77
|
|
80
78
|
protected render(): TemplateResult<1> {
|
81
|
-
return html
|
79
|
+
return html`
|
80
|
+
<div
|
81
|
+
part="root"
|
82
|
+
${attr(omit(this.observedRecord, "src"))}
|
83
|
+
>
|
84
|
+
${this._renderAvatar()}
|
85
|
+
</div>
|
86
|
+
`;
|
82
87
|
}
|
83
88
|
|
84
89
|
private _renderAvatar() {
|
85
90
|
if (this.src) {
|
86
|
-
return html
|
91
|
+
return html`
|
92
|
+
<img
|
93
|
+
part="image"
|
94
|
+
src="${this.src}"
|
95
|
+
alt="${this.name}"
|
96
|
+
@error=${this._handleError}
|
97
|
+
/>
|
98
|
+
`;
|
87
99
|
}
|
88
100
|
if (this.name) {
|
89
|
-
return html
|
101
|
+
return html`
|
102
|
+
<span part="name">${this.format()}</span>
|
103
|
+
`;
|
90
104
|
}
|
91
105
|
return htmlSlot();
|
92
106
|
}
|
package/src/components/badge.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
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
|
-
import {
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
6
|
|
7
7
|
type Position = "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
8
8
|
|
@@ -16,61 +16,59 @@ const cssScope = scopePrefix(protoName);
|
|
16
16
|
* @category display
|
17
17
|
*/
|
18
18
|
@godown(protoName)
|
19
|
-
@styles(
|
20
|
-
|
21
|
-
:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
`,
|
73
|
-
)
|
19
|
+
@styles(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
|
+
font-size: 75%;
|
39
|
+
padding: 0 0.5em;
|
40
|
+
user-select: none;
|
41
|
+
border-radius: calc(infinity * 1px);
|
42
|
+
transform: translate(-50%, -50%);
|
43
|
+
left: var(--left);
|
44
|
+
top: var(--top);
|
45
|
+
background: var(${cssScope}--background);
|
46
|
+
}
|
47
|
+
|
48
|
+
[part="badge"]:empty {
|
49
|
+
width: 0.5em;
|
50
|
+
height: 0.5em;
|
51
|
+
font-size: 100%;
|
52
|
+
padding: 0;
|
53
|
+
border-radius: 50%;
|
54
|
+
}
|
55
|
+
|
56
|
+
[position^="top"] {
|
57
|
+
--top: calc(0% + var(${cssScope}--offset-y));
|
58
|
+
}
|
59
|
+
|
60
|
+
[position$="right"] {
|
61
|
+
--left: calc(100% - var(${cssScope}--offset-x));
|
62
|
+
}
|
63
|
+
|
64
|
+
[position^="bottom"] {
|
65
|
+
--top: calc(100% - var(${cssScope}--offset-y));
|
66
|
+
}
|
67
|
+
|
68
|
+
[position$="left"] {
|
69
|
+
--left: calc(0% + var(${cssScope}--offset-x));
|
70
|
+
}
|
71
|
+
`)
|
74
72
|
class Badge extends GlobalStyle {
|
75
73
|
@property()
|
76
74
|
position: Position = "top-right";
|
@@ -92,14 +90,19 @@ class Badge extends GlobalStyle {
|
|
92
90
|
}
|
93
91
|
|
94
92
|
render(): TemplateResult<1> {
|
95
|
-
return html
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
93
|
+
return html`
|
94
|
+
<div
|
95
|
+
part="root"
|
96
|
+
${attr(this.observedRecord)}
|
97
|
+
>
|
98
|
+
${htmlSlot()}
|
99
|
+
${this.value || this.dot
|
100
|
+
? html`
|
101
|
+
<div part="badge">${this.dot ? "" : this.formatValue(this.value)}</div>
|
102
|
+
`
|
103
|
+
: ""}
|
104
|
+
</div>
|
105
|
+
`;
|
103
106
|
}
|
104
107
|
}
|
105
108
|
|
package/src/components/breath.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { attr, godown, htmlStyle, 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
|
-
import {
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
6
|
|
7
7
|
const defineName = "breath";
|
8
8
|
const cssScope = scopePrefix(defineName);
|
@@ -48,11 +48,11 @@ const cssScope = scopePrefix(defineName);
|
|
48
48
|
}
|
49
49
|
|
50
50
|
:host,
|
51
|
-
:host([contents]) [part=root] {
|
51
|
+
:host([contents]) [part="root"] {
|
52
52
|
display: flex;
|
53
53
|
}
|
54
54
|
|
55
|
-
[part=root] {
|
55
|
+
[part="root"] {
|
56
56
|
display: contents;
|
57
57
|
}
|
58
58
|
|
@@ -108,16 +108,23 @@ class Breath extends GlobalStyle {
|
|
108
108
|
|
109
109
|
protected render(): TemplateResult<1> {
|
110
110
|
const texts = this.getTexts();
|
111
|
-
return html
|
112
|
-
|
113
|
-
|
111
|
+
return html`
|
112
|
+
<div
|
113
|
+
part="root"
|
114
|
+
${attr(this.observedRecord)}
|
115
|
+
>
|
116
|
+
${[texts.map(this.renderText), htmlStyle(this._computeStyle(texts.length))]}
|
117
|
+
</div>
|
118
|
+
`;
|
114
119
|
}
|
115
120
|
|
116
121
|
protected renderText(text: string): TemplateResult<1> {
|
117
|
-
return html
|
118
|
-
<span class="
|
119
|
-
|
120
|
-
|
122
|
+
return html`
|
123
|
+
<span class="rel">
|
124
|
+
<span class="nocolor">${text}</span>
|
125
|
+
<span class="colorful">${text}</span>
|
126
|
+
</span>
|
127
|
+
`;
|
121
128
|
}
|
122
129
|
|
123
130
|
protected getTexts(): string[] {
|
@@ -129,16 +136,13 @@ class Breath extends GlobalStyle {
|
|
129
136
|
const duration = this.parseDuration() || len * 2 + 2;
|
130
137
|
let style1 = "";
|
131
138
|
for (let number = 1; number <= len; number++) {
|
132
|
-
const delay = -duration / len * (len - number + 1);
|
139
|
+
const delay = (-duration / len) * (len - number + 1);
|
133
140
|
const defaultNumber = ((number - 1) % 3) + 1;
|
134
|
-
style1 +=
|
135
|
-
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
141
|
+
style1 += `.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
136
142
|
}
|
137
|
-
return
|
138
|
-
|
139
|
-
|
140
|
-
}%{opacity:1;}}${style1}`
|
141
|
-
);
|
143
|
+
return `.colorful{animation-duration:${duration}s;}@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${
|
144
|
+
gap * 2
|
145
|
+
}%{opacity:1;}}${style1}`;
|
142
146
|
}
|
143
147
|
|
144
148
|
protected parseDuration(): number | undefined {
|
package/src/components/button.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { attr, constructCSSObject, godown, htmlSlot, htmlStyle, part, styles, toVar } 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
|
-
import {
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
6
|
|
7
7
|
const protoName = "button";
|
8
8
|
const cssScope = scopePrefix(protoName);
|
@@ -106,7 +106,7 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
106
106
|
|
107
107
|
:host([ghost]) {
|
108
108
|
${cssScope}--modal-background: var(${cssScope}--ghost-color);
|
109
|
-
box-shadow:inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
109
|
+
box-shadow: inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
110
110
|
color: var(${cssScope}--ghost-color);
|
111
111
|
background: transparent;
|
112
112
|
}
|
@@ -137,11 +137,11 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
137
137
|
cursor: pointer;
|
138
138
|
}
|
139
139
|
|
140
|
-
:host([contents]) [part=root] {
|
140
|
+
:host([contents]) [part="root"] {
|
141
141
|
width: fit-content;
|
142
142
|
}
|
143
143
|
|
144
|
-
[part=root] {
|
144
|
+
[part="root"] {
|
145
145
|
width: 100%;
|
146
146
|
height: 100%;
|
147
147
|
overflow: hidden;
|
@@ -152,7 +152,7 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
152
152
|
transition-duration: inherit;
|
153
153
|
}
|
154
154
|
|
155
|
-
[part=content] {
|
155
|
+
[part="content"] {
|
156
156
|
padding: var(${cssScope}--padding);
|
157
157
|
}
|
158
158
|
|
@@ -228,12 +228,15 @@ class Button extends GlobalStyle {
|
|
228
228
|
|
229
229
|
protected render(): TemplateResult<1> {
|
230
230
|
const color = this.nextColor();
|
231
|
-
return html
|
232
|
-
<
|
233
|
-
|
234
|
-
${
|
231
|
+
return html`
|
232
|
+
<div
|
233
|
+
part="root"
|
234
|
+
${attr(this.observedRecord)}
|
235
|
+
>
|
236
|
+
<span part="modal-root"></span>
|
237
|
+
<div part="content">${[this.content || htmlSlot(), htmlStyle(colors[color])]}</div>
|
235
238
|
</div>
|
236
|
-
|
239
|
+
`;
|
237
240
|
}
|
238
241
|
|
239
242
|
focus(): void {
|