@solidjs/signals 2.0.0-rc.8 → 2.0.0-rc.9

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 (90) hide show
  1. package/dist/dev-shared.js +1399 -285
  2. package/dist/dev.attribution.js +459 -307
  3. package/dist/dev.js +1864 -435
  4. package/dist/observe/affects.js +3 -1
  5. package/dist/observe/attribution.js +7 -1
  6. package/dist/observe/boundaries.js +209 -154
  7. package/dist/observe/core/action.js +18 -8
  8. package/dist/observe/core/async.js +220 -110
  9. package/dist/observe/core/attribution-costs.js +66 -0
  10. package/dist/observe/core/attribution-feedback.js +282 -0
  11. package/dist/observe/core/attribution-hooks.js +23 -1
  12. package/dist/observe/core/attribution-queries.js +28 -0
  13. package/dist/observe/core/attribution.js +262 -485
  14. package/dist/observe/core/constants.js +34 -1
  15. package/dist/observe/core/context.js +3 -3
  16. package/dist/observe/core/core.js +867 -367
  17. package/dist/observe/core/dev.js +78 -17
  18. package/dist/observe/core/effect.js +67 -51
  19. package/dist/observe/core/error-hooks.js +71 -0
  20. package/dist/observe/core/external.js +4 -4
  21. package/dist/observe/core/graph.js +37 -37
  22. package/dist/observe/core/heap.js +45 -45
  23. package/dist/observe/core/invariants.js +2 -0
  24. package/dist/observe/core/lanes.js +86 -49
  25. package/dist/observe/core/optimistic.js +242 -95
  26. package/dist/observe/core/owner.js +98 -84
  27. package/dist/observe/core/scheduler.js +543 -305
  28. package/dist/observe/core/verdict.js +247 -129
  29. package/dist/observe/index.js +7 -3
  30. package/dist/observe/map.js +126 -124
  31. package/dist/observe/signals.js +33 -17
  32. package/dist/observe/store/index.js +2 -0
  33. package/dist/observe/store/next/optimistic.js +141 -132
  34. package/dist/observe/store/next/projection.js +34 -21
  35. package/dist/observe/store/next/reconcile.js +58 -56
  36. package/dist/observe/store/next/store.js +260 -146
  37. package/dist/observe/store/store.js +5 -3
  38. package/dist/observe/store/utils.js +948 -135
  39. package/dist/prod/attribution.js +26 -17
  40. package/dist/prod/boundaries.js +128 -76
  41. package/dist/prod/core/action.js +16 -8
  42. package/dist/prod/core/async.js +251 -143
  43. package/dist/prod/core/constants.js +34 -1
  44. package/dist/prod/core/context.js +3 -3
  45. package/dist/prod/core/core.js +843 -347
  46. package/dist/prod/core/dev.js +17 -1
  47. package/dist/prod/core/effect.js +48 -34
  48. package/dist/prod/core/error-hooks.js +71 -0
  49. package/dist/prod/core/external.js +4 -4
  50. package/dist/prod/core/graph.js +37 -37
  51. package/dist/prod/core/heap.js +45 -45
  52. package/dist/prod/core/lanes.js +90 -53
  53. package/dist/prod/core/optimistic.js +247 -100
  54. package/dist/prod/core/owner.js +57 -45
  55. package/dist/prod/core/scheduler.js +543 -305
  56. package/dist/prod/core/verdict.js +245 -127
  57. package/dist/prod/index.js +7 -3
  58. package/dist/prod/map.js +112 -112
  59. package/dist/prod/signals.js +28 -12
  60. package/dist/prod/store/next/optimistic.js +135 -128
  61. package/dist/prod/store/next/projection.js +31 -20
  62. package/dist/prod/store/next/store.js +325 -252
  63. package/dist/prod/store/store.js +2 -2
  64. package/dist/prod/store/utils.js +946 -135
  65. package/dist/types/attribution.d.ts +7 -2
  66. package/dist/types/attribution.prod.d.ts +10 -1
  67. package/dist/types/boundaries.d.ts +10 -1
  68. package/dist/types/core/action.d.ts +12 -5
  69. package/dist/types/core/attribution-costs.d.ts +35 -0
  70. package/dist/types/core/attribution-feedback.d.ts +133 -0
  71. package/dist/types/core/attribution-hooks.d.ts +28 -3
  72. package/dist/types/core/attribution-queries.d.ts +10 -0
  73. package/dist/types/core/attribution.d.ts +51 -172
  74. package/dist/types/core/constants.d.ts +33 -0
  75. package/dist/types/core/core.d.ts +186 -5
  76. package/dist/types/core/dev.d.ts +129 -9
  77. package/dist/types/core/error-hooks.d.ts +71 -0
  78. package/dist/types/core/index.d.ts +3 -1
  79. package/dist/types/core/invariants.d.ts +4 -0
  80. package/dist/types/core/lanes.d.ts +31 -4
  81. package/dist/types/core/scheduler.d.ts +95 -2
  82. package/dist/types/core/types.d.ts +3 -0
  83. package/dist/types/index.d.ts +2 -2
  84. package/dist/types/signals.d.ts +8 -0
  85. package/dist/types/store/index.d.ts +2 -1
  86. package/dist/types/store/next/optimistic.d.ts +1 -1
  87. package/dist/types/store/next/store.d.ts +6 -5
  88. package/dist/types/store/next/target.d.ts +1 -1
  89. package/dist/types/store/utils.d.ts +177 -6
  90. package/package.json +1 -1
@@ -4,6 +4,8 @@ import { isThenable } from "./async.js";
4
4
 
5
5
  import "./core.js";
6
6
 
7
+ import "./dev.js";
8
+
7
9
  import { attrHooks } from "./attribution-hooks.js";
8
10
 
9
11
  /** Invocation order across all actions — the provenance every slice of an
@@ -49,15 +51,22 @@ function restoreTransition(t, e, r) {
49
51
  * `yield` is the transaction-safe suspension point: the action waits for a
50
52
  * yielded promise and re-enters the transaction before running the code after
51
53
  * it. A plain `await` does NOT — the runtime has no hook into an async
52
- * generator's internal await continuations, so writes to fresh signals
53
- * between an `await` and the next `yield` escape the transaction and commit
54
- * immediately. `await` is still the ergonomic choice for typed results; just
55
- * put a bare `yield` before any writes that follow it:
54
+ * generator's internal await continuations, so code between an `await` and
55
+ * the next `yield` runs OUTSIDE the transaction: writes to fresh signals
56
+ * commit immediately, and anything that creates a reader there `until()`,
57
+ * `latest()`, a memo or effect, a mount is created mainline, where a read of
58
+ * this action's held state makes it born held (A29): staged with the
59
+ * transaction and replayed at its commit. For `until()` that commit is the
60
+ * settle its own promise holds open (#3482). `await` is still the ergonomic
61
+ * choice for typed results; just put a bare `yield` before any write or
62
+ * reader creation that follows it — including the expression of the next
63
+ * `yield`, which is evaluated before the step re-enters:
56
64
  *
57
65
  * ```ts
58
66
  * const saved = await api.createTodo(text); // typed result
59
- * yield; // re-enter the transaction before writing
67
+ * yield; // re-enter the transaction before writing or reading
60
68
  * setTodos(t => { ... });
69
+ * yield until(() => todos.some(t => t.id === saved.id));
61
70
  * ```
62
71
  *
63
72
  * (For the same reason, don't call `flush()` inside an action body — it
@@ -95,11 +104,12 @@ function restoreTransition(t, e, r) {
95
104
  setOrigin(o);
96
105
  globalQueue.initTransition();
97
106
  let s = activeTransition;
98
- s.ut.push(i);
107
+ s.dt.push(i);
108
+ s.Tt = true;
99
109
  const done = (t, e, o = false) => {
100
110
  s = currentTransition(s);
101
- const u = s.ut.indexOf(i);
102
- if (u >= 0) s.ut.splice(u, 1);
111
+ const u = s.dt.indexOf(i);
112
+ if (u >= 0) s.dt.splice(u, 1);
103
113
  // Re-adopt through initTransition like every other resumption site:
104
114
  // a bare setActiveTransition leaves globalQueue._batch as a detached
105
115
  // ambient batch, and anything registered before the scheduled flush