solid-js 1.3.5 → 1.3.6

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/dev.cjs CHANGED
@@ -267,6 +267,7 @@ function createResource(source, fetcher, options) {
267
267
  initP = null,
268
268
  id = null,
269
269
  loadedUnderTransition = false,
270
+ scheduled = false,
270
271
  dynamic = typeof source === "function";
271
272
  if (sharedConfig.context) {
272
273
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
@@ -321,6 +322,8 @@ function createResource(source, fetcher, options) {
321
322
  return v;
322
323
  }
323
324
  function load(refetching = true) {
325
+ if (refetching && scheduled) return;
326
+ scheduled = false;
324
327
  setError(err = undefined);
325
328
  const lookup = dynamic ? source() : source;
326
329
  loadedUnderTransition = Transition && Transition.running;
@@ -338,6 +341,8 @@ function createResource(source, fetcher, options) {
338
341
  return p;
339
342
  }
340
343
  pr = p;
344
+ scheduled = true;
345
+ queueMicrotask(() => scheduled = false);
341
346
  batch(() => {
342
347
  setLoading(true);
343
348
  trigger();
package/dist/dev.js CHANGED
@@ -263,6 +263,7 @@ function createResource(source, fetcher, options) {
263
263
  initP = null,
264
264
  id = null,
265
265
  loadedUnderTransition = false,
266
+ scheduled = false,
266
267
  dynamic = typeof source === "function";
267
268
  if (sharedConfig.context) {
268
269
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
@@ -317,6 +318,8 @@ function createResource(source, fetcher, options) {
317
318
  return v;
318
319
  }
319
320
  function load(refetching = true) {
321
+ if (refetching && scheduled) return;
322
+ scheduled = false;
320
323
  setError(err = undefined);
321
324
  const lookup = dynamic ? source() : source;
322
325
  loadedUnderTransition = Transition && Transition.running;
@@ -334,6 +337,8 @@ function createResource(source, fetcher, options) {
334
337
  return p;
335
338
  }
336
339
  pr = p;
340
+ scheduled = true;
341
+ queueMicrotask(() => scheduled = false);
337
342
  batch(() => {
338
343
  setLoading(true);
339
344
  trigger();
package/dist/server.cjs CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const equalFn = (a, b) => a === b;
6
6
  const $PROXY = Symbol("solid-proxy");
7
- const $DEVCOMP = Symbol('solid-dev-component');
7
+ const $DEVCOMP = Symbol("solid-dev-component");
8
8
  const DEV = {};
9
9
  const ERROR = Symbol("error");
10
10
  const UNOWNED = {
@@ -79,7 +79,7 @@ function createMemo(fn, value) {
79
79
  function createDeferred(source) {
80
80
  return source;
81
81
  }
82
- function createSelector(source, fn) {
82
+ function createSelector(source, fn = equalFn) {
83
83
  return k => fn(k, source());
84
84
  }
85
85
  function batch(fn) {
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const equalFn = (a, b) => a === b;
2
2
  const $PROXY = Symbol("solid-proxy");
3
- const $DEVCOMP = Symbol('solid-dev-component');
3
+ const $DEVCOMP = Symbol("solid-dev-component");
4
4
  const DEV = {};
5
5
  const ERROR = Symbol("error");
6
6
  const UNOWNED = {
@@ -75,7 +75,7 @@ function createMemo(fn, value) {
75
75
  function createDeferred(source) {
76
76
  return source;
77
77
  }
78
- function createSelector(source, fn) {
78
+ function createSelector(source, fn = equalFn) {
79
79
  return k => fn(k, source());
80
80
  }
81
81
  function batch(fn) {
package/dist/solid.cjs CHANGED
@@ -264,6 +264,7 @@ function createResource(source, fetcher, options) {
264
264
  initP = null,
265
265
  id = null,
266
266
  loadedUnderTransition = false,
267
+ scheduled = false,
267
268
  dynamic = typeof source === "function";
268
269
  if (sharedConfig.context) {
269
270
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
@@ -318,6 +319,8 @@ function createResource(source, fetcher, options) {
318
319
  return v;
319
320
  }
320
321
  function load(refetching = true) {
322
+ if (refetching && scheduled) return;
323
+ scheduled = false;
321
324
  setError(err = undefined);
322
325
  const lookup = dynamic ? source() : source;
323
326
  loadedUnderTransition = Transition && Transition.running;
@@ -335,6 +338,8 @@ function createResource(source, fetcher, options) {
335
338
  return p;
336
339
  }
337
340
  pr = p;
341
+ scheduled = true;
342
+ queueMicrotask(() => scheduled = false);
338
343
  batch(() => {
339
344
  setLoading(true);
340
345
  trigger();
package/dist/solid.js CHANGED
@@ -260,6 +260,7 @@ function createResource(source, fetcher, options) {
260
260
  initP = null,
261
261
  id = null,
262
262
  loadedUnderTransition = false,
263
+ scheduled = false,
263
264
  dynamic = typeof source === "function";
264
265
  if (sharedConfig.context) {
265
266
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
@@ -314,6 +315,8 @@ function createResource(source, fetcher, options) {
314
315
  return v;
315
316
  }
316
317
  function load(refetching = true) {
318
+ if (refetching && scheduled) return;
319
+ scheduled = false;
317
320
  setError(err = undefined);
318
321
  const lookup = dynamic ? source() : source;
319
322
  loadedUnderTransition = Transition && Transition.running;
@@ -331,6 +334,8 @@ function createResource(source, fetcher, options) {
331
334
  return p;
332
335
  }
333
336
  pr = p;
337
+ scheduled = true;
338
+ queueMicrotask(() => scheduled = false);
334
339
  batch(() => {
335
340
  setLoading(true);
336
341
  trigger();
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.3.5",
4
+ "version": "1.3.6",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "cc19f07cfd675bd5579891dcae3145fa0d171c66"
147
+ "gitHead": "10183a0ee2de5c685e4d4558cbe1b78a6ca4c48e"
148
148
  }
package/types/jsx.d.ts CHANGED
@@ -2085,6 +2085,8 @@ export namespace JSX {
2085
2085
  }
2086
2086
  interface DetailsHtmlAttributes<T> extends HTMLAttributes<T> {
2087
2087
  open?: boolean;
2088
+ onToggle?: EventHandlerUnion<T, Event>;
2089
+ ontoggle?: EventHandlerUnion<T, Event>;
2088
2090
  }
2089
2091
  interface DialogHtmlAttributes<T> extends HTMLAttributes<T> {
2090
2092
  open?: boolean;
@@ -19,7 +19,7 @@ export declare function createEffect<T>(fn: (v?: T) => T, value?: T): void;
19
19
  export declare function createReaction(fn: () => void): (fn: () => void) => void;
20
20
  export declare function createMemo<T>(fn: (v?: T) => T, value?: T): () => T;
21
21
  export declare function createDeferred<T>(source: () => T): () => T;
22
- export declare function createSelector<T>(source: () => T, fn: (k: T, value: T) => boolean): (k: T) => boolean;
22
+ export declare function createSelector<T>(source: () => T, fn?: (k: T, value: T) => boolean): (k: T) => boolean;
23
23
  export declare function batch<T>(fn: () => T): T;
24
24
  export declare const untrack: typeof batch;
25
25
  export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: Array<T> | T, prev?: Array<T> | T, prevResults?: U) => U, options?: {
package/web/dist/dev.cjs CHANGED
@@ -197,6 +197,9 @@ function dynamicProperty(props, key) {
197
197
  });
198
198
  return props;
199
199
  }
200
+ function innerHTML(parent, content) {
201
+ !solidJs.sharedConfig.context && (parent.innerHTML = content);
202
+ }
200
203
  function insert(parent, accessor, marker, initial) {
201
204
  if (marker !== undefined && !initial) initial = [];
202
205
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
@@ -395,7 +398,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
395
398
  appendNodes(parent, array, marker);
396
399
  } else reconcileArrays(parent, current, array);
397
400
  } else {
398
- current && cleanChildren(parent, current);
401
+ current && cleanChildren(parent);
399
402
  appendNodes(parent, array);
400
403
  }
401
404
  current = array;
@@ -622,6 +625,7 @@ exports.getNextElement = getNextElement;
622
625
  exports.getNextMarker = getNextMarker;
623
626
  exports.getNextMatch = getNextMatch;
624
627
  exports.hydrate = hydrate;
628
+ exports.innerHTML = innerHTML;
625
629
  exports.insert = insert;
626
630
  exports.isServer = isServer;
627
631
  exports.memo = memo;
package/web/dist/dev.js CHANGED
@@ -194,6 +194,9 @@ function dynamicProperty(props, key) {
194
194
  });
195
195
  return props;
196
196
  }
197
+ function innerHTML(parent, content) {
198
+ !sharedConfig.context && (parent.innerHTML = content);
199
+ }
197
200
  function insert(parent, accessor, marker, initial) {
198
201
  if (marker !== undefined && !initial) initial = [];
199
202
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
@@ -392,7 +395,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
392
395
  appendNodes(parent, array, marker);
393
396
  } else reconcileArrays(parent, current, array);
394
397
  } else {
395
- current && cleanChildren(parent, current);
398
+ current && cleanChildren(parent);
396
399
  appendNodes(parent, array);
397
400
  }
398
401
  current = array;
@@ -546,4 +549,4 @@ function Dynamic(props) {
546
549
  });
547
550
  }
548
551
 
549
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
552
+ export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -323,7 +323,11 @@ function renderToStream(code, options = {}) {
323
323
  const checkEnd = () => {
324
324
  if (!registry.size && !completed) {
325
325
  writeTasks();
326
- onCompleteAll && onCompleteAll(result);
326
+ onCompleteAll && onCompleteAll({
327
+ write(v) {
328
+ !completed && buffer.write(v);
329
+ }
330
+ });
327
331
  writable && writable.end();
328
332
  completed = true;
329
333
  }
@@ -396,7 +400,11 @@ function renderToStream(code, options = {}) {
396
400
  buffer.write(html);
397
401
  tasks.length = 0;
398
402
  scheduled = false;
399
- onCompleteShell && onCompleteShell();
403
+ onCompleteShell && onCompleteShell({
404
+ write(v) {
405
+ !completed && buffer.write(v);
406
+ }
407
+ });
400
408
  });
401
409
  return {
402
410
  pipe(w) {
@@ -615,8 +623,11 @@ function serializeSet(registry, key, value) {
615
623
  }
616
624
  function pipeToNodeWritable(code, writable, options = {}) {
617
625
  if (options.onReady) {
618
- options.onCompleteShell = () => {
626
+ options.onCompleteShell = ({
627
+ write
628
+ }) => {
619
629
  options.onReady({
630
+ write,
620
631
  startWriting() {
621
632
  stream.pipe(writable);
622
633
  }
@@ -628,8 +639,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
628
639
  }
629
640
  function pipeToWritable(code, writable, options = {}) {
630
641
  if (options.onReady) {
631
- options.onCompleteShell = () => {
642
+ options.onCompleteShell = ({
643
+ write
644
+ }) => {
632
645
  options.onReady({
646
+ write,
633
647
  startWriting() {
634
648
  stream.pipeTo(writable);
635
649
  }
@@ -320,7 +320,11 @@ function renderToStream(code, options = {}) {
320
320
  const checkEnd = () => {
321
321
  if (!registry.size && !completed) {
322
322
  writeTasks();
323
- onCompleteAll && onCompleteAll(result);
323
+ onCompleteAll && onCompleteAll({
324
+ write(v) {
325
+ !completed && buffer.write(v);
326
+ }
327
+ });
324
328
  writable && writable.end();
325
329
  completed = true;
326
330
  }
@@ -393,7 +397,11 @@ function renderToStream(code, options = {}) {
393
397
  buffer.write(html);
394
398
  tasks.length = 0;
395
399
  scheduled = false;
396
- onCompleteShell && onCompleteShell();
400
+ onCompleteShell && onCompleteShell({
401
+ write(v) {
402
+ !completed && buffer.write(v);
403
+ }
404
+ });
397
405
  });
398
406
  return {
399
407
  pipe(w) {
@@ -612,8 +620,11 @@ function serializeSet(registry, key, value) {
612
620
  }
613
621
  function pipeToNodeWritable(code, writable, options = {}) {
614
622
  if (options.onReady) {
615
- options.onCompleteShell = () => {
623
+ options.onCompleteShell = ({
624
+ write
625
+ }) => {
616
626
  options.onReady({
627
+ write,
617
628
  startWriting() {
618
629
  stream.pipe(writable);
619
630
  }
@@ -625,8 +636,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
625
636
  }
626
637
  function pipeToWritable(code, writable, options = {}) {
627
638
  if (options.onReady) {
628
- options.onCompleteShell = () => {
639
+ options.onCompleteShell = ({
640
+ write
641
+ }) => {
629
642
  options.onReady({
643
+ write,
630
644
  startWriting() {
631
645
  stream.pipeTo(writable);
632
646
  }
package/web/dist/web.cjs CHANGED
@@ -196,6 +196,9 @@ function dynamicProperty(props, key) {
196
196
  });
197
197
  return props;
198
198
  }
199
+ function innerHTML(parent, content) {
200
+ !solidJs.sharedConfig.context && (parent.innerHTML = content);
201
+ }
199
202
  function insert(parent, accessor, marker, initial) {
200
203
  if (marker !== undefined && !initial) initial = [];
201
204
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
@@ -394,7 +397,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
394
397
  appendNodes(parent, array, marker);
395
398
  } else reconcileArrays(parent, current, array);
396
399
  } else {
397
- current && cleanChildren(parent, current);
400
+ current && cleanChildren(parent);
398
401
  appendNodes(parent, array);
399
402
  }
400
403
  current = array;
@@ -618,6 +621,7 @@ exports.getNextElement = getNextElement;
618
621
  exports.getNextMarker = getNextMarker;
619
622
  exports.getNextMatch = getNextMatch;
620
623
  exports.hydrate = hydrate;
624
+ exports.innerHTML = innerHTML;
621
625
  exports.insert = insert;
622
626
  exports.isServer = isServer;
623
627
  exports.memo = memo;
package/web/dist/web.js CHANGED
@@ -193,6 +193,9 @@ function dynamicProperty(props, key) {
193
193
  });
194
194
  return props;
195
195
  }
196
+ function innerHTML(parent, content) {
197
+ !sharedConfig.context && (parent.innerHTML = content);
198
+ }
196
199
  function insert(parent, accessor, marker, initial) {
197
200
  if (marker !== undefined && !initial) initial = [];
198
201
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
@@ -391,7 +394,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
391
394
  appendNodes(parent, array, marker);
392
395
  } else reconcileArrays(parent, current, array);
393
396
  } else {
394
- current && cleanChildren(parent, current);
397
+ current && cleanChildren(parent);
395
398
  appendNodes(parent, array);
396
399
  }
397
400
  current = array;
@@ -542,4 +545,4 @@ function Dynamic(props) {
542
545
  });
543
546
  }
544
547
 
545
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
548
+ export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -30,6 +30,7 @@ export function spread<T>(
30
30
  export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
31
31
  export function setAttribute(node: Element, name: string, value: string): void;
32
32
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
33
+ export function innerHTML(node: Element, content: string): void;
33
34
  export function addEventListener(
34
35
  node: Element,
35
36
  name: string,