@solidjs/web
Advanced tools
+16
-28
@@ -132,3 +132,2 @@ 'use strict'; | ||
| } | ||
| const renderRoot = getChildRoot(element); | ||
| let disposer; | ||
@@ -142,3 +141,3 @@ solidJs.createRoot(dispose => { | ||
| const tree = code(); | ||
| insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions); | ||
| insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions); | ||
| } | ||
@@ -150,3 +149,3 @@ }, { | ||
| disposer(); | ||
| renderRoot.textContent = ""; | ||
| element.textContent = ""; | ||
| }; | ||
@@ -290,7 +289,6 @@ } | ||
| function insert(parent, accessor, marker, initial, options) { | ||
| const childRoot = getChildRoot(parent); | ||
| const multi = marker !== undefined; | ||
| if (multi && !initial) initial = []; | ||
| if (isHydrating(parent)) { | ||
| if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes]; | ||
| if (!multi && initial === undefined && parent) initial = [...parent.childNodes]; | ||
| if (Array.isArray(initial)) { | ||
@@ -310,3 +308,3 @@ let j = 0; | ||
| const placeholder = document.createTextNode(""); | ||
| childRoot.insertBefore(placeholder, marker); | ||
| parent.insertBefore(placeholder, marker); | ||
| initial = [placeholder]; | ||
@@ -366,3 +364,3 @@ } | ||
| function hydrate$1(code, element, options = {}) { | ||
| if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options); | ||
| options.renderId ||= ""; | ||
@@ -413,3 +411,3 @@ if (!globalThis._$HY.modules) globalThis._$HY.modules = {}; | ||
| try { | ||
| disposer = render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| disposer = render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -426,3 +424,3 @@ solidJs.sharedConfig.hydrating = false; | ||
| gatherHydratable(element, options.renderId); | ||
| return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| return render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -476,3 +474,3 @@ solidJs.sharedConfig.hydrating = false; | ||
| function getFirstChild(node, expectedTag) { | ||
| const child = getChildRoot(node).firstChild; | ||
| const child = node.firstChild; | ||
| if (isHydrating() && expectedTag && child?.localName !== expectedTag) { | ||
@@ -496,3 +494,3 @@ const isMissing = !child || child.nodeType !== 1; | ||
| const children = []; | ||
| let child = getChildRoot(parent).firstChild; | ||
| let child = parent.firstChild; | ||
| while (child) { | ||
@@ -547,5 +545,2 @@ if (child.nodeType === 1) children.push(child); | ||
| } | ||
| function getChildRoot(node) { | ||
| return node && node.localName === "template" ? node.content : node; | ||
| } | ||
| function classListToObject(classList) { | ||
@@ -585,7 +580,3 @@ if (Array.isArray(classList)) { | ||
| const hasNamespace = prop.indexOf(":") > -1; | ||
| if (hasNamespace && prop.slice(0, 3) === "on:") { | ||
| const e = prop.slice(3); | ||
| prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev); | ||
| value && node.addEventListener(e, value, typeof value !== "function" && value); | ||
| } else if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| const name = prop.slice(2).toLowerCase(); | ||
@@ -663,3 +654,2 @@ const delegate = DelegatedEvents.has(name); | ||
| if (value === current) return; | ||
| const childRoot = getChildRoot(parent); | ||
| const t = typeof value, | ||
@@ -670,4 +660,4 @@ multi = marker !== undefined; | ||
| if (tc === "string" || tc === "number") { | ||
| childRoot.firstChild.data = value; | ||
| } else childRoot.textContent = value; | ||
| parent.firstChild.data = value; | ||
| } else parent.textContent = value; | ||
| } else if (value === undefined) { | ||
@@ -678,5 +668,5 @@ cleanChildren(parent, current, marker); | ||
| cleanChildren(parent, current, multi ? marker : null, value); | ||
| } else if (current === undefined || !childRoot.firstChild) { | ||
| childRoot.appendChild(value); | ||
| } else childRoot.replaceChild(value, childRoot.firstChild); | ||
| } else if (current === undefined || !parent.firstChild) { | ||
| parent.appendChild(value); | ||
| } else parent.replaceChild(value, parent.firstChild); | ||
| } else if (Array.isArray(value)) { | ||
@@ -689,3 +679,3 @@ const currentArray = current && Array.isArray(current); | ||
| appendNodes(parent, value, marker); | ||
| } else reconcileArrays(childRoot, current, value); | ||
| } else reconcileArrays(parent, current, value); | ||
| } else { | ||
@@ -715,7 +705,5 @@ current && cleanChildren(parent); | ||
| function appendNodes(parent, array, marker = null) { | ||
| parent = getChildRoot(parent); | ||
| for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker); | ||
| } | ||
| function cleanChildren(parent, current, marker, replacement) { | ||
| parent = getChildRoot(parent); | ||
| if (marker === undefined) return parent.textContent = ""; | ||
@@ -722,0 +710,0 @@ if (current.length) { |
+16
-28
@@ -131,3 +131,2 @@ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js'; | ||
| } | ||
| const renderRoot = getChildRoot(element); | ||
| let disposer; | ||
@@ -141,3 +140,3 @@ createRoot(dispose => { | ||
| const tree = code(); | ||
| insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions); | ||
| insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions); | ||
| } | ||
@@ -149,3 +148,3 @@ }, { | ||
| disposer(); | ||
| renderRoot.textContent = ""; | ||
| element.textContent = ""; | ||
| }; | ||
@@ -289,7 +288,6 @@ } | ||
| function insert(parent, accessor, marker, initial, options) { | ||
| const childRoot = getChildRoot(parent); | ||
| const multi = marker !== undefined; | ||
| if (multi && !initial) initial = []; | ||
| if (isHydrating(parent)) { | ||
| if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes]; | ||
| if (!multi && initial === undefined && parent) initial = [...parent.childNodes]; | ||
| if (Array.isArray(initial)) { | ||
@@ -309,3 +307,3 @@ let j = 0; | ||
| const placeholder = document.createTextNode(""); | ||
| childRoot.insertBefore(placeholder, marker); | ||
| parent.insertBefore(placeholder, marker); | ||
| initial = [placeholder]; | ||
@@ -365,3 +363,3 @@ } | ||
| function hydrate$1(code, element, options = {}) { | ||
| if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options); | ||
| options.renderId ||= ""; | ||
@@ -412,3 +410,3 @@ if (!globalThis._$HY.modules) globalThis._$HY.modules = {}; | ||
| try { | ||
| disposer = render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| disposer = render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -425,3 +423,3 @@ sharedConfig.hydrating = false; | ||
| gatherHydratable(element, options.renderId); | ||
| return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| return render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -475,3 +473,3 @@ sharedConfig.hydrating = false; | ||
| function getFirstChild(node, expectedTag) { | ||
| const child = getChildRoot(node).firstChild; | ||
| const child = node.firstChild; | ||
| if (isHydrating() && expectedTag && child?.localName !== expectedTag) { | ||
@@ -495,3 +493,3 @@ const isMissing = !child || child.nodeType !== 1; | ||
| const children = []; | ||
| let child = getChildRoot(parent).firstChild; | ||
| let child = parent.firstChild; | ||
| while (child) { | ||
@@ -546,5 +544,2 @@ if (child.nodeType === 1) children.push(child); | ||
| } | ||
| function getChildRoot(node) { | ||
| return node && node.localName === "template" ? node.content : node; | ||
| } | ||
| function classListToObject(classList) { | ||
@@ -584,7 +579,3 @@ if (Array.isArray(classList)) { | ||
| const hasNamespace = prop.indexOf(":") > -1; | ||
| if (hasNamespace && prop.slice(0, 3) === "on:") { | ||
| const e = prop.slice(3); | ||
| prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev); | ||
| value && node.addEventListener(e, value, typeof value !== "function" && value); | ||
| } else if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| const name = prop.slice(2).toLowerCase(); | ||
@@ -662,3 +653,2 @@ const delegate = DelegatedEvents.has(name); | ||
| if (value === current) return; | ||
| const childRoot = getChildRoot(parent); | ||
| const t = typeof value, | ||
@@ -669,4 +659,4 @@ multi = marker !== undefined; | ||
| if (tc === "string" || tc === "number") { | ||
| childRoot.firstChild.data = value; | ||
| } else childRoot.textContent = value; | ||
| parent.firstChild.data = value; | ||
| } else parent.textContent = value; | ||
| } else if (value === undefined) { | ||
@@ -677,5 +667,5 @@ cleanChildren(parent, current, marker); | ||
| cleanChildren(parent, current, multi ? marker : null, value); | ||
| } else if (current === undefined || !childRoot.firstChild) { | ||
| childRoot.appendChild(value); | ||
| } else childRoot.replaceChild(value, childRoot.firstChild); | ||
| } else if (current === undefined || !parent.firstChild) { | ||
| parent.appendChild(value); | ||
| } else parent.replaceChild(value, parent.firstChild); | ||
| } else if (Array.isArray(value)) { | ||
@@ -688,3 +678,3 @@ const currentArray = current && Array.isArray(current); | ||
| appendNodes(parent, value, marker); | ||
| } else reconcileArrays(childRoot, current, value); | ||
| } else reconcileArrays(parent, current, value); | ||
| } else { | ||
@@ -714,7 +704,5 @@ current && cleanChildren(parent); | ||
| function appendNodes(parent, array, marker = null) { | ||
| parent = getChildRoot(parent); | ||
| for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker); | ||
| } | ||
| function cleanChildren(parent, current, marker, replacement) { | ||
| parent = getChildRoot(parent); | ||
| if (marker === undefined) return parent.textContent = ""; | ||
@@ -721,0 +709,0 @@ if (current.length) { |
+15
-27
@@ -129,3 +129,2 @@ 'use strict'; | ||
| function render$1(code, element, init, options = {}) { | ||
| const renderRoot = getChildRoot(element); | ||
| let disposer; | ||
@@ -139,3 +138,3 @@ solidJs.createRoot(dispose => { | ||
| const tree = code(); | ||
| insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions); | ||
| insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions); | ||
| } | ||
@@ -147,3 +146,3 @@ }, { | ||
| disposer(); | ||
| renderRoot.textContent = ""; | ||
| element.textContent = ""; | ||
| }; | ||
@@ -285,7 +284,6 @@ } | ||
| function insert(parent, accessor, marker, initial, options) { | ||
| const childRoot = getChildRoot(parent); | ||
| const multi = marker !== undefined; | ||
| if (multi && !initial) initial = []; | ||
| if (isHydrating(parent)) { | ||
| if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes]; | ||
| if (!multi && initial === undefined && parent) initial = [...parent.childNodes]; | ||
| if (Array.isArray(initial)) { | ||
@@ -305,3 +303,3 @@ let j = 0; | ||
| const placeholder = document.createTextNode(""); | ||
| childRoot.insertBefore(placeholder, marker); | ||
| parent.insertBefore(placeholder, marker); | ||
| initial = [placeholder]; | ||
@@ -361,3 +359,3 @@ } | ||
| function hydrate$1(code, element, options = {}) { | ||
| if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options); | ||
| options.renderId ||= ""; | ||
@@ -398,3 +396,3 @@ if (!globalThis._$HY.modules) globalThis._$HY.modules = {}; | ||
| try { | ||
| disposer = render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| disposer = render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -411,3 +409,3 @@ solidJs.sharedConfig.hydrating = false; | ||
| gatherHydratable(element, options.renderId); | ||
| return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| return render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -455,3 +453,3 @@ solidJs.sharedConfig.hydrating = false; | ||
| function getFirstChild(node, expectedTag) { | ||
| const child = getChildRoot(node).firstChild; | ||
| const child = node.firstChild; | ||
| return child; | ||
@@ -489,5 +487,2 @@ } | ||
| } | ||
| function getChildRoot(node) { | ||
| return node && node.localName === "template" ? node.content : node; | ||
| } | ||
| function classListToObject(classList) { | ||
@@ -527,7 +522,3 @@ if (Array.isArray(classList)) { | ||
| const hasNamespace = prop.indexOf(":") > -1; | ||
| if (hasNamespace && prop.slice(0, 3) === "on:") { | ||
| const e = prop.slice(3); | ||
| prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev); | ||
| value && node.addEventListener(e, value, typeof value !== "function" && value); | ||
| } else if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| const name = prop.slice(2).toLowerCase(); | ||
@@ -605,3 +596,2 @@ const delegate = DelegatedEvents.has(name); | ||
| if (value === current) return; | ||
| const childRoot = getChildRoot(parent); | ||
| const t = typeof value, | ||
@@ -612,4 +602,4 @@ multi = marker !== undefined; | ||
| if (tc === "string" || tc === "number") { | ||
| childRoot.firstChild.data = value; | ||
| } else childRoot.textContent = value; | ||
| parent.firstChild.data = value; | ||
| } else parent.textContent = value; | ||
| } else if (value === undefined) { | ||
@@ -620,5 +610,5 @@ cleanChildren(parent, current, marker); | ||
| cleanChildren(parent, current, multi ? marker : null, value); | ||
| } else if (current === undefined || !childRoot.firstChild) { | ||
| childRoot.appendChild(value); | ||
| } else childRoot.replaceChild(value, childRoot.firstChild); | ||
| } else if (current === undefined || !parent.firstChild) { | ||
| parent.appendChild(value); | ||
| } else parent.replaceChild(value, parent.firstChild); | ||
| } else if (Array.isArray(value)) { | ||
@@ -631,3 +621,3 @@ const currentArray = current && Array.isArray(current); | ||
| appendNodes(parent, value, marker); | ||
| } else reconcileArrays(childRoot, current, value); | ||
| } else reconcileArrays(parent, current, value); | ||
| } else { | ||
@@ -657,7 +647,5 @@ current && cleanChildren(parent); | ||
| function appendNodes(parent, array, marker = null) { | ||
| parent = getChildRoot(parent); | ||
| for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker); | ||
| } | ||
| function cleanChildren(parent, current, marker, replacement) { | ||
| parent = getChildRoot(parent); | ||
| if (marker === undefined) return parent.textContent = ""; | ||
@@ -664,0 +652,0 @@ if (current.length) { |
+15
-27
@@ -128,3 +128,2 @@ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, enableHydration, flush } from 'solid-js'; | ||
| function render$1(code, element, init, options = {}) { | ||
| const renderRoot = getChildRoot(element); | ||
| let disposer; | ||
@@ -138,3 +137,3 @@ createRoot(dispose => { | ||
| const tree = code(); | ||
| insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions); | ||
| insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions); | ||
| } | ||
@@ -146,3 +145,3 @@ }, { | ||
| disposer(); | ||
| renderRoot.textContent = ""; | ||
| element.textContent = ""; | ||
| }; | ||
@@ -284,7 +283,6 @@ } | ||
| function insert(parent, accessor, marker, initial, options) { | ||
| const childRoot = getChildRoot(parent); | ||
| const multi = marker !== undefined; | ||
| if (multi && !initial) initial = []; | ||
| if (isHydrating(parent)) { | ||
| if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes]; | ||
| if (!multi && initial === undefined && parent) initial = [...parent.childNodes]; | ||
| if (Array.isArray(initial)) { | ||
@@ -304,3 +302,3 @@ let j = 0; | ||
| const placeholder = document.createTextNode(""); | ||
| childRoot.insertBefore(placeholder, marker); | ||
| parent.insertBefore(placeholder, marker); | ||
| initial = [placeholder]; | ||
@@ -360,3 +358,3 @@ } | ||
| function hydrate$1(code, element, options = {}) { | ||
| if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options); | ||
| options.renderId ||= ""; | ||
@@ -397,3 +395,3 @@ if (!globalThis._$HY.modules) globalThis._$HY.modules = {}; | ||
| try { | ||
| disposer = render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| disposer = render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -410,3 +408,3 @@ sharedConfig.hydrating = false; | ||
| gatherHydratable(element, options.renderId); | ||
| return render$1(code, element, [...getChildRoot(element).childNodes], options); | ||
| return render$1(code, element, [...element.childNodes], options); | ||
| } finally { | ||
@@ -454,3 +452,3 @@ sharedConfig.hydrating = false; | ||
| function getFirstChild(node, expectedTag) { | ||
| const child = getChildRoot(node).firstChild; | ||
| const child = node.firstChild; | ||
| return child; | ||
@@ -488,5 +486,2 @@ } | ||
| } | ||
| function getChildRoot(node) { | ||
| return node && node.localName === "template" ? node.content : node; | ||
| } | ||
| function classListToObject(classList) { | ||
@@ -526,7 +521,3 @@ if (Array.isArray(classList)) { | ||
| const hasNamespace = prop.indexOf(":") > -1; | ||
| if (hasNamespace && prop.slice(0, 3) === "on:") { | ||
| const e = prop.slice(3); | ||
| prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev); | ||
| value && node.addEventListener(e, value, typeof value !== "function" && value); | ||
| } else if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| if (!hasNamespace && prop.slice(0, 2) === "on") { | ||
| const name = prop.slice(2).toLowerCase(); | ||
@@ -604,3 +595,2 @@ const delegate = DelegatedEvents.has(name); | ||
| if (value === current) return; | ||
| const childRoot = getChildRoot(parent); | ||
| const t = typeof value, | ||
@@ -611,4 +601,4 @@ multi = marker !== undefined; | ||
| if (tc === "string" || tc === "number") { | ||
| childRoot.firstChild.data = value; | ||
| } else childRoot.textContent = value; | ||
| parent.firstChild.data = value; | ||
| } else parent.textContent = value; | ||
| } else if (value === undefined) { | ||
@@ -619,5 +609,5 @@ cleanChildren(parent, current, marker); | ||
| cleanChildren(parent, current, multi ? marker : null, value); | ||
| } else if (current === undefined || !childRoot.firstChild) { | ||
| childRoot.appendChild(value); | ||
| } else childRoot.replaceChild(value, childRoot.firstChild); | ||
| } else if (current === undefined || !parent.firstChild) { | ||
| parent.appendChild(value); | ||
| } else parent.replaceChild(value, parent.firstChild); | ||
| } else if (Array.isArray(value)) { | ||
@@ -630,3 +620,3 @@ const currentArray = current && Array.isArray(current); | ||
| appendNodes(parent, value, marker); | ||
| } else reconcileArrays(childRoot, current, value); | ||
| } else reconcileArrays(parent, current, value); | ||
| } else { | ||
@@ -656,7 +646,5 @@ current && cleanChildren(parent); | ||
| function appendNodes(parent, array, marker = null) { | ||
| parent = getChildRoot(parent); | ||
| for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker); | ||
| } | ||
| function cleanChildren(parent, current, marker, replacement) { | ||
| parent = getChildRoot(parent); | ||
| if (marker === undefined) return parent.textContent = ""; | ||
@@ -663,0 +651,0 @@ if (current.length) { |
+3
-3
| { | ||
| "name": "@solidjs/web", | ||
| "description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).", | ||
| "version": "2.0.0-beta.12", | ||
| "version": "2.0.0-beta.13", | ||
| "author": "Ryan Carniato", | ||
@@ -140,6 +140,6 @@ "license": "MIT", | ||
| "peerDependencies": { | ||
| "solid-js": "^2.0.0-beta.12" | ||
| "solid-js": "^2.0.0-beta.13" | ||
| }, | ||
| "devDependencies": { | ||
| "solid-js": "2.0.0-beta.12" | ||
| "solid-js": "2.0.0-beta.13" | ||
| }, | ||
@@ -146,0 +146,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
629966
-4.59%10962
-2.39%