godown 3.4.0 → 3.5.1
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 +2 -2
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +2 -2
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +2 -2
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +5 -5
- package/build/godown.js +4 -4
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +5 -5
- package/build/godown.umd.js.map +1 -1
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -1
- package/components/avatar.js.map +1 -1
- package/components/badge.js +1 -1
- package/components/badge.js.map +1 -1
- package/components/button.js +1 -1
- package/components/button.js.map +1 -1
- package/components/card.js +1 -1
- package/components/card.js.map +1 -1
- package/components/details.js +1 -1
- package/components/details.js.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +1 -1
- package/components/divider.js.map +1 -1
- package/components/range.d.ts +7 -6
- package/components/range.d.ts.map +1 -1
- package/components/range.js.map +1 -1
- package/components/split.js +1 -1
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +5 -13
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +1 -1
- package/components/switch.js.map +1 -1
- package/core/global-style.js +1 -1
- package/core/super-input.d.ts +2 -2
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -1
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts +0 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/package.json +6 -18
- package/src/components/avatar.ts +2 -1
- package/src/components/button.ts +2 -3
- package/src/components/card.ts +4 -0
- package/src/components/details.ts +1 -1
- package/src/components/dialog.ts +4 -6
- package/src/components/divider.ts +2 -1
- package/src/components/range.ts +13 -11
- package/src/components/split.ts +2 -1
- package/src/components/switch.ts +43 -60
- package/src/core/global-style.ts +2 -2
- package/src/core/super-input.ts +13 -8
- package/src/core/super-openable.ts +0 -4
- package/tsconfig.json +33 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
- package/dev/alert.d.ts +0 -9
- package/dev/alert.d.ts.map +0 -1
- package/dev/alert.js +0 -5
- package/dev/alert.js.map +0 -1
- package/dev/avatar.d.ts +0 -9
- package/dev/avatar.d.ts.map +0 -1
- package/dev/avatar.js +0 -5
- package/dev/avatar.js.map +0 -1
- package/dev/badge.d.ts +0 -9
- package/dev/badge.d.ts.map +0 -1
- package/dev/badge.js +0 -5
- package/dev/badge.js.map +0 -1
- package/dev/breath.d.ts +0 -9
- package/dev/breath.d.ts.map +0 -1
- package/dev/breath.js +0 -5
- package/dev/breath.js.map +0 -1
- package/dev/button.d.ts +0 -9
- package/dev/button.d.ts.map +0 -1
- package/dev/button.js +0 -5
- package/dev/button.js.map +0 -1
- package/dev/card.d.ts +0 -9
- package/dev/card.d.ts.map +0 -1
- package/dev/card.js +0 -5
- package/dev/card.js.map +0 -1
- package/dev/carousel.d.ts +0 -9
- package/dev/carousel.d.ts.map +0 -1
- package/dev/carousel.js +0 -5
- package/dev/carousel.js.map +0 -1
- package/dev/components/alert.d.ts +0 -55
- package/dev/components/alert.d.ts.map +0 -1
- package/dev/components/alert.js +0 -236
- package/dev/components/alert.js.map +0 -1
- package/dev/components/avatar.d.ts +0 -33
- package/dev/components/avatar.d.ts.map +0 -1
- package/dev/components/avatar.js +0 -118
- package/dev/components/avatar.js.map +0 -1
- package/dev/components/badge.d.ts +0 -31
- package/dev/components/badge.d.ts.map +0 -1
- package/dev/components/badge.js +0 -122
- package/dev/components/badge.js.map +0 -1
- package/dev/components/breath.d.ts +0 -36
- package/dev/components/breath.d.ts.map +0 -1
- package/dev/components/breath.js +0 -135
- package/dev/components/breath.js.map +0 -1
- package/dev/components/button.d.ts +0 -60
- package/dev/components/button.d.ts.map +0 -1
- package/dev/components/button.js +0 -288
- package/dev/components/button.js.map +0 -1
- package/dev/components/card.d.ts +0 -27
- package/dev/components/card.d.ts.map +0 -1
- package/dev/components/card.js +0 -83
- package/dev/components/card.js.map +0 -1
- package/dev/components/carousel.d.ts +0 -39
- package/dev/components/carousel.d.ts.map +0 -1
- package/dev/components/carousel.js +0 -184
- package/dev/components/carousel.js.map +0 -1
- package/dev/components/details.d.ts +0 -24
- package/dev/components/details.d.ts.map +0 -1
- package/dev/components/details.js +0 -124
- package/dev/components/details.js.map +0 -1
- package/dev/components/dialog.d.ts +0 -43
- package/dev/components/dialog.d.ts.map +0 -1
- package/dev/components/dialog.js +0 -154
- package/dev/components/dialog.js.map +0 -1
- package/dev/components/divider.d.ts +0 -17
- package/dev/components/divider.d.ts.map +0 -1
- package/dev/components/divider.js +0 -63
- package/dev/components/divider.js.map +0 -1
- package/dev/components/dragbox.d.ts +0 -42
- package/dev/components/dragbox.d.ts.map +0 -1
- package/dev/components/dragbox.js +0 -126
- package/dev/components/dragbox.js.map +0 -1
- package/dev/components/flex.d.ts +0 -34
- package/dev/components/flex.d.ts.map +0 -1
- package/dev/components/flex.js +0 -73
- package/dev/components/flex.js.map +0 -1
- package/dev/components/form.d.ts +0 -24
- package/dev/components/form.d.ts.map +0 -1
- package/dev/components/form.js +0 -76
- package/dev/components/form.js.map +0 -1
- package/dev/components/grid.d.ts +0 -38
- package/dev/components/grid.d.ts.map +0 -1
- package/dev/components/grid.js +0 -67
- package/dev/components/grid.js.map +0 -1
- package/dev/components/heading.d.ts +0 -31
- package/dev/components/heading.d.ts.map +0 -1
- package/dev/components/heading.js +0 -127
- package/dev/components/heading.js.map +0 -1
- package/dev/components/input.d.ts +0 -23
- package/dev/components/input.d.ts.map +0 -1
- package/dev/components/input.js +0 -99
- package/dev/components/input.js.map +0 -1
- package/dev/components/layout.d.ts +0 -28
- package/dev/components/layout.d.ts.map +0 -1
- package/dev/components/layout.js +0 -96
- package/dev/components/layout.js.map +0 -1
- package/dev/components/link.d.ts +0 -54
- package/dev/components/link.d.ts.map +0 -1
- package/dev/components/link.js +0 -110
- package/dev/components/link.js.map +0 -1
- package/dev/components/progress.d.ts +0 -16
- package/dev/components/progress.d.ts.map +0 -1
- package/dev/components/progress.js +0 -101
- package/dev/components/progress.js.map +0 -1
- package/dev/components/range.d.ts +0 -121
- package/dev/components/range.d.ts.map +0 -1
- package/dev/components/range.js +0 -391
- package/dev/components/range.js.map +0 -1
- package/dev/components/rotate.d.ts +0 -30
- package/dev/components/rotate.d.ts.map +0 -1
- package/dev/components/rotate.js +0 -93
- package/dev/components/rotate.js.map +0 -1
- package/dev/components/router.d.ts +0 -116
- package/dev/components/router.d.ts.map +0 -1
- package/dev/components/router.js +0 -240
- package/dev/components/router.js.map +0 -1
- package/dev/components/select.d.ts +0 -53
- package/dev/components/select.d.ts.map +0 -1
- package/dev/components/select.js +0 -269
- package/dev/components/select.js.map +0 -1
- package/dev/components/skeleton.d.ts +0 -28
- package/dev/components/skeleton.d.ts.map +0 -1
- package/dev/components/skeleton.js +0 -122
- package/dev/components/skeleton.js.map +0 -1
- package/dev/components/split.d.ts +0 -56
- package/dev/components/split.d.ts.map +0 -1
- package/dev/components/split.js +0 -219
- package/dev/components/split.js.map +0 -1
- package/dev/components/switch.d.ts +0 -40
- package/dev/components/switch.d.ts.map +0 -1
- package/dev/components/switch.js +0 -166
- package/dev/components/switch.js.map +0 -1
- package/dev/components/text.d.ts +0 -21
- package/dev/components/text.d.ts.map +0 -1
- package/dev/components/text.js +0 -96
- package/dev/components/text.js.map +0 -1
- package/dev/components/time.d.ts +0 -36
- package/dev/components/time.d.ts.map +0 -1
- package/dev/components/time.js +0 -75
- package/dev/components/time.js.map +0 -1
- package/dev/components/tooltip.d.ts +0 -51
- package/dev/components/tooltip.d.ts.map +0 -1
- package/dev/components/tooltip.js +0 -140
- package/dev/components/tooltip.js.map +0 -1
- package/dev/components/typewriter.d.ts +0 -49
- package/dev/components/typewriter.d.ts.map +0 -1
- package/dev/components/typewriter.js +0 -149
- package/dev/components/typewriter.js.map +0 -1
- package/dev/core/direction.d.ts +0 -27
- package/dev/core/direction.d.ts.map +0 -1
- package/dev/core/direction.js +0 -56
- package/dev/core/direction.js.map +0 -1
- package/dev/core/global-style.d.ts +0 -20
- package/dev/core/global-style.d.ts.map +0 -1
- package/dev/core/global-style.js +0 -82
- package/dev/core/global-style.js.map +0 -1
- package/dev/core/outline.d.ts +0 -20
- package/dev/core/outline.d.ts.map +0 -1
- package/dev/core/outline.js +0 -44
- package/dev/core/outline.js.map +0 -1
- package/dev/core/super-anchor.d.ts +0 -18
- package/dev/core/super-anchor.d.ts.map +0 -1
- package/dev/core/super-anchor.js +0 -60
- package/dev/core/super-anchor.js.map +0 -1
- package/dev/core/super-input.d.ts +0 -43
- package/dev/core/super-input.d.ts.map +0 -1
- package/dev/core/super-input.js +0 -197
- package/dev/core/super-input.js.map +0 -1
- package/dev/core/super-openable.d.ts +0 -16
- package/dev/core/super-openable.d.ts.map +0 -1
- package/dev/core/super-openable.js +0 -36
- package/dev/core/super-openable.js.map +0 -1
- package/dev/details.d.ts +0 -9
- package/dev/details.d.ts.map +0 -1
- package/dev/details.js +0 -5
- package/dev/details.js.map +0 -1
- package/dev/dialog.d.ts +0 -9
- package/dev/dialog.d.ts.map +0 -1
- package/dev/dialog.js +0 -5
- package/dev/dialog.js.map +0 -1
- package/dev/divider.d.ts +0 -9
- package/dev/divider.d.ts.map +0 -1
- package/dev/divider.js +0 -5
- package/dev/divider.js.map +0 -1
- package/dev/dragbox.d.ts +0 -9
- package/dev/dragbox.d.ts.map +0 -1
- package/dev/dragbox.js +0 -5
- package/dev/dragbox.js.map +0 -1
- package/dev/flex.d.ts +0 -9
- package/dev/flex.d.ts.map +0 -1
- package/dev/flex.js +0 -5
- package/dev/flex.js.map +0 -1
- package/dev/form.d.ts +0 -9
- package/dev/form.d.ts.map +0 -1
- package/dev/form.js +0 -5
- package/dev/form.js.map +0 -1
- package/dev/grid.d.ts +0 -9
- package/dev/grid.d.ts.map +0 -1
- package/dev/grid.js +0 -5
- package/dev/grid.js.map +0 -1
- package/dev/heading.d.ts +0 -9
- package/dev/heading.d.ts.map +0 -1
- package/dev/heading.js +0 -5
- package/dev/heading.js.map +0 -1
- package/dev/index.d.ts +0 -31
- package/dev/index.d.ts.map +0 -1
- package/dev/index.js +0 -31
- package/dev/index.js.map +0 -1
- package/dev/input.d.ts +0 -9
- package/dev/input.d.ts.map +0 -1
- package/dev/input.js +0 -5
- package/dev/input.js.map +0 -1
- package/dev/layout.d.ts +0 -9
- package/dev/layout.d.ts.map +0 -1
- package/dev/layout.js +0 -5
- package/dev/layout.js.map +0 -1
- package/dev/link.d.ts +0 -9
- package/dev/link.d.ts.map +0 -1
- package/dev/link.js +0 -5
- package/dev/link.js.map +0 -1
- package/dev/progress.d.ts +0 -9
- package/dev/progress.d.ts.map +0 -1
- package/dev/progress.js +0 -5
- package/dev/progress.js.map +0 -1
- package/dev/range.d.ts +0 -9
- package/dev/range.d.ts.map +0 -1
- package/dev/range.js +0 -5
- package/dev/range.js.map +0 -1
- package/dev/rotate.d.ts +0 -9
- package/dev/rotate.d.ts.map +0 -1
- package/dev/rotate.js +0 -5
- package/dev/rotate.js.map +0 -1
- package/dev/router.d.ts +0 -9
- package/dev/router.d.ts.map +0 -1
- package/dev/router.js +0 -5
- package/dev/router.js.map +0 -1
- package/dev/select.d.ts +0 -9
- package/dev/select.d.ts.map +0 -1
- package/dev/select.js +0 -5
- package/dev/select.js.map +0 -1
- package/dev/skeleton.d.ts +0 -9
- package/dev/skeleton.d.ts.map +0 -1
- package/dev/skeleton.js +0 -5
- package/dev/skeleton.js.map +0 -1
- package/dev/split.d.ts +0 -9
- package/dev/split.d.ts.map +0 -1
- package/dev/split.js +0 -5
- package/dev/split.js.map +0 -1
- package/dev/switch.d.ts +0 -9
- package/dev/switch.d.ts.map +0 -1
- package/dev/switch.js +0 -5
- package/dev/switch.js.map +0 -1
- package/dev/text.d.ts +0 -9
- package/dev/text.d.ts.map +0 -1
- package/dev/text.js +0 -5
- package/dev/text.js.map +0 -1
- package/dev/time.d.ts +0 -9
- package/dev/time.d.ts.map +0 -1
- package/dev/time.js +0 -5
- package/dev/time.js.map +0 -1
- package/dev/tooltip.d.ts +0 -9
- package/dev/tooltip.d.ts.map +0 -1
- package/dev/tooltip.js +0 -5
- package/dev/tooltip.js.map +0 -1
- package/dev/typewriter.d.ts +0 -9
- package/dev/typewriter.d.ts.map +0 -1
- package/dev/typewriter.js +0 -5
- package/dev/typewriter.js.map +0 -1
package/dev/components/link.js
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import { godown } from "@godown/element";
|
3
|
-
import { property } from "lit/decorators.js";
|
4
|
-
import { SuperAnchor } from "../core/super-anchor.js";
|
5
|
-
import Router from "./router.js";
|
6
|
-
const protoName = "link";
|
7
|
-
const linkTypes = {
|
8
|
-
push: "push",
|
9
|
-
replace: "replace",
|
10
|
-
normal: "normal",
|
11
|
-
auto: "auto",
|
12
|
-
};
|
13
|
-
/**
|
14
|
-
* {@linkcode Link} is used for link jumping, works standalone or in {@linkcode Router}.
|
15
|
-
*
|
16
|
-
* Set `type` to `"normal"`,
|
17
|
-
* behave like a normal anchor.
|
18
|
-
*
|
19
|
-
* Set `type` to `"push" `or `"replace"`,
|
20
|
-
* update history state by `history.pushState` or `history.replaceState`,
|
21
|
-
* update all routers whether current pathname is registered or not.
|
22
|
-
*
|
23
|
-
* Set `type` to `"auto"`,
|
24
|
-
* only update the routers if the current pathname is registered,
|
25
|
-
* if not registered, behave like `"normal"`.
|
26
|
-
*
|
27
|
-
* `replace` property will enforce `history.replaceState`.
|
28
|
-
*
|
29
|
-
* @fires navigate - Fires when the link is clicked.
|
30
|
-
* @category navigation
|
31
|
-
*/
|
32
|
-
let Link = class Link extends SuperAnchor {
|
33
|
-
constructor() {
|
34
|
-
super(...arguments);
|
35
|
-
/**
|
36
|
-
* If `"normal"`, behave like a normal anchor.
|
37
|
-
*
|
38
|
-
* If `"auto"` or `"push"`, call `history.pushState` if `replace` is false,
|
39
|
-
*
|
40
|
-
* If `"replace"`, call `history.replaceState`.
|
41
|
-
*/
|
42
|
-
this.type = linkTypes.auto;
|
43
|
-
/**
|
44
|
-
* If `true`, the {@linkcode Router} will not be updated.
|
45
|
-
*/
|
46
|
-
this.suppress = false;
|
47
|
-
/**
|
48
|
-
* Use `replaceState` instead of `pushState`.
|
49
|
-
*/
|
50
|
-
this.replace = false;
|
51
|
-
/**
|
52
|
-
* Location state object.
|
53
|
-
*/
|
54
|
-
this.state = {};
|
55
|
-
this.handleState = () => {
|
56
|
-
switch (this.type) {
|
57
|
-
case linkTypes.auto:
|
58
|
-
case linkTypes.push:
|
59
|
-
if (!this.replace) {
|
60
|
-
// type is auto or push and replace is false
|
61
|
-
history.pushState(this.state, "", this.href);
|
62
|
-
break;
|
63
|
-
}
|
64
|
-
// fallthrough to replace
|
65
|
-
case linkTypes.replace:
|
66
|
-
history.replaceState(this.state, "", this.href);
|
67
|
-
break;
|
68
|
-
}
|
69
|
-
};
|
70
|
-
}
|
71
|
-
_handleClick(e) {
|
72
|
-
const { state, type, href, pathname, suppress } = this;
|
73
|
-
this.dispatchCustomEvent("navigate", {
|
74
|
-
...this.observedRecord,
|
75
|
-
pathname,
|
76
|
-
state,
|
77
|
-
});
|
78
|
-
if (href.startsWith("#") || type === linkTypes.normal) {
|
79
|
-
return;
|
80
|
-
}
|
81
|
-
this.handleState();
|
82
|
-
const routers = [...Router.routerInstances];
|
83
|
-
if (
|
84
|
-
// only runs when suppress is false
|
85
|
-
!suppress &&
|
86
|
-
(type !== linkTypes.auto ||
|
87
|
-
// in auto mode, only update the routers if the current pathname is registered
|
88
|
-
routers.some((i) => i.search(location.pathname)))) {
|
89
|
-
e.preventDefault();
|
90
|
-
Router.routerInstances.forEach((i) => {
|
91
|
-
i.handlePopstate();
|
92
|
-
});
|
93
|
-
}
|
94
|
-
}
|
95
|
-
};
|
96
|
-
__decorate([
|
97
|
-
property()
|
98
|
-
], Link.prototype, "type", void 0);
|
99
|
-
__decorate([
|
100
|
-
property({ type: Boolean })
|
101
|
-
], Link.prototype, "suppress", void 0);
|
102
|
-
__decorate([
|
103
|
-
property({ type: Boolean })
|
104
|
-
], Link.prototype, "replace", void 0);
|
105
|
-
Link = __decorate([
|
106
|
-
godown(protoName)
|
107
|
-
], Link);
|
108
|
-
export default Link;
|
109
|
-
export { Link };
|
110
|
-
//# sourceMappingURL=link.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/components/link.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACJ,CAAC;AAIX;;;;;;;;;;;;;;;;;;GAkBG;AAEH,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,WAAW;IAA9B;;QACE;;;;;;WAMG;QAEH,SAAI,GAAa,SAAS,CAAC,IAAI,CAAC;QAEhC;;WAEG;QAEH,aAAQ,GAAG,KAAK,CAAC;QAEjB;;WAEG;QAEH,YAAO,GAAG,KAAK,CAAC;QAEhB;;WAEG;QACH,UAAK,GAAG,EAAE,CAAC;QA4BX,gBAAW,GAAe,GAAG,EAAE;YAC7B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,SAAS,CAAC,IAAI,CAAC;gBACpB,KAAK,SAAS,CAAC,IAAI;oBACjB,IAAI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,CAAC;IACH,CAAC;CAiBF,CAAA;AA5DC;IADC,QAAQ,EAAE;kCACqB;AAMhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACX;AAMjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCACZ;AArBZ,IAAI;IADT,MAAM,CAAC,SAAS,CAAC;GACZ,IAAI,CAqET;AAED,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { type TemplateResult } from "lit";
|
2
|
-
import { GlobalStyle } from "../core/global-style.js";
|
3
|
-
/**
|
4
|
-
* {@linkcode Progress} similar to `<progress>`.
|
5
|
-
*
|
6
|
-
* @category feedback
|
7
|
-
*/
|
8
|
-
declare class Progress extends GlobalStyle {
|
9
|
-
max: number;
|
10
|
-
min: number;
|
11
|
-
value: number;
|
12
|
-
protected render(): TemplateResult<1>;
|
13
|
-
}
|
14
|
-
export default Progress;
|
15
|
-
export { Progress };
|
16
|
-
//# sourceMappingURL=progress.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAIrE;;;;GAIG;AACH,cAgDM,QAAS,SAAQ,WAAW;IAEhC,GAAG,SAAK;IAGR,GAAG,SAAK;IAGR,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAqBtC;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -1,101 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import { attr, godown, isNil, Ranger, styles } from "@godown/element";
|
3
|
-
import { css, html } from "lit";
|
4
|
-
import { property } from "lit/decorators.js";
|
5
|
-
import { GlobalStyle, cssGlobalVars } from "../core/global-style.js";
|
6
|
-
const protoName = "progress";
|
7
|
-
/**
|
8
|
-
* {@linkcode Progress} similar to `<progress>`.
|
9
|
-
*
|
10
|
-
* @category feedback
|
11
|
-
*/
|
12
|
-
let Progress = class Progress extends GlobalStyle {
|
13
|
-
constructor() {
|
14
|
-
super(...arguments);
|
15
|
-
this.max = 1;
|
16
|
-
this.min = 0;
|
17
|
-
}
|
18
|
-
render() {
|
19
|
-
let width = 20;
|
20
|
-
let className;
|
21
|
-
if (!isNil(this.value)) {
|
22
|
-
const ranger = new Ranger(this.min, this.max);
|
23
|
-
width = ranger.restrict(this.value / ranger.diff) * 100;
|
24
|
-
className = "static";
|
25
|
-
}
|
26
|
-
return html `
|
27
|
-
<div
|
28
|
-
part="root"
|
29
|
-
${attr(this.observedRecord)}
|
30
|
-
class="${className}"
|
31
|
-
>
|
32
|
-
<i
|
33
|
-
part="value"
|
34
|
-
style="width:${width}%;"
|
35
|
-
></i>
|
36
|
-
</div>
|
37
|
-
`;
|
38
|
-
}
|
39
|
-
};
|
40
|
-
__decorate([
|
41
|
-
property({ type: Number })
|
42
|
-
], Progress.prototype, "max", void 0);
|
43
|
-
__decorate([
|
44
|
-
property({ type: Number })
|
45
|
-
], Progress.prototype, "min", void 0);
|
46
|
-
__decorate([
|
47
|
-
property({ type: Number })
|
48
|
-
], Progress.prototype, "value", void 0);
|
49
|
-
Progress = __decorate([
|
50
|
-
godown(protoName),
|
51
|
-
styles(css `
|
52
|
-
:host {
|
53
|
-
width: 100%;
|
54
|
-
height: 0.5em;
|
55
|
-
border-radius: 0.25em;
|
56
|
-
background: var(${cssGlobalVars.passive});
|
57
|
-
color: var(${cssGlobalVars.active});
|
58
|
-
}
|
59
|
-
|
60
|
-
:host,
|
61
|
-
[part="root"] {
|
62
|
-
display: block;
|
63
|
-
}
|
64
|
-
|
65
|
-
[part="root"] {
|
66
|
-
height: inherit;
|
67
|
-
z-index: 1;
|
68
|
-
position: relative;
|
69
|
-
border-radius: inherit;
|
70
|
-
overflow: hidden;
|
71
|
-
}
|
72
|
-
|
73
|
-
[part="value"] {
|
74
|
-
position: absolute;
|
75
|
-
z-index: 2;
|
76
|
-
top: 0;
|
77
|
-
left: 0;
|
78
|
-
height: 100%;
|
79
|
-
border-radius: inherit;
|
80
|
-
transition: all 0.3s;
|
81
|
-
animation: progress 1.8s ease-in-out infinite alternate;
|
82
|
-
background: currentColor;
|
83
|
-
}
|
84
|
-
|
85
|
-
@keyframes progress {
|
86
|
-
from {
|
87
|
-
left: 0;
|
88
|
-
}
|
89
|
-
to {
|
90
|
-
left: 80%;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
.static [part="value"] {
|
95
|
-
animation: none;
|
96
|
-
}
|
97
|
-
`)
|
98
|
-
], Progress);
|
99
|
-
export default Progress;
|
100
|
-
export { Progress };
|
101
|
-
//# sourceMappingURL=progress.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/components/progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B;;;;GAIG;AAiDH,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,WAAW;IAAlC;;QAEE,QAAG,GAAG,CAAC,CAAC;QAGR,QAAG,GAAG,CAAC,CAAC;IA0BV,CAAC;IArBW,MAAM;QACd,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,SAAiB,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9C,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YACxD,SAAS,GAAG,QAAQ,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAA;;;UAGL,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;iBAClB,SAAS;;;;yBAID,KAAK;;;KAGzB,CAAC;IACJ,CAAC;CACF,CAAA;AA7BC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACnB;AAGR;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACnB;AAGR;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACb;AARV,QAAQ;IAhDb,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CAAC,GAAG,CAAA;;;;;sBAKW,aAAa,CAAC,OAAO;iBAC1B,aAAa,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpC,CAAC;GACI,QAAQ,CA+Bb;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -1,121 +0,0 @@
|
|
1
|
-
import { Ranger } from "@godown/element";
|
2
|
-
import { type TemplateResult } from "lit";
|
3
|
-
import { SuperInput } from "../core/super-input.js";
|
4
|
-
/**
|
5
|
-
* {@linkcode Range} is similar to `<input type="range">`.
|
6
|
-
*
|
7
|
-
* Value accepts number, or array.
|
8
|
-
*
|
9
|
-
* Number has 1 handle, the array has the number of its elements.
|
10
|
-
*
|
11
|
-
* @fires input - Fires when the input value changes.
|
12
|
-
* @fires change - Fires when the input value changes.
|
13
|
-
* @fires range - Fires when the value changes.
|
14
|
-
* @fires focus - Fires when the handle is focused.
|
15
|
-
* @fires blur - Fires when the handle is blurred.
|
16
|
-
* @category input
|
17
|
-
*/
|
18
|
-
declare class Range extends SuperInput {
|
19
|
-
/**
|
20
|
-
* Minimum value.
|
21
|
-
*/
|
22
|
-
min: number;
|
23
|
-
/**
|
24
|
-
* Maximum value.
|
25
|
-
*/
|
26
|
-
max: number;
|
27
|
-
/**
|
28
|
-
* Sliding step length.
|
29
|
-
*/
|
30
|
-
step: number;
|
31
|
-
/**
|
32
|
-
* Whether to display the range vertically.
|
33
|
-
*/
|
34
|
-
vertical: boolean;
|
35
|
-
/**
|
36
|
-
* Value, or each of values, will render a handle.
|
37
|
-
*
|
38
|
-
* Accepts number or array of numbers.
|
39
|
-
*/
|
40
|
-
value: number | number[];
|
41
|
-
/**
|
42
|
-
* The default of `{@linkcode this.value}`.
|
43
|
-
*/
|
44
|
-
default: typeof this.value;
|
45
|
-
protected _root: HTMLElement;
|
46
|
-
protected _handles: NodeListOf<HTMLElement>;
|
47
|
-
lastFocus?: number;
|
48
|
-
protected _ranger: Ranger;
|
49
|
-
private __focusStack;
|
50
|
-
get range(): boolean;
|
51
|
-
/**
|
52
|
-
* Return values in the form of an array.
|
53
|
-
*/
|
54
|
-
get rangeValue(): number[];
|
55
|
-
/**
|
56
|
-
* Pad the value to the specified length.
|
57
|
-
*/
|
58
|
-
padValue(len: number, value?: number): number[];
|
59
|
-
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
60
|
-
get observedRecord(): Record<string, any>;
|
61
|
-
protected render(): TemplateResult<1>;
|
62
|
-
protected _renderHandle(index: number): TemplateResult<1>;
|
63
|
-
private __keydownEvent;
|
64
|
-
/**
|
65
|
-
* Focuses the handle at the given index, updates the focus stack, and dispatches a "focus" event.
|
66
|
-
* @param index - The index of the handle to focus.
|
67
|
-
*/
|
68
|
-
focusHandle(index: number): void;
|
69
|
-
/**
|
70
|
-
* Removes the focus from the currently focused handle and dispatches a "blur" event.
|
71
|
-
*/
|
72
|
-
blurHandle(): void;
|
73
|
-
/**
|
74
|
-
* Creates a keydown event handler that updates the value of the range based on arrow key presses.
|
75
|
-
* @param index - The index of the handle to update.
|
76
|
-
* @returns A function that handles the keydown event and updates the range value.
|
77
|
-
*/
|
78
|
-
protected createKeydownEvent(index: number): (e: KeyboardEvent) => void;
|
79
|
-
/**
|
80
|
-
* Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
|
81
|
-
* @param index - The index of the handle to focus.
|
82
|
-
* @returns A function that handles the mouse down event and updates the range value.
|
83
|
-
*/
|
84
|
-
protected createMouseDown(index: number): (e: MouseEvent) => void;
|
85
|
-
/**
|
86
|
-
* Creates a function that sets the value of the range at the given index.
|
87
|
-
* @param index - The index of the value to set.
|
88
|
-
* @returns A function that sets the value of the range.
|
89
|
-
*/
|
90
|
-
protected createSetValue(index: number): (value: number) => void;
|
91
|
-
/**
|
92
|
-
* Compute value from event.
|
93
|
-
* @returns The value closest to the event client position.
|
94
|
-
*/
|
95
|
-
protected _computeValue({ clientX, clientY }: MouseEvent): number;
|
96
|
-
/**
|
97
|
-
* Handles the mouse down event on the root element of the range component.
|
98
|
-
* Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.
|
99
|
-
* @param e - The mouse down event object.
|
100
|
-
*/
|
101
|
-
protected _handleMousedownRoot(e: MouseEvent): void;
|
102
|
-
/**
|
103
|
-
* Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
|
104
|
-
* @param index - The index of the handle to focus.
|
105
|
-
* @returns A function that handles the mouse down event and updates the range value.
|
106
|
-
*/
|
107
|
-
protected createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
|
108
|
-
/**
|
109
|
-
* Creates a mouse move event handler that updates the range value based on the mouse position.
|
110
|
-
* @param callback - A function to call with the new value when the mouse is moved.
|
111
|
-
* @returns A function that handles the mouse move event and updates the range value.
|
112
|
-
*/
|
113
|
-
protected createMousemoveListener(callback: (newValue: number) => void): (e: MouseEvent) => void;
|
114
|
-
protected _connectedInit(): void;
|
115
|
-
reset(): void;
|
116
|
-
sort(): number | number[];
|
117
|
-
toSorted(): number | number[];
|
118
|
-
}
|
119
|
-
export default Range;
|
120
|
-
export { Range };
|
121
|
-
//# sourceMappingURL=range.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/components/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsE,MAAM,EAAQ,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKpD;;;;;;;;;;;;;GAaG;AACH,cA8FM,KAAM,SAAQ,UAAU;IAC5B;;OAEG;IAEH,GAAG,SAAK;IAER;;OAEG;IAEH,GAAG,SAAO;IAEV;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;;OAIG;IAEH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;OAEG;IAEH,OAAO,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAG3B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAG7B,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAG5C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,YAAY,CAAgB;IAEpC,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,EAAE,CAEzB;IAED;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,EAAE;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