@solidjs/web 2.0.0-experimental.0

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.
@@ -0,0 +1,714 @@
1
+ 'use strict';
2
+
3
+ var solidJs = require('solid-js');
4
+ var seroval = require('seroval');
5
+ var web = require('seroval-plugins/web');
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]);
10
+ 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
+ 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
+ const SVGElements = /*#__PURE__*/new Set([
42
+ "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",
43
+ "set", "stop",
44
+ "svg", "switch", "symbol", "text", "textPath",
45
+ "tref", "tspan", "use", "view", "vkern"]);
46
+ const SVGNamespace = {
47
+ xlink: "http://www.w3.org/1999/xlink",
48
+ xml: "http://www.w3.org/XML/1998/namespace"
49
+ };
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
+
52
+ const ES2017FLAG = seroval.Feature.AggregateError
53
+ | seroval.Feature.BigIntTypedArray;
54
+ const GLOBAL_IDENTIFIER = '_$HY.r';
55
+ function createSerializer({
56
+ onData,
57
+ onDone,
58
+ scopeId,
59
+ onError
60
+ }) {
61
+ return new seroval.Serializer({
62
+ scopeId,
63
+ plugins: [
64
+ web.CustomEventPlugin, web.DOMExceptionPlugin, web.EventPlugin,
65
+ web.FormDataPlugin, web.HeadersPlugin, web.ReadableStreamPlugin, web.RequestPlugin, web.ResponsePlugin, web.URLSearchParamsPlugin, web.URLPlugin],
66
+ globalIdentifier: GLOBAL_IDENTIFIER,
67
+ disabledFeatures: ES2017FLAG,
68
+ onData,
69
+ onDone,
70
+ onError
71
+ });
72
+ }
73
+ function getLocalHeaderScript(id) {
74
+ return seroval.getCrossReferenceHeader(id) + ';';
75
+ }
76
+
77
+ const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
78
+ 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
+ function renderToString(code, options = {}) {
80
+ const {
81
+ renderId
82
+ } = options;
83
+ let scripts = "";
84
+ const serializer = createSerializer({
85
+ scopeId: renderId,
86
+ onData(script) {
87
+ if (!scripts) {
88
+ scripts = getLocalHeaderScript(renderId);
89
+ }
90
+ scripts += script + ";";
91
+ },
92
+ onError: options.onError
93
+ });
94
+ solidJs.sharedConfig.context = {
95
+ id: renderId || "",
96
+ count: 0,
97
+ suspense: {},
98
+ lazy: {},
99
+ assets: [],
100
+ nonce: options.nonce,
101
+ serialize(id, p) {
102
+ !solidJs.sharedConfig.context.noHydrate && serializer.write(id, p);
103
+ },
104
+ roots: 0,
105
+ nextRoot() {
106
+ return this.renderId + "i-" + this.roots++;
107
+ }
108
+ };
109
+ let html = solidJs.createRoot(d => {
110
+ setTimeout(d);
111
+ return resolveSSRNode(escape(code()));
112
+ });
113
+ solidJs.sharedConfig.context.noHydrate = true;
114
+ serializer.close();
115
+ html = injectAssets(solidJs.sharedConfig.context.assets, html);
116
+ if (scripts.length) html = injectScripts(html, scripts, options.nonce);
117
+ return html;
118
+ }
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
+ function renderToStream(code, options = {}) {
133
+ let {
134
+ nonce,
135
+ onCompleteShell,
136
+ onCompleteAll,
137
+ renderId,
138
+ noScripts
139
+ } = options;
140
+ let dispose;
141
+ const blockingPromises = [];
142
+ const pushTask = task => {
143
+ if (noScripts) return;
144
+ if (!tasks && !firstFlushed) {
145
+ tasks = getLocalHeaderScript(renderId);
146
+ }
147
+ tasks += task + ";";
148
+ if (!timer && firstFlushed) {
149
+ timer = setTimeout(writeTasks);
150
+ }
151
+ };
152
+ const onDone = () => {
153
+ writeTasks();
154
+ doShell();
155
+ onCompleteAll && onCompleteAll({
156
+ write(v) {
157
+ !completed && buffer.write(v);
158
+ }
159
+ });
160
+ writable && writable.end();
161
+ completed = true;
162
+ if (firstFlushed) dispose();
163
+ };
164
+ const serializer = createSerializer({
165
+ scopeId: options.renderId,
166
+ onData: pushTask,
167
+ onDone,
168
+ onError: options.onError
169
+ });
170
+ const flushEnd = () => {
171
+ if (!registry.size) {
172
+ queue(() => queue(() => serializer.flush()));
173
+ }
174
+ };
175
+ const registry = new Map();
176
+ const writeTasks = () => {
177
+ if (tasks.length && !completed && firstFlushed) {
178
+ buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks}</script>`);
179
+ tasks = "";
180
+ }
181
+ timer && clearTimeout(timer);
182
+ timer = null;
183
+ };
184
+ let context;
185
+ let writable;
186
+ let tmp = "";
187
+ let tasks = "";
188
+ let firstFlushed = false;
189
+ let completed = false;
190
+ let shellCompleted = false;
191
+ let scriptFlushed = false;
192
+ let timer = null;
193
+ let buffer = {
194
+ write(payload) {
195
+ tmp += payload;
196
+ }
197
+ };
198
+ solidJs.sharedConfig.context = context = {
199
+ id: renderId || "",
200
+ count: 0,
201
+ async: true,
202
+ resources: {},
203
+ lazy: {},
204
+ suspense: {},
205
+ assets: [],
206
+ nonce,
207
+ block(p) {
208
+ if (!firstFlushed) blockingPromises.push(p);
209
+ },
210
+ replace(id, payloadFn) {
211
+ if (firstFlushed) return;
212
+ const placeholder = `<!--!$${id}-->`;
213
+ const first = html.indexOf(placeholder);
214
+ if (first === -1) return;
215
+ const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
216
+ html = html.slice(0, first) + resolveSSRNode(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
217
+ },
218
+ serialize(id, p, wait) {
219
+ const serverOnly = solidJs.sharedConfig.context.noHydrate;
220
+ if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
221
+ blockingPromises.push(p);
222
+ !serverOnly && p.then(d => {
223
+ serializer.write(id, d);
224
+ }).catch(e => {
225
+ serializer.write(id, e);
226
+ });
227
+ } else if (!serverOnly) serializer.write(id, p);
228
+ },
229
+ roots: 0,
230
+ nextRoot() {
231
+ return this.renderId + "i-" + this.roots++;
232
+ },
233
+ registerFragment(key) {
234
+ if (!registry.has(key)) {
235
+ let resolve, reject;
236
+ 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
+ })));
241
+ serializer.write(key, p);
242
+ }
243
+ return (value, error) => {
244
+ if (registry.has(key)) {
245
+ const resolve = registry.get(key);
246
+ registry.delete(key);
247
+ if (waitForFragments(registry, key)) {
248
+ resolve();
249
+ return;
250
+ }
251
+ if (!completed) {
252
+ if (!firstFlushed) {
253
+ queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
254
+ resolve(error);
255
+ } else {
256
+ buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
257
+ pushTask(`$df("${key}")${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
258
+ resolve(error);
259
+ scriptFlushed = true;
260
+ }
261
+ }
262
+ }
263
+ return firstFlushed;
264
+ };
265
+ }
266
+ };
267
+ let html = solidJs.createRoot(d => {
268
+ dispose = d;
269
+ return resolveSSRNode(escape(code()));
270
+ });
271
+ function doShell() {
272
+ if (shellCompleted) return;
273
+ solidJs.sharedConfig.context = context;
274
+ context.noHydrate = true;
275
+ html = injectAssets(context.assets, html);
276
+ if (tasks.length) html = injectScripts(html, tasks, nonce);
277
+ buffer.write(html);
278
+ tasks = "";
279
+ onCompleteShell && onCompleteShell({
280
+ write(v) {
281
+ !completed && buffer.write(v);
282
+ }
283
+ });
284
+ shellCompleted = true;
285
+ }
286
+ return {
287
+ then(fn) {
288
+ function complete() {
289
+ dispose();
290
+ fn(tmp);
291
+ }
292
+ if (onCompleteAll) {
293
+ let ogComplete = onCompleteAll;
294
+ onCompleteAll = options => {
295
+ ogComplete(options);
296
+ complete();
297
+ };
298
+ } else onCompleteAll = complete;
299
+ queue(flushEnd);
300
+ },
301
+ pipe(w) {
302
+ allSettled(blockingPromises).then(() => {
303
+ setTimeout(() => {
304
+ doShell();
305
+ buffer = writable = w;
306
+ buffer.write(tmp);
307
+ firstFlushed = true;
308
+ if (completed) {
309
+ dispose();
310
+ writable.end();
311
+ } else flushEnd();
312
+ });
313
+ });
314
+ },
315
+ pipeTo(w) {
316
+ return allSettled(blockingPromises).then(() => {
317
+ let resolve;
318
+ const p = new Promise(r => resolve = r);
319
+ setTimeout(() => {
320
+ doShell();
321
+ const encoder = new TextEncoder();
322
+ const writer = w.getWriter();
323
+ writable = {
324
+ end() {
325
+ writer.releaseLock();
326
+ w.close();
327
+ resolve();
328
+ }
329
+ };
330
+ buffer = {
331
+ write(payload) {
332
+ writer.write(encoder.encode(payload));
333
+ }
334
+ };
335
+ buffer.write(tmp);
336
+ firstFlushed = true;
337
+ if (completed) {
338
+ dispose();
339
+ writable.end();
340
+ } else flushEnd();
341
+ });
342
+ return p;
343
+ });
344
+ }
345
+ };
346
+ }
347
+ function HydrationScript(props) {
348
+ const {
349
+ nonce
350
+ } = solidJs.sharedConfig.context;
351
+ return ssr(generateHydrationScript({
352
+ nonce,
353
+ ...props
354
+ }));
355
+ }
356
+ 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
+ }
366
+ return {
367
+ t
368
+ };
369
+ }
370
+ function ssrClassName(value) {
371
+ if (!value) return "";
372
+ let classKeys = Object.keys(value),
373
+ result = "";
374
+ for (let i = 0, len = classKeys.length; i < len; i++) {
375
+ const key = classKeys[i],
376
+ classValue = !!value[key];
377
+ if (!key || key === "undefined" || !classValue) continue;
378
+ i && (result += " ");
379
+ result += escape(key);
380
+ }
381
+ return result;
382
+ }
383
+ function ssrStyle(value) {
384
+ if (!value) return "";
385
+ if (typeof value === "string") return escape(value, true);
386
+ let result = "";
387
+ const k = Object.keys(value);
388
+ for (let i = 0; i < k.length; i++) {
389
+ const s = k[i];
390
+ const v = value[s];
391
+ if (v != undefined) {
392
+ if (i) result += ";";
393
+ result += `${s}:${escape(v, true)}`;
394
+ }
395
+ }
396
+ return result;
397
+ }
398
+ function ssrElement(tag, props, children, needsId) {
399
+ if (props == null) props = {};else if (typeof props === "function") props = props();
400
+ const skipChildren = VOID_ELEMENTS.test(tag);
401
+ const keys = Object.keys(props);
402
+ let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
403
+ for (let i = 0; i < keys.length; i++) {
404
+ const prop = keys[i];
405
+ if (ChildProperties.has(prop)) {
406
+ if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
407
+ continue;
408
+ }
409
+ const value = props[prop];
410
+ if (prop === "style") {
411
+ result += `style="${ssrStyle(value)}"`;
412
+ } else if (prop === "class") {
413
+ result += `class="${ssrClassName(value)}"`;
414
+ } else if (BooleanAttributes.has(prop)) {
415
+ if (value) result += prop;else continue;
416
+ } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
417
+ continue;
418
+ } else if (prop.slice(0, 5) === "bool:") {
419
+ if (!value) continue;
420
+ result += escape(prop.slice(5));
421
+ } else if (prop.slice(0, 5) === "attr:") {
422
+ result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
423
+ } else {
424
+ result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
425
+ }
426
+ if (i !== keys.length - 1) result += " ";
427
+ }
428
+ if (skipChildren) return {
429
+ t: result + "/>"
430
+ };
431
+ if (typeof children === "function") children = children();
432
+ return {
433
+ t: result + `>${resolveSSRNode(children, true)}</${tag}>`
434
+ };
435
+ }
436
+ function ssrAttribute(key, value, isBoolean) {
437
+ return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
438
+ }
439
+ function ssrHydrationKey() {
440
+ const hk = getHydrationKey();
441
+ return hk ? ` data-hk=${hk}` : "";
442
+ }
443
+ function escape(s, attr) {
444
+ const t = typeof s;
445
+ if (t !== "string") {
446
+ if (!attr && t === "function") return escape(s());
447
+ if (!attr && Array.isArray(s)) {
448
+ for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
449
+ return s;
450
+ }
451
+ if (attr && t === "boolean") return String(s);
452
+ return s;
453
+ }
454
+ const delim = attr ? '"' : "<";
455
+ const escDelim = attr ? "&quot;" : "&lt;";
456
+ let iDelim = s.indexOf(delim);
457
+ let iAmp = s.indexOf("&");
458
+ if (iDelim < 0 && iAmp < 0) return s;
459
+ let left = 0,
460
+ out = "";
461
+ while (iDelim >= 0 && iAmp >= 0) {
462
+ if (iDelim < iAmp) {
463
+ if (left < iDelim) out += s.substring(left, iDelim);
464
+ out += escDelim;
465
+ left = iDelim + 1;
466
+ iDelim = s.indexOf(delim, left);
467
+ } else {
468
+ if (left < iAmp) out += s.substring(left, iAmp);
469
+ out += "&amp;";
470
+ left = iAmp + 1;
471
+ iAmp = s.indexOf("&", left);
472
+ }
473
+ }
474
+ if (iDelim >= 0) {
475
+ do {
476
+ if (left < iDelim) out += s.substring(left, iDelim);
477
+ out += escDelim;
478
+ left = iDelim + 1;
479
+ iDelim = s.indexOf(delim, left);
480
+ } while (iDelim >= 0);
481
+ } else while (iAmp >= 0) {
482
+ if (left < iAmp) out += s.substring(left, iAmp);
483
+ out += "&amp;";
484
+ left = iAmp + 1;
485
+ iAmp = s.indexOf("&", left);
486
+ }
487
+ return left < s.length ? out + s.substring(left) : out;
488
+ }
489
+ function resolveSSRNode(node, top) {
490
+ const t = typeof node;
491
+ if (t === "string") return node;
492
+ if (node == null || t === "boolean") return "";
493
+ if (Array.isArray(node)) {
494
+ let prev = {};
495
+ let mapped = "";
496
+ for (let i = 0, len = node.length; i < len; i++) {
497
+ if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
498
+ mapped += resolveSSRNode(prev = node[i]);
499
+ }
500
+ return mapped;
501
+ }
502
+ if (t === "object") return node.t;
503
+ if (t === "function") return resolveSSRNode(node());
504
+ return String(node);
505
+ }
506
+ function getHydrationKey() {
507
+ const hydrate = solidJs.sharedConfig.context;
508
+ return hydrate && !hydrate.noHydrate && solidJs.sharedConfig.getNextContextId();
509
+ }
510
+ function useAssets(fn) {
511
+ solidJs.sharedConfig.context.assets.push(() => resolveSSRNode(escape(fn())));
512
+ }
513
+ function getAssets() {
514
+ const assets = solidJs.sharedConfig.context.assets;
515
+ let out = "";
516
+ for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
517
+ return out;
518
+ }
519
+ function generateHydrationScript({
520
+ eventNames = ["click", "input"],
521
+ nonce
522
+ } = {}) {
523
+ 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-->`;
524
+ }
525
+ function Hydration(props) {
526
+ if (!solidJs.sharedConfig.context.noHydrate) return props.children;
527
+ const context = solidJs.sharedConfig.context;
528
+ solidJs.sharedConfig.context = {
529
+ ...context,
530
+ count: 0,
531
+ id: solidJs.sharedConfig.getNextContextId(),
532
+ noHydrate: false
533
+ };
534
+ const res = props.children;
535
+ solidJs.sharedConfig.context = context;
536
+ return res;
537
+ }
538
+ function NoHydration(props) {
539
+ if (solidJs.sharedConfig.context) solidJs.sharedConfig.context.noHydrate = true;
540
+ return props.children;
541
+ }
542
+ function queue(fn) {
543
+ return Promise.resolve().then(fn);
544
+ }
545
+ function allSettled(promises) {
546
+ let length = promises.length;
547
+ return Promise.allSettled(promises).then(() => {
548
+ if (promises.length !== length) return allSettled(promises);
549
+ return;
550
+ });
551
+ }
552
+ function injectAssets(assets, html) {
553
+ if (!assets || !assets.length) return html;
554
+ let out = "";
555
+ for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
556
+ const index = html.indexOf("</head>");
557
+ if (index === -1) return html;
558
+ return html.slice(0, index) + out + html.slice(index);
559
+ }
560
+ function injectScripts(html, scripts, nonce) {
561
+ const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
562
+ const index = html.indexOf("<!--xs-->");
563
+ if (index > -1) {
564
+ return html.slice(0, index) + tag + html.slice(index);
565
+ }
566
+ return html + tag;
567
+ }
568
+ function waitForFragments(registry, key) {
569
+ for (const k of [...registry.keys()].reverse()) {
570
+ if (key.startsWith(k)) return true;
571
+ }
572
+ return false;
573
+ }
574
+ function replacePlaceholder(html, key, value) {
575
+ const marker = `<template id="pl-${key}">`;
576
+ const close = `<!--pl-${key}-->`;
577
+ const first = html.indexOf(marker);
578
+ if (first === -1) return html;
579
+ const last = html.indexOf(close, first + marker.length);
580
+ return html.slice(0, first) + value + html.slice(last + close.length);
581
+ }
582
+ const RequestContext = Symbol();
583
+ function getRequestEvent() {
584
+ 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;
585
+ }
586
+ function Assets(props) {
587
+ useAssets(() => props.children);
588
+ }
589
+ function notSup() {
590
+ 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>.");
591
+ }
592
+
593
+ const isServer = true;
594
+ const isDev = false;
595
+ function Dynamic(props) {
596
+ const [p, others] = solidJs.splitProps(props, ["component"]);
597
+ const comp = p.component,
598
+ t = typeof comp;
599
+ if (comp) {
600
+ if (t === "function") return comp(others);else if (t === "string") {
601
+ return ssrElement(comp, others, undefined, true);
602
+ }
603
+ }
604
+ }
605
+ function Portal(props) {
606
+ return "";
607
+ }
608
+
609
+ Object.defineProperty(exports, "ErrorBoundary", {
610
+ enumerable: true,
611
+ get: function () { return solidJs.ErrorBoundary; }
612
+ });
613
+ Object.defineProperty(exports, "For", {
614
+ enumerable: true,
615
+ get: function () { return solidJs.For; }
616
+ });
617
+ Object.defineProperty(exports, "Index", {
618
+ enumerable: true,
619
+ get: function () { return solidJs.Index; }
620
+ });
621
+ Object.defineProperty(exports, "Match", {
622
+ enumerable: true,
623
+ get: function () { return solidJs.Match; }
624
+ });
625
+ Object.defineProperty(exports, "Show", {
626
+ enumerable: true,
627
+ get: function () { return solidJs.Show; }
628
+ });
629
+ Object.defineProperty(exports, "Suspense", {
630
+ enumerable: true,
631
+ get: function () { return solidJs.Suspense; }
632
+ });
633
+ Object.defineProperty(exports, "SuspenseList", {
634
+ enumerable: true,
635
+ get: function () { return solidJs.SuspenseList; }
636
+ });
637
+ Object.defineProperty(exports, "Switch", {
638
+ enumerable: true,
639
+ get: function () { return solidJs.Switch; }
640
+ });
641
+ Object.defineProperty(exports, "createComponent", {
642
+ enumerable: true,
643
+ get: function () { return solidJs.createComponent; }
644
+ });
645
+ Object.defineProperty(exports, "effect", {
646
+ enumerable: true,
647
+ get: function () { return solidJs.createRenderEffect; }
648
+ });
649
+ Object.defineProperty(exports, "getOwner", {
650
+ enumerable: true,
651
+ get: function () { return solidJs.getOwner; }
652
+ });
653
+ Object.defineProperty(exports, "memo", {
654
+ enumerable: true,
655
+ get: function () { return solidJs.createMemo; }
656
+ });
657
+ Object.defineProperty(exports, "mergeProps", {
658
+ enumerable: true,
659
+ get: function () { return solidJs.mergeProps; }
660
+ });
661
+ Object.defineProperty(exports, "untrack", {
662
+ enumerable: true,
663
+ get: function () { return solidJs.untrack; }
664
+ });
665
+ exports.Assets = Assets;
666
+ exports.ChildProperties = ChildProperties;
667
+ exports.DOMElements = DOMElements;
668
+ exports.DelegatedEvents = DelegatedEvents;
669
+ exports.Dynamic = Dynamic;
670
+ exports.Hydration = Hydration;
671
+ exports.HydrationScript = HydrationScript;
672
+ exports.NoHydration = NoHydration;
673
+ exports.Portal = Portal;
674
+ exports.Properties = Properties;
675
+ exports.RequestContext = RequestContext;
676
+ exports.SVGElements = SVGElements;
677
+ exports.SVGNamespace = SVGNamespace;
678
+ exports.addEventListener = notSup;
679
+ exports.assign = notSup;
680
+ exports.className = notSup;
681
+ exports.delegateEvents = notSup;
682
+ exports.dynamicProperty = notSup;
683
+ exports.escape = escape;
684
+ exports.generateHydrationScript = generateHydrationScript;
685
+ exports.getAssets = getAssets;
686
+ exports.getHydrationKey = getHydrationKey;
687
+ exports.getNextElement = notSup;
688
+ exports.getNextMarker = notSup;
689
+ exports.getNextMatch = notSup;
690
+ exports.getPropAlias = getPropAlias;
691
+ exports.getRequestEvent = getRequestEvent;
692
+ exports.hydrate = notSup;
693
+ exports.insert = notSup;
694
+ exports.isDev = isDev;
695
+ exports.isServer = isServer;
696
+ exports.render = notSup;
697
+ exports.renderToStream = renderToStream;
698
+ exports.renderToString = renderToString;
699
+ exports.renderToStringAsync = renderToStringAsync;
700
+ exports.resolveSSRNode = resolveSSRNode;
701
+ exports.runHydrationEvents = notSup;
702
+ exports.setAttribute = notSup;
703
+ exports.setAttributeNS = notSup;
704
+ exports.setProperty = notSup;
705
+ exports.spread = notSup;
706
+ exports.ssr = ssr;
707
+ exports.ssrAttribute = ssrAttribute;
708
+ exports.ssrClassName = ssrClassName;
709
+ exports.ssrElement = ssrElement;
710
+ exports.ssrHydrationKey = ssrHydrationKey;
711
+ exports.ssrStyle = ssrStyle;
712
+ exports.style = notSup;
713
+ exports.template = notSup;
714
+ exports.useAssets = useAssets;