@solidjs/web 2.0.0-rc.7 → 2.0.0-rc.8

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 (72) hide show
  1. package/dist/server.dev.js +15 -2
  2. package/dist/server.js +15 -2
  3. package/dist/web.dev.js +41 -9
  4. package/dist/web.js +39 -8
  5. package/dist/{web.cjs → web.observe.js} +137 -239
  6. package/frames/dist/server.dev.js +19 -0
  7. package/frames/dist/server.js +19 -0
  8. package/frames/package.json +6 -24
  9. package/package.json +81 -314
  10. package/serialization/decode/package.json +3 -9
  11. package/serialization/package.json +3 -9
  12. package/serialization/types/serializer-decode.d.ts +49 -2
  13. package/server-functions/dist/server.dev.js +28 -10
  14. package/server-functions/dist/server.js +28 -10
  15. package/server-functions/package.json +6 -24
  16. package/server-functions/rich-args/package.json +3 -9
  17. package/storage/package.json +3 -9
  18. package/types/client.d.ts +17 -0
  19. package/types/frames/serializer-decode.d.ts +49 -2
  20. package/types/serializer-decode.d.ts +49 -2
  21. package/types/server-functions/server.d.ts +27 -4
  22. package/types/server.d.ts +1 -1
  23. package/dist/server.cjs +0 -3708
  24. package/dist/server.dev.cjs +0 -3794
  25. package/dist/web.dev.cjs +0 -2285
  26. package/frames/dist/client.cjs +0 -2043
  27. package/frames/dist/client.dev.cjs +0 -2063
  28. package/frames/dist/server.cjs +0 -4542
  29. package/frames/dist/server.dev.cjs +0 -4584
  30. package/serialization/dist/decode.cjs +0 -155
  31. package/serialization/dist/serialization.cjs +0 -275
  32. package/serialization/types-cjs/index.d.cts +0 -101
  33. package/serialization/types-cjs/package.json +0 -3
  34. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  35. package/serialization/types-cjs/serializer.d.cts +0 -101
  36. package/server-functions/dist/client.cjs +0 -1069
  37. package/server-functions/dist/rich-args.cjs +0 -11
  38. package/server-functions/dist/server.cjs +0 -2381
  39. package/server-functions/dist/server.dev.cjs +0 -2409
  40. package/storage/dist/storage.cjs +0 -12
  41. package/storage/types-cjs/index.d.cts +0 -28
  42. package/storage/types-cjs/package.json +0 -3
  43. package/types-cjs/client.d.cts +0 -197
  44. package/types-cjs/constants.d.cts +0 -20
  45. package/types-cjs/cookies.d.cts +0 -41
  46. package/types-cjs/frames/client.d.cts +0 -36
  47. package/types-cjs/frames/frame-client.d.cts +0 -370
  48. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  49. package/types-cjs/frames/frame-sink.d.cts +0 -92
  50. package/types-cjs/frames/frame-transport.d.cts +0 -189
  51. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  52. package/types-cjs/frames/serializer.d.cts +0 -101
  53. package/types-cjs/frames/server.d.cts +0 -52
  54. package/types-cjs/head.d.cts +0 -19
  55. package/types-cjs/index.d.cts +0 -191
  56. package/types-cjs/index.server.d.cts +0 -147
  57. package/types-cjs/jsx-properties.d.cts +0 -93
  58. package/types-cjs/jsx.d.cts +0 -4146
  59. package/types-cjs/package.json +0 -3
  60. package/types-cjs/reconcile.d.cts +0 -1
  61. package/types-cjs/render.d.cts +0 -6
  62. package/types-cjs/response.d.cts +0 -81
  63. package/types-cjs/serializer-decode.d.cts +0 -172
  64. package/types-cjs/serializer.d.cts +0 -101
  65. package/types-cjs/server-functions/client.d.cts +0 -184
  66. package/types-cjs/server-functions/flash.d.cts +0 -36
  67. package/types-cjs/server-functions/registry.d.cts +0 -100
  68. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  69. package/types-cjs/server-functions/server.d.cts +0 -546
  70. package/types-cjs/server-functions/shared.d.cts +0 -283
  71. package/types-cjs/server-mock.d.cts +0 -337
  72. package/types-cjs/server.d.cts +0 -408
@@ -2683,8 +2683,8 @@ function ssrElement(tag, props, children, needsId) {
2683
2683
  let result = `<${tag}${hk} `;
2684
2684
  for (let i = 0; i < keys.length; i++) {
2685
2685
  const prop = keys[i];
2686
- const value = props[prop];
2687
2686
  if (tag === "textarea" && (prop === "value" || prop === "defaultValue")) {
2687
+ const value = props[prop];
2688
2688
  if (value !== null) children = escape(value);
2689
2689
  continue;
2690
2690
  }
@@ -2692,6 +2692,7 @@ function ssrElement(tag, props, children, needsId) {
2692
2692
  if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
2693
2693
  continue;
2694
2694
  }
2695
+ const value = props[prop];
2695
2696
  if (prop === "style") {
2696
2697
  result += `style="${ssrStyle(value)}"`;
2697
2698
  } else if (prop === "class") {
@@ -2862,10 +2863,13 @@ function escape(s, attr) {
2862
2863
  if (!attr && Array.isArray(s)) {
2863
2864
  const joined = tryJoinPlainSSRArray(s);
2864
2865
  if (joined !== undefined) return joined;
2866
+ const src = s;
2865
2867
  s = s.slice();
2866
2868
  for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
2869
+ if (src.$slot) s.$slot = true;
2867
2870
  return s;
2868
2871
  }
2872
+ if (!attr && t === "function") return escapeLate(s);
2869
2873
  if (attr) {
2870
2874
  if (s == null || t === "boolean" || t === "number") return s;
2871
2875
  return escape(String(s), attr);
@@ -2876,6 +2880,15 @@ function escape(s, attr) {
2876
2880
  if (i < 0) return s;
2877
2881
  return escapeSlow(s, attr, i);
2878
2882
  }
2883
+ function escapeLate(fn) {
2884
+ if (fn.$esc) return fn;
2885
+ const w = () => escape(fn());
2886
+ w.$esc = true;
2887
+ if (fn.$lhSkip) w.$lhSkip = true;
2888
+ if (fn.$lhSuppress) w.$lhSuppress = true;
2889
+ if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
2890
+ return w;
2891
+ }
2879
2892
  const ESCAPE_CONTENT = /[&<]/;
2880
2893
  const ESCAPE_ATTR = /[&"<]/;
2881
2894
  function escapeSlow(s, attr, start) {
@@ -3624,4 +3637,4 @@ function httpHeader(name, value, options) {
3624
3637
  }
3625
3638
  }
3626
3639
 
3627
- export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
3640
+ export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
package/dist/server.js CHANGED
@@ -2604,8 +2604,8 @@ function ssrElement(tag, props, children, needsId) {
2604
2604
  let result = `<${tag}${hk} `;
2605
2605
  for (let i = 0; i < keys.length; i++) {
2606
2606
  const prop = keys[i];
2607
- const value = props[prop];
2608
2607
  if (tag === "textarea" && (prop === "value" || prop === "defaultValue")) {
2608
+ const value = props[prop];
2609
2609
  if (value !== null) children = escape(value);
2610
2610
  continue;
2611
2611
  }
@@ -2613,6 +2613,7 @@ function ssrElement(tag, props, children, needsId) {
2613
2613
  if (children === undefined && !skipChildren) children = tag === "script" || tag === "style" || prop === "innerHTML" ? props[prop] : escape(props[prop]);
2614
2614
  continue;
2615
2615
  }
2616
+ const value = props[prop];
2616
2617
  if (prop === "style") {
2617
2618
  result += `style="${ssrStyle(value)}"`;
2618
2619
  } else if (prop === "class") {
@@ -2777,10 +2778,13 @@ function escape(s, attr) {
2777
2778
  if (!attr && Array.isArray(s)) {
2778
2779
  const joined = tryJoinPlainSSRArray(s);
2779
2780
  if (joined !== undefined) return joined;
2781
+ const src = s;
2780
2782
  s = s.slice();
2781
2783
  for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
2784
+ if (src.$slot) s.$slot = true;
2782
2785
  return s;
2783
2786
  }
2787
+ if (!attr && t === "function") return escapeLate(s);
2784
2788
  if (attr) {
2785
2789
  if (s == null || t === "boolean" || t === "number") return s;
2786
2790
  return escape(String(s), attr);
@@ -2791,6 +2795,15 @@ function escape(s, attr) {
2791
2795
  if (i < 0) return s;
2792
2796
  return escapeSlow(s, attr, i);
2793
2797
  }
2798
+ function escapeLate(fn) {
2799
+ if (fn.$esc) return fn;
2800
+ const w = () => escape(fn());
2801
+ w.$esc = true;
2802
+ if (fn.$lhSkip) w.$lhSkip = true;
2803
+ if (fn.$lhSuppress) w.$lhSuppress = true;
2804
+ if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
2805
+ return w;
2806
+ }
2794
2807
  const ESCAPE_CONTENT = /[&<]/;
2795
2808
  const ESCAPE_ATTR = /[&"<]/;
2796
2809
  function escapeSlow(s, attr, start) {
@@ -3538,4 +3551,4 @@ function httpHeader(name, value, options) {
3538
3551
  }
3539
3552
  }
3540
3553
 
3541
- export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
3554
+ export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
package/dist/web.dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, getOwner, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush, DEV, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, createEffect } from 'solid-js';
1
+ import { createRenderEffect, getOwner, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, flatten, flush, mergeSources, OBSERVE, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, createEffect } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const DOMWithState = {
@@ -509,7 +509,7 @@ function describeEventTarget(target) {
509
509
  return out;
510
510
  }
511
511
  function dispatchAsInteraction(e, fn) {
512
- return DEV.attribution.withInteraction({
512
+ return OBSERVE.attribution.withInteraction({
513
513
  type: e.type,
514
514
  target: describeEventTarget(e.target)
515
515
  }, fn);
@@ -698,6 +698,21 @@ function style(node, value, prev) {
698
698
  }
699
699
  }
700
700
  }
701
+ function readShallow(value) {
702
+ if (value === null || typeof value !== "object") return value;
703
+ if (Array.isArray(value)) return value.map(readShallow);
704
+ if (value[$PROXY] !== value) return value;
705
+ const keys = ownKeys(value);
706
+ const out = {};
707
+ for (let i = 0; i < keys.length; i++) {
708
+ const k = keys[i];
709
+ if (typeof k === "string") out[k] = value[k];
710
+ }
711
+ return out;
712
+ }
713
+ function ownKeys(o) {
714
+ return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
715
+ }
701
716
  function setStyleProperty(node, name, value) {
702
717
  tagElement(node);
703
718
  if (isHydrating(node)) return;
@@ -718,15 +733,27 @@ function spread(node, props, skipChildren) {
718
733
  effect(() => {
719
734
  const source = get();
720
735
  const newProps = {};
721
- for (const prop in source) {
722
- if (!hasOwn.call(source, prop)) continue;
723
- if (prop === "children" || prop === "ref") continue;
724
- newProps[prop] = source[prop];
725
- }
736
+ const sources = mergeSources(source);
737
+ if (sources !== undefined) {
738
+ for (let i = 0; i < sources.length; i++) {
739
+ let s = sources[i];
740
+ if (typeof s === "function") s = s();
741
+ if (s != null) collectProps(newProps, s);
742
+ }
743
+ } else collectProps(newProps, source);
726
744
  return newProps;
727
745
  }, props => assign(node, props, true, prevProps, true));
728
746
  return prevProps;
729
747
  }
748
+ function collectProps(out, s) {
749
+ const keys = ownKeys(s);
750
+ for (let i = 0; i < keys.length; i++) {
751
+ const prop = keys[i];
752
+ if (typeof prop !== "string" || prop === "children" || prop === "ref") continue;
753
+ const v = s[prop];
754
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
755
+ }
756
+ }
730
757
  function dynamicProperty(props, key) {
731
758
  const src = props[key];
732
759
  Object.defineProperty(props, key, {
@@ -1369,9 +1396,14 @@ function hydrate(code, element, options = {}) {
1369
1396
  sharedConfig.hydrating = false;
1370
1397
  }
1371
1398
  }, err => {
1372
- console.error("Hydration module preload failed, falling back to client render:", err);
1373
1399
  sharedConfig.hydrating = false;
1374
1400
  sharedConfig.registry = undefined;
1401
+ if (element.nodeType === 9) {
1402
+ 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.");
1403
+ (globalThis.reportError || console.error)(err);
1404
+ return;
1405
+ }
1406
+ console.error("Hydration module preload failed, falling back to client render:", err);
1375
1407
  disposer = render(code, element, [...element.childNodes], options);
1376
1408
  });
1377
1409
  return () => disposer && disposer();
@@ -2127,4 +2159,4 @@ _moduleUrl) {
2127
2159
  function httpStatus(_code, _text) {}
2128
2160
  function httpHeader(_name, _value, _options) {}
2129
2161
 
2130
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, 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, waitAsset, warmAsset };
2162
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, 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, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, sharedConfig, enableHydration, untrack, runWithOwner, createRoot, flatten, flush, createComponent, omit, createOwner, createSignal, onCleanup, getOwner, createEffect } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, enableHydration, $PROXY, untrack, runWithOwner, createRoot, flatten, flush, mergeSources, createComponent, omit, createOwner, createSignal, onCleanup, getOwner, createEffect } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const DOMWithState = {
@@ -622,6 +622,21 @@ function style(node, value, prev) {
622
622
  }
623
623
  }
624
624
  }
625
+ function readShallow(value) {
626
+ if (value === null || typeof value !== "object") return value;
627
+ if (Array.isArray(value)) return value.map(readShallow);
628
+ if (value[$PROXY] !== value) return value;
629
+ const keys = ownKeys(value);
630
+ const out = {};
631
+ for (let i = 0; i < keys.length; i++) {
632
+ const k = keys[i];
633
+ if (typeof k === "string") out[k] = value[k];
634
+ }
635
+ return out;
636
+ }
637
+ function ownKeys(o) {
638
+ return o[$PROXY] === o ? Reflect.ownKeys(o) : Object.keys(o);
639
+ }
625
640
  function setStyleProperty(node, name, value) {
626
641
  if (isHydrating(node)) return;
627
642
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
@@ -641,15 +656,27 @@ function spread(node, props, skipChildren) {
641
656
  effect(() => {
642
657
  const source = get();
643
658
  const newProps = {};
644
- for (const prop in source) {
645
- if (!hasOwn.call(source, prop)) continue;
646
- if (prop === "children" || prop === "ref") continue;
647
- newProps[prop] = source[prop];
648
- }
659
+ const sources = mergeSources(source);
660
+ if (sources !== undefined) {
661
+ for (let i = 0; i < sources.length; i++) {
662
+ let s = sources[i];
663
+ if (typeof s === "function") s = s();
664
+ if (s != null) collectProps(newProps, s);
665
+ }
666
+ } else collectProps(newProps, source);
649
667
  return newProps;
650
668
  }, props => assign(node, props, true, prevProps, true));
651
669
  return prevProps;
652
670
  }
671
+ function collectProps(out, s) {
672
+ const keys = ownKeys(s);
673
+ for (let i = 0; i < keys.length; i++) {
674
+ const prop = keys[i];
675
+ if (typeof prop !== "string" || prop === "children" || prop === "ref") continue;
676
+ const v = s[prop];
677
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
678
+ }
679
+ }
653
680
  function dynamicProperty(props, key) {
654
681
  const src = props[key];
655
682
  Object.defineProperty(props, key, {
@@ -1278,9 +1305,13 @@ function hydrate(code, element, options = {}) {
1278
1305
  sharedConfig.hydrating = false;
1279
1306
  }
1280
1307
  }, err => {
1281
- console.error("Hydration module preload failed, falling back to client render:", err);
1282
1308
  sharedConfig.hydrating = false;
1283
1309
  sharedConfig.registry = undefined;
1310
+ if (element.nodeType === 9) {
1311
+ (globalThis.reportError || console.error)(err);
1312
+ return;
1313
+ }
1314
+ console.error("Hydration module preload failed, falling back to client render:", err);
1284
1315
  disposer = render(code, element, [...element.childNodes], options);
1285
1316
  });
1286
1317
  return () => disposer && disposer();
@@ -1987,4 +2018,4 @@ _moduleUrl) {
1987
2018
  function httpStatus(_code, _text) {}
1988
2019
  function httpHeader(_name, _value, _options) {}
1989
2020
 
1990
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, 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, waitAsset, warmAsset };
2021
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, 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, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, 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, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };