@b9g/crank 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dom.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dom.cjs","sources":["../src/dom.ts"],"sourcesContent":["import {\n\tChildren,\n\tContext,\n\tElementValue,\n\tHydrationData,\n\tPortal,\n\tRenderer,\n\tRendererImpl,\n} from \"./crank.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\n\nexport const impl: Partial<RendererImpl<Node, string>> = {\n\tscope(\n\t\txmlns: string | undefined,\n\t\ttag: string | symbol,\n\t\tprops: Record<string, any>,\n\t): string | undefined {\n\t\tswitch (tag) {\n\t\t\tcase Portal:\n\t\t\t\txmlns = undefined;\n\t\t\t\tbreak;\n\t\t\tcase \"svg\":\n\t\t\t\txmlns = SVG_NAMESPACE;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn props.xmlns || xmlns;\n\t},\n\n\tcreate(\n\t\ttag: string | symbol,\n\t\t_props: unknown,\n\t\txmlns: string | undefined,\n\t): Node {\n\t\tif (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t} else if (tag.toLowerCase() === \"svg\") {\n\t\t\txmlns = SVG_NAMESPACE;\n\t\t}\n\n\t\treturn xmlns\n\t\t\t? document.createElementNS(xmlns, tag)\n\t\t\t: document.createElement(tag);\n\t},\n\n\thydrate(\n\t\ttag: string | symbol,\n\t\tnode: Element,\n\t\tprops: Record<string, unknown>,\n\t): HydrationData<Element> | undefined {\n\t\tif (typeof tag !== \"string\" && tag !== Portal) {\n\t\t\tthrow new Error(`Unknown tag: ${tag.toString()}`);\n\t\t}\n\n\t\tif (\n\t\t\ttypeof tag === \"string\" &&\n\t\t\ttag.toUpperCase() !== (node as Element).tagName\n\t\t) {\n\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t//console.error(`Expected <${tag}> while hydrating but found:`, node);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst children: Array<string | Element> = [];\n\t\tfor (let i = 0; i < node.childNodes.length; i++) {\n\t\t\tconst child = node.childNodes[i];\n\t\t\tif (child.nodeType === Node.TEXT_NODE) {\n\t\t\t\tchildren.push((child as Text).data);\n\t\t\t} else if (child.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tchildren.push(child as Element);\n\t\t\t}\n\t\t}\n\n\t\t// TODO: extract props from nodes\n\t\treturn {props, children};\n\t},\n\n\tpatch(\n\t\t_tag: string | symbol,\n\t\t// TODO: Why does this assignment work?\n\t\tnode: HTMLElement | SVGElement,\n\t\tname: string,\n\t\t// TODO: Stricter typings?\n\t\tvalue: unknown,\n\t\toldValue: unknown,\n\t\txmlns: string | undefined,\n\t): void {\n\t\tconst isSVG = xmlns === SVG_NAMESPACE;\n\t\tconst colonIndex = name.indexOf(\":\");\n\t\tif (colonIndex !== -1) {\n\t\t\tconst ns = name.slice(0, colonIndex);\n\t\t\tconst name1 = name.slice(colonIndex + 1);\n\t\t\tswitch (ns) {\n\t\t\t\tcase \"prop\":\n\t\t\t\t\t(node as any)[name1] = value;\n\t\t\t\t\treturn;\n\t\t\t\tcase \"attr\":\n\t\t\t\t\tif (value == null || value === false) {\n\t\t\t\t\t\tnode.removeAttribute(name1);\n\t\t\t\t\t} else if (value === true) {\n\t\t\t\t\t\tnode.setAttribute(name1, \"\");\n\t\t\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\t\t\tnode.setAttribute(name1, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.setAttribute(name, String(value));\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tswitch (name) {\n\t\t\tcase \"style\": {\n\t\t\t\tconst style: CSSStyleDeclaration = node.style;\n\t\t\t\tif (style == null) {\n\t\t\t\t\tnode.setAttribute(\"style\", value as string);\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(\"style\");\n\t\t\t\t} else if (value === true) {\n\t\t\t\t\tnode.setAttribute(\"style\", \"\");\n\t\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\t\tif (style.cssText !== value) {\n\t\t\t\t\t\tstyle.cssText = value;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof oldValue === \"string\") {\n\t\t\t\t\t\tstyle.cssText = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (const styleName in {...(oldValue as {}), ...(value as {})}) {\n\t\t\t\t\t\tconst styleValue = value && (value as any)[styleName];\n\t\t\t\t\t\tif (styleValue == null) {\n\t\t\t\t\t\t\tstyle.removeProperty(styleName);\n\t\t\t\t\t\t} else if (style.getPropertyValue(styleName) !== styleValue) {\n\t\t\t\t\t\t\tstyle.setProperty(styleName, styleValue);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"class\":\n\t\t\tcase \"className\":\n\t\t\t\tif (value === true) {\n\t\t\t\t\tnode.setAttribute(\"class\", \"\");\n\t\t\t\t} else if (value == null) {\n\t\t\t\t\tnode.removeAttribute(\"class\");\n\t\t\t\t} else if (!isSVG) {\n\t\t\t\t\tif (node.className !== value) {\n\t\t\t\t\t\t(node as any)[\"className\"] = value;\n\t\t\t\t\t}\n\t\t\t\t} else if (node.getAttribute(\"class\") !== value) {\n\t\t\t\t\tnode.setAttribute(\"class\", value as string);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"innerHTML\":\n\t\t\t\tif (value !== oldValue) {\n\t\t\t\t\tnode.innerHTML = value as any;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tif (\n\t\t\t\t\tname[0] === \"o\" &&\n\t\t\t\t\tname[1] === \"n\" &&\n\t\t\t\t\tname[2] === name[2].toUpperCase() &&\n\t\t\t\t\ttypeof value === \"function\"\n\t\t\t\t) {\n\t\t\t\t\t// Support React-style event names (onClick, onChange, etc.)\n\t\t\t\t\tname = name.toLowerCase();\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tname in node &&\n\t\t\t\t\t// boolean properties will coerce strings, but sometimes they map to\n\t\t\t\t\t// enumerated attributes, where truthy strings (\"false\", \"no\") map to\n\t\t\t\t\t// falsy properties, so we use attributes in this case.\n\t\t\t\t\t!(\n\t\t\t\t\t\ttypeof value === \"string\" &&\n\t\t\t\t\t\ttypeof (node as any)[name] === \"boolean\"\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// walk up the object's prototype chain to find the owner of the\n\t\t\t\t\t// named property\n\t\t\t\t\tlet obj = node;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(obj, name)) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while ((obj = Object.getPrototypeOf(obj)));\n\n\t\t\t\t\t// get the descriptor for the named property and check whether it\n\t\t\t\t\t// implies that the property is writable\n\t\t\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(obj, name);\n\t\t\t\t\tif (\n\t\t\t\t\t\tdescriptor != null &&\n\t\t\t\t\t\t(descriptor.writable === true || descriptor.set !== undefined)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((node as any)[name] !== value || oldValue === undefined) {\n\t\t\t\t\t\t\t(node as any)[name] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if the property wasn't writable, fall through to the code below\n\t\t\t\t\t// which uses setAttribute() instead of assigning directly.\n\t\t\t\t}\n\n\t\t\t\tif (value === true) {\n\t\t\t\t\tvalue = \"\";\n\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\tnode.removeAttribute(name);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.getAttribute(name) !== value) {\n\t\t\t\t\tnode.setAttribute(name, value as any);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tarrange(\n\t\ttag: string | symbol,\n\t\tnode: Node,\n\t\tprops: Record<string, any>,\n\t\tchildren: Array<Element | string>,\n\t\t_oldProps: Record<string, any> | undefined,\n\t\toldChildren: Array<Element | string> | undefined,\n\t): void {\n\t\tif (tag === Portal && (node == null || typeof node.nodeType !== \"number\")) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Portal root is not a node. Received: ${JSON.stringify(\n\t\t\t\t\tnode && node.toString(),\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t!(\"innerHTML\" in props) &&\n\t\t\t// We don’t want to update elements without explicit children (<div/>),\n\t\t\t// because these elements sometimes have child nodes added via raw\n\t\t\t// DOM manipulations.\n\t\t\t// However, if an element has previously rendered children, we clear the\n\t\t\t// them because it would be surprising not to clear Crank managed\n\t\t\t// children, even if the new element does not have explicit children.\n\t\t\t(\"children\" in props || (oldChildren && oldChildren.length))\n\t\t) {\n\t\t\tif (children.length === 0) {\n\t\t\t\tnode.textContent = \"\";\n\t\t\t} else {\n\t\t\t\tlet oldChild = node.firstChild;\n\t\t\t\tlet i = 0;\n\t\t\t\twhile (oldChild !== null && i < children.length) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tif (oldChild === newChild) {\n\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (typeof newChild === \"string\") {\n\t\t\t\t\t\tif (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\t\tif ((oldChild as Text).data !== newChild) {\n\t\t\t\t\t\t\t\t(oldChild as Text).data = newChild;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.insertBefore(document.createTextNode(newChild), oldChild);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti++;\n\t\t\t\t\t} else if (oldChild.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.insertBefore(newChild, oldChild);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t\t// TODO: This is an optimization but we need to think a little more about other cases like prepending.\n\t\t\t\t\t\tif (oldChild !== children[i]) {\n\t\t\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// remove excess DOM nodes\n\t\t\t\twhile (oldChild !== null) {\n\t\t\t\t\tconst nextSibling = oldChild.nextSibling;\n\t\t\t\t\tnode.removeChild(oldChild);\n\t\t\t\t\toldChild = nextSibling;\n\t\t\t\t}\n\n\t\t\t\t// append excess children\n\t\t\t\tfor (; i < children.length; i++) {\n\t\t\t\t\tconst newChild = children[i];\n\t\t\t\t\tnode.appendChild(\n\t\t\t\t\t\ttypeof newChild === \"string\"\n\t\t\t\t\t\t\t? document.createTextNode(newChild)\n\t\t\t\t\t\t\t: newChild,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\ttext(\n\t\ttext: string,\n\t\t_scope: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): string {\n\t\tif (hydrationData != null) {\n\t\t\tlet value = hydrationData.children.shift();\n\t\t\tif (typeof value !== \"string\" || !value.startsWith(text)) {\n\t\t\t\t// TODO: consider pros and cons of hydration warnings\n\t\t\t\t//console.error(`Expected \"${text}\" while hydrating but found:`, value);\n\t\t\t} else if (text.length < value.length) {\n\t\t\t\tvalue = value.slice(text.length);\n\t\t\t\thydrationData.children.unshift(value);\n\t\t\t}\n\t\t}\n\n\t\treturn text;\n\t},\n\n\traw(\n\t\tvalue: string | Node,\n\t\txmlns: string | undefined,\n\t\thydrationData: HydrationData<Element> | undefined,\n\t): ElementValue<Node> {\n\t\tlet result: ElementValue<Node>;\n\t\tif (typeof value === \"string\") {\n\t\t\tconst el =\n\t\t\t\txmlns == null\n\t\t\t\t\t? document.createElement(\"div\")\n\t\t\t\t\t: document.createElementNS(xmlns, \"svg\");\n\t\t\tel.innerHTML = value;\n\t\t\tif (el.childNodes.length === 0) {\n\t\t\t\tresult = undefined;\n\t\t\t} else if (el.childNodes.length === 1) {\n\t\t\t\tresult = el.childNodes[0];\n\t\t\t} else {\n\t\t\t\tresult = Array.from(el.childNodes);\n\t\t\t}\n\t\t} else {\n\t\t\tresult = value;\n\t\t}\n\n\t\tif (hydrationData != null) {\n\t\t\t// TODO: maybe we should warn on incorrect values\n\t\t\tif (Array.isArray(result)) {\n\t\t\t\tfor (let i = 0; i < result.length; i++) {\n\t\t\t\t\tconst node = result[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof node !== \"string\" &&\n\t\t\t\t\t\t(node.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\t\t\tnode.nodeType === Node.TEXT_NODE)\n\t\t\t\t\t) {\n\t\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (result != null && typeof result !== \"string\") {\n\t\t\t\tif (\n\t\t\t\t\tresult.nodeType === Node.ELEMENT_NODE ||\n\t\t\t\t\tresult.nodeType === Node.TEXT_NODE\n\t\t\t\t) {\n\t\t\t\t\thydrationData.children.shift();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t},\n};\n\nexport class DOMRenderer extends Renderer<Node, string> {\n\tconstructor() {\n\t\tsuper(impl);\n\t}\n\n\trender(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.render(children, root, ctx);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: Node,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.hydrate(children, root, ctx);\n\t}\n}\n\nfunction validateRoot(root: unknown): asserts root is Node {\n\tif (\n\t\troot === null ||\n\t\t(typeof root === \"object\" && typeof (root as any).nodeType !== \"number\")\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`Render root is not a node. Received: ${JSON.stringify(\n\t\t\t\troot && root.toString(),\n\t\t\t)}`,\n\t\t);\n\t}\n}\n\nexport const renderer = new DOMRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n"],"names":["Portal","Renderer"],"mappings":";;;;AAUA,MAAM,aAAa,GAAG,4BAA4B;AAErC,MAAA,IAAI,GAAwC;AACxD,IAAA,KAAK,CACJ,KAAyB,EACzB,GAAoB,EACpB,KAA0B,EAAA;QAE1B,QAAQ,GAAG;AACV,YAAA,KAAKA,YAAM;gBACV,KAAK,GAAG,SAAS;gBACjB;AACD,YAAA,KAAK,KAAK;gBACT,KAAK,GAAG,aAAa;gBACrB;;AAGF,QAAA,OAAO,KAAK,CAAC,KAAK,IAAI,KAAK;KAC3B;AAED,IAAA,MAAM,CACL,GAAoB,EACpB,MAAe,EACf,KAAyB,EAAA;AAEzB,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,CAAgB,aAAA,EAAA,GAAG,CAAC,QAAQ,EAAE,CAAE,CAAA,CAAC;;AAC3C,aAAA,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;YACvC,KAAK,GAAG,aAAa;;AAGtB,QAAA,OAAO;cACJ,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG;AACrC,cAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;KAC9B;AAED,IAAA,OAAO,CACN,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dapter,\n} from \"./crank.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\n\nfunction isWritableProperty(element: Element, name: string): boolean {\n\t// walk up the object's prototype chain to find the owner\n\tlet propOwner = element;\n\tdo {\n\t\tif (Object.prototype.hasOwnProperty.call(propOwner, name)) {\n\t\t\tbreak;\n\t\t}\n\t} while ((propOwner = Object.getPrototypeOf(propOwner)));\n\n\tif (propOwner === null) {\n\t\treturn false;\n\t}\n\n\t// get the descriptor for the named property and check whether it implies\n\t// that the property is writable\n\tconst descriptor = Object.getOwnPropertyDescriptor(propOwner, name);\n\tif (\n\t\tdescriptor != null &&\n\t\t(descriptor.writable === true || descriptor.set !== undefined)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction emitHydrationWarning(\n\tpropName: string,\n\tquietProps: Set<string> | undefined,\n\texpectedValue: any,\n\tactualValue: any,\n\telement: Element,\n\tdisplayName?: string,\n) {\n\tconst checkName = propName;\n\tconst showName = displayName || propName;\n\tif (!quietProps || !quietProps.has(checkName)) {\n\t\tif (expectedValue === null || expectedValue === false) {\n\t\t\tconsole.warn(\n\t\t\t\t`Expected \"${showName}\" to be missing but found ${String(actualValue)} while hydrating:`,\n\t\t\t\telement,\n\t\t\t);\n\t\t} else if (expectedValue === true || expectedValue === \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`Expected \"${showName}\" to be ${expectedValue === true ? \"present\" : '\"\"'} but found ${String(actualValue)} while hydrating:`,\n\t\t\t\telement,\n\t\t\t);\n\t\t} else if (\n\t\t\ttypeof window !== \"undefined\" &&\n\t\t\twindow.location &&\n\t\t\tnew URL(expectedValue, window.location.origin).href ===\n\t\t\t\tnew URL(actualValue, window.location.origin).href\n\t\t) {\n\t\t\t// attrs which are URLs will often be resolved to their full\n\t\t\t// href in the DOM, so we squash these errors\n\t\t} else {\n\t\t\tconsole.warn(\n\t\t\t\t`Expected \"${showName}\" to be \"${String(expectedValue)}\" but found ${String(actualValue)} while hydrating:`,\n\t\t\t\telement,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport const adapter: Partial<RenderAdapter<Node, string, Element>> = {\n\tscope({\n\t\tscope: xmlns,\n\t\ttag,\n\t\tprops,\n\t}: {\n\t\tscope: string | undefined;\n\t\ttag: string | symbol;\n\t\tprops: Record<string, any>;\n\t}): string | undefined {\n\t\tswitch (tag) {\n\t\t\tcase Portal:\n\t\t\t\t// TODO: read the namespace from the portal root element\n\t\t\t\txmlns = undefined;\n\t\t\t\tbreak;\n\t\t\tcase \"svg\":\n\t\t\t\txmlns = SVG_NAMESPACE;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn props.xmlns || xmlns;\n\t},\n\n\tcreate({\n\t\ttag,\n\t\ttagName,\n\t\tscope: xmlns,\n\t}: {\n\t\ttag: string | symbol;\n\t\ttagName: string;\n\t\tscope: string | undefined;\n\t}): Node {\n\t\tif (typeof tag !== \"string\") {\n\t\t\tthrow new Error(`Unknown tag: ${tagName}`);\n\t\t} else if (tag.toLowerCase() === \"svg\") {\n\t\t\txmlns = SVG_NAMESPACE;\n\t\t}\n\n\t\treturn xmlns\n\t\t\t? document.createElementNS(xmlns, tag)\n\t\t\t: document.createElement(tag);\n\t},\n\n\tadopt({\n\t\ttag,\n\t\ttagName,\n\t\tnode,\n\t}: {\n\t\ttag: string | symbol;\n\t\ttagName: string;\n\t\tnode: Node | undefined;\n\t}): Array<Node> | undefined {\n\t\tif (typeof tag !== \"string\" && tag !== Portal) {\n\t\t\tthrow new Error(`Unknown tag: ${tagName}`);\n\t\t}\n\n\t\tif (\n\t\t\tnode === document.body ||\n\t\t\tnode === document.head ||\n\t\t\tnode === document.documentElement ||\n\t\t\tnode === document\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`Hydrating ${node.nodeName.toLowerCase()} is discouraged as it is destructive and may remove unknown nodes.`,\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tnode == null ||\n\t\t\t(typeof tag === \"string\" &&\n\t\t\t\t(node.nodeType !== Node.ELEMENT_NODE ||\n\t\t\t\t\ttag.toLowerCase() !== (node as Element).tagName.toLowerCase()))\n\t\t) {\n\t\t\tconsole.warn(`Expected <${tagName}> while hydrating but found: `, node);\n\t\t\treturn;\n\t\t}\n\n\t\treturn Array.from(node.childNodes);\n\t},\n\n\tpatch({\n\t\ttagName,\n\t\tnode,\n\t\tprops,\n\t\toldProps,\n\t\tscope: xmlns,\n\t\tcopyProps,\n\t\tquietProps,\n\t\tisHydrating,\n\t}: {\n\t\tnode: Node;\n\t\ttagName: string;\n\t\tprops: Record<string, any>;\n\t\toldProps: Record<string, any> | undefined;\n\t\tscope: string | undefined;\n\t\tcopyProps: Set<string> | undefined;\n\t\tquietProps: Set<string> | undefined;\n\t\tisHydrating: boolean;\n\t}): void {\n\t\tif (node.nodeType !== Node.ELEMENT_NODE) {\n\t\t\tthrow new TypeError(`Cannot patch node: ${String(node)}`);\n\t\t} else if (props.class && props.className) {\n\t\t\tconsole.error(\n\t\t\t\t`Both \"class\" and \"className\" set in props for <${tagName}>. Use one or the other.`,\n\t\t\t);\n\t\t}\n\n\t\tconst element = node as Element;\n\t\tconst isSVG = xmlns === SVG_NAMESPACE;\n\t\tfor (let name in {...oldProps, ...props}) {\n\t\t\tlet value = props[name];\n\t\t\tconst oldValue = oldProps ? oldProps[name] : undefined;\n\t\t\t{\n\t\t\t\tif (copyProps != null && copyProps.has(name)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// handle prop:name or attr:name properties\n\t\t\t\tconst colonIndex = name.indexOf(\":\");\n\t\t\t\tif (colonIndex !== -1) {\n\t\t\t\t\tconst [ns, name1] = [\n\t\t\t\t\t\tname.slice(0, colonIndex),\n\t\t\t\t\t\tname.slice(colonIndex + 1),\n\t\t\t\t\t];\n\t\t\t\t\tswitch (ns) {\n\t\t\t\t\t\tcase \"prop\":\n\t\t\t\t\t\t\t(node as any)[name1] = value;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tcase \"attr\":\n\t\t\t\t\t\t\tif (value == null || value === false) {\n\t\t\t\t\t\t\t\tif (isHydrating && element.hasAttribute(name1)) {\n\t\t\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t\telement.getAttribute(name1),\n\t\t\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telement.removeAttribute(name1);\n\t\t\t\t\t\t\t} else if (value === true) {\n\t\t\t\t\t\t\t\tif (isHydrating && !element.hasAttribute(name1)) {\n\t\t\t\t\t\t\t\t\temitHydrationWarning(name, quietProps, value, null, element);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telement.setAttribute(name1, \"\");\n\t\t\t\t\t\t\t} else if (typeof value !== \"string\") {\n\t\t\t\t\t\t\t\tvalue = String(value);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (isHydrating && element.getAttribute(name1) !== value) {\n\t\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\telement.getAttribute(name1),\n\t\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\telement.setAttribute(name1, String(value));\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch (name) {\n\t\t\t\t// TODO: fix hydration warnings for the style prop\n\t\t\t\tcase \"style\": {\n\t\t\t\t\tconst style = (element as HTMLElement | SVGElement).style;\n\t\t\t\t\tif (value == null || value === false) {\n\t\t\t\t\t\tif (isHydrating && style.cssText !== \"\") {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tstyle.cssText,\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telement.removeAttribute(\"style\");\n\t\t\t\t\t} else if (value === true) {\n\t\t\t\t\t\tif (isHydrating && style.cssText !== \"\") {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t\tstyle.cssText,\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telement.setAttribute(\"style\", \"\");\n\t\t\t\t\t} else if (typeof value === \"string\") {\n\t\t\t\t\t\tif (style.cssText !== value) {\n\t\t\t\t\t\t\t// TODO: Fix hydration warnings for styles\n\t\t\t\t\t\t\t//if (isHydrating) {\n\t\t\t\t\t\t\t//\temitHydrationWarning(\n\t\t\t\t\t\t\t//\t\tname,\n\t\t\t\t\t\t\t//\t\tquietProps,\n\t\t\t\t\t\t\t//\t\tvalue,\n\t\t\t\t\t\t\t//\t\tstyle.cssText,\n\t\t\t\t\t\t\t//\t\telement,\n\t\t\t\t\t\t\t//\t);\n\t\t\t\t\t\t\t//}\n\n\t\t\t\t\t\t\tstyle.cssText = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (typeof oldValue === \"string\") {\n\t\t\t\t\t\t\t// if the old value was a string, we need to clear the style\n\t\t\t\t\t\t\t// TODO: only clear the styles enumerated in the old value\n\t\t\t\t\t\t\tstyle.cssText = \"\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (const styleName in {...oldValue, ...value}) {\n\t\t\t\t\t\t\tconst styleValue = value && (value as any)[styleName];\n\t\t\t\t\t\t\tif (styleValue == null) {\n\t\t\t\t\t\t\t\tif (isHydrating && style.getPropertyValue(styleName) !== \"\") {\n\t\t\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\tstyle.getPropertyValue(styleName),\n\t\t\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t\t\t\t`style.${styleName}`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle.removeProperty(styleName);\n\t\t\t\t\t\t\t} else if (style.getPropertyValue(styleName) !== styleValue) {\n\t\t\t\t\t\t\t\t// TODO: hydration warnings for style props\n\t\t\t\t\t\t\t\t//if (isHydrating) {\n\t\t\t\t\t\t\t\t//\temitHydrationWarning(\n\t\t\t\t\t\t\t\t//\t\tname,\n\t\t\t\t\t\t\t\t//\t\tquietProps,\n\t\t\t\t\t\t\t\t//\t\tstyleValue,\n\t\t\t\t\t\t\t\t//\t\tstyle.getPropertyValue(styleName),\n\t\t\t\t\t\t\t\t//\t\telement,\n\t\t\t\t\t\t\t\t//\t\t`style.${styleName}`,\n\t\t\t\t\t\t\t\t//\t);\n\t\t\t\t\t\t\t\t//}\n\t\t\t\t\t\t\t\tstyle.setProperty(styleName, styleValue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"class\":\n\t\t\t\tcase \"className\":\n\t\t\t\t\tif (value === true) {\n\t\t\t\t\t\tif (isHydrating && element.getAttribute(\"class\") !== \"\") {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t\telement.getAttribute(\"class\"),\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telement.setAttribute(\"class\", \"\");\n\t\t\t\t\t} else if (value == null) {\n\t\t\t\t\t\tif (isHydrating && element.hasAttribute(\"class\")) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\telement.getAttribute(\"class\"),\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telement.removeAttribute(\"class\");\n\t\t\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\t\t\t// class={{\"included-class\": true, \"excluded-class\": false}} syntax\n\t\t\t\t\t\tif (typeof oldValue === \"string\") {\n\t\t\t\t\t\t\t// if the old value was a string, we need to clear all classes\n\t\t\t\t\t\t\telement.setAttribute(\"class\", \"\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet shouldIssueWarning = false;\n\t\t\t\t\t\tconst hydratingClasses = isHydrating\n\t\t\t\t\t\t\t? new Set(Array.from(element.classList))\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\tconst hydratingClassName = isHydrating\n\t\t\t\t\t\t\t? element.getAttribute(\"class\")\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\tfor (const className in {...oldValue, ...value}) {\n\t\t\t\t\t\t\tconst classValue = value && value[className];\n\t\t\t\t\t\t\tif (classValue) {\n\t\t\t\t\t\t\t\telement.classList.add(className);\n\t\t\t\t\t\t\t\tif (hydratingClasses && hydratingClasses.has(className)) {\n\t\t\t\t\t\t\t\t\thydratingClasses.delete(className);\n\t\t\t\t\t\t\t\t} else if (isHydrating) {\n\t\t\t\t\t\t\t\t\tshouldIssueWarning = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\telement.classList.remove(className);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshouldIssueWarning ||\n\t\t\t\t\t\t\t(hydratingClasses && hydratingClasses.size > 0)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tObject.keys(value)\n\t\t\t\t\t\t\t\t\t.filter((k) => value[k])\n\t\t\t\t\t\t\t\t\t.join(\" \"),\n\t\t\t\t\t\t\t\thydratingClassName || \"\",\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (!isSVG) {\n\t\t\t\t\t\tif (element.className !== value) {\n\t\t\t\t\t\t\tif (isHydrating) {\n\t\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\telement.className,\n\t\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telement.className = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (element.getAttribute(\"class\") !== value) {\n\t\t\t\t\t\tif (isHydrating) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\telement.getAttribute(\"class\"),\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telement.setAttribute(\"class\", value as string);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"innerHTML\":\n\t\t\t\t\tif (value !== oldValue) {\n\t\t\t\t\t\tif (isHydrating) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\telement.innerHTML,\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telement.innerHTML = value as any;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: {\n\t\t\t\t\tif (\n\t\t\t\t\t\tname[0] === \"o\" &&\n\t\t\t\t\t\tname[1] === \"n\" &&\n\t\t\t\t\t\tname[2] === name[2].toUpperCase() &&\n\t\t\t\t\t\ttypeof value === \"function\"\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Support React-style event names (onClick, onChange, etc.)\n\t\t\t\t\t\tname = name.toLowerCase();\n\t\t\t\t\t}\n\n\t\t\t\t\t// try to set the property directly\n\t\t\t\t\tif (\n\t\t\t\t\t\tname in element &&\n\t\t\t\t\t\t// boolean properties will coerce strings, but sometimes they map to\n\t\t\t\t\t\t// enumerated attributes, where truthy strings (\"false\", \"no\") map to\n\t\t\t\t\t\t// falsy properties, so we force using setAttribute.\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\ttypeof value === \"string\" &&\n\t\t\t\t\t\t\ttypeof (element as any)[name] === \"boolean\"\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\tisWritableProperty(element, name)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((element as any)[name] !== value || oldValue === undefined) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisHydrating &&\n\t\t\t\t\t\t\t\ttypeof (element as any)[name] === \"string\" &&\n\t\t\t\t\t\t\t\t(element as any)[name] !== value\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t(element as any)[name],\n\t\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// if the property is writable, assign it directly\n\t\t\t\t\t\t\t(element as any)[name] = value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value === true) {\n\t\t\t\t\t\tvalue = \"\";\n\t\t\t\t\t} else if (value == null || value === false) {\n\t\t\t\t\t\tif (isHydrating && element.hasAttribute(name)) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\telement.getAttribute(name),\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telement.removeAttribute(name);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (typeof value !== \"string\") {\n\t\t\t\t\t\tvalue = String(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (element.getAttribute(name) !== value) {\n\t\t\t\t\t\tif (isHydrating) {\n\t\t\t\t\t\t\temitHydrationWarning(\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tquietProps,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\telement.getAttribute(name),\n\t\t\t\t\t\t\t\telement,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telement.setAttribute(name, value as any);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tarrange({\n\t\ttag,\n\t\tnode,\n\t\tprops,\n\t\tchildren,\n\t}: {\n\t\ttag: string | symbol;\n\t\tnode: Node;\n\t\tprops: Record<string, any>;\n\t\tchildren: Array<Node>;\n\t}): void {\n\t\tif (tag === Portal && (node == null || typeof node.nodeType !== \"number\")) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`<Portal> root is not a node. Received: ${String(node)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (!(\"innerHTML\" in props)) {\n\t\t\tlet oldChild = node.firstChild;\n\t\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\t\tconst newChild = children[i];\n\t\t\t\tif (oldChild === newChild) {\n\t\t\t\t\t// the child is already in the right place, so we can skip it\n\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t} else {\n\t\t\t\t\tnode.insertBefore(newChild, oldChild);\n\t\t\t\t\tif (\n\t\t\t\t\t\ttag !== Portal &&\n\t\t\t\t\t\toldChild &&\n\t\t\t\t\t\ti + 1 < children.length &&\n\t\t\t\t\t\toldChild !== children[i + 1]\n\t\t\t\t\t) {\n\t\t\t\t\t\toldChild = oldChild.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tremove({\n\t\tnode,\n\t\tparentNode,\n\t\tisNested,\n\t}: {\n\t\tnode: Node;\n\t\tparentNode: Node;\n\t\tisNested: boolean;\n\t}): void {\n\t\tif (!isNested && node.parentNode === parentNode) {\n\t\t\tparentNode.removeChild(node);\n\t\t}\n\t},\n\n\ttext({\n\t\tvalue,\n\t\toldNode,\n\t\thydrationNodes,\n\t}: {\n\t\tvalue: string;\n\t\thydrationNodes: Array<Node> | undefined;\n\t\toldNode: Node | undefined;\n\t}): Node {\n\t\tif (hydrationNodes != null) {\n\t\t\tlet node = hydrationNodes.shift();\n\t\t\tif (!node || node.nodeType !== Node.TEXT_NODE) {\n\t\t\t\tconsole.warn(`Expected \"${value}\" while hydrating but found:`, node);\n\t\t\t} else {\n\t\t\t\t// value is a text node, check if it matches the expected text\n\t\t\t\tconst textData = (node as Text).data;\n\t\t\t\tif (textData.length > value.length) {\n\t\t\t\t\tif (textData.startsWith(value)) {\n\t\t\t\t\t\t// the text node is longer than the expected text, so we\n\t\t\t\t\t\t// reuse the existing text node, but truncate it and unshift the rest\n\t\t\t\t\t\t(node as Text).data = value;\n\t\t\t\t\t\thydrationNodes.unshift(\n\t\t\t\t\t\t\tdocument.createTextNode(textData.slice(value.length)),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn node;\n\t\t\t\t\t}\n\t\t\t\t} else if (textData === value) {\n\t\t\t\t\treturn node;\n\t\t\t\t}\n\n\t\t\t\t// We log textData and not node because node will be mutated\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Expected \"${value}\" while hydrating but found:`,\n\t\t\t\t\ttextData,\n\t\t\t\t);\n\t\t\t\toldNode = node;\n\t\t\t}\n\t\t}\n\n\t\tif (oldNode != null) {\n\t\t\tif ((oldNode as Text).data !== value) {\n\t\t\t\t(oldNode as Text).data = value;\n\t\t\t}\n\n\t\t\treturn oldNode;\n\t\t}\n\n\t\treturn document.createTextNode(value);\n\t},\n\n\traw({\n\t\tvalue,\n\t\tscope: xmlns,\n\t\thydrationNodes,\n\t}: {\n\t\tvalue: string | Node;\n\t\tscope: string | undefined;\n\t\thydrationNodes: Array<Node> | undefined;\n\t}): ElementValue<Node> {\n\t\tlet nodes: Array<Node>;\n\t\tif (typeof value === \"string\") {\n\t\t\tconst el =\n\t\t\t\txmlns == null\n\t\t\t\t\t? document.createElement(\"div\")\n\t\t\t\t\t: document.createElementNS(xmlns, \"svg\");\n\t\t\tel.innerHTML = value;\n\t\t\tnodes = Array.from(el.childNodes);\n\t\t} else {\n\t\t\tnodes = value == null ? [] : Array.isArray(value) ? [...value] : [value];\n\t\t}\n\n\t\tif (hydrationNodes != null) {\n\t\t\tfor (let i = 0; i < nodes.length; i++) {\n\t\t\t\tconst node = nodes[i];\n\t\t\t\t// check if node is equal to the next node in the hydration array\n\t\t\t\tconst hydrationNode = hydrationNodes.shift();\n\t\t\t\tif (\n\t\t\t\t\thydrationNode &&\n\t\t\t\t\ttypeof hydrationNode === \"object\" &&\n\t\t\t\t\ttypeof hydrationNode.nodeType === \"number\" &&\n\t\t\t\t\tnode.isEqualNode(hydrationNode as Node)\n\t\t\t\t) {\n\t\t\t\t\tnodes[i] = hydrationNode as Node;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Expected <Raw value=\"${String(value)}\"> while hydrating but found:`,\n\t\t\t\t\t\thydrationNode,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nodes.length === 0\n\t\t\t? undefined\n\t\t\t: nodes.length === 1\n\t\t\t\t? nodes[0]\n\t\t\t\t: nodes;\n\t},\n};\n\nexport class DOMRenderer extends Renderer<Node, string, Element> {\n\tconstructor() {\n\t\tsuper(adapter);\n\t}\n\n\trender(\n\t\tchildren: Children,\n\t\troot: Element,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.render(children, root, ctx);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: Element,\n\t\tctx?: Context,\n\t): Promise<ElementValue<Node>> | ElementValue<Node> {\n\t\tvalidateRoot(root);\n\t\treturn super.hydrate(children, root, ctx);\n\t}\n}\n\nfunction validateRoot(root: unknown): asserts root is Element {\n\tif (\n\t\troot == null ||\n\t\t(typeof root === \"object\" && typeof (root as any).nodeType !== \"number\")\n\t) {\n\t\tthrow new TypeError(`Render root is not a node. Received: ${String(root)}`);\n\t} else if ((root as Node).nodeType !== Node.ELEMENT_NODE) {\n\t\tthrow new TypeError(\n\t\t\t`Render root must be an element node. Received: ${String(root)}`,\n\t\t);\n\t}\n}\n\nexport const renderer = new DOMRenderer();\n\ndeclare global {\n\tmodule Crank {\n\t\tinterface EventMap extends GlobalEventHandlersEventMap {}\n\t}\n}\n"],"names":["Portal","Renderer"],"mappings":";;;;;AASA,MAAM,aAAa,GAAG,4BAA4B;AAElD,SAAS,kBAAkB,CAAC,OAAgB,EAAE,IAAY,EAAA;;IAEzD,IAAI,SAAS,GAAG,OAAO;AACvB,IAAA,GAAG;AACF,QAAA,IAAI,MAAM,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AC;;AAGf,IAAA,MAAM,CACL,QAAkB,EAClB,IAAa,EACb,GAAa,EAAA;QAEb,YAAY,CAAC,IAAI,CAAC;QAClB,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC;;AAGzC,IAAA,OAAO,CACN,QAAkB,EAClB,IAAa,EACb,GAAa,EAAA;QAEb,YAAY,CAAC,IAAI,CAAC;QAClB,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC;;AAE1C;AAED,SAAS,YAAY,CAAC,IAAa,EAAA;IAClC,IACC,IAAI,IAAI,IAAI;AACZ,SAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAQ,IAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC,EACvE;QACD,MAAM,IAAI,SAAS,CAAC,CAAwC,qCAAA,EAAA,MAAM,CAAC,IAAI,CAAC,CAAE,CAAA,CAAC;;SACrE,IAAK,IAAa,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;QACzD,MAAM,IAAI,SAAS,CAClB,CAAkD,+CAAA,EAAA,MAAM,CAAC,IAAI,CAAC,CAAE,CAAA,CAChE;;AAEH;AAEa,MAAA,QAAQ,GAAG,IAAI,WAAW;;;;;;"}
package/dom.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Children, Context, ElementValue, Renderer, RendererImpl } from "./crank.js";
2
- export declare const impl: Partial<RendererImpl<Node, string>>;
3
- export declare class DOMRenderer extends Renderer<Node, string> {
1
+ import { Children, Context, ElementValue, Renderer, RenderAdapter } from "./crank.js";
2
+ export declare const adapter: Partial<RenderAdapter<Node, string, Element>>;
3
+ export declare class DOMRenderer extends Renderer<Node, string, Element> {
4
4
  constructor();
5
- render(children: Children, root: Node, ctx?: Context): Promise<ElementValue<Node>> | ElementValue<Node>;
6
- hydrate(children: Children, root: Node, ctx?: Context): Promise<ElementValue<Node>> | ElementValue<Node>;
5
+ render(children: Children, root: Element, ctx?: Context): Promise<ElementValue<Node>> | ElementValue<Node>;
6
+ hydrate(children: Children, root: Element, ctx?: Context): Promise<ElementValue<Node>> | ElementValue<Node>;
7
7
  }
8
8
  export declare const renderer: DOMRenderer;
9
9
  declare global {