godown 3.8.2 → 3.9.0
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 +10 -10
- package/build/godown.js +10 -10
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +10 -10
- package/build/godown.umd.js.map +1 -1
- package/components/alert.d.ts +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/button.d.ts +4 -4
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -1
- package/components/button.js.map +1 -1
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js.map +1 -1
- package/components/input.d.ts +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/range.d.ts.map +1 -1
- package/components/range.js +1 -1
- package/components/range.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/split.d.ts +1 -0
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -1
- package/components/split.js.map +1 -1
- package/components/tabs.d.ts +1 -0
- package/components/tabs.d.ts.map +1 -1
- package/components/tabs.js +1 -1
- package/components/tabs.js.map +1 -1
- package/core/global-style.d.ts +3 -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/outline.d.ts +7 -9
- package/core/outline.d.ts.map +1 -1
- package/core/outline.js +1 -1
- package/core/outline.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/package.json +4 -5
- package/src/components/alert.ts +33 -25
- package/src/components/avatar.ts +1 -2
- package/src/components/button.ts +89 -68
- package/src/components/carousel.ts +2 -1
- package/src/components/input.ts +12 -5
- package/src/components/range.ts +14 -3
- package/src/components/select.ts +1 -0
- package/src/components/split.ts +12 -2
- package/src/components/tabs.ts +58 -64
- package/src/core/global-style.ts +20 -7
- package/src/core/outline.ts +35 -40
- package/src/core/super-input.ts +2 -11
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "godown",
|
3
|
-
"version": "3.
|
4
|
-
"description": "
|
3
|
+
"version": "3.9.0",
|
4
|
+
"description": "Web Components Library",
|
5
5
|
"type": "module",
|
6
6
|
"main": "index.js",
|
7
7
|
"homepage": "https://godown.js.org",
|
@@ -20,9 +20,9 @@
|
|
20
20
|
"fmtime": "^0.0.3",
|
21
21
|
"lit": "^3.0.0",
|
22
22
|
"tslib": "^2.7.0",
|
23
|
+
"@godown/element": "^1.7.0",
|
23
24
|
"@godown/colors": "^1.0.0",
|
24
|
-
"@godown/
|
25
|
-
"@godown/f7-icon": "^1.0.7"
|
25
|
+
"@godown/f7-icon": "^1.0.9"
|
26
26
|
},
|
27
27
|
"publishConfig": {
|
28
28
|
"access": "public"
|
@@ -45,7 +45,6 @@
|
|
45
45
|
"build": "tsx build.ts",
|
46
46
|
"build:ts": "tsc",
|
47
47
|
"fmt": "prettier src/**/* --write",
|
48
|
-
"lint": "biome lint",
|
49
48
|
"manifest": "tsx manifest.ts"
|
50
49
|
}
|
51
50
|
}
|
package/src/components/alert.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr,
|
1
|
+
import { attr, godown, htmlSlot, joinRules, StyleController, styles } from "@godown/element";
|
2
2
|
import iconCheckAltCircle from "@godown/f7-icon/icons/checkmark-alt-circle.js";
|
3
3
|
import iconExclamationCircle from "@godown/f7-icon/icons/exclamationmark-circle.js";
|
4
4
|
import iconInfoCircle from "@godown/f7-icon/icons/info-circle.js";
|
@@ -15,30 +15,23 @@ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js
|
|
15
15
|
const protoName = "alert";
|
16
16
|
const cssScope = scopePrefix(protoName);
|
17
17
|
|
18
|
-
const vars = ["color", "background"].map((v) => `${cssScope}--${v}`);
|
19
|
-
|
20
18
|
const genDark = (key: string) => {
|
21
19
|
return [cssGlobalVars._colors[key][5], cssGlobalVars._colors[key][9]];
|
22
20
|
};
|
23
21
|
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
black: [cssGlobalVars._colors.darkgray[8], cssGlobalVars._colors.lightgray[5]],
|
38
|
-
},
|
39
|
-
() => ":host",
|
40
|
-
(prop) => toVar(prop),
|
41
|
-
);
|
22
|
+
const colorDetails = {
|
23
|
+
green: genDark("green"),
|
24
|
+
blue: genDark("blue"),
|
25
|
+
orange: genDark("orange"),
|
26
|
+
red: genDark("red"),
|
27
|
+
yellow: genDark("yellow"),
|
28
|
+
purple: genDark("purple"),
|
29
|
+
teal: genDark("teal"),
|
30
|
+
pink: genDark("pink"),
|
31
|
+
gray: [cssGlobalVars._colors.lightgray[5], cssGlobalVars._colors.darkgray[5]],
|
32
|
+
white: [cssGlobalVars._colors.lightgray[2], cssGlobalVars._colors.darkgray[7]],
|
33
|
+
black: [cssGlobalVars._colors.darkgray[8], cssGlobalVars._colors.lightgray[5]],
|
34
|
+
};
|
42
35
|
|
43
36
|
const calls = {
|
44
37
|
tip: {
|
@@ -88,12 +81,15 @@ const calls = {
|
|
88
81
|
*/
|
89
82
|
@godown(protoName)
|
90
83
|
@styles(css`
|
91
|
-
:host
|
92
|
-
:where(:host([contents]) [part="root"]) {
|
84
|
+
:host {
|
93
85
|
${cssScope}--border-width: .075em;
|
94
86
|
${cssScope}--blockquote-width: .2em;
|
95
87
|
${cssScope}--blockquote-background: transparent;
|
96
88
|
${cssScope}--gap: .5em;
|
89
|
+
}
|
90
|
+
|
91
|
+
:host,
|
92
|
+
:where(:host([contents]) [part="root"]) {
|
97
93
|
display: block;
|
98
94
|
}
|
99
95
|
|
@@ -142,6 +138,20 @@ const calls = {
|
|
142
138
|
}
|
143
139
|
`)
|
144
140
|
class Alert extends GlobalStyle {
|
141
|
+
private __colorSC = new StyleController(this, () => {
|
142
|
+
const color = calls[this.call]?.color || this.color;
|
143
|
+
if (color in colorDetails) {
|
144
|
+
const [fg, bg] = colorDetails[color];
|
145
|
+
return joinRules({
|
146
|
+
":host": [
|
147
|
+
[`${cssScope}--color`, `var(${fg})`],
|
148
|
+
[`${cssScope}--background`, `var(${bg})`],
|
149
|
+
],
|
150
|
+
});
|
151
|
+
}
|
152
|
+
return null;
|
153
|
+
});
|
154
|
+
|
145
155
|
/**
|
146
156
|
* If it is a legal value, the icon and preset color will be rendered.
|
147
157
|
*/
|
@@ -202,7 +212,6 @@ class Alert extends GlobalStyle {
|
|
202
212
|
variant: "blockquote" | "dark" = "dark";
|
203
213
|
|
204
214
|
protected render(): TemplateResult<1> {
|
205
|
-
const color = calls[this.call]?.color || this.color;
|
206
215
|
const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
|
207
216
|
return html`
|
208
217
|
<div
|
@@ -231,7 +240,6 @@ class Alert extends GlobalStyle {
|
|
231
240
|
${iconXmark()}
|
232
241
|
</div>
|
233
242
|
`}
|
234
|
-
${htmlStyle(darkStyles[color])}
|
235
243
|
</div>
|
236
244
|
`;
|
237
245
|
}
|
package/src/components/avatar.ts
CHANGED
@@ -2,10 +2,9 @@ import { attr, godown, htmlSlot, omit, styles } from "@godown/element";
|
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
|
-
import { GlobalStyle,
|
5
|
+
import { GlobalStyle, cssGlobalVars } from "../core/global-style.js";
|
6
6
|
|
7
7
|
const protoName = "avatar";
|
8
|
-
const cssScope = scopePrefix(protoName);
|
9
8
|
|
10
9
|
/**
|
11
10
|
* {@linkcode Avatar} renders a avatar.
|
package/src/components/button.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr,
|
1
|
+
import { attr, godown, htmlSlot, joinRules, part, StyleController, styles } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
@@ -10,69 +10,77 @@ const cssScope = scopePrefix(protoName);
|
|
10
10
|
const whiteFont = cssGlobalVars.white;
|
11
11
|
const blackFont = cssGlobalVars.black;
|
12
12
|
|
13
|
-
type Colors =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
13
|
+
type Colors =
|
14
|
+
| "none"
|
15
|
+
| "teal"
|
16
|
+
| "blue"
|
17
|
+
| "green"
|
18
|
+
| "red"
|
19
|
+
| "purple"
|
20
|
+
| "orange"
|
21
|
+
| "yellow"
|
22
|
+
| "pink"
|
23
|
+
| "gray"
|
24
|
+
| "white"
|
25
|
+
| "black";
|
26
|
+
|
27
|
+
const colorDetails = {
|
28
|
+
black: [
|
29
|
+
whiteFont, // color
|
30
|
+
cssGlobalVars._colors.darkgray[7], // background
|
31
|
+
cssGlobalVars._colors.darkgray[5], // gradients
|
32
|
+
],
|
33
|
+
gray: [
|
34
|
+
whiteFont, // color
|
35
|
+
cssGlobalVars._colors.darkgray[1], // background
|
36
|
+
cssGlobalVars._colors.lightgray[8], // gradients
|
37
|
+
],
|
38
|
+
white: [
|
39
|
+
blackFont, // color
|
40
|
+
cssGlobalVars._colors.lightgray[3], // background
|
41
|
+
cssGlobalVars._colors.lightgray[0], // gradients
|
42
|
+
],
|
43
|
+
blue: [
|
44
|
+
whiteFont, // color
|
45
|
+
cssGlobalVars._colors.blue[6], // background
|
46
|
+
cssGlobalVars._colors.blue[4], // gradients
|
47
|
+
],
|
48
|
+
green: [
|
49
|
+
whiteFont, // color
|
50
|
+
cssGlobalVars._colors.green[6], // background
|
51
|
+
cssGlobalVars._colors.green[4], // gradients
|
52
|
+
],
|
53
|
+
red: [
|
54
|
+
whiteFont, // color
|
55
|
+
cssGlobalVars._colors.red[6], // background
|
56
|
+
cssGlobalVars._colors.red[4], // gradients
|
57
|
+
],
|
58
|
+
orange: [
|
59
|
+
whiteFont, // color
|
60
|
+
cssGlobalVars._colors.orange[6], // background
|
61
|
+
cssGlobalVars._colors.orange[4], // gradients
|
62
|
+
],
|
63
|
+
pink: [
|
64
|
+
whiteFont, // color
|
65
|
+
cssGlobalVars._colors.pink[6], // background
|
66
|
+
cssGlobalVars._colors.pink[4], // gradients
|
67
|
+
],
|
68
|
+
purple: [
|
69
|
+
whiteFont, // color
|
70
|
+
cssGlobalVars._colors.purple[6], // background
|
71
|
+
cssGlobalVars._colors.purple[4], // gradients
|
72
|
+
],
|
73
|
+
yellow: [
|
74
|
+
blackFont, // color
|
75
|
+
cssGlobalVars._colors.yellow[6], // background
|
76
|
+
cssGlobalVars._colors.yellow[4], // gradients
|
77
|
+
],
|
78
|
+
teal: [
|
79
|
+
whiteFont, // color
|
80
|
+
cssGlobalVars._colors.teal[6], // background
|
81
|
+
cssGlobalVars._colors.teal[4], // gradients
|
82
|
+
],
|
83
|
+
};
|
76
84
|
|
77
85
|
/**
|
78
86
|
* {@linkcode Button} renders a button.
|
@@ -182,6 +190,21 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
182
190
|
`,
|
183
191
|
)
|
184
192
|
class Button extends GlobalStyle {
|
193
|
+
private __colorSC = new StyleController(this, () => {
|
194
|
+
const color = this.nextColor();
|
195
|
+
if (color in colorDetails) {
|
196
|
+
const [fg, bg, gd] = colorDetails[color];
|
197
|
+
return joinRules({
|
198
|
+
":host": [
|
199
|
+
[`${cssScope}--color`, `var(${fg})`],
|
200
|
+
[`${cssScope}--background`, `var(${bg})`],
|
201
|
+
[`${cssScope}--gradients`, `var(${gd})`],
|
202
|
+
],
|
203
|
+
});
|
204
|
+
}
|
205
|
+
return null;
|
206
|
+
});
|
207
|
+
|
185
208
|
/**
|
186
209
|
* If true, remove gradient, modal animation, focus scale.
|
187
210
|
*/
|
@@ -217,7 +240,7 @@ class Button extends GlobalStyle {
|
|
217
240
|
* The primary color.
|
218
241
|
*/
|
219
242
|
@property({ reflect: true })
|
220
|
-
color:
|
243
|
+
color: Colors = "black";
|
221
244
|
|
222
245
|
/**
|
223
246
|
* Content text.
|
@@ -231,7 +254,6 @@ class Button extends GlobalStyle {
|
|
231
254
|
protected _root: HTMLElement;
|
232
255
|
|
233
256
|
protected render(): TemplateResult<1> {
|
234
|
-
const color = this.nextColor();
|
235
257
|
return html`
|
236
258
|
<div
|
237
259
|
part="root"
|
@@ -239,7 +261,6 @@ class Button extends GlobalStyle {
|
|
239
261
|
>
|
240
262
|
${this.content || htmlSlot()}
|
241
263
|
<span part="modal-root"></span>
|
242
|
-
${htmlStyle(colors[color])}
|
243
264
|
</div>
|
244
265
|
`;
|
245
266
|
}
|
@@ -287,7 +308,7 @@ class Button extends GlobalStyle {
|
|
287
308
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
288
309
|
}
|
289
310
|
|
290
|
-
nextColor(): Colors
|
311
|
+
nextColor(): Colors {
|
291
312
|
return this.color;
|
292
313
|
}
|
293
314
|
}
|
@@ -193,7 +193,8 @@ class Carousel extends GlobalStyle {
|
|
193
193
|
normalizeIndex(i: number): number {
|
194
194
|
if (i < 0) {
|
195
195
|
return 0;
|
196
|
-
}
|
196
|
+
}
|
197
|
+
if (i > this.children.length - 3) {
|
197
198
|
return this.children.length - 3;
|
198
199
|
}
|
199
200
|
return i;
|
package/src/components/input.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
import { attr,
|
1
|
+
import { attr, godown, part, styles, htmlSlot, StyleController } from "@godown/element";
|
2
2
|
import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
|
3
3
|
import { type TemplateResult, css, html, nothing } from "lit";
|
4
4
|
import { property } from "lit/decorators.js";
|
5
5
|
|
6
6
|
import { cssGlobalVars } from "../core/global-style.js";
|
7
7
|
import { SuperInput } from "../core/super-input.js";
|
8
|
+
import { OutlineBuilder } from "../core/outline.js";
|
8
9
|
|
9
10
|
const protoName = "input";
|
10
11
|
|
@@ -23,9 +24,8 @@ const protoName = "input";
|
|
23
24
|
display: block;
|
24
25
|
}
|
25
26
|
|
26
|
-
:host(:focus-within)
|
27
|
-
|
28
|
-
${cssGlobalVars.input}-outline-color: var(${cssGlobalVars.active});
|
27
|
+
:host(:focus-within) {
|
28
|
+
${cssGlobalVars.outlineColor}: var(${cssGlobalVars.active});
|
29
29
|
}
|
30
30
|
`)
|
31
31
|
class Input extends SuperInput {
|
@@ -42,12 +42,19 @@ class Input extends SuperInput {
|
|
42
42
|
@part("input")
|
43
43
|
protected _input: HTMLInputElement;
|
44
44
|
|
45
|
+
private __outlineSC = new StyleController(
|
46
|
+
this,
|
47
|
+
() =>
|
48
|
+
new OutlineBuilder({ outlineType: this.outlineType }).css +
|
49
|
+
(this.variant === "outline" ? `:host{${cssGlobalVars.outlineColor}: var(${cssGlobalVars.active})}` : ""),
|
50
|
+
);
|
51
|
+
|
45
52
|
protected render(): TemplateResult<1> {
|
46
53
|
return html`
|
47
54
|
<div
|
48
55
|
part="root"
|
49
56
|
${attr(this.observedRecord)}
|
50
|
-
class="
|
57
|
+
class="input-field"
|
51
58
|
>
|
52
59
|
${[
|
53
60
|
this._renderPrefix(),
|
package/src/components/range.ts
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
attr,
|
3
|
+
tokenList,
|
4
|
+
godown,
|
5
|
+
isNullable,
|
6
|
+
joinDeclarations,
|
7
|
+
loop,
|
8
|
+
part,
|
9
|
+
styles,
|
10
|
+
Ranger,
|
11
|
+
omit,
|
12
|
+
} from "@godown/element";
|
2
13
|
import { type TemplateResult, css, html } from "lit";
|
3
14
|
import { property, queryAll, state } from "lit/decorators.js";
|
4
15
|
|
@@ -209,7 +220,7 @@ class Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {
|
|
209
220
|
part="root"
|
210
221
|
${attr(this.observedRecord)}
|
211
222
|
@mousedown="${this.disabled ? null : this._handleMousedownRoot}"
|
212
|
-
style="${
|
223
|
+
style="${joinDeclarations([
|
213
224
|
["--from", `${((from - this.min) / gap) * 100}%`],
|
214
225
|
["--to", `${((to - this.min) / gap) * 100}%`],
|
215
226
|
...rangeValue.map(
|
@@ -236,7 +247,7 @@ class Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {
|
|
236
247
|
@mousedown="${disabled ? null : this.createMouseDown(index)}"
|
237
248
|
@focus="${disabled ? null : () => this.focusHandle(index)}"
|
238
249
|
@blur="${disabled ? null : this.blurHandle}"
|
239
|
-
style="${
|
250
|
+
style="${joinDeclarations({
|
240
251
|
"z-index": this.__focusStack.indexOf(index) + 1,
|
241
252
|
"--handle": `var(--${end ? "to" : `handle-${index}`})`,
|
242
253
|
})}"
|
package/src/components/select.ts
CHANGED
package/src/components/split.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
import { type HandlerEvent, attr, tokenList, godown, styles, loop, omit } from "@godown/element";
|
1
|
+
import { type HandlerEvent, attr, tokenList, godown, styles, loop, omit, StyleController } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property, state } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
6
|
import { SuperInput } from "../core/super-input.js";
|
7
|
+
import { OutlineBuilder } from "../core/outline.js";
|
7
8
|
|
8
9
|
const protoName = "split";
|
9
10
|
const cssScope = scopePrefix(protoName);
|
@@ -61,7 +62,7 @@ const cssScope = scopePrefix(protoName);
|
|
61
62
|
|
62
63
|
.focus,
|
63
64
|
[part="input-box"]:active {
|
64
|
-
${cssGlobalVars.
|
65
|
+
${cssGlobalVars.outlineColor}: var(${cssGlobalVars.active});
|
65
66
|
}
|
66
67
|
`)
|
67
68
|
class Split extends SuperInput {
|
@@ -83,6 +84,15 @@ class Split extends SuperInput {
|
|
83
84
|
@state()
|
84
85
|
currentValue: (string | void)[] = [];
|
85
86
|
|
87
|
+
private __outlineSC = new StyleController(
|
88
|
+
this,
|
89
|
+
() =>
|
90
|
+
new OutlineBuilder({
|
91
|
+
selector: "[part=input-box]",
|
92
|
+
outlineType: this.outlineType,
|
93
|
+
}).css,
|
94
|
+
);
|
95
|
+
|
86
96
|
get observedRecord(): Record<string, any> {
|
87
97
|
return omit(super.observedRecord, "outline-type");
|
88
98
|
}
|
package/src/components/tabs.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr, godown, htmlSlot, styles, tokenList } from "@godown/element";
|
1
|
+
import { attr, godown, htmlSlot, StyleController, styles, tokenList } from "@godown/element";
|
2
2
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
3
3
|
import { css, html, type TemplateResult } from "lit";
|
4
4
|
import { property, queryAll } from "lit/decorators.js";
|
@@ -35,75 +35,67 @@ const mouseEnterAddedToken = "hover";
|
|
35
35
|
* @category display
|
36
36
|
*/
|
37
37
|
@godown(protoName)
|
38
|
-
@styles(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
:
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
${cssScope}--space: 0.25em;
|
49
|
-
border-radius: var(${cssGlobalVars.borderRadius});
|
50
|
-
transition: 0.2s ease-in-out;
|
51
|
-
width: fit-content;
|
52
|
-
display: flex;
|
53
|
-
cursor: default;
|
54
|
-
}
|
38
|
+
@styles(css`
|
39
|
+
:host {
|
40
|
+
${cssScope}--indicator-background: var(${cssGlobalVars._colors.darkgray[7]});
|
41
|
+
${cssScope}--space: 0.25em;
|
42
|
+
border-radius: var(${cssGlobalVars.radius});
|
43
|
+
transition: 0.2s ease-in-out;
|
44
|
+
width: fit-content;
|
45
|
+
display: flex;
|
46
|
+
cursor: default;
|
47
|
+
}
|
55
48
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
49
|
+
[part="root"] {
|
50
|
+
position: relative;
|
51
|
+
z-index: 1;
|
52
|
+
display: flex;
|
53
|
+
flex-direction: inherit;
|
54
|
+
overflow-x: clip;
|
55
|
+
border-radius: inherit;
|
56
|
+
transition: inherit;
|
57
|
+
transition-property: width, transform, opacity;
|
58
|
+
padding: var(${cssScope}--space);
|
59
|
+
gap: var(${cssScope}--space);
|
60
|
+
}
|
68
61
|
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
[useslot] [part~="item"] {
|
63
|
+
padding: 0;
|
64
|
+
}
|
72
65
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
66
|
+
[part~="item"] {
|
67
|
+
width: 100%;
|
68
|
+
display: block;
|
69
|
+
padding: 0 0.4em;
|
70
|
+
position: relative;
|
71
|
+
white-space: nowrap;
|
72
|
+
transition: inherit;
|
73
|
+
border-radius: inherit;
|
74
|
+
transition-property: inherit;
|
75
|
+
}
|
83
76
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
77
|
+
[part="indicator"] {
|
78
|
+
width: 100%;
|
79
|
+
height: 100%;
|
80
|
+
inset: 0;
|
81
|
+
opacity: 0;
|
82
|
+
z-index: -1;
|
83
|
+
position: absolute;
|
84
|
+
transition: inherit;
|
85
|
+
border-radius: inherit;
|
86
|
+
transition-property: inherit;
|
87
|
+
background: var(${cssScope}--indicator-background);
|
88
|
+
}
|
96
89
|
|
97
|
-
|
98
|
-
|
99
|
-
|
90
|
+
[part~="selected"] {
|
91
|
+
background: var(${cssScope}--indicator-background);
|
92
|
+
}
|
100
93
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
)
|
94
|
+
[part~="selected"] [part="indicator"],
|
95
|
+
[part~="hover"] [part="indicator"] {
|
96
|
+
opacity: 1;
|
97
|
+
}
|
98
|
+
`)
|
107
99
|
class Tabs extends GlobalStyle {
|
108
100
|
@property({ attribute: "outline-type" })
|
109
101
|
outlineType: OutlineType = "border";
|
@@ -134,6 +126,8 @@ class Tabs extends GlobalStyle {
|
|
134
126
|
@queryAll("[part=indicator]")
|
135
127
|
protected _indicators: HTMLCollectionOf<HTMLDivElement>;
|
136
128
|
|
129
|
+
private __outlineSC = new StyleController(this, () => new OutlineBuilder({ outlineType: this.outlineType }).css);
|
130
|
+
|
137
131
|
render(): TemplateResult<1> {
|
138
132
|
return html`
|
139
133
|
<ul
|