drab 7.0.3 → 8.0.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/dist/base/index.d.ts +122 -48
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.js +10 -7
- package/dist/contextmenu/index.d.ts +90 -35
- package/dist/contextmenu/index.d.ts.map +1 -1
- package/dist/define.d.ts +0 -1
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +0 -1
- package/dist/editor/index.d.ts +90 -35
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/fullscreen/index.d.ts +90 -36
- package/dist/fullscreen/index.d.ts.map +1 -1
- package/dist/fullscreen/index.js +3 -14
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/intersect/index.d.ts +90 -36
- package/dist/intersect/index.d.ts.map +1 -1
- package/dist/intersect/index.js +1 -11
- package/dist/prefetch/index.d.ts +62 -25
- package/dist/prefetch/index.d.ts.map +1 -1
- package/dist/prefetch/index.js +17 -30
- package/dist/share/index.d.ts +120 -47
- package/dist/share/index.d.ts.map +1 -1
- package/dist/tablesort/index.d.ts +120 -47
- package/dist/tablesort/index.d.ts.map +1 -1
- package/dist/tablesort/index.js +54 -54
- package/dist/tabs/index.d.ts +61 -24
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +10 -2
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/util/validate.d.ts.map +1 -1
- package/dist/util/validate.js +2 -1
- package/dist/wakelock/index.d.ts +120 -47
- package/dist/wakelock/index.d.ts.map +1 -1
- package/dist/wakelock/index.js +1 -2
- package/package.json +4 -4
- package/src/base/index.ts +10 -7
- package/src/contextmenu/index.ts +2 -3
- package/src/define.ts +0 -1
- package/src/editor/index.ts +1 -2
- package/src/fullscreen/index.ts +6 -18
- package/src/index.ts +0 -1
- package/src/intersect/index.ts +2 -14
- package/src/prefetch/index.ts +21 -36
- package/src/tablesort/index.ts +64 -63
- package/src/tabs/index.ts +11 -2
- package/src/types/index.ts +0 -2
- package/src/util/validate.ts +2 -1
- package/src/wakelock/index.ts +2 -5
- package/dist/dialog/define.d.ts +0 -2
- package/dist/dialog/define.d.ts.map +0 -1
- package/dist/dialog/define.js +0 -3
- package/dist/dialog/index.d.ts +0 -1079
- package/dist/dialog/index.d.ts.map +0 -1
- package/dist/dialog/index.js +0 -90
- package/src/dialog/define.ts +0 -4
- package/src/dialog/index.ts +0 -120
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EAGtB,KAAK,iBAAiB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB,EAAE,iBAAiB;IAC7E,6CAA6C;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,uDAAuD;IACvD,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,MAAO,SAAQ,WAA6B;;;IA8BxD,6CAA6C;IAC7C,IAAI;IAKJ,yCAAyC;IACzC,KAAK;IAKL,oEAAoE;IACpE,MAAM;IAKG,KAAK;CAoCd"}
|
package/dist/dialog/index.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Content, Lifecycle, Trigger, } from "../base/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Provides triggers for the `HTMLDialogElement`.
|
|
4
|
-
*
|
|
5
|
-
* ### Attributes
|
|
6
|
-
*
|
|
7
|
-
* `click-outside-close`
|
|
8
|
-
*
|
|
9
|
-
* By default, the `HTMLDialogElement` doesn't close if the user clicks outside of it.
|
|
10
|
-
* Add a `click-outside-close` attribute to close when the user clicks outside.
|
|
11
|
-
*
|
|
12
|
-
* If the dialog covers the full viewport and this attribute is present, the first child
|
|
13
|
-
* of the dialog will be assumed to be the content of the dialog and the dialog will close
|
|
14
|
-
* if there is a click outside of the first child element.
|
|
15
|
-
*
|
|
16
|
-
* `remove-body-scroll`
|
|
17
|
-
*
|
|
18
|
-
* Add the `remove-body-scroll` attribute to remove the scroll from `document.body` when the dialog
|
|
19
|
-
* is open.
|
|
20
|
-
*/
|
|
21
|
-
export class Dialog extends Lifecycle(Trigger(Content())) {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
}
|
|
25
|
-
/** The `HTMLDialogElement` within the element. */
|
|
26
|
-
get #dialog() {
|
|
27
|
-
return this.content(HTMLDialogElement);
|
|
28
|
-
}
|
|
29
|
-
get #removeBodyScroll() {
|
|
30
|
-
return this.hasAttribute("remove-body-scroll");
|
|
31
|
-
}
|
|
32
|
-
get #clickOutsideClose() {
|
|
33
|
-
return this.hasAttribute("click-outside-close");
|
|
34
|
-
}
|
|
35
|
-
get #scrollbarWidth() {
|
|
36
|
-
return window.innerWidth - document.documentElement.clientWidth;
|
|
37
|
-
}
|
|
38
|
-
/** Remove scroll from the body when open with the `remove-body-scroll` attribute. */
|
|
39
|
-
#toggleBodyScroll(show) {
|
|
40
|
-
if (this.#removeBodyScroll) {
|
|
41
|
-
document.documentElement.style.scrollbarGutter = "stable";
|
|
42
|
-
document.body.style.overflow = show ? "hidden" : "";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/** Wraps `HTMLDialogElement.showModal()`. */
|
|
46
|
-
show() {
|
|
47
|
-
this.#dialog.showModal();
|
|
48
|
-
this.#toggleBodyScroll(true);
|
|
49
|
-
}
|
|
50
|
-
/** Wraps `HTMLDialogElement.close()`. */
|
|
51
|
-
close() {
|
|
52
|
-
this.#toggleBodyScroll(false);
|
|
53
|
-
this.#dialog.close();
|
|
54
|
-
}
|
|
55
|
-
/** `show` or `close` depending on the dialog's `open` attribute. */
|
|
56
|
-
toggle() {
|
|
57
|
-
if (this.#dialog.open)
|
|
58
|
-
this.close();
|
|
59
|
-
else
|
|
60
|
-
this.show();
|
|
61
|
-
}
|
|
62
|
-
mount() {
|
|
63
|
-
this.listener(() => this.toggle());
|
|
64
|
-
this.safeListener("keydown", (e) => {
|
|
65
|
-
if (e.key === "Escape" && this.#dialog.open) {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
this.close();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (this.#clickOutsideClose) {
|
|
71
|
-
// https://blog.webdevsimplified.com/2023-04/html-dialog/#close-on-outside-click
|
|
72
|
-
this.#dialog.addEventListener("click", (e) => {
|
|
73
|
-
let rect = this.#dialog.getBoundingClientRect();
|
|
74
|
-
// If dialog covers full viewport, use first child element for hit testing
|
|
75
|
-
// Example: https://picocss.com/docs/modal
|
|
76
|
-
if (window.innerWidth - rect.width <= this.#scrollbarWidth + 3 &&
|
|
77
|
-
window.innerHeight - rect.height <= 3 &&
|
|
78
|
-
this.#dialog.firstElementChild) {
|
|
79
|
-
rect = this.#dialog.firstElementChild.getBoundingClientRect();
|
|
80
|
-
}
|
|
81
|
-
if (e.clientX < rect.left ||
|
|
82
|
-
e.clientX > rect.right ||
|
|
83
|
-
e.clientY < rect.top ||
|
|
84
|
-
e.clientY > rect.bottom) {
|
|
85
|
-
this.close();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
package/src/dialog/define.ts
DELETED
package/src/dialog/index.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Content,
|
|
3
|
-
type ContentAttributes,
|
|
4
|
-
Lifecycle,
|
|
5
|
-
Trigger,
|
|
6
|
-
type TriggerAttributes,
|
|
7
|
-
} from "../base/index.js";
|
|
8
|
-
|
|
9
|
-
export interface DialogAttributes extends TriggerAttributes, ContentAttributes {
|
|
10
|
-
/** Close the dialog when clicked outside. */
|
|
11
|
-
"click-outside-close"?: boolean;
|
|
12
|
-
|
|
13
|
-
/** Remove scroll from the body when dialog is open. */
|
|
14
|
-
"remove-body-scroll"?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Provides triggers for the `HTMLDialogElement`.
|
|
19
|
-
*
|
|
20
|
-
* ### Attributes
|
|
21
|
-
*
|
|
22
|
-
* `click-outside-close`
|
|
23
|
-
*
|
|
24
|
-
* By default, the `HTMLDialogElement` doesn't close if the user clicks outside of it.
|
|
25
|
-
* Add a `click-outside-close` attribute to close when the user clicks outside.
|
|
26
|
-
*
|
|
27
|
-
* If the dialog covers the full viewport and this attribute is present, the first child
|
|
28
|
-
* of the dialog will be assumed to be the content of the dialog and the dialog will close
|
|
29
|
-
* if there is a click outside of the first child element.
|
|
30
|
-
*
|
|
31
|
-
* `remove-body-scroll`
|
|
32
|
-
*
|
|
33
|
-
* Add the `remove-body-scroll` attribute to remove the scroll from `document.body` when the dialog
|
|
34
|
-
* is open.
|
|
35
|
-
*/
|
|
36
|
-
export class Dialog extends Lifecycle(Trigger(Content())) {
|
|
37
|
-
constructor() {
|
|
38
|
-
super();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** The `HTMLDialogElement` within the element. */
|
|
42
|
-
get #dialog() {
|
|
43
|
-
return this.content(HTMLDialogElement);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
get #removeBodyScroll() {
|
|
47
|
-
return this.hasAttribute("remove-body-scroll");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
get #clickOutsideClose() {
|
|
51
|
-
return this.hasAttribute("click-outside-close");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get #scrollbarWidth() {
|
|
55
|
-
return window.innerWidth - document.documentElement.clientWidth;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Remove scroll from the body when open with the `remove-body-scroll` attribute. */
|
|
59
|
-
#toggleBodyScroll(show: boolean) {
|
|
60
|
-
if (this.#removeBodyScroll) {
|
|
61
|
-
document.documentElement.style.scrollbarGutter = "stable";
|
|
62
|
-
document.body.style.overflow = show ? "hidden" : "";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Wraps `HTMLDialogElement.showModal()`. */
|
|
67
|
-
show() {
|
|
68
|
-
this.#dialog.showModal();
|
|
69
|
-
this.#toggleBodyScroll(true);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Wraps `HTMLDialogElement.close()`. */
|
|
73
|
-
close() {
|
|
74
|
-
this.#toggleBodyScroll(false);
|
|
75
|
-
this.#dialog.close();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** `show` or `close` depending on the dialog's `open` attribute. */
|
|
79
|
-
toggle() {
|
|
80
|
-
if (this.#dialog.open) this.close();
|
|
81
|
-
else this.show();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
override mount() {
|
|
85
|
-
this.listener(() => this.toggle());
|
|
86
|
-
|
|
87
|
-
this.safeListener("keydown", (e) => {
|
|
88
|
-
if (e.key === "Escape" && this.#dialog.open) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
this.close();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
if (this.#clickOutsideClose) {
|
|
95
|
-
// https://blog.webdevsimplified.com/2023-04/html-dialog/#close-on-outside-click
|
|
96
|
-
this.#dialog.addEventListener("click", (e) => {
|
|
97
|
-
let rect = this.#dialog.getBoundingClientRect();
|
|
98
|
-
|
|
99
|
-
// If dialog covers full viewport, use first child element for hit testing
|
|
100
|
-
// Example: https://picocss.com/docs/modal
|
|
101
|
-
if (
|
|
102
|
-
window.innerWidth - rect.width <= this.#scrollbarWidth + 3 &&
|
|
103
|
-
window.innerHeight - rect.height <= 3 &&
|
|
104
|
-
this.#dialog.firstElementChild
|
|
105
|
-
) {
|
|
106
|
-
rect = this.#dialog.firstElementChild.getBoundingClientRect();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
e.clientX < rect.left ||
|
|
111
|
-
e.clientX > rect.right ||
|
|
112
|
-
e.clientY < rect.top ||
|
|
113
|
-
e.clientY > rect.bottom
|
|
114
|
-
) {
|
|
115
|
-
this.close();
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|