godown 3.0.2 → 3.2.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/README.md +2 -2
- 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/link.d.ts +34 -7
- package/components/link.d.ts.map +1 -1
- package/components/link.js +1 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -1
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +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 +9 -5
- 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/split.js +1 -1
- package/components/split.js.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 +2 -0
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -1
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +1 -0
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -1
- package/core/super-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/link.d.ts +34 -7
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +70 -12
- package/dev/components/link.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 +11 -11
- 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 +9 -5
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +26 -24
- 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 +1 -8
- 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 +2 -0
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +4 -4
- 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 +3 -3
- 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/link.ts +75 -12
- package/src/components/progress.ts +13 -3
- package/src/components/range.ts +13 -13
- package/src/components/rotate.ts +1 -1
- package/src/components/router.ts +30 -26
- package/src/components/select.ts +6 -6
- package/src/components/split.ts +2 -10
- package/src/components/time.ts +3 -2
- package/src/core/global-style.ts +1 -0
- package/src/core/super-anchor.ts +6 -1
- 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/link.ts
CHANGED
@@ -6,41 +6,104 @@ import Router from "./router.js";
|
|
6
6
|
|
7
7
|
const protoName = "link";
|
8
8
|
|
9
|
+
const linkTypes = {
|
10
|
+
push: "push",
|
11
|
+
replace: "replace",
|
12
|
+
normal: "normal",
|
13
|
+
auto: "auto",
|
14
|
+
} as const;
|
15
|
+
|
16
|
+
type LinkType = keyof typeof linkTypes;
|
17
|
+
|
9
18
|
/**
|
10
|
-
* {@linkcode Link} is used for link jumping.
|
19
|
+
* {@linkcode Link} is used for link jumping, works standalone or in {@linkcode Router}.
|
20
|
+
*
|
21
|
+
* Set `type` to `"normal"`,
|
22
|
+
* behave like a normal anchor.
|
11
23
|
*
|
12
24
|
* Set `type` to `"push" `or `"replace"`,
|
13
|
-
*
|
25
|
+
* update history state by `history.pushState` or `history.replaceState`,
|
26
|
+
* update all routers whether current pathname is registered or not.
|
27
|
+
*
|
28
|
+
* Set `type` to `"auto"`,
|
29
|
+
* only update the routers if the current pathname is registered,
|
30
|
+
* if not registered, behave like `"normal"`.
|
14
31
|
*
|
32
|
+
* `replace` property will enforce `history.replaceState`.
|
33
|
+
*
|
34
|
+
* @fires navigate - Fires when the link is clicked.
|
15
35
|
* @category navigation
|
16
36
|
*/
|
17
37
|
@godown(protoName)
|
18
38
|
class Link extends SuperAnchor {
|
19
39
|
/**
|
20
|
-
* If "
|
40
|
+
* If `"normal"`, behave like a normal anchor.
|
21
41
|
*
|
22
|
-
* If "
|
42
|
+
* If `"auto"` or `"push"`, call `history.pushState` if `replace` is false,
|
23
43
|
*
|
24
|
-
* If "
|
44
|
+
* If `"replace"`, call `history.replaceState`.
|
25
45
|
*/
|
26
46
|
@property()
|
27
|
-
type:
|
47
|
+
type: LinkType = linkTypes.auto;
|
28
48
|
|
29
49
|
/**
|
30
|
-
*
|
50
|
+
* If `true`, the {@linkcode Router} will not be updated.
|
31
51
|
*/
|
32
52
|
@property({ type: Boolean })
|
33
53
|
suppress = false;
|
34
54
|
|
55
|
+
/**
|
56
|
+
* Use `replaceState` instead of `pushState`.
|
57
|
+
*/
|
58
|
+
@property({ type: Boolean })
|
59
|
+
replace = false;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Location state object.
|
63
|
+
*/
|
64
|
+
state = {};
|
65
|
+
|
35
66
|
protected _handleClick(e: MouseEvent): void {
|
36
|
-
|
67
|
+
const { state, type, href, pathname, suppress } = this;
|
68
|
+
this.dispatchCustomEvent("navigate", {
|
69
|
+
...this.observedRecord,
|
70
|
+
pathname,
|
71
|
+
state,
|
72
|
+
});
|
73
|
+
if (href.startsWith("#") || type === linkTypes.normal) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
this.handleState();
|
77
|
+
const routers = [...Router.routerInstances];
|
78
|
+
if (
|
79
|
+
// only runs when suppress is false
|
80
|
+
!suppress &&
|
81
|
+
(type !== linkTypes.auto ||
|
82
|
+
// in auto mode, only update the routers if the current pathname is registered
|
83
|
+
routers.some((i) => i.search(location.pathname)))
|
84
|
+
) {
|
37
85
|
e.preventDefault();
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
86
|
+
Router.routerInstances.forEach((i) => {
|
87
|
+
i.handlePopstate();
|
88
|
+
});
|
42
89
|
}
|
43
90
|
}
|
91
|
+
|
92
|
+
handleState: () => void = () => {
|
93
|
+
switch (this.type) {
|
94
|
+
case linkTypes.auto:
|
95
|
+
// biome-ignore lint: if replace is true, fallthrough to replace case
|
96
|
+
case linkTypes.push:
|
97
|
+
if (!this.replace) {
|
98
|
+
// type is auto or push and replace is false
|
99
|
+
history.pushState(this.state, "", this.href);
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
case linkTypes.replace:
|
103
|
+
history.replaceState(this.state, "", this.href);
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
};
|
44
107
|
}
|
45
108
|
|
46
109
|
export default Link;
|
@@ -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
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr, classList, godown, isNil, joinProperties, part, styles } from "@godown/element";
|
1
|
+
import { attr, classList, godown, isNil, joinProperties, loop, part, styles } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property, queryAll, state } from "lit/decorators.js";
|
4
4
|
|
@@ -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
|
-
${
|
226
|
+
${loop(this.rangeValue.length, (index) => this._renderHandle(index))}
|
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
@@ -21,6 +21,14 @@ interface RouteItem {
|
|
21
21
|
component?: unknown;
|
22
22
|
}
|
23
23
|
|
24
|
+
const routerTypes = {
|
25
|
+
field: "field",
|
26
|
+
slotted: "slotted",
|
27
|
+
united: "united",
|
28
|
+
} as const;
|
29
|
+
|
30
|
+
type RouterType = keyof typeof routerTypes;
|
31
|
+
|
24
32
|
const protoName = "router";
|
25
33
|
|
26
34
|
/**
|
@@ -101,7 +109,7 @@ class Router extends GlobalStyle {
|
|
101
109
|
* This property should not be changed after the rendering is complete.
|
102
110
|
*/
|
103
111
|
@property()
|
104
|
-
type:
|
112
|
+
type: RouterType = routerTypes.united;
|
105
113
|
|
106
114
|
/**
|
107
115
|
* Cache accessed records.
|
@@ -126,22 +134,23 @@ class Router extends GlobalStyle {
|
|
126
134
|
}
|
127
135
|
|
128
136
|
protected render(): unknown {
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
}
|
137
|
+
let cached: RouteResult | undefined;
|
138
|
+
if (this.cache && (cached = this.__cacheRecord.get(this.pathname))) {
|
139
|
+
this.component = cached.component;
|
140
|
+
this.path = cached.path;
|
141
|
+
this.pathname = cached.pathname;
|
135
142
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
143
|
+
if (!cached) {
|
144
|
+
switch (this.type) {
|
145
|
+
case routerTypes.field:
|
146
|
+
this.component = this.fieldComponent();
|
147
|
+
break;
|
148
|
+
case routerTypes.slotted:
|
149
|
+
this.component = this.slottedComponent();
|
150
|
+
break;
|
151
|
+
default:
|
152
|
+
this.component = this.fieldComponent() ?? this.slottedComponent();
|
153
|
+
}
|
145
154
|
}
|
146
155
|
return this.component ?? this.default;
|
147
156
|
}
|
@@ -175,20 +184,13 @@ class Router extends GlobalStyle {
|
|
175
184
|
};
|
176
185
|
}
|
177
186
|
|
178
|
-
/**
|
179
|
-
* Callback function when the route changes.
|
180
|
-
*/
|
181
|
-
routeChangeCallback: (params: RouteResult, first: boolean) => void = null;
|
182
|
-
|
183
187
|
protected updated(changedProperties: PropertyValueMap<this>): void {
|
184
188
|
const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
|
185
189
|
if (shouldDispatch) {
|
186
190
|
const ur = this.useRouter();
|
187
|
-
|
188
|
-
if (noRecord) {
|
191
|
+
if (!this.__cacheRecord.has(this.pathname) && this.path) {
|
189
192
|
this.__cacheRecord.set(this.pathname, ur);
|
190
193
|
}
|
191
|
-
this.routeChangeCallback?.(ur, noRecord);
|
192
194
|
this.dispatchEvent(new CustomEvent("change", { detail: ur }));
|
193
195
|
}
|
194
196
|
}
|
@@ -209,8 +211,6 @@ class Router extends GlobalStyle {
|
|
209
211
|
return null;
|
210
212
|
}
|
211
213
|
|
212
|
-
console.log(this.path);
|
213
|
-
|
214
214
|
if ("render" in route) {
|
215
215
|
return route.render?.(omit(this.useRouter(), "component")) || null;
|
216
216
|
}
|
@@ -266,6 +266,10 @@ class Router extends GlobalStyle {
|
|
266
266
|
});
|
267
267
|
}
|
268
268
|
|
269
|
+
search(pathname: string): RouteTree {
|
270
|
+
return this.__fieldRouteTree.search(pathname) || this.__slottedRouteTree.search(pathname);
|
271
|
+
}
|
272
|
+
|
269
273
|
handlePopstate: () => void = this.events.add(window, "popstate", () => {
|
270
274
|
this.pathname = location.pathname;
|
271
275
|
});
|
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
|
-
import { type HandlerEvent, attr, classList, godown, styles } from "@godown/element";
|
2
|
-
import { type TemplateResult, css, html
|
1
|
+
import { type HandlerEvent, attr, classList, godown, styles, loop } from "@godown/element";
|
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";
|
@@ -8,14 +8,6 @@ import SuperInput from "../core/super-input.js";
|
|
8
8
|
const protoName = "split";
|
9
9
|
const cssScope = scopePrefix(protoName);
|
10
10
|
|
11
|
-
const loop = <T>(len: number, fn: (index?: number) => T) => {
|
12
|
-
const result: T[] = new Array(len);
|
13
|
-
for (let index = 0; index < len; index++) {
|
14
|
-
result[index] = fn(index);
|
15
|
-
}
|
16
|
-
return result;
|
17
|
-
};
|
18
|
-
|
19
11
|
/**
|
20
12
|
* {@linkcode Split} renders multiple input boxes.
|
21
13
|
*
|
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
@@ -28,13 +28,17 @@ class SuperAnchor extends GlobalStyle {
|
|
28
28
|
* A element href.
|
29
29
|
*/
|
30
30
|
@property()
|
31
|
-
href: string
|
31
|
+
href: string;
|
32
32
|
/**
|
33
33
|
* A element target.
|
34
34
|
*/
|
35
35
|
@property()
|
36
36
|
target: "_blank" | "_self" | "_parent" | "_top" = "_self";
|
37
37
|
|
38
|
+
get pathname(): string {
|
39
|
+
return new URL(this.href, location.href).pathname;
|
40
|
+
}
|
41
|
+
|
38
42
|
protected render(): TemplateResult<1> {
|
39
43
|
return html`
|
40
44
|
<a
|
@@ -53,3 +57,4 @@ class SuperAnchor extends GlobalStyle {
|
|
53
57
|
}
|
54
58
|
|
55
59
|
export default SuperAnchor;
|
60
|
+
export { SuperAnchor };
|
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":"RouterType"}]},{"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, works standalone or in Router.\nSet `type` to `\"normal\"`,\nbehave like a normal anchor.\nSet `type` to `\"push\" `or `\"replace\"`,\nupdate history state by `history.pushState` or `history.replaceState`,\nupdate all routers whether current pathname is registered or not.\nSet `type` to `\"auto\"`,\nonly update the routers if the current pathname is registered,\nif not registered, behave like `\"normal\"`.\n`replace` property will enforce `history.replaceState`.\n---\n### **Events:**\n - **navigate** - Fires when the link is clicked.","attributes":[{"name":"type","description":"If `\"normal\"`, behave like a normal anchor.\nIf `\"auto\"` or `\"push\"`, call `history.pushState` if `replace` is false,\nIf `\"replace\"`, call `history.replaceState`.","values":[{"name":"LinkType"}]},{"name":"suppress","description":"If `true`, the Router will not be updated.","values":[]},{"name":"replace","description":"Use `replaceState` instead of `pushState`.","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":[]}]}
|