@b9g/crank 0.7.1 → 0.7.3
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/README.md +540 -84
- package/_css.js.map +1 -1
- package/_utils.js.map +1 -1
- package/async.cjs +42 -38
- package/async.cjs.map +1 -1
- package/async.d.ts +10 -7
- package/async.js +42 -38
- package/async.js.map +1 -1
- package/crank.cjs +50 -8
- package/crank.cjs.map +1 -1
- package/crank.js +50 -8
- package/crank.js.map +1 -1
- package/dom.cjs +16 -1
- package/dom.cjs.map +1 -1
- package/dom.js +16 -1
- package/dom.js.map +1 -1
- package/package.json +2 -1
- package/umd.js +66 -9
- package/umd.js.map +1 -1
package/dom.cjs
CHANGED
|
@@ -300,7 +300,22 @@ const adapter = {
|
|
|
300
300
|
!(typeof value === "string" &&
|
|
301
301
|
typeof element[name] === "boolean") &&
|
|
302
302
|
isWritableProperty(element, name)) {
|
|
303
|
-
|
|
303
|
+
// For URL properties like src and href, the DOM property returns the
|
|
304
|
+
// resolved absolute URL. We need to resolve the prop value the same way
|
|
305
|
+
// to compare correctly.
|
|
306
|
+
let domValue = element[name];
|
|
307
|
+
let propValue = value;
|
|
308
|
+
if ((name === "src" || name === "href") &&
|
|
309
|
+
typeof value === "string" &&
|
|
310
|
+
typeof domValue === "string") {
|
|
311
|
+
try {
|
|
312
|
+
propValue = new URL(value, element.baseURI).href;
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
// Invalid URL, use original value for comparison
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (propValue !== domValue || oldValue === undefined) {
|
|
304
319
|
if (isHydrating &&
|
|
305
320
|
typeof element[name] === "string" &&
|
|
306
321
|
element[name] !== value) {
|
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\tPortal,\n\tRenderer,\n\tRenderAdapter,\n} from \"./crank.js\";\nimport {camelToKebabCase, formatStyleValue} from \"./_css.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\nconst MATHML_NAMESPACE = \"http://www.w3.org/1998/Math/MathML\";\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\tcase \"math\":\n\t\t\t\txmlns = MATHML_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} else if (tag.toLowerCase() === \"math\") {\n\t\t\txmlns = MATHML_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\tconst isMathML = xmlns === MATHML_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 cssName = camelToKebabCase(styleName);\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(cssName) !== \"\") {\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(cssName),\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(cssName);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst formattedValue = formatStyleValue(cssName, styleValue);\n\t\t\t\t\t\t\t\tif (style.getPropertyValue(cssName) !== formattedValue) {\n\t\t\t\t\t\t\t\t\t// TODO: hydration warnings for style props\n\t\t\t\t\t\t\t\t\t//if (isHydrating) {\n\t\t\t\t\t\t\t\t\t//\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\t//\t\tname,\n\t\t\t\t\t\t\t\t\t//\t\tquietProps,\n\t\t\t\t\t\t\t\t\t//\t\tformattedValue,\n\t\t\t\t\t\t\t\t\t//\t\tstyle.getPropertyValue(cssName),\n\t\t\t\t\t\t\t\t\t//\t\telement,\n\t\t\t\t\t\t\t\t\t//\t\t`style.${styleName}`,\n\t\t\t\t\t\t\t\t\t//\t);\n\t\t\t\t\t\t\t\t\t//}\n\t\t\t\t\t\t\t\t\tstyle.setProperty(cssName, formattedValue);\n\t\t\t\t\t\t\t\t}\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 && !isMathML) {\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: xmlns === SVG_NAMESPACE\n\t\t\t\t\t\t? document.createElementNS(xmlns, \"svg\")\n\t\t\t\t\t\t: document.createElementNS(xmlns, \"math\");\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","camelToKebabCase","formatStyleValue","Renderer"],"mappings":";;;;;AAUA,MAAM,aAAa,GAAG,4BAA4B;AAClD,MAAM,gBAAgB,GAAG,oCAAoC;AAE7D,SAAS,kBAAkB,CAAC,OAAgB,EAAE,IAAY,EAAA;;IAEzD,IAAI,SAAS,GAAG,OAAO;AACvB,IAAA,GAAG;AACF,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAC1D;;KAED,SAAS,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;AAEtD,IAAA,IAAI,SAAS,KAAK,IAAI,EAAE;AACvB,QAAA,OAAO,KAAK;;;;IAKb,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,IAAI,CAAC;IACnE,IACC,UAAU,IAAI,IAAI;AAClB,SAAC,UAAU,CAAC,QAAQ,KAAK,IAAI,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,CAAC,EAC7D;AACD,QAAA,OAAO,IAAI;;AAGZ,IAAA,OAAO,KAAK;AACb;AAEA,SAAS,oBAAoB,CAC5B,QAAgB,EAChB,UAAmC,EACnC,aAAkB,EAClB,WAAgB,EAChB,OAAgB,EAChB,WAAoB,EAAA;IAEpB,MAAM,SAAS,GAAG,QAAQ;AAC1B,IAAA,MAAM,QAAQ,GAAG,WAAW,IAAI,QAAQ;IACx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AEb,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;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dom.cjs","sources":["../src/dom.ts"],"sourcesContent":["import {\n\tChildren,\n\tContext,\n\tElementValue,\n\tPortal,\n\tRenderer,\n\tRenderAdapter,\n} from \"./crank.js\";\nimport {camelToKebabCase, formatStyleValue} from \"./_css.js\";\n\nconst SVG_NAMESPACE = \"http://www.w3.org/2000/svg\";\nconst MATHML_NAMESPACE = \"http://www.w3.org/1998/Math/MathML\";\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\tcase \"math\":\n\t\t\t\txmlns = MATHML_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} else if (tag.toLowerCase() === \"math\") {\n\t\t\txmlns = MATHML_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\tconst isMathML = xmlns === MATHML_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 cssName = camelToKebabCase(styleName);\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(cssName) !== \"\") {\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(cssName),\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(cssName);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst formattedValue = formatStyleValue(cssName, styleValue);\n\t\t\t\t\t\t\t\tif (style.getPropertyValue(cssName) !== formattedValue) {\n\t\t\t\t\t\t\t\t\t// TODO: hydration warnings for style props\n\t\t\t\t\t\t\t\t\t//if (isHydrating) {\n\t\t\t\t\t\t\t\t\t//\temitHydrationWarning(\n\t\t\t\t\t\t\t\t\t//\t\tname,\n\t\t\t\t\t\t\t\t\t//\t\tquietProps,\n\t\t\t\t\t\t\t\t\t//\t\tformattedValue,\n\t\t\t\t\t\t\t\t\t//\t\tstyle.getPropertyValue(cssName),\n\t\t\t\t\t\t\t\t\t//\t\telement,\n\t\t\t\t\t\t\t\t\t//\t\t`style.${styleName}`,\n\t\t\t\t\t\t\t\t\t//\t);\n\t\t\t\t\t\t\t\t\t//}\n\t\t\t\t\t\t\t\t\tstyle.setProperty(cssName, formattedValue);\n\t\t\t\t\t\t\t\t}\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 && !isMathML) {\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\t// For URL properties like src and href, the DOM property returns the\n\t\t\t\t\t\t// resolved absolute URL. We need to resolve the prop value the same way\n\t\t\t\t\t\t// to compare correctly.\n\t\t\t\t\t\tlet domValue = (element as any)[name];\n\t\t\t\t\t\tlet propValue = value;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(name === \"src\" || name === \"href\") &&\n\t\t\t\t\t\t\ttypeof value === \"string\" &&\n\t\t\t\t\t\t\ttypeof domValue === \"string\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tpropValue = new URL(value, element.baseURI).href;\n\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t// Invalid URL, use original value for comparison\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (propValue !== domValue || 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: xmlns === SVG_NAMESPACE\n\t\t\t\t\t\t? document.createElementNS(xmlns, \"svg\")\n\t\t\t\t\t\t: document.createElementNS(xmlns, \"math\");\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","camelToKebabCase","formatStyleValue","Renderer"],"mappings":";;;;;AAUA,MAAM,aAAa,GAAG,4BAA4B;AAClD,MAAM,gBAAgB,GAAG,oCAAoC;AAE7D,SAAS,kBAAkB,CAAC,OAAgB,EAAE,IAAY,EAAA;;IAEzD,IAAI,SAAS,GAAG,OAAO;AACvB,IAAA,GAAG;AACF,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAC1D;;KAED,SAAS,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;AAEtD,IAAA,IAAI,SAAS,KAAK,IAAI,EAAE;AACvB,QAAA,OAAO,KAAK;;;;IAKb,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,IAAI,CAAC;IACnE,IACC,UAAU,IAAI,IAAI;AAClB,SAAC,UAAU,CAAC,QAAQ,KAAK,IAAI,IAAI,UAAU,CAAC,GAAG,KAAK,SAAS,CAAC,EAC7D;AACD,QAAA,OAAO,IAAI;;AAGZ,IAAA,OAAO,KAAK;AACb;AAEA,SAAS,oBAAoB,CAC5B,QAAgB,EAChB,UAAmC,EACnC,aAAkB,EAClB,WAAgB,EAChB,OAAgB,EAChB,WAAoB,EAAA;IAEpB,MAAM,SAAS,GAAG,QAAQ;AAC1B,IAAA,MAAM,QAAQ,GAAG,WAAW,IAAI,QAAQ;IACxC,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS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AAA;AAC/D,IAAA,WAAA,GAAA;QACC,KAAK,CAAC,OAAO,CAAC;;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.js
CHANGED
|
@@ -299,7 +299,22 @@ const adapter = {
|
|
|
299
299
|
!(typeof value === "string" &&
|
|
300
300
|
typeof element[name] === "boolean") &&
|
|
301
301
|
isWritableProperty(element, name)) {
|
|
302
|
-
|
|
302
|
+
// For URL properties like src and href, the DOM property returns the
|
|
303
|
+
// resolved absolute URL. We need to resolve the prop value the same way
|
|
304
|
+
// to compare correctly.
|
|
305
|
+
let domValue = element[name];
|
|
306
|
+
let propValue = value;
|
|
307
|
+
if ((name === "src" || name === "href") &&
|
|
308
|
+
typeof value === "string" &&
|
|
309
|
+
typeof domValue === "string") {
|
|
310
|
+
try {
|
|
311
|
+
propValue = new URL(value, element.baseURI).href;
|
|
312
|
+
}
|
|
313
|
+
catch {
|
|
314
|
+
// Invalid URL, use original value for comparison
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (propValue !== domValue || oldValue === undefined) {
|
|
303
318
|
if (isHydrating &&
|
|
304
319
|
typeof element[name] === "string" &&
|
|
305
320
|
element[name] !== value) {
|