@solidjs/web 2.0.0-rc.6 → 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 (50) hide show
  1. package/dist/server.cjs +105 -35
  2. package/dist/server.dev.cjs +3794 -0
  3. package/dist/server.dev.js +3627 -0
  4. package/dist/server.js +106 -36
  5. package/dist/web.cjs +39 -385
  6. package/dist/{dev.cjs → web.dev.cjs} +91 -396
  7. package/dist/{dev.js → web.dev.js} +93 -393
  8. package/dist/web.js +41 -382
  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 +234 -32
  14. package/frames/dist/server.dev.cjs +4584 -0
  15. package/frames/dist/server.dev.js +4571 -0
  16. package/frames/dist/server.js +234 -32
  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 +13 -14
  24. package/server-functions/dist/client.js +13 -14
  25. package/server-functions/dist/server.cjs +331 -83
  26. package/server-functions/dist/server.dev.cjs +338 -82
  27. package/server-functions/dist/server.dev.js +338 -82
  28. package/server-functions/dist/server.js +331 -83
  29. package/types/client.d.ts +0 -3
  30. package/types/frames/frame-client.d.ts +1 -1
  31. package/types/head.d.ts +3 -0
  32. package/types/index.d.ts +18 -7
  33. package/types/index.server.d.ts +31 -9
  34. package/types/render.d.ts +3 -1
  35. package/types/server-functions/flash.d.ts +12 -3
  36. package/types/server-functions/server.d.ts +27 -3
  37. package/types/server-mock.d.ts +43 -7
  38. package/types/server.d.ts +47 -5
  39. package/types-cjs/client.d.cts +0 -3
  40. package/types-cjs/frames/frame-client.d.cts +1 -1
  41. package/types-cjs/head.d.cts +3 -0
  42. package/types-cjs/index.d.cts +18 -7
  43. package/types-cjs/index.server.d.cts +31 -9
  44. package/types-cjs/render.d.cts +3 -1
  45. package/types-cjs/server-functions/flash.d.cts +12 -3
  46. package/types-cjs/server-functions/server.d.cts +27 -3
  47. package/types-cjs/server-mock.d.cts +43 -7
  48. package/types-cjs/server.d.cts +47 -5
  49. package/types/patch-driver.d.ts +0 -3
  50. package/types-cjs/patch-driver.d.cts +0 -3
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush, getOwner, createOwner, patchableRaw, storeHasOptimisticFamily, storeIsShallow, registerRowOps, registerSlotPatch, onCleanup, registerPatch, createComponent, omit, createSignal, createEffect } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush, createComponent, omit, createOwner, createSignal, onCleanup, getOwner, createEffect } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const DOMWithState = {
@@ -58,11 +58,12 @@ const syncOptions = {
58
58
  sync: true
59
59
  };
60
60
  function effect(fn, effectFn, options) {
61
- createRenderEffect(fn, effectFn, options ? {
61
+ const nodeOptions = options ? {
62
62
  sync: true,
63
63
  ...options,
64
64
  transparent: !options.scope
65
- } : transparentOptions);
65
+ } : transparentOptions;
66
+ createRenderEffect(fn, effectFn, nodeOptions);
66
67
  }
67
68
  function memo(fn) {
68
69
  return createMemo(() => fn(), syncOptions);
@@ -211,12 +212,24 @@ function classifyHeadTag(desc) {
211
212
  resource: false
212
213
  };
213
214
  }
215
+ function qualifierValue(name, value) {
216
+ if (value == null || value === false) return null;
217
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
218
+ const v = value === true ? "" : String(value);
219
+ if (name === "as") return asciiLowerCase(v);
220
+ if (name !== "crossorigin") return v;
221
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
222
+ }
223
+ function asciiLowerCase(value) {
224
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
225
+ }
214
226
  function resourceIdentity(tag, props) {
215
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
227
+ const url = String(props.href || props.src || "");
228
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
216
229
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
217
230
  const q = RESOURCE_QUALIFIERS[i];
218
- const value = props[q];
219
- if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
231
+ const value = qualifierValue(q, props[q]);
232
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
220
233
  }
221
234
  return id;
222
235
  }
@@ -335,10 +348,6 @@ const waitAsset = promise => {
335
348
  }
336
349
  gate();
337
350
  };
338
- let listDriver;
339
- function installListDriver(driver) {
340
- listDriver = driver;
341
- }
342
351
  const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
343
352
  const $$EVENT_TUPLE = Symbol();
344
353
  const hasOwn = Object.prototype.hasOwnProperty;
@@ -617,9 +626,9 @@ function setStyleProperty(node, name, value) {
617
626
  if (isHydrating(node)) return;
618
627
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
619
628
  }
620
- function spread(node, props = {}, skipChildren) {
629
+ function spread(node, props, skipChildren) {
621
630
  const prevProps = {};
622
- const get = typeof props === "function" ? props : () => props;
631
+ const get = () => (typeof props === "function" ? props() : props) ?? {};
623
632
  if (!skipChildren) insert(node, () => {
624
633
  const source = get();
625
634
  return hasOwn.call(source, "children") ? source.children : undefined;
@@ -665,19 +674,6 @@ function scope(fn) {
665
674
  const SCOPE_OPTIONS = {
666
675
  scope: true
667
676
  };
668
- let insertionParent = null;
669
- function getInsertionParent() {
670
- return insertionParent;
671
- }
672
- function withInsertionParent(parent, fn) {
673
- const prev = insertionParent;
674
- insertionParent = parent;
675
- try {
676
- return fn();
677
- } finally {
678
- insertionParent = prev;
679
- }
680
- }
681
677
  let hydrationRt = null;
682
678
  function installHydrationRuntime() {
683
679
  hydrationRt = {
@@ -739,13 +735,8 @@ function insert(parent, accessor, marker, initial, options) {
739
735
  const host = options && options.host;
740
736
  if (multi && !initial) initial = [];
741
737
  if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
742
- if (listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
743
- const listAccessor = accessor;
744
- const owner = getOwner();
745
- if (listDriver(parent, accessor, marker, () => runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
746
- }
747
738
  if (typeof accessor !== "function") {
748
- accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
739
+ accessor = normalize(accessor, initial, multi, true);
749
740
  if (typeof accessor !== "function") {
750
741
  insertExpression(parent, accessor, initial, marker);
751
742
  host && tagHost(accessor, host);
@@ -760,9 +751,9 @@ function insert(parent, accessor, marker, initial, options) {
760
751
  let current = initial;
761
752
  effect(prev => {
762
753
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
763
- const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
754
+ const value = normalize(accessor(), current, multi, true);
764
755
  if (typeof value !== "function") return value;
765
- effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
756
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
766
757
  current = insertExpression(parent, inner, current, marker);
767
758
  host && tagHost(current, host);
768
759
  }, prev !== undefined && !(options && options.schedule) ? {
@@ -803,10 +794,16 @@ function assetEntryKey(descriptor) {
803
794
  if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
804
795
  return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
805
796
  }
806
- function findAssetElement(selector, attr, value) {
797
+ function findAssetElement(selector, attr, value, qualifiers) {
807
798
  const nodes = document.querySelectorAll(selector);
808
- for (let i = 0; i < nodes.length; i++) {
809
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
799
+ outer: for (let i = 0; i < nodes.length; i++) {
800
+ if (nodes[i].getAttribute(attr) !== value) continue;
801
+ if (!qualifiers) return nodes[i];
802
+ for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
803
+ const name = RESOURCE_QUALIFIERS[q];
804
+ if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
805
+ }
806
+ return nodes[i];
810
807
  }
811
808
  return null;
812
809
  }
@@ -1110,8 +1107,8 @@ function mountHeadResource(tag, props) {
1110
1107
  headMountedResources.add(identity);
1111
1108
  const url = props.href || props.src;
1112
1109
  let el = null;
1113
- if (url != null) {
1114
- if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1110
+ if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
1111
+ if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url, props);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1115
1112
  }
1116
1113
  if (!el) document.head.appendChild(createHeadElement(tag, props));
1117
1114
  }
@@ -1688,322 +1685,6 @@ function getHydrationKey() {
1688
1685
  }
1689
1686
  const RequestContext = Symbol();
1690
1687
 
1691
- const PURE_ROW = Symbol.for("solid.pure-row");
1692
- const arm = () => {
1693
- installListDriver(driveList);
1694
- };
1695
- function rowProof(fn) {
1696
- arm();
1697
- fn[PURE_ROW] = true;
1698
- return fn;
1699
- }
1700
- let rowCollector = null;
1701
- const lisPositions = sources => {
1702
- const n = sources.length;
1703
- const tails = [];
1704
- const tailsIdx = [];
1705
- const prev = new Array(n).fill(-1);
1706
- for (let j = 0; j < n; j++) {
1707
- const v = sources[j];
1708
- if (v === -1) continue;
1709
- let lo = 0,
1710
- hi = tails.length;
1711
- while (lo < hi) {
1712
- const mid = lo + hi >> 1;
1713
- if (tails[mid] < v) lo = mid + 1;else hi = mid;
1714
- }
1715
- if (lo > 0) prev[j] = tailsIdx[lo - 1];
1716
- tails[lo] = v;
1717
- tailsIdx[lo] = j;
1718
- }
1719
- const stable = new Set();
1720
- let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
1721
- while (k >= 0) {
1722
- stable.add(k);
1723
- k = prev[k];
1724
- }
1725
- return stable;
1726
- };
1727
- const driveList = (parent, listFn, marker, lateClassic) => {
1728
- const meta = listFn.$ll;
1729
- if (meta.row?.[PURE_ROW] !== true) return false;
1730
- if (typeof meta.keyed === "function") return false;
1731
- const evalOwner = createOwner({
1732
- id: "&each"
1733
- });
1734
- let subject = runWithOwner(evalOwner, () => untrack(meta.each));
1735
- evalOwner.dispose();
1736
- let raw = subject != null ? patchableRaw(subject) : undefined;
1737
- if (raw === undefined || !Array.isArray(raw)) return false;
1738
- const optimistic = storeHasOptimisticFamily(subject);
1739
- if (optimistic) raw = untrack(() => Array.from(subject));
1740
- const hydrating = !!sharedConfig.hydrating;
1741
- if (hydrating && raw.length === 0) return false;
1742
- let domRows;
1743
- let rowIds;
1744
- if (hydrating) {
1745
- if (marker !== undefined) return false;
1746
- domRows = Array.from(parent.children);
1747
- if (domRows.length !== raw.length) return false;
1748
- rowIds = new Array(raw.length);
1749
- for (let i = 0; i < domRows.length; i++) {
1750
- const key = domRows[i].getAttribute("_hk");
1751
- if (key === null || !key.endsWith("0") || key.length < 2) return false;
1752
- rowIds[i] = key.slice(0, -1);
1753
- }
1754
- }
1755
- const rowFn = meta.row;
1756
- const endAnchor = marker ?? null;
1757
- const shallow = storeIsShallow(subject);
1758
- let lastBodies = null;
1759
- let lastUnbinds = null;
1760
- const collectBind = (abs, build) => {
1761
- const prevC = rowCollector;
1762
- rowCollector = {
1763
- row: shallow ? subject[abs] : undefined,
1764
- bodies: [],
1765
- unbinds: []
1766
- };
1767
- try {
1768
- return build();
1769
- } finally {
1770
- lastBodies = rowCollector.bodies;
1771
- lastUnbinds = rowCollector.unbinds;
1772
- rowCollector = prevC;
1773
- }
1774
- };
1775
- const listOwner = createOwner();
1776
- let declined = false;
1777
- const bindRow = (abs, claimId) => {
1778
- return collectBind(abs, () => runWithOwner(listOwner, () => claimId !== undefined ? runWithOwner(createOwner({
1779
- id: claimId
1780
- }), () => untrack(() => rowFn(subject[abs]))) : untrack(() => rowFn(subject[abs]))));
1781
- };
1782
- let entries = new Array(raw.length);
1783
- let rowBodies = shallow ? new Array(raw.length) : null;
1784
- let rowUnbinds = new Array(raw.length);
1785
- const runUnbinds = list => {
1786
- if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
1787
- };
1788
- const unbindAllRows = () => {
1789
- for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
1790
- rowUnbinds = [];
1791
- };
1792
- let prevRaws = raw.slice();
1793
- try {
1794
- if (hydrating) {
1795
- for (let i = 0; i < raw.length; i++) {
1796
- entries[i] = bindRow(i, rowIds[i]);
1797
- if (rowBodies !== null) rowBodies[i] = lastBodies;
1798
- rowUnbinds[i] = lastUnbinds;
1799
- }
1800
- } else {
1801
- for (let i = 0; i < raw.length; i++) {
1802
- const node = bindRow(i);
1803
- entries[i] = node;
1804
- if (rowBodies !== null) rowBodies[i] = lastBodies;
1805
- rowUnbinds[i] = lastUnbinds;
1806
- parent.insertBefore(node, endAnchor);
1807
- }
1808
- }
1809
- } catch (err) {
1810
- unbindAllRows();
1811
- runUnbinds(lastUnbinds ?? undefined);
1812
- for (let j = 0; j < entries.length; j++) {
1813
- const n = entries[j];
1814
- if (n !== undefined && n.parentNode === parent) n.remove();
1815
- }
1816
- listOwner.dispose();
1817
- throw err;
1818
- }
1819
- const identityOps = nextArr => {
1820
- const keyOf = r => {
1821
- const w = r != null ? patchableRaw(r) : undefined;
1822
- return w !== undefined ? w : r;
1823
- };
1824
- const oldIndex = new Map();
1825
- for (let j = 0; j < prevRaws.length; j++) {
1826
- const k = keyOf(prevRaws[j]);
1827
- const existing = oldIndex.get(k);
1828
- if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
1829
- }
1830
- const sources = new Array(nextArr.length);
1831
- for (let k = 0; k < nextArr.length; k++) {
1832
- const m = oldIndex.get(keyOf(nextArr[k]));
1833
- if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
1834
- sources[k] = m.shift();
1835
- if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
1836
- } else {
1837
- sources[k] = m;
1838
- oldIndex.delete(keyOf(nextArr[k]));
1839
- }
1840
- }
1841
- return {
1842
- prefix: 0,
1843
- sources
1844
- };
1845
- };
1846
- let resyncNeeded = false;
1847
- const applyOps = (next, ops) => {
1848
- if (declined) return;
1849
- if (resyncNeeded) ops = null;
1850
- if (ops === null) ops = identityOps(next);
1851
- const {
1852
- prefix,
1853
- sources
1854
- } = ops;
1855
- const built = new Array(sources.length);
1856
- const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
1857
- const builtUnbinds = new Array(sources.length);
1858
- let j = 0;
1859
- try {
1860
- for (; j < sources.length; j++) {
1861
- const abs = prefix + j;
1862
- const src = sources[j];
1863
- if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
1864
- built[j] = bindRow(abs);
1865
- if (builtBodies !== null) builtBodies[j] = lastBodies;
1866
- builtUnbinds[j] = lastUnbinds;
1867
- }
1868
- }
1869
- } catch (err) {
1870
- for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
1871
- runUnbinds(lastUnbinds ?? undefined);
1872
- resyncNeeded = true;
1873
- throw err;
1874
- }
1875
- const retained = new Set();
1876
- for (let k = 0; k < sources.length; k++) {
1877
- if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
1878
- }
1879
- for (let k = prefix; k < entries.length; k++) {
1880
- if (!retained.has(k)) {
1881
- entries[k].remove();
1882
- runUnbinds(rowUnbinds[k]);
1883
- }
1884
- }
1885
- const newEntries = new Array(prefix + sources.length);
1886
- const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
1887
- const newUnbinds = new Array(prefix + sources.length);
1888
- for (let i = 0; i < prefix; i++) {
1889
- newEntries[i] = entries[i];
1890
- if (newBodies !== null) newBodies[i] = rowBodies[i];
1891
- newUnbinds[i] = rowUnbinds[i];
1892
- }
1893
- const stable = lisPositions(sources);
1894
- let anchor = endAnchor;
1895
- for (let k = sources.length - 1; k >= 0; k--) {
1896
- const abs = prefix + k;
1897
- const src = sources[k];
1898
- let node;
1899
- if (built[k] !== undefined) {
1900
- node = built[k];
1901
- if (newBodies !== null) newBodies[abs] = builtBodies[k];
1902
- newUnbinds[abs] = builtUnbinds[k];
1903
- parent.insertBefore(node, anchor);
1904
- } else {
1905
- node = entries[src];
1906
- if (newBodies !== null) newBodies[abs] = rowBodies[src];
1907
- newUnbinds[abs] = rowUnbinds[src];
1908
- if (!stable.has(k)) parent.insertBefore(node, anchor);
1909
- }
1910
- newEntries[abs] = node;
1911
- anchor = node;
1912
- }
1913
- entries = newEntries;
1914
- if (newBodies !== null) rowBodies = newBodies;
1915
- rowUnbinds = newUnbinds;
1916
- prevRaws = next.slice();
1917
- resyncNeeded = false;
1918
- };
1919
- let unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
1920
- const refRebuild = shallow && typeof meta.keyed !== "function";
1921
- const rebuildSlot = i => {
1922
- runUnbinds(rowUnbinds[i]);
1923
- const old = entries[i];
1924
- const node = bindRow(i);
1925
- rowBodies[i] = lastBodies;
1926
- rowUnbinds[i] = lastUnbinds;
1927
- parent.insertBefore(node, old);
1928
- old.remove();
1929
- entries[i] = node;
1930
- };
1931
- const applySlot = (i, next, prev) => {
1932
- if (declined) return;
1933
- if (resyncNeeded) {
1934
- const live = subject != null ? patchableRaw(subject) : undefined;
1935
- if (live !== undefined && Array.isArray(live)) applyOps(live, null);
1936
- return;
1937
- }
1938
- if (refRebuild) {
1939
- rebuildSlot(i);
1940
- prevRaws[i] = next;
1941
- return;
1942
- }
1943
- const bodies = rowBodies[i];
1944
- if (bodies !== undefined) {
1945
- for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
1946
- }
1947
- prevRaws[i] = next;
1948
- };
1949
- let unbindSlots = shallow ? runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot)) : null;
1950
- runWithOwner(listOwner, () => effect(() => meta.each(), value => {
1951
- if (declined || value === subject) return;
1952
- const nextRaw = value != null ? patchableRaw(value) : undefined;
1953
- unbindOps();
1954
- unbindSlots?.();
1955
- if (nextRaw !== undefined && Array.isArray(nextRaw) && storeIsShallow(value) !== shallow) {
1956
- for (let j = 0; j < entries.length; j++) entries[j].remove();
1957
- entries = [];
1958
- prevRaws = [];
1959
- unbindAllRows();
1960
- subject = value;
1961
- declined = true;
1962
- listOwner.dispose();
1963
- lateClassic?.();
1964
- return;
1965
- }
1966
- if (nextRaw === undefined || !Array.isArray(nextRaw)) {
1967
- for (let j = 0; j < entries.length; j++) entries[j].remove();
1968
- entries = [];
1969
- prevRaws = [];
1970
- unbindAllRows();
1971
- subject = value;
1972
- declined = true;
1973
- listOwner.dispose();
1974
- lateClassic?.();
1975
- return;
1976
- }
1977
- const swapOps = identityOps(nextRaw);
1978
- subject = value;
1979
- unbindOps = runWithOwner(listOwner, () => registerRowOps(subject, applyOps));
1980
- if (shallow) unbindSlots = runWithOwner(listOwner, () => registerSlotPatch(subject, applySlot));
1981
- applyOps(nextRaw, swapOps);
1982
- }));
1983
- onCleanup(() => {
1984
- unbindOps();
1985
- unbindSlots?.();
1986
- unbindAllRows();
1987
- listOwner.dispose();
1988
- });
1989
- return true;
1990
- };
1991
- const patchDriver = (subject, body) => {
1992
- const raw = patchableRaw(subject);
1993
- if (raw !== undefined) {
1994
- if (!sharedConfig.hydrating) body(raw, undefined, true);
1995
- const unbind = registerPatch(subject, body);
1996
- if (rowCollector !== null) rowCollector.unbinds.push(unbind);
1997
- else onCleanup(unbind);
1998
- } else if (rowCollector !== null && subject === rowCollector.row) {
1999
- rowCollector.bodies.push(body);
2000
- if (!sharedConfig.hydrating) body(subject, undefined, true);
2001
- } else {
2002
- effect(() => body(subject, subject, false),
2003
- () => untrack(() => body(subject, undefined, true)));
2004
- }
2005
- };
2006
-
2007
1688
  function throwInBrowser(func) {
2008
1689
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
2009
1690
  console.error(err);
@@ -2221,7 +1902,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2221
1902
  function bindingOf(value) {
2222
1903
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
2223
1904
  }
2224
- function dynamic(source) {
1905
+ function dynamic(source, _options) {
2225
1906
  let latest = 0;
2226
1907
  const sites = new Set();
2227
1908
  let deliveredAddress;
@@ -2262,24 +1943,9 @@ function dynamic(source) {
2262
1943
  return untrack(() => component(props));
2263
1944
  }
2264
1945
  case "string":
2265
- {
2266
- if (sharedConfig.hydrating) {
2267
- const el = getNextElement();
2268
- spread(el, props);
2269
- return el;
2270
- }
2271
- const owner = getOwner();
2272
- let el;
2273
- return () => {
2274
- if (!el) {
2275
- runWithOwner(owner, () => {
2276
- el = createElement(component, untrack(() => props.is));
2277
- spread(el, props);
2278
- });
2279
- }
2280
- return el;
2281
- };
2282
- }
1946
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
1947
+ spread(el, props);
1948
+ return el;
2283
1949
  }
2284
1950
  });
2285
1951
  };
@@ -2288,15 +1954,8 @@ function Dynamic(props) {
2288
1954
  const Comp = dynamic(() => props.component);
2289
1955
  return createComponent(Comp, omit(props, "component"));
2290
1956
  }
2291
- const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
2292
1957
  function createElement(tagName, is = undefined) {
2293
- if (SVGElements.has(tagName)) return document.createElementNS(Namespaces.svg, tagName);
2294
- if (MathMLElements.has(tagName)) return document.createElementNS(Namespaces.mathml, tagName);
2295
- if (AmbiguousSVGElements.has(tagName)) {
2296
- const parent = getInsertionParent();
2297
- if (parent && parent.namespaceURI === Namespaces.svg && parent.localName !== "foreignObject") return document.createElementNS(Namespaces.svg, tagName);
2298
- }
2299
- return document.createElement(tagName, {
1958
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
2300
1959
  is
2301
1960
  });
2302
1961
  }
@@ -2328,4 +1987,4 @@ _moduleUrl) {
2328
1987
  function httpStatus(_code, _text) {}
2329
1988
  function httpHeader(_name, _value, _options) {}
2330
1989
 
2331
- 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 };
1990
+ 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, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
@@ -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) {