@solidjs/web 2.0.0-rc.4 → 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.
Files changed (61) hide show
  1. package/dist/dev.cjs +163 -36
  2. package/dist/dev.js +161 -37
  3. package/dist/server.cjs +178 -37
  4. package/dist/server.js +177 -38
  5. package/dist/web.cjs +143 -36
  6. package/dist/web.js +141 -37
  7. package/frames/dist/client.cjs +41 -8
  8. package/frames/dist/client.dev.cjs +41 -8
  9. package/frames/dist/client.dev.js +41 -8
  10. package/frames/dist/client.js +41 -8
  11. package/frames/dist/server.cjs +497 -44
  12. package/frames/dist/server.js +497 -44
  13. package/package.json +2 -2
  14. package/serialization/dist/decode.cjs +4 -2
  15. package/serialization/dist/decode.js +4 -2
  16. package/serialization/dist/serialization.cjs +12 -8
  17. package/serialization/dist/serialization.js +12 -8
  18. package/serialization/types/index.d.ts +7 -0
  19. package/serialization/types/serializer-decode.d.ts +14 -1
  20. package/serialization/types/serializer.d.ts +7 -0
  21. package/serialization/types-cjs/index.d.cts +7 -0
  22. package/serialization/types-cjs/serializer-decode.d.cts +14 -1
  23. package/serialization/types-cjs/serializer.d.cts +7 -0
  24. package/server-functions/dist/client.cjs +164 -35
  25. package/server-functions/dist/client.js +161 -36
  26. package/server-functions/dist/server.cjs +899 -136
  27. package/server-functions/dist/server.dev.cjs +919 -136
  28. package/server-functions/dist/server.dev.js +915 -137
  29. package/server-functions/dist/server.js +895 -137
  30. package/types/client.d.ts +2 -1
  31. package/types/constants.d.ts +3 -1
  32. package/types/cookies.d.ts +6 -14
  33. package/types/frames/frame-client.d.ts +4 -0
  34. package/types/frames/serializer-decode.d.ts +14 -1
  35. package/types/frames/serializer.d.ts +7 -0
  36. package/types/jsx.d.ts +11 -16
  37. package/types/response.d.ts +11 -0
  38. package/types/serializer-decode.d.ts +14 -1
  39. package/types/serializer.d.ts +7 -0
  40. package/types/server-functions/client.d.ts +22 -2
  41. package/types/server-functions/flash.d.ts +9 -0
  42. package/types/server-functions/server.d.ts +131 -11
  43. package/types/server-functions/shared.d.ts +77 -14
  44. package/types/server-mock.d.ts +17 -2
  45. package/types/server.d.ts +16 -2
  46. package/types-cjs/client.d.cts +2 -1
  47. package/types-cjs/constants.d.cts +3 -1
  48. package/types-cjs/cookies.d.cts +6 -14
  49. package/types-cjs/frames/frame-client.d.cts +4 -0
  50. package/types-cjs/frames/serializer-decode.d.cts +14 -1
  51. package/types-cjs/frames/serializer.d.cts +7 -0
  52. package/types-cjs/jsx.d.cts +11 -16
  53. package/types-cjs/response.d.cts +11 -0
  54. package/types-cjs/serializer-decode.d.cts +14 -1
  55. package/types-cjs/serializer.d.cts +7 -0
  56. package/types-cjs/server-functions/client.d.cts +22 -2
  57. package/types-cjs/server-functions/flash.d.cts +9 -0
  58. package/types-cjs/server-functions/server.d.cts +131 -11
  59. package/types-cjs/server-functions/shared.d.cts +77 -14
  60. package/types-cjs/server-mock.d.cts +17 -2
  61. package/types-cjs/server.d.cts +16 -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,
@@ -215,7 +216,8 @@ function resourceIdentity(tag, props) {
215
216
  let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
216
217
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
217
218
  const q = RESOURCE_QUALIFIERS[i];
218
- if (props[q] != null) id += ":" + q + "=" + props[q];
219
+ const value = props[q];
220
+ if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
219
221
  }
220
222
  return id;
221
223
  }
@@ -288,6 +290,7 @@ function decodeSafe(text) {
288
290
  }
289
291
  }
290
292
  function serializeCookie(name, value, options = {}) {
293
+ assertServableCookie(name, options);
291
294
  let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
292
295
  cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
293
296
  if (options.domain) cookie += `; Domain=${options.domain}`;
@@ -295,12 +298,32 @@ function serializeCookie(name, value, options = {}) {
295
298
  if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
296
299
  if (options.httpOnly) cookie += "; HttpOnly";
297
300
  if (options.secure) cookie += "; Secure";
301
+ if (options.partitioned) cookie += "; Partitioned";
298
302
  if (options.sameSite) {
299
303
  const sameSite = options.sameSite.toLowerCase();
300
304
  cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
301
305
  }
302
306
  return cookie;
303
307
  }
308
+ function assertServableCookie(name, options) {
309
+ const reject = reason => {
310
+ throw new Error(`serializeCookie: every browser silently rejects this cookie — ${reason}. ` + `It would never come back on a request, with no error anywhere.`);
311
+ };
312
+ const lower = name.toLowerCase();
313
+ if (lower.startsWith("__host-")) {
314
+ if (!options.secure) reject(`the __Host- prefix on \`${name}\` requires \`secure: true\``);
315
+ if (options.path !== undefined && options.path !== "/") reject(`the __Host- prefix on \`${name}\` requires \`Path=/\` (got \`${options.path}\`) — ` + `host-locking is the prefix's whole contract, so it cannot be path-scoped`);
316
+ if (options.domain) reject(`the __Host- prefix on \`${name}\` forbids \`Domain\` (got \`${options.domain}\`)`);
317
+ } else if (lower.startsWith("__secure-") && !options.secure) {
318
+ reject(`the __Secure- prefix on \`${name}\` requires \`secure: true\``);
319
+ }
320
+ if (options.sameSite && options.sameSite.toLowerCase() === "none" && !options.secure) {
321
+ reject("`SameSite=None` requires `secure: true`");
322
+ }
323
+ if (options.partitioned && !options.secure) {
324
+ reject("`Partitioned` requires `secure: true`");
325
+ }
326
+ }
304
327
  const FLASH_COOKIE = "flash";
305
328
  const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
306
329
  function hasFlashCookie(cookieHeader) {
@@ -339,6 +362,8 @@ function installListDriver(driver) {
339
362
  exports.listDriver = driver;
340
363
  }
341
364
  const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
365
+ const $$EVENT_TUPLE = Symbol();
366
+ const hasOwn = Object.prototype.hasOwnProperty;
342
367
  const INNER_OWNED = {};
343
368
  const delegatedEvents = new Set();
344
369
  const delegatedContainers = new Map();
@@ -464,7 +489,8 @@ function findOwner(target, state) {
464
489
  }
465
490
  function setProperty(node, name, value) {
466
491
  if (isHydrating(node)) return;
467
- node[name] = value;
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;
468
494
  }
469
495
  let claimHandlers = null;
470
496
  const CLAIM_SEAM = Symbol.for("solid.element-claims");
@@ -498,7 +524,17 @@ function claimElement(node) {
498
524
  }
499
525
  function setAttribute(node, name, value) {
500
526
  if (isHydrating(node)) return;
501
- if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
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;
502
538
  if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
503
539
  }
504
540
  function setAttributeNS(node, namespace, name, value) {
@@ -506,22 +542,32 @@ function setAttributeNS(node, namespace, name, value) {
506
542
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
507
543
  }
508
544
  function className(node, value, prev) {
509
- if (isHydrating(node)) return;
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
+ }
510
551
  if (value == null || value === false) {
511
- prev && node.removeAttribute("class");
552
+ if (prev || node._$classes) {
553
+ node.removeAttribute("class");
554
+ node._$classes = undefined;
555
+ }
512
556
  return;
513
557
  }
514
558
  if (typeof value === "string") {
559
+ node._$classes = undefined;
515
560
  value !== prev && node.setAttribute("class", value);
516
561
  return;
517
562
  }
563
+ let applied;
518
564
  if (typeof prev === "string") {
519
- prev = {};
565
+ applied = {};
520
566
  node.removeAttribute("class");
521
- } else prev = classListToObject(prev || {});
567
+ } else applied = node._$classes || classListToObject(prev || {});
522
568
  value = classListToObject(value);
523
- const classKeys = Object.keys(value || {});
524
- const prevKeys = Object.keys(prev);
569
+ const classKeys = Object.keys(value);
570
+ const prevKeys = Object.keys(applied);
525
571
  let i, len;
526
572
  for (i = 0, len = prevKeys.length; i < len; i++) {
527
573
  const key = prevKeys[i];
@@ -531,22 +577,34 @@ function className(node, value, prev) {
531
577
  for (i = 0, len = classKeys.length; i < len; i++) {
532
578
  const key = classKeys[i],
533
579
  classValue = !!value[key];
534
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
580
+ if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
535
581
  node.classList.add(key);
536
582
  }
583
+ node._$classes = value;
537
584
  }
538
585
  function addEvent(node, name, handler, delegate) {
539
586
  if (delegate) {
587
+ const key = `$$${name}`;
588
+ let data;
540
589
  if (Array.isArray(handler)) {
541
- node[`$$${name}`] = handler[0];
542
- node[`$$${name}Data`] = handler[1];
543
- } else node[`$$${name}`] = handler;
544
- } else if (Array.isArray(handler)) {
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)) {
545
597
  const handlerFn = handler[0];
546
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
547
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
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;
548
605
  }
549
606
  function style(node, value, prev) {
607
+ if (isHydrating(node)) return;
550
608
  if (!value) {
551
609
  if (prev || node._$styles) {
552
610
  setAttribute(node, "style");
@@ -571,12 +629,13 @@ function style(node, value, prev) {
571
629
  }
572
630
  let v, s;
573
631
  for (s in applied) {
574
- if (value[s] == null) {
632
+ if (!hasOwn.call(value, s) || value[s] == null) {
575
633
  nodeStyle.removeProperty(s);
576
634
  delete applied[s];
577
635
  }
578
636
  }
579
637
  for (s in value) {
638
+ if (!hasOwn.call(value, s)) continue;
580
639
  v = value[s];
581
640
  if (v != null && v !== applied[s]) {
582
641
  nodeStyle.setProperty(s, v);
@@ -585,20 +644,28 @@ function style(node, value, prev) {
585
644
  }
586
645
  }
587
646
  function setStyleProperty(node, name, value) {
647
+ if (isHydrating(node)) return;
588
648
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
589
649
  }
590
650
  function spread(node, props = {}, skipChildren) {
591
651
  const prevProps = {};
592
- if (!skipChildren) insert(node, () => props.children);
652
+ const get = typeof props === "function" ? props : () => props;
653
+ if (!skipChildren) insert(node, () => {
654
+ const source = get();
655
+ return hasOwn.call(source, "children") ? source.children : undefined;
656
+ });
593
657
  effect(() => {
594
- const r = props.ref;
658
+ const source = get();
659
+ const r = hasOwn.call(source, "ref") && source.ref;
595
660
  (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
596
661
  }, () => {});
597
662
  effect(() => {
663
+ const source = get();
598
664
  const newProps = {};
599
- for (const prop in props) {
665
+ for (const prop in source) {
666
+ if (!hasOwn.call(source, prop)) continue;
600
667
  if (prop === "children" || prop === "ref") continue;
601
- newProps[prop] = props[prop];
668
+ newProps[prop] = source[prop];
602
669
  }
603
670
  return newProps;
604
671
  }, props => assign(node, props, true, prevProps, true));
@@ -628,6 +695,19 @@ function scope(fn) {
628
695
  const SCOPE_OPTIONS = {
629
696
  scope: true
630
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
+ }
631
711
  let hydrationRt = null;
632
712
  function installHydrationRuntime() {
633
713
  hydrationRt = {
@@ -695,7 +775,7 @@ function insert(parent, accessor, marker, initial, options) {
695
775
  if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
696
776
  }
697
777
  if (typeof accessor !== "function") {
698
- accessor = normalize(accessor, initial, multi, true);
778
+ accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
699
779
  if (typeof accessor !== "function") {
700
780
  insertExpression(parent, accessor, initial, marker);
701
781
  host && tagHost(accessor, host);
@@ -710,9 +790,9 @@ function insert(parent, accessor, marker, initial, options) {
710
790
  let current = initial;
711
791
  effect(prev => {
712
792
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
713
- const value = normalize(accessor(), current, multi, true);
793
+ const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
714
794
  if (typeof value !== "function") return value;
715
- 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 => {
716
796
  current = insertExpression(parent, inner, current, marker);
717
797
  host && tagHost(current, host);
718
798
  }, prev !== undefined && !(options && options.schedule) ? {
@@ -1430,7 +1510,8 @@ function classListToObject(classList) {
1430
1510
  function flattenClassList(list, result) {
1431
1511
  for (let i = 0, len = list.length; i < len; i++) {
1432
1512
  const item = list[i];
1433
- 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;
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;
1434
1515
  }
1435
1516
  }
1436
1517
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
@@ -1446,12 +1527,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
1446
1527
  const name = prop.slice(2).toLowerCase();
1447
1528
  const delegate = DelegatedEvents.has(name);
1448
1529
  if (!delegate && prev) {
1449
- const h = Array.isArray(prev) ? prev[0] : prev;
1450
- node.removeEventListener(name, h);
1530
+ if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
1531
+ node.removeEventListener(name, prev, typeof prev !== "function" && prev);
1451
1532
  }
1452
1533
  if (delegate || value) {
1453
- addEvent(node, name, value, delegate);
1534
+ const attached = addEvent(node, name, value, delegate);
1454
1535
  delegate && delegateEvents([name]);
1536
+ if (!delegate) return attached;
1455
1537
  }
1456
1538
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1457
1539
  if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
@@ -1491,7 +1573,7 @@ function eventHandler(e, container, state) {
1491
1573
  }
1492
1574
  if (handler && !node.disabled) {
1493
1575
  const data = node[`${key}Data`];
1494
- 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);
1495
1577
  if (e.cancelBubble) return;
1496
1578
  }
1497
1579
  node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
@@ -1611,7 +1693,7 @@ function normalize(value, current, multi, doNotUnwrap) {
1611
1693
  const item = value[i],
1612
1694
  prev = current && current[i],
1613
1695
  t = typeof item;
1614
- 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;
1615
1697
  }
1616
1698
  }
1617
1699
  return value;
@@ -2092,6 +2174,7 @@ function isSafeError(value) {
2092
2174
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
2093
2175
  }
2094
2176
  const REVALIDATE_HEADER = "X-Revalidate";
2177
+ const RESPONSE_HEADER_VALUE_LIMIT = 4096;
2095
2178
  function initWithRevalidate(init = {}) {
2096
2179
  const resolved = typeof init === "number" ? {
2097
2180
  status: init
@@ -2112,7 +2195,13 @@ function initWithRevalidate(init = {}) {
2112
2195
  } else {
2113
2196
  headers = new Headers(responseInit.headers);
2114
2197
  }
2115
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
2198
+ if (revalidate !== undefined) {
2199
+ const keys = revalidate.toString();
2200
+ if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
2201
+ throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
2202
+ }
2203
+ headers.set(REVALIDATE_HEADER, keys);
2204
+ }
2116
2205
  return {
2117
2206
  responseInit,
2118
2207
  headers
@@ -2130,7 +2219,12 @@ function redirect(url, init = 302) {
2130
2219
  responseInit.status = 302;
2131
2220
  }
2132
2221
  const target = typeof url === "string" ? url : url[HREF];
2133
- headers.set("Location", typeof target === "string" ? target : String(url));
2222
+ const location = typeof target === "string" ? target : String(url);
2223
+ const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
2224
+ if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
2225
+ throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
2226
+ }
2227
+ headers.set("Location", encoded);
2134
2228
  return new Response(null, {
2135
2229
  ...responseInit,
2136
2230
  headers
@@ -2146,11 +2240,19 @@ function reload(init = {}) {
2146
2240
  headers
2147
2241
  });
2148
2242
  }
2243
+ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
2149
2244
  function respond(value, init = {}) {
2150
2245
  const {
2151
2246
  responseInit,
2152
2247
  headers
2153
2248
  } = initWithRevalidate(init);
2249
+ for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
2250
+ if (NULL_BODY_STATUSES.has(responseInit.status)) {
2251
+ return new ResponseEnvelope(new Response(null, {
2252
+ ...responseInit,
2253
+ headers
2254
+ }), value);
2255
+ }
2154
2256
  headers.set("Content-Type", "application/json");
2155
2257
  return new ResponseEnvelope(new Response(JSON.stringify(value), {
2156
2258
  ...responseInit,
@@ -2260,9 +2362,24 @@ function dynamic(source) {
2260
2362
  return solidJs.untrack(() => component(props));
2261
2363
  }
2262
2364
  case "string":
2263
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
2264
- spread(el, props);
2265
- return el;
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
+ }
2266
2383
  }
2267
2384
  });
2268
2385
  };
@@ -2271,8 +2388,15 @@ function Dynamic(props) {
2271
2388
  const Comp = dynamic(() => props.component);
2272
2389
  return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
2273
2390
  }
2391
+ const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
2274
2392
  function createElement(tagName, is = undefined) {
2275
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
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, {
2276
2400
  is
2277
2401
  });
2278
2402
  }
@@ -2368,8 +2492,10 @@ exports.Dynamic = Dynamic;
2368
2492
  exports.HREF = HREF;
2369
2493
  exports.HydrationScript = HydrationScript;
2370
2494
  exports.MathMLElements = MathMLElements;
2495
+ exports.NULL_BODY_STATUSES = NULL_BODY_STATUSES;
2371
2496
  exports.Namespaces = Namespaces;
2372
2497
  exports.Portal = Portal;
2498
+ exports.RESPONSE_HEADER_VALUE_LIMIT = RESPONSE_HEADER_VALUE_LIMIT;
2373
2499
  exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
2374
2500
  exports.RawTextElements = RawTextElements;
2375
2501
  exports.RequestContext = RequestContext;
@@ -2402,6 +2528,7 @@ exports.getDelegatedRoot = getDelegatedRoot;
2402
2528
  exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
2403
2529
  exports.getFirstChild = getFirstChild;
2404
2530
  exports.getHydrationKey = getHydrationKey;
2531
+ exports.getInsertionParent = getInsertionParent;
2405
2532
  exports.getNextElement = getNextElement;
2406
2533
  exports.getNextMarker = getNextMarker;
2407
2534
  exports.getNextMatch = getNextMatch;