@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.10

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 (108) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +4472 -0
  3. package/dist/server.js +1363 -224
  4. package/dist/{server.cjs → server.observe.js} +1563 -424
  5. package/dist/{dev.cjs → web.dev.js} +708 -365
  6. package/dist/web.js +460 -144
  7. package/dist/{dev.js → web.observe.js} +511 -213
  8. package/frames/dist/client.dev.js +464 -72
  9. package/frames/dist/client.js +364 -71
  10. package/frames/dist/{client.dev.cjs → client.observe.js} +487 -134
  11. package/frames/dist/server.dev.js +1713 -0
  12. package/frames/dist/server.js +553 -2495
  13. package/frames/dist/server.observe.js +1713 -0
  14. package/frames/package.json +2 -25
  15. package/package.json +214 -254
  16. package/performance-tracks/dist/performance-tracks.dev.js +678 -0
  17. package/performance-tracks/dist/performance-tracks.js +6 -0
  18. package/performance-tracks/dist/performance-tracks.observe.js +666 -0
  19. package/performance-tracks/package.json +7 -0
  20. package/performance-tracks/types/index.d.ts +67 -0
  21. package/serialization/decode/package.json +2 -15
  22. package/serialization/dist/decode.js +101 -12
  23. package/serialization/dist/serialization.js +112 -20
  24. package/serialization/package.json +2 -15
  25. package/serialization/types/index.d.ts +76 -157
  26. package/serialization/types/serializer-decode.d.ts +149 -112
  27. package/serialization/types/serializer.d.ts +101 -0
  28. package/server-functions/dist/client.dev.js +1364 -0
  29. package/server-functions/dist/client.js +745 -85
  30. package/server-functions/dist/client.observe.js +1343 -0
  31. package/server-functions/dist/server.dev.js +2203 -175
  32. package/server-functions/dist/server.js +2111 -176
  33. package/server-functions/dist/server.observe.js +3043 -0
  34. package/server-functions/package.json +2 -35
  35. package/server-functions/rich-args/package.json +2 -15
  36. package/storage/package.json +2 -15
  37. package/types/client.d.ts +193 -288
  38. package/types/constants.d.ts +20 -0
  39. package/types/cookies.d.ts +32 -84
  40. package/types/diagnostics.d.ts +56 -0
  41. package/types/frames/client.d.ts +1 -1
  42. package/types/frames/frame-client.d.ts +323 -259
  43. package/types/frames/frame-container-plugin.d.ts +72 -0
  44. package/types/frames/frame-sink.d.ts +101 -158
  45. package/types/frames/frame-transport.d.ts +192 -190
  46. package/types/frames/serializer-decode.d.ts +219 -0
  47. package/types/frames/serializer.d.ts +76 -157
  48. package/types/frames/server.d.ts +1 -1
  49. package/types/head.d.ts +19 -0
  50. package/types/index.d.ts +62 -76
  51. package/types/index.server.d.ts +174 -0
  52. package/types/jsx.d.ts +33 -26
  53. package/types/observe.d.ts +358 -0
  54. package/types/reconcile.d.ts +1 -0
  55. package/types/render.d.ts +9 -0
  56. package/types/response.d.ts +75 -150
  57. package/types/serializer-decode.d.ts +149 -112
  58. package/types/serializer.d.ts +76 -157
  59. package/types/server-functions/client.d.ts +202 -174
  60. package/types/server-functions/flash.d.ts +28 -30
  61. package/types/server-functions/registry.d.ts +102 -0
  62. package/types/server-functions/rich-args.d.ts +1 -10
  63. package/types/server-functions/server.d.ts +518 -454
  64. package/types/server-functions/shared.d.ts +366 -425
  65. package/types/server-mock.d.ts +110 -13
  66. package/types/server-observe.d.ts +77 -0
  67. package/types/server.d.ts +425 -425
  68. package/types/trace.d.ts +127 -0
  69. package/LICENSE +0 -21
  70. package/dist/web.cjs +0 -2007
  71. package/frames/dist/client.cjs +0 -1916
  72. package/frames/dist/server.cjs +0 -3667
  73. package/serialization/dist/decode.cjs +0 -110
  74. package/serialization/dist/serialization.cjs +0 -232
  75. package/serialization/types-cjs/index.d.cts +0 -182
  76. package/serialization/types-cjs/package.json +0 -3
  77. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  78. package/server-functions/dist/client.cjs +0 -646
  79. package/server-functions/dist/rich-args.cjs +0 -11
  80. package/server-functions/dist/server.cjs +0 -1077
  81. package/server-functions/dist/server.dev.cjs +0 -1077
  82. package/storage/dist/storage.cjs +0 -12
  83. package/storage/types-cjs/index.d.cts +0 -28
  84. package/storage/types-cjs/package.json +0 -3
  85. package/types/core.d.ts +0 -6
  86. package/types-cjs/client.d.cts +0 -337
  87. package/types-cjs/cookies.d.cts +0 -93
  88. package/types-cjs/core.d.cts +0 -6
  89. package/types-cjs/frames/client.d.cts +0 -36
  90. package/types-cjs/frames/frame-client.d.cts +0 -338
  91. package/types-cjs/frames/frame-sink.d.cts +0 -194
  92. package/types-cjs/frames/frame-transport.d.cts +0 -222
  93. package/types-cjs/frames/serializer.d.cts +0 -182
  94. package/types-cjs/frames/server.d.cts +0 -52
  95. package/types-cjs/index.d.cts +0 -230
  96. package/types-cjs/jsx-properties.d.cts +0 -93
  97. package/types-cjs/jsx.d.cts +0 -4150
  98. package/types-cjs/package.json +0 -3
  99. package/types-cjs/response.d.cts +0 -174
  100. package/types-cjs/serializer-decode.d.cts +0 -182
  101. package/types-cjs/serializer.d.cts +0 -182
  102. package/types-cjs/server-functions/client.d.cts +0 -201
  103. package/types-cjs/server-functions/flash.d.cts +0 -38
  104. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  105. package/types-cjs/server-functions/server.d.cts +0 -588
  106. package/types-cjs/server-functions/shared.d.cts +0 -523
  107. package/types-cjs/server-mock.d.cts +0 -277
  108. package/types-cjs/server.d.cts +0 -523
@@ -1,6 +1,6 @@
1
- 'use strict';
2
-
3
- var solidJs = require('solid-js');
1
+ import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, createEffect } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
+ import { sourceKeys, SOURCE_PROXY, hasStaticKeys, resolvedTable, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PLAIN } from 'solid-js/internal';
4
4
 
5
5
  const DOMWithState = {
6
6
  INPUT: {
@@ -49,31 +49,53 @@ const Namespaces = {
49
49
  const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
50
50
  const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
51
51
  const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
52
+ const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
52
53
 
53
54
  const transparentOptions = {
54
55
  transparent: true,
55
56
  sync: true
56
57
  };
58
+ let spreadName;
59
+ function setSpreadName(name) {
60
+ spreadName = name;
61
+ }
57
62
  const syncOptions = {
58
63
  sync: true
59
64
  };
60
- const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
61
- sync: true,
62
- ...options,
63
- transparent: !options.scope
64
- } : transparentOptions);
65
- const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
66
- const assetGates = new WeakMap();
67
- const waitAsset = promise => {
68
- let gate = assetGates.get(promise);
69
- if (!gate) {
70
- solidJs.runWithOwner(null, () => {
71
- gate = solidJs.createMemo(() => promise);
72
- });
73
- assetGates.set(promise, gate);
65
+ let bindingEffect = null;
66
+ function tagElement(node) {
67
+ if (bindingEffect !== null && bindingEffect._devElement === undefined) bindingEffect._devElement = node;
68
+ }
69
+ function effect(fn, effectFn, options) {
70
+ if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
71
+ ...options,
72
+ name: spreadName + ".spread"
73
+ };
74
+ const nodeOptions = options ? {
75
+ sync: true,
76
+ ...options,
77
+ transparent: !options.scope
78
+ } : transparentOptions;
79
+ {
80
+ let node = null;
81
+ createRenderEffect(prev => {
82
+ node = getOwner();
83
+ return fn(prev);
84
+ }, (value, prev) => {
85
+ const outer = bindingEffect;
86
+ bindingEffect = node;
87
+ try {
88
+ return effectFn(value, prev);
89
+ } finally {
90
+ bindingEffect = outer;
91
+ }
92
+ }, nodeOptions);
93
+ return;
74
94
  }
75
- gate();
76
- };
95
+ }
96
+ function memo(fn) {
97
+ return createMemo(() => fn(), syncOptions);
98
+ }
77
99
 
78
100
  function reconcileArrays(parentNode, a, b, marker) {
79
101
  let bLength = b.length,
@@ -87,13 +109,18 @@ function reconcileArrays(parentNode, a, b, marker) {
87
109
  map = null,
88
110
  anchor,
89
111
  anchorTag;
112
+ const isLive = n => {
113
+ if (!n) return false;
114
+ const tag = n[$$SLOT];
115
+ return n.parentNode === parentNode && (!tag || tag === marker);
116
+ };
90
117
  while (aStart < aEnd || bStart < bEnd) {
91
- if (a[aStart] === b[bStart]) {
118
+ if (a[aStart] === b[bStart] && isLive(a[aStart])) {
92
119
  aStart++;
93
120
  bStart++;
94
121
  continue;
95
122
  }
96
- while (a[aEnd - 1] === b[bEnd - 1]) {
123
+ while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
97
124
  aEnd--;
98
125
  bEnd--;
99
126
  }
@@ -181,6 +208,30 @@ function reconcileArrays(parentNode, a, b, marker) {
181
208
  }
182
209
  }
183
210
 
211
+ function emitFinding(finding, subject = getOwner()) {
212
+ if (OBSERVE === undefined) return;
213
+ const entry = OBSERVE.diagnostics.emit(finding, subject);
214
+ if (DEV !== undefined) DEV.report(entry);
215
+ }
216
+ function devCheck(finding, subject) {
217
+ emitFinding(finding, subject);
218
+ }
219
+ function unscopedHoleAllocatedIds(before, after, site, subject) {
220
+ const fn = site.name ? `\`${site.name}\`` : "a function";
221
+ const where = site.registered !== undefined ? `the server evaluated it at ${before} (→ ${after}), after the scoped holes that follow it ` + `had reserved theirs, but it was registered at ${site.registered}, where the client builds ` + `it in place` : `the client built it in place at ${before} (→ ${after}) and its content missed its ` + `server-rendered keys, because the server evaluates it after the scoped holes that follow it`;
222
+ devCheck({
223
+ code: "UNSCOPED_HOLE_ALLOCATED_IDS",
224
+ kind: "render",
225
+ severity: "warn",
226
+ message: `[UNSCOPED_HOLE_ALLOCATED_IDS] A JSX hole received ${fn} instead of a value, and calling it ` + `built hydratable content. The hole is unscoped, so that content took ids from the enclosing ` + `scope's counter: ${where}. The hydration keys of this hole's content and of the holes after it ` + `permute between server and client. Pass the built value — call it at the hole ` + `(\`{${site.name || "render"}()}\`) or assign the result first — rather than the function; a ` + `function is not a JSX.Element, so this shape is reached only from JavaScript or through a cast.`,
227
+ data: {
228
+ before,
229
+ after,
230
+ ...site
231
+ }
232
+ }, subject);
233
+ }
234
+
184
235
  const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
185
236
  const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
186
237
  const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
@@ -213,11 +264,24 @@ function classifyHeadTag(desc) {
213
264
  resource: false
214
265
  };
215
266
  }
267
+ function qualifierValue(name, value) {
268
+ if (value == null || value === false) return null;
269
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
270
+ const v = value === true ? "" : String(value);
271
+ if (name === "as") return asciiLowerCase(v);
272
+ if (name !== "crossorigin") return v;
273
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
274
+ }
275
+ function asciiLowerCase(value) {
276
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
277
+ }
216
278
  function resourceIdentity(tag, props) {
217
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
279
+ const url = String(props.href || props.src || "");
280
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
218
281
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
219
282
  const q = RESOURCE_QUALIFIERS[i];
220
- if (props[q] != null) id += ":" + q + "=" + props[q];
283
+ const value = qualifierValue(q, props[q]);
284
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
221
285
  }
222
286
  return id;
223
287
  }
@@ -251,7 +315,16 @@ function resolveHead(groups) {
251
315
  }
252
316
  for (const [identity, tags] of byIdentity) {
253
317
  if (identity === "title") {
254
- if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
318
+ if (tags.length > 1) devCheck({
319
+ code: "HEAD_TAG_INVALID",
320
+ kind: "head",
321
+ severity: "warn",
322
+ message: "[HEAD_TAG_INVALID] Multiple <title> tags in one head group; the last one wins.",
323
+ data: {
324
+ reason: "duplicate-title",
325
+ detail: tags.length
326
+ }
327
+ });
255
328
  winners.set(identity, {
256
329
  seq: group.seq,
257
330
  tags: [tags[tags.length - 1]]
@@ -290,6 +363,7 @@ function decodeSafe(text) {
290
363
  }
291
364
  }
292
365
  function serializeCookie(name, value, options = {}) {
366
+ assertServableCookie(name, options);
293
367
  let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
294
368
  cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
295
369
  if (options.domain) cookie += `; Domain=${options.domain}`;
@@ -297,12 +371,32 @@ function serializeCookie(name, value, options = {}) {
297
371
  if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
298
372
  if (options.httpOnly) cookie += "; HttpOnly";
299
373
  if (options.secure) cookie += "; Secure";
374
+ if (options.partitioned) cookie += "; Partitioned";
300
375
  if (options.sameSite) {
301
376
  const sameSite = options.sameSite.toLowerCase();
302
377
  cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
303
378
  }
304
379
  return cookie;
305
380
  }
381
+ function assertServableCookie(name, options) {
382
+ const reject = reason => {
383
+ throw new Error(`serializeCookie: every browser silently rejects this cookie — ${reason}. ` + `It would never come back on a request, with no error anywhere.`);
384
+ };
385
+ const lower = name.toLowerCase();
386
+ if (lower.startsWith("__host-")) {
387
+ if (!options.secure) reject(`the __Host- prefix on \`${name}\` requires \`secure: true\``);
388
+ if (options.path !== undefined && options.path !== "/") reject(`the __Host- prefix on \`${name}\` requires \`Path=/\` (got \`${options.path}\`) — ` + `host-locking is the prefix's whole contract, so it cannot be path-scoped`);
389
+ if (options.domain) reject(`the __Host- prefix on \`${name}\` forbids \`Domain\` (got \`${options.domain}\`)`);
390
+ } else if (lower.startsWith("__secure-") && !options.secure) {
391
+ reject(`the __Secure- prefix on \`${name}\` requires \`secure: true\``);
392
+ }
393
+ if (options.sameSite && options.sameSite.toLowerCase() === "none" && !options.secure) {
394
+ reject("`SameSite=None` requires `secure: true`");
395
+ }
396
+ if (options.partitioned && !options.secure) {
397
+ reject("`Partitioned` requires `secure: true`");
398
+ }
399
+ }
306
400
  const FLASH_COOKIE = "flash";
307
401
  const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
308
402
  function hasFlashCookie(cookieHeader) {
@@ -325,33 +419,67 @@ function getServerFunctionRPC() {
325
419
  return globalThis[SERVER_FUNCTION_RPC];
326
420
  }
327
421
 
328
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
422
+ const assetGates = new WeakMap();
423
+ const waitAsset = promise => {
424
+ let gate = assetGates.get(promise);
425
+ if (!gate) {
426
+ runWithOwner(null, () => {
427
+ gate = createMemo(() => promise, {
428
+ transparent: true
429
+ });
430
+ });
431
+ assetGates.set(promise, gate);
432
+ }
433
+ gate();
434
+ };
435
+ const EVENT_KEY = "_$$";
436
+ const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
437
+ const $$EVENT_TUPLE = Symbol();
438
+ const hasOwn = Object.prototype.hasOwnProperty;
329
439
  const INNER_OWNED = {};
330
440
  const delegatedEvents = new Set();
331
441
  const delegatedContainers = new Map();
332
- function render$1(code, element, init, options = {}) {
442
+ function voidFn() {}
443
+ function generateHydrationScript(_options) {
444
+ return "";
445
+ }
446
+ function HydrationScript(_props) {
447
+ return null;
448
+ }
449
+ const getRequestEvent = voidFn;
450
+ const getTraceContext = voidFn;
451
+ function render(code, element, init, options = {}) {
333
452
  if (!element) {
334
453
  throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
335
454
  }
455
+ resetErrorHalt();
456
+ enforceLoadingBoundary(true);
336
457
  let disposer;
337
458
  registerDelegatedRoot(element);
338
459
  try {
339
- solidJs.createRoot(dispose => {
460
+ createRoot(dispose => {
340
461
  disposer = dispose;
462
+ if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
341
463
  if (element === document) {
342
464
  const tree = code();
343
- effect(() => solidJs.flatten(tree), () => {});
465
+ effect(() => flatten(tree), () => {});
344
466
  } else {
345
467
  const tree = code();
346
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
468
+ insert(element, () => tree, element.firstChild ? null : undefined, init, {
469
+ ...options.insertOptions,
470
+ schedule: true
471
+ });
347
472
  }
348
473
  }, {
349
474
  id: options.renderId
350
475
  });
476
+ flush();
351
477
  } catch (err) {
352
478
  if (disposer) disposer();
353
479
  unregisterDelegatedRoot(element);
354
480
  throw err;
481
+ } finally {
482
+ enforceLoadingBoundary(false);
355
483
  }
356
484
  return () => {
357
485
  disposer();
@@ -361,6 +489,7 @@ function render$1(code, element, init, options = {}) {
361
489
  }
362
490
  function create(html, bypassGuard, flag) {
363
491
  if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
492
+ if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: " + "a <template> parse strips those tags. Render this component through hydrate(), " + "where the document shell already exists.");
364
493
  const t = document.createElement("template");
365
494
  t.innerHTML = html;
366
495
  return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
@@ -411,10 +540,32 @@ function unregisterDelegatedContainer(container, owner = container) {
411
540
  }
412
541
  function attachDelegatedEvent(name, container, state) {
413
542
  if (state.handlers.has(name)) return;
414
- const handler = e => eventHandler(e, container, state);
543
+ const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
415
544
  state.handlers.set(name, handler);
416
545
  container.addEventListener(name, handler);
417
546
  }
547
+ function describeEventTarget(target) {
548
+ if (!target || typeof target.tagName !== "string") return undefined;
549
+ const tag = target.tagName.toLowerCase();
550
+ let out = tag;
551
+ if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
552
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") {
553
+ const text = (target.textContent || "").trim().replace(/\s+/g, " ");
554
+ if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
555
+ }
556
+ return out;
557
+ }
558
+ function interactionStart(e) {
559
+ const at = e.timeStamp;
560
+ return typeof at === "number" && at >= 0 && at <= performance.now() ? at : undefined;
561
+ }
562
+ function dispatchAsInteraction(e, fn) {
563
+ return OBSERVE.attribution.withInteraction({
564
+ type: e.type,
565
+ target: describeEventTarget(e.target),
566
+ at: interactionStart(e)
567
+ }, fn);
568
+ }
418
569
  function getDelegatedRoot(node) {
419
570
  while (node) {
420
571
  if (delegatedContainers.get(node)?.roots) return node;
@@ -434,11 +585,13 @@ function findOwner(target, state) {
434
585
  }
435
586
  }
436
587
  function setProperty(node, name, value) {
588
+ tagElement(node);
437
589
  if (isHydrating(node)) return;
438
- node[name] = value;
590
+ const nodeName = node.nodeName;
591
+ if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
439
592
  }
440
593
  let claimHandlers = null;
441
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
594
+ const CLAIM_SEAM = Symbol.for("solid.element-claims");
442
595
  function registerElementClaim(handler) {
443
596
  (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
444
597
  return () => {
@@ -468,31 +621,54 @@ function claimElement(node) {
468
621
  return node;
469
622
  }
470
623
  function setAttribute(node, name, value) {
624
+ tagElement(node);
471
625
  if (isHydrating(node)) return;
472
- if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
626
+ const selectMultiple = name === "multiple" && node.localName === "select";
627
+ if (value == null || value === false) node.removeAttribute(name);else {
628
+ node.setAttribute(name, value === true ? "" : value);
629
+ if (selectMultiple && !node._$multiple) {
630
+ const options = node.options;
631
+ for (let i = 0; i < options.length; i++) {
632
+ if (options[i].defaultSelected) options[i].selected = true;
633
+ }
634
+ }
635
+ }
636
+ if (selectMultiple) node._$multiple = true;
473
637
  if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
474
638
  }
475
639
  function setAttributeNS(node, namespace, name, value) {
640
+ tagElement(node);
476
641
  if (isHydrating(node)) return;
477
642
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
478
643
  }
479
644
  function className(node, value, prev) {
480
- if (isHydrating(node)) return;
645
+ tagElement(node);
646
+ if (typeof value === "number") value = "" + value;
647
+ if (typeof prev === "number") prev = "" + prev;
648
+ if (isHydrating(node)) {
649
+ node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
650
+ return;
651
+ }
481
652
  if (value == null || value === false) {
482
- prev && node.removeAttribute("class");
653
+ if (prev || node._$classes) {
654
+ node.removeAttribute("class");
655
+ node._$classes = undefined;
656
+ }
483
657
  return;
484
658
  }
485
659
  if (typeof value === "string") {
660
+ node._$classes = undefined;
486
661
  value !== prev && node.setAttribute("class", value);
487
662
  return;
488
663
  }
664
+ let applied;
489
665
  if (typeof prev === "string") {
490
- prev = {};
666
+ applied = {};
491
667
  node.removeAttribute("class");
492
- } else prev = classListToObject(prev || {});
668
+ } else applied = node._$classes || classListToObject(prev || {});
493
669
  value = classListToObject(value);
494
- const classKeys = Object.keys(value || {});
495
- const prevKeys = Object.keys(prev);
670
+ const classKeys = Object.keys(value);
671
+ const prevKeys = Object.keys(applied);
496
672
  let i, len;
497
673
  for (i = 0, len = prevKeys.length; i < len; i++) {
498
674
  const key = prevKeys[i];
@@ -502,22 +678,40 @@ function className(node, value, prev) {
502
678
  for (i = 0, len = classKeys.length; i < len; i++) {
503
679
  const key = classKeys[i],
504
680
  classValue = !!value[key];
505
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
681
+ if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
506
682
  node.classList.add(key);
507
683
  }
684
+ node._$classes = value;
508
685
  }
509
686
  function addEvent(node, name, handler, delegate) {
510
687
  if (delegate) {
688
+ const key = EVENT_KEY + name;
689
+ let data;
511
690
  if (Array.isArray(handler)) {
512
- node[`$$${name}`] = handler[0];
513
- node[`$$${name}Data`] = handler[1];
514
- } else node[`$$${name}`] = handler;
515
- } else if (Array.isArray(handler)) {
691
+ data = handler[1];
692
+ node[key] = handler[0];
693
+ } else node[key] = handler;
694
+ node[`${key}Data`] = data;
695
+ return;
696
+ }
697
+ if (Array.isArray(handler)) {
516
698
  const handlerFn = handler[0];
517
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
518
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
699
+ const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
700
+ listener[$$EVENT_TUPLE] = handler;
701
+ node.addEventListener(name, listener);
702
+ return listener;
703
+ }
704
+ if (typeof handler === "function") {
705
+ const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
706
+ node.addEventListener(name, listener);
707
+ return listener;
708
+ }
709
+ node.addEventListener(name, handler, typeof handler !== "function" && handler);
710
+ return handler;
519
711
  }
520
712
  function style(node, value, prev) {
713
+ tagElement(node);
714
+ if (isHydrating(node)) return;
521
715
  if (!value) {
522
716
  if (prev || node._$styles) {
523
717
  setAttribute(node, "style");
@@ -542,12 +736,13 @@ function style(node, value, prev) {
542
736
  }
543
737
  let v, s;
544
738
  for (s in applied) {
545
- if (value[s] == null) {
739
+ if (!hasOwn.call(value, s) || value[s] == null) {
546
740
  nodeStyle.removeProperty(s);
547
741
  delete applied[s];
548
742
  }
549
743
  }
550
744
  for (s in value) {
745
+ if (!hasOwn.call(value, s)) continue;
551
746
  v = value[s];
552
747
  if (v != null && v !== applied[s]) {
553
748
  nodeStyle.setProperty(s, v);
@@ -555,26 +750,135 @@ function style(node, value, prev) {
555
750
  }
556
751
  }
557
752
  }
753
+ function readShallow(value) {
754
+ if (value === null || typeof value !== "object") return value;
755
+ if (Array.isArray(value)) return value.map(readShallow);
756
+ if (value[$PROXY] !== value) return value;
757
+ const keys = sourceKeys(value, SOURCE_PROXY);
758
+ const out = {};
759
+ for (let i = 0; i < keys.length; i++) {
760
+ const k = keys[i];
761
+ if (typeof k === "string") out[k] = value[k];
762
+ }
763
+ return out;
764
+ }
558
765
  function setStyleProperty(node, name, value) {
766
+ tagElement(node);
767
+ if (isHydrating(node)) return;
559
768
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
560
769
  }
561
- function spread(node, props = {}, skipChildren) {
770
+ function spread(node, props, skipChildren, skip, name) {
771
+ if (name !== undefined) {
772
+ const outer = spreadName;
773
+ setSpreadName(name);
774
+ try {
775
+ return spread(node, props, skipChildren, skip);
776
+ } finally {
777
+ setSpreadName(outer);
778
+ }
779
+ }
562
780
  const prevProps = {};
563
- if (!skipChildren) insert(node, () => props.children);
564
- effect(() => {
565
- const r = props.ref;
566
- (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
567
- }, () => {});
781
+ const apply = newProps => {
782
+ const r = newProps.ref;
783
+ if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
784
+ assign(node, newProps, true, prevProps, true);
785
+ };
786
+ unscopedByDesign = node;
787
+ if (Array.isArray(props)) {
788
+ if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
789
+ for (let i = props.length - 1; i >= 0; i--) {
790
+ const s = resolveSource(props[i]);
791
+ if (s != null && entryHas(s, "children")) return entryGet(s, "children");
792
+ }
793
+ });
794
+ unscopedByDesign = null;
795
+ effect(() => collectSources({}, props, undefined, skip), apply);
796
+ return prevProps;
797
+ }
798
+ if (!skipChildren && !(skip !== undefined && skip("children"))) {
799
+ if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
800
+ const desc = Object.getOwnPropertyDescriptor(props, "children");
801
+ if (desc !== undefined) {
802
+ if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
803
+ }
804
+ } else insert(node, () => {
805
+ const source = resolveSource(props);
806
+ return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
807
+ });
808
+ }
809
+ unscopedByDesign = null;
568
810
  effect(() => {
811
+ const source = resolveSource(props);
569
812
  const newProps = {};
570
- for (const prop in props) {
571
- if (prop === "children" || prop === "ref") continue;
572
- newProps[prop] = props[prop];
813
+ const table = resolvedTable(source);
814
+ if (table !== undefined) return collectTable(newProps, table, skip);
815
+ if (source != null) {
816
+ const view = viewOf(source);
817
+ if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
573
818
  }
574
819
  return newProps;
575
- }, props => assign(node, props, true, prevProps, true));
820
+ }, apply);
576
821
  return prevProps;
577
822
  }
823
+ function collectTable(out, table, skip) {
824
+ for (const [prop, leaf] of table) {
825
+ if (typeof prop !== "string" || prop === "children") continue;
826
+ if (skip !== undefined && skip(prop)) continue;
827
+ const v = leaf[prop];
828
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
829
+ }
830
+ return out;
831
+ }
832
+ function resolveSource(s) {
833
+ return typeof s === "function" ? s() : s;
834
+ }
835
+ function entryHas(s, key) {
836
+ const view = viewOf(s);
837
+ return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
838
+ }
839
+ function entryGet(s, key) {
840
+ const view = viewOf(s);
841
+ return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
842
+ }
843
+ function collectSources(out, sources, kinds, skip) {
844
+ const resolved = [];
845
+ const resolvedKinds = [];
846
+ for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
847
+ for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
848
+ return out;
849
+ }
850
+ function pushEntry(resolved, kinds, s, kind) {
851
+ if (kind !== SOURCE_MEMO) {
852
+ resolved.push(s);
853
+ kinds.push(kind);
854
+ return;
855
+ }
856
+ s = resolveSource(s);
857
+ if (s == null) return;
858
+ const view = viewOf(s);
859
+ if (view instanceof OmitView) {
860
+ resolved.push(view);
861
+ kinds.push(SOURCE_OMIT);
862
+ } else if (view !== undefined) {
863
+ const f = view.sources,
864
+ k = view.kinds;
865
+ for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
866
+ } else {
867
+ resolved.push(s);
868
+ kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
869
+ }
870
+ }
871
+ function collectProps(out, s, kind, skip, later, laterKinds, from) {
872
+ const keys = sourceKeys(s, kind);
873
+ outer: for (let i = 0; i < keys.length; i++) {
874
+ const prop = keys[i];
875
+ if (typeof prop !== "string" || prop === "children") continue;
876
+ if (skip !== undefined && skip(prop)) continue;
877
+ if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
878
+ const v = sourceGet(s, kind, prop);
879
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
880
+ }
881
+ }
578
882
  function dynamicProperty(props, key) {
579
883
  const src = props[key];
580
884
  Object.defineProperty(props, key, {
@@ -589,8 +893,8 @@ function applyRef(r, element) {
589
893
  Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
590
894
  }
591
895
  function ref(fn, element) {
592
- const resolved = solidJs.untrack(fn);
593
- solidJs.runWithOwner(null, () => applyRef(resolved, element));
896
+ const resolved = untrack(fn);
897
+ runWithOwner(null, () => applyRef(resolved, element));
594
898
  }
595
899
  function scope(fn) {
596
900
  fn.$s = true;
@@ -599,18 +903,39 @@ function scope(fn) {
599
903
  const SCOPE_OPTIONS = {
600
904
  scope: true
601
905
  };
906
+ let unscopedByDesign = null;
907
+ let reportedHoleSites = null;
908
+ let hydrationKeyMisses = 0;
909
+ function unscopedHoleSnapshot(accessor, parent) {
910
+ if (accessor.$s || !sharedConfig.hydrating || parent === unscopedByDesign || sharedConfig.devPeekNextContextId === undefined) return undefined;
911
+ return {
912
+ next: sharedConfig.devPeekNextContextId(),
913
+ misses: hydrationKeyMisses
914
+ };
915
+ }
916
+ function checkUnscopedHole(snapshot, accessor, parent) {
917
+ if (snapshot === undefined || hydrationKeyMisses === snapshot.misses) return;
918
+ const after = sharedConfig.devPeekNextContextId();
919
+ if (after === snapshot.next) return;
920
+ let site = parent.nodeName + "|" + accessor.name;
921
+ for (let o = getOwner(); o !== null; o = o._parent) if (o._name) site = o._name + "|" + site;
922
+ if ((reportedHoleSites || (reportedHoleSites = new Set())).has(site)) return;
923
+ reportedHoleSites.add(site);
924
+ unscopedHoleAllocatedIds(snapshot.next, after, accessor.name ? {
925
+ name: accessor.name
926
+ } : {});
927
+ }
602
928
  let hydrationRt = null;
603
929
  function installHydrationRuntime() {
604
930
  hydrationRt = {
605
931
  claimInitial(parent, multi, initial) {
606
932
  if (isHydrating(parent)) {
607
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
608
- if (Array.isArray(initial)) stripTextSeparators(initial);
933
+ if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
609
934
  }
610
935
  return initial;
611
936
  },
612
937
  reclaimRegion(current, parent, marker) {
613
- if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
938
+ if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
614
939
  const first = Array.isArray(current) ? current[0] : current;
615
940
  if (!first || !first.nodeType || first.isConnected) return current;
616
941
  let nodes;
@@ -629,11 +954,11 @@ function installHydrationRuntime() {
629
954
  nodes.unshift(node);
630
955
  node = node.previousSibling;
631
956
  }
632
- } else nodes = [...parent.childNodes];
957
+ } else return claimChildNodes(parent);
633
958
  return stripTextSeparators(nodes);
634
959
  },
635
960
  dedupEvent(e) {
636
- return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
961
+ return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
637
962
  }
638
963
  };
639
964
  }
@@ -642,20 +967,41 @@ function stripTextSeparators(nodes) {
642
967
  for (let i = 0; i < nodes.length; i++) {
643
968
  const node = nodes[i],
644
969
  t = node.nodeType;
645
- if (t === 8) {
646
- const v = node.nodeValue;
647
- if (v === "!$") {
648
- node.remove();
649
- continue;
650
- }
651
- if (v.startsWith("pl-")) continue;
652
- } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
970
+ if (t === 8 && node.nodeValue === "!$") {
971
+ node.remove();
972
+ continue;
973
+ }
974
+ if (isPlaceholderScaffolding(node, t)) continue;
653
975
  nodes[j++] = node;
654
976
  }
655
977
  nodes.length = j;
656
978
  return nodes;
657
979
  }
980
+ function claimChildNodes(parent) {
981
+ const live = parent.childNodes;
982
+ const out = [];
983
+ for (let i = 0, n = live.length; i < n; i++) {
984
+ const node = live[i],
985
+ t = node.nodeType;
986
+ if (t === 8 && node.nodeValue === "!$") {
987
+ node.remove();
988
+ i--;
989
+ n--;
990
+ continue;
991
+ }
992
+ if (isPlaceholderScaffolding(node, t)) continue;
993
+ out.push(node);
994
+ }
995
+ return out;
996
+ }
997
+ function isPlaceholderScaffolding(node, t) {
998
+ return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
999
+ }
658
1000
  function insert(parent, accessor, marker, initial, options) {
1001
+ if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
1002
+ ...options,
1003
+ name: spreadName + ".children"
1004
+ };
659
1005
  const multi = marker !== undefined;
660
1006
  const host = options && options.host;
661
1007
  if (multi && !initial) initial = [];
@@ -676,7 +1022,9 @@ function insert(parent, accessor, marker, initial, options) {
676
1022
  let current = initial;
677
1023
  effect(prev => {
678
1024
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
1025
+ const devNext = unscopedHoleSnapshot(accessor, parent) ;
679
1026
  const value = normalize(accessor(), current, multi, true);
1027
+ checkUnscopedHole(devNext, accessor, parent);
680
1028
  if (typeof value !== "function") return value;
681
1029
  effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
682
1030
  current = insertExpression(parent, inner, current, marker);
@@ -685,6 +1033,7 @@ function insert(parent, accessor, marker, initial, options) {
685
1033
  ...options,
686
1034
  schedule: true
687
1035
  } : options);
1036
+ checkUnscopedHole(devNext, accessor, parent);
688
1037
  return INNER_OWNED;
689
1038
  }, value => {
690
1039
  if (value === INNER_OWNED) return;
@@ -697,6 +1046,7 @@ function insert(parent, accessor, marker, initial, options) {
697
1046
  } : SCOPE_OPTIONS : options);
698
1047
  }
699
1048
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
1049
+ tagElement(node);
700
1050
  const nodeName = node.nodeName;
701
1051
  props || (props = {});
702
1052
  for (const prop in prevProps) {
@@ -719,10 +1069,16 @@ function assetEntryKey(descriptor) {
719
1069
  if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
720
1070
  return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
721
1071
  }
722
- function findAssetElement(selector, attr, value) {
1072
+ function findAssetElement(selector, attr, value, qualifiers) {
723
1073
  const nodes = document.querySelectorAll(selector);
724
- for (let i = 0; i < nodes.length; i++) {
725
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
1074
+ outer: for (let i = 0; i < nodes.length; i++) {
1075
+ if (nodes[i].getAttribute(attr) !== value) continue;
1076
+ if (!qualifiers) return nodes[i];
1077
+ for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
1078
+ const name = RESOURCE_QUALIFIERS[q];
1079
+ if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
1080
+ }
1081
+ return nodes[i];
726
1082
  }
727
1083
  return null;
728
1084
  }
@@ -895,7 +1251,7 @@ function initHeadRegistry() {
895
1251
  headOwned = new Map();
896
1252
  headApplied = new Map();
897
1253
  const t = document.querySelector("title");
898
- headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
1254
+ headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
899
1255
  if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
900
1256
  }
901
1257
  function applyServerHeadOps(ops) {
@@ -939,7 +1295,7 @@ function scheduleHeadApply() {
939
1295
  queueMicrotask(flushHeadRegistry);
940
1296
  }
941
1297
  function flushHeadRegistry() {
942
- if (solidJs.sharedConfig.hydrating) {
1298
+ if (sharedConfig.hydrating) {
943
1299
  setTimeout(flushHeadRegistry, 0);
944
1300
  return;
945
1301
  }
@@ -950,7 +1306,11 @@ function flushHeadRegistry() {
950
1306
  headOwned.delete(identity);
951
1307
  headApplied.delete(identity);
952
1308
  if (identity === "title") {
953
- if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
1309
+ if (headFallbackTitle != null) {
1310
+ const el = setHeadTitle(headFallbackTitle);
1311
+ el.removeAttribute("data-dh");
1312
+ el.removeAttribute("data-dhf");
1313
+ }
954
1314
  } else {
955
1315
  for (let i = 0; i < els.length; i++) els[i].remove();
956
1316
  }
@@ -1024,8 +1384,8 @@ function mountHeadResource(tag, props) {
1024
1384
  headMountedResources.add(identity);
1025
1385
  const url = props.href || props.src;
1026
1386
  let el = null;
1027
- if (url != null) {
1028
- if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1387
+ if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
1388
+ if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url, props);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1029
1389
  }
1030
1390
  if (!el) document.head.appendChild(createHeadElement(tag, props));
1031
1391
  }
@@ -1047,7 +1407,7 @@ function gateHeadResource(props) {
1047
1407
  if (attrs) descriptor.attrs = attrs;
1048
1408
  effect(() => {
1049
1409
  const entry = warmAsset(descriptor);
1050
- if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1410
+ if (gateable && !sharedConfig.hydrating && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1051
1411
  }, () => acquireAsset(descriptor));
1052
1412
  }
1053
1413
  function useHead(tags) {
@@ -1117,7 +1477,7 @@ function loadModuleAssets(mapping) {
1117
1477
  const pending = [];
1118
1478
  for (const key in mapping) {
1119
1479
  if (hy.modules[key]) continue;
1120
- const entryUrl = mapping[key];
1480
+ const entryUrl = new URL(mapping[key], document.baseURI).href;
1121
1481
  if (!hy.loading[key]) {
1122
1482
  hy.loading[key] = import(entryUrl).then(mod => {
1123
1483
  hy.modules[key] = mod;
@@ -1130,19 +1490,29 @@ function loadModuleAssets(mapping) {
1130
1490
  }
1131
1491
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1132
1492
  }
1133
- function hydrate$1(code, element, options = {}) {
1493
+ function hydrate(code, element, options = {}) {
1494
+ enableHydration();
1134
1495
  installHydrationRuntime();
1135
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1496
+ if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
1497
+ const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
1498
+ if (head && element.contains(head)) {
1499
+ let n = head.firstChild;
1500
+ while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
1501
+ const next = n.nextSibling;
1502
+ head.appendChild(n);
1503
+ n = next;
1504
+ }
1505
+ }
1136
1506
  options.renderId ||= "";
1137
1507
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1138
1508
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
1139
- solidJs.sharedConfig.completed = globalThis._$HY.completed;
1140
- solidJs.sharedConfig.events = globalThis._$HY.events;
1141
- solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
1142
- solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
1143
- solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
1144
- solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
1145
- solidJs.sharedConfig.cleanupFragment = id => {
1509
+ sharedConfig.completed = globalThis._$HY.completed;
1510
+ sharedConfig.events = globalThis._$HY.events;
1511
+ sharedConfig.load = id => globalThis._$HY.r[id];
1512
+ sharedConfig.has = id => id in globalThis._$HY.r;
1513
+ sharedConfig.gather = root => gatherHydratable(element, root);
1514
+ sharedConfig.loadModuleAssets = loadModuleAssets;
1515
+ sharedConfig.cleanupFragment = id => {
1146
1516
  const tpl = document.getElementById("pl-" + id);
1147
1517
  if (tpl) {
1148
1518
  let node = tpl.nextSibling;
@@ -1158,20 +1528,20 @@ function hydrate$1(code, element, options = {}) {
1158
1528
  tpl.remove();
1159
1529
  }
1160
1530
  };
1161
- solidJs.sharedConfig.registry = new Map();
1162
- if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
1163
- solidJs.sharedConfig.captureBoundaryScope = id => {
1164
- if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
1165
- registry: solidJs.sharedConfig.registry,
1166
- gather: solidJs.sharedConfig.gather
1531
+ sharedConfig.registry = new Map();
1532
+ if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
1533
+ sharedConfig.captureBoundaryScope = id => {
1534
+ if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
1535
+ registry: sharedConfig.registry,
1536
+ gather: sharedConfig.gather
1167
1537
  });
1168
1538
  };
1169
- solidJs.sharedConfig.hydrating = true;
1539
+ sharedConfig.hydrating = true;
1170
1540
  {
1171
- solidJs.sharedConfig.verifyHydration = () => {
1172
- if (solidJs.sharedConfig.registry && solidJs.sharedConfig.registry.size) {
1173
- const orphaned = [...solidJs.sharedConfig.registry.values()].filter(node => node.isConnected);
1174
- solidJs.sharedConfig.registry.clear();
1541
+ sharedConfig.verifyHydration = () => {
1542
+ if (sharedConfig.registry && sharedConfig.registry.size) {
1543
+ const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
1544
+ sharedConfig.registry.clear();
1175
1545
  if (!orphaned.length) return;
1176
1546
  console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
1177
1547
  }
@@ -1183,42 +1553,51 @@ function hydrate$1(code, element, options = {}) {
1183
1553
  const p = loadModuleAssets(rootMapping);
1184
1554
  if (p) {
1185
1555
  gatherHydratable(element, options.renderId);
1186
- const registry = solidJs.sharedConfig.registry;
1187
- const gather = solidJs.sharedConfig.gather;
1556
+ const registry = sharedConfig.registry;
1557
+ const gather = sharedConfig.gather;
1188
1558
  let disposer;
1189
1559
  p.then(() => {
1190
- solidJs.sharedConfig.registry = registry;
1191
- solidJs.sharedConfig.gather = gather;
1192
- solidJs.sharedConfig.hydrating = true;
1560
+ sharedConfig.registry = registry;
1561
+ sharedConfig.gather = gather;
1562
+ sharedConfig.hydrating = true;
1193
1563
  try {
1194
- disposer = render$1(code, element, [...element.childNodes], options);
1564
+ disposer = render(code, element, [...element.childNodes], options);
1195
1565
  } finally {
1196
- solidJs.sharedConfig.hydrating = false;
1566
+ sharedConfig.hydrating = false;
1197
1567
  }
1198
1568
  }, err => {
1569
+ sharedConfig.hydrating = false;
1570
+ sharedConfig.registry = undefined;
1571
+ if (element.nodeType === 9) {
1572
+ console.error("Hydration module preload failed for a document root; a document shell cannot " + "be client-rendered, so hydration was abandoned and the page is not interactive.");
1573
+ (globalThis.reportError || console.error)(err);
1574
+ return;
1575
+ }
1199
1576
  console.error("Hydration module preload failed, falling back to client render:", err);
1200
- solidJs.sharedConfig.hydrating = false;
1201
- solidJs.sharedConfig.registry = undefined;
1202
- disposer = render$1(code, element, [...element.childNodes], options);
1577
+ disposer = render(code, element, [...element.childNodes], options);
1203
1578
  });
1204
1579
  return () => disposer && disposer();
1205
1580
  }
1206
1581
  }
1207
1582
  try {
1208
1583
  gatherHydratable(element, options.renderId);
1209
- return render$1(code, element, [...element.childNodes], options);
1584
+ return render(code, element, [...element.childNodes], options);
1210
1585
  } finally {
1211
- solidJs.sharedConfig.hydrating = false;
1586
+ sharedConfig.hydrating = false;
1212
1587
  }
1213
1588
  }
1214
1589
  function getNextElement(template) {
1215
1590
  let node,
1216
1591
  key,
1217
1592
  hydrating = isHydrating();
1218
- if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
1593
+ if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
1219
1594
  if (!template) {
1220
1595
  throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
1221
1596
  }
1597
+ if (hydrating) {
1598
+ hydrationKeyMisses++;
1599
+ console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`);
1600
+ }
1222
1601
  return template(true);
1223
1602
  }
1224
1603
  if (template && template._html) {
@@ -1227,8 +1606,8 @@ function getNextElement(template) {
1227
1606
  console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
1228
1607
  }
1229
1608
  }
1230
- if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
1231
- solidJs.sharedConfig.registry.delete(key);
1609
+ if (sharedConfig.completed) sharedConfig.completed.add(node);
1610
+ sharedConfig.registry.delete(key);
1232
1611
  return node;
1233
1612
  }
1234
1613
  function getNextMatch(el, nodeName) {
@@ -1299,12 +1678,12 @@ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
1299
1678
  return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
1300
1679
  }
1301
1680
  function runHydrationEvents() {
1302
- if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
1681
+ if (sharedConfig.events && !sharedConfig.events.queued) {
1303
1682
  queueMicrotask(() => {
1304
1683
  const {
1305
1684
  completed,
1306
1685
  events
1307
- } = solidJs.sharedConfig;
1686
+ } = sharedConfig;
1308
1687
  if (!events) return;
1309
1688
  events.queued = false;
1310
1689
  while (events.length) {
@@ -1338,18 +1717,19 @@ function runHydrationEvents() {
1338
1717
  for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1339
1718
  } else if (matchContainer) eventHandler(e, matchContainer, matchState);
1340
1719
  }
1341
- if (solidJs.sharedConfig.done) {
1342
- solidJs.sharedConfig.events = _$HY.events = null;
1343
- solidJs.sharedConfig.completed = _$HY.completed = null;
1720
+ if (sharedConfig.done) {
1721
+ sharedConfig.events = _$HY.events = null;
1722
+ sharedConfig.completed = _$HY.completed = null;
1344
1723
  }
1345
1724
  });
1346
- solidJs.sharedConfig.events.queued = true;
1725
+ sharedConfig.events.queued = true;
1347
1726
  }
1348
1727
  }
1349
1728
  function isHydrating(node) {
1350
- if (!solidJs.sharedConfig.hydrating) return false;
1729
+ if (!sharedConfig.hydrating) return false;
1730
+ if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
1351
1731
  if (!node || node.isConnected) return true;
1352
- const roots = solidJs.sharedConfig.claimRoots;
1732
+ const roots = sharedConfig.claimRoots;
1353
1733
  if (roots) {
1354
1734
  for (let i = 0; i < roots.length; i++) {
1355
1735
  if (roots[i].contains(node)) return true;
@@ -1379,7 +1759,8 @@ function classListToObject(classList) {
1379
1759
  function flattenClassList(list, result) {
1380
1760
  for (let i = 0, len = list.length; i < len; i++) {
1381
1761
  const item = list[i];
1382
- if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
1762
+ if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
1763
+ else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
1383
1764
  }
1384
1765
  }
1385
1766
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
@@ -1395,12 +1776,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
1395
1776
  const name = prop.slice(2).toLowerCase();
1396
1777
  const delegate = DelegatedEvents.has(name);
1397
1778
  if (!delegate && prev) {
1398
- const h = Array.isArray(prev) ? prev[0] : prev;
1399
- node.removeEventListener(name, h);
1779
+ if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
1780
+ node.removeEventListener(name, prev, typeof prev !== "function" && prev);
1400
1781
  }
1401
1782
  if (delegate || value) {
1402
- addEvent(node, name, value, delegate);
1783
+ const attached = addEvent(node, name, value, delegate);
1403
1784
  delegate && delegateEvents([name]);
1785
+ if (!delegate) return attached;
1404
1786
  }
1405
1787
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1406
1788
  if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
@@ -1422,9 +1804,10 @@ function eventHandler(e, container, state) {
1422
1804
  }
1423
1805
  const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1424
1806
  if (state && !owner) return;
1807
+ if (owner && owner === resumeNode) return;
1425
1808
  e[$$EVENT_OWNER] = owner || true;
1426
1809
  let node = resumeNode || e.target;
1427
- const key = `$$${e.type}`;
1810
+ const key = EVENT_KEY + e.type;
1428
1811
  const oriTarget = e.target;
1429
1812
  const boundary = owner || container || e.currentTarget;
1430
1813
  const retarget = value => Object.defineProperty(e, "target", {
@@ -1432,17 +1815,21 @@ function eventHandler(e, container, state) {
1432
1815
  value
1433
1816
  });
1434
1817
  const handleNode = () => {
1435
- const handler = node[key];
1818
+ let handler = node[key];
1819
+ if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
1820
+ const seam = globalThis[Symbol.for("solid.bnd")];
1821
+ if (seam) handler = seam.resolve(node, e.type);
1822
+ }
1436
1823
  if (handler && !node.disabled) {
1437
1824
  const data = node[`${key}Data`];
1438
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
1825
+ data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
1439
1826
  if (e.cancelBubble) return;
1440
1827
  }
1441
1828
  node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1442
1829
  return true;
1443
1830
  };
1444
1831
  const walkUpTree = () => {
1445
- while (handleNode()) {
1832
+ while (node && handleNode()) {
1446
1833
  if (node === boundary || node.parentNode === boundary) break;
1447
1834
  node = node._$host || node.parentNode || node.host;
1448
1835
  }
@@ -1478,8 +1865,18 @@ function eventHandler(e, container, state) {
1478
1865
  retarget(oriTarget);
1479
1866
  }
1480
1867
  function insertExpression(parent, value, current, marker) {
1868
+ tagElement(parent);
1481
1869
  if (hydrationRt !== null && isHydrating(parent)) {
1482
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1870
+ if (value && value !== current) {
1871
+ const arr = Array.isArray(value);
1872
+ for (const n of arr ? value : [value]) {
1873
+ if (n && n.nodeType) {
1874
+ if (!isHydrating(n)) return current;
1875
+ } else if (arr && (typeof n === "string" || typeof n === "number")) {
1876
+ return current;
1877
+ }
1878
+ }
1879
+ }
1483
1880
  return value;
1484
1881
  }
1485
1882
  if (value === current) return value;
@@ -1500,16 +1897,27 @@ function insertExpression(parent, value, current, marker) {
1500
1897
  } else if (value.nodeType) {
1501
1898
  if (Array.isArray(current)) {
1502
1899
  cleanChildren(parent, current, multi ? marker : null, value);
1503
- } else if (current && current.nodeType) {
1900
+ } else if (current != null && current.nodeType) {
1504
1901
  current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1505
- } else if (current && parent.firstChild) {
1902
+ } else if (current != null && parent.firstChild) {
1506
1903
  parent.replaceChild(value, parent.firstChild);
1507
1904
  } else {
1508
1905
  parent.appendChild(value);
1509
1906
  }
1510
1907
  if (marker) value[$$SLOT] = marker;
1511
1908
  } else if (Array.isArray(value)) {
1512
- const currentArray = current && Array.isArray(current);
1909
+ const currentArray = Array.isArray(current);
1910
+ for (let i = 0, len = value.length; i < len; i++) {
1911
+ const item = value[i],
1912
+ t = typeof item;
1913
+ if (t === "string" || t === "number") {
1914
+ const prev = currentArray ? current[i] : undefined;
1915
+ if (prev && prev.nodeType === 3) {
1916
+ if (prev.data !== "" + item) prev.data = item;
1917
+ value[i] = prev;
1918
+ } else value[i] = document.createTextNode(item);
1919
+ }
1920
+ }
1513
1921
  if (value.length === 0) {
1514
1922
  cleanChildren(parent, current, marker);
1515
1923
  } else if (currentArray) {
@@ -1517,25 +1925,34 @@ function insertExpression(parent, value, current, marker) {
1517
1925
  appendNodes(parent, value, marker);
1518
1926
  } else reconcileArrays(parent, current, value, marker);
1519
1927
  } else {
1520
- current && cleanChildren(parent, current);
1928
+ if (current != null) cleanChildren(parent, current);
1521
1929
  appendNodes(parent, value);
1522
1930
  }
1523
- } else console.warn(`Unrecognized value. Skipped inserting`, value);
1931
+ } else devCheck({
1932
+ code: "UNRECOGNIZED_INSERT_VALUE",
1933
+ kind: "render",
1934
+ severity: "warn",
1935
+ message: `[UNRECOGNIZED_INSERT_VALUE] Unrecognized value. Skipped inserting (${typeof value}).`,
1936
+ data: {
1937
+ type: typeof value,
1938
+ value
1939
+ }
1940
+ });
1524
1941
  return value;
1525
1942
  }
1526
1943
  function normalize(value, current, multi, doNotUnwrap) {
1527
- value = solidJs.flatten(value, {
1944
+ value = flatten(value, {
1528
1945
  skipNonRendered: true,
1529
1946
  doNotUnwrap
1530
1947
  });
1531
1948
  if (doNotUnwrap && typeof value === "function") return value;
1532
1949
  if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1533
- if (Array.isArray(value)) {
1950
+ if (sharedConfig.hydrating && Array.isArray(value)) {
1534
1951
  for (let i = 0, len = value.length; i < len; i++) {
1535
1952
  const item = value[i],
1536
1953
  prev = current && current[i],
1537
1954
  t = typeof item;
1538
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (solidJs.sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1955
+ if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
1539
1956
  }
1540
1957
  }
1541
1958
  return value;
@@ -1601,24 +2018,33 @@ function cleanChildren(parent, current, marker, replacement) {
1601
2018
  }
1602
2019
  function gatherHydratable(element, root) {
1603
2020
  const templates = element.querySelectorAll(`*[_hk]`);
2021
+ const frames = root ? null : element.querySelectorAll("[data-fid]");
2022
+ const frameCount = frames ? frames.length : 0;
2023
+ const registry = sharedConfig.registry;
1604
2024
  for (let i = 0; i < templates.length; i++) {
1605
2025
  const node = templates[i];
1606
2026
  const key = node.getAttribute("_hk");
1607
2027
  if (root) {
1608
2028
  if (!key.startsWith(root)) continue;
1609
- } else {
1610
- const frame = node.closest("[data-fid]");
1611
- if (frame && frame !== element && element.contains(frame)) continue;
2029
+ } else if (frameCount !== 0) {
2030
+ let inFrame = false;
2031
+ for (let j = 0; j < frameCount; j++) {
2032
+ if (frames[j].contains(node)) {
2033
+ inFrame = true;
2034
+ break;
2035
+ }
2036
+ }
2037
+ if (inFrame) continue;
1612
2038
  }
1613
- if (!solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
2039
+ if (!registry.has(key)) registry.set(key, node);
1614
2040
  }
1615
2041
  }
1616
2042
  function getHydrationKey() {
1617
- return solidJs.sharedConfig.getNextContextId();
2043
+ return sharedConfig.getNextContextId();
1618
2044
  }
1619
- const voidFn = () => undefined;
1620
2045
  const RequestContext = Symbol();
1621
2046
 
2047
+ function configureServerErrors(_config) {}
1622
2048
  function throwInBrowser(func) {
1623
2049
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1624
2050
  console.error(err);
@@ -1648,14 +2074,15 @@ function composeMiddleware(middlewares) {
1648
2074
  throwInBrowser(composeMiddleware);
1649
2075
  }
1650
2076
  function ssr(template, ...nodes) {}
1651
- function ssrElement(name, props, children, needsId) {}
2077
+ function ssrElement(name, props, children, needsId, skip, attrs) {}
2078
+ function ssrElementAttribute(key, value) {}
1652
2079
  function ssrClassName(value) {}
1653
2080
  function ssrStyle(value) {}
1654
2081
  function ssrStyleProperty(name, value) {}
1655
2082
  function ssrAttribute(key, value) {}
1656
2083
  function ssrGroup(fn, n) {}
1657
2084
  function ssrHydrationKey() {}
1658
- function resolveSSRNode(node, result, top) {}
2085
+ function resolveSSRNode(node, result, top, nested) {}
1659
2086
  function escape(s, attr) {}
1660
2087
 
1661
2088
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
@@ -1692,11 +2119,16 @@ function isSafeError(value) {
1692
2119
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1693
2120
  }
1694
2121
  const REVALIDATE_HEADER = "X-Revalidate";
1695
- function initWithRevalidate(init) {
2122
+ const REVALIDATE_ALL = "*";
2123
+ const RESPONSE_HEADER_VALUE_LIMIT = 4096;
2124
+ function initWithRevalidate(init = {}) {
2125
+ const resolved = typeof init === "number" ? {
2126
+ status: init
2127
+ } : init;
1696
2128
  const {
1697
2129
  revalidate,
1698
2130
  ...responseInit
1699
- } = init;
2131
+ } = resolved;
1700
2132
  let headers;
1701
2133
  if (responseInit.headers && responseInit.headers.getSetCookie) {
1702
2134
  headers = new Headers();
@@ -1709,7 +2141,17 @@ function initWithRevalidate(init) {
1709
2141
  } else {
1710
2142
  headers = new Headers(responseInit.headers);
1711
2143
  }
1712
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
2144
+ if (revalidate !== undefined) {
2145
+ const list = Array.isArray(revalidate) ? revalidate : [revalidate];
2146
+ if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
2147
+ throw new TypeError(`revalidate names "${REVALIDATE_ALL}" alongside other keys; "${REVALIDATE_ALL}" already ` + `means every entry and stands alone — pass revalidate: "${REVALIDATE_ALL}" or the named keys.`);
2148
+ }
2149
+ const keys = list.join(",");
2150
+ if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
2151
+ throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
2152
+ }
2153
+ headers.set(REVALIDATE_HEADER, keys);
2154
+ }
1713
2155
  return {
1714
2156
  responseInit,
1715
2157
  headers
@@ -1722,13 +2164,17 @@ function redirect(url, init = 302) {
1722
2164
  const {
1723
2165
  responseInit,
1724
2166
  headers
1725
- } = initWithRevalidate(typeof init === "number" ? {
1726
- status: init
1727
- } : init);
2167
+ } = initWithRevalidate(init);
1728
2168
  if (responseInit.status === undefined) {
1729
2169
  responseInit.status = 302;
1730
2170
  }
1731
- headers.set("Location", String(url));
2171
+ const target = typeof url === "string" ? url : url[HREF];
2172
+ const location = typeof target === "string" ? target : String(url);
2173
+ const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
2174
+ if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
2175
+ throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
2176
+ }
2177
+ headers.set("Location", encoded);
1732
2178
  return new Response(null, {
1733
2179
  ...responseInit,
1734
2180
  headers
@@ -1744,11 +2190,19 @@ function reload(init = {}) {
1744
2190
  headers
1745
2191
  });
1746
2192
  }
2193
+ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
1747
2194
  function respond(value, init = {}) {
1748
2195
  const {
1749
2196
  responseInit,
1750
2197
  headers
1751
2198
  } = initWithRevalidate(init);
2199
+ for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
2200
+ if (NULL_BODY_STATUSES.has(responseInit.status)) {
2201
+ return new ResponseEnvelope(new Response(null, {
2202
+ ...responseInit,
2203
+ headers
2204
+ }), value);
2205
+ }
1752
2206
  headers.set("Content-Type", "application/json");
1753
2207
  return new ResponseEnvelope(new Response(JSON.stringify(value), {
1754
2208
  ...responseInit,
@@ -1756,45 +2210,25 @@ function respond(value, init = {}) {
1756
2210
  }), value);
1757
2211
  }
1758
2212
 
1759
- const mergeProps = solidJs.merge;
1760
2213
  const isServer = false;
1761
2214
  const isDev = true;
1762
- function render(code, element, init, options = {}) {
1763
- solidJs.enforceLoadingBoundary(true);
1764
- try {
1765
- const dispose = render$1(code, element, init, {
1766
- ...options,
1767
- insertOptions: {
1768
- schedule: true
1769
- }
1770
- });
1771
- solidJs.flush();
1772
- return dispose;
1773
- } finally {
1774
- solidJs.enforceLoadingBoundary(false);
1775
- }
1776
- }
1777
- const hydrate = (...args) => {
1778
- solidJs.enableHydration();
1779
- return hydrate$1(...args);
1780
- };
1781
2215
  function Portal(props) {
1782
- return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
2216
+ return runWithOwner(createOwner(), () => portalImpl(props));
1783
2217
  }
1784
2218
  function portalImpl(props) {
1785
2219
  const treeMarker = document.createTextNode(""),
1786
2220
  startMarker = document.createTextNode(""),
1787
2221
  endMarker = document.createTextNode(""),
1788
2222
  mount = () => props.mount || document.body,
1789
- content = solidJs.createMemo(() => [startMarker, props.children], {
2223
+ content = createMemo(() => [startMarker, props.children], {
1790
2224
  ssrSource: "client",
1791
2225
  loadingValue: undefined
1792
2226
  });
1793
- solidJs.createRenderEffect(
1794
- () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1795
- const m = solidJs.untrack(mount);
2227
+ createRenderEffect(
2228
+ () => [mount(), content(), getOwner()], ([, c, owner]) => {
2229
+ const m = untrack(mount);
1796
2230
  m.appendChild(endMarker);
1797
- const dispose = solidJs.runWithOwner(owner, () => solidJs.createRoot(d => {
2231
+ const dispose = runWithOwner(owner, () => createRoot(d => {
1798
2232
  insert(m, c, endMarker, undefined, {
1799
2233
  host: () => treeMarker.parentNode
1800
2234
  });
@@ -1815,8 +2249,8 @@ function portalImpl(props) {
1815
2249
  schedule: true,
1816
2250
  ssrSource: "client"
1817
2251
  });
1818
- solidJs.createEffect(mount, () => {
1819
- const m = solidJs.untrack(mount);
2252
+ createEffect(mount, () => {
2253
+ const m = untrack(mount);
1820
2254
  const ownerRoot = getDelegatedRoot(treeMarker);
1821
2255
  if (!ownerRoot || ownerRoot.contains(m)) return;
1822
2256
  registerDelegatedContainer(m, ownerRoot);
@@ -1824,18 +2258,19 @@ function portalImpl(props) {
1824
2258
  }, {
1825
2259
  ssrSource: "client"
1826
2260
  });
1827
- if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
2261
+ if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
1828
2262
  ssrSource: "client",
1829
2263
  loadingValue: undefined
1830
2264
  });
1831
2265
  return treeMarker;
1832
2266
  }
1833
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
2267
+ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2268
+ const FLIGHT = Symbol("solid.dynamic-flight");
1834
2269
  function bindingOf(value) {
1835
2270
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1836
2271
  }
1837
- function dynamic(source) {
1838
- let latest = 0;
2272
+ function dynamic(source, options) {
2273
+ if (options?.static) return staticDynamic(untrack(source));
1839
2274
  const sites = new Set();
1840
2275
  let deliveredAddress;
1841
2276
  const resolveBinding = (next, prev) => {
@@ -1849,71 +2284,127 @@ function dynamic(source) {
1849
2284
  }
1850
2285
  return next;
1851
2286
  };
1852
- const cached = solidJs.createMemo(prev => {
2287
+ const sameInstance = (prev, next) => {
2288
+ if (prev === next) return true;
2289
+ const held = bindingOf(prev);
2290
+ const incoming = bindingOf(next);
2291
+ if (!held || !incoming || held.component !== incoming.component) return false;
2292
+ if (held.address === incoming.address) return true;
2293
+ if (deliveredAddress === undefined) return false;
2294
+ if (incoming.address !== deliveredAddress) {
2295
+ deliveredAddress = incoming.address;
2296
+ for (const deliver of sites) deliver(incoming.address);
2297
+ }
2298
+ return true;
2299
+ };
2300
+ const cached = createMemo(prev => {
1853
2301
  const next = source();
1854
2302
  if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1855
- const token = ++latest;
1856
2303
  return {
1857
- then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
2304
+ [FLIGHT]: next
1858
2305
  };
1859
2306
  }, {
1860
- lazy: true
2307
+ lazy: true,
2308
+ equals: sameInstance
1861
2309
  });
1862
2310
  return props => {
1863
- return solidJs.createMemo(() => {
1864
- const component = cached();
2311
+ if (sharedConfig.hydrating) {
2312
+ try {
2313
+ untrack(cached);
2314
+ } catch {}
2315
+ }
2316
+ let latest = 0;
2317
+ const value = createMemo(prev => {
2318
+ const c = cached();
2319
+ if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
2320
+ const next = c[FLIGHT];
2321
+ const token = ++latest;
2322
+ return {
2323
+ then: (onFulfilled, onRejected) => next.then(resolved => {
2324
+ const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
2325
+ return onFulfilled ? onFulfilled(landed) : landed;
2326
+ }, onRejected)
2327
+ };
2328
+ }, {
2329
+ equals: sameInstance
2330
+ });
2331
+ return createMemo(() => {
2332
+ const component = value();
1865
2333
  switch (typeof component) {
1866
2334
  case "function":
1867
2335
  {
1868
2336
  Object.assign(component, {
1869
- [solidJs.$DEVCOMP]: true
2337
+ [$DEVCOMP]: true
1870
2338
  });
1871
2339
  const binding = bindingOf(component);
1872
2340
  if (binding) {
1873
- const [address, setAddress] = solidJs.createSignal(deliveredAddress ?? binding.address);
2341
+ const [address, setAddress] = createSignal(deliveredAddress ??= binding.address);
1874
2342
  sites.add(setAddress);
1875
- solidJs.onCleanup(() => sites.delete(setAddress));
1876
- return solidJs.untrack(() => binding.component(props, address));
2343
+ onCleanup(() => sites.delete(setAddress));
2344
+ return untrack(() => binding.component(props, address));
1877
2345
  }
1878
- return solidJs.untrack(() => component(props));
2346
+ return untrack(() => component(props));
1879
2347
  }
1880
2348
  case "string":
1881
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
1882
- spread(el, props);
1883
- return el;
2349
+ return staticElement(component, props);
1884
2350
  }
1885
2351
  });
1886
2352
  };
1887
2353
  }
2354
+ function staticDynamic(component) {
2355
+ if (component && typeof component.then === "function") throw new Error("dynamic(): a static source must resolve synchronously, not to a promise");
2356
+ if (typeof component === "function") {
2357
+ Object.assign(component, {
2358
+ [$DEVCOMP]: true
2359
+ });
2360
+ const binding = bindingOf(component);
2361
+ if (binding) {
2362
+ const address = () => binding.address;
2363
+ return props => untrack(() => binding.component(props, address));
2364
+ }
2365
+ return props => untrack(() => component(props));
2366
+ }
2367
+ if (typeof component === "string") return props => staticElement(component, props);
2368
+ return () => undefined;
2369
+ }
2370
+ function staticElement(tag, props) {
2371
+ const hydrating = sharedConfig.hydrating;
2372
+ const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
2373
+ spread(el, props);
2374
+ if (hydrating) runHydrationEvents();
2375
+ return el;
2376
+ }
1888
2377
  function Dynamic(props) {
1889
2378
  const Comp = dynamic(() => props.component);
1890
- return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
2379
+ return createComponent(Comp, omit(props, "component"));
1891
2380
  }
1892
- function createElement(tagName, is = undefined) {
1893
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
2381
+ function createElement(tagName, is = undefined, xmlns = undefined) {
2382
+ return xmlns ? document.createElementNS(xmlns, tagName, {
2383
+ is
2384
+ }) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1894
2385
  is
1895
2386
  });
1896
2387
  }
1897
- function loadClientOnly(fn, setComp) {
1898
- fn().then(m => setComp(() => m.default));
2388
+ function loadClientOnly(fn, setComp, exportName) {
2389
+ fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
1899
2390
  }
1900
2391
  function clientOnly(fn, options = {},
1901
2392
  _moduleUrl) {
1902
- const [comp, setComp] = solidJs.createSignal();
2393
+ const [comp, setComp] = createSignal();
1903
2394
  let started = !options.lazy;
1904
- started && loadClientOnly(fn, setComp);
2395
+ started && loadClientOnly(fn, setComp, options.export);
1905
2396
  return props => {
1906
2397
  let Comp;
1907
2398
  let m;
1908
- const rest = solidJs.omit(props, "fallback");
2399
+ const rest = omit(props, "fallback");
1909
2400
  if (!started) {
1910
2401
  started = true;
1911
- loadClientOnly(fn, setComp);
2402
+ loadClientOnly(fn, setComp, options.export);
1912
2403
  }
1913
- if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
1914
- const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
1915
- const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
1916
- const onHydrationEnd = solidJs.sharedConfig.onHydrationEnd;
2404
+ if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
2405
+ const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
2406
+ const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
2407
+ const onHydrationEnd = sharedConfig.onHydrationEnd;
1917
2408
  const release = () => setMounted(true);
1918
2409
  onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
1919
2410
  return gate;
@@ -1922,152 +2413,4 @@ _moduleUrl) {
1922
2413
  function httpStatus(_code, _text) {}
1923
2414
  function httpHeader(_name, _value, _options) {}
1924
2415
 
1925
- Object.defineProperty(exports, "Errored", {
1926
- enumerable: true,
1927
- get: function () { return solidJs.Errored; }
1928
- });
1929
- Object.defineProperty(exports, "For", {
1930
- enumerable: true,
1931
- get: function () { return solidJs.For; }
1932
- });
1933
- Object.defineProperty(exports, "Hydration", {
1934
- enumerable: true,
1935
- get: function () { return solidJs.Hydration; }
1936
- });
1937
- Object.defineProperty(exports, "Loading", {
1938
- enumerable: true,
1939
- get: function () { return solidJs.Loading; }
1940
- });
1941
- Object.defineProperty(exports, "Match", {
1942
- enumerable: true,
1943
- get: function () { return solidJs.Match; }
1944
- });
1945
- Object.defineProperty(exports, "NoHydration", {
1946
- enumerable: true,
1947
- get: function () { return solidJs.NoHydration; }
1948
- });
1949
- Object.defineProperty(exports, "Repeat", {
1950
- enumerable: true,
1951
- get: function () { return solidJs.Repeat; }
1952
- });
1953
- Object.defineProperty(exports, "Reveal", {
1954
- enumerable: true,
1955
- get: function () { return solidJs.Reveal; }
1956
- });
1957
- Object.defineProperty(exports, "Show", {
1958
- enumerable: true,
1959
- get: function () { return solidJs.Show; }
1960
- });
1961
- Object.defineProperty(exports, "Switch", {
1962
- enumerable: true,
1963
- get: function () { return solidJs.Switch; }
1964
- });
1965
- Object.defineProperty(exports, "createComponent", {
1966
- enumerable: true,
1967
- get: function () { return solidJs.createComponent; }
1968
- });
1969
- Object.defineProperty(exports, "getOwner", {
1970
- enumerable: true,
1971
- get: function () { return solidJs.getOwner; }
1972
- });
1973
- Object.defineProperty(exports, "untrack", {
1974
- enumerable: true,
1975
- get: function () { return solidJs.untrack; }
1976
- });
1977
- exports.ChildProperties = ChildProperties;
1978
- exports.DOMElements = DOMElements;
1979
- exports.DOMWithState = DOMWithState;
1980
- exports.DelegatedEvents = DelegatedEvents;
1981
- exports.Dynamic = Dynamic;
1982
- exports.HREF = HREF;
1983
- exports.HydrationScript = voidFn;
1984
- exports.MathMLElements = MathMLElements;
1985
- exports.Namespaces = Namespaces;
1986
- exports.Portal = Portal;
1987
- exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
1988
- exports.RawTextElements = RawTextElements;
1989
- exports.RequestContext = RequestContext;
1990
- exports.ResponseEnvelope = ResponseEnvelope;
1991
- exports.SAFE_ERROR = SAFE_ERROR;
1992
- exports.SVGElements = SVGElements;
1993
- exports.VoidElements = VoidElements;
1994
- exports.acquireAsset = acquireAsset;
1995
- exports.addEvent = addEvent;
1996
- exports.applyRef = applyRef;
1997
- exports.assign = assign;
1998
- exports.claimElement = claimElement;
1999
- exports.claimElementTree = claimElementTree;
2000
- exports.className = className;
2001
- exports.clearFlashCookie = clearFlashCookie;
2002
- exports.clientOnly = clientOnly;
2003
- exports.commitEventResponse = commitEventResponse;
2004
- exports.composeMiddleware = composeMiddleware;
2005
- exports.createRequestEvent = createRequestEvent;
2006
- exports.createResponseStub = createResponseStub;
2007
- exports.createSSRResponse = createSSRResponse;
2008
- exports.delegateEvents = delegateEvents;
2009
- exports.dynamic = dynamic;
2010
- exports.dynamicProperty = dynamicProperty;
2011
- exports.effect = effect;
2012
- exports.escape = escape;
2013
- exports.generateHydrationScript = voidFn;
2014
- exports.getDelegatedRoot = getDelegatedRoot;
2015
- exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
2016
- exports.getFirstChild = getFirstChild;
2017
- exports.getHydrationKey = getHydrationKey;
2018
- exports.getNextElement = getNextElement;
2019
- exports.getNextMarker = getNextMarker;
2020
- exports.getNextMatch = getNextMatch;
2021
- exports.getNextSibling = getNextSibling;
2022
- exports.getRequestEvent = voidFn;
2023
- exports.getServerFunctionMetadata = getServerFunctionMetadata;
2024
- exports.getServerFunctionRPC = getServerFunctionRPC;
2025
- exports.hasFlashCookie = hasFlashCookie;
2026
- exports.httpHeader = httpHeader;
2027
- exports.httpStatus = httpStatus;
2028
- exports.hydrate = hydrate;
2029
- exports.insert = insert;
2030
- exports.installHydrationRuntime = installHydrationRuntime;
2031
- exports.isDev = isDev;
2032
- exports.isHref = isHref;
2033
- exports.isResponseEnvelope = isResponseEnvelope;
2034
- exports.isSafeError = isSafeError;
2035
- exports.isServer = isServer;
2036
- exports.isServerFunction = isServerFunction;
2037
- exports.markSafeError = markSafeError;
2038
- exports.memo = memo;
2039
- exports.mergeProps = mergeProps;
2040
- exports.parseCookieHeader = parseCookieHeader;
2041
- exports.redirect = redirect;
2042
- exports.ref = ref;
2043
- exports.registerDelegatedContainer = registerDelegatedContainer;
2044
- exports.registerDelegatedRoot = registerDelegatedRoot;
2045
- exports.registerElementClaim = registerElementClaim;
2046
- exports.reload = reload;
2047
- exports.render = render;
2048
- exports.renderToStream = renderToStream;
2049
- exports.renderToString = renderToString;
2050
- exports.resolveSSRNode = resolveSSRNode;
2051
- exports.respond = respond;
2052
- exports.runHydrationEvents = runHydrationEvents;
2053
- exports.scope = scope;
2054
- exports.serializeCookie = serializeCookie;
2055
- exports.setAttribute = setAttribute;
2056
- exports.setAttributeNS = setAttributeNS;
2057
- exports.setProperty = setProperty;
2058
- exports.setStyleProperty = setStyleProperty;
2059
- exports.spread = spread;
2060
- exports.ssr = ssr;
2061
- exports.ssrAttribute = ssrAttribute;
2062
- exports.ssrClassName = ssrClassName;
2063
- exports.ssrElement = ssrElement;
2064
- exports.ssrGroup = ssrGroup;
2065
- exports.ssrHydrationKey = ssrHydrationKey;
2066
- exports.ssrStyle = ssrStyle;
2067
- exports.ssrStyleProperty = ssrStyleProperty;
2068
- exports.style = style;
2069
- exports.template = template;
2070
- exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
2071
- exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
2072
- exports.useHead = useHead;
2073
- exports.warmAsset = warmAsset;
2416
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };