@solidjs/web 2.0.0-rc.1 → 2.0.0-rc.3

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 (84) hide show
  1. package/dist/dev.cjs +116 -66
  2. package/dist/dev.js +109 -65
  3. package/dist/server.cjs +386 -109
  4. package/dist/server.js +378 -113
  5. package/dist/web.cjs +113 -64
  6. package/dist/web.js +106 -63
  7. package/frames/dist/client.cjs +100 -14
  8. package/frames/dist/client.dev.cjs +103 -14
  9. package/frames/dist/client.dev.js +104 -15
  10. package/frames/dist/client.js +101 -15
  11. package/frames/dist/server.cjs +285 -154
  12. package/frames/dist/server.js +287 -156
  13. package/package.json +20 -22
  14. package/serialization/dist/decode.cjs +22 -5
  15. package/serialization/dist/decode.js +23 -6
  16. package/serialization/dist/serialization.cjs +26 -13
  17. package/serialization/dist/serialization.js +26 -8
  18. package/serialization/types/index.d.ts +69 -157
  19. package/serialization/types/serializer-decode.d.ts +89 -112
  20. package/serialization/types/serializer.d.ts +94 -0
  21. package/serialization/types-cjs/index.d.cts +69 -157
  22. package/serialization/types-cjs/serializer-decode.d.cts +89 -112
  23. package/serialization/types-cjs/serializer.d.cts +94 -0
  24. package/server-functions/dist/client.cjs +48 -7
  25. package/server-functions/dist/client.js +48 -8
  26. package/server-functions/dist/server.cjs +76 -5
  27. package/server-functions/dist/server.dev.cjs +76 -5
  28. package/server-functions/dist/server.dev.js +76 -6
  29. package/server-functions/dist/server.js +76 -6
  30. package/types/client.d.ts +150 -290
  31. package/types/constants.d.ts +18 -0
  32. package/types/cookies.d.ts +31 -75
  33. package/types/frames/frame-client.d.ts +287 -259
  34. package/types/frames/frame-container-plugin.d.ts +71 -0
  35. package/types/frames/frame-sink.d.ts +58 -160
  36. package/types/frames/frame-transport.d.ts +161 -194
  37. package/types/frames/serializer-decode.d.ts +159 -0
  38. package/types/frames/serializer.d.ts +69 -157
  39. package/types/head.d.ts +16 -0
  40. package/types/index.d.ts +0 -65
  41. package/types/index.server.d.ts +125 -0
  42. package/types/jsx.d.ts +5 -13
  43. package/types/reconcile.d.ts +1 -0
  44. package/types/render.d.ts +4 -0
  45. package/types/response.d.ts +41 -153
  46. package/types/serializer-decode.d.ts +89 -112
  47. package/types/serializer.d.ts +69 -157
  48. package/types/server-functions/client.d.ts +101 -199
  49. package/types/server-functions/flash.d.ts +10 -30
  50. package/types/server-functions/registry.d.ts +63 -0
  51. package/types/server-functions/rich-args.d.ts +1 -10
  52. package/types/server-functions/server.d.ts +301 -518
  53. package/types/server-functions/shared.d.ts +112 -458
  54. package/types/server-mock.d.ts +13 -4
  55. package/types/server.d.ts +256 -427
  56. package/types-cjs/client.d.cts +150 -290
  57. package/types-cjs/constants.d.cts +18 -0
  58. package/types-cjs/cookies.d.cts +31 -75
  59. package/types-cjs/frames/frame-client.d.cts +287 -259
  60. package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
  61. package/types-cjs/frames/frame-sink.d.cts +58 -160
  62. package/types-cjs/frames/frame-transport.d.cts +161 -194
  63. package/types-cjs/frames/serializer-decode.d.cts +159 -0
  64. package/types-cjs/frames/serializer.d.cts +69 -157
  65. package/types-cjs/head.d.cts +16 -0
  66. package/types-cjs/index.d.cts +0 -65
  67. package/types-cjs/index.server.d.cts +125 -0
  68. package/types-cjs/jsx.d.cts +5 -13
  69. package/types-cjs/reconcile.d.cts +1 -0
  70. package/types-cjs/render.d.cts +4 -0
  71. package/types-cjs/response.d.cts +41 -153
  72. package/types-cjs/serializer-decode.d.cts +89 -112
  73. package/types-cjs/serializer.d.cts +69 -157
  74. package/types-cjs/server-functions/client.d.cts +101 -199
  75. package/types-cjs/server-functions/flash.d.cts +10 -30
  76. package/types-cjs/server-functions/registry.d.cts +63 -0
  77. package/types-cjs/server-functions/rich-args.d.cts +1 -10
  78. package/types-cjs/server-functions/server.d.cts +301 -518
  79. package/types-cjs/server-functions/shared.d.cts +112 -458
  80. package/types-cjs/server-mock.d.cts +13 -4
  81. package/types-cjs/server.d.cts +256 -427
  82. package/LICENSE +0 -21
  83. package/types/core.d.ts +0 -6
  84. package/types-cjs/core.d.cts +0 -6
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onCleanup, enableHydration, flush, getOwner, createEffect } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } 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
+ 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 = {
5
5
  INPUT: {
@@ -56,23 +56,16 @@ const transparentOptions = {
56
56
  const syncOptions = {
57
57
  sync: true
58
58
  };
59
- const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
60
- sync: true,
61
- ...options,
62
- transparent: !options.scope
63
- } : transparentOptions);
64
- const memo = fn => createMemo(() => fn(), syncOptions);
65
- const assetGates = new WeakMap();
66
- const waitAsset = promise => {
67
- let gate = assetGates.get(promise);
68
- if (!gate) {
69
- runWithOwner(null, () => {
70
- gate = createMemo(() => promise);
71
- });
72
- assetGates.set(promise, gate);
73
- }
74
- gate();
75
- };
59
+ function effect(fn, effectFn, options) {
60
+ createRenderEffect(fn, effectFn, options ? {
61
+ sync: true,
62
+ ...options,
63
+ transparent: !options.scope
64
+ } : transparentOptions);
65
+ }
66
+ function memo(fn) {
67
+ return createMemo(() => fn(), syncOptions);
68
+ }
76
69
 
77
70
  function reconcileArrays(parentNode, a, b, marker) {
78
71
  let bLength = b.length,
@@ -86,13 +79,18 @@ function reconcileArrays(parentNode, a, b, marker) {
86
79
  map = null,
87
80
  anchor,
88
81
  anchorTag;
82
+ const isLive = n => {
83
+ if (!n) return false;
84
+ const tag = n[$$SLOT];
85
+ return n.parentNode === parentNode && (!tag || tag === marker);
86
+ };
89
87
  while (aStart < aEnd || bStart < bEnd) {
90
- if (a[aStart] === b[bStart]) {
88
+ if (a[aStart] === b[bStart] && isLive(a[aStart])) {
91
89
  aStart++;
92
90
  bStart++;
93
91
  continue;
94
92
  }
95
- while (a[aEnd - 1] === b[bEnd - 1]) {
93
+ while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
96
94
  aEnd--;
97
95
  bEnd--;
98
96
  }
@@ -323,11 +321,30 @@ function getServerFunctionRPC() {
323
321
  return globalThis[SERVER_FUNCTION_RPC];
324
322
  }
325
323
 
326
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
324
+ const assetGates = new WeakMap();
325
+ const waitAsset = promise => {
326
+ let gate = assetGates.get(promise);
327
+ if (!gate) {
328
+ runWithOwner(null, () => {
329
+ gate = createMemo(() => promise);
330
+ });
331
+ assetGates.set(promise, gate);
332
+ }
333
+ gate();
334
+ };
335
+ const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
327
336
  const INNER_OWNED = {};
328
337
  const delegatedEvents = new Set();
329
338
  const delegatedContainers = new Map();
330
- function render$1(code, element, init, options = {}) {
339
+ function voidFn() {}
340
+ function generateHydrationScript(_options) {
341
+ return "";
342
+ }
343
+ function HydrationScript(_props) {
344
+ return null;
345
+ }
346
+ const getRequestEvent = voidFn;
347
+ function render(code, element, init, options = {}) {
331
348
  let disposer;
332
349
  registerDelegatedRoot(element);
333
350
  try {
@@ -338,15 +355,20 @@ function render$1(code, element, init, options = {}) {
338
355
  effect(() => flatten(tree), () => {});
339
356
  } else {
340
357
  const tree = code();
341
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
358
+ insert(element, () => tree, element.firstChild ? null : undefined, init, {
359
+ ...options.insertOptions,
360
+ schedule: true
361
+ });
342
362
  }
343
363
  }, {
344
364
  id: options.renderId
345
365
  });
366
+ flush();
346
367
  } catch (err) {
347
368
  if (disposer) disposer();
348
369
  unregisterDelegatedRoot(element);
349
370
  throw err;
371
+ } finally {
350
372
  }
351
373
  return () => {
352
374
  disposer();
@@ -431,7 +453,7 @@ function setProperty(node, name, value) {
431
453
  node[name] = value;
432
454
  }
433
455
  let claimHandlers = null;
434
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
456
+ const CLAIM_SEAM = Symbol.for("solid.element-claims");
435
457
  function registerElementClaim(handler) {
436
458
  (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
437
459
  return () => {
@@ -585,6 +607,11 @@ function ref(fn, element) {
585
607
  const resolved = untrack(fn);
586
608
  runWithOwner(null, () => applyRef(resolved, element));
587
609
  }
610
+ const PURE_ROW = Symbol.for("solid.pure-row");
611
+ function rowProof(fn) {
612
+ fn[PURE_ROW] = true;
613
+ return fn;
614
+ }
588
615
  function scope(fn) {
589
616
  fn.$s = true;
590
617
  return fn;
@@ -648,6 +675,11 @@ function stripTextSeparators(nodes) {
648
675
  nodes.length = j;
649
676
  return nodes;
650
677
  }
678
+ function patchDriver(subject, body) {
679
+ {
680
+ effect(() => body(subject, subject, false), () => body(subject, undefined, true));
681
+ }
682
+ }
651
683
  function insert(parent, accessor, marker, initial, options) {
652
684
  const multi = marker !== undefined;
653
685
  const host = options && options.host;
@@ -888,7 +920,7 @@ function initHeadRegistry() {
888
920
  headOwned = new Map();
889
921
  headApplied = new Map();
890
922
  const t = document.querySelector("title");
891
- headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
923
+ headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
892
924
  if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
893
925
  }
894
926
  function applyServerHeadOps(ops) {
@@ -943,7 +975,11 @@ function flushHeadRegistry() {
943
975
  headOwned.delete(identity);
944
976
  headApplied.delete(identity);
945
977
  if (identity === "title") {
946
- if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
978
+ if (headFallbackTitle != null) {
979
+ const el = setHeadTitle(headFallbackTitle);
980
+ el.removeAttribute("data-dh");
981
+ el.removeAttribute("data-dhf");
982
+ }
947
983
  } else {
948
984
  for (let i = 0; i < els.length; i++) els[i].remove();
949
985
  }
@@ -1107,7 +1143,7 @@ function loadModuleAssets(mapping) {
1107
1143
  const pending = [];
1108
1144
  for (const key in mapping) {
1109
1145
  if (hy.modules[key]) continue;
1110
- const entryUrl = mapping[key];
1146
+ const entryUrl = new URL(mapping[key], document.baseURI).href;
1111
1147
  if (!hy.loading[key]) {
1112
1148
  hy.loading[key] = import(entryUrl).then(mod => {
1113
1149
  hy.modules[key] = mod;
@@ -1120,9 +1156,10 @@ function loadModuleAssets(mapping) {
1120
1156
  }
1121
1157
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1122
1158
  }
1123
- function hydrate$1(code, element, options = {}) {
1159
+ function hydrate(code, element, options = {}) {
1160
+ enableHydration();
1124
1161
  installHydrationRuntime();
1125
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1162
+ if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
1126
1163
  options.renderId ||= "";
1127
1164
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1128
1165
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -1171,7 +1208,7 @@ function hydrate$1(code, element, options = {}) {
1171
1208
  sharedConfig.gather = gather;
1172
1209
  sharedConfig.hydrating = true;
1173
1210
  try {
1174
- disposer = render$1(code, element, [...element.childNodes], options);
1211
+ disposer = render(code, element, [...element.childNodes], options);
1175
1212
  } finally {
1176
1213
  sharedConfig.hydrating = false;
1177
1214
  }
@@ -1179,14 +1216,14 @@ function hydrate$1(code, element, options = {}) {
1179
1216
  console.error("Hydration module preload failed, falling back to client render:", err);
1180
1217
  sharedConfig.hydrating = false;
1181
1218
  sharedConfig.registry = undefined;
1182
- disposer = render$1(code, element, [...element.childNodes], options);
1219
+ disposer = render(code, element, [...element.childNodes], options);
1183
1220
  });
1184
1221
  return () => disposer && disposer();
1185
1222
  }
1186
1223
  }
1187
1224
  try {
1188
1225
  gatherHydratable(element, options.renderId);
1189
- return render$1(code, element, [...element.childNodes], options);
1226
+ return render(code, element, [...element.childNodes], options);
1190
1227
  } finally {
1191
1228
  sharedConfig.hydrating = false;
1192
1229
  }
@@ -1371,7 +1408,11 @@ function eventHandler(e, container, state) {
1371
1408
  value
1372
1409
  });
1373
1410
  const handleNode = () => {
1374
- const handler = node[key];
1411
+ let handler = node[key];
1412
+ if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
1413
+ const seam = globalThis[Symbol.for("solid.bnd")];
1414
+ if (seam) handler = seam.resolve(node, e.type);
1415
+ }
1375
1416
  if (handler && !node.disabled) {
1376
1417
  const data = node[`${key}Data`];
1377
1418
  data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
@@ -1418,7 +1459,16 @@ function eventHandler(e, container, state) {
1418
1459
  }
1419
1460
  function insertExpression(parent, value, current, marker) {
1420
1461
  if (hydrationRt !== null && isHydrating(parent)) {
1421
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1462
+ if (value && value !== current) {
1463
+ const arr = Array.isArray(value);
1464
+ for (const n of arr ? value : [value]) {
1465
+ if (n && n.nodeType) {
1466
+ if (!isHydrating(n)) return current;
1467
+ } else if (arr && (typeof n === "string" || typeof n === "number")) {
1468
+ return current;
1469
+ }
1470
+ }
1471
+ }
1422
1472
  return value;
1423
1473
  }
1424
1474
  if (value === current) return value;
@@ -1449,6 +1499,17 @@ function insertExpression(parent, value, current, marker) {
1449
1499
  if (marker) value[$$SLOT] = marker;
1450
1500
  } else if (Array.isArray(value)) {
1451
1501
  const currentArray = current && Array.isArray(current);
1502
+ for (let i = 0, len = value.length; i < len; i++) {
1503
+ const item = value[i],
1504
+ t = typeof item;
1505
+ if (t === "string" || t === "number") {
1506
+ const prev = currentArray ? current[i] : undefined;
1507
+ if (prev && prev.nodeType === 3) {
1508
+ if (prev.data !== "" + item) prev.data = item;
1509
+ value[i] = prev;
1510
+ } else value[i] = document.createTextNode(item);
1511
+ }
1512
+ }
1452
1513
  if (value.length === 0) {
1453
1514
  cleanChildren(parent, current, marker);
1454
1515
  } else if (currentArray) {
@@ -1469,12 +1530,12 @@ function normalize(value, current, multi, doNotUnwrap) {
1469
1530
  });
1470
1531
  if (doNotUnwrap && typeof value === "function") return value;
1471
1532
  if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1472
- if (Array.isArray(value)) {
1533
+ if (sharedConfig.hydrating && Array.isArray(value)) {
1473
1534
  for (let i = 0, len = value.length; i < len; i++) {
1474
1535
  const item = value[i],
1475
1536
  prev = current && current[i],
1476
1537
  t = typeof item;
1477
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1538
+ if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
1478
1539
  }
1479
1540
  }
1480
1541
  return value;
@@ -1555,7 +1616,6 @@ function gatherHydratable(element, root) {
1555
1616
  function getHydrationKey() {
1556
1617
  return sharedConfig.getNextContextId();
1557
1618
  }
1558
- const voidFn = () => undefined;
1559
1619
  const RequestContext = Symbol();
1560
1620
 
1561
1621
  function throwInBrowser(func) {
@@ -1631,11 +1691,14 @@ function isSafeError(value) {
1631
1691
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1632
1692
  }
1633
1693
  const REVALIDATE_HEADER = "X-Revalidate";
1634
- function initWithRevalidate(init) {
1694
+ function initWithRevalidate(init = {}) {
1695
+ const resolved = typeof init === "number" ? {
1696
+ status: init
1697
+ } : init;
1635
1698
  const {
1636
1699
  revalidate,
1637
1700
  ...responseInit
1638
- } = init;
1701
+ } = resolved;
1639
1702
  let headers;
1640
1703
  if (responseInit.headers && responseInit.headers.getSetCookie) {
1641
1704
  headers = new Headers();
@@ -1661,9 +1724,7 @@ function redirect(url, init = 302) {
1661
1724
  const {
1662
1725
  responseInit,
1663
1726
  headers
1664
- } = initWithRevalidate(typeof init === "number" ? {
1665
- status: init
1666
- } : init);
1727
+ } = initWithRevalidate(init);
1667
1728
  if (responseInit.status === undefined) {
1668
1729
  responseInit.status = 302;
1669
1730
  }
@@ -1695,26 +1756,8 @@ function respond(value, init = {}) {
1695
1756
  }), value);
1696
1757
  }
1697
1758
 
1698
- const mergeProps = merge;
1699
1759
  const isServer = false;
1700
1760
  const isDev = false;
1701
- function render(code, element, init, options = {}) {
1702
- try {
1703
- const dispose = render$1(code, element, init, {
1704
- ...options,
1705
- insertOptions: {
1706
- schedule: true
1707
- }
1708
- });
1709
- flush();
1710
- return dispose;
1711
- } finally {
1712
- }
1713
- }
1714
- const hydrate = (...args) => {
1715
- enableHydration();
1716
- return hydrate$1(...args);
1717
- };
1718
1761
  function Portal(props) {
1719
1762
  return runWithOwner(createOwner(), () => portalImpl(props));
1720
1763
  }
@@ -1767,7 +1810,7 @@ function portalImpl(props) {
1767
1810
  });
1768
1811
  return treeMarker;
1769
1812
  }
1770
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1813
+ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
1771
1814
  function bindingOf(value) {
1772
1815
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1773
1816
  }
@@ -1856,4 +1899,4 @@ _moduleUrl) {
1856
1899
  function httpStatus(_code, _text) {}
1857
1900
  function httpHeader(_name, _value, _options) {}
1858
1901
 
1859
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, 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, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, 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, warmAsset };
1902
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, 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, 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 };
@@ -7,7 +7,7 @@ var client = require('@solidjs/web/server-functions/client');
7
7
  const ELEMENT_NODE = 1;
8
8
  const TEXT_NODE = 3;
9
9
  const COMMENT_NODE = 8;
10
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
10
+ const CLAIM_SEAM = Symbol.for("solid.element-claims");
11
11
  const CLAIMED_ELEMENTS = "a[href], form[action]";
12
12
  function claimHandlers() {
13
13
  const handlers = globalThis[CLAIM_SEAM];
@@ -17,6 +17,71 @@ function claimNode(handlers, el) {
17
17
  for (let i = 0; i < handlers.length; i++) handlers[i](el);
18
18
  }
19
19
  const claimedAttr = name => name === "href" || name === "action";
20
+ const BOUND_SEAM = Symbol.for("solid.bnd");
21
+ const boundSeam = globalThis[BOUND_SEAM] || (globalThis[BOUND_SEAM] = {});
22
+ const BND_ATTR = "_bnd";
23
+ const BND_SELECTOR = "[_bnd]";
24
+ function bndMap(el) {
25
+ const s = el.getAttribute(BND_ATTR);
26
+ if (!s) return undefined;
27
+ const map = {};
28
+ for (const entry of s.split(",")) {
29
+ const eq = entry.indexOf("=");
30
+ if (eq < 1) continue;
31
+ const pos = entry.slice(0, eq);
32
+ const prop = decodeURIComponent(entry.slice(eq + 1));
33
+ const prev = map[pos];
34
+ if (prev === undefined) map[pos] = prop;else if (Array.isArray(prev)) prev.push(prop);else map[pos] = [prev, prop];
35
+ }
36
+ return map;
37
+ }
38
+ boundSeam.resolve = (el, type) => {
39
+ const frame = el._$bndFrame;
40
+ if (!frame) return undefined;
41
+ const map = bndMap(el);
42
+ const prop = map && map[type];
43
+ if (typeof prop !== "string") return undefined;
44
+ return claimFn(frame, type, prop);
45
+ };
46
+ function claimFn(frame, pos, prop) {
47
+ const fn = frame.clientProp(prop);
48
+ if (typeof fn === "function") return fn;
49
+ return undefined;
50
+ }
51
+ function sweepBound(root, frame, delegate, scope) {
52
+ const isElement = root.nodeType === ELEMENT_NODE;
53
+ if (!isElement && root.nodeType !== 11 ) return;
54
+ let els;
55
+ if (isElement && root.hasAttribute(BND_ATTR)) (els = []).push(root);
56
+ const found = root.querySelectorAll(BND_SELECTOR);
57
+ if (found.length) {
58
+ els || (els = []);
59
+ for (let i = 0; i < found.length; i++) els.push(found[i]);
60
+ }
61
+ if (!els) return;
62
+ const run = () => {
63
+ let types;
64
+ for (const el of els) {
65
+ el._$bndFrame = frame;
66
+ const map = bndMap(el);
67
+ if (!map) continue;
68
+ for (const pos in map) {
69
+ if (pos === "ref") fireRefs(frame, el, map.ref);else (types || (types = [])).push(pos);
70
+ }
71
+ }
72
+ if (types && delegate) delegate(types);
73
+ };
74
+ scope ? scope(run) : run();
75
+ }
76
+ function fireRefs(frame, el, prop) {
77
+ const fired = el._$bndFired || (el._$bndFired = new Set());
78
+ for (const p of Array.isArray(prop) ? prop : [prop]) {
79
+ if (fired.has(p)) continue;
80
+ fired.add(p);
81
+ const fn = claimFn(frame, "ref", p);
82
+ if (fn) fn(el);
83
+ }
84
+ }
20
85
  function claimTree(handlers, root) {
21
86
  const isElement = root.nodeType === ELEMENT_NODE;
22
87
  if (!isElement && root.nodeType !== 11 ) return;
@@ -116,6 +181,7 @@ function createFrameHost(options = {}) {
116
181
  return true;
117
182
  };
118
183
  return {
184
+ delegate: options.delegate,
119
185
  register(id, frame) {
120
186
  let set = frames.get(id);
121
187
  if (!set) frames.set(id, set = new Set());
@@ -210,10 +276,18 @@ class FrameImpl {
210
276
  if (!this.#disposed) this.#flush();
211
277
  };
212
278
  #claimTree = (node, direct) => {
279
+ if (!direct && node.nodeType !== TEXT_NODE && node.nodeType !== COMMENT_NODE) {
280
+ const o = this.#options;
281
+ sweepBound(node, this, o.delegate || o.host && o.host.delegate, o.ownerScope);
282
+ }
213
283
  const handlers = claimHandlers();
214
284
  if (!handlers) return;
215
285
  this.#scoped(() => direct ? claimNode(handlers, node) : claimTree(handlers, node));
216
286
  };
287
+ clientProp(name) {
288
+ const props = this.#options.props;
289
+ return props ? props[name] : undefined;
290
+ }
217
291
  #scoped(fn) {
218
292
  const scope = this.#options.ownerScope;
219
293
  return scope ? scope(fn) : fn();
@@ -662,7 +736,7 @@ class FrameImpl {
662
736
  parent.insertBefore(fragment, this.#end);
663
737
  this.#hasContent = true;
664
738
  } else {
665
- const claim = claimHandlers() ? this.#claimTree : null;
739
+ const claim = this.#claimTree;
666
740
  const ranges = new Map();
667
741
  this.#collectSlots(ranges);
668
742
  const grafts = [];
@@ -678,8 +752,7 @@ class FrameImpl {
678
752
  if (!close) {
679
753
  return false;
680
754
  }
681
- const claim = claimHandlers() ? this.#claimTree : null;
682
- reconcileChildren(open.parentNode, parseFragment(html), open, close, claim);
755
+ reconcileChildren(open.parentNode, parseFragment(html), open, close, this.#claimTree);
683
756
  return true;
684
757
  }
685
758
  #applyAttrs(addr, text, removed) {
@@ -703,7 +776,6 @@ class FrameImpl {
703
776
  removeUntil(this.#parent(), this.#firstContent(), this.#end);
704
777
  }
705
778
  #claimContent() {
706
- if (!claimHandlers()) return;
707
779
  let n = this.#firstContent();
708
780
  while (n && n !== this.#end) {
709
781
  this.#claimTree(n);
@@ -773,7 +845,7 @@ class FrameImpl {
773
845
  function createFrame(boundary, options) {
774
846
  return new FrameImpl(boundary, null, null, options);
775
847
  }
776
- const FRAME_TAG = "dx-frame";
848
+ const FRAME_TAG = "solid-frame";
777
849
  const FRAME_ID_ATTR = "data-fid";
778
850
  function createFrameElement(options) {
779
851
  const el = makeFrameElement(options.id);
@@ -1228,9 +1300,9 @@ async function applyFrameResponse(response, host, options = {}) {
1228
1300
  }
1229
1301
  return as !== undefined ? as : rootId;
1230
1302
  }
1231
- const SERVER_COMPONENT = /*#__PURE__*/Symbol.for("dom-expressions.server-component");
1232
- const SERVER_COMPONENT_ADDRESS = /*#__PURE__*/Symbol.for("dom-expressions.server-component-address");
1233
- const COMPONENT_BINDING = /*#__PURE__*/Symbol.for("dom-expressions.component-binding");
1303
+ const SERVER_COMPONENT = /*#__PURE__*/Symbol.for("solid.server-component");
1304
+ const SERVER_COMPONENT_ADDRESS = /*#__PURE__*/Symbol.for("solid.server-component-address");
1305
+ const COMPONENT_BINDING = /*#__PURE__*/Symbol.for("solid.component-binding");
1234
1306
  let resolveServerComponent;
1235
1307
  function parseServerComponent(value, ctx) {
1236
1308
  return {
@@ -1239,7 +1311,7 @@ function parseServerComponent(value, ctx) {
1239
1311
  };
1240
1312
  }
1241
1313
  const ServerComponentPlugin = {
1242
- tag: "dom-expressions/server-component",
1314
+ tag: "solid/server-component",
1243
1315
  test(value) {
1244
1316
  return typeof value === "function" && SERVER_COMPONENT in value;
1245
1317
  },
@@ -1385,7 +1457,7 @@ function createServerComponentHandler({
1385
1457
  }
1386
1458
  }
1387
1459
 
1388
- const STATE = Symbol.for("dom-expressions.container-trace-state");
1460
+ const STATE = Symbol.for("solid.container-trace-state");
1389
1461
  const state = globalThis[STATE] || (globalThis[STATE] = {
1390
1462
  materialized: new WeakMap(),
1391
1463
  materializedValues: new WeakSet()
@@ -1406,7 +1478,9 @@ function isMaterializedContainer(value) {
1406
1478
  return value !== null && typeof value === "object" && state.materializedValues.has(value);
1407
1479
  }
1408
1480
  function isContainerTraceMarker(value) {
1409
- return value != null && typeof value === "object" && value.$tr != null && typeof value.$tr[Symbol.asyncIterator] === "function";
1481
+ if (value == null || typeof value !== "object" || value.$tr == null) return false;
1482
+ const tr = value.$tr;
1483
+ return tr.__SEROVAL_STREAM__ === true || typeof tr[Symbol.asyncIterator] === "function";
1410
1484
  }
1411
1485
  function reviveContainerTraces(value) {
1412
1486
  if (!state.materializeTrace || value == null || typeof value !== "object") return value;
@@ -1452,7 +1526,8 @@ function getFrameHost() {
1452
1526
  applyData: c => tableFor(c.id)?.apply(c),
1453
1527
  resolve: (ref, id) => tableFor(id)?.resolve(ref),
1454
1528
  revive: reviveContainerTraces,
1455
- isContainer: isMaterializedContainer
1529
+ isContainer: isMaterializedContainer,
1530
+ delegate: web.delegateEvents
1456
1531
  });
1457
1532
  }
1458
1533
  return sharedHost;
@@ -1528,7 +1603,16 @@ function slotArgsProxy(args) {
1528
1603
  if (!isAsyncValue(v)) return v;
1529
1604
  let read = asyncReads.get(key);
1530
1605
  if (!read) {
1531
- const make = () => solidJs.createMemo(() => args()[key]);
1606
+ const make = () => solidJs.createMemo(() => {
1607
+ const raw = args()[key];
1608
+ if (raw != null && typeof raw.then === "function") {
1609
+ if (raw.s === 1) return raw.v;
1610
+ if (raw.s === 2) throw raw.v;
1611
+ }
1612
+ return raw;
1613
+ }, {
1614
+ transparent: true
1615
+ });
1532
1616
  read = owner ? solidJs.runWithOwner(owner, make) : make();
1533
1617
  asyncReads.set(key, read);
1534
1618
  }
@@ -1647,6 +1731,7 @@ function boundaryComponent(host, fnId) {
1647
1731
  host,
1648
1732
  id,
1649
1733
  slots: slotsFor(props),
1734
+ props,
1650
1735
  ownerScope: boundaryScope(owner),
1651
1736
  reveal: revealSeam(owner),
1652
1737
  onApply: () => {
@@ -1831,6 +1916,7 @@ function adoptBoundary(host, id, el, props, binding) {
1831
1916
  host,
1832
1917
  id: address,
1833
1918
  slots: slotsFor(props),
1919
+ props,
1834
1920
  ownerScope: boundaryScope(owner),
1835
1921
  reveal: revealSeam(owner),
1836
1922
  onApply: () => {