@solidjs/web 2.0.0-experimental.1 → 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/LICENSE +1 -1
- package/dist/dev.cjs +19 -11
- package/dist/dev.js +639 -85
- package/dist/server.cjs +27 -7
- package/dist/server.js +647 -103
- package/dist/web.cjs +19 -11
- package/dist/web.js +627 -83
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +11 -2
- package/types/core.d.ts +11 -1
- package/types/index.d.ts +20 -4
- package/types/server-mock.d.ts +33 -26
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],
|
|
@@ -601,22 +605,25 @@ function createElementProxy(el, marker) {
|
|
|
601
605
|
}
|
|
602
606
|
});
|
|
603
607
|
}
|
|
604
|
-
function
|
|
605
|
-
const
|
|
606
|
-
const cached = solidJs.createMemo(() => props.component);
|
|
608
|
+
function createDynamic(component, props) {
|
|
609
|
+
const cached = solidJs.createMemo(component);
|
|
607
610
|
return solidJs.createMemo(() => {
|
|
608
611
|
const component = cached();
|
|
609
612
|
switch (typeof component) {
|
|
610
613
|
case "function":
|
|
611
|
-
return solidJs.untrack(() => component(
|
|
614
|
+
return solidJs.untrack(() => component(props));
|
|
612
615
|
case "string":
|
|
613
616
|
const isSvg = SVGElements.has(component);
|
|
614
617
|
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
615
|
-
spread(el,
|
|
618
|
+
spread(el, props, isSvg);
|
|
616
619
|
return el;
|
|
617
620
|
}
|
|
618
621
|
});
|
|
619
622
|
}
|
|
623
|
+
function Dynamic(props) {
|
|
624
|
+
const others = solidJs.omit(props, "component");
|
|
625
|
+
return createDynamic(() => props.component, others);
|
|
626
|
+
}
|
|
620
627
|
|
|
621
628
|
Object.defineProperty(exports, "ErrorBoundary", {
|
|
622
629
|
enumerable: true,
|
|
@@ -683,6 +690,7 @@ exports.addEventListener = addEventListener;
|
|
|
683
690
|
exports.assign = assign;
|
|
684
691
|
exports.className = className;
|
|
685
692
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
693
|
+
exports.createDynamic = createDynamic;
|
|
686
694
|
exports.delegateEvents = delegateEvents;
|
|
687
695
|
exports.dynamicProperty = dynamicProperty;
|
|
688
696
|
exports.escape = escape;
|