jj 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/JJN.d.ts +25 -2
- package/lib/JJN.js +44 -7
- package/lib/JJN.js.map +1 -1
- package/lib/bundle.js +61 -30
- package/lib/bundle.js.map +2 -2
- package/lib/bundle.min.js +2 -2
- package/lib/mixin-types.d.ts +1 -1
- package/lib/mixins.d.ts +2 -19
- package/lib/mixins.js +17 -40
- package/lib/mixins.js.map +1 -1
- package/package.json +1 -1
package/lib/bundle.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/jty/src/misc.ts", "../node_modules/jty/src/number.ts", "../node_modules/jty/src/array.ts", "../node_modules/jty/src/object.ts", "../node_modules/jty/src/string.ts", "../node_modules/jty/src/same.ts", "../src/util.ts", "../src/case.ts", "../src/JJN.ts", "../src/JJT.ts", "../src/JJDF.ts", "../src/JJSR.ts", "../src/JJE.ts", "../src/JJHE.ts", "../src/JJSE.ts", "../src/JJD.ts", "../src/mixins.ts", "../src/helpers.ts", "../src/components.ts"],
|
|
4
|
-
"sourcesContent": [null, null, null, null, null, null, "import { isStr } from 'jty'\n\n/**\n * Returns the file extension\n *\n * @remarks\n * This convenience function is primarily used to guess the 'as' attribute of\n * a link preload/prefetch behind the scene.\n *\n * @example\n * ```ts\n * fileExt('file.txt') // => 'txt'\n * fileExt('https://www.alexewerlof.com/path/to/file.js') // => 'js'\n * ```\n *\n * @param path - absolute, relative, or URL path to a file\n * @returns the extension name in lowercase and without any dot prefix\n * @throws {TypeError} If path is not a string.\n */\nexport function fileExt(path: string): string {\n if (!isStr(path)) {\n throw new TypeError(`Expected a string file path. Got ${path} (${typeof path})`)\n }\n const lastDotIndex = path.lastIndexOf('.')\n if (lastDotIndex === -1) {\n return ''\n }\n const ext = path.slice(lastDotIndex + 1)\n if (ext.indexOf('/') !== -1) {\n return ''\n }\n return ext.toLowerCase().trim()\n}\n\n/**\n * Returns a promise that resolves before the next repaint.\n *\n * @remarks\n * Used to give the UI a moment to update.\n *\n * @example\n * ```ts\n * await nextAnimationFrame()\n * ```\n *\n * @returns A promise that resolves with the timestamp.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame | requestAnimationFrame}\n */\nexport function nextAnimationFrame(): Promise<number> {\n return new Promise((resolve) => requestAnimationFrame(resolve))\n}\n\n/**\n * Returns a promise that resolves after the specified delay.\n *\n * @remarks\n * Uses `setTimeout` to delay execution. When used with 0ms, it defers\n * execution to the next macro-task, allowing the event loop to cycle.\n *\n * @example\n * ```ts\n * await sleep(100)\n * await sleep() // equivalent to setTimeout(..., 0)\n * ```\n *\n * @param ms - The delay in milliseconds. Defaults to 0.\n * @returns A promise that resolves after the delay.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/setTimeout | setTimeout}\n */\nexport function sleep(ms: number = 0): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * Adds an event listener to a target.\n *\n * @example\n * ```ts\n * on(window, 'resize', () => console.log('resized'))\n * ```\n *\n * @param target - The event target.\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\nexport function on(target: EventTarget, eventName: string, handler: EventListenerOrEventListenerObject): void {\n target.addEventListener(eventName, handler)\n}\n\n/**\n * Removes an event listener from a target.\n *\n * @example\n * ```ts\n * off(window, 'resize', handler)\n * ```\n *\n * @param target - The event target.\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener | EventTarget.removeEventListener}\n */\nexport function off(target: EventTarget, eventName: string, handler: EventListenerOrEventListenerObject): void {\n target.removeEventListener(eventName, handler)\n}\n\n/**\n * Converts a CSS string to a CSSStyleSheet.\n *\n * @remarks\n * Suitable for attaching to ShadowRoot via `adoptedStyleSheets`.\n *\n * @example\n * ```ts\n * const sheet = await cssToStyle('p { color: red; }')\n * shadowRoot.adoptedStyleSheets = [sheet]\n * ```\n *\n * @param css - The CSS string.\n * @returns A promise resolving to the created CSSStyleSheet.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replace | CSSStyleSheet.replace}\n */\nexport async function cssToStyle(css: string): Promise<CSSStyleSheet> {\n const sheet = new CSSStyleSheet()\n return await sheet.replace(css)\n}\n", "import { isStr } from 'jty'\n\n/**\n * Converts a PascalCase, camelCase, or snake_case string to kebab-case.\n *\n * @remarks\n * This function is useful for converting JavaScript property names to CSS or HTML attribute names.\n * It strictly validates the input to contain only alphanumeric characters and underscores.\n *\n * @example\n * ```ts\n * pas2keb('backgroundColor') // 'background-color'\n * pas2keb('MyComponent') // 'my-component'\n * pas2keb('user_id') // 'user-id'\n * ```\n *\n * @param str - The string to convert.\n * @returns The kebab-case string.\n * @throws {TypeError} If `str` is not a string or contains invalid characters (anything other than `/[a-zA-Z0-9_]/`).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace | String.prototype.replace}\n */\nexport function pas2keb(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n if (/[^a-zA-Z0-9_]/.test(str)) {\n throw new TypeError(`Invalid characters in string. Only alphanumeric and underscores are allowed. Got: ${str}`)\n }\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')\n .replace(/_/g, '-')\n .toLowerCase()\n}\n\n/**\n * Converts a kebab-case string to PascalCase.\n *\n * @remarks\n * This function splits the string by hyphens and capitalizes the first letter of each segment.\n * It handles multiple hyphens by ignoring empty segments.\n *\n * @example\n * ```ts\n * keb2pas('background-color') // 'BackgroundColor'\n * keb2pas('my-component') // 'MyComponent'\n * keb2pas('multi--dash') // 'MultiDash'\n * ```\n *\n * @param str - The string to convert.\n * @returns The PascalCase string.\n * @throws {TypeError} If `str` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split | String.prototype.split}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.prototype.map}\n */\nexport function keb2pas(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n return (\n str\n .split('-')\n .filter(Boolean) // Remove empty strings from leading/trailing/multiple hyphens\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('') ||\n // Handle strings that were not kebab-case to begin with (e.g. 'single', 'camelCase')\n (str.length > 0 ? str.charAt(0).toUpperCase() + str.slice(1) : '')\n )\n}\n\n/**\n * Converts a kebab-case string to camelCase.\n *\n * @remarks\n * This function is primarily useful for converting attributes to JavaScript property names.\n * Leading and trailing hyphens are removed before conversion.\n *\n * @example\n * ```ts\n * keb2cam('background-color') // 'backgroundColor'\n * keb2cam('-webkit-transform') // 'webkitTransform'\n * ```\n *\n * @param str - The string to convert.\n * @returns The camelCase string.\n * @throws {TypeError} If `str` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace | String.prototype.replace}\n */\nexport function keb2cam(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n return str\n .replace(/^-+|-+$/g, '') // Remove any leading or trailing hyphens\n .replace(/-+([a-z])/g, (g, c) => c.toUpperCase())\n}\n", "import { isA } from 'jty'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { off, on } from './util.js'\nimport { IAppendPrepend } from './mixin-types.js'\n\n/**\n * Wraps a DOM Node.\n *\n * @remarks\n * This is the base class for all JJ wrappers. It provides common functionality for DOM manipulation,\n * traversal, and event handling.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node | Node}\n */\nexport class JJN<T extends Node = Node> implements IAppendPrepend {\n /**\n * Creates a JJN instance from a Node reference.\n *\n * @example\n * ```ts\n * const node = JJN.from(document.createTextNode('hello'))\n * ```\n *\n * @param node - The Node instance.\n * @returns A new JJN instance.\n */\n static from(node: Node): JJN {\n return new JJN(node)\n }\n\n /**\n * Wraps a native DOM node or string into the most specific JJ wrapper available.\n *\n * @remarks\n * This function acts as a factory, inspecting the input type and returning the appropriate\n * subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).\n *\n * @example\n * ```ts\n * const bodyWrapper = JJN.wrap(document.body) // Returns JJHE\n * const textWrapper = JJN.wrap('Hello') // Returns JJT wrapping a new Text node\n * ```\n *\n * @param raw - The object to wrap. If it's already Wrapped, it'll be returned without any change. We don't double-wrap or clone it.\n * @returns The most granular Wrapped subclass instance. If the input is already wrapped, it'll be returned as is without cloning.\n * @throws {TypeError} If the input is not a Node, string, or JJ wrapper.\n */\n static wrap(raw: Wrappable): Wrapped {\n throw new ReferenceError(`The mixin is supposed to override this method.`)\n }\n\n /**\n * Extracts the underlying native DOM node from a wrapper.\n *\n * @remarks\n * If the input is already a native Node, it is returned as is.\n * If the input is a string, a new Text node is created and returned.\n *\n * @example\n * ```ts\n * const rawElement = JJN.unwrap(myJJHE) // Returns HTMLElement\n * ```\n *\n * @param obj - The object to unwrap.\n * @returns The underlying DOM node.\n * @throws {TypeError} If the input cannot be unwrapped.\n */\n static unwrap(obj: Wrappable): Unwrapped {\n throw new ReferenceError(`The mixin is supposed to override this method.`)\n }\n\n /**\n * Wraps an iterable object (e.g. an array of wrapped or DOM elements).\n *\n * @example\n * ```ts\n * const wrappedList = JJN.wrapAll(document.querySelectorAll('div'))\n * ```\n *\n * @param iterable - The iterable to wrap.\n * @returns An array of wrapped instances.\n */\n static wrapAll(iterable: Iterable<Wrappable>): Wrapped[] {\n return Array.from(iterable, JJN.wrap)\n }\n\n /**\n * Unwraps an iterable object (e.g. an array or HTMLCollection).\n *\n * @example\n * ```ts\n * const nodes = JJN.unwrapAll(wrappedList)\n * ```\n *\n * @param iterable - The iterable to unwrap.\n * @returns An array of native DOM nodes.\n */\n static unwrapAll(iterable: Iterable<Wrappable>): Unwrapped[] {\n return Array.from(iterable, JJN.unwrap)\n }\n\n #ref!: T\n\n /**\n * Creates an instance of JJN.\n *\n * @param ref - The Node to wrap.\n * @throws {TypeError} If `ref` is not a Node.\n */\n constructor(ref: T) {\n if (!isA(ref, Node)) {\n throw new TypeError(`Expected a Node. Got ${ref} (${typeof ref})`)\n }\n this.#ref = ref\n }\n\n /**\n * Gets the underlying DOM Node.\n */\n get ref() {\n return this.#ref\n }\n\n /**\n * Clones the node.\n *\n * @param deep - If true, clones the subtree.\n * @returns A new wrapped instance of the clone.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode | Node.cloneNode}\n */\n clone(deep?: boolean): Wrapped {\n return JJN.wrap(this.ref.cloneNode(deep))\n }\n\n /**\n * Appends children to this node.\n *\n * @param children - The children to append (Nodes, strings, or Wrappers).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/append | Element.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild | Node.appendChild}\n */\n append(...children: Wrappable[]) {\n const nodes = JJN.unwrapAll(children)\n const ref = this.ref\n for (const node of nodes) {\n if (node) {\n ref.appendChild(node)\n }\n }\n return this\n }\n\n /**\n * Maps an array to children and appends them.\n *\n * @example\n * ```ts\n * list.mapAppend(['a', 'b'], item => h('li', null, item))\n * ```\n *\n * @param array - The source array.\n * @param mapFn - The mapping function returning a Wrappable.\n * @returns This instance for chaining.\n */\n mapAppend(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.append(...array.map(mapFn))\n }\n\n /**\n * Prepends children to this node.\n *\n * @param children - The children to prepend.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend | Element.prepend}\n */\n prepend(...children: Wrappable[]) {\n const nodes = JJN.unwrapAll(children)\n const ref = this.ref\n const first = ref.firstChild\n for (const node of nodes) {\n if (node) {\n ref.insertBefore(node, first)\n }\n }\n return this\n }\n\n /**\n * Maps an array to children and prepends them.\n *\n * @example\n * ```ts\n * list.mapPrepend(['a', 'b'], item => JJHE.fromTag('li').setText(item))\n * ```\n *\n * @param array - The source array.\n * @param mapFn - The mapping function.\n * @returns This instance for chaining.\n */\n mapPrepend(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.prepend(...array.map(mapFn))\n }\n\n /**\n * Replaces the existing children of this node with a specified new set of children.\n *\n * @remarks\n * If no children are specified, it essentially empties the node\n *\n * @param children - The new children to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n */\n replaceChildren(...children: Wrappable[]): this {\n return this.empty().append(...children)\n }\n\n /**\n * Adds an event listener.\n *\n * @param eventName - The event name.\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\n on(eventName: string, handler: EventListenerOrEventListenerObject): this {\n on(this.ref, eventName, handler)\n return this\n }\n\n /**\n * Removes an event listener.\n *\n * @param eventName - The event name.\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener | EventTarget.removeEventListener}\n */\n off(eventName: string, handler: EventListenerOrEventListenerObject): this {\n off(this.ref, eventName, handler)\n return this\n }\n\n /**\n * Removes this node from the DOM.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild | Node.removeChild}\n */\n rm() {\n this.ref.parentNode?.removeChild(this.ref)\n return this\n }\n\n /**\n * Removes all children from this node.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n */\n empty(): this {\n const element = this.ref\n while (element.firstChild) {\n element.removeChild(element.firstChild)\n }\n return this\n }\n\n /**\n * Runs a function in the context of this JJN instance.\n *\n * @example\n * ```ts\n * div.run(function() {\n * this.addClass('active')\n * console.log(this.ref)\n * })\n * ```\n * @remarks\n * If you want to access the current JJ* instance, you SHOULD use a `function` not an arrow function.\n * If the function throws, `run()` doesn't swallow the exception.\n * So if you're expecting an error, make sure to wrap it in a `try..catch` block and handle the exception.\n * If the function returns a promise, you can `await` on the response.\n *\n * @param fn - The function to run. `this` inside the function will refer to this JJN instance.\n * @param args - Arguments to pass to the function.\n * @returns The return value of the function.\n */\n run<R, Args extends any[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R {\n return fn.call(this, ...args)\n }\n}\n", "import { isA, isStr } from 'jty'\nimport { JJN } from './JJN.js'\n\n/**\n * Wraps a DOM Text Node.\n *\n * @remarks\n * The Text interface represents the textual content of Element or Attr.\n * If an element has no markup within its content, it has a single child implementing Text\n * that contains the element's text.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Text | Text}\n */\nexport class JJT<T extends Text = Text> extends JJN<Text> {\n /**\n * Creates a JJT instance from a Text node.\n *\n * @example\n * ```ts\n * const textNode = document.createTextNode('foo')\n * const jjText = JJT.from(textNode)\n * ```\n *\n * @param text - The Text node.\n * @returns A new JJT instance.\n * @throws {TypeError} If `text` is not a Text node.\n */\n static from(text: Text): JJT {\n if (!isA(text, Text)) {\n throw new TypeError(`Expected a Text object. Got: ${text} (${typeof text})`)\n }\n return new JJT(text)\n }\n\n /**\n * Creates an instance of JJT.\n *\n * @example\n * ```ts\n * const text = new JJT('Hello World')\n * ```\n *\n * @param ref - The Text node or a string to create a Text node from.\n * @throws {TypeError} If `ref` is not a Text node or string.\n */\n constructor(ref: T | string) {\n if (isStr(ref)) {\n super(document.createTextNode(ref))\n } else if (isA(ref, Text)) {\n super(ref)\n } else {\n throw new TypeError(`Expected a Text. Got: ${ref} (${typeof ref})`)\n }\n }\n\n /**\n * Gets the text content.\n *\n * @returns The text content.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n getText(): string {\n return this.ref.textContent ?? ''\n }\n\n /**\n * Sets the text content.\n *\n * @example\n * ```ts\n * text.setText('New content')\n * ```\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @throws {TypeError} If `text` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n setText(text: string): this {\n if (!isStr(text)) {\n throw new TypeError(`Expected a string. Got: ${text} (${typeof text})`)\n }\n this.ref.textContent = text\n return this\n }\n\n /**\n * Clears the text content.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n empty(): this {\n return this.setText('')\n }\n\n /**\n * Sets the text content to multiple lines joined by newline.\n *\n * @example\n * ```ts\n * text.addLines('Line 1', 'Line 2')\n * ```\n *\n * @param lines - The lines of text.\n * @returns This instance for chaining.\n */\n addLines(...lines: string[]): this {\n return this.setText(lines.join('\\n'))\n }\n}\n", "import { isA } from 'jty'\nimport { JJN } from './JJN.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\n\nexport interface JJDF<T extends DocumentFragment> extends IById, IQuery, IAppendPrepend {}\n\n/**\n * Wraps a DocumentFragment (which is a descendant of Node).\n *\n * @remarks\n * DocumentFragments are lightweight versions of Document that store a segment of a document structure\n * comprised of nodes just like a standard document. The key difference is that because the document fragment\n * isn't part of the active document tree structure, changes made to the fragment don't affect the document,\n * cause reflow, or incur any performance impact that can occur when changes are made.\n *\n * @example\n * ```ts\n * const frag = JJDF.create()\n * frag.append(\n * h('div', null, 'Item 1'),\n * h('div', null, 'Item 2'),\n * )\n * document.body.appendChild(frag.ref)\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}\n */\nexport class JJDF<T extends DocumentFragment = DocumentFragment> extends JJN<T> {\n /**\n * Creates a JJDF instance from a DocumentFragment reference.\n *\n * @example\n * ```ts\n * const frag = JJDF.from(myFrag)\n * ```\n *\n *\n * @param ref - The DocumentFragment instance.\n * @returns A new JJDF instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}\n */\n static from(ref: DocumentFragment): JJDF {\n return new JJDF(ref)\n }\n\n /**\n * Creates a new empty JJDF instance (wraps a new DocumentFragment).\n *\n * @example\n * ```ts\n * const frag = JJDF.create()\n * ```\n *\n * @returns A new JJDF instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment | document.createDocumentFragment}\n */\n static create(): JJDF<DocumentFragment> {\n return new JJDF(document.createDocumentFragment())\n }\n\n /**\n * Creates an instance of JJDF.\n *\n * @param ref - The DocumentFragment instance to wrap.\n * @throws {TypeError} If `ref` is not a DocumentFragment.\n */\n constructor(ref: T) {\n if (!isA(ref, DocumentFragment)) {\n throw new TypeError(`Expected a DocumentFragment. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n}\n", "import { isA } from 'jty'\nimport { JJDF } from './JJDF.js'\n\n/**\n * Wraps a DOM ShadowRoot node (which is a descendant of DocumentFragment).\n *\n * @remarks\n * The ShadowRoot interface of the Shadow DOM API is the root node of a DOM subtree\n * that is rendered separately from a document's main DOM tree.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot | ShadowRoot}\n */\nexport class JJSR<T extends ShadowRoot = ShadowRoot> extends JJDF<T> {\n /**\n * Creates a JJSR instance from a ShadowRoot reference.\n *\n * @example\n * ```ts\n * const shadow = JJSR.from(element.shadowRoot)\n * ```\n *\n * @param shadowRoot - The ShadowRoot instance.\n * @returns A new JJSR instance.\n */\n static from(shadowRoot: ShadowRoot) {\n return new JJSR(shadowRoot)\n }\n\n /**\n * Creates an instance of JJSR.\n *\n * @param shadowRoot - The ShadowRoot to wrap.\n * @throws {TypeError} If `shadowRoot` is not a ShadowRoot.\n */\n constructor(shadowRoot: T) {\n if (!isA(shadowRoot, ShadowRoot)) {\n throw new TypeError(`Expected a ShadowRoot. Got ${shadowRoot} (${typeof shadowRoot})`)\n }\n super(shadowRoot)\n }\n\n /**\n * Gets the inner HTML of the shadow root.\n *\n * @returns The inner HTML string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n getHTML(): string {\n return this.ref.innerHTML\n }\n\n /**\n * Sets the inner HTML of the shadow root.\n *\n * @example\n * ```ts\n * shadow.setHTML('<p>Hello</p>', false)\n * ```\n *\n * @param value - The HTML string.\n * @param unsafe - Reserved for future use (must be false).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n setHTML(value: string, unsafe: false): this {\n // TODO: https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/setHTMLUnsafe\n this.ref.innerHTML = value\n return this\n }\n\n /**\n * Adds constructed stylesheets to the shadow root.\n *\n * @example\n * ```ts\n * const sheet = new CSSStyleSheet()\n * sheet.replaceSync('p { color: red; }')\n * shadow.addStyleSheets(sheet)\n * ```\n *\n * @param styleSheets - The stylesheets to add.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | ShadowRoot.adoptedStyleSheets}\n */\n addStyleSheets(...styleSheets: CSSStyleSheet[]): this {\n this.ref.adoptedStyleSheets.push(...styleSheets)\n return this\n }\n}\n", "import { isA, isArr, isObj, isStr } from 'jty'\nimport { JJN } from './JJN.js'\nimport { JJSR } from './JJSR.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\nimport { ShadowConfig, Wrapped } from './types.js'\n\nexport interface JJE<T extends Element> extends IQuery, IAppendPrepend {}\n\n/**\n * Wraps a DOM Element (which is a descendant of Node).\n *\n * @remarks\n * This class provides a wrapper around the native `Element` interface, adding fluent API methods\n * for attribute manipulation, class handling, and event binding.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element | Element}\n */\nexport class JJE<T extends Element = Element> extends JJN<T> implements IById {\n /**\n * Creates a JJE instance from an Element reference.\n *\n * @example\n * ```ts\n * const el = JJE.from(document.querySelector('.my-class'))\n * ```\n *\n * @param ref - The Element instance.\n * @returns A new JJE instance.\n */\n static from(ref: Element): JJE {\n return new JJE(ref)\n }\n\n /**\n * Creates an instance of JJE.\n *\n * @param ref - The Element to wrap.\n * @throws {TypeError} If `ref` is not an Element.\n */\n constructor(ref: T) {\n if (!isA(ref, Element)) {\n throw new TypeError(`Expected an Element. Got: ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Finds an element by ID within this element's context\n *\n * @remarks\n * This method uses `Element.querySelector()` under the hood.\n *\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n byId(id: string, throwIfNotFound = true): Wrapped | null {\n if (!isStr(id)) {\n throw new TypeError(`Expected a string id. Got ${id} (${typeof id})`)\n }\n return this.query(`#${id}`, throwIfNotFound)\n }\n\n /**\n * Gets the value of an attribute.\n *\n * @param name - The name of the attribute.\n * @returns The attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute | Element.getAttribute}\n */\n getAttr(name: string): string | null {\n return this.ref.getAttribute(name)\n }\n\n /**\n * Checks if an attribute exists.\n *\n * @param name - The name of the attribute.\n * @returns `true` if the attribute exists, otherwise `false`.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute | Element.hasAttribute}\n */\n hasAttr(name: string): boolean {\n return this.ref.hasAttribute(name)\n }\n\n /**\n * Sets the value of an attribute.\n *\n * @param name - The name of the attribute.\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}\n */\n setAttr(name: string, value: string): this {\n this.ref.setAttribute(name, value)\n return this\n }\n\n /**\n * Sets multiple attributes at once.\n *\n * @example\n * ```ts\n * el.setAttrs({ id: 'my-id', class: 'my-class' })\n * ```\n *\n * @param obj - An object where keys are attribute names and values are attribute values.\n * @returns This instance for chaining.\n * @throws {TypeError} If `obj` is not an object.\n */\n setAttrs(obj: Record<string, string>): this {\n if (!isObj(obj)) {\n throw new TypeError(`Expected an object. Got: ${obj} (${typeof obj})`)\n }\n for (const [name, value] of Object.entries(obj)) {\n this.setAttr(name, value)\n }\n return this\n }\n\n /**\n * Removes an attribute.\n *\n * @param name - The name of the attribute to remove.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute | Element.removeAttribute}\n */\n rmAttr(name: string) {\n return this.rmAttrs(name)\n }\n\n /**\n * Removes multiple attributes.\n *\n * @param names - The names of the attributes to remove.\n * @returns This instance for chaining.\n */\n rmAttrs(...names: string[]): this {\n for (const name of names) {\n this.ref.removeAttribute(name)\n }\n return this\n }\n\n /**\n * Gets the value of an ARIA attribute.\n *\n * @remarks\n * Automatically prepends `aria-` to the name.\n *\n * @example\n * ```ts\n * el.getAria('label') // gets 'aria-label'\n * ```\n *\n * @param name - The ARIA attribute suffix (e.g., 'label' for 'aria-label').\n * @returns The attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n getAria(name: string): string | null {\n return this.ref.getAttribute(`aria-${name}`)\n }\n\n /**\n * Checks if an ARIA attribute exists.\n *\n * @param name - The ARIA attribute suffix.\n * @returns `true` if the attribute exists.\n */\n hasAria(name: string): boolean {\n return this.ref.hasAttribute(`aria-${name}`)\n }\n\n /**\n * Sets an ARIA attribute.\n *\n * @example\n * ```ts\n * el.setAria('hidden', 'true') // sets aria-hidden=\"true\"\n * ```\n *\n * @param name - The ARIA attribute suffix.\n * @param value - The value to set.\n * @returns This instance for chaining.\n */\n setAria(name: string, value: string): this {\n this.ref.setAttribute(`aria-${name}`, value)\n return this\n }\n\n /**\n * Removes an ARIA attribute.\n *\n * @param name - The ARIA attribute suffix.\n * @returns This instance for chaining.\n */\n rmAria(name: string): this {\n this.ref.removeAttribute(`aria-${name}`)\n return this\n }\n\n /**\n * Gets the class attribute.\n *\n * @returns The class attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n */\n getClass(): string | null {\n return this.getAttr('class')\n }\n\n /**\n * Sets the class attribute.\n *\n * @param className - The class string to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n */\n setClass(className: string): this {\n return this.setAttr('class', className)\n }\n\n /**\n * Removes the `class` attribute of the element.\n *\n * @remarks\n * If you want to remove a few specific class instead of all, use `rmClasses`\n *\n * @returns This instance for chaining.\n */\n rmClass(): this {\n return this.rmAttr('class')\n }\n\n /**\n * Adds one or more classes to the element.\n *\n * @param classNames - The classes to add.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add | DOMTokenList.add}\n */\n addClass(...classNames: string[]): this {\n this.ref.classList.add(...classNames)\n return this\n }\n\n /**\n * Removes one or more classes from the element.\n *\n * @param classNames - The classes to remove.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove | DOMTokenList.remove}\n */\n rmClasses(...classNames: string[]): this {\n this.ref.classList.remove(...classNames)\n return this\n }\n\n /**\n * Checks if the element has a specific class.\n *\n * @param className - The class to check for.\n * @returns `true` if the element has the class.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains | DOMTokenList.contains}\n */\n hasClass(className: string): boolean {\n return this.ref.classList.contains(className)\n }\n\n /**\n * Toggles a class on the element.\n *\n * @param className - The class to toggle.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle | DOMTokenList.toggle}\n */\n toggleClass(className: string): this {\n this.ref.classList.toggle(className)\n return this\n }\n\n /**\n * Replaces a class with another one\n *\n * @remarks\n * If the `oldClassName` doesn't exist, the `newClassName` isn't added\n *\n * @param oldClassName - The class name to remove\n * @param newClassName - The class name to add\n */\n replaceClass(oldClassName: string, newClassName: string): this {\n this.ref.classList.replace(oldClassName, newClassName)\n return this\n }\n\n /**\n * Adds a click event listener.\n *\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\n onClick(handler: EventListenerOrEventListenerObject): this {\n return this.on('click', handler)\n }\n\n /**\n * Hides the element by setting the `hidden` attribute and `aria-hidden=\"true\"`.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden | hidden attribute}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden | aria-hidden}\n */\n hide(): this {\n return this.setAttr('hidden', '').setAttr('aria-hidden', 'true')\n }\n\n /**\n * Shows the element by removing the `hidden` and `aria-hidden` attributes.\n *\n * @returns This instance for chaining.\n */\n show(): this {\n return this.rmAttrs('hidden', 'aria-hidden')\n }\n\n /**\n * Disables the element by setting the `disabled` attribute and `aria-disabled=\"true\"`.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled attribute}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled | aria-disabled}\n */\n disable(): this {\n return this.setAttr('disabled', '').setAttr('aria-disabled', 'true')\n }\n\n /**\n * Enables the element by removing the `disabled` and `aria-disabled` attributes.\n *\n * @returns This instance for chaining.\n */\n enable(): this {\n return this.rmAttrs('disabled', 'aria-disabled')\n }\n\n /**\n * Gets the title attribute.\n *\n * @returns The title, or null if not set.\n */\n getTitle(): string | null {\n return this.getAttr('title')\n }\n\n /**\n * Sets the title attribute.\n *\n * @param title - The title to set.\n * @returns This instance for chaining.\n */\n setTitle(title: string): this {\n return this.setAttr('title', title)\n }\n\n /**\n * Sets the id attribute.\n *\n * @param id - The id to set.\n * @returns This instance for chaining.\n */\n setId(id: string): this {\n return this.setAttr('id', id)\n }\n\n /**\n * Gets the id attribute.\n *\n * @returns The id, or null if not set.\n */\n getId(): string | null {\n return this.getAttr('id')\n }\n\n /**\n * Gets the inner HTML of the element.\n *\n * @returns The inner HTML string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n getHTML(): string {\n return this.ref.innerHTML\n }\n\n /**\n * Sets the inner HTML of the element.\n *\n * @param html - The HTML string to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n setHTML(html: string): this {\n this.ref.innerHTML = html\n return this\n }\n\n /**\n * Attaches a Shadow DOM to the element and optionally sets its content and styles.\n *\n * @remarks\n * We prevent FOUC by assigning the template and CSS in one go.\n * **Note:** You can't attach a shadow root to every type of element. There are some that can't have a\n * shadow DOM for security reasons (for example `<a>`).\n *\n * @param mode - The encapsulation mode ('open' or 'closed'). Defaults to 'open'.\n * @param config - Optional configuration object containing `template` (HTML string) and `styles` (array of CSSStyleSheet).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow | Element.attachShadow}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | ShadowRoot.adoptedStyleSheets}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets | Document.adoptedStyleSheets}\n */\n initShadow(mode: ShadowRootMode = 'open', config?: ShadowConfig): this {\n const shadowRoot = this.ref.shadowRoot ?? this.ref.attachShadow({ mode })\n if (isObj(config)) {\n const { template, styles } = config\n\n if (template) {\n shadowRoot.innerHTML = template\n }\n if (isArr(styles) && styles.length) {\n shadowRoot.adoptedStyleSheets.push(...styles)\n }\n }\n return this\n }\n\n /**\n * Gets a wrapper around the element's Shadow Root, if it exists.\n *\n * @returns A JJSR instance wrapping the shadow root, or null if no shadow root exists.\n */\n get shadow() {\n return this.ref.shadowRoot ? new JJSR(this.ref.shadowRoot) : null\n }\n}\n", "import { hasProp, isA, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { JJN } from './JJN.js'\nimport { IElementData, IQuery } from './mixin-types.js'\nimport { Wrapped } from './types.js'\n\n/**\n * Wraps a DOM HTMLElement (which is a descendant of Element).\n *\n * @remarks\n * This class extends `JJE` to provide specific functionality for HTML elements,\n * such as access to `dataset`, `innerText`, and form values.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement | HTMLElement}\n */\nexport class JJHE<T extends HTMLElement = HTMLElement> extends JJE<T> {\n /**\n * Creates a JJHE instance from an HTMLElement reference.\n *\n * @example\n * ```ts\n * const el = JJHE.from(document.getElementById('my-id'))\n * ```\n *\n * @param ref - The HTMLElement.\n * @returns A new JJHE instance.\n */\n static from(ref: HTMLElement): JJHE {\n return new JJHE(ref)\n }\n\n /**\n * Creates a JJHE instance from a tag name.\n *\n * @example\n * ```ts\n * const div = JJHE.fromTag('div')\n * const input = JJHE.fromTag('input', { is: 'custom-input' })\n * ```\n *\n * @param tagName - The tag name.\n * @param options - Element creation options.\n * @returns A new JJHE instance.\n * @throws {TypeError} If `tagName` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement | document.createElement}\n */\n static fromTag(tagName: string, options?: ElementCreationOptions): JJHE {\n if (!isStr(tagName)) {\n throw new TypeError(`Expected a string for tagName. Got: ${tagName} (${typeof tagName})`)\n }\n return new JJHE(document.createElement(tagName, options))\n }\n\n /**\n * Creates an instance of JJHE.\n *\n * @param ref - The HTMLElement to wrap.\n * @throws {TypeError} If `ref` is not an HTMLElement.\n */\n constructor(ref: T) {\n if (!isA(ref, HTMLElement)) {\n throw new TypeError(`Expected an HTMLElement. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the value property of the element (e.g. for inputs).\n *\n * @returns The value.\n * @throws {Error} If the element does not have a value property.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}\n */\n getValue() {\n if (!hasProp(this.ref, 'value')) {\n throw new Error('Element does not have a value property')\n }\n return this.ref.value\n }\n\n /**\n * Sets the value property of the element.\n *\n * @example\n * ```ts\n * input.setValue('new value')\n * ```\n *\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @throws {Error} If the element does not have a value property.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}\n */\n setValue(value: string): this {\n if (!hasProp(this.ref, 'value')) {\n throw new Error('Element does not have a value property')\n }\n this.ref.value = value\n return this\n }\n\n /**\n * Focuses the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus | HTMLElement.focus}\n */\n focus(): this {\n this.ref.focus()\n return this\n }\n\n /**\n * Clicks the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click | HTMLElement.click}\n */\n click(): this {\n this.ref.click()\n return this\n }\n\n /**\n * Gets the inner text of the element.\n *\n * @returns The inner text.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}\n */\n getText(): string {\n return this.ref.innerText\n }\n\n /**\n * Sets the inner text of the element.\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}\n */\n setText(text: string): this {\n this.ref.innerText = text\n return this\n }\n\n /**\n * Finds the first element matching a selector within this element's context.\n *\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If the element is not found and `throwIfNotFound` is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n query(selector: string, throwIfNotFound = true): Wrapped | null {\n const el = this.ref.querySelector(selector)\n if (el) {\n return JJN.wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n }\n\n /**\n * Finds all elements matching a selector within this element's context.\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n */\n queryAll(selector: string): Wrapped[] {\n return JJN.wrapAll(this.ref.querySelectorAll(selector))\n }\n}\n\nexport declare interface JJHE<T extends HTMLElement> extends IQuery, IElementData {}\n", "import { isA, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { IElementData } from './mixin-types.js'\n\nconst SVG_NAMESPACE_URI = 'http://www.w3.org/2000/svg'\n\n/**\n * Wraps a DOM SVGElement.\n *\n * @remarks\n * This class extends `JJE` to provide specific functionality for SVG elements,\n * including namespace-aware creation and helper methods for common SVG attributes.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement | SVGElement}\n */\nexport class JJSE<T extends SVGElement = SVGElement> extends JJE<T> {\n /**\n * Creates a JJSE instance from an SVGElement reference.\n *\n * @example\n * ```ts\n * const svg = JJSE.from(myCircle)\n * ```\n *\n * @param ref - The SVGElement.\n * @returns A new JJSE instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement | SVGElement}\n */\n static from(ref: SVGElement): JJSE {\n return new JJSE(ref)\n }\n\n /**\n * Creates a JJSE instance from a tag name (in the SVG namespace).\n *\n * @remarks\n * Automatically uses the correct SVG namespace URI: `http://www.w3.org/2000/svg`.\n *\n * @example\n * ```ts\n * const circle = JJSE.fromTag('circle')\n * ```\n *\n * @param tagName - The tag name.\n * @param options - Element creation options.\n * @returns A new JJSE instance.\n * @throws {TypeError} If `tagName` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS | document.createElementNS}\n */\n static fromTag(tagName: string, options?: ElementCreationOptions): JJSE {\n if (!isStr(tagName)) {\n throw new TypeError(`Expected a string for tagName. Got: ${tagName} (${typeof tagName})`)\n }\n // SVG elements must be created with the SVG namespace\n const element = document.createElementNS(SVG_NAMESPACE_URI, tagName, options)\n return new JJSE(element as SVGElement)\n }\n\n /**\n * Creates an instance of JJSE.\n *\n * @param ref - The SVGElement to wrap.\n * @throws {TypeError} If `ref` is not an SVGElement.\n */\n constructor(ref: T) {\n if (!isA(ref, SVGElement)) {\n throw new TypeError(`Expected an SVGElement. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the element.\n *\n * @returns The text content.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n getText(): string {\n return this.ref.textContent ?? ''\n }\n\n /**\n * Sets the text content of the element.\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n setText(text: string): this {\n this.ref.textContent = text\n return this\n }\n\n /**\n * Clears the text content of the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n empty(): this {\n this.ref.textContent = ''\n return this\n }\n\n /**\n * Sets the fill attribute.\n *\n * @param value - The fill color/value.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill | fill}\n */\n setFill(value: string): this {\n return this.setAttr('fill', value)\n }\n\n /**\n * Sets the stroke attribute.\n *\n * @param value - The stroke color/value.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke | stroke}\n */\n setStroke(value: string): this {\n return this.setAttr('stroke', value)\n }\n\n /**\n * Sets the stroke-width attribute.\n *\n * @param value - The width.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width | stroke-width}\n */\n setStrokeWidth(value: string | number): this {\n return this.setAttr('stroke-width', String(value))\n }\n\n /**\n * Sets the viewBox attribute.\n *\n * @example\n * ```ts\n * svg.setViewBox(0, 0, 100, 100)\n * svg.setViewBox('0 0 100 100')\n * ```\n *\n * @param p1 - Min-x or string/array value.\n * @param p2 - Min-y.\n * @param p3 - Width.\n * @param p4 - Height.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox | viewBox}\n */\n setViewBox(p1: string | (string | number)[] | number, p2?: number, p3?: number, p4?: number): this {\n if (typeof p1 === 'number' && p2 !== undefined && p3 !== undefined && p4 !== undefined) {\n return this.setAttr('viewBox', `${p1} ${p2} ${p3} ${p4}`)\n }\n const value = p1 as string | (string | number)[]\n return this.setAttr('viewBox', Array.isArray(value) ? value.join(' ') : value)\n }\n\n /**\n * Sets the width attribute.\n *\n * @param value - The width.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/width | width}\n */\n setWidth(value: string | number): this {\n return this.setAttr('width', String(value))\n }\n\n /**\n * Sets the height attribute.\n *\n * @param value - The height.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/height | height}\n */\n setHeight(value: string | number): this {\n return this.setAttr('height', String(value))\n }\n\n /**\n * Sets the d attribute (path data).\n *\n * @param value - The path data string or array of segments.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d | d}\n */\n setD(value: string | (string | number)[]): this {\n return this.setAttr('d', Array.isArray(value) ? value.join(' ') : value)\n }\n\n /**\n * Sets the transform attribute.\n *\n * @param value - The transform string.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform | transform}\n */\n setTransform(value: string): this {\n return this.setAttr('transform', value)\n }\n}\n\n// IElementData\nexport declare interface JJSE<T extends SVGElement> extends IElementData {}\n", "import { isA } from 'jty'\nimport { JJN } from './JJN.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\n\nexport interface JJD<T extends Document> extends IById, IQuery, IAppendPrepend {}\n\n/**\n * Wraps a Document (which is a descendant of Node).\n *\n * @remarks\n * This class provides a wrapper around the native `Document` interface, inheriting\n * the fluent API capabilities of `JJN`.\n * It also supports querying (`byId`, `query`) and manipulation (`append`, `prepend`) methods.\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * doc.on('DOMContentLoaded', () => console.log('Ready'))\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document | Document}\n */\nexport class JJD<T extends Document = Document> extends JJN<T> {\n /**\n * Creates a JJD instance from a Document reference.\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * ```\n *\n * @param ref - The Document instance.\n * @returns A new JJD instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document | Document}\n */\n static from(ref: Document): JJD {\n return new JJD(ref)\n }\n\n /**\n * Creates an instance of JJD.\n *\n * @param ref - The Document instance to wrap.\n * @throws {TypeError} If `ref` is not a Document.\n */\n constructor(ref: T) {\n if (!isA(ref, Document)) {\n throw new TypeError(`Expected a Document. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the `<head>` element of the document wrapped in a `JJHE` instance.\n *\n * @returns The wrapped head element.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/head | Document.head}\n */\n get head() {\n return JJN.wrap(this.ref.head)\n }\n\n /**\n * Gets the `<body>` element of the document wrapped in a `JJHE` instance.\n *\n * @returns The wrapped body element.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/body | Document.body}\n */\n get body() {\n return JJN.wrap(this.ref.body)\n }\n\n /**\n * Sets the document title.\n *\n * @example\n * ```ts\n * JJD.from(document).setTitle('New Page Title')\n * ```\n *\n * @param title - The new title string.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/title | Document.title}\n */\n setTitle(title: string): this {\n this.ref.title = title\n return this\n }\n\n /**\n * Gets the document title.\n *\n * @returns The current title of the document.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/title | Document.title}\n */\n getTitle(): string {\n return this.ref.title\n }\n}\n", "import { hasProp, isA, isObj, isStr } from 'jty'\nimport { JJHE } from './JJHE.js'\nimport { JJE } from './JJE.js'\nimport { JJDF } from './JJDF.js'\nimport { JJSR } from './JJSR.js'\nimport { JJT } from './JJT.js'\nimport { JJN } from './JJN.js'\nimport { JJD } from './JJD.js'\nimport { JJSE } from './JJSE.js'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { IById } from './mixin-types.js'\n\nexport const { wrapAll, unwrapAll } = JJN\n\n/**\n * Wraps a native DOM node or string into the most specific JJ wrapper available.\n *\n * @remarks\n * This function acts as a factory, inspecting the input type and returning the appropriate\n * subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).\n *\n * @example\n * ```ts\n * const bodyWrapper = JJN.wrap(document.body) // Returns JJHE\n * const textWrapper = JJN.wrap('Hello') // Returns JJT wrapping a new Text node\n * ```\n *\n * @param raw - The object to wrap. If it's already Wrapped, it'll be returned without any change. We don't double-wrap or clone it.\n * @returns The most granular Wrapped subclass instance. If the input is already wrapped, it'll be returned as is without cloning.\n * @throws {TypeError} If the input is not a Node, string, or JJ wrapper.\n */\nexport function wrap(raw: Wrappable): Wrapped {\n if (isStr(raw)) {\n return JJT.from(document.createTextNode(raw))\n }\n if (!isObj(raw)) {\n throw new TypeError(`Expected an object to wrap. Got ${raw} (${typeof raw})`)\n }\n if (isA(raw, JJN)) {\n return raw\n }\n if (isA(raw, HTMLElement)) {\n return JJHE.from(raw)\n }\n if (isA(raw, SVGElement)) {\n return JJSE.from(raw)\n }\n if (isA(raw, Element)) {\n return JJE.from(raw)\n }\n if (isA(raw, ShadowRoot)) {\n return JJSR.from(raw)\n }\n if (isA(raw, DocumentFragment)) {\n return JJDF.from(raw)\n }\n if (isA(raw, Document)) {\n return JJD.from(raw)\n }\n if (isA(raw, Text)) {\n return JJT.from(raw)\n }\n if (isA(raw, Node)) {\n return JJN.from(raw)\n }\n throw new TypeError(`Expected a Node to wrap. Got ${raw} (${typeof raw})`)\n}\n\n/**\n * Extracts the underlying native DOM node from a wrapper.\n *\n * @remarks\n * If the input is already a native Node, it is returned as is.\n * If the input is a string, a new Text node is created and returned.\n *\n * @example\n * ```ts\n * const rawElement = JJN.unwrap(myJJHE) // Returns HTMLElement\n * ```\n *\n * @param obj - The object to unwrap.\n * @returns The underlying DOM node.\n * @throws {TypeError} If the input cannot be unwrapped.\n */\nexport function unwrap(obj: Wrappable): Unwrapped {\n if (isStr(obj)) {\n return document.createTextNode(obj)\n }\n if (!isObj(obj)) {\n throw new TypeError(`Expected an object. Got ${obj} (${typeof obj})`)\n }\n if (isA(obj, Node)) {\n return obj\n }\n if (isA(obj, JJN)) {\n return obj.ref\n }\n throw new TypeError(`Could not unwrap ${obj} (${typeof obj})`)\n}\n\n/**\n * Finds an element by ID in the document.\n *\n * @example\n * ```ts\n * const el = byId('my-id')\n * ```\n *\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @throws {TypeError} If the element is not found and throwIfNotFound is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById | Document.getElementById}\n */\nexport function byId(id: string, throwIfNotFound = true): Wrapped | null {\n const el = document.getElementById(id)\n if (el) {\n return wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Found no element with id ${id} in the document.`)\n }\n return null\n}\n\n/**\n * Finds elements by class name in the document.\n *\n * @example\n * ```ts\n * const items = byClass('list-item')\n * ```\n *\n * @param className - The class name to search for.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName | Document.getElementsByClassName}\n */\nexport function byClass(className: string): Wrapped[] {\n return wrapAll(document.getElementsByClassName(className))\n}\n\n/**\n * Finds the first element matching a selector in the document.\n *\n * @example\n * ```ts\n * const btn = query('.submit-btn')\n * ```\n *\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If not found and throwIfNotFound is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector | Document.querySelector}\n */\nexport function query(selector: string, throwIfNotFound = true): Wrapped | null {\n const queryResult = document.querySelector(selector)\n if (queryResult) {\n return wrap(queryResult)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n}\n\n/**\n * Finds all elements matching a selector in the document.\n *\n * @example\n * ```ts\n * const inputs = queryAll('input[type=\"text\"]')\n * ```\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | Document.querySelectorAll}\n */\nexport function queryAll(selector: string): Wrapped[] {\n return wrapAll(document.querySelectorAll(selector))\n}\n\nconst DDF: IById = {\n /**\n * Finds an element by ID within this Document or DocumentFragment.\n *\n * @example\n * ```ts\n * const el = doc.byId('header')\n * ```\n *\n * @param this - The JJD or JJDF instance.\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById | Document.getElementById}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/getElementById | DocumentFragment.getElementById}\n */\n byId(this: JJD | JJDF, id: string, throwIfNotFound = true): Wrapped | null {\n const el = this.ref.getElementById(id)\n if (el) {\n return wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with id ${id} not found`)\n }\n return null\n },\n}\n\nconst EDDF = {\n /**\n * Finds the first element matching a selector within this element's context.\n *\n * @example\n * ```ts\n * const span = div.query('span')\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If context is invalid or element not found (when requested).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector | Document.querySelector}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelector | DocumentFragment.querySelector}\n */\n query(this: JJE | JJD | JJDF, selector: string, throwIfNotFound = true): Wrapped | null {\n const queryResult = this.ref.querySelector(selector)\n if (queryResult) {\n return wrap(queryResult)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n },\n\n /**\n * Finds all elements matching a selector within this element's context.\n *\n * @example\n * ```ts\n * const items = list.queryAll('li')\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | Document.querySelectorAll}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll | DocumentFragment.querySelectorAll}\n */\n queryAll(this: JJE | JJD | JJDF, selector: string): Wrapped[] {\n return wrapAll(this.ref.querySelectorAll(selector))\n },\n\n /**\n * Appends children to this node using native append.\n *\n * @example\n * ```ts\n * myDiv.append(h('span', null, 'hello'))\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to append.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/append | Element.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/append | Document.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/append | DocumentFragment.append}\n */\n append<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children)\n this.ref.append(...nodes)\n return this\n },\n\n /**\n * Prepends children to this node using native prepend.\n *\n * @example\n * ```ts\n * div.prepend(h('span', null, 'first'))\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to prepend.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend | Element.prepend}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend | Document.prepend}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/prepend | DocumentFragment.prepend}\n */\n prepend<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children)\n this.ref.prepend(...nodes)\n return this\n },\n\n /**\n * Replaces the existing children of a node with a specified new set of children.\n *\n * @remarks\n * If no children are provided, it empties the node.\n *\n * @example\n * ```ts\n * div.replaceChildren(h('p', null, 'New Content'))\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to replace with.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren | Document.replaceChildren}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren | DocumentFragment.replaceChildren}\n */\n replaceChildren<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children)\n this.ref.replaceChildren(...nodes)\n return this\n },\n\n /**\n * Removes all children from this node.\n *\n * @example\n * ```ts\n * div.empty()\n * ```\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n */\n empty<T extends JJE | JJD | JJDF>(this: T): T {\n this.replaceChildren()\n return this\n },\n}\n\nconst HESE = {\n getData<T extends JJHE | JJSE>(this: T, name: string): string | undefined {\n return this.ref.dataset[name]\n },\n\n hasData<T extends JJHE | JJSE>(this: T, name: string): boolean {\n return hasProp(this.ref.dataset, name)\n },\n\n setData<T extends JJHE | JJSE>(this: T, name: string, value: string): T {\n this.ref.dataset[name] = value\n return this\n },\n\n setDataObj<T extends JJHE | JJSE>(this: T, obj: Record<string, string>): T {\n for (const [name, value] of Object.entries(obj)) {\n this.setData(name, value)\n }\n return this\n },\n\n rmData<T extends JJHE | JJSE>(this: T, name: string): T {\n delete this.ref.dataset[name]\n return this\n },\n}\n\nfunction assignPrototype(Class: any, ...mixins: any[]) {\n for (const mixin of mixins) {\n Object.assign(Class.prototype, mixin)\n }\n}\n\nJJN.wrap = wrap\nJJN.unwrap = unwrap\n\nassignPrototype(JJE, EDDF)\nassignPrototype(JJD, DDF, EDDF)\nassignPrototype(JJDF, DDF, EDDF)\nassignPrototype(JJHE, HESE)\nassignPrototype(JJSE, HESE)\n", "import { isA, isStr } from 'jty'\nimport { JJHE } from './JJHE.js'\nimport { Wrappable } from './types.js'\nimport { cssToStyle, fileExt } from './util.js'\n\n/**\n * Hyperscript helper to create JJHE instances.\n * The `h` function provides a concise way to create DOM wrappers with attributes and children,\n * similar to hyperscript helpers found in other libraries.\n *\n *\n * @remarks\n * It returns a `JJHE` instance which wraps the native HTMLElement.\n *\n * You may recognize it from other libraries:\n * - [React](https://react.dev/reference/react/createElement)\n * - [Vue](https://vuejs.org/guide/extras/render-function)\n * - [Hyperscript](https://github.com/hyperhype/hyperscript)\n * - [Angular](https://angular.dev/guide/components/programmatic-rendering)\n * - [Lit](https://lit.dev/docs/components/rendering/)\n *\n * This is not exactly a replacement, but it roughly follows the same idea.\n *\n * @example\n * ```ts\n * // Create a simple div\n * h('div', { id: 'app' }, 'Hello World')\n *\n * // Create a nested structure\n * h('ul', { class: 'list' },\n * h('li', null, 'Item 1'),\n * h('li', null, 'Item 2')\n * )\n * ```\n *\n * @param tagName - The HTML tag name.\n * @param attributes - Attributes to set on the element. Can be null or undefined.\n * @param children - Children to append (strings, nodes, or other JJHE instances).\n * @returns The created JJHE instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement | document.createElement}\n */\nexport function h(tagName: string, attributes?: Record<string, string> | null, ...children: Wrappable[]): JJHE {\n const ret = JJHE.fromTag(tagName).append(...children)\n if (attributes) {\n ret.setAttrs(attributes)\n }\n return ret\n}\n\n/**\n * Tries to find the best match for the link.as attribute when it's omitted\n * @param href a relative, absolute, or URL resource\n * @returns a valid value for the link.as attribute\n * @throws {TypeError} if it cannot guess a valid value for the 'link.as' attribute\n */\nfunction linkAs(href: string): 'fetch' | 'style' | 'script' {\n switch (fileExt(href)) {\n case 'html':\n case 'htm':\n case 'md':\n return 'fetch'\n case 'css':\n return 'style'\n case 'js':\n case 'mjs':\n case 'cjs':\n return 'script'\n default:\n throw new Error(`No 'as' attribute was specified and we failed to guess it from the URL: ${href}`)\n }\n}\n\n/**\n * Creates a `<link>` element for prefetching or preloading resources.\n *\n * @remarks\n * This function validates the input arguments and returns a wrapped `JJHE` instance.\n * It does not append the element to the document.\n *\n * @param rel - The relationship of the linked resource ('prefetch' or 'preload').\n * @param href - The URL of the resource.\n * @param as - The type of content being loaded ('fetch' for HTML, 'style' for CSS, or 'script' for JavaScript files).\n * If it's not provided or set to a falsy value, it runs heuristics to find the best match from the href parameter.\n *\n * @returns The JJHE instance representing the link element. The `<link>` is accessible via `.ref`\n * @throws {TypeError} If `href` is not a string or URL.\n * @throws {RangeError} If `rel` or `as` are not valid values.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload | Link types: preload}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/prefetch | Link types: prefetch}\n */\nexport function createLinkPre(\n rel: 'prefetch' | 'preload',\n href: string | URL,\n as?: 'fetch' | 'style' | 'script',\n): JJHE {\n if (!isStr(href)) {\n if (!isA(href, URL)) {\n throw new TypeError(`Expected a string or URL. Got ${href} (${typeof href})`)\n }\n href = href.toString()\n }\n\n if (!['prefetch', 'preload'].includes(rel)) {\n throw new RangeError(`rel should be one of 'prefetch' or 'preload'. Got ${rel} (${typeof rel})`)\n }\n\n if (!as) {\n as = linkAs(href)\n if (!as) {\n throw new Error(`No 'as' attribute was specified and we failed to guess it from the URL: ${href}`)\n }\n }\n\n if (!['fetch', 'style', 'script'].includes(as)) {\n throw new RangeError(`as should be one of 'fetch' or 'style'. Got ${as} (${typeof as})`)\n }\n\n return JJHE.fromTag('link').setAttrs({\n rel,\n href,\n as,\n })\n}\n\n/**\n * Adds a `<link>` tag to the document head for prefetching or preloading resources.\n *\n * @remarks\n * This function helps in optimizing performance by telling the browser to fetch resources\n * that might be needed later (prefetch) or are needed immediately (preload).\n *\n * Please refer to {@link createLinkPre} for more details.\n *\n * @example\n * ```ts\n * // Preload a script\n * addLinkPre('https://example.com/script.js', 'preload', 'script')\n *\n * // Prefetch a future page's CSS\n * addLinkPre('/next-page.css', 'prefetch', 'style')\n * ```\n *\n * @returns The JJHE instance representing the link element.\n * @throws {TypeError} If `href` is not a string or URL.\n * @throws {RangeError} If `rel` or `as` are not valid values.\n * @see {@link createLinkPre}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload | Link types: preload}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/prefetch | Link types: prefetch}\n */\nexport function addLinkPre(...args: Parameters<typeof createLinkPre>) {\n const link = createLinkPre(...args)\n document.head.append(link.ref)\n return link\n}\n\n/**\n * Fetches a file and returns its contents as string.\n *\n * @remarks\n * This is a wrapper around the native `fetch` API that handles the response status check\n * and text extraction. It sets the `Accept` header based on the provided mime type.\n *\n * @example\n * ```ts\n * const text = await fetchText('https://example.com/data.txt')\n * ```\n *\n * @param url - The file location.\n * @param mime - The HTTP Request Accept header. Defaults to 'text/*'.\n * @returns The file contents as a string.\n * @throws {TypeError} If `mime` is not a string.\n * @throws {Error} If the fetch fails or the response status is not OK (200-299).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/text | Response.text()}\n */\nexport async function fetchText(url: URL | string, mime: string = 'text/*') {\n if (!isStr(mime)) {\n throw new TypeError(`Expected a string mime like 'text/html' or 'text/css'. Got ${mime} (${typeof mime})`)\n }\n const response = await fetch(url, { headers: { Accept: mime } })\n if (!response.ok) {\n throw new Error(`GET ${url} failed: ${response.status} ${response.statusText}`)\n }\n return response.text()\n}\n\n/**\n * Fetches the contents of a HTML file as string.\n *\n * @remarks\n * Useful for loading HTML templates dynamically.\n * You can use `import.meta.resolve('./relative-path-to.html')` to resolve paths relative to the current module.\n *\n * @example\n * ```ts\n * const template = await fetchHtml('./template.html')\n * ```\n *\n * @param url - The HTML file location.\n * @returns The file content as a string.\n * @throws {Error} If the response is not ok.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types | MIME types}\n */\nexport async function fetchHtml(url: URL | string): Promise<string> {\n return await fetchText(url, 'text/html')\n}\n\n/**\n * Fetches the contents of a CSS file as string.\n *\n * @remarks\n * You can use `import.meta.resolve('./relative-path-to.css')` inside components to resolve relative paths.\n *\n * @example\n * ```ts\n * const css = await fetchCss('./style.css')\n * ```\n *\n * @param url - The CSS file location.\n * @returns The file content as a string.\n * @throws {Error} If the response is not ok.\n */\nexport async function fetchCss(url: URL | string): Promise<string> {\n return await fetchText(url, 'text/css')\n}\n\n/**\n * Fetches a CSS file and constructs a CSSStyleSheet.\n *\n * @remarks\n * This is particularly useful for Constructable Stylesheets, which can be shared across Shadow DOM boundaries.\n *\n * @example\n * ```ts\n * const sheet = await fetchStyle('./component.css')\n * shadowRoot.adoptedStyleSheets = [sheet]\n * ```\n *\n * @param url - The CSS file location.\n * @returns The CSSStyleSheet object constructed from the CSS contents.\n * @throws {Error} If the fetch fails.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet | CSSStyleSheet}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | adoptedStyleSheets}\n */\nexport async function fetchStyle(url: URL | string): Promise<CSSStyleSheet> {\n return await cssToStyle(await fetchCss(url))\n}\n", "import { hasProp, isA, isArr, isDef, isFn, isStr } from 'jty'\nimport { JJStyleConfig, JJTemplateConfig, ShadowConfig } from './types.js'\nimport { JJHE } from './JJHE.js'\nimport { cssToStyle } from './util.js'\nimport { keb2cam } from './case.js'\n\n/**\n * Resolves a template configuration into a string suitable for Shadow DOM.\n *\n * Handles functions (sync/async), promises, strings, JJHE instances, and HTMLElements.\n *\n * @param templateConfig - The configuration to resolve.\n * @returns A promise resolving to the HTML string or undefined.\n * @throws {TypeError} If the resolved value is not a string, JJHE, or HTMLElement.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML | Element.outerHTML}\n */\nasync function templatePromise(templateConfig?: JJTemplateConfig): Promise<ShadowConfig['template']> {\n if (!isDef(templateConfig)) {\n return undefined\n }\n\n if (isFn(templateConfig)) {\n templateConfig = await templateConfig()\n }\n\n templateConfig = await templateConfig\n\n if (isStr(templateConfig)) {\n return templateConfig\n }\n if (isA(templateConfig, JJHE)) {\n return templateConfig.getHTML()\n }\n if (isA(templateConfig, HTMLElement)) {\n return templateConfig.outerHTML\n }\n\n throw new TypeError(`Expected a string, JJHE or HTMLElement. Got ${templateConfig} (${typeof templateConfig})`)\n}\n\n/**\n * Resolves a style configuration into a CSSStyleSheet.\n *\n * Handles functions (sync/async), promises, CSSStyleSheet instances, and strings.\n * Strings are converted to CSSStyleSheet using `cssToStyle`.\n *\n * @param styleConfig - The configuration to resolve.\n * @returns A promise resolving to a CSSStyleSheet.\n * @throws {TypeError} If the resolved value is not a string or CSSStyleSheet.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet | CSSStyleSheet}\n */\nasync function stylePromise(styleConfig?: JJStyleConfig): Promise<CSSStyleSheet> {\n if (isFn(styleConfig)) {\n styleConfig = await styleConfig()\n }\n\n styleConfig = await styleConfig\n\n if (isA(styleConfig, CSSStyleSheet)) {\n return styleConfig\n }\n if (isStr(styleConfig)) {\n return await cssToStyle(styleConfig)\n }\n\n throw new TypeError(`Expected a css string or CSSStyleSheet. Got ${styleConfig} (${typeof styleConfig})`)\n}\n\n/**\n * Maps an array of style configurations to an array of promises resolving to CSSStyleSheets.\n *\n * @param styleConfigs - Array of style configurations.\n * @returns Array of promises.\n */\nfunction stylePromises(styleConfigs?: JJStyleConfig[]): Promise<CSSStyleSheet>[] {\n if (!isArr(styleConfigs)) {\n return []\n }\n\n return styleConfigs.map(stylePromise)\n}\n\n/**\n * Resolves both template and style configurations.\n *\n * @param templateConfig - The template configuration.\n * @param styleConfigs - The style configurations.\n * @returns A promise resolving to the final ShadowConfig.\n */\nasync function resolveConfig(templateConfig?: JJTemplateConfig, styleConfigs?: JJStyleConfig[]): Promise<ShadowConfig> {\n const [template, ...styles] = await Promise.all([templatePromise(templateConfig), ...stylePromises(styleConfigs)])\n return { template, styles }\n}\n\n/**\n * Manages the resolution of Shadow DOM configuration (template and styles).\n *\n * Allows building up the configuration and resolving it lazily.\n *\n * @example\n * ```ts\n * const sm = ShadowMaster.create()\n * .setTemplate('<div>Hello World</div>')\n * .addStyles('div { color: red; }')\n *\n * class MyComponent extends HTMLElement {\n * async connectedCallback() {\n * // Resolves the config once and caches it\n * const shadowConfig = await sm.getResolved()\n * // ... init shadow root with shadowConfig\n * }\n * }\n * ```\n */\nexport class ShadowMaster {\n #templateConfig?: JJTemplateConfig = undefined\n #stylesConfig: JJStyleConfig[] = []\n #normalizedConfig?: Promise<ShadowConfig> = undefined\n\n /**\n * Creates a new instance of ShadowMaster.\n *\n * @returns A new ShadowMaster instance.\n */\n static create() {\n return new ShadowMaster()\n }\n\n constructor() {}\n\n /**\n * Sets the template configuration.\n *\n * @param templateConfig - The template configuration.\n * @returns The instance for chaining.\n *\n * @example\n * ```ts\n * // Accepts string, promise, or fetchHtml result\n * sm.setTemplate(fetchHtml('./template.html'))\n * ```\n */\n setTemplate(templateConfig?: JJTemplateConfig): this {\n this.#templateConfig = templateConfig\n return this\n }\n\n /**\n * Adds one or more style configurations.\n *\n * @param stylesConfig - Variable number of style configurations.\n * @returns The instance for chaining.\n *\n * @example\n * ```ts\n * sm.addStyles(\n * 'p { color: red; }',\n * fetchCss('./styles.css'),\n * () => fetchCss('../lazy-loaded-styles.css'),\n * )\n * ```\n */\n addStyles(...stylesConfig: JJStyleConfig[]): this {\n this.#stylesConfig.push(...stylesConfig)\n return this\n }\n\n /**\n * Resolves the configuration to something that can be fed to `JJHE.initShadow()` function\n *\n * The result is cached, so subsequent calls return the same promise.\n * Note: Any changes made to the ShadowMaster instance (via setTemplate/addStyles)\n * after the first call to getResolved() will be ignored.\n *\n * @returns A promise resolving to the ShadowConfig.\n */\n async getResolved(): Promise<ShadowConfig> {\n if (!this.#normalizedConfig) {\n this.#normalizedConfig = resolveConfig(this.#templateConfig, this.#stylesConfig)\n }\n return await this.#normalizedConfig\n }\n}\n\n/**\n * A helper to bridge the attribute world (kebab-case) to the property world (camelCase).\n * It works in tandem with browser's `observedAttributes` feature which triggers\n * `attributeChangedCallback`.\n *\n * @remarks\n * Your custom component class MUST define `static observedAttributes[]` otherwise `attributeChangedCallback` won't trigger.\n * `observedAttributes` should contain kebab-based attribute names.\n *\n * @example\n * ```ts\n * class MyComponent extends HTMLElement {\n * static observedAttributes = ['user-name', 'counter']\n * userName = '' // Property MUST exist on the instance (or prototype setter)\n * #counter = 0 // You can also use private properties together with getter/setters\n * \n * attributeChangedCallback(name, oldValue, newValue) {\n * attr2prop(this, name, oldValue, newValue)\n * }\n\n * get counter() {\n * return this.#counter\n * }\n * \n * set counter(value) {\n * this.#counter = value\n * this.#render() // You can call your render function to update the DOM\n * }\n * \n * #render() {\n * const shadow = JJHE.from(this).shadow\n * if (shadow) {\n * shadow.byId('user').setText(this.userName)\n * shadow.byId('counter').setText(this.counter)\n * }\n * }\n * }\n * ```\n *\n * @param instance - A reference to the common component instance\n * @param name - kebab-case and in lower case exactly as it appears in `observedAttributes`.\n * @param oldValue - The previous value of the attribute.\n * @param newValue - The new value of the attribute.\n * @returns `true` if it tried to set the attribute; otherwise `false`.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes | Responding to attribute changes}\n */\nexport function attr2prop(instance: HTMLElement, name: string, oldValue: any, newValue: any) {\n if (!isA(instance, HTMLElement)) {\n throw new TypeError(\n `Expected an HTMLElement or a custom element instance. Got ${instance} (${typeof instance})`,\n )\n }\n // Called when observed attributes change.\n if (oldValue !== newValue) {\n const propName = keb2cam(name)\n if (hasProp(instance, propName)) {\n instance[propName] = newValue\n return true\n }\n }\n return false\n}\n\n/**\n * Registers the custom element with the browser and waits till it is defined.\n *\n * @example\n * ```ts\n * class MyComponent extends HTMLElement {}\n * await registerComponent('my-component', MyComponent)\n * ```\n * Another convention is to have a `static async register()` function in the Custom Component.\n * ```ts\n * export class MyComponent extends HTMLElement {\n * static async register() {\n * return registerComponent('my-component', MyComponent)\n * }\n * }\n * ```\n * That way, you can import multiple components and do a `Promise.all()` on all their `.register()`s.\n * ```ts\n * import { MyComponent, YourComponent, TheirComponent } ...\n * await Promise.all([\n * MyComponent.register(),\n * YourComponent.register(),\n * TheirComponent.register(),\n * ])\n *\n * @throws {TypeError} If name is not a string or constructor is not a function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define | customElements.define}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined | customElements.whenDefined}\n */\nexport async function registerComponent(\n name: string,\n constructor: CustomElementConstructor,\n options?: ElementDefinitionOptions,\n): Promise<void> {\n if (!isStr(name)) {\n throw new TypeError(`Expected a string name. Got ${name} (${typeof name})`)\n }\n if (!isFn(constructor)) {\n throw new TypeError(`Expected a constructor function. Got ${constructor} (${typeof constructor})`)\n }\n if (!customElements.get(name)) {\n customElements.define(name, constructor, options)\n await customElements.whenDefined(name)\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAuBM,SAAU,MAAS,GAAgB;AACrC,SAAO,MAAM;AACjB;AAkEM,SAAU,KAAyB,GAAU;AAC/C,SAAO,OAAO,MAAM;AACxB;;;AC3FA,IAAM,EAAE,OAAO,UAAU,UAAS,IAAK;AAiBjC,SAAU,MAAM,GAAU;AAC5B,SAAO,OAAO,MAAM,YAAY,CAAC,MAAM,CAAC;AAC5C;AAmFM,SAAU,QAAQ,GAAW,KAAc,KAAY;AACzD,MAAI,CAAC,MAAM,CAAC,GAAG;AACX,UAAM,IAAI,UAAU,wCAAwC,CAAC,KAAK,OAAO,CAAC,GAAG;EACjF;AAEA,MAAI,MAAM,GAAG,GAAG;AACZ,QAAI,CAAC,MAAM,GAAG,GAAG;AACb,YAAM,IAAI,UAAU,0CAA0C,GAAG,KAAK,OAAO,GAAG,GAAG;IACvF;AAEA,QAAI,MAAM,GAAG,GAAG;AACZ,UAAI,CAAC,MAAM,GAAG,GAAG;AACb,cAAM,IAAI,UAAU,0CAA0C,GAAG,KAAK,OAAO,GAAG,GAAG;MACvF;AAEA,UAAI,MAAM,KAAK;AACX,eAAO,OAAO,KAAK,KAAK;MAC5B;AAEA,aAAO,OAAO,KAAK,KAAK;IAC5B;AAEA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WAAW,GAAG;AAC7B,UAAM,IAAI;AAAA,MACN,6DAA6D,QAAQ,KAAK,OAAO,QAAQ;AAAA,IAC7F;AAAA,EACJ;AAEA,MAAI,aAAa,UAAU;AACvB,UAAM,WAAW,QAAQ,IAAI;AAC7B,QAAI,QAAQ,UAAU,QAAQ,GAAG;AAC7B,eAAS,QAAQ,IAAI;AACrB,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;AA+BA,eAAsB,kBAClB,MACA,aACA,SACa;AACb,MAAI,CAAC,MAAM,IAAI,GAAG;AACd,UAAM,IAAI,UAAU,+BAA+B,IAAI,KAAK,OAAO,IAAI,GAAG;AAAA,EAC9E;AACA,MAAI,CAAC,KAAK,WAAW,GAAG;AACpB,UAAM,IAAI,UAAU,wCAAwC,WAAW,KAAK,OAAO,WAAW,GAAG;AAAA,EACrG;AACA,MAAI,CAAC,eAAe,IAAI,IAAI,GAAG;AAC3B,mBAAe,OAAO,MAAM,aAAa,OAAO;AAChD,UAAM,eAAe,YAAY,IAAI;AAAA,EACzC;AACJ;",
|
|
4
|
+
"sourcesContent": [null, null, null, null, null, null, "import { isStr } from 'jty'\n\n/**\n * Returns the file extension\n *\n * @remarks\n * This convenience function is primarily used to guess the 'as' attribute of\n * a link preload/prefetch behind the scene.\n *\n * @example\n * ```ts\n * fileExt('file.txt') // => 'txt'\n * fileExt('https://www.alexewerlof.com/path/to/file.js') // => 'js'\n * ```\n *\n * @param path - absolute, relative, or URL path to a file\n * @returns the extension name in lowercase and without any dot prefix\n * @throws {TypeError} If path is not a string.\n */\nexport function fileExt(path: string): string {\n if (!isStr(path)) {\n throw new TypeError(`Expected a string file path. Got ${path} (${typeof path})`)\n }\n const lastDotIndex = path.lastIndexOf('.')\n if (lastDotIndex === -1) {\n return ''\n }\n const ext = path.slice(lastDotIndex + 1)\n if (ext.indexOf('/') !== -1) {\n return ''\n }\n return ext.toLowerCase().trim()\n}\n\n/**\n * Returns a promise that resolves before the next repaint.\n *\n * @remarks\n * Used to give the UI a moment to update.\n *\n * @example\n * ```ts\n * await nextAnimationFrame()\n * ```\n *\n * @returns A promise that resolves with the timestamp.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame | requestAnimationFrame}\n */\nexport function nextAnimationFrame(): Promise<number> {\n return new Promise((resolve) => requestAnimationFrame(resolve))\n}\n\n/**\n * Returns a promise that resolves after the specified delay.\n *\n * @remarks\n * Uses `setTimeout` to delay execution. When used with 0ms, it defers\n * execution to the next macro-task, allowing the event loop to cycle.\n *\n * @example\n * ```ts\n * await sleep(100)\n * await sleep() // equivalent to setTimeout(..., 0)\n * ```\n *\n * @param ms - The delay in milliseconds. Defaults to 0.\n * @returns A promise that resolves after the delay.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/setTimeout | setTimeout}\n */\nexport function sleep(ms: number = 0): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * Adds an event listener to a target.\n *\n * @example\n * ```ts\n * on(window, 'resize', () => console.log('resized'))\n * ```\n *\n * @param target - The event target.\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\nexport function on(target: EventTarget, eventName: string, handler: EventListenerOrEventListenerObject): void {\n target.addEventListener(eventName, handler)\n}\n\n/**\n * Removes an event listener from a target.\n *\n * @example\n * ```ts\n * off(window, 'resize', handler)\n * ```\n *\n * @param target - The event target.\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener | EventTarget.removeEventListener}\n */\nexport function off(target: EventTarget, eventName: string, handler: EventListenerOrEventListenerObject): void {\n target.removeEventListener(eventName, handler)\n}\n\n/**\n * Converts a CSS string to a CSSStyleSheet.\n *\n * @remarks\n * Suitable for attaching to ShadowRoot via `adoptedStyleSheets`.\n *\n * @example\n * ```ts\n * const sheet = await cssToStyle('p { color: red; }')\n * shadowRoot.adoptedStyleSheets = [sheet]\n * ```\n *\n * @param css - The CSS string.\n * @returns A promise resolving to the created CSSStyleSheet.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/replace | CSSStyleSheet.replace}\n */\nexport async function cssToStyle(css: string): Promise<CSSStyleSheet> {\n const sheet = new CSSStyleSheet()\n return await sheet.replace(css)\n}\n", "import { isStr } from 'jty'\n\n/**\n * Converts a PascalCase, camelCase, or snake_case string to kebab-case.\n *\n * @remarks\n * This function is useful for converting JavaScript property names to CSS or HTML attribute names.\n * It strictly validates the input to contain only alphanumeric characters and underscores.\n *\n * @example\n * ```ts\n * pas2keb('backgroundColor') // 'background-color'\n * pas2keb('MyComponent') // 'my-component'\n * pas2keb('user_id') // 'user-id'\n * ```\n *\n * @param str - The string to convert.\n * @returns The kebab-case string.\n * @throws {TypeError} If `str` is not a string or contains invalid characters (anything other than `/[a-zA-Z0-9_]/`).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace | String.prototype.replace}\n */\nexport function pas2keb(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n if (/[^a-zA-Z0-9_]/.test(str)) {\n throw new TypeError(`Invalid characters in string. Only alphanumeric and underscores are allowed. Got: ${str}`)\n }\n return str\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')\n .replace(/_/g, '-')\n .toLowerCase()\n}\n\n/**\n * Converts a kebab-case string to PascalCase.\n *\n * @remarks\n * This function splits the string by hyphens and capitalizes the first letter of each segment.\n * It handles multiple hyphens by ignoring empty segments.\n *\n * @example\n * ```ts\n * keb2pas('background-color') // 'BackgroundColor'\n * keb2pas('my-component') // 'MyComponent'\n * keb2pas('multi--dash') // 'MultiDash'\n * ```\n *\n * @param str - The string to convert.\n * @returns The PascalCase string.\n * @throws {TypeError} If `str` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split | String.prototype.split}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map | Array.prototype.map}\n */\nexport function keb2pas(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n return (\n str\n .split('-')\n .filter(Boolean) // Remove empty strings from leading/trailing/multiple hyphens\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('') ||\n // Handle strings that were not kebab-case to begin with (e.g. 'single', 'camelCase')\n (str.length > 0 ? str.charAt(0).toUpperCase() + str.slice(1) : '')\n )\n}\n\n/**\n * Converts a kebab-case string to camelCase.\n *\n * @remarks\n * This function is primarily useful for converting attributes to JavaScript property names.\n * Leading and trailing hyphens are removed before conversion.\n *\n * @example\n * ```ts\n * keb2cam('background-color') // 'backgroundColor'\n * keb2cam('-webkit-transform') // 'webkitTransform'\n * ```\n *\n * @param str - The string to convert.\n * @returns The camelCase string.\n * @throws {TypeError} If `str` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace | String.prototype.replace}\n */\nexport function keb2cam(str: string): string {\n if (!isStr(str)) {\n throw new TypeError(`Expected a string. Got ${str} (${typeof str})`)\n }\n return str\n .replace(/^-+|-+$/g, '') // Remove any leading or trailing hyphens\n .replace(/-+([a-z])/g, (g, c) => c.toUpperCase())\n}\n", "import { isA, isObj, isStr } from 'jty'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { off, on } from './util.js'\nimport { IAppendPrepend } from './mixin-types.js'\n\n/**\n * Wraps a DOM Node.\n *\n * @remarks\n * This is the base class for all JJ wrappers. It provides common functionality for DOM manipulation,\n * traversal, and event handling.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node | Node}\n */\nexport class JJN<T extends Node = Node> implements IAppendPrepend {\n /**\n * Creates a JJN instance from a Node reference.\n *\n * @example\n * ```ts\n * const node = JJN.from(document.createTextNode('hello'))\n * ```\n *\n * @param node - The Node instance.\n * @returns A new JJN instance.\n */\n static from(node: Node): JJN {\n return new JJN(node)\n }\n\n /**\n * Checks if a value can be passed to the `wrap()` or `unwrap()` function.\n *\n * @remarks\n * This is useful for filtering the array that is passed to `append()`, `prepend()` or `setChildren()`\n *\n * @param x an unknown value\n * @returns true if `x` is a string, Node (or its descendents), JJN (or its descendents)\n */\n static isWrapable(x: unknown): x is Wrappable {\n return isStr(x) || isA(x, Node) || isA(x, JJN)\n }\n\n /**\n * Wraps a native DOM node or string into the most specific JJ wrapper available.\n *\n * @remarks\n * This function acts as a factory, inspecting the input type and returning the appropriate\n * subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).\n *\n * @example\n * ```ts\n * const bodyWrapper = JJN.wrap(document.body) // Returns JJHE\n * const textWrapper = JJN.wrap('Hello') // Returns JJT wrapping a new Text node\n * ```\n *\n * @param raw - The object to wrap. If it's already Wrapped, it'll be returned without any change. We don't double-wrap or clone it.\n * @returns The most granular Wrapped subclass instance. If the input is already wrapped, it'll be returned as is without cloning.\n * @throws {TypeError} If the input is not a Node, string, or JJ wrapper.\n */\n static wrap(raw: Wrappable): Wrapped {\n throw new ReferenceError(`The mixin is supposed to override this method.`)\n }\n\n /**\n * Extracts the underlying native DOM node from a wrapper.\n *\n * @remarks\n * If the input is already a native Node, it is returned as is.\n * If the input is a string, a new Text node is created and returned.\n *\n * @example\n * ```ts\n * const rawElement = JJN.unwrap(myJJHE) // Returns HTMLElement\n * ```\n *\n * @param obj - The object to unwrap.\n * @returns The underlying DOM node.\n * @throws {TypeError} If the input cannot be unwrapped.\n */\n static unwrap(obj: Wrappable): Unwrapped {\n if (isStr(obj)) {\n return document.createTextNode(obj)\n }\n if (!isObj(obj)) {\n throw new TypeError(`Expected an object. Got ${obj} (${typeof obj})`)\n }\n if (isA(obj, Node)) {\n return obj\n }\n if (isA(obj, JJN)) {\n return obj.ref\n }\n throw new TypeError(`Could not unwrap ${obj} (${typeof obj})`)\n }\n\n /**\n * Wraps an iterable object (e.g. an array of wrapped or DOM elements).\n *\n * @example\n * ```ts\n * const wrappedList = JJN.wrapAll(document.querySelectorAll('div'))\n * ```\n *\n * @param iterable - The iterable to wrap.\n * @returns An array of wrapped instances.\n */\n static wrapAll(iterable: Iterable<Wrappable>): Wrapped[] {\n return Array.from(iterable, JJN.wrap)\n }\n\n /**\n * Unwraps an iterable object (e.g. an array or HTMLCollection).\n *\n * @example\n * ```ts\n * const nodes = JJN.unwrapAll(wrappedList)\n * ```\n *\n * @param iterable - The iterable to unwrap.\n * @returns An array of native DOM nodes.\n */\n static unwrapAll(iterable: Iterable<Wrappable>): Unwrapped[] {\n return Array.from(iterable, JJN.unwrap)\n }\n\n #ref!: T\n\n /**\n * Creates an instance of JJN.\n *\n * @param ref - The Node to wrap.\n * @throws {TypeError} If `ref` is not a Node.\n */\n constructor(ref: T) {\n if (!isA(ref, Node)) {\n throw new TypeError(`Expected a Node. Got ${ref} (${typeof ref})`)\n }\n this.#ref = ref\n }\n\n /**\n * Gets the underlying DOM Node.\n */\n get ref() {\n return this.#ref\n }\n\n /**\n * Clones the node.\n *\n * @param deep - If true, clones the subtree.\n * @returns A new wrapped instance of the clone.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode | Node.cloneNode}\n */\n clone(deep?: boolean): Wrapped {\n return JJN.wrap(this.ref.cloneNode(deep))\n }\n\n /**\n * Appends children to this node.\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param children - The children to append (Nodes, strings, or Wrappers).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/append | Element.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild | Node.appendChild}\n */\n append(...children: Wrappable[]) {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrapable))\n const ref = this.ref\n for (const node of nodes) {\n if (node) {\n ref.appendChild(node)\n }\n }\n return this\n }\n\n /**\n * Maps an array to children and appends them.\n *\n * @example\n * ```ts\n * list.mapAppend(['a', 'b'], item => h('li', null, item))\n * ```\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param array - The source array.\n * @param mapFn - The mapping function returning a Wrappable.\n * @returns This instance for chaining.\n */\n mapAppend(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.append(...array.map(mapFn))\n }\n\n /**\n * Prepends children to this node.\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param children - The children to prepend.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend | Element.prepend}\n */\n prepend(...children: Wrappable[]) {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrapable))\n const ref = this.ref\n const first = ref.firstChild\n for (const node of nodes) {\n if (node) {\n ref.insertBefore(node, first)\n }\n }\n return this\n }\n\n /**\n * Maps an array to children and prepends them.\n *\n * @example\n * ```ts\n * list.mapPrepend(['a', 'b'], item => JJHE.fromTag('li').setText(item))\n * ```\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param array - The source array.\n * @param mapFn - The mapping function.\n * @returns This instance for chaining.\n */\n mapPrepend(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.prepend(...array.map(mapFn))\n }\n\n /**\n * Replaces the existing children of this node with a specified new set of children.\n *\n * @remarks\n * If no children are specified, it essentially empties the node\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param children - The new children to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n */\n setChildren(...children: Wrappable[]): this {\n return this.empty().append(...children.filter(JJN.isWrapable))\n }\n\n /**\n * Adds an event listener.\n *\n * @param eventName - The event name.\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\n on(eventName: string, handler: EventListenerOrEventListenerObject): this {\n on(this.ref, eventName, handler)\n return this\n }\n\n /**\n * Removes an event listener.\n *\n * @param eventName - The event name.\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener | EventTarget.removeEventListener}\n */\n off(eventName: string, handler: EventListenerOrEventListenerObject): this {\n off(this.ref, eventName, handler)\n return this\n }\n\n /**\n * Removes this node from the DOM.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild | Node.removeChild}\n */\n rm() {\n this.ref.parentNode?.removeChild(this.ref)\n return this\n }\n\n /**\n * Removes all children from this node.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n */\n empty(): this {\n const element = this.ref\n while (element.firstChild) {\n element.removeChild(element.firstChild)\n }\n return this\n }\n\n /**\n * Runs a function in the context of this JJN instance.\n *\n * @example\n * ```ts\n * div.run(function() {\n * this.addClass('active')\n * console.log(this.ref)\n * })\n * ```\n * @remarks\n * If you want to access the current JJ* instance using `this` keyword, you SHOULD use a `function` not an arrow function.\n * If the function throws, `run()` doesn't swallow the exception.\n * So if you're expecting an error, make sure to wrap it in a `try..catch` block and handle the exception.\n * If the function returns a promise, you can `await` on the response.\n *\n * @param fn - The function to run. `this` inside the function will refer to this JJN instance.\n * @param args - Arguments to pass to the function.\n * @returns The return value of the function.\n */\n run<R, Args extends any[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R {\n return fn.call(this, ...args)\n }\n}\n", "import { isA, isStr } from 'jty'\nimport { JJN } from './JJN.js'\n\n/**\n * Wraps a DOM Text Node.\n *\n * @remarks\n * The Text interface represents the textual content of Element or Attr.\n * If an element has no markup within its content, it has a single child implementing Text\n * that contains the element's text.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Text | Text}\n */\nexport class JJT<T extends Text = Text> extends JJN<Text> {\n /**\n * Creates a JJT instance from a Text node.\n *\n * @example\n * ```ts\n * const textNode = document.createTextNode('foo')\n * const jjText = JJT.from(textNode)\n * ```\n *\n * @param text - The Text node.\n * @returns A new JJT instance.\n * @throws {TypeError} If `text` is not a Text node.\n */\n static from(text: Text): JJT {\n if (!isA(text, Text)) {\n throw new TypeError(`Expected a Text object. Got: ${text} (${typeof text})`)\n }\n return new JJT(text)\n }\n\n /**\n * Creates an instance of JJT.\n *\n * @example\n * ```ts\n * const text = new JJT('Hello World')\n * ```\n *\n * @param ref - The Text node or a string to create a Text node from.\n * @throws {TypeError} If `ref` is not a Text node or string.\n */\n constructor(ref: T | string) {\n if (isStr(ref)) {\n super(document.createTextNode(ref))\n } else if (isA(ref, Text)) {\n super(ref)\n } else {\n throw new TypeError(`Expected a Text. Got: ${ref} (${typeof ref})`)\n }\n }\n\n /**\n * Gets the text content.\n *\n * @returns The text content.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n getText(): string {\n return this.ref.textContent ?? ''\n }\n\n /**\n * Sets the text content.\n *\n * @example\n * ```ts\n * text.setText('New content')\n * ```\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @throws {TypeError} If `text` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n setText(text: string): this {\n if (!isStr(text)) {\n throw new TypeError(`Expected a string. Got: ${text} (${typeof text})`)\n }\n this.ref.textContent = text\n return this\n }\n\n /**\n * Clears the text content.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n empty(): this {\n return this.setText('')\n }\n\n /**\n * Sets the text content to multiple lines joined by newline.\n *\n * @example\n * ```ts\n * text.addLines('Line 1', 'Line 2')\n * ```\n *\n * @param lines - The lines of text.\n * @returns This instance for chaining.\n */\n addLines(...lines: string[]): this {\n return this.setText(lines.join('\\n'))\n }\n}\n", "import { isA } from 'jty'\nimport { JJN } from './JJN.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\n\nexport interface JJDF<T extends DocumentFragment> extends IById, IQuery, IAppendPrepend {}\n\n/**\n * Wraps a DocumentFragment (which is a descendant of Node).\n *\n * @remarks\n * DocumentFragments are lightweight versions of Document that store a segment of a document structure\n * comprised of nodes just like a standard document. The key difference is that because the document fragment\n * isn't part of the active document tree structure, changes made to the fragment don't affect the document,\n * cause reflow, or incur any performance impact that can occur when changes are made.\n *\n * @example\n * ```ts\n * const frag = JJDF.create()\n * frag.append(\n * h('div', null, 'Item 1'),\n * h('div', null, 'Item 2'),\n * )\n * document.body.appendChild(frag.ref)\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}\n */\nexport class JJDF<T extends DocumentFragment = DocumentFragment> extends JJN<T> {\n /**\n * Creates a JJDF instance from a DocumentFragment reference.\n *\n * @example\n * ```ts\n * const frag = JJDF.from(myFrag)\n * ```\n *\n *\n * @param ref - The DocumentFragment instance.\n * @returns A new JJDF instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}\n */\n static from(ref: DocumentFragment): JJDF {\n return new JJDF(ref)\n }\n\n /**\n * Creates a new empty JJDF instance (wraps a new DocumentFragment).\n *\n * @example\n * ```ts\n * const frag = JJDF.create()\n * ```\n *\n * @returns A new JJDF instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment | document.createDocumentFragment}\n */\n static create(): JJDF<DocumentFragment> {\n return new JJDF(document.createDocumentFragment())\n }\n\n /**\n * Creates an instance of JJDF.\n *\n * @param ref - The DocumentFragment instance to wrap.\n * @throws {TypeError} If `ref` is not a DocumentFragment.\n */\n constructor(ref: T) {\n if (!isA(ref, DocumentFragment)) {\n throw new TypeError(`Expected a DocumentFragment. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n}\n", "import { isA } from 'jty'\nimport { JJDF } from './JJDF.js'\n\n/**\n * Wraps a DOM ShadowRoot node (which is a descendant of DocumentFragment).\n *\n * @remarks\n * The ShadowRoot interface of the Shadow DOM API is the root node of a DOM subtree\n * that is rendered separately from a document's main DOM tree.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot | ShadowRoot}\n */\nexport class JJSR<T extends ShadowRoot = ShadowRoot> extends JJDF<T> {\n /**\n * Creates a JJSR instance from a ShadowRoot reference.\n *\n * @example\n * ```ts\n * const shadow = JJSR.from(element.shadowRoot)\n * ```\n *\n * @param shadowRoot - The ShadowRoot instance.\n * @returns A new JJSR instance.\n */\n static from(shadowRoot: ShadowRoot) {\n return new JJSR(shadowRoot)\n }\n\n /**\n * Creates an instance of JJSR.\n *\n * @param shadowRoot - The ShadowRoot to wrap.\n * @throws {TypeError} If `shadowRoot` is not a ShadowRoot.\n */\n constructor(shadowRoot: T) {\n if (!isA(shadowRoot, ShadowRoot)) {\n throw new TypeError(`Expected a ShadowRoot. Got ${shadowRoot} (${typeof shadowRoot})`)\n }\n super(shadowRoot)\n }\n\n /**\n * Gets the inner HTML of the shadow root.\n *\n * @returns The inner HTML string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n getHTML(): string {\n return this.ref.innerHTML\n }\n\n /**\n * Sets the inner HTML of the shadow root.\n *\n * @example\n * ```ts\n * shadow.setHTML('<p>Hello</p>', false)\n * ```\n *\n * @param value - The HTML string.\n * @param unsafe - Reserved for future use (must be false).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n setHTML(value: string, unsafe: false): this {\n // TODO: https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/setHTMLUnsafe\n this.ref.innerHTML = value\n return this\n }\n\n /**\n * Adds constructed stylesheets to the shadow root.\n *\n * @example\n * ```ts\n * const sheet = new CSSStyleSheet()\n * sheet.replaceSync('p { color: red; }')\n * shadow.addStyleSheets(sheet)\n * ```\n *\n * @param styleSheets - The stylesheets to add.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | ShadowRoot.adoptedStyleSheets}\n */\n addStyleSheets(...styleSheets: CSSStyleSheet[]): this {\n this.ref.adoptedStyleSheets.push(...styleSheets)\n return this\n }\n}\n", "import { isA, isArr, isObj, isStr } from 'jty'\nimport { JJN } from './JJN.js'\nimport { JJSR } from './JJSR.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\nimport { ShadowConfig, Wrapped } from './types.js'\n\nexport interface JJE<T extends Element> extends IQuery, IAppendPrepend {}\n\n/**\n * Wraps a DOM Element (which is a descendant of Node).\n *\n * @remarks\n * This class provides a wrapper around the native `Element` interface, adding fluent API methods\n * for attribute manipulation, class handling, and event binding.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element | Element}\n */\nexport class JJE<T extends Element = Element> extends JJN<T> implements IById {\n /**\n * Creates a JJE instance from an Element reference.\n *\n * @example\n * ```ts\n * const el = JJE.from(document.querySelector('.my-class'))\n * ```\n *\n * @param ref - The Element instance.\n * @returns A new JJE instance.\n */\n static from(ref: Element): JJE {\n return new JJE(ref)\n }\n\n /**\n * Creates an instance of JJE.\n *\n * @param ref - The Element to wrap.\n * @throws {TypeError} If `ref` is not an Element.\n */\n constructor(ref: T) {\n if (!isA(ref, Element)) {\n throw new TypeError(`Expected an Element. Got: ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Finds an element by ID within this element's context\n *\n * @remarks\n * This method uses `Element.querySelector()` under the hood.\n *\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n byId(id: string, throwIfNotFound = true): Wrapped | null {\n if (!isStr(id)) {\n throw new TypeError(`Expected a string id. Got ${id} (${typeof id})`)\n }\n return this.query(`#${id}`, throwIfNotFound)\n }\n\n /**\n * Gets the value of an attribute.\n *\n * @param name - The name of the attribute.\n * @returns The attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute | Element.getAttribute}\n */\n getAttr(name: string): string | null {\n return this.ref.getAttribute(name)\n }\n\n /**\n * Checks if an attribute exists.\n *\n * @param name - The name of the attribute.\n * @returns `true` if the attribute exists, otherwise `false`.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute | Element.hasAttribute}\n */\n hasAttr(name: string): boolean {\n return this.ref.hasAttribute(name)\n }\n\n /**\n * Sets the value of an attribute.\n *\n * @param name - The name of the attribute.\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}\n */\n setAttr(name: string, value: string): this {\n this.ref.setAttribute(name, value)\n return this\n }\n\n /**\n * Sets multiple attributes at once.\n *\n * @example\n * ```ts\n * el.setAttrs({ id: 'my-id', class: 'my-class' })\n * ```\n *\n * @param obj - An object where keys are attribute names and values are attribute values.\n * @returns This instance for chaining.\n * @throws {TypeError} If `obj` is not an object.\n */\n setAttrs(obj: Record<string, string>): this {\n if (!isObj(obj)) {\n throw new TypeError(`Expected an object. Got: ${obj} (${typeof obj})`)\n }\n for (const [name, value] of Object.entries(obj)) {\n this.setAttr(name, value)\n }\n return this\n }\n\n /**\n * Removes an attribute.\n *\n * @param name - The name of the attribute to remove.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute | Element.removeAttribute}\n */\n rmAttr(name: string) {\n return this.rmAttrs(name)\n }\n\n /**\n * Removes multiple attributes.\n *\n * @param names - The names of the attributes to remove.\n * @returns This instance for chaining.\n */\n rmAttrs(...names: string[]): this {\n for (const name of names) {\n this.ref.removeAttribute(name)\n }\n return this\n }\n\n /**\n * Gets the value of an ARIA attribute.\n *\n * @remarks\n * Automatically prepends `aria-` to the name.\n *\n * @example\n * ```ts\n * el.getAria('label') // gets 'aria-label'\n * ```\n *\n * @param name - The ARIA attribute suffix (e.g., 'label' for 'aria-label').\n * @returns The attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n getAria(name: string): string | null {\n return this.ref.getAttribute(`aria-${name}`)\n }\n\n /**\n * Checks if an ARIA attribute exists.\n *\n * @param name - The ARIA attribute suffix.\n * @returns `true` if the attribute exists.\n */\n hasAria(name: string): boolean {\n return this.ref.hasAttribute(`aria-${name}`)\n }\n\n /**\n * Sets an ARIA attribute.\n *\n * @example\n * ```ts\n * el.setAria('hidden', 'true') // sets aria-hidden=\"true\"\n * ```\n *\n * @param name - The ARIA attribute suffix.\n * @param value - The value to set.\n * @returns This instance for chaining.\n */\n setAria(name: string, value: string): this {\n this.ref.setAttribute(`aria-${name}`, value)\n return this\n }\n\n /**\n * Removes an ARIA attribute.\n *\n * @param name - The ARIA attribute suffix.\n * @returns This instance for chaining.\n */\n rmAria(name: string): this {\n this.ref.removeAttribute(`aria-${name}`)\n return this\n }\n\n /**\n * Gets the class attribute.\n *\n * @returns The class attribute value, or null if not present.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n */\n getClass(): string | null {\n return this.getAttr('class')\n }\n\n /**\n * Sets the class attribute.\n *\n * @param className - The class string to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n */\n setClass(className: string): this {\n return this.setAttr('class', className)\n }\n\n /**\n * Removes the `class` attribute of the element.\n *\n * @remarks\n * If you want to remove a few specific class instead of all, use `rmClasses`\n *\n * @returns This instance for chaining.\n */\n rmClass(): this {\n return this.rmAttr('class')\n }\n\n /**\n * Adds one or more classes to the element.\n *\n * @param classNames - The classes to add.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add | DOMTokenList.add}\n */\n addClass(...classNames: string[]): this {\n this.ref.classList.add(...classNames)\n return this\n }\n\n /**\n * Removes one or more classes from the element.\n *\n * @param classNames - The classes to remove.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove | DOMTokenList.remove}\n */\n rmClasses(...classNames: string[]): this {\n this.ref.classList.remove(...classNames)\n return this\n }\n\n /**\n * Checks if the element has a specific class.\n *\n * @param className - The class to check for.\n * @returns `true` if the element has the class.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains | DOMTokenList.contains}\n */\n hasClass(className: string): boolean {\n return this.ref.classList.contains(className)\n }\n\n /**\n * Toggles a class on the element.\n *\n * @param className - The class to toggle.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle | DOMTokenList.toggle}\n */\n toggleClass(className: string): this {\n this.ref.classList.toggle(className)\n return this\n }\n\n /**\n * Replaces a class with another one\n *\n * @remarks\n * If the `oldClassName` doesn't exist, the `newClassName` isn't added\n *\n * @param oldClassName - The class name to remove\n * @param newClassName - The class name to add\n */\n replaceClass(oldClassName: string, newClassName: string): this {\n this.ref.classList.replace(oldClassName, newClassName)\n return this\n }\n\n /**\n * Adds a click event listener.\n *\n * @param handler - The event handler.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener | EventTarget.addEventListener}\n */\n onClick(handler: EventListenerOrEventListenerObject): this {\n return this.on('click', handler)\n }\n\n /**\n * Hides the element by setting the `hidden` attribute and `aria-hidden=\"true\"`.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden | hidden attribute}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden | aria-hidden}\n */\n hide(): this {\n return this.setAttr('hidden', '').setAttr('aria-hidden', 'true')\n }\n\n /**\n * Shows the element by removing the `hidden` and `aria-hidden` attributes.\n *\n * @returns This instance for chaining.\n */\n show(): this {\n return this.rmAttrs('hidden', 'aria-hidden')\n }\n\n /**\n * Disables the element by setting the `disabled` attribute and `aria-disabled=\"true\"`.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled attribute}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled | aria-disabled}\n */\n disable(): this {\n return this.setAttr('disabled', '').setAttr('aria-disabled', 'true')\n }\n\n /**\n * Enables the element by removing the `disabled` and `aria-disabled` attributes.\n *\n * @returns This instance for chaining.\n */\n enable(): this {\n return this.rmAttrs('disabled', 'aria-disabled')\n }\n\n /**\n * Gets the title attribute.\n *\n * @returns The title, or null if not set.\n */\n getTitle(): string | null {\n return this.getAttr('title')\n }\n\n /**\n * Sets the title attribute.\n *\n * @param title - The title to set.\n * @returns This instance for chaining.\n */\n setTitle(title: string): this {\n return this.setAttr('title', title)\n }\n\n /**\n * Sets the id attribute.\n *\n * @param id - The id to set.\n * @returns This instance for chaining.\n */\n setId(id: string): this {\n return this.setAttr('id', id)\n }\n\n /**\n * Gets the id attribute.\n *\n * @returns The id, or null if not set.\n */\n getId(): string | null {\n return this.getAttr('id')\n }\n\n /**\n * Gets the inner HTML of the element.\n *\n * @returns The inner HTML string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n getHTML(): string {\n return this.ref.innerHTML\n }\n\n /**\n * Sets the inner HTML of the element.\n *\n * @param html - The HTML string to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}\n */\n setHTML(html: string): this {\n this.ref.innerHTML = html\n return this\n }\n\n /**\n * Attaches a Shadow DOM to the element and optionally sets its content and styles.\n *\n * @remarks\n * We prevent FOUC by assigning the template and CSS in one go.\n * **Note:** You can't attach a shadow root to every type of element. There are some that can't have a\n * shadow DOM for security reasons (for example `<a>`).\n *\n * @param mode - The encapsulation mode ('open' or 'closed'). Defaults to 'open'.\n * @param config - Optional configuration object containing `template` (HTML string) and `styles` (array of CSSStyleSheet).\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow | Element.attachShadow}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | ShadowRoot.adoptedStyleSheets}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets | Document.adoptedStyleSheets}\n */\n initShadow(mode: ShadowRootMode = 'open', config?: ShadowConfig): this {\n const shadowRoot = this.ref.shadowRoot ?? this.ref.attachShadow({ mode })\n if (isObj(config)) {\n const { template, styles } = config\n\n if (template) {\n shadowRoot.innerHTML = template\n }\n if (isArr(styles) && styles.length) {\n shadowRoot.adoptedStyleSheets.push(...styles)\n }\n }\n return this\n }\n\n /**\n * Gets a wrapper around the element's Shadow Root, if it exists.\n *\n * @returns A JJSR instance wrapping the shadow root, or null if no shadow root exists.\n */\n get shadow() {\n return this.ref.shadowRoot ? new JJSR(this.ref.shadowRoot) : null\n }\n}\n", "import { hasProp, isA, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { JJN } from './JJN.js'\nimport { IElementData, IQuery } from './mixin-types.js'\nimport { Wrapped } from './types.js'\n\n/**\n * Wraps a DOM HTMLElement (which is a descendant of Element).\n *\n * @remarks\n * This class extends `JJE` to provide specific functionality for HTML elements,\n * such as access to `dataset`, `innerText`, and form values.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement | HTMLElement}\n */\nexport class JJHE<T extends HTMLElement = HTMLElement> extends JJE<T> {\n /**\n * Creates a JJHE instance from an HTMLElement reference.\n *\n * @example\n * ```ts\n * const el = JJHE.from(document.getElementById('my-id'))\n * ```\n *\n * @param ref - The HTMLElement.\n * @returns A new JJHE instance.\n */\n static from(ref: HTMLElement): JJHE {\n return new JJHE(ref)\n }\n\n /**\n * Creates a JJHE instance from a tag name.\n *\n * @example\n * ```ts\n * const div = JJHE.fromTag('div')\n * const input = JJHE.fromTag('input', { is: 'custom-input' })\n * ```\n *\n * @param tagName - The tag name.\n * @param options - Element creation options.\n * @returns A new JJHE instance.\n * @throws {TypeError} If `tagName` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement | document.createElement}\n */\n static fromTag(tagName: string, options?: ElementCreationOptions): JJHE {\n if (!isStr(tagName)) {\n throw new TypeError(`Expected a string for tagName. Got: ${tagName} (${typeof tagName})`)\n }\n return new JJHE(document.createElement(tagName, options))\n }\n\n /**\n * Creates an instance of JJHE.\n *\n * @param ref - The HTMLElement to wrap.\n * @throws {TypeError} If `ref` is not an HTMLElement.\n */\n constructor(ref: T) {\n if (!isA(ref, HTMLElement)) {\n throw new TypeError(`Expected an HTMLElement. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the value property of the element (e.g. for inputs).\n *\n * @returns The value.\n * @throws {Error} If the element does not have a value property.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}\n */\n getValue() {\n if (!hasProp(this.ref, 'value')) {\n throw new Error('Element does not have a value property')\n }\n return this.ref.value\n }\n\n /**\n * Sets the value property of the element.\n *\n * @example\n * ```ts\n * input.setValue('new value')\n * ```\n *\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @throws {Error} If the element does not have a value property.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/value | HTMLInputElement.value}\n */\n setValue(value: string): this {\n if (!hasProp(this.ref, 'value')) {\n throw new Error('Element does not have a value property')\n }\n this.ref.value = value\n return this\n }\n\n /**\n * Focuses the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus | HTMLElement.focus}\n */\n focus(): this {\n this.ref.focus()\n return this\n }\n\n /**\n * Clicks the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click | HTMLElement.click}\n */\n click(): this {\n this.ref.click()\n return this\n }\n\n /**\n * Gets the inner text of the element.\n *\n * @returns The inner text.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}\n */\n getText(): string {\n return this.ref.innerText\n }\n\n /**\n * Sets the inner text of the element.\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText | HTMLElement.innerText}\n */\n setText(text: string): this {\n this.ref.innerText = text\n return this\n }\n\n /**\n * Finds the first element matching a selector within this element's context.\n *\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If the element is not found and `throwIfNotFound` is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n query(selector: string, throwIfNotFound = true): Wrapped | null {\n const el = this.ref.querySelector(selector)\n if (el) {\n return JJN.wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n }\n\n /**\n * Finds all elements matching a selector within this element's context.\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n */\n queryAll(selector: string): Wrapped[] {\n return JJN.wrapAll(this.ref.querySelectorAll(selector))\n }\n}\n\nexport declare interface JJHE<T extends HTMLElement> extends IQuery, IElementData {}\n", "import { isA, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { IElementData } from './mixin-types.js'\n\nconst SVG_NAMESPACE_URI = 'http://www.w3.org/2000/svg'\n\n/**\n * Wraps a DOM SVGElement.\n *\n * @remarks\n * This class extends `JJE` to provide specific functionality for SVG elements,\n * including namespace-aware creation and helper methods for common SVG attributes.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement | SVGElement}\n */\nexport class JJSE<T extends SVGElement = SVGElement> extends JJE<T> {\n /**\n * Creates a JJSE instance from an SVGElement reference.\n *\n * @example\n * ```ts\n * const svg = JJSE.from(myCircle)\n * ```\n *\n * @param ref - The SVGElement.\n * @returns A new JJSE instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement | SVGElement}\n */\n static from(ref: SVGElement): JJSE {\n return new JJSE(ref)\n }\n\n /**\n * Creates a JJSE instance from a tag name (in the SVG namespace).\n *\n * @remarks\n * Automatically uses the correct SVG namespace URI: `http://www.w3.org/2000/svg`.\n *\n * @example\n * ```ts\n * const circle = JJSE.fromTag('circle')\n * ```\n *\n * @param tagName - The tag name.\n * @param options - Element creation options.\n * @returns A new JJSE instance.\n * @throws {TypeError} If `tagName` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS | document.createElementNS}\n */\n static fromTag(tagName: string, options?: ElementCreationOptions): JJSE {\n if (!isStr(tagName)) {\n throw new TypeError(`Expected a string for tagName. Got: ${tagName} (${typeof tagName})`)\n }\n // SVG elements must be created with the SVG namespace\n const element = document.createElementNS(SVG_NAMESPACE_URI, tagName, options)\n return new JJSE(element as SVGElement)\n }\n\n /**\n * Creates an instance of JJSE.\n *\n * @param ref - The SVGElement to wrap.\n * @throws {TypeError} If `ref` is not an SVGElement.\n */\n constructor(ref: T) {\n if (!isA(ref, SVGElement)) {\n throw new TypeError(`Expected an SVGElement. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the element.\n *\n * @returns The text content.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n getText(): string {\n return this.ref.textContent ?? ''\n }\n\n /**\n * Sets the text content of the element.\n *\n * @param text - The text to set.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n setText(text: string): this {\n this.ref.textContent = text\n return this\n }\n\n /**\n * Clears the text content of the element.\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n empty(): this {\n this.ref.textContent = ''\n return this\n }\n\n /**\n * Sets the fill attribute.\n *\n * @param value - The fill color/value.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill | fill}\n */\n setFill(value: string): this {\n return this.setAttr('fill', value)\n }\n\n /**\n * Sets the stroke attribute.\n *\n * @param value - The stroke color/value.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke | stroke}\n */\n setStroke(value: string): this {\n return this.setAttr('stroke', value)\n }\n\n /**\n * Sets the stroke-width attribute.\n *\n * @param value - The width.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width | stroke-width}\n */\n setStrokeWidth(value: string | number): this {\n return this.setAttr('stroke-width', String(value))\n }\n\n /**\n * Sets the viewBox attribute.\n *\n * @example\n * ```ts\n * svg.setViewBox(0, 0, 100, 100)\n * svg.setViewBox('0 0 100 100')\n * ```\n *\n * @param p1 - Min-x or string/array value.\n * @param p2 - Min-y.\n * @param p3 - Width.\n * @param p4 - Height.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox | viewBox}\n */\n setViewBox(p1: string | (string | number)[] | number, p2?: number, p3?: number, p4?: number): this {\n if (typeof p1 === 'number' && p2 !== undefined && p3 !== undefined && p4 !== undefined) {\n return this.setAttr('viewBox', `${p1} ${p2} ${p3} ${p4}`)\n }\n const value = p1 as string | (string | number)[]\n return this.setAttr('viewBox', Array.isArray(value) ? value.join(' ') : value)\n }\n\n /**\n * Sets the width attribute.\n *\n * @param value - The width.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/width | width}\n */\n setWidth(value: string | number): this {\n return this.setAttr('width', String(value))\n }\n\n /**\n * Sets the height attribute.\n *\n * @param value - The height.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/height | height}\n */\n setHeight(value: string | number): this {\n return this.setAttr('height', String(value))\n }\n\n /**\n * Sets the d attribute (path data).\n *\n * @param value - The path data string or array of segments.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d | d}\n */\n setD(value: string | (string | number)[]): this {\n return this.setAttr('d', Array.isArray(value) ? value.join(' ') : value)\n }\n\n /**\n * Sets the transform attribute.\n *\n * @param value - The transform string.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform | transform}\n */\n setTransform(value: string): this {\n return this.setAttr('transform', value)\n }\n}\n\n// IElementData\nexport declare interface JJSE<T extends SVGElement> extends IElementData {}\n", "import { isA } from 'jty'\nimport { JJN } from './JJN.js'\nimport { IAppendPrepend, IById, IQuery } from './mixin-types.js'\n\nexport interface JJD<T extends Document> extends IById, IQuery, IAppendPrepend {}\n\n/**\n * Wraps a Document (which is a descendant of Node).\n *\n * @remarks\n * This class provides a wrapper around the native `Document` interface, inheriting\n * the fluent API capabilities of `JJN`.\n * It also supports querying (`byId`, `query`) and manipulation (`append`, `prepend`) methods.\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * doc.on('DOMContentLoaded', () => console.log('Ready'))\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document | Document}\n */\nexport class JJD<T extends Document = Document> extends JJN<T> {\n /**\n * Creates a JJD instance from a Document reference.\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * ```\n *\n * @param ref - The Document instance.\n * @returns A new JJD instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document | Document}\n */\n static from(ref: Document): JJD {\n return new JJD(ref)\n }\n\n /**\n * Creates an instance of JJD.\n *\n * @param ref - The Document instance to wrap.\n * @throws {TypeError} If `ref` is not a Document.\n */\n constructor(ref: T) {\n if (!isA(ref, Document)) {\n throw new TypeError(`Expected a Document. Got ${ref} (${typeof ref})`)\n }\n super(ref)\n }\n\n /**\n * Gets the `<head>` element of the document wrapped in a `JJHE` instance.\n *\n * @returns The wrapped head element.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/head | Document.head}\n */\n get head() {\n return JJN.wrap(this.ref.head)\n }\n\n /**\n * Gets the `<body>` element of the document wrapped in a `JJHE` instance.\n *\n * @returns The wrapped body element.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/body | Document.body}\n */\n get body() {\n return JJN.wrap(this.ref.body)\n }\n\n /**\n * Sets the document title.\n *\n * @example\n * ```ts\n * JJD.from(document).setTitle('New Page Title')\n * ```\n *\n * @param title - The new title string.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/title | Document.title}\n */\n setTitle(title: string): this {\n this.ref.title = title\n return this\n }\n\n /**\n * Gets the document title.\n *\n * @returns The current title of the document.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/title | Document.title}\n */\n getTitle(): string {\n return this.ref.title\n }\n}\n", "import { hasProp, isA, isObj, isStr } from 'jty'\nimport { JJHE } from './JJHE.js'\nimport { JJE } from './JJE.js'\nimport { JJDF } from './JJDF.js'\nimport { JJSR } from './JJSR.js'\nimport { JJT } from './JJT.js'\nimport { JJN } from './JJN.js'\nimport { JJD } from './JJD.js'\nimport { JJSE } from './JJSE.js'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { IById } from './mixin-types.js'\n\nexport const { wrapAll, unwrap, unwrapAll, isWrapable } = JJN\n\n/**\n * Wraps a native DOM node or string into the most specific JJ wrapper available.\n *\n * @remarks\n * This function acts as a factory, inspecting the input type and returning the appropriate\n * subclass of `JJN` (e.g., `JJHE` for `HTMLElement`, `JJT` for `Text`).\n *\n * @example\n * ```ts\n * const bodyWrapper = JJN.wrap(document.body) // Returns JJHE\n * const textWrapper = JJN.wrap('Hello') // Returns JJT wrapping a new Text node\n * ```\n *\n * @param raw - The object to wrap. If it's already Wrapped, it'll be returned without any change. We don't double-wrap or clone it.\n * @returns The most granular Wrapped subclass instance. If the input is already wrapped, it'll be returned as is without cloning.\n * @throws {TypeError} If the input is not a Node, string, or JJ wrapper.\n */\nexport function wrap(raw: Wrappable): Wrapped {\n if (isStr(raw)) {\n return JJT.from(document.createTextNode(raw))\n }\n if (!isObj(raw)) {\n throw new TypeError(`Expected an object to wrap. Got ${raw} (${typeof raw})`)\n }\n if (isA(raw, JJN)) {\n return raw\n }\n if (isA(raw, HTMLElement)) {\n return JJHE.from(raw)\n }\n if (isA(raw, SVGElement)) {\n return JJSE.from(raw)\n }\n if (isA(raw, Element)) {\n return JJE.from(raw)\n }\n if (isA(raw, ShadowRoot)) {\n return JJSR.from(raw)\n }\n if (isA(raw, DocumentFragment)) {\n return JJDF.from(raw)\n }\n if (isA(raw, Document)) {\n return JJD.from(raw)\n }\n if (isA(raw, Text)) {\n return JJT.from(raw)\n }\n if (isA(raw, Node)) {\n return JJN.from(raw)\n }\n throw new TypeError(`Expected a Node to wrap. Got ${raw} (${typeof raw})`)\n}\n\n/**\n * Finds an element by ID in the document.\n *\n * @example\n * ```ts\n * const el = byId('my-id')\n * ```\n *\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @throws {TypeError} If the element is not found and throwIfNotFound is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById | Document.getElementById}\n */\nexport function byId(id: string, throwIfNotFound = true): Wrapped | null {\n const el = document.getElementById(id)\n if (el) {\n return wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Found no element with id ${id} in the document.`)\n }\n return null\n}\n\n/**\n * Finds elements by class name in the document.\n *\n * @example\n * ```ts\n * const items = byClass('list-item')\n * ```\n *\n * @param className - The class name to search for.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName | Document.getElementsByClassName}\n */\nexport function byClass(className: string): Wrapped[] {\n return wrapAll(document.getElementsByClassName(className))\n}\n\n/**\n * Finds the first element matching a selector in the document.\n *\n * @example\n * ```ts\n * const btn = query('.submit-btn')\n * ```\n *\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If not found and throwIfNotFound is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector | Document.querySelector}\n */\nexport function query(selector: string, throwIfNotFound = true): Wrapped | null {\n const queryResult = document.querySelector(selector)\n if (queryResult) {\n return wrap(queryResult)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n}\n\n/**\n * Finds all elements matching a selector in the document.\n *\n * @example\n * ```ts\n * const inputs = queryAll('input[type=\"text\"]')\n * ```\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | Document.querySelectorAll}\n */\nexport function queryAll(selector: string): Wrapped[] {\n return wrapAll(document.querySelectorAll(selector))\n}\n\nconst DDF: IById = {\n /**\n * Finds an element by ID within this Document or DocumentFragment.\n *\n * @example\n * ```ts\n * const el = doc.byId('header')\n * ```\n *\n * @param this - The JJD or JJDF instance.\n * @param id - The ID to search for.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null if not found and throwIfNotFound is false.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById | Document.getElementById}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/getElementById | DocumentFragment.getElementById}\n */\n byId(this: JJD | JJDF, id: string, throwIfNotFound = true): Wrapped | null {\n const el = this.ref.getElementById(id)\n if (el) {\n return wrap(el)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with id ${id} not found`)\n }\n return null\n },\n}\n\nconst EDDF = {\n /**\n * Finds the first element matching a selector within this element's context.\n *\n * @example\n * ```ts\n * const span = div.query('span')\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param selector - The CSS selector.\n * @param throwIfNotFound - Whether to throw an error if not found. Defaults to true.\n * @returns The wrapped element, or null.\n * @throws {TypeError} If context is invalid or element not found (when requested).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector | Document.querySelector}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelector | DocumentFragment.querySelector}\n */\n query(this: JJE | JJD | JJDF, selector: string, throwIfNotFound = true): Wrapped | null {\n const queryResult = this.ref.querySelector(selector)\n if (queryResult) {\n return wrap(queryResult)\n }\n if (throwIfNotFound) {\n throw new TypeError(`Element with selector ${selector} not found`)\n }\n return null\n },\n\n /**\n * Finds all elements matching a selector within this element's context.\n *\n * @example\n * ```ts\n * const items = list.queryAll('li')\n * ```\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | Document.querySelectorAll}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll | DocumentFragment.querySelectorAll}\n */\n queryAll(this: JJE | JJD | JJDF, selector: string): Wrapped[] {\n return wrapAll(this.ref.querySelectorAll(selector))\n },\n\n /**\n * Appends children to this node using native append.\n *\n * @example\n * ```ts\n * myDiv.append(h('span', null, 'hello'))\n * ```\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to append.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/append | Element.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/append | Document.append}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/append | DocumentFragment.append}\n */\n append<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children.filter(isWrapable))\n this.ref.append(...nodes)\n return this\n },\n\n /**\n * Prepends children to this node using native prepend.\n *\n * @example\n * ```ts\n * div.prepend(h('span', null, 'first'))\n * ```\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to prepend.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend | Element.prepend}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend | Document.prepend}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/prepend | DocumentFragment.prepend}\n */\n prepend<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children.filter(isWrapable))\n this.ref.prepend(...nodes)\n return this\n },\n\n /**\n * Replaces the existing children of a node with a specified new set of children.\n *\n * @remarks\n * If no children are provided, it empties the node.\n *\n * @example\n * ```ts\n * div.setChildren(h('p', null, 'New Content'))\n * ```\n *\n * @remarks\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @param this - The JJE, JJD or JJDF instance.\n * @param children - The children to replace with.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.replaceChildren}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren | Document.replaceChildren}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren | DocumentFragment.replaceChildren}\n */\n setChildren<T extends JJE | JJD | JJDF>(this: T, ...children: Wrappable[]): T {\n const nodes = unwrapAll(children.filter(isWrapable))\n this.ref.replaceChildren(...nodes)\n return this\n },\n\n /**\n * Removes all children from this node.\n *\n * @example\n * ```ts\n * div.empty()\n * ```\n *\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren | Element.setChildren}\n */\n empty<T extends JJE | JJD | JJDF>(this: T): T {\n this.setChildren()\n return this\n },\n}\n\nconst HESE = {\n getData<T extends JJHE | JJSE>(this: T, name: string): string | undefined {\n return this.ref.dataset[name]\n },\n\n hasData<T extends JJHE | JJSE>(this: T, name: string): boolean {\n return hasProp(this.ref.dataset, name)\n },\n\n setData<T extends JJHE | JJSE>(this: T, name: string, value: string): T {\n this.ref.dataset[name] = value\n return this\n },\n\n setDataObj<T extends JJHE | JJSE>(this: T, obj: Record<string, string>): T {\n for (const [name, value] of Object.entries(obj)) {\n this.setData(name, value)\n }\n return this\n },\n\n rmData<T extends JJHE | JJSE>(this: T, name: string): T {\n delete this.ref.dataset[name]\n return this\n },\n}\n\nfunction assignPrototype(Class: any, ...mixins: any[]) {\n for (const mixin of mixins) {\n Object.assign(Class.prototype, mixin)\n }\n}\n\nJJN.wrap = wrap\n\nassignPrototype(JJE, EDDF)\nassignPrototype(JJD, DDF, EDDF)\nassignPrototype(JJDF, DDF, EDDF)\nassignPrototype(JJHE, HESE)\nassignPrototype(JJSE, HESE)\n", "import { isA, isStr } from 'jty'\nimport { JJHE } from './JJHE.js'\nimport { Wrappable } from './types.js'\nimport { cssToStyle, fileExt } from './util.js'\n\n/**\n * Hyperscript helper to create JJHE instances.\n * The `h` function provides a concise way to create DOM wrappers with attributes and children,\n * similar to hyperscript helpers found in other libraries.\n *\n *\n * @remarks\n * It returns a `JJHE` instance which wraps the native HTMLElement.\n *\n * You may recognize it from other libraries:\n * - [React](https://react.dev/reference/react/createElement)\n * - [Vue](https://vuejs.org/guide/extras/render-function)\n * - [Hyperscript](https://github.com/hyperhype/hyperscript)\n * - [Angular](https://angular.dev/guide/components/programmatic-rendering)\n * - [Lit](https://lit.dev/docs/components/rendering/)\n *\n * This is not exactly a replacement, but it roughly follows the same idea.\n *\n * @example\n * ```ts\n * // Create a simple div\n * h('div', { id: 'app' }, 'Hello World')\n *\n * // Create a nested structure\n * h('ul', { class: 'list' },\n * h('li', null, 'Item 1'),\n * h('li', null, 'Item 2')\n * )\n * ```\n *\n * @param tagName - The HTML tag name.\n * @param attributes - Attributes to set on the element. Can be null or undefined.\n * @param children - Children to append (strings, nodes, or other JJHE instances).\n * @returns The created JJHE instance.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement | document.createElement}\n */\nexport function h(tagName: string, attributes?: Record<string, string> | null, ...children: Wrappable[]): JJHE {\n const ret = JJHE.fromTag(tagName).append(...children)\n if (attributes) {\n ret.setAttrs(attributes)\n }\n return ret\n}\n\n/**\n * Tries to find the best match for the link.as attribute when it's omitted\n * @param href a relative, absolute, or URL resource\n * @returns a valid value for the link.as attribute\n * @throws {TypeError} if it cannot guess a valid value for the 'link.as' attribute\n */\nfunction linkAs(href: string): 'fetch' | 'style' | 'script' {\n switch (fileExt(href)) {\n case 'html':\n case 'htm':\n case 'md':\n return 'fetch'\n case 'css':\n return 'style'\n case 'js':\n case 'mjs':\n case 'cjs':\n return 'script'\n default:\n throw new Error(`No 'as' attribute was specified and we failed to guess it from the URL: ${href}`)\n }\n}\n\n/**\n * Creates a `<link>` element for prefetching or preloading resources.\n *\n * @remarks\n * This function validates the input arguments and returns a wrapped `JJHE` instance.\n * It does not append the element to the document.\n *\n * @param rel - The relationship of the linked resource ('prefetch' or 'preload').\n * @param href - The URL of the resource.\n * @param as - The type of content being loaded ('fetch' for HTML, 'style' for CSS, or 'script' for JavaScript files).\n * If it's not provided or set to a falsy value, it runs heuristics to find the best match from the href parameter.\n *\n * @returns The JJHE instance representing the link element. The `<link>` is accessible via `.ref`\n * @throws {TypeError} If `href` is not a string or URL.\n * @throws {RangeError} If `rel` or `as` are not valid values.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload | Link types: preload}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/prefetch | Link types: prefetch}\n */\nexport function createLinkPre(\n rel: 'prefetch' | 'preload',\n href: string | URL,\n as?: 'fetch' | 'style' | 'script',\n): JJHE {\n if (!isStr(href)) {\n if (!isA(href, URL)) {\n throw new TypeError(`Expected a string or URL. Got ${href} (${typeof href})`)\n }\n href = href.toString()\n }\n\n if (!['prefetch', 'preload'].includes(rel)) {\n throw new RangeError(`rel should be one of 'prefetch' or 'preload'. Got ${rel} (${typeof rel})`)\n }\n\n if (!as) {\n as = linkAs(href)\n if (!as) {\n throw new Error(`No 'as' attribute was specified and we failed to guess it from the URL: ${href}`)\n }\n }\n\n if (!['fetch', 'style', 'script'].includes(as)) {\n throw new RangeError(`as should be one of 'fetch' or 'style'. Got ${as} (${typeof as})`)\n }\n\n return JJHE.fromTag('link').setAttrs({\n rel,\n href,\n as,\n })\n}\n\n/**\n * Adds a `<link>` tag to the document head for prefetching or preloading resources.\n *\n * @remarks\n * This function helps in optimizing performance by telling the browser to fetch resources\n * that might be needed later (prefetch) or are needed immediately (preload).\n *\n * Please refer to {@link createLinkPre} for more details.\n *\n * @example\n * ```ts\n * // Preload a script\n * addLinkPre('https://example.com/script.js', 'preload', 'script')\n *\n * // Prefetch a future page's CSS\n * addLinkPre('/next-page.css', 'prefetch', 'style')\n * ```\n *\n * @returns The JJHE instance representing the link element.\n * @throws {TypeError} If `href` is not a string or URL.\n * @throws {RangeError} If `rel` or `as` are not valid values.\n * @see {@link createLinkPre}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload | Link types: preload}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/prefetch | Link types: prefetch}\n */\nexport function addLinkPre(...args: Parameters<typeof createLinkPre>) {\n const link = createLinkPre(...args)\n document.head.append(link.ref)\n return link\n}\n\n/**\n * Fetches a file and returns its contents as string.\n *\n * @remarks\n * This is a wrapper around the native `fetch` API that handles the response status check\n * and text extraction. It sets the `Accept` header based on the provided mime type.\n *\n * @example\n * ```ts\n * const text = await fetchText('https://example.com/data.txt')\n * ```\n *\n * @param url - The file location.\n * @param mime - The HTTP Request Accept header. Defaults to 'text/*'.\n * @returns The file contents as a string.\n * @throws {TypeError} If `mime` is not a string.\n * @throws {Error} If the fetch fails or the response status is not OK (200-299).\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/text | Response.text()}\n */\nexport async function fetchText(url: URL | string, mime: string = 'text/*') {\n if (!isStr(mime)) {\n throw new TypeError(`Expected a string mime like 'text/html' or 'text/css'. Got ${mime} (${typeof mime})`)\n }\n const response = await fetch(url, { headers: { Accept: mime } })\n if (!response.ok) {\n throw new Error(`GET ${url} failed: ${response.status} ${response.statusText}`)\n }\n return response.text()\n}\n\n/**\n * Fetches the contents of a HTML file as string.\n *\n * @remarks\n * Useful for loading HTML templates dynamically.\n * You can use `import.meta.resolve('./relative-path-to.html')` to resolve paths relative to the current module.\n *\n * @example\n * ```ts\n * const template = await fetchHtml('./template.html')\n * ```\n *\n * @param url - The HTML file location.\n * @returns The file content as a string.\n * @throws {Error} If the response is not ok.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types | MIME types}\n */\nexport async function fetchHtml(url: URL | string): Promise<string> {\n return await fetchText(url, 'text/html')\n}\n\n/**\n * Fetches the contents of a CSS file as string.\n *\n * @remarks\n * You can use `import.meta.resolve('./relative-path-to.css')` inside components to resolve relative paths.\n *\n * @example\n * ```ts\n * const css = await fetchCss('./style.css')\n * ```\n *\n * @param url - The CSS file location.\n * @returns The file content as a string.\n * @throws {Error} If the response is not ok.\n */\nexport async function fetchCss(url: URL | string): Promise<string> {\n return await fetchText(url, 'text/css')\n}\n\n/**\n * Fetches a CSS file and constructs a CSSStyleSheet.\n *\n * @remarks\n * This is particularly useful for Constructable Stylesheets, which can be shared across Shadow DOM boundaries.\n *\n * @example\n * ```ts\n * const sheet = await fetchStyle('./component.css')\n * shadowRoot.adoptedStyleSheets = [sheet]\n * ```\n *\n * @param url - The CSS file location.\n * @returns The CSSStyleSheet object constructed from the CSS contents.\n * @throws {Error} If the fetch fails.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet | CSSStyleSheet}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | adoptedStyleSheets}\n */\nexport async function fetchStyle(url: URL | string): Promise<CSSStyleSheet> {\n return await cssToStyle(await fetchCss(url))\n}\n", "import { hasProp, isA, isArr, isDef, isFn, isStr } from 'jty'\nimport { JJStyleConfig, JJTemplateConfig, ShadowConfig } from './types.js'\nimport { JJHE } from './JJHE.js'\nimport { cssToStyle } from './util.js'\nimport { keb2cam } from './case.js'\n\n/**\n * Resolves a template configuration into a string suitable for Shadow DOM.\n *\n * Handles functions (sync/async), promises, strings, JJHE instances, and HTMLElements.\n *\n * @param templateConfig - The configuration to resolve.\n * @returns A promise resolving to the HTML string or undefined.\n * @throws {TypeError} If the resolved value is not a string, JJHE, or HTMLElement.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML | Element.outerHTML}\n */\nasync function templatePromise(templateConfig?: JJTemplateConfig): Promise<ShadowConfig['template']> {\n if (!isDef(templateConfig)) {\n return undefined\n }\n\n if (isFn(templateConfig)) {\n templateConfig = await templateConfig()\n }\n\n templateConfig = await templateConfig\n\n if (isStr(templateConfig)) {\n return templateConfig\n }\n if (isA(templateConfig, JJHE)) {\n return templateConfig.getHTML()\n }\n if (isA(templateConfig, HTMLElement)) {\n return templateConfig.outerHTML\n }\n\n throw new TypeError(`Expected a string, JJHE or HTMLElement. Got ${templateConfig} (${typeof templateConfig})`)\n}\n\n/**\n * Resolves a style configuration into a CSSStyleSheet.\n *\n * Handles functions (sync/async), promises, CSSStyleSheet instances, and strings.\n * Strings are converted to CSSStyleSheet using `cssToStyle`.\n *\n * @param styleConfig - The configuration to resolve.\n * @returns A promise resolving to a CSSStyleSheet.\n * @throws {TypeError} If the resolved value is not a string or CSSStyleSheet.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet | CSSStyleSheet}\n */\nasync function stylePromise(styleConfig?: JJStyleConfig): Promise<CSSStyleSheet> {\n if (isFn(styleConfig)) {\n styleConfig = await styleConfig()\n }\n\n styleConfig = await styleConfig\n\n if (isA(styleConfig, CSSStyleSheet)) {\n return styleConfig\n }\n if (isStr(styleConfig)) {\n return await cssToStyle(styleConfig)\n }\n\n throw new TypeError(`Expected a css string or CSSStyleSheet. Got ${styleConfig} (${typeof styleConfig})`)\n}\n\n/**\n * Maps an array of style configurations to an array of promises resolving to CSSStyleSheets.\n *\n * @param styleConfigs - Array of style configurations.\n * @returns Array of promises.\n */\nfunction stylePromises(styleConfigs?: JJStyleConfig[]): Promise<CSSStyleSheet>[] {\n if (!isArr(styleConfigs)) {\n return []\n }\n\n return styleConfigs.map(stylePromise)\n}\n\n/**\n * Resolves both template and style configurations.\n *\n * @param templateConfig - The template configuration.\n * @param styleConfigs - The style configurations.\n * @returns A promise resolving to the final ShadowConfig.\n */\nasync function resolveConfig(templateConfig?: JJTemplateConfig, styleConfigs?: JJStyleConfig[]): Promise<ShadowConfig> {\n const [template, ...styles] = await Promise.all([templatePromise(templateConfig), ...stylePromises(styleConfigs)])\n return { template, styles }\n}\n\n/**\n * Manages the resolution of Shadow DOM configuration (template and styles).\n *\n * Allows building up the configuration and resolving it lazily.\n *\n * @example\n * ```ts\n * const sm = ShadowMaster.create()\n * .setTemplate('<div>Hello World</div>')\n * .addStyles('div { color: red; }')\n *\n * class MyComponent extends HTMLElement {\n * async connectedCallback() {\n * // Resolves the config once and caches it\n * const shadowConfig = await sm.getResolved()\n * // ... init shadow root with shadowConfig\n * }\n * }\n * ```\n */\nexport class ShadowMaster {\n #templateConfig?: JJTemplateConfig = undefined\n #stylesConfig: JJStyleConfig[] = []\n #normalizedConfig?: Promise<ShadowConfig> = undefined\n\n /**\n * Creates a new instance of ShadowMaster.\n *\n * @returns A new ShadowMaster instance.\n */\n static create() {\n return new ShadowMaster()\n }\n\n constructor() {}\n\n /**\n * Sets the template configuration.\n *\n * @param templateConfig - The template configuration.\n * @returns The instance for chaining.\n *\n * @example\n * ```ts\n * // Accepts string, promise, or fetchHtml result\n * sm.setTemplate(fetchHtml('./template.html'))\n * ```\n */\n setTemplate(templateConfig?: JJTemplateConfig): this {\n this.#templateConfig = templateConfig\n return this\n }\n\n /**\n * Adds one or more style configurations.\n *\n * @param stylesConfig - Variable number of style configurations.\n * @returns The instance for chaining.\n *\n * @example\n * ```ts\n * sm.addStyles(\n * 'p { color: red; }',\n * fetchCss('./styles.css'),\n * () => fetchCss('../lazy-loaded-styles.css'),\n * )\n * ```\n */\n addStyles(...stylesConfig: JJStyleConfig[]): this {\n this.#stylesConfig.push(...stylesConfig)\n return this\n }\n\n /**\n * Resolves the configuration to something that can be fed to `JJHE.initShadow()` function\n *\n * The result is cached, so subsequent calls return the same promise.\n * Note: Any changes made to the ShadowMaster instance (via setTemplate/addStyles)\n * after the first call to getResolved() will be ignored.\n *\n * @returns A promise resolving to the ShadowConfig.\n */\n async getResolved(): Promise<ShadowConfig> {\n if (!this.#normalizedConfig) {\n this.#normalizedConfig = resolveConfig(this.#templateConfig, this.#stylesConfig)\n }\n return await this.#normalizedConfig\n }\n}\n\n/**\n * A helper to bridge the attribute world (kebab-case) to the property world (camelCase).\n * It works in tandem with browser's `observedAttributes` feature which triggers\n * `attributeChangedCallback`.\n *\n * @remarks\n * Your custom component class MUST define `static observedAttributes[]` otherwise `attributeChangedCallback` won't trigger.\n * `observedAttributes` should contain kebab-based attribute names.\n *\n * @example\n * ```ts\n * class MyComponent extends HTMLElement {\n * static observedAttributes = ['user-name', 'counter']\n * userName = '' // Property MUST exist on the instance (or prototype setter)\n * #counter = 0 // You can also use private properties together with getter/setters\n * \n * attributeChangedCallback(name, oldValue, newValue) {\n * attr2prop(this, name, oldValue, newValue)\n * }\n\n * get counter() {\n * return this.#counter\n * }\n * \n * set counter(value) {\n * this.#counter = value\n * this.#render() // You can call your render function to update the DOM\n * }\n * \n * #render() {\n * const shadow = JJHE.from(this).shadow\n * if (shadow) {\n * shadow.byId('user').setText(this.userName)\n * shadow.byId('counter').setText(this.counter)\n * }\n * }\n * }\n * ```\n *\n * @param instance - A reference to the common component instance\n * @param name - kebab-case and in lower case exactly as it appears in `observedAttributes`.\n * @param oldValue - The previous value of the attribute.\n * @param newValue - The new value of the attribute.\n * @returns `true` if it tried to set the attribute; otherwise `false`.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes | Responding to attribute changes}\n */\nexport function attr2prop(instance: HTMLElement, name: string, oldValue: any, newValue: any) {\n if (!isA(instance, HTMLElement)) {\n throw new TypeError(\n `Expected an HTMLElement or a custom element instance. Got ${instance} (${typeof instance})`,\n )\n }\n // Called when observed attributes change.\n if (oldValue !== newValue) {\n const propName = keb2cam(name)\n if (hasProp(instance, propName)) {\n instance[propName] = newValue\n return true\n }\n }\n return false\n}\n\n/**\n * Registers the custom element with the browser and waits till it is defined.\n *\n * @example\n * ```ts\n * class MyComponent extends HTMLElement {}\n * await registerComponent('my-component', MyComponent)\n * ```\n * Another convention is to have a `static async register()` function in the Custom Component.\n * ```ts\n * export class MyComponent extends HTMLElement {\n * static async register() {\n * return registerComponent('my-component', MyComponent)\n * }\n * }\n * ```\n * That way, you can import multiple components and do a `Promise.all()` on all their `.register()`s.\n * ```ts\n * import { MyComponent, YourComponent, TheirComponent } ...\n * await Promise.all([\n * MyComponent.register(),\n * YourComponent.register(),\n * TheirComponent.register(),\n * ])\n *\n * @throws {TypeError} If name is not a string or constructor is not a function\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define | customElements.define}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined | customElements.whenDefined}\n */\nexport async function registerComponent(\n name: string,\n constructor: CustomElementConstructor,\n options?: ElementDefinitionOptions,\n): Promise<void> {\n if (!isStr(name)) {\n throw new TypeError(`Expected a string name. Got ${name} (${typeof name})`)\n }\n if (!isFn(constructor)) {\n throw new TypeError(`Expected a constructor function. Got ${constructor} (${typeof constructor})`)\n }\n if (!customElements.get(name)) {\n customElements.define(name, constructor, options)\n await customElements.whenDefined(name)\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAuBM,SAAU,MAAS,GAAgB;AACrC,SAAO,MAAM;AACjB;AAkEM,SAAU,KAAyB,GAAU;AAC/C,SAAO,OAAO,MAAM;AACxB;;;AC3FA,IAAM,EAAE,OAAO,UAAU,UAAS,IAAK;AAiBjC,SAAU,MAAM,GAAU;AAC5B,SAAO,OAAO,MAAM,YAAY,CAAC,MAAM,CAAC;AAC5C;AAmFM,SAAU,QAAQ,GAAW,KAAc,KAAY;AACzD,MAAI,CAAC,MAAM,CAAC,GAAG;AACX,UAAM,IAAI,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