solid-js 1.6.8 → 1.6.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/dist/dev.cjs +140 -127
- package/dist/dev.js +140 -127
- package/dist/server.cjs +30 -25
- package/dist/server.js +30 -25
- package/dist/solid.cjs +126 -115
- package/dist/solid.js +126 -115
- package/h/dist/h.cjs +4 -4
- package/h/dist/h.js +4 -4
- package/h/types/hyperscript.d.ts +3 -3
- package/html/dist/html.cjs +34 -35
- package/html/dist/html.js +34 -35
- package/html/types/lit.d.ts +2 -2
- package/package.json +1 -1
- package/store/dist/dev.cjs +16 -16
- package/store/dist/dev.js +16 -16
- package/store/dist/server.cjs +3 -3
- package/store/dist/server.js +3 -3
- package/store/dist/store.cjs +16 -16
- package/store/dist/store.js +16 -16
- package/types/reactive/signal.d.ts +9 -8
- package/universal/dist/dev.cjs +10 -10
- package/universal/dist/dev.js +10 -10
- package/universal/dist/universal.cjs +10 -10
- package/universal/dist/universal.js +10 -10
- package/web/dist/dev.cjs +29 -22
- package/web/dist/dev.js +29 -22
- package/web/dist/server.cjs +12 -20
- package/web/dist/server.js +12 -20
- package/web/dist/web.cjs +29 -22
- package/web/dist/web.js +29 -22
package/universal/dist/dev.cjs
CHANGED
|
@@ -23,7 +23,7 @@ function createRenderer$1({
|
|
|
23
23
|
while (typeof current === "function") current = current();
|
|
24
24
|
if (value === current) return current;
|
|
25
25
|
const t = typeof value,
|
|
26
|
-
|
|
26
|
+
multi = marker !== undefined;
|
|
27
27
|
if (t === "string" || t === "number") {
|
|
28
28
|
if (t === "number") value = value.toString();
|
|
29
29
|
if (multi) {
|
|
@@ -85,7 +85,7 @@ function createRenderer$1({
|
|
|
85
85
|
let dynamic = false;
|
|
86
86
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
87
87
|
let item = array[i],
|
|
88
|
-
|
|
88
|
+
t;
|
|
89
89
|
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
90
90
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
91
91
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
@@ -104,12 +104,12 @@ function createRenderer$1({
|
|
|
104
104
|
}
|
|
105
105
|
function reconcileArrays(parentNode, a, b) {
|
|
106
106
|
let bLength = b.length,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
aEnd = a.length,
|
|
108
|
+
bEnd = bLength,
|
|
109
|
+
aStart = 0,
|
|
110
|
+
bStart = 0,
|
|
111
|
+
after = getNextSibling(a[aEnd - 1]),
|
|
112
|
+
map = null;
|
|
113
113
|
while (aStart < aEnd || bStart < bEnd) {
|
|
114
114
|
if (a[aStart] === b[bStart]) {
|
|
115
115
|
aStart++;
|
|
@@ -143,8 +143,8 @@ function createRenderer$1({
|
|
|
143
143
|
if (index != null) {
|
|
144
144
|
if (bStart < index && index < bEnd) {
|
|
145
145
|
let i = aStart,
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
sequence = 1,
|
|
147
|
+
t;
|
|
148
148
|
while (++i < aEnd && i < bEnd) {
|
|
149
149
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
150
150
|
sequence++;
|
package/universal/dist/dev.js
CHANGED
|
@@ -21,7 +21,7 @@ function createRenderer$1({
|
|
|
21
21
|
while (typeof current === "function") current = current();
|
|
22
22
|
if (value === current) return current;
|
|
23
23
|
const t = typeof value,
|
|
24
|
-
|
|
24
|
+
multi = marker !== undefined;
|
|
25
25
|
if (t === "string" || t === "number") {
|
|
26
26
|
if (t === "number") value = value.toString();
|
|
27
27
|
if (multi) {
|
|
@@ -83,7 +83,7 @@ function createRenderer$1({
|
|
|
83
83
|
let dynamic = false;
|
|
84
84
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
85
85
|
let item = array[i],
|
|
86
|
-
|
|
86
|
+
t;
|
|
87
87
|
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
88
88
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
89
89
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
@@ -102,12 +102,12 @@ function createRenderer$1({
|
|
|
102
102
|
}
|
|
103
103
|
function reconcileArrays(parentNode, a, b) {
|
|
104
104
|
let bLength = b.length,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
aEnd = a.length,
|
|
106
|
+
bEnd = bLength,
|
|
107
|
+
aStart = 0,
|
|
108
|
+
bStart = 0,
|
|
109
|
+
after = getNextSibling(a[aEnd - 1]),
|
|
110
|
+
map = null;
|
|
111
111
|
while (aStart < aEnd || bStart < bEnd) {
|
|
112
112
|
if (a[aStart] === b[bStart]) {
|
|
113
113
|
aStart++;
|
|
@@ -141,8 +141,8 @@ function createRenderer$1({
|
|
|
141
141
|
if (index != null) {
|
|
142
142
|
if (bStart < index && index < bEnd) {
|
|
143
143
|
let i = aStart,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
sequence = 1,
|
|
145
|
+
t;
|
|
146
146
|
while (++i < aEnd && i < bEnd) {
|
|
147
147
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
148
148
|
sequence++;
|
|
@@ -23,7 +23,7 @@ function createRenderer$1({
|
|
|
23
23
|
while (typeof current === "function") current = current();
|
|
24
24
|
if (value === current) return current;
|
|
25
25
|
const t = typeof value,
|
|
26
|
-
|
|
26
|
+
multi = marker !== undefined;
|
|
27
27
|
if (t === "string" || t === "number") {
|
|
28
28
|
if (t === "number") value = value.toString();
|
|
29
29
|
if (multi) {
|
|
@@ -85,7 +85,7 @@ function createRenderer$1({
|
|
|
85
85
|
let dynamic = false;
|
|
86
86
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
87
87
|
let item = array[i],
|
|
88
|
-
|
|
88
|
+
t;
|
|
89
89
|
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
90
90
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
91
91
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
@@ -104,12 +104,12 @@ function createRenderer$1({
|
|
|
104
104
|
}
|
|
105
105
|
function reconcileArrays(parentNode, a, b) {
|
|
106
106
|
let bLength = b.length,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
aEnd = a.length,
|
|
108
|
+
bEnd = bLength,
|
|
109
|
+
aStart = 0,
|
|
110
|
+
bStart = 0,
|
|
111
|
+
after = getNextSibling(a[aEnd - 1]),
|
|
112
|
+
map = null;
|
|
113
113
|
while (aStart < aEnd || bStart < bEnd) {
|
|
114
114
|
if (a[aStart] === b[bStart]) {
|
|
115
115
|
aStart++;
|
|
@@ -143,8 +143,8 @@ function createRenderer$1({
|
|
|
143
143
|
if (index != null) {
|
|
144
144
|
if (bStart < index && index < bEnd) {
|
|
145
145
|
let i = aStart,
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
sequence = 1,
|
|
147
|
+
t;
|
|
148
148
|
while (++i < aEnd && i < bEnd) {
|
|
149
149
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
150
150
|
sequence++;
|
|
@@ -21,7 +21,7 @@ function createRenderer$1({
|
|
|
21
21
|
while (typeof current === "function") current = current();
|
|
22
22
|
if (value === current) return current;
|
|
23
23
|
const t = typeof value,
|
|
24
|
-
|
|
24
|
+
multi = marker !== undefined;
|
|
25
25
|
if (t === "string" || t === "number") {
|
|
26
26
|
if (t === "number") value = value.toString();
|
|
27
27
|
if (multi) {
|
|
@@ -83,7 +83,7 @@ function createRenderer$1({
|
|
|
83
83
|
let dynamic = false;
|
|
84
84
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
85
85
|
let item = array[i],
|
|
86
|
-
|
|
86
|
+
t;
|
|
87
87
|
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
88
88
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
89
89
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
@@ -102,12 +102,12 @@ function createRenderer$1({
|
|
|
102
102
|
}
|
|
103
103
|
function reconcileArrays(parentNode, a, b) {
|
|
104
104
|
let bLength = b.length,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
aEnd = a.length,
|
|
106
|
+
bEnd = bLength,
|
|
107
|
+
aStart = 0,
|
|
108
|
+
bStart = 0,
|
|
109
|
+
after = getNextSibling(a[aEnd - 1]),
|
|
110
|
+
map = null;
|
|
111
111
|
while (aStart < aEnd || bStart < bEnd) {
|
|
112
112
|
if (a[aStart] === b[bStart]) {
|
|
113
113
|
aStart++;
|
|
@@ -141,8 +141,8 @@ function createRenderer$1({
|
|
|
141
141
|
if (index != null) {
|
|
142
142
|
if (bStart < index && index < bEnd) {
|
|
143
143
|
let i = aStart,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
sequence = 1,
|
|
145
|
+
t;
|
|
146
146
|
while (++i < aEnd && i < bEnd) {
|
|
147
147
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
148
148
|
sequence++;
|
package/web/dist/dev.cjs
CHANGED
|
@@ -31,12 +31,12 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
|
|
|
31
31
|
|
|
32
32
|
function reconcileArrays(parentNode, a, b) {
|
|
33
33
|
let bLength = b.length,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
aEnd = a.length,
|
|
35
|
+
bEnd = bLength,
|
|
36
|
+
aStart = 0,
|
|
37
|
+
bStart = 0,
|
|
38
|
+
after = a[aEnd - 1].nextSibling,
|
|
39
|
+
map = null;
|
|
40
40
|
while (aStart < aEnd || bStart < bEnd) {
|
|
41
41
|
if (a[aStart] === b[bStart]) {
|
|
42
42
|
aStart++;
|
|
@@ -70,8 +70,8 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
70
70
|
if (index != null) {
|
|
71
71
|
if (bStart < index && index < bEnd) {
|
|
72
72
|
let i = aStart,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
sequence = 1,
|
|
74
|
+
t;
|
|
75
75
|
while (++i < aEnd && i < bEnd) {
|
|
76
76
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
77
77
|
sequence++;
|
|
@@ -144,7 +144,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
144
144
|
}
|
|
145
145
|
function classList(node, value, prev = {}) {
|
|
146
146
|
const classKeys = Object.keys(value || {}),
|
|
147
|
-
|
|
147
|
+
prevKeys = Object.keys(prev);
|
|
148
148
|
let i, len;
|
|
149
149
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
150
150
|
const key = prevKeys[i];
|
|
@@ -154,7 +154,7 @@ function classList(node, value, prev = {}) {
|
|
|
154
154
|
}
|
|
155
155
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
156
156
|
const key = classKeys[i],
|
|
157
|
-
|
|
157
|
+
classValue = !!value[key];
|
|
158
158
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
159
159
|
toggleClassKey(node, key, true);
|
|
160
160
|
prev[key] = classValue;
|
|
@@ -261,8 +261,8 @@ function getNextMatch(el, nodeName) {
|
|
|
261
261
|
}
|
|
262
262
|
function getNextMarker(start) {
|
|
263
263
|
let end = start,
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
count = 0,
|
|
265
|
+
current = [];
|
|
266
266
|
if (solidJs.sharedConfig.context) {
|
|
267
267
|
while (end) {
|
|
268
268
|
if (end.nodeType === 8) {
|
|
@@ -354,7 +354,14 @@ function eventHandler(e) {
|
|
|
354
354
|
});
|
|
355
355
|
if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
|
|
356
356
|
solidJs.sharedConfig.done = true;
|
|
357
|
-
document.querySelectorAll("[id^=pl-]").forEach(elem =>
|
|
357
|
+
document.querySelectorAll("[id^=pl-]").forEach(elem => {
|
|
358
|
+
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
359
|
+
let x = elem.nextSibling;
|
|
360
|
+
elem.remove();
|
|
361
|
+
elem = x;
|
|
362
|
+
}
|
|
363
|
+
elem && elem.remove();
|
|
364
|
+
});
|
|
358
365
|
}
|
|
359
366
|
while (node) {
|
|
360
367
|
const handler = node[key];
|
|
@@ -371,7 +378,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
371
378
|
while (typeof current === "function") current = current();
|
|
372
379
|
if (value === current) return current;
|
|
373
380
|
const t = typeof value,
|
|
374
|
-
|
|
381
|
+
multi = marker !== undefined;
|
|
375
382
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
376
383
|
if (t === "string" || t === "number") {
|
|
377
384
|
if (solidJs.sharedConfig.context) return current;
|
|
@@ -438,7 +445,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
438
445
|
let dynamic = false;
|
|
439
446
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
440
447
|
let item = array[i],
|
|
441
|
-
|
|
448
|
+
prev = current && current[i];
|
|
442
449
|
if (item instanceof Node) {
|
|
443
450
|
normalized.push(item);
|
|
444
451
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
@@ -532,10 +539,10 @@ const hydrate = (...args) => {
|
|
|
532
539
|
};
|
|
533
540
|
function Portal(props) {
|
|
534
541
|
const {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
542
|
+
useShadow
|
|
543
|
+
} = props,
|
|
544
|
+
marker = document.createTextNode(""),
|
|
545
|
+
mount = props.mount || document.body;
|
|
539
546
|
function renderPortal() {
|
|
540
547
|
if (solidJs.sharedConfig.context) {
|
|
541
548
|
const [s, set] = solidJs.createSignal(false);
|
|
@@ -552,9 +559,9 @@ function Portal(props) {
|
|
|
552
559
|
});
|
|
553
560
|
} else {
|
|
554
561
|
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
562
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
563
|
+
mode: "open"
|
|
564
|
+
}) : container;
|
|
558
565
|
Object.defineProperty(container, "_$host", {
|
|
559
566
|
get() {
|
|
560
567
|
return marker.parentNode;
|
package/web/dist/dev.js
CHANGED
|
@@ -30,12 +30,12 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
|
|
|
30
30
|
|
|
31
31
|
function reconcileArrays(parentNode, a, b) {
|
|
32
32
|
let bLength = b.length,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
aEnd = a.length,
|
|
34
|
+
bEnd = bLength,
|
|
35
|
+
aStart = 0,
|
|
36
|
+
bStart = 0,
|
|
37
|
+
after = a[aEnd - 1].nextSibling,
|
|
38
|
+
map = null;
|
|
39
39
|
while (aStart < aEnd || bStart < bEnd) {
|
|
40
40
|
if (a[aStart] === b[bStart]) {
|
|
41
41
|
aStart++;
|
|
@@ -69,8 +69,8 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
69
69
|
if (index != null) {
|
|
70
70
|
if (bStart < index && index < bEnd) {
|
|
71
71
|
let i = aStart,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
sequence = 1,
|
|
73
|
+
t;
|
|
74
74
|
while (++i < aEnd && i < bEnd) {
|
|
75
75
|
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
76
76
|
sequence++;
|
|
@@ -143,7 +143,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
143
143
|
}
|
|
144
144
|
function classList(node, value, prev = {}) {
|
|
145
145
|
const classKeys = Object.keys(value || {}),
|
|
146
|
-
|
|
146
|
+
prevKeys = Object.keys(prev);
|
|
147
147
|
let i, len;
|
|
148
148
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
149
149
|
const key = prevKeys[i];
|
|
@@ -153,7 +153,7 @@ function classList(node, value, prev = {}) {
|
|
|
153
153
|
}
|
|
154
154
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
155
155
|
const key = classKeys[i],
|
|
156
|
-
|
|
156
|
+
classValue = !!value[key];
|
|
157
157
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
158
158
|
toggleClassKey(node, key, true);
|
|
159
159
|
prev[key] = classValue;
|
|
@@ -260,8 +260,8 @@ function getNextMatch(el, nodeName) {
|
|
|
260
260
|
}
|
|
261
261
|
function getNextMarker(start) {
|
|
262
262
|
let end = start,
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
count = 0,
|
|
264
|
+
current = [];
|
|
265
265
|
if (sharedConfig.context) {
|
|
266
266
|
while (end) {
|
|
267
267
|
if (end.nodeType === 8) {
|
|
@@ -353,7 +353,14 @@ function eventHandler(e) {
|
|
|
353
353
|
});
|
|
354
354
|
if (sharedConfig.registry && !sharedConfig.done) {
|
|
355
355
|
sharedConfig.done = true;
|
|
356
|
-
document.querySelectorAll("[id^=pl-]").forEach(elem =>
|
|
356
|
+
document.querySelectorAll("[id^=pl-]").forEach(elem => {
|
|
357
|
+
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
358
|
+
let x = elem.nextSibling;
|
|
359
|
+
elem.remove();
|
|
360
|
+
elem = x;
|
|
361
|
+
}
|
|
362
|
+
elem && elem.remove();
|
|
363
|
+
});
|
|
357
364
|
}
|
|
358
365
|
while (node) {
|
|
359
366
|
const handler = node[key];
|
|
@@ -370,7 +377,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
370
377
|
while (typeof current === "function") current = current();
|
|
371
378
|
if (value === current) return current;
|
|
372
379
|
const t = typeof value,
|
|
373
|
-
|
|
380
|
+
multi = marker !== undefined;
|
|
374
381
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
375
382
|
if (t === "string" || t === "number") {
|
|
376
383
|
if (sharedConfig.context) return current;
|
|
@@ -437,7 +444,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
437
444
|
let dynamic = false;
|
|
438
445
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
439
446
|
let item = array[i],
|
|
440
|
-
|
|
447
|
+
prev = current && current[i];
|
|
441
448
|
if (item instanceof Node) {
|
|
442
449
|
normalized.push(item);
|
|
443
450
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
@@ -531,10 +538,10 @@ const hydrate = (...args) => {
|
|
|
531
538
|
};
|
|
532
539
|
function Portal(props) {
|
|
533
540
|
const {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
541
|
+
useShadow
|
|
542
|
+
} = props,
|
|
543
|
+
marker = document.createTextNode(""),
|
|
544
|
+
mount = props.mount || document.body;
|
|
538
545
|
function renderPortal() {
|
|
539
546
|
if (sharedConfig.context) {
|
|
540
547
|
const [s, set] = createSignal(false);
|
|
@@ -551,9 +558,9 @@ function Portal(props) {
|
|
|
551
558
|
});
|
|
552
559
|
} else {
|
|
553
560
|
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
561
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
562
|
+
mode: "open"
|
|
563
|
+
}) : container;
|
|
557
564
|
Object.defineProperty(container, "_$host", {
|
|
558
565
|
get() {
|
|
559
566
|
return marker.parentNode;
|
package/web/dist/server.cjs
CHANGED
|
@@ -261,7 +261,7 @@ function toRefParam(index) {
|
|
|
261
261
|
return ref;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
const REPLACE_SCRIPT = `function $df(e,t,d
|
|
264
|
+
const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
|
|
265
265
|
function renderToString(code, options = {}) {
|
|
266
266
|
let scripts = "";
|
|
267
267
|
solidJs.sharedConfig.context = {
|
|
@@ -392,7 +392,7 @@ function renderToStream(code, options = {}) {
|
|
|
392
392
|
Promise.resolve().then(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
393
393
|
error && pushTask(serializeSet(dedupe, key, error, serializeError));
|
|
394
394
|
} else {
|
|
395
|
-
buffer.write(`<
|
|
395
|
+
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
396
396
|
pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") + ";" : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
397
397
|
scriptFlushed = true;
|
|
398
398
|
}
|
|
@@ -495,10 +495,10 @@ function ssr(t, ...nodes) {
|
|
|
495
495
|
function ssrClassList(value) {
|
|
496
496
|
if (!value) return "";
|
|
497
497
|
let classKeys = Object.keys(value),
|
|
498
|
-
|
|
498
|
+
result = "";
|
|
499
499
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
500
500
|
const key = classKeys[i],
|
|
501
|
-
|
|
501
|
+
classValue = !!value[key];
|
|
502
502
|
if (!key || key === "undefined" || !classValue) continue;
|
|
503
503
|
i && (result += " ");
|
|
504
504
|
result += key;
|
|
@@ -579,7 +579,7 @@ function escape(s, attr) {
|
|
|
579
579
|
let iAmp = s.indexOf("&");
|
|
580
580
|
if (iDelim < 0 && iAmp < 0) return s;
|
|
581
581
|
let left = 0,
|
|
582
|
-
|
|
582
|
+
out = "";
|
|
583
583
|
while (iDelim >= 0 && iAmp >= 0) {
|
|
584
584
|
if (iDelim < iAmp) {
|
|
585
585
|
if (left < iDelim) out += s.substring(left, iDelim);
|
|
@@ -643,7 +643,8 @@ function generateHydrationScript({
|
|
|
643
643
|
function Hydration(props) {
|
|
644
644
|
if (!solidJs.sharedConfig.context.noHydrate) return props.children;
|
|
645
645
|
const context = solidJs.sharedConfig.context;
|
|
646
|
-
solidJs.sharedConfig.context = {
|
|
646
|
+
solidJs.sharedConfig.context = {
|
|
647
|
+
...context,
|
|
647
648
|
count: 0,
|
|
648
649
|
id: `${context.id}${context.count++}-`,
|
|
649
650
|
noHydrate: false
|
|
@@ -701,21 +702,12 @@ function serializeSet(registry, key, value, serializer = stringify) {
|
|
|
701
702
|
return `_$HY.set("${key}", ${serializer(value)})`;
|
|
702
703
|
}
|
|
703
704
|
function replacePlaceholder(html, key, value) {
|
|
704
|
-
const
|
|
705
|
-
const
|
|
705
|
+
const marker = `<template id="pl-${key}">`;
|
|
706
|
+
const close = `<!pl-${key}>`;
|
|
706
707
|
const first = html.indexOf(marker);
|
|
707
708
|
if (first === -1) return html;
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
let open = 0,
|
|
711
|
-
close = 0;
|
|
712
|
-
while (match = nextRegex.exec(html)) {
|
|
713
|
-
if (match[0][1] === "/") {
|
|
714
|
-
close++;
|
|
715
|
-
if (close > open) break;
|
|
716
|
-
} else open++;
|
|
717
|
-
}
|
|
718
|
-
return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
|
|
709
|
+
const last = html.indexOf(close, first + marker.length);
|
|
710
|
+
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
719
711
|
}
|
|
720
712
|
function Assets(props) {
|
|
721
713
|
useAssets(() => props.children);
|
|
@@ -794,7 +786,7 @@ function delegateEvents() {}
|
|
|
794
786
|
function Dynamic(props) {
|
|
795
787
|
const [p, others] = solidJs.splitProps(props, ["component"]);
|
|
796
788
|
const comp = p.component,
|
|
797
|
-
|
|
789
|
+
t = typeof comp;
|
|
798
790
|
if (comp) {
|
|
799
791
|
if (t === "function") return comp(others);else if (t === "string") {
|
|
800
792
|
return ssrElement(comp, others, undefined, true);
|
package/web/dist/server.js
CHANGED
|
@@ -260,7 +260,7 @@ function toRefParam(index) {
|
|
|
260
260
|
return ref;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
const REPLACE_SCRIPT = `function $df(e,t,d
|
|
263
|
+
const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
|
|
264
264
|
function renderToString(code, options = {}) {
|
|
265
265
|
let scripts = "";
|
|
266
266
|
sharedConfig.context = {
|
|
@@ -391,7 +391,7 @@ function renderToStream(code, options = {}) {
|
|
|
391
391
|
Promise.resolve().then(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
|
|
392
392
|
error && pushTask(serializeSet(dedupe, key, error, serializeError));
|
|
393
393
|
} else {
|
|
394
|
-
buffer.write(`<
|
|
394
|
+
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
395
395
|
pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") + ";" : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
396
396
|
scriptFlushed = true;
|
|
397
397
|
}
|
|
@@ -494,10 +494,10 @@ function ssr(t, ...nodes) {
|
|
|
494
494
|
function ssrClassList(value) {
|
|
495
495
|
if (!value) return "";
|
|
496
496
|
let classKeys = Object.keys(value),
|
|
497
|
-
|
|
497
|
+
result = "";
|
|
498
498
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
499
499
|
const key = classKeys[i],
|
|
500
|
-
|
|
500
|
+
classValue = !!value[key];
|
|
501
501
|
if (!key || key === "undefined" || !classValue) continue;
|
|
502
502
|
i && (result += " ");
|
|
503
503
|
result += key;
|
|
@@ -578,7 +578,7 @@ function escape(s, attr) {
|
|
|
578
578
|
let iAmp = s.indexOf("&");
|
|
579
579
|
if (iDelim < 0 && iAmp < 0) return s;
|
|
580
580
|
let left = 0,
|
|
581
|
-
|
|
581
|
+
out = "";
|
|
582
582
|
while (iDelim >= 0 && iAmp >= 0) {
|
|
583
583
|
if (iDelim < iAmp) {
|
|
584
584
|
if (left < iDelim) out += s.substring(left, iDelim);
|
|
@@ -642,7 +642,8 @@ function generateHydrationScript({
|
|
|
642
642
|
function Hydration(props) {
|
|
643
643
|
if (!sharedConfig.context.noHydrate) return props.children;
|
|
644
644
|
const context = sharedConfig.context;
|
|
645
|
-
sharedConfig.context = {
|
|
645
|
+
sharedConfig.context = {
|
|
646
|
+
...context,
|
|
646
647
|
count: 0,
|
|
647
648
|
id: `${context.id}${context.count++}-`,
|
|
648
649
|
noHydrate: false
|
|
@@ -700,21 +701,12 @@ function serializeSet(registry, key, value, serializer = stringify) {
|
|
|
700
701
|
return `_$HY.set("${key}", ${serializer(value)})`;
|
|
701
702
|
}
|
|
702
703
|
function replacePlaceholder(html, key, value) {
|
|
703
|
-
const
|
|
704
|
-
const
|
|
704
|
+
const marker = `<template id="pl-${key}">`;
|
|
705
|
+
const close = `<!pl-${key}>`;
|
|
705
706
|
const first = html.indexOf(marker);
|
|
706
707
|
if (first === -1) return html;
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
let open = 0,
|
|
710
|
-
close = 0;
|
|
711
|
-
while (match = nextRegex.exec(html)) {
|
|
712
|
-
if (match[0][1] === "/") {
|
|
713
|
-
close++;
|
|
714
|
-
if (close > open) break;
|
|
715
|
-
} else open++;
|
|
716
|
-
}
|
|
717
|
-
return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
|
|
708
|
+
const last = html.indexOf(close, first + marker.length);
|
|
709
|
+
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
718
710
|
}
|
|
719
711
|
function Assets(props) {
|
|
720
712
|
useAssets(() => props.children);
|
|
@@ -793,7 +785,7 @@ function delegateEvents() {}
|
|
|
793
785
|
function Dynamic(props) {
|
|
794
786
|
const [p, others] = splitProps(props, ["component"]);
|
|
795
787
|
const comp = p.component,
|
|
796
|
-
|
|
788
|
+
t = typeof comp;
|
|
797
789
|
if (comp) {
|
|
798
790
|
if (t === "function") return comp(others);else if (t === "string") {
|
|
799
791
|
return ssrElement(comp, others, undefined, true);
|