solid-js 1.9.2 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/dev.cjs +5 -5
  2. package/dist/dev.js +563 -322
  3. package/dist/server.cjs +50 -10
  4. package/dist/server.js +220 -83
  5. package/dist/solid.cjs +5 -5
  6. package/dist/solid.js +490 -280
  7. package/h/dist/h.js +40 -9
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +11 -8
  10. package/h/jsx-runtime/types/jsx.d.ts +93 -91
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/html/dist/html.js +219 -94
  13. package/html/types/lit.d.ts +52 -33
  14. package/package.json +1 -1
  15. package/store/dist/dev.cjs +1 -1
  16. package/store/dist/dev.js +123 -43
  17. package/store/dist/server.js +20 -8
  18. package/store/dist/store.cjs +1 -1
  19. package/store/dist/store.js +114 -40
  20. package/store/types/index.d.ts +21 -7
  21. package/store/types/modifiers.d.ts +6 -3
  22. package/store/types/mutable.d.ts +5 -2
  23. package/store/types/server.d.ts +25 -5
  24. package/store/types/store.d.ts +218 -61
  25. package/types/index.d.ts +75 -10
  26. package/types/jsx.d.ts +143 -157
  27. package/types/reactive/array.d.ts +12 -4
  28. package/types/reactive/observable.d.ts +25 -17
  29. package/types/reactive/scheduler.d.ts +9 -6
  30. package/types/reactive/signal.d.ts +233 -142
  31. package/types/render/Suspense.d.ts +5 -5
  32. package/types/render/component.d.ts +71 -35
  33. package/types/render/flow.d.ts +43 -31
  34. package/types/render/hydration.d.ts +15 -15
  35. package/types/server/index.d.ts +57 -2
  36. package/types/server/reactive.d.ts +73 -42
  37. package/types/server/rendering.d.ts +169 -98
  38. package/universal/dist/dev.js +28 -12
  39. package/universal/dist/universal.js +28 -12
  40. package/universal/types/index.d.ts +3 -1
  41. package/universal/types/universal.d.ts +0 -1
  42. package/web/dist/dev.js +639 -89
  43. package/web/dist/server.cjs +18 -13
  44. package/web/dist/server.js +657 -120
  45. package/web/dist/web.js +627 -87
  46. package/web/storage/dist/storage.js +3 -3
  47. package/web/types/client.d.ts +1 -1
  48. package/web/types/core.d.ts +10 -1
  49. package/web/types/index.d.ts +27 -10
  50. package/web/types/server-mock.d.ts +47 -32
  51. package/web/types/server.d.ts +1 -1
  52. package/web/storage/types/index.js +0 -13
@@ -1,17 +1,83 @@
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';
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";
5
31
 
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(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
9
- const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
10
- const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
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
+ "className",
62
+ "value",
63
+ "readOnly",
64
+ "formNoValidate",
65
+ "isMap",
66
+ "noModule",
67
+ "playsInline",
68
+ ...booleans
69
+ ]);
70
+ const ChildProperties = /*#__PURE__*/ new Set([
71
+ "innerHTML",
72
+ "textContent",
73
+ "innerText",
74
+ "children"
75
+ ]);
76
+ const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
11
77
  className: "class",
12
78
  htmlFor: "for"
13
79
  });
14
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
80
+ const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
15
81
  class: "className",
16
82
  formnovalidate: {
17
83
  $: "formNoValidate",
@@ -38,34 +104,414 @@ const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
38
104
  });
39
105
  function getPropAlias(prop, tagName) {
40
106
  const a = PropAliases[prop];
41
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
42
- }
43
- 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"]);
44
- const SVGElements = /*#__PURE__*/new Set([
45
- "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",
46
- "set", "stop",
47
- "svg", "switch", "symbol", "text", "textPath",
48
- "tref", "tspan", "use", "view", "vkern"]);
107
+ return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
108
+ }
109
+ const DelegatedEvents = /*#__PURE__*/ new Set([
110
+ "beforeinput",
111
+ "click",
112
+ "dblclick",
113
+ "contextmenu",
114
+ "focusin",
115
+ "focusout",
116
+ "input",
117
+ "keydown",
118
+ "keyup",
119
+ "mousedown",
120
+ "mousemove",
121
+ "mouseout",
122
+ "mouseover",
123
+ "mouseup",
124
+ "pointerdown",
125
+ "pointermove",
126
+ "pointerout",
127
+ "pointerover",
128
+ "pointerup",
129
+ "touchend",
130
+ "touchmove",
131
+ "touchstart"
132
+ ]);
133
+ const SVGElements = /*#__PURE__*/ new Set([
134
+ "altGlyph",
135
+ "altGlyphDef",
136
+ "altGlyphItem",
137
+ "animate",
138
+ "animateColor",
139
+ "animateMotion",
140
+ "animateTransform",
141
+ "circle",
142
+ "clipPath",
143
+ "color-profile",
144
+ "cursor",
145
+ "defs",
146
+ "desc",
147
+ "ellipse",
148
+ "feBlend",
149
+ "feColorMatrix",
150
+ "feComponentTransfer",
151
+ "feComposite",
152
+ "feConvolveMatrix",
153
+ "feDiffuseLighting",
154
+ "feDisplacementMap",
155
+ "feDistantLight",
156
+ "feDropShadow",
157
+ "feFlood",
158
+ "feFuncA",
159
+ "feFuncB",
160
+ "feFuncG",
161
+ "feFuncR",
162
+ "feGaussianBlur",
163
+ "feImage",
164
+ "feMerge",
165
+ "feMergeNode",
166
+ "feMorphology",
167
+ "feOffset",
168
+ "fePointLight",
169
+ "feSpecularLighting",
170
+ "feSpotLight",
171
+ "feTile",
172
+ "feTurbulence",
173
+ "filter",
174
+ "font",
175
+ "font-face",
176
+ "font-face-format",
177
+ "font-face-name",
178
+ "font-face-src",
179
+ "font-face-uri",
180
+ "foreignObject",
181
+ "g",
182
+ "glyph",
183
+ "glyphRef",
184
+ "hkern",
185
+ "image",
186
+ "line",
187
+ "linearGradient",
188
+ "marker",
189
+ "mask",
190
+ "metadata",
191
+ "missing-glyph",
192
+ "mpath",
193
+ "path",
194
+ "pattern",
195
+ "polygon",
196
+ "polyline",
197
+ "radialGradient",
198
+ "rect",
199
+ "set",
200
+ "stop",
201
+ "svg",
202
+ "switch",
203
+ "symbol",
204
+ "text",
205
+ "textPath",
206
+ "tref",
207
+ "tspan",
208
+ "use",
209
+ "view",
210
+ "vkern"
211
+ ]);
49
212
  const SVGNamespace = {
50
213
  xlink: "http://www.w3.org/1999/xlink",
51
214
  xml: "http://www.w3.org/XML/1998/namespace"
52
215
  };
53
- 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"]);
216
+ const DOMElements = /*#__PURE__*/ new Set([
217
+ "html",
218
+ "base",
219
+ "head",
220
+ "link",
221
+ "meta",
222
+ "style",
223
+ "title",
224
+ "body",
225
+ "address",
226
+ "article",
227
+ "aside",
228
+ "footer",
229
+ "header",
230
+ "main",
231
+ "nav",
232
+ "section",
233
+ "body",
234
+ "blockquote",
235
+ "dd",
236
+ "div",
237
+ "dl",
238
+ "dt",
239
+ "figcaption",
240
+ "figure",
241
+ "hr",
242
+ "li",
243
+ "ol",
244
+ "p",
245
+ "pre",
246
+ "ul",
247
+ "a",
248
+ "abbr",
249
+ "b",
250
+ "bdi",
251
+ "bdo",
252
+ "br",
253
+ "cite",
254
+ "code",
255
+ "data",
256
+ "dfn",
257
+ "em",
258
+ "i",
259
+ "kbd",
260
+ "mark",
261
+ "q",
262
+ "rp",
263
+ "rt",
264
+ "ruby",
265
+ "s",
266
+ "samp",
267
+ "small",
268
+ "span",
269
+ "strong",
270
+ "sub",
271
+ "sup",
272
+ "time",
273
+ "u",
274
+ "var",
275
+ "wbr",
276
+ "area",
277
+ "audio",
278
+ "img",
279
+ "map",
280
+ "track",
281
+ "video",
282
+ "embed",
283
+ "iframe",
284
+ "object",
285
+ "param",
286
+ "picture",
287
+ "portal",
288
+ "source",
289
+ "svg",
290
+ "math",
291
+ "canvas",
292
+ "noscript",
293
+ "script",
294
+ "del",
295
+ "ins",
296
+ "caption",
297
+ "col",
298
+ "colgroup",
299
+ "table",
300
+ "tbody",
301
+ "td",
302
+ "tfoot",
303
+ "th",
304
+ "thead",
305
+ "tr",
306
+ "button",
307
+ "datalist",
308
+ "fieldset",
309
+ "form",
310
+ "input",
311
+ "label",
312
+ "legend",
313
+ "meter",
314
+ "optgroup",
315
+ "option",
316
+ "output",
317
+ "progress",
318
+ "select",
319
+ "textarea",
320
+ "details",
321
+ "dialog",
322
+ "menu",
323
+ "summary",
324
+ "details",
325
+ "slot",
326
+ "template",
327
+ "acronym",
328
+ "applet",
329
+ "basefont",
330
+ "bgsound",
331
+ "big",
332
+ "blink",
333
+ "center",
334
+ "content",
335
+ "dir",
336
+ "font",
337
+ "frame",
338
+ "frameset",
339
+ "hgroup",
340
+ "image",
341
+ "keygen",
342
+ "marquee",
343
+ "menuitem",
344
+ "nobr",
345
+ "noembed",
346
+ "noframes",
347
+ "plaintext",
348
+ "rb",
349
+ "rtc",
350
+ "shadow",
351
+ "spacer",
352
+ "strike",
353
+ "tt",
354
+ "xmp",
355
+ "a",
356
+ "abbr",
357
+ "acronym",
358
+ "address",
359
+ "applet",
360
+ "area",
361
+ "article",
362
+ "aside",
363
+ "audio",
364
+ "b",
365
+ "base",
366
+ "basefont",
367
+ "bdi",
368
+ "bdo",
369
+ "bgsound",
370
+ "big",
371
+ "blink",
372
+ "blockquote",
373
+ "body",
374
+ "br",
375
+ "button",
376
+ "canvas",
377
+ "caption",
378
+ "center",
379
+ "cite",
380
+ "code",
381
+ "col",
382
+ "colgroup",
383
+ "content",
384
+ "data",
385
+ "datalist",
386
+ "dd",
387
+ "del",
388
+ "details",
389
+ "dfn",
390
+ "dialog",
391
+ "dir",
392
+ "div",
393
+ "dl",
394
+ "dt",
395
+ "em",
396
+ "embed",
397
+ "fieldset",
398
+ "figcaption",
399
+ "figure",
400
+ "font",
401
+ "footer",
402
+ "form",
403
+ "frame",
404
+ "frameset",
405
+ "head",
406
+ "header",
407
+ "hgroup",
408
+ "hr",
409
+ "html",
410
+ "i",
411
+ "iframe",
412
+ "image",
413
+ "img",
414
+ "input",
415
+ "ins",
416
+ "kbd",
417
+ "keygen",
418
+ "label",
419
+ "legend",
420
+ "li",
421
+ "link",
422
+ "main",
423
+ "map",
424
+ "mark",
425
+ "marquee",
426
+ "menu",
427
+ "menuitem",
428
+ "meta",
429
+ "meter",
430
+ "nav",
431
+ "nobr",
432
+ "noembed",
433
+ "noframes",
434
+ "noscript",
435
+ "object",
436
+ "ol",
437
+ "optgroup",
438
+ "option",
439
+ "output",
440
+ "p",
441
+ "param",
442
+ "picture",
443
+ "plaintext",
444
+ "portal",
445
+ "pre",
446
+ "progress",
447
+ "q",
448
+ "rb",
449
+ "rp",
450
+ "rt",
451
+ "rtc",
452
+ "ruby",
453
+ "s",
454
+ "samp",
455
+ "script",
456
+ "section",
457
+ "select",
458
+ "shadow",
459
+ "slot",
460
+ "small",
461
+ "source",
462
+ "spacer",
463
+ "span",
464
+ "strike",
465
+ "strong",
466
+ "style",
467
+ "sub",
468
+ "summary",
469
+ "sup",
470
+ "table",
471
+ "tbody",
472
+ "td",
473
+ "template",
474
+ "textarea",
475
+ "tfoot",
476
+ "th",
477
+ "thead",
478
+ "time",
479
+ "title",
480
+ "tr",
481
+ "track",
482
+ "tt",
483
+ "u",
484
+ "ul",
485
+ "var",
486
+ "video",
487
+ "wbr",
488
+ "xmp",
489
+ "input",
490
+ "h1",
491
+ "h2",
492
+ "h3",
493
+ "h4",
494
+ "h5",
495
+ "h6"
496
+ ]);
54
497
 
55
- const ES2017FLAG = Feature.AggregateError
56
- | Feature.BigIntTypedArray;
57
- const GLOBAL_IDENTIFIER = '_$HY.r';
58
- function createSerializer({
59
- onData,
60
- onDone,
61
- scopeId,
62
- onError
63
- }) {
498
+ const ES2017FLAG = Feature.AggregateError | Feature.BigIntTypedArray;
499
+ const GLOBAL_IDENTIFIER = "_$HY.r";
500
+ function createSerializer({ onData, onDone, scopeId, onError }) {
64
501
  return new Serializer({
65
502
  scopeId,
66
503
  plugins: [
67
- CustomEventPlugin, DOMExceptionPlugin, EventPlugin,
68
- FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin],
504
+ CustomEventPlugin,
505
+ DOMExceptionPlugin,
506
+ EventPlugin,
507
+ FormDataPlugin,
508
+ HeadersPlugin,
509
+ ReadableStreamPlugin,
510
+ RequestPlugin,
511
+ ResponsePlugin,
512
+ URLSearchParamsPlugin,
513
+ URLPlugin
514
+ ],
69
515
  globalIdentifier: GLOBAL_IDENTIFIER,
70
516
  disabledFeatures: ES2017FLAG,
71
517
  onData,
@@ -74,15 +520,14 @@ function createSerializer({
74
520
  });
75
521
  }
76
522
  function getLocalHeaderScript(id) {
77
- return getCrossReferenceHeader(id) + ';';
523
+ return getCrossReferenceHeader(id) + ";";
78
524
  }
79
525
 
80
- const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
526
+ const VOID_ELEMENTS =
527
+ /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
81
528
  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)}`;
82
529
  function renderToString(code, options = {}) {
83
- const {
84
- renderId
85
- } = options;
530
+ const { renderId } = options;
86
531
  let scripts = "";
87
532
  const serializer = createSerializer({
88
533
  scopeId: renderId,
@@ -120,9 +565,7 @@ function renderToString(code, options = {}) {
120
565
  return html;
121
566
  }
122
567
  function renderToStringAsync(code, options = {}) {
123
- const {
124
- timeoutMs = 30000
125
- } = options;
568
+ const { timeoutMs = 30000 } = options;
126
569
  let timeoutHandle;
127
570
  const timeout = new Promise((_, reject) => {
128
571
  timeoutHandle = setTimeout(() => reject("renderToString timed out"), timeoutMs);
@@ -133,13 +576,7 @@ function renderToStringAsync(code, options = {}) {
133
576
  });
134
577
  }
135
578
  function renderToStream(code, options = {}) {
136
- let {
137
- nonce,
138
- onCompleteShell,
139
- onCompleteAll,
140
- renderId,
141
- noScripts
142
- } = options;
579
+ let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
143
580
  let dispose;
144
581
  const blockingPromises = [];
145
582
  const pushTask = task => {
@@ -155,11 +592,12 @@ function renderToStream(code, options = {}) {
155
592
  const onDone = () => {
156
593
  writeTasks();
157
594
  doShell();
158
- onCompleteAll && onCompleteAll({
159
- write(v) {
160
- !completed && buffer.write(v);
161
- }
162
- });
595
+ onCompleteAll &&
596
+ onCompleteAll({
597
+ write(v) {
598
+ !completed && buffer.write(v);
599
+ }
600
+ });
163
601
  writable && writable.end();
164
602
  completed = true;
165
603
  if (firstFlushed) dispose();
@@ -216,17 +654,23 @@ function renderToStream(code, options = {}) {
216
654
  const first = html.indexOf(placeholder);
217
655
  if (first === -1) return;
218
656
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
219
- html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
657
+ html =
658
+ html.slice(0, first) +
659
+ resolveSSRNode(escape(payloadFn())) +
660
+ html.slice(last + placeholder.length + 1);
220
661
  },
221
662
  serialize(id, p, wait) {
222
663
  const serverOnly = sharedConfig.context.noHydrate;
223
664
  if (!firstFlushed && wait && typeof p === "object" && "then" in p) {
224
665
  blockingPromises.push(p);
225
- !serverOnly && p.then(d => {
226
- serializer.write(id, d);
227
- }).catch(e => {
228
- serializer.write(id, e);
229
- });
666
+ !serverOnly &&
667
+ p
668
+ .then(d => {
669
+ serializer.write(id, d);
670
+ })
671
+ .catch(e => {
672
+ serializer.write(id, e);
673
+ });
230
674
  } else if (!serverOnly) serializer.write(id, p);
231
675
  },
232
676
  roots: 0,
@@ -236,11 +680,15 @@ function renderToStream(code, options = {}) {
236
680
  registerFragment(key) {
237
681
  if (!registry.has(key)) {
238
682
  let resolve, reject;
239
- const p = new Promise((r, rej) => (resolve = r, reject = rej));
240
- registry.set(key, err => queue(() => queue(() => {
241
- err ? reject(err) : resolve(true);
242
- queue(flushEnd);
243
- })));
683
+ const p = new Promise((r, rej) => ((resolve = r), (reject = rej)));
684
+ registry.set(key, err =>
685
+ queue(() =>
686
+ queue(() => {
687
+ err ? reject(err) : resolve(true);
688
+ queue(flushEnd);
689
+ })
690
+ )
691
+ );
244
692
  serializer.write(key, p);
245
693
  }
246
694
  return (value, error) => {
@@ -253,7 +701,7 @@ function renderToStream(code, options = {}) {
253
701
  }
254
702
  if (!completed) {
255
703
  if (!firstFlushed) {
256
- queue(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
704
+ queue(() => (html = replacePlaceholder(html, key, value !== undefined ? value : "")));
257
705
  resolve(error);
258
706
  } else {
259
707
  buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
@@ -279,11 +727,12 @@ function renderToStream(code, options = {}) {
279
727
  if (tasks.length) html = injectScripts(html, tasks, nonce);
280
728
  buffer.write(html);
281
729
  tasks = "";
282
- onCompleteShell && onCompleteShell({
283
- write(v) {
284
- !completed && buffer.write(v);
285
- }
286
- });
730
+ onCompleteShell &&
731
+ onCompleteShell({
732
+ write(v) {
733
+ !completed && buffer.write(v);
734
+ }
735
+ });
287
736
  shellCompleted = true;
288
737
  }
289
738
  return {
@@ -318,7 +767,7 @@ function renderToStream(code, options = {}) {
318
767
  pipeTo(w) {
319
768
  return allSettled(blockingPromises).then(() => {
320
769
  let resolve;
321
- const p = new Promise(r => resolve = r);
770
+ const p = new Promise(r => (resolve = r));
322
771
  setTimeout(() => {
323
772
  doShell();
324
773
  const encoder = new TextEncoder();
@@ -348,13 +797,13 @@ function renderToStream(code, options = {}) {
348
797
  };
349
798
  }
350
799
  function HydrationScript(props) {
351
- const {
352
- nonce
353
- } = sharedConfig.context;
354
- return ssr(generateHydrationScript({
355
- nonce,
356
- ...props
357
- }));
800
+ const { nonce } = sharedConfig.context;
801
+ return ssr(
802
+ generateHydrationScript({
803
+ nonce,
804
+ ...props
805
+ })
806
+ );
358
807
  }
359
808
  function ssr(t, ...nodes) {
360
809
  if (nodes.length) {
@@ -399,7 +848,8 @@ function ssrStyle(value) {
399
848
  return result;
400
849
  }
401
850
  function ssrElement(tag, props, children, needsId) {
402
- if (props == null) props = {};else if (typeof props === "function") props = props();
851
+ if (props == null) props = {};
852
+ else if (typeof props === "function") props = props();
403
853
  const skipChildren = VOID_ELEMENTS.test(tag);
404
854
  const keys = Object.keys(props);
405
855
  let result = `<${tag}${needsId ? ssrHydrationKey() : ""} `;
@@ -407,7 +857,8 @@ function ssrElement(tag, props, children, needsId) {
407
857
  for (let i = 0; i < keys.length; i++) {
408
858
  const prop = keys[i];
409
859
  if (ChildProperties.has(prop)) {
410
- if (children === undefined && !skipChildren) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
860
+ if (children === undefined && !skipChildren)
861
+ children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
411
862
  continue;
412
863
  }
413
864
  const value = props[prop];
@@ -416,27 +867,42 @@ function ssrElement(tag, props, children, needsId) {
416
867
  } else if (prop === "class" || prop === "className" || prop === "classList") {
417
868
  if (classResolved) continue;
418
869
  let n;
419
- result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
870
+ result += `class="${
871
+ escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) +
872
+ ssrClassList(props.classList)
873
+ }"`;
420
874
  classResolved = true;
421
875
  } else if (BooleanAttributes.has(prop)) {
422
- if (value) result += prop;else continue;
423
- } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
876
+ if (value) result += prop;
877
+ else continue;
878
+ } else if (
879
+ value == undefined ||
880
+ prop === "ref" ||
881
+ prop.slice(0, 2) === "on" ||
882
+ prop.slice(0, 5) === "prop:"
883
+ ) {
424
884
  continue;
885
+ } else if (prop.slice(0, 5) === "bool:") {
886
+ if (!value) continue;
887
+ result += escape(prop.slice(5));
888
+ } else if (prop.slice(0, 5) === "attr:") {
889
+ result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
425
890
  } else {
426
891
  result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
427
892
  }
428
893
  if (i !== keys.length - 1) result += " ";
429
894
  }
430
- if (skipChildren) return {
431
- t: result + "/>"
432
- };
895
+ if (skipChildren)
896
+ return {
897
+ t: result + "/>"
898
+ };
433
899
  if (typeof children === "function") children = children();
434
900
  return {
435
901
  t: result + `>${resolveSSRNode(children, true)}</${tag}>`
436
902
  };
437
903
  }
438
904
  function ssrAttribute(key, value, isBoolean) {
439
- return isBoolean ? value ? " " + key : "" : value != null ? ` ${key}="${value}"` : "";
905
+ return isBoolean ? (value ? " " + key : "") : value != null ? ` ${key}="${value}"` : "";
440
906
  }
441
907
  function ssrHydrationKey() {
442
908
  const hk = getHydrationKey();
@@ -480,12 +946,13 @@ function escape(s, attr) {
480
946
  left = iDelim + 1;
481
947
  iDelim = s.indexOf(delim, left);
482
948
  } while (iDelim >= 0);
483
- } else while (iAmp >= 0) {
484
- if (left < iAmp) out += s.substring(left, iAmp);
485
- out += "&amp;";
486
- left = iAmp + 1;
487
- iAmp = s.indexOf("&", left);
488
- }
949
+ } else
950
+ while (iAmp >= 0) {
951
+ if (left < iAmp) out += s.substring(left, iAmp);
952
+ out += "&amp;";
953
+ left = iAmp + 1;
954
+ iAmp = s.indexOf("&", left);
955
+ }
489
956
  return left < s.length ? out + s.substring(left) : out;
490
957
  }
491
958
  function resolveSSRNode(node, top) {
@@ -497,7 +964,7 @@ function resolveSSRNode(node, top) {
497
964
  let mapped = "";
498
965
  for (let i = 0, len = node.length; i < len; i++) {
499
966
  if (!top && typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
500
- mapped += resolveSSRNode(prev = node[i]);
967
+ mapped += resolveSSRNode((prev = node[i]));
501
968
  }
502
969
  return mapped;
503
970
  }
@@ -510,7 +977,7 @@ function getHydrationKey() {
510
977
  return hydrate && !hydrate.noHydrate && sharedConfig.getNextContextId();
511
978
  }
512
979
  function useAssets(fn) {
513
- sharedConfig.context.assets.push(() => resolveSSRNode(fn()));
980
+ sharedConfig.context.assets.push(() => resolveSSRNode(escape(fn())));
514
981
  }
515
982
  function getAssets() {
516
983
  const assets = sharedConfig.context.assets;
@@ -518,11 +985,12 @@ function getAssets() {
518
985
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
519
986
  return out;
520
987
  }
521
- function generateHydrationScript({
522
- eventNames = ["click", "input"],
523
- nonce
524
- } = {}) {
525
- 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-->`;
988
+ function generateHydrationScript({ eventNames = ["click", "input"], nonce } = {}) {
989
+ return `<script${
990
+ nonce ? ` nonce="${nonce}"` : ""
991
+ }>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(
992
+ '", "'
993
+ )}"].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-->`;
526
994
  }
527
995
  function Hydration(props) {
528
996
  if (!sharedConfig.context.noHydrate) return props.children;
@@ -538,7 +1006,7 @@ function Hydration(props) {
538
1006
  return res;
539
1007
  }
540
1008
  function NoHydration(props) {
541
- sharedConfig.context.noHydrate = true;
1009
+ if (sharedConfig.context) sharedConfig.context.noHydrate = true;
542
1010
  return props.children;
543
1011
  }
544
1012
  function queue(fn) {
@@ -555,7 +1023,9 @@ function injectAssets(assets, html) {
555
1023
  if (!assets || !assets.length) return html;
556
1024
  let out = "";
557
1025
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
558
- return html.replace(`</head>`, out + `</head>`);
1026
+ const index = html.indexOf("</head>");
1027
+ if (index === -1) return html;
1028
+ return html.slice(0, index) + out + html.slice(index);
559
1029
  }
560
1030
  function injectScripts(html, scripts, nonce) {
561
1031
  const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
@@ -581,16 +1051,20 @@ function replacePlaceholder(html, key, value) {
581
1051
  }
582
1052
  const RequestContext = Symbol();
583
1053
  function getRequestEvent() {
584
- 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;
1054
+ return globalThis[RequestContext]
1055
+ ? globalThis[RequestContext].getStore() ||
1056
+ (sharedConfig.context && sharedConfig.context.event) ||
1057
+ console.log(
1058
+ "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."
1059
+ )
1060
+ : undefined;
585
1061
  }
586
1062
  function Assets(props) {
587
1063
  useAssets(() => props.children);
588
1064
  }
589
1065
  function pipeToNodeWritable(code, writable, options = {}) {
590
1066
  if (options.onReady) {
591
- options.onCompleteShell = ({
592
- write
593
- }) => {
1067
+ options.onCompleteShell = ({ write }) => {
594
1068
  options.onReady({
595
1069
  write,
596
1070
  startWriting() {
@@ -604,9 +1078,7 @@ function pipeToNodeWritable(code, writable, options = {}) {
604
1078
  }
605
1079
  function pipeToWritable(code, writable, options = {}) {
606
1080
  if (options.onReady) {
607
- options.onCompleteShell = ({
608
- write
609
- }) => {
1081
+ options.onCompleteShell = ({ write }) => {
610
1082
  options.onReady({
611
1083
  write,
612
1084
  startWriting() {
@@ -636,28 +1108,36 @@ function ssrSpread(props, isSVG, skipChildren) {
636
1108
  } else if (prop === "class" || prop === "className" || prop === "classList") {
637
1109
  if (classResolved) continue;
638
1110
  let n;
639
- result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
1111
+ result += `class="${(n = props.class) ? n + " " : ""}${
1112
+ (n = props.className) ? n + " " : ""
1113
+ }${ssrClassList(props.classList)}"`;
640
1114
  classResolved = true;
641
1115
  } else if (prop !== "value" && Properties.has(prop)) {
642
- if (value) result += prop;else continue;
643
- } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
1116
+ if (value) result += prop;
1117
+ else continue;
1118
+ } else if (
1119
+ value == undefined ||
1120
+ prop === "ref" ||
1121
+ prop.slice(0, 2) === "on" ||
1122
+ prop.slice(0, 5) === "prop:"
1123
+ ) {
644
1124
  continue;
1125
+ } else if (prop.slice(0, 5) === "bool:") {
1126
+ if (!value) continue;
1127
+ result += escape(prop.slice(5));
1128
+ } else if (prop.slice(0, 5) === "attr:") {
1129
+ result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
645
1130
  } else {
646
- if (prop.slice(0, 5) === "bool:") {
647
- if (!value) continue;
648
- prop = prop.slice(5);
649
- result += `${escape(prop)}`;
650
- } else {
651
- if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
652
- result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
653
- }
1131
+ result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
654
1132
  }
655
1133
  if (i !== keys.length - 1) result += " ";
656
1134
  }
657
1135
  return result;
658
1136
  }
659
1137
  function notSup() {
660
- 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>.");
1138
+ throw new Error(
1139
+ "Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
1140
+ );
661
1141
  }
662
1142
 
663
1143
  const isServer = true;
@@ -667,7 +1147,8 @@ function Dynamic(props) {
667
1147
  const comp = p.component,
668
1148
  t = typeof comp;
669
1149
  if (comp) {
670
- if (t === "function") return comp(others);else if (t === "string") {
1150
+ if (t === "function") return comp(others);
1151
+ else if (t === "string") {
671
1152
  return ssrElement(comp, others, undefined, true);
672
1153
  }
673
1154
  }
@@ -676,4 +1157,60 @@ function Portal(props) {
676
1157
  return "";
677
1158
  }
678
1159
 
679
- export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as classList, 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, pipeToNodeWritable, pipeToWritable, notSup as render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, notSup as style, notSup as template, useAssets };
1160
+ export {
1161
+ Aliases,
1162
+ Assets,
1163
+ ChildProperties,
1164
+ DOMElements,
1165
+ DelegatedEvents,
1166
+ Dynamic,
1167
+ Hydration,
1168
+ HydrationScript,
1169
+ NoHydration,
1170
+ Portal,
1171
+ Properties,
1172
+ RequestContext,
1173
+ SVGElements,
1174
+ SVGNamespace,
1175
+ notSup as addEventListener,
1176
+ notSup as assign,
1177
+ notSup as classList,
1178
+ notSup as className,
1179
+ notSup as delegateEvents,
1180
+ notSup as dynamicProperty,
1181
+ escape,
1182
+ generateHydrationScript,
1183
+ getAssets,
1184
+ getHydrationKey,
1185
+ notSup as getNextElement,
1186
+ notSup as getNextMarker,
1187
+ notSup as getNextMatch,
1188
+ getPropAlias,
1189
+ getRequestEvent,
1190
+ notSup as hydrate,
1191
+ notSup as insert,
1192
+ isDev,
1193
+ isServer,
1194
+ pipeToNodeWritable,
1195
+ pipeToWritable,
1196
+ notSup as render,
1197
+ renderToStream,
1198
+ renderToString,
1199
+ renderToStringAsync,
1200
+ resolveSSRNode,
1201
+ notSup as runHydrationEvents,
1202
+ notSup as setAttribute,
1203
+ notSup as setAttributeNS,
1204
+ notSup as setProperty,
1205
+ notSup as spread,
1206
+ ssr,
1207
+ ssrAttribute,
1208
+ ssrClassList,
1209
+ ssrElement,
1210
+ ssrHydrationKey,
1211
+ ssrSpread,
1212
+ ssrStyle,
1213
+ notSup as style,
1214
+ notSup as template,
1215
+ useAssets
1216
+ };