@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/LICENSE
CHANGED
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],
|
|
@@ -609,9 +613,8 @@ function createElementProxy(el, marker) {
|
|
|
609
613
|
}
|
|
610
614
|
});
|
|
611
615
|
}
|
|
612
|
-
function
|
|
613
|
-
const
|
|
614
|
-
const cached = solidJs.createMemo(() => props.component);
|
|
616
|
+
function createDynamic(component, props) {
|
|
617
|
+
const cached = solidJs.createMemo(component);
|
|
615
618
|
return solidJs.createMemo(() => {
|
|
616
619
|
const component = cached();
|
|
617
620
|
switch (typeof component) {
|
|
@@ -619,15 +622,19 @@ function Dynamic(props) {
|
|
|
619
622
|
Object.assign(component, {
|
|
620
623
|
[solidJs.$DEVCOMP]: true
|
|
621
624
|
});
|
|
622
|
-
return solidJs.untrack(() => component(
|
|
625
|
+
return solidJs.untrack(() => component(props));
|
|
623
626
|
case "string":
|
|
624
627
|
const isSvg = SVGElements.has(component);
|
|
625
628
|
const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
|
|
626
|
-
spread(el,
|
|
629
|
+
spread(el, props, isSvg);
|
|
627
630
|
return el;
|
|
628
631
|
}
|
|
629
632
|
});
|
|
630
633
|
}
|
|
634
|
+
function Dynamic(props) {
|
|
635
|
+
const others = solidJs.omit(props, "component");
|
|
636
|
+
return createDynamic(() => props.component, others);
|
|
637
|
+
}
|
|
631
638
|
|
|
632
639
|
Object.defineProperty(exports, "ErrorBoundary", {
|
|
633
640
|
enumerable: true,
|
|
@@ -694,6 +701,7 @@ exports.addEventListener = addEventListener;
|
|
|
694
701
|
exports.assign = assign;
|
|
695
702
|
exports.className = className;
|
|
696
703
|
exports.clearDelegatedEvents = clearDelegatedEvents;
|
|
704
|
+
exports.createDynamic = createDynamic;
|
|
697
705
|
exports.delegateEvents = delegateEvents;
|
|
698
706
|
exports.dynamicProperty = dynamicProperty;
|
|
699
707
|
exports.escape = escape;
|