solid-js 1.9.2 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/dev.cjs +5 -5
  2. package/dist/dev.js +563 -322
  3. package/dist/server.cjs +50 -10
  4. package/dist/server.js +220 -83
  5. package/dist/solid.cjs +5 -5
  6. package/dist/solid.js +490 -280
  7. package/h/dist/h.js +40 -9
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +11 -8
  10. package/h/jsx-runtime/types/jsx.d.ts +93 -91
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/html/dist/html.js +219 -94
  13. package/html/types/lit.d.ts +52 -33
  14. package/package.json +1 -1
  15. package/store/dist/dev.cjs +1 -1
  16. package/store/dist/dev.js +123 -43
  17. package/store/dist/server.js +20 -8
  18. package/store/dist/store.cjs +1 -1
  19. package/store/dist/store.js +114 -40
  20. package/store/types/index.d.ts +21 -7
  21. package/store/types/modifiers.d.ts +6 -3
  22. package/store/types/mutable.d.ts +5 -2
  23. package/store/types/server.d.ts +25 -5
  24. package/store/types/store.d.ts +218 -61
  25. package/types/index.d.ts +75 -10
  26. package/types/jsx.d.ts +143 -157
  27. package/types/reactive/array.d.ts +12 -4
  28. package/types/reactive/observable.d.ts +25 -17
  29. package/types/reactive/scheduler.d.ts +9 -6
  30. package/types/reactive/signal.d.ts +233 -142
  31. package/types/render/Suspense.d.ts +5 -5
  32. package/types/render/component.d.ts +71 -35
  33. package/types/render/flow.d.ts +43 -31
  34. package/types/render/hydration.d.ts +15 -15
  35. package/types/server/index.d.ts +57 -2
  36. package/types/server/reactive.d.ts +73 -42
  37. package/types/server/rendering.d.ts +169 -98
  38. package/universal/dist/dev.js +28 -12
  39. package/universal/dist/universal.js +28 -12
  40. package/universal/types/index.d.ts +3 -1
  41. package/universal/types/universal.d.ts +0 -1
  42. package/web/dist/dev.js +639 -89
  43. package/web/dist/server.cjs +18 -13
  44. package/web/dist/server.js +657 -120
  45. package/web/dist/web.js +627 -87
  46. package/web/storage/dist/storage.js +3 -3
  47. package/web/types/client.d.ts +1 -1
  48. package/web/types/core.d.ts +10 -1
  49. package/web/types/index.d.ts +27 -10
  50. package/web/types/server-mock.d.ts +47 -32
  51. package/web/types/server.d.ts +1 -1
  52. package/web/storage/types/index.js +0 -13
@@ -217,7 +217,7 @@ function renderToStream(code, options = {}) {
217
217
  const first = html.indexOf(placeholder);
218
218
  if (first === -1) return;
219
219
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
220
- html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
220
+ html = html.slice(0, first) + resolveSSRNode(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
221
221
  },
222
222
  serialize(id, p, wait) {
223
223
  const serverOnly = solidJs.sharedConfig.context.noHydrate;
@@ -421,8 +421,13 @@ function ssrElement(tag, props, children, needsId) {
421
421
  classResolved = true;
422
422
  } else if (BooleanAttributes.has(prop)) {
423
423
  if (value) result += prop;else continue;
424
- } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on") {
424
+ } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
425
425
  continue;
426
+ } else if (prop.slice(0, 5) === "bool:") {
427
+ if (!value) continue;
428
+ result += escape(prop.slice(5));
429
+ } else if (prop.slice(0, 5) === "attr:") {
430
+ result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
426
431
  } else {
427
432
  result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
428
433
  }
@@ -511,7 +516,7 @@ function getHydrationKey() {
511
516
  return hydrate && !hydrate.noHydrate && solidJs.sharedConfig.getNextContextId();
512
517
  }
513
518
  function useAssets(fn) {
514
- solidJs.sharedConfig.context.assets.push(() => resolveSSRNode(fn()));
519
+ solidJs.sharedConfig.context.assets.push(() => resolveSSRNode(escape(fn())));
515
520
  }
516
521
  function getAssets() {
517
522
  const assets = solidJs.sharedConfig.context.assets;
@@ -539,7 +544,7 @@ function Hydration(props) {
539
544
  return res;
540
545
  }
541
546
  function NoHydration(props) {
542
- solidJs.sharedConfig.context.noHydrate = true;
547
+ if (solidJs.sharedConfig.context) solidJs.sharedConfig.context.noHydrate = true;
543
548
  return props.children;
544
549
  }
545
550
  function queue(fn) {
@@ -556,7 +561,9 @@ function injectAssets(assets, html) {
556
561
  if (!assets || !assets.length) return html;
557
562
  let out = "";
558
563
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
559
- return html.replace(`</head>`, out + `</head>`);
564
+ const index = html.indexOf("</head>");
565
+ if (index === -1) return html;
566
+ return html.slice(0, index) + out + html.slice(index);
560
567
  }
561
568
  function injectScripts(html, scripts, nonce) {
562
569
  const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
@@ -643,15 +650,13 @@ function ssrSpread(props, isSVG, skipChildren) {
643
650
  if (value) result += prop;else continue;
644
651
  } else if (value == undefined || prop === "ref" || prop.slice(0, 2) === "on" || prop.slice(0, 5) === "prop:") {
645
652
  continue;
653
+ } else if (prop.slice(0, 5) === "bool:") {
654
+ if (!value) continue;
655
+ result += escape(prop.slice(5));
656
+ } else if (prop.slice(0, 5) === "attr:") {
657
+ result += `${escape(prop.slice(5))}="${escape(value, true)}"`;
646
658
  } else {
647
- if (prop.slice(0, 5) === "bool:") {
648
- if (!value) continue;
649
- prop = prop.slice(5);
650
- result += `${escape(prop)}`;
651
- } else {
652
- if (prop.slice(0, 5) === "attr:") prop = prop.slice(5);
653
- result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
654
- }
659
+ result += `${Aliases[prop] || escape(prop)}="${escape(value, true)}"`;
655
660
  }
656
661
  if (i !== keys.length - 1) result += " ";
657
662
  }