solid-js 1.9.6 → 1.9.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 (51) hide show
  1. package/dist/dev.cjs +26 -15
  2. package/dist/dev.js +334 -564
  3. package/dist/server.cjs +3 -1
  4. package/dist/server.js +83 -178
  5. package/dist/solid.cjs +26 -15
  6. package/dist/solid.js +290 -493
  7. package/h/dist/h.js +9 -40
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +8 -11
  10. package/h/jsx-runtime/types/jsx.d.ts +246 -234
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/html/dist/html.js +94 -219
  13. package/html/types/lit.d.ts +33 -52
  14. package/package.json +3 -3
  15. package/store/dist/dev.cjs +9 -5
  16. package/store/dist/dev.js +50 -126
  17. package/store/dist/server.js +8 -20
  18. package/store/dist/store.cjs +9 -5
  19. package/store/dist/store.js +47 -117
  20. package/store/types/index.d.ts +7 -21
  21. package/store/types/modifiers.d.ts +3 -6
  22. package/store/types/mutable.d.ts +2 -5
  23. package/store/types/server.d.ts +5 -25
  24. package/store/types/store.d.ts +61 -218
  25. package/types/index.d.ts +11 -78
  26. package/types/jsx.d.ts +245 -229
  27. package/types/reactive/array.d.ts +4 -12
  28. package/types/reactive/observable.d.ts +16 -22
  29. package/types/reactive/scheduler.d.ts +6 -9
  30. package/types/reactive/signal.d.ts +145 -236
  31. package/types/render/Suspense.d.ts +5 -5
  32. package/types/render/component.d.ts +37 -73
  33. package/types/render/flow.d.ts +31 -43
  34. package/types/render/hydration.d.ts +15 -15
  35. package/types/server/index.d.ts +2 -57
  36. package/types/server/reactive.d.ts +45 -76
  37. package/types/server/rendering.d.ts +98 -169
  38. package/universal/dist/dev.js +12 -28
  39. package/universal/dist/universal.js +12 -28
  40. package/universal/types/index.d.ts +2 -3
  41. package/universal/types/universal.d.ts +3 -2
  42. package/web/dist/dev.cjs +89 -6
  43. package/web/dist/dev.js +174 -646
  44. package/web/dist/server.cjs +90 -5
  45. package/web/dist/server.js +194 -647
  46. package/web/dist/web.cjs +89 -6
  47. package/web/dist/web.js +172 -634
  48. package/web/storage/dist/storage.js +3 -3
  49. package/web/types/core.d.ts +1 -9
  50. package/web/types/index.d.ts +11 -31
  51. package/web/types/server-mock.d.ts +32 -47
package/dist/dev.cjs CHANGED
@@ -9,6 +9,7 @@ let taskIdCounter = 1,
9
9
  yieldInterval = 5,
10
10
  deadline = 0,
11
11
  maxYieldInterval = 300,
12
+ maxDeadline = 0,
12
13
  scheduleCallback = null,
13
14
  scheduledCallback = null;
14
15
  const maxSigned31BitInt = 1073741823;
@@ -20,9 +21,9 @@ function setupScheduler() {
20
21
  if (scheduledCallback !== null) {
21
22
  const currentTime = performance.now();
22
23
  deadline = currentTime + yieldInterval;
23
- const hasTimeRemaining = true;
24
+ maxDeadline = currentTime + maxYieldInterval;
24
25
  try {
25
- const hasMoreWork = scheduledCallback(hasTimeRemaining, currentTime);
26
+ const hasMoreWork = scheduledCallback(currentTime);
26
27
  if (!hasMoreWork) {
27
28
  scheduledCallback = null;
28
29
  } else port.postMessage(null);
@@ -40,7 +41,7 @@ function setupScheduler() {
40
41
  if (scheduling.isInputPending()) {
41
42
  return true;
42
43
  }
43
- return currentTime >= maxYieldInterval;
44
+ return currentTime >= maxDeadline;
44
45
  } else {
45
46
  return false;
46
47
  }
@@ -84,21 +85,21 @@ function requestCallback(fn, options) {
84
85
  function cancelCallback(task) {
85
86
  task.fn = null;
86
87
  }
87
- function flushWork(hasTimeRemaining, initialTime) {
88
+ function flushWork(initialTime) {
88
89
  isCallbackScheduled = false;
89
90
  isPerformingWork = true;
90
91
  try {
91
- return workLoop(hasTimeRemaining, initialTime);
92
+ return workLoop(initialTime);
92
93
  } finally {
93
94
  currentTask = null;
94
95
  isPerformingWork = false;
95
96
  }
96
97
  }
97
- function workLoop(hasTimeRemaining, initialTime) {
98
+ function workLoop(initialTime) {
98
99
  let currentTime = initialTime;
99
100
  currentTask = taskQueue[0] || null;
100
101
  while (currentTask !== null) {
101
- if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
102
+ if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
102
103
  break;
103
104
  }
104
105
  const callback = currentTask.fn;
@@ -364,17 +365,27 @@ function createResource(pSource, pFetcher, pOptions) {
364
365
  return;
365
366
  }
366
367
  if (Transition && pr) Transition.promises.delete(pr);
367
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
368
- value: value(),
369
- refetching
370
- }));
371
- if (!isPromise(p)) {
368
+ let error;
369
+ const p = initP !== NO_INIT ? initP : untrack(() => {
370
+ try {
371
+ return fetcher(lookup, {
372
+ value: value(),
373
+ refetching
374
+ });
375
+ } catch (fetcherError) {
376
+ error = fetcherError;
377
+ }
378
+ });
379
+ if (error !== undefined) {
380
+ loadEnd(pr, undefined, castError(error), lookup);
381
+ return;
382
+ } else if (!isPromise(p)) {
372
383
  loadEnd(pr, p, undefined, lookup);
373
384
  return p;
374
385
  }
375
386
  pr = p;
376
- if ("value" in p) {
377
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
387
+ if ("v" in p) {
388
+ if (p.s === 1) loadEnd(pr, p.v, undefined, lookup);else loadEnd(pr, undefined, castError(p.v), lookup);
378
389
  return p;
379
390
  }
380
391
  scheduled = true;
@@ -1697,7 +1708,7 @@ function Suspense(props) {
1697
1708
  const key = sharedConfig.getContextId();
1698
1709
  let ref = sharedConfig.load(key);
1699
1710
  if (ref) {
1700
- if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
1711
+ if (typeof ref !== "object" || ref.s !== 1) p = ref;else sharedConfig.gather(key);
1701
1712
  }
1702
1713
  if (p && p !== "$$f") {
1703
1714
  const [s, set] = createSignal(undefined, {