defuss 1.4.0 → 1.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index-B8vV328V.cjs","sources":["../src/common/path.ts","../src/render/isomorph.ts","../src/store/store.ts","../src/render/ref.ts"],"sourcesContent":["const ARRAY_INDEX = /(.*)\\[(\\d+)\\]/;\nconst IS_NUMBER = /^\\d+$/;\n\nexport const getAllKeysFromPath = (path: string): Array<string | number> =>\n path.split('.').flatMap(key => {\n const match = key.match(ARRAY_INDEX);\n return match ? [...getAllKeysFromPath(match[1]), Number(match[2])] : key;\n });\n\nexport const ensureKey = (\n obj: Record<string, any>,\n key: string | number,\n nextKey?: string | number\n): void => {\n if (!(key in obj)) {\n obj[key] = IS_NUMBER.test(String(nextKey)) ? [] : {};\n }\n};\n\nexport const getByPath = (obj: any, path: string): any => {\n const keys = getAllKeysFromPath(path);\n return keys.reduce((result, key) => (result == null ? undefined : result[key]), obj);\n};\n\nexport const setByPath = (obj: any, path: string, value: any): any => {\n const keys = getAllKeysFromPath(path);\n const key = keys[0];\n const newObj = Array.isArray(obj) ? [...obj] : { ...obj };\n\n if (keys.length === 1) {\n if (value === undefined) {\n Array.isArray(newObj) ? newObj.splice(Number(key), 1) : delete newObj[key];\n } else {\n newObj[key] = value;\n }\n return newObj;\n }\n\n ensureKey(newObj, key, keys[1]);\n newObj[key] = setByPath(newObj[key], keys.slice(1).join('.'), value);\n return newObj;\n};\n","import type { Dequery } from '@/dequery/dequery.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, VNodeAttributes, DomAbstractionImpl, Globals } from '@/render/types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nexport const createInPlaceErrorMessageVNode = (error: unknown) => ({\n type: 'p',\n attributes: {},\n children: [`FATAL ERROR: ${(error as Error)?.message || error}`]\n})\n\nexport const jsx = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n if (typeof key !== \"undefined\") {\n /* key passed for instance-based lifecycle event listener registration */\n attributes.key = key;\n }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>;\n }\n\n // it's a component, divide and conquer children\n // in case of async functions, we just pass them through\n if (typeof type === 'function' && type.constructor.name !== 'AsyncFunction') {\n\n try {\n return type({\n children,\n ...attributes,\n })\n } catch (error) {\n\n if (typeof error === \"string\") {\n error = `[JsxError] in ${type.name}: ${error}`;\n } else if (error instanceof Error) {\n error.message = `[JsxError] in ${type.name}: ${error.message}`;\n }\n\n // render the error in place\n return createInPlaceErrorMessageVNode(error)\n }\n }\n\n return {\n type,\n attributes,\n children,\n };\n}\n\nexport const observeUnmount = (domNode: Node, onUnmount: () => void): void => {\n if (!domNode || typeof onUnmount !== 'function') {\n throw new Error('Invalid arguments. Ensure domNode and onUnmount are valid.');\n }\n\n const parentNode = domNode.parentNode;\n if (!parentNode) {\n throw new Error('The provided domNode does not have a parentNode.');\n }\n\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.removedNodes.length > 0) {\n for (const removedNode of mutation.removedNodes) {\n if (removedNode === domNode) {\n onUnmount();\n observer.disconnect(); // Stop observing after unmount\n return;\n }\n }\n }\n }\n });\n\n // Observe the parentNode for child removals\n observer.observe(parentNode, { childList: true });\n}\n\n/** lifecycle event attachment has been implemented separately, because it is also required to run when partially updating the DOM */\nexport const handleLifecycleEventsForOnMount = (newEl: HTMLElement) => {\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any)?.$onMount === 'function') {\n ; (newEl as any).$onMount!()\n // remove the hook after it's been called\n ; (newEl as any).$onMount = null;\n }\n\n // optionally check for a element lifecycle \"onUnmount\" and hook it up\n if (typeof (newEl as any)?.$onUnmount === 'function') {\n // register the unmount observer (MutationObserver)\n observeUnmount(newEl as HTMLElement, (newEl as any).$onUnmount!);\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element | undefined = undefined;\n\n try {\n // if a synchronous function is still a function, VDOM has obviously not resolved, probably an \n // Error occurred while generating the VDOM (in JSX runtime)\n if (\n virtualNode.constructor.name === 'AsyncFunction'\n ) {\n newEl = document.createElement('div')\n } else if (typeof virtualNode.type === 'function') {\n newEl = document.createElement('div')\n ; (newEl as HTMLElement).innerText = `FATAL ERROR: ${virtualNode.type._error}`\n } else if ( // SVG support\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) { // SVG support\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n renderer.setAttributes(virtualNode, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n // TODO: FIX me\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n handleLifecycleEventsForOnMount(newEl as HTMLElement)\n }\n } catch (e) {\n console.error('Fatal error! Error happend while rendering the VDOM!', e, virtualNode);\n throw e;\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element, virtualNode: VNode<VNodeAttributes>) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return // if not set, ignore\n\n // TODO: use DANGROUSLY_SET_INNER_HTML_ATTRIBUTE here\n if (name === 'dangerouslySetInnerHTML') return; // special case, handled elsewhere\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement // update ref\n return; // but do not render the ref as a string [object Object] into the DOM\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ; (domElement as any).$onMount = value // DOM event lifecycle hook\n }\n\n if (eventName === 'unmount') {\n ; (domElement as any).$onUnmount = value // DOM event lifecycle hook\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React JSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n // SVG support\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ; (domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ; (domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (virtualNode: VNode<VNodeAttributes>, domElement: Element) => {\n const attrNames = Object.keys(virtualNode.attributes!)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], virtualNode.attributes![attrNames[i]], domElement, virtualNode)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n let renderResult: Array<Element | Text | undefined> | Element | Text | undefined\n\n if (typeof virtualNode === 'string') {\n renderResult = getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n } else {\n renderResult = getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n }\n return renderResult;\n}\n\n// --- JSX standard (necessary exports for jsx-runtime)\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string,\n allChildrenAreStatic?: boolean,\n sourceInfo?: string,\n selfReference?: any,\n): Array<VNode> | VNode => {\n let renderResult: Array<VNode> | VNode;\n try {\n renderResult = jsx(type, attributes, key);\n } catch (error) {\n console.error(\"JSX error:\", error, 'in', sourceInfo, 'component', selfReference);\n }\n return renderResult!;\n}\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};","import { getByPath, setByPath } from '@/common/index.js';\n\nexport type Listener<T> = (newValue: T, oldValue?: T, changedKey?: string) => void;\n\nexport interface Store<T> {\n value: T;\n get: <D=T>(path?: string) => D;\n set: <D=T>(pathOrValue: string | D, value?: D) => void;\n subscribe: (listener: Listener<T>) => () => void;\n}\n\nexport const createStore = <T>(initialValue: T): Store<T> => {\n let value: T = initialValue; // internal state\n const listeners: Array<Listener<T>> = [];\n\n const notify = (oldValue: T, changedKey?: string) => {\n listeners.forEach(listener => listener(value, oldValue, changedKey));\n };\n\n return {\n // allow reading value but prevent external mutation\n get value() {\n return value; \n },\n\n get(path?: string) {\n return path ? getByPath(value, path) : value;\n },\n\n set(pathOrValue: string | any, newValue?: any) {\n const oldValue = value;\n\n if (newValue === undefined) {\n // replace entire store value\n if (oldValue !== pathOrValue) {\n value = pathOrValue;\n notify(oldValue);\n }\n } else {\n // update a specific path\n const updatedValue = setByPath(value, pathOrValue, newValue);\n if (oldValue !== updatedValue) {\n value = updatedValue;\n notify(oldValue, pathOrValue);\n }\n }\n },\n\n subscribe(listener) {\n listeners.push(listener);\n return () => {\n const index = listeners.indexOf(listener);\n if (index >= 0) listeners.splice(index, 1);\n };\n },\n };\n};\n","import type { Ref, RefUpdateFn } from '@/render/types.js';\nimport { createStore } from '@/store/store.js';\n\nexport const isRef = (obj: any): obj is Ref<Element> =>\n obj && typeof obj === \"object\" && \"current\" in obj;\n\nexport function createRef<ST = any, NT extends Node | Element | Text | null = HTMLElement>(refUpdateFn?: RefUpdateFn<ST>, defaultState?: ST): Ref<NT, ST> {\n\n const stateStore = createStore<ST>(defaultState as ST);\n \n const ref: Ref<NT, ST> = { \n current: null as NT,\n store: stateStore,\n get state() {\n return stateStore.value;\n },\n set state(value: ST) {\n stateStore.set(value);\n },\n update: (state: ST) => {\n stateStore.set(state);\n },\n subscribe: (refUpdateFn: RefUpdateFn<ST>) => stateStore.subscribe(refUpdateFn),\n }\n\n if (typeof refUpdateFn === 'function') {\n ref.subscribe(refUpdateFn);\n }\n return ref;\n}"],"names":[],"mappings":";;AACA,MAAM,WAAW,GAAG,eAAe;AACnC,MAAM,SAAS,GAAG,OAAO;AACb,MAAC,kBAAkB,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AAC7E,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;AACtC,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG;AAC1E,CAAC;AACW,MAAC,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK;AAChD,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE;AACrB,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;AACxD;AACA;AACY,MAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK;AACxC,EAAE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACvC,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;AACjF;AACY,MAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,KAAK;AAC/C,EAAE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;AACvC,EAAE,MAAM,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AAK,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AAClD,OAAO;AACP;AACA,GAAG;AACH;;ACrCY,MAAC,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI;AACtE,SAAS,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE;AACrD,EAAE,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC;AAC9C,EAAE,MAAM,GAAG,GAAG;AACd,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,KAAK,EAAE,UAAU;AACrB,IAAI,IAAI,KAAK,GAAG;AAChB,MAAM,OAAO,UAAU,CAAC,KAAK;AAC7B,KAAK;AACL,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,EAAE,CAAC,KAAK,KAAK;AACvB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,SAAS,EAAE,CAAC,YAAY,KAAK,UAAU,CAAC,SAAS,CAAC,YAAY;AAClE,GAAG;AACH,EAAE,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;AACzC,IAAI,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC;AAC9B;AACA,EAAE,OAAO,GAAG;AACZ;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-B8vV328V.cjs","sources":["../src/common/path.ts","../src/render/isomorph.ts","../src/store/store.ts","../src/render/ref.ts"],"sourcesContent":["const ARRAY_INDEX = /(.*)\\[(\\d+)\\]/;\nconst IS_NUMBER = /^\\d+$/;\n\nexport const getAllKeysFromPath = (path: string): Array<string | number> =>\n path.split('.').flatMap(key => {\n const match = key.match(ARRAY_INDEX);\n return match ? [...getAllKeysFromPath(match[1]), Number(match[2])] : key;\n });\n\nexport const ensureKey = (\n obj: Record<string, any>,\n key: string | number,\n nextKey?: string | number\n): void => {\n if (!(key in obj)) {\n obj[key] = IS_NUMBER.test(String(nextKey)) ? [] : {};\n }\n};\n\nexport const getByPath = (obj: any, path: string): any => {\n const keys = getAllKeysFromPath(path);\n return keys.reduce((result, key) => (result == null ? undefined : result[key]), obj);\n};\n\nexport const setByPath = (obj: any, path: string, value: any): any => {\n const keys = getAllKeysFromPath(path);\n const key = keys[0];\n const newObj = Array.isArray(obj) ? [...obj] : { ...obj };\n\n if (keys.length === 1) {\n if (value === undefined) {\n Array.isArray(newObj) ? newObj.splice(Number(key), 1) : delete newObj[key];\n } else {\n newObj[key] = value;\n }\n return newObj;\n }\n\n ensureKey(newObj, key, keys[1]);\n newObj[key] = setByPath(newObj[key], keys.slice(1).join('.'), value);\n return newObj;\n};\n","import type { Dequery } from '@/dequery/dequery.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, VNodeAttributes, DomAbstractionImpl, Globals } from '@/render/types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nexport const createInPlaceErrorMessageVNode = (error: unknown) => ({\n type: 'p',\n attributes: {},\n children: [`FATAL ERROR: ${(error as Error)?.message || error}`]\n})\n\nexport const jsx = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n if (typeof key !== \"undefined\") {\n /* key passed for instance-based lifecycle event listener registration */\n attributes.key = key;\n }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>;\n }\n\n // it's a component, divide and conquer children\n // in case of async functions, we just pass them through\n if (typeof type === 'function' && type.constructor.name !== 'AsyncFunction') {\n\n try {\n return type({\n children,\n ...attributes,\n })\n } catch (error) {\n\n if (typeof error === \"string\") {\n error = `[JsxError] in ${type.name}: ${error}`;\n } else if (error instanceof Error) {\n error.message = `[JsxError] in ${type.name}: ${error.message}`;\n }\n\n // render the error in place\n return createInPlaceErrorMessageVNode(error)\n }\n }\n\n return {\n type,\n attributes,\n children,\n };\n}\n\nexport const observeUnmount = (domNode: Node, onUnmount: () => void): void => {\n if (!domNode || typeof onUnmount !== 'function') {\n throw new Error('Invalid arguments. Ensure domNode and onUnmount are valid.');\n }\n\n const parentNode = domNode.parentNode;\n if (!parentNode) {\n throw new Error('The provided domNode does not have a parentNode.');\n }\n\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.removedNodes.length > 0) {\n for (const removedNode of mutation.removedNodes) {\n if (removedNode === domNode) {\n onUnmount();\n observer.disconnect(); // Stop observing after unmount\n return;\n }\n }\n }\n }\n });\n\n // Observe the parentNode for child removals\n observer.observe(parentNode, { childList: true });\n}\n\n/** lifecycle event attachment has been implemented separately, because it is also required to run when partially updating the DOM */\nexport const handleLifecycleEventsForOnMount = (newEl: HTMLElement) => {\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any)?.$onMount === 'function') {\n ; (newEl as any).$onMount!()\n // remove the hook after it's been called\n ; (newEl as any).$onMount = null;\n }\n\n // optionally check for a element lifecycle \"onUnmount\" and hook it up\n if (typeof (newEl as any)?.$onUnmount === 'function') {\n // register the unmount observer (MutationObserver)\n observeUnmount(newEl as HTMLElement, (newEl as any).$onUnmount!);\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element | undefined = undefined;\n\n try {\n // if a synchronous function is still a function, VDOM has obviously not resolved, probably an \n // Error occurred while generating the VDOM (in JSX runtime)\n if (\n virtualNode.constructor.name === 'AsyncFunction'\n ) {\n newEl = document.createElement('div')\n } else if (typeof virtualNode.type === 'function') {\n newEl = document.createElement('div')\n ; (newEl as HTMLElement).innerText = `FATAL ERROR: ${virtualNode.type._error}`\n } else if ( // SVG support\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) { // SVG support\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n renderer.setAttributes(virtualNode, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n // TODO: FIX me\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n handleLifecycleEventsForOnMount(newEl as HTMLElement)\n }\n } catch (e) {\n console.error('Fatal error! Error happend while rendering the VDOM!', e, virtualNode);\n throw e;\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element, virtualNode: VNode<VNodeAttributes>) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return // if not set, ignore\n\n // TODO: use DANGROUSLY_SET_INNER_HTML_ATTRIBUTE here\n if (name === 'dangerouslySetInnerHTML') return; // special case, handled elsewhere\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement // update ref\n return; // but do not render the ref as a string [object Object] into the DOM\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ; (domElement as any).$onMount = value // DOM event lifecycle hook\n }\n\n if (eventName === 'unmount') {\n ; (domElement as any).$onUnmount = value // DOM event lifecycle hook\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React JSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n // SVG support\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ; (domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ; (domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (virtualNode: VNode<VNodeAttributes>, domElement: Element) => {\n const attrNames = Object.keys(virtualNode.attributes!)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], virtualNode.attributes![attrNames[i]], domElement, virtualNode)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n let renderResult: Array<Element | Text | undefined> | Element | Text | undefined\n\n if (typeof virtualNode === 'string') {\n renderResult = getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n } else {\n renderResult = getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n }\n return renderResult;\n}\n\n// --- JSX standard (necessary exports for jsx-runtime)\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string,\n allChildrenAreStatic?: boolean,\n sourceInfo?: string,\n selfReference?: any,\n): Array<VNode> | VNode => {\n let renderResult: Array<VNode> | VNode;\n try {\n renderResult = jsx(type, attributes, key);\n } catch (error) {\n console.error(\"JSX error:\", error, 'in', sourceInfo, 'component', selfReference);\n }\n return renderResult!;\n}\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};","import { getByPath, setByPath } from '../common/index.js';\n\nexport type Listener<T> = (newValue: T, oldValue?: T, changedKey?: string) => void;\n\nexport interface Store<T> {\n value: T;\n get: <D = T>(path?: string) => D;\n set: <D = T>(pathOrValue: string | D, value?: D) => void;\n subscribe: (listener: Listener<T>) => () => void;\n}\n\nexport const createStore = <T>(initialValue: T): Store<T> => {\n let value: T = initialValue; // internal state\n const listeners: Array<Listener<T>> = [];\n\n const notify = (oldValue: T, changedKey?: string) => {\n listeners.forEach(listener => listener(value, oldValue, changedKey));\n };\n\n return {\n // allow reading value but prevent external mutation\n get value() {\n return value;\n },\n\n get(path?: string) {\n return path ? getByPath(value, path) : value;\n },\n\n set(pathOrValue: string | any, newValue?: any) {\n const oldValue = value;\n\n if (newValue === undefined) {\n // replace entire store value\n if (oldValue !== pathOrValue) {\n value = pathOrValue;\n notify(oldValue);\n }\n } else {\n // update a specific path\n const updatedValue = setByPath(value, pathOrValue, newValue);\n if (oldValue !== updatedValue) {\n value = updatedValue;\n notify(oldValue, pathOrValue);\n }\n }\n },\n\n subscribe(listener) {\n listeners.push(listener);\n return () => {\n const index = listeners.indexOf(listener);\n if (index >= 0) listeners.splice(index, 1);\n };\n },\n };\n};\n","import type { Ref, RefUpdateFn } from '../render/types.js';\nimport { createStore } from '../store/store.js';\n\nexport const isRef = (obj: any): obj is Ref<Element> =>\n obj && typeof obj === \"object\" && \"current\" in obj;\n\nexport function createRef<ST = any, NT extends Node | Element | Text | null = HTMLElement>(refUpdateFn?: RefUpdateFn<ST>, defaultState?: ST): Ref<NT, ST> {\n\n const stateStore = createStore<ST>(defaultState as ST);\n\n const ref: Ref<NT, ST> = {\n current: null as NT,\n store: stateStore,\n get state() {\n return stateStore.value;\n },\n set state(value: ST) {\n stateStore.set(value);\n },\n update: (state: ST) => {\n stateStore.set(state);\n },\n subscribe: (refUpdateFn: RefUpdateFn<ST>) => stateStore.subscribe(refUpdateFn),\n }\n\n if (typeof refUpdateFn === 'function') {\n ref.subscribe(refUpdateFn);\n }\n return ref;\n}"],"names":[],"mappings":";;AACA,MAAM,WAAW,GAAG,eAAe;AACnC,MAAM,SAAS,GAAG,OAAO;AACb,MAAC,kBAAkB,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AAC7E,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;AACtC,EAAE,OAAO,KAAK,GAAG,C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AM,OAAO,UAAU,CAAC,KAAK;AAC7B,KAAK;AACL,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,EAAE,CAAC,KAAK,KAAK;AACvB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,SAAS,EAAE,CAAC,YAAY,KAAK,UAAU,CAAC,SAAS,CAAC,YAAY;AAClE,GAAG;AACH,EAAE,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;AACzC,IAAI,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC;AAC9B;AACA,EAAE,OAAO,GAAG;AACZ;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index-BDxEyjzN.mjs","sources":["../src/common/path.ts","../src/render/isomorph.ts","../src/store/store.ts","../src/render/ref.ts"],"sourcesContent":["const ARRAY_INDEX = /(.*)\\[(\\d+)\\]/;\nconst IS_NUMBER = /^\\d+$/;\n\nexport const getAllKeysFromPath = (path: string): Array<string | number> =>\n path.split('.').flatMap(key => {\n const match = key.match(ARRAY_INDEX);\n return match ? [...getAllKeysFromPath(match[1]), Number(match[2])] : key;\n });\n\nexport const ensureKey = (\n obj: Record<string, any>,\n key: string | number,\n nextKey?: string | number\n): void => {\n if (!(key in obj)) {\n obj[key] = IS_NUMBER.test(String(nextKey)) ? [] : {};\n }\n};\n\nexport const getByPath = (obj: any, path: string): any => {\n const keys = getAllKeysFromPath(path);\n return keys.reduce((result, key) => (result == null ? undefined : result[key]), obj);\n};\n\nexport const setByPath = (obj: any, path: string, value: any): any => {\n const keys = getAllKeysFromPath(path);\n const key = keys[0];\n const newObj = Array.isArray(obj) ? [...obj] : { ...obj };\n\n if (keys.length === 1) {\n if (value === undefined) {\n Array.isArray(newObj) ? newObj.splice(Number(key), 1) : delete newObj[key];\n } else {\n newObj[key] = value;\n }\n return newObj;\n }\n\n ensureKey(newObj, key, keys[1]);\n newObj[key] = setByPath(newObj[key], keys.slice(1).join('.'), value);\n return newObj;\n};\n","import type { Dequery } from '@/dequery/dequery.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, VNodeAttributes, DomAbstractionImpl, Globals } from '@/render/types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nexport const createInPlaceErrorMessageVNode = (error: unknown) => ({\n type: 'p',\n attributes: {},\n children: [`FATAL ERROR: ${(error as Error)?.message || error}`]\n})\n\nexport const jsx = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n if (typeof key !== \"undefined\") {\n /* key passed for instance-based lifecycle event listener registration */\n attributes.key = key;\n }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>;\n }\n\n // it's a component, divide and conquer children\n // in case of async functions, we just pass them through\n if (typeof type === 'function' && type.constructor.name !== 'AsyncFunction') {\n\n try {\n return type({\n children,\n ...attributes,\n })\n } catch (error) {\n\n if (typeof error === \"string\") {\n error = `[JsxError] in ${type.name}: ${error}`;\n } else if (error instanceof Error) {\n error.message = `[JsxError] in ${type.name}: ${error.message}`;\n }\n\n // render the error in place\n return createInPlaceErrorMessageVNode(error)\n }\n }\n\n return {\n type,\n attributes,\n children,\n };\n}\n\nexport const observeUnmount = (domNode: Node, onUnmount: () => void): void => {\n if (!domNode || typeof onUnmount !== 'function') {\n throw new Error('Invalid arguments. Ensure domNode and onUnmount are valid.');\n }\n\n const parentNode = domNode.parentNode;\n if (!parentNode) {\n throw new Error('The provided domNode does not have a parentNode.');\n }\n\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.removedNodes.length > 0) {\n for (const removedNode of mutation.removedNodes) {\n if (removedNode === domNode) {\n onUnmount();\n observer.disconnect(); // Stop observing after unmount\n return;\n }\n }\n }\n }\n });\n\n // Observe the parentNode for child removals\n observer.observe(parentNode, { childList: true });\n}\n\n/** lifecycle event attachment has been implemented separately, because it is also required to run when partially updating the DOM */\nexport const handleLifecycleEventsForOnMount = (newEl: HTMLElement) => {\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any)?.$onMount === 'function') {\n ; (newEl as any).$onMount!()\n // remove the hook after it's been called\n ; (newEl as any).$onMount = null;\n }\n\n // optionally check for a element lifecycle \"onUnmount\" and hook it up\n if (typeof (newEl as any)?.$onUnmount === 'function') {\n // register the unmount observer (MutationObserver)\n observeUnmount(newEl as HTMLElement, (newEl as any).$onUnmount!);\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element | undefined = undefined;\n\n try {\n // if a synchronous function is still a function, VDOM has obviously not resolved, probably an \n // Error occurred while generating the VDOM (in JSX runtime)\n if (\n virtualNode.constructor.name === 'AsyncFunction'\n ) {\n newEl = document.createElement('div')\n } else if (typeof virtualNode.type === 'function') {\n newEl = document.createElement('div')\n ; (newEl as HTMLElement).innerText = `FATAL ERROR: ${virtualNode.type._error}`\n } else if ( // SVG support\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) { // SVG support\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n renderer.setAttributes(virtualNode, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n // TODO: FIX me\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n handleLifecycleEventsForOnMount(newEl as HTMLElement)\n }\n } catch (e) {\n console.error('Fatal error! Error happend while rendering the VDOM!', e, virtualNode);\n throw e;\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element, virtualNode: VNode<VNodeAttributes>) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return // if not set, ignore\n\n // TODO: use DANGROUSLY_SET_INNER_HTML_ATTRIBUTE here\n if (name === 'dangerouslySetInnerHTML') return; // special case, handled elsewhere\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement // update ref\n return; // but do not render the ref as a string [object Object] into the DOM\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ; (domElement as any).$onMount = value // DOM event lifecycle hook\n }\n\n if (eventName === 'unmount') {\n ; (domElement as any).$onUnmount = value // DOM event lifecycle hook\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React JSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n // SVG support\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ; (domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ; (domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (virtualNode: VNode<VNodeAttributes>, domElement: Element) => {\n const attrNames = Object.keys(virtualNode.attributes!)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], virtualNode.attributes![attrNames[i]], domElement, virtualNode)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n let renderResult: Array<Element | Text | undefined> | Element | Text | undefined\n\n if (typeof virtualNode === 'string') {\n renderResult = getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n } else {\n renderResult = getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n }\n return renderResult;\n}\n\n// --- JSX standard (necessary exports for jsx-runtime)\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string,\n allChildrenAreStatic?: boolean,\n sourceInfo?: string,\n selfReference?: any,\n): Array<VNode> | VNode => {\n let renderResult: Array<VNode> | VNode;\n try {\n renderResult = jsx(type, attributes, key);\n } catch (error) {\n console.error(\"JSX error:\", error, 'in', sourceInfo, 'component', selfReference);\n }\n return renderResult!;\n}\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};","import { getByPath, setByPath } from '@/common/index.js';\n\nexport type Listener<T> = (newValue: T, oldValue?: T, changedKey?: string) => void;\n\nexport interface Store<T> {\n value: T;\n get: <D=T>(path?: string) => D;\n set: <D=T>(pathOrValue: string | D, value?: D) => void;\n subscribe: (listener: Listener<T>) => () => void;\n}\n\nexport const createStore = <T>(initialValue: T): Store<T> => {\n let value: T = initialValue; // internal state\n const listeners: Array<Listener<T>> = [];\n\n const notify = (oldValue: T, changedKey?: string) => {\n listeners.forEach(listener => listener(value, oldValue, changedKey));\n };\n\n return {\n // allow reading value but prevent external mutation\n get value() {\n return value; \n },\n\n get(path?: string) {\n return path ? getByPath(value, path) : value;\n },\n\n set(pathOrValue: string | any, newValue?: any) {\n const oldValue = value;\n\n if (newValue === undefined) {\n // replace entire store value\n if (oldValue !== pathOrValue) {\n value = pathOrValue;\n notify(oldValue);\n }\n } else {\n // update a specific path\n const updatedValue = setByPath(value, pathOrValue, newValue);\n if (oldValue !== updatedValue) {\n value = updatedValue;\n notify(oldValue, pathOrValue);\n }\n }\n },\n\n subscribe(listener) {\n listeners.push(listener);\n return () => {\n const index = listeners.indexOf(listener);\n if (index >= 0) listeners.splice(index, 1);\n };\n },\n };\n};\n","import type { Ref, RefUpdateFn } from '@/render/types.js';\nimport { createStore } from '@/store/store.js';\n\nexport const isRef = (obj: any): obj is Ref<Element> =>\n obj && typeof obj === \"object\" && \"current\" in obj;\n\nexport function createRef<ST = any, NT extends Node | Element | Text | null = HTMLElement>(refUpdateFn?: RefUpdateFn<ST>, defaultState?: ST): Ref<NT, ST> {\n\n const stateStore = createStore<ST>(defaultState as ST);\n \n const ref: Ref<NT, ST> = { \n current: null as NT,\n store: stateStore,\n get state() {\n return stateStore.value;\n },\n set state(value: ST) {\n stateStore.set(value);\n },\n update: (state: ST) => {\n stateStore.set(state);\n },\n subscribe: (refUpdateFn: RefUpdateFn<ST>) => stateStore.subscribe(refUpdateFn),\n }\n\n if (typeof refUpdateFn === 'function') {\n ref.subscribe(refUpdateFn);\n }\n return ref;\n}"],"names":[],"mappings":"AACA,MAAM,WAAW,GAAG,eAAe;AACnC,MAAM,SAAS,GAAG,OAAO;AACb,MAAC,kBAAkB,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AAC7E,EAAE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;AACtC,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG;AAC1E,CAAC;AACW,MAAC,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK;AAChD,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE;AACrB,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE;AACxD;AACA;AACY,MAAC,SAAS,GAAG,CAAC,GA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,CAAC;AAC9B;AACA,EAAE,OAAO,GAAG;AACZ;;;;"}
1
+ {"version":3,"file":"index-BDxEyjzN.mjs","sources":["../src/common/path.ts","../src/render/isomorph.ts","../src/store/store.ts","../src/render/ref.ts"],"sourcesContent":["const ARRAY_INDEX = /(.*)\\[(\\d+)\\]/;\nconst IS_NUMBER = /^\\d+$/;\n\nexport const getAllKeysFromPath = (path: string): Array<string | number> =>\n path.split('.').flatMap(key => {\n const match = key.match(ARRAY_INDEX);\n return match ? [...getAllKeysFromPath(match[1]), Number(match[2])] : key;\n });\n\nexport const ensureKey = (\n obj: Record<string, any>,\n key: string | number,\n nextKey?: string | number\n): void => {\n if (!(key in obj)) {\n obj[key] = IS_NUMBER.test(String(nextKey)) ? [] : {};\n }\n};\n\nexport const getByPath = (obj: any, path: string): any => {\n const keys = getAllKeysFromPath(path);\n return keys.reduce((result, key) => (result == null ? undefined : result[key]), obj);\n};\n\nexport const setByPath = (obj: any, path: string, value: any): any => {\n const keys = getAllKeysFromPath(path);\n const key = keys[0];\n const newObj = Array.isArray(obj) ? [...obj] : { ...obj };\n\n if (keys.length === 1) {\n if (value === undefined) {\n Array.isArray(newObj) ? newObj.splice(Number(key), 1) : delete newObj[key];\n } else {\n newObj[key] = value;\n }\n return newObj;\n }\n\n ensureKey(newObj, key, keys[1]);\n newObj[key] = setByPath(newObj[key], keys.slice(1).join('.'), value);\n return newObj;\n};\n","import type { Dequery } from '@/dequery/dequery.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, VNodeAttributes, DomAbstractionImpl, Globals } from '@/render/types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nexport const createInPlaceErrorMessageVNode = (error: unknown) => ({\n type: 'p',\n attributes: {},\n children: [`FATAL ERROR: ${(error as Error)?.message || error}`]\n})\n\nexport const jsx = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n if (typeof key !== \"undefined\") {\n /* key passed for instance-based lifecycle event listener registration */\n attributes.key = key;\n }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>;\n }\n\n // it's a component, divide and conquer children\n // in case of async functions, we just pass them through\n if (typeof type === 'function' && type.constructor.name !== 'AsyncFunction') {\n\n try {\n return type({\n children,\n ...attributes,\n })\n } catch (error) {\n\n if (typeof error === \"string\") {\n error = `[JsxError] in ${type.name}: ${error}`;\n } else if (error instanceof Error) {\n error.message = `[JsxError] in ${type.name}: ${error.message}`;\n }\n\n // render the error in place\n return createInPlaceErrorMessageVNode(error)\n }\n }\n\n return {\n type,\n attributes,\n children,\n };\n}\n\nexport const observeUnmount = (domNode: Node, onUnmount: () => void): void => {\n if (!domNode || typeof onUnmount !== 'function') {\n throw new Error('Invalid arguments. Ensure domNode and onUnmount are valid.');\n }\n\n const parentNode = domNode.parentNode;\n if (!parentNode) {\n throw new Error('The provided domNode does not have a parentNode.');\n }\n\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.removedNodes.length > 0) {\n for (const removedNode of mutation.removedNodes) {\n if (removedNode === domNode) {\n onUnmount();\n observer.disconnect(); // Stop observing after unmount\n return;\n }\n }\n }\n }\n });\n\n // Observe the parentNode for child removals\n observer.observe(parentNode, { childList: true });\n}\n\n/** lifecycle event attachment has been implemented separately, because it is also required to run when partially updating the DOM */\nexport const handleLifecycleEventsForOnMount = (newEl: HTMLElement) => {\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any)?.$onMount === 'function') {\n ; (newEl as any).$onMount!()\n // remove the hook after it's been called\n ; (newEl as any).$onMount = null;\n }\n\n // optionally check for a element lifecycle \"onUnmount\" and hook it up\n if (typeof (newEl as any)?.$onUnmount === 'function') {\n // register the unmount observer (MutationObserver)\n observeUnmount(newEl as HTMLElement, (newEl as any).$onUnmount!);\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element | undefined = undefined;\n\n try {\n // if a synchronous function is still a function, VDOM has obviously not resolved, probably an \n // Error occurred while generating the VDOM (in JSX runtime)\n if (\n virtualNode.constructor.name === 'AsyncFunction'\n ) {\n newEl = document.createElement('div')\n } else if (typeof virtualNode.type === 'function') {\n newEl = document.createElement('div')\n ; (newEl as HTMLElement).innerText = `FATAL ERROR: ${virtualNode.type._error}`\n } else if ( // SVG support\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) { // SVG support\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n renderer.setAttributes(virtualNode, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n // TODO: FIX me\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n handleLifecycleEventsForOnMount(newEl as HTMLElement)\n }\n } catch (e) {\n console.error('Fatal error! Error happend while rendering the VDOM!', e, virtualNode);\n throw e;\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element, virtualNode: VNode<VNodeAttributes>) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return // if not set, ignore\n\n // TODO: use DANGROUSLY_SET_INNER_HTML_ATTRIBUTE here\n if (name === 'dangerouslySetInnerHTML') return; // special case, handled elsewhere\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement // update ref\n return; // but do not render the ref as a string [object Object] into the DOM\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ; (domElement as any).$onMount = value // DOM event lifecycle hook\n }\n\n if (eventName === 'unmount') {\n ; (domElement as any).$onUnmount = value // DOM event lifecycle hook\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React JSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n // SVG support\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ; (domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ; (domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (virtualNode: VNode<VNodeAttributes>, domElement: Element) => {\n const attrNames = Object.keys(virtualNode.attributes!)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], virtualNode.attributes![attrNames[i]], domElement, virtualNode)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n let renderResult: Array<Element | Text | undefined> | Element | Text | undefined\n\n if (typeof virtualNode === 'string') {\n renderResult = getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n } else {\n renderResult = getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n }\n return renderResult;\n}\n\n// --- JSX standard (necessary exports for jsx-runtime)\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = (\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n key?: string,\n allChildrenAreStatic?: boolean,\n sourceInfo?: string,\n selfReference?: any,\n): Array<VNode> | VNode => {\n let renderResult: Array<VNode> | VNode;\n try {\n renderResult = jsx(type, attributes, key);\n } catch (error) {\n console.error(\"JSX error:\", error, 'in', sourceInfo, 'component', selfReference);\n }\n return renderResult!;\n}\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};","import { getByPath, setByPath } from '../common/index.js';\n\nexport type Listener<T> = (newValue: T, oldValue?: T, changedKey?: string) => void;\n\nexport interface Store<T> {\n value: T;\n get: <D = T>(path?: string) => D;\n set: <D = T>(pathOrValue: string | D, value?: D) => void;\n subscribe: (listener: Listener<T>) => () => void;\n}\n\nexport const createStore = <T>(initialValue: T): Store<T> => {\n let value: T = initialValue; // internal state\n const listeners: Array<Listener<T>> = [];\n\n const notify = (oldValue: T, changedKey?: string) => {\n listeners.forEach(listener => listener(value, oldValue, changedKey));\n };\n\n return {\n // allow reading value but prevent external mutation\n get value() {\n return value;\n },\n\n get(path?: string) {\n return path ? getByPath(value, path) : value;\n },\n\n set(pathOrValue: string | any, newValue?: any) {\n const oldValue = value;\n\n if (newValue === undefined) {\n // replace entire store value\n if (oldValue !== pathOrValue) {\n value = pathOrValue;\n notify(oldValue);\n }\n } else {\n // update a specific path\n const updatedValue = setByPath(value, pathOrValue, newValue);\n if (oldValue !== updatedValue) {\n value = updatedValue;\n notify(oldValue, pathOrValue);\n }\n }\n },\n\n subscribe(listener) {\n listeners.push(listener);\n return () => {\n const index = listeners.indexOf(listener);\n if (index >= 0) listeners.splice(index, 1);\n };\n },\n };\n};\n","import type { Ref, RefUpdateFn } from '../render/types.js';\nimport { createStore } from '../store/store.js';\n\nexport const isRef = (obj: any): obj is Ref<Element> =>\n obj && typeof obj === \"object\" && \"current\" in obj;\n\nexport function createRef<ST = any, NT extends Node | Element | Text | null = HTMLElement>(refUpdateFn?: RefUpdateFn<ST>, defaultState?: ST): Ref<NT, ST> {\n\n const stateStore = createStore<ST>(defaultState as ST);\n\n const ref: Ref<NT, ST> = {\n current: null as NT,\n store: stateStore,\n get state() {\n return stateStore.value;\n },\n set state(value: ST) {\n stateStore.set(value);\n },\n update: (state: ST) => {\n stateStore.set(state);\n },\n subscribe: (refUpdateFn: RefUpdateFn<ST>) => stateStore.subscribe(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;AAClD,OAAO;AACP;AACA,GAAG;AACH;;ACrCY,MAAC,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI;AACtE,SAAS,SAAS,CAAC,WAAW,EAAE,YAAY,EAAE;AACrD,EAAE,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC;AAC9C,EAAE,MAAM,GAAG,GAAG;AACd,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,KAAK,EAAE,UAAU;AACrB,IAAI,IAAI,KAAK,GAAG;AAChB,MAAM,OAAO,UAAU,CAAC,KAAK;AAC7B,KAAK;AACL,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;AACrB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,EAAE,CAAC,KAAK,KAAK;AACvB,MAAM,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,KAAK;AACL,IAAI,SAAS,EAAE,CAAC,YAAY,KAAK,UAAU,CAAC,SAAS,CAAC,YAAY;AAClE,GAAG;AACH,EAAE,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;AACzC,IAAI,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC;AAC9B;AACA,EAAE,OAAO,GAAG;AACZ;;;;"}
@@ -1236,7 +1236,11 @@ interface DequeryOptions {
1236
1236
  maxWaitMs: number;
1237
1237
  }
1238
1238
  declare const defaultConfig: DequeryOptions;
1239
- declare const dequery: (selectorRefOrEl: Node | Element | Text | Ref<Node | Element | Text, any> | string, options?: DequeryOptions) => Dequery;
1239
+ type ElementCreationOptions = JSX.HTMLAttributesLowerCase & JSX.HTMLAttributesLowerCase & {
1240
+ innerHTML?: string;
1241
+ textContent?: string;
1242
+ };
1243
+ declare const dequery: (selectorRefOrEl: Node | Element | Text | Ref<Node | Element | Text, any> | string, options?: DequeryOptions | ElementCreationOptions) => Dequery;
1240
1244
  declare class Dequery {
1241
1245
  options: DequeryOptions;
1242
1246
  elements: Array<NodeType>;
@@ -1263,7 +1267,7 @@ declare class Dequery {
1263
1267
  text(text?: string): Dequery;
1264
1268
  remove(): Dequery;
1265
1269
  replaceWithJsx(vdomOrNode: RenderInput | NodeType): Dequery;
1266
- append(content: string | NodeType): Dequery;
1270
+ append(content: string | NodeType | Dequery): Dequery;
1267
1271
  on(eventName: string, handler: EventListener): Dequery;
1268
1272
  off(eventName: string, handler: EventListener): Dequery;
1269
1273
  css(cssProps: string): string | undefined;
@@ -1271,7 +1275,7 @@ declare class Dequery {
1271
1275
  css(cssProps: string, value: string): Dequery;
1272
1276
  addClass(className: Array<string> | string): Dequery;
1273
1277
  removeClass(className: Array<string> | string): Dequery;
1274
- hasClass(className: string): Dequery;
1278
+ hasClass(className: string): boolean;
1275
1279
  toggleClass(className: string): Dequery;
1276
1280
  animateClass(className: string, duration: number): Dequery;
1277
1281
  click(): Dequery;
@@ -1287,7 +1291,7 @@ declare class Dequery {
1287
1291
  form(): FormKeyValues;
1288
1292
  form(formData: FormKeyValues): Dequery;
1289
1293
  }
1290
- declare const $: (selectorRefOrEl: Node | Element | Text | Ref<Node | Element | Text, any> | string, options?: DequeryOptions) => Dequery;
1294
+ declare const $: (selectorRefOrEl: Node | Element | Text | Ref<Node | Element | Text, any> | string, options?: DequeryOptions | ElementCreationOptions) => Dequery;
1291
1295
 
1292
1296
  declare const createInPlaceErrorMessageVNode: (error: unknown) => {
1293
1297
  type: string;
@@ -1307,4 +1311,4 @@ declare const jsxDEV: (type: VNodeType | Function | any, attributes: (JSX.HTMLAt
1307
1311
  declare const isRef: (obj: any) => obj is Ref<Element>;
1308
1312
  declare function createRef<ST = any, NT extends Node | Element | Text | null = HTMLElement>(refUpdateFn?: RefUpdateFn<ST>, defaultState?: ST): Ref<NT, ST>;
1309
1313
 
1310
- export { $, createRef as A, type FormFieldValue as B, type CSSProperties as C, Dequery as D, type FormKeyValues as E, type FontFaceProperties as F, type Globals as G, type DequeryOptions as H, defaultConfig as I, dequery as J, type KeyFrameProperties as K, type Listener as L, createStore as M, type NodeType as N, type Props as P, type RenderInput as R, type Store as S, type VAttributes as V, type RenderResult as a, type RefUpdateFn as b, type Ref as c, type VNodeAttributes as d, type VNode as e, type VNodeType as f, type VNodeKey as g, type VNodeRefObject as h, type VNodeRefCallback as i, type VNodeRef as j, type VNodeChild as k, type VNodeChildren as l, type Children as m, type DomAbstractionImpl as n, type RenderNodeInput as o, type RenderResultNode as p, createInPlaceErrorMessageVNode as q, jsx as r, observeUnmount as s, handleLifecycleEventsForOnMount as t, getRenderer as u, renderIsomorphic as v, Fragment as w, jsxs as x, jsxDEV as y, isRef as z };
1314
+ export { $, createRef as A, type FormFieldValue as B, type CSSProperties as C, Dequery as D, type FormKeyValues as E, type FontFaceProperties as F, type Globals as G, type DequeryOptions as H, defaultConfig as I, type ElementCreationOptions as J, type KeyFrameProperties as K, dequery as L, type Listener as M, type NodeType as N, createStore as O, type Props as P, type RenderInput as R, type Store as S, type VAttributes as V, type RenderResult as a, type RefUpdateFn as b, type Ref as c, type VNodeAttributes as d, type VNode as e, type VNodeType as f, type VNodeKey as g, type VNodeRefObject as h, type VNodeRefCallback as i, type VNodeRef as j, type VNodeChild as k, type VNodeChildren as l, type Children as m, type DomAbstractionImpl as n, type RenderNodeInput as o, type RenderResultNode as p, createInPlaceErrorMessageVNode as q, jsx as r, observeUnmount as s, handleLifecycleEventsForOnMount as t, getRenderer as u, renderIsomorphic as v, Fragment as w, jsxs as x, jsxDEV as y, isRef as z };
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var I=Object.defineProperty;var o=(t,e)=>I(t,"name",{value:e,configurable:!0});var h=require("./index-B8vV328V.cjs");const H=!0,C=o((t,e)=>{if(t===e)return!0;if(t.nodeType!==e.nodeType)return!1;if(t.nodeType===Node.ELEMENT_NODE){const r=t,s=e;if(r.tagName!==s.tagName)return!1;const n=r.attributes,i=s.attributes;if(n.length!==i.length)return!1;for(let c=0;c<n.length;c++){const l=n[c],u=s.getAttribute(l.name);if(l.value!==u)return!1}}return!(t.nodeType===Node.TEXT_NODE&&t.textContent!==e.textContent)},"areDomNodesEqual"),v=o((t,e)=>{if(!C(t,e)){t.parentNode?.replaceChild(e.cloneNode(!0),t);return}if(t.nodeType===Node.ELEMENT_NODE){const r=t.childNodes,s=e.childNodes,n=Math.max(r.length,s.length);for(let i=0;i<n;i++){const c=r[i],l=s[i];c&&l?v(c,l):l&&!c?t.appendChild(l.cloneNode(!0)):c&&!l&&t.removeChild(c)}}},"updateNode"),T=o((t,e)=>{const s=new DOMParser().parseFromString(e,"text/html"),n=Array.from(s.body.children);if(n.length===0){console.warn("No root elements found in the new HTML.");return}for(let i=0;i<n.length;i++){const c=n[i],l=t.children[i];l?v(l,c):t.appendChild(c.cloneNode(!0))}for(;t.children.length>n.length;)t.removeChild(t.lastChild)},"updateDom");function A(t){if(t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="object"&&"type"in t)return t}o(A,"toValidChild");function N(t,e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return t.nodeType===Node.TEXT_NODE;if(e&&typeof e=="object"){if(t.nodeType!==Node.ELEMENT_NODE)return!1;const r=t.tagName.toLowerCase(),s=e.type.toLowerCase();return r===s}return!1}o(N,"areNodeAndChildMatching");function B(t,e,r){const s=h.getRenderer(r.window.document);if(typeof e=="string"||typeof e=="number"||typeof e=="boolean"){const n=String(e);t.nodeValue!==n&&(t.nodeValue=n);return}if(t.nodeType===Node.ELEMENT_NODE&&e&&typeof e=="object"){const n=t,i=Array.from(n.attributes);for(const c of i){const{name:l}=c;!Object.prototype.hasOwnProperty.call(e.attributes,l)&&l!=="style"&&n.removeAttribute(l)}if(s.setAttributes(e,n),e.attributes?.dangerouslySetInnerHTML){n.innerHTML=e.attributes.dangerouslySetInnerHTML.__html;return}if(e.children)b(n,e.children,r);else for(;n.firstChild;)n.removeChild(n.firstChild)}}o(B,"patchDomInPlace");function _(t,e){const r=h.getRenderer(e.window.document);if(t==null)return;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return e.window.document.createTextNode(String(t));let s=r.createElementOrElements(t);return s&&!Array.isArray(s)&&(s=[s]),s}o(_,"createDomFromChild");function b(t,e,r){console.log("updateDomWithVdom",e,t);let s=[];if(Array.isArray(e))s=e.map(A).filter(l=>l!==void 0);else if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")s=[e];else if(e){const l=A(e);l!==void 0&&(s=[l])}console.log("new children to render!",s);const n=s.map(l=>_(l,r)),i=Array.from(t.childNodes),c=Math.max(i.length,n.length);for(let l=0;l<c;l++){const u=i[l],f=n[l],p=s[l];if(u&&f!==void 0)if(Array.isArray(f))if(f.length===0)t.removeChild(u);else{const m=f[0];t.replaceChild(m,u),typeof m<"u"&&h.handleLifecycleEventsForOnMount(m);for(let d=1;d<f.length;d++)f[d]&&(t.insertBefore(f[d],m.nextSibling),typeof f[d]<"u"&&(console.log("inserBefore!"),h.handleLifecycleEventsForOnMount(f[d])))}else f&&(p&&N(u,p)?B(u,p,r):(t.replaceChild(f,u),h.handleLifecycleEventsForOnMount(f)));else!u&&f!==void 0?Array.isArray(f)?f.forEach(m=>{const d=m&&t.appendChild(m);return d&&h.handleLifecycleEventsForOnMount(m),d}):f&&(t.appendChild(f),h.handleLifecycleEventsForOnMount(f)):u&&f===void 0&&t.removeChild(u)}}o(b,"updateDomWithVdom");function j(t,e,r){for(;t.firstChild;)t.removeChild(t.firstChild);const n=h.getRenderer(r.window.document).createElementOrElements(e);if(Array.isArray(n))for(const i of n)i&&t.appendChild(i);else n&&t.appendChild(n)}o(j,"replaceDomWithVdom");const a=o(t=>{if(t instanceof HTMLElement)return t;let e="Expected an HTMLElement, but found: ";throw t?.nodeName?e+=t.nodeName:e+=t,new Error(e)},"elementGuard"),g={maxWaitMs:1e3},L=o((t,e=g)=>{if(!t)throw console.error("dequery: selector, ref, or element is required. Got nothing."),new Error("dequery: selector, ref, or element is required. Got nothing.");const r=new x({...g,...e});return typeof t=="string"?r.query(t):h.isRef(t)?r.elements=[t.current]:t.nodeType===Node.ELEMENT_NODE&&(r.elements=[t]),a(r.el),r},"dequery");class x{static{o(this,"Dequery")}constructor(e=g,r=[]){this.options=e,this.elements=r,this.options={...g,...e},this.elements=[]}get el(){return this.elements[0]}tap(e){return e(this.elements),this}query(e){return console.log("querying",e),this.elements=Array.from(document.querySelectorAll(e)),this}first(){return this.elements=[this.el],this}last(){const e=this.elements;return this.elements=[e[e.length-1]],this}next(){return this.elements=this.elements.map(e=>a(e).nextElementSibling).filter(Boolean),this}eq(e){return this.elements=[this.elements[e]],this}prev(){return this.elements=this.elements.map(e=>a(e).previousElementSibling).filter(Boolean),this}each(e){return this.elements.forEach(e),this}find(e){return this.elements=this.elements.flatMap(r=>Array.from(a(r).querySelectorAll(e))),this}parent(){return this.elements=this.elements.map(e=>e.parentElement).filter(Boolean),this}children(){return this.elements=this.elements.flatMap(e=>Array.from(a(e).children)),this}closest(e){return this.elements=this.elements.map(r=>a(r).closest(e)).filter(Boolean),this}filter(e){return this.elements=this.elements.filter(r=>a(r).matches(e)),this}attr(e,r){return r!==void 0?(this.elements.forEach(s=>a(s).setAttribute(e,r)),this):a(this.el)?.getAttribute(e)??null}empty(){return this.elements.forEach(e=>{a(e).innerHTML=""}),this}html(e){return e&&this.elements.forEach(r=>{T(a(r),e)}),this}jsx(e){return this.elements.forEach(r=>{b(a(r),e,globalThis)}),this}text(e){return e&&this.elements.forEach(r=>{a(r).textContent=e}),this}remove(){return this.elements.forEach(e=>a(e).remove()),this}replaceWithJsx(e){return this.elements.forEach(r=>{const s=e instanceof Node?e:h.renderIsomorphic(e,a(r),globalThis);r.parentNode?.replaceChild(s.cloneNode(!0),r)}),this}append(e){return this.elements.forEach(r=>{typeof e=="string"?a(r).innerHTML+=e:r.appendChild(e)}),this}on(e,r){return this.elements.forEach(s=>s.addEventListener(e,r)),this}off(e,r){return this.elements.forEach(s=>s.removeEventListener(e,r)),this}css(e,r){return!r&&typeof e=="string"?a(this.el)?.style.getPropertyValue(e):!r&&typeof e=="object"?(this.elements.forEach(s=>{for(const n in e)a(s).style.setProperty(n,e[n])}),this):typeof r=="string"&&typeof e=="string"?(this.elements.forEach(s=>{a(s).style.setProperty(e,r)}),this):this}addClass(e){const r=Array.isArray(e)?e:[e];return this.elements.forEach(s=>a(s).classList.add(...r)),this}removeClass(e){const r=Array.isArray(e)?e:[e];return this.elements.forEach(s=>a(s).classList.remove(...r)),this}hasClass(e){const r=this.elements.every(s=>a(s).classList.contains(e));return console.log(`Has class "${e}":`,r),this}toggleClass(e){return this.elements.forEach(r=>a(r).classList.toggle(e)),this}animateClass(e,r){return this.elements.forEach(s=>{a(s).classList.add(e),setTimeout(()=>a(s).classList.remove(e),r)}),this}click(){return this.elements.forEach(e=>a(e).click()),this}focus(){return this.elements.forEach(e=>a(e).focus()),this}blur(){return this.elements.forEach(e=>a(e).blur()),this}val(e){return typeof e<"u"?(this.elements.forEach(r=>{r instanceof HTMLInputElement&&(r.value=String(e))}),this):a(this.el)?.value}map(e){return this.elements.map(e)}prop(e,r){return typeof r<"u"?(this.elements.forEach(s=>{a(s)[e]=r}),this):a(this.el)[e]}data(e,r){return typeof r<"u"?(this.elements.forEach(s=>{a(s).dataset[e]=r}),this):a(this.el)?.dataset[e]}form(e){if(e)return Object.entries(e).forEach(([s,n])=>{this.elements.forEach(i=>{i instanceof HTMLInputElement&&(i.value=n)})}),this;const r={};return this.elements.forEach(s=>{s instanceof HTMLInputElement&&(r[s.name]=s.value)}),r}}const R=L,F=o(()=>{const t=new Map;return{clear:o(()=>{t.clear()},"clear"),getItem:o(e=>t.get(String(e))??null,"getItem"),removeItem:o(e=>{t.delete(String(e))},"removeItem"),setItem:o((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),O=F();class E{static{o(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||O}get(e,r,s){const n=this.storage.getItem(e);if(n===null)return r;let i=JSON.parse(n);return s&&(i=s(e,i)),i}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const k=o((t,e)=>{switch(t){case"session":return new E(window.sessionStorage);case"local":return new E(window.localStorage)}return new E},"getPersistenceProvider$1"),V=o((t,e)=>new E,"getPersistenceProvider"),W=o(()=>typeof window>"u"||typeof window.document>"u","isServer"),$=o((t="local",e)=>W()?V():k(t),"webstorage"),G=/{([^}]*)}/g,J=o((t,e)=>t.replace(G,(r,s)=>e[s]||`{${s}}`),"interpolate"),S=o(()=>{const t=h.createStore({});let e="en";const r=[];return{language:e,changeLanguage(s){e=s,r.forEach(n=>n(s))},t(s,n={}){const i=t.get(`${e}.${s}`)||s;return typeof i!="string"?i:J(i,n)},load(s,n){t.set(s,{...t.get(s),...n})},subscribe(s){return r.push(s),()=>{const n=r.indexOf(s);n>=0&&r.splice(n,1)}}}},"createI18n"),w=S(),U=o(({path:t,replacements:e,tag:r,...s})=>{const n={};return w.subscribe(()=>{const i=w.t(t,e);console.log("new val",i)}),{tag:r||"span",attributes:{ref:n,...s},children:w.t(t,e)}},"Trans");class y{static{o(this,"Headers")}map;constructor(e={}){this.map=new Map,e instanceof y?e.forEach((r,s)=>this.map.set(s,r)):Object.entries(e).forEach(([r,s])=>this.map.set(r.toLowerCase(),s))}append(e,r){this.map.set(e.toLowerCase(),r)}get(e){return this.map.get(e.toLowerCase())||null}has(e){return this.map.has(e.toLowerCase())}forEach(e){this.map.forEach((r,s)=>e(r,s))}}class M extends EventTarget{static{o(this,"ProgressSignal")}_progress;constructor(){super(),this._progress={loaded:0,total:0}}get progress(){return this._progress}dispatchProgress(e){this._progress={loaded:e.loaded,total:e.total},this.dispatchEvent(new ProgressEvent("progress",{loaded:e.loaded,total:e.total}))}}class K{static{o(this,"ProgressController")}signal;constructor(){this.signal=new M}}function P(t){return t?t instanceof FormData||t instanceof Blob||t instanceof URLSearchParams||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t):null}o(P,"serializeBody");function q(t){const e=new y;return t.split(`\r
2
- `).forEach(r=>{const[s,...n]=r.split(": ");s&&e.append(s,n.join(": "))}),e}o(q,"parseHeaders");async function D(t,e={}){return!e.progressSignal&&typeof globalThis.fetch=="function"?D(t,e):new Promise((r,s)=>{const n=new XMLHttpRequest,i=(e.method||"GET").toUpperCase(),c=P(e.body||null),l=e.progressSignal,u=e.signal;if(u){const f=o(()=>{n.abort(),s(new DOMException("The operation was aborted.","AbortError"))},"abortHandler");u.addEventListener("abort",f,{once:!0})}n.open(i,t.toString(),!0),e.credentials==="include"?n.withCredentials=!0:e.credentials==="omit"&&(n.withCredentials=!1),e.headers instanceof y?e.headers.forEach((f,p)=>n.setRequestHeader(p,f)):e.headers&&Object.entries(e.headers).forEach(([f,p])=>{n.setRequestHeader(f,p)}),l&&(n.upload&&(n.upload.onprogress=f=>l.dispatchProgress(f)),n.onprogress=f=>l.dispatchProgress(f)),n.onload=()=>{const f={ok:n.status>=200&&n.status<300,status:n.status,statusText:n.statusText,headers:q(n.getAllResponseHeaders()),url:n.responseURL,text:o(()=>Promise.resolve(n.responseText),"text"),json:o(()=>Promise.resolve(JSON.parse(n.responseText)),"json"),blob:o(()=>Promise.resolve(new Blob([n.response])),"blob")};r(f)},n.onerror=()=>s(new TypeError("Network request failed")),n.ontimeout=()=>s(new TypeError("Network request timed out")),n.onabort=()=>s(new DOMException("The operation was aborted.","AbortError")),n.send(c)})}o(D,"fetch"),exports.Fragment=h.Fragment,exports.createInPlaceErrorMessageVNode=h.createInPlaceErrorMessageVNode,exports.createRef=h.createRef,exports.createStore=h.createStore,exports.ensureKey=h.ensureKey,exports.getAllKeysFromPath=h.getAllKeysFromPath,exports.getByPath=h.getByPath,exports.getRenderer=h.getRenderer,exports.handleLifecycleEventsForOnMount=h.handleLifecycleEventsForOnMount,exports.isRef=h.isRef,exports.jsx=h.jsx,exports.jsxDEV=h.jsxDEV,exports.jsxs=h.jsxs,exports.observeUnmount=h.observeUnmount,exports.renderIsomorphic=h.renderIsomorphic,exports.setByPath=h.setByPath,exports.$=R,exports.Dequery=x,exports.Headers=y,exports.ProgressController=K,exports.ProgressSignal=M,exports.Trans=U,exports.areDomNodesEqual=C,exports.createI18n=S,exports.defaultConfig=g,exports.dequery=L,exports.fetch=D,exports.i18n=w,exports.inDevMode=H,exports.parseHeaders=q,exports.replaceDomWithVdom=j,exports.serializeBody=P,exports.updateDom=T,exports.updateDomWithVdom=b,exports.webstorage=$;
1
+ "use strict";var H=Object.defineProperty;var i=(t,e)=>H(t,"name",{value:e,configurable:!0});var c=require("./index-B8vV328V.cjs");const I=!0,T=i((t,e)=>{if(t===e)return!0;if(t.nodeType!==e.nodeType)return!1;if(t.nodeType===Node.ELEMENT_NODE){const r=t,s=e;if(r.tagName!==s.tagName)return!1;const n=r.attributes,o=s.attributes;if(n.length!==o.length)return!1;for(let h=0;h<n.length;h++){const a=n[h],u=s.getAttribute(a.name);if(a.value!==u)return!1}}return!(t.nodeType===Node.TEXT_NODE&&t.textContent!==e.textContent)},"areDomNodesEqual"),v=i((t,e)=>{if(!T(t,e)){t.parentNode?.replaceChild(e.cloneNode(!0),t);return}if(t.nodeType===Node.ELEMENT_NODE){const r=t.childNodes,s=e.childNodes,n=Math.max(r.length,s.length);for(let o=0;o<n;o++){const h=r[o],a=s[o];h&&a?v(h,a):a&&!h?t.appendChild(a.cloneNode(!0)):h&&!a&&t.removeChild(h)}}},"updateNode"),A=i((t,e)=>{const s=new DOMParser().parseFromString(e,"text/html"),n=Array.from(s.body.children);if(n.length===0){console.warn("No root elements found in the new HTML.");return}for(let o=0;o<n.length;o++){const h=n[o],a=t.children[o];a?v(a,h):t.appendChild(h.cloneNode(!0))}for(;t.children.length>n.length;)t.removeChild(t.lastChild)},"updateDom");function L(t){if(t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="object"&&"type"in t)return t}i(L,"toValidChild");function N(t,e){if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return t.nodeType===Node.TEXT_NODE;if(e&&typeof e=="object"){if(t.nodeType!==Node.ELEMENT_NODE)return!1;const r=t.tagName.toLowerCase(),s=e.type.toLowerCase();return r===s}return!1}i(N,"areNodeAndChildMatching");function B(t,e,r){const s=c.getRenderer(r.window.document);if(typeof e=="string"||typeof e=="number"||typeof e=="boolean"){const n=String(e);t.nodeValue!==n&&(t.nodeValue=n);return}if(t.nodeType===Node.ELEMENT_NODE&&e&&typeof e=="object"){const n=t,o=Array.from(n.attributes);for(const h of o){const{name:a}=h;!Object.prototype.hasOwnProperty.call(e.attributes,a)&&a!=="style"&&n.removeAttribute(a)}if(s.setAttributes(e,n),e.attributes?.dangerouslySetInnerHTML){n.innerHTML=e.attributes.dangerouslySetInnerHTML.__html;return}if(e.children)b(n,e.children,r);else for(;n.firstChild;)n.removeChild(n.firstChild)}}i(B,"patchDomInPlace");function j(t,e){const r=c.getRenderer(e.window.document);if(t==null)return;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return e.window.document.createTextNode(String(t));let s=r.createElementOrElements(t);return s&&!Array.isArray(s)&&(s=[s]),s}i(j,"createDomFromChild");function b(t,e,r){console.log("updateDomWithVdom",e,t);let s=[];if(Array.isArray(e))s=e.map(L).filter(a=>a!==void 0);else if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")s=[e];else if(e){const a=L(e);a!==void 0&&(s=[a])}console.log("new children to render!",s);const n=s.map(a=>j(a,r)),o=Array.from(t.childNodes),h=Math.max(o.length,n.length);for(let a=0;a<h;a++){const u=o[a],f=n[a],d=s[a];if(u&&f!==void 0)if(Array.isArray(f))if(f.length===0)t.removeChild(u);else{const p=f[0];t.replaceChild(p,u),typeof p<"u"&&c.handleLifecycleEventsForOnMount(p);for(let m=1;m<f.length;m++)f[m]&&(t.insertBefore(f[m],p.nextSibling),typeof f[m]<"u"&&(console.log("inserBefore!"),c.handleLifecycleEventsForOnMount(f[m])))}else f&&(d&&N(u,d)?B(u,d,r):(t.replaceChild(f,u),c.handleLifecycleEventsForOnMount(f)));else!u&&f!==void 0?Array.isArray(f)?f.forEach(p=>{const m=p&&t.appendChild(p);return m&&c.handleLifecycleEventsForOnMount(p),m}):f&&(t.appendChild(f),c.handleLifecycleEventsForOnMount(f)):u&&f===void 0&&t.removeChild(u)}}i(b,"updateDomWithVdom");function _(t,e,r){for(;t.firstChild;)t.removeChild(t.firstChild);const n=c.getRenderer(r.window.document).createElementOrElements(e);if(Array.isArray(n))for(const o of n)o&&t.appendChild(o);else n&&t.appendChild(n)}i(_,"replaceDomWithVdom");const l=i(t=>{if(t instanceof HTMLElement)return t;let e="Expected an HTMLElement, but found: ";throw t?.nodeName?e+=t.nodeName:e+=t,new Error(e)},"elementGuard"),g={maxWaitMs:1e3},x=i((t,e=g)=>{if(!t)throw console.error("dequery: selector, ref, or element is required. Got nothing."),new Error("dequery: selector, ref, or element is required. Got nothing.");const r=new C({...g,...e});if(typeof t=="string"){const s=/^<(\w+)>$/,n=t.match(s);if(n){const o=document.createElement(n[1]),{innerHTML:h,textContent:a,...u}=e;Object.entries(u).forEach(([f,d])=>{o.setAttribute(f,String(d))}),h?o.innerHTML=h:a&&(o.textContent=a),r.elements=[o]}else r.query(t)}else c.isRef(t)?r.elements=[t.current]:t.nodeType===Node.ELEMENT_NODE&&(r.elements=[t]);return l(r.el),r},"dequery");class C{static{i(this,"Dequery")}constructor(e=g,r=[]){this.options=e,this.elements=r,this.options={...g,...e},this.elements=[]}get el(){return this.elements[0]}tap(e){return e(this.elements),this}query(e){return console.log("querying",e),this.elements=Array.from(document.querySelectorAll(e)),this}first(){return this.elements=[this.el],this}last(){const e=this.elements;return this.elements=[e[e.length-1]],this}next(){return this.elements=this.elements.map(e=>l(e).nextElementSibling).filter(Boolean),this}eq(e){return this.elements=[this.elements[e]],this}prev(){return this.elements=this.elements.map(e=>l(e).previousElementSibling).filter(Boolean),this}each(e){return this.elements.forEach(e),this}find(e){return this.elements=this.elements.flatMap(r=>Array.from(l(r).querySelectorAll(e))),this}parent(){return this.elements=this.elements.map(e=>e.parentElement).filter(Boolean),this}children(){return this.elements=this.elements.flatMap(e=>Array.from(l(e).children)),this}closest(e){return this.elements=this.elements.map(r=>l(r).closest(e)).filter(Boolean),this}filter(e){return this.elements=this.elements.filter(r=>l(r).matches(e)),this}attr(e,r){return r!==void 0?(this.elements.forEach(s=>l(s).setAttribute(e,r)),this):l(this.el)?.getAttribute(e)??null}empty(){return this.elements.forEach(e=>{l(e).innerHTML=""}),this}html(e){return e&&this.elements.forEach(r=>{A(l(r),e)}),this}jsx(e){return this.elements.forEach(r=>{b(l(r),e,globalThis)}),this}text(e){return e&&this.elements.forEach(r=>{l(r).textContent=e}),this}remove(){return this.elements.forEach(e=>l(e).remove()),this}replaceWithJsx(e){return this.elements.forEach(r=>{const s=e instanceof Node?e:c.renderIsomorphic(e,l(r),globalThis);r.parentNode?.replaceChild(s.cloneNode(!0),r)}),this}append(e){return this.elements.forEach(r=>{typeof e=="string"?l(r).innerHTML+=e:e instanceof C?e.elements.forEach(s=>{r.appendChild(l(s))}):r.appendChild(e)}),this}on(e,r){return this.elements.forEach(s=>s.addEventListener(e,r)),this}off(e,r){return this.elements.forEach(s=>s.removeEventListener(e,r)),this}css(e,r){return!r&&typeof e=="string"?l(this.el)?.style.getPropertyValue(e):!r&&typeof e=="object"?(this.elements.forEach(s=>{for(const n in e)l(s).style.setProperty(n,e[n])}),this):typeof r=="string"&&typeof e=="string"?(this.elements.forEach(s=>{l(s).style.setProperty(e,r)}),this):this}addClass(e){const r=Array.isArray(e)?e:[e];return this.elements.forEach(s=>l(s).classList.add(...r)),this}removeClass(e){const r=Array.isArray(e)?e:[e];return this.elements.forEach(s=>l(s).classList.remove(...r)),this}hasClass(e){return this.elements.every(r=>l(r).classList.contains(e))}toggleClass(e){return this.elements.forEach(r=>l(r).classList.toggle(e)),this}animateClass(e,r){return this.elements.forEach(s=>{l(s).classList.add(e),setTimeout(()=>l(s).classList.remove(e),r)}),this}click(){return this.elements.forEach(e=>l(e).click()),this}focus(){return this.elements.forEach(e=>l(e).focus()),this}blur(){return this.elements.forEach(e=>l(e).blur()),this}val(e){return typeof e<"u"?(this.elements.forEach(r=>{r instanceof HTMLInputElement&&(r.value=String(e))}),this):l(this.el)?.value}map(e){return this.elements.map(e)}prop(e,r){return typeof r<"u"?(this.elements.forEach(s=>{l(s)[e]=r}),this):l(this.el)[e]}data(e,r){return typeof r<"u"?(this.elements.forEach(s=>{l(s).dataset[e]=r}),this):l(this.el)?.dataset[e]}form(e){if(e)return Object.entries(e).forEach(([s,n])=>{this.elements.forEach(o=>{o instanceof HTMLInputElement&&(o.value=n)})}),this;const r={};return this.elements.forEach(s=>{s instanceof HTMLInputElement&&(r[s.name]=s.value)}),r}}const R=x,F=i(()=>{const t=new Map;return{clear:i(()=>{t.clear()},"clear"),getItem:i(e=>t.get(String(e))??null,"getItem"),removeItem:i(e=>{t.delete(String(e))},"removeItem"),setItem:i((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),O=F();class E{static{i(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||O}get(e,r,s){const n=this.storage.getItem(e);if(n===null)return r;let o=JSON.parse(n);return s&&(o=s(e,o)),o}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const k=i((t,e)=>{switch(t){case"session":return new E(window.sessionStorage);case"local":return new E(window.localStorage)}return new E},"getPersistenceProvider$1"),V=i((t,e)=>new E,"getPersistenceProvider"),W=i(()=>typeof window>"u"||typeof window.document>"u","isServer"),$=i((t="local",e)=>W()?V():k(t),"webstorage"),G=/{([^}]*)}/g,J=i((t,e)=>t.replace(G,(r,s)=>e[s]||`{${s}}`),"interpolate"),S=i(()=>{const t=c.createStore({});let e="en";const r=[];return{language:e,changeLanguage(s){e=s,r.forEach(n=>n(s))},t(s,n={}){const o=t.get(`${e}.${s}`)||s;return typeof o!="string"?o:J(o,n)},load(s,n){t.set(s,{...t.get(s),...n})},subscribe(s){return r.push(s),()=>{const n=r.indexOf(s);n>=0&&r.splice(n,1)}}}},"createI18n"),w=S(),U=i(({path:t,replacements:e,tag:r,...s})=>{const n={};return w.subscribe(()=>{const o=w.t(t,e);console.log("new val",o)}),{tag:r||"span",attributes:{ref:n,...s},children:w.t(t,e)}},"Trans");class y{static{i(this,"Headers")}map;constructor(e={}){this.map=new Map,e instanceof y?e.forEach((r,s)=>this.map.set(s,r)):Object.entries(e).forEach(([r,s])=>this.map.set(r.toLowerCase(),s))}append(e,r){this.map.set(e.toLowerCase(),r)}get(e){return this.map.get(e.toLowerCase())||null}has(e){return this.map.has(e.toLowerCase())}forEach(e){this.map.forEach((r,s)=>e(r,s))}}class M extends EventTarget{static{i(this,"ProgressSignal")}_progress;constructor(){super(),this._progress={loaded:0,total:0}}get progress(){return this._progress}dispatchProgress(e){this._progress={loaded:e.loaded,total:e.total},this.dispatchEvent(new ProgressEvent("progress",{loaded:e.loaded,total:e.total}))}}class K{static{i(this,"ProgressController")}signal;constructor(){this.signal=new M}}function P(t){return t?t instanceof FormData||t instanceof Blob||t instanceof URLSearchParams||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="string"?t:typeof t=="object"?JSON.stringify(t):String(t):null}i(P,"serializeBody");function q(t){const e=new y;return t.split(`\r
2
+ `).forEach(r=>{const[s,...n]=r.split(": ");s&&e.append(s,n.join(": "))}),e}i(q,"parseHeaders");async function D(t,e={}){return!e.progressSignal&&typeof globalThis.fetch=="function"?D(t,e):new Promise((r,s)=>{const n=new XMLHttpRequest,o=(e.method||"GET").toUpperCase(),h=P(e.body||null),a=e.progressSignal,u=e.signal;if(u){const f=i(()=>{n.abort(),s(new DOMException("The operation was aborted.","AbortError"))},"abortHandler");u.addEventListener("abort",f,{once:!0})}n.open(o,t.toString(),!0),e.credentials==="include"?n.withCredentials=!0:e.credentials==="omit"&&(n.withCredentials=!1),e.headers instanceof y?e.headers.forEach((f,d)=>n.setRequestHeader(d,f)):e.headers&&Object.entries(e.headers).forEach(([f,d])=>{n.setRequestHeader(f,d)}),a&&(n.upload&&(n.upload.onprogress=f=>a.dispatchProgress(f)),n.onprogress=f=>a.dispatchProgress(f)),n.onload=()=>{const f={ok:n.status>=200&&n.status<300,status:n.status,statusText:n.statusText,headers:q(n.getAllResponseHeaders()),url:n.responseURL,text:i(()=>Promise.resolve(n.responseText),"text"),json:i(()=>Promise.resolve(JSON.parse(n.responseText)),"json"),blob:i(()=>Promise.resolve(new Blob([n.response])),"blob")};r(f)},n.onerror=()=>s(new TypeError("Network request failed")),n.ontimeout=()=>s(new TypeError("Network request timed out")),n.onabort=()=>s(new DOMException("The operation was aborted.","AbortError")),n.send(h)})}i(D,"fetch"),exports.Fragment=c.Fragment,exports.createInPlaceErrorMessageVNode=c.createInPlaceErrorMessageVNode,exports.createRef=c.createRef,exports.createStore=c.createStore,exports.ensureKey=c.ensureKey,exports.getAllKeysFromPath=c.getAllKeysFromPath,exports.getByPath=c.getByPath,exports.getRenderer=c.getRenderer,exports.handleLifecycleEventsForOnMount=c.handleLifecycleEventsForOnMount,exports.isRef=c.isRef,exports.jsx=c.jsx,exports.jsxDEV=c.jsxDEV,exports.jsxs=c.jsxs,exports.observeUnmount=c.observeUnmount,exports.renderIsomorphic=c.renderIsomorphic,exports.setByPath=c.setByPath,exports.$=R,exports.Dequery=C,exports.Headers=y,exports.ProgressController=K,exports.ProgressSignal=M,exports.Trans=U,exports.areDomNodesEqual=T,exports.createI18n=S,exports.defaultConfig=g,exports.dequery=x,exports.fetch=D,exports.i18n=w,exports.inDevMode=I,exports.parseHeaders=q,exports.replaceDomWithVdom=_,exports.serializeBody=P,exports.updateDom=A,exports.updateDomWithVdom=b,exports.webstorage=$;
3
3
  //# sourceMappingURL=index.cjs.map