@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
@@ -58,12 +58,32 @@ const transparentOptions = {
58
58
  const syncOptions = {
59
59
  sync: true
60
60
  };
61
+ let bindingEffect = null;
62
+ function tagElement(node) {
63
+ if (bindingEffect !== null && bindingEffect._devElement === undefined) bindingEffect._devElement = node;
64
+ }
61
65
  function effect(fn, effectFn, options) {
62
- solidJs.createRenderEffect(fn, effectFn, options ? {
66
+ const nodeOptions = options ? {
63
67
  sync: true,
64
68
  ...options,
65
69
  transparent: !options.scope
66
- } : transparentOptions);
70
+ } : transparentOptions;
71
+ {
72
+ let node = null;
73
+ solidJs.createRenderEffect(prev => {
74
+ node = solidJs.getOwner();
75
+ return fn(prev);
76
+ }, (value, prev) => {
77
+ const outer = bindingEffect;
78
+ bindingEffect = node;
79
+ try {
80
+ return effectFn(value, prev);
81
+ } finally {
82
+ bindingEffect = outer;
83
+ }
84
+ }, nodeOptions);
85
+ return;
86
+ }
67
87
  }
68
88
  function memo(fn) {
69
89
  return solidJs.createMemo(() => fn(), syncOptions);
@@ -212,12 +232,24 @@ function classifyHeadTag(desc) {
212
232
  resource: false
213
233
  };
214
234
  }
235
+ function qualifierValue(name, value) {
236
+ if (value == null || value === false) return null;
237
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
238
+ const v = value === true ? "" : String(value);
239
+ if (name === "as") return asciiLowerCase(v);
240
+ if (name !== "crossorigin") return v;
241
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
242
+ }
243
+ function asciiLowerCase(value) {
244
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
245
+ }
215
246
  function resourceIdentity(tag, props) {
216
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
247
+ const url = String(props.href || props.src || "");
248
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
217
249
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
218
250
  const q = RESOURCE_QUALIFIERS[i];
219
- const value = props[q];
220
- if (value != null) id += ":" + q + "=" + (value === true ? "" : value);
251
+ const value = qualifierValue(q, props[q]);
252
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
221
253
  }
222
254
  return id;
223
255
  }
@@ -357,10 +389,6 @@ const waitAsset = promise => {
357
389
  }
358
390
  gate();
359
391
  };
360
- exports.listDriver = void 0;
361
- function installListDriver(driver) {
362
- exports.listDriver = driver;
363
- }
364
392
  const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
365
393
  const $$EVENT_TUPLE = Symbol();
366
394
  const hasOwn = Object.prototype.hasOwnProperty;
@@ -415,6 +443,7 @@ function render(code, element, init, options = {}) {
415
443
  }
416
444
  function create(html, bypassGuard, flag) {
417
445
  if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
446
+ if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: " + "a <template> parse strips those tags. Render this component through hydrate(), " + "where the document shell already exists.");
418
447
  const t = document.createElement("template");
419
448
  t.innerHTML = html;
420
449
  return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
@@ -465,10 +494,27 @@ function unregisterDelegatedContainer(container, owner = container) {
465
494
  }
466
495
  function attachDelegatedEvent(name, container, state) {
467
496
  if (state.handlers.has(name)) return;
468
- const handler = e => eventHandler(e, container, state);
497
+ const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
469
498
  state.handlers.set(name, handler);
470
499
  container.addEventListener(name, handler);
471
500
  }
501
+ function describeEventTarget(target) {
502
+ if (!target || typeof target.tagName !== "string") return undefined;
503
+ const tag = target.tagName.toLowerCase();
504
+ let out = tag;
505
+ if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
506
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") {
507
+ const text = (target.textContent || "").trim().replace(/\s+/g, " ");
508
+ if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
509
+ }
510
+ return out;
511
+ }
512
+ function dispatchAsInteraction(e, fn) {
513
+ return solidJs.DEV.attribution.withInteraction({
514
+ type: e.type,
515
+ target: describeEventTarget(e.target)
516
+ }, fn);
517
+ }
472
518
  function getDelegatedRoot(node) {
473
519
  while (node) {
474
520
  if (delegatedContainers.get(node)?.roots) return node;
@@ -488,6 +534,7 @@ function findOwner(target, state) {
488
534
  }
489
535
  }
490
536
  function setProperty(node, name, value) {
537
+ tagElement(node);
491
538
  if (isHydrating(node)) return;
492
539
  const nodeName = node.nodeName;
493
540
  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;
@@ -523,6 +570,7 @@ function claimElement(node) {
523
570
  return node;
524
571
  }
525
572
  function setAttribute(node, name, value) {
573
+ tagElement(node);
526
574
  if (isHydrating(node)) return;
527
575
  const selectMultiple = name === "multiple" && node.localName === "select";
528
576
  if (value == null || value === false) node.removeAttribute(name);else {
@@ -538,10 +586,12 @@ function setAttribute(node, name, value) {
538
586
  if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
539
587
  }
540
588
  function setAttributeNS(node, namespace, name, value) {
589
+ tagElement(node);
541
590
  if (isHydrating(node)) return;
542
591
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
543
592
  }
544
593
  function className(node, value, prev) {
594
+ tagElement(node);
545
595
  if (typeof value === "number") value = "" + value;
546
596
  if (typeof prev === "number") prev = "" + prev;
547
597
  if (isHydrating(node)) {
@@ -595,15 +645,21 @@ function addEvent(node, name, handler, delegate) {
595
645
  }
596
646
  if (Array.isArray(handler)) {
597
647
  const handlerFn = handler[0];
598
- const listener = e => handlerFn.call(node, handler[1], e);
648
+ const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
599
649
  listener[$$EVENT_TUPLE] = handler;
600
650
  node.addEventListener(name, listener);
601
651
  return listener;
602
652
  }
653
+ if (typeof handler === "function") {
654
+ const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
655
+ node.addEventListener(name, listener);
656
+ return listener;
657
+ }
603
658
  node.addEventListener(name, handler, typeof handler !== "function" && handler);
604
659
  return handler;
605
660
  }
606
661
  function style(node, value, prev) {
662
+ tagElement(node);
607
663
  if (isHydrating(node)) return;
608
664
  if (!value) {
609
665
  if (prev || node._$styles) {
@@ -644,12 +700,13 @@ function style(node, value, prev) {
644
700
  }
645
701
  }
646
702
  function setStyleProperty(node, name, value) {
703
+ tagElement(node);
647
704
  if (isHydrating(node)) return;
648
705
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
649
706
  }
650
- function spread(node, props = {}, skipChildren) {
707
+ function spread(node, props, skipChildren) {
651
708
  const prevProps = {};
652
- const get = typeof props === "function" ? props : () => props;
709
+ const get = () => (typeof props === "function" ? props() : props) ?? {};
653
710
  if (!skipChildren) insert(node, () => {
654
711
  const source = get();
655
712
  return hasOwn.call(source, "children") ? source.children : undefined;
@@ -695,19 +752,6 @@ function scope(fn) {
695
752
  const SCOPE_OPTIONS = {
696
753
  scope: true
697
754
  };
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
- }
711
755
  let hydrationRt = null;
712
756
  function installHydrationRuntime() {
713
757
  hydrationRt = {
@@ -769,13 +813,8 @@ function insert(parent, accessor, marker, initial, options) {
769
813
  const host = options && options.host;
770
814
  if (multi && !initial) initial = [];
771
815
  if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
772
- if (exports.listDriver !== undefined && typeof accessor === "function" && accessor.$ll !== undefined) {
773
- const listAccessor = accessor;
774
- const owner = solidJs.getOwner();
775
- if (exports.listDriver(parent, accessor, marker, () => solidJs.runWithOwner(owner, () => insert(parent, () => listAccessor(), marker, marker !== undefined ? [] : undefined, options)))) return;
776
- }
777
816
  if (typeof accessor !== "function") {
778
- accessor = withInsertionParent(parent, () => normalize(accessor, initial, multi, true));
817
+ accessor = normalize(accessor, initial, multi, true);
779
818
  if (typeof accessor !== "function") {
780
819
  insertExpression(parent, accessor, initial, marker);
781
820
  host && tagHost(accessor, host);
@@ -790,9 +829,9 @@ function insert(parent, accessor, marker, initial, options) {
790
829
  let current = initial;
791
830
  effect(prev => {
792
831
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
793
- const value = withInsertionParent(parent, () => normalize(accessor(), current, multi, true));
832
+ const value = normalize(accessor(), current, multi, true);
794
833
  if (typeof value !== "function") return value;
795
- effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), withInsertionParent(parent, () => normalize(value, current, multi))), inner => {
834
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
796
835
  current = insertExpression(parent, inner, current, marker);
797
836
  host && tagHost(current, host);
798
837
  }, prev !== undefined && !(options && options.schedule) ? {
@@ -811,6 +850,7 @@ function insert(parent, accessor, marker, initial, options) {
811
850
  } : SCOPE_OPTIONS : options);
812
851
  }
813
852
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
853
+ tagElement(node);
814
854
  const nodeName = node.nodeName;
815
855
  props || (props = {});
816
856
  for (const prop in prevProps) {
@@ -833,10 +873,16 @@ function assetEntryKey(descriptor) {
833
873
  if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
834
874
  return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
835
875
  }
836
- function findAssetElement(selector, attr, value) {
876
+ function findAssetElement(selector, attr, value, qualifiers) {
837
877
  const nodes = document.querySelectorAll(selector);
838
- for (let i = 0; i < nodes.length; i++) {
839
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
878
+ outer: for (let i = 0; i < nodes.length; i++) {
879
+ if (nodes[i].getAttribute(attr) !== value) continue;
880
+ if (!qualifiers) return nodes[i];
881
+ for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
882
+ const name = RESOURCE_QUALIFIERS[q];
883
+ if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
884
+ }
885
+ return nodes[i];
840
886
  }
841
887
  return null;
842
888
  }
@@ -1142,8 +1188,8 @@ function mountHeadResource(tag, props) {
1142
1188
  headMountedResources.add(identity);
1143
1189
  const url = props.href || props.src;
1144
1190
  let el = null;
1145
- if (url != null) {
1146
- 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);
1191
+ if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
1192
+ 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);
1147
1193
  }
1148
1194
  if (!el) document.head.appendChild(createHeadElement(tag, props));
1149
1195
  }
@@ -1616,6 +1662,7 @@ function eventHandler(e, container, state) {
1616
1662
  retarget(oriTarget);
1617
1663
  }
1618
1664
  function insertExpression(parent, value, current, marker) {
1665
+ tagElement(parent);
1619
1666
  if (hydrationRt !== null && isHydrating(parent)) {
1620
1667
  if (value && value !== current) {
1621
1668
  const arr = Array.isArray(value);
@@ -1776,331 +1823,6 @@ function getHydrationKey() {
1776
1823
  }
1777
1824
  const RequestContext = Symbol();
1778
1825
 
1779
- const PURE_ROW = Symbol.for("solid.pure-row");
1780
- const arm = () => {
1781
- installListDriver(driveList);
1782
- };
1783
- function rowProof(fn) {
1784
- arm();
1785
- fn[PURE_ROW] = true;
1786
- return fn;
1787
- }
1788
- let rowCollector = null;
1789
- const lisPositions = sources => {
1790
- const n = sources.length;
1791
- const tails = [];
1792
- const tailsIdx = [];
1793
- const prev = new Array(n).fill(-1);
1794
- for (let j = 0; j < n; j++) {
1795
- const v = sources[j];
1796
- if (v === -1) continue;
1797
- let lo = 0,
1798
- hi = tails.length;
1799
- while (lo < hi) {
1800
- const mid = lo + hi >> 1;
1801
- if (tails[mid] < v) lo = mid + 1;else hi = mid;
1802
- }
1803
- if (lo > 0) prev[j] = tailsIdx[lo - 1];
1804
- tails[lo] = v;
1805
- tailsIdx[lo] = j;
1806
- }
1807
- const stable = new Set();
1808
- let k = tailsIdx.length ? tailsIdx[tails.length - 1] : -1;
1809
- while (k >= 0) {
1810
- stable.add(k);
1811
- k = prev[k];
1812
- }
1813
- return stable;
1814
- };
1815
- const driveList = (parent, listFn, marker, lateClassic) => {
1816
- const meta = listFn.$ll;
1817
- if (meta.row?.[PURE_ROW] !== true) return false;
1818
- if (typeof meta.keyed === "function") return false;
1819
- const evalOwner = solidJs.createOwner({
1820
- id: "&each"
1821
- });
1822
- let subject = solidJs.runWithOwner(evalOwner, () => solidJs.untrack(meta.each));
1823
- evalOwner.dispose();
1824
- let raw = subject != null ? solidJs.patchableRaw(subject) : undefined;
1825
- if (raw === undefined || !Array.isArray(raw)) return false;
1826
- const optimistic = solidJs.storeHasOptimisticFamily(subject);
1827
- if (optimistic) raw = solidJs.untrack(() => Array.from(subject));
1828
- const hydrating = !!solidJs.sharedConfig.hydrating;
1829
- if (hydrating && raw.length === 0) return false;
1830
- let domRows;
1831
- let rowIds;
1832
- if (hydrating) {
1833
- if (marker !== undefined) return false;
1834
- domRows = Array.from(parent.children);
1835
- if (domRows.length !== raw.length) return false;
1836
- rowIds = new Array(raw.length);
1837
- for (let i = 0; i < domRows.length; i++) {
1838
- const key = domRows[i].getAttribute("_hk");
1839
- if (key === null || !key.endsWith("0") || key.length < 2) return false;
1840
- rowIds[i] = key.slice(0, -1);
1841
- }
1842
- }
1843
- const rowFn = meta.row;
1844
- const endAnchor = marker ?? null;
1845
- const shallow = solidJs.storeIsShallow(subject);
1846
- let lastBodies = null;
1847
- let lastUnbinds = null;
1848
- const collectBind = (abs, build) => {
1849
- const prevC = rowCollector;
1850
- rowCollector = {
1851
- row: shallow ? subject[abs] : undefined,
1852
- bodies: [],
1853
- unbinds: []
1854
- };
1855
- try {
1856
- return build();
1857
- } finally {
1858
- lastBodies = rowCollector.bodies;
1859
- lastUnbinds = rowCollector.unbinds;
1860
- rowCollector = prevC;
1861
- }
1862
- };
1863
- const listOwner = solidJs.createOwner();
1864
- let declined = false;
1865
- const bindRow = (abs, claimId) => {
1866
- {
1867
- const o = listOwner;
1868
- const prevChild = o._firstChild;
1869
- const prevDisposal = o._disposal;
1870
- const node = collectBind(abs, () => solidJs.runWithOwner(listOwner, () => claimId !== undefined ? solidJs.runWithOwner(solidJs.createOwner({
1871
- id: claimId
1872
- }), () => solidJs.untrack(() => rowFn(subject[abs]))) : solidJs.untrack(() => rowFn(subject[abs]))));
1873
- if (o._firstChild !== prevChild || o._disposal !== prevDisposal) {
1874
- console.warn("A patch-mode list row created reactive computations or cleanups " + "during build (likely a handler/attribute value expression calling " + "createEffect/onCleanup). This work attaches to the LIST, not the " + "row, and will not dispose when the row is removed. Move owned " + "work into effects/refs (which opt the row out of patch mode).");
1875
- }
1876
- return node;
1877
- }
1878
- };
1879
- let entries = new Array(raw.length);
1880
- let rowBodies = shallow ? new Array(raw.length) : null;
1881
- let rowUnbinds = new Array(raw.length);
1882
- const runUnbinds = list => {
1883
- if (list !== undefined) for (let u = 0; u < list.length; u++) list[u]();
1884
- };
1885
- const unbindAllRows = () => {
1886
- for (let j = 0; j < rowUnbinds.length; j++) runUnbinds(rowUnbinds[j]);
1887
- rowUnbinds = [];
1888
- };
1889
- let prevRaws = raw.slice();
1890
- try {
1891
- if (hydrating) {
1892
- for (let i = 0; i < raw.length; i++) {
1893
- entries[i] = bindRow(i, rowIds[i]);
1894
- if (rowBodies !== null) rowBodies[i] = lastBodies;
1895
- rowUnbinds[i] = lastUnbinds;
1896
- }
1897
- } else {
1898
- for (let i = 0; i < raw.length; i++) {
1899
- const node = bindRow(i);
1900
- entries[i] = node;
1901
- if (rowBodies !== null) rowBodies[i] = lastBodies;
1902
- rowUnbinds[i] = lastUnbinds;
1903
- parent.insertBefore(node, endAnchor);
1904
- }
1905
- }
1906
- } catch (err) {
1907
- unbindAllRows();
1908
- runUnbinds(lastUnbinds ?? undefined);
1909
- for (let j = 0; j < entries.length; j++) {
1910
- const n = entries[j];
1911
- if (n !== undefined && n.parentNode === parent) n.remove();
1912
- }
1913
- listOwner.dispose();
1914
- throw err;
1915
- }
1916
- const identityOps = nextArr => {
1917
- const keyOf = r => {
1918
- const w = r != null ? solidJs.patchableRaw(r) : undefined;
1919
- return w !== undefined ? w : r;
1920
- };
1921
- const oldIndex = new Map();
1922
- for (let j = 0; j < prevRaws.length; j++) {
1923
- const k = keyOf(prevRaws[j]);
1924
- const existing = oldIndex.get(k);
1925
- if (existing === undefined) oldIndex.set(k, j);else if (Array.isArray(existing)) existing.push(j);else oldIndex.set(k, [existing, j]);
1926
- }
1927
- const sources = new Array(nextArr.length);
1928
- for (let k = 0; k < nextArr.length; k++) {
1929
- const m = oldIndex.get(keyOf(nextArr[k]));
1930
- if (m === undefined) sources[k] = -1;else if (Array.isArray(m)) {
1931
- sources[k] = m.shift();
1932
- if (m.length === 1) oldIndex.set(keyOf(nextArr[k]), m[0]);
1933
- } else {
1934
- sources[k] = m;
1935
- oldIndex.delete(keyOf(nextArr[k]));
1936
- }
1937
- }
1938
- return {
1939
- prefix: 0,
1940
- sources
1941
- };
1942
- };
1943
- let resyncNeeded = false;
1944
- const applyOps = (next, ops) => {
1945
- if (declined) return;
1946
- if (resyncNeeded) ops = null;
1947
- if (ops === null) ops = identityOps(next);
1948
- const {
1949
- prefix,
1950
- sources
1951
- } = ops;
1952
- const built = new Array(sources.length);
1953
- const builtBodies = rowBodies !== null ? new Array(sources.length) : null;
1954
- const builtUnbinds = new Array(sources.length);
1955
- let j = 0;
1956
- try {
1957
- for (; j < sources.length; j++) {
1958
- const abs = prefix + j;
1959
- const src = sources[j];
1960
- if (src === -1 || refRebuild && src >= 0 && next[abs] !== prevRaws[src]) {
1961
- built[j] = bindRow(abs);
1962
- if (builtBodies !== null) builtBodies[j] = lastBodies;
1963
- builtUnbinds[j] = lastUnbinds;
1964
- }
1965
- }
1966
- } catch (err) {
1967
- for (let k = 0; k < j; k++) runUnbinds(builtUnbinds[k]);
1968
- runUnbinds(lastUnbinds ?? undefined);
1969
- resyncNeeded = true;
1970
- throw err;
1971
- }
1972
- const retained = new Set();
1973
- for (let k = 0; k < sources.length; k++) {
1974
- if (sources[k] >= 0 && built[k] === undefined) retained.add(sources[k]);
1975
- }
1976
- for (let k = prefix; k < entries.length; k++) {
1977
- if (!retained.has(k)) {
1978
- entries[k].remove();
1979
- runUnbinds(rowUnbinds[k]);
1980
- }
1981
- }
1982
- const newEntries = new Array(prefix + sources.length);
1983
- const newBodies = rowBodies !== null ? new Array(prefix + sources.length) : null;
1984
- const newUnbinds = new Array(prefix + sources.length);
1985
- for (let i = 0; i < prefix; i++) {
1986
- newEntries[i] = entries[i];
1987
- if (newBodies !== null) newBodies[i] = rowBodies[i];
1988
- newUnbinds[i] = rowUnbinds[i];
1989
- }
1990
- const stable = lisPositions(sources);
1991
- let anchor = endAnchor;
1992
- for (let k = sources.length - 1; k >= 0; k--) {
1993
- const abs = prefix + k;
1994
- const src = sources[k];
1995
- let node;
1996
- if (built[k] !== undefined) {
1997
- node = built[k];
1998
- if (newBodies !== null) newBodies[abs] = builtBodies[k];
1999
- newUnbinds[abs] = builtUnbinds[k];
2000
- parent.insertBefore(node, anchor);
2001
- } else {
2002
- node = entries[src];
2003
- if (newBodies !== null) newBodies[abs] = rowBodies[src];
2004
- newUnbinds[abs] = rowUnbinds[src];
2005
- if (!stable.has(k)) parent.insertBefore(node, anchor);
2006
- }
2007
- newEntries[abs] = node;
2008
- anchor = node;
2009
- }
2010
- entries = newEntries;
2011
- if (newBodies !== null) rowBodies = newBodies;
2012
- rowUnbinds = newUnbinds;
2013
- prevRaws = next.slice();
2014
- resyncNeeded = false;
2015
- };
2016
- let unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
2017
- const refRebuild = shallow && typeof meta.keyed !== "function";
2018
- const rebuildSlot = i => {
2019
- runUnbinds(rowUnbinds[i]);
2020
- const old = entries[i];
2021
- const node = bindRow(i);
2022
- rowBodies[i] = lastBodies;
2023
- rowUnbinds[i] = lastUnbinds;
2024
- parent.insertBefore(node, old);
2025
- old.remove();
2026
- entries[i] = node;
2027
- };
2028
- const applySlot = (i, next, prev) => {
2029
- if (declined) return;
2030
- if (resyncNeeded) {
2031
- const live = subject != null ? solidJs.patchableRaw(subject) : undefined;
2032
- if (live !== undefined && Array.isArray(live)) applyOps(live, null);
2033
- return;
2034
- }
2035
- if (refRebuild) {
2036
- rebuildSlot(i);
2037
- prevRaws[i] = next;
2038
- return;
2039
- }
2040
- const bodies = rowBodies[i];
2041
- if (bodies !== undefined) {
2042
- for (let b = 0; b < bodies.length; b++) bodies[b](next, prev, false);
2043
- }
2044
- prevRaws[i] = next;
2045
- };
2046
- let unbindSlots = shallow ? solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot)) : null;
2047
- solidJs.runWithOwner(listOwner, () => effect(() => meta.each(), value => {
2048
- if (declined || value === subject) return;
2049
- const nextRaw = value != null ? solidJs.patchableRaw(value) : undefined;
2050
- unbindOps();
2051
- unbindSlots?.();
2052
- if (nextRaw !== undefined && Array.isArray(nextRaw) && solidJs.storeIsShallow(value) !== shallow) {
2053
- for (let j = 0; j < entries.length; j++) entries[j].remove();
2054
- entries = [];
2055
- prevRaws = [];
2056
- unbindAllRows();
2057
- subject = value;
2058
- declined = true;
2059
- listOwner.dispose();
2060
- lateClassic?.();
2061
- return;
2062
- }
2063
- if (nextRaw === undefined || !Array.isArray(nextRaw)) {
2064
- for (let j = 0; j < entries.length; j++) entries[j].remove();
2065
- entries = [];
2066
- prevRaws = [];
2067
- unbindAllRows();
2068
- subject = value;
2069
- declined = true;
2070
- listOwner.dispose();
2071
- lateClassic?.();
2072
- return;
2073
- }
2074
- const swapOps = identityOps(nextRaw);
2075
- subject = value;
2076
- unbindOps = solidJs.runWithOwner(listOwner, () => solidJs.registerRowOps(subject, applyOps));
2077
- if (shallow) unbindSlots = solidJs.runWithOwner(listOwner, () => solidJs.registerSlotPatch(subject, applySlot));
2078
- applyOps(nextRaw, swapOps);
2079
- }));
2080
- solidJs.onCleanup(() => {
2081
- unbindOps();
2082
- unbindSlots?.();
2083
- unbindAllRows();
2084
- listOwner.dispose();
2085
- });
2086
- return true;
2087
- };
2088
- const patchDriver = (subject, body) => {
2089
- const raw = solidJs.patchableRaw(subject);
2090
- if (raw !== undefined) {
2091
- if (!solidJs.sharedConfig.hydrating) body(raw, undefined, true);
2092
- const unbind = solidJs.registerPatch(subject, body);
2093
- if (rowCollector !== null) rowCollector.unbinds.push(unbind);
2094
- else solidJs.onCleanup(unbind);
2095
- } else if (rowCollector !== null && subject === rowCollector.row) {
2096
- rowCollector.bodies.push(body);
2097
- if (!solidJs.sharedConfig.hydrating) body(subject, undefined, true);
2098
- } else {
2099
- effect(() => body(subject, subject, false),
2100
- () => solidJs.untrack(() => body(subject, undefined, true)));
2101
- }
2102
- };
2103
-
2104
1826
  function throwInBrowser(func) {
2105
1827
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
2106
1828
  console.error(err);
@@ -2318,7 +2040,7 @@ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2318
2040
  function bindingOf(value) {
2319
2041
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
2320
2042
  }
2321
- function dynamic(source) {
2043
+ function dynamic(source, _options) {
2322
2044
  let latest = 0;
2323
2045
  const sites = new Set();
2324
2046
  let deliveredAddress;
@@ -2362,24 +2084,9 @@ function dynamic(source) {
2362
2084
  return solidJs.untrack(() => component(props));
2363
2085
  }
2364
2086
  case "string":
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
- }
2087
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
2088
+ spread(el, props);
2089
+ return el;
2383
2090
  }
2384
2091
  });
2385
2092
  };
@@ -2388,15 +2095,8 @@ function Dynamic(props) {
2388
2095
  const Comp = dynamic(() => props.component);
2389
2096
  return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
2390
2097
  }
2391
- const AmbiguousSVGElements = /*#__PURE__*/new Set(["a", "script", "style", "title"]);
2392
2098
  function createElement(tagName, is = undefined) {
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, {
2099
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
2400
2100
  is
2401
2101
  });
2402
2102
  }
@@ -2518,7 +2218,6 @@ exports.createRequestEvent = createRequestEvent;
2518
2218
  exports.createResponseStub = createResponseStub;
2519
2219
  exports.createSSRResponse = createSSRResponse;
2520
2220
  exports.delegateEvents = delegateEvents;
2521
- exports.driveList = driveList;
2522
2221
  exports.dynamic = dynamic;
2523
2222
  exports.dynamicProperty = dynamicProperty;
2524
2223
  exports.effect = effect;
@@ -2528,7 +2227,6 @@ exports.getDelegatedRoot = getDelegatedRoot;
2528
2227
  exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
2529
2228
  exports.getFirstChild = getFirstChild;
2530
2229
  exports.getHydrationKey = getHydrationKey;
2531
- exports.getInsertionParent = getInsertionParent;
2532
2230
  exports.getNextElement = getNextElement;
2533
2231
  exports.getNextMarker = getNextMarker;
2534
2232
  exports.getNextMatch = getNextMatch;
@@ -2542,7 +2240,6 @@ exports.httpStatus = httpStatus;
2542
2240
  exports.hydrate = hydrate;
2543
2241
  exports.insert = insert;
2544
2242
  exports.installHydrationRuntime = installHydrationRuntime;
2545
- exports.installListDriver = installListDriver;
2546
2243
  exports.isDev = isDev;
2547
2244
  exports.isHref = isHref;
2548
2245
  exports.isResponseEnvelope = isResponseEnvelope;
@@ -2552,7 +2249,6 @@ exports.isServerFunction = isServerFunction;
2552
2249
  exports.markSafeError = markSafeError;
2553
2250
  exports.memo = memo;
2554
2251
  exports.parseCookieHeader = parseCookieHeader;
2555
- exports.patchDriver = patchDriver;
2556
2252
  exports.redirect = redirect;
2557
2253
  exports.ref = ref;
2558
2254
  exports.registerDelegatedContainer = registerDelegatedContainer;
@@ -2564,7 +2260,6 @@ exports.renderToStream = renderToStream;
2564
2260
  exports.renderToString = renderToString;
2565
2261
  exports.resolveSSRNode = resolveSSRNode;
2566
2262
  exports.respond = respond;
2567
- exports.rowProof = rowProof;
2568
2263
  exports.runHydrationEvents = runHydrationEvents;
2569
2264
  exports.scope = scope;
2570
2265
  exports.serializeCookie = serializeCookie;