@solidjs/web 2.0.0-experimental.4 → 2.0.0-experimental.6

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.cjs CHANGED
@@ -4,39 +4,9 @@ var solidJs = require('solid-js');
4
4
  var seroval = require('seroval');
5
5
  var web = require('seroval-plugins/web');
6
6
 
7
- const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
8
- const BooleanAttributes = /*#__PURE__*/new Set(booleans);
9
- const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
7
+ const Properties = /*#__PURE__*/new Set([
8
+ "value", "checked", "selected", "muted"]);
10
9
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
11
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
12
- class: "className",
13
- formnovalidate: {
14
- $: "formNoValidate",
15
- BUTTON: 1,
16
- INPUT: 1
17
- },
18
- ismap: {
19
- $: "isMap",
20
- IMG: 1
21
- },
22
- nomodule: {
23
- $: "noModule",
24
- SCRIPT: 1
25
- },
26
- playsinline: {
27
- $: "playsInline",
28
- VIDEO: 1
29
- },
30
- readonly: {
31
- $: "readOnly",
32
- INPUT: 1,
33
- TEXTAREA: 1
34
- }
35
- });
36
- function getPropAlias(prop, tagName) {
37
- const a = PropAliases[prop];
38
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
39
- }
40
10
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
41
11
  const SVGElements = /*#__PURE__*/new Set([
42
12
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
@@ -47,7 +17,11 @@ const SVGNamespace = {
47
17
  xlink: "http://www.w3.org/1999/xlink",
48
18
  xml: "http://www.w3.org/XML/1998/namespace"
49
19
  };
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"]);
20
+ 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",
21
+ "webview",
22
+ "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
23
+
24
+ const memo = fn => solidJs.createMemo(() => fn());
51
25
 
52
26
  const ES2017FLAG = seroval.Feature.AggregateError
53
27
  | seroval.Feature.BigIntTypedArray;
@@ -60,7 +34,7 @@ function createSerializer({
60
34
  }) {
61
35
  return new seroval.Serializer({
62
36
  scopeId,
63
- plugins: [
37
+ plugins: [web.AbortSignalPlugin,
64
38
  web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
65
39
  web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin],
66
40
  globalIdentifier: GLOBAL_IDENTIFIER,
@@ -78,12 +52,15 @@ const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menui
78
52
  const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content)}n.remove(),_$HY.fe(e)}`;
79
53
  function renderToString(code, options = {}) {
80
54
  const {
81
- renderId
55
+ renderId = "",
56
+ nonce,
57
+ noScripts
82
58
  } = options;
83
59
  let scripts = "";
84
60
  const serializer = createSerializer({
85
61
  scopeId: renderId,
86
62
  onData(script) {
63
+ if (noScripts) return;
87
64
  if (!scripts) {
88
65
  scripts = getLocalHeaderScript(renderId);
89
66
  }
@@ -92,23 +69,20 @@ function renderToString(code, options = {}) {
92
69
  onError: options.onError
93
70
  });
94
71
  solidJs.sharedConfig.context = {
95
- id: renderId || "",
96
- count: 0,
97
- suspense: {},
98
- lazy: {},
99
72
  assets: [],
100
- nonce: options.nonce,
73
+ nonce,
74
+ escape: escape,
75
+ resolve: resolveSSRNode,
76
+ ssr: ssr,
101
77
  serialize(id, p) {
102
78
  !solidJs.sharedConfig.context.noHydrate && serializer.write(id, p);
103
- },
104
- roots: 0,
105
- nextRoot() {
106
- return this.renderId + "i-" + this.roots++;
107
79
  }
108
80
  };
109
81
  let html = solidJs.createRoot(d => {
110
82
  setTimeout(d);
111
- return resolveSSRNode(escape(code()));
83
+ return resolveSSRSync(escape(code()));
84
+ }, {
85
+ id: renderId
112
86
  });
113
87
  solidJs.sharedConfig.context.noHydrate = true;
114
88
  serializer.close();
@@ -116,25 +90,12 @@ function renderToString(code, options = {}) {
116
90
  if (scripts.length) html = injectScripts(html, scripts, options.nonce);
117
91
  return html;
118
92
  }
119
- function renderToStringAsync(code, options = {}) {
120
- const {
121
- timeoutMs = 30000
122
- } = options;
123
- let timeoutHandle;
124
- const timeout = new Promise((_, reject) => {
125
- timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
126
- });
127
- return Promise.race([renderToStream(code, options), timeout]).then(html => {
128
- clearTimeout(timeoutHandle);
129
- return html;
130
- });
131
- }
132
93
  function renderToStream(code, options = {}) {
133
94
  let {
134
95
  nonce,
135
96
  onCompleteShell,
136
97
  onCompleteAll,
137
- renderId,
98
+ renderId = "",
138
99
  noScripts
139
100
  } = options;
140
101
  let dispose;
@@ -196,12 +157,7 @@ function renderToStream(code, options = {}) {
196
157
  }
197
158
  };
198
159
  solidJs.sharedConfig.context = context = {
199
- id: renderId || "",
200
- count: 0,
201
160
  async: true,
202
- resources: {},
203
- lazy: {},
204
- suspense: {},
205
161
  assets: [],
206
162
  nonce,
207
163
  block(p) {
@@ -213,7 +169,7 @@ function renderToStream(code, options = {}) {
213
169
  const first = html.indexOf(placeholder);
214
170
  if (first === -1) return;
215
171
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
216
- html = html.slice(0, first) + resolveSSRNode(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
172
+ html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
217
173
  },
218
174
  serialize(id, p, wait) {
219
175
  const serverOnly = solidJs.sharedConfig.context.noHydrate;
@@ -226,36 +182,46 @@ function renderToStream(code, options = {}) {
226
182
  });
227
183
  } else if (!serverOnly) serializer.write(id, p);
228
184
  },
229
- roots: 0,
230
- nextRoot() {
231
- return this.renderId + "i-" + this.roots++;
232
- },
185
+ escape: escape,
186
+ resolve: resolveSSRNode,
187
+ ssr: ssr,
233
188
  registerFragment(key) {
234
189
  if (!registry.has(key)) {
235
190
  let resolve, reject;
236
191
  const p = new Promise((r, rej) => (resolve = r, reject = rej));
237
- registry.set(key, err => queue(() => queue(() => {
238
- err ? reject(err) : resolve(true);
239
- queue(flushEnd);
240
- })));
192
+ registry.set(key, {
193
+ resolve: err => queue(() => queue(() => {
194
+ err ? reject(err) : resolve(true);
195
+ queue(flushEnd);
196
+ }))
197
+ });
241
198
  serializer.write(key, p);
242
199
  }
243
200
  return (value, error) => {
244
201
  if (registry.has(key)) {
245
- const resolve = registry.get(key);
202
+ const item = registry.get(key);
246
203
  registry.delete(key);
247
- if (waitForFragments(registry, key)) {
248
- resolve();
204
+ if (item.children) {
205
+ for (const k in item.children) {
206
+ value = replacePlaceholder(value, k, item.children[k]);
207
+ }
208
+ }
209
+ const parentKey = waitForFragments(registry, key);
210
+ if (parentKey) {
211
+ const parent = registry.get(parentKey);
212
+ parent.children ||= {};
213
+ parent.children[key] = value !== undefined ? value : "";
214
+ item.resolve();
249
215
  return;
250
216
  }
251
217
  if (!completed) {
252
218
  if (!firstFlushed) {
253
219
  queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
254
- resolve(error);
220
+ item.resolve(error);
255
221
  } else {
256
222
  buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
257
223
  pushTask(`$df("${key}")${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
258
- resolve(error);
224
+ item.resolve(error);
259
225
  scriptFlushed = true;
260
226
  }
261
227
  }
@@ -266,12 +232,13 @@ function renderToStream(code, options = {}) {
266
232
  };
267
233
  let html = solidJs.createRoot(d => {
268
234
  dispose = d;
269
- return resolveSSRNode(escape(code()));
235
+ return resolveSSRSync(escape(code()));
236
+ }, {
237
+ id: renderId
270
238
  });
271
239
  function doShell() {
272
240
  if (shellCompleted) return;
273
241
  solidJs.sharedConfig.context = context;
274
- context.noHydrate = true;
275
242
  html = injectAssets(context.assets, html);
276
243
  if (tasks.length) html = injectScripts(html, tasks, nonce);
277
244
  buffer.write(html);
@@ -354,15 +321,7 @@ function HydrationScript(props) {
354
321
  }));
355
322
  }
356
323
  function ssr(t, ...nodes) {
357
- if (nodes.length) {
358
- let result = "";
359
- for (let i = 0; i < nodes.length; i++) {
360
- result += t[i];
361
- const node = nodes[i];
362
- if (node !== undefined) result += resolveSSRNode(node);
363
- }
364
- t = result + t[nodes.length];
365
- }
324
+ if (nodes.length) return resolveSSR(t, nodes);
366
325
  return {
367
326
  t
368
327
  };
@@ -392,11 +351,17 @@ function ssrStyle(value) {
392
351
  const v = value[s];
393
352
  if (v != undefined) {
394
353
  if (i) result += ";";
395
- result += `${s}:${escape(v, true)}`;
354
+ const r = escape(v, true);
355
+ if (r != undefined && r !== "undefined") {
356
+ result += `${s}:${r}`;
357
+ }
396
358
  }
397
359
  }
398
360
  return result;
399
361
  }
362
+ function ssrStyleProperty(name, value) {
363
+ return value != null ? name + value : "";
364
+ }
400
365
  function ssrElement(tag, props, children, needsId) {
401
366
  if (props == null) props = {};else if (typeof props === "function") props = props();
402
367
  const skipChildren = VOID_ELEMENTS.test(tag);
@@ -413,17 +378,13 @@ function ssrElement(tag, props, children, needsId) {
413
378
  result += `style="${ssrStyle(value)}"`;
414
379
  } else if (prop === "class") {
415
380
  result += `class="${ssrClassName(value)}"`;
416
- } else if (BooleanAttributes.has(prop)) {
417
- if (value) result += prop;else continue;
418
381
  } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
419
382
  continue;
420
- } else if (prop.slice(0, 5) === "bool:") {
383
+ } else if (typeof value === "boolean") {
421
384
  if (!value) continue;
422
- result += escape(prop.slice(5));
423
- } else if (prop.slice(0, 5) === "attr:") {
424
- result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
385
+ result += escape(prop);
425
386
  } else {
426
- result += `${escape(prop)}="${escape(value, true)}"`;
387
+ result += value === "" ? escape(prop) : `${escape(prop)}="${escape(value, true)}"`;
427
388
  }
428
389
  if (i !== keys.length - 1) result += " ";
429
390
  }
@@ -431,26 +392,24 @@ function ssrElement(tag, props, children, needsId) {
431
392
  t: result + "/>"
432
393
  };
433
394
  if (typeof children === "function") children = children();
434
- return {
435
- t: result + `>${resolveSSRNode(children, true)}</${tag}>`
436
- };
395
+ return ssr([result + ">", `</${tag}>`], resolveSSRNode(children, undefined, true));
437
396
  }
438
- function ssrAttribute(key, value, isBoolean) {
439
- return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
397
+ function ssrAttribute(key, value) {
398
+ return value == null || value === false ? "" : value === true ? ` ${key}` : ` ${key}="${value}"`;
440
399
  }
441
400
  function ssrHydrationKey() {
442
401
  const hk = getHydrationKey();
443
- return hk ? ` data-hk=${hk}` : "";
402
+ return hk ? ` _hk=${hk}` : "";
444
403
  }
445
404
  function escape(s, attr) {
446
405
  const t = typeof s;
447
406
  if (t !== "string") {
448
- if (!attr && t === "function") return escape(s());
449
407
  if (!attr && Array.isArray(s)) {
408
+ s = s.slice();
450
409
  for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
451
410
  return s;
452
411
  }
453
- if (attr && t === "boolean") return String(s);
412
+ if (attr && t === "boolean") return s;
454
413
  return s;
455
414
  }
456
415
  const delim = attr ? '"' : "<";
@@ -488,23 +447,6 @@ function escape(s, attr) {
488
447
  }
489
448
  return left < s.length ? out + s.substring(left) : out;
490
449
  }
491
- function resolveSSRNode(node, top) {
492
- const t = typeof node;
493
- if (t === "string") return node;
494
- if (node == null || t === "boolean") return "";
495
- if (Array.isArray(node)) {
496
- let prev = {};
497
- let mapped = "";
498
- for (let i = 0, len = node.length; i < len; i++) {
499
- if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
500
- mapped += resolveSSRNode(prev = node[i]);
501
- }
502
- return mapped;
503
- }
504
- if (t === "object") return node.t;
505
- if (t === "function") return resolveSSRNode(node());
506
- return String(node);
507
- }
508
450
  function mergeProps(...sources) {
509
451
  const target = {};
510
452
  for (let i = 0; i < sources.length; i++) {
@@ -533,7 +475,7 @@ function getHydrationKey() {
533
475
  return hydrate && !hydrate.noHydrate && solidJs.sharedConfig.getNextContextId();
534
476
  }
535
477
  function useAssets(fn) {
536
- solidJs.sharedConfig.context.assets.push(() => resolveSSRNode(escape(fn())));
478
+ solidJs.sharedConfig.context.assets.push(() => resolveSSRSync(escape(fn())));
537
479
  }
538
480
  function getAssets() {
539
481
  const assets = solidJs.sharedConfig.context.assets;
@@ -545,15 +487,13 @@ function generateHydrationScript({
545
487
  eventNames = ["click", "input"],
546
488
  nonce
547
489
  } = {}) {
548
- return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('", "')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
490
+ return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('", "')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
549
491
  }
550
492
  function Hydration(props) {
551
493
  if (!solidJs.sharedConfig.context.noHydrate) return props.children;
552
494
  const context = solidJs.sharedConfig.context;
553
495
  solidJs.sharedConfig.context = {
554
496
  ...context,
555
- count: 0,
556
- id: solidJs.sharedConfig.getNextContextId(),
557
497
  noHydrate: false
558
498
  };
559
499
  const res = props.children;
@@ -561,8 +501,14 @@ function Hydration(props) {
561
501
  return res;
562
502
  }
563
503
  function NoHydration(props) {
564
- if (solidJs.sharedConfig.context) solidJs.sharedConfig.context.noHydrate = true;
565
- return props.children;
504
+ let context = solidJs.sharedConfig.context;
505
+ if (context) solidJs.sharedConfig.context = {
506
+ ...context,
507
+ noHydrate: true
508
+ };
509
+ const res = props.children;
510
+ if (context) solidJs.sharedConfig.context = context;
511
+ return res;
566
512
  }
567
513
  function queue(fn) {
568
514
  return Promise.resolve().then(fn);
@@ -592,7 +538,7 @@ function injectScripts(html, scripts, nonce) {
592
538
  }
593
539
  function waitForFragments(registry, key) {
594
540
  for (const k of [...registry.keys()].reverse()) {
595
- if (key.startsWith(k)) return true;
541
+ if (key.startsWith(k)) return k;
596
542
  }
597
543
  return false;
598
544
  }
@@ -618,12 +564,68 @@ function flattenClassList(list, result) {
618
564
  if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
619
565
  }
620
566
  }
567
+ function resolveSSR(template, holes, result = {
568
+ t: [""],
569
+ h: [],
570
+ p: []
571
+ }) {
572
+ for (let i = 0; i < holes.length; i++) {
573
+ const hole = holes[i];
574
+ result.t[result.t.length - 1] += template[i];
575
+ if (hole == null || hole === true || hole === false) continue;
576
+ resolveSSRNode(hole, result);
577
+ }
578
+ result.t[result.t.length - 1] += template[template.length - 1];
579
+ return result;
580
+ }
581
+ function resolveSSRNode(node, result = {
582
+ t: [""],
583
+ h: [],
584
+ p: []
585
+ }, top) {
586
+ const t = typeof node;
587
+ if (t === "string" || t === "number") {
588
+ result.t[result.t.length - 1] += node;
589
+ } else if (node == null || t === "boolean") ; else if (Array.isArray(node)) {
590
+ let prev = {};
591
+ for (let i = 0, len = node.length; i < len; i++) {
592
+ if (!top && typeof prev !== "object" && typeof node[i] !== "object") result.t[result.t.length - 1] += `<!--!$-->`;
593
+ resolveSSRNode(prev = node[i], result);
594
+ }
595
+ } else if (t === "object") {
596
+ if (node.h) {
597
+ result.t[result.t.length - 1] += node.t[0];
598
+ if (node.t.length > 1) {
599
+ result.t.push(...node.t.slice(1));
600
+ result.h.push(...node.h);
601
+ result.p.push(...node.p);
602
+ }
603
+ } else result.t[result.t.length - 1] += node.t;
604
+ } else if (t === "function") {
605
+ try {
606
+ resolveSSRNode(node(), result);
607
+ } catch (err) {
608
+ const p = solidJs.ssrHandleError(err);
609
+ if (p) {
610
+ result.h.push(node);
611
+ result.p.push(p);
612
+ result.t.push("");
613
+ }
614
+ }
615
+ }
616
+ return result;
617
+ }
618
+ function resolveSSRSync(node) {
619
+ const res = resolveSSRNode(node);
620
+ if (!res.h.length) return res.t[0];
621
+ throw new Error("This value cannot be rendered synchronously. Are you missing a Suspsense boundary?");
622
+ }
621
623
  const RequestContext = Symbol();
622
624
  function getRequestEvent() {
623
625
  return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.log("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;
624
626
  }
625
- function Assets(props) {
626
- useAssets(() => props.children);
627
+ function renderToStringAsync(code, options = {}) {
628
+ return renderToStream(code, options).then(html => html);
627
629
  }
628
630
  function notSup() {
629
631
  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>.");
@@ -688,15 +690,14 @@ Object.defineProperty(exports, "getOwner", {
688
690
  enumerable: true,
689
691
  get: function () { return solidJs.getOwner; }
690
692
  });
691
- Object.defineProperty(exports, "memo", {
693
+ Object.defineProperty(exports, "ssrRunInScope", {
692
694
  enumerable: true,
693
- get: function () { return solidJs.createMemo; }
695
+ get: function () { return solidJs.ssrRunInScope; }
694
696
  });
695
697
  Object.defineProperty(exports, "untrack", {
696
698
  enumerable: true,
697
699
  get: function () { return solidJs.untrack; }
698
700
  });
699
- exports.Assets = Assets;
700
701
  exports.ChildProperties = ChildProperties;
701
702
  exports.DOMElements = DOMElements;
702
703
  exports.DelegatedEvents = DelegatedEvents;
@@ -722,18 +723,17 @@ exports.getHydrationKey = getHydrationKey;
722
723
  exports.getNextElement = notSup;
723
724
  exports.getNextMarker = notSup;
724
725
  exports.getNextMatch = notSup;
725
- exports.getPropAlias = getPropAlias;
726
726
  exports.getRequestEvent = getRequestEvent;
727
727
  exports.hydrate = notSup;
728
728
  exports.insert = notSup;
729
729
  exports.isDev = isDev;
730
730
  exports.isServer = isServer;
731
+ exports.memo = memo;
731
732
  exports.mergeProps = mergeProps;
732
733
  exports.render = notSup;
733
734
  exports.renderToStream = renderToStream;
734
735
  exports.renderToString = renderToString;
735
736
  exports.renderToStringAsync = renderToStringAsync;
736
- exports.resolveSSRNode = resolveSSRNode;
737
737
  exports.runHydrationEvents = notSup;
738
738
  exports.setAttribute = notSup;
739
739
  exports.setAttributeNS = notSup;
@@ -745,6 +745,7 @@ exports.ssrClassName = ssrClassName;
745
745
  exports.ssrElement = ssrElement;
746
746
  exports.ssrHydrationKey = ssrHydrationKey;
747
747
  exports.ssrStyle = ssrStyle;
748
+ exports.ssrStyleProperty = ssrStyleProperty;
748
749
  exports.style = notSup;
749
750
  exports.template = notSup;
750
751
  exports.useAssets = useAssets;