@solidjs/signals 2.0.0-rc.14 → 2.0.0-rc.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.
Files changed (98) hide show
  1. package/dist/dev-shared.js +882 -405
  2. package/dist/dev.attribution.js +172 -66
  3. package/dist/dev.js +1529 -745
  4. package/dist/observe/affects-marks.js +86 -0
  5. package/dist/observe/affects.js +32 -80
  6. package/dist/observe/boundaries.js +202 -166
  7. package/dist/observe/core/async.js +192 -141
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +315 -214
  10. package/dist/observe/core/constants.js +23 -4
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +532 -360
  13. package/dist/observe/core/dev.js +63 -35
  14. package/dist/observe/core/effect.js +47 -47
  15. package/dist/observe/core/error.js +5 -3
  16. package/dist/observe/core/external.js +5 -6
  17. package/dist/observe/core/graph.js +56 -42
  18. package/dist/observe/core/heap.js +33 -33
  19. package/dist/observe/core/identities.js +62 -0
  20. package/dist/observe/core/lanes.js +242 -229
  21. package/dist/observe/core/owner.js +62 -50
  22. package/dist/observe/core/scheduler.js +322 -168
  23. package/dist/observe/core/truth.js +45 -0
  24. package/dist/observe/core/verdict.js +114 -64
  25. package/dist/observe/deferred.js +184 -0
  26. package/dist/observe/index.js +7 -1
  27. package/dist/observe/map.js +339 -254
  28. package/dist/observe/reveal.js +77 -77
  29. package/dist/observe/signals.js +54 -33
  30. package/dist/observe/store/affects.js +76 -69
  31. package/dist/observe/store/edges.js +39 -0
  32. package/dist/observe/store/hooks.js +13 -0
  33. package/dist/observe/store/index.js +0 -2
  34. package/dist/observe/store/optimistic.js +82 -44
  35. package/dist/observe/store/projection.js +83 -64
  36. package/dist/observe/store/reconcile.js +32 -30
  37. package/dist/observe/store/store.js +219 -123
  38. package/dist/prod/affects-marks.js +86 -0
  39. package/dist/prod/affects.js +33 -79
  40. package/dist/prod/boundaries.js +185 -149
  41. package/dist/prod/core/async.js +176 -135
  42. package/dist/prod/core/constants.js +23 -4
  43. package/dist/prod/core/context.js +3 -3
  44. package/dist/prod/core/core.js +521 -353
  45. package/dist/prod/core/effect.js +66 -66
  46. package/dist/prod/core/error.js +5 -3
  47. package/dist/prod/core/external.js +5 -6
  48. package/dist/prod/core/graph.js +56 -42
  49. package/dist/prod/core/heap.js +38 -38
  50. package/dist/prod/core/identities.js +62 -0
  51. package/dist/prod/core/lanes.js +237 -224
  52. package/dist/prod/core/owner.js +62 -51
  53. package/dist/prod/core/scheduler.js +312 -158
  54. package/dist/prod/core/truth.js +45 -0
  55. package/dist/prod/core/verdict.js +113 -63
  56. package/dist/prod/deferred.js +182 -0
  57. package/dist/prod/index.js +7 -1
  58. package/dist/prod/map.js +366 -281
  59. package/dist/prod/reveal.js +77 -77
  60. package/dist/prod/signals.js +59 -38
  61. package/dist/prod/store/affects.js +76 -69
  62. package/dist/prod/store/edges.js +39 -0
  63. package/dist/prod/store/hooks.js +13 -0
  64. package/dist/prod/store/index.js +0 -2
  65. package/dist/prod/store/optimistic.js +121 -84
  66. package/dist/prod/store/projection.js +46 -34
  67. package/dist/prod/store/reconcile.js +32 -30
  68. package/dist/prod/store/store.js +205 -116
  69. package/dist/types/affects-marks.d.ts +14 -0
  70. package/dist/types/boundaries.d.ts +5 -1
  71. package/dist/types/core/async.d.ts +10 -0
  72. package/dist/types/core/attribution.d.ts +6 -2
  73. package/dist/types/core/constants.d.ts +18 -1
  74. package/dist/types/core/core.d.ts +77 -5
  75. package/dist/types/core/dev.d.ts +43 -13
  76. package/dist/types/core/graph.d.ts +11 -0
  77. package/dist/types/core/identities.d.ts +17 -0
  78. package/dist/types/core/index.d.ts +2 -1
  79. package/dist/types/core/lanes.d.ts +2 -4
  80. package/dist/types/core/owner.d.ts +5 -3
  81. package/dist/types/core/scheduler.d.ts +59 -34
  82. package/dist/types/core/truth.d.ts +16 -0
  83. package/dist/types/core/types.d.ts +21 -6
  84. package/dist/types/core/verdict.d.ts +32 -0
  85. package/dist/types/deferred.d.ts +28 -0
  86. package/dist/types/index.d.ts +6 -0
  87. package/dist/types/map.d.ts +2 -2
  88. package/dist/types/signals.d.ts +28 -7
  89. package/dist/types/store/affects.d.ts +11 -0
  90. package/dist/types/store/edges.d.ts +9 -0
  91. package/dist/types/store/hooks.d.ts +48 -0
  92. package/dist/types/store/index.d.ts +10 -4
  93. package/dist/types/store/optimistic.d.ts +3 -2
  94. package/dist/types/store/projection.d.ts +4 -3
  95. package/dist/types/store/store.d.ts +4 -39
  96. package/dist/types/store/target.d.ts +16 -8
  97. package/dist/types/store/types.d.ts +14 -0
  98. package/package.json +1 -1
@@ -2,7 +2,9 @@ import { isEqual } from "../core/core.js";
2
2
 
3
3
  import { isOwned, $OWNER, storeLookup, lookupTarget } from "./target.js";
4
4
 
5
- import { userWriting, optHooks, unwrapValue, adoptPB, sameKey, materializePB, notifyFold, targetsEqual, bumpDeep, notifyKeyValue, notifyKeyDiff, notifyFoldTail, hasAccessorFlag } from "./store.js";
5
+ import { userWriting, unwrapValue, adoptPB, sameKey, materializePB, notifyFold, sameRow, targetsEqual, bumpDeep, notifyKeyValue, notifyKeyDiff, notifyFoldTail, hasAccessorFlag } from "./store.js";
6
+
7
+ import { optHooks } from "./hooks.js";
6
8
 
7
9
  import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "./types.js";
8
10
 
@@ -73,33 +75,33 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
73
75
  // — key matching from the arrangement the guesses made (R28), so a row
74
76
  // the guess added keeps its proxy when the server returns it.
75
77
  const i = l?.opt === true ? optHooks.view(e, f) : f;
76
- const u = Array.isArray(n);
77
- const s = e.s === true;
78
+ const s = Array.isArray(n);
79
+ const u = e.s === true;
78
80
  const r = f;
79
81
  adoptPB(e, n, false);
80
- if (s) markRawIngest(n);
81
- if (Array.isArray(i) !== u) {
82
+ if (u) markRawIngest(n);
83
+ if (Array.isArray(i) !== s) {
82
84
  notifyFold(e, r, n);
83
85
  return;
84
86
  }
85
- if (u) {
87
+ if (s) {
86
88
  const f = i;
87
- const u = n;
89
+ const s = n;
88
90
  const a = e.n;
89
91
  let c = 0;
90
- if (t && !s) {
92
+ if (t && !u) {
91
93
  const i = f.length;
92
- const s = u.length;
94
+ const u = s.length;
93
95
  let d = false;
94
96
  let p = 0;
95
97
  // Aligned prefix: same row (by reference or key) at the same index.
96
- for (const y = Math.min(i, s); p < y; p++) {
97
- const i = u[p];
98
- const s = f[p];
99
- if (s !== i && !(s !== null && typeof s === "object" && i !== null && typeof i === "object" && sameKey(t(s), t(i)))) break;
98
+ for (const y = Math.min(i, u); p < y; p++) {
99
+ const i = s[p];
100
+ const u = f[p];
101
+ if (u !== i && !sameRow(u, i, t)) break;
100
102
  // misaligned: fall to the keyed remainder below
101
- if ((s !== i || i !== null && typeof i === "object" && isOwned(i)) && i !== null && typeof i === "object") descend(unwrapValue(s), i, t, l, o);
102
- if (e.dk !== null && !d && !(i !== null && typeof i === "object" ? targetsEqual(s, i) : isEqual(s, i))) {
103
+ if ((u !== i || i !== null && typeof i === "object" && isOwned(i)) && i !== null && typeof i === "object") descend(unwrapValue(u), i, t, l, o);
104
+ if (e.dk !== null && !d && !(i !== null && typeof i === "object" ? targetsEqual(u, i) : isEqual(u, i))) {
103
105
  bumpDeep(e);
104
106
  d = true;
105
107
  }
@@ -111,12 +113,12 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
111
113
  }
112
114
  }
113
115
  }
114
- if (e.dk !== null && !d && p < u.length) bumpDeep(e);
116
+ if (e.dk !== null && !d && p < s.length) bumpDeep(e);
115
117
  const y = p;
116
118
  // misalignment point (== nlen on aligned ticks)
117
119
  let w = null;
118
- for (;p < u.length; p++) {
119
- const e = u[p];
120
+ for (;p < s.length; p++) {
121
+ const e = s[p];
120
122
  if (e !== null && typeof e === "object") {
121
123
  const n = t(e);
122
124
  let i;
@@ -156,12 +158,12 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
156
158
  }
157
159
  }
158
160
  } else {
159
- const i = Math.min(f.length, u.length);
160
- const d = u.length;
161
+ const i = Math.min(f.length, s.length);
162
+ const d = s.length;
161
163
  let p = false;
162
164
  for (let y = 0; y < d; y++) {
163
- const d = u[y];
164
- if (!s && y < i && d !== null && typeof d === "object") descend(unwrapValue(f[y]), d, t, l, o);
165
+ const d = s[y];
166
+ if (!u && y < i && d !== null && typeof d === "object") descend(unwrapValue(f[y]), d, t, l, o);
165
167
  if (e.dk !== null && !p && !(d !== null && typeof d === "object" ? targetsEqual(f[y], d) : isEqual(f[y], d))) {
166
168
  bumpDeep(e);
167
169
  p = true;
@@ -179,7 +181,7 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
179
181
  if (a !== null && c < e.nc) {
180
182
  for (const e of Reflect.ownKeys(a)) {
181
183
  const t = typeof e === "string" ? +e : NaN;
182
- if (!(t >= 0 && t < u.length)) notifyKeyDiff(a[e], e, r, n, false);
184
+ if (!(t >= 0 && t < s.length)) notifyKeyDiff(a[e], e, r, n, false);
183
185
  }
184
186
  }
185
187
  notifyFoldTail(e, r, n);
@@ -189,15 +191,15 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
189
191
  let c = 0;
190
192
  let d = false;
191
193
  for (const f in n) {
192
- const u = n[f];
194
+ const s = n[f];
193
195
  const p = r[f];
194
- const y = u !== null && typeof u === "object";
195
- if (p === u && (!y || !isOwned(u)) && (a === null || a[f] === undefined || !hasAccessorFlag(a[f]))) {
196
+ const y = s !== null && typeof s === "object";
197
+ if (p === s && (!y || !isOwned(s)) && (a === null || a[f] === undefined || !hasAccessorFlag(a[f]))) {
196
198
  if (a !== null && a[f] !== undefined) c++;
197
199
  continue;
198
200
  }
199
- if (y && !s) descend(unwrapValue(i[f]), u, t, l, o);
200
- if (e.dk !== null && !d && !(y ? targetsEqual(p, u) : isEqual(p, u))) {
201
+ if (y && !u) descend(unwrapValue(i[f]), s, t, l, o);
202
+ if (e.dk !== null && !d && !(y ? targetsEqual(p, s) : isEqual(p, s))) {
201
203
  bumpDeep(e);
202
204
  d = true;
203
205
  }
@@ -205,7 +207,7 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
205
207
  const e = a[f];
206
208
  if (e !== undefined) {
207
209
  c++;
208
- notifyKeyValue(e, f, p, u, r, n);
210
+ notifyKeyValue(e, f, p, s, r, n);
209
211
  }
210
212
  }
211
213
  }
@@ -214,7 +216,7 @@ import { $TARGET, markRawIngest, isWrappable, rawValuesUsed, isRawValue } from "
214
216
  const f = p[e];
215
217
  if (f === $OWNER) continue;
216
218
  const i = n[f];
217
- if (!s && i !== null && typeof i === "object") descend(unwrapValue(r[f]), i, t, l, o);
219
+ if (!u && i !== null && typeof i === "object") descend(unwrapValue(r[f]), i, t, l, o);
218
220
  if (a !== null) {
219
221
  const e = a[f];
220
222
  if (e !== undefined) {