@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/web.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,
@@ -410,6 +408,44 @@ function scope(fn) {
410
408
  const SCOPE_OPTIONS = {
411
409
  scope: true
412
410
  };
411
+ let hydrationRt = null;
412
+ function installHydrationRuntime() {
413
+ hydrationRt = {
414
+ claimInitial(parent, multi, initial) {
415
+ if (isHydrating(parent)) {
416
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
417
+ if (Array.isArray(initial)) stripTextSeparators(initial);
418
+ }
419
+ return initial;
420
+ },
421
+ reclaimRegion(current, parent, marker) {
422
+ if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
423
+ const first = Array.isArray(current) ? current[0] : current;
424
+ if (!first || !first.nodeType || first.isConnected) return current;
425
+ let nodes;
426
+ if (marker) {
427
+ nodes = [];
428
+ let node = marker.previousSibling,
429
+ depth = 0;
430
+ while (node) {
431
+ if (node.nodeType === 8) {
432
+ const v = node.nodeValue;
433
+ if (v === "/") depth++;else if (v === "$") {
434
+ if (depth === 0) break;
435
+ depth--;
436
+ }
437
+ }
438
+ nodes.unshift(node);
439
+ node = node.previousSibling;
440
+ }
441
+ } else nodes = [...parent.childNodes];
442
+ return stripTextSeparators(nodes);
443
+ },
444
+ dedupEvent(e) {
445
+ return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
446
+ }
447
+ };
448
+ }
413
449
  function stripTextSeparators(nodes) {
414
450
  let j = 0;
415
451
  for (let i = 0; i < nodes.length; i++) {
@@ -422,10 +458,7 @@ function insert(parent, accessor, marker, initial, options) {
422
458
  const multi = marker !== undefined;
423
459
  const host = options && options.host;
424
460
  if (multi && !initial) initial = [];
425
- if (isHydrating(parent)) {
426
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
427
- if (Array.isArray(initial)) stripTextSeparators(initial);
428
- }
461
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
429
462
  if (typeof accessor !== "function") {
430
463
  accessor = normalize(accessor, initial, multi, true);
431
464
  if (typeof accessor !== "function") {
@@ -440,34 +473,11 @@ function insert(parent, accessor, marker, initial, options) {
440
473
  initial = [placeholder];
441
474
  }
442
475
  let current = initial;
443
- function reclaimSwappedRegion() {
444
- if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return;
445
- const first = Array.isArray(current) ? current[0] : current;
446
- if (!first || !first.nodeType || first.isConnected) return;
447
- let nodes;
448
- if (marker) {
449
- nodes = [];
450
- let node = marker.previousSibling,
451
- depth = 0;
452
- while (node) {
453
- if (node.nodeType === 8) {
454
- const v = node.nodeValue;
455
- if (v === "/") depth++;else if (v === "$") {
456
- if (depth === 0) break;
457
- depth--;
458
- }
459
- }
460
- nodes.unshift(node);
461
- node = node.previousSibling;
462
- }
463
- } else nodes = [...parent.childNodes];
464
- current = stripTextSeparators(nodes);
465
- }
466
476
  effect(prev => {
467
- reclaimSwappedRegion();
477
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
468
478
  const value = normalize(accessor(), current, multi, true);
469
479
  if (typeof value !== "function") return value;
470
- effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
480
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
471
481
  insertExpression(parent, inner, current, marker);
472
482
  current = inner;
473
483
  host && tagHost(current, host);
@@ -619,6 +629,7 @@ function loadModuleAssets(mapping) {
619
629
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
620
630
  }
621
631
  function hydrate$1(code, element, options = {}) {
632
+ installHydrationRuntime();
622
633
  if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
623
634
  options.renderId ||= "";
624
635
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
@@ -826,9 +837,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
826
837
  return value;
827
838
  }
828
839
  function eventHandler(e, container, state) {
829
- if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
830
- if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
831
- }
840
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
832
841
  const prev = e[$$EVENT_OWNER];
833
842
  let resumeNode;
834
843
  if (prev) {
@@ -893,7 +902,7 @@ function eventHandler(e, container, state) {
893
902
  retarget(oriTarget);
894
903
  }
895
904
  function insertExpression(parent, value, current, marker) {
896
- if (isHydrating(parent)) return;
905
+ if (hydrationRt !== null && isHydrating(parent)) return;
897
906
  if (value === current) return;
898
907
  const t = typeof value,
899
908
  multi = marker !== undefined;
@@ -902,8 +911,7 @@ function insertExpression(parent, value, current, marker) {
902
911
  if (tc === "string" || tc === "number") {
903
912
  parent.firstChild.data = value;
904
913
  } else {
905
- const owned = ownedChildCount(current);
906
- if (owned === -1 || owned === parent.childNodes.length) parent.textContent = value;else {
914
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
907
915
  removeOwnedChildren(parent, current);
908
916
  parent.insertBefore(document.createTextNode(value), parent.firstChild);
909
917
  }
@@ -970,11 +978,15 @@ function appendNodes(parent, array, marker = null) {
970
978
  if (marker) n[$$SLOT] = marker;
971
979
  }
972
980
  }
973
- function ownedChildCount(current) {
974
- if (Array.isArray(current)) return current.length;
975
- if (current == null) return -1;
976
- if (current === "") return 0;
977
- return 1;
981
+ function ownsAllChildren(parent, current) {
982
+ if (current == null) return true;
983
+ if (Array.isArray(current)) {
984
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
985
+ }
986
+ if (current === "") return parent.firstChild === null;
987
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
988
+ const first = parent.firstChild;
989
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
978
990
  }
979
991
  function removeOwnedChildren(parent, current) {
980
992
  if (Array.isArray(current)) {
@@ -991,8 +1003,7 @@ function removeOwnedChildren(parent, current) {
991
1003
  }
992
1004
  function cleanChildren(parent, current, marker, replacement) {
993
1005
  if (marker === undefined) {
994
- const owned = ownedChildCount(current);
995
- if (owned === -1 || owned === parent.childNodes.length) return parent.textContent = "";
1006
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
996
1007
  return removeOwnedChildren(parent, current);
997
1008
  }
998
1009
  if (current.length) {
@@ -1044,6 +1055,67 @@ function ssrHydrationKey() {}
1044
1055
  function resolveSSRNode(node) {}
1045
1056
  function escape(html) {}
1046
1057
 
1058
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1059
+ class ResponseEnvelope {
1060
+ constructor(response, value) {
1061
+ this.response = response;
1062
+ this.value = value;
1063
+ }
1064
+ }
1065
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1066
+ function isResponseEnvelope(value) {
1067
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1068
+ }
1069
+ function initWithRevalidate(init) {
1070
+ const {
1071
+ revalidate,
1072
+ ...responseInit
1073
+ } = init;
1074
+ const headers = new Headers(responseInit.headers);
1075
+ revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
1076
+ return {
1077
+ responseInit,
1078
+ headers
1079
+ };
1080
+ }
1081
+ function redirect(url, init = 302) {
1082
+ const {
1083
+ responseInit,
1084
+ headers
1085
+ } = initWithRevalidate(typeof init === "number" ? {
1086
+ status: init
1087
+ } : init);
1088
+ if (responseInit.status === undefined) {
1089
+ responseInit.status = 302;
1090
+ }
1091
+ headers.set("Location", url);
1092
+ return new Response(null, {
1093
+ ...responseInit,
1094
+ headers
1095
+ });
1096
+ }
1097
+ function reload(init = {}) {
1098
+ const {
1099
+ responseInit,
1100
+ headers
1101
+ } = initWithRevalidate(init);
1102
+ return new Response(null, {
1103
+ ...responseInit,
1104
+ headers
1105
+ });
1106
+ }
1107
+ function respond(value, init = {}) {
1108
+ const {
1109
+ responseInit,
1110
+ headers
1111
+ } = initWithRevalidate(init);
1112
+ headers.set("Content-Type", "application/json");
1113
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1114
+ ...responseInit,
1115
+ headers
1116
+ }), value);
1117
+ }
1118
+
1047
1119
  const mergeProps = solidJs.merge;
1048
1120
  const isServer = false;
1049
1121
  const isDev = false;
@@ -1065,11 +1137,16 @@ const hydrate = (...args) => {
1065
1137
  return hydrate$1(...args);
1066
1138
  };
1067
1139
  function Portal(props) {
1140
+ return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
1141
+ }
1142
+ function portalImpl(props) {
1068
1143
  const treeMarker = document.createTextNode(""),
1069
1144
  startMarker = document.createTextNode(""),
1070
1145
  endMarker = document.createTextNode(""),
1071
1146
  mount = () => props.mount || document.body,
1072
- content = solidJs.createMemo(() => [startMarker, props.children]);
1147
+ content = solidJs.createMemo(() => [startMarker, props.children], {
1148
+ ssrSource: "client"
1149
+ });
1073
1150
  solidJs.createRenderEffect(
1074
1151
  () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1075
1152
  const m = solidJs.untrack(mount);
@@ -1090,8 +1167,10 @@ function Portal(props) {
1090
1167
  c = n;
1091
1168
  }
1092
1169
  };
1093
- }, {
1094
- schedule: true
1170
+ },
1171
+ {
1172
+ schedule: true,
1173
+ ssrSource: "client"
1095
1174
  });
1096
1175
  solidJs.createEffect(mount, () => {
1097
1176
  const m = solidJs.untrack(mount);
@@ -1099,6 +1178,11 @@ function Portal(props) {
1099
1178
  if (!ownerRoot || ownerRoot.contains(m)) return;
1100
1179
  registerDelegatedContainer(m, ownerRoot);
1101
1180
  return () => unregisterDelegatedContainer(m, ownerRoot);
1181
+ }, {
1182
+ ssrSource: "client"
1183
+ });
1184
+ if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
1185
+ ssrSource: "client"
1102
1186
  });
1103
1187
  return treeMarker;
1104
1188
  }
@@ -1194,6 +1278,7 @@ exports.Namespaces = Namespaces;
1194
1278
  exports.Portal = Portal;
1195
1279
  exports.RawTextElements = RawTextElements;
1196
1280
  exports.RequestContext = RequestContext;
1281
+ exports.ResponseEnvelope = ResponseEnvelope;
1197
1282
  exports.SVGElements = SVGElements;
1198
1283
  exports.VoidElements = VoidElements;
1199
1284
  exports.acquireAsset = acquireAsset;
@@ -1218,18 +1303,23 @@ exports.getNextSibling = getNextSibling;
1218
1303
  exports.getRequestEvent = voidFn;
1219
1304
  exports.hydrate = hydrate;
1220
1305
  exports.insert = insert;
1306
+ exports.installHydrationRuntime = installHydrationRuntime;
1221
1307
  exports.isDev = isDev;
1308
+ exports.isResponseEnvelope = isResponseEnvelope;
1222
1309
  exports.isServer = isServer;
1223
1310
  exports.memo = memo;
1224
1311
  exports.mergeProps = mergeProps;
1312
+ exports.redirect = redirect;
1225
1313
  exports.ref = ref;
1226
1314
  exports.registerDelegatedContainer = registerDelegatedContainer;
1227
1315
  exports.registerDelegatedRoot = registerDelegatedRoot;
1316
+ exports.reload = reload;
1228
1317
  exports.render = render;
1229
1318
  exports.renderToStream = renderToStream;
1230
1319
  exports.renderToString = renderToString;
1231
1320
  exports.renderToStringAsync = renderToStringAsync;
1232
1321
  exports.resolveSSRNode = resolveSSRNode;
1322
+ exports.respond = respond;
1233
1323
  exports.runHydrationEvents = runHydrationEvents;
1234
1324
  exports.scope = scope;
1235
1325
  exports.setAttribute = setAttribute;
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, getOwner, createEffect, enableHydration, flush } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, enableHydration, 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,
@@ -409,6 +407,44 @@ function scope(fn) {
409
407
  const SCOPE_OPTIONS = {
410
408
  scope: true
411
409
  };
410
+ let hydrationRt = null;
411
+ function installHydrationRuntime() {
412
+ hydrationRt = {
413
+ claimInitial(parent, multi, initial) {
414
+ if (isHydrating(parent)) {
415
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
416
+ if (Array.isArray(initial)) stripTextSeparators(initial);
417
+ }
418
+ return initial;
419
+ },
420
+ reclaimRegion(current, parent, marker) {
421
+ if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
422
+ const first = Array.isArray(current) ? current[0] : current;
423
+ if (!first || !first.nodeType || first.isConnected) return current;
424
+ let nodes;
425
+ if (marker) {
426
+ nodes = [];
427
+ let node = marker.previousSibling,
428
+ depth = 0;
429
+ while (node) {
430
+ if (node.nodeType === 8) {
431
+ const v = node.nodeValue;
432
+ if (v === "/") depth++;else if (v === "$") {
433
+ if (depth === 0) break;
434
+ depth--;
435
+ }
436
+ }
437
+ nodes.unshift(node);
438
+ node = node.previousSibling;
439
+ }
440
+ } else nodes = [...parent.childNodes];
441
+ return stripTextSeparators(nodes);
442
+ },
443
+ dedupEvent(e) {
444
+ return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
445
+ }
446
+ };
447
+ }
412
448
  function stripTextSeparators(nodes) {
413
449
  let j = 0;
414
450
  for (let i = 0; i < nodes.length; i++) {
@@ -421,10 +457,7 @@ function insert(parent, accessor, marker, initial, options) {
421
457
  const multi = marker !== undefined;
422
458
  const host = options && options.host;
423
459
  if (multi && !initial) initial = [];
424
- if (isHydrating(parent)) {
425
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
426
- if (Array.isArray(initial)) stripTextSeparators(initial);
427
- }
460
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
428
461
  if (typeof accessor !== "function") {
429
462
  accessor = normalize(accessor, initial, multi, true);
430
463
  if (typeof accessor !== "function") {
@@ -439,34 +472,11 @@ function insert(parent, accessor, marker, initial, options) {
439
472
  initial = [placeholder];
440
473
  }
441
474
  let current = initial;
442
- function reclaimSwappedRegion() {
443
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return;
444
- const first = Array.isArray(current) ? current[0] : current;
445
- if (!first || !first.nodeType || first.isConnected) return;
446
- let nodes;
447
- if (marker) {
448
- nodes = [];
449
- let node = marker.previousSibling,
450
- depth = 0;
451
- while (node) {
452
- if (node.nodeType === 8) {
453
- const v = node.nodeValue;
454
- if (v === "/") depth++;else if (v === "$") {
455
- if (depth === 0) break;
456
- depth--;
457
- }
458
- }
459
- nodes.unshift(node);
460
- node = node.previousSibling;
461
- }
462
- } else nodes = [...parent.childNodes];
463
- current = stripTextSeparators(nodes);
464
- }
465
475
  effect(prev => {
466
- reclaimSwappedRegion();
476
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
467
477
  const value = normalize(accessor(), current, multi, true);
468
478
  if (typeof value !== "function") return value;
469
- effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
479
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
470
480
  insertExpression(parent, inner, current, marker);
471
481
  current = inner;
472
482
  host && tagHost(current, host);
@@ -618,6 +628,7 @@ function loadModuleAssets(mapping) {
618
628
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
619
629
  }
620
630
  function hydrate$1(code, element, options = {}) {
631
+ installHydrationRuntime();
621
632
  if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
622
633
  options.renderId ||= "";
623
634
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
@@ -825,9 +836,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
825
836
  return value;
826
837
  }
827
838
  function eventHandler(e, container, state) {
828
- if (sharedConfig.registry && sharedConfig.events) {
829
- if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
830
- }
839
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
831
840
  const prev = e[$$EVENT_OWNER];
832
841
  let resumeNode;
833
842
  if (prev) {
@@ -892,7 +901,7 @@ function eventHandler(e, container, state) {
892
901
  retarget(oriTarget);
893
902
  }
894
903
  function insertExpression(parent, value, current, marker) {
895
- if (isHydrating(parent)) return;
904
+ if (hydrationRt !== null && isHydrating(parent)) return;
896
905
  if (value === current) return;
897
906
  const t = typeof value,
898
907
  multi = marker !== undefined;
@@ -901,8 +910,7 @@ function insertExpression(parent, value, current, marker) {
901
910
  if (tc === "string" || tc === "number") {
902
911
  parent.firstChild.data = value;
903
912
  } else {
904
- const owned = ownedChildCount(current);
905
- if (owned === -1 || owned === parent.childNodes.length) parent.textContent = value;else {
913
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
906
914
  removeOwnedChildren(parent, current);
907
915
  parent.insertBefore(document.createTextNode(value), parent.firstChild);
908
916
  }
@@ -969,11 +977,15 @@ function appendNodes(parent, array, marker = null) {
969
977
  if (marker) n[$$SLOT] = marker;
970
978
  }
971
979
  }
972
- function ownedChildCount(current) {
973
- if (Array.isArray(current)) return current.length;
974
- if (current == null) return -1;
975
- if (current === "") return 0;
976
- return 1;
980
+ function ownsAllChildren(parent, current) {
981
+ if (current == null) return true;
982
+ if (Array.isArray(current)) {
983
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
984
+ }
985
+ if (current === "") return parent.firstChild === null;
986
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
987
+ const first = parent.firstChild;
988
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
977
989
  }
978
990
  function removeOwnedChildren(parent, current) {
979
991
  if (Array.isArray(current)) {
@@ -990,8 +1002,7 @@ function removeOwnedChildren(parent, current) {
990
1002
  }
991
1003
  function cleanChildren(parent, current, marker, replacement) {
992
1004
  if (marker === undefined) {
993
- const owned = ownedChildCount(current);
994
- if (owned === -1 || owned === parent.childNodes.length) return parent.textContent = "";
1005
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
995
1006
  return removeOwnedChildren(parent, current);
996
1007
  }
997
1008
  if (current.length) {
@@ -1043,6 +1054,67 @@ function ssrHydrationKey() {}
1043
1054
  function resolveSSRNode(node) {}
1044
1055
  function escape(html) {}
1045
1056
 
1057
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1058
+ class ResponseEnvelope {
1059
+ constructor(response, value) {
1060
+ this.response = response;
1061
+ this.value = value;
1062
+ }
1063
+ }
1064
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1065
+ function isResponseEnvelope(value) {
1066
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1067
+ }
1068
+ function initWithRevalidate(init) {
1069
+ const {
1070
+ revalidate,
1071
+ ...responseInit
1072
+ } = init;
1073
+ const headers = new Headers(responseInit.headers);
1074
+ revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
1075
+ return {
1076
+ responseInit,
1077
+ headers
1078
+ };
1079
+ }
1080
+ function redirect(url, init = 302) {
1081
+ const {
1082
+ responseInit,
1083
+ headers
1084
+ } = initWithRevalidate(typeof init === "number" ? {
1085
+ status: init
1086
+ } : init);
1087
+ if (responseInit.status === undefined) {
1088
+ responseInit.status = 302;
1089
+ }
1090
+ headers.set("Location", url);
1091
+ return new Response(null, {
1092
+ ...responseInit,
1093
+ headers
1094
+ });
1095
+ }
1096
+ function reload(init = {}) {
1097
+ const {
1098
+ responseInit,
1099
+ headers
1100
+ } = initWithRevalidate(init);
1101
+ return new Response(null, {
1102
+ ...responseInit,
1103
+ headers
1104
+ });
1105
+ }
1106
+ function respond(value, init = {}) {
1107
+ const {
1108
+ responseInit,
1109
+ headers
1110
+ } = initWithRevalidate(init);
1111
+ headers.set("Content-Type", "application/json");
1112
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1113
+ ...responseInit,
1114
+ headers
1115
+ }), value);
1116
+ }
1117
+
1046
1118
  const mergeProps = merge;
1047
1119
  const isServer = false;
1048
1120
  const isDev = false;
@@ -1064,11 +1136,16 @@ const hydrate = (...args) => {
1064
1136
  return hydrate$1(...args);
1065
1137
  };
1066
1138
  function Portal(props) {
1139
+ return runWithOwner(createOwner(), () => portalImpl(props));
1140
+ }
1141
+ function portalImpl(props) {
1067
1142
  const treeMarker = document.createTextNode(""),
1068
1143
  startMarker = document.createTextNode(""),
1069
1144
  endMarker = document.createTextNode(""),
1070
1145
  mount = () => props.mount || document.body,
1071
- content = createMemo(() => [startMarker, props.children]);
1146
+ content = createMemo(() => [startMarker, props.children], {
1147
+ ssrSource: "client"
1148
+ });
1072
1149
  createRenderEffect(
1073
1150
  () => [mount(), content(), getOwner()], ([, c, owner]) => {
1074
1151
  const m = untrack(mount);
@@ -1089,8 +1166,10 @@ function Portal(props) {
1089
1166
  c = n;
1090
1167
  }
1091
1168
  };
1092
- }, {
1093
- schedule: true
1169
+ },
1170
+ {
1171
+ schedule: true,
1172
+ ssrSource: "client"
1094
1173
  });
1095
1174
  createEffect(mount, () => {
1096
1175
  const m = untrack(mount);
@@ -1098,6 +1177,11 @@ function Portal(props) {
1098
1177
  if (!ownerRoot || ownerRoot.contains(m)) return;
1099
1178
  registerDelegatedContainer(m, ownerRoot);
1100
1179
  return () => unregisterDelegatedContainer(m, ownerRoot);
1180
+ }, {
1181
+ ssrSource: "client"
1182
+ });
1183
+ if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
1184
+ ssrSource: "client"
1101
1185
  });
1102
1186
  return treeMarker;
1103
1187
  }
@@ -1129,4 +1213,4 @@ function createElement(tagName, is = undefined) {
1129
1213
  });
1130
1214
  }
1131
1215
 
1132
- 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 };
1216
+ 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 };