godown 3.0.2 → 3.1.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 +2 -0
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +2 -2
- package/components/avatar.d.ts.map +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.map +1 -1
- package/components/breath.d.ts +3 -3
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -1
- package/components/breath.js.map +1 -1
- package/components/carousel.d.ts +4 -4
- 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 +1 -1
- package/components/dialog.d.ts +3 -3
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/dragbox.d.ts +5 -5
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -1
- package/components/dragbox.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -1
- package/components/grid.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -1
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +4 -4
- 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 +1 -1
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +0 -4
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts +1 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -1
- package/components/select.js.map +1 -1
- package/components/split.d.ts.map +1 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -1
- package/components/time.js.map +1 -1
- package/core/global-style.d.ts +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -1
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts +1 -0
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +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-openable.d.ts +1 -0
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts +2 -0
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +5 -0
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +2 -2
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts +1 -1
- package/dev/components/badge.d.ts.map +1 -1
- package/dev/components/badge.js.map +1 -1
- package/dev/components/breath.d.ts +3 -3
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +6 -4
- package/dev/components/breath.js.map +1 -1
- package/dev/components/carousel.d.ts +4 -4
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +7 -7
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +1 -1
- package/dev/components/details.js +1 -1
- package/dev/components/dialog.d.ts +3 -3
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +8 -8
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/dragbox.d.ts +5 -5
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +10 -10
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +3 -2
- package/dev/components/grid.js.map +1 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +14 -3
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +4 -4
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +10 -10
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +1 -1
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +0 -4
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +0 -6
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +6 -6
- package/dev/components/select.js.map +1 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js.map +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +3 -2
- package/dev/components/time.js.map +1 -1
- package/dev/core/global-style.d.ts +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +1 -0
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts +1 -0
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +1 -0
- 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 +1 -0
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts +1 -0
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dev/core/super-openable.js +1 -0
- package/dev/core/super-openable.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert.ts +5 -0
- package/src/components/avatar.ts +2 -2
- package/src/components/badge.ts +1 -1
- package/src/components/breath.ts +7 -5
- package/src/components/carousel.ts +10 -10
- package/src/components/details.ts +1 -1
- package/src/components/dialog.ts +10 -10
- package/src/components/dragbox.ts +14 -14
- package/src/components/grid.ts +4 -2
- package/src/components/progress.ts +13 -3
- package/src/components/range.ts +12 -12
- package/src/components/rotate.ts +1 -1
- package/src/components/router.ts +0 -8
- package/src/components/select.ts +6 -6
- package/src/components/split.ts +1 -1
- package/src/components/time.ts +3 -2
- package/src/core/global-style.ts +1 -0
- package/src/core/super-anchor.ts +1 -0
- package/src/core/super-input.ts +1 -0
- package/src/core/super-openable.ts +1 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/src/components/breath.ts
CHANGED
@@ -98,7 +98,7 @@ class Breath extends GlobalStyle {
|
|
98
98
|
* otherwise split strings by whitespace.
|
99
99
|
*/
|
100
100
|
@property()
|
101
|
-
|
101
|
+
content: string | string[];
|
102
102
|
|
103
103
|
/**
|
104
104
|
* Effect duration, ending in s or ms.
|
@@ -113,12 +113,12 @@ class Breath extends GlobalStyle {
|
|
113
113
|
part="root"
|
114
114
|
${attr(this.observedRecord)}
|
115
115
|
>
|
116
|
-
${[texts.map(this.
|
116
|
+
${[texts.map(this._renderText), htmlStyle(this._computeStyle(texts.length))]}
|
117
117
|
</div>
|
118
118
|
`;
|
119
119
|
}
|
120
120
|
|
121
|
-
protected
|
121
|
+
protected _renderText(text: string): TemplateResult<1> {
|
122
122
|
return html`
|
123
123
|
<span class="rel">
|
124
124
|
<span class="nocolor">${text}</span>
|
@@ -128,7 +128,9 @@ class Breath extends GlobalStyle {
|
|
128
128
|
}
|
129
129
|
|
130
130
|
protected getTexts(): string[] {
|
131
|
-
return Array.isArray(this.
|
131
|
+
return Array.isArray(this.content)
|
132
|
+
? this.content
|
133
|
+
: (this.content || this.textContent).split(/\s+/).filter((x) => x);
|
132
134
|
}
|
133
135
|
|
134
136
|
protected _computeStyle(len: number): string {
|
@@ -145,7 +147,7 @@ class Breath extends GlobalStyle {
|
|
145
147
|
}%{opacity:1;}}${style1}`;
|
146
148
|
}
|
147
149
|
|
148
|
-
|
150
|
+
parseDuration(): number | undefined {
|
149
151
|
const { duration } = this;
|
150
152
|
if (duration) {
|
151
153
|
if (duration.endsWith("s")) {
|
@@ -19,7 +19,7 @@ const protoName = "carousel";
|
|
19
19
|
* If no width, it will be the width of the first element.
|
20
20
|
*
|
21
21
|
* @slot - Carousel items, should maintain the same size.
|
22
|
-
* @fires change -
|
22
|
+
* @fires change - Fires when the index changes.
|
23
23
|
* @category display
|
24
24
|
*/
|
25
25
|
@godown(protoName)
|
@@ -89,11 +89,11 @@ class Carousel extends GlobalStyle {
|
|
89
89
|
@part("move-root")
|
90
90
|
protected _moveRoot: HTMLElement;
|
91
91
|
|
92
|
-
|
92
|
+
intervalID: number;
|
93
93
|
|
94
|
-
private
|
94
|
+
private __cloneFirst: HTMLElement | undefined;
|
95
95
|
|
96
|
-
private
|
96
|
+
private __cloneLast: HTMLElement | undefined;
|
97
97
|
|
98
98
|
protected render(): TemplateResult<1> {
|
99
99
|
return html`
|
@@ -130,12 +130,12 @@ class Carousel extends GlobalStyle {
|
|
130
130
|
if (this.children.length) {
|
131
131
|
this.width ||= `${(this.firstElementChild as HTMLElement).offsetWidth}px`;
|
132
132
|
|
133
|
-
this.
|
134
|
-
this.
|
135
|
-
this.
|
136
|
-
this.
|
137
|
-
this.appendChild(this.
|
138
|
-
this.insertBefore(this.
|
133
|
+
this.__cloneFirst?.remove();
|
134
|
+
this.__cloneLast?.remove();
|
135
|
+
this.__cloneLast = this.firstElementChild.cloneNode(true) as HTMLElement;
|
136
|
+
this.__cloneFirst = this.lastElementChild.cloneNode(true) as HTMLElement;
|
137
|
+
this.appendChild(this.__cloneLast);
|
138
|
+
this.insertBefore(this.__cloneFirst, this.firstElementChild);
|
139
139
|
this.show(this.index);
|
140
140
|
}
|
141
141
|
this.checkInterval();
|
@@ -15,7 +15,7 @@ const cssScope = scopePrefix(protoName);
|
|
15
15
|
*
|
16
16
|
* @slot summary - Details summary if no `summary` is provided.
|
17
17
|
* @slot - Details content.
|
18
|
-
* @fires change -
|
18
|
+
* @fires change - Fires when the open changes.
|
19
19
|
* @category display
|
20
20
|
*/
|
21
21
|
@godown(protoName)
|
package/src/components/dialog.ts
CHANGED
@@ -100,7 +100,7 @@ class Dialog extends SuperOpenable {
|
|
100
100
|
@property()
|
101
101
|
key = "Escape";
|
102
102
|
|
103
|
-
private
|
103
|
+
private __modalInvoke = false;
|
104
104
|
|
105
105
|
protected render(): TemplateResult<1> {
|
106
106
|
return html`
|
@@ -117,24 +117,24 @@ class Dialog extends SuperOpenable {
|
|
117
117
|
showModal(): void {
|
118
118
|
if (!this.modal) {
|
119
119
|
this.modal = true;
|
120
|
-
this.
|
120
|
+
this.__modalInvoke = true;
|
121
121
|
}
|
122
122
|
this.show();
|
123
123
|
}
|
124
124
|
|
125
|
-
private
|
126
|
-
private
|
125
|
+
private __submitEvent: EventListenerOrEventListenerObject;
|
126
|
+
private __keydownEvent: EventListenerOrEventListenerObject;
|
127
127
|
|
128
128
|
protected updated(changedProperties: PropertyValues): void {
|
129
129
|
if (changedProperties.has("open")) {
|
130
130
|
if (this.open) {
|
131
|
-
this.
|
131
|
+
this.__submitEvent = this.events.add(this, "submit", this._handelSubmit);
|
132
132
|
if (this.key) {
|
133
|
-
this.
|
133
|
+
this.__keydownEvent = this.events.add(document, "keydown", this._handleKeydown.bind(this));
|
134
134
|
}
|
135
135
|
} else {
|
136
|
-
this.events.remove(this, "submit", this.
|
137
|
-
this.events.remove(document, "keydown", this.
|
136
|
+
this.events.remove(this, "submit", this.__submitEvent);
|
137
|
+
this.events.remove(document, "keydown", this.__keydownEvent);
|
138
138
|
}
|
139
139
|
}
|
140
140
|
}
|
@@ -155,9 +155,9 @@ class Dialog extends SuperOpenable {
|
|
155
155
|
}
|
156
156
|
|
157
157
|
close(): void {
|
158
|
-
if (this.
|
158
|
+
if (this.__modalInvoke) {
|
159
159
|
this.modal = false;
|
160
|
-
this.
|
160
|
+
this.__modalInvoke = false;
|
161
161
|
}
|
162
162
|
this.open = false;
|
163
163
|
}
|
@@ -38,11 +38,11 @@ class Dragbox extends GlobalStyle {
|
|
38
38
|
return this.offsetParent?.clientHeight ?? document.body.offsetHeight;
|
39
39
|
}
|
40
40
|
|
41
|
-
private
|
42
|
-
private
|
43
|
-
private
|
44
|
-
private
|
45
|
-
private
|
41
|
+
private __drag = false;
|
42
|
+
private __t: number;
|
43
|
+
private __l: number;
|
44
|
+
private __cx: number;
|
45
|
+
private __cy: number;
|
46
46
|
|
47
47
|
/**
|
48
48
|
* Position x.
|
@@ -74,11 +74,11 @@ class Dragbox extends GlobalStyle {
|
|
74
74
|
}
|
75
75
|
|
76
76
|
protected _handleDragStart(e: MouseEvent): void {
|
77
|
-
this.
|
78
|
-
this.
|
79
|
-
this.
|
80
|
-
this.
|
81
|
-
this.
|
77
|
+
this.__cx = e.clientX;
|
78
|
+
this.__cy = e.clientY;
|
79
|
+
this.__t = this.offsetTop;
|
80
|
+
this.__l = this.offsetLeft;
|
81
|
+
this.__drag = true;
|
82
82
|
this._handleMouseMove = this.events.add(document, "mousemove", this._handleDrag.bind(this));
|
83
83
|
this._handleMouseLeave = this.events.add(document, "mouseleave", this._handleDragEnd.bind(this));
|
84
84
|
}
|
@@ -87,17 +87,17 @@ class Dragbox extends GlobalStyle {
|
|
87
87
|
protected _handleMouseLeave: EventListenerFunc;
|
88
88
|
|
89
89
|
protected _handleDragEnd(): void {
|
90
|
-
this.
|
90
|
+
this.__drag = false;
|
91
91
|
this.events.remove(document, "mousemove", this._handleMouseMove);
|
92
92
|
this.events.remove(document, "mouseleave", this._handleMouseLeave);
|
93
93
|
}
|
94
94
|
|
95
95
|
protected _handleDrag(e: MouseEvent): void {
|
96
|
-
if (!this.
|
96
|
+
if (!this.__drag) {
|
97
97
|
return;
|
98
98
|
}
|
99
|
-
const nl = e.clientX - (this.
|
100
|
-
const nt = e.clientY - (this.
|
99
|
+
const nl = e.clientX - (this.__cx - this.__l);
|
100
|
+
const nt = e.clientY - (this.__cy - this.__t);
|
101
101
|
const { style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight } = this;
|
102
102
|
if (nl < 0) {
|
103
103
|
style.left = "0";
|
package/src/components/grid.ts
CHANGED
@@ -4,6 +4,8 @@ import { property } from "lit/decorators.js";
|
|
4
4
|
|
5
5
|
import { GlobalStyle } from "../core/global-style.js";
|
6
6
|
|
7
|
+
const toTemplate = (s: number | string) => (isNumerical(s) ? `repeat(${s},1fr)` : s);
|
8
|
+
|
7
9
|
const protoName = "grid";
|
8
10
|
|
9
11
|
/**
|
@@ -70,8 +72,8 @@ class Grid extends GlobalStyle {
|
|
70
72
|
joinRules({
|
71
73
|
":host": {
|
72
74
|
gap: this.gap,
|
73
|
-
"grid-template-columns":
|
74
|
-
"grid-template-rows":
|
75
|
+
"grid-template-columns": toTemplate(this.columns),
|
76
|
+
"grid-template-rows": toTemplate(this.rows),
|
75
77
|
"place-content": this.content,
|
76
78
|
"place-items": this.items,
|
77
79
|
},
|
@@ -73,6 +73,11 @@ class Progress extends GlobalStyle {
|
|
73
73
|
let className: string;
|
74
74
|
if (!isNil(this.value)) {
|
75
75
|
width = this.parsePercent(this.value);
|
76
|
+
if (width > 100) {
|
77
|
+
width = 100;
|
78
|
+
} else if (width < 0) {
|
79
|
+
width = 0;
|
80
|
+
}
|
76
81
|
className = "static";
|
77
82
|
}
|
78
83
|
return html`
|
@@ -96,10 +101,15 @@ class Progress extends GlobalStyle {
|
|
96
101
|
* @returns Percentage without a percent sign.
|
97
102
|
*/
|
98
103
|
parsePercent(s: string | number = "0"): number {
|
99
|
-
|
100
|
-
|
104
|
+
s = String(s);
|
105
|
+
if (s.includes("%")) {
|
106
|
+
return parseFloat(s);
|
101
107
|
}
|
102
|
-
|
108
|
+
const diff = this.max - this.min;
|
109
|
+
if (diff === 0) {
|
110
|
+
return 100;
|
111
|
+
}
|
112
|
+
return (parseFloat(s) / diff) * 100;
|
103
113
|
}
|
104
114
|
}
|
105
115
|
|
package/src/components/range.ts
CHANGED
@@ -164,7 +164,7 @@ class Range extends SuperInput {
|
|
164
164
|
@state()
|
165
165
|
lastFocus?: number;
|
166
166
|
|
167
|
-
|
167
|
+
private __focusStack: number[] = [];
|
168
168
|
|
169
169
|
/**
|
170
170
|
* Returns true when the second number is greater than the first number.
|
@@ -223,12 +223,12 @@ class Range extends SuperInput {
|
|
223
223
|
})}"
|
224
224
|
>
|
225
225
|
<div part="track"></div>
|
226
|
-
${this.range ? (this.value as number[]).map((_, index) => this.
|
226
|
+
${this.range ? (this.value as number[]).map((_, index) => this._renderHandle(index)) : this._renderHandle(0)}
|
227
227
|
</div>
|
228
228
|
`;
|
229
229
|
}
|
230
230
|
|
231
|
-
protected
|
231
|
+
protected _renderHandle(index: number): TemplateResult<1> {
|
232
232
|
const { range } = this;
|
233
233
|
const end = !range || index === (this.value as number[]).length - 1;
|
234
234
|
return html`
|
@@ -239,7 +239,7 @@ class Range extends SuperInput {
|
|
239
239
|
@mousedown="${this.disabled ? null : this.createMouseDown(index)}"
|
240
240
|
@focus="${this.disabled ? null : () => this.focusHandle(index)}"
|
241
241
|
@blur="${this.disabled ? null : this.blurHandle}"
|
242
|
-
style="z-index:${this.
|
242
|
+
style="z-index:${this.__focusStack.indexOf(index) + 1};--handle:var(--${
|
243
243
|
/* In single-handle mod or end, it is max value */
|
244
244
|
!range && end ? "to" : `handle-${index}`
|
245
245
|
})"
|
@@ -247,26 +247,26 @@ class Range extends SuperInput {
|
|
247
247
|
`;
|
248
248
|
}
|
249
249
|
|
250
|
-
private
|
250
|
+
private __keydownEvent: EventListenerOrEventListenerObject;
|
251
251
|
|
252
252
|
focusHandle(index: number): void {
|
253
253
|
this.lastFocus = index;
|
254
|
-
const indexOfFocusStack = this.
|
254
|
+
const indexOfFocusStack = this.__focusStack.indexOf(index);
|
255
255
|
if (indexOfFocusStack !== -1) {
|
256
|
-
this.
|
256
|
+
this.__focusStack.splice(indexOfFocusStack, 1);
|
257
257
|
}
|
258
|
-
this.
|
258
|
+
this.__focusStack.push(index);
|
259
259
|
const handleItem = this._handles.item(index);
|
260
260
|
handleItem?.focus();
|
261
|
-
if (!this.
|
262
|
-
this.
|
261
|
+
if (!this.__keydownEvent) {
|
262
|
+
this.__keydownEvent = this.events.add(document, "keydown", this.createKeydownEvent(index));
|
263
263
|
}
|
264
264
|
this.dispatchEvent(new CustomEvent("focus", { detail: index }));
|
265
265
|
}
|
266
266
|
|
267
267
|
blurHandle(): void {
|
268
268
|
this.lastFocus = undefined;
|
269
|
-
this.
|
269
|
+
this.__keydownEvent = this.events.remove(document, "keydown", this.__keydownEvent);
|
270
270
|
this.dispatchEvent(new CustomEvent("blur"));
|
271
271
|
}
|
272
272
|
|
@@ -321,7 +321,7 @@ class Range extends SuperInput {
|
|
321
321
|
/**
|
322
322
|
* Ensure that the values do not exceed the range of max and min.
|
323
323
|
*/
|
324
|
-
|
324
|
+
normalizeValue(value: number): number {
|
325
325
|
if (value > this.max) {
|
326
326
|
value -= this.step;
|
327
327
|
} else if (value < this.min) {
|
package/src/components/rotate.ts
CHANGED
package/src/components/router.ts
CHANGED
@@ -175,11 +175,6 @@ class Router extends GlobalStyle {
|
|
175
175
|
};
|
176
176
|
}
|
177
177
|
|
178
|
-
/**
|
179
|
-
* Callback function when the route changes.
|
180
|
-
*/
|
181
|
-
routeChangeCallback: (params: RouteResult, first: boolean) => void = null;
|
182
|
-
|
183
178
|
protected updated(changedProperties: PropertyValueMap<this>): void {
|
184
179
|
const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
|
185
180
|
if (shouldDispatch) {
|
@@ -188,7 +183,6 @@ class Router extends GlobalStyle {
|
|
188
183
|
if (noRecord) {
|
189
184
|
this.__cacheRecord.set(this.pathname, ur);
|
190
185
|
}
|
191
|
-
this.routeChangeCallback?.(ur, noRecord);
|
192
186
|
this.dispatchEvent(new CustomEvent("change", { detail: ur }));
|
193
187
|
}
|
194
188
|
}
|
@@ -209,8 +203,6 @@ class Router extends GlobalStyle {
|
|
209
203
|
return null;
|
210
204
|
}
|
211
205
|
|
212
|
-
console.log(this.path);
|
213
|
-
|
214
206
|
if ("render" in route) {
|
215
207
|
return route.render?.(omit(this.useRouter(), "component")) || null;
|
216
208
|
}
|
package/src/components/select.ts
CHANGED
@@ -97,7 +97,7 @@ class Select extends Input {
|
|
97
97
|
protected lastChecked: HTMLElement;
|
98
98
|
protected defaultText: string;
|
99
99
|
protected defaultChecked: HTMLElement[];
|
100
|
-
private
|
100
|
+
private __store: { value: string; text: string }[] = [];
|
101
101
|
|
102
102
|
protected render(): TemplateResult<1> {
|
103
103
|
return html`
|
@@ -214,15 +214,15 @@ class Select extends Input {
|
|
214
214
|
text ||= value;
|
215
215
|
let operation: 0 | 1 = 0;
|
216
216
|
if (this.multiple) {
|
217
|
-
const i = this.
|
217
|
+
const i = this.__store.findIndex((s) => s.value === value);
|
218
218
|
if (i > -1) {
|
219
|
-
this.
|
219
|
+
this.__store.splice(i, 1);
|
220
220
|
} else {
|
221
|
-
this.
|
221
|
+
this.__store.push({ value, text });
|
222
222
|
operation = 1;
|
223
223
|
}
|
224
|
-
this.value = this.
|
225
|
-
this.text = this.
|
224
|
+
this.value = this.__store.map((s) => s.value);
|
225
|
+
this.text = this.__store.map((s) => s.text).join(", ");
|
226
226
|
} else {
|
227
227
|
if (this.value === value) {
|
228
228
|
this.value = "";
|
package/src/components/split.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type HandlerEvent, attr, classList, godown, styles } from "@godown/element";
|
2
|
-
import { type TemplateResult, css, html
|
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";
|
package/src/components/time.ts
CHANGED
@@ -30,7 +30,7 @@ class Time extends GlobalStyle {
|
|
30
30
|
* Format strings.
|
31
31
|
*/
|
32
32
|
@property()
|
33
|
-
format = "YYYY-MM-DD hh:mm:ss
|
33
|
+
format = "YYYY-MM-DD hh:mm:ss";
|
34
34
|
|
35
35
|
/**
|
36
36
|
* Time.
|
@@ -71,8 +71,8 @@ class Time extends GlobalStyle {
|
|
71
71
|
|
72
72
|
protected updated(changedProperties: PropertyValues): void {
|
73
73
|
if (changedProperties.has("timeout")) {
|
74
|
-
clearInterval(this.timeoutId);
|
75
74
|
if (this.timeout) {
|
75
|
+
clearInterval(this.timeoutId);
|
76
76
|
this.timeoutId = this.startTimeout();
|
77
77
|
}
|
78
78
|
}
|
@@ -80,6 +80,7 @@ class Time extends GlobalStyle {
|
|
80
80
|
|
81
81
|
disconnectedCallback(): void {
|
82
82
|
clearInterval(this.timeoutId);
|
83
|
+
this.timeoutId = undefined;
|
83
84
|
}
|
84
85
|
|
85
86
|
startTimeout(): number {
|
package/src/core/global-style.ts
CHANGED
@@ -4,6 +4,7 @@ import { GodownElement, joinProperties, trim } from "@godown/element";
|
|
4
4
|
import { type CSSResult, css, unsafeCSS } from "lit";
|
5
5
|
|
6
6
|
export class GlobalStyle extends GodownElement {}
|
7
|
+
export default GlobalStyle;
|
7
8
|
|
8
9
|
const cssvar = trim(GlobalStyle.godownConfig.prefix, "-");
|
9
10
|
|
package/src/core/super-anchor.ts
CHANGED
package/src/core/super-input.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":1.1,"tags":[{"name":"godown-typewriter","description":"Typewriter renders a typewriter effect to text.\n---\n### **Events:**\n ","attributes":[{"name":"content","description":"Raw text.","values":[]},{"name":"ended","description":"If true, hide the cursor","values":[]},{"name":"max","description":"Maximum random time.","values":[]},{"name":"min","description":"Minimum random time.","values":[]},{"name":"delay","description":"Fixed time.","values":[]},{"name":"index","description":"The index at the beginning.","values":[]}],"references":[]},{"name":"godown-tooltip","description":"Tooltip provide tooltip for slot elements.\nIf it has the tip property, ignore the slot tip.\n---\n### **Events:**\n - **change**\n### **Slots:**\n - **tip** - Tip element if no `tip` provided.\n- _default_ - Content.","attributes":[{"name":"tip","description":"Tip text, if there is a value, the slot will be ignored.","values":[]},{"name":"direction","description":"Direction of opening the tip.","values":[{"name":"Direction8"}]},{"name":"align","description":"Content alignment.","values":[{"name":"center"},{"name":"flex-start"},{"name":"flex-end"},{"name":"start"},{"name":"end"}]},{"name":"propagation","description":"If true, allow penetration of the tip.","values":[]},{"name":"type","description":"How can tips be triggered.\nIf `focus`, element will be focusable, open tip when focused.\nIf `hover`, element will open tip when hovered.","values":[{"name":"hover"},{"name":"focus"}]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-time","description":"Time renders a formatting time.\n---\n### **Events:**\n - **time** - Fires when the time changes.","attributes":[{"name":"escape","description":"Escape symbol.","values":[]},{"name":"format","description":"Format strings.","values":[]},{"name":"time","description":"Time.","values":[{"name":"Date"}]},{"name":"timeout","description":"If there is a value, update every gap or timeout.","values":[]},{"name":"gap","description":"The number of milliseconds that change with each update.","values":[]}],"references":[]},{"name":"godown-text","description":"Text renders nowrap text.\n---\n","attributes":[{"name":"underline","description":"Underline behavior.","values":[{"name":"none"},{"name":"hover"},{"name":"active"},{"name":"always"}]},{"name":"clip","description":"Set background-clip to text.","values":[]}],"references":[]},{"name":"godown-switch","description":"Switch renders a switch.\nThe switch is rectangular by default,\nset the round property to rounded switch.\n---\n### **Events:**\n - **change** - Fires when the switch is switched.\n- **input**","attributes":[{"name":"round","description":"Display rounded.","values":[]},{"name":"checked","description":"Whether this element is selected or not.","values":[]},{"name":"disabled","description":"Disable this element.","values":[]},{"name":"default","description":"Default checked state.","values":[]},{"name":"value","description":"Input value.","values":[]},{"name":"autocomplete","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]}],"references":[]},{"name":"godown-split","description":"Split renders multiple input boxes.\nInput: will move the focus box backward until the complete input from start to end.\nDelete: will move the focus box forward until the first and no inputs for each.\n---\n### **Events:**\n - **input** - Fires when the input value changes.\n- **focus** - Fires when the input is focused.\n- **blur** - Fires when the input is blurred.\n- **change** - Fires when the input value changes.\n### **Methods:**\n ","attributes":[{"name":"len","description":"The number of input boxes.","values":[]},{"name":"index","description":"Focus index.","values":[]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-skeleton","description":"Skeleton renders a skeleton screen.\n---\n### **Slots:**\n - **loading** - The content if loading is true.\n- _default_ - The content if loading is false.","attributes":[{"name":"type","description":"If \"image\", render a image placeholder.","values":[{"name":"text"},{"name":"image"}]},{"name":"animation","description":"Animation type.\nopacity animation only effect on slotted element and image icon.","values":[{"name":"position"},{"name":"opacity"}]}],"references":[]},{"name":"godown-select","description":"Select is similar to `<select>`.\nElements with the value attribute/property can be used as options.\nThe checked attribute will be added to the selected element.\nMulti-selected state looks the same as single-selected.\nInput will filter the element.\n---\n### **Events:**\n - **select** - Fires when select an option.\n- **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.\n### **Slots:**\n - _default_ - Options.","attributes":[{"name":"text","description":"Selected texts.","values":[]},{"name":"direction","values":[{"name":"top"},{"name":"bottom"}]},{"name":"multiple","values":[]},{"name":"visible","values":[]},{"name":"variant","description":"If outline, the outline is always present.","values":[{"name":"default"},{"name":"outline"}]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-router","description":"Router has basic routing control.\nTo switch routes, use `router-link component`.\nIt has two methods to collect routes.\n1. From field `routes`, an array, each elements require \"path\".\n2. From child elements, which have the slot attribute for matching routes.\nIf only the method 1 is used, set `type` to `\"field\"`.\nIf only the method 2 is used, set `type` to `\"slotted\"`.\n`type` defaults to `\"united\"`, which will try method 1, then method 2.\nIf no routes are matched, the default value (no named slot) will be rendered.\n---\n### **Events:**\n - **change**\n### **Methods:**\n - **fieldComponent(query: _string_): _unknown_** - Get component from routes by query.\n- **slottedComponent(query: _string_): _TemplateResult<1>_** - Get component from slotted elements by query.\n- **collectSlottedRoutes(): _void_** - Reset the route tree, clear cache, collect routes from child elements.\n- **collectFieldRoutes(value: _typeof this.routes_): _void_** - Reset the route tree, clear cache, collect routes from value.\n### **Slots:**\n - _default_ - Display slot when there is no match.\n- ***** - Matching slot will be displayed.","attributes":[{"name":"pathname","description":"Current pathname (equals to location.pathname).","values":[]},{"name":"type","description":"The type of routing sources.\nIf field, it won't collect the slot attribute of the child elements.\nThis property should not be changed after the rendering is complete.","values":[{"name":"united"},{"name":"slotted"},{"name":"field"}]},{"name":"cache","description":"Cache accessed records.\nEmptied at each re-collection.","values":[]}],"references":[]},{"name":"godown-rotate","description":"Rotate Make child elements rotate.\n---\n### **Methods:**\n - **_computeOffset(e: _MouseEvent_): __** - Compute offset.\n```\n`rotateX(${rotateX}rad) rotateY(${rotateY}rad)`\n```","attributes":[],"references":[]},{"name":"godown-range","description":"Range is similar to `<input type=\"range\">`.\nValue accepts number, or array.\nNumber has 1 handle, the array has the number of its elements and the minimum is 2.\n---\n### **Events:**\n - **focus** - Fires when the handle is focused.\n- **blur** - Fires when the handle is blurred.\n- **range** - Fires when the value changes.\n- **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.\n### **Methods:**\n \n","attributes":[{"name":"min","description":"Minimum value.","values":[]},{"name":"max","description":"Maximum value.","values":[]},{"name":"step","description":"Sliding step length.","values":[]},{"name":"vertical","description":"Display vertically.","values":[]},{"name":"value","description":"Value, or each of values, will render a handle.\nAccepts number or array of numbers.","values":[]},{"name":"default","description":"The default of `this.value`.","values":[]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]}],"references":[]},{"name":"godown-progress","description":"Progress similar to `<progress>`.\n---\n### **Methods:**\n - **parsePercent(s: _string | number_): __** - Convert s to a percentage without a percent sign.","attributes":[{"name":"max","values":[]},{"name":"min","values":[]},{"name":"value","values":[]}],"references":[]},{"name":"godown-link","description":"Link is used for link jumping.\nSet `type` to `\"push\" `or `\"replace\"`,\nwill invoke the history api and trigger the Router.updateAll.\n---\n","attributes":[{"name":"type","description":"If \"push\", call `history.pushState`.\nIf \"replace\", call `history.replaceState`.\nIf \"normal\", behave like a normal anchor.","values":[{"name":"push"},{"name":"replace"},{"name":"normal"}]},{"name":"suppress","description":"Suppress the update of the Router.","values":[]},{"name":"href","description":"A element href.","values":[]},{"name":"target","description":"A element target.","values":[{"name":"_blank"},{"name":"_self"},{"name":"_parent"},{"name":"_top"}]}],"references":[]},{"name":"godown-layout","description":"Layout renders slot and optional top header, bottom footer.\n---\n### **Slots:**\n - _default_ - The main content of the layout.\n- **header** - The header of the layout.\n- **footer** - The footer of the layout.","attributes":[{"name":"noHeader","description":"If true, remove the header slot.","values":[]},{"name":"noFooter","description":"If true, remove the footer slot.","values":[]},{"name":"sticky","description":"If true, header will sticky.","values":[]}],"references":[]},{"name":"godown-input","description":"Input renders a text input.\n---\n### **Events:**\n - **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.","attributes":[{"name":"variant","description":"If outline, the outline is always present.","values":[{"name":"default"},{"name":"outline"}]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-heading","description":"Heading renders a heading.\nIf the id is provided, the anchor will be displayed.\n---\n### **Slots:**\n - _default_ - Heading content.","attributes":[{"name":"as","description":"The heading level.","values":[{"name":"h1"},{"name":"h2"},{"name":"h3"},{"name":"h4"},{"name":"h5"},{"name":"h6"}]},{"name":"anchor","description":"The anchor prefix.","values":[]},{"name":"side","description":"The anchor side.","values":[{"name":"left"},{"name":"right"}]}],"references":[]},{"name":"godown-grid","description":"Grid provides gird layout.\n---\n### **Slots:**\n - _default_ - Grid items.","attributes":[{"name":"gap","description":"CSS property `gap`.","values":[]},{"name":"columns","description":"CSS property `grid-template-columns`.\nIf columns is numerical, divide columns equally.","values":[]},{"name":"rows","description":"CSS property `grid-template-rows`.\nIf rows is numerical, divide rows equally.","values":[]},{"name":"content","description":"CSS property `place-content` (`align-content justify-content`).","values":[]},{"name":"items","description":"CSS property `place-items` (`align-items justify-items`).","values":[]}],"references":[]},{"name":"godown-form","description":"Form Gets child element key-value object,\nwhich will be nested if the child element is the same as this element.\n---\n","attributes":[{"name":"name","values":[]}],"references":[]},{"name":"godown-flex","description":"Flex provides flex layout.\n---\n### **Slots:**\n - _default_ - Flex items.","attributes":[{"name":"flex-flow","description":"CSS property `flex-flow` (`flex-direction flex-wrap`).","values":[]},{"name":"gap","description":"CSS property `gap`.","values":[]},{"name":"content","description":"CSS property `justify-content`.","values":[]},{"name":"items","description":"CSS property `align-items`.","values":[]},{"name":"vertical","description":"If true, set flex-direction to \"column\".","values":[]}],"references":[]},{"name":"godown-dragbox","description":"Dragbox does not extend beyond the range of Dragbox.offsetsWidth and Dragbox.offsetsHeight.\n---\n","attributes":[{"name":"x","description":"Position x.","values":[]},{"name":"y","description":"Position y.","values":[]}],"references":[]},{"name":"godown-divider","description":"Divider similar to `<hr>`.\n---\n","attributes":[{"name":"vertical","description":"Vertical display.","values":[]}],"references":[]},{"name":"godown-dialog","description":"Dialog similar to `<dialog>`.\nLike dialog, it listens for submit events and closes itself when the target method is \"dialog\".\nIt listens for the keydown event and also closes itself when the key contained in the key is pressed.\n---\n### **Events:**\n - **change** - Fires when the open changes.","attributes":[{"name":"modal","description":"Enable modal, blocking event penetration.","values":[]},{"name":"key","description":"Close key.","values":[]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-details","description":"Details similar to `<details>`.\n---\n### **Events:**\n - **change** - Fired when the open changes.\n### **Slots:**\n - **summary** - Details summary if no `summary` is provided.\n- _default_ - Details content.","attributes":[{"name":"fill","description":"If it is true, the summary event scope will fill the element.","values":[]},{"name":"summary","description":"Summary text.","values":[]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-carousel","description":"Carousel make the content display as a carousel.\nWhen this component is `firstUpdated`,\nclone the first and last element and make the matching element visible when switching index.\nChild elements should maintain the same size.\nIf no width, it will be the width of the first element.\n---\n### **Events:**\n - **change** - Fired when the index changes.\n### **Slots:**\n - _default_ - Carousel items, should maintain the same size.","attributes":[{"name":"index","description":"The index of the element is displayed for the first time.","values":[]},{"name":"autoChange","description":"If autoChange > 0, the rotation will be automated.","values":[]},{"name":"width","description":"Element width.","values":[]}],"references":[]},{"name":"godown-card","description":"Card renders a card.\nThis may be similar to Layout,\nbut it needs to be specified to enable header and footer.\n---\n### **Slots:**\n - _default_ - The main content of the card.\n- **header** - The header of the card.\n- **footer** - The footer of the card.","attributes":[{"name":"footer","values":[]},{"name":"header","values":[]}],"references":[]},{"name":"godown-button","description":"Button renders a button.\nCreate modal animation upon clicking.\nAvailable colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.\nDefault color is `black`.\nSet the color to `none` to prevent applying styles.\n---\n","attributes":[{"name":"disabled","description":"Whether to disable this element.","values":[]},{"name":"ghost","description":"Display ghost.","values":[]},{"name":"active","description":"Whether this element is active or not.","values":[]},{"name":"round","description":"Display rounded.","values":[]},{"name":"color","description":"The primary color.","values":[{"name":"none"},{"name":"keyof typeof colors"}]},{"name":"content","description":"Content text.","values":[]}],"references":[]},{"name":"godown-breath","description":"Breath render the text with a breathing effect.\nDynamically generate a breathing effect based on the length of the split text.\nIf there is not enough CSS variable, overrun elements will use the.\ngodown was a css library in its earliest days,\nand this is the component version of its first effect.\nInspired by Vercel home page (2023).\n---\n### **Slots:**\n - _default_ - Breathing parts.","attributes":[{"name":"text","description":"Strings or array of strings,\nif array, divided each element into chunks,\notherwise split strings by whitespace.","values":[{"name":"string[]"}]},{"name":"duration","description":"Effect duration, ending in s or ms.","values":[]}],"references":[]},{"name":"godown-badge","description":"Badge renders a badge.\n---\n### **Slots:**\n - _default_ - Badge content.","attributes":[{"name":"position","values":[{"name":"Position"}]},{"name":"value","values":[]},{"name":"dot","description":"If `true`, render a dot badge.","values":[]},{"name":"max","values":[]}],"references":[]},{"name":"godown-avatar","description":"Avatar renders a avatar.\nRenders as an image if it has a src property,\notherwise falls back to name or nameless slot.\n---\n### **Slots:**\n - _default_ - Display content if no `src` or `name` provided.","attributes":[{"name":"src","description":"Image src.","values":[]},{"name":"name","description":"If the image is not available, display name (call Avatar.format).","values":[]},{"name":"round","description":"Display rounded.","values":[]}],"references":[]},{"name":"godown-alert","description":"Alert renders a alert.\nColor defaults to blue.\n---\n### **Events:**\n - **close** - Fires when the alert is closed.\n### **Slots:**\n - _default_ - Alert content.\n- **title** - Alert title.\n- **icon** - Alert icon.","attributes":[{"name":"call","description":"If it is a legal value, the icon and preset color will be rendered.","values":[{"name":"tip"},{"name":"success"},{"name":"info"},{"name":"warning"},{"name":"danger"},{"name":"error"},{"name":"help"},{"name":"deprecated"}]},{"name":"color","description":"The tone of the component.\nOverrides the color of the call.","values":[{"name":""},{"name":"white"},{"name":"black"},{"name":"gray"},{"name":"green"},{"name":"teal"},{"name":"blue"},{"name":"red"},{"name":"purple"},{"name":"orange"},{"name":"yellow"},{"name":"pink"},{"name":"none"}]},{"name":"autoclose","description":"Close delay, if 0, it will not be closed automatically.","values":[]},{"name":"title","description":"The title is bold and the icon height is the same as it.","values":[]},{"name":"content","description":"Content, if zero value, will be rendered as an unnamed slot.","values":[]},{"name":"hideClose","description":"Set true to hide the close button.\nThe behavior may change due to the variant property.","values":[]},{"name":"variant","description":"Alert variant, if set to `blockquote`, the alert will be rendered as a blockquote.\nIf variant is `\"blockquote\"`, hide the close button.","values":[{"name":"blockquote"},{"name":"dark"},{"name":"light"}]}],"references":[]}]}
|
1
|
+
{"version":1.1,"tags":[{"name":"godown-typewriter","description":"Typewriter renders a typewriter effect to text.\n---\n### **Events:**\n ","attributes":[{"name":"content","description":"Raw text.","values":[]},{"name":"ended","description":"If true, hide the cursor","values":[]},{"name":"max","description":"Maximum random time.","values":[]},{"name":"min","description":"Minimum random time.","values":[]},{"name":"delay","description":"Fixed time.","values":[]},{"name":"index","description":"The index at the beginning.","values":[]}],"references":[]},{"name":"godown-tooltip","description":"Tooltip provide tooltip for slot elements.\nIf it has the tip property, ignore the slot tip.\n---\n### **Events:**\n - **change**\n### **Slots:**\n - **tip** - Tip element if no `tip` provided.\n- _default_ - Content.","attributes":[{"name":"tip","description":"Tip text, if there is a value, the slot will be ignored.","values":[]},{"name":"direction","description":"Direction of opening the tip.","values":[{"name":"Direction8"}]},{"name":"align","description":"Content alignment.","values":[{"name":"center"},{"name":"flex-start"},{"name":"flex-end"},{"name":"start"},{"name":"end"}]},{"name":"propagation","description":"If true, allow penetration of the tip.","values":[]},{"name":"type","description":"How can tips be triggered.\nIf `focus`, element will be focusable, open tip when focused.\nIf `hover`, element will open tip when hovered.","values":[{"name":"hover"},{"name":"focus"}]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-time","description":"Time renders a formatting time.\n---\n### **Events:**\n - **time** - Fires when the time changes.","attributes":[{"name":"escape","description":"Escape symbol.","values":[]},{"name":"format","description":"Format strings.","values":[]},{"name":"time","description":"Time.","values":[{"name":"Date"}]},{"name":"timeout","description":"If there is a value, update every gap or timeout.","values":[]},{"name":"gap","description":"The number of milliseconds that change with each update.","values":[]}],"references":[]},{"name":"godown-text","description":"Text renders nowrap text.\n---\n","attributes":[{"name":"underline","description":"Underline behavior.","values":[{"name":"none"},{"name":"hover"},{"name":"active"},{"name":"always"}]},{"name":"clip","description":"Set background-clip to text.","values":[]}],"references":[]},{"name":"godown-switch","description":"Switch renders a switch.\nThe switch is rectangular by default,\nset the round property to rounded switch.\n---\n### **Events:**\n - **change** - Fires when the switch is switched.\n- **input**","attributes":[{"name":"round","description":"Display rounded.","values":[]},{"name":"checked","description":"Whether this element is selected or not.","values":[]},{"name":"disabled","description":"Disable this element.","values":[]},{"name":"default","description":"Default checked state.","values":[]},{"name":"value","description":"Input value.","values":[]},{"name":"autocomplete","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]}],"references":[]},{"name":"godown-split","description":"Split renders multiple input boxes.\nInput: will move the focus box backward until the complete input from start to end.\nDelete: will move the focus box forward until the first and no inputs for each.\n---\n### **Events:**\n - **input** - Fires when the input value changes.\n- **focus** - Fires when the input is focused.\n- **blur** - Fires when the input is blurred.\n- **change** - Fires when the input value changes.\n### **Methods:**\n ","attributes":[{"name":"len","description":"The number of input boxes.","values":[]},{"name":"index","description":"Focus index.","values":[]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-skeleton","description":"Skeleton renders a skeleton screen.\n---\n### **Slots:**\n - **loading** - The content if loading is true.\n- _default_ - The content if loading is false.","attributes":[{"name":"type","description":"If \"image\", render a image placeholder.","values":[{"name":"text"},{"name":"image"}]},{"name":"animation","description":"Animation type.\nopacity animation only effect on slotted element and image icon.","values":[{"name":"position"},{"name":"opacity"}]}],"references":[]},{"name":"godown-select","description":"Select is similar to `<select>`.\nElements with the value attribute/property can be used as options.\nThe checked attribute will be added to the selected element.\nMulti-selected state looks the same as single-selected.\nInput will filter the element.\n---\n### **Events:**\n - **select** - Fires when select an option.\n- **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.\n### **Slots:**\n - _default_ - Options.","attributes":[{"name":"text","description":"Selected texts.","values":[]},{"name":"direction","values":[{"name":"top"},{"name":"bottom"}]},{"name":"multiple","values":[]},{"name":"visible","values":[]},{"name":"variant","description":"If outline, the outline is always present.","values":[{"name":"default"},{"name":"outline"}]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-router","description":"Router has basic routing control.\nTo switch routes, use `router-link component`.\nIt has two methods to collect routes.\n1. From field `routes`, an array, each elements require \"path\".\n2. From child elements, which have the slot attribute for matching routes.\nIf only the method 1 is used, set `type` to `\"field\"`.\nIf only the method 2 is used, set `type` to `\"slotted\"`.\n`type` defaults to `\"united\"`, which will try method 1, then method 2.\nIf no routes are matched, the default value (no named slot) will be rendered.\n---\n### **Events:**\n - **change**\n### **Methods:**\n - **fieldComponent(query: _string_): _unknown_** - Get component from routes by query.\n- **slottedComponent(query: _string_): _TemplateResult<1>_** - Get component from slotted elements by query.\n- **collectSlottedRoutes(): _void_** - Reset the route tree, clear cache, collect routes from child elements.\n- **collectFieldRoutes(value: _typeof this.routes_): _void_** - Reset the route tree, clear cache, collect routes from value.\n### **Slots:**\n - _default_ - Display slot when there is no match.\n- ***** - Matching slot will be displayed.","attributes":[{"name":"pathname","description":"Current pathname (equals to location.pathname).","values":[]},{"name":"type","description":"The type of routing sources.\nIf field, it won't collect the slot attribute of the child elements.\nThis property should not be changed after the rendering is complete.","values":[{"name":"united"},{"name":"slotted"},{"name":"field"}]},{"name":"cache","description":"Cache accessed records.\nEmptied at each re-collection.","values":[]}],"references":[]},{"name":"godown-rotate","description":"Rotate Make child elements rotate.\n---\n### **Methods:**\n ","attributes":[],"references":[]},{"name":"godown-range","description":"Range is similar to `<input type=\"range\">`.\nValue accepts number, or array.\nNumber has 1 handle, the array has the number of its elements and the minimum is 2.\n---\n### **Events:**\n - **focus** - Fires when the handle is focused.\n- **blur** - Fires when the handle is blurred.\n- **range** - Fires when the value changes.\n- **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.\n### **Methods:**\n \n- **normalizeValue(value: _number_): _number_** - Ensure that the values do not exceed the range of max and min.","attributes":[{"name":"min","description":"Minimum value.","values":[]},{"name":"max","description":"Maximum value.","values":[]},{"name":"step","description":"Sliding step length.","values":[]},{"name":"vertical","description":"Display vertically.","values":[]},{"name":"value","description":"Value, or each of values, will render a handle.\nAccepts number or array of numbers.","values":[]},{"name":"default","description":"The default of `this.value`.","values":[]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]}],"references":[]},{"name":"godown-progress","description":"Progress similar to `<progress>`.\n---\n### **Methods:**\n - **parsePercent(s: _string | number_): __** - Convert s to a percentage without a percent sign.","attributes":[{"name":"max","values":[]},{"name":"min","values":[]},{"name":"value","values":[]}],"references":[]},{"name":"godown-link","description":"Link is used for link jumping.\nSet `type` to `\"push\" `or `\"replace\"`,\nwill invoke the history api and trigger the Router.updateAll.\n---\n","attributes":[{"name":"type","description":"If \"push\", call `history.pushState`.\nIf \"replace\", call `history.replaceState`.\nIf \"normal\", behave like a normal anchor.","values":[{"name":"push"},{"name":"replace"},{"name":"normal"}]},{"name":"suppress","description":"Suppress the update of the Router.","values":[]},{"name":"href","description":"A element href.","values":[]},{"name":"target","description":"A element target.","values":[{"name":"_blank"},{"name":"_self"},{"name":"_parent"},{"name":"_top"}]}],"references":[]},{"name":"godown-layout","description":"Layout renders slot and optional top header, bottom footer.\n---\n### **Slots:**\n - _default_ - The main content of the layout.\n- **header** - The header of the layout.\n- **footer** - The footer of the layout.","attributes":[{"name":"noHeader","description":"If true, remove the header slot.","values":[]},{"name":"noFooter","description":"If true, remove the footer slot.","values":[]},{"name":"sticky","description":"If true, header will sticky.","values":[]}],"references":[]},{"name":"godown-input","description":"Input renders a text input.\n---\n### **Events:**\n - **input** - Fires when the input value changes.\n- **change** - Fires when the input value changes.","attributes":[{"name":"variant","description":"If outline, the outline is always present.","values":[{"name":"default"},{"name":"outline"}]},{"name":"autocomplete","values":[]},{"name":"disabled","values":[]},{"name":"type","values":[{"name":"InputType"}]},{"name":"placeholder","values":[]},{"name":"name","values":[]},{"name":"value","values":[]},{"name":"default","description":"default property records the default or initial value and is used to reset the input.","values":[]}],"references":[]},{"name":"godown-heading","description":"Heading renders a heading.\nIf the id is provided, the anchor will be displayed.\n---\n### **Slots:**\n - _default_ - Heading content.","attributes":[{"name":"as","description":"The heading level.","values":[{"name":"h1"},{"name":"h2"},{"name":"h3"},{"name":"h4"},{"name":"h5"},{"name":"h6"}]},{"name":"anchor","description":"The anchor prefix.","values":[]},{"name":"side","description":"The anchor side.","values":[{"name":"left"},{"name":"right"}]}],"references":[]},{"name":"godown-grid","description":"Grid provides gird layout.\n---\n### **Slots:**\n - _default_ - Grid items.","attributes":[{"name":"gap","description":"CSS property `gap`.","values":[]},{"name":"columns","description":"CSS property `grid-template-columns`.\nIf columns is numerical, divide columns equally.","values":[]},{"name":"rows","description":"CSS property `grid-template-rows`.\nIf rows is numerical, divide rows equally.","values":[]},{"name":"content","description":"CSS property `place-content` (`align-content justify-content`).","values":[]},{"name":"items","description":"CSS property `place-items` (`align-items justify-items`).","values":[]}],"references":[]},{"name":"godown-form","description":"Form Gets child element key-value object,\nwhich will be nested if the child element is the same as this element.\n---\n","attributes":[{"name":"name","values":[]}],"references":[]},{"name":"godown-flex","description":"Flex provides flex layout.\n---\n### **Slots:**\n - _default_ - Flex items.","attributes":[{"name":"flex-flow","description":"CSS property `flex-flow` (`flex-direction flex-wrap`).","values":[]},{"name":"gap","description":"CSS property `gap`.","values":[]},{"name":"content","description":"CSS property `justify-content`.","values":[]},{"name":"items","description":"CSS property `align-items`.","values":[]},{"name":"vertical","description":"If true, set flex-direction to \"column\".","values":[]}],"references":[]},{"name":"godown-dragbox","description":"Dragbox does not extend beyond the range of Dragbox.offsetsWidth and Dragbox.offsetsHeight.\n---\n","attributes":[{"name":"x","description":"Position x.","values":[]},{"name":"y","description":"Position y.","values":[]}],"references":[]},{"name":"godown-divider","description":"Divider similar to `<hr>`.\n---\n","attributes":[{"name":"vertical","description":"Vertical display.","values":[]}],"references":[]},{"name":"godown-dialog","description":"Dialog similar to `<dialog>`.\nLike dialog, it listens for submit events and closes itself when the target method is \"dialog\".\nIt listens for the keydown event and also closes itself when the key contained in the key is pressed.\n---\n### **Events:**\n - **change** - Fires when the open changes.","attributes":[{"name":"modal","description":"Enable modal, blocking event penetration.","values":[]},{"name":"key","description":"Close key.","values":[]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-details","description":"Details similar to `<details>`.\n---\n### **Events:**\n - **change** - Fires when the open changes.\n### **Slots:**\n - **summary** - Details summary if no `summary` is provided.\n- _default_ - Details content.","attributes":[{"name":"fill","description":"If it is true, the summary event scope will fill the element.","values":[]},{"name":"summary","description":"Summary text.","values":[]},{"name":"open","description":"Open the content.","values":[]}],"references":[]},{"name":"godown-carousel","description":"Carousel make the content display as a carousel.\nWhen this component is `firstUpdated`,\nclone the first and last element and make the matching element visible when switching index.\nChild elements should maintain the same size.\nIf no width, it will be the width of the first element.\n---\n### **Events:**\n - **change** - Fires when the index changes.\n### **Slots:**\n - _default_ - Carousel items, should maintain the same size.","attributes":[{"name":"index","description":"The index of the element is displayed for the first time.","values":[]},{"name":"autoChange","description":"If autoChange > 0, the rotation will be automated.","values":[]},{"name":"width","description":"Element width.","values":[]}],"references":[]},{"name":"godown-card","description":"Card renders a card.\nThis may be similar to Layout,\nbut it needs to be specified to enable header and footer.\n---\n### **Slots:**\n - _default_ - The main content of the card.\n- **header** - The header of the card.\n- **footer** - The footer of the card.","attributes":[{"name":"footer","values":[]},{"name":"header","values":[]}],"references":[]},{"name":"godown-button","description":"Button renders a button.\nCreate modal animation upon clicking.\nAvailable colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.\nDefault color is `black`.\nSet the color to `none` to prevent applying styles.\n---\n","attributes":[{"name":"disabled","description":"Whether to disable this element.","values":[]},{"name":"ghost","description":"Display ghost.","values":[]},{"name":"active","description":"Whether this element is active or not.","values":[]},{"name":"round","description":"Display rounded.","values":[]},{"name":"color","description":"The primary color.","values":[{"name":"none"},{"name":"keyof typeof colors"}]},{"name":"content","description":"Content text.","values":[]}],"references":[]},{"name":"godown-breath","description":"Breath render the text with a breathing effect.\nDynamically generate a breathing effect based on the length of the split text.\nIf there is not enough CSS variable, overrun elements will use the.\ngodown was a css library in its earliest days,\nand this is the component version of its first effect.\nInspired by Vercel home page (2023).\n---\n### **Slots:**\n - _default_ - Breathing parts.","attributes":[{"name":"content","description":"Strings or array of strings,\nif array, divided each element into chunks,\notherwise split strings by whitespace.","values":[{"name":"string[]"}]},{"name":"duration","description":"Effect duration, ending in s or ms.","values":[]}],"references":[]},{"name":"godown-badge","description":"Badge renders a badge.\n---\n### **Slots:**\n - _default_ - Badge content.","attributes":[{"name":"position","values":[{"name":"Position"}]},{"name":"value","values":[]},{"name":"dot","description":"If `true`, render a dot badge.","values":[]},{"name":"max","values":[]}],"references":[]},{"name":"godown-avatar","description":"Avatar renders a avatar.\nRenders as an image if it has a src property,\notherwise falls back to name or nameless slot.\n---\n### **Slots:**\n - _default_ - Display content if no `src` or `name` provided.","attributes":[{"name":"src","description":"Image src.","values":[]},{"name":"name","description":"If the image is not available, display name (call Avatar.format).","values":[]},{"name":"round","description":"Display rounded.","values":[]}],"references":[]},{"name":"godown-alert","description":"Alert renders a alert.\nColor defaults to blue.\n---\n### **Events:**\n - **close** - Fires when the alert is closed.\n### **Slots:**\n - _default_ - Alert content.\n- **title** - Alert title.\n- **icon** - Alert icon.","attributes":[{"name":"call","description":"If it is a legal value, the icon and preset color will be rendered.","values":[{"name":"tip"},{"name":"success"},{"name":"info"},{"name":"warning"},{"name":"danger"},{"name":"error"},{"name":"help"},{"name":"deprecated"}]},{"name":"color","description":"The tone of the component.\nOverrides the color of the call.","values":[{"name":""},{"name":"white"},{"name":"black"},{"name":"gray"},{"name":"green"},{"name":"teal"},{"name":"blue"},{"name":"red"},{"name":"purple"},{"name":"orange"},{"name":"yellow"},{"name":"pink"},{"name":"none"}]},{"name":"autoclose","description":"Close delay, if 0, it will not be closed automatically.","values":[]},{"name":"title","description":"The title is bold and the icon height is the same as it.","values":[]},{"name":"content","description":"Content, if zero value, will be rendered as an unnamed slot.","values":[]},{"name":"hideClose","description":"Set true to hide the close button.\nThe behavior may change due to the variant property.","values":[]},{"name":"variant","description":"Alert variant, if set to `blockquote`, the alert will be rendered as a blockquote.\nIf variant is `\"blockquote\"`, hide the close button.\n! __\"light\" will be deprecated__ in the future.","values":[{"name":"blockquote"},{"name":"dark"},{"name":"light"}]}],"references":[]}]}
|