solid-js 1.6.8 → 1.6.10
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 +144 -127
- package/dist/dev.js +144 -127
- package/dist/server.cjs +30 -25
- package/dist/server.js +30 -25
- package/dist/solid.cjs +130 -115
- package/dist/solid.js +130 -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/index.d.ts +1 -1
- package/types/reactive/observable.d.ts +8 -6
- package/types/reactive/signal.d.ts +12 -9
- package/types/render/Suspense.d.ts +2 -2
- package/types/render/flow.d.ts +6 -6
- 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/web/types/index.d.ts +3 -3
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);
|
package/web/dist/web.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++;
|
|
@@ -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;
|
|
@@ -258,8 +258,8 @@ function getNextMatch(el, nodeName) {
|
|
|
258
258
|
}
|
|
259
259
|
function getNextMarker(start) {
|
|
260
260
|
let end = start,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
count = 0,
|
|
262
|
+
current = [];
|
|
263
263
|
if (solidJs.sharedConfig.context) {
|
|
264
264
|
while (end) {
|
|
265
265
|
if (end.nodeType === 8) {
|
|
@@ -351,7 +351,14 @@ function eventHandler(e) {
|
|
|
351
351
|
});
|
|
352
352
|
if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
|
|
353
353
|
solidJs.sharedConfig.done = true;
|
|
354
|
-
document.querySelectorAll("[id^=pl-]").forEach(elem =>
|
|
354
|
+
document.querySelectorAll("[id^=pl-]").forEach(elem => {
|
|
355
|
+
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
356
|
+
let x = elem.nextSibling;
|
|
357
|
+
elem.remove();
|
|
358
|
+
elem = x;
|
|
359
|
+
}
|
|
360
|
+
elem && elem.remove();
|
|
361
|
+
});
|
|
355
362
|
}
|
|
356
363
|
while (node) {
|
|
357
364
|
const handler = node[key];
|
|
@@ -368,7 +375,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
368
375
|
while (typeof current === "function") current = current();
|
|
369
376
|
if (value === current) return current;
|
|
370
377
|
const t = typeof value,
|
|
371
|
-
|
|
378
|
+
multi = marker !== undefined;
|
|
372
379
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
373
380
|
if (t === "string" || t === "number") {
|
|
374
381
|
if (solidJs.sharedConfig.context) return current;
|
|
@@ -435,7 +442,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
435
442
|
let dynamic = false;
|
|
436
443
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
437
444
|
let item = array[i],
|
|
438
|
-
|
|
445
|
+
prev = current && current[i];
|
|
439
446
|
if (item instanceof Node) {
|
|
440
447
|
normalized.push(item);
|
|
441
448
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
@@ -529,10 +536,10 @@ const hydrate = (...args) => {
|
|
|
529
536
|
};
|
|
530
537
|
function Portal(props) {
|
|
531
538
|
const {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
539
|
+
useShadow
|
|
540
|
+
} = props,
|
|
541
|
+
marker = document.createTextNode(""),
|
|
542
|
+
mount = props.mount || document.body;
|
|
536
543
|
function renderPortal() {
|
|
537
544
|
if (solidJs.sharedConfig.context) {
|
|
538
545
|
const [s, set] = solidJs.createSignal(false);
|
|
@@ -549,9 +556,9 @@ function Portal(props) {
|
|
|
549
556
|
});
|
|
550
557
|
} else {
|
|
551
558
|
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
559
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
560
|
+
mode: "open"
|
|
561
|
+
}) : container;
|
|
555
562
|
Object.defineProperty(container, "_$host", {
|
|
556
563
|
get() {
|
|
557
564
|
return marker.parentNode;
|
package/web/dist/web.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++;
|
|
@@ -142,7 +142,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
142
142
|
}
|
|
143
143
|
function classList(node, value, prev = {}) {
|
|
144
144
|
const classKeys = Object.keys(value || {}),
|
|
145
|
-
|
|
145
|
+
prevKeys = Object.keys(prev);
|
|
146
146
|
let i, len;
|
|
147
147
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
148
148
|
const key = prevKeys[i];
|
|
@@ -152,7 +152,7 @@ function classList(node, value, prev = {}) {
|
|
|
152
152
|
}
|
|
153
153
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
154
154
|
const key = classKeys[i],
|
|
155
|
-
|
|
155
|
+
classValue = !!value[key];
|
|
156
156
|
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
157
157
|
toggleClassKey(node, key, true);
|
|
158
158
|
prev[key] = classValue;
|
|
@@ -257,8 +257,8 @@ function getNextMatch(el, nodeName) {
|
|
|
257
257
|
}
|
|
258
258
|
function getNextMarker(start) {
|
|
259
259
|
let end = start,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
count = 0,
|
|
261
|
+
current = [];
|
|
262
262
|
if (sharedConfig.context) {
|
|
263
263
|
while (end) {
|
|
264
264
|
if (end.nodeType === 8) {
|
|
@@ -350,7 +350,14 @@ function eventHandler(e) {
|
|
|
350
350
|
});
|
|
351
351
|
if (sharedConfig.registry && !sharedConfig.done) {
|
|
352
352
|
sharedConfig.done = true;
|
|
353
|
-
document.querySelectorAll("[id^=pl-]").forEach(elem =>
|
|
353
|
+
document.querySelectorAll("[id^=pl-]").forEach(elem => {
|
|
354
|
+
while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
|
|
355
|
+
let x = elem.nextSibling;
|
|
356
|
+
elem.remove();
|
|
357
|
+
elem = x;
|
|
358
|
+
}
|
|
359
|
+
elem && elem.remove();
|
|
360
|
+
});
|
|
354
361
|
}
|
|
355
362
|
while (node) {
|
|
356
363
|
const handler = node[key];
|
|
@@ -367,7 +374,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
367
374
|
while (typeof current === "function") current = current();
|
|
368
375
|
if (value === current) return current;
|
|
369
376
|
const t = typeof value,
|
|
370
|
-
|
|
377
|
+
multi = marker !== undefined;
|
|
371
378
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
372
379
|
if (t === "string" || t === "number") {
|
|
373
380
|
if (sharedConfig.context) return current;
|
|
@@ -434,7 +441,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
434
441
|
let dynamic = false;
|
|
435
442
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
436
443
|
let item = array[i],
|
|
437
|
-
|
|
444
|
+
prev = current && current[i];
|
|
438
445
|
if (item instanceof Node) {
|
|
439
446
|
normalized.push(item);
|
|
440
447
|
} else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
@@ -528,10 +535,10 @@ const hydrate = (...args) => {
|
|
|
528
535
|
};
|
|
529
536
|
function Portal(props) {
|
|
530
537
|
const {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
538
|
+
useShadow
|
|
539
|
+
} = props,
|
|
540
|
+
marker = document.createTextNode(""),
|
|
541
|
+
mount = props.mount || document.body;
|
|
535
542
|
function renderPortal() {
|
|
536
543
|
if (sharedConfig.context) {
|
|
537
544
|
const [s, set] = createSignal(false);
|
|
@@ -548,9 +555,9 @@ function Portal(props) {
|
|
|
548
555
|
});
|
|
549
556
|
} else {
|
|
550
557
|
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
558
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
559
|
+
mode: "open"
|
|
560
|
+
}) : container;
|
|
554
561
|
Object.defineProperty(container, "_$host", {
|
|
555
562
|
get() {
|
|
556
563
|
return marker.parentNode;
|
package/web/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const hydrate: typeof hydrateCore;
|
|
|
10
10
|
*
|
|
11
11
|
* Useful for inserting modals and tooltips outside of an cropping layout. If no mount point is given, the portal is inserted in document.body; it is wrapped in a `<div>` unless the target is document.head or `isSVG` is true. setting `useShadow` to true places the element in a shadow root to isolate styles.
|
|
12
12
|
*
|
|
13
|
-
* @description https://www.solidjs.com/docs/latest/api
|
|
13
|
+
* @description https://www.solidjs.com/docs/latest/api#portal
|
|
14
14
|
*/
|
|
15
15
|
export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
|
|
16
16
|
mount?: Node;
|
|
@@ -21,7 +21,7 @@ export declare function Portal<T extends boolean = false, S extends boolean = fa
|
|
|
21
21
|
} : {}) & (S extends true ? SVGGElement : HTMLDivElement)) => void);
|
|
22
22
|
children: JSX.Element;
|
|
23
23
|
}): Text;
|
|
24
|
-
declare type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
24
|
+
export declare type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
25
25
|
[K in keyof P]: P[K];
|
|
26
26
|
} & {
|
|
27
27
|
component: T | undefined;
|
|
@@ -31,6 +31,6 @@ declare type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
31
31
|
* ```typescript
|
|
32
32
|
* <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
|
|
33
33
|
* ```
|
|
34
|
-
* @description https://www.solidjs.com/docs/latest/api
|
|
34
|
+
* @description https://www.solidjs.com/docs/latest/api#dynamic
|
|
35
35
|
*/
|
|
36
36
|
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): Accessor<JSX.Element>;
|