@solidjs/web 2.0.0-experimental.2 → 2.0.0-experimental.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/dist/dev.cjs +10 -6
- package/dist/dev.js +12 -6
- package/dist/server.cjs +18 -2
- package/dist/server.js +23 -2
- package/dist/web.cjs +10 -6
- package/dist/web.js +12 -6
- package/package.json +3 -3
package/dist/dev.cjs
CHANGED
|
@@ -363,14 +363,17 @@ function toggleClassKey(node, key, value) {
|
|
|
363
363
|
function classListToObject(classList) {
|
|
364
364
|
if (Array.isArray(classList)) {
|
|
365
365
|
const result = {};
|
|
366
|
-
|
|
367
|
-
const key = classList[i];
|
|
368
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
|
|
369
|
-
}
|
|
366
|
+
flattenClassList(classList, result);
|
|
370
367
|
return result;
|
|
371
368
|
}
|
|
372
369
|
return classList;
|
|
373
370
|
}
|
|
371
|
+
function flattenClassList(list, result) {
|
|
372
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
373
|
+
const item = list[i];
|
|
374
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
374
377
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
375
378
|
let propAlias, forceProp;
|
|
376
379
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -398,7 +401,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
398
401
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
399
402
|
setBoolAttribute(node, prop.slice(5), value);
|
|
400
403
|
} else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
|
|
401
|
-
if (forceProp) prop = prop.slice(5);
|
|
404
|
+
if (forceProp) prop = prop.slice(5);
|
|
405
|
+
if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
|
|
402
406
|
} else {
|
|
403
407
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
404
408
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -493,7 +497,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
493
497
|
doNotUnwrap
|
|
494
498
|
});
|
|
495
499
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
496
|
-
if (multi &&
|
|
500
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
497
501
|
if (Array.isArray(value)) {
|
|
498
502
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
499
503
|
const item = value[i],
|
package/dist/dev.js
CHANGED
|
@@ -830,15 +830,19 @@ function toggleClassKey(node, key, value) {
|
|
|
830
830
|
function classListToObject(classList) {
|
|
831
831
|
if (Array.isArray(classList)) {
|
|
832
832
|
const result = {};
|
|
833
|
-
|
|
834
|
-
const key = classList[i];
|
|
835
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);
|
|
836
|
-
else if (key || key === 0) result[key] = true;
|
|
837
|
-
}
|
|
833
|
+
flattenClassList(classList, result);
|
|
838
834
|
return result;
|
|
839
835
|
}
|
|
840
836
|
return classList;
|
|
841
837
|
}
|
|
838
|
+
function flattenClassList(list, result) {
|
|
839
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
840
|
+
const item = list[i];
|
|
841
|
+
if (Array.isArray(item)) flattenClassList(item, result);
|
|
842
|
+
else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
843
|
+
else if (item || item === 0) result[item] = true;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
842
846
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
843
847
|
let propAlias, forceProp;
|
|
844
848
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -872,6 +876,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
872
876
|
Properties.has(prop)
|
|
873
877
|
) {
|
|
874
878
|
if (forceProp) prop = prop.slice(5);
|
|
879
|
+
if (prop === "value" && node.nodeName === "SELECT")
|
|
880
|
+
queueMicrotask(() => (node.value = value)) || (node.value = value);
|
|
875
881
|
else node[propAlias || prop] = value;
|
|
876
882
|
} else {
|
|
877
883
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -972,7 +978,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
972
978
|
doNotUnwrap
|
|
973
979
|
});
|
|
974
980
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
975
|
-
if (multi &&
|
|
981
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
976
982
|
if (Array.isArray(value)) {
|
|
977
983
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
978
984
|
const item = value[i],
|
package/dist/server.cjs
CHANGED
|
@@ -369,6 +369,8 @@ function ssr(t, ...nodes) {
|
|
|
369
369
|
}
|
|
370
370
|
function ssrClassName(value) {
|
|
371
371
|
if (!value) return "";
|
|
372
|
+
if (typeof value === "string") return escape(value, true);
|
|
373
|
+
value = classListToObject(value);
|
|
372
374
|
let classKeys = Object.keys(value),
|
|
373
375
|
result = "";
|
|
374
376
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
@@ -403,7 +405,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
403
405
|
for (let i = 0; i < keys.length; i++) {
|
|
404
406
|
const prop = keys[i];
|
|
405
407
|
if (ChildProperties.has(prop)) {
|
|
406
|
-
if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
408
|
+
if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
|
|
407
409
|
continue;
|
|
408
410
|
}
|
|
409
411
|
const value = props[prop];
|
|
@@ -421,7 +423,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
421
423
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
422
424
|
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
423
425
|
} else {
|
|
424
|
-
result += `${
|
|
426
|
+
result += `${escape(prop)}="${escape(value, true)}"`;
|
|
425
427
|
}
|
|
426
428
|
if (i !== keys.length - 1) result += " ";
|
|
427
429
|
}
|
|
@@ -579,6 +581,20 @@ function replacePlaceholder(html, key, value) {
|
|
|
579
581
|
const last = html.indexOf(close, first + marker.length);
|
|
580
582
|
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
581
583
|
}
|
|
584
|
+
function classListToObject(classList) {
|
|
585
|
+
if (Array.isArray(classList)) {
|
|
586
|
+
const result = {};
|
|
587
|
+
flattenClassList(classList, result);
|
|
588
|
+
return result;
|
|
589
|
+
}
|
|
590
|
+
return classList;
|
|
591
|
+
}
|
|
592
|
+
function flattenClassList(list, result) {
|
|
593
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
594
|
+
const item = list[i];
|
|
595
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
582
598
|
const RequestContext = Symbol();
|
|
583
599
|
function getRequestEvent() {
|
|
584
600
|
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.log("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
|
package/dist/server.js
CHANGED
|
@@ -816,6 +816,8 @@ function ssr(t, ...nodes) {
|
|
|
816
816
|
}
|
|
817
817
|
function ssrClassName(value) {
|
|
818
818
|
if (!value) return "";
|
|
819
|
+
if (typeof value === "string") return escape(value, true);
|
|
820
|
+
value = classListToObject(value);
|
|
819
821
|
let classKeys = Object.keys(value),
|
|
820
822
|
result = "";
|
|
821
823
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
@@ -852,7 +854,10 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
852
854
|
const prop = keys[i];
|
|
853
855
|
if (ChildProperties.has(prop)) {
|
|
854
856
|
if (children === undefined && !skipChildren)
|
|
855
|
-
children =
|
|
857
|
+
children =
|
|
858
|
+
tag === "script" || tag === "style" || prop === "innerHTML"
|
|
859
|
+
? props[prop]
|
|
860
|
+
: escape(props[prop]);
|
|
856
861
|
continue;
|
|
857
862
|
}
|
|
858
863
|
const value = props[prop];
|
|
@@ -876,7 +881,7 @@ function ssrElement(tag, props, children, needsId) {
|
|
|
876
881
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
877
882
|
result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
|
|
878
883
|
} else {
|
|
879
|
-
result += `${
|
|
884
|
+
result += `${escape(prop)}="${escape(value, true)}"`;
|
|
880
885
|
}
|
|
881
886
|
if (i !== keys.length - 1) result += " ";
|
|
882
887
|
}
|
|
@@ -1037,6 +1042,22 @@ function replacePlaceholder(html, key, value) {
|
|
|
1037
1042
|
const last = html.indexOf(close, first + marker.length);
|
|
1038
1043
|
return html.slice(0, first) + value + html.slice(last + close.length);
|
|
1039
1044
|
}
|
|
1045
|
+
function classListToObject(classList) {
|
|
1046
|
+
if (Array.isArray(classList)) {
|
|
1047
|
+
const result = {};
|
|
1048
|
+
flattenClassList(classList, result);
|
|
1049
|
+
return result;
|
|
1050
|
+
}
|
|
1051
|
+
return classList;
|
|
1052
|
+
}
|
|
1053
|
+
function flattenClassList(list, result) {
|
|
1054
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
1055
|
+
const item = list[i];
|
|
1056
|
+
if (Array.isArray(item)) flattenClassList(item, result);
|
|
1057
|
+
else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1058
|
+
else if (item || item === 0) result[item] = true;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1040
1061
|
const RequestContext = Symbol();
|
|
1041
1062
|
function getRequestEvent() {
|
|
1042
1063
|
return globalThis[RequestContext]
|
package/dist/web.cjs
CHANGED
|
@@ -355,14 +355,17 @@ function toggleClassKey(node, key, value) {
|
|
|
355
355
|
function classListToObject(classList) {
|
|
356
356
|
if (Array.isArray(classList)) {
|
|
357
357
|
const result = {};
|
|
358
|
-
|
|
359
|
-
const key = classList[i];
|
|
360
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
|
|
361
|
-
}
|
|
358
|
+
flattenClassList(classList, result);
|
|
362
359
|
return result;
|
|
363
360
|
}
|
|
364
361
|
return classList;
|
|
365
362
|
}
|
|
363
|
+
function flattenClassList(list, result) {
|
|
364
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
365
|
+
const item = list[i];
|
|
366
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
366
369
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
367
370
|
let propAlias, forceProp;
|
|
368
371
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -390,7 +393,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
390
393
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
391
394
|
setBoolAttribute(node, prop.slice(5), value);
|
|
392
395
|
} else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
|
|
393
|
-
if (forceProp) prop = prop.slice(5);
|
|
396
|
+
if (forceProp) prop = prop.slice(5);
|
|
397
|
+
if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
|
|
394
398
|
} else {
|
|
395
399
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
396
400
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -485,7 +489,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
485
489
|
doNotUnwrap
|
|
486
490
|
});
|
|
487
491
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
488
|
-
if (multi &&
|
|
492
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
489
493
|
if (Array.isArray(value)) {
|
|
490
494
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
491
495
|
const item = value[i],
|
package/dist/web.js
CHANGED
|
@@ -812,15 +812,19 @@ function toggleClassKey(node, key, value) {
|
|
|
812
812
|
function classListToObject(classList) {
|
|
813
813
|
if (Array.isArray(classList)) {
|
|
814
814
|
const result = {};
|
|
815
|
-
|
|
816
|
-
const key = classList[i];
|
|
817
|
-
if (typeof key === "object" && key != null) Object.assign(result, key);
|
|
818
|
-
else if (key || key === 0) result[key] = true;
|
|
819
|
-
}
|
|
815
|
+
flattenClassList(classList, result);
|
|
820
816
|
return result;
|
|
821
817
|
}
|
|
822
818
|
return classList;
|
|
823
819
|
}
|
|
820
|
+
function flattenClassList(list, result) {
|
|
821
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
822
|
+
const item = list[i];
|
|
823
|
+
if (Array.isArray(item)) flattenClassList(item, result);
|
|
824
|
+
else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
825
|
+
else if (item || item === 0) result[item] = true;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
824
828
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
825
829
|
let propAlias, forceProp;
|
|
826
830
|
if (prop === "style") return style(node, value, prev), value;
|
|
@@ -854,6 +858,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
854
858
|
Properties.has(prop)
|
|
855
859
|
) {
|
|
856
860
|
if (forceProp) prop = prop.slice(5);
|
|
861
|
+
if (prop === "value" && node.nodeName === "SELECT")
|
|
862
|
+
queueMicrotask(() => (node.value = value)) || (node.value = value);
|
|
857
863
|
else node[propAlias || prop] = value;
|
|
858
864
|
} else {
|
|
859
865
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -954,7 +960,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
954
960
|
doNotUnwrap
|
|
955
961
|
});
|
|
956
962
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
957
|
-
if (multi &&
|
|
963
|
+
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
958
964
|
if (Array.isArray(value)) {
|
|
959
965
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
960
966
|
const item = value[i],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime for the browser and the server",
|
|
4
|
-
"version": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.3",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"seroval-plugins": "^1.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"solid-js": "^2.0.0-experimental.
|
|
78
|
+
"solid-js": "^2.0.0-experimental.3"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"solid-js": "2.0.0-experimental.
|
|
81
|
+
"solid-js": "2.0.0-experimental.3"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "npm-run-all -nl build:*",
|