@solidjs/web 2.0.0-beta.18 → 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.
package/dist/server.js CHANGED
@@ -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,
@@ -1266,7 +1264,7 @@ function resolveSSRSync(node) {
1266
1264
  if (!res.h.length) return res.t[0];
1267
1265
  throw new Error("This value cannot be rendered synchronously. Are you missing a boundary?");
1268
1266
  }
1269
- const RequestContext = Symbol();
1267
+ const RequestContext = Symbol.for("solid.RequestContext");
1270
1268
  function getRequestEvent() {
1271
1269
  return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
1272
1270
  }
@@ -1277,6 +1275,67 @@ function notSup() {
1277
1275
  throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
1278
1276
  }
1279
1277
 
1278
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1279
+ class ResponseEnvelope {
1280
+ constructor(response, value) {
1281
+ this.response = response;
1282
+ this.value = value;
1283
+ }
1284
+ }
1285
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1286
+ function isResponseEnvelope(value) {
1287
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1288
+ }
1289
+ function initWithRevalidate(init) {
1290
+ const {
1291
+ revalidate,
1292
+ ...responseInit
1293
+ } = init;
1294
+ const headers = new Headers(responseInit.headers);
1295
+ revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString());
1296
+ return {
1297
+ responseInit,
1298
+ headers
1299
+ };
1300
+ }
1301
+ function redirect(url, init = 302) {
1302
+ const {
1303
+ responseInit,
1304
+ headers
1305
+ } = initWithRevalidate(typeof init === "number" ? {
1306
+ status: init
1307
+ } : init);
1308
+ if (responseInit.status === undefined) {
1309
+ responseInit.status = 302;
1310
+ }
1311
+ headers.set("Location", url);
1312
+ return new Response(null, {
1313
+ ...responseInit,
1314
+ headers
1315
+ });
1316
+ }
1317
+ function reload(init = {}) {
1318
+ const {
1319
+ responseInit,
1320
+ headers
1321
+ } = initWithRevalidate(init);
1322
+ return new Response(null, {
1323
+ ...responseInit,
1324
+ headers
1325
+ });
1326
+ }
1327
+ function respond(value, init = {}) {
1328
+ const {
1329
+ responseInit,
1330
+ headers
1331
+ } = initWithRevalidate(init);
1332
+ headers.set("Content-Type", "application/json");
1333
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1334
+ ...responseInit,
1335
+ headers
1336
+ }), value);
1337
+ }
1338
+
1280
1339
  const isServer = true;
1281
1340
  const isDev = false;
1282
1341
  function dynamic(source) {
@@ -1328,4 +1387,4 @@ function Portal(props) {
1328
1387
  return undefined;
1329
1388
  }
1330
1389
 
1331
- export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
1390
+ export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };
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;
@@ -1046,6 +1055,67 @@ function ssrHydrationKey() {}
1046
1055
  function resolveSSRNode(node) {}
1047
1056
  function escape(html) {}
1048
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
+
1049
1119
  const mergeProps = solidJs.merge;
1050
1120
  const isServer = false;
1051
1121
  const isDev = false;
@@ -1208,6 +1278,7 @@ exports.Namespaces = Namespaces;
1208
1278
  exports.Portal = Portal;
1209
1279
  exports.RawTextElements = RawTextElements;
1210
1280
  exports.RequestContext = RequestContext;
1281
+ exports.ResponseEnvelope = ResponseEnvelope;
1211
1282
  exports.SVGElements = SVGElements;
1212
1283
  exports.VoidElements = VoidElements;
1213
1284
  exports.acquireAsset = acquireAsset;
@@ -1232,18 +1303,23 @@ exports.getNextSibling = getNextSibling;
1232
1303
  exports.getRequestEvent = voidFn;
1233
1304
  exports.hydrate = hydrate;
1234
1305
  exports.insert = insert;
1306
+ exports.installHydrationRuntime = installHydrationRuntime;
1235
1307
  exports.isDev = isDev;
1308
+ exports.isResponseEnvelope = isResponseEnvelope;
1236
1309
  exports.isServer = isServer;
1237
1310
  exports.memo = memo;
1238
1311
  exports.mergeProps = mergeProps;
1312
+ exports.redirect = redirect;
1239
1313
  exports.ref = ref;
1240
1314
  exports.registerDelegatedContainer = registerDelegatedContainer;
1241
1315
  exports.registerDelegatedRoot = registerDelegatedRoot;
1316
+ exports.reload = reload;
1242
1317
  exports.render = render;
1243
1318
  exports.renderToStream = renderToStream;
1244
1319
  exports.renderToString = renderToString;
1245
1320
  exports.renderToStringAsync = renderToStringAsync;
1246
1321
  exports.resolveSSRNode = resolveSSRNode;
1322
+ exports.respond = respond;
1247
1323
  exports.runHydrationEvents = runHydrationEvents;
1248
1324
  exports.scope = scope;
1249
1325
  exports.setAttribute = setAttribute;
package/dist/web.js CHANGED
@@ -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;
@@ -1045,6 +1054,67 @@ function ssrHydrationKey() {}
1045
1054
  function resolveSSRNode(node) {}
1046
1055
  function escape(html) {}
1047
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
+
1048
1118
  const mergeProps = merge;
1049
1119
  const isServer = false;
1050
1120
  const isDev = false;
@@ -1143,4 +1213,4 @@ function createElement(tagName, is = undefined) {
1143
1213
  });
1144
1214
  }
1145
1215
 
1146
- 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 };