@solidjs/web 2.0.0-beta.17 → 2.0.0-beta.19

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 (42) hide show
  1. package/dist/dev.cjs +138 -48
  2. package/dist/dev.js +134 -50
  3. package/dist/server.cjs +108 -23
  4. package/dist/server.js +105 -25
  5. package/dist/web.cjs +138 -48
  6. package/dist/web.js +134 -50
  7. package/package.json +100 -11
  8. package/serialization/dist/serialization.cjs +83 -0
  9. package/serialization/dist/serialization.js +75 -0
  10. package/serialization/package.json +20 -0
  11. package/serialization/types/index.d.ts +139 -0
  12. package/serialization/types-cjs/index.d.cts +139 -0
  13. package/serialization/types-cjs/package.json +3 -0
  14. package/server-functions/dist/client.cjs +370 -0
  15. package/server-functions/dist/client.js +363 -0
  16. package/server-functions/dist/server.cjs +542 -0
  17. package/server-functions/dist/server.js +531 -0
  18. package/server-functions/package.json +30 -0
  19. package/storage/types/index.d.ts +28 -0
  20. package/storage/types-cjs/index.d.cts +28 -0
  21. package/types/index.d.ts +8 -1
  22. package/types/response.d.ts +93 -0
  23. package/types/serializer.d.ts +139 -0
  24. package/types/server-functions/client.d.ts +63 -0
  25. package/types/server-functions/server.d.ts +188 -0
  26. package/types/server-functions/shared.d.ts +171 -0
  27. package/types/server.d.ts +70 -15
  28. package/types-cjs/index.d.cts +8 -1
  29. package/types-cjs/response.d.cts +93 -0
  30. package/types-cjs/serializer.d.cts +139 -0
  31. package/types-cjs/server-functions/client.d.cts +63 -0
  32. package/types-cjs/server-functions/server.d.cts +188 -0
  33. package/types-cjs/server-functions/shared.d.cts +171 -0
  34. package/types-cjs/server.d.cts +70 -15
  35. package/storage/types/src/client.d.ts +0 -1
  36. package/storage/types/src/index.d.ts +0 -171
  37. package/storage/types/src/server-mock.d.ts +0 -161
  38. package/storage/types/storage/src/index.d.ts +0 -2
  39. package/storage/types-cjs/src/client.d.cts +0 -1
  40. package/storage/types-cjs/src/index.d.cts +0 -171
  41. package/storage/types-cjs/src/server-mock.d.cts +0 -161
  42. package/storage/types-cjs/storage/src/index.d.cts +0 -2
package/dist/dev.cjs CHANGED
@@ -48,9 +48,7 @@ const Namespaces = {
48
48
  };
49
49
  const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
50
50
  const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
51
- const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
52
- "webview",
53
- "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
51
+ const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
54
52
 
55
53
  const transparentOptions = {
56
54
  transparent: true,
@@ -415,6 +413,44 @@ function scope(fn) {
415
413
  const SCOPE_OPTIONS = {
416
414
  scope: true
417
415
  };
416
+ let hydrationRt = null;
417
+ function installHydrationRuntime() {
418
+ hydrationRt = {
419
+ claimInitial(parent, multi, initial) {
420
+ if (isHydrating(parent)) {
421
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
422
+ if (Array.isArray(initial)) stripTextSeparators(initial);
423
+ }
424
+ return initial;
425
+ },
426
+ reclaimRegion(current, parent, marker) {
427
+ if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
428
+ const first = Array.isArray(current) ? current[0] : current;
429
+ if (!first || !first.nodeType || first.isConnected) return current;
430
+ let nodes;
431
+ if (marker) {
432
+ nodes = [];
433
+ let node = marker.previousSibling,
434
+ depth = 0;
435
+ while (node) {
436
+ if (node.nodeType === 8) {
437
+ const v = node.nodeValue;
438
+ if (v === "/") depth++;else if (v === "$") {
439
+ if (depth === 0) break;
440
+ depth--;
441
+ }
442
+ }
443
+ nodes.unshift(node);
444
+ node = node.previousSibling;
445
+ }
446
+ } else nodes = [...parent.childNodes];
447
+ return stripTextSeparators(nodes);
448
+ },
449
+ dedupEvent(e) {
450
+ return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
451
+ }
452
+ };
453
+ }
418
454
  function stripTextSeparators(nodes) {
419
455
  let j = 0;
420
456
  for (let i = 0; i < nodes.length; i++) {
@@ -427,10 +463,7 @@ function insert(parent, accessor, marker, initial, options) {
427
463
  const multi = marker !== undefined;
428
464
  const host = options && options.host;
429
465
  if (multi && !initial) initial = [];
430
- if (isHydrating(parent)) {
431
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
432
- if (Array.isArray(initial)) stripTextSeparators(initial);
433
- }
466
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
434
467
  if (typeof accessor !== "function") {
435
468
  accessor = normalize(accessor, initial, multi, true);
436
469
  if (typeof accessor !== "function") {
@@ -445,34 +478,11 @@ function insert(parent, accessor, marker, initial, options) {
445
478
  initial = [placeholder];
446
479
  }
447
480
  let current = initial;
448
- function reclaimSwappedRegion() {
449
- if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return;
450
- const first = Array.isArray(current) ? current[0] : current;
451
- if (!first || !first.nodeType || first.isConnected) return;
452
- let nodes;
453
- if (marker) {
454
- nodes = [];
455
- let node = marker.previousSibling,
456
- depth = 0;
457
- while (node) {
458
- if (node.nodeType === 8) {
459
- const v = node.nodeValue;
460
- if (v === "/") depth++;else if (v === "$") {
461
- if (depth === 0) break;
462
- depth--;
463
- }
464
- }
465
- nodes.unshift(node);
466
- node = node.previousSibling;
467
- }
468
- } else nodes = [...parent.childNodes];
469
- current = stripTextSeparators(nodes);
470
- }
471
481
  effect(prev => {
472
- reclaimSwappedRegion();
482
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
473
483
  const value = normalize(accessor(), current, multi, true);
474
484
  if (typeof value !== "function") return value;
475
- effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
485
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
476
486
  insertExpression(parent, inner, current, marker);
477
487
  current = inner;
478
488
  host && tagHost(current, host);
@@ -624,6 +634,7 @@ function loadModuleAssets(mapping) {
624
634
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
625
635
  }
626
636
  function hydrate$1(code, element, options = {}) {
637
+ installHydrationRuntime();
627
638
  if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
628
639
  options.renderId ||= "";
629
640
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
@@ -883,9 +894,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
883
894
  return value;
884
895
  }
885
896
  function eventHandler(e, container, state) {
886
- if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
887
- if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
888
- }
897
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
889
898
  const prev = e[$$EVENT_OWNER];
890
899
  let resumeNode;
891
900
  if (prev) {
@@ -950,7 +959,7 @@ function eventHandler(e, container, state) {
950
959
  retarget(oriTarget);
951
960
  }
952
961
  function insertExpression(parent, value, current, marker) {
953
- if (isHydrating(parent)) return;
962
+ if (hydrationRt !== null && isHydrating(parent)) return;
954
963
  if (value === current) return;
955
964
  const t = typeof value,
956
965
  multi = marker !== undefined;
@@ -959,8 +968,7 @@ function insertExpression(parent, value, current, marker) {
959
968
  if (tc === "string" || tc === "number") {
960
969
  parent.firstChild.data = value;
961
970
  } else {
962
- const owned = ownedChildCount(current);
963
- if (owned === -1 || owned === parent.childNodes.length) parent.textContent = value;else {
971
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
964
972
  removeOwnedChildren(parent, current);
965
973
  parent.insertBefore(document.createTextNode(value), parent.firstChild);
966
974
  }
@@ -1027,11 +1035,15 @@ function appendNodes(parent, array, marker = null) {
1027
1035
  if (marker) n[$$SLOT] = marker;
1028
1036
  }
1029
1037
  }
1030
- function ownedChildCount(current) {
1031
- if (Array.isArray(current)) return current.length;
1032
- if (current == null) return -1;
1033
- if (current === "") return 0;
1034
- return 1;
1038
+ function ownsAllChildren(parent, current) {
1039
+ if (current == null) return true;
1040
+ if (Array.isArray(current)) {
1041
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1042
+ }
1043
+ if (current === "") return parent.firstChild === null;
1044
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1045
+ const first = parent.firstChild;
1046
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
1035
1047
  }
1036
1048
  function removeOwnedChildren(parent, current) {
1037
1049
  if (Array.isArray(current)) {
@@ -1048,8 +1060,7 @@ function removeOwnedChildren(parent, current) {
1048
1060
  }
1049
1061
  function cleanChildren(parent, current, marker, replacement) {
1050
1062
  if (marker === undefined) {
1051
- const owned = ownedChildCount(current);
1052
- if (owned === -1 || owned === parent.childNodes.length) return parent.textContent = "";
1063
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
1053
1064
  return removeOwnedChildren(parent, current);
1054
1065
  }
1055
1066
  if (current.length) {
@@ -1101,6 +1112,67 @@ function ssrHydrationKey() {}
1101
1112
  function resolveSSRNode(node) {}
1102
1113
  function escape(html) {}
1103
1114
 
1115
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1116
+ class ResponseEnvelope {
1117
+ constructor(response, value) {
1118
+ this.response = response;
1119
+ this.value = value;
1120
+ }
1121
+ }
1122
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1123
+ function isResponseEnvelope(value) {
1124
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1125
+ }
1126
+ function initWithRevalidate(init) {
1127
+ const {
1128
+ revalidate,
1129
+ ...responseInit
1130
+ } = init;
1131
+ const headers = new Headers(responseInit.headers);
1132
+ revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
1133
+ return {
1134
+ responseInit,
1135
+ headers
1136
+ };
1137
+ }
1138
+ function redirect(url, init = 302) {
1139
+ const {
1140
+ responseInit,
1141
+ headers
1142
+ } = initWithRevalidate(typeof init === "number" ? {
1143
+ status: init
1144
+ } : init);
1145
+ if (responseInit.status === undefined) {
1146
+ responseInit.status = 302;
1147
+ }
1148
+ headers.set("Location", url);
1149
+ return new Response(null, {
1150
+ ...responseInit,
1151
+ headers
1152
+ });
1153
+ }
1154
+ function reload(init = {}) {
1155
+ const {
1156
+ responseInit,
1157
+ headers
1158
+ } = initWithRevalidate(init);
1159
+ return new Response(null, {
1160
+ ...responseInit,
1161
+ headers
1162
+ });
1163
+ }
1164
+ function respond(value, init = {}) {
1165
+ const {
1166
+ responseInit,
1167
+ headers
1168
+ } = initWithRevalidate(init);
1169
+ headers.set("Content-Type", "application/json");
1170
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1171
+ ...responseInit,
1172
+ headers
1173
+ }), value);
1174
+ }
1175
+
1104
1176
  const mergeProps = solidJs.merge;
1105
1177
  const isServer = false;
1106
1178
  const isDev = true;
@@ -1124,11 +1196,16 @@ const hydrate = (...args) => {
1124
1196
  return hydrate$1(...args);
1125
1197
  };
1126
1198
  function Portal(props) {
1199
+ return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
1200
+ }
1201
+ function portalImpl(props) {
1127
1202
  const treeMarker = document.createTextNode(""),
1128
1203
  startMarker = document.createTextNode(""),
1129
1204
  endMarker = document.createTextNode(""),
1130
1205
  mount = () => props.mount || document.body,
1131
- content = solidJs.createMemo(() => [startMarker, props.children]);
1206
+ content = solidJs.createMemo(() => [startMarker, props.children], {
1207
+ ssrSource: "client"
1208
+ });
1132
1209
  solidJs.createRenderEffect(
1133
1210
  () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1134
1211
  const m = solidJs.untrack(mount);
@@ -1149,8 +1226,10 @@ function Portal(props) {
1149
1226
  c = n;
1150
1227
  }
1151
1228
  };
1152
- }, {
1153
- schedule: true
1229
+ },
1230
+ {
1231
+ schedule: true,
1232
+ ssrSource: "client"
1154
1233
  });
1155
1234
  solidJs.createEffect(mount, () => {
1156
1235
  const m = solidJs.untrack(mount);
@@ -1158,6 +1237,11 @@ function Portal(props) {
1158
1237
  if (!ownerRoot || ownerRoot.contains(m)) return;
1159
1238
  registerDelegatedContainer(m, ownerRoot);
1160
1239
  return () => unregisterDelegatedContainer(m, ownerRoot);
1240
+ }, {
1241
+ ssrSource: "client"
1242
+ });
1243
+ if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
1244
+ ssrSource: "client"
1161
1245
  });
1162
1246
  return treeMarker;
1163
1247
  }
@@ -1256,6 +1340,7 @@ exports.Namespaces = Namespaces;
1256
1340
  exports.Portal = Portal;
1257
1341
  exports.RawTextElements = RawTextElements;
1258
1342
  exports.RequestContext = RequestContext;
1343
+ exports.ResponseEnvelope = ResponseEnvelope;
1259
1344
  exports.SVGElements = SVGElements;
1260
1345
  exports.VoidElements = VoidElements;
1261
1346
  exports.acquireAsset = acquireAsset;
@@ -1280,18 +1365,23 @@ exports.getNextSibling = getNextSibling;
1280
1365
  exports.getRequestEvent = voidFn;
1281
1366
  exports.hydrate = hydrate;
1282
1367
  exports.insert = insert;
1368
+ exports.installHydrationRuntime = installHydrationRuntime;
1283
1369
  exports.isDev = isDev;
1370
+ exports.isResponseEnvelope = isResponseEnvelope;
1284
1371
  exports.isServer = isServer;
1285
1372
  exports.memo = memo;
1286
1373
  exports.mergeProps = mergeProps;
1374
+ exports.redirect = redirect;
1287
1375
  exports.ref = ref;
1288
1376
  exports.registerDelegatedContainer = registerDelegatedContainer;
1289
1377
  exports.registerDelegatedRoot = registerDelegatedRoot;
1378
+ exports.reload = reload;
1290
1379
  exports.render = render;
1291
1380
  exports.renderToStream = renderToStream;
1292
1381
  exports.renderToString = renderToString;
1293
1382
  exports.renderToStringAsync = renderToStringAsync;
1294
1383
  exports.resolveSSRNode = resolveSSRNode;
1384
+ exports.respond = respond;
1295
1385
  exports.runHydrationEvents = runHydrationEvents;
1296
1386
  exports.scope = scope;
1297
1387
  exports.setAttribute = setAttribute;
package/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, getOwner, createEffect, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
3
3
 
4
4
  const DOMWithState = {
@@ -47,9 +47,7 @@ const Namespaces = {
47
47
  };
48
48
  const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
49
49
  const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
50
- const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
51
- "webview",
52
- "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
50
+ const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
53
51
 
54
52
  const transparentOptions = {
55
53
  transparent: true,
@@ -414,6 +412,44 @@ function scope(fn) {
414
412
  const SCOPE_OPTIONS = {
415
413
  scope: true
416
414
  };
415
+ let hydrationRt = null;
416
+ function installHydrationRuntime() {
417
+ hydrationRt = {
418
+ claimInitial(parent, multi, initial) {
419
+ if (isHydrating(parent)) {
420
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
421
+ if (Array.isArray(initial)) stripTextSeparators(initial);
422
+ }
423
+ return initial;
424
+ },
425
+ reclaimRegion(current, parent, marker) {
426
+ if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
427
+ const first = Array.isArray(current) ? current[0] : current;
428
+ if (!first || !first.nodeType || first.isConnected) return current;
429
+ let nodes;
430
+ if (marker) {
431
+ nodes = [];
432
+ let node = marker.previousSibling,
433
+ depth = 0;
434
+ while (node) {
435
+ if (node.nodeType === 8) {
436
+ const v = node.nodeValue;
437
+ if (v === "/") depth++;else if (v === "$") {
438
+ if (depth === 0) break;
439
+ depth--;
440
+ }
441
+ }
442
+ nodes.unshift(node);
443
+ node = node.previousSibling;
444
+ }
445
+ } else nodes = [...parent.childNodes];
446
+ return stripTextSeparators(nodes);
447
+ },
448
+ dedupEvent(e) {
449
+ return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
450
+ }
451
+ };
452
+ }
417
453
  function stripTextSeparators(nodes) {
418
454
  let j = 0;
419
455
  for (let i = 0; i < nodes.length; i++) {
@@ -426,10 +462,7 @@ function insert(parent, accessor, marker, initial, options) {
426
462
  const multi = marker !== undefined;
427
463
  const host = options && options.host;
428
464
  if (multi && !initial) initial = [];
429
- if (isHydrating(parent)) {
430
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
431
- if (Array.isArray(initial)) stripTextSeparators(initial);
432
- }
465
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
433
466
  if (typeof accessor !== "function") {
434
467
  accessor = normalize(accessor, initial, multi, true);
435
468
  if (typeof accessor !== "function") {
@@ -444,34 +477,11 @@ function insert(parent, accessor, marker, initial, options) {
444
477
  initial = [placeholder];
445
478
  }
446
479
  let current = initial;
447
- function reclaimSwappedRegion() {
448
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return;
449
- const first = Array.isArray(current) ? current[0] : current;
450
- if (!first || !first.nodeType || first.isConnected) return;
451
- let nodes;
452
- if (marker) {
453
- nodes = [];
454
- let node = marker.previousSibling,
455
- depth = 0;
456
- while (node) {
457
- if (node.nodeType === 8) {
458
- const v = node.nodeValue;
459
- if (v === "/") depth++;else if (v === "$") {
460
- if (depth === 0) break;
461
- depth--;
462
- }
463
- }
464
- nodes.unshift(node);
465
- node = node.previousSibling;
466
- }
467
- } else nodes = [...parent.childNodes];
468
- current = stripTextSeparators(nodes);
469
- }
470
480
  effect(prev => {
471
- reclaimSwappedRegion();
481
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
472
482
  const value = normalize(accessor(), current, multi, true);
473
483
  if (typeof value !== "function") return value;
474
- effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
484
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
475
485
  insertExpression(parent, inner, current, marker);
476
486
  current = inner;
477
487
  host && tagHost(current, host);
@@ -623,6 +633,7 @@ function loadModuleAssets(mapping) {
623
633
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
624
634
  }
625
635
  function hydrate$1(code, element, options = {}) {
636
+ installHydrationRuntime();
626
637
  if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
627
638
  options.renderId ||= "";
628
639
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
@@ -882,9 +893,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
882
893
  return value;
883
894
  }
884
895
  function eventHandler(e, container, state) {
885
- if (sharedConfig.registry && sharedConfig.events) {
886
- if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
887
- }
896
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
888
897
  const prev = e[$$EVENT_OWNER];
889
898
  let resumeNode;
890
899
  if (prev) {
@@ -949,7 +958,7 @@ function eventHandler(e, container, state) {
949
958
  retarget(oriTarget);
950
959
  }
951
960
  function insertExpression(parent, value, current, marker) {
952
- if (isHydrating(parent)) return;
961
+ if (hydrationRt !== null && isHydrating(parent)) return;
953
962
  if (value === current) return;
954
963
  const t = typeof value,
955
964
  multi = marker !== undefined;
@@ -958,8 +967,7 @@ function insertExpression(parent, value, current, marker) {
958
967
  if (tc === "string" || tc === "number") {
959
968
  parent.firstChild.data = value;
960
969
  } else {
961
- const owned = ownedChildCount(current);
962
- if (owned === -1 || owned === parent.childNodes.length) parent.textContent = value;else {
970
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
963
971
  removeOwnedChildren(parent, current);
964
972
  parent.insertBefore(document.createTextNode(value), parent.firstChild);
965
973
  }
@@ -1026,11 +1034,15 @@ function appendNodes(parent, array, marker = null) {
1026
1034
  if (marker) n[$$SLOT] = marker;
1027
1035
  }
1028
1036
  }
1029
- function ownedChildCount(current) {
1030
- if (Array.isArray(current)) return current.length;
1031
- if (current == null) return -1;
1032
- if (current === "") return 0;
1033
- return 1;
1037
+ function ownsAllChildren(parent, current) {
1038
+ if (current == null) return true;
1039
+ if (Array.isArray(current)) {
1040
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1041
+ }
1042
+ if (current === "") return parent.firstChild === null;
1043
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1044
+ const first = parent.firstChild;
1045
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
1034
1046
  }
1035
1047
  function removeOwnedChildren(parent, current) {
1036
1048
  if (Array.isArray(current)) {
@@ -1047,8 +1059,7 @@ function removeOwnedChildren(parent, current) {
1047
1059
  }
1048
1060
  function cleanChildren(parent, current, marker, replacement) {
1049
1061
  if (marker === undefined) {
1050
- const owned = ownedChildCount(current);
1051
- if (owned === -1 || owned === parent.childNodes.length) return parent.textContent = "";
1062
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
1052
1063
  return removeOwnedChildren(parent, current);
1053
1064
  }
1054
1065
  if (current.length) {
@@ -1100,6 +1111,67 @@ function ssrHydrationKey() {}
1100
1111
  function resolveSSRNode(node) {}
1101
1112
  function escape(html) {}
1102
1113
 
1114
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1115
+ class ResponseEnvelope {
1116
+ constructor(response, value) {
1117
+ this.response = response;
1118
+ this.value = value;
1119
+ }
1120
+ }
1121
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1122
+ function isResponseEnvelope(value) {
1123
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1124
+ }
1125
+ function initWithRevalidate(init) {
1126
+ const {
1127
+ revalidate,
1128
+ ...responseInit
1129
+ } = init;
1130
+ const headers = new Headers(responseInit.headers);
1131
+ revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
1132
+ return {
1133
+ responseInit,
1134
+ headers
1135
+ };
1136
+ }
1137
+ function redirect(url, init = 302) {
1138
+ const {
1139
+ responseInit,
1140
+ headers
1141
+ } = initWithRevalidate(typeof init === "number" ? {
1142
+ status: init
1143
+ } : init);
1144
+ if (responseInit.status === undefined) {
1145
+ responseInit.status = 302;
1146
+ }
1147
+ headers.set("Location", url);
1148
+ return new Response(null, {
1149
+ ...responseInit,
1150
+ headers
1151
+ });
1152
+ }
1153
+ function reload(init = {}) {
1154
+ const {
1155
+ responseInit,
1156
+ headers
1157
+ } = initWithRevalidate(init);
1158
+ return new Response(null, {
1159
+ ...responseInit,
1160
+ headers
1161
+ });
1162
+ }
1163
+ function respond(value, init = {}) {
1164
+ const {
1165
+ responseInit,
1166
+ headers
1167
+ } = initWithRevalidate(init);
1168
+ headers.set("Content-Type", "application/json");
1169
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1170
+ ...responseInit,
1171
+ headers
1172
+ }), value);
1173
+ }
1174
+
1103
1175
  const mergeProps = merge;
1104
1176
  const isServer = false;
1105
1177
  const isDev = true;
@@ -1123,11 +1195,16 @@ const hydrate = (...args) => {
1123
1195
  return hydrate$1(...args);
1124
1196
  };
1125
1197
  function Portal(props) {
1198
+ return runWithOwner(createOwner(), () => portalImpl(props));
1199
+ }
1200
+ function portalImpl(props) {
1126
1201
  const treeMarker = document.createTextNode(""),
1127
1202
  startMarker = document.createTextNode(""),
1128
1203
  endMarker = document.createTextNode(""),
1129
1204
  mount = () => props.mount || document.body,
1130
- content = createMemo(() => [startMarker, props.children]);
1205
+ content = createMemo(() => [startMarker, props.children], {
1206
+ ssrSource: "client"
1207
+ });
1131
1208
  createRenderEffect(
1132
1209
  () => [mount(), content(), getOwner()], ([, c, owner]) => {
1133
1210
  const m = untrack(mount);
@@ -1148,8 +1225,10 @@ function Portal(props) {
1148
1225
  c = n;
1149
1226
  }
1150
1227
  };
1151
- }, {
1152
- schedule: true
1228
+ },
1229
+ {
1230
+ schedule: true,
1231
+ ssrSource: "client"
1153
1232
  });
1154
1233
  createEffect(mount, () => {
1155
1234
  const m = untrack(mount);
@@ -1157,6 +1236,11 @@ function Portal(props) {
1157
1236
  if (!ownerRoot || ownerRoot.contains(m)) return;
1158
1237
  registerDelegatedContainer(m, ownerRoot);
1159
1238
  return () => unregisterDelegatedContainer(m, ownerRoot);
1239
+ }, {
1240
+ ssrSource: "client"
1241
+ });
1242
+ if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
1243
+ ssrSource: "client"
1160
1244
  });
1161
1245
  return treeMarker;
1162
1246
  }
@@ -1191,4 +1275,4 @@ function createElement(tagName, is = undefined) {
1191
1275
  });
1192
1276
  }
1193
1277
 
1194
- export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
1278
+ export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };