godown 3.5.2 → 3.6.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 +3 -3
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +3 -3
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +3 -3
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +4 -4
- package/build/godown.js +6 -6
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +4 -4
- package/build/godown.umd.js.map +1 -1
- package/components/alert.js +1 -1
- package/components/alert.js.map +1 -1
- package/components/avatar.js +1 -1
- package/components/avatar.js.map +1 -1
- package/components/badge.d.ts +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.js +1 -1
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +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.js +1 -1
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +1 -0
- 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 +4 -0
- 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 +4 -6
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/divider.js +1 -1
- package/components/divider.js.map +1 -1
- package/components/layout.d.ts +10 -4
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -1
- package/components/layout.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/split.js +1 -1
- package/components/split.js.map +1 -1
- package/core/global-style.d.ts +1 -0
- 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-input.js +1 -1
- package/core/super-input.js.map +1 -1
- package/custom-elements.json +1 -1
- package/package.json +1 -1
- package/src/components/alert.ts +0 -2
- package/src/components/avatar.ts +3 -5
- package/src/components/badge.ts +9 -11
- package/src/components/breath.ts +1 -1
- package/src/components/button.ts +8 -10
- package/src/components/card.ts +0 -1
- package/src/components/carousel.ts +15 -6
- package/src/components/details.ts +24 -21
- package/src/components/dialog.ts +59 -70
- package/src/components/divider.ts +1 -2
- package/src/components/layout.ts +31 -32
- package/src/components/range.ts +1 -0
- package/src/components/split.ts +1 -1
- package/src/core/global-style.ts +8 -0
- package/src/core/super-input.ts +0 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/package.json
CHANGED
package/src/components/alert.ts
CHANGED
@@ -90,12 +90,10 @@ const calls = {
|
|
90
90
|
@styles(css`
|
91
91
|
:host,
|
92
92
|
:where(:host([contents]) [part="root"]) {
|
93
|
-
${cssScope}--border-radius: .2em;
|
94
93
|
${cssScope}--border-width: .075em;
|
95
94
|
${cssScope}--blockquote-width: .2em;
|
96
95
|
${cssScope}--blockquote-background: transparent;
|
97
96
|
${cssScope}--gap: .5em;
|
98
|
-
border-radius: var(${cssScope}--border-radius);
|
99
97
|
display: block;
|
100
98
|
width: 100%;
|
101
99
|
}
|
package/src/components/avatar.ts
CHANGED
@@ -19,12 +19,11 @@ const cssScope = scopePrefix(protoName);
|
|
19
19
|
@godown(protoName)
|
20
20
|
@styles(css`
|
21
21
|
:host {
|
22
|
-
${cssScope}--size: 2em;
|
23
|
-
width: var(${cssScope}--size);
|
24
|
-
height: var(${cssScope}--size);
|
25
22
|
background: var(${cssGlobalVars.passive});
|
26
23
|
vertical-align: bottom;
|
27
|
-
|
24
|
+
overflow: hidden;
|
25
|
+
width: 2em;
|
26
|
+
height: 2em;
|
28
27
|
}
|
29
28
|
|
30
29
|
:host,
|
@@ -49,7 +48,6 @@ const cssScope = scopePrefix(protoName);
|
|
49
48
|
}
|
50
49
|
|
51
50
|
[part="root"] {
|
52
|
-
overflow: hidden;
|
53
51
|
position: relative;
|
54
52
|
border-radius: inherit;
|
55
53
|
width: 100%;
|
package/src/components/badge.ts
CHANGED
@@ -3,7 +3,7 @@ import { type TemplateResult, css, html } from "lit";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
|
-
import { DirectionCorner } from "../core/direction.js";
|
6
|
+
import type { DirectionCorner } from "../core/direction.js";
|
7
7
|
|
8
8
|
const protoName = "badge";
|
9
9
|
const cssScope = scopePrefix(protoName);
|
@@ -39,8 +39,6 @@ const cssScope = scopePrefix(protoName);
|
|
39
39
|
user-select: none;
|
40
40
|
border-radius: calc(infinity * 1px);
|
41
41
|
transform: translate(-50%, -50%);
|
42
|
-
left: var(--left);
|
43
|
-
top: var(--top);
|
44
42
|
background: var(${cssScope}--background);
|
45
43
|
}
|
46
44
|
|
@@ -52,20 +50,20 @@ const cssScope = scopePrefix(protoName);
|
|
52
50
|
border-radius: 50%;
|
53
51
|
}
|
54
52
|
|
55
|
-
[position^="top"] {
|
56
|
-
|
53
|
+
[position^="top"] [part="badge"] {
|
54
|
+
top: calc(0% + var(${cssScope}--offset-y));
|
57
55
|
}
|
58
56
|
|
59
|
-
[position$="right"] {
|
60
|
-
|
57
|
+
[position$="right"] [part="badge"] {
|
58
|
+
left: calc(100% - var(${cssScope}--offset-x));
|
61
59
|
}
|
62
60
|
|
63
|
-
[position^="bottom"] {
|
64
|
-
|
61
|
+
[position^="bottom"] [part="badge"] {
|
62
|
+
top: calc(100% - var(${cssScope}--offset-y));
|
65
63
|
}
|
66
64
|
|
67
|
-
[position$="left"] {
|
68
|
-
|
65
|
+
[position$="left"] [part="badge"] {
|
66
|
+
left: calc(0% + var(${cssScope}--offset-x));
|
69
67
|
}
|
70
68
|
`)
|
71
69
|
class Badge extends GlobalStyle {
|
package/src/components/breath.ts
CHANGED
@@ -140,7 +140,7 @@ class Breath extends GlobalStyle {
|
|
140
140
|
for (let number = 1; number <= len; number++) {
|
141
141
|
const delay = (-duration / len) * (len - number + 1);
|
142
142
|
const defaultNumber = ((number - 1) % 3) + 1;
|
143
|
-
style1 += `.rel:nth-child(${number}) .colorful{animation-delay:${delay}
|
143
|
+
style1 += `.rel:nth-child(${number}) .colorful{animation-delay:${delay}ms;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
144
144
|
}
|
145
145
|
return `.colorful{animation-duration:${duration}ms;}@keyframes colorfulN{0%,${gap * 3}%{opacity:0;}${gap}%,${
|
146
146
|
gap * 2
|
package/src/components/button.ts
CHANGED
@@ -131,12 +131,11 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
131
131
|
var(${cssScope}--background),
|
132
132
|
var(${cssScope}--gradients, var(${cssScope}--background))
|
133
133
|
);
|
134
|
-
|
134
|
+
padding: var(${cssScope}--padding);
|
135
135
|
width: fit-content;
|
136
136
|
display: block;
|
137
137
|
overflow: hidden;
|
138
138
|
text-align: center;
|
139
|
-
padding: 0 !important;
|
140
139
|
cursor: pointer;
|
141
140
|
}
|
142
141
|
|
@@ -147,13 +146,11 @@ const colors: Record<Colors, string> = constructCSSObject(
|
|
147
146
|
[part="root"] {
|
148
147
|
width: 100%;
|
149
148
|
height: 100%;
|
150
|
-
overflow: hidden;
|
151
149
|
position: relative;
|
152
150
|
transition: none;
|
153
151
|
user-select: none;
|
154
152
|
border-radius: inherit;
|
155
153
|
transition-duration: inherit;
|
156
|
-
padding: var(${cssScope}--padding);
|
157
154
|
}
|
158
155
|
|
159
156
|
i {
|
@@ -259,7 +256,8 @@ class Button extends GlobalStyle {
|
|
259
256
|
super.blur();
|
260
257
|
}
|
261
258
|
|
262
|
-
|
259
|
+
connectedCallback(): void {
|
260
|
+
super.connectedCallback();
|
263
261
|
this.events.add(this, "click", this._handelClick, true);
|
264
262
|
}
|
265
263
|
|
@@ -276,13 +274,13 @@ class Button extends GlobalStyle {
|
|
276
274
|
|
277
275
|
protected _handleModal(e: MouseEvent): void {
|
278
276
|
const modal = document.createElement("i");
|
279
|
-
const
|
280
|
-
const {
|
281
|
-
const size = `${Math.sqrt(height
|
277
|
+
const { width, height } = this.getBoundingClientRect();
|
278
|
+
const { x, y } = this._root.getBoundingClientRect();
|
279
|
+
const size = `${Math.sqrt(height ** 2 + width ** 2) * 2}px`;
|
282
280
|
modal.style.height = size;
|
283
281
|
modal.style.width = size;
|
284
|
-
modal.style.left = `${e.
|
285
|
-
modal.style.top = `${e.
|
282
|
+
modal.style.left = `${e.x - x}px`;
|
283
|
+
modal.style.top = `${e.y - y}px`;
|
286
284
|
modal.style.animationName = "kf";
|
287
285
|
this._modalRoot.appendChild(modal);
|
288
286
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
package/src/components/card.ts
CHANGED
@@ -124,6 +124,10 @@ class Carousel extends GlobalStyle {
|
|
124
124
|
this.appendChild(this.__cloneLast);
|
125
125
|
this.insertBefore(this.__cloneFirst, this.firstElementChild);
|
126
126
|
}
|
127
|
+
this.observers.add(this, ResizeObserver, () => {
|
128
|
+
this._offset = this._computeOffset();
|
129
|
+
this._doTranslateX(`${this._offset}px`, true);
|
130
|
+
});
|
127
131
|
}
|
128
132
|
|
129
133
|
protected async firstUpdated(): Promise<void> {
|
@@ -141,13 +145,9 @@ class Carousel extends GlobalStyle {
|
|
141
145
|
show(i: number, n?: boolean): void {
|
142
146
|
i = this.normalizeIndex(i);
|
143
147
|
this.index = i;
|
144
|
-
this._offset =
|
145
|
-
for (let childIndex = 0; childIndex <= i; childIndex++) {
|
146
|
-
this._offset -= getWidth(this.children[childIndex]);
|
147
|
-
}
|
148
|
-
this._offset += (getWidth(this) - getWidth(this.children[i + 1])) / 2;
|
149
|
-
this.dispatchEvent(new CustomEvent("change", { detail: i, composed: true }));
|
148
|
+
this._offset = this._computeOffset();
|
150
149
|
this._doTranslateX(`${this._offset}px`, n);
|
150
|
+
this.dispatchCustomEvent("change", i);
|
151
151
|
this.timeouts.remove(this.intervalID);
|
152
152
|
if (this.autoChange > 0) {
|
153
153
|
this.intervalID = this.timeouts.add(
|
@@ -181,6 +181,15 @@ class Carousel extends GlobalStyle {
|
|
181
181
|
this._moveRoot.style.transition = noTransition ? "none" : "";
|
182
182
|
}
|
183
183
|
|
184
|
+
protected _computeOffset(): number {
|
185
|
+
let offset = 0;
|
186
|
+
for (let childIndex = 0; childIndex <= this.index; childIndex++) {
|
187
|
+
offset -= getWidth(this.children[childIndex]);
|
188
|
+
}
|
189
|
+
offset += (getWidth(this) - getWidth(this.children[this.index + 1])) / 2;
|
190
|
+
return offset;
|
191
|
+
}
|
192
|
+
|
184
193
|
normalizeIndex(i: number): number {
|
185
194
|
if (i < 0) {
|
186
195
|
return 0;
|
@@ -23,54 +23,53 @@ const cssScope = scopePrefix(protoName);
|
|
23
23
|
:host {
|
24
24
|
${cssScope}--icon-deg-open: 0deg;
|
25
25
|
${cssScope}--icon-deg-close: 90deg;
|
26
|
-
${cssScope}--icon-space:
|
27
|
-
${cssScope}--summary-direction: row;
|
28
|
-
${cssScope}--transition: .3s;
|
29
|
-
height: fit-content;
|
26
|
+
${cssScope}--icon-space: .22em;
|
30
27
|
display: block;
|
31
|
-
transition:
|
28
|
+
transition: 0.3s;
|
32
29
|
}
|
33
30
|
|
34
31
|
[part="root"] {
|
35
32
|
height: 100%;
|
36
33
|
position: relative;
|
37
|
-
overflow: hidden;
|
38
34
|
}
|
39
35
|
|
40
36
|
[part="title"] {
|
41
37
|
direction: ltr;
|
42
38
|
height: 100%;
|
43
|
-
display:
|
44
|
-
flex-wrap: nowrap;
|
45
|
-
justify-content: space-between;
|
46
|
-
background: inherit;
|
39
|
+
display: grid;
|
47
40
|
align-items: center;
|
48
|
-
|
41
|
+
justify-content: space-between;
|
42
|
+
grid-template-columns: auto auto;
|
43
|
+
transition: inherit;
|
49
44
|
}
|
50
45
|
|
51
46
|
[part="details"] {
|
52
|
-
display: grid;
|
53
47
|
overflow: hidden;
|
48
|
+
display: grid;
|
54
49
|
grid-template-rows: 0fr;
|
55
|
-
transition:
|
56
|
-
transition-property: grid-template-rows;
|
50
|
+
transition: inherit;
|
57
51
|
}
|
58
52
|
|
59
53
|
:host([open]) [part="details"] {
|
60
54
|
grid-template-rows: 1fr;
|
61
55
|
}
|
62
56
|
|
63
|
-
|
64
|
-
top: 100%;
|
57
|
+
[float] [part="details"] {
|
65
58
|
position: absolute;
|
59
|
+
top: 100%;
|
60
|
+
width: 100%;
|
61
|
+
}
|
62
|
+
|
63
|
+
[part] {
|
64
|
+
transition: inherit;
|
65
|
+
transition-property: transform, grid-template-rows;
|
66
66
|
}
|
67
67
|
|
68
68
|
[part="icon"] {
|
69
69
|
display: flex;
|
70
70
|
backface-visibility: hidden;
|
71
|
-
padding: var(${cssScope}--icon-space);
|
72
|
-
transition: var(${cssScope}--transition);
|
73
71
|
transform: rotate(var(${cssScope}--icon-deg-close));
|
72
|
+
padding: var(${cssScope}--icon-space);
|
74
73
|
}
|
75
74
|
|
76
75
|
:host([open]) [part="icon"] {
|
@@ -78,6 +77,12 @@ const cssScope = scopePrefix(protoName);
|
|
78
77
|
}
|
79
78
|
`)
|
80
79
|
class Details extends SuperOpenable {
|
80
|
+
/**
|
81
|
+
* Determines whether the details component should float.
|
82
|
+
*/
|
83
|
+
@property({ type: Boolean })
|
84
|
+
float = false;
|
85
|
+
|
81
86
|
/**
|
82
87
|
* Determines whether the details component should fill the available space.
|
83
88
|
*/
|
@@ -101,9 +106,7 @@ class Details extends SuperOpenable {
|
|
101
106
|
@click="${() => this.toggle()}"
|
102
107
|
>
|
103
108
|
<span part="summary">${this.summary || htmlSlot("summary")}</span>
|
104
|
-
<span>
|
105
|
-
<i part="icon">${svgCaretDown()}</i>
|
106
|
-
</span>
|
109
|
+
<span part="icon">${svgCaretDown()}</span>
|
107
110
|
</dt>
|
108
111
|
<dd
|
109
112
|
part="details"
|
package/src/components/dialog.ts
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
import { type HandlerEvent, attr, godown, htmlSlot, styles } from "@godown/element";
|
2
2
|
import { type PropertyValues, type TemplateResult, css, html } from "lit";
|
3
|
-
import { property } from "lit/decorators.js";
|
3
|
+
import { property, query } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { scopePrefix } from "../core/global-style.js";
|
6
6
|
import { SuperOpenable } from "../core/super-openable.js";
|
7
|
-
import {
|
8
|
-
type DirectionCardinal,
|
9
|
-
type DirectionCenter,
|
10
|
-
type DirectionCorner,
|
11
|
-
directionInsetAlign,
|
12
|
-
} from "../core/direction.js";
|
13
7
|
|
14
8
|
const protoName = "dialog";
|
15
9
|
const cssScope = scopePrefix(protoName);
|
@@ -25,65 +19,50 @@ const cssScope = scopePrefix(protoName);
|
|
25
19
|
* @category feedback
|
26
20
|
*/
|
27
21
|
@godown(protoName)
|
28
|
-
@styles(
|
29
|
-
|
30
|
-
|
31
|
-
:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
:host(:not([open])) {
|
43
|
-
visibility: hidden;
|
44
|
-
}
|
22
|
+
@styles(css`
|
23
|
+
:host {
|
24
|
+
${cssScope}--background-modal: black;
|
25
|
+
${cssScope}--opacity-modal: 0.2;
|
26
|
+
width: fit-content;
|
27
|
+
display: block;
|
28
|
+
margin: auto;
|
29
|
+
background: none;
|
30
|
+
left: 50%;
|
31
|
+
top: 50%;
|
32
|
+
position: fixed;
|
33
|
+
transform: translate(-50%, -50%);
|
34
|
+
}
|
45
35
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
36
|
+
:host(:not([open])) {
|
37
|
+
visibility: hidden;
|
38
|
+
}
|
50
39
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
width: 100%;
|
55
|
-
height: 100%;
|
56
|
-
position: absolute;
|
57
|
-
background: var(${cssScope}--background-modal);
|
58
|
-
}
|
40
|
+
:host([contents]) dialog {
|
41
|
+
position: fixed;
|
42
|
+
}
|
59
43
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
position: relative;
|
65
|
-
align-items: center;
|
66
|
-
justify-content: center;
|
67
|
-
}
|
44
|
+
dialog {
|
45
|
+
position: relative;
|
46
|
+
background: inherit;
|
47
|
+
}
|
68
48
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
)
|
49
|
+
::backdrop {
|
50
|
+
background: var(${cssScope}--background-modal);
|
51
|
+
opacity: var(${cssScope}--opacity-modal);
|
52
|
+
}
|
53
|
+
`)
|
75
54
|
class Dialog extends SuperOpenable {
|
76
|
-
/**
|
77
|
-
* The direction of the dialog container.
|
78
|
-
*/
|
79
|
-
@property()
|
80
|
-
direction: DirectionCardinal | DirectionCorner | DirectionCenter;
|
81
|
-
|
82
55
|
/**
|
83
56
|
* Indicates whether the dialog should be displayed as a modal.
|
84
57
|
*/
|
85
58
|
@property({ type: Boolean, reflect: true })
|
86
|
-
modal
|
59
|
+
set modal(value: boolean) {
|
60
|
+
this.contents = value;
|
61
|
+
}
|
62
|
+
|
63
|
+
get modal(): boolean {
|
64
|
+
return this.contents;
|
65
|
+
}
|
87
66
|
|
88
67
|
/**
|
89
68
|
* The keys will close the dialog when pressed.
|
@@ -96,31 +75,41 @@ class Dialog extends SuperOpenable {
|
|
96
75
|
*/
|
97
76
|
private __modalInvoke = false;
|
98
77
|
|
78
|
+
@query("dialog")
|
79
|
+
protected _dialog: HTMLDialogElement;
|
80
|
+
|
99
81
|
protected render(): TemplateResult<1> {
|
100
82
|
return html`
|
101
|
-
<
|
83
|
+
<dialog
|
102
84
|
part="root"
|
103
85
|
${attr(this.observedRecord)}
|
104
86
|
>
|
105
|
-
|
106
|
-
|
107
|
-
part="container"
|
108
|
-
direction-inset-align
|
109
|
-
>
|
110
|
-
${htmlSlot()}
|
111
|
-
</div>
|
112
|
-
</div>
|
87
|
+
${htmlSlot()}
|
88
|
+
</dialog>
|
113
89
|
`;
|
114
90
|
}
|
115
91
|
|
116
92
|
showModal(): void {
|
117
|
-
|
118
|
-
|
119
|
-
this.__modalInvoke = true;
|
120
|
-
}
|
93
|
+
this.modal = true;
|
94
|
+
this.__modalInvoke = true;
|
121
95
|
this.show();
|
122
96
|
}
|
123
97
|
|
98
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
|
99
|
+
super.attributeChangedCallback(name, _old, value);
|
100
|
+
if (name === "open") {
|
101
|
+
if (this.open) {
|
102
|
+
if (this.modal) {
|
103
|
+
this._dialog.showModal();
|
104
|
+
} else {
|
105
|
+
this._dialog.show();
|
106
|
+
}
|
107
|
+
} else {
|
108
|
+
this._dialog.close();
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
124
113
|
private __submitEvent: EventListenerOrEventListenerObject;
|
125
114
|
private __keydownEvent: EventListenerOrEventListenerObject;
|
126
115
|
|
@@ -16,7 +16,6 @@ const protoName = "divider";
|
|
16
16
|
:host {
|
17
17
|
width: 100%;
|
18
18
|
height: 0.05em;
|
19
|
-
margin: auto;
|
20
19
|
display: block;
|
21
20
|
background: currentColor;
|
22
21
|
color: var(${cssGlobalVars.passive});
|
@@ -24,7 +23,7 @@ const protoName = "divider";
|
|
24
23
|
|
25
24
|
:host([vertical]) {
|
26
25
|
width: 0.05em;
|
27
|
-
height:
|
26
|
+
height: 100%;
|
28
27
|
}
|
29
28
|
|
30
29
|
:host([contents]) [part="root"] {
|
package/src/components/layout.ts
CHANGED
@@ -7,7 +7,13 @@ import { GlobalStyle } from "../core/global-style.js";
|
|
7
7
|
const protoName = "layout";
|
8
8
|
|
9
9
|
/**
|
10
|
-
* {@linkcode Layout} renders
|
10
|
+
* {@linkcode Layout} renders main content, top header, bottom footer.
|
11
|
+
*
|
12
|
+
* If `sticky` is set to `true`, the header will be sticky.
|
13
|
+
*
|
14
|
+
* Main content will take up the remaining space.
|
15
|
+
*
|
16
|
+
* Element display should be `(inline-)flex` or `(inline-)grid`.
|
11
17
|
*
|
12
18
|
* @slot - The main content of the layout.
|
13
19
|
* @slot header - The header of the layout.
|
@@ -16,50 +22,51 @@ const protoName = "layout";
|
|
16
22
|
*/
|
17
23
|
@godown(protoName)
|
18
24
|
@styles(css`
|
19
|
-
:host
|
20
|
-
|
25
|
+
:host {
|
26
|
+
width: 100%;
|
21
27
|
min-height: 100%;
|
22
|
-
display: flex;
|
23
28
|
flex-direction: column;
|
29
|
+
grid-template-rows: auto 1fr auto;
|
24
30
|
}
|
25
31
|
|
26
|
-
|
27
|
-
|
32
|
+
:host,
|
33
|
+
:host([contents]) [part="root"] {
|
34
|
+
display: grid;
|
28
35
|
}
|
29
36
|
|
30
|
-
[
|
31
|
-
|
32
|
-
top: 0;
|
33
|
-
z-index: 1;
|
37
|
+
[part="root"] {
|
38
|
+
display: contents;
|
34
39
|
}
|
35
40
|
|
36
41
|
[part="main"] {
|
37
|
-
position: relative;
|
38
|
-
flex: 1;
|
39
42
|
width: 100%;
|
43
|
+
flex: 1;
|
40
44
|
}
|
41
45
|
|
42
|
-
header,
|
43
|
-
|
44
|
-
|
46
|
+
[part="header"],
|
47
|
+
[part="footer"] {
|
48
|
+
flex-shrink: 0;
|
45
49
|
width: 100%;
|
46
50
|
}
|
51
|
+
|
52
|
+
[sticky] header {
|
53
|
+
position: sticky;
|
54
|
+
top: 0;
|
55
|
+
}
|
47
56
|
`)
|
48
57
|
class Layout extends GlobalStyle {
|
49
58
|
/**
|
50
|
-
*
|
59
|
+
* @deprecated Omit header slot instead.
|
51
60
|
*/
|
52
|
-
|
53
|
-
noHeader = false;
|
61
|
+
noHeader: boolean;
|
54
62
|
|
55
63
|
/**
|
56
|
-
*
|
64
|
+
* @deprecated Omit footer slot instead.
|
57
65
|
*/
|
58
|
-
|
59
|
-
noFooter = false;
|
66
|
+
noFooter: boolean;
|
60
67
|
|
61
68
|
/**
|
62
|
-
* If true
|
69
|
+
* If `true`, header will sticky.
|
63
70
|
*/
|
64
71
|
@property({ type: Boolean })
|
65
72
|
sticky = false;
|
@@ -70,17 +77,9 @@ class Layout extends GlobalStyle {
|
|
70
77
|
part="root"
|
71
78
|
${attr(this.observedRecord)}
|
72
79
|
>
|
73
|
-
|
74
|
-
? html`
|
75
|
-
<header part="header">${htmlSlot("header")}</header>
|
76
|
-
`
|
77
|
-
: ""}
|
80
|
+
<header part="header">${htmlSlot("header")}</header>
|
78
81
|
<main part="main">${htmlSlot()}</main>
|
79
|
-
|
80
|
-
? html`
|
81
|
-
<footer part="footer">${htmlSlot("footer")}</footer>
|
82
|
-
`
|
83
|
-
: ""}
|
82
|
+
<footer part="footer">${htmlSlot("footer")}</footer>
|
84
83
|
</div>
|
85
84
|
`;
|
86
85
|
}
|
package/src/components/range.ts
CHANGED
@@ -395,6 +395,7 @@ class Range<V extends RangeValue = RangeValue> extends SuperInput<RangeValue> {
|
|
395
395
|
}
|
396
396
|
|
397
397
|
protected _connectedInit(): void {
|
398
|
+
this._ranger = new Ranger(this.min, this.max, this.step);
|
398
399
|
const gap = this._ranger.diff;
|
399
400
|
this.step ||= gap / 100;
|
400
401
|
if (isNil(this.value)) {
|
package/src/components/split.ts
CHANGED
package/src/core/global-style.ts
CHANGED
@@ -25,6 +25,7 @@ export const cssGlobalVars: {
|
|
25
25
|
white: CSSResult;
|
26
26
|
black: CSSResult;
|
27
27
|
color: CSSResult;
|
28
|
+
borderRadius: CSSResult;
|
28
29
|
} = {
|
29
30
|
clipBackground: scopePrefix("clip-background", 2),
|
30
31
|
active: scopePrefix("active", 2),
|
@@ -34,6 +35,7 @@ export const cssGlobalVars: {
|
|
34
35
|
white: scopePrefix("color-white", 2),
|
35
36
|
black: scopePrefix("color-black", 2),
|
36
37
|
color: scopePrefix("color", 2),
|
38
|
+
borderRadius: scopePrefix("border-radius", 2),
|
37
39
|
};
|
38
40
|
|
39
41
|
type PresetsGradientsCSSResult = Record<keyof typeof presetsRGB, Gradients<CSSResult>>;
|
@@ -95,4 +97,10 @@ GlobalStyle.styles = [
|
|
95
97
|
display: revert;
|
96
98
|
}
|
97
99
|
`,
|
100
|
+
css`
|
101
|
+
:host {
|
102
|
+
${cssGlobalVars.borderRadius}: 0.2em;
|
103
|
+
border-radius: var(${cssGlobalVars.borderRadius});
|
104
|
+
}
|
105
|
+
`,
|
98
106
|
];
|
package/src/core/super-input.ts
CHANGED
@@ -53,7 +53,6 @@ const inputStyle = css`
|
|
53
53
|
${cssGlobalVars.input}-outline-width: .075em;
|
54
54
|
${cssGlobalVars.input}-outline-color: var(${cssGlobalVars._colors.darkgray[4]});
|
55
55
|
${cssGlobalVars.input}-icon-color: var(${cssGlobalVars._colors.darkgray[4]});
|
56
|
-
border-radius: 0.2em;
|
57
56
|
}
|
58
57
|
|
59
58
|
:host([disabled]) {
|