solid-js 1.6.14 → 1.6.16

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.
package/dist/server.cjs CHANGED
@@ -586,7 +586,7 @@ function Suspense(props) {
586
586
  ...ctx,
587
587
  count: 0
588
588
  });
589
- o && cleanNode(o);
589
+ cleanNode(o);
590
590
  return runWithOwner(o, () => {
591
591
  return createComponent(SuspenseContext.Provider, {
592
592
  value,
@@ -598,12 +598,14 @@ function Suspense(props) {
598
598
  }
599
599
  const res = runSuspense();
600
600
  if (suspenseComplete(value)) return res;
601
- onError(err => {
602
- if (!done || !done(undefined, err)) {
603
- if (o) runWithOwner(o.owner, () => {
604
- throw err;
605
- });else throw err;
606
- }
601
+ runWithOwner(o, () => {
602
+ onError(err => {
603
+ if (!done || !done(undefined, err)) {
604
+ runWithOwner(o.owner, () => {
605
+ throw err;
606
+ });
607
+ }
608
+ });
607
609
  });
608
610
  done = ctx.async ? ctx.registerFragment(id) : undefined;
609
611
  if (ctx.async) {
package/dist/server.js CHANGED
@@ -584,7 +584,7 @@ function Suspense(props) {
584
584
  ...ctx,
585
585
  count: 0
586
586
  });
587
- o && cleanNode(o);
587
+ cleanNode(o);
588
588
  return runWithOwner(o, () => {
589
589
  return createComponent(SuspenseContext.Provider, {
590
590
  value,
@@ -596,12 +596,14 @@ function Suspense(props) {
596
596
  }
597
597
  const res = runSuspense();
598
598
  if (suspenseComplete(value)) return res;
599
- onError(err => {
600
- if (!done || !done(undefined, err)) {
601
- if (o) runWithOwner(o.owner, () => {
602
- throw err;
603
- });else throw err;
604
- }
599
+ runWithOwner(o, () => {
600
+ onError(err => {
601
+ if (!done || !done(undefined, err)) {
602
+ runWithOwner(o.owner, () => {
603
+ throw err;
604
+ });
605
+ }
606
+ });
605
607
  });
606
608
  done = ctx.async ? ctx.registerFragment(id) : undefined;
607
609
  if (ctx.async) {
@@ -1209,6 +1209,7 @@ export namespace JSX {
1209
1209
  mask?: FunctionMaybe<string>;
1210
1210
  opacity?: FunctionMaybe<number | string | "inherit">;
1211
1211
  overflow?: FunctionMaybe<"visible" | "hidden" | "scroll" | "auto" | "inherit">;
1212
+ pathLength?: FunctionMaybe<string | number>;
1212
1213
  "pointer-events"?: FunctionMaybe<
1213
1214
  | "bounding-box"
1214
1215
  | "visiblePainted"
@@ -1331,6 +1332,7 @@ export namespace JSX {
1331
1332
  | "stroke-dashoffset"
1332
1333
  | "stroke-opacity"
1333
1334
  | "shape-rendering"
1335
+ | "pathLength"
1334
1336
  > {}
1335
1337
  interface TextContentElementSVGAttributes<T>
1336
1338
  extends CoreSVGAttributes<T>,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.6.14",
4
+ "version": "1.6.16",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -278,8 +278,8 @@
278
278
  "types:universal": "tsc --project ./universal/tsconfig.json && ncp ../../node_modules/dom-expressions/src/universal.d.ts ./universal/types/universal.d.ts",
279
279
  "bench": "node --allow-natives-syntax bench/bench.cjs",
280
280
  "link": "symlink-dir . node_modules/solid-js",
281
- "test": "jest",
282
- "coverage": "jest --coverage",
281
+ "test": "vitest run",
282
+ "coverage": "vitest run --coverage",
283
283
  "test-types": "tsc --project tsconfig.test.json"
284
284
  }
285
285
  }
package/types/jsx.d.ts CHANGED
@@ -798,11 +798,13 @@ export namespace JSX {
798
798
  accept?: string;
799
799
  alt?: string;
800
800
  autocomplete?: string;
801
+ autocorrect?: "on" | "off";
801
802
  autofocus?: boolean;
802
803
  capture?: boolean | string;
803
804
  checked?: boolean;
804
805
  crossorigin?: HTMLCrossorigin;
805
806
  disabled?: boolean;
807
+ enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
806
808
  form?: string;
807
809
  formaction?: string;
808
810
  formenctype?: HTMLFormEncType;
@@ -810,6 +812,7 @@ export namespace JSX {
810
812
  formnovalidate?: boolean;
811
813
  formtarget?: string;
812
814
  height?: number | string;
815
+ incremental?: boolean;
813
816
  list?: string;
814
817
  max?: number | string;
815
818
  maxlength?: number | string;
@@ -820,6 +823,7 @@ export namespace JSX {
820
823
  pattern?: string;
821
824
  placeholder?: string;
822
825
  readonly?: boolean;
826
+ results?: number;
823
827
  required?: boolean;
824
828
  size?: number | string;
825
829
  src?: string;
@@ -1219,6 +1223,7 @@ export namespace JSX {
1219
1223
  mask?: string;
1220
1224
  opacity?: number | string | "inherit";
1221
1225
  overflow?: "visible" | "hidden" | "scroll" | "auto" | "inherit";
1226
+ pathLength?: string | number;
1222
1227
  "pointer-events"?:
1223
1228
  | "bounding-box"
1224
1229
  | "visiblePainted"
@@ -1341,6 +1346,7 @@ export namespace JSX {
1341
1346
  | "stroke-dashoffset"
1342
1347
  | "stroke-opacity"
1343
1348
  | "shape-rendering"
1349
+ | "pathLength"
1344
1350
  > {}
1345
1351
  interface TextContentElementSVGAttributes<T>
1346
1352
  extends CoreSVGAttributes<T>,
@@ -23,6 +23,7 @@ export interface Renderer<NodeType> {
23
23
  spread<T>(node: any, accessor: (() => T) | T, skipChildren?: Boolean): void;
24
24
  setProp<T>(node: NodeType, name: string, value: T, prev?: T): T;
25
25
  mergeProps(...sources: unknown[]): unknown;
26
+ use<A, T>(fn: (element: NodeType, arg: A) => T, element: NodeType, arg: A): T;
26
27
  }
27
28
 
28
29
  export function createRenderer<NodeType>(options: RendererOptions<NodeType>): Renderer<NodeType>;
package/web/dist/dev.cjs CHANGED
@@ -352,17 +352,7 @@ function eventHandler(e) {
352
352
  return node || document;
353
353
  }
354
354
  });
355
- if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
356
- solidJs.sharedConfig.done = true;
357
- document.querySelectorAll("[id^=pl-]").forEach(elem => {
358
- while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
359
- let x = elem.nextSibling;
360
- elem.remove();
361
- elem = x;
362
- }
363
- elem && elem.remove();
364
- });
365
- }
355
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) solidJs.sharedConfig.done = _$HY.done = true;
366
356
  while (node) {
367
357
  const handler = node[key];
368
358
  if (handler && !node.disabled) {
@@ -374,7 +364,15 @@ function eventHandler(e) {
374
364
  }
375
365
  }
376
366
  function insertExpression(parent, value, current, marker, unwrapArray) {
377
- if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
367
+ if (solidJs.sharedConfig.context) {
368
+ !current && (current = [...parent.childNodes]);
369
+ let cleaned = [];
370
+ for (let i = 0; i < current.length; i++) {
371
+ const node = current[i];
372
+ if (node.nodeType === 8 && node.data === "!") node.remove();else cleaned.push(node);
373
+ }
374
+ current = cleaned;
375
+ }
378
376
  while (typeof current === "function") current = current();
379
377
  if (value === current) return current;
380
378
  const t = typeof value,
@@ -460,9 +458,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
460
458
  }
461
459
  } else {
462
460
  const value = String(item);
463
- if (value === "<!>") {
464
- if (prev && prev.nodeType === 8) normalized.push(prev);
465
- } else if (prev && prev.nodeType === 3) {
461
+ if (prev && prev.nodeType === 3) {
466
462
  prev.data = value;
467
463
  normalized.push(prev);
468
464
  } else normalized.push(document.createTextNode(value));
package/web/dist/dev.js CHANGED
@@ -351,17 +351,7 @@ function eventHandler(e) {
351
351
  return node || document;
352
352
  }
353
353
  });
354
- if (sharedConfig.registry && !sharedConfig.done) {
355
- sharedConfig.done = true;
356
- document.querySelectorAll("[id^=pl-]").forEach(elem => {
357
- while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
358
- let x = elem.nextSibling;
359
- elem.remove();
360
- elem = x;
361
- }
362
- elem && elem.remove();
363
- });
364
- }
354
+ if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
365
355
  while (node) {
366
356
  const handler = node[key];
367
357
  if (handler && !node.disabled) {
@@ -373,7 +363,15 @@ function eventHandler(e) {
373
363
  }
374
364
  }
375
365
  function insertExpression(parent, value, current, marker, unwrapArray) {
376
- if (sharedConfig.context && !current) current = [...parent.childNodes];
366
+ if (sharedConfig.context) {
367
+ !current && (current = [...parent.childNodes]);
368
+ let cleaned = [];
369
+ for (let i = 0; i < current.length; i++) {
370
+ const node = current[i];
371
+ if (node.nodeType === 8 && node.data === "!") node.remove();else cleaned.push(node);
372
+ }
373
+ current = cleaned;
374
+ }
377
375
  while (typeof current === "function") current = current();
378
376
  if (value === current) return current;
379
377
  const t = typeof value,
@@ -459,9 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
459
457
  }
460
458
  } else {
461
459
  const value = String(item);
462
- if (value === "<!>") {
463
- if (prev && prev.nodeType === 8) normalized.push(prev);
464
- } else if (prev && prev.nodeType === 3) {
460
+ if (prev && prev.nodeType === 3) {
465
461
  prev.data = value;
466
462
  normalized.push(prev);
467
463
  } else normalized.push(document.createTextNode(value));
@@ -262,7 +262,7 @@ function toRefParam(index) {
262
262
  }
263
263
 
264
264
  const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
265
- const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
265
+ const REPLACE_SCRIPT = `function $df(e,n,t,o,d){if(t=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;_$HY.done?o.remove():o.replaceWith(t.content)}t.remove(),_$HY.set(e,n),_$HY.fe(e)}`;
266
266
  function renderToString(code, options = {}) {
267
267
  let scripts = "";
268
268
  solidJs.sharedConfig.context = {
@@ -279,9 +279,8 @@ function renderToString(code, options = {}) {
279
279
  }
280
280
  };
281
281
  let html = solidJs.createRoot(d => {
282
- const r = resolveSSRNode(escape(code()));
283
- d();
284
- return r;
282
+ setTimeout(d);
283
+ return resolveSSRNode(escape(code()));
285
284
  });
286
285
  solidJs.sharedConfig.context.noHydrate = true;
287
286
  html = injectAssets(solidJs.sharedConfig.context.assets, html);
@@ -322,7 +321,7 @@ function renderToStream(code, options = {}) {
322
321
  });
323
322
  writable && writable.end();
324
323
  completed = true;
325
- dispose();
324
+ setTimeout(dispose);
326
325
  }
327
326
  };
328
327
  const pushTask = task => {
@@ -511,7 +510,7 @@ function ssrClassList(value) {
511
510
  classValue = !!value[key];
512
511
  if (!key || key === "undefined" || !classValue) continue;
513
512
  i && (result += " ");
514
- result += key;
513
+ result += escape(key);
515
514
  }
516
515
  return result;
517
516
  }
@@ -548,7 +547,7 @@ function ssrElement(tag, props, children, needsId) {
548
547
  } else if (prop === "class" || prop === "className" || prop === "classList") {
549
548
  if (classResolved) continue;
550
549
  let n;
551
- result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
550
+ result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
552
551
  classResolved = true;
553
552
  } else if (BooleanAttributes.has(prop)) {
554
553
  if (value) result += prop;else continue;
@@ -561,7 +560,7 @@ function ssrElement(tag, props, children, needsId) {
561
560
  }
562
561
  if (skipChildren) {
563
562
  return {
564
- t: result + '/>'
563
+ t: result + "/>"
565
564
  };
566
565
  }
567
566
  return {
@@ -578,13 +577,10 @@ function ssrHydrationKey() {
578
577
  function escape(s, attr) {
579
578
  const t = typeof s;
580
579
  if (t !== "string") {
581
- if (!attr && t === "function") return escape(s(), attr);
580
+ if (!attr && t === "function") return escape(s());
582
581
  if (!attr && Array.isArray(s)) {
583
- let r = "";
584
- for (let i = 0; i < s.length; i++) r += resolveSSRNode(escape(s[i], attr));
585
- return {
586
- t: r
587
- };
582
+ for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
583
+ return s;
588
584
  }
589
585
  if (attr && t === "boolean") return String(s);
590
586
  return s;
@@ -629,8 +625,12 @@ function resolveSSRNode(node) {
629
625
  if (t === "string") return node;
630
626
  if (node == null || t === "boolean") return "";
631
627
  if (Array.isArray(node)) {
628
+ let prev = {};
632
629
  let mapped = "";
633
- for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
630
+ for (let i = 0, len = node.length; i < len; i++) {
631
+ if (typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!-->`;
632
+ mapped += resolveSSRNode(prev = node[i]);
633
+ }
634
634
  return mapped;
635
635
  }
636
636
  if (t === "object") return node.t;
@@ -261,7 +261,7 @@ function toRefParam(index) {
261
261
  }
262
262
 
263
263
  const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
264
- const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
264
+ const REPLACE_SCRIPT = `function $df(e,n,t,o,d){if(t=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;_$HY.done?o.remove():o.replaceWith(t.content)}t.remove(),_$HY.set(e,n),_$HY.fe(e)}`;
265
265
  function renderToString(code, options = {}) {
266
266
  let scripts = "";
267
267
  sharedConfig.context = {
@@ -278,9 +278,8 @@ function renderToString(code, options = {}) {
278
278
  }
279
279
  };
280
280
  let html = createRoot(d => {
281
- const r = resolveSSRNode(escape(code()));
282
- d();
283
- return r;
281
+ setTimeout(d);
282
+ return resolveSSRNode(escape(code()));
284
283
  });
285
284
  sharedConfig.context.noHydrate = true;
286
285
  html = injectAssets(sharedConfig.context.assets, html);
@@ -321,7 +320,7 @@ function renderToStream(code, options = {}) {
321
320
  });
322
321
  writable && writable.end();
323
322
  completed = true;
324
- dispose();
323
+ setTimeout(dispose);
325
324
  }
326
325
  };
327
326
  const pushTask = task => {
@@ -510,7 +509,7 @@ function ssrClassList(value) {
510
509
  classValue = !!value[key];
511
510
  if (!key || key === "undefined" || !classValue) continue;
512
511
  i && (result += " ");
513
- result += key;
512
+ result += escape(key);
514
513
  }
515
514
  return result;
516
515
  }
@@ -547,7 +546,7 @@ function ssrElement(tag, props, children, needsId) {
547
546
  } else if (prop === "class" || prop === "className" || prop === "classList") {
548
547
  if (classResolved) continue;
549
548
  let n;
550
- result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
549
+ result += `class="${escape(((n = props.class) ? n + " " : "") + ((n = props.className) ? n + " " : ""), true) + ssrClassList(props.classList)}"`;
551
550
  classResolved = true;
552
551
  } else if (BooleanAttributes.has(prop)) {
553
552
  if (value) result += prop;else continue;
@@ -560,7 +559,7 @@ function ssrElement(tag, props, children, needsId) {
560
559
  }
561
560
  if (skipChildren) {
562
561
  return {
563
- t: result + '/>'
562
+ t: result + "/>"
564
563
  };
565
564
  }
566
565
  return {
@@ -577,13 +576,10 @@ function ssrHydrationKey() {
577
576
  function escape(s, attr) {
578
577
  const t = typeof s;
579
578
  if (t !== "string") {
580
- if (!attr && t === "function") return escape(s(), attr);
579
+ if (!attr && t === "function") return escape(s());
581
580
  if (!attr && Array.isArray(s)) {
582
- let r = "";
583
- for (let i = 0; i < s.length; i++) r += resolveSSRNode(escape(s[i], attr));
584
- return {
585
- t: r
586
- };
581
+ for (let i = 0; i < s.length; i++) s[i] = escape(s[i]);
582
+ return s;
587
583
  }
588
584
  if (attr && t === "boolean") return String(s);
589
585
  return s;
@@ -628,8 +624,12 @@ function resolveSSRNode(node) {
628
624
  if (t === "string") return node;
629
625
  if (node == null || t === "boolean") return "";
630
626
  if (Array.isArray(node)) {
627
+ let prev = {};
631
628
  let mapped = "";
632
- for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
629
+ for (let i = 0, len = node.length; i < len; i++) {
630
+ if (typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!-->`;
631
+ mapped += resolveSSRNode(prev = node[i]);
632
+ }
633
633
  return mapped;
634
634
  }
635
635
  if (t === "object") return node.t;
package/web/dist/web.cjs CHANGED
@@ -352,17 +352,7 @@ function eventHandler(e) {
352
352
  return node || document;
353
353
  }
354
354
  });
355
- if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
356
- solidJs.sharedConfig.done = true;
357
- document.querySelectorAll("[id^=pl-]").forEach(elem => {
358
- while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
359
- let x = elem.nextSibling;
360
- elem.remove();
361
- elem = x;
362
- }
363
- elem && elem.remove();
364
- });
365
- }
355
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) solidJs.sharedConfig.done = _$HY.done = true;
366
356
  while (node) {
367
357
  const handler = node[key];
368
358
  if (handler && !node.disabled) {
@@ -374,7 +364,15 @@ function eventHandler(e) {
374
364
  }
375
365
  }
376
366
  function insertExpression(parent, value, current, marker, unwrapArray) {
377
- if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
367
+ if (solidJs.sharedConfig.context) {
368
+ !current && (current = [...parent.childNodes]);
369
+ let cleaned = [];
370
+ for (let i = 0; i < current.length; i++) {
371
+ const node = current[i];
372
+ if (node.nodeType === 8 && node.data === "!") node.remove();else cleaned.push(node);
373
+ }
374
+ current = cleaned;
375
+ }
378
376
  while (typeof current === "function") current = current();
379
377
  if (value === current) return current;
380
378
  const t = typeof value,
@@ -460,9 +458,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
460
458
  }
461
459
  } else {
462
460
  const value = String(item);
463
- if (value === "<!>") {
464
- if (prev && prev.nodeType === 8) normalized.push(prev);
465
- } else if (prev && prev.nodeType === 3) {
461
+ if (prev && prev.nodeType === 3) {
466
462
  prev.data = value;
467
463
  normalized.push(prev);
468
464
  } else normalized.push(document.createTextNode(value));
package/web/dist/web.js CHANGED
@@ -351,17 +351,7 @@ function eventHandler(e) {
351
351
  return node || document;
352
352
  }
353
353
  });
354
- if (sharedConfig.registry && !sharedConfig.done) {
355
- sharedConfig.done = true;
356
- document.querySelectorAll("[id^=pl-]").forEach(elem => {
357
- while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
358
- let x = elem.nextSibling;
359
- elem.remove();
360
- elem = x;
361
- }
362
- elem && elem.remove();
363
- });
364
- }
354
+ if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
365
355
  while (node) {
366
356
  const handler = node[key];
367
357
  if (handler && !node.disabled) {
@@ -373,7 +363,15 @@ function eventHandler(e) {
373
363
  }
374
364
  }
375
365
  function insertExpression(parent, value, current, marker, unwrapArray) {
376
- if (sharedConfig.context && !current) current = [...parent.childNodes];
366
+ if (sharedConfig.context) {
367
+ !current && (current = [...parent.childNodes]);
368
+ let cleaned = [];
369
+ for (let i = 0; i < current.length; i++) {
370
+ const node = current[i];
371
+ if (node.nodeType === 8 && node.data === "!") node.remove();else cleaned.push(node);
372
+ }
373
+ current = cleaned;
374
+ }
377
375
  while (typeof current === "function") current = current();
378
376
  if (value === current) return current;
379
377
  const t = typeof value,
@@ -459,9 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
459
457
  }
460
458
  } else {
461
459
  const value = String(item);
462
- if (value === "<!>") {
463
- if (prev && prev.nodeType === 8) normalized.push(prev);
464
- } else if (prev && prev.nodeType === 3) {
460
+ if (prev && prev.nodeType === 3) {
465
461
  prev.data = value;
466
462
  normalized.push(prev);
467
463
  } else normalized.push(document.createTextNode(value));