drab 5.0.2 → 5.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.
Files changed (46) hide show
  1. package/animate/define.iife.js +1 -1
  2. package/animate/index.iife.js +1 -1
  3. package/base/define.iife.js +1 -1
  4. package/base/index.d.ts +8 -4
  5. package/base/index.iife.js +1 -1
  6. package/base/index.js +28 -5
  7. package/breakpoint/define.iife.js +1 -1
  8. package/breakpoint/index.iife.js +1 -1
  9. package/contextmenu/define.iife.js +1 -1
  10. package/contextmenu/index.iife.js +1 -1
  11. package/copy/define.iife.js +1 -1
  12. package/copy/index.iife.js +1 -1
  13. package/define/index.iife.js +9 -9
  14. package/details/define.iife.js +1 -1
  15. package/details/index.iife.js +1 -1
  16. package/dialog/define.iife.js +1 -1
  17. package/dialog/index.iife.js +1 -1
  18. package/editor/define.iife.js +4 -4
  19. package/editor/index.iife.js +5 -5
  20. package/fullscreen/define.iife.js +1 -1
  21. package/fullscreen/index.iife.js +1 -1
  22. package/fullscreen/index.js +2 -1
  23. package/index.d.ts +3 -1
  24. package/index.iife.js +9 -9
  25. package/index.js +3 -1
  26. package/package.json +19 -1
  27. package/popover/define.iife.js +1 -1
  28. package/popover/index.iife.js +1 -1
  29. package/prefetch/define.d.ts +1 -0
  30. package/prefetch/define.iife.js +1 -0
  31. package/prefetch/define.js +2 -0
  32. package/prefetch/index.d.ts +80 -0
  33. package/prefetch/index.iife.js +1 -0
  34. package/prefetch/index.js +164 -0
  35. package/share/define.iife.js +1 -1
  36. package/share/index.iife.js +1 -1
  37. package/tablesort/define.iife.js +1 -1
  38. package/tablesort/index.iife.js +1 -1
  39. package/wakelock/define.d.ts +1 -0
  40. package/wakelock/define.iife.js +1 -0
  41. package/wakelock/define.js +2 -0
  42. package/wakelock/index.d.ts +32 -0
  43. package/wakelock/index.iife.js +1 -0
  44. package/wakelock/index.js +88 -0
  45. package/youtube/define.iife.js +1 -1
  46. package/youtube/index.iife.js +1 -1
@@ -1 +1 @@
1
- "use strict";(()=>{var l=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(i){this.setAttribute("event",i)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(i=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof i)return n;throw new Error("Content not found")}swapContent(i=!0,n=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let t=Array.from(this.getContent().childNodes);e instanceof HTMLTemplateElement?this.getContent().replaceChildren(e.content.cloneNode(!0)):this.getContent().replaceChildren(...e.childNodes),i&&setTimeout(()=>this.getContent().replaceChildren(...t),n)}}safeListener(i,n,e=document.body,t={}){t.signal=this.#e.signal,e.addEventListener(i,n,t)}triggerListener(i,n=this.event){for(let e of this.getTrigger())e.addEventListener(n,i)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var f=class extends l{constructor(){super()}get animationOptions(){let i={};for(let n of this.getAttributeNames())if(n.startsWith("animation-option-")){let e=this.getAttribute(n),[,,t]=n.split("-");e&&(t==="duration"||t==="delay"?i[t]=Number(e):t==="easing"&&(i[t]=e))}return i}async animateElement(i={element:this.getContent(),options:{}}){let{element:n=this.getContent(),options:e={}}=i,t=this.keyframes;if(t.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let o=t.at(0),s=t.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let m of a)delete o[m],delete s[m]}e.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(n.style,o),await n.animate(t,e).finished,Object.assign(n.style,s)}}get keyframes(){let i=[];for(let n of this.getAttributeNames()){let e=this.getAttribute(n),[,,t,...o]=n.split("-");if(n.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(t&&s){t==="from"?t="0":t==="to"?t="1":t=String(parseInt(t)*.01);let r=Number(t),a=i.find(m=>m.offset===r);a?a[s]=e:i.push({[s]:e,offset:r})}}}return i.sort((n,e)=>Number(n.offset)-Number(e.offset)),i}};customElements.define("drab-animate",f);})();
1
+ "use strict";(()=>{var l=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(i){this.setAttribute("event",i)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(i=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof i)return n;throw new Error("Content not found")}swapContent(i=!0,n=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let t=Array.from(this.getContent().childNodes),s=[];e instanceof HTMLTemplateElement?(s.push(e.content.cloneNode(!0)),e.content.replaceChildren(...t)):(s.push(...e.childNodes),e.replaceChildren(...t)),this.getContent().replaceChildren(...s),i&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(i,n,e=document.body,t={}){t.signal=this.#e.signal,e.addEventListener(i,n,t)}triggerListener(i,n=this.event){for(let e of this.getTrigger())e.addEventListener(n,i)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var f=class extends l{constructor(){super()}get animationOptions(){let i={};for(let n of this.getAttributeNames())if(n.startsWith("animation-option-")){let e=this.getAttribute(n),[,,t]=n.split("-");e&&(t==="duration"||t==="delay"?i[t]=Number(e):t==="easing"&&(i[t]=e))}return i}async animateElement(i={element:this.getContent(),options:{}}){let{element:n=this.getContent(),options:e={}}=i,t=this.keyframes;if(t.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let s=t.at(0),o=t.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let m of a)delete s[m],delete o[m]}e.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(n.style,s),await n.animate(t,e).finished,Object.assign(n.style,o)}}get keyframes(){let i=[];for(let n of this.getAttributeNames()){let e=this.getAttribute(n),[,,t,...s]=n.split("-");if(n.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(t&&o){t==="from"?t="0":t==="to"?t="1":t=String(parseInt(t)*.01);let r=Number(t),a=i.find(m=>m.offset===r);a?a[o]=e:i.push({[o]:e,offset:r})}}}return i.sort((n,e)=>Number(n.offset)-Number(e.offset)),i}};customElements.define("drab-animate",f);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(i){this.setAttribute("event",i)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(i=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof i)return n;throw new Error("Content not found")}swapContent(i=!0,n=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let t=Array.from(this.getContent().childNodes);e instanceof HTMLTemplateElement?this.getContent().replaceChildren(e.content.cloneNode(!0)):this.getContent().replaceChildren(...e.childNodes),i&&setTimeout(()=>this.getContent().replaceChildren(...t),n)}}safeListener(i,n,e=document.body,t={}){t.signal=this.#e.signal,e.addEventListener(i,n,t)}triggerListener(i,n=this.event){for(let e of this.getTrigger())e.addEventListener(n,i)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let i={};for(let n of this.getAttributeNames())if(n.startsWith("animation-option-")){let e=this.getAttribute(n),[,,t]=n.split("-");e&&(t==="duration"||t==="delay"?i[t]=Number(e):t==="easing"&&(i[t]=e))}return i}async animateElement(i={element:this.getContent(),options:{}}){let{element:n=this.getContent(),options:e={}}=i,t=this.keyframes;if(t.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let o=t.at(0),s=t.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let l of a)delete o[l],delete s[l]}e.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(n.style,o),await n.animate(t,e).finished,Object.assign(n.style,s)}}get keyframes(){let i=[];for(let n of this.getAttributeNames()){let e=this.getAttribute(n),[,,t,...o]=n.split("-");if(n.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(t&&s){t==="from"?t="0":t==="to"?t="1":t=String(parseInt(t)*.01);let r=Number(t),a=i.find(l=>l.offset===r);a?a[s]=e:i.push({[s]:e,offset:r})}}}return i.sort((n,e)=>Number(n.offset)-Number(e.offset)),i}};})();
1
+ "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(i){this.setAttribute("event",i)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(i=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof i)return n;throw new Error("Content not found")}swapContent(i=!0,n=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let t=Array.from(this.getContent().childNodes),s=[];e instanceof HTMLTemplateElement?(s.push(e.content.cloneNode(!0)),e.content.replaceChildren(...t)):(s.push(...e.childNodes),e.replaceChildren(...t)),this.getContent().replaceChildren(...s),i&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(i,n,e=document.body,t={}){t.signal=this.#e.signal,e.addEventListener(i,n,t)}triggerListener(i,n=this.event){for(let e of this.getTrigger())e.addEventListener(n,i)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let i={};for(let n of this.getAttributeNames())if(n.startsWith("animation-option-")){let e=this.getAttribute(n),[,,t]=n.split("-");e&&(t==="duration"||t==="delay"?i[t]=Number(e):t==="easing"&&(i[t]=e))}return i}async animateElement(i={element:this.getContent(),options:{}}){let{element:n=this.getContent(),options:e={}}=i,t=this.keyframes;if(t.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let s=t.at(0),o=t.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}e.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(n.style,s),await n.animate(t,e).finished,Object.assign(n.style,o)}}get keyframes(){let i=[];for(let n of this.getAttributeNames()){let e=this.getAttribute(n),[,,t,...s]=n.split("-");if(n.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(t&&o){t==="from"?t="0":t==="to"?t="1":t=String(parseInt(t)*.01);let r=Number(t),a=i.find(l=>l.offset===r);a?a[o]=e:i.push({[o]:e,offset:r})}}}return i.sort((n,e)=>Number(n.offset)-Number(e.offset)),i}};})();
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let t=this.querySelector(this.getAttribute("content")??"[data-content]");if(t instanceof e)return t;throw new Error("Content not found")}swapContent(e=!0,t=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...r),t)}}safeListener(e,t,n=document.body,r={}){r.signal=this.#e.signal,n.addEventListener(e,t,r)}triggerListener(e,t=this.event){for(let n of this.getTrigger())n.addEventListener(t,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};customElements.define("drab-base",s);})();
1
+ "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),o=[];t instanceof HTMLTemplateElement?(o.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(o.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...o),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};customElements.define("drab-base",s);})();
package/base/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare class Base extends HTMLElement {
26
26
  * @returns All of the elements that match the `trigger` selector.
27
27
  * @default this.querySelectorAll("[data-trigger]")
28
28
  */
29
- getTrigger(): NodeListOf<HTMLElement>;
29
+ getTrigger<T extends HTMLElement = HTMLElement>(): NodeListOf<T>;
30
30
  /**
31
31
  * @param instance The instance of the desired element, ex: `HTMLDialogElement`.
32
32
  * Defaults to `HTMLElement`.
@@ -51,17 +51,21 @@ export declare class Base extends HTMLElement {
51
51
  * @param listener
52
52
  * @param options
53
53
  */
54
- safeListener<K extends keyof HTMLElementEventMap, T extends HTMLElement | Window | Document = HTMLElement>(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, element?: T, options?: AddEventListenerOptions): void;
54
+ safeListener<K extends keyof DocumentEventMap, T extends HTMLElement | Window | Document = HTMLElement>(type: K, listener: (this: T, ev: DocumentEventMap[K]) => any, element?: T, options?: AddEventListenerOptions): void;
55
55
  /**
56
56
  * @param listener Listener to attach to all of the `trigger` elements.
57
57
  */
58
- triggerListener<T extends HTMLElement, K extends keyof HTMLElementEventMap>(listener: (this: T, ev: HTMLElementEventMap[K]) => any, type?: K): void;
58
+ triggerListener<T extends HTMLElement, K extends keyof HTMLElementEventMap>(listener: (this: T, e: HTMLElementEventMap[K]) => any, type?: K): void;
59
59
  /**
60
- * Placeholder function is passed into `queueMicrotask` in `connectedCallback`. It is overridden in each component that needs to run `connectedCallback`.
60
+ * Passed into `queueMicrotask` in `connectedCallback`. It is overridden in each component that needs to run `connectedCallback`.
61
61
  *
62
62
  * The reason for this is to make these elements work better with frameworks like Svelte. For SSR this isn't necessary, but when client side rendering, the HTML within the custom element isn't available before `connectedCallback` is called. By waiting until the next microtask, the HTML content is available---then for example, listeners can be attached to elements inside.
63
63
  */
64
64
  mount(): void;
65
65
  connectedCallback(): void;
66
+ /**
67
+ * Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallback` as well. It is overridden in each element that needs to run `disconnectedCallback`.
68
+ */
69
+ destroy(): void;
66
70
  disconnectedCallback(): void;
67
71
  }
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let t=this.querySelector(this.getAttribute("content")??"[data-content]");if(t instanceof e)return t;throw new Error("Content not found")}swapContent(e=!0,t=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...r),t)}}safeListener(e,t,n=document.body,r={}){r.signal=this.#e.signal,n.addEventListener(e,t,r)}triggerListener(e,t=this.event){for(let n of this.getTrigger())n.addEventListener(t,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};})();
1
+ "use strict";(()=>{var o=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),s=[];t instanceof HTMLTemplateElement?(s.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(s.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...s),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};})();
package/base/index.js CHANGED
@@ -59,17 +59,35 @@ export class Base extends HTMLElement {
59
59
  * @param delay Wait time before swapping back
60
60
  */
61
61
  swapContent(revert = true, delay = 800) {
62
+ // BREAKING TODO: `revert` and `delay` -- these could be one parameter
63
+ // revert: number = 800
64
+ /** The swap element, used to hold the replacement contents. */
62
65
  const swap = this.querySelector(this.getAttribute("swap") ?? "[data-swap]");
63
66
  if (swap) {
64
- const original = Array.from(this.getContent().childNodes);
67
+ /** A copy of the content currently in `this.getContent()`. */
68
+ const currentContent = Array.from(this.getContent().childNodes);
69
+ /**
70
+ * The contents of the swap element, set based on whether the
71
+ * swap is a `template` or not.
72
+ */
73
+ const placeholder = [];
74
+ // Set the placeholder with the `swap` content, then replace the
75
+ // swap content with the `currentContent`
65
76
  if (swap instanceof HTMLTemplateElement) {
66
- this.getContent().replaceChildren(swap.content.cloneNode(true));
77
+ // use `content` since it's a `template` element
78
+ placeholder.push(swap.content.cloneNode(true));
79
+ swap.content.replaceChildren(...currentContent);
67
80
  }
68
81
  else {
69
- this.getContent().replaceChildren(...swap.childNodes);
82
+ // not a `template`, replace children directly
83
+ placeholder.push(...swap.childNodes);
84
+ swap.replaceChildren(...currentContent);
70
85
  }
86
+ // finally, set the content to the contents of the placeholder
87
+ this.getContent().replaceChildren(...placeholder);
71
88
  if (revert) {
72
- setTimeout(() => this.getContent().replaceChildren(...original), delay);
89
+ // wait and then run again to swap back
90
+ setTimeout(() => this.swapContent(false), delay);
73
91
  }
74
92
  }
75
93
  }
@@ -94,7 +112,7 @@ export class Base extends HTMLElement {
94
112
  }
95
113
  }
96
114
  /**
97
- * Placeholder function is passed into `queueMicrotask` in `connectedCallback`. It is overridden in each component that needs to run `connectedCallback`.
115
+ * Passed into `queueMicrotask` in `connectedCallback`. It is overridden in each component that needs to run `connectedCallback`.
98
116
  *
99
117
  * The reason for this is to make these elements work better with frameworks like Svelte. For SSR this isn't necessary, but when client side rendering, the HTML within the custom element isn't available before `connectedCallback` is called. By waiting until the next microtask, the HTML content is available---then for example, listeners can be attached to elements inside.
100
118
  */
@@ -102,7 +120,12 @@ export class Base extends HTMLElement {
102
120
  connectedCallback() {
103
121
  queueMicrotask(() => this.mount());
104
122
  }
123
+ /**
124
+ * Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallback` as well. It is overridden in each element that needs to run `disconnectedCallback`.
125
+ */
126
+ destroy() { }
105
127
  disconnectedCallback() {
128
+ this.destroy();
106
129
  this.#listenerController.abort();
107
130
  }
108
131
  }
@@ -1 +1 @@
1
- "use strict";(()=>{var r=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...i),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var s=class extends r{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...n]=e.split("-");n&&t.push({name:n.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,n)=>n.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};customElements.define("drab-breakpoint",s);})();
1
+ "use strict";(()=>{var i=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes),o=[];n instanceof HTMLTemplateElement?(o.push(n.content.cloneNode(!0)),n.content.replaceChildren(...r)):(o.push(...n.childNodes),n.replaceChildren(...r)),this.getContent().replaceChildren(...o),t&&setTimeout(()=>this.swapContent(!1),e)}}safeListener(t,e,n=document.body,r={}){r.signal=this.#t.signal,n.addEventListener(t,e,r)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var s=class extends i{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...n]=e.split("-");n&&t.push({name:n.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,n)=>n.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};customElements.define("drab-breakpoint",s);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var r=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...i),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var s=class extends r{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...n]=e.split("-");n&&t.push({name:n.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,n)=>n.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};})();
1
+ "use strict";(()=>{var i=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes),s=[];n instanceof HTMLTemplateElement?(s.push(n.content.cloneNode(!0)),n.content.replaceChildren(...r)):(s.push(...n.childNodes),n.replaceChildren(...r)),this.getContent().replaceChildren(...s),t&&setTimeout(()=>this.swapContent(!1),e)}}safeListener(t,e,n=document.body,r={}){r.signal=this.#t.signal,n.addEventListener(t,e,r)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var o=class extends i{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...n]=e.split("-");n&&t.push({name:n.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,n)=>n.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};})();
@@ -1 +1 @@
1
- "use strict";(()=>{var c=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...i),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var m=class extends c{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let n=this.getAttribute(e),[,,i]=e.split("-");n&&(i==="duration"||i==="delay"?t[i]=Number(n):i==="easing"&&(t[i]=n))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:n={}}=t,i=this.keyframes;if(i.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){n=Object.assign(this.animationOptions,n),n.duration||(n.duration=200),n.easing||(n.easing="ease-in-out");let r=i.at(0),s=i.at(-1);if(r&&s){let a=["composite","easing","offset"];for(let l of a)delete r[l],delete s[l]}n.direction?.includes("reverse")&&([r,s]=[s,r]),Object.assign(e.style,r),await e.animate(i,n).finished,Object.assign(e.style,s)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let n=this.getAttribute(e),[,,i,...r]=e.split("-");if(e.startsWith("animation-keyframe-")){let s=r.map((o,a)=>a<1?o:o.at(0)?.toUpperCase()+o.slice(1)).join("");if(i&&s){i==="from"?i="0":i==="to"?i="1":i=String(parseInt(i)*.01);let o=Number(i),a=t.find(l=>l.offset===o);a?a[s]=n:t.push({[s]:n,offset:o})}}}return t.sort((e,n)=>Number(e.offset)-Number(n.offset)),t}};var f=class extends m{#t;constructor(){super()}set#e(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,n=window.scrollX,i=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,r=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,s=i+n,o=r+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let a=this.getContent().offsetWidth+24,l=this.getContent().offsetHeight+6,u=window.innerWidth,d=window.innerHeight;s+a>n+u&&(s=n+u-a),o+l>e+d&&(o=e+d-l),this.#e={x:s,y:o},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};customElements.define("drab-contextmenu",f);})();
1
+ "use strict";(()=>{var l=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes),s=[];n instanceof HTMLTemplateElement?(s.push(n.content.cloneNode(!0)),n.content.replaceChildren(...i)):(s.push(...n.childNodes),n.replaceChildren(...i)),this.getContent().replaceChildren(...s),t&&setTimeout(()=>this.swapContent(!1),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var m=class extends l{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let n=this.getAttribute(e),[,,i]=e.split("-");n&&(i==="duration"||i==="delay"?t[i]=Number(n):i==="easing"&&(t[i]=n))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:n={}}=t,i=this.keyframes;if(i.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){n=Object.assign(this.animationOptions,n),n.duration||(n.duration=200),n.easing||(n.easing="ease-in-out");let s=i.at(0),o=i.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let c of a)delete s[c],delete o[c]}n.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(e.style,s),await e.animate(i,n).finished,Object.assign(e.style,o)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let n=this.getAttribute(e),[,,i,...s]=e.split("-");if(e.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(i&&o){i==="from"?i="0":i==="to"?i="1":i=String(parseInt(i)*.01);let r=Number(i),a=t.find(c=>c.offset===r);a?a[o]=n:t.push({[o]:n,offset:r})}}}return t.sort((e,n)=>Number(e.offset)-Number(n.offset)),t}};var f=class extends m{#t;constructor(){super()}set#e(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,n=window.scrollX,i=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,s=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,o=i+n,r=s+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let a=this.getContent().offsetWidth+24,c=this.getContent().offsetHeight+6,h=window.innerWidth,d=window.innerHeight;o+a>n+h&&(o=n+h-a),r+c>e+d&&(r=e+d-c),this.#e={x:o,y:r},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};customElements.define("drab-contextmenu",f);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var c=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...i),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var m=class extends c{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let n=this.getAttribute(e),[,,i]=e.split("-");n&&(i==="duration"||i==="delay"?t[i]=Number(n):i==="easing"&&(t[i]=n))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:n={}}=t,i=this.keyframes;if(i.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){n=Object.assign(this.animationOptions,n),n.duration||(n.duration=200),n.easing||(n.easing="ease-in-out");let r=i.at(0),s=i.at(-1);if(r&&s){let a=["composite","easing","offset"];for(let l of a)delete r[l],delete s[l]}n.direction?.includes("reverse")&&([r,s]=[s,r]),Object.assign(e.style,r),await e.animate(i,n).finished,Object.assign(e.style,s)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let n=this.getAttribute(e),[,,i,...r]=e.split("-");if(e.startsWith("animation-keyframe-")){let s=r.map((o,a)=>a<1?o:o.at(0)?.toUpperCase()+o.slice(1)).join("");if(i&&s){i==="from"?i="0":i==="to"?i="1":i=String(parseInt(i)*.01);let o=Number(i),a=t.find(l=>l.offset===o);a?a[s]=n:t.push({[s]:n,offset:o})}}}return t.sort((e,n)=>Number(e.offset)-Number(n.offset)),t}};var d=class extends m{#t;constructor(){super()}set#e(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,n=window.scrollX,i=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,r=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,s=i+n,o=r+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let a=this.getContent().offsetWidth+24,l=this.getContent().offsetHeight+6,h=window.innerWidth,u=window.innerHeight;s+a>n+h&&(s=n+h-a),o+l>e+u&&(o=e+u-l),this.#e={x:s,y:o},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};})();
1
+ "use strict";(()=>{var c=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let i=Array.from(this.getContent().childNodes),s=[];n instanceof HTMLTemplateElement?(s.push(n.content.cloneNode(!0)),n.content.replaceChildren(...i)):(s.push(...n.childNodes),n.replaceChildren(...i)),this.getContent().replaceChildren(...s),t&&setTimeout(()=>this.swapContent(!1),e)}}safeListener(t,e,n=document.body,i={}){i.signal=this.#t.signal,n.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var m=class extends c{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let n=this.getAttribute(e),[,,i]=e.split("-");n&&(i==="duration"||i==="delay"?t[i]=Number(n):i==="easing"&&(t[i]=n))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:n={}}=t,i=this.keyframes;if(i.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){n=Object.assign(this.animationOptions,n),n.duration||(n.duration=200),n.easing||(n.easing="ease-in-out");let s=i.at(0),o=i.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}n.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(e.style,s),await e.animate(i,n).finished,Object.assign(e.style,o)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let n=this.getAttribute(e),[,,i,...s]=e.split("-");if(e.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(i&&o){i==="from"?i="0":i==="to"?i="1":i=String(parseInt(i)*.01);let r=Number(i),a=t.find(l=>l.offset===r);a?a[o]=n:t.push({[o]:n,offset:r})}}}return t.sort((e,n)=>Number(e.offset)-Number(n.offset)),t}};var d=class extends m{#t;constructor(){super()}set#e(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,n=window.scrollX,i=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,s=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,o=i+n,r=s+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let a=this.getContent().offsetWidth+24,l=this.getContent().offsetHeight+6,h=window.innerWidth,u=window.innerHeight;o+a>n+h&&(o=n+h-a),r+l>e+u&&(r=e+u-l),this.#e={x:o,y:r},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};})();
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let t=this.querySelector(this.getAttribute("content")??"[data-content]");if(t instanceof e)return t;throw new Error("Content not found")}swapContent(e=!0,t=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...r),t)}}safeListener(e,t,n=document.body,r={}){r.signal=this.#e.signal,n.addEventListener(e,t,r)}triggerListener(e,t=this.event){for(let n of this.getTrigger())n.addEventListener(t,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var i=class extends s{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}async copy(e=this.value){await navigator.clipboard.writeText(e),this.swapContent()}};var o=class extends i{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};customElements.define("drab-copy",o);})();
1
+ "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),a=[];t instanceof HTMLTemplateElement?(a.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(a.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...a),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var o=class extends s{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}async copy(e=this.value){await navigator.clipboard.writeText(e),this.swapContent()}};var i=class extends o{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};customElements.define("drab-copy",i);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...r),e)}}safeListener(t,e,n=document.body,r={}){r.signal=this.#t.signal,n.addEventListener(t,e,r)}triggerListener(t,e=this.event){for(let n of this.getTrigger())n.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var i=class extends s{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}async copy(t=this.value){await navigator.clipboard.writeText(t),this.swapContent()}};var a=class extends i{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};})();
1
+ "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),i=[];t instanceof HTMLTemplateElement?(i.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(i.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...i),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var o=class extends s{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}async copy(e=this.value){await navigator.clipboard.writeText(e),this.swapContent()}};var l=class extends o{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};})();
@@ -1,9 +1,9 @@
1
- "use strict";(()=>{var P=Object.defineProperty;var B=(o,t)=>{for(var e in t)P(o,e,{get:t[e],enumerable:!0})};var L={};B(L,{Animate:()=>c,Base:()=>h,Breakpoint:()=>g,ContextMenu:()=>d,Copy:()=>y,Details:()=>b,Dialog:()=>A,Editor:()=>w,Fullscreen:()=>v,Popover:()=>E,Share:()=>k,TableSort:()=>T,YouTube:()=>C});var h=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let i=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(i){let s=Array.from(this.getContent().childNodes);i instanceof HTMLTemplateElement?this.getContent().replaceChildren(i.content.cloneNode(!0)):this.getContent().replaceChildren(...i.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...s),e)}}safeListener(t,e,i=document.body,s={}){s.signal=this.#t.signal,i.addEventListener(t,e,s)}triggerListener(t,e=this.event){for(let i of this.getTrigger())i.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var c=class extends h{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let i=this.getAttribute(e),[,,s]=e.split("-");i&&(s==="duration"||s==="delay"?t[s]=Number(i):s==="easing"&&(t[s]=i))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:i={}}=t,s=this.keyframes;if(s.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){i=Object.assign(this.animationOptions,i),i.duration||(i.duration=200),i.easing||(i.easing="ease-in-out");let r=s.at(0),n=s.at(-1);if(r&&n){let l=["composite","easing","offset"];for(let u of l)delete r[u],delete n[u]}i.direction?.includes("reverse")&&([r,n]=[n,r]),Object.assign(e.style,r),await e.animate(s,i).finished,Object.assign(e.style,n)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let i=this.getAttribute(e),[,,s,...r]=e.split("-");if(e.startsWith("animation-keyframe-")){let n=r.map((a,l)=>l<1?a:a.at(0)?.toUpperCase()+a.slice(1)).join("");if(s&&n){s==="from"?s="0":s==="to"?s="1":s=String(parseInt(s)*.01);let a=Number(s),l=t.find(u=>u.offset===a);l?l[n]=i:t.push({[n]:i,offset:a})}}}return t.sort((e,i)=>Number(e.offset)-Number(i.offset)),t}};var g=class extends h{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...i]=e.split("-");i&&t.push({name:i.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,i)=>i.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};var d=class extends c{#t;constructor(){super()}set#r(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,i=window.scrollX,s=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,r=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,n=s+i,a=r+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let l=this.getContent().offsetWidth+24,u=this.getContent().offsetHeight+6,m=window.innerWidth,p=window.innerHeight;n+l>i+m&&(n=i+m-l),a+u>e+p&&(a=e+p-u),this.#r={x:n,y:a},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};var f=class extends h{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}async copy(t=this.value){await navigator.clipboard.writeText(t),this.swapContent()}};var y=class extends f{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};var b=class extends c{constructor(){super()}get details(){let t=this.getContent(HTMLElement).parentElement;if(!(t instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return t}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()})}};var A=class extends c{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",t=>{t.key==="Escape"&&this.dialog.open&&(t.preventDefault(),this.close())})}};var w=class extends h{#t=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#r)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#r(){let t=[];for(let e of this.getTrigger())t.push(this.#a(e));return t}get#u(){let t=this.text.split("```"),e=0;for(let[i,s]of t.entries())if(e+=s.length+3,this.#i<e)return i;return 0}get#e(){return this.textArea.selectionEnd}get#i(){return this.textArea.selectionStart}#s(t,e){this.textArea.setSelectionRange(t,e)}#a(t){let e=t.dataset.type,i=t.dataset.value,s=t.dataset.key??void 0;return{type:e,value:i,key:s}}async#h(t,e,i){if(t.type==="inline")this.text=`${this.text.slice(0,i)}${t.value}${this.text.slice(i)}`;else if(t.type==="wrap")this.text=N(this.text,t.value,e),this.text=N(this.text,this.keyPairs[t.value],i+t.value.length),t.value.length<2&&this.#t.push(t.value);else if(t.type==="block"){let{lines:s,lineNumber:r}=this.#o(),n=t.value.at(0);n&&s[r]?.startsWith(n)?s[r]=t.value.trim()+s[r]:s[r]=t.value+s[r],this.text=s.join(`
2
- `)}}async#c(t,e,i){let s=0,r=0;if(/[a-z]/i.test(t)){for(let n=i;n<this.text.length;n++)if(this.text[n]?.match(/[a-z]/i))s?r=n+1:s=n;else if(s)break}else s=e+t.length,r=i+t.length;this.#s(s,r),this.textArea.focus()}async#n(t){let e=this.#e,i=this.#i;await this.#h(t,i,e),this.#c(t.value,i,e)}#m(t){if(t){let e=[];this.#r.forEach(s=>{s.type==="block"&&e.push(s.value)});for(let s=0;s<e.length;s++){let r=e[s];if(r&&t.startsWith(r))return r}let i=S(t);if(i)return`${i}. `}return""}#o(){let t=this.text.split(`
3
- `),e=0;for(let i=0;i<t.length;i++){let s=t.at(i)?.length??0;if(e++,e+=s,e>this.#e)return{lines:t,lineNumber:i,columnNumber:this.#e-(e-s-1)}}return{lines:t,lineNumber:0,columnNumber:0}}#l(t,e=!1){let{lines:i}=this.#o();for(let s=t+1;s<i.length;s++){let r=i[s];if(r){let n=S(r);if(n){let a;if(e)if(n>1)a=n-1;else break;else a=n+1;i[s]=r.slice(String(n).length),i[s]=String(a)+i[s]}else break}}this.text=i.join(`
4
- `)}mount(){this.textArea.addEventListener("keydown",async t=>{let e=["ArrowUp","ArrowDown","Delete"],i=this.text[this.#e]??"";if(e.includes(t.key))this.#t=[];else if(t.key==="Backspace"){let s=this.text[this.#i-1];if(s&&s in this.keyPairs&&i===this.keyPairs[s]){t.preventDefault();let r=this.#i-1,n=this.#e-1;this.text=x(this.text,r),this.text=x(this.text,n),setTimeout(()=>{this.#s(r,n)},0),this.#t.pop()}if(s===`
5
- `&&this.#i===this.#e){t.preventDefault();let r=this.#i-1,{lineNumber:n}=this.#o();this.#l(n,!0),this.text=x(this.text,r),setTimeout(async()=>{this.#s(r,r)},0)}}else if(t.key==="Tab")this.#u%2!==0&&(t.preventDefault(),await this.#n({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:s,lineNumber:r,columnNumber:n}=this.#o(),a=s.at(r),l=this.#m(a),u=l,m=S(l);if(m&&(l=`${m+1}. `),l&&u.length<n)t.preventDefault(),m&&this.#l(r),await this.#n({type:"inline",value:`
6
- ${l}`});else if(l&&u.length===n){t.preventDefault();let p=this.#e,M=p-u.length;for(let H=0;H<u.length;H++)this.text=x(this.text,p-(H+1));setTimeout(async()=>{this.#s(M,M),this.textArea.focus(),await this.#n({type:"inline",value:`
7
- `})},0)}}else{let s=Object.values(this.keyPairs).includes(i),r=this.#i!==this.#e;if((t.ctrlKey||t.metaKey)&&this.#i===this.#e&&(t.key==="c"||t.key==="x")){t.preventDefault();let{lines:n,lineNumber:a,columnNumber:l}=this.#o();if(await navigator.clipboard.writeText(`${a===0&&t.key==="x"?"":`
8
- `}${n[a]}`),t.key==="x"){let u=this.#i-l;n.splice(a,1),this.text=n.join(`
9
- `),setTimeout(()=>{this.#s(u,u)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let n=this.#r.find(a=>a.key===t.key);n&&this.#n(n)}else s&&(i===t.key||t.key==="ArrowRight")&&this.#t.length&&!r?(t.preventDefault(),this.#s(this.#i+1,this.#e+1),this.#t.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#n({type:"wrap",value:t.key}),this.#t.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#i!==this.#e&&(this.text[this.#i]===" "&&this.#s(this.#i+1,this.#e),this.text[this.#e-1]===" "&&this.#s(this.#i,this.#e-1))}),this.textArea.addEventListener("click",()=>this.#t=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#n(this.#a(t))})}},S=o=>{let t=o.match(/^(\d+)\./);return t?Number(t[1]):null},N=(o,t,e)=>o.slice(0,e)+t+o.slice(e),x=(o,t)=>o.slice(0,t)+o.slice(t+1);var v=class extends h{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let t of this.getTrigger())!this.fullscreenSupported()&&t instanceof HTMLButtonElement&&(t.disabled=!0)}};var E=class extends c{constructor(){super()}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}async show(){this.getContent().showPopover(),await this.animateElement()}async hide(){await this.animateElement({options:{direction:"reverse"}}),this.getContent().hidePopover()}async toggle(){this.open?this.hide():this.show()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()}),this.getContent().addEventListener("toggle",t=>{t.newState==="open"?this.open=!0:this.open=!1}),this.safeListener("keydown",t=>{t.key==="Escape"&&this.open&&(t.preventDefault(),this.hide())})}};var k=class extends f{constructor(){super()}async share(t=this.value){if(navigator.canShare&&navigator.canShare({url:t}))try{await navigator.share({url:t})}catch(e){e?.name!=="AbortError"&&console.error(e)}else this.copy()}mount(){this.triggerListener(async()=>await this.share())}};var T=class extends h{constructor(){super()}#t(t){let e="data-asc",i="data-desc";for(let s of this.getTrigger())s!==t&&(s.removeAttribute(e),s.removeAttribute(i));return t.hasAttribute(e)?(t.removeAttribute(e),t.setAttribute(i,""),!1):(t.removeAttribute(i),t.setAttribute(e,""),!0)}mount(){let t=this.getContent(HTMLTableSectionElement);for(let e of this.getTrigger())e.addEventListener(this.event,()=>{Array.from(t.querySelectorAll("tr")).sort(j(e,this.#t(e))).forEach(i=>t.appendChild(i))})}},j=(o,t)=>(i,s)=>{let r=Array.from(o.parentNode?.children??[]).indexOf(o);return((a,l)=>{let u=o.dataset.type??"string";if(u==="string")return new Intl.Collator().compare(a,l);if(u==="boolean"){let m=p=>["0","false","null","undefined"].includes(p)?!1:!!p;return m(a)===m(l)?0:m(a)?-1:1}else return Number(a)-Number(l)})(D(t?i:s,r),D(t?s:i,r))},D=(o,t)=>{let e=o.children[t];return e instanceof HTMLElement?e.dataset.value??e.textContent??"":""};var C=class extends h{static observedAttributes=["autoplay","start","uid"];constructor(){super()}get iframe(){return this.getContent(HTMLIFrameElement)}get autoplay(){return this.hasAttribute("autoplay")}set autoplay(t){t?this.setAttribute("autoplay",""):this.removeAttribute("autoplay")}get start(){return this.getAttribute("start")??"0"}set start(t){this.setAttribute("start",t)}get uid(){let t=this.getAttribute("uid");if(!t)throw new Error("YouTube: missing `uid` attribute.");return t}set uid(t){this.setAttribute("uid",t)}mount(){this.iframe.allowFullscreen=!0,this.iframe.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"}attributeChangedCallback(){queueMicrotask(()=>{this.iframe.src=`https://www.youtube-nocookie.com/embed/${this.uid}?start=${this.start}${this.autoplay?"&autoplay=1":""}`})}};for(let o in L)customElements.define(`drab-${o.toLowerCase()}`,L[o]);})();
1
+ "use strict";(()=>{var B=Object.defineProperty;var $=(o,t)=>{for(var e in t)B(o,e,{get:t[e],enumerable:!0})};var S={};$(S,{Animate:()=>p,Base:()=>c,Breakpoint:()=>d,ContextMenu:()=>g,Copy:()=>y,Details:()=>b,Dialog:()=>A,Editor:()=>k,Fullscreen:()=>v,Popover:()=>w,Prefetch:()=>E,Share:()=>T,TableSort:()=>L,WakeLock:()=>C,YouTube:()=>M});var c=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let e=this.querySelector(this.getAttribute("content")??"[data-content]");if(e instanceof t)return e;throw new Error("Content not found")}swapContent(t=!0,e=800){let s=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(s){let i=Array.from(this.getContent().childNodes),n=[];s instanceof HTMLTemplateElement?(n.push(s.content.cloneNode(!0)),s.content.replaceChildren(...i)):(n.push(...s.childNodes),s.replaceChildren(...i)),this.getContent().replaceChildren(...n),t&&setTimeout(()=>this.swapContent(!1),e)}}safeListener(t,e,s=document.body,i={}){i.signal=this.#t.signal,s.addEventListener(t,e,i)}triggerListener(t,e=this.event){for(let s of this.getTrigger())s.addEventListener(e,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var p=class extends c{constructor(){super()}get animationOptions(){let t={};for(let e of this.getAttributeNames())if(e.startsWith("animation-option-")){let s=this.getAttribute(e),[,,i]=e.split("-");s&&(i==="duration"||i==="delay"?t[i]=Number(s):i==="easing"&&(t[i]=s))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:e=this.getContent(),options:s={}}=t,i=this.keyframes;if(i.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){s=Object.assign(this.animationOptions,s),s.duration||(s.duration=200),s.easing||(s.easing="ease-in-out");let n=i.at(0),r=i.at(-1);if(n&&r){let u=["composite","easing","offset"];for(let l of u)delete n[l],delete r[l]}s.direction?.includes("reverse")&&([n,r]=[r,n]),Object.assign(e.style,n),await e.animate(i,s).finished,Object.assign(e.style,r)}}get keyframes(){let t=[];for(let e of this.getAttributeNames()){let s=this.getAttribute(e),[,,i,...n]=e.split("-");if(e.startsWith("animation-keyframe-")){let r=n.map((a,u)=>u<1?a:a.at(0)?.toUpperCase()+a.slice(1)).join("");if(i&&r){i==="from"?i="0":i==="to"?i="1":i=String(parseInt(i)*.01);let a=Number(i),u=t.find(l=>l.offset===a);u?u[r]=s:t.push({[r]:s,offset:a})}}}return t.sort((e,s)=>Number(e.offset)-Number(s.offset)),t}};var d=class extends c{breakpoints=[{name:"sm",width:640},{name:"md",width:768},{name:"lg",width:1024},{name:"xl",width:1280},{name:"2xl",width:1536}];constructor(){super();let t=[];for(let e of this.getAttributeNames())if(e.startsWith("breakpoint-")){let[,...s]=e.split("-");s&&t.push({name:s.join("-"),width:Number(this.getAttribute(e))})}t.length&&(this.breakpoints=t),this.breakpoints.sort((e,s)=>s.width-e.width)}get breakpoint(){for(let t=0;t<this.breakpoints.length;t++){let e=this.breakpoints[t];if(e&&window.innerWidth>e.width)return e.name}return"none"}mount(){let t=()=>this.getContent().innerHTML=`${this.breakpoint}:${window.innerWidth}`;t(),this.safeListener("resize",t,window)}};var g=class extends p{#t;constructor(){super()}set#i(t){this.getContent().style.left=`${t.x}px`,this.getContent().style.top=`${t.y}px`}async show(t){let e=window.scrollY,s=window.scrollX,i=t instanceof MouseEvent?t.clientX:t.touches[0]?.clientX??0,n=t instanceof MouseEvent?t.clientY:t.touches[0]?.clientY??0,r=i+s,a=n+e;this.getContent().style.position="absolute",this.getContent().style.display="block";let u=this.getContent().offsetWidth+24,l=this.getContent().offsetHeight+6,h=window.innerWidth,m=window.innerHeight;r+u>s+h&&(r=s+h-u),a+l>e+m&&(a=e+m-l),this.#i={x:r,y:a},await this.animateElement()}async hide(){this.getContent().style.display!=="none"&&(await this.animateElement({options:{direction:"reverse"}}),this.getContent().style.display="none")}mount(){this.triggerListener(e=>{e.preventDefault(),this.show(e)},"contextmenu"),this.safeListener("click",()=>this.hide()),this.triggerListener(e=>{this.#t=setTimeout(()=>{this.show(e)},800)},"touchstart");let t=()=>clearTimeout(this.#t);this.triggerListener(t,"touchend"),this.triggerListener(t,"touchcancel"),this.safeListener("keydown",e=>{e.key==="Escape"&&this.hide()})}};var f=class extends c{constructor(){super()}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}async copy(t=this.value){await navigator.clipboard.writeText(t),this.swapContent()}};var y=class extends f{constructor(){super()}mount(){this.triggerListener(async()=>await this.copy())}};var b=class extends p{constructor(){super()}get details(){let t=this.getContent(HTMLElement).parentElement;if(!(t instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return t}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()})}};var A=class extends p{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",t=>{t.key==="Escape"&&this.dialog.open&&(t.preventDefault(),this.close())})}};var k=class extends c{#t=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#i)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#i(){let t=[];for(let e of this.getTrigger())t.push(this.#l(e));return t}get#a(){let t=this.text.split("```"),e=0;for(let[s,i]of t.entries())if(e+=i.length+3,this.#s<e)return s;return 0}get#e(){return this.textArea.selectionEnd}get#s(){return this.textArea.selectionStart}#r(t,e){this.textArea.setSelectionRange(t,e)}#l(t){let e=t.dataset.type,s=t.dataset.value,i=t.dataset.key??void 0;return{type:e,value:s,key:i}}async#c(t,e,s){if(t.type==="inline")this.text=`${this.text.slice(0,s)}${t.value}${this.text.slice(s)}`;else if(t.type==="wrap")this.text=P(this.text,t.value,e),this.text=P(this.text,this.keyPairs[t.value],s+t.value.length),t.value.length<2&&this.#t.push(t.value);else if(t.type==="block"){let{lines:i,lineNumber:n}=this.#o(),r=t.value.at(0);r&&i[n]?.startsWith(r)?i[n]=t.value.trim()+i[n]:i[n]=t.value+i[n],this.text=i.join(`
2
+ `)}}async#h(t,e,s){let i=0,n=0;if(/[a-z]/i.test(t)){for(let r=s;r<this.text.length;r++)if(this.text[r]?.match(/[a-z]/i))i?n=r+1:i=r;else if(i)break}else i=e+t.length,n=s+t.length;this.#r(i,n),this.textArea.focus()}async#n(t){let e=this.#e,s=this.#s;await this.#c(t,s,e),this.#h(t.value,s,e)}#p(t){if(t){let e=[];this.#i.forEach(i=>{i.type==="block"&&e.push(i.value)});for(let i=0;i<e.length;i++){let n=e[i];if(n&&t.startsWith(n))return n}let s=D(t);if(s)return`${s}. `}return""}#o(){let t=this.text.split(`
3
+ `),e=0;for(let s=0;s<t.length;s++){let i=t.at(s)?.length??0;if(e++,e+=i,e>this.#e)return{lines:t,lineNumber:s,columnNumber:this.#e-(e-i-1)}}return{lines:t,lineNumber:0,columnNumber:0}}#u(t,e=!1){let{lines:s}=this.#o();for(let i=t+1;i<s.length;i++){let n=s[i];if(n){let r=D(n);if(r){let a;if(e)if(r>1)a=r-1;else break;else a=r+1;s[i]=n.slice(String(r).length),s[i]=String(a)+s[i]}else break}}this.text=s.join(`
4
+ `)}mount(){this.textArea.addEventListener("keydown",async t=>{let e=["ArrowUp","ArrowDown","Delete"],s=this.text[this.#e]??"";if(e.includes(t.key))this.#t=[];else if(t.key==="Backspace"){let i=this.text[this.#s-1];if(i&&i in this.keyPairs&&s===this.keyPairs[i]){t.preventDefault();let n=this.#s-1,r=this.#e-1;this.text=x(this.text,n),this.text=x(this.text,r),setTimeout(()=>{this.#r(n,r)},0),this.#t.pop()}if(i===`
5
+ `&&this.#s===this.#e){t.preventDefault();let n=this.#s-1,{lineNumber:r}=this.#o();this.#u(r,!0),this.text=x(this.text,n),setTimeout(async()=>{this.#r(n,n)},0)}}else if(t.key==="Tab")this.#a%2!==0&&(t.preventDefault(),await this.#n({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:i,lineNumber:n,columnNumber:r}=this.#o(),a=i.at(n),u=this.#p(a),l=u,h=D(u);if(h&&(u=`${h+1}. `),u&&l.length<r)t.preventDefault(),h&&this.#u(n),await this.#n({type:"inline",value:`
6
+ ${u}`});else if(u&&l.length===r){t.preventDefault();let m=this.#e,H=m-l.length;for(let N=0;N<l.length;N++)this.text=x(this.text,m-(N+1));setTimeout(async()=>{this.#r(H,H),this.textArea.focus(),await this.#n({type:"inline",value:`
7
+ `})},0)}}else{let i=Object.values(this.keyPairs).includes(s),n=this.#s!==this.#e;if((t.ctrlKey||t.metaKey)&&this.#s===this.#e&&(t.key==="c"||t.key==="x")){t.preventDefault();let{lines:r,lineNumber:a,columnNumber:u}=this.#o();if(await navigator.clipboard.writeText(`${a===0&&t.key==="x"?"":`
8
+ `}${r[a]}`),t.key==="x"){let l=this.#s-u;r.splice(a,1),this.text=r.join(`
9
+ `),setTimeout(()=>{this.#r(l,l)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let r=this.#i.find(a=>a.key===t.key);r&&this.#n(r)}else i&&(s===t.key||t.key==="ArrowRight")&&this.#t.length&&!n?(t.preventDefault(),this.#r(this.#s+1,this.#e+1),this.#t.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#n({type:"wrap",value:t.key}),this.#t.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#s!==this.#e&&(this.text[this.#s]===" "&&this.#r(this.#s+1,this.#e),this.text[this.#e-1]===" "&&this.#r(this.#s,this.#e-1))}),this.textArea.addEventListener("click",()=>this.#t=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#n(this.#l(t))})}},D=o=>{let t=o.match(/^(\d+)\./);return t?Number(t[1]):null},P=(o,t,e)=>o.slice(0,e)+t+o.slice(e),x=(o,t)=>o.slice(0,t)+o.slice(t+1);var v=class extends c{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let t of this.getTrigger())!this.fullscreenSupported()&&"disabled"in t&&(t.disabled=!0)}};var w=class extends p{constructor(){super()}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}async show(){this.getContent().showPopover(),await this.animateElement()}async hide(){await this.animateElement({options:{direction:"reverse"}}),this.getContent().hidePopover()}async toggle(){this.open?this.hide():this.show()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()}),this.getContent().addEventListener("toggle",t=>{t.newState==="open"?this.open=!0:this.open=!1}),this.safeListener("keydown",t=>{t.key==="Escape"&&this.open&&(t.preventDefault(),this.hide())})}};var E=class extends c{constructor(){super()}get#t(){return this.getAttribute("strategy")??"hover"}get#i(){return this.hasAttribute("prerender")}get#a(){return this.getAttribute("url")}appendTag(t){let{url:e,prerender:s}=t;if(e!==window.location.href){let i="speculationrules";if(!(r=>{if(document.querySelector(`link[href='${r}']`))return!0;let a=document.querySelectorAll(`script[type='${i}']`);for(let u of a)if(JSON.parse(u.textContent??"{}").prerender?.at(0)?.urls?.includes(r))return!0;return!1})(e))if(s&&HTMLScriptElement.supports&&HTMLScriptElement.supports(i)){let r=document.createElement("script");r.type=i,r.textContent=JSON.stringify({prerender:[{source:"list",urls:[e]}]}),document.head.append(r)}else{let r=document.createElement("link");r.rel="prefetch",r.as="document",r.href=e,document.head.append(r)}}}prefetch(t={anchors:this.getTrigger(),prerender:this.#i,strategy:this.#t}){let{anchors:e=this.getTrigger(),prerender:s=this.#i,strategy:i=this.#t}=t,n,r=(l=200)=>h=>{let{href:m}=h.currentTarget;n=setTimeout(()=>this.appendTag({url:m,prerender:s}),l)},a=()=>clearTimeout(n),u=new IntersectionObserver(l=>{for(let h of l)h.isIntersecting&&this.appendTag({url:h.target.href,prerender:s})});for(let l of e)i==="load"?this.appendTag({url:l.href,prerender:s}):i==="visible"?u.observe(l):(l.addEventListener("mouseover",r()),l.addEventListener("mouseout",a),l.addEventListener("focus",r()),l.addEventListener("focusout",a),l.addEventListener("touchstart",r(0)))}mount(){this.#a&&this.appendTag({url:this.#a,prerender:this.#i}),this.prefetch()}};var T=class extends f{constructor(){super()}async share(t=this.value){if(navigator.canShare&&navigator.canShare({url:t}))try{await navigator.share({url:t})}catch(e){e?.name!=="AbortError"&&console.error(e)}else this.copy()}mount(){this.triggerListener(async()=>await this.share())}};var L=class extends c{constructor(){super()}#t(t){let e="data-asc",s="data-desc";for(let i of this.getTrigger())i!==t&&(i.removeAttribute(e),i.removeAttribute(s));return t.hasAttribute(e)?(t.removeAttribute(e),t.setAttribute(s,""),!1):(t.removeAttribute(s),t.setAttribute(e,""),!0)}mount(){let t=this.getContent(HTMLTableSectionElement);for(let e of this.getTrigger())e.addEventListener(this.event,()=>{Array.from(t.querySelectorAll("tr")).sort(K(e,this.#t(e))).forEach(s=>t.appendChild(s))})}},K=(o,t)=>(s,i)=>{let n=Array.from(o.parentNode?.children??[]).indexOf(o);return((a,u)=>{let l=o.dataset.type??"string";if(l==="string")return new Intl.Collator().compare(a,u);if(l==="boolean"){let h=m=>["0","false","null","undefined"].includes(m)?!1:!!m;return h(a)===h(u)?0:h(a)?-1:1}else return Number(a)-Number(u)})(j(t?s:i,n),j(t?i:s,n))},j=(o,t)=>{let e=o.children[t];return e instanceof HTMLElement?e.dataset.value??e.textContent??"":""};var C=class extends c{wakeLock=null;constructor(){super()}#t(){return"wakeLock"in navigator}get#i(){return this.hasAttribute("auto-lock")}async request(){this.#t()&&document.visibilityState==="visible"&&(this.wakeLock=await navigator.wakeLock.request("screen"),this.setAttribute("locked",""),this.swapContent(!1),this.wakeLock.addEventListener("release",()=>{this.removeAttribute("locked"),this.swapContent(!1),this.#i||(this.wakeLock=null)}))}async release(){await this.wakeLock?.release(),this.wakeLock=null}mount(){this.hasAttribute("locked")&&this.request(),this.triggerListener(()=>{this.wakeLock?this.release():this.request()});for(let t of this.getTrigger())!this.#t()&&"disabled"in t&&(t.disabled=!0);this.#i&&this.safeListener("visibilitychange",()=>{this.wakeLock&&this.request()},document)}destroy(){this.release()}};var M=class extends c{static observedAttributes=["autoplay","start","uid"];constructor(){super()}get iframe(){return this.getContent(HTMLIFrameElement)}get autoplay(){return this.hasAttribute("autoplay")}set autoplay(t){t?this.setAttribute("autoplay",""):this.removeAttribute("autoplay")}get start(){return this.getAttribute("start")??"0"}set start(t){this.setAttribute("start",t)}get uid(){let t=this.getAttribute("uid");if(!t)throw new Error("YouTube: missing `uid` attribute.");return t}set uid(t){this.setAttribute("uid",t)}mount(){this.iframe.allowFullscreen=!0,this.iframe.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"}attributeChangedCallback(){queueMicrotask(()=>{this.iframe.src=`https://www.youtube-nocookie.com/embed/${this.uid}?start=${this.start}${this.autoplay?"&autoplay=1":""}`})}};for(let o in S)customElements.define(`drab-${o.toLowerCase()}`,S[o]);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof e)return i;throw new Error("Content not found")}swapContent(e=!0,i=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let n=Array.from(this.getContent().childNodes);t instanceof HTMLTemplateElement?this.getContent().replaceChildren(t.content.cloneNode(!0)):this.getContent().replaceChildren(...t.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...n),i)}}safeListener(e,i,t=document.body,n={}){n.signal=this.#e.signal,t.addEventListener(e,i,n)}triggerListener(e,i=this.event){for(let t of this.getTrigger())t.addEventListener(i,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let e={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let t=this.getAttribute(i),[,,n]=i.split("-");t&&(n==="duration"||n==="delay"?e[n]=Number(t):n==="easing"&&(e[n]=t))}return e}async animateElement(e={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:t={}}=e,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){t=Object.assign(this.animationOptions,t),t.duration||(t.duration=200),t.easing||(t.easing="ease-in-out");let o=n.at(0),s=n.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let l of a)delete o[l],delete s[l]}t.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(i.style,o),await i.animate(n,t).finished,Object.assign(i.style,s)}}get keyframes(){let e=[];for(let i of this.getAttributeNames()){let t=this.getAttribute(i),[,,n,...o]=i.split("-");if(i.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&s){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=e.find(l=>l.offset===r);a?a[s]=t:e.push({[s]:t,offset:r})}}}return e.sort((i,t)=>Number(i.offset)-Number(t.offset)),e}};var c=class extends f{constructor(){super()}get details(){let e=this.getContent(HTMLElement).parentElement;if(!(e instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return e}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(e=>{e.preventDefault(),this.toggle()})}};customElements.define("drab-details",c);})();
1
+ "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof t)return i;throw new Error("Content not found")}swapContent(t=!0,i=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let n=Array.from(this.getContent().childNodes),s=[];e instanceof HTMLTemplateElement?(s.push(e.content.cloneNode(!0)),e.content.replaceChildren(...n)):(s.push(...e.childNodes),e.replaceChildren(...n)),this.getContent().replaceChildren(...s),t&&setTimeout(()=>this.swapContent(!1),i)}}safeListener(t,i,e=document.body,n={}){n.signal=this.#e.signal,e.addEventListener(t,i,n)}triggerListener(t,i=this.event){for(let e of this.getTrigger())e.addEventListener(i,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let t={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let e=this.getAttribute(i),[,,n]=i.split("-");e&&(n==="duration"||n==="delay"?t[n]=Number(e):n==="easing"&&(t[n]=e))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:e={}}=t,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let s=n.at(0),o=n.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}e.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(i.style,s),await i.animate(n,e).finished,Object.assign(i.style,o)}}get keyframes(){let t=[];for(let i of this.getAttributeNames()){let e=this.getAttribute(i),[,,n,...s]=i.split("-");if(i.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&o){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=t.find(l=>l.offset===r);a?a[o]=e:t.push({[o]:e,offset:r})}}}return t.sort((i,e)=>Number(i.offset)-Number(e.offset)),t}};var c=class extends f{constructor(){super()}get details(){let t=this.getContent(HTMLElement).parentElement;if(!(t instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return t}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()})}};customElements.define("drab-details",c);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var m=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof t)return i;throw new Error("Content not found")}swapContent(t=!0,i=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let n=Array.from(this.getContent().childNodes);e instanceof HTMLTemplateElement?this.getContent().replaceChildren(e.content.cloneNode(!0)):this.getContent().replaceChildren(...e.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...n),i)}}safeListener(t,i,e=document.body,n={}){n.signal=this.#t.signal,e.addEventListener(t,i,n)}triggerListener(t,i=this.event){for(let e of this.getTrigger())e.addEventListener(i,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let t={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let e=this.getAttribute(i),[,,n]=i.split("-");e&&(n==="duration"||n==="delay"?t[n]=Number(e):n==="easing"&&(t[n]=e))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:e={}}=t,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let o=n.at(0),s=n.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let l of a)delete o[l],delete s[l]}e.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(i.style,o),await i.animate(n,e).finished,Object.assign(i.style,s)}}get keyframes(){let t=[];for(let i of this.getAttributeNames()){let e=this.getAttribute(i),[,,n,...o]=i.split("-");if(i.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&s){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=t.find(l=>l.offset===r);a?a[s]=e:t.push({[s]:e,offset:r})}}}return t.sort((i,e)=>Number(i.offset)-Number(e.offset)),t}};var u=class extends f{constructor(){super()}get details(){let t=this.getContent(HTMLElement).parentElement;if(!(t instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return t}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()})}};})();
1
+ "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof t)return i;throw new Error("Content not found")}swapContent(t=!0,i=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let n=Array.from(this.getContent().childNodes),s=[];e instanceof HTMLTemplateElement?(s.push(e.content.cloneNode(!0)),e.content.replaceChildren(...n)):(s.push(...e.childNodes),e.replaceChildren(...n)),this.getContent().replaceChildren(...s),t&&setTimeout(()=>this.swapContent(!1),i)}}safeListener(t,i,e=document.body,n={}){n.signal=this.#e.signal,e.addEventListener(t,i,n)}triggerListener(t,i=this.event){for(let e of this.getTrigger())e.addEventListener(i,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let t={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let e=this.getAttribute(i),[,,n]=i.split("-");e&&(n==="duration"||n==="delay"?t[n]=Number(e):n==="easing"&&(t[n]=e))}return t}async animateElement(t={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:e={}}=t,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let s=n.at(0),o=n.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}e.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(i.style,s),await i.animate(n,e).finished,Object.assign(i.style,o)}}get keyframes(){let t=[];for(let i of this.getAttributeNames()){let e=this.getAttribute(i),[,,n,...s]=i.split("-");if(i.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&o){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=t.find(l=>l.offset===r);a?a[o]=e:t.push({[o]:e,offset:r})}}}return t.sort((i,e)=>Number(i.offset)-Number(e.offset)),t}};var u=class extends f{constructor(){super()}get details(){let t=this.getContent(HTMLElement).parentElement;if(!(t instanceof HTMLDetailsElement))throw new Error("Details: HTMLDetailsElement not found.");return t}async open(){this.details.open=!0,await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.details.open=!1}toggle(){this.details.open?this.close():this.open()}mount(){this.triggerListener(t=>{t.preventDefault(),this.toggle()})}};})();
@@ -1 +1 @@
1
- "use strict";(()=>{var m=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof e)return i;throw new Error("Content not found")}swapContent(e=!0,i=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let n=Array.from(this.getContent().childNodes);t instanceof HTMLTemplateElement?this.getContent().replaceChildren(t.content.cloneNode(!0)):this.getContent().replaceChildren(...t.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...n),i)}}safeListener(e,i,t=document.body,n={}){n.signal=this.#t.signal,t.addEventListener(e,i,n)}triggerListener(e,i=this.event){for(let t of this.getTrigger())t.addEventListener(i,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let e={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let t=this.getAttribute(i),[,,n]=i.split("-");t&&(n==="duration"||n==="delay"?e[n]=Number(t):n==="easing"&&(e[n]=t))}return e}async animateElement(e={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:t={}}=e,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){t=Object.assign(this.animationOptions,t),t.duration||(t.duration=200),t.easing||(t.easing="ease-in-out");let o=n.at(0),s=n.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let l of a)delete o[l],delete s[l]}t.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(i.style,o),await i.animate(n,t).finished,Object.assign(i.style,s)}}get keyframes(){let e=[];for(let i of this.getAttributeNames()){let t=this.getAttribute(i),[,,n,...o]=i.split("-");if(i.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&s){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=e.find(l=>l.offset===r);a?a[s]=t:e.push({[s]:t,offset:r})}}}return e.sort((i,t)=>Number(i.offset)-Number(t.offset)),e}};var c=class extends f{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",e=>{e.key==="Escape"&&this.dialog.open&&(e.preventDefault(),this.close())})}};customElements.define("drab-dialog",c);})();
1
+ "use strict";(()=>{var m=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(n){this.setAttribute("event",n)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(n=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof n)return i;throw new Error("Content not found")}swapContent(n=!0,i=800){let e=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(e){let t=Array.from(this.getContent().childNodes),s=[];e instanceof HTMLTemplateElement?(s.push(e.content.cloneNode(!0)),e.content.replaceChildren(...t)):(s.push(...e.childNodes),e.replaceChildren(...t)),this.getContent().replaceChildren(...s),n&&setTimeout(()=>this.swapContent(!1),i)}}safeListener(n,i,e=document.body,t={}){t.signal=this.#e.signal,e.addEventListener(n,i,t)}triggerListener(n,i=this.event){for(let e of this.getTrigger())e.addEventListener(i,n)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var c=class extends m{constructor(){super()}get animationOptions(){let n={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let e=this.getAttribute(i),[,,t]=i.split("-");e&&(t==="duration"||t==="delay"?n[t]=Number(e):t==="easing"&&(n[t]=e))}return n}async animateElement(n={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:e={}}=n,t=this.keyframes;if(t.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){e=Object.assign(this.animationOptions,e),e.duration||(e.duration=200),e.easing||(e.easing="ease-in-out");let s=t.at(0),o=t.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}e.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(i.style,s),await i.animate(t,e).finished,Object.assign(i.style,o)}}get keyframes(){let n=[];for(let i of this.getAttributeNames()){let e=this.getAttribute(i),[,,t,...s]=i.split("-");if(i.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(t&&o){t==="from"?t="0":t==="to"?t="1":t=String(parseInt(t)*.01);let r=Number(t),a=n.find(l=>l.offset===r);a?a[o]=e:n.push({[o]:e,offset:r})}}}return n.sort((i,e)=>Number(i.offset)-Number(e.offset)),n}};var f=class extends c{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",n=>{n.key==="Escape"&&this.dialog.open&&(n.preventDefault(),this.close())})}};customElements.define("drab-dialog",f);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var m=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof e)return i;throw new Error("Content not found")}swapContent(e=!0,i=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let n=Array.from(this.getContent().childNodes);t instanceof HTMLTemplateElement?this.getContent().replaceChildren(t.content.cloneNode(!0)):this.getContent().replaceChildren(...t.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...n),i)}}safeListener(e,i,t=document.body,n={}){n.signal=this.#t.signal,t.addEventListener(e,i,n)}triggerListener(e,i=this.event){for(let t of this.getTrigger())t.addEventListener(i,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#t.abort()}};var f=class extends m{constructor(){super()}get animationOptions(){let e={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let t=this.getAttribute(i),[,,n]=i.split("-");t&&(n==="duration"||n==="delay"?e[n]=Number(t):n==="easing"&&(e[n]=t))}return e}async animateElement(e={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:t={}}=e,n=this.keyframes;if(n.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){t=Object.assign(this.animationOptions,t),t.duration||(t.duration=200),t.easing||(t.easing="ease-in-out");let o=n.at(0),s=n.at(-1);if(o&&s){let a=["composite","easing","offset"];for(let l of a)delete o[l],delete s[l]}t.direction?.includes("reverse")&&([o,s]=[s,o]),Object.assign(i.style,o),await i.animate(n,t).finished,Object.assign(i.style,s)}}get keyframes(){let e=[];for(let i of this.getAttributeNames()){let t=this.getAttribute(i),[,,n,...o]=i.split("-");if(i.startsWith("animation-keyframe-")){let s=o.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(n&&s){n==="from"?n="0":n==="to"?n="1":n=String(parseInt(n)*.01);let r=Number(n),a=e.find(l=>l.offset===r);a?a[s]=t:e.push({[s]:t,offset:r})}}}return e.sort((i,t)=>Number(i.offset)-Number(t.offset)),e}};var g=class extends f{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",e=>{e.key==="Escape"&&this.dialog.open&&(e.preventDefault(),this.close())})}};})();
1
+ "use strict";(()=>{var m=class extends HTMLElement{#t=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(n){this.setAttribute("event",n)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(n=HTMLElement){let i=this.querySelector(this.getAttribute("content")??"[data-content]");if(i instanceof n)return i;throw new Error("Content not found")}swapContent(n=!0,i=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let e=Array.from(this.getContent().childNodes),s=[];t instanceof HTMLTemplateElement?(s.push(t.content.cloneNode(!0)),t.content.replaceChildren(...e)):(s.push(...t.childNodes),t.replaceChildren(...e)),this.getContent().replaceChildren(...s),n&&setTimeout(()=>this.swapContent(!1),i)}}safeListener(n,i,t=document.body,e={}){e.signal=this.#t.signal,t.addEventListener(n,i,e)}triggerListener(n,i=this.event){for(let t of this.getTrigger())t.addEventListener(i,n)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#t.abort()}};var c=class extends m{constructor(){super()}get animationOptions(){let n={};for(let i of this.getAttributeNames())if(i.startsWith("animation-option-")){let t=this.getAttribute(i),[,,e]=i.split("-");t&&(e==="duration"||e==="delay"?n[e]=Number(t):e==="easing"&&(n[e]=t))}return n}async animateElement(n={element:this.getContent(),options:{}}){let{element:i=this.getContent(),options:t={}}=n,e=this.keyframes;if(e.length&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){t=Object.assign(this.animationOptions,t),t.duration||(t.duration=200),t.easing||(t.easing="ease-in-out");let s=e.at(0),o=e.at(-1);if(s&&o){let a=["composite","easing","offset"];for(let l of a)delete s[l],delete o[l]}t.direction?.includes("reverse")&&([s,o]=[o,s]),Object.assign(i.style,s),await i.animate(e,t).finished,Object.assign(i.style,o)}}get keyframes(){let n=[];for(let i of this.getAttributeNames()){let t=this.getAttribute(i),[,,e,...s]=i.split("-");if(i.startsWith("animation-keyframe-")){let o=s.map((r,a)=>a<1?r:r.at(0)?.toUpperCase()+r.slice(1)).join("");if(e&&o){e==="from"?e="0":e==="to"?e="1":e=String(parseInt(e)*.01);let r=Number(e),a=n.find(l=>l.offset===r);a?a[o]=t:n.push({[o]:t,offset:r})}}}return n.sort((i,t)=>Number(i.offset)-Number(t.offset)),n}};var u=class extends c{constructor(){super()}get dialog(){return this.getContent(HTMLDialogElement)}async show(){this.dialog.showModal(),await this.animateElement()}async close(){await this.animateElement({options:{direction:"reverse"}}),this.dialog.close()}async toggle(){this.dialog.open?this.close():this.show()}mount(){this.triggerListener(()=>this.toggle()),this.safeListener("keydown",n=>{n.key==="Escape"&&this.dialog.open&&(n.preventDefault(),this.close())})}};})();
@@ -1,9 +1,9 @@
1
- "use strict";(()=>{var c=class extends HTMLElement{#n=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let s=this.querySelector(this.getAttribute("content")??"[data-content]");if(s instanceof t)return s;throw new Error("Content not found")}swapContent(t=!0,s=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let e=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...e),s)}}safeListener(t,s,n=document.body,e={}){e.signal=this.#n.signal,n.addEventListener(t,s,e)}triggerListener(t,s=this.event){for(let n of this.getTrigger())n.addEventListener(s,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#n.abort()}};var g=class extends c{#n=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#o)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#o(){let t=[];for(let s of this.getTrigger())t.push(this.#l(s));return t}get#h(){let t=this.text.split("```"),s=0;for(let[n,e]of t.entries())if(s+=e.length+3,this.#e<s)return n;return 0}get#t(){return this.textArea.selectionEnd}get#e(){return this.textArea.selectionStart}#s(t,s){this.textArea.setSelectionRange(t,s)}#l(t){let s=t.dataset.type,n=t.dataset.value,e=t.dataset.key??void 0;return{type:s,value:n,key:e}}async#c(t,s,n){if(t.type==="inline")this.text=`${this.text.slice(0,n)}${t.value}${this.text.slice(n)}`;else if(t.type==="wrap")this.text=v(this.text,t.value,s),this.text=v(this.text,this.keyPairs[t.value],n+t.value.length),t.value.length<2&&this.#n.push(t.value);else if(t.type==="block"){let{lines:e,lineNumber:i}=this.#r(),r=t.value.at(0);r&&e[i]?.startsWith(r)?e[i]=t.value.trim()+e[i]:e[i]=t.value+e[i],this.text=e.join(`
2
- `)}}async#u(t,s,n){let e=0,i=0;if(/[a-z]/i.test(t)){for(let r=n;r<this.text.length;r++)if(this.text[r]?.match(/[a-z]/i))e?i=r+1:e=r;else if(e)break}else e=s+t.length,i=n+t.length;this.#s(e,i),this.textArea.focus()}async#i(t){let s=this.#t,n=this.#e;await this.#c(t,n,s),this.#u(t.value,n,s)}#g(t){if(t){let s=[];this.#o.forEach(e=>{e.type==="block"&&s.push(e.value)});for(let e=0;e<s.length;e++){let i=s[e];if(i&&t.startsWith(i))return i}let n=p(t);if(n)return`${n}. `}return""}#r(){let t=this.text.split(`
1
+ "use strict";(()=>{var c=class extends HTMLElement{#n=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let s=this.querySelector(this.getAttribute("content")??"[data-content]");if(s instanceof t)return s;throw new Error("Content not found")}swapContent(t=!0,s=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let e=Array.from(this.getContent().childNodes),i=[];n instanceof HTMLTemplateElement?(i.push(n.content.cloneNode(!0)),n.content.replaceChildren(...e)):(i.push(...n.childNodes),n.replaceChildren(...e)),this.getContent().replaceChildren(...i),t&&setTimeout(()=>this.swapContent(!1),s)}}safeListener(t,s,n=document.body,e={}){e.signal=this.#n.signal,n.addEventListener(t,s,e)}triggerListener(t,s=this.event){for(let n of this.getTrigger())n.addEventListener(s,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#n.abort()}};var f=class extends c{#n=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#o)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#o(){let t=[];for(let s of this.getTrigger())t.push(this.#l(s));return t}get#h(){let t=this.text.split("```"),s=0;for(let[n,e]of t.entries())if(s+=e.length+3,this.#e<s)return n;return 0}get#t(){return this.textArea.selectionEnd}get#e(){return this.textArea.selectionStart}#s(t,s){this.textArea.setSelectionRange(t,s)}#l(t){let s=t.dataset.type,n=t.dataset.value,e=t.dataset.key??void 0;return{type:s,value:n,key:e}}async#c(t,s,n){if(t.type==="inline")this.text=`${this.text.slice(0,n)}${t.value}${this.text.slice(n)}`;else if(t.type==="wrap")this.text=x(this.text,t.value,s),this.text=x(this.text,this.keyPairs[t.value],n+t.value.length),t.value.length<2&&this.#n.push(t.value);else if(t.type==="block"){let{lines:e,lineNumber:i}=this.#r(),r=t.value.at(0);r&&e[i]?.startsWith(r)?e[i]=t.value.trim()+e[i]:e[i]=t.value+e[i],this.text=e.join(`
2
+ `)}}async#u(t,s,n){let e=0,i=0;if(/[a-z]/i.test(t)){for(let r=n;r<this.text.length;r++)if(this.text[r]?.match(/[a-z]/i))e?i=r+1:e=r;else if(e)break}else e=s+t.length,i=n+t.length;this.#s(e,i),this.textArea.focus()}async#i(t){let s=this.#t,n=this.#e;await this.#c(t,n,s),this.#u(t.value,n,s)}#f(t){if(t){let s=[];this.#o.forEach(e=>{e.type==="block"&&s.push(e.value)});for(let e=0;e<s.length;e++){let i=s[e];if(i&&t.startsWith(i))return i}let n=p(t);if(n)return`${n}. `}return""}#r(){let t=this.text.split(`
3
3
  `),s=0;for(let n=0;n<t.length;n++){let e=t.at(n)?.length??0;if(s++,s+=e,s>this.#t)return{lines:t,lineNumber:n,columnNumber:this.#t-(s-e-1)}}return{lines:t,lineNumber:0,columnNumber:0}}#a(t,s=!1){let{lines:n}=this.#r();for(let e=t+1;e<n.length;e++){let i=n[e];if(i){let r=p(i);if(r){let o;if(s)if(r>1)o=r-1;else break;else o=r+1;n[e]=i.slice(String(r).length),n[e]=String(o)+n[e]}else break}}this.text=n.join(`
4
4
  `)}mount(){this.textArea.addEventListener("keydown",async t=>{let s=["ArrowUp","ArrowDown","Delete"],n=this.text[this.#t]??"";if(s.includes(t.key))this.#n=[];else if(t.key==="Backspace"){let e=this.text[this.#e-1];if(e&&e in this.keyPairs&&n===this.keyPairs[e]){t.preventDefault();let i=this.#e-1,r=this.#t-1;this.text=u(this.text,i),this.text=u(this.text,r),setTimeout(()=>{this.#s(i,r)},0),this.#n.pop()}if(e===`
5
- `&&this.#e===this.#t){t.preventDefault();let i=this.#e-1,{lineNumber:r}=this.#r();this.#a(r,!0),this.text=u(this.text,i),setTimeout(async()=>{this.#s(i,i)},0)}}else if(t.key==="Tab")this.#h%2!==0&&(t.preventDefault(),await this.#i({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:e,lineNumber:i,columnNumber:r}=this.#r(),o=e.at(i),a=this.#g(o),h=a,f=p(a);if(f&&(a=`${f+1}. `),a&&h.length<r)t.preventDefault(),f&&this.#a(i),await this.#i({type:"inline",value:`
5
+ `&&this.#e===this.#t){t.preventDefault();let i=this.#e-1,{lineNumber:r}=this.#r();this.#a(r,!0),this.text=u(this.text,i),setTimeout(async()=>{this.#s(i,i)},0)}}else if(t.key==="Tab")this.#h%2!==0&&(t.preventDefault(),await this.#i({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:e,lineNumber:i,columnNumber:r}=this.#r(),o=e.at(i),a=this.#f(o),h=a,g=p(a);if(g&&(a=`${g+1}. `),a&&h.length<r)t.preventDefault(),g&&this.#a(i),await this.#i({type:"inline",value:`
6
6
  ${a}`});else if(a&&h.length===r){t.preventDefault();let d=this.#t,y=d-h.length;for(let m=0;m<h.length;m++)this.text=u(this.text,d-(m+1));setTimeout(async()=>{this.#s(y,y),this.textArea.focus(),await this.#i({type:"inline",value:`
7
7
  `})},0)}}else{let e=Object.values(this.keyPairs).includes(n),i=this.#e!==this.#t;if((t.ctrlKey||t.metaKey)&&this.#e===this.#t&&(t.key==="c"||t.key==="x")){t.preventDefault();let{lines:r,lineNumber:o,columnNumber:a}=this.#r();if(await navigator.clipboard.writeText(`${o===0&&t.key==="x"?"":`
8
8
  `}${r[o]}`),t.key==="x"){let h=this.#e-a;r.splice(o,1),this.text=r.join(`
9
- `),setTimeout(()=>{this.#s(h,h)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let r=this.#o.find(o=>o.key===t.key);r&&this.#i(r)}else e&&(n===t.key||t.key==="ArrowRight")&&this.#n.length&&!i?(t.preventDefault(),this.#s(this.#e+1,this.#t+1),this.#n.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#i({type:"wrap",value:t.key}),this.#n.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#e!==this.#t&&(this.text[this.#e]===" "&&this.#s(this.#e+1,this.#t),this.text[this.#t-1]===" "&&this.#s(this.#e,this.#t-1))}),this.textArea.addEventListener("click",()=>this.#n=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#i(this.#l(t))})}},p=l=>{let t=l.match(/^(\d+)\./);return t?Number(t[1]):null},v=(l,t,s)=>l.slice(0,s)+t+l.slice(s),u=(l,t)=>l.slice(0,t)+l.slice(t+1);customElements.define("drab-editor",g);})();
9
+ `),setTimeout(()=>{this.#s(h,h)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let r=this.#o.find(o=>o.key===t.key);r&&this.#i(r)}else e&&(n===t.key||t.key==="ArrowRight")&&this.#n.length&&!i?(t.preventDefault(),this.#s(this.#e+1,this.#t+1),this.#n.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#i({type:"wrap",value:t.key}),this.#n.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#e!==this.#t&&(this.text[this.#e]===" "&&this.#s(this.#e+1,this.#t),this.text[this.#t-1]===" "&&this.#s(this.#e,this.#t-1))}),this.textArea.addEventListener("click",()=>this.#n=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#i(this.#l(t))})}},p=l=>{let t=l.match(/^(\d+)\./);return t?Number(t[1]):null},x=(l,t,s)=>l.slice(0,s)+t+l.slice(s),u=(l,t)=>l.slice(0,t)+l.slice(t+1);customElements.define("drab-editor",f);})();
@@ -1,9 +1,9 @@
1
- "use strict";(()=>{var c=class extends HTMLElement{#n=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let s=this.querySelector(this.getAttribute("content")??"[data-content]");if(s instanceof t)return s;throw new Error("Content not found")}swapContent(t=!0,s=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let e=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),t&&setTimeout(()=>this.getContent().replaceChildren(...e),s)}}safeListener(t,s,n=document.body,e={}){e.signal=this.#n.signal,n.addEventListener(t,s,e)}triggerListener(t,s=this.event){for(let n of this.getTrigger())n.addEventListener(s,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#n.abort()}};var d=class extends c{#n=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#o)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#o(){let t=[];for(let s of this.getTrigger())t.push(this.#l(s));return t}get#h(){let t=this.text.split("```"),s=0;for(let[n,e]of t.entries())if(s+=e.length+3,this.#e<s)return n;return 0}get#t(){return this.textArea.selectionEnd}get#e(){return this.textArea.selectionStart}#s(t,s){this.textArea.setSelectionRange(t,s)}#l(t){let s=t.dataset.type,n=t.dataset.value,e=t.dataset.key??void 0;return{type:s,value:n,key:e}}async#c(t,s,n){if(t.type==="inline")this.text=`${this.text.slice(0,n)}${t.value}${this.text.slice(n)}`;else if(t.type==="wrap")this.text=v(this.text,t.value,s),this.text=v(this.text,this.keyPairs[t.value],n+t.value.length),t.value.length<2&&this.#n.push(t.value);else if(t.type==="block"){let{lines:e,lineNumber:i}=this.#r(),r=t.value.at(0);r&&e[i]?.startsWith(r)?e[i]=t.value.trim()+e[i]:e[i]=t.value+e[i],this.text=e.join(`
2
- `)}}async#u(t,s,n){let e=0,i=0;if(/[a-z]/i.test(t)){for(let r=n;r<this.text.length;r++)if(this.text[r]?.match(/[a-z]/i))e?i=r+1:e=r;else if(e)break}else e=s+t.length,i=n+t.length;this.#s(e,i),this.textArea.focus()}async#i(t){let s=this.#t,n=this.#e;await this.#c(t,n,s),this.#u(t.value,n,s)}#g(t){if(t){let s=[];this.#o.forEach(e=>{e.type==="block"&&s.push(e.value)});for(let e=0;e<s.length;e++){let i=s[e];if(i&&t.startsWith(i))return i}let n=m(t);if(n)return`${n}. `}return""}#r(){let t=this.text.split(`
1
+ "use strict";(()=>{var c=class extends HTMLElement{#n=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(t){this.setAttribute("event",t)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(t=HTMLElement){let s=this.querySelector(this.getAttribute("content")??"[data-content]");if(s instanceof t)return s;throw new Error("Content not found")}swapContent(t=!0,s=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let e=Array.from(this.getContent().childNodes),i=[];n instanceof HTMLTemplateElement?(i.push(n.content.cloneNode(!0)),n.content.replaceChildren(...e)):(i.push(...n.childNodes),n.replaceChildren(...e)),this.getContent().replaceChildren(...i),t&&setTimeout(()=>this.swapContent(!1),s)}}safeListener(t,s,n=document.body,e={}){e.signal=this.#n.signal,n.addEventListener(t,s,e)}triggerListener(t,s=this.event){for(let n of this.getTrigger())n.addEventListener(s,t)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#n.abort()}};var d=class extends c{#n=[];keyPairs={"(":")","{":"}","[":"]","<":">",'"':'"',"`":"`"};constructor(){super();for(let t of this.#o)t.type==="wrap"&&(this.keyPairs[t.value]=t.value)}get textArea(){return this.getContent(HTMLTextAreaElement)}get text(){return this.textArea.value}set text(t){this.textArea.value=t}get#o(){let t=[];for(let s of this.getTrigger())t.push(this.#l(s));return t}get#h(){let t=this.text.split("```"),s=0;for(let[n,e]of t.entries())if(s+=e.length+3,this.#e<s)return n;return 0}get#t(){return this.textArea.selectionEnd}get#e(){return this.textArea.selectionStart}#s(t,s){this.textArea.setSelectionRange(t,s)}#l(t){let s=t.dataset.type,n=t.dataset.value,e=t.dataset.key??void 0;return{type:s,value:n,key:e}}async#c(t,s,n){if(t.type==="inline")this.text=`${this.text.slice(0,n)}${t.value}${this.text.slice(n)}`;else if(t.type==="wrap")this.text=x(this.text,t.value,s),this.text=x(this.text,this.keyPairs[t.value],n+t.value.length),t.value.length<2&&this.#n.push(t.value);else if(t.type==="block"){let{lines:e,lineNumber:i}=this.#r(),r=t.value.at(0);r&&e[i]?.startsWith(r)?e[i]=t.value.trim()+e[i]:e[i]=t.value+e[i],this.text=e.join(`
2
+ `)}}async#u(t,s,n){let e=0,i=0;if(/[a-z]/i.test(t)){for(let r=n;r<this.text.length;r++)if(this.text[r]?.match(/[a-z]/i))e?i=r+1:e=r;else if(e)break}else e=s+t.length,i=n+t.length;this.#s(e,i),this.textArea.focus()}async#i(t){let s=this.#t,n=this.#e;await this.#c(t,n,s),this.#u(t.value,n,s)}#f(t){if(t){let s=[];this.#o.forEach(e=>{e.type==="block"&&s.push(e.value)});for(let e=0;e<s.length;e++){let i=s[e];if(i&&t.startsWith(i))return i}let n=m(t);if(n)return`${n}. `}return""}#r(){let t=this.text.split(`
3
3
  `),s=0;for(let n=0;n<t.length;n++){let e=t.at(n)?.length??0;if(s++,s+=e,s>this.#t)return{lines:t,lineNumber:n,columnNumber:this.#t-(s-e-1)}}return{lines:t,lineNumber:0,columnNumber:0}}#a(t,s=!1){let{lines:n}=this.#r();for(let e=t+1;e<n.length;e++){let i=n[e];if(i){let r=m(i);if(r){let o;if(s)if(r>1)o=r-1;else break;else o=r+1;n[e]=i.slice(String(r).length),n[e]=String(o)+n[e]}else break}}this.text=n.join(`
4
4
  `)}mount(){this.textArea.addEventListener("keydown",async t=>{let s=["ArrowUp","ArrowDown","Delete"],n=this.text[this.#t]??"";if(s.includes(t.key))this.#n=[];else if(t.key==="Backspace"){let e=this.text[this.#e-1];if(e&&e in this.keyPairs&&n===this.keyPairs[e]){t.preventDefault();let i=this.#e-1,r=this.#t-1;this.text=u(this.text,i),this.text=u(this.text,r),setTimeout(()=>{this.#s(i,r)},0),this.#n.pop()}if(e===`
5
- `&&this.#e===this.#t){t.preventDefault();let i=this.#e-1,{lineNumber:r}=this.#r();this.#a(r,!0),this.text=u(this.text,i),setTimeout(async()=>{this.#s(i,i)},0)}}else if(t.key==="Tab")this.#h%2!==0&&(t.preventDefault(),await this.#i({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:e,lineNumber:i,columnNumber:r}=this.#r(),o=e.at(i),a=this.#g(o),h=a,g=m(a);if(g&&(a=`${g+1}. `),a&&h.length<r)t.preventDefault(),g&&this.#a(i),await this.#i({type:"inline",value:`
6
- ${a}`});else if(a&&h.length===r){t.preventDefault();let p=this.#t,y=p-h.length;for(let f=0;f<h.length;f++)this.text=u(this.text,p-(f+1));setTimeout(async()=>{this.#s(y,y),this.textArea.focus(),await this.#i({type:"inline",value:`
5
+ `&&this.#e===this.#t){t.preventDefault();let i=this.#e-1,{lineNumber:r}=this.#r();this.#a(r,!0),this.text=u(this.text,i),setTimeout(async()=>{this.#s(i,i)},0)}}else if(t.key==="Tab")this.#h%2!==0&&(t.preventDefault(),await this.#i({type:"inline",value:" "}));else if(t.key==="Enter"){let{lines:e,lineNumber:i,columnNumber:r}=this.#r(),o=e.at(i),a=this.#f(o),h=a,f=m(a);if(f&&(a=`${f+1}. `),a&&h.length<r)t.preventDefault(),f&&this.#a(i),await this.#i({type:"inline",value:`
6
+ ${a}`});else if(a&&h.length===r){t.preventDefault();let p=this.#t,y=p-h.length;for(let g=0;g<h.length;g++)this.text=u(this.text,p-(g+1));setTimeout(async()=>{this.#s(y,y),this.textArea.focus(),await this.#i({type:"inline",value:`
7
7
  `})},0)}}else{let e=Object.values(this.keyPairs).includes(n),i=this.#e!==this.#t;if((t.ctrlKey||t.metaKey)&&this.#e===this.#t&&(t.key==="c"||t.key==="x")){t.preventDefault();let{lines:r,lineNumber:o,columnNumber:a}=this.#r();if(await navigator.clipboard.writeText(`${o===0&&t.key==="x"?"":`
8
8
  `}${r[o]}`),t.key==="x"){let h=this.#e-a;r.splice(o,1),this.text=r.join(`
9
- `),setTimeout(()=>{this.#s(h,h)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let r=this.#o.find(o=>o.key===t.key);r&&this.#i(r)}else e&&(n===t.key||t.key==="ArrowRight")&&this.#n.length&&!i?(t.preventDefault(),this.#s(this.#e+1,this.#t+1),this.#n.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#i({type:"wrap",value:t.key}),this.#n.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#e!==this.#t&&(this.text[this.#e]===" "&&this.#s(this.#e+1,this.#t),this.text[this.#t-1]===" "&&this.#s(this.#e,this.#t-1))}),this.textArea.addEventListener("click",()=>this.#n=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#i(this.#l(t))})}},m=l=>{let t=l.match(/^(\d+)\./);return t?Number(t[1]):null},v=(l,t,s)=>l.slice(0,s)+t+l.slice(s),u=(l,t)=>l.slice(0,t)+l.slice(t+1);})();
9
+ `),setTimeout(()=>{this.#s(h,h)},0)}}if((t.ctrlKey||t.metaKey)&&t.key){let r=this.#o.find(o=>o.key===t.key);r&&this.#i(r)}else e&&(n===t.key||t.key==="ArrowRight")&&this.#n.length&&!i?(t.preventDefault(),this.#s(this.#e+1,this.#t+1),this.#n.pop()):t.key in this.keyPairs&&(t.preventDefault(),await this.#i({type:"wrap",value:t.key}),this.#n.push(t.key))}}),this.textArea.addEventListener("dblclick",()=>{this.#e!==this.#t&&(this.text[this.#e]===" "&&this.#s(this.#e+1,this.#t),this.text[this.#t-1]===" "&&this.#s(this.#e,this.#t-1))}),this.textArea.addEventListener("click",()=>this.#n=[]);for(let t of this.getTrigger())t.addEventListener(this.event,()=>{this.#i(this.#l(t))})}},m=l=>{let t=l.match(/^(\d+)\./);return t?Number(t[1]):null},x=(l,t,s)=>l.slice(0,s)+t+l.slice(s),u=(l,t)=>l.slice(0,t)+l.slice(t+1);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let t=this.querySelector(this.getAttribute("content")??"[data-content]");if(t instanceof e)return t;throw new Error("Content not found")}swapContent(e=!0,t=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...r),t)}}safeListener(e,t,n=document.body,r={}){r.signal=this.#e.signal,n.addEventListener(e,t,r)}triggerListener(e,t=this.event){for(let n of this.getTrigger())n.addEventListener(t,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var o=class extends s{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let e of this.getTrigger())!this.fullscreenSupported()&&e instanceof HTMLButtonElement&&(e.disabled=!0)}};customElements.define("drab-fullscreen",o);})();
1
+ "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),l=[];t instanceof HTMLTemplateElement?(l.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(l.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...l),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var o=class extends s{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let e of this.getTrigger())!this.fullscreenSupported()&&"disabled"in e&&(e.disabled=!0)}};customElements.define("drab-fullscreen",o);})();
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let t=this.querySelector(this.getAttribute("content")??"[data-content]");if(t instanceof e)return t;throw new Error("Content not found")}swapContent(e=!0,t=800){let n=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(n){let r=Array.from(this.getContent().childNodes);n instanceof HTMLTemplateElement?this.getContent().replaceChildren(n.content.cloneNode(!0)):this.getContent().replaceChildren(...n.childNodes),e&&setTimeout(()=>this.getContent().replaceChildren(...r),t)}}safeListener(e,t,n=document.body,r={}){r.signal=this.#e.signal,n.addEventListener(e,t,r)}triggerListener(e,t=this.event){for(let n of this.getTrigger())n.addEventListener(t,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}disconnectedCallback(){this.#e.abort()}};var o=class extends s{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let e of this.getTrigger())!this.fullscreenSupported()&&e instanceof HTMLButtonElement&&(e.disabled=!0)}};})();
1
+ "use strict";(()=>{var s=class extends HTMLElement{#e=new AbortController;constructor(){super()}get event(){return this.getAttribute("event")??"click"}set event(e){this.setAttribute("event",e)}getTrigger(){return this.querySelectorAll(this.getAttribute("trigger")??"[data-trigger]")}getContent(e=HTMLElement){let n=this.querySelector(this.getAttribute("content")??"[data-content]");if(n instanceof e)return n;throw new Error("Content not found")}swapContent(e=!0,n=800){let t=this.querySelector(this.getAttribute("swap")??"[data-swap]");if(t){let r=Array.from(this.getContent().childNodes),o=[];t instanceof HTMLTemplateElement?(o.push(t.content.cloneNode(!0)),t.content.replaceChildren(...r)):(o.push(...t.childNodes),t.replaceChildren(...r)),this.getContent().replaceChildren(...o),e&&setTimeout(()=>this.swapContent(!1),n)}}safeListener(e,n,t=document.body,r={}){r.signal=this.#e.signal,t.addEventListener(e,n,r)}triggerListener(e,n=this.event){for(let t of this.getTrigger())t.addEventListener(n,e)}mount(){}connectedCallback(){queueMicrotask(()=>this.mount())}destroy(){}disconnectedCallback(){this.destroy(),this.#e.abort()}};var i=class extends s{constructor(){super()}isFullscreen(){return document.fullscreenElement!==null}fullscreenSupported(){return!!document.documentElement.requestFullscreen}toggle(){if(this.isFullscreen())document.exitFullscreen();else try{this.getContent(HTMLElement).requestFullscreen()}catch{document.documentElement.requestFullscreen()}}mount(){this.triggerListener(()=>this.toggle());for(let e of this.getTrigger())!this.fullscreenSupported()&&"disabled"in e&&(e.disabled=!0)}};})();
@@ -18,6 +18,7 @@ export class Fullscreen extends Base {
18
18
  * @returns `true` if fullscreen is supported.
19
19
  */
20
20
  fullscreenSupported() {
21
+ // BREAKING TODO: make private like in WakeLock
21
22
  return Boolean(document.documentElement.requestFullscreen);
22
23
  }
23
24
  /** Enables or disables fullscreen mode based on the current state. */
@@ -37,7 +38,7 @@ export class Fullscreen extends Base {
37
38
  mount() {
38
39
  this.triggerListener(() => this.toggle());
39
40
  for (const trigger of this.getTrigger()) {
40
- if (!this.fullscreenSupported() && trigger instanceof HTMLButtonElement) {
41
+ if (!this.fullscreenSupported() && "disabled" in trigger) {
41
42
  trigger.disabled = true;
42
43
  }
43
44
  }