drab 5.4.1 → 6.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/{base → dist/base}/copy/index.d.ts +4 -1
- package/{base → dist/base}/index.d.ts +8 -3
- package/{base → dist/base}/index.js +4 -6
- package/dist/contextmenu/index.d.ts +12 -0
- package/{contextmenu → dist/contextmenu}/index.js +6 -12
- package/{copy → dist/copy}/index.d.ts +2 -3
- package/dist/define.js +4 -0
- package/{dialog → dist/dialog}/index.d.ts +7 -8
- package/{dialog → dist/dialog}/index.js +10 -23
- package/{editor → dist/editor}/index.d.ts +2 -3
- package/{fullscreen → dist/fullscreen}/index.d.ts +3 -7
- package/{fullscreen → dist/fullscreen}/index.js +2 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/{intersect → dist/intersect}/index.d.ts +4 -5
- package/{prefetch → dist/prefetch}/index.d.ts +7 -10
- package/{share → dist/share}/index.d.ts +2 -3
- package/{tablesort → dist/tablesort}/index.d.ts +2 -3
- package/{tablesort → dist/tablesort}/index.js +1 -1
- package/{wakelock → dist/wakelock}/index.d.ts +5 -6
- package/{youtube → dist/youtube}/index.d.ts +6 -3
- package/{youtube → dist/youtube}/index.js +0 -1
- package/package.json +103 -147
- package/LICENSE.md +0 -21
- package/README.md +0 -49
- package/animate/define.iife.js +0 -1
- package/animate/define.js +0 -2
- package/animate/index.d.ts +0 -57
- package/animate/index.iife.js +0 -1
- package/animate/index.js +0 -138
- package/base/define.iife.js +0 -1
- package/base/index.iife.js +0 -1
- package/breakpoint/define.iife.js +0 -1
- package/breakpoint/define.js +0 -2
- package/breakpoint/index.d.ts +0 -26
- package/breakpoint/index.iife.js +0 -1
- package/breakpoint/index.js +0 -55
- package/contextmenu/define.iife.js +0 -1
- package/contextmenu/index.d.ts +0 -13
- package/contextmenu/index.iife.js +0 -1
- package/copy/define.iife.js +0 -1
- package/copy/index.iife.js +0 -1
- package/define.iife.js +0 -9
- package/define.js +0 -4
- package/details/define.iife.js +0 -1
- package/details/define.js +0 -2
- package/details/index.d.ts +0 -21
- package/details/index.iife.js +0 -1
- package/details/index.js +0 -46
- package/dialog/define.iife.js +0 -1
- package/dialog/index.iife.js +0 -1
- package/editor/define.iife.js +0 -9
- package/editor/index.iife.js +0 -9
- package/fullscreen/define.iife.js +0 -1
- package/fullscreen/index.iife.js +0 -1
- package/index.d.ts +0 -17
- package/index.iife.js +0 -9
- package/index.js +0 -17
- package/intersect/define.iife.js +0 -1
- package/intersect/index.iife.js +0 -1
- package/popover/define.iife.js +0 -1
- package/popover/define.js +0 -2
- package/popover/index.d.ts +0 -25
- package/popover/index.iife.js +0 -1
- package/popover/index.js +0 -72
- package/prefetch/define.iife.js +0 -1
- package/prefetch/index.iife.js +0 -1
- package/share/define.d.ts +0 -1
- package/share/define.iife.js +0 -1
- package/share/index.iife.js +0 -1
- package/tablesort/define.d.ts +0 -1
- package/tablesort/define.iife.js +0 -1
- package/tablesort/index.iife.js +0 -1
- package/types/index.d.ts +0 -11
- package/types/index.js +0 -1
- package/wakelock/define.d.ts +0 -1
- package/wakelock/define.iife.js +0 -1
- package/wakelock/index.iife.js +0 -1
- package/youtube/define.d.ts +0 -1
- package/youtube/define.iife.js +0 -1
- package/youtube/index.iife.js +0 -1
- /package/{base → dist/base}/copy/index.js +0 -0
- /package/{animate → dist/base}/define.d.ts +0 -0
- /package/{base → dist/base}/define.js +0 -0
- /package/{base → dist/contextmenu}/define.d.ts +0 -0
- /package/{contextmenu → dist/contextmenu}/define.js +0 -0
- /package/{breakpoint → dist/copy}/define.d.ts +0 -0
- /package/{copy → dist/copy}/define.js +0 -0
- /package/{copy → dist/copy}/index.js +0 -0
- /package/{contextmenu → dist}/define.d.ts +0 -0
- /package/{copy → dist/dialog}/define.d.ts +0 -0
- /package/{dialog → dist/dialog}/define.js +0 -0
- /package/{define.d.ts → dist/editor/define.d.ts} +0 -0
- /package/{editor → dist/editor}/define.js +0 -0
- /package/{editor → dist/editor}/index.js +0 -0
- /package/{details → dist/fullscreen}/define.d.ts +0 -0
- /package/{fullscreen → dist/fullscreen}/define.js +0 -0
- /package/{dialog → dist/intersect}/define.d.ts +0 -0
- /package/{intersect → dist/intersect}/define.js +0 -0
- /package/{intersect → dist/intersect}/index.js +0 -0
- /package/{editor → dist/prefetch}/define.d.ts +0 -0
- /package/{prefetch → dist/prefetch}/define.js +0 -0
- /package/{prefetch → dist/prefetch}/index.js +0 -0
- /package/{fullscreen → dist/share}/define.d.ts +0 -0
- /package/{share → dist/share}/define.js +0 -0
- /package/{share → dist/share}/index.js +0 -0
- /package/{intersect → dist/tablesort}/define.d.ts +0 -0
- /package/{tablesort → dist/tablesort}/define.js +0 -0
- /package/{popover → dist/wakelock}/define.d.ts +0 -0
- /package/{wakelock → dist/wakelock}/define.js +0 -0
- /package/{wakelock → dist/wakelock}/index.js +0 -0
- /package/{prefetch → dist/youtube}/define.d.ts +0 -0
- /package/{youtube → dist/youtube}/define.js +0 -0
@@ -1,3 +1,8 @@
|
|
1
|
+
export type BaseAttributes = {
|
2
|
+
trigger?: string;
|
3
|
+
content?: string;
|
4
|
+
swap?: string;
|
5
|
+
};
|
1
6
|
/**
|
2
7
|
* Each element in the library extends the `Base` class. It provides methods
|
3
8
|
* for selecting elements via HTML attributes along with other helpers.
|
@@ -40,10 +45,10 @@ export declare class Base extends HTMLElement {
|
|
40
45
|
* Finds the `HTMLElement | HTMLTemplateElement` via the `swap` selector and
|
41
46
|
* swaps `this.content()` with the content of the element found.
|
42
47
|
*
|
43
|
-
* @param revert
|
44
|
-
*
|
48
|
+
* @param revert Wait time (ms) before swapping back, set to `false` to not revert.
|
49
|
+
* default: `800`
|
45
50
|
*/
|
46
|
-
swapContent(revert?:
|
51
|
+
swapContent(revert?: number | false): void;
|
47
52
|
/**
|
48
53
|
* Wrapper around `document.body.addEventListener` that ensures when the
|
49
54
|
* element is removed from the DOM, these event listeners are cleaned up.
|
@@ -55,12 +55,10 @@ export class Base extends HTMLElement {
|
|
55
55
|
* Finds the `HTMLElement | HTMLTemplateElement` via the `swap` selector and
|
56
56
|
* swaps `this.content()` with the content of the element found.
|
57
57
|
*
|
58
|
-
* @param revert
|
59
|
-
*
|
58
|
+
* @param revert Wait time (ms) before swapping back, set to `false` to not revert.
|
59
|
+
* default: `800`
|
60
60
|
*/
|
61
|
-
swapContent(revert =
|
62
|
-
// BREAKING TODO: `revert` and `delay` -- these could be one parameter
|
63
|
-
// revert: number = 800
|
61
|
+
swapContent(revert = 800) {
|
64
62
|
/** The swap element, used to hold the replacement contents. */
|
65
63
|
const swap = this.querySelector(this.getAttribute("swap") ?? "[data-swap]");
|
66
64
|
if (swap) {
|
@@ -87,7 +85,7 @@ export class Base extends HTMLElement {
|
|
87
85
|
this.getContent().replaceChildren(...placeholder);
|
88
86
|
if (revert) {
|
89
87
|
// wait and then run again to swap back
|
90
|
-
setTimeout(() => this.swapContent(
|
88
|
+
setTimeout(() => this.swapContent(0), revert);
|
91
89
|
}
|
92
90
|
}
|
93
91
|
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type ContextMenuAttributes = BaseAttributes;
|
3
|
+
/**
|
4
|
+
* Displays content when the `trigger` element is right clicked, or long pressed on mobile.
|
5
|
+
*/
|
6
|
+
export declare class ContextMenu extends Base {
|
7
|
+
#private;
|
8
|
+
constructor();
|
9
|
+
show(e: MouseEvent | TouchEvent): Promise<void>;
|
10
|
+
hide(): Promise<void>;
|
11
|
+
mount(): void;
|
12
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { Base } from "../base/index.js";
|
2
2
|
/**
|
3
3
|
* Displays content when the `trigger` element is right clicked, or long pressed on mobile.
|
4
4
|
*/
|
5
|
-
export class ContextMenu extends
|
5
|
+
export class ContextMenu extends Base {
|
6
6
|
/** Tracks the long press duration on mobile. */
|
7
7
|
#touchTimer;
|
8
8
|
constructor() {
|
@@ -17,12 +17,12 @@ export class ContextMenu extends Animate {
|
|
17
17
|
// find coordinates of the click
|
18
18
|
const scrollY = window.scrollY;
|
19
19
|
const scrollX = window.scrollX;
|
20
|
-
const clientX = e instanceof MouseEvent ? e.clientX : e.touches[0]?.clientX ?? 0;
|
21
|
-
const clientY = e instanceof MouseEvent ? e.clientY : e.touches[0]?.clientY ?? 0;
|
20
|
+
const clientX = e instanceof MouseEvent ? e.clientX : (e.touches[0]?.clientX ?? 0);
|
21
|
+
const clientY = e instanceof MouseEvent ? e.clientY : (e.touches[0]?.clientY ?? 0);
|
22
22
|
let x = clientX + scrollX;
|
23
23
|
let y = clientY + scrollY;
|
24
24
|
this.getContent().style.position = "absolute";
|
25
|
-
this.getContent().
|
25
|
+
this.getContent().setAttribute("data-open", "");
|
26
26
|
const offsetWidth = this.getContent().offsetWidth + 24;
|
27
27
|
const offsetHeight = this.getContent().offsetHeight + 6;
|
28
28
|
const innerWidth = window.innerWidth;
|
@@ -35,15 +35,9 @@ export class ContextMenu extends Animate {
|
|
35
35
|
y = scrollY + innerHeight - offsetHeight;
|
36
36
|
}
|
37
37
|
this.#coordinates = { x, y };
|
38
|
-
await this.animateElement();
|
39
38
|
}
|
40
39
|
async hide() {
|
41
|
-
|
42
|
-
await this.animateElement({
|
43
|
-
options: { direction: "reverse" },
|
44
|
-
});
|
45
|
-
this.getContent().style.display = "none";
|
46
|
-
}
|
40
|
+
this.getContent().removeAttribute("data-open");
|
47
41
|
}
|
48
42
|
mount() {
|
49
43
|
// mouse
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { BaseCopy } from "../base/copy/index.js";
|
2
|
-
|
3
|
-
export type CopyAttributes = Attributes<Copy, "value">;
|
1
|
+
import { BaseCopy, type BaseCopyAttributes } from "../base/copy/index.js";
|
2
|
+
export type CopyAttributes = BaseCopyAttributes;
|
4
3
|
/**
|
5
4
|
* Uses the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText)
|
6
5
|
* to copy text.
|
package/dist/define.js
ADDED
@@ -1,11 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
"
|
5
|
-
|
6
|
-
}>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type DialogAttributes = BaseAttributes & {
|
3
|
+
"click-outside-close"?: boolean;
|
4
|
+
"remove-body-scroll"?: boolean;
|
5
|
+
};
|
7
6
|
/**
|
8
|
-
* Provides triggers
|
7
|
+
* Provides triggers for the `HTMLDialogElement`.
|
9
8
|
*
|
10
9
|
* `click-outside-close`
|
11
10
|
*
|
@@ -17,7 +16,7 @@ export type DialogAttributes = Attributes<Dialog> & AnimateAttributes & Partial<
|
|
17
16
|
* Add the `remove-body-scroll` attribute to remove the scroll from `document.body` when the dialog
|
18
17
|
* is open.
|
19
18
|
*/
|
20
|
-
export declare class Dialog extends
|
19
|
+
export declare class Dialog extends Base {
|
21
20
|
#private;
|
22
21
|
constructor();
|
23
22
|
/** The `HTMLDialogElement` within the element. */
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { Base } from "../base/index.js";
|
2
2
|
/**
|
3
|
-
* Provides triggers
|
3
|
+
* Provides triggers for the `HTMLDialogElement`.
|
4
4
|
*
|
5
5
|
* `click-outside-close`
|
6
6
|
*
|
@@ -12,7 +12,7 @@ import { Animate } from "../animate/index.js";
|
|
12
12
|
* Add the `remove-body-scroll` attribute to remove the scroll from `document.body` when the dialog
|
13
13
|
* is open.
|
14
14
|
*/
|
15
|
-
export class Dialog extends
|
15
|
+
export class Dialog extends Base {
|
16
16
|
/** The initial margin-right value of the body element. */
|
17
17
|
#initialBodyMarginRight = parseInt(getComputedStyle(document.body).marginRight);
|
18
18
|
constructor() {
|
@@ -22,38 +22,25 @@ export class Dialog extends Animate {
|
|
22
22
|
get dialog() {
|
23
23
|
return this.getContent(HTMLDialogElement);
|
24
24
|
}
|
25
|
-
/** The width of the scrollbar---used for when the scroll is removed. */
|
26
|
-
get #scrollbarWidth() {
|
27
|
-
return window.innerWidth - document.documentElement.clientWidth;
|
28
|
-
}
|
29
|
-
set #bodyMarginRight(margin) {
|
30
|
-
document.body.style.marginRight = `${margin}px`;
|
31
|
-
}
|
32
|
-
set #bodyOverflow(overflow) {
|
33
|
-
document.body.style.overflow = overflow;
|
34
|
-
}
|
35
25
|
/** Remove scroll from the body when open with the `remove-body-scroll` attribute. */
|
36
26
|
#toggleBodyScroll(show) {
|
37
27
|
if (this.hasAttribute("remove-body-scroll")) {
|
38
|
-
|
39
|
-
? this.#initialBodyMarginRight +
|
40
|
-
|
41
|
-
|
28
|
+
document.body.style.marginRight = `${show
|
29
|
+
? this.#initialBodyMarginRight +
|
30
|
+
// scrollbar width
|
31
|
+
window.innerWidth -
|
32
|
+
document.documentElement.clientWidth
|
33
|
+
: this.#initialBodyMarginRight}px`;
|
34
|
+
document.body.style.overflow = show ? "hidden" : "";
|
42
35
|
}
|
43
36
|
}
|
44
37
|
/** `HTMLDialogElement.showModal()` with animation. */
|
45
38
|
async show() {
|
46
39
|
this.dialog.showModal();
|
47
40
|
this.#toggleBodyScroll(true);
|
48
|
-
await this.animateElement();
|
49
41
|
}
|
50
42
|
/** `HTMLDialogElement.close()` with animation. */
|
51
43
|
async close() {
|
52
|
-
await this.animateElement({
|
53
|
-
options: {
|
54
|
-
direction: "reverse",
|
55
|
-
},
|
56
|
-
});
|
57
44
|
this.#toggleBodyScroll(false);
|
58
45
|
this.dialog.close();
|
59
46
|
}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
|
3
|
-
export type EditorAttributes = Attributes<Editor>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type EditorAttributes = BaseAttributes;
|
4
3
|
/**
|
5
4
|
* A piece of content to insert into the `textarea`.
|
6
5
|
*/
|
@@ -1,21 +1,17 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
|
3
|
-
export type FullscreenAttributes = Attributes<Fullscreen>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type FullscreenAttributes = BaseAttributes;
|
4
3
|
/**
|
5
4
|
* Toggles the `documentElement` or `content` element to fullscreen mode.
|
6
5
|
*
|
7
6
|
* Disables the `trigger` if fullscreen is not supported.
|
8
7
|
*/
|
9
8
|
export declare class Fullscreen extends Base {
|
9
|
+
#private;
|
10
10
|
constructor();
|
11
11
|
/**
|
12
12
|
* @returns `true` if fullscreen is currently enabled.
|
13
13
|
*/
|
14
14
|
isFullscreen(): boolean;
|
15
|
-
/**
|
16
|
-
* @returns `true` if fullscreen is supported.
|
17
|
-
*/
|
18
|
-
fullscreenSupported(): boolean;
|
19
15
|
/** Enables or disables fullscreen mode based on the current state. */
|
20
16
|
toggle(): void;
|
21
17
|
mount(): void;
|
@@ -17,8 +17,7 @@ export class Fullscreen extends Base {
|
|
17
17
|
/**
|
18
18
|
* @returns `true` if fullscreen is supported.
|
19
19
|
*/
|
20
|
-
fullscreenSupported() {
|
21
|
-
// BREAKING TODO: make private like in WakeLock
|
20
|
+
#fullscreenSupported() {
|
22
21
|
return Boolean(document.documentElement.requestFullscreen);
|
23
22
|
}
|
24
23
|
/** Enables or disables fullscreen mode based on the current state. */
|
@@ -38,7 +37,7 @@ export class Fullscreen extends Base {
|
|
38
37
|
mount() {
|
39
38
|
this.triggerListener(() => this.toggle());
|
40
39
|
for (const trigger of this.getTrigger()) {
|
41
|
-
if (!this
|
40
|
+
if (!this.#fullscreenSupported() && "disabled" in trigger) {
|
42
41
|
trigger.disabled = true;
|
43
42
|
}
|
44
43
|
}
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
export { Base, type BaseAttributes } from "./base/index.js";
|
2
|
+
export { ContextMenu, type ContextMenuAttributes, } from "./contextmenu/index.js";
|
3
|
+
export { Copy, type CopyAttributes } from "./copy/index.js";
|
4
|
+
export { Dialog, type DialogAttributes } from "./dialog/index.js";
|
5
|
+
export { Editor, type EditorAttributes } from "./editor/index.js";
|
6
|
+
export { Fullscreen, type FullscreenAttributes } from "./fullscreen/index.js";
|
7
|
+
export { Intersect, type IntersectAttributes } from "./intersect/index.js";
|
8
|
+
export { Prefetch, type PrefetchAttributes } from "./prefetch/index.js";
|
9
|
+
export { Share, type ShareAttributes } from "./share/index.js";
|
10
|
+
export { TableSort, type TableSortAttributes } from "./tablesort/index.js";
|
11
|
+
export { WakeLock, type WakeLockAttributes } from "./wakelock/index.js";
|
12
|
+
export { YouTube, type YouTubeAttributes } from "./youtube/index.js";
|
package/dist/index.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
export { Base } from "./base/index.js";
|
2
|
+
export { ContextMenu, } from "./contextmenu/index.js";
|
3
|
+
export { Copy } from "./copy/index.js";
|
4
|
+
export { Dialog } from "./dialog/index.js";
|
5
|
+
export { Editor } from "./editor/index.js";
|
6
|
+
export { Fullscreen } from "./fullscreen/index.js";
|
7
|
+
export { Intersect } from "./intersect/index.js";
|
8
|
+
export { Prefetch } from "./prefetch/index.js";
|
9
|
+
export { Share } from "./share/index.js";
|
10
|
+
export { TableSort } from "./tablesort/index.js";
|
11
|
+
export { WakeLock } from "./wakelock/index.js";
|
12
|
+
export { YouTube } from "./youtube/index.js";
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type IntersectAttributes = BaseAttributes & {
|
3
|
+
threshold?: number;
|
4
|
+
};
|
6
5
|
type IntersectCallback = () => any;
|
7
6
|
/**
|
8
7
|
* Uses the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to add a `data-intersect` attribute to `content` when the `trigger` is intersecting.
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
import type { Attributes } from "../types/index.js";
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
3
2
|
type Strategy = "hover" | "load" | "visible";
|
4
|
-
export type PrefetchAttributes =
|
5
|
-
strategy
|
6
|
-
prerender
|
7
|
-
url
|
8
|
-
}
|
3
|
+
export type PrefetchAttributes = BaseAttributes & {
|
4
|
+
strategy?: Strategy;
|
5
|
+
prerender?: boolean;
|
6
|
+
url?: string;
|
7
|
+
};
|
9
8
|
/**
|
10
9
|
* The `Prefetch` element can prefetch a url, or enhance the `HTMLAnchorElement` by loading the HTML for a page before it is navigated to. This element speeds up the navigation for multi-page applications (MPAs).
|
11
10
|
*
|
@@ -60,9 +59,7 @@ export declare class Prefetch extends Base {
|
|
60
59
|
prefetch(options?: {
|
61
60
|
/** The anchors to prefetch. Defaults to `trigger` elements. */
|
62
61
|
anchors?: NodeListOf<HTMLAnchorElement>;
|
63
|
-
/**
|
64
|
-
* Uses the Speculation Rules API when supported to prerender on the client.
|
65
|
-
*/
|
62
|
+
/** Uses the Speculation Rules API when supported to prerender on the client. */
|
66
63
|
prerender?: boolean;
|
67
64
|
/**
|
68
65
|
* Determines when the prefetch takes place.
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { BaseCopy } from "../base/copy/index.js";
|
2
|
-
|
3
|
-
export type ShareAttributes = Attributes<Share, "value">;
|
1
|
+
import { BaseCopy, type BaseCopyAttributes } from "../base/copy/index.js";
|
2
|
+
export type ShareAttributes = BaseCopyAttributes;
|
4
3
|
/**
|
5
4
|
* Uses the [Navigator API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share) to share a url. If `share` is not supported, falls back to copy the text instead.
|
6
5
|
*/
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { Base } from "../index.js";
|
2
|
-
|
3
|
-
export type TableSortAttributes = Attributes<TableSort>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type TableSortAttributes = BaseAttributes;
|
4
3
|
/**
|
5
4
|
* Wrap a `HTMLTableElement` in the `TableSort` element to have sortable column
|
6
5
|
* headers. Set each `th` that you want to sort to the `trigger`. Set the `tbody`
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}>;
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type WakeLockAttributes = BaseAttributes & {
|
3
|
+
"auto-lock"?: boolean;
|
4
|
+
locked?: boolean;
|
5
|
+
};
|
7
6
|
/**
|
8
7
|
* `WakeLock` uses the [WakeLock API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API) to ensure the screen does not turn off when viewing the page on supported devices. Use your best judgement for when this is necessary, for example, if you have a timer that needs to stay on, or you are displaying a QR code.
|
9
8
|
*
|
@@ -1,6 +1,9 @@
|
|
1
|
-
import { Base } from "../base/index.js";
|
2
|
-
|
3
|
-
|
1
|
+
import { Base, type BaseAttributes } from "../base/index.js";
|
2
|
+
export type YouTubeAttributes = BaseAttributes & {
|
3
|
+
autoplay?: boolean;
|
4
|
+
start?: number;
|
5
|
+
uid: string;
|
6
|
+
};
|
4
7
|
/**
|
5
8
|
* Embeds a YouTube video iframe into a website with the video uid, using www.youtube-nocookie.com.
|
6
9
|
*/
|
@@ -49,7 +49,6 @@ export class YouTube extends Base {
|
|
49
49
|
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
|
50
50
|
}
|
51
51
|
attributeChangedCallback() {
|
52
|
-
// BREAKING TODO: make consistent with other components - decide on observed attributes
|
53
52
|
queueMicrotask(() => {
|
54
53
|
this.iframe.src = `https://www.youtube-nocookie.com/embed/${this.uid}?start=${this.start}${this.autoplay ? "&autoplay=1" : ""}`;
|
55
54
|
});
|