@solidjs/web 2.0.0-rc.5 → 2.0.0-rc.6
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 +113 -31
- package/dist/dev.js +113 -32
- package/dist/server.cjs +17 -3
- package/dist/server.js +17 -3
- package/dist/web.cjs +113 -31
- package/dist/web.js +113 -32
- package/frames/dist/server.cjs +87 -22
- package/frames/dist/server.js +87 -22
- package/package.json +2 -2
- package/server-functions/dist/client.cjs +14 -2
- package/server-functions/dist/client.js +14 -2
- package/server-functions/dist/server.cjs +219 -69
- package/server-functions/dist/server.dev.cjs +219 -69
- package/server-functions/dist/server.dev.js +219 -69
- package/server-functions/dist/server.js +219 -69
- package/types/client.d.ts +2 -1
- package/types/constants.d.ts +3 -1
- package/types/server-functions/server.d.ts +73 -2
- package/types-cjs/client.d.cts +2 -1
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/server-functions/server.d.cts +73 -2
package/dist/dev.cjs
CHANGED
|
@@ -49,6 +49,7 @@ const Namespaces = {
|
|
|
49
49
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
50
50
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
51
51
|
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
52
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
52
53
|
|
|
53
54
|
const transparentOptions = {
|
|
54
55
|
transparent: true,
|
|
@@ -361,6 +362,8 @@ function installListDriver(driver) {
|
|
|
361
362
|
exports.listDriver = driver;
|
|
362
363
|
}
|
|
363
364
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
365
|
+
const $$EVENT_TUPLE = Symbol();
|
|
366
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
364
367
|
const INNER_OWNED = {};
|
|
365
368
|
const delegatedEvents = new Set();
|
|
366
369
|
const delegatedContainers = new Map();
|
|
@@ -486,7 +489,8 @@ function findOwner(target, state) {
|
|
|
486
489
|
}
|
|
487
490
|
function setProperty(node, name, value) {
|
|
488
491
|
if (isHydrating(node)) return;
|
|
489
|
-
|
|
492
|
+
const nodeName = node.nodeName;
|
|
493
|
+
if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
|
|
490
494
|
}
|
|
491
495
|
let claimHandlers = null;
|
|
492
496
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -520,7 +524,17 @@ function claimElement(node) {
|
|
|
520
524
|
}
|
|
521
525
|
function setAttribute(node, name, value) {
|
|
522
526
|
if (isHydrating(node)) return;
|
|
523
|
-
|
|
527
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
528
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
529
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
530
|
+
if (selectMultiple && !node._$multiple) {
|
|
531
|
+
const options = node.options;
|
|
532
|
+
for (let i = 0; i < options.length; i++) {
|
|
533
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (selectMultiple) node._$multiple = true;
|
|
524
538
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
525
539
|
}
|
|
526
540
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -528,22 +542,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
528
542
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
529
543
|
}
|
|
530
544
|
function className(node, value, prev) {
|
|
531
|
-
if (
|
|
545
|
+
if (typeof value === "number") value = "" + value;
|
|
546
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
547
|
+
if (isHydrating(node)) {
|
|
548
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
532
551
|
if (value == null || value === false) {
|
|
533
|
-
prev
|
|
552
|
+
if (prev || node._$classes) {
|
|
553
|
+
node.removeAttribute("class");
|
|
554
|
+
node._$classes = undefined;
|
|
555
|
+
}
|
|
534
556
|
return;
|
|
535
557
|
}
|
|
536
558
|
if (typeof value === "string") {
|
|
559
|
+
node._$classes = undefined;
|
|
537
560
|
value !== prev && node.setAttribute("class", value);
|
|
538
561
|
return;
|
|
539
562
|
}
|
|
563
|
+
let applied;
|
|
540
564
|
if (typeof prev === "string") {
|
|
541
|
-
|
|
565
|
+
applied = {};
|
|
542
566
|
node.removeAttribute("class");
|
|
543
|
-
} else
|
|
567
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
544
568
|
value = classListToObject(value);
|
|
545
|
-
const classKeys = Object.keys(value
|
|
546
|
-
const prevKeys = Object.keys(
|
|
569
|
+
const classKeys = Object.keys(value);
|
|
570
|
+
const prevKeys = Object.keys(applied);
|
|
547
571
|
let i, len;
|
|
548
572
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
549
573
|
const key = prevKeys[i];
|
|
@@ -553,22 +577,34 @@ function className(node, value, prev) {
|
|
|
553
577
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
554
578
|
const key = classKeys[i],
|
|
555
579
|
classValue = !!value[key];
|
|
556
|
-
if (!key || key === "undefined" ||
|
|
580
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
557
581
|
node.classList.add(key);
|
|
558
582
|
}
|
|
583
|
+
node._$classes = value;
|
|
559
584
|
}
|
|
560
585
|
function addEvent(node, name, handler, delegate) {
|
|
561
586
|
if (delegate) {
|
|
587
|
+
const key = `$$${name}`;
|
|
588
|
+
let data;
|
|
562
589
|
if (Array.isArray(handler)) {
|
|
563
|
-
|
|
564
|
-
node[
|
|
565
|
-
} else node[
|
|
566
|
-
|
|
590
|
+
data = handler[1];
|
|
591
|
+
node[key] = handler[0];
|
|
592
|
+
} else node[key] = handler;
|
|
593
|
+
node[`${key}Data`] = data;
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
if (Array.isArray(handler)) {
|
|
567
597
|
const handlerFn = handler[0];
|
|
568
|
-
|
|
569
|
-
|
|
598
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
599
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
600
|
+
node.addEventListener(name, listener);
|
|
601
|
+
return listener;
|
|
602
|
+
}
|
|
603
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
604
|
+
return handler;
|
|
570
605
|
}
|
|
571
606
|
function style(node, value, prev) {
|
|
607
|
+
if (isHydrating(node)) return;
|
|
572
608
|
if (!value) {
|
|
573
609
|
if (prev || node._$styles) {
|
|
574
610
|
setAttribute(node, "style");
|
|
@@ -593,12 +629,13 @@ function style(node, value, prev) {
|
|
|
593
629
|
}
|
|
594
630
|
let v, s;
|
|
595
631
|
for (s in applied) {
|
|
596
|
-
if (value[s] == null) {
|
|
632
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
597
633
|
nodeStyle.removeProperty(s);
|
|
598
634
|
delete applied[s];
|
|
599
635
|
}
|
|
600
636
|
}
|
|
601
637
|
for (s in value) {
|
|
638
|
+
if (!hasOwn.call(value, s)) continue;
|
|
602
639
|
v = value[s];
|
|
603
640
|
if (v != null && v !== applied[s]) {
|
|
604
641
|
nodeStyle.setProperty(s, v);
|
|
@@ -607,20 +644,26 @@ function style(node, value, prev) {
|
|
|
607
644
|
}
|
|
608
645
|
}
|
|
609
646
|
function setStyleProperty(node, name, value) {
|
|
647
|
+
if (isHydrating(node)) return;
|
|
610
648
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
611
649
|
}
|
|
612
650
|
function spread(node, props = {}, skipChildren) {
|
|
613
651
|
const prevProps = {};
|
|
614
652
|
const get = typeof props === "function" ? props : () => props;
|
|
615
|
-
if (!skipChildren) insert(node, () =>
|
|
653
|
+
if (!skipChildren) insert(node, () => {
|
|
654
|
+
const source = get();
|
|
655
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
656
|
+
});
|
|
616
657
|
effect(() => {
|
|
617
|
-
const
|
|
658
|
+
const source = get();
|
|
659
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
618
660
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
619
661
|
}, () => {});
|
|
620
662
|
effect(() => {
|
|
621
663
|
const source = get();
|
|
622
664
|
const newProps = {};
|
|
623
665
|
for (const prop in source) {
|
|
666
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
624
667
|
if (prop === "children" || prop === "ref") continue;
|
|
625
668
|
newProps[prop] = source[prop];
|
|
626
669
|
}
|
|
@@ -652,6 +695,19 @@ function scope(fn) {
|
|
|
652
695
|
const SCOPE_OPTIONS = {
|
|
653
696
|
scope: true
|
|
654
697
|
};
|
|
698
|
+
let insertionParent = null;
|
|
699
|
+
function getInsertionParent() {
|
|
700
|
+
return insertionParent;
|
|
701
|
+
}
|
|
702
|
+
function withInsertionParent(parent, fn) {
|
|
703
|
+
const prev = insertionParent;
|
|
704
|
+
insertionParent = parent;
|
|
705
|
+
try {
|
|
706
|
+
return fn();
|
|
707
|
+
} finally {
|
|
708
|
+
insertionParent = prev;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
655
711
|
let hydrationRt = null;
|
|
656
712
|
function installHydrationRuntime() {
|
|
657
713
|
hydrationRt = {
|
|
@@ -719,7 +775,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
719
775
|
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
720
776
|
}
|
|
721
777
|
if (typeof accessor !== "function") {
|
|
722
|
-
accessor = normalize(accessor, initial, multi, true);
|
|
778
|
+
accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
|
|
723
779
|
if (typeof accessor !== "function") {
|
|
724
780
|
insertExpression(parent, accessor, initial, marker);
|
|
725
781
|
host && tagHost(accessor, host);
|
|
@@ -734,9 +790,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
734
790
|
let current = initial;
|
|
735
791
|
effect(prev => {
|
|
736
792
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
737
|
-
const value = normalize(accessor(), current, multi, true);
|
|
793
|
+
const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
|
|
738
794
|
if (typeof value !== "function") return value;
|
|
739
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
795
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
|
|
740
796
|
current = insertExpression(parent, inner, current, marker);
|
|
741
797
|
host && tagHost(current, host);
|
|
742
798
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -1454,7 +1510,8 @@ function classListToObject(classList) {
|
|
|
1454
1510
|
function flattenClassList(list, result) {
|
|
1455
1511
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1456
1512
|
const item = list[i];
|
|
1457
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1513
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1514
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1458
1515
|
}
|
|
1459
1516
|
}
|
|
1460
1517
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1470,12 +1527,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1470
1527
|
const name = prop.slice(2).toLowerCase();
|
|
1471
1528
|
const delegate = DelegatedEvents.has(name);
|
|
1472
1529
|
if (!delegate && prev) {
|
|
1473
|
-
|
|
1474
|
-
node.removeEventListener(name,
|
|
1530
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1531
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1475
1532
|
}
|
|
1476
1533
|
if (delegate || value) {
|
|
1477
|
-
addEvent(node, name, value, delegate);
|
|
1534
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1478
1535
|
delegate && delegateEvents([name]);
|
|
1536
|
+
if (!delegate) return attached;
|
|
1479
1537
|
}
|
|
1480
1538
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1481
1539
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1515,7 +1573,7 @@ function eventHandler(e, container, state) {
|
|
|
1515
1573
|
}
|
|
1516
1574
|
if (handler && !node.disabled) {
|
|
1517
1575
|
const data = node[`${key}Data`];
|
|
1518
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1576
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1519
1577
|
if (e.cancelBubble) return;
|
|
1520
1578
|
}
|
|
1521
1579
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1635,7 +1693,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1635
1693
|
const item = value[i],
|
|
1636
1694
|
prev = current && current[i],
|
|
1637
1695
|
t = typeof item;
|
|
1638
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1696
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1639
1697
|
}
|
|
1640
1698
|
}
|
|
1641
1699
|
return value;
|
|
@@ -2188,6 +2246,7 @@ function respond(value, init = {}) {
|
|
|
2188
2246
|
responseInit,
|
|
2189
2247
|
headers
|
|
2190
2248
|
} = initWithRevalidate(init);
|
|
2249
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2191
2250
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2192
2251
|
return new ResponseEnvelope(new Response(null, {
|
|
2193
2252
|
...responseInit,
|
|
@@ -2303,9 +2362,24 @@ function dynamic(source) {
|
|
|
2303
2362
|
return solidJs.untrack(() => component(props));
|
|
2304
2363
|
}
|
|
2305
2364
|
case "string":
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2365
|
+
{
|
|
2366
|
+
if (solidJs.sharedConfig.hydrating) {
|
|
2367
|
+
const el = getNextElement();
|
|
2368
|
+
spread(el, props);
|
|
2369
|
+
return el;
|
|
2370
|
+
}
|
|
2371
|
+
const owner = solidJs.getOwner();
|
|
2372
|
+
let el;
|
|
2373
|
+
return () => {
|
|
2374
|
+
if (!el) {
|
|
2375
|
+
solidJs.runWithOwner(owner, () => {
|
|
2376
|
+
el = createElement(component, solidJs.untrack(() => props.is));
|
|
2377
|
+
spread(el, props);
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
return el;
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2309
2383
|
}
|
|
2310
2384
|
});
|
|
2311
2385
|
};
|
|
@@ -2314,8 +2388,15 @@ function Dynamic(props) {
|
|
|
2314
2388
|
const Comp = dynamic(() => props.component);
|
|
2315
2389
|
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
2316
2390
|
}
|
|
2391
|
+
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2317
2392
|
function createElement(tagName, is = undefined) {
|
|
2318
|
-
|
|
2393
|
+
if (SVGElements.has(tagName)) return document.createElementNS(Namespaces.svg, tagName);
|
|
2394
|
+
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2395
|
+
if (AmbiguousSVGElements.has(tagName)) {
|
|
2396
|
+
const parent = getInsertionParent();
|
|
2397
|
+
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2398
|
+
}
|
|
2399
|
+
return document.createElement(tagName, {
|
|
2319
2400
|
is
|
|
2320
2401
|
});
|
|
2321
2402
|
}
|
|
@@ -2447,6 +2528,7 @@ exports.getDelegatedRoot = getDelegatedRoot;
|
|
|
2447
2528
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2448
2529
|
exports.getFirstChild = getFirstChild;
|
|
2449
2530
|
exports.getHydrationKey = getHydrationKey;
|
|
2531
|
+
exports.getInsertionParent = getInsertionParent;
|
|
2450
2532
|
exports.getNextElement = getNextElement;
|
|
2451
2533
|
exports.getNextMarker = getNextMarker;
|
|
2452
2534
|
exports.getNextMatch = getNextMatch;
|
package/dist/dev.js
CHANGED
|
@@ -48,6 +48,7 @@ const Namespaces = {
|
|
|
48
48
|
const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
49
49
|
const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
|
|
50
50
|
const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
|
|
51
|
+
const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
|
|
51
52
|
|
|
52
53
|
const transparentOptions = {
|
|
53
54
|
transparent: true,
|
|
@@ -360,6 +361,8 @@ function installListDriver(driver) {
|
|
|
360
361
|
listDriver = driver;
|
|
361
362
|
}
|
|
362
363
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
364
|
+
const $$EVENT_TUPLE = Symbol();
|
|
365
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
363
366
|
const INNER_OWNED = {};
|
|
364
367
|
const delegatedEvents = new Set();
|
|
365
368
|
const delegatedContainers = new Map();
|
|
@@ -485,7 +488,8 @@ function findOwner(target, state) {
|
|
|
485
488
|
}
|
|
486
489
|
function setProperty(node, name, value) {
|
|
487
490
|
if (isHydrating(node)) return;
|
|
488
|
-
|
|
491
|
+
const nodeName = node.nodeName;
|
|
492
|
+
if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
|
|
489
493
|
}
|
|
490
494
|
let claimHandlers = null;
|
|
491
495
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -519,7 +523,17 @@ function claimElement(node) {
|
|
|
519
523
|
}
|
|
520
524
|
function setAttribute(node, name, value) {
|
|
521
525
|
if (isHydrating(node)) return;
|
|
522
|
-
|
|
526
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
527
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
528
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
529
|
+
if (selectMultiple && !node._$multiple) {
|
|
530
|
+
const options = node.options;
|
|
531
|
+
for (let i = 0; i < options.length; i++) {
|
|
532
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (selectMultiple) node._$multiple = true;
|
|
523
537
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
524
538
|
}
|
|
525
539
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -527,22 +541,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
527
541
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
528
542
|
}
|
|
529
543
|
function className(node, value, prev) {
|
|
530
|
-
if (
|
|
544
|
+
if (typeof value === "number") value = "" + value;
|
|
545
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
546
|
+
if (isHydrating(node)) {
|
|
547
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
531
550
|
if (value == null || value === false) {
|
|
532
|
-
prev
|
|
551
|
+
if (prev || node._$classes) {
|
|
552
|
+
node.removeAttribute("class");
|
|
553
|
+
node._$classes = undefined;
|
|
554
|
+
}
|
|
533
555
|
return;
|
|
534
556
|
}
|
|
535
557
|
if (typeof value === "string") {
|
|
558
|
+
node._$classes = undefined;
|
|
536
559
|
value !== prev && node.setAttribute("class", value);
|
|
537
560
|
return;
|
|
538
561
|
}
|
|
562
|
+
let applied;
|
|
539
563
|
if (typeof prev === "string") {
|
|
540
|
-
|
|
564
|
+
applied = {};
|
|
541
565
|
node.removeAttribute("class");
|
|
542
|
-
} else
|
|
566
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
543
567
|
value = classListToObject(value);
|
|
544
|
-
const classKeys = Object.keys(value
|
|
545
|
-
const prevKeys = Object.keys(
|
|
568
|
+
const classKeys = Object.keys(value);
|
|
569
|
+
const prevKeys = Object.keys(applied);
|
|
546
570
|
let i, len;
|
|
547
571
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
548
572
|
const key = prevKeys[i];
|
|
@@ -552,22 +576,34 @@ function className(node, value, prev) {
|
|
|
552
576
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
553
577
|
const key = classKeys[i],
|
|
554
578
|
classValue = !!value[key];
|
|
555
|
-
if (!key || key === "undefined" ||
|
|
579
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
556
580
|
node.classList.add(key);
|
|
557
581
|
}
|
|
582
|
+
node._$classes = value;
|
|
558
583
|
}
|
|
559
584
|
function addEvent(node, name, handler, delegate) {
|
|
560
585
|
if (delegate) {
|
|
586
|
+
const key = `$$${name}`;
|
|
587
|
+
let data;
|
|
561
588
|
if (Array.isArray(handler)) {
|
|
562
|
-
|
|
563
|
-
node[
|
|
564
|
-
} else node[
|
|
565
|
-
|
|
589
|
+
data = handler[1];
|
|
590
|
+
node[key] = handler[0];
|
|
591
|
+
} else node[key] = handler;
|
|
592
|
+
node[`${key}Data`] = data;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (Array.isArray(handler)) {
|
|
566
596
|
const handlerFn = handler[0];
|
|
567
|
-
|
|
568
|
-
|
|
597
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
598
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
599
|
+
node.addEventListener(name, listener);
|
|
600
|
+
return listener;
|
|
601
|
+
}
|
|
602
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
603
|
+
return handler;
|
|
569
604
|
}
|
|
570
605
|
function style(node, value, prev) {
|
|
606
|
+
if (isHydrating(node)) return;
|
|
571
607
|
if (!value) {
|
|
572
608
|
if (prev || node._$styles) {
|
|
573
609
|
setAttribute(node, "style");
|
|
@@ -592,12 +628,13 @@ function style(node, value, prev) {
|
|
|
592
628
|
}
|
|
593
629
|
let v, s;
|
|
594
630
|
for (s in applied) {
|
|
595
|
-
if (value[s] == null) {
|
|
631
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
596
632
|
nodeStyle.removeProperty(s);
|
|
597
633
|
delete applied[s];
|
|
598
634
|
}
|
|
599
635
|
}
|
|
600
636
|
for (s in value) {
|
|
637
|
+
if (!hasOwn.call(value, s)) continue;
|
|
601
638
|
v = value[s];
|
|
602
639
|
if (v != null && v !== applied[s]) {
|
|
603
640
|
nodeStyle.setProperty(s, v);
|
|
@@ -606,20 +643,26 @@ function style(node, value, prev) {
|
|
|
606
643
|
}
|
|
607
644
|
}
|
|
608
645
|
function setStyleProperty(node, name, value) {
|
|
646
|
+
if (isHydrating(node)) return;
|
|
609
647
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
610
648
|
}
|
|
611
649
|
function spread(node, props = {}, skipChildren) {
|
|
612
650
|
const prevProps = {};
|
|
613
651
|
const get = typeof props === "function" ? props : () => props;
|
|
614
|
-
if (!skipChildren) insert(node, () =>
|
|
652
|
+
if (!skipChildren) insert(node, () => {
|
|
653
|
+
const source = get();
|
|
654
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
655
|
+
});
|
|
615
656
|
effect(() => {
|
|
616
|
-
const
|
|
657
|
+
const source = get();
|
|
658
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
617
659
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
618
660
|
}, () => {});
|
|
619
661
|
effect(() => {
|
|
620
662
|
const source = get();
|
|
621
663
|
const newProps = {};
|
|
622
664
|
for (const prop in source) {
|
|
665
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
623
666
|
if (prop === "children" || prop === "ref") continue;
|
|
624
667
|
newProps[prop] = source[prop];
|
|
625
668
|
}
|
|
@@ -651,6 +694,19 @@ function scope(fn) {
|
|
|
651
694
|
const SCOPE_OPTIONS = {
|
|
652
695
|
scope: true
|
|
653
696
|
};
|
|
697
|
+
let insertionParent = null;
|
|
698
|
+
function getInsertionParent() {
|
|
699
|
+
return insertionParent;
|
|
700
|
+
}
|
|
701
|
+
function withInsertionParent(parent, fn) {
|
|
702
|
+
const prev = insertionParent;
|
|
703
|
+
insertionParent = parent;
|
|
704
|
+
try {
|
|
705
|
+
return fn();
|
|
706
|
+
} finally {
|
|
707
|
+
insertionParent = prev;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
654
710
|
let hydrationRt = null;
|
|
655
711
|
function installHydrationRuntime() {
|
|
656
712
|
hydrationRt = {
|
|
@@ -718,7 +774,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
718
774
|
if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
719
775
|
}
|
|
720
776
|
if (typeof accessor !== "function") {
|
|
721
|
-
accessor = normalize(accessor, initial, multi, true);
|
|
777
|
+
accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
|
|
722
778
|
if (typeof accessor !== "function") {
|
|
723
779
|
insertExpression(parent, accessor, initial, marker);
|
|
724
780
|
host && tagHost(accessor, host);
|
|
@@ -733,9 +789,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
733
789
|
let current = initial;
|
|
734
790
|
effect(prev => {
|
|
735
791
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
736
|
-
const value = normalize(accessor(), current, multi, true);
|
|
792
|
+
const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
|
|
737
793
|
if (typeof value !== "function") return value;
|
|
738
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
794
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
|
|
739
795
|
current = insertExpression(parent, inner, current, marker);
|
|
740
796
|
host && tagHost(current, host);
|
|
741
797
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -1453,7 +1509,8 @@ function classListToObject(classList) {
|
|
|
1453
1509
|
function flattenClassList(list, result) {
|
|
1454
1510
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1455
1511
|
const item = list[i];
|
|
1456
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1512
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1513
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1457
1514
|
}
|
|
1458
1515
|
}
|
|
1459
1516
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1469,12 +1526,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1469
1526
|
const name = prop.slice(2).toLowerCase();
|
|
1470
1527
|
const delegate = DelegatedEvents.has(name);
|
|
1471
1528
|
if (!delegate && prev) {
|
|
1472
|
-
|
|
1473
|
-
node.removeEventListener(name,
|
|
1529
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1530
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1474
1531
|
}
|
|
1475
1532
|
if (delegate || value) {
|
|
1476
|
-
addEvent(node, name, value, delegate);
|
|
1533
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1477
1534
|
delegate && delegateEvents([name]);
|
|
1535
|
+
if (!delegate) return attached;
|
|
1478
1536
|
}
|
|
1479
1537
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1480
1538
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1514,7 +1572,7 @@ function eventHandler(e, container, state) {
|
|
|
1514
1572
|
}
|
|
1515
1573
|
if (handler && !node.disabled) {
|
|
1516
1574
|
const data = node[`${key}Data`];
|
|
1517
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1575
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1518
1576
|
if (e.cancelBubble) return;
|
|
1519
1577
|
}
|
|
1520
1578
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1634,7 +1692,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1634
1692
|
const item = value[i],
|
|
1635
1693
|
prev = current && current[i],
|
|
1636
1694
|
t = typeof item;
|
|
1637
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1695
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1638
1696
|
}
|
|
1639
1697
|
}
|
|
1640
1698
|
return value;
|
|
@@ -2187,6 +2245,7 @@ function respond(value, init = {}) {
|
|
|
2187
2245
|
responseInit,
|
|
2188
2246
|
headers
|
|
2189
2247
|
} = initWithRevalidate(init);
|
|
2248
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2190
2249
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2191
2250
|
return new ResponseEnvelope(new Response(null, {
|
|
2192
2251
|
...responseInit,
|
|
@@ -2302,9 +2361,24 @@ function dynamic(source) {
|
|
|
2302
2361
|
return untrack(() => component(props));
|
|
2303
2362
|
}
|
|
2304
2363
|
case "string":
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2364
|
+
{
|
|
2365
|
+
if (sharedConfig.hydrating) {
|
|
2366
|
+
const el = getNextElement();
|
|
2367
|
+
spread(el, props);
|
|
2368
|
+
return el;
|
|
2369
|
+
}
|
|
2370
|
+
const owner = getOwner();
|
|
2371
|
+
let el;
|
|
2372
|
+
return () => {
|
|
2373
|
+
if (!el) {
|
|
2374
|
+
runWithOwner(owner, () => {
|
|
2375
|
+
el = createElement(component, untrack(() => props.is));
|
|
2376
|
+
spread(el, props);
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
return el;
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2308
2382
|
}
|
|
2309
2383
|
});
|
|
2310
2384
|
};
|
|
@@ -2313,8 +2387,15 @@ function Dynamic(props) {
|
|
|
2313
2387
|
const Comp = dynamic(() => props.component);
|
|
2314
2388
|
return createComponent(Comp, omit(props, "component"));
|
|
2315
2389
|
}
|
|
2390
|
+
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2316
2391
|
function createElement(tagName, is = undefined) {
|
|
2317
|
-
|
|
2392
|
+
if (SVGElements.has(tagName)) return document.createElementNS(Namespaces.svg, tagName);
|
|
2393
|
+
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2394
|
+
if (AmbiguousSVGElements.has(tagName)) {
|
|
2395
|
+
const parent = getInsertionParent();
|
|
2396
|
+
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2397
|
+
}
|
|
2398
|
+
return document.createElement(tagName, {
|
|
2318
2399
|
is
|
|
2319
2400
|
});
|
|
2320
2401
|
}
|
|
@@ -2346,4 +2427,4 @@ _moduleUrl) {
|
|
|
2346
2427
|
function httpStatus(_code, _text) {}
|
|
2347
2428
|
function httpHeader(_name, _value, _options) {}
|
|
2348
2429
|
|
|
2349
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, driveList, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installListDriver, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, listDriver, markSafeError, memo, parseCookieHeader, patchDriver, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, rowProof, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2430
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, driveList, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getInsertionParent, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installListDriver, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, listDriver, markSafeError, memo, parseCookieHeader, patchDriver, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, rowProof, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|