@solidjs/web 2.0.0-experimental.0 → 2.0.0-experimental.1

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
@@ -1,78 +1,13 @@
1
- import { sharedConfig, createRoot, splitProps } from "solid-js";
2
- export {
3
- ErrorBoundary,
4
- For,
5
- Index,
6
- Match,
7
- Show,
8
- Suspense,
9
- SuspenseList,
10
- Switch,
11
- createComponent,
12
- createRenderEffect as effect,
13
- getOwner,
14
- createMemo as memo,
15
- mergeProps,
16
- untrack
17
- } from "solid-js";
18
- import { Feature, Serializer, getCrossReferenceHeader } from "seroval";
19
- import {
20
- CustomEventPlugin,
21
- DOMExceptionPlugin,
22
- EventPlugin,
23
- FormDataPlugin,
24
- HeadersPlugin,
25
- ReadableStreamPlugin,
26
- RequestPlugin,
27
- ResponsePlugin,
28
- URLSearchParamsPlugin,
29
- URLPlugin
30
- } from "seroval-plugins/web";
1
+ import { sharedConfig, createRoot, splitProps } from 'solid-js';
2
+ export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
3
+ import { Feature, Serializer, getCrossReferenceHeader } from 'seroval';
4
+ import { CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
31
5
 
32
- const booleans = [
33
- "allowfullscreen",
34
- "async",
35
- "autofocus",
36
- "autoplay",
37
- "checked",
38
- "controls",
39
- "default",
40
- "disabled",
41
- "formnovalidate",
42
- "hidden",
43
- "indeterminate",
44
- "inert",
45
- "ismap",
46
- "loop",
47
- "multiple",
48
- "muted",
49
- "nomodule",
50
- "novalidate",
51
- "open",
52
- "playsinline",
53
- "readonly",
54
- "required",
55
- "reversed",
56
- "seamless",
57
- "selected"
58
- ];
59
- const BooleanAttributes = /*#__PURE__*/ new Set(booleans);
60
- const Properties = /*#__PURE__*/ new Set([
61
- "value",
62
- "readOnly",
63
- "formNoValidate",
64
- "isMap",
65
- "noModule",
66
- "playsInline",
67
- ...booleans
68
- ]);
69
- const ChildProperties = /*#__PURE__*/ new Set([
70
- "innerHTML",
71
- "textContent",
72
- "innerText",
73
- "children"
74
- ]);
75
- const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
6
+ 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"];
7
+ const BooleanAttributes = /*#__PURE__*/new Set(booleans);
8
+ const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
9
+ const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
10
+ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
76
11
  class: "className",
77
12
  formnovalidate: {
78
13
  $: "formNoValidate",
@@ -99,414 +34,34 @@ const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
99
34
  });
100
35
  function getPropAlias(prop, tagName) {
101
36
  const a = PropAliases[prop];
102
- return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
103
- }
104
- const DelegatedEvents = /*#__PURE__*/ new Set([
105
- "beforeinput",
106
- "click",
107
- "dblclick",
108
- "contextmenu",
109
- "focusin",
110
- "focusout",
111
- "input",
112
- "keydown",
113
- "keyup",
114
- "mousedown",
115
- "mousemove",
116
- "mouseout",
117
- "mouseover",
118
- "mouseup",
119
- "pointerdown",
120
- "pointermove",
121
- "pointerout",
122
- "pointerover",
123
- "pointerup",
124
- "touchend",
125
- "touchmove",
126
- "touchstart"
127
- ]);
128
- const SVGElements = /*#__PURE__*/ new Set([
129
- "altGlyph",
130
- "altGlyphDef",
131
- "altGlyphItem",
132
- "animate",
133
- "animateColor",
134
- "animateMotion",
135
- "animateTransform",
136
- "circle",
137
- "clipPath",
138
- "color-profile",
139
- "cursor",
140
- "defs",
141
- "desc",
142
- "ellipse",
143
- "feBlend",
144
- "feColorMatrix",
145
- "feComponentTransfer",
146
- "feComposite",
147
- "feConvolveMatrix",
148
- "feDiffuseLighting",
149
- "feDisplacementMap",
150
- "feDistantLight",
151
- "feDropShadow",
152
- "feFlood",
153
- "feFuncA",
154
- "feFuncB",
155
- "feFuncG",
156
- "feFuncR",
157
- "feGaussianBlur",
158
- "feImage",
159
- "feMerge",
160
- "feMergeNode",
161
- "feMorphology",
162
- "feOffset",
163
- "fePointLight",
164
- "feSpecularLighting",
165
- "feSpotLight",
166
- "feTile",
167
- "feTurbulence",
168
- "filter",
169
- "font",
170
- "font-face",
171
- "font-face-format",
172
- "font-face-name",
173
- "font-face-src",
174
- "font-face-uri",
175
- "foreignObject",
176
- "g",
177
- "glyph",
178
- "glyphRef",
179
- "hkern",
180
- "image",
181
- "line",
182
- "linearGradient",
183
- "marker",
184
- "mask",
185
- "metadata",
186
- "missing-glyph",
187
- "mpath",
188
- "path",
189
- "pattern",
190
- "polygon",
191
- "polyline",
192
- "radialGradient",
193
- "rect",
194
- "set",
195
- "stop",
196
- "svg",
197
- "switch",
198
- "symbol",
199
- "text",
200
- "textPath",
201
- "tref",
202
- "tspan",
203
- "use",
204
- "view",
205
- "vkern"
206
- ]);
37
+ return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
38
+ }
39
+ 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"]);
40
+ const SVGElements = /*#__PURE__*/new Set([
41
+ "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",
42
+ "set", "stop",
43
+ "svg", "switch", "symbol", "text", "textPath",
44
+ "tref", "tspan", "use", "view", "vkern"]);
207
45
  const SVGNamespace = {
208
46
  xlink: "http://www.w3.org/1999/xlink",
209
47
  xml: "http://www.w3.org/XML/1998/namespace"
210
48
  };
211
- const DOMElements = /*#__PURE__*/ new Set([
212
- "html",
213
- "base",
214
- "head",
215
- "link",
216
- "meta",
217
- "style",
218
- "title",
219
- "body",
220
- "address",
221
- "article",
222
- "aside",
223
- "footer",
224
- "header",
225
- "main",
226
- "nav",
227
- "section",
228
- "body",
229
- "blockquote",
230
- "dd",
231
- "div",
232
- "dl",
233
- "dt",
234
- "figcaption",
235
- "figure",
236
- "hr",
237
- "li",
238
- "ol",
239
- "p",
240
- "pre",
241
- "ul",
242
- "a",
243
- "abbr",
244
- "b",
245
- "bdi",
246
- "bdo",
247
- "br",
248
- "cite",
249
- "code",
250
- "data",
251
- "dfn",
252
- "em",
253
- "i",
254
- "kbd",
255
- "mark",
256
- "q",
257
- "rp",
258
- "rt",
259
- "ruby",
260
- "s",
261
- "samp",
262
- "small",
263
- "span",
264
- "strong",
265
- "sub",
266
- "sup",
267
- "time",
268
- "u",
269
- "var",
270
- "wbr",
271
- "area",
272
- "audio",
273
- "img",
274
- "map",
275
- "track",
276
- "video",
277
- "embed",
278
- "iframe",
279
- "object",
280
- "param",
281
- "picture",
282
- "portal",
283
- "source",
284
- "svg",
285
- "math",
286
- "canvas",
287
- "noscript",
288
- "script",
289
- "del",
290
- "ins",
291
- "caption",
292
- "col",
293
- "colgroup",
294
- "table",
295
- "tbody",
296
- "td",
297
- "tfoot",
298
- "th",
299
- "thead",
300
- "tr",
301
- "button",
302
- "datalist",
303
- "fieldset",
304
- "form",
305
- "input",
306
- "label",
307
- "legend",
308
- "meter",
309
- "optgroup",
310
- "option",
311
- "output",
312
- "progress",
313
- "select",
314
- "textarea",
315
- "details",
316
- "dialog",
317
- "menu",
318
- "summary",
319
- "details",
320
- "slot",
321
- "template",
322
- "acronym",
323
- "applet",
324
- "basefont",
325
- "bgsound",
326
- "big",
327
- "blink",
328
- "center",
329
- "content",
330
- "dir",
331
- "font",
332
- "frame",
333
- "frameset",
334
- "hgroup",
335
- "image",
336
- "keygen",
337
- "marquee",
338
- "menuitem",
339
- "nobr",
340
- "noembed",
341
- "noframes",
342
- "plaintext",
343
- "rb",
344
- "rtc",
345
- "shadow",
346
- "spacer",
347
- "strike",
348
- "tt",
349
- "xmp",
350
- "a",
351
- "abbr",
352
- "acronym",
353
- "address",
354
- "applet",
355
- "area",
356
- "article",
357
- "aside",
358
- "audio",
359
- "b",
360
- "base",
361
- "basefont",
362
- "bdi",
363
- "bdo",
364
- "bgsound",
365
- "big",
366
- "blink",
367
- "blockquote",
368
- "body",
369
- "br",
370
- "button",
371
- "canvas",
372
- "caption",
373
- "center",
374
- "cite",
375
- "code",
376
- "col",
377
- "colgroup",
378
- "content",
379
- "data",
380
- "datalist",
381
- "dd",
382
- "del",
383
- "details",
384
- "dfn",
385
- "dialog",
386
- "dir",
387
- "div",
388
- "dl",
389
- "dt",
390
- "em",
391
- "embed",
392
- "fieldset",
393
- "figcaption",
394
- "figure",
395
- "font",
396
- "footer",
397
- "form",
398
- "frame",
399
- "frameset",
400
- "head",
401
- "header",
402
- "hgroup",
403
- "hr",
404
- "html",
405
- "i",
406
- "iframe",
407
- "image",
408
- "img",
409
- "input",
410
- "ins",
411
- "kbd",
412
- "keygen",
413
- "label",
414
- "legend",
415
- "li",
416
- "link",
417
- "main",
418
- "map",
419
- "mark",
420
- "marquee",
421
- "menu",
422
- "menuitem",
423
- "meta",
424
- "meter",
425
- "nav",
426
- "nobr",
427
- "noembed",
428
- "noframes",
429
- "noscript",
430
- "object",
431
- "ol",
432
- "optgroup",
433
- "option",
434
- "output",
435
- "p",
436
- "param",
437
- "picture",
438
- "plaintext",
439
- "portal",
440
- "pre",
441
- "progress",
442
- "q",
443
- "rb",
444
- "rp",
445
- "rt",
446
- "rtc",
447
- "ruby",
448
- "s",
449
- "samp",
450
- "script",
451
- "section",
452
- "select",
453
- "shadow",
454
- "slot",
455
- "small",
456
- "source",
457
- "spacer",
458
- "span",
459
- "strike",
460
- "strong",
461
- "style",
462
- "sub",
463
- "summary",
464
- "sup",
465
- "table",
466
- "tbody",
467
- "td",
468
- "template",
469
- "textarea",
470
- "tfoot",
471
- "th",
472
- "thead",
473
- "time",
474
- "title",
475
- "tr",
476
- "track",
477
- "tt",
478
- "u",
479
- "ul",
480
- "var",
481
- "video",
482
- "wbr",
483
- "xmp",
484
- "input",
485
- "h1",
486
- "h2",
487
- "h3",
488
- "h4",
489
- "h5",
490
- "h6"
491
- ]);
49
+ 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"]);
492
50
 
493
- const ES2017FLAG = Feature.AggregateError | Feature.BigIntTypedArray;
494
- const GLOBAL_IDENTIFIER = "_$HY.r";
495
- function createSerializer({ onData, onDone, scopeId, onError }) {
51
+ const ES2017FLAG = Feature.AggregateError
52
+ | Feature.BigIntTypedArray;
53
+ const GLOBAL_IDENTIFIER = '_$HY.r';
54
+ function createSerializer({
55
+ onData,
56
+ onDone,
57
+ scopeId,
58
+ onError
59
+ }) {
496
60
  return new Serializer({
497
61
  scopeId,
498
62
  plugins: [
499
- CustomEventPlugin,
500
- DOMExceptionPlugin,
501
- EventPlugin,
502
- FormDataPlugin,
503
- HeadersPlugin,
504
- ReadableStreamPlugin,
505
- RequestPlugin,
506
- ResponsePlugin,
507
- URLSearchParamsPlugin,
508
- URLPlugin
509
- ],
63
+ CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
64
+ FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin],
510
65
  globalIdentifier: GLOBAL_IDENTIFIER,
511
66
  disabledFeatures: ES2017FLAG,
512
67
  onData,
@@ -515,14 +70,15 @@ function createSerializer({ onData, onDone, scopeId, onError }) {
515
70
  });
516
71
  }
517
72
  function getLocalHeaderScript(id) {
518
- return getCrossReferenceHeader(id) + ";";
73
+ return getCrossReferenceHeader(id) + ';';
519
74
  }
520
75
 
521
- const VOID_ELEMENTS =
522
- /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
76
+ const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
523
77
  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)}`;
524
78
  function renderToString(code, options = {}) {
525
- const { renderId } = options;
79
+ const {
80
+ renderId
81
+ } = options;
526
82
  let scripts = "";
527
83
  const serializer = createSerializer({
528
84
  scopeId: renderId,
@@ -560,7 +116,9 @@ function renderToString(code, options = {}) {
560
116
  return html;
561
117
  }
562
118
  function renderToStringAsync(code, options = {}) {
563
- const { timeoutMs = 30000 } = options;
119
+ const {
120
+ timeoutMs = 30000
121
+ } = options;
564
122
  let timeoutHandle;
565
123
  const timeout = new Promise((_, reject) => {
566
124
  timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
@@ -571,7 +129,13 @@ function renderToStringAsync(code, options = {}) {
571
129
  });
572
130
  }
573
131
  function renderToStream(code, options = {}) {
574
- let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
132
+ let {
133
+ nonce,
134
+ onCompleteShell,
135
+ onCompleteAll,
136
+ renderId,
137
+ noScripts
138
+ } = options;
575
139
  let dispose;
576
140
  const blockingPromises = [];
577
141
  const pushTask = task => {
@@ -587,12 +151,11 @@ function renderToStream(code, options = {}) {
587
151
  const onDone = () => {
588
152
  writeTasks();
589
153
  doShell();
590
- onCompleteAll &&
591
- onCompleteAll({
592
- write(v) {
593
- !completed && buffer.write(v);
594
- }
595
- });
154
+ onCompleteAll && onCompleteAll({
155
+ write(v) {
156
+ !completed && buffer.write(v);
157
+ }
158
+ });
596
159
  writable && writable.end();
597
160
  completed = true;
598
161
  if (firstFlushed) dispose();
@@ -649,23 +212,17 @@ function renderToStream(code, options = {}) {
649
212
  const first = html.indexOf(placeholder);
650
213
  if (first === -1) return;
651
214
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
652
- html =
653
- html.slice(0, first) +
654
- resolveSSRNode(escape(payloadFn())) +
655
- html.slice(last + placeholder.length + 1);
215
+ html = html.slice(0, first) + resolveSSRNode(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
656
216
  },
657
217
  serialize(id, p, wait) {
658
218
  const serverOnly = sharedConfig.context.noHydrate;
659
219
  if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
660
220
  blockingPromises.push(p);
661
- !serverOnly &&
662
- p
663
- .then(d => {
664
- serializer.write(id, d);
665
- })
666
- .catch(e => {
667
- serializer.write(id, e);
668
- });
221
+ !serverOnly && p.then(d => {
222
+ serializer.write(id, d);
223
+ }).catch(e => {
224
+ serializer.write(id, e);
225
+ });
669
226
  } else if (!serverOnly) serializer.write(id, p);
670
227
  },
671
228
  roots: 0,
@@ -675,15 +232,11 @@ function renderToStream(code, options = {}) {
675
232
  registerFragment(key) {
676
233
  if (!registry.has(key)) {
677
234
  let resolve, reject;
678
- const p = new Promise((r, rej) => ((resolve = r), (reject = rej)));
679
- registry.set(key, err =>
680
- queue(() =>
681
- queue(() => {
682
- err ? reject(err) : resolve(true);
683
- queue(flushEnd);
684
- })
685
- )
686
- );
235
+ const p = new Promise((r, rej) => (resolve = r, reject = rej));
236
+ registry.set(key, err => queue(() => queue(() => {
237
+ err ? reject(err) : resolve(true);
238
+ queue(flushEnd);
239
+ })));
687
240
  serializer.write(key, p);
688
241
  }
689
242
  return (value, error) => {
@@ -696,7 +249,7 @@ function renderToStream(code, options = {}) {
696
249
  }
697
250
  if (!completed) {
698
251
  if (!firstFlushed) {
699
- queue(() => (html = replacePlaceholder(html, key, value !== undefined ? value : "")));
252
+ queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
700
253
  resolve(error);
701
254
  } else {
702
255
  buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
@@ -722,12 +275,11 @@ function renderToStream(code, options = {}) {
722
275
  if (tasks.length) html = injectScripts(html, tasks, nonce);
723
276
  buffer.write(html);
724
277
  tasks = "";
725
- onCompleteShell &&
726
- onCompleteShell({
727
- write(v) {
728
- !completed && buffer.write(v);
729
- }
730
- });
278
+ onCompleteShell && onCompleteShell({
279
+ write(v) {
280
+ !completed && buffer.write(v);
281
+ }
282
+ });
731
283
  shellCompleted = true;
732
284
  }
733
285
  return {
@@ -762,7 +314,7 @@ function renderToStream(code, options = {}) {
762
314
  pipeTo(w) {
763
315
  return allSettled(blockingPromises).then(() => {
764
316
  let resolve;
765
- const p = new Promise(r => (resolve = r));
317
+ const p = new Promise(r => resolve = r);
766
318
  setTimeout(() => {
767
319
  doShell();
768
320
  const encoder = new TextEncoder();
@@ -792,13 +344,13 @@ function renderToStream(code, options = {}) {
792
344
  };
793
345
  }
794
346
  function HydrationScript(props) {
795
- const { nonce } = sharedConfig.context;
796
- return ssr(
797
- generateHydrationScript({
798
- nonce,
799
- ...props
800
- })
801
- );
347
+ const {
348
+ nonce
349
+ } = sharedConfig.context;
350
+ return ssr(generateHydrationScript({
351
+ nonce,
352
+ ...props
353
+ }));
802
354
  }
803
355
  function ssr(t, ...nodes) {
804
356
  if (nodes.length) {
@@ -843,16 +395,14 @@ function ssrStyle(value) {
843
395
  return result;
844
396
  }
845
397
  function ssrElement(tag, props, children, needsId) {
846
- if (props == null) props = {};
847
- else if (typeof props === "function") props = props();
398
+ if (props == null) props = {};else if (typeof props === "function") props = props();
848
399
  const skipChildren = VOID_ELEMENTS.test(tag);
849
400
  const keys = Object.keys(props);
850
401
  let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
851
402
  for (let i = 0; i < keys.length; i++) {
852
403
  const prop = keys[i];
853
404
  if (ChildProperties.has(prop)) {
854
- if (children === undefined && !skipChildren)
855
- children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
405
+ if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
856
406
  continue;
857
407
  }
858
408
  const value = props[prop];
@@ -861,14 +411,8 @@ function ssrElement(tag, props, children, needsId) {
861
411
  } else if (prop === "class") {
862
412
  result += `class="${ssrClassName(value)}"`;
863
413
  } else if (BooleanAttributes.has(prop)) {
864
- if (value) result += prop;
865
- else continue;
866
- } else if (
867
- value == undefined ||
868
- prop === "ref" ||
869
- prop.slice(0, 2) === "on" ||
870
- prop.slice(0, 5) === "prop:"
871
- ) {
414
+ if (value) result += prop;else continue;
415
+ } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
872
416
  continue;
873
417
  } else if (prop.slice(0, 5) === "bool:") {
874
418
  if (!value) continue;
@@ -880,17 +424,16 @@ function ssrElement(tag, props, children, needsId) {
880
424
  }
881
425
  if (i !== keys.length - 1) result += " ";
882
426
  }
883
- if (skipChildren)
884
- return {
885
- t: result + "/>"
886
- };
427
+ if (skipChildren) return {
428
+ t: result + "/>"
429
+ };
887
430
  if (typeof children === "function") children = children();
888
431
  return {
889
432
  t: result + `>${resolveSSRNode(children, true)}</${tag}>`
890
433
  };
891
434
  }
892
435
  function ssrAttribute(key, value, isBoolean) {
893
- return isBoolean ? (value ? " " + key : "") : value != null ? ` ${key}="${value}"` : "";
436
+ return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
894
437
  }
895
438
  function ssrHydrationKey() {
896
439
  const hk = getHydrationKey();
@@ -934,13 +477,12 @@ function escape(s, attr) {
934
477
  left = iDelim + 1;
935
478
  iDelim = s.indexOf(delim, left);
936
479
  } while (iDelim >= 0);
937
- } else
938
- while (iAmp >= 0) {
939
- if (left < iAmp) out += s.substring(left, iAmp);
940
- out += "&amp;";
941
- left = iAmp + 1;
942
- iAmp = s.indexOf("&", left);
943
- }
480
+ } else while (iAmp >= 0) {
481
+ if (left < iAmp) out += s.substring(left, iAmp);
482
+ out += "&amp;";
483
+ left = iAmp + 1;
484
+ iAmp = s.indexOf("&", left);
485
+ }
944
486
  return left < s.length ? out + s.substring(left) : out;
945
487
  }
946
488
  function resolveSSRNode(node, top) {
@@ -952,7 +494,7 @@ function resolveSSRNode(node, top) {
952
494
  let mapped = "";
953
495
  for (let i = 0, len = node.length; i < len; i++) {
954
496
  if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
955
- mapped += resolveSSRNode((prev = node[i]));
497
+ mapped += resolveSSRNode(prev = node[i]);
956
498
  }
957
499
  return mapped;
958
500
  }
@@ -973,12 +515,11 @@ function getAssets() {
973
515
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
974
516
  return out;
975
517
  }
976
- function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
977
- return `<script${
978
- nonce ? ` nonce="${nonce}"` : ""
979
- }>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(
980
- '", "'
981
- )}"].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-->`;
518
+ function generateHydrationScript({
519
+ eventNames = ["click", "input"],
520
+ nonce
521
+ } = {}) {
522
+ 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-->`;
982
523
  }
983
524
  function Hydration(props) {
984
525
  if (!sharedConfig.context.noHydrate) return props.children;
@@ -1039,21 +580,13 @@ function replacePlaceholder(html, key, value) {
1039
580
  }
1040
581
  const RequestContext = Symbol();
1041
582
  function getRequestEvent() {
1042
- return globalThis[RequestContext]
1043
- ? globalThis[RequestContext].getStore() ||
1044
- (sharedConfig.context && sharedConfig.context.event) ||
1045
- console.log(
1046
- "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."
1047
- )
1048
- : undefined;
583
+ return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && 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;
1049
584
  }
1050
585
  function Assets(props) {
1051
586
  useAssets(() => props.children);
1052
587
  }
1053
588
  function notSup() {
1054
- throw new Error(
1055
- "Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
1056
- );
589
+ 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>.");
1057
590
  }
1058
591
 
1059
592
  const isServer = true;
@@ -1063,8 +596,7 @@ function Dynamic(props) {
1063
596
  const comp = p.component,
1064
597
  t = typeof comp;
1065
598
  if (comp) {
1066
- if (t === "function") return comp(others);
1067
- else if (t === "string") {
599
+ if (t === "function") return comp(others);else if (t === "string") {
1068
600
  return ssrElement(comp, others, undefined, true);
1069
601
  }
1070
602
  }
@@ -1073,55 +605,4 @@ function Portal(props) {
1073
605
  return "";
1074
606
  }
1075
607
 
1076
- export {
1077
- Assets,
1078
- ChildProperties,
1079
- DOMElements,
1080
- DelegatedEvents,
1081
- Dynamic,
1082
- Hydration,
1083
- HydrationScript,
1084
- NoHydration,
1085
- Portal,
1086
- Properties,
1087
- RequestContext,
1088
- SVGElements,
1089
- SVGNamespace,
1090
- notSup as addEventListener,
1091
- notSup as assign,
1092
- notSup as className,
1093
- notSup as delegateEvents,
1094
- notSup as dynamicProperty,
1095
- escape,
1096
- generateHydrationScript,
1097
- getAssets,
1098
- getHydrationKey,
1099
- notSup as getNextElement,
1100
- notSup as getNextMarker,
1101
- notSup as getNextMatch,
1102
- getPropAlias,
1103
- getRequestEvent,
1104
- notSup as hydrate,
1105
- notSup as insert,
1106
- isDev,
1107
- isServer,
1108
- notSup as render,
1109
- renderToStream,
1110
- renderToString,
1111
- renderToStringAsync,
1112
- resolveSSRNode,
1113
- notSup as runHydrationEvents,
1114
- notSup as setAttribute,
1115
- notSup as setAttributeNS,
1116
- notSup as setProperty,
1117
- notSup as spread,
1118
- ssr,
1119
- ssrAttribute,
1120
- ssrClassName,
1121
- ssrElement,
1122
- ssrHydrationKey,
1123
- ssrStyle,
1124
- notSup as style,
1125
- notSup as template,
1126
- useAssets
1127
- };
608
+ export { Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as className, notSup as delegateEvents, notSup as dynamicProperty, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getPropAlias, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, notSup as render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, notSup as style, notSup as template, useAssets };