@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
package/dist/web.js CHANGED
@@ -1,5 +1,6 @@
1
- import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onCleanup, enableHydration, flush, getOwner, createEffect } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, 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';
3
4
 
4
5
  const DOMWithState = {
5
6
  INPUT: {
@@ -48,6 +49,7 @@ const Namespaces = {
48
49
  const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
49
50
  const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
50
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"]);
51
53
 
52
54
  const transparentOptions = {
53
55
  transparent: true,
@@ -56,23 +58,17 @@ const transparentOptions = {
56
58
  const syncOptions = {
57
59
  sync: true
58
60
  };
59
- const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
60
- sync: true,
61
- ...options,
62
- transparent: !options.scope
63
- } : transparentOptions);
64
- const memo = fn => createMemo(() => fn(), syncOptions);
65
- const assetGates = new WeakMap();
66
- const waitAsset = promise => {
67
- let gate = assetGates.get(promise);
68
- if (!gate) {
69
- runWithOwner(null, () => {
70
- gate = createMemo(() => promise);
71
- });
72
- assetGates.set(promise, gate);
73
- }
74
- gate();
75
- };
61
+ function effect(fn, effectFn, options) {
62
+ const nodeOptions = options ? {
63
+ sync: true,
64
+ ...options,
65
+ transparent: !options.scope
66
+ } : transparentOptions;
67
+ createRenderEffect(fn, effectFn, nodeOptions);
68
+ }
69
+ function memo(fn) {
70
+ return createMemo(() => fn(), syncOptions);
71
+ }
76
72
 
77
73
  function reconcileArrays(parentNode, a, b, marker) {
78
74
  let bLength = b.length,
@@ -86,13 +82,18 @@ function reconcileArrays(parentNode, a, b, marker) {
86
82
  map = null,
87
83
  anchor,
88
84
  anchorTag;
85
+ const isLive = n => {
86
+ if (!n) return false;
87
+ const tag = n[$$SLOT];
88
+ return n.parentNode === parentNode && (!tag || tag === marker);
89
+ };
89
90
  while (aStart < aEnd || bStart < bEnd) {
90
- if (a[aStart] === b[bStart]) {
91
+ if (a[aStart] === b[bStart] && isLive(a[aStart])) {
91
92
  aStart++;
92
93
  bStart++;
93
94
  continue;
94
95
  }
95
- while (a[aEnd - 1] === b[bEnd - 1]) {
96
+ while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
96
97
  aEnd--;
97
98
  bEnd--;
98
99
  }
@@ -212,11 +213,24 @@ function classifyHeadTag(desc) {
212
213
  resource: false
213
214
  };
214
215
  }
216
+ function qualifierValue(name, value) {
217
+ if (value == null || value === false) return null;
218
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
219
+ const v = value === true ? "" : String(value);
220
+ if (name === "as") return asciiLowerCase(v);
221
+ if (name !== "crossorigin") return v;
222
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
223
+ }
224
+ function asciiLowerCase(value) {
225
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
226
+ }
215
227
  function resourceIdentity(tag, props) {
216
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
228
+ const url = String(props.href || props.src || "");
229
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
217
230
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
218
231
  const q = RESOURCE_QUALIFIERS[i];
219
- if (props[q] != null) id += ":" + q + "=" + props[q];
232
+ const value = qualifierValue(q, props[q]);
233
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
220
234
  }
221
235
  return id;
222
236
  }
@@ -295,6 +309,7 @@ function serializeCookie(name, value, options = {}) {
295
309
  if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
296
310
  if (options.httpOnly) cookie += "; HttpOnly";
297
311
  if (options.secure) cookie += "; Secure";
312
+ if (options.partitioned) cookie += "; Partitioned";
298
313
  if (options.sameSite) {
299
314
  const sameSite = options.sameSite.toLowerCase();
300
315
  cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
@@ -323,30 +338,61 @@ function getServerFunctionRPC() {
323
338
  return globalThis[SERVER_FUNCTION_RPC];
324
339
  }
325
340
 
326
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
341
+ const assetGates = new WeakMap();
342
+ const waitAsset = promise => {
343
+ let gate = assetGates.get(promise);
344
+ if (!gate) {
345
+ runWithOwner(null, () => {
346
+ gate = createMemo(() => promise, {
347
+ transparent: true
348
+ });
349
+ });
350
+ assetGates.set(promise, gate);
351
+ }
352
+ gate();
353
+ };
354
+ const EVENT_KEY = "_$$";
355
+ const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
356
+ const $$EVENT_TUPLE = Symbol();
357
+ const hasOwn = Object.prototype.hasOwnProperty;
327
358
  const INNER_OWNED = {};
328
359
  const delegatedEvents = new Set();
329
360
  const delegatedContainers = new Map();
330
- function render$1(code, element, init, options = {}) {
361
+ function voidFn() {}
362
+ function generateHydrationScript(_options) {
363
+ return "";
364
+ }
365
+ function HydrationScript(_props) {
366
+ return null;
367
+ }
368
+ const getRequestEvent = voidFn;
369
+ const getTraceContext = voidFn;
370
+ function render(code, element, init, options = {}) {
331
371
  let disposer;
332
372
  registerDelegatedRoot(element);
333
373
  try {
334
374
  createRoot(dispose => {
335
375
  disposer = dispose;
376
+ if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
336
377
  if (element === document) {
337
378
  const tree = code();
338
379
  effect(() => flatten(tree), () => {});
339
380
  } else {
340
381
  const tree = code();
341
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
382
+ insert(element, () => tree, element.firstChild ? null : undefined, init, {
383
+ ...options.insertOptions,
384
+ schedule: true
385
+ });
342
386
  }
343
387
  }, {
344
388
  id: options.renderId
345
389
  });
390
+ flush();
346
391
  } catch (err) {
347
392
  if (disposer) disposer();
348
393
  unregisterDelegatedRoot(element);
349
394
  throw err;
395
+ } finally {
350
396
  }
351
397
  return () => {
352
398
  disposer();
@@ -428,10 +474,11 @@ function findOwner(target, state) {
428
474
  }
429
475
  function setProperty(node, name, value) {
430
476
  if (isHydrating(node)) return;
431
- node[name] = value;
477
+ const nodeName = node.nodeName;
478
+ 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;
432
479
  }
433
480
  let claimHandlers = null;
434
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
481
+ const CLAIM_SEAM = Symbol.for("solid.element-claims");
435
482
  function registerElementClaim(handler) {
436
483
  (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
437
484
  return () => {
@@ -462,7 +509,17 @@ function claimElement(node) {
462
509
  }
463
510
  function setAttribute(node, name, value) {
464
511
  if (isHydrating(node)) return;
465
- if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
512
+ const selectMultiple = name === "multiple" && node.localName === "select";
513
+ if (value == null || value === false) node.removeAttribute(name);else {
514
+ node.setAttribute(name, value === true ? "" : value);
515
+ if (selectMultiple && !node._$multiple) {
516
+ const options = node.options;
517
+ for (let i = 0; i < options.length; i++) {
518
+ if (options[i].defaultSelected) options[i].selected = true;
519
+ }
520
+ }
521
+ }
522
+ if (selectMultiple) node._$multiple = true;
466
523
  if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
467
524
  }
468
525
  function setAttributeNS(node, namespace, name, value) {
@@ -470,22 +527,32 @@ function setAttributeNS(node, namespace, name, value) {
470
527
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
471
528
  }
472
529
  function className(node, value, prev) {
473
- if (isHydrating(node)) return;
530
+ if (typeof value === "number") value = "" + value;
531
+ if (typeof prev === "number") prev = "" + prev;
532
+ if (isHydrating(node)) {
533
+ node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
534
+ return;
535
+ }
474
536
  if (value == null || value === false) {
475
- prev && node.removeAttribute("class");
537
+ if (prev || node._$classes) {
538
+ node.removeAttribute("class");
539
+ node._$classes = undefined;
540
+ }
476
541
  return;
477
542
  }
478
543
  if (typeof value === "string") {
544
+ node._$classes = undefined;
479
545
  value !== prev && node.setAttribute("class", value);
480
546
  return;
481
547
  }
548
+ let applied;
482
549
  if (typeof prev === "string") {
483
- prev = {};
550
+ applied = {};
484
551
  node.removeAttribute("class");
485
- } else prev = classListToObject(prev || {});
552
+ } else applied = node._$classes || classListToObject(prev || {});
486
553
  value = classListToObject(value);
487
- const classKeys = Object.keys(value || {});
488
- const prevKeys = Object.keys(prev);
554
+ const classKeys = Object.keys(value);
555
+ const prevKeys = Object.keys(applied);
489
556
  let i, len;
490
557
  for (i = 0, len = prevKeys.length; i < len; i++) {
491
558
  const key = prevKeys[i];
@@ -495,22 +562,34 @@ function className(node, value, prev) {
495
562
  for (i = 0, len = classKeys.length; i < len; i++) {
496
563
  const key = classKeys[i],
497
564
  classValue = !!value[key];
498
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
565
+ if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
499
566
  node.classList.add(key);
500
567
  }
568
+ node._$classes = value;
501
569
  }
502
570
  function addEvent(node, name, handler, delegate) {
503
571
  if (delegate) {
572
+ const key = EVENT_KEY + name;
573
+ let data;
504
574
  if (Array.isArray(handler)) {
505
- node[`$$${name}`] = handler[0];
506
- node[`$$${name}Data`] = handler[1];
507
- } else node[`$$${name}`] = handler;
508
- } else if (Array.isArray(handler)) {
575
+ data = handler[1];
576
+ node[key] = handler[0];
577
+ } else node[key] = handler;
578
+ node[`${key}Data`] = data;
579
+ return;
580
+ }
581
+ if (Array.isArray(handler)) {
509
582
  const handlerFn = handler[0];
510
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
511
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
583
+ const listener = e => handlerFn.call(node, handler[1], e);
584
+ listener[$$EVENT_TUPLE] = handler;
585
+ node.addEventListener(name, listener);
586
+ return listener;
587
+ }
588
+ node.addEventListener(name, handler, typeof handler !== "function" && handler);
589
+ return handler;
512
590
  }
513
591
  function style(node, value, prev) {
592
+ if (isHydrating(node)) return;
514
593
  if (!value) {
515
594
  if (prev || node._$styles) {
516
595
  setAttribute(node, "style");
@@ -535,12 +614,13 @@ function style(node, value, prev) {
535
614
  }
536
615
  let v, s;
537
616
  for (s in applied) {
538
- if (value[s] == null) {
617
+ if (!hasOwn.call(value, s) || value[s] == null) {
539
618
  nodeStyle.removeProperty(s);
540
619
  delete applied[s];
541
620
  }
542
621
  }
543
622
  for (s in value) {
623
+ if (!hasOwn.call(value, s)) continue;
544
624
  v = value[s];
545
625
  if (v != null && v !== applied[s]) {
546
626
  nodeStyle.setProperty(s, v);
@@ -548,26 +628,122 @@ function style(node, value, prev) {
548
628
  }
549
629
  }
550
630
  }
631
+ function readShallow(value) {
632
+ if (value === null || typeof value !== "object") return value;
633
+ if (Array.isArray(value)) return value.map(readShallow);
634
+ if (value[$PROXY] !== value) return value;
635
+ const keys = sourceKeys(value, SOURCE_PROXY);
636
+ const out = {};
637
+ for (let i = 0; i < keys.length; i++) {
638
+ const k = keys[i];
639
+ if (typeof k === "string") out[k] = value[k];
640
+ }
641
+ return out;
642
+ }
551
643
  function setStyleProperty(node, name, value) {
644
+ if (isHydrating(node)) return;
552
645
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
553
646
  }
554
- function spread(node, props = {}, skipChildren) {
647
+ function spread(node, props, skipChildren, skip, name) {
555
648
  const prevProps = {};
556
- if (!skipChildren) insert(node, () => props.children);
557
- effect(() => {
558
- const r = props.ref;
559
- (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
560
- }, () => {});
649
+ const apply = newProps => {
650
+ const r = newProps.ref;
651
+ if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
652
+ assign(node, newProps, true, prevProps, true);
653
+ };
654
+ if (Array.isArray(props)) {
655
+ if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
656
+ for (let i = props.length - 1; i >= 0; i--) {
657
+ const s = resolveSource(props[i]);
658
+ if (s != null && entryHas(s, "children")) return entryGet(s, "children");
659
+ }
660
+ });
661
+ effect(() => collectSources({}, props, undefined, skip), apply);
662
+ return prevProps;
663
+ }
664
+ if (!skipChildren && !(skip !== undefined && skip("children"))) {
665
+ if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
666
+ const desc = Object.getOwnPropertyDescriptor(props, "children");
667
+ if (desc !== undefined) {
668
+ if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
669
+ }
670
+ } else insert(node, () => {
671
+ const source = resolveSource(props);
672
+ return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
673
+ });
674
+ }
561
675
  effect(() => {
676
+ const source = resolveSource(props);
562
677
  const newProps = {};
563
- for (const prop in props) {
564
- if (prop === "children" || prop === "ref") continue;
565
- newProps[prop] = props[prop];
678
+ const table = resolvedTable(source);
679
+ if (table !== undefined) return collectTable(newProps, table, skip);
680
+ if (source != null) {
681
+ const view = viewOf(source);
682
+ 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);
566
683
  }
567
684
  return newProps;
568
- }, props => assign(node, props, true, prevProps, true));
685
+ }, apply);
569
686
  return prevProps;
570
687
  }
688
+ function collectTable(out, table, skip) {
689
+ for (const [prop, leaf] of table) {
690
+ if (typeof prop !== "string" || prop === "children") continue;
691
+ if (skip !== undefined && skip(prop)) continue;
692
+ const v = leaf[prop];
693
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
694
+ }
695
+ return out;
696
+ }
697
+ function resolveSource(s) {
698
+ return typeof s === "function" ? s() : s;
699
+ }
700
+ function entryHas(s, key) {
701
+ const view = viewOf(s);
702
+ return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
703
+ }
704
+ function entryGet(s, key) {
705
+ const view = viewOf(s);
706
+ return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
707
+ }
708
+ function collectSources(out, sources, kinds, skip) {
709
+ const resolved = [];
710
+ const resolvedKinds = [];
711
+ for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
712
+ for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
713
+ return out;
714
+ }
715
+ function pushEntry(resolved, kinds, s, kind) {
716
+ if (kind !== SOURCE_MEMO) {
717
+ resolved.push(s);
718
+ kinds.push(kind);
719
+ return;
720
+ }
721
+ s = resolveSource(s);
722
+ if (s == null) return;
723
+ const view = viewOf(s);
724
+ if (view instanceof OmitView) {
725
+ resolved.push(view);
726
+ kinds.push(SOURCE_OMIT);
727
+ } else if (view !== undefined) {
728
+ const f = view.sources,
729
+ k = view.kinds;
730
+ for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
731
+ } else {
732
+ resolved.push(s);
733
+ kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
734
+ }
735
+ }
736
+ function collectProps(out, s, kind, skip, later, laterKinds, from) {
737
+ const keys = sourceKeys(s, kind);
738
+ outer: for (let i = 0; i < keys.length; i++) {
739
+ const prop = keys[i];
740
+ if (typeof prop !== "string" || prop === "children") continue;
741
+ if (skip !== undefined && skip(prop)) continue;
742
+ if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
743
+ const v = sourceGet(s, kind, prop);
744
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
745
+ }
746
+ }
571
747
  function dynamicProperty(props, key) {
572
748
  const src = props[key];
573
749
  Object.defineProperty(props, key, {
@@ -597,8 +773,7 @@ function installHydrationRuntime() {
597
773
  hydrationRt = {
598
774
  claimInitial(parent, multi, initial) {
599
775
  if (isHydrating(parent)) {
600
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
601
- if (Array.isArray(initial)) stripTextSeparators(initial);
776
+ if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
602
777
  }
603
778
  return initial;
604
779
  },
@@ -622,7 +797,7 @@ function installHydrationRuntime() {
622
797
  nodes.unshift(node);
623
798
  node = node.previousSibling;
624
799
  }
625
- } else nodes = [...parent.childNodes];
800
+ } else return claimChildNodes(parent);
626
801
  return stripTextSeparators(nodes);
627
802
  },
628
803
  dedupEvent(e) {
@@ -635,19 +810,36 @@ function stripTextSeparators(nodes) {
635
810
  for (let i = 0; i < nodes.length; i++) {
636
811
  const node = nodes[i],
637
812
  t = node.nodeType;
638
- if (t === 8) {
639
- const v = node.nodeValue;
640
- if (v === "!$") {
641
- node.remove();
642
- continue;
643
- }
644
- if (v.startsWith("pl-")) continue;
645
- } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
813
+ if (t === 8 && node.nodeValue === "!$") {
814
+ node.remove();
815
+ continue;
816
+ }
817
+ if (isPlaceholderScaffolding(node, t)) continue;
646
818
  nodes[j++] = node;
647
819
  }
648
820
  nodes.length = j;
649
821
  return nodes;
650
822
  }
823
+ function claimChildNodes(parent) {
824
+ const live = parent.childNodes;
825
+ const out = [];
826
+ for (let i = 0, n = live.length; i < n; i++) {
827
+ const node = live[i],
828
+ t = node.nodeType;
829
+ if (t === 8 && node.nodeValue === "!$") {
830
+ node.remove();
831
+ i--;
832
+ n--;
833
+ continue;
834
+ }
835
+ if (isPlaceholderScaffolding(node, t)) continue;
836
+ out.push(node);
837
+ }
838
+ return out;
839
+ }
840
+ function isPlaceholderScaffolding(node, t) {
841
+ return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
842
+ }
651
843
  function insert(parent, accessor, marker, initial, options) {
652
844
  const multi = marker !== undefined;
653
845
  const host = options && options.host;
@@ -712,10 +904,16 @@ function assetEntryKey(descriptor) {
712
904
  if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
713
905
  return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
714
906
  }
715
- function findAssetElement(selector, attr, value) {
907
+ function findAssetElement(selector, attr, value, qualifiers) {
716
908
  const nodes = document.querySelectorAll(selector);
717
- for (let i = 0; i < nodes.length; i++) {
718
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
909
+ outer: for (let i = 0; i < nodes.length; i++) {
910
+ if (nodes[i].getAttribute(attr) !== value) continue;
911
+ if (!qualifiers) return nodes[i];
912
+ for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
913
+ const name = RESOURCE_QUALIFIERS[q];
914
+ if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
915
+ }
916
+ return nodes[i];
719
917
  }
720
918
  return null;
721
919
  }
@@ -888,7 +1086,7 @@ function initHeadRegistry() {
888
1086
  headOwned = new Map();
889
1087
  headApplied = new Map();
890
1088
  const t = document.querySelector("title");
891
- headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
1089
+ headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
892
1090
  if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
893
1091
  }
894
1092
  function applyServerHeadOps(ops) {
@@ -943,7 +1141,11 @@ function flushHeadRegistry() {
943
1141
  headOwned.delete(identity);
944
1142
  headApplied.delete(identity);
945
1143
  if (identity === "title") {
946
- if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
1144
+ if (headFallbackTitle != null) {
1145
+ const el = setHeadTitle(headFallbackTitle);
1146
+ el.removeAttribute("data-dh");
1147
+ el.removeAttribute("data-dhf");
1148
+ }
947
1149
  } else {
948
1150
  for (let i = 0; i < els.length; i++) els[i].remove();
949
1151
  }
@@ -1015,8 +1217,8 @@ function mountHeadResource(tag, props) {
1015
1217
  headMountedResources.add(identity);
1016
1218
  const url = props.href || props.src;
1017
1219
  let el = null;
1018
- if (url != null) {
1019
- 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);
1220
+ if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
1221
+ 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);
1020
1222
  }
1021
1223
  if (!el) document.head.appendChild(createHeadElement(tag, props));
1022
1224
  }
@@ -1038,7 +1240,7 @@ function gateHeadResource(props) {
1038
1240
  if (attrs) descriptor.attrs = attrs;
1039
1241
  effect(() => {
1040
1242
  const entry = warmAsset(descriptor);
1041
- if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1243
+ if (gateable && !sharedConfig.hydrating && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1042
1244
  }, () => acquireAsset(descriptor));
1043
1245
  }
1044
1246
  function useHead(tags) {
@@ -1107,7 +1309,7 @@ function loadModuleAssets(mapping) {
1107
1309
  const pending = [];
1108
1310
  for (const key in mapping) {
1109
1311
  if (hy.modules[key]) continue;
1110
- const entryUrl = mapping[key];
1312
+ const entryUrl = new URL(mapping[key], document.baseURI).href;
1111
1313
  if (!hy.loading[key]) {
1112
1314
  hy.loading[key] = import(entryUrl).then(mod => {
1113
1315
  hy.modules[key] = mod;
@@ -1120,9 +1322,19 @@ function loadModuleAssets(mapping) {
1120
1322
  }
1121
1323
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1122
1324
  }
1123
- function hydrate$1(code, element, options = {}) {
1325
+ function hydrate(code, element, options = {}) {
1326
+ enableHydration();
1124
1327
  installHydrationRuntime();
1125
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1328
+ if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
1329
+ const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
1330
+ if (head && element.contains(head)) {
1331
+ let n = head.firstChild;
1332
+ while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
1333
+ const next = n.nextSibling;
1334
+ head.appendChild(n);
1335
+ n = next;
1336
+ }
1337
+ }
1126
1338
  options.renderId ||= "";
1127
1339
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1128
1340
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -1171,22 +1383,26 @@ function hydrate$1(code, element, options = {}) {
1171
1383
  sharedConfig.gather = gather;
1172
1384
  sharedConfig.hydrating = true;
1173
1385
  try {
1174
- disposer = render$1(code, element, [...element.childNodes], options);
1386
+ disposer = render(code, element, [...element.childNodes], options);
1175
1387
  } finally {
1176
1388
  sharedConfig.hydrating = false;
1177
1389
  }
1178
1390
  }, err => {
1179
- console.error("Hydration module preload failed, falling back to client render:", err);
1180
1391
  sharedConfig.hydrating = false;
1181
1392
  sharedConfig.registry = undefined;
1182
- disposer = render$1(code, element, [...element.childNodes], options);
1393
+ if (element.nodeType === 9) {
1394
+ (globalThis.reportError || console.error)(err);
1395
+ return;
1396
+ }
1397
+ console.error("Hydration module preload failed, falling back to client render:", err);
1398
+ disposer = render(code, element, [...element.childNodes], options);
1183
1399
  });
1184
1400
  return () => disposer && disposer();
1185
1401
  }
1186
1402
  }
1187
1403
  try {
1188
1404
  gatherHydratable(element, options.renderId);
1189
- return render$1(code, element, [...element.childNodes], options);
1405
+ return render(code, element, [...element.childNodes], options);
1190
1406
  } finally {
1191
1407
  sharedConfig.hydrating = false;
1192
1408
  }
@@ -1286,6 +1502,7 @@ function runHydrationEvents() {
1286
1502
  }
1287
1503
  function isHydrating(node) {
1288
1504
  if (!sharedConfig.hydrating) return false;
1505
+ if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
1289
1506
  if (!node || node.isConnected) return true;
1290
1507
  const roots = sharedConfig.claimRoots;
1291
1508
  if (roots) {
@@ -1317,7 +1534,8 @@ function classListToObject(classList) {
1317
1534
  function flattenClassList(list, result) {
1318
1535
  for (let i = 0, len = list.length; i < len; i++) {
1319
1536
  const item = list[i];
1320
- 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;
1537
+ if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
1538
+ else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
1321
1539
  }
1322
1540
  }
1323
1541
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
@@ -1333,12 +1551,13 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
1333
1551
  const name = prop.slice(2).toLowerCase();
1334
1552
  const delegate = DelegatedEvents.has(name);
1335
1553
  if (!delegate && prev) {
1336
- const h = Array.isArray(prev) ? prev[0] : prev;
1337
- node.removeEventListener(name, h);
1554
+ if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
1555
+ node.removeEventListener(name, prev, typeof prev !== "function" && prev);
1338
1556
  }
1339
1557
  if (delegate || value) {
1340
- addEvent(node, name, value, delegate);
1558
+ const attached = addEvent(node, name, value, delegate);
1341
1559
  delegate && delegateEvents([name]);
1560
+ if (!delegate) return attached;
1342
1561
  }
1343
1562
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1344
1563
  if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
@@ -1360,9 +1579,10 @@ function eventHandler(e, container, state) {
1360
1579
  }
1361
1580
  const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1362
1581
  if (state && !owner) return;
1582
+ if (owner && owner === resumeNode) return;
1363
1583
  e[$$EVENT_OWNER] = owner || true;
1364
1584
  let node = resumeNode || e.target;
1365
- const key = `$$${e.type}`;
1585
+ const key = EVENT_KEY + e.type;
1366
1586
  const oriTarget = e.target;
1367
1587
  const boundary = owner || container || e.currentTarget;
1368
1588
  const retarget = value => Object.defineProperty(e, "target", {
@@ -1370,17 +1590,21 @@ function eventHandler(e, container, state) {
1370
1590
  value
1371
1591
  });
1372
1592
  const handleNode = () => {
1373
- const handler = node[key];
1593
+ let handler = node[key];
1594
+ if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
1595
+ const seam = globalThis[Symbol.for("solid.bnd")];
1596
+ if (seam) handler = seam.resolve(node, e.type);
1597
+ }
1374
1598
  if (handler && !node.disabled) {
1375
1599
  const data = node[`${key}Data`];
1376
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
1600
+ data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
1377
1601
  if (e.cancelBubble) return;
1378
1602
  }
1379
1603
  node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1380
1604
  return true;
1381
1605
  };
1382
1606
  const walkUpTree = () => {
1383
- while (handleNode()) {
1607
+ while (node && handleNode()) {
1384
1608
  if (node === boundary || node.parentNode === boundary) break;
1385
1609
  node = node._$host || node.parentNode || node.host;
1386
1610
  }
@@ -1417,7 +1641,16 @@ function eventHandler(e, container, state) {
1417
1641
  }
1418
1642
  function insertExpression(parent, value, current, marker) {
1419
1643
  if (hydrationRt !== null && isHydrating(parent)) {
1420
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1644
+ if (value && value !== current) {
1645
+ const arr = Array.isArray(value);
1646
+ for (const n of arr ? value : [value]) {
1647
+ if (n && n.nodeType) {
1648
+ if (!isHydrating(n)) return current;
1649
+ } else if (arr && (typeof n === "string" || typeof n === "number")) {
1650
+ return current;
1651
+ }
1652
+ }
1653
+ }
1421
1654
  return value;
1422
1655
  }
1423
1656
  if (value === current) return value;
@@ -1438,16 +1671,27 @@ function insertExpression(parent, value, current, marker) {
1438
1671
  } else if (value.nodeType) {
1439
1672
  if (Array.isArray(current)) {
1440
1673
  cleanChildren(parent, current, multi ? marker : null, value);
1441
- } else if (current && current.nodeType) {
1674
+ } else if (current != null && current.nodeType) {
1442
1675
  current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1443
- } else if (current && parent.firstChild) {
1676
+ } else if (current != null && parent.firstChild) {
1444
1677
  parent.replaceChild(value, parent.firstChild);
1445
1678
  } else {
1446
1679
  parent.appendChild(value);
1447
1680
  }
1448
1681
  if (marker) value[$$SLOT] = marker;
1449
1682
  } else if (Array.isArray(value)) {
1450
- const currentArray = current && Array.isArray(current);
1683
+ const currentArray = Array.isArray(current);
1684
+ for (let i = 0, len = value.length; i < len; i++) {
1685
+ const item = value[i],
1686
+ t = typeof item;
1687
+ if (t === "string" || t === "number") {
1688
+ const prev = currentArray ? current[i] : undefined;
1689
+ if (prev && prev.nodeType === 3) {
1690
+ if (prev.data !== "" + item) prev.data = item;
1691
+ value[i] = prev;
1692
+ } else value[i] = document.createTextNode(item);
1693
+ }
1694
+ }
1451
1695
  if (value.length === 0) {
1452
1696
  cleanChildren(parent, current, marker);
1453
1697
  } else if (currentArray) {
@@ -1455,7 +1699,7 @@ function insertExpression(parent, value, current, marker) {
1455
1699
  appendNodes(parent, value, marker);
1456
1700
  } else reconcileArrays(parent, current, value, marker);
1457
1701
  } else {
1458
- current && cleanChildren(parent, current);
1702
+ if (current != null) cleanChildren(parent, current);
1459
1703
  appendNodes(parent, value);
1460
1704
  }
1461
1705
  } else ;
@@ -1468,12 +1712,12 @@ function normalize(value, current, multi, doNotUnwrap) {
1468
1712
  });
1469
1713
  if (doNotUnwrap && typeof value === "function") return value;
1470
1714
  if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1471
- if (Array.isArray(value)) {
1715
+ if (sharedConfig.hydrating && Array.isArray(value)) {
1472
1716
  for (let i = 0, len = value.length; i < len; i++) {
1473
1717
  const item = value[i],
1474
1718
  prev = current && current[i],
1475
1719
  t = typeof item;
1476
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1720
+ if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
1477
1721
  }
1478
1722
  }
1479
1723
  return value;
@@ -1539,24 +1783,33 @@ function cleanChildren(parent, current, marker, replacement) {
1539
1783
  }
1540
1784
  function gatherHydratable(element, root) {
1541
1785
  const templates = element.querySelectorAll(`*[_hk]`);
1786
+ const frames = root ? null : element.querySelectorAll("[data-fid]");
1787
+ const frameCount = frames ? frames.length : 0;
1788
+ const registry = sharedConfig.registry;
1542
1789
  for (let i = 0; i < templates.length; i++) {
1543
1790
  const node = templates[i];
1544
1791
  const key = node.getAttribute("_hk");
1545
1792
  if (root) {
1546
1793
  if (!key.startsWith(root)) continue;
1547
- } else {
1548
- const frame = node.closest("[data-fid]");
1549
- if (frame && frame !== element && element.contains(frame)) continue;
1794
+ } else if (frameCount !== 0) {
1795
+ let inFrame = false;
1796
+ for (let j = 0; j < frameCount; j++) {
1797
+ if (frames[j].contains(node)) {
1798
+ inFrame = true;
1799
+ break;
1800
+ }
1801
+ }
1802
+ if (inFrame) continue;
1550
1803
  }
1551
- if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1804
+ if (!registry.has(key)) registry.set(key, node);
1552
1805
  }
1553
1806
  }
1554
1807
  function getHydrationKey() {
1555
1808
  return sharedConfig.getNextContextId();
1556
1809
  }
1557
- const voidFn = () => undefined;
1558
1810
  const RequestContext = Symbol();
1559
1811
 
1812
+ function configureServerErrors(_config) {}
1560
1813
  function throwInBrowser(func) {
1561
1814
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1562
1815
  console.error(err);
@@ -1586,14 +1839,15 @@ function composeMiddleware(middlewares) {
1586
1839
  throwInBrowser(composeMiddleware);
1587
1840
  }
1588
1841
  function ssr(template, ...nodes) {}
1589
- function ssrElement(name, props, children, needsId) {}
1842
+ function ssrElement(name, props, children, needsId, skip, attrs) {}
1843
+ function ssrElementAttribute(key, value) {}
1590
1844
  function ssrClassName(value) {}
1591
1845
  function ssrStyle(value) {}
1592
1846
  function ssrStyleProperty(name, value) {}
1593
1847
  function ssrAttribute(key, value) {}
1594
1848
  function ssrGroup(fn, n) {}
1595
1849
  function ssrHydrationKey() {}
1596
- function resolveSSRNode(node, result, top) {}
1850
+ function resolveSSRNode(node, result, top, nested) {}
1597
1851
  function escape(s, attr) {}
1598
1852
 
1599
1853
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
@@ -1630,11 +1884,16 @@ function isSafeError(value) {
1630
1884
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1631
1885
  }
1632
1886
  const REVALIDATE_HEADER = "X-Revalidate";
1633
- function initWithRevalidate(init) {
1887
+ const REVALIDATE_ALL = "*";
1888
+ const RESPONSE_HEADER_VALUE_LIMIT = 4096;
1889
+ function initWithRevalidate(init = {}) {
1890
+ const resolved = typeof init === "number" ? {
1891
+ status: init
1892
+ } : init;
1634
1893
  const {
1635
1894
  revalidate,
1636
1895
  ...responseInit
1637
- } = init;
1896
+ } = resolved;
1638
1897
  let headers;
1639
1898
  if (responseInit.headers && responseInit.headers.getSetCookie) {
1640
1899
  headers = new Headers();
@@ -1647,7 +1906,17 @@ function initWithRevalidate(init) {
1647
1906
  } else {
1648
1907
  headers = new Headers(responseInit.headers);
1649
1908
  }
1650
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1909
+ if (revalidate !== undefined) {
1910
+ const list = Array.isArray(revalidate) ? revalidate : [revalidate];
1911
+ if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
1912
+ 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.`);
1913
+ }
1914
+ const keys = list.join(",");
1915
+ if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
1916
+ 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.`);
1917
+ }
1918
+ headers.set(REVALIDATE_HEADER, keys);
1919
+ }
1651
1920
  return {
1652
1921
  responseInit,
1653
1922
  headers
@@ -1660,13 +1929,17 @@ function redirect(url, init = 302) {
1660
1929
  const {
1661
1930
  responseInit,
1662
1931
  headers
1663
- } = initWithRevalidate(typeof init === "number" ? {
1664
- status: init
1665
- } : init);
1932
+ } = initWithRevalidate(init);
1666
1933
  if (responseInit.status === undefined) {
1667
1934
  responseInit.status = 302;
1668
1935
  }
1669
- headers.set("Location", String(url));
1936
+ const target = typeof url === "string" ? url : url[HREF];
1937
+ const location = typeof target === "string" ? target : String(url);
1938
+ const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
1939
+ if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
1940
+ 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.`);
1941
+ }
1942
+ headers.set("Location", encoded);
1670
1943
  return new Response(null, {
1671
1944
  ...responseInit,
1672
1945
  headers
@@ -1682,11 +1955,19 @@ function reload(init = {}) {
1682
1955
  headers
1683
1956
  });
1684
1957
  }
1958
+ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
1685
1959
  function respond(value, init = {}) {
1686
1960
  const {
1687
1961
  responseInit,
1688
1962
  headers
1689
1963
  } = initWithRevalidate(init);
1964
+ for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
1965
+ if (NULL_BODY_STATUSES.has(responseInit.status)) {
1966
+ return new ResponseEnvelope(new Response(null, {
1967
+ ...responseInit,
1968
+ headers
1969
+ }), value);
1970
+ }
1690
1971
  headers.set("Content-Type", "application/json");
1691
1972
  return new ResponseEnvelope(new Response(JSON.stringify(value), {
1692
1973
  ...responseInit,
@@ -1694,26 +1975,8 @@ function respond(value, init = {}) {
1694
1975
  }), value);
1695
1976
  }
1696
1977
 
1697
- const mergeProps = merge;
1698
1978
  const isServer = false;
1699
1979
  const isDev = false;
1700
- function render(code, element, init, options = {}) {
1701
- try {
1702
- const dispose = render$1(code, element, init, {
1703
- ...options,
1704
- insertOptions: {
1705
- schedule: true
1706
- }
1707
- });
1708
- flush();
1709
- return dispose;
1710
- } finally {
1711
- }
1712
- }
1713
- const hydrate = (...args) => {
1714
- enableHydration();
1715
- return hydrate$1(...args);
1716
- };
1717
1980
  function Portal(props) {
1718
1981
  return runWithOwner(createOwner(), () => portalImpl(props));
1719
1982
  }
@@ -1766,12 +2029,13 @@ function portalImpl(props) {
1766
2029
  });
1767
2030
  return treeMarker;
1768
2031
  }
1769
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
2032
+ const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2033
+ const FLIGHT = Symbol("solid.dynamic-flight");
1770
2034
  function bindingOf(value) {
1771
2035
  return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1772
2036
  }
1773
- function dynamic(source) {
1774
- let latest = 0;
2037
+ function dynamic(source, options) {
2038
+ if (options?.static) return staticDynamic(untrack(source));
1775
2039
  const sites = new Set();
1776
2040
  let deliveredAddress;
1777
2041
  const resolveBinding = (next, prev) => {
@@ -1785,25 +2049,58 @@ function dynamic(source) {
1785
2049
  }
1786
2050
  return next;
1787
2051
  };
2052
+ const sameInstance = (prev, next) => {
2053
+ if (prev === next) return true;
2054
+ const held = bindingOf(prev);
2055
+ const incoming = bindingOf(next);
2056
+ if (!held || !incoming || held.component !== incoming.component) return false;
2057
+ if (held.address === incoming.address) return true;
2058
+ if (deliveredAddress === undefined) return false;
2059
+ if (incoming.address !== deliveredAddress) {
2060
+ deliveredAddress = incoming.address;
2061
+ for (const deliver of sites) deliver(incoming.address);
2062
+ }
2063
+ return true;
2064
+ };
1788
2065
  const cached = createMemo(prev => {
1789
2066
  const next = source();
1790
2067
  if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1791
- const token = ++latest;
1792
2068
  return {
1793
- then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
2069
+ [FLIGHT]: next
1794
2070
  };
1795
2071
  }, {
1796
- lazy: true
2072
+ lazy: true,
2073
+ equals: sameInstance
1797
2074
  });
1798
2075
  return props => {
2076
+ if (sharedConfig.hydrating) {
2077
+ try {
2078
+ untrack(cached);
2079
+ } catch {}
2080
+ }
2081
+ let latest = 0;
2082
+ const value = createMemo(prev => {
2083
+ const c = cached();
2084
+ if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
2085
+ const next = c[FLIGHT];
2086
+ const token = ++latest;
2087
+ return {
2088
+ then: (onFulfilled, onRejected) => next.then(resolved => {
2089
+ const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
2090
+ return onFulfilled ? onFulfilled(landed) : landed;
2091
+ }, onRejected)
2092
+ };
2093
+ }, {
2094
+ equals: sameInstance
2095
+ });
1799
2096
  return createMemo(() => {
1800
- const component = cached();
2097
+ const component = value();
1801
2098
  switch (typeof component) {
1802
2099
  case "function":
1803
2100
  {
1804
2101
  const binding = bindingOf(component);
1805
2102
  if (binding) {
1806
- const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
2103
+ const [address, setAddress] = createSignal(deliveredAddress ??= binding.address);
1807
2104
  sites.add(setAddress);
1808
2105
  onCleanup(() => sites.delete(setAddress));
1809
2106
  return untrack(() => binding.component(props, address));
@@ -1811,37 +2108,56 @@ function dynamic(source) {
1811
2108
  return untrack(() => component(props));
1812
2109
  }
1813
2110
  case "string":
1814
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
1815
- spread(el, props);
1816
- return el;
2111
+ return staticElement(component, props);
1817
2112
  }
1818
2113
  });
1819
2114
  };
1820
2115
  }
2116
+ function staticDynamic(component) {
2117
+ if (typeof component === "function") {
2118
+ const binding = bindingOf(component);
2119
+ if (binding) {
2120
+ const address = () => binding.address;
2121
+ return props => untrack(() => binding.component(props, address));
2122
+ }
2123
+ return props => untrack(() => component(props));
2124
+ }
2125
+ if (typeof component === "string") return props => staticElement(component, props);
2126
+ return () => undefined;
2127
+ }
2128
+ function staticElement(tag, props) {
2129
+ const hydrating = sharedConfig.hydrating;
2130
+ const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
2131
+ spread(el, props);
2132
+ if (hydrating) runHydrationEvents();
2133
+ return el;
2134
+ }
1821
2135
  function Dynamic(props) {
1822
2136
  const Comp = dynamic(() => props.component);
1823
2137
  return createComponent(Comp, omit(props, "component"));
1824
2138
  }
1825
- function createElement(tagName, is = undefined) {
1826
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
2139
+ function createElement(tagName, is = undefined, xmlns = undefined) {
2140
+ return xmlns ? document.createElementNS(xmlns, tagName, {
2141
+ is
2142
+ }) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1827
2143
  is
1828
2144
  });
1829
2145
  }
1830
- function loadClientOnly(fn, setComp) {
1831
- fn().then(m => setComp(() => m.default));
2146
+ function loadClientOnly(fn, setComp, exportName) {
2147
+ fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
1832
2148
  }
1833
2149
  function clientOnly(fn, options = {},
1834
2150
  _moduleUrl) {
1835
2151
  const [comp, setComp] = createSignal();
1836
2152
  let started = !options.lazy;
1837
- started && loadClientOnly(fn, setComp);
2153
+ started && loadClientOnly(fn, setComp, options.export);
1838
2154
  return props => {
1839
2155
  let Comp;
1840
2156
  let m;
1841
2157
  const rest = omit(props, "fallback");
1842
2158
  if (!started) {
1843
2159
  started = true;
1844
- loadClientOnly(fn, setComp);
2160
+ loadClientOnly(fn, setComp, options.export);
1845
2161
  }
1846
2162
  if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
1847
2163
  const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
@@ -1855,4 +2171,4 @@ _moduleUrl) {
1855
2171
  function httpStatus(_code, _text) {}
1856
2172
  function httpHeader(_name, _value, _options) {}
1857
2173
 
1858
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };
2174
+ 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 };