jj 2.8.0 → 2.9.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/SKILL.md +20 -2
- package/lib/bundle.cjs +61 -0
- package/lib/bundle.cjs.map +1 -1
- package/lib/bundle.d.cts +50 -0
- package/lib/bundle.d.ts +50 -0
- package/lib/bundle.global.js +61 -0
- package/lib/bundle.global.js.map +1 -1
- package/lib/bundle.js +61 -0
- package/lib/bundle.js.map +1 -1
- package/lib/bundle.min.cjs +1 -1
- package/lib/bundle.min.cjs.map +1 -1
- package/lib/bundle.min.d.cts +50 -0
- package/lib/bundle.min.d.ts +50 -0
- package/lib/bundle.min.global.js +1 -1
- package/lib/bundle.min.global.js.map +1 -1
- package/lib/bundle.min.js +1 -1
- package/lib/bundle.min.js.map +1 -1
- package/package.json +1 -1
package/lib/bundle.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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/internal.ts","../src/util.ts","../src/case.ts","../src/wrappers/JJET.ts","../src/wrappers/JJN-raw.ts","../src/wrappers/JJNx.ts","../src/wrappers/JJDF.ts","../src/wrappers/JJSR.ts","../src/wrappers/JJE.ts","../src/wrappers/JJEx.ts","../src/wrappers/JJHE.ts","../src/wrappers/JJT.ts","../src/wrappers/JJD.ts","../src/wrappers/JJSE.ts","../src/wrappers/JJN.ts","../src/helpers.ts","../src/components.ts","../src/ShadowMaster.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/**\n * Internal utilities for the JJ library.\n * These are not part of the public API.\n */\n\n/**\n * Creates a gzip-friendly error message by concatenating strings.\n * This avoids repeating common error message patterns that compress well.\n *\n * @remarks\n * Uses backtick strings to take advantage of gzip compression across the codebase.\n * Common patterns like `Expected 'x' to be ...` compress very efficiently.\n *\n * @internal\n * @param varName - The name of the variable\n * @param expected - Description of expected type\n * @param received - The actual value received\n * @returns Error message string\n */\nexport function errMsg(varName: string, expected: unknown, received: unknown): string {\n return `Expected '${varName}' to be ${expected}. Got ${received} (${typeof received})`\n}\n\n/**\n * Creates a TypeError with a standardized error message.\n * Convenience wrapper around errMsg for type errors.\n *\n * @internal\n * @param varName - The name of the variable\n * @param expected - Description of expected type\n * @param received - The actual value received\n * @returns A TypeError ready to be thrown\n */\nexport function typeErr(varName: string, expected: unknown, received: unknown): TypeError {\n return new TypeError(errMsg(varName, expected, received))\n}\n","import { isStr } from 'jty'\nimport { typeErr } from './internal.js'\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 typeErr('path', 'a string', 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 * 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'\nimport { errMsg, typeErr } from './internal.js'\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 typeErr('str', 'a string', str)\n }\n if (/[^a-zA-Z0-9_]/.test(str)) {\n throw new SyntaxError(errMsg('str', 'alphanumeric characters and underscores', 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 typeErr('str', 'a string', 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 typeErr('str', 'a string', 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'\n\n/**\n * Wraps a DOM EventTarget.\n *\n * @remarks\n * This is the base class for all JJ wrappers that wrap an EventTarget.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | EventTarget}\n */\nexport class JJET<T extends EventTarget = EventTarget> {\n static from(ref: EventTarget) {\n return new JJET(ref)\n }\n\n #ref!: T\n #boundHandlers = new WeakMap<EventListenerOrEventListenerObject, EventListenerOrEventListenerObject>()\n\n /**\n * Creates a JJET instance.\n *\n * @param ref - The EventTarget to wrap.\n * @throws {TypeError} If `ref` is not an EventTarget.\n */\n constructor(ref: T) {\n if (!isA(ref, EventTarget)) {\n throw new TypeError(`JJET expects an EventTarget instance. Got ${ref} (${typeof ref}). `)\n }\n this.#ref = ref\n }\n\n /**\n * Gets the underlying DOM object.\n */\n get ref() {\n return this.#ref\n }\n\n /**\n * Gets or creates a bound version of the handler.\n *\n * @remarks\n * Bound handlers are cached in a WeakMap to ensure `off()` can properly remove listeners.\n * When the original handler is garbage collected, the bound version is automatically removed.\n *\n * @param handler - The event handler to bind.\n * @returns The bound handler, or null if the input is null.\n */\n #getBoundHandler(handler: EventListenerOrEventListenerObject | null): EventListenerOrEventListenerObject | null {\n if (handler === null) return null\n\n let bound = this.#boundHandlers.get(handler)\n if (!bound) {\n // Bind the handler to this JJET instance\n if (typeof handler === 'function') {\n bound = handler.bind(this)\n } else {\n // EventListenerObject with handleEvent method\n bound = { handleEvent: handler.handleEvent.bind(this) }\n }\n this.#boundHandlers.set(handler, bound)\n }\n return bound\n }\n\n /**\n * Adds an event listener.\n *\n * @remarks\n * The handler is automatically bound to this JJET instance, so `this` inside the handler\n * refers to the JJET instance, not the DOM element. To access the DOM element, use `this.ref`.\n *\n * @example\n * ```ts\n * JJET.from(window).on('resize', function() {\n * console.log(this) // JJET instance\n * console.log(this.ref) // window object\n * })\n * ```\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @param options - Optional event listener options.\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 | null, options?: AddEventListenerOptions): this {\n const boundHandler = this.#getBoundHandler(handler)\n this.ref.addEventListener(eventName, boundHandler, options)\n return this\n }\n\n /**\n * Removes an event listener.\n *\n * @remarks\n * Pass the same handler reference that was used in `on()` to properly remove the listener.\n *\n * @example\n * ```ts\n * const handler = function() { console.log(this) }\n * JJET.from(window).on('resize', handler)\n * JJET.from(window).off('resize', handler)\n * ```\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @param options - Optional event listener options or boolean.\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(\n eventName: string,\n handler: EventListenerOrEventListenerObject | null,\n options?: EventListenerOptions | boolean,\n ): this {\n const boundHandler = this.#getBoundHandler(handler)\n this.ref.removeEventListener(eventName, boundHandler, options)\n return this\n }\n\n /**\n * Dispatches an Event at the specified EventTarget.\n *\n * @param event - The Event object to dispatch.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent | EventTarget.dispatchEvent}\n */\n trigger(event: Event): this {\n this.ref.dispatchEvent(event)\n return this\n }\n\n /**\n * Runs a function in the context of this JJET instance.\n *\n * @example\n * ```ts\n * node.run(function() {\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 JJET instance.\n * @param args - Arguments to pass to the function.\n * @returns The return value of the function.\n */\n run<R, Args extends unknown[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R {\n return fn.call(this, ...args)\n }\n}\n","import { isA, isObj, isStr } from 'jty'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { JJET } from './JJET.js'\nimport { typeErr } from '../internal.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 */\n\nexport class JJN<T extends Node = Node> extends JJET<T> {\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 descendent), JJN (or its descendent)\n */\n static isWrappable(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 * JJN.ts overrides this method to a richer version that handles all subclasses of JJN.\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 if (isObj(raw)) {\n if (isA(raw, JJN)) {\n return raw\n }\n if (isA(raw, Node)) {\n return new JJN(raw)\n }\n }\n throw typeErr('raw', 'a Node', 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 */\n static unwrap(obj: Wrappable): Unwrapped {\n if (isStr(obj)) {\n return document.createTextNode(obj)\n }\n if (!isObj(obj)) {\n throw new TypeError(`JJN.unwrap() expects a string, DOM Node, or JJ wrapper. 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(\n `Could not unwrap ${obj} (${typeof obj}). ` +\n `Expected a string, Node, or JJ wrapper. ` +\n `Make sure you're passing a valid DOM element or JJ wrapper.`,\n )\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 /**\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(\n `JJN expects a Node instance. Got ${ref} (${typeof ref}). ` +\n `Use JJN.from(node) with a DOM Node, or check that you're passing a valid DOM element.`,\n )\n }\n super(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 * Creates a Text node from a string and appends it to this Node.\n *\n * @remarks\n * This method is overridden in JJT to append to the existing text content instead.\n *\n * @example\n * ```ts\n * el.addText('Hello ')\n * el.addText('World')\n * ```\n *\n * @param text - The text to add. If null or undefined, nothing is added.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode | document.createTextNode}\n */\n addText(...textArr: unknown[]): this {\n if (textArr) {\n this.ref.appendChild(document.createTextNode(textArr.join('')))\n }\n return this\n }\n}\n","import { JJN } from './JJN-raw.js'\nimport { Wrappable, Wrapped } from './types.js'\n\nexport abstract class JJNx<T extends Element | Document | DocumentFragment> extends JJN<T> {\n /**\n * Finds the first element matching a selector within this Element.\n *\n * @example\n * ```ts\n * const span = el.find('span') // Returns null if not found\n * const span = el.find('span', true) // Throws if not found\n * ```\n *\n * @param selector - The CSS selector.\n * @param required - Whether to throw an error if not found. Defaults to false.\n * @returns The wrapped element, or null if not found and required is false.\n * @throws {TypeError} If selector is not a string or element not found and required is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n find(selector: string, required = false): Wrapped | null {\n const queryResult = this.ref.querySelector(selector)\n if (queryResult) {\n return JJN.wrap(queryResult)\n }\n if (required) {\n throw new TypeError(`No element matched query \"${selector}\"`)\n }\n return null\n }\n\n /**\n * Finds all elements matching a selector within this Element.\n *\n * @example\n * ```ts\n * const items = el.findAll('li')\n * ```\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @throws {TypeError} If selector is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n */\n findAll(selector: string): Wrapped[] {\n return JJN.wrapAll(this.ref.querySelectorAll(selector))\n }\n\n /**\n * Appends children to this Element.\n *\n * @example\n * ```ts\n * el.addChild(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 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 */\n addChild(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.append(...nodes)\n return this\n }\n\n /**\n * Prepends children to this Element.\n *\n * @example\n * ```ts\n * el.preChild(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 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 preChild(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.prepend(...nodes)\n return this\n }\n\n /**\n * Maps an array to children and appends them.\n *\n * @example\n * ```ts\n * node.addChildMap(['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 addChildMap(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.addChild(...array.map(mapFn))\n }\n\n /**\n * Maps an array to children and prepends them.\n *\n * @example\n * ```ts\n * node.preChildMap(['a', 'b'], item => JJHE.create('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 preChildMap(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.preChild(...array.map(mapFn))\n }\n\n /**\n * Replaces the existing children of an Element with a specified new set of children.\n *\n * @remarks\n * If no children are provided, it empties the Element.\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @example\n * ```ts\n * el.setChildren(h('p', null, 'New Content'))\n * ```\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 */\n setChildren(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.replaceChildren(...nodes)\n return this\n }\n\n /**\n * Removes all children from this Element.\n *\n * @example\n * ```ts\n * el.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(): this {\n this.setChildren()\n return this\n }\n}\n","import { isA } from 'jty'\nimport { JJNx } from './JJNx.js'\nimport { typeErr } from '../internal.js'\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.addChild(\n * h('div', null, 'Item 1'),\n * h('div', null, 'Item 2'),\n * )\n * doc.body.addChild(frag)\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 JJNx<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 typeErr('ref', 'a DocumentFragment', ref)\n }\n super(ref)\n }\n}\n","import { isA } from 'jty'\nimport { JJDF } from './JJDF.js'\n\n/**\n * Wraps a DOM ShadowRoot (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 * ShadowRoot inherits DocumentFragment and therefore has access to all its methods\n * most importantly `find`, and `findAll` which come handy to access and\n * update its children.\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(\n `JJSR expects a ShadowRoot instance. Got ${shadowRoot} (${typeof shadowRoot}). ` +\n `Access a shadow root using element.shadowRoot after calling element.attachShadow().`,\n )\n }\n super(shadowRoot)\n }\n\n /**\n * Gets the inner HTML of the ShadowRoot.\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 ShadowRoot.\n *\n * @example\n * ```ts\n * shadow.setHTML('<p>Hello</p>', true)\n * ```\n *\n * @param html - The HTML string to set, or null/undefined to clear.\n * @param unsafe - explicit opt-in to set innerHTML. must be true if html is provided.\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 | null | undefined, unsafe?: boolean): this {\n if (html && unsafe !== true) {\n throw new Error(\n `Setting innerHTML is unsafe. Pass true as the second argument to confirm you know what you are doing.`,\n )\n }\n this.ref.innerHTML = html ?? ''\n return this\n }\n\n /**\n * Adds constructed stylesheets to the ShadowRoot.\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 { JJSR } from './JJSR.js'\nimport { ShadowConfig, Wrapped } from './types.js'\nimport { JJNx } from './JJNx.js'\nimport { typeErr } from '../internal.js'\nimport { JJN } from './JJN-raw.js'\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 JJNx<T> {\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(\n `JJE expects an Element instance. Got ${ref} (${typeof ref}). ` +\n `Use JJE.from(element) with a DOM Element, or use the specific wrapper (JJHE for HTMLElement, JJSE for SVGElement).`,\n )\n }\n super(ref)\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute | Element.getAttribute}\n */\n getAttr(name: string): string | null {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute | Element.hasAttribute}\n */\n hasAttr(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.hasAttribute(name)\n }\n\n /**\n * Sets one or more attributes on the Element.\n *\n * @example\n * ```ts\n * el.setAttr('id', 'my-id') // Single attribute\n * el.setAttr({ id: 'my-id', class: 'my-class' }) // Multiple attributes\n * el.setAttr('x', 50) // Numbers are automatically converted\n * ```\n *\n * @throws {TypeError} If arguments are invalid types.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}\n */\n setAttr(name: string, value: unknown): this\n setAttr(obj: Record<string, unknown>): this\n setAttr(nameOrObj: string | Record<string, unknown>, value?: unknown): this {\n if (typeof nameOrObj === 'string') {\n this.ref.setAttribute(nameOrObj, value as string)\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.setAttribute(k, v as string)\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more attributes from the Element.\n *\n * @example\n * ```ts\n * el.rmAttr('disabled') // Remove single\n * el.rmAttr('hidden', 'aria-hidden') // Remove multiple\n * ```\n *\n * @param names - The name(s) of the attribute(s) to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute | Element.removeAttribute}\n */\n rmAttr(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n getAria(name: string): string | null {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n */\n hasAria(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.hasAttribute(`aria-${name}`)\n }\n\n /**\n * Sets one or more ARIA attributes on the Element.\n *\n * @example\n * ```ts\n * el.setAria('hidden', 'true') // Single: sets aria-hidden=\"true\"\n * el.setAria({ label: 'Close', hidden: 'false' }) // Multiple\n * el.setAria('level', 2) // Numbers are automatically converted\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n setAria(name: string, value: unknown): this\n setAria(obj: Record<string, unknown>): this\n setAria(nameOrObj: string | Record<string, unknown>, value?: unknown): this {\n if (isStr(nameOrObj)) {\n this.ref.setAttribute(`aria-${nameOrObj}`, value as string)\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.setAttribute(`aria-${k}`, v as string)\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more ARIA attributes from the Element.\n *\n * @example\n * ```ts\n * el.rmAria('hidden') // Remove single\n * el.rmAria('label', 'hidden') // Remove multiple\n * ```\n *\n * @param names - The ARIA attribute suffix(es) to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n */\n rmAria(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n this.ref.removeAttribute(`aria-${name}`)\n }\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 or conditionally adds/removes classes.\n *\n * @remarks\n * - Pass a string to replace the entire class attribute\n * - Pass an object with class names as keys and boolean values to conditionally add/remove classes\n * - To remove all classes, pass an empty string: `setClass('')`\n *\n * @example\n * ```ts\n * el.setClass('btn btn-primary') // Set classes as string\n * el.setClass({ // Conditional classes (Vue.js style)\n * 'active': true, // adds 'active'\n * 'disabled': false, // removes 'disabled'\n * 'highlight': isHighlighted // adds/removes based on condition\n * })\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n */\n setClass(className: string): this\n setClass(classMap: Record<string, boolean | unknown>): this\n setClass(classNameOrMap: string | Record<string, boolean | unknown>): this {\n if (typeof classNameOrMap === 'string') {\n return this.setAttr('class', classNameOrMap)\n }\n // Conditional class object (Vue.js style)\n for (const [className, condition] of Object.entries(classNameOrMap)) {\n if (condition) {\n this.ref.classList.add(className)\n } else {\n this.ref.classList.remove(className)\n }\n }\n return this\n }\n\n /**\n * Adds one or more classes to the Element.\n *\n * @example\n * ```ts\n * el.addClass('btn', 'btn-primary')\n * ```\n *\n * @param classNames - The classes to add.\n * @returns This instance for chaining.\n * @throws {TypeError} If any class name is not a string.\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 for (const className of classNames) {\n if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\n }\n this.ref.classList.add(...classNames)\n return this\n }\n\n /**\n * Removes one or more classes from the Element.\n *\n * @example\n * ```ts\n * el.rmClass('active') // Remove single\n * el.rmClass('btn', 'btn-primary') // Remove multiple\n * ```\n *\n * @param classNames - The classes to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any class name is not a string.\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 rmClass(...classNames: string[]): this {\n for (const className of classNames) {\n if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\n }\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 * @throws {TypeError} If `className` is not a string.\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 if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\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 * @throws {TypeError} If `className` is not a string.\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 if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\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 * @throws {TypeError} If either className is not a string.\n */\n replaceClass(oldClassName: string, newClassName: string): this {\n if (!isStr(oldClassName)) {\n throw typeErr('oldClassName', 'a string', oldClassName)\n }\n if (!isStr(newClassName)) {\n throw typeErr('newClassName', 'a string', newClassName)\n }\n this.ref.classList.replace(oldClassName, newClassName)\n return this\n }\n\n /**\n * Finds the closest ancestor (or self) that matches a CSS selector.\n *\n * @remarks\n * Returns `null` when no matching ancestor is found.\n *\n * @example\n * ```ts\n * const button = JJE.from(document.querySelector('button'))\n * const card = button.closest('.card')\n * if (card) {\n * card.addClass('has-action')\n * }\n * ```\n *\n * @param selector - The CSS selector to search for.\n * @returns A JJE wrapping the closest match, or null when none exists.\n * @throws {TypeError} If `selector` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest | Element.closest}\n */\n closest(selector: string): Wrapped | null {\n if (!isStr(selector)) {\n throw typeErr('selector', 'a string', selector)\n }\n const match = this.ref.closest(selector)\n return match ? JJN.wrap(match) : null\n }\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.rmAttr('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.rmAttr('disabled', 'aria-disabled')\n }\n\n /**\n * Gets the inner HTML of the Element.\n *\n * @remarks\n * This method operates on `innerHTML`. The method name is kept short for convenience.\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 * @remarks\n * This method operates on `innerHTML`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n *\n * @param html - The HTML string to set, or null/undefined to clear.\n * @param unsafe - explicit opt-in to set innerHTML. must be true if html is provided.\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 | null | undefined, unsafe?: boolean): this {\n if (html && unsafe !== true) {\n throw new Error(\n `Setting innerHTML is unsafe. Pass true as the second argument to confirm you know what you are doing.`,\n )\n }\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 if (isStr(template)) {\n shadowRoot.innerHTML = template\n } else {\n shadowRoot.appendChild(template)\n }\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, isObj, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { typeErr } from '../internal.js'\n\nexport abstract class JJEx<T extends HTMLElement | SVGElement> extends JJE<T> {\n /**\n * Gets a data attribute from the HTMLElement.\n *\n * @example\n * ```ts\n * const value = el.getData('my-key')\n * ```\n *\n * @param name - The data attribute name (in camelCase).\n * @returns The value of the attribute, or undefined if not set.\n * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n getData(name: string): string | undefined {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.dataset[name]\n }\n\n /**\n * Checks if a data attribute exists on the HTMLElement.\n *\n * @example\n * ```ts\n * if (el.hasData('my-key')) {\n * // ...\n * }\n * ```\n *\n * @param name - The data attribute name (in camelCase).\n * @returns True if the attribute exists, false otherwise.\n * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n hasData(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return hasProp(this.ref.dataset, name)\n }\n\n /**\n * Sets one or more data attributes on the HTMLElement.\n *\n * @example\n * ```ts\n * el.setData('myKey', 'myValue') // Single\n * el.setData({ myKey: 'myValue', otherKey: 'otherValue' }) // Multiple\n * el.setData('count', 42) // Numbers are automatically converted to strings\n * ```\n *\n * @throws {TypeError} If arguments are invalid types.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n setData(name: string, value?: string): this\n setData(obj: Record<string, string | undefined>): this\n setData(nameOrObj: string | Record<string, string | undefined>, value?: string): this {\n if (typeof nameOrObj === 'string') {\n this.ref.dataset[nameOrObj] = value\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.dataset[k] = v\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more data attributes from the HTMLElement.\n *\n * @example\n * ```ts\n * el.rmData('myKey') // Remove single\n * el.rmData('myKey', 'otherKey') // Remove multiple\n * ```\n *\n * @param names - The data attribute name(s) (in camelCase).\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n rmData(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n delete this.ref.dataset[name]\n }\n return this\n }\n}\n","import { hasProp, isA, isStr } from 'jty'\nimport { JJEx } from './JJEx.js'\nimport { typeErr } from '../internal.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 JJEx<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')) // from an existing HTMLElement\n * const el = JJHE.from(new document.createElement('div')) // from a new HTMLElement\n * ```\n *\n * @param ref - The HTMLElement.\n * @returns A new JJHE instance.\n */\n static from<T extends HTMLElement>(ref: T): JJHE<T> {\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.create('div')\n * const input = JJHE.create('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 create<K extends keyof HTMLElementTagNameMap>(\n tagName: K,\n options?: ElementCreationOptions,\n ): JJHE<HTMLElementTagNameMap[K]>\n static create(tagName: string, options?: ElementCreationOptions): JJHE\n static create(tagName: string, options?: ElementCreationOptions): JJHE {\n if (!isStr(tagName)) {\n throw typeErr('tagName', \"a string like 'div' or 'button'\", 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 typeErr('ref', 'an HTMLElement', ref)\n }\n super(ref)\n }\n\n /**\n * Gets the value property of the HTMLElement (e.g. for inputs).\n *\n * @returns The value.\n * @throws {Error} If the HTMLElement 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 ReferenceError(`${this.ref.tagName} has no value property.`)\n }\n return this.ref.value\n }\n\n /**\n * Sets the value property of the HTMLElement.\n *\n * @example\n * ```ts\n * input.setValue('new value')\n * input.setValue(42) // Numbers are automatically converted\n * ```\n *\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @throws {Error} If the HTMLElement 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: unknown): this {\n if (!hasProp(this.ref, 'value')) {\n throw new ReferenceError(`${this.ref.tagName} has no value property.`)\n }\n this.ref.value = value\n return this\n }\n\n /**\n * Focuses the HTMLElement.\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 HTMLElement.\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 HTMLElement.\n *\n * @remarks\n * This method operates on `innerText`. The method name is kept short for convenience.\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 HTMLElement.\n *\n * @remarks\n * This method operates on `innerText`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n * Numbers and booleans are automatically converted to strings.\n *\n * @param text - The text to set, or null/undefined to clear.\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?: unknown): this {\n this.ref.innerText = text as string\n return this\n }\n}\n","import { isA } from 'jty'\nimport { JJN } from './JJN-raw.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 text = 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 return new JJT(text)\n }\n\n static fromStr(text: string): JJT {\n return new JJT(document.createTextNode(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) {\n if (!isA(ref, Text)) {\n throw new TypeError(\n `JJT expects a Text node. Got ${ref} (${typeof ref}). ` +\n `Create a Text node with JJT.fromStr() or document.createTextNode('text').`,\n )\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the Text node.\n *\n * @example\n * ```ts\n * const content = text.getText()\n * ```\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 Text node.\n *\n * @example\n * ```ts\n * text.setText('New content')\n * ```\n *\n * @param text - The text to set. Set it to null or undefined to remove all text\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?: unknown): this {\n this.ref.textContent = text as string | null\n return this\n }\n\n /**\n * Appends text to the existing content.\n *\n * @example\n * ```ts\n * text.setText('hello')\n * text.addText(' world')\n * console.log(text.getText()) // 'hello world'\n * ```\n *\n * @param textArr - The string to add to the existing contents. If null or undefined, nothing is added.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n addText(...textArr: unknown[]): this {\n this.setText(this.getText() + textArr.join(''))\n return this\n }\n\n /**\n * Clears the text content of the Text node.\n *\n * @example\n * ```ts\n * text.empty()\n * ```\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","import { isA } from 'jty'\nimport { JJNx } from './JJNx.js'\nimport { JJHE } from './JJHE.js'\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 (`find`) and manipulation (`addChild`, `preChild`) methods.\n *\n * To find elements by class name, use: `doc.find('.my-class')`\n *\n * To set the document title, use: `doc.ref.title = 'New Title'`\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * doc.on('DOMContentLoaded', () => console.log('Ready'))\n * doc.ref.title = 'My Page Title' // Set document title\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 JJNx<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(`JJD expects a Document instance. 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 JJHE.from(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 JJHE.from(this.ref.body)\n }\n}\n","import { isA, isStr } from 'jty'\nimport { JJEx } from './JJEx.js'\nimport { typeErr } from '../internal.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 JJEx<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.create('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 create(tagName: string, options?: ElementCreationOptions): JJSE {\n if (!isStr(tagName)) {\n throw typeErr('tagName', 'a string like \"circle\" or \"path\"', 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 typeErr('ref', 'an SVGElement', ref)\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the SVGElement.\n *\n * @remarks\n * This method operates on `textContent`. The method name is kept short for convenience.\n *\n * @example\n * ```ts\n * const text = svg.getText()\n * ```\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 SVGElement.\n *\n * @remarks\n * This method operates on `textContent`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n * Numbers and booleans are automatically converted to strings.\n *\n * @example\n * ```ts\n * svg.setText('Hello SVG')\n * svg.setText(null) // Clear content\n * svg.setText(42) // Numbers are converted\n * ```\n *\n * @param text - The text to set, or null/undefined to clear.\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?: unknown): this {\n this.ref.textContent = text as string | null\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","import { isA, isObj, isStr } from 'jty'\nimport { typeErr } from '../internal.js'\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-raw.js'\nimport { JJD } from './JJD.js'\nimport { JJSE } from './JJSE.js'\nimport { Wrappable, Wrapped } from './types.js'\n\nJJN.wrap = function wrap(raw: Wrappable): Wrapped {\n if (isStr(raw)) {\n return JJT.fromStr(raw)\n }\n if (!isObj(raw)) {\n throw typeErr('raw', 'an object', 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 typeErr('raw', 'a Node', raw)\n}\n\nexport { JJN }\n","import { isA, isStr } from 'jty'\nimport { Wrappable, JJHE } from './wrappers/index.js'\nimport { cssToStyle, fileExt } from './util.js'\nimport { typeErr, errMsg } from './internal.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.create(tagName).addChild(...children)\n if (attributes) {\n ret.setAttr(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 href - The URL of the resource.\n * @param rel - The relationship of the linked resource ('prefetch' or 'preload').\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 href: string | URL,\n rel: 'prefetch' | 'preload',\n as?: 'fetch' | 'style' | 'script',\n): JJHE {\n if (!isStr(href)) {\n if (!isA(href, URL)) {\n throw typeErr('href', 'a string or URL', href)\n }\n href = href.toString()\n }\n\n if (!['prefetch', 'preload'].includes(rel)) {\n throw new RangeError(errMsg('rel', `'prefetch' or 'preload'`, rel))\n }\n\n if (!as) {\n as = linkAs(href)\n if (!as) {\n throw new Error(`Could not guess 'as' attribute from URL: ${href}`)\n }\n }\n\n if (!['fetch', 'style', 'script'].includes(as)) {\n throw new RangeError(errMsg('as', `'fetch', 'style', or 'script'`, as))\n }\n\n return JJHE.create('link').setAttr({\n href,\n rel,\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 * @param args - The arguments to be passed to {@link createLinkPre}.\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 typeErr('mime', 'a string', 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, isFn, isStr } from 'jty'\nimport { typeErr } from './internal.js'\nimport { keb2cam } from './case.js'\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.find('#user').setText(this.userName)\n shadow.find('#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: unknown, newValue: unknown) {\n if (!isA(instance, HTMLElement)) {\n throw typeErr('instance', 'an HTMLElement', instance)\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 typeErr('name', 'a string', name)\n }\n if (!isFn(constructor)) {\n throw typeErr('constructor', 'a function', constructor)\n }\n if (!customElements.get(name)) {\n customElements.define(name, constructor, options)\n await customElements.whenDefined(name)\n }\n}\n","import { isA, isArr, isFn, isStr } from 'jty'\nimport { JJStyleConfig, JJTemplateConfig, ShadowConfig, JJHE, JJDF } from './wrappers/index.js'\nimport { cssToStyle } from './util.js'\nimport { typeErr } from './internal.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 * @remarks\n * If at some point it ends up with a JJHE instance or HTMLElement, a specific logic is applied..\n * If it is <TEMPLATE>, its `content` (DocumentFragment) will be used, otherwise its `outerHTML` will be used.\n *\n * @param templateConfig - The template configuration to resolve.\n * @returns A promise resolving to the HTML string, DocumentFragment, or undefined.\n * @throws {TypeError} If the resolved value is not a string, JJHE, JJDF, HTMLElement, or DocumentFragment.\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 (templateConfig === undefined) {\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, JJDF)) {\n return templateConfig.ref.cloneNode(true) as DocumentFragment\n }\n if (isA(templateConfig, DocumentFragment)) {\n return templateConfig.cloneNode(true) as DocumentFragment\n }\n if (isA(templateConfig, JJHE)) {\n // If it's a <template> wrapper, return a clone of its content (DocumentFragment)\n if (templateConfig.ref instanceof HTMLTemplateElement) {\n return templateConfig.ref.content.cloneNode(true) as DocumentFragment\n }\n return templateConfig.ref.outerHTML\n }\n if (isA(templateConfig, HTMLElement)) {\n return templateConfig instanceof HTMLTemplateElement\n ? (templateConfig.content.cloneNode(true) as DocumentFragment)\n : templateConfig.outerHTML\n }\n\n throw typeErr('template', 'a string, JJHE, JJDF, HTMLElement, or DocumentFragment', 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 style 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 typeErr('style', 'a CSS string or CSSStyleSheet', 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","export * from './util.js'\nexport * from './case.js'\nexport * from './wrappers/index.js'\nexport * from './helpers.js'\nexport * from './components.js'\nexport * from './ShadowMaster.js'\n\nimport { JJD } from './wrappers/JJD.js'\n\n/**\n * A wrapped document for convenience.\n * It can be used instead of document\n *\n * @example\n * ```ts\n * import { doc } from 'jj'\n * const el = doc.find('#my-element') // A JJHE instance\n * const body = doc.body // A JJHE instance\n * doc.addChild(JJHE.create('script').setAttr('src', 'my-code.js'))\n * doc.head.addChild(JJHE.create('link').setAttr({\n * rel: 'stylesheet',\n * href: 'code.css'\n * }))\n * ```\n */\nexport const doc = JJD.from(document)\n"],"mappings":"yXAuBM,SAAUA,EAASC,EAAgB,CACrC,OAAOA,IAAM,MACjB,CAkEM,SAAUC,EAAyBC,EAAU,CAC/C,OAAO,OAAOA,GAAM,UACxB,CC3F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nH,GAAM,CAACG,EAAU,GAAGC,CAAM,EAAI,MAAM,QAAQ,IAAI,CAAChB,GAAgBC,CAAc,EAAG,GAAGU,GAAcC,CAAY,CAAC,CAAC,EACjH,MAAO,CAAE,SAAAG,EAAU,OAAAC,CAAO,CAC9B,CA1GA,IAAAC,EAAAC,EAAAC,EAgIaC,EAAN,MAAMA,CAAa,CActB,aAAc,CAbdC,EAAA,KAAAJ,GACAI,EAAA,KAAAH,EAAiC,CAAC,GAClCG,EAAA,KAAAF,EAWe,CAJf,OAAO,QAAS,CACZ,OAAO,IAAIC,CACf,CAgBA,YAAYnB,EAAyC,CACjD,OAAAqB,EAAA,KAAKL,EAAkBhB,GAChB,IACX,CAiBA,aAAasB,EAAqC,CAC9C,OAAAC,EAAA,KAAKN,GAAc,KAAK,GAAGK,CAAY,EAChC,IACX,CAWA,MAAM,aAAqC,CACvC,OAAKC,EAAA,KAAKL,IACNG,EAAA,KAAKH,EAAoBL,GAAcU,EAAA,KAAKP,GAAiBO,EAAA,KAAKN,EAAa,GAE5E,MAAMM,EAAA,KAAKL,EACtB,CACJ,EAnEIF,EAAA,YACAC,EAAA,YACAC,EAAA,YAHG,IAAMM,EAANL,ECvGA,IAAMM,GAAMC,EAAI,KAAK,QAAQ","names":["isDef","x","isFn","x","isNaN","isFinite","isInteger","isNum","x","inRange","x","min","max","isNum","isDef","isArray","isArr","x","minLen","maxLen","inRange","hasOwnProperty","isObj","x","isA","classConstructor","isFn","hasProp","x","propNames","isObj","propName","isStr","x","hasOwnProperty","isArray","errMsg","varName","expected","received","typeErr","fileExt","path","isStr","typeErr","lastDotIndex","ext","nextAnimationFrame","resolve","sleep","ms","cssToStyle","css","pas2keb","str","isStr","typeErr","errMsg","keb2pas","word","keb2cam","g","c","_ref","_boundHandlers","_JJET_instances","getBoundHandler_fn","_JJET","ref","__privateAdd","isA","__privateSet","__privateGet","eventName","handler","options","boundHandler","__privateMethod","event","fn","args","bound","JJET","JJN","_JJN","JJET","node","x","isStr","isA","raw","isObj","typeErr","obj","iterable","ref","deep","textArr","JJNx","JJN","selector","required","queryResult","children","nodes","array","mapFn","JJDF","_JJDF","JJNx","ref","isA","typeErr","JJSR","_JJSR","JJDF","shadowRoot","isA","html","unsafe","styleSheets","JJE","_JJE","JJNx","ref","isA","name","isStr","typeErr","nameOrObj","value","isObj","k","v","names","classNameOrMap","className","condition","classNames","oldClassName","newClassName","selector","match","JJN","html","unsafe","mode","config","shadowRoot","template","styles","isArr","JJSR","JJEx","JJE","name","isStr","typeErr","hasProp","nameOrObj","value","isObj","k","v","names","JJHE","_JJHE","JJEx","ref","tagName","options","isStr","typeErr","isA","hasProp","value","text","JJT","_JJT","JJN","text","ref","isA","textArr","JJD","_JJD","JJNx","ref","isA","JJHE","SVG_NAMESPACE_URI","JJSE","_JJSE","JJEx","ref","tagName","options","isStr","typeErr","element","isA","text","value","p1","p2","p3","p4","JJN","raw","isStr","JJT","isObj","typeErr","isA","JJHE","JJSE","JJE","JJSR","JJDF","JJD","h","tagName","attributes","children","ret","JJHE","linkAs","href","fileExt","createLinkPre","rel","as","isStr","isA","typeErr","errMsg","addLinkPre","args","link","fetchText","url","mime","response","fetchHtml","fetchCss","fetchStyle","cssToStyle","attr2prop","instance","name","oldValue","newValue","isA","typeErr","propName","keb2cam","hasProp","registerComponent","constructor","options","isStr","isFn","templatePromise","templateConfig","isFn","isStr","isA","JJDF","JJHE","typeErr","stylePromise","styleConfig","cssToStyle","stylePromises","styleConfigs","isArr","resolveConfig","template","styles","_templateConfig","_stylesConfig","_normalizedConfig","_ShadowMaster","__privateAdd","__privateSet","stylesConfig","__privateGet","ShadowMaster","doc","JJD"]}
|
|
1
|
+
{"version":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/internal.ts","../src/util.ts","../src/case.ts","../src/wrappers/JJET.ts","../src/wrappers/JJN-raw.ts","../src/wrappers/JJNx.ts","../src/wrappers/JJDF.ts","../src/wrappers/JJSR.ts","../src/wrappers/JJE.ts","../src/wrappers/JJEx.ts","../src/wrappers/JJHE.ts","../src/wrappers/JJT.ts","../src/wrappers/JJD.ts","../src/wrappers/JJSE.ts","../src/wrappers/JJN.ts","../src/helpers.ts","../src/components.ts","../src/ShadowMaster.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/**\n * Internal utilities for the JJ library.\n * These are not part of the public API.\n */\n\n/**\n * Creates a gzip-friendly error message by concatenating strings.\n * This avoids repeating common error message patterns that compress well.\n *\n * @remarks\n * Uses backtick strings to take advantage of gzip compression across the codebase.\n * Common patterns like `Expected 'x' to be ...` compress very efficiently.\n *\n * @internal\n * @param varName - The name of the variable\n * @param expected - Description of expected type\n * @param received - The actual value received\n * @returns Error message string\n */\nexport function errMsg(varName: string, expected: unknown, received: unknown): string {\n return `Expected '${varName}' to be ${expected}. Got ${received} (${typeof received})`\n}\n\n/**\n * Creates a TypeError with a standardized error message.\n * Convenience wrapper around errMsg for type errors.\n *\n * @internal\n * @param varName - The name of the variable\n * @param expected - Description of expected type\n * @param received - The actual value received\n * @returns A TypeError ready to be thrown\n */\nexport function typeErr(varName: string, expected: unknown, received: unknown): TypeError {\n return new TypeError(errMsg(varName, expected, received))\n}\n","import { isStr } from 'jty'\nimport { typeErr } from './internal.js'\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 typeErr('path', 'a string', 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 * 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'\nimport { errMsg, typeErr } from './internal.js'\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 typeErr('str', 'a string', str)\n }\n if (/[^a-zA-Z0-9_]/.test(str)) {\n throw new SyntaxError(errMsg('str', 'alphanumeric characters and underscores', 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 typeErr('str', 'a string', 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 typeErr('str', 'a string', 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'\n\n/**\n * Wraps a DOM EventTarget.\n *\n * @remarks\n * This is the base class for all JJ wrappers that wrap an EventTarget.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | EventTarget}\n */\nexport class JJET<T extends EventTarget = EventTarget> {\n static from(ref: EventTarget) {\n return new JJET(ref)\n }\n\n #ref!: T\n #boundHandlers = new WeakMap<EventListenerOrEventListenerObject, EventListenerOrEventListenerObject>()\n\n /**\n * Creates a JJET instance.\n *\n * @param ref - The EventTarget to wrap.\n * @throws {TypeError} If `ref` is not an EventTarget.\n */\n constructor(ref: T) {\n if (!isA(ref, EventTarget)) {\n throw new TypeError(`JJET expects an EventTarget instance. Got ${ref} (${typeof ref}). `)\n }\n this.#ref = ref\n }\n\n /**\n * Gets the underlying DOM object.\n */\n get ref() {\n return this.#ref\n }\n\n /**\n * Gets or creates a bound version of the handler.\n *\n * @remarks\n * Bound handlers are cached in a WeakMap to ensure `off()` can properly remove listeners.\n * When the original handler is garbage collected, the bound version is automatically removed.\n *\n * @param handler - The event handler to bind.\n * @returns The bound handler, or null if the input is null.\n */\n #getBoundHandler(handler: EventListenerOrEventListenerObject | null): EventListenerOrEventListenerObject | null {\n if (handler === null) return null\n\n let bound = this.#boundHandlers.get(handler)\n if (!bound) {\n // Bind the handler to this JJET instance\n if (typeof handler === 'function') {\n bound = handler.bind(this)\n } else {\n // EventListenerObject with handleEvent method\n bound = { handleEvent: handler.handleEvent.bind(this) }\n }\n this.#boundHandlers.set(handler, bound)\n }\n return bound\n }\n\n /**\n * Adds an event listener.\n *\n * @remarks\n * The handler is automatically bound to this JJET instance, so `this` inside the handler\n * refers to the JJET instance, not the DOM element. To access the DOM element, use `this.ref`.\n *\n * @example\n * ```ts\n * JJET.from(window).on('resize', function() {\n * console.log(this) // JJET instance\n * console.log(this.ref) // window object\n * })\n * ```\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @param options - Optional event listener options.\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 | null, options?: AddEventListenerOptions): this {\n const boundHandler = this.#getBoundHandler(handler)\n this.ref.addEventListener(eventName, boundHandler, options)\n return this\n }\n\n /**\n * Removes an event listener.\n *\n * @remarks\n * Pass the same handler reference that was used in `on()` to properly remove the listener.\n *\n * @example\n * ```ts\n * const handler = function() { console.log(this) }\n * JJET.from(window).on('resize', handler)\n * JJET.from(window).off('resize', handler)\n * ```\n * @param eventName - The name of the event.\n * @param handler - The event handler.\n * @param options - Optional event listener options or boolean.\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(\n eventName: string,\n handler: EventListenerOrEventListenerObject | null,\n options?: EventListenerOptions | boolean,\n ): this {\n const boundHandler = this.#getBoundHandler(handler)\n this.ref.removeEventListener(eventName, boundHandler, options)\n return this\n }\n\n /**\n * Dispatches an Event at the specified EventTarget.\n *\n * @param event - The Event object to dispatch.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent | EventTarget.dispatchEvent}\n */\n trigger(event: Event): this {\n this.ref.dispatchEvent(event)\n return this\n }\n\n /**\n * Runs a function in the context of this JJET instance.\n *\n * @example\n * ```ts\n * node.run(function() {\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 JJET instance.\n * @param args - Arguments to pass to the function.\n * @returns The return value of the function.\n */\n run<R, Args extends unknown[]>(fn: (this: this, ...args: Args) => R, ...args: Args): R {\n return fn.call(this, ...args)\n }\n}\n","import { isA, isObj, isStr } from 'jty'\nimport { Unwrapped, Wrappable, Wrapped } from './types.js'\nimport { JJET } from './JJET.js'\nimport { typeErr } from '../internal.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 */\n\nexport class JJN<T extends Node = Node> extends JJET<T> {\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 descendent), JJN (or its descendent)\n */\n static isWrappable(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 * JJN.ts overrides this method to a richer version that handles all subclasses of JJN.\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 if (isObj(raw)) {\n if (isA(raw, JJN)) {\n return raw\n }\n if (isA(raw, Node)) {\n return new JJN(raw)\n }\n }\n throw typeErr('raw', 'a Node', 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 */\n static unwrap(obj: Wrappable): Unwrapped {\n if (isStr(obj)) {\n return document.createTextNode(obj)\n }\n if (!isObj(obj)) {\n throw new TypeError(`JJN.unwrap() expects a string, DOM Node, or JJ wrapper. 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(\n `Could not unwrap ${obj} (${typeof obj}). ` +\n `Expected a string, Node, or JJ wrapper. ` +\n `Make sure you're passing a valid DOM element or JJ wrapper.`,\n )\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 /**\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(\n `JJN expects a Node instance. Got ${ref} (${typeof ref}). ` +\n `Use JJN.from(node) with a DOM Node, or check that you're passing a valid DOM element.`,\n )\n }\n super(ref)\n }\n\n /**\n * Gets the parent node wrapped in the most specific JJ wrapper available.\n *\n * @remarks\n * Returns `null` when this node is detached and therefore has no parent.\n *\n * @example\n * ```ts\n * const text = JJT.fromStr('hello')\n * JJHE.create('div').addChild(text)\n * const parent = text.parent // JJHE\n * ```\n *\n * @returns The wrapped parent node, or `null` if this node has no parent.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode | Node.parentNode}\n */\n get parent(): Wrapped | null {\n const { parentNode } = this.ref\n return parentNode ? JJN.wrap(parentNode) : null\n }\n\n /**\n * Gets the child nodes wrapped in the most specific JJ wrappers available.\n *\n * @remarks\n * Returns an empty array when this node has no children.\n *\n * @example\n * ```ts\n * const el = JJHE.create('div').addChild('hello', JJHE.create('span'))\n * const children = el.children // [JJT, JJHE]\n * ```\n *\n * @returns The wrapped child nodes.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes | Node.childNodes}\n */\n get children(): Wrapped[] {\n return JJN.wrapAll(this.ref.childNodes)\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 * Removes this node from its parent.\n *\n * @remarks\n * If the node has no parent, this method does nothing.\n *\n * @example\n * ```ts\n * const el = JJHE.create('div')\n * doc.body.addChild(el)\n * el.rm()\n * ```\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(): this {\n const { parentNode } = this.ref\n if (parentNode) {\n parentNode.removeChild(this.ref)\n }\n return this\n }\n\n /**\n * Creates a Text node from a string and appends it to this Node.\n *\n * @remarks\n * This method is overridden in JJT to append to the existing text content instead.\n *\n * @example\n * ```ts\n * el.addText('Hello ')\n * el.addText('World')\n * ```\n *\n * @param text - The text to add. If null or undefined, nothing is added.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode | document.createTextNode}\n */\n addText(...textArr: unknown[]): this {\n if (textArr) {\n this.ref.appendChild(document.createTextNode(textArr.join('')))\n }\n return this\n }\n}\n","import { JJN } from './JJN-raw.js'\nimport { Wrappable, Wrapped } from './types.js'\n\nexport abstract class JJNx<T extends Element | Document | DocumentFragment> extends JJN<T> {\n /**\n * Finds the first element matching a selector within this Element.\n *\n * @example\n * ```ts\n * const span = el.find('span') // Returns null if not found\n * const span = el.find('span', true) // Throws if not found\n * ```\n *\n * @param selector - The CSS selector.\n * @param required - Whether to throw an error if not found. Defaults to false.\n * @returns The wrapped element, or null if not found and required is false.\n * @throws {TypeError} If selector is not a string or element not found and required is true.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector | Element.querySelector}\n */\n find(selector: string, required = false): Wrapped | null {\n const queryResult = this.ref.querySelector(selector)\n if (queryResult) {\n return JJN.wrap(queryResult)\n }\n if (required) {\n throw new TypeError(`No element matched query \"${selector}\"`)\n }\n return null\n }\n\n /**\n * Finds all elements matching a selector within this Element.\n *\n * @example\n * ```ts\n * const items = el.findAll('li')\n * ```\n *\n * @param selector - The CSS selector.\n * @returns An array of wrapped elements.\n * @throws {TypeError} If selector is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll | Element.querySelectorAll}\n */\n findAll(selector: string): Wrapped[] {\n return JJN.wrapAll(this.ref.querySelectorAll(selector))\n }\n\n /**\n * Appends children to this Element.\n *\n * @example\n * ```ts\n * el.addChild(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 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 */\n addChild(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.append(...nodes)\n return this\n }\n\n /**\n * Prepends children to this Element.\n *\n * @example\n * ```ts\n * el.preChild(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 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 preChild(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.prepend(...nodes)\n return this\n }\n\n /**\n * Maps an array to children and appends them.\n *\n * @example\n * ```ts\n * node.addChildMap(['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 addChildMap(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.addChild(...array.map(mapFn))\n }\n\n /**\n * Maps an array to children and prepends them.\n *\n * @example\n * ```ts\n * node.preChildMap(['a', 'b'], item => JJHE.create('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 preChildMap(array: Wrappable[], mapFn: (item: Wrappable) => Wrappable) {\n return this.preChild(...array.map(mapFn))\n }\n\n /**\n * Replaces the existing children of an Element with a specified new set of children.\n *\n * @remarks\n * If no children are provided, it empties the Element.\n * To make template codes easier, this function ignores any child that is not possible to `wrap()` (e.g. undefined, null, false).\n *\n * @example\n * ```ts\n * el.setChildren(h('p', null, 'New Content'))\n * ```\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 */\n setChildren(...children: Wrappable[]): this {\n const nodes = JJN.unwrapAll(children.filter(JJN.isWrappable))\n this.ref.replaceChildren(...nodes)\n return this\n }\n\n /**\n * Removes all children from this Element.\n *\n * @example\n * ```ts\n * el.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(): this {\n this.setChildren()\n return this\n }\n}\n","import { isA } from 'jty'\nimport { JJNx } from './JJNx.js'\nimport { typeErr } from '../internal.js'\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.addChild(\n * h('div', null, 'Item 1'),\n * h('div', null, 'Item 2'),\n * )\n * doc.body.addChild(frag)\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 JJNx<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 typeErr('ref', 'a DocumentFragment', ref)\n }\n super(ref)\n }\n}\n","import { isA } from 'jty'\nimport { JJDF } from './JJDF.js'\n\n/**\n * Wraps a DOM ShadowRoot (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 * ShadowRoot inherits DocumentFragment and therefore has access to all its methods\n * most importantly `find`, and `findAll` which come handy to access and\n * update its children.\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(\n `JJSR expects a ShadowRoot instance. Got ${shadowRoot} (${typeof shadowRoot}). ` +\n `Access a shadow root using element.shadowRoot after calling element.attachShadow().`,\n )\n }\n super(shadowRoot)\n }\n\n /**\n * Gets the inner HTML of the ShadowRoot.\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 ShadowRoot.\n *\n * @example\n * ```ts\n * shadow.setHTML('<p>Hello</p>', true)\n * ```\n *\n * @param html - The HTML string to set, or null/undefined to clear.\n * @param unsafe - explicit opt-in to set innerHTML. must be true if html is provided.\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 | null | undefined, unsafe?: boolean): this {\n if (html && unsafe !== true) {\n throw new Error(\n `Setting innerHTML is unsafe. Pass true as the second argument to confirm you know what you are doing.`,\n )\n }\n this.ref.innerHTML = html ?? ''\n return this\n }\n\n /**\n * Adds constructed stylesheets to the ShadowRoot.\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 { JJSR } from './JJSR.js'\nimport { ShadowConfig, Wrapped } from './types.js'\nimport { JJNx } from './JJNx.js'\nimport { typeErr } from '../internal.js'\nimport { JJN } from './JJN-raw.js'\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 JJNx<T> {\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(\n `JJE expects an Element instance. Got ${ref} (${typeof ref}). ` +\n `Use JJE.from(element) with a DOM Element, or use the specific wrapper (JJHE for HTMLElement, JJSE for SVGElement).`,\n )\n }\n super(ref)\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute | Element.getAttribute}\n */\n getAttr(name: string): string | null {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute | Element.hasAttribute}\n */\n hasAttr(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.hasAttribute(name)\n }\n\n /**\n * Sets one or more attributes on the Element.\n *\n * @example\n * ```ts\n * el.setAttr('id', 'my-id') // Single attribute\n * el.setAttr({ id: 'my-id', class: 'my-class' }) // Multiple attributes\n * el.setAttr('x', 50) // Numbers are automatically converted\n * ```\n *\n * @throws {TypeError} If arguments are invalid types.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}\n */\n setAttr(name: string, value: unknown): this\n setAttr(obj: Record<string, unknown>): this\n setAttr(nameOrObj: string | Record<string, unknown>, value?: unknown): this {\n if (typeof nameOrObj === 'string') {\n this.ref.setAttribute(nameOrObj, value as string)\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.setAttribute(k, v as string)\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more attributes from the Element.\n *\n * @example\n * ```ts\n * el.rmAttr('disabled') // Remove single\n * el.rmAttr('hidden', 'aria-hidden') // Remove multiple\n * ```\n *\n * @param names - The name(s) of the attribute(s) to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute | Element.removeAttribute}\n */\n rmAttr(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n getAria(name: string): string | null {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\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 * @throws {TypeError} If `name` is not a string.\n */\n hasAria(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.hasAttribute(`aria-${name}`)\n }\n\n /**\n * Sets one or more ARIA attributes on the Element.\n *\n * @example\n * ```ts\n * el.setAria('hidden', 'true') // Single: sets aria-hidden=\"true\"\n * el.setAria({ label: 'Close', hidden: 'false' }) // Multiple\n * el.setAria('level', 2) // Numbers are automatically converted\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}\n */\n setAria(name: string, value: unknown): this\n setAria(obj: Record<string, unknown>): this\n setAria(nameOrObj: string | Record<string, unknown>, value?: unknown): this {\n if (isStr(nameOrObj)) {\n this.ref.setAttribute(`aria-${nameOrObj}`, value as string)\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.setAttribute(`aria-${k}`, v as string)\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more ARIA attributes from the Element.\n *\n * @example\n * ```ts\n * el.rmAria('hidden') // Remove single\n * el.rmAria('label', 'hidden') // Remove multiple\n * ```\n *\n * @param names - The ARIA attribute suffix(es) to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n */\n rmAria(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n this.ref.removeAttribute(`aria-${name}`)\n }\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 or conditionally adds/removes classes.\n *\n * @remarks\n * - Pass a string to replace the entire class attribute\n * - Pass an object with class names as keys and boolean values to conditionally add/remove classes\n * - To remove all classes, pass an empty string: `setClass('')`\n *\n * @example\n * ```ts\n * el.setClass('btn btn-primary') // Set classes as string\n * el.setClass({ // Conditional classes (Vue.js style)\n * 'active': true, // adds 'active'\n * 'disabled': false, // removes 'disabled'\n * 'highlight': isHighlighted // adds/removes based on condition\n * })\n * ```\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}\n */\n setClass(className: string): this\n setClass(classMap: Record<string, boolean | unknown>): this\n setClass(classNameOrMap: string | Record<string, boolean | unknown>): this {\n if (typeof classNameOrMap === 'string') {\n return this.setAttr('class', classNameOrMap)\n }\n // Conditional class object (Vue.js style)\n for (const [className, condition] of Object.entries(classNameOrMap)) {\n if (condition) {\n this.ref.classList.add(className)\n } else {\n this.ref.classList.remove(className)\n }\n }\n return this\n }\n\n /**\n * Adds one or more classes to the Element.\n *\n * @example\n * ```ts\n * el.addClass('btn', 'btn-primary')\n * ```\n *\n * @param classNames - The classes to add.\n * @returns This instance for chaining.\n * @throws {TypeError} If any class name is not a string.\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 for (const className of classNames) {\n if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\n }\n this.ref.classList.add(...classNames)\n return this\n }\n\n /**\n * Removes one or more classes from the Element.\n *\n * @example\n * ```ts\n * el.rmClass('active') // Remove single\n * el.rmClass('btn', 'btn-primary') // Remove multiple\n * ```\n *\n * @param classNames - The classes to remove.\n * @returns This instance for chaining.\n * @throws {TypeError} If any class name is not a string.\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 rmClass(...classNames: string[]): this {\n for (const className of classNames) {\n if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\n }\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 * @throws {TypeError} If `className` is not a string.\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 if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\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 * @throws {TypeError} If `className` is not a string.\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 if (!isStr(className)) {\n throw typeErr('className', 'a string', className)\n }\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 * @throws {TypeError} If either className is not a string.\n */\n replaceClass(oldClassName: string, newClassName: string): this {\n if (!isStr(oldClassName)) {\n throw typeErr('oldClassName', 'a string', oldClassName)\n }\n if (!isStr(newClassName)) {\n throw typeErr('newClassName', 'a string', newClassName)\n }\n this.ref.classList.replace(oldClassName, newClassName)\n return this\n }\n\n /**\n * Finds the closest ancestor (or self) that matches a CSS selector.\n *\n * @remarks\n * Returns `null` when no matching ancestor is found.\n *\n * @example\n * ```ts\n * const button = JJE.from(document.querySelector('button'))\n * const card = button.closest('.card')\n * if (card) {\n * card.addClass('has-action')\n * }\n * ```\n *\n * @param selector - The CSS selector to search for.\n * @returns A JJE wrapping the closest match, or null when none exists.\n * @throws {TypeError} If `selector` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest | Element.closest}\n */\n closest(selector: string): Wrapped | null {\n if (!isStr(selector)) {\n throw typeErr('selector', 'a string', selector)\n }\n const match = this.ref.closest(selector)\n return match ? JJN.wrap(match) : null\n }\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.rmAttr('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.rmAttr('disabled', 'aria-disabled')\n }\n\n /**\n * Gets the inner HTML of the Element.\n *\n * @remarks\n * This method operates on `innerHTML`. The method name is kept short for convenience.\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 * @remarks\n * This method operates on `innerHTML`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n *\n * @param html - The HTML string to set, or null/undefined to clear.\n * @param unsafe - explicit opt-in to set innerHTML. must be true if html is provided.\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 | null | undefined, unsafe?: boolean): this {\n if (html && unsafe !== true) {\n throw new Error(\n `Setting innerHTML is unsafe. Pass true as the second argument to confirm you know what you are doing.`,\n )\n }\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 if (isStr(template)) {\n shadowRoot.innerHTML = template\n } else {\n shadowRoot.appendChild(template)\n }\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, isObj, isStr } from 'jty'\nimport { JJE } from './JJE.js'\nimport { typeErr } from '../internal.js'\n\nexport abstract class JJEx<T extends HTMLElement | SVGElement> extends JJE<T> {\n /**\n * Gets a data attribute from the HTMLElement.\n *\n * @example\n * ```ts\n * const value = el.getData('my-key')\n * ```\n *\n * @param name - The data attribute name (in camelCase).\n * @returns The value of the attribute, or undefined if not set.\n * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n getData(name: string): string | undefined {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return this.ref.dataset[name]\n }\n\n /**\n * Checks if a data attribute exists on the HTMLElement.\n *\n * @example\n * ```ts\n * if (el.hasData('my-key')) {\n * // ...\n * }\n * ```\n *\n * @param name - The data attribute name (in camelCase).\n * @returns True if the attribute exists, false otherwise.\n * @throws {TypeError} If `name` is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n hasData(name: string): boolean {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n return hasProp(this.ref.dataset, name)\n }\n\n /**\n * Sets one or more data attributes on the HTMLElement.\n *\n * @example\n * ```ts\n * el.setData('myKey', 'myValue') // Single\n * el.setData({ myKey: 'myValue', otherKey: 'otherValue' }) // Multiple\n * el.setData('count', 42) // Numbers are automatically converted to strings\n * ```\n *\n * @throws {TypeError} If arguments are invalid types.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n setData(name: string, value?: string): this\n setData(obj: Record<string, string | undefined>): this\n setData(nameOrObj: string | Record<string, string | undefined>, value?: string): this {\n if (typeof nameOrObj === 'string') {\n this.ref.dataset[nameOrObj] = value\n } else if (isObj(nameOrObj)) {\n for (const [k, v] of Object.entries(nameOrObj)) {\n this.ref.dataset[k] = v\n }\n } else {\n throw typeErr('nameOrObj', 'a string or object', nameOrObj)\n }\n return this\n }\n\n /**\n * Removes one or more data attributes from the HTMLElement.\n *\n * @example\n * ```ts\n * el.rmData('myKey') // Remove single\n * el.rmData('myKey', 'otherKey') // Remove multiple\n * ```\n *\n * @param names - The data attribute name(s) (in camelCase).\n * @returns This instance for chaining.\n * @throws {TypeError} If any name is not a string.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset | HTMLElement.dataset}\n */\n rmData(...names: string[]): this {\n for (const name of names) {\n if (!isStr(name)) {\n throw typeErr('name', 'a string', name)\n }\n delete this.ref.dataset[name]\n }\n return this\n }\n}\n","import { hasProp, isA, isStr } from 'jty'\nimport { JJEx } from './JJEx.js'\nimport { typeErr } from '../internal.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 JJEx<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')) // from an existing HTMLElement\n * const el = JJHE.from(new document.createElement('div')) // from a new HTMLElement\n * ```\n *\n * @param ref - The HTMLElement.\n * @returns A new JJHE instance.\n */\n static from<T extends HTMLElement>(ref: T): JJHE<T> {\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.create('div')\n * const input = JJHE.create('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 create<K extends keyof HTMLElementTagNameMap>(\n tagName: K,\n options?: ElementCreationOptions,\n ): JJHE<HTMLElementTagNameMap[K]>\n static create(tagName: string, options?: ElementCreationOptions): JJHE\n static create(tagName: string, options?: ElementCreationOptions): JJHE {\n if (!isStr(tagName)) {\n throw typeErr('tagName', \"a string like 'div' or 'button'\", 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 typeErr('ref', 'an HTMLElement', ref)\n }\n super(ref)\n }\n\n /**\n * Gets the value property of the HTMLElement (e.g. for inputs).\n *\n * @returns The value.\n * @throws {Error} If the HTMLElement 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 ReferenceError(`${this.ref.tagName} has no value property.`)\n }\n return this.ref.value\n }\n\n /**\n * Sets the value property of the HTMLElement.\n *\n * @example\n * ```ts\n * input.setValue('new value')\n * input.setValue(42) // Numbers are automatically converted\n * ```\n *\n * @param value - The value to set.\n * @returns This instance for chaining.\n * @throws {Error} If the HTMLElement 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: unknown): this {\n if (!hasProp(this.ref, 'value')) {\n throw new ReferenceError(`${this.ref.tagName} has no value property.`)\n }\n this.ref.value = value\n return this\n }\n\n /**\n * Focuses the HTMLElement.\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 HTMLElement.\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 HTMLElement.\n *\n * @remarks\n * This method operates on `innerText`. The method name is kept short for convenience.\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 HTMLElement.\n *\n * @remarks\n * This method operates on `innerText`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n * Numbers and booleans are automatically converted to strings.\n *\n * @param text - The text to set, or null/undefined to clear.\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?: unknown): this {\n this.ref.innerText = text as string\n return this\n }\n}\n","import { isA } from 'jty'\nimport { JJN } from './JJN-raw.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 text = 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 return new JJT(text)\n }\n\n static fromStr(text: string): JJT {\n return new JJT(document.createTextNode(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) {\n if (!isA(ref, Text)) {\n throw new TypeError(\n `JJT expects a Text node. Got ${ref} (${typeof ref}). ` +\n `Create a Text node with JJT.fromStr() or document.createTextNode('text').`,\n )\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the Text node.\n *\n * @example\n * ```ts\n * const content = text.getText()\n * ```\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 Text node.\n *\n * @example\n * ```ts\n * text.setText('New content')\n * ```\n *\n * @param text - The text to set. Set it to null or undefined to remove all text\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?: unknown): this {\n this.ref.textContent = text as string | null\n return this\n }\n\n /**\n * Appends text to the existing content.\n *\n * @example\n * ```ts\n * text.setText('hello')\n * text.addText(' world')\n * console.log(text.getText()) // 'hello world'\n * ```\n *\n * @param textArr - The string to add to the existing contents. If null or undefined, nothing is added.\n * @returns This instance for chaining.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent | Node.textContent}\n */\n addText(...textArr: unknown[]): this {\n this.setText(this.getText() + textArr.join(''))\n return this\n }\n\n /**\n * Clears the text content of the Text node.\n *\n * @example\n * ```ts\n * text.empty()\n * ```\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","import { isA } from 'jty'\nimport { JJNx } from './JJNx.js'\nimport { JJHE } from './JJHE.js'\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 (`find`) and manipulation (`addChild`, `preChild`) methods.\n *\n * To find elements by class name, use: `doc.find('.my-class')`\n *\n * To set the document title, use: `doc.ref.title = 'New Title'`\n *\n * @example\n * ```ts\n * const doc = JJD.from(document)\n * doc.on('DOMContentLoaded', () => console.log('Ready'))\n * doc.ref.title = 'My Page Title' // Set document title\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 JJNx<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(`JJD expects a Document instance. 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 JJHE.from(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 JJHE.from(this.ref.body)\n }\n}\n","import { isA, isStr } from 'jty'\nimport { JJEx } from './JJEx.js'\nimport { typeErr } from '../internal.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 JJEx<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.create('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 create(tagName: string, options?: ElementCreationOptions): JJSE {\n if (!isStr(tagName)) {\n throw typeErr('tagName', 'a string like \"circle\" or \"path\"', 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 typeErr('ref', 'an SVGElement', ref)\n }\n super(ref)\n }\n\n /**\n * Gets the text content of the SVGElement.\n *\n * @remarks\n * This method operates on `textContent`. The method name is kept short for convenience.\n *\n * @example\n * ```ts\n * const text = svg.getText()\n * ```\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 SVGElement.\n *\n * @remarks\n * This method operates on `textContent`. The method name is kept short for convenience.\n * Pass an empty string, `null`, or `undefined` to clear the content.\n * Numbers and booleans are automatically converted to strings.\n *\n * @example\n * ```ts\n * svg.setText('Hello SVG')\n * svg.setText(null) // Clear content\n * svg.setText(42) // Numbers are converted\n * ```\n *\n * @param text - The text to set, or null/undefined to clear.\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?: unknown): this {\n this.ref.textContent = text as string | null\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","import { isA, isObj, isStr } from 'jty'\nimport { typeErr } from '../internal.js'\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-raw.js'\nimport { JJD } from './JJD.js'\nimport { JJSE } from './JJSE.js'\nimport { Wrappable, Wrapped } from './types.js'\n\nJJN.wrap = function wrap(raw: Wrappable): Wrapped {\n if (isStr(raw)) {\n return JJT.fromStr(raw)\n }\n if (!isObj(raw)) {\n throw typeErr('raw', 'an object', 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 typeErr('raw', 'a Node', raw)\n}\n\nexport { JJN }\n","import { isA, isStr } from 'jty'\nimport { Wrappable, JJHE } from './wrappers/index.js'\nimport { cssToStyle, fileExt } from './util.js'\nimport { typeErr, errMsg } from './internal.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.create(tagName).addChild(...children)\n if (attributes) {\n ret.setAttr(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 href - The URL of the resource.\n * @param rel - The relationship of the linked resource ('prefetch' or 'preload').\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 href: string | URL,\n rel: 'prefetch' | 'preload',\n as?: 'fetch' | 'style' | 'script',\n): JJHE {\n if (!isStr(href)) {\n if (!isA(href, URL)) {\n throw typeErr('href', 'a string or URL', href)\n }\n href = href.toString()\n }\n\n if (!['prefetch', 'preload'].includes(rel)) {\n throw new RangeError(errMsg('rel', `'prefetch' or 'preload'`, rel))\n }\n\n if (!as) {\n as = linkAs(href)\n if (!as) {\n throw new Error(`Could not guess 'as' attribute from URL: ${href}`)\n }\n }\n\n if (!['fetch', 'style', 'script'].includes(as)) {\n throw new RangeError(errMsg('as', `'fetch', 'style', or 'script'`, as))\n }\n\n return JJHE.create('link').setAttr({\n href,\n rel,\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 * @param args - The arguments to be passed to {@link createLinkPre}.\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 typeErr('mime', 'a string', 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, isFn, isStr } from 'jty'\nimport { typeErr } from './internal.js'\nimport { keb2cam } from './case.js'\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.find('#user').setText(this.userName)\n shadow.find('#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: unknown, newValue: unknown) {\n if (!isA(instance, HTMLElement)) {\n throw typeErr('instance', 'an HTMLElement', instance)\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 typeErr('name', 'a string', name)\n }\n if (!isFn(constructor)) {\n throw typeErr('constructor', 'a function', constructor)\n }\n if (!customElements.get(name)) {\n customElements.define(name, constructor, options)\n await customElements.whenDefined(name)\n }\n}\n","import { isA, isArr, isFn, isStr } from 'jty'\nimport { JJStyleConfig, JJTemplateConfig, ShadowConfig, JJHE, JJDF } from './wrappers/index.js'\nimport { cssToStyle } from './util.js'\nimport { typeErr } from './internal.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 * @remarks\n * If at some point it ends up with a JJHE instance or HTMLElement, a specific logic is applied..\n * If it is <TEMPLATE>, its `content` (DocumentFragment) will be used, otherwise its `outerHTML` will be used.\n *\n * @param templateConfig - The template configuration to resolve.\n * @returns A promise resolving to the HTML string, DocumentFragment, or undefined.\n * @throws {TypeError} If the resolved value is not a string, JJHE, JJDF, HTMLElement, or DocumentFragment.\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 (templateConfig === undefined) {\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, JJDF)) {\n return templateConfig.ref.cloneNode(true) as DocumentFragment\n }\n if (isA(templateConfig, DocumentFragment)) {\n return templateConfig.cloneNode(true) as DocumentFragment\n }\n if (isA(templateConfig, JJHE)) {\n // If it's a <template> wrapper, return a clone of its content (DocumentFragment)\n if (templateConfig.ref instanceof HTMLTemplateElement) {\n return templateConfig.ref.content.cloneNode(true) as DocumentFragment\n }\n return templateConfig.ref.outerHTML\n }\n if (isA(templateConfig, HTMLElement)) {\n return templateConfig instanceof HTMLTemplateElement\n ? (templateConfig.content.cloneNode(true) as DocumentFragment)\n : templateConfig.outerHTML\n }\n\n throw typeErr('template', 'a string, JJHE, JJDF, HTMLElement, or DocumentFragment', 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 style 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 typeErr('style', 'a CSS string or CSSStyleSheet', 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","export * from './util.js'\nexport * from './case.js'\nexport * from './wrappers/index.js'\nexport * from './helpers.js'\nexport * from './components.js'\nexport * from './ShadowMaster.js'\n\nimport { JJD } from './wrappers/JJD.js'\n\n/**\n * A wrapped document for convenience.\n * It can be used instead of document\n *\n * @example\n * ```ts\n * import { doc } from 'jj'\n * const el = doc.find('#my-element') // A JJHE instance\n * const body = doc.body // A JJHE instance\n * doc.addChild(JJHE.create('script').setAttr('src', 'my-code.js'))\n * doc.head.addChild(JJHE.create('link').setAttr({\n * rel: 'stylesheet',\n * href: 'code.css'\n * }))\n * ```\n */\nexport const doc = JJD.from(document)\n"],"mappings":"y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Integer","isNum","x","inRange","x","min","max","isNum","isDef","isArray","isArr","x","minLen","maxLen","inRange","hasOwnProperty","isObj","x","isA","classConstructor","isFn","hasProp","x","propNames","isObj","propName","isStr","x","hasOwnProperty","isArray","errMsg","varName","expected","received","typeErr","fileExt","path","isStr","typeErr","lastDotIndex","ext","nextAnimationFrame","resolve","sleep","ms","cssToStyle","css","pas2keb","str","isStr","typeErr","errMsg","keb2pas","word","keb2cam","g","c","_ref","_boundHandlers","_JJET_instances","getBoundHandler_fn","_JJET","ref","__privateAdd","isA","__privateSet","__privateGet","eventName","handler","options","boundHandler","__privateMethod","event","fn","args","bound","JJET","JJN","_JJN","JJET","node","x","isStr","isA","raw","isObj","typeErr","obj","iterable","ref","parentNode","deep","textArr","JJNx","JJN","selector","required","queryResult","children","nodes","array","mapFn","JJDF","_JJDF","JJNx","ref","isA","typeErr","JJSR","_JJSR","JJDF","shadowRoot","isA","html","unsafe","styleSheets","JJE","_JJE","JJNx","ref","isA","name","isStr","typeErr","nameOrObj","value","isObj","k","v","names","classNameOrMap","className","condition","classNames","oldClassName","newClassName","selector","match","JJN","html","unsafe","mode","config","shadowRoot","template","styles","isArr","JJSR","JJEx","JJE","name","isStr","typeErr","hasProp","nameOrObj","value","isObj","k","v","names","JJHE","_JJHE","JJEx","ref","tagName","options","isStr","typeErr","isA","hasProp","value","text","JJT","_JJT","JJN","text","ref","isA","textArr","JJD","_JJD","JJNx","ref","isA","JJHE","SVG_NAMESPACE_URI","JJSE","_JJSE","JJEx","ref","tagName","options","isStr","typeErr","element","isA","text","value","p1","p2","p3","p4","JJN","raw","isStr","JJT","isObj","typeErr","isA","JJHE","JJSE","JJE","JJSR","JJDF","JJD","h","tagName","attributes","children","ret","JJHE","linkAs","href","fileExt","createLinkPre","rel","as","isStr","isA","typeErr","errMsg","addLinkPre","args","link","fetchText","url","mime","response","fetchHtml","fetchCss","fetchStyle","cssToStyle","attr2prop","instance","name","oldValue","newValue","isA","typeErr","propName","keb2cam","hasProp","registerComponent","constructor","options","isStr","isFn","templatePromise","templateConfig","isFn","isStr","isA","JJDF","JJHE","typeErr","stylePromise","styleConfig","cssToStyle","stylePromises","styleConfigs","isArr","resolveConfig","template","styles","_templateConfig","_stylesConfig","_normalizedConfig","_ShadowMaster","__privateAdd","__privateSet","stylesConfig","__privateGet","ShadowMaster","doc","JJD"]}
|