@solidjs/web 2.0.0-rc.5 → 2.0.0-rc.7

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 (52) hide show
  1. package/dist/server.cjs +122 -38
  2. package/dist/server.dev.cjs +3794 -0
  3. package/dist/server.dev.js +3627 -0
  4. package/dist/server.js +123 -39
  5. package/dist/web.cjs +102 -366
  6. package/dist/{dev.cjs → web.dev.cjs} +153 -376
  7. package/dist/{dev.js → web.dev.js} +155 -374
  8. package/dist/web.js +104 -364
  9. package/frames/dist/client.cjs +11 -3
  10. package/frames/dist/client.dev.cjs +11 -3
  11. package/frames/dist/client.dev.js +11 -3
  12. package/frames/dist/client.js +11 -3
  13. package/frames/dist/server.cjs +320 -53
  14. package/frames/dist/server.dev.cjs +4584 -0
  15. package/frames/dist/server.dev.js +4571 -0
  16. package/frames/dist/server.js +320 -53
  17. package/frames/package.json +10 -0
  18. package/package.json +78 -8
  19. package/serialization/dist/decode.cjs +18 -4
  20. package/serialization/dist/decode.js +18 -4
  21. package/serialization/dist/serialization.cjs +18 -4
  22. package/serialization/dist/serialization.js +18 -4
  23. package/server-functions/dist/client.cjs +27 -16
  24. package/server-functions/dist/client.js +27 -16
  25. package/server-functions/dist/server.cjs +529 -131
  26. package/server-functions/dist/server.dev.cjs +536 -130
  27. package/server-functions/dist/server.dev.js +536 -130
  28. package/server-functions/dist/server.js +529 -131
  29. package/types/client.d.ts +1 -3
  30. package/types/constants.d.ts +3 -1
  31. package/types/frames/frame-client.d.ts +1 -1
  32. package/types/head.d.ts +3 -0
  33. package/types/index.d.ts +18 -7
  34. package/types/index.server.d.ts +31 -9
  35. package/types/render.d.ts +3 -1
  36. package/types/server-functions/flash.d.ts +12 -3
  37. package/types/server-functions/server.d.ts +100 -5
  38. package/types/server-mock.d.ts +43 -7
  39. package/types/server.d.ts +47 -5
  40. package/types-cjs/client.d.cts +1 -3
  41. package/types-cjs/constants.d.cts +3 -1
  42. package/types-cjs/frames/frame-client.d.cts +1 -1
  43. package/types-cjs/head.d.cts +3 -0
  44. package/types-cjs/index.d.cts +18 -7
  45. package/types-cjs/index.server.d.cts +31 -9
  46. package/types-cjs/render.d.cts +3 -1
  47. package/types-cjs/server-functions/flash.d.cts +12 -3
  48. package/types-cjs/server-functions/server.d.cts +100 -5
  49. package/types-cjs/server-mock.d.cts +43 -7
  50. package/types-cjs/server.d.cts +47 -5
  51. package/types/patch-driver.d.ts +0 -3
  52. package/types-cjs/patch-driver.d.cts +0 -3
@@ -920,13 +920,20 @@ function parseFragment(html) {
920
920
  return template.content;
921
921
  }
922
922
  const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
923
+ function qualifierValue(name, value) {
924
+ if (value == null) return null;
925
+ if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
926
+ if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
927
+ if (name !== "crossorigin") return value;
928
+ return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
929
+ }
923
930
  function findHeadElement(selector, attr, value, qualifiers) {
924
931
  candidate: for (const node of document.head.querySelectorAll(selector)) {
925
932
  if (node.getAttribute(attr) !== value) continue;
926
933
  if (!qualifiers) return node;
927
934
  for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
928
935
  const name = PRELOAD_QUALIFIERS[i];
929
- if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
936
+ if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
930
937
  }
931
938
  return node;
932
939
  }
@@ -934,11 +941,12 @@ function findHeadElement(selector, attr, value, qualifiers) {
934
941
  }
935
942
  function ensurePreload(entry) {
936
943
  const attrs = entry.attrs;
937
- if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
944
+ const href = entry.href;
945
+ if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
938
946
  const link = document.createElement("link");
939
947
  link.rel = "preload";
940
948
  for (const name in attrs) link.setAttribute(name, attrs[name]);
941
- link.setAttribute("href", entry.href);
949
+ if (href) link.setAttribute("href", href);
942
950
  document.head.appendChild(link);
943
951
  }
944
952
  function ensureStylesheet(entry, onSettle) {
@@ -930,13 +930,20 @@ function parseFragment(html) {
930
930
  return template.content;
931
931
  }
932
932
  const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
933
+ function qualifierValue(name, value) {
934
+ if (value == null) return null;
935
+ if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
936
+ if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
937
+ if (name !== "crossorigin") return value;
938
+ return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
939
+ }
933
940
  function findHeadElement(selector, attr, value, qualifiers) {
934
941
  candidate: for (const node of document.head.querySelectorAll(selector)) {
935
942
  if (node.getAttribute(attr) !== value) continue;
936
943
  if (!qualifiers) return node;
937
944
  for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
938
945
  const name = PRELOAD_QUALIFIERS[i];
939
- if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
946
+ if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
940
947
  }
941
948
  return node;
942
949
  }
@@ -944,11 +951,12 @@ function findHeadElement(selector, attr, value, qualifiers) {
944
951
  }
945
952
  function ensurePreload(entry) {
946
953
  const attrs = entry.attrs;
947
- if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
954
+ const href = entry.href;
955
+ if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
948
956
  const link = document.createElement("link");
949
957
  link.rel = "preload";
950
958
  for (const name in attrs) link.setAttribute(name, attrs[name]);
951
- link.setAttribute("href", entry.href);
959
+ if (href) link.setAttribute("href", href);
952
960
  document.head.appendChild(link);
953
961
  }
954
962
  function ensureStylesheet(entry, onSettle) {
@@ -928,13 +928,20 @@ function parseFragment(html) {
928
928
  return template.content;
929
929
  }
930
930
  const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
931
+ function qualifierValue(name, value) {
932
+ if (value == null) return null;
933
+ if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
934
+ if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
935
+ if (name !== "crossorigin") return value;
936
+ return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
937
+ }
931
938
  function findHeadElement(selector, attr, value, qualifiers) {
932
939
  candidate: for (const node of document.head.querySelectorAll(selector)) {
933
940
  if (node.getAttribute(attr) !== value) continue;
934
941
  if (!qualifiers) return node;
935
942
  for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
936
943
  const name = PRELOAD_QUALIFIERS[i];
937
- if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
944
+ if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
938
945
  }
939
946
  return node;
940
947
  }
@@ -942,11 +949,12 @@ function findHeadElement(selector, attr, value, qualifiers) {
942
949
  }
943
950
  function ensurePreload(entry) {
944
951
  const attrs = entry.attrs;
945
- if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
952
+ const href = entry.href;
953
+ if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
946
954
  const link = document.createElement("link");
947
955
  link.rel = "preload";
948
956
  for (const name in attrs) link.setAttribute(name, attrs[name]);
949
- link.setAttribute("href", entry.href);
957
+ if (href) link.setAttribute("href", href);
950
958
  document.head.appendChild(link);
951
959
  }
952
960
  function ensureStylesheet(entry, onSettle) {
@@ -918,13 +918,20 @@ function parseFragment(html) {
918
918
  return template.content;
919
919
  }
920
920
  const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
921
+ function qualifierValue(name, value) {
922
+ if (value == null) return null;
923
+ if (name === "imagesrcset" || name === "imagesizes") return value === "" ? null : value;
924
+ if (name === "as") return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
925
+ if (name !== "crossorigin") return value;
926
+ return value.length === 15 && value.toLowerCase() === "use-credentials" ? "use-credentials" : "anonymous";
927
+ }
921
928
  function findHeadElement(selector, attr, value, qualifiers) {
922
929
  candidate: for (const node of document.head.querySelectorAll(selector)) {
923
930
  if (node.getAttribute(attr) !== value) continue;
924
931
  if (!qualifiers) return node;
925
932
  for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
926
933
  const name = PRELOAD_QUALIFIERS[i];
927
- if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
934
+ if (qualifierValue(name, node.getAttribute(name)) !== qualifierValue(name, qualifiers[name] ?? null)) continue candidate;
928
935
  }
929
936
  return node;
930
937
  }
@@ -932,11 +939,12 @@ function findHeadElement(selector, attr, value, qualifiers) {
932
939
  }
933
940
  function ensurePreload(entry) {
934
941
  const attrs = entry.attrs;
935
- if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
942
+ const href = entry.href;
943
+ if (findHeadElement('link[rel="preload"]', "href", href || null, attrs)) return;
936
944
  const link = document.createElement("link");
937
945
  link.rel = "preload";
938
946
  for (const name in attrs) link.setAttribute(name, attrs[name]);
939
- link.setAttribute("href", entry.href);
947
+ if (href) link.setAttribute("href", href);
940
948
  document.head.appendChild(link);
941
949
  }
942
950
  function ensureStylesheet(entry, onSettle) {