@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/server.cjs
CHANGED
|
@@ -49,6 +49,15 @@ 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"]);
|
|
53
|
+
function isHttpNavigationTarget(target) {
|
|
54
|
+
try {
|
|
55
|
+
const protocol = new URL(target, "http://base.invalid").protocol;
|
|
56
|
+
return protocol === "http:" || protocol === "https:";
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
52
61
|
|
|
53
62
|
const transparentOptions = {
|
|
54
63
|
transparent: true,
|
|
@@ -286,6 +295,7 @@ function respond(value, init = {}) {
|
|
|
286
295
|
responseInit,
|
|
287
296
|
headers
|
|
288
297
|
} = initWithRevalidate(init);
|
|
298
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
289
299
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
290
300
|
return new ResponseEnvelope(new Response(null, {
|
|
291
301
|
...responseInit,
|
|
@@ -2501,6 +2511,7 @@ function ssr(t) {
|
|
|
2501
2511
|
return result;
|
|
2502
2512
|
}
|
|
2503
2513
|
function ssrClassName(value) {
|
|
2514
|
+
if (typeof value === "number") return "" + value;
|
|
2504
2515
|
if (!value) return "";
|
|
2505
2516
|
if (typeof value === "string") return escape(value, true);
|
|
2506
2517
|
value = classListToObject(value);
|
|
@@ -2986,7 +2997,8 @@ function classListToObject(classList) {
|
|
|
2986
2997
|
function flattenClassList(list, result) {
|
|
2987
2998
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
2988
2999
|
const item = list[i];
|
|
2989
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
3000
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
3001
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
2990
3002
|
}
|
|
2991
3003
|
}
|
|
2992
3004
|
function tryResolveString(node) {
|
|
@@ -3156,7 +3168,8 @@ function copyInitHeaders(init) {
|
|
|
3156
3168
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
3157
3169
|
return headers;
|
|
3158
3170
|
}
|
|
3159
|
-
const STUB_GAP_FILL_EXCLUDED = /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location"
|
|
3171
|
+
const STUB_GAP_FILL_EXCLUDED = /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
3172
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()));
|
|
3160
3173
|
function fillsStubGap(key, headers, response) {
|
|
3161
3174
|
if (key === "set-cookie" || STUB_GAP_FILL_EXCLUDED.has(key)) return false;
|
|
3162
3175
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
@@ -3185,6 +3198,7 @@ function commitEventResponse(response, event = getRequestEvent()) {
|
|
|
3185
3198
|
}
|
|
3186
3199
|
function deriveHead(stub, responseInit = {}) {
|
|
3187
3200
|
const headers = mergeStubHeaders(copyInitHeaders(responseInit.headers), stub);
|
|
3201
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
3188
3202
|
const status = stub && stub.status || responseInit.status || 200;
|
|
3189
3203
|
const statusText = stub && stub.statusText || responseInit.statusText || undefined;
|
|
3190
3204
|
return {
|
|
@@ -3268,7 +3282,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3268
3282
|
end() {
|
|
3269
3283
|
if (closed || !controller) return;
|
|
3270
3284
|
const location = stub && stub.headers.get("Location");
|
|
3271
|
-
if (location) {
|
|
3285
|
+
if (location && isHttpNavigationTarget(location)) {
|
|
3272
3286
|
const attr = nonceAttr(nonce, "script");
|
|
3273
3287
|
enqueue(`<script${attr}>window.location=${JSON.stringify(location).replace(/</g, "\\u003c")}</script>`);
|
|
3274
3288
|
}
|
package/dist/server.js
CHANGED
|
@@ -48,6 +48,15 @@ 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"]);
|
|
52
|
+
function isHttpNavigationTarget(target) {
|
|
53
|
+
try {
|
|
54
|
+
const protocol = new URL(target, "http://base.invalid").protocol;
|
|
55
|
+
return protocol === "http:" || protocol === "https:";
|
|
56
|
+
} catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
51
60
|
|
|
52
61
|
const transparentOptions = {
|
|
53
62
|
transparent: true,
|
|
@@ -285,6 +294,7 @@ function respond(value, init = {}) {
|
|
|
285
294
|
responseInit,
|
|
286
295
|
headers
|
|
287
296
|
} = initWithRevalidate(init);
|
|
297
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
288
298
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
289
299
|
return new ResponseEnvelope(new Response(null, {
|
|
290
300
|
...responseInit,
|
|
@@ -2500,6 +2510,7 @@ function ssr(t) {
|
|
|
2500
2510
|
return result;
|
|
2501
2511
|
}
|
|
2502
2512
|
function ssrClassName(value) {
|
|
2513
|
+
if (typeof value === "number") return "" + value;
|
|
2503
2514
|
if (!value) return "";
|
|
2504
2515
|
if (typeof value === "string") return escape(value, true);
|
|
2505
2516
|
value = classListToObject(value);
|
|
@@ -2985,7 +2996,8 @@ function classListToObject(classList) {
|
|
|
2985
2996
|
function flattenClassList(list, result) {
|
|
2986
2997
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
2987
2998
|
const item = list[i];
|
|
2988
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
2999
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
3000
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
2989
3001
|
}
|
|
2990
3002
|
}
|
|
2991
3003
|
function tryResolveString(node) {
|
|
@@ -3155,7 +3167,8 @@ function copyInitHeaders(init) {
|
|
|
3155
3167
|
for (const cookie of init.getSetCookie()) headers.append("Set-Cookie", cookie);
|
|
3156
3168
|
return headers;
|
|
3157
3169
|
}
|
|
3158
|
-
const STUB_GAP_FILL_EXCLUDED = /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location"
|
|
3170
|
+
const STUB_GAP_FILL_EXCLUDED = /*#__PURE__*/new Set([ERROR_HEADER, BODY_FORMAT_HEADER, SINGLE_FLIGHT_HEADER, REVALIDATE_HEADER, REDIRECT_HEADER, "Location",
|
|
3171
|
+
...COMPOSED_BODY_FRAMING].map(header => header.toLowerCase()));
|
|
3159
3172
|
function fillsStubGap(key, headers, response) {
|
|
3160
3173
|
if (key === "set-cookie" || STUB_GAP_FILL_EXCLUDED.has(key)) return false;
|
|
3161
3174
|
if (response.body === null && (key === "content-type" || key === "content-length")) return false;
|
|
@@ -3184,6 +3197,7 @@ function commitEventResponse(response, event = getRequestEvent()) {
|
|
|
3184
3197
|
}
|
|
3185
3198
|
function deriveHead(stub, responseInit = {}) {
|
|
3186
3199
|
const headers = mergeStubHeaders(copyInitHeaders(responseInit.headers), stub);
|
|
3200
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
3187
3201
|
const status = stub && stub.status || responseInit.status || 200;
|
|
3188
3202
|
const statusText = stub && stub.statusText || responseInit.statusText || undefined;
|
|
3189
3203
|
return {
|
|
@@ -3267,7 +3281,7 @@ function createSSRResponse(result, event, options = {}) {
|
|
|
3267
3281
|
end() {
|
|
3268
3282
|
if (closed || !controller) return;
|
|
3269
3283
|
const location = stub && stub.headers.get("Location");
|
|
3270
|
-
if (location) {
|
|
3284
|
+
if (location && isHttpNavigationTarget(location)) {
|
|
3271
3285
|
const attr = nonceAttr(nonce, "script");
|
|
3272
3286
|
enqueue(`<script${attr}>window.location=${JSON.stringify(location).replace(/</g, "\\u003c")}</script>`);
|
|
3273
3287
|
}
|
package/dist/web.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,
|
|
@@ -340,6 +341,8 @@ function installListDriver(driver) {
|
|
|
340
341
|
exports.listDriver = driver;
|
|
341
342
|
}
|
|
342
343
|
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
344
|
+
const $$EVENT_TUPLE = Symbol();
|
|
345
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
343
346
|
const INNER_OWNED = {};
|
|
344
347
|
const delegatedEvents = new Set();
|
|
345
348
|
const delegatedContainers = new Map();
|
|
@@ -457,7 +460,8 @@ function findOwner(target, state) {
|
|
|
457
460
|
}
|
|
458
461
|
function setProperty(node, name, value) {
|
|
459
462
|
if (isHydrating(node)) return;
|
|
460
|
-
|
|
463
|
+
const nodeName = node.nodeName;
|
|
464
|
+
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;
|
|
461
465
|
}
|
|
462
466
|
let claimHandlers = null;
|
|
463
467
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -491,7 +495,17 @@ function claimElement(node) {
|
|
|
491
495
|
}
|
|
492
496
|
function setAttribute(node, name, value) {
|
|
493
497
|
if (isHydrating(node)) return;
|
|
494
|
-
|
|
498
|
+
const selectMultiple = name === "multiple" && node.localName === "select";
|
|
499
|
+
if (value == null || value === false) node.removeAttribute(name);else {
|
|
500
|
+
node.setAttribute(name, value === true ? "" : value);
|
|
501
|
+
if (selectMultiple && !node._$multiple) {
|
|
502
|
+
const options = node.options;
|
|
503
|
+
for (let i = 0; i < options.length; i++) {
|
|
504
|
+
if (options[i].defaultSelected) options[i].selected = true;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (selectMultiple) node._$multiple = true;
|
|
495
509
|
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
496
510
|
}
|
|
497
511
|
function setAttributeNS(node, namespace, name, value) {
|
|
@@ -499,22 +513,32 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
499
513
|
if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
500
514
|
}
|
|
501
515
|
function className(node, value, prev) {
|
|
502
|
-
if (
|
|
516
|
+
if (typeof value === "number") value = "" + value;
|
|
517
|
+
if (typeof prev === "number") prev = "" + prev;
|
|
518
|
+
if (isHydrating(node)) {
|
|
519
|
+
node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
503
522
|
if (value == null || value === false) {
|
|
504
|
-
prev
|
|
523
|
+
if (prev || node._$classes) {
|
|
524
|
+
node.removeAttribute("class");
|
|
525
|
+
node._$classes = undefined;
|
|
526
|
+
}
|
|
505
527
|
return;
|
|
506
528
|
}
|
|
507
529
|
if (typeof value === "string") {
|
|
530
|
+
node._$classes = undefined;
|
|
508
531
|
value !== prev && node.setAttribute("class", value);
|
|
509
532
|
return;
|
|
510
533
|
}
|
|
534
|
+
let applied;
|
|
511
535
|
if (typeof prev === "string") {
|
|
512
|
-
|
|
536
|
+
applied = {};
|
|
513
537
|
node.removeAttribute("class");
|
|
514
|
-
} else
|
|
538
|
+
} else applied = node._$classes || classListToObject(prev || {});
|
|
515
539
|
value = classListToObject(value);
|
|
516
|
-
const classKeys = Object.keys(value
|
|
517
|
-
const prevKeys = Object.keys(
|
|
540
|
+
const classKeys = Object.keys(value);
|
|
541
|
+
const prevKeys = Object.keys(applied);
|
|
518
542
|
let i, len;
|
|
519
543
|
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
520
544
|
const key = prevKeys[i];
|
|
@@ -524,22 +548,34 @@ function className(node, value, prev) {
|
|
|
524
548
|
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
525
549
|
const key = classKeys[i],
|
|
526
550
|
classValue = !!value[key];
|
|
527
|
-
if (!key || key === "undefined" ||
|
|
551
|
+
if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
|
|
528
552
|
node.classList.add(key);
|
|
529
553
|
}
|
|
554
|
+
node._$classes = value;
|
|
530
555
|
}
|
|
531
556
|
function addEvent(node, name, handler, delegate) {
|
|
532
557
|
if (delegate) {
|
|
558
|
+
const key = `$$${name}`;
|
|
559
|
+
let data;
|
|
533
560
|
if (Array.isArray(handler)) {
|
|
534
|
-
|
|
535
|
-
node[
|
|
536
|
-
} else node[
|
|
537
|
-
|
|
561
|
+
data = handler[1];
|
|
562
|
+
node[key] = handler[0];
|
|
563
|
+
} else node[key] = handler;
|
|
564
|
+
node[`${key}Data`] = data;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (Array.isArray(handler)) {
|
|
538
568
|
const handlerFn = handler[0];
|
|
539
|
-
|
|
540
|
-
|
|
569
|
+
const listener = e => handlerFn.call(node, handler[1], e);
|
|
570
|
+
listener[$$EVENT_TUPLE] = handler;
|
|
571
|
+
node.addEventListener(name, listener);
|
|
572
|
+
return listener;
|
|
573
|
+
}
|
|
574
|
+
node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
575
|
+
return handler;
|
|
541
576
|
}
|
|
542
577
|
function style(node, value, prev) {
|
|
578
|
+
if (isHydrating(node)) return;
|
|
543
579
|
if (!value) {
|
|
544
580
|
if (prev || node._$styles) {
|
|
545
581
|
setAttribute(node, "style");
|
|
@@ -564,12 +600,13 @@ function style(node, value, prev) {
|
|
|
564
600
|
}
|
|
565
601
|
let v, s;
|
|
566
602
|
for (s in applied) {
|
|
567
|
-
if (value[s] == null) {
|
|
603
|
+
if (!hasOwn.call(value, s) || value[s] == null) {
|
|
568
604
|
nodeStyle.removeProperty(s);
|
|
569
605
|
delete applied[s];
|
|
570
606
|
}
|
|
571
607
|
}
|
|
572
608
|
for (s in value) {
|
|
609
|
+
if (!hasOwn.call(value, s)) continue;
|
|
573
610
|
v = value[s];
|
|
574
611
|
if (v != null && v !== applied[s]) {
|
|
575
612
|
nodeStyle.setProperty(s, v);
|
|
@@ -578,20 +615,26 @@ function style(node, value, prev) {
|
|
|
578
615
|
}
|
|
579
616
|
}
|
|
580
617
|
function setStyleProperty(node, name, value) {
|
|
618
|
+
if (isHydrating(node)) return;
|
|
581
619
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
582
620
|
}
|
|
583
621
|
function spread(node, props = {}, skipChildren) {
|
|
584
622
|
const prevProps = {};
|
|
585
623
|
const get = typeof props === "function" ? props : () => props;
|
|
586
|
-
if (!skipChildren) insert(node, () =>
|
|
624
|
+
if (!skipChildren) insert(node, () => {
|
|
625
|
+
const source = get();
|
|
626
|
+
return hasOwn.call(source, "children") ? source.children : undefined;
|
|
627
|
+
});
|
|
587
628
|
effect(() => {
|
|
588
|
-
const
|
|
629
|
+
const source = get();
|
|
630
|
+
const r = hasOwn.call(source, "ref") && source.ref;
|
|
589
631
|
(typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
|
|
590
632
|
}, () => {});
|
|
591
633
|
effect(() => {
|
|
592
634
|
const source = get();
|
|
593
635
|
const newProps = {};
|
|
594
636
|
for (const prop in source) {
|
|
637
|
+
if (!hasOwn.call(source, prop)) continue;
|
|
595
638
|
if (prop === "children" || prop === "ref") continue;
|
|
596
639
|
newProps[prop] = source[prop];
|
|
597
640
|
}
|
|
@@ -623,6 +666,19 @@ function scope(fn) {
|
|
|
623
666
|
const SCOPE_OPTIONS = {
|
|
624
667
|
scope: true
|
|
625
668
|
};
|
|
669
|
+
let insertionParent = null;
|
|
670
|
+
function getInsertionParent() {
|
|
671
|
+
return insertionParent;
|
|
672
|
+
}
|
|
673
|
+
function withInsertionParent(parent, fn) {
|
|
674
|
+
const prev = insertionParent;
|
|
675
|
+
insertionParent = parent;
|
|
676
|
+
try {
|
|
677
|
+
return fn();
|
|
678
|
+
} finally {
|
|
679
|
+
insertionParent = prev;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
626
682
|
let hydrationRt = null;
|
|
627
683
|
function installHydrationRuntime() {
|
|
628
684
|
hydrationRt = {
|
|
@@ -690,7 +746,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
690
746
|
if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
|
|
691
747
|
}
|
|
692
748
|
if (typeof accessor !== "function") {
|
|
693
|
-
accessor = normalize(accessor, initial, multi, true);
|
|
749
|
+
accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
|
|
694
750
|
if (typeof accessor !== "function") {
|
|
695
751
|
insertExpression(parent, accessor, initial, marker);
|
|
696
752
|
host && tagHost(accessor, host);
|
|
@@ -705,9 +761,9 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
705
761
|
let current = initial;
|
|
706
762
|
effect(prev => {
|
|
707
763
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
708
|
-
const value = normalize(accessor(), current, multi, true);
|
|
764
|
+
const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
|
|
709
765
|
if (typeof value !== "function") return value;
|
|
710
|
-
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
766
|
+
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
|
|
711
767
|
current = insertExpression(parent, inner, current, marker);
|
|
712
768
|
host && tagHost(current, host);
|
|
713
769
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
@@ -1367,7 +1423,8 @@ function classListToObject(classList) {
|
|
|
1367
1423
|
function flattenClassList(list, result) {
|
|
1368
1424
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
1369
1425
|
const item = list[i];
|
|
1370
|
-
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1426
|
+
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
|
|
1427
|
+
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1371
1428
|
}
|
|
1372
1429
|
}
|
|
1373
1430
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
@@ -1383,12 +1440,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1383
1440
|
const name = prop.slice(2).toLowerCase();
|
|
1384
1441
|
const delegate = DelegatedEvents.has(name);
|
|
1385
1442
|
if (!delegate && prev) {
|
|
1386
|
-
|
|
1387
|
-
node.removeEventListener(name,
|
|
1443
|
+
if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
|
|
1444
|
+
node.removeEventListener(name, prev, typeof prev !== "function" && prev);
|
|
1388
1445
|
}
|
|
1389
1446
|
if (delegate || value) {
|
|
1390
|
-
addEvent(node, name, value, delegate);
|
|
1447
|
+
const attached = addEvent(node, name, value, delegate);
|
|
1391
1448
|
delegate && delegateEvents([name]);
|
|
1449
|
+
if (!delegate) return attached;
|
|
1392
1450
|
}
|
|
1393
1451
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1394
1452
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
@@ -1428,7 +1486,7 @@ function eventHandler(e, container, state) {
|
|
|
1428
1486
|
}
|
|
1429
1487
|
if (handler && !node.disabled) {
|
|
1430
1488
|
const data = node[`${key}Data`];
|
|
1431
|
-
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
1489
|
+
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1432
1490
|
if (e.cancelBubble) return;
|
|
1433
1491
|
}
|
|
1434
1492
|
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
@@ -1548,7 +1606,7 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1548
1606
|
const item = value[i],
|
|
1549
1607
|
prev = current && current[i],
|
|
1550
1608
|
t = typeof item;
|
|
1551
|
-
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1609
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
|
|
1552
1610
|
}
|
|
1553
1611
|
}
|
|
1554
1612
|
return value;
|
|
@@ -2092,6 +2150,7 @@ function respond(value, init = {}) {
|
|
|
2092
2150
|
responseInit,
|
|
2093
2151
|
headers
|
|
2094
2152
|
} = initWithRevalidate(init);
|
|
2153
|
+
for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
|
|
2095
2154
|
if (NULL_BODY_STATUSES.has(responseInit.status)) {
|
|
2096
2155
|
return new ResponseEnvelope(new Response(null, {
|
|
2097
2156
|
...responseInit,
|
|
@@ -2204,9 +2263,24 @@ function dynamic(source) {
|
|
|
2204
2263
|
return solidJs.untrack(() => component(props));
|
|
2205
2264
|
}
|
|
2206
2265
|
case "string":
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2266
|
+
{
|
|
2267
|
+
if (solidJs.sharedConfig.hydrating) {
|
|
2268
|
+
const el = getNextElement();
|
|
2269
|
+
spread(el, props);
|
|
2270
|
+
return el;
|
|
2271
|
+
}
|
|
2272
|
+
const owner = solidJs.getOwner();
|
|
2273
|
+
let el;
|
|
2274
|
+
return () => {
|
|
2275
|
+
if (!el) {
|
|
2276
|
+
solidJs.runWithOwner(owner, () => {
|
|
2277
|
+
el = createElement(component, solidJs.untrack(() => props.is));
|
|
2278
|
+
spread(el, props);
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
return el;
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2210
2284
|
}
|
|
2211
2285
|
});
|
|
2212
2286
|
};
|
|
@@ -2215,8 +2289,15 @@ function Dynamic(props) {
|
|
|
2215
2289
|
const Comp = dynamic(() => props.component);
|
|
2216
2290
|
return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
|
|
2217
2291
|
}
|
|
2292
|
+
const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
|
|
2218
2293
|
function createElement(tagName, is = undefined) {
|
|
2219
|
-
|
|
2294
|
+
if (SVGElements.has(tagName)) return document.createElementNS(Namespaces.svg, tagName);
|
|
2295
|
+
if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
|
|
2296
|
+
if (AmbiguousSVGElements.has(tagName)) {
|
|
2297
|
+
const parent = getInsertionParent();
|
|
2298
|
+
if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
|
|
2299
|
+
}
|
|
2300
|
+
return document.createElement(tagName, {
|
|
2220
2301
|
is
|
|
2221
2302
|
});
|
|
2222
2303
|
}
|
|
@@ -2348,6 +2429,7 @@ exports.getDelegatedRoot = getDelegatedRoot;
|
|
|
2348
2429
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
2349
2430
|
exports.getFirstChild = getFirstChild;
|
|
2350
2431
|
exports.getHydrationKey = getHydrationKey;
|
|
2432
|
+
exports.getInsertionParent = getInsertionParent;
|
|
2351
2433
|
exports.getNextElement = getNextElement;
|
|
2352
2434
|
exports.getNextMarker = getNextMarker;
|
|
2353
2435
|
exports.getNextMatch = getNextMatch;
|