solid-js 1.5.1 → 1.5.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.
@@ -263,8 +263,7 @@ function toRefParam(index) {
263
263
  const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t)}`;
264
264
  function renderToString(code, options = {}) {
265
265
  let scripts = "";
266
- let context;
267
- sharedConfig.context = context = {
266
+ sharedConfig.context = {
268
267
  id: options.renderId || "",
269
268
  count: 0,
270
269
  suspense: {},
@@ -276,8 +275,8 @@ function renderToString(code, options = {}) {
276
275
  }
277
276
  };
278
277
  let html = resolveSSRNode(escape(code()));
279
- sharedConfig.context = undefined;
280
- html = injectAssets(context.assets, html);
278
+ sharedConfig.context.noHydrate = true;
279
+ html = injectAssets(sharedConfig.context.assets, html);
281
280
  if (scripts.length) html = injectScripts(html, scripts, options.nonce);
282
281
  return html;
283
282
  }
@@ -351,6 +350,9 @@ function renderToStream(code, options = {}) {
351
350
  suspense: {},
352
351
  assets: [],
353
352
  nonce,
353
+ block(p) {
354
+ if (!firstFlushed) blockingResources.push(p);
355
+ },
354
356
  replace(id, payloadFn) {
355
357
  if (firstFlushed) return;
356
358
  const placeholder = `<!${id}>`;
@@ -390,14 +392,15 @@ function renderToStream(code, options = {}) {
390
392
  }
391
393
  }
392
394
  }
393
- Promise.resolve().then(checkEnd);
395
+ if (!registry.size) Promise.resolve().then(checkEnd);
394
396
  return firstFlushed;
395
397
  };
396
398
  }
397
399
  };
398
400
  let html = resolveSSRNode(escape(code()));
399
401
  function doShell() {
400
- sharedConfig.context = undefined;
402
+ sharedConfig.context = context;
403
+ context.noHydrate = true;
401
404
  html = injectAssets(context.assets, html);
402
405
  for (const key in context.resources) {
403
406
  if (!("data" in context.resources[key] || context.resources[key].ref[0].error)) pushTask(`_$HY.init("${key}")`);
@@ -426,7 +429,7 @@ function renderToStream(code, options = {}) {
426
429
  complete();
427
430
  };
428
431
  } else onCompleteAll = complete;
429
- checkEnd();
432
+ if (!registry.size) Promise.resolve().then(checkEnd);
430
433
  },
431
434
  pipe(w) {
432
435
  Promise.allSettled(blockingResources).then(() => {
@@ -525,8 +528,8 @@ function ssrElement(tag, props, children, needsId) {
525
528
  let classResolved;
526
529
  for (let i = 0; i < keys.length; i++) {
527
530
  const prop = keys[i];
528
- if (ChildProperties.has(prop) && children === undefined) {
529
- children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
531
+ if (ChildProperties.has(prop)) {
532
+ if (children === undefined) children = prop === "innerHTML" ? props[prop] : escape(props[prop]);
530
533
  continue;
531
534
  }
532
535
  const value = props[prop];
@@ -757,7 +760,9 @@ function ssrSpread(props, isSVG, skipChildren) {
757
760
  }
758
761
 
759
762
  const isServer = true;
763
+ function insert() {}
760
764
  function spread() {}
765
+ function delegateEvents() {}
761
766
  function Dynamic(props) {
762
767
  const [p, others] = splitProps(props, ["component"]);
763
768
  const comp = p.component,
@@ -772,4 +777,4 @@ function Portal(props) {
772
777
  return "";
773
778
  }
774
779
 
775
- export { Assets, Dynamic, HydrationScript, NoHydration, Portal, escape, generateHydrationScript, getAssets, getHydrationKey, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
780
+ export { Assets, Dynamic, HydrationScript, NoHydration, Portal, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, insert, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
package/web/dist/web.cjs CHANGED
@@ -457,7 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
457
457
  } else if ((typeof item) === "function") {
458
458
  if (unwrap) {
459
459
  while (typeof item === "function") item = item();
460
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
460
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
461
461
  } else {
462
462
  normalized.push(item);
463
463
  dynamic = true;
@@ -640,6 +640,10 @@ Object.defineProperty(exports, 'mergeProps', {
640
640
  enumerable: true,
641
641
  get: function () { return solidJs.mergeProps; }
642
642
  });
643
+ Object.defineProperty(exports, 'untrack', {
644
+ enumerable: true,
645
+ get: function () { return solidJs.untrack; }
646
+ });
643
647
  exports.Aliases = Aliases;
644
648
  exports.Assets = voidFn;
645
649
  exports.ChildProperties = ChildProperties;
package/web/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createMemo, createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps } from 'solid-js';
2
- export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps } from 'solid-js';
2
+ export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
5
5
  const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
@@ -454,7 +454,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
454
454
  } else if ((typeof item) === "function") {
455
455
  if (unwrap) {
456
456
  while (typeof item === "function") item = item();
457
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic;
457
+ dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
458
458
  } else {
459
459
  normalized.push(item);
460
460
  dynamic = true;
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "solid-js/web",
3
+ "main": "./dist/server.cjs",
4
+ "module": "./dist/server.js",
5
+ "browser": {
6
+ "./dist/server.cjs": "./dist/web.cjs",
7
+ "./dist/server.js": "./dist/web.js"
8
+ },
9
+ "unpkg": "./dist/web.cjs",
10
+ "types": "./types/index.d.ts",
11
+ "type": "module",
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "browser": {
16
+ "development": {
17
+ "import": {
18
+ "types": "./types/index.d.ts",
19
+ "default": "./dist/dev.js"
20
+ },
21
+ "require": "./dist/dev.cjs"
22
+ },
23
+ "import": {
24
+ "types": "./types/index.d.ts",
25
+ "default": "./dist/web.js"
26
+ },
27
+ "require": "./dist/web.cjs"
28
+ },
29
+ "node": {
30
+ "import": {
31
+ "types": "./types/index.d.ts",
32
+ "default": "./dist/server.js"
33
+ },
34
+ "require": "./dist/server.cjs"
35
+ },
36
+ "development": {
37
+ "import": {
38
+ "types": "./types/index.d.ts",
39
+ "default": "./dist/dev.js"
40
+ },
41
+ "require": "./dist/dev.cjs"
42
+ },
43
+ "import": {
44
+ "types": "./types/index.d.ts",
45
+ "default": "./dist/web.js"
46
+ },
47
+ "require": "./dist/web.cjs"
48
+ }
49
+ }
50
+ }
@@ -13,6 +13,7 @@ export function render(code: () => JSX.Element, element: MountableElement): () =
13
13
  export function template(html: string, count: number, isSVG?: boolean): Element;
14
14
  export function effect<T>(fn: (prev?: T) => T, init?: T): void;
15
15
  export function memo<T>(fn: () => T, equal: boolean): () => T;
16
+ export function untrack<T>(fn: () => T): T;
16
17
  export function insert<T>(
17
18
  parent: MountableElement,
18
19
  accessor: (() => T) | T,
@@ -67,4 +68,4 @@ export function getAssets(): string;
67
68
  export function Assets(props: { children?: JSX.Element }): JSX.Element;
68
69
  export function HydrationScript(): JSX.Element;
69
70
  export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
70
- export function getHydrationScript(): string;
71
+ export function generateHydrationScript(): string;