dom-expressions 0.31.8 → 0.31.9
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/package.json +3 -3
- package/src/client.js +2 -1
- package/src/reconcile.js +2 -2
- package/src/server.js +3 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dom-expressions",
|
|
3
3
|
"description": "A Fine-Grained Runtime for Performant DOM Rendering",
|
|
4
|
-
"version": "0.31.
|
|
4
|
+
"version": "0.31.9",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devalue": "^2.0.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"babel-plugin-jsx-dom-expressions": "^0.31.
|
|
23
|
+
"babel-plugin-jsx-dom-expressions": "^0.31.9"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "d6acdfaec8fd29efa9954a56f1f6d068b9b8e528"
|
|
26
26
|
}
|
package/src/client.js
CHANGED
|
@@ -326,6 +326,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
329
|
+
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
329
330
|
while (typeof current === "function") current = current();
|
|
330
331
|
if (value === current) return current;
|
|
331
332
|
const t = typeof value,
|
|
@@ -439,7 +440,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
439
440
|
const isParent = el.parentNode === parent;
|
|
440
441
|
if (!inserted && !i)
|
|
441
442
|
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
442
|
-
else isParent &&
|
|
443
|
+
else isParent && el.remove();
|
|
443
444
|
} else inserted = true;
|
|
444
445
|
}
|
|
445
446
|
} else if (current instanceof Node) parent.replaceChild(node, current);
|
package/src/reconcile.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function reconcileArrays(parentNode, a, b) {
|
|
|
33
33
|
// remove
|
|
34
34
|
} else if (bEnd === bStart) {
|
|
35
35
|
while (aStart < aEnd) {
|
|
36
|
-
if (!map || !map.has(a[aStart]))
|
|
36
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
37
37
|
aStart++;
|
|
38
38
|
}
|
|
39
39
|
// swap backward
|
|
@@ -69,7 +69,7 @@ export default function reconcileArrays(parentNode, a, b) {
|
|
|
69
69
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
70
70
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
71
71
|
} else aStart++;
|
|
72
|
-
} else
|
|
72
|
+
} else a[aStart++].remove();
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
package/src/server.js
CHANGED
|
@@ -390,12 +390,12 @@ export function getHydrationKey() {
|
|
|
390
390
|
return hydrate && !hydrate.noHydrate && `${hydrate.id}${hydrate.count++}`;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
export function generateHydrationScript({ eventNames = ["click", "input"], nonce }) {
|
|
393
|
+
export function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
|
|
394
394
|
return `<script${
|
|
395
395
|
nonce ? ` nonce="${nonce}"` : ""
|
|
396
396
|
}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join(
|
|
397
397
|
'","'
|
|
398
|
-
)}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script
|
|
398
|
+
)}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!--xs-->`;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
function injectAssets(assets, html) {
|
|
@@ -407,7 +407,7 @@ function injectAssets(assets, html) {
|
|
|
407
407
|
|
|
408
408
|
function injectScripts(html, scripts, nonce) {
|
|
409
409
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
410
|
-
const index = html.indexOf("
|
|
410
|
+
const index = html.indexOf("<!--xs-->");
|
|
411
411
|
if (index > -1) {
|
|
412
412
|
return html.slice(0, index) + tag + html.slice(index);
|
|
413
413
|
}
|