godown 3.0.0 → 3.0.2
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 +3 -2
- 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 +21 -26
- 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 +1 -0
- 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 -13
- 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 +3 -2
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +63 -65
- 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 +21 -26
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +22 -18
- 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 +1 -0
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +87 -69
- 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 +3 -3
- 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 -14
- 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 +69 -66
- 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 +46 -46
- 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 +91 -74
- package/src/core/super-openable.ts +2 -8
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/dev/core/super-input.js
CHANGED
@@ -1,77 +1,77 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { htmlSlot, part, styles } from "@godown/element";
|
2
|
+
import { htmlSlot, omit, part, styles } from "@godown/element";
|
3
3
|
import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
|
4
4
|
import { css, html } from "lit";
|
5
5
|
import { property } from "lit/decorators.js";
|
6
|
-
import {
|
6
|
+
import { GlobalStyle, cssGlobalVars } from "./global-style.js";
|
7
7
|
const fieldStyle = css `
|
8
|
-
.input-field {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
}
|
8
|
+
.input-field {
|
9
|
+
display: flex;
|
10
|
+
position: relative;
|
11
|
+
align-items: center;
|
12
|
+
border-radius: inherit;
|
13
|
+
height: inherit;
|
14
|
+
}
|
15
15
|
|
16
|
-
.input-field [part=input] {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
16
|
+
.input-field [part="input"] {
|
17
|
+
background: transparent;
|
18
|
+
height: 100%;
|
19
|
+
width: 100%;
|
20
|
+
color: inherit;
|
21
|
+
padding: 0 var(${cssGlobalVars.input}-space);
|
22
|
+
}
|
23
23
|
|
24
|
-
.input-field:focus-within,
|
25
|
-
.input-field.outline {
|
26
|
-
|
27
|
-
}
|
24
|
+
.input-field:focus-within,
|
25
|
+
.input-field.outline {
|
26
|
+
box-shadow: var(${cssGlobalVars.input}-box-shadow);
|
27
|
+
}
|
28
28
|
|
29
|
-
.input-field [part=icon] {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
29
|
+
.input-field [part="icon"] {
|
30
|
+
display: flex;
|
31
|
+
align-items: center;
|
32
|
+
justify-content: center;
|
33
|
+
}
|
34
34
|
|
35
|
-
.input-field [part=prefix],
|
36
|
-
.input-field [part=suffix] {
|
37
|
-
|
38
|
-
|
39
|
-
}
|
35
|
+
.input-field [part="prefix"],
|
36
|
+
.input-field [part="suffix"] {
|
37
|
+
height: 100%;
|
38
|
+
display: flex;
|
39
|
+
}
|
40
40
|
|
41
|
-
.input-field [part=suffix] [part=icon] {
|
42
|
-
|
43
|
-
}
|
41
|
+
.input-field [part="suffix"] [part="icon"] {
|
42
|
+
padding-inline-end: var(${cssGlobalVars.input}-space);
|
43
|
+
}
|
44
44
|
|
45
|
-
.input-field [part=prefix] [part=icon] {
|
46
|
-
|
47
|
-
}
|
45
|
+
.input-field [part="prefix"] [part="icon"] {
|
46
|
+
padding-inline-start: var(${cssGlobalVars.input}-space);
|
47
|
+
}
|
48
48
|
`;
|
49
49
|
const inputStyle = css `
|
50
|
-
:host {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
}
|
50
|
+
:host {
|
51
|
+
${cssGlobalVars.input}-width: 10em;
|
52
|
+
${cssGlobalVars.input}-height: 1.6em;
|
53
|
+
${cssGlobalVars.input}-space: 0.2em;
|
54
|
+
${cssGlobalVars.input}-background: var(${cssGlobalVars.background});
|
55
|
+
${cssGlobalVars.input}-control: var(${cssGlobalVars.foreground});
|
56
|
+
${cssGlobalVars.input}-control-edge: var(${cssGlobalVars.active});
|
57
|
+
${cssGlobalVars.input}-radius: 0.2em;
|
58
|
+
${cssGlobalVars.input}-box-shadow: 0px 0px 0px .1em var(${cssGlobalVars.active});
|
59
|
+
border-radius: var(${cssGlobalVars.input}-radius);
|
60
|
+
}
|
61
61
|
|
62
|
-
:host([disabled]) {
|
63
|
-
|
64
|
-
|
65
|
-
}
|
62
|
+
:host([disabled]) {
|
63
|
+
cursor: not-allowed;
|
64
|
+
filter: brightness(0.85);
|
65
|
+
}
|
66
66
|
|
67
|
-
input:disabled {
|
68
|
-
|
69
|
-
}
|
67
|
+
input:disabled {
|
68
|
+
cursor: inherit;
|
69
|
+
}
|
70
70
|
|
71
|
-
input::-ms-reveal,
|
72
|
-
input::-ms-clear {
|
73
|
-
|
74
|
-
}
|
71
|
+
input::-ms-reveal,
|
72
|
+
input::-ms-clear {
|
73
|
+
display: none;
|
74
|
+
}
|
75
75
|
`;
|
76
76
|
let SuperInput = class SuperInput extends GlobalStyle {
|
77
77
|
constructor() {
|
@@ -85,6 +85,9 @@ let SuperInput = class SuperInput extends GlobalStyle {
|
|
85
85
|
this.makeId = Math.random().toString(36).slice(1);
|
86
86
|
this.nameValue = this.namevalue;
|
87
87
|
}
|
88
|
+
get observedRecord() {
|
89
|
+
return omit(super.observedRecord, "default", "value");
|
90
|
+
}
|
88
91
|
set defaultValue(value) {
|
89
92
|
this.default = value;
|
90
93
|
}
|
@@ -122,7 +125,7 @@ let SuperInput = class SuperInput extends GlobalStyle {
|
|
122
125
|
}
|
123
126
|
_compositionInit() {
|
124
127
|
if (this._input) {
|
125
|
-
this.events.add(this._input, "compositionstart", () => this.compositing = true);
|
128
|
+
this.events.add(this._input, "compositionstart", () => (this.compositing = true));
|
126
129
|
this.events.add(this._input, "compositionend", (e) => {
|
127
130
|
this.compositing = false;
|
128
131
|
this._handleInput(e);
|
@@ -141,21 +144,36 @@ let SuperInput = class SuperInput extends GlobalStyle {
|
|
141
144
|
this._compositionInit();
|
142
145
|
}
|
143
146
|
_renderPrefix() {
|
144
|
-
return html
|
145
|
-
|
147
|
+
return html `
|
148
|
+
<label
|
149
|
+
for=${this.makeId}
|
150
|
+
part="prefix"
|
151
|
+
>
|
152
|
+
${htmlSlot("prefix")}
|
153
|
+
</label>
|
154
|
+
`;
|
146
155
|
}
|
147
156
|
_renderSuffix() {
|
148
157
|
const PASSWORD = "password";
|
149
|
-
return html
|
158
|
+
return html `
|
159
|
+
<label
|
160
|
+
for=${this.makeId}
|
161
|
+
part="suffix"
|
162
|
+
>
|
163
|
+
${this.type === "password"
|
150
164
|
? html `
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
165
|
+
<i
|
166
|
+
part="icon"
|
167
|
+
@mousedown="${() => this._changeInputType("text")}"
|
168
|
+
@mouseup="${() => this._changeInputType(PASSWORD)}"
|
169
|
+
@mouseleave="${() => this._changeInputType(PASSWORD)}"
|
170
|
+
>
|
171
|
+
${iconEyeSlashFill()}
|
172
|
+
</i>
|
173
|
+
`
|
157
174
|
: htmlSlot("suffix")}
|
158
|
-
|
175
|
+
</label>
|
176
|
+
`;
|
159
177
|
}
|
160
178
|
};
|
161
179
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"super-input.js","sourceRoot":"","sources":["../../src/core/super-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"super-input.js","sourceRoot":"","sources":["../../src/core/super-input.ts"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,gBAAgB,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;qBAcD,aAAa,CAAC,KAAK;;;;;sBAKlB,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;8BAgBX,aAAa,CAAC,KAAK;;;;gCAIjB,aAAa,CAAC,KAAK;;CAElD,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,CAAA;;MAEhB,aAAa,CAAC,KAAK;MACnB,aAAa,CAAC,KAAK;MACnB,aAAa,CAAC,KAAK;MACnB,aAAa,CAAC,KAAK,oBAAoB,aAAa,CAAC,UAAU;MAC/D,aAAa,CAAC,KAAK,iBAAiB,aAAa,CAAC,UAAU;MAC5D,aAAa,CAAC,KAAK,sBAAsB,aAAa,CAAC,MAAM;MAC7D,aAAa,CAAC,KAAK;MACnB,aAAa,CAAC,KAAK,qCAAqC,aAAa,CAAC,MAAM;yBACzD,aAAa,CAAC,KAAK;;;;;;;;;;;;;;;;CAgB3C,CAAC;AAGF,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAApC;;QACE,cAAS,GAAG,KAAK,CAAC;QAKlB,aAAQ,GAAG,KAAK,CAAC;QA2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AG5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,cAAM,aAAc,SAAQ,WAAW;IACrC;;OAEG;IAEH,IAAI,UAAS;IAEb,MAAM,CAAC,EAAE,GAAE,
|
1
|
+
{"version":3,"file":"super-openable.d.ts","sourceRoot":"","sources":["../../src/core/super-openable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,cAAM,aAAc,SAAQ,WAAW;IACrC;;OAEG;IAEH,IAAI,UAAS;IAEb,MAAM,CAAC,EAAE,GAAE,OAAsC,GAAG,IAAI;IAIxD,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI;IAIZ,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAOlE,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;CAG5C;AAED,eAAe,aAAa,CAAC;AAE7B,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC"}
|
@@ -9,7 +9,7 @@ class SuperOpenable extends GlobalStyle {
|
|
9
9
|
*/
|
10
10
|
this.open = false;
|
11
11
|
}
|
12
|
-
toggle(to =
|
12
|
+
toggle(to = !this.open) {
|
13
13
|
this.open = to;
|
14
14
|
}
|
15
15
|
close() {
|
@@ -24,7 +24,6 @@ class SuperOpenable extends GlobalStyle {
|
|
24
24
|
this.dispatchEvent(new CustomEvent("change", { detail: this.open, composed: true }));
|
25
25
|
}
|
26
26
|
}
|
27
|
-
// eslint-disable-next-line
|
28
27
|
_handelClick(_) {
|
29
28
|
this.toggle();
|
30
29
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"super-openable.js","sourceRoot":"","sources":["../../src/core/super-openable.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QACE;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"super-openable.js","sourceRoot":"","sources":["../../src/core/super-openable.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QACE;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;IAwBf,CAAC;IAtBC,MAAM,CAAC,KAAc,CAAC,IAAI,CAAC,IAAsB;QAC/C,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAES,OAAO,CAAC,iBAAyC;QACzD,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAES,YAAY,CAAC,CAAa;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF;AAxBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAC9B;AA0Bf,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "godown",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.2",
|
4
4
|
"description": "Non Composite Web Components Library",
|
5
5
|
"type": "module",
|
6
6
|
"main": "index.js",
|
@@ -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
|
}
|