@solidjs/signals 0.0.3 → 0.0.5
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.js +153 -55
- package/dist/node.cjs +306 -212
- package/dist/prod.js +303 -212
- package/dist/types/core/constants.d.ts +2 -1
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/owner.d.ts +7 -2
- package/dist/types/core/scheduler.d.ts +1 -0
- package/dist/types/core/suspense.d.ts +1 -1
- package/dist/types/core/utils.d.ts +5 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +1 -1
- package/dist/types/signals.d.ts +89 -21
- package/package.json +1 -1
- package/dist/types/utils.d.ts +0 -1
package/dist/node.cjs
CHANGED
|
@@ -5,9 +5,7 @@ var NotReadyError = class extends Error {
|
|
|
5
5
|
};
|
|
6
6
|
var NoOwnerError = class extends Error {
|
|
7
7
|
constructor() {
|
|
8
|
-
super(
|
|
9
|
-
""
|
|
10
|
-
);
|
|
8
|
+
super("");
|
|
11
9
|
}
|
|
12
10
|
};
|
|
13
11
|
var ContextNotFoundError = class extends Error {
|
|
@@ -18,21 +16,76 @@ var ContextNotFoundError = class extends Error {
|
|
|
18
16
|
}
|
|
19
17
|
};
|
|
20
18
|
|
|
21
|
-
// src/utils.ts
|
|
22
|
-
function isUndefined(value) {
|
|
23
|
-
return typeof value === "undefined";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
19
|
// src/core/constants.ts
|
|
27
20
|
var STATE_CLEAN = 0;
|
|
28
21
|
var STATE_CHECK = 1;
|
|
29
22
|
var STATE_DIRTY = 2;
|
|
30
|
-
var
|
|
23
|
+
var STATE_UNINITIALIZED = 3;
|
|
24
|
+
var STATE_DISPOSED = 4;
|
|
31
25
|
var EFFECT_PURE = 0;
|
|
32
26
|
var EFFECT_RENDER = 1;
|
|
33
27
|
var EFFECT_USER = 2;
|
|
34
28
|
var SUPPORTS_PROXY = typeof Proxy === "function";
|
|
35
29
|
|
|
30
|
+
// src/core/utils.ts
|
|
31
|
+
function isUndefined(value) {
|
|
32
|
+
return typeof value === "undefined";
|
|
33
|
+
}
|
|
34
|
+
function flatten(children, options) {
|
|
35
|
+
if (typeof children === "function" && !children.length) {
|
|
36
|
+
if (options == null ? void 0 : options.doNotUnwrap)
|
|
37
|
+
return children;
|
|
38
|
+
do {
|
|
39
|
+
children = children();
|
|
40
|
+
} while (typeof children === "function" && !children.length);
|
|
41
|
+
}
|
|
42
|
+
if ((options == null ? void 0 : options.skipNonRendered) && (children == null || children === true || children === false || children === ""))
|
|
43
|
+
return;
|
|
44
|
+
if (Array.isArray(children)) {
|
|
45
|
+
let results = [];
|
|
46
|
+
if (flattenArray(children, results, options)) {
|
|
47
|
+
return () => {
|
|
48
|
+
let nested = [];
|
|
49
|
+
flattenArray(results, nested, { ...options, doNotUnwrap: false });
|
|
50
|
+
return nested;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return results;
|
|
54
|
+
}
|
|
55
|
+
return children;
|
|
56
|
+
}
|
|
57
|
+
function flattenArray(children, results = [], options) {
|
|
58
|
+
let notReady = null;
|
|
59
|
+
let needsUnwrap = false;
|
|
60
|
+
for (let i = 0; i < children.length; i++) {
|
|
61
|
+
try {
|
|
62
|
+
let child = children[i];
|
|
63
|
+
if (typeof child === "function" && !child.length) {
|
|
64
|
+
if (options == null ? void 0 : options.doNotUnwrap) {
|
|
65
|
+
results.push(child);
|
|
66
|
+
needsUnwrap = true;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
do {
|
|
70
|
+
child = child();
|
|
71
|
+
} while (typeof child === "function" && !child.length);
|
|
72
|
+
}
|
|
73
|
+
if (Array.isArray(child)) {
|
|
74
|
+
needsUnwrap = flattenArray(child, results, options);
|
|
75
|
+
} else if ((options == null ? void 0 : options.skipNonRendered) && (child == null || child === true || child === false || child === "")) {
|
|
76
|
+
} else
|
|
77
|
+
results.push(child);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
if (!(e instanceof NotReadyError))
|
|
80
|
+
throw e;
|
|
81
|
+
notReady = e;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (notReady)
|
|
85
|
+
throw notReady;
|
|
86
|
+
return needsUnwrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
36
89
|
// src/core/owner.ts
|
|
37
90
|
var currentOwner = null;
|
|
38
91
|
var defaultContext = {};
|
|
@@ -48,30 +101,30 @@ var Owner = class {
|
|
|
48
101
|
// We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild
|
|
49
102
|
// However, the children are actually added in reverse creation order
|
|
50
103
|
// See comment at the top of the file for an example of the _nextSibling traversal
|
|
51
|
-
r = null;
|
|
52
|
-
m = null;
|
|
53
104
|
o = null;
|
|
105
|
+
m = null;
|
|
106
|
+
p = null;
|
|
54
107
|
a = STATE_CLEAN;
|
|
55
|
-
h = null;
|
|
56
|
-
n = defaultContext;
|
|
57
108
|
i = null;
|
|
109
|
+
n = defaultContext;
|
|
110
|
+
j = null;
|
|
58
111
|
e = null;
|
|
59
112
|
constructor(signal = false) {
|
|
60
113
|
if (currentOwner && !signal)
|
|
61
114
|
currentOwner.append(this);
|
|
62
115
|
}
|
|
63
116
|
append(child) {
|
|
64
|
-
child.r = this;
|
|
65
117
|
child.o = this;
|
|
118
|
+
child.p = this;
|
|
66
119
|
if (this.m)
|
|
67
|
-
this.m.
|
|
120
|
+
this.m.p = child;
|
|
68
121
|
child.m = this.m;
|
|
69
122
|
this.m = child;
|
|
70
123
|
if (child.n !== this.n) {
|
|
71
124
|
child.n = { ...this.n, ...child.n };
|
|
72
125
|
}
|
|
73
|
-
if (this.
|
|
74
|
-
child.
|
|
126
|
+
if (this.j) {
|
|
127
|
+
child.j = !child.j ? this.j : [...child.j, ...this.j];
|
|
75
128
|
}
|
|
76
129
|
if (this.e)
|
|
77
130
|
child.e = this.e;
|
|
@@ -79,8 +132,8 @@ var Owner = class {
|
|
|
79
132
|
dispose(self = true) {
|
|
80
133
|
if (this.a === STATE_DISPOSED)
|
|
81
134
|
return;
|
|
82
|
-
let head = self ? this.
|
|
83
|
-
while (current && current.
|
|
135
|
+
let head = self ? this.p || this.o : this, current = this.m, next = null;
|
|
136
|
+
while (current && current.o === this) {
|
|
84
137
|
current.dispose(true);
|
|
85
138
|
current.x();
|
|
86
139
|
next = current.m;
|
|
@@ -90,40 +143,40 @@ var Owner = class {
|
|
|
90
143
|
if (self)
|
|
91
144
|
this.x();
|
|
92
145
|
if (current)
|
|
93
|
-
current.
|
|
146
|
+
current.p = !self ? this : this.p;
|
|
94
147
|
if (head)
|
|
95
148
|
head.m = current;
|
|
96
149
|
}
|
|
97
150
|
x() {
|
|
98
|
-
if (this.
|
|
99
|
-
this.
|
|
100
|
-
this.r = null;
|
|
151
|
+
if (this.p)
|
|
152
|
+
this.p.m = null;
|
|
101
153
|
this.o = null;
|
|
154
|
+
this.p = null;
|
|
102
155
|
this.n = defaultContext;
|
|
103
|
-
this.
|
|
156
|
+
this.j = null;
|
|
104
157
|
this.a = STATE_DISPOSED;
|
|
105
158
|
this.emptyDisposal();
|
|
106
159
|
}
|
|
107
160
|
emptyDisposal() {
|
|
108
|
-
if (!this.
|
|
161
|
+
if (!this.i)
|
|
109
162
|
return;
|
|
110
|
-
if (Array.isArray(this.
|
|
111
|
-
for (let i = 0; i < this.
|
|
112
|
-
const callable = this.
|
|
163
|
+
if (Array.isArray(this.i)) {
|
|
164
|
+
for (let i = 0; i < this.i.length; i++) {
|
|
165
|
+
const callable = this.i[i];
|
|
113
166
|
callable.call(callable);
|
|
114
167
|
}
|
|
115
168
|
} else {
|
|
116
|
-
this.
|
|
169
|
+
this.i.call(this.i);
|
|
117
170
|
}
|
|
118
|
-
this.
|
|
171
|
+
this.i = null;
|
|
119
172
|
}
|
|
120
173
|
handleError(error) {
|
|
121
|
-
if (!this.
|
|
174
|
+
if (!this.j)
|
|
122
175
|
throw error;
|
|
123
|
-
let i = 0, len = this.
|
|
176
|
+
let i = 0, len = this.j.length;
|
|
124
177
|
for (i = 0; i < len; i++) {
|
|
125
178
|
try {
|
|
126
|
-
this.
|
|
179
|
+
this.j[i](error);
|
|
127
180
|
break;
|
|
128
181
|
} catch (e) {
|
|
129
182
|
error = e;
|
|
@@ -158,17 +211,18 @@ function setContext(context, value, owner = currentOwner) {
|
|
|
158
211
|
function hasContext(context, owner = currentOwner) {
|
|
159
212
|
return !isUndefined(owner == null ? void 0 : owner.n[context.id]);
|
|
160
213
|
}
|
|
161
|
-
function onCleanup(
|
|
214
|
+
function onCleanup(fn) {
|
|
162
215
|
if (!currentOwner)
|
|
163
|
-
return;
|
|
216
|
+
return fn;
|
|
164
217
|
const node = currentOwner;
|
|
165
|
-
if (!node.
|
|
166
|
-
node.
|
|
167
|
-
} else if (Array.isArray(node.
|
|
168
|
-
node.
|
|
218
|
+
if (!node.i) {
|
|
219
|
+
node.i = fn;
|
|
220
|
+
} else if (Array.isArray(node.i)) {
|
|
221
|
+
node.i.push(fn);
|
|
169
222
|
} else {
|
|
170
|
-
node.
|
|
223
|
+
node.i = [node.i, fn];
|
|
171
224
|
}
|
|
225
|
+
return fn;
|
|
172
226
|
}
|
|
173
227
|
|
|
174
228
|
// src/core/flags.ts
|
|
@@ -195,40 +249,41 @@ function incrementClock() {
|
|
|
195
249
|
}
|
|
196
250
|
var UNCHANGED = Symbol(0);
|
|
197
251
|
var Computation = class extends Owner {
|
|
198
|
-
b = null;
|
|
199
252
|
c = null;
|
|
253
|
+
b = null;
|
|
200
254
|
d;
|
|
201
|
-
|
|
255
|
+
B;
|
|
202
256
|
// Used in __DEV__ mode, hopefully removed in production
|
|
203
257
|
V;
|
|
204
258
|
// Using false is an optimization as an alternative to _equals: () => false
|
|
205
259
|
// which could enable more efficient DIRTY notification
|
|
206
|
-
|
|
260
|
+
F = isEqual;
|
|
207
261
|
N;
|
|
208
262
|
/** Whether the computation is an error or has ancestors that are unresolved */
|
|
209
|
-
|
|
263
|
+
f = 0;
|
|
210
264
|
/** Which flags raised by sources are handled, vs. being passed through. */
|
|
211
|
-
|
|
212
|
-
F = null;
|
|
265
|
+
C = DEFAULT_FLAGS;
|
|
213
266
|
G = null;
|
|
214
|
-
H =
|
|
267
|
+
H = null;
|
|
268
|
+
I = -1;
|
|
215
269
|
constructor(initialValue, compute2, options) {
|
|
216
270
|
super(compute2 === null);
|
|
217
|
-
this.
|
|
218
|
-
this.a = compute2 ?
|
|
271
|
+
this.B = compute2;
|
|
272
|
+
this.a = compute2 ? STATE_UNINITIALIZED : STATE_CLEAN;
|
|
219
273
|
this.d = initialValue;
|
|
220
274
|
if ((options == null ? void 0 : options.equals) !== void 0)
|
|
221
|
-
this.
|
|
275
|
+
this.F = options.equals;
|
|
222
276
|
if (options == null ? void 0 : options.unobserved)
|
|
223
277
|
this.N = options == null ? void 0 : options.unobserved;
|
|
224
278
|
}
|
|
225
279
|
O() {
|
|
226
|
-
|
|
280
|
+
var _a;
|
|
281
|
+
if (this.B)
|
|
227
282
|
this.s();
|
|
228
|
-
if (!this.
|
|
283
|
+
if (!this.B || ((_a = this.c) == null ? void 0 : _a.length))
|
|
229
284
|
track(this);
|
|
230
|
-
newFlags |= this.
|
|
231
|
-
if (this.
|
|
285
|
+
newFlags |= this.f & ~currentMask;
|
|
286
|
+
if (this.f & ERROR_BIT) {
|
|
232
287
|
throw this.d;
|
|
233
288
|
} else {
|
|
234
289
|
return this.d;
|
|
@@ -262,36 +317,36 @@ var Computation = class extends Owner {
|
|
|
262
317
|
* loading state changes
|
|
263
318
|
*/
|
|
264
319
|
loading() {
|
|
265
|
-
if (this.
|
|
266
|
-
this.
|
|
320
|
+
if (this.H === null) {
|
|
321
|
+
this.H = loadingState(this);
|
|
267
322
|
}
|
|
268
|
-
return this.
|
|
323
|
+
return this.H.read();
|
|
269
324
|
}
|
|
270
325
|
/**
|
|
271
326
|
* Return true if the computation is the computation threw an error
|
|
272
327
|
* Triggers re-execution of the computation when the error state changes
|
|
273
328
|
*/
|
|
274
329
|
error() {
|
|
275
|
-
if (this.
|
|
276
|
-
this.
|
|
330
|
+
if (this.G === null) {
|
|
331
|
+
this.G = errorState(this);
|
|
277
332
|
}
|
|
278
|
-
return this.
|
|
333
|
+
return this.G.read();
|
|
279
334
|
}
|
|
280
335
|
/** Update the computation with a new value. */
|
|
281
336
|
write(value, flags = 0, raw = false) {
|
|
282
337
|
const newValue = !raw && typeof value === "function" ? value(this.d) : value;
|
|
283
|
-
const valueChanged = newValue !== UNCHANGED && (!!(flags & ERROR_BIT) || this.
|
|
338
|
+
const valueChanged = newValue !== UNCHANGED && (!!(flags & ERROR_BIT) || this.a === STATE_UNINITIALIZED || this.F === false || !this.F(this.d, newValue));
|
|
284
339
|
if (valueChanged)
|
|
285
340
|
this.d = newValue;
|
|
286
|
-
const changedFlagsMask = this.
|
|
287
|
-
this.
|
|
288
|
-
this.
|
|
289
|
-
if (this.
|
|
290
|
-
for (let i = 0; i < this.
|
|
341
|
+
const changedFlagsMask = this.f ^ flags, changedFlags = changedFlagsMask & flags;
|
|
342
|
+
this.f = flags;
|
|
343
|
+
this.I = clock + 1;
|
|
344
|
+
if (this.b) {
|
|
345
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
291
346
|
if (valueChanged) {
|
|
292
|
-
this.
|
|
347
|
+
this.b[i].t(STATE_DIRTY);
|
|
293
348
|
} else if (changedFlagsMask) {
|
|
294
|
-
this.
|
|
349
|
+
this.b[i].P(changedFlagsMask, changedFlags);
|
|
295
350
|
}
|
|
296
351
|
}
|
|
297
352
|
}
|
|
@@ -304,9 +359,9 @@ var Computation = class extends Owner {
|
|
|
304
359
|
if (this.a >= state)
|
|
305
360
|
return;
|
|
306
361
|
this.a = state;
|
|
307
|
-
if (this.
|
|
308
|
-
for (let i = 0; i < this.
|
|
309
|
-
this.
|
|
362
|
+
if (this.b) {
|
|
363
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
364
|
+
this.b[i].t(STATE_CHECK);
|
|
310
365
|
}
|
|
311
366
|
}
|
|
312
367
|
}
|
|
@@ -319,27 +374,27 @@ var Computation = class extends Owner {
|
|
|
319
374
|
P(mask, newFlags2) {
|
|
320
375
|
if (this.a >= STATE_DIRTY)
|
|
321
376
|
return;
|
|
322
|
-
if (mask & this.
|
|
377
|
+
if (mask & this.C) {
|
|
323
378
|
this.t(STATE_DIRTY);
|
|
324
379
|
return;
|
|
325
380
|
}
|
|
326
381
|
if (this.a >= STATE_CHECK)
|
|
327
382
|
return;
|
|
328
|
-
const prevFlags = this.
|
|
383
|
+
const prevFlags = this.f & mask;
|
|
329
384
|
const deltaFlags = prevFlags ^ newFlags2;
|
|
330
385
|
if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
|
|
331
386
|
this.t(STATE_CHECK);
|
|
332
387
|
} else {
|
|
333
|
-
this.
|
|
334
|
-
if (this.
|
|
335
|
-
for (let i = 0; i < this.
|
|
336
|
-
this.
|
|
388
|
+
this.f ^= deltaFlags;
|
|
389
|
+
if (this.b) {
|
|
390
|
+
for (let i = 0; i < this.b.length; i++) {
|
|
391
|
+
this.b[i].P(mask, newFlags2);
|
|
337
392
|
}
|
|
338
393
|
}
|
|
339
394
|
}
|
|
340
395
|
}
|
|
341
396
|
Q(error) {
|
|
342
|
-
this.write(error, this.
|
|
397
|
+
this.write(error, this.f | ERROR_BIT);
|
|
343
398
|
}
|
|
344
399
|
/**
|
|
345
400
|
* This is the core part of the reactivity system, which makes sure that the values are updated
|
|
@@ -357,15 +412,15 @@ var Computation = class extends Owner {
|
|
|
357
412
|
}
|
|
358
413
|
let observerFlags = 0;
|
|
359
414
|
if (this.a === STATE_CHECK) {
|
|
360
|
-
for (let i = 0; i < this.
|
|
361
|
-
this.
|
|
362
|
-
observerFlags |= this.
|
|
415
|
+
for (let i = 0; i < this.c.length; i++) {
|
|
416
|
+
this.c[i].s();
|
|
417
|
+
observerFlags |= this.c[i].f;
|
|
363
418
|
if (this.a === STATE_DIRTY) {
|
|
364
419
|
break;
|
|
365
420
|
}
|
|
366
421
|
}
|
|
367
422
|
}
|
|
368
|
-
if (this.a === STATE_DIRTY) {
|
|
423
|
+
if (this.a === STATE_DIRTY || this.a === STATE_UNINITIALIZED) {
|
|
369
424
|
update(this);
|
|
370
425
|
} else {
|
|
371
426
|
this.write(UNCHANGED, observerFlags);
|
|
@@ -378,46 +433,46 @@ var Computation = class extends Owner {
|
|
|
378
433
|
x() {
|
|
379
434
|
if (this.a === STATE_DISPOSED)
|
|
380
435
|
return;
|
|
381
|
-
if (this.
|
|
436
|
+
if (this.c)
|
|
382
437
|
removeSourceObservers(this, 0);
|
|
383
438
|
super.x();
|
|
384
439
|
}
|
|
385
440
|
};
|
|
386
441
|
function loadingState(node) {
|
|
387
|
-
const prevOwner = setOwner(node.
|
|
442
|
+
const prevOwner = setOwner(node.o);
|
|
388
443
|
const options = void 0;
|
|
389
444
|
const computation = new Computation(
|
|
390
445
|
void 0,
|
|
391
446
|
() => {
|
|
392
447
|
track(node);
|
|
393
448
|
node.s();
|
|
394
|
-
return !!(node.
|
|
449
|
+
return !!(node.f & LOADING_BIT);
|
|
395
450
|
},
|
|
396
451
|
options
|
|
397
452
|
);
|
|
398
|
-
computation.
|
|
453
|
+
computation.C = ERROR_BIT | LOADING_BIT;
|
|
399
454
|
setOwner(prevOwner);
|
|
400
455
|
return computation;
|
|
401
456
|
}
|
|
402
457
|
function errorState(node) {
|
|
403
|
-
const prevOwner = setOwner(node.
|
|
458
|
+
const prevOwner = setOwner(node.o);
|
|
404
459
|
const options = void 0;
|
|
405
460
|
const computation = new Computation(
|
|
406
461
|
void 0,
|
|
407
462
|
() => {
|
|
408
463
|
track(node);
|
|
409
464
|
node.s();
|
|
410
|
-
return !!(node.
|
|
465
|
+
return !!(node.f & ERROR_BIT);
|
|
411
466
|
},
|
|
412
467
|
options
|
|
413
468
|
);
|
|
414
|
-
computation.
|
|
469
|
+
computation.C = ERROR_BIT;
|
|
415
470
|
setOwner(prevOwner);
|
|
416
471
|
return computation;
|
|
417
472
|
}
|
|
418
473
|
function track(computation) {
|
|
419
474
|
if (currentObserver) {
|
|
420
|
-
if (!newSources && currentObserver.
|
|
475
|
+
if (!newSources && currentObserver.c && currentObserver.c[newSourcesIndex] === computation) {
|
|
421
476
|
newSourcesIndex++;
|
|
422
477
|
} else if (!newSources)
|
|
423
478
|
newSources = [computation];
|
|
@@ -425,7 +480,7 @@ function track(computation) {
|
|
|
425
480
|
newSources.push(computation);
|
|
426
481
|
}
|
|
427
482
|
if (updateCheck) {
|
|
428
|
-
updateCheck.d = computation.
|
|
483
|
+
updateCheck.d = computation.I > currentObserver.I;
|
|
429
484
|
}
|
|
430
485
|
}
|
|
431
486
|
}
|
|
@@ -437,7 +492,7 @@ function update(node) {
|
|
|
437
492
|
try {
|
|
438
493
|
node.dispose(false);
|
|
439
494
|
node.emptyDisposal();
|
|
440
|
-
const result = compute(node, node.
|
|
495
|
+
const result = compute(node, node.B, node);
|
|
441
496
|
node.write(result, newFlags, true);
|
|
442
497
|
} catch (error) {
|
|
443
498
|
if (error instanceof NotReadyError) {
|
|
@@ -447,27 +502,27 @@ function update(node) {
|
|
|
447
502
|
}
|
|
448
503
|
} finally {
|
|
449
504
|
if (newSources) {
|
|
450
|
-
if (node.
|
|
505
|
+
if (node.c)
|
|
451
506
|
removeSourceObservers(node, newSourcesIndex);
|
|
452
|
-
if (node.
|
|
453
|
-
node.
|
|
507
|
+
if (node.c && newSourcesIndex > 0) {
|
|
508
|
+
node.c.length = newSourcesIndex + newSources.length;
|
|
454
509
|
for (let i = 0; i < newSources.length; i++) {
|
|
455
|
-
node.
|
|
510
|
+
node.c[newSourcesIndex + i] = newSources[i];
|
|
456
511
|
}
|
|
457
512
|
} else {
|
|
458
|
-
node.
|
|
513
|
+
node.c = newSources;
|
|
459
514
|
}
|
|
460
515
|
let source;
|
|
461
|
-
for (let i = newSourcesIndex; i < node.
|
|
462
|
-
source = node.
|
|
463
|
-
if (!source.
|
|
464
|
-
source.
|
|
516
|
+
for (let i = newSourcesIndex; i < node.c.length; i++) {
|
|
517
|
+
source = node.c[i];
|
|
518
|
+
if (!source.b)
|
|
519
|
+
source.b = [node];
|
|
465
520
|
else
|
|
466
|
-
source.
|
|
521
|
+
source.b.push(node);
|
|
467
522
|
}
|
|
468
|
-
} else if (node.
|
|
523
|
+
} else if (node.c && newSourcesIndex < node.c.length) {
|
|
469
524
|
removeSourceObservers(node, newSourcesIndex);
|
|
470
|
-
node.
|
|
525
|
+
node.c.length = newSourcesIndex;
|
|
471
526
|
}
|
|
472
527
|
newSources = prevSources;
|
|
473
528
|
newSourcesIndex = prevSourcesIndex;
|
|
@@ -479,13 +534,13 @@ function removeSourceObservers(node, index) {
|
|
|
479
534
|
var _a;
|
|
480
535
|
let source;
|
|
481
536
|
let swap;
|
|
482
|
-
for (let i = index; i < node.
|
|
483
|
-
source = node.
|
|
484
|
-
if (source.
|
|
485
|
-
swap = source.
|
|
486
|
-
source.
|
|
487
|
-
source.
|
|
488
|
-
if (!source.
|
|
537
|
+
for (let i = index; i < node.c.length; i++) {
|
|
538
|
+
source = node.c[i];
|
|
539
|
+
if (source.b) {
|
|
540
|
+
swap = source.b.indexOf(node);
|
|
541
|
+
source.b[swap] = source.b[source.b.length - 1];
|
|
542
|
+
source.b.pop();
|
|
543
|
+
if (!source.b.length)
|
|
489
544
|
(_a = source.N) == null ? void 0 : _a.call(source);
|
|
490
545
|
}
|
|
491
546
|
}
|
|
@@ -530,7 +585,7 @@ function latest(fn) {
|
|
|
530
585
|
function compute(owner, compute2, observer) {
|
|
531
586
|
const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask;
|
|
532
587
|
currentObserver = observer;
|
|
533
|
-
currentMask = (observer == null ? void 0 : observer.
|
|
588
|
+
currentMask = (observer == null ? void 0 : observer.C) ?? DEFAULT_FLAGS;
|
|
534
589
|
try {
|
|
535
590
|
return compute2(observer ? observer.d : void 0);
|
|
536
591
|
} finally {
|
|
@@ -546,10 +601,11 @@ function schedule() {
|
|
|
546
601
|
if (scheduled)
|
|
547
602
|
return;
|
|
548
603
|
scheduled = true;
|
|
549
|
-
|
|
604
|
+
if (!globalQueue.D)
|
|
605
|
+
queueMicrotask(flushSync);
|
|
550
606
|
}
|
|
551
607
|
var Queue = class {
|
|
552
|
-
|
|
608
|
+
D = false;
|
|
553
609
|
u = [[], [], []];
|
|
554
610
|
z = [];
|
|
555
611
|
enqueue(type, node) {
|
|
@@ -574,16 +630,17 @@ var Queue = class {
|
|
|
574
630
|
}
|
|
575
631
|
}
|
|
576
632
|
flush() {
|
|
577
|
-
if (this.
|
|
633
|
+
if (this.D)
|
|
578
634
|
return;
|
|
579
|
-
this.
|
|
635
|
+
this.D = true;
|
|
580
636
|
try {
|
|
581
637
|
this.run(EFFECT_PURE);
|
|
582
638
|
incrementClock();
|
|
639
|
+
scheduled = false;
|
|
583
640
|
this.run(EFFECT_RENDER);
|
|
584
641
|
this.run(EFFECT_USER);
|
|
585
642
|
} finally {
|
|
586
|
-
this.
|
|
643
|
+
this.D = false;
|
|
587
644
|
}
|
|
588
645
|
}
|
|
589
646
|
addChild(child) {
|
|
@@ -596,9 +653,18 @@ var Queue = class {
|
|
|
596
653
|
}
|
|
597
654
|
};
|
|
598
655
|
var globalQueue = new Queue();
|
|
656
|
+
var globalTasks = [];
|
|
599
657
|
function flushSync() {
|
|
600
|
-
|
|
601
|
-
|
|
658
|
+
while (scheduled) {
|
|
659
|
+
globalQueue.flush();
|
|
660
|
+
for (let i = 0; i < globalTasks.length; i++)
|
|
661
|
+
globalTasks[i]();
|
|
662
|
+
globalTasks.length = 0;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
function queueTask(fn) {
|
|
666
|
+
globalTasks.push(fn);
|
|
667
|
+
schedule();
|
|
602
668
|
}
|
|
603
669
|
function createBoundary(fn, queue) {
|
|
604
670
|
const owner = new Owner();
|
|
@@ -609,7 +675,7 @@ function createBoundary(fn, queue) {
|
|
|
609
675
|
}
|
|
610
676
|
function runTop(node) {
|
|
611
677
|
const ancestors = [];
|
|
612
|
-
for (let current = node; current !== null; current = current.
|
|
678
|
+
for (let current = node; current !== null; current = current.o) {
|
|
613
679
|
if (current.a !== STATE_CLEAN) {
|
|
614
680
|
ancestors.push(current);
|
|
615
681
|
}
|
|
@@ -634,25 +700,25 @@ function runEffectQueue(queue) {
|
|
|
634
700
|
var Effect = class extends Computation {
|
|
635
701
|
J;
|
|
636
702
|
K = false;
|
|
637
|
-
|
|
638
|
-
|
|
703
|
+
E;
|
|
704
|
+
A;
|
|
639
705
|
e;
|
|
640
706
|
constructor(initialValue, compute2, effect, options) {
|
|
641
707
|
var _a;
|
|
642
708
|
super(initialValue, compute2, options);
|
|
643
709
|
this.J = effect;
|
|
644
|
-
this.
|
|
645
|
-
this.
|
|
710
|
+
this.E = initialValue;
|
|
711
|
+
this.A = (options == null ? void 0 : options.render) ? EFFECT_RENDER : EFFECT_USER;
|
|
646
712
|
this.e = ((_a = getOwner()) == null ? void 0 : _a.e) || globalQueue;
|
|
647
713
|
this.s();
|
|
648
|
-
this.
|
|
714
|
+
this.A === EFFECT_USER ? this.e.enqueue(this.A, this) : this.R();
|
|
649
715
|
}
|
|
650
716
|
write(value, flags = 0) {
|
|
651
717
|
var _a, _b;
|
|
652
|
-
const currentFlags = this.
|
|
653
|
-
this.
|
|
654
|
-
if ((flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
|
|
655
|
-
(_b = (_a = this.e).
|
|
718
|
+
const currentFlags = this.f;
|
|
719
|
+
this.f = flags;
|
|
720
|
+
if (this.A === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
|
|
721
|
+
(_b = (_a = this.e).S) == null ? void 0 : _b.call(_a, this);
|
|
656
722
|
}
|
|
657
723
|
if (value === UNCHANGED)
|
|
658
724
|
return this.d;
|
|
@@ -664,7 +730,7 @@ var Effect = class extends Computation {
|
|
|
664
730
|
if (this.a >= state)
|
|
665
731
|
return;
|
|
666
732
|
if (this.a === STATE_CLEAN)
|
|
667
|
-
this.e.enqueue(this.
|
|
733
|
+
this.e.enqueue(this.A, this);
|
|
668
734
|
this.a = state;
|
|
669
735
|
}
|
|
670
736
|
Q(error) {
|
|
@@ -672,13 +738,13 @@ var Effect = class extends Computation {
|
|
|
672
738
|
}
|
|
673
739
|
x() {
|
|
674
740
|
this.J = void 0;
|
|
675
|
-
this.
|
|
741
|
+
this.E = void 0;
|
|
676
742
|
super.x();
|
|
677
743
|
}
|
|
678
744
|
R() {
|
|
679
745
|
if (this.K && this.a !== STATE_DISPOSED) {
|
|
680
|
-
this.J(this.d, this.
|
|
681
|
-
this.
|
|
746
|
+
this.J(this.d, this.E);
|
|
747
|
+
this.E = this.d;
|
|
682
748
|
this.K = false;
|
|
683
749
|
}
|
|
684
750
|
}
|
|
@@ -702,35 +768,49 @@ var EagerComputation = class extends Computation {
|
|
|
702
768
|
|
|
703
769
|
// src/core/suspense.ts
|
|
704
770
|
var SuspenseQueue = class extends Queue {
|
|
705
|
-
|
|
706
|
-
|
|
771
|
+
g = /* @__PURE__ */ new Set();
|
|
772
|
+
q = false;
|
|
707
773
|
L = new Computation(false, null);
|
|
708
774
|
run(type) {
|
|
709
|
-
if (type && this.
|
|
775
|
+
if (type && this.q)
|
|
710
776
|
return;
|
|
711
777
|
super.run(type);
|
|
712
778
|
}
|
|
713
|
-
|
|
714
|
-
if (node.
|
|
715
|
-
this.
|
|
716
|
-
if (!this.
|
|
717
|
-
this.
|
|
718
|
-
|
|
779
|
+
S(node) {
|
|
780
|
+
if (node.f & LOADING_BIT) {
|
|
781
|
+
this.g.add(node);
|
|
782
|
+
if (!this.q) {
|
|
783
|
+
this.q = true;
|
|
784
|
+
queueTask(() => this.L.write(true));
|
|
719
785
|
}
|
|
720
786
|
} else {
|
|
721
|
-
this.
|
|
722
|
-
if (this.
|
|
723
|
-
this.
|
|
724
|
-
|
|
787
|
+
this.g.delete(node);
|
|
788
|
+
if (this.g.size === 0) {
|
|
789
|
+
this.q = false;
|
|
790
|
+
queueTask(() => this.L.write(false));
|
|
725
791
|
}
|
|
726
792
|
}
|
|
727
793
|
}
|
|
728
794
|
};
|
|
795
|
+
var LiveComputation = class extends EagerComputation {
|
|
796
|
+
write(value, flags = 0) {
|
|
797
|
+
var _a, _b;
|
|
798
|
+
const currentFlags = this.f;
|
|
799
|
+
super.write(value, flags);
|
|
800
|
+
if ((flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
|
|
801
|
+
(_b = (_a = this.e).S) == null ? void 0 : _b.call(_a, this);
|
|
802
|
+
}
|
|
803
|
+
return this.d;
|
|
804
|
+
}
|
|
805
|
+
};
|
|
729
806
|
function createSuspense(fn, fallbackFn) {
|
|
730
807
|
const queue = new SuspenseQueue();
|
|
731
|
-
const tree = createBoundary(
|
|
732
|
-
|
|
733
|
-
|
|
808
|
+
const tree = createBoundary(() => {
|
|
809
|
+
const child = new Computation(null, fn);
|
|
810
|
+
return new LiveComputation(null, () => flatten(child.wait()));
|
|
811
|
+
}, queue);
|
|
812
|
+
const equality = new Computation(null, () => queue.L.read() || queue.q);
|
|
813
|
+
const comp = new Computation(null, () => equality.read() ? untrack(fallbackFn) : tree.read());
|
|
734
814
|
return comp.read.bind(comp);
|
|
735
815
|
}
|
|
736
816
|
|
|
@@ -750,14 +830,36 @@ function createSignal(first, second, third) {
|
|
|
750
830
|
const node = new Computation(first, null, second);
|
|
751
831
|
return [node.read.bind(node), node.write.bind(node)];
|
|
752
832
|
}
|
|
753
|
-
function
|
|
833
|
+
function createMemo(compute2, value, options) {
|
|
834
|
+
let node = new Computation(
|
|
835
|
+
value,
|
|
836
|
+
compute2,
|
|
837
|
+
options
|
|
838
|
+
);
|
|
839
|
+
let resolvedValue;
|
|
840
|
+
return () => {
|
|
841
|
+
var _a, _b, _c;
|
|
842
|
+
if (node) {
|
|
843
|
+
resolvedValue = node.wait();
|
|
844
|
+
if (!((_a = node.c) == null ? void 0 : _a.length) && ((_b = node.m) == null ? void 0 : _b.o) !== node) {
|
|
845
|
+
node.dispose();
|
|
846
|
+
node = void 0;
|
|
847
|
+
} else if (!node.o && !((_c = node.b) == null ? void 0 : _c.length)) {
|
|
848
|
+
node.dispose();
|
|
849
|
+
node.a = STATE_UNINITIALIZED;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return resolvedValue;
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function createAsync(compute2, value, options) {
|
|
754
856
|
const lhs = new EagerComputation(
|
|
755
857
|
{
|
|
756
|
-
d:
|
|
858
|
+
d: value
|
|
757
859
|
},
|
|
758
860
|
(p) => {
|
|
759
|
-
const
|
|
760
|
-
const source =
|
|
861
|
+
const value2 = p == null ? void 0 : p.d;
|
|
862
|
+
const source = compute2(value2);
|
|
761
863
|
const isPromise = source instanceof Promise;
|
|
762
864
|
const iterator = source[Symbol.asyncIterator];
|
|
763
865
|
if (!isPromise && !iterator) {
|
|
@@ -768,12 +870,12 @@ function createAsync(fn, initial, options) {
|
|
|
768
870
|
d: source
|
|
769
871
|
};
|
|
770
872
|
}
|
|
771
|
-
const signal = new Computation(
|
|
873
|
+
const signal = new Computation(value2, null, options);
|
|
772
874
|
signal.write(UNCHANGED, LOADING_BIT);
|
|
773
875
|
if (isPromise) {
|
|
774
876
|
source.then(
|
|
775
|
-
(
|
|
776
|
-
signal.write(
|
|
877
|
+
(value3) => {
|
|
878
|
+
signal.write(value3, 0, true);
|
|
777
879
|
},
|
|
778
880
|
(error) => {
|
|
779
881
|
signal.write(error, ERROR_BIT);
|
|
@@ -784,10 +886,10 @@ function createAsync(fn, initial, options) {
|
|
|
784
886
|
onCleanup(() => abort = true);
|
|
785
887
|
(async () => {
|
|
786
888
|
try {
|
|
787
|
-
for await (let
|
|
889
|
+
for await (let value3 of source) {
|
|
788
890
|
if (abort)
|
|
789
891
|
return;
|
|
790
|
-
signal.write(
|
|
892
|
+
signal.write(value3, 0, true);
|
|
791
893
|
}
|
|
792
894
|
} catch (error) {
|
|
793
895
|
signal.write(error, ERROR_BIT);
|
|
@@ -799,29 +901,16 @@ function createAsync(fn, initial, options) {
|
|
|
799
901
|
);
|
|
800
902
|
return () => lhs.wait().wait();
|
|
801
903
|
}
|
|
802
|
-
function
|
|
803
|
-
let node = new Computation(initialValue, compute2, options);
|
|
804
|
-
let value;
|
|
805
|
-
return () => {
|
|
806
|
-
var _a;
|
|
807
|
-
if (node) {
|
|
808
|
-
value = node.wait();
|
|
809
|
-
if (!((_a = node.b) == null ? void 0 : _a.length))
|
|
810
|
-
node = void 0;
|
|
811
|
-
}
|
|
812
|
-
return value;
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
function createEffect(compute2, effect, initialValue, options) {
|
|
904
|
+
function createEffect(compute2, effect, value, options) {
|
|
816
905
|
void new Effect(
|
|
817
|
-
|
|
906
|
+
value,
|
|
818
907
|
compute2,
|
|
819
908
|
effect,
|
|
820
909
|
void 0
|
|
821
910
|
);
|
|
822
911
|
}
|
|
823
|
-
function createRenderEffect(compute2, effect,
|
|
824
|
-
void new Effect(
|
|
912
|
+
function createRenderEffect(compute2, effect, value, options) {
|
|
913
|
+
void new Effect(value, compute2, effect, {
|
|
825
914
|
render: true,
|
|
826
915
|
...void 0
|
|
827
916
|
});
|
|
@@ -840,9 +929,9 @@ function runWithOwner(owner, run) {
|
|
|
840
929
|
}
|
|
841
930
|
function catchError(fn, handler) {
|
|
842
931
|
const owner = new Owner();
|
|
843
|
-
owner.
|
|
932
|
+
owner.j = owner.j ? [handler, ...owner.j] : [handler];
|
|
844
933
|
try {
|
|
845
|
-
compute(owner, fn, null);
|
|
934
|
+
return compute(owner, fn, null);
|
|
846
935
|
} catch (error) {
|
|
847
936
|
owner.handleError(error);
|
|
848
937
|
}
|
|
@@ -1309,28 +1398,28 @@ function omit(props, ...keys) {
|
|
|
1309
1398
|
function mapArray(list, map, options) {
|
|
1310
1399
|
const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
|
|
1311
1400
|
return updateKeyedMap.bind({
|
|
1312
|
-
|
|
1401
|
+
T: new Owner(),
|
|
1313
1402
|
w: 0,
|
|
1314
1403
|
U: list,
|
|
1315
|
-
|
|
1404
|
+
r: [],
|
|
1316
1405
|
M: map,
|
|
1317
1406
|
k: [],
|
|
1318
|
-
|
|
1407
|
+
g: [],
|
|
1319
1408
|
y: keyFn,
|
|
1320
|
-
|
|
1409
|
+
h: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
|
|
1321
1410
|
l: map.length > 1 ? [] : void 0,
|
|
1322
|
-
|
|
1411
|
+
q: options == null ? void 0 : options.fallback
|
|
1323
1412
|
});
|
|
1324
1413
|
}
|
|
1325
1414
|
function updateKeyedMap() {
|
|
1326
1415
|
const newItems = this.U() || [], newLen = newItems.length;
|
|
1327
1416
|
newItems[$TRACK];
|
|
1328
|
-
runWithOwner(this.
|
|
1329
|
-
let i, j, mapper = this.
|
|
1330
|
-
this.
|
|
1417
|
+
runWithOwner(this.T, () => {
|
|
1418
|
+
let i, j, mapper = this.h ? () => {
|
|
1419
|
+
this.h[j] = new Computation(newItems[j], null);
|
|
1331
1420
|
this.l[j] = new Computation(j, null);
|
|
1332
1421
|
return this.M(
|
|
1333
|
-
Computation.prototype.read.bind(this.
|
|
1422
|
+
Computation.prototype.read.bind(this.h[j]),
|
|
1334
1423
|
Computation.prototype.read.bind(this.l[j])
|
|
1335
1424
|
);
|
|
1336
1425
|
} : this.l ? () => {
|
|
@@ -1343,36 +1432,40 @@ function updateKeyedMap() {
|
|
|
1343
1432
|
};
|
|
1344
1433
|
if (newLen === 0) {
|
|
1345
1434
|
if (this.w !== 0) {
|
|
1346
|
-
this.
|
|
1347
|
-
this.
|
|
1348
|
-
this.
|
|
1435
|
+
this.T.dispose(false);
|
|
1436
|
+
this.g = [];
|
|
1437
|
+
this.r = [];
|
|
1349
1438
|
this.k = [];
|
|
1350
1439
|
this.w = 0;
|
|
1351
|
-
this.
|
|
1440
|
+
this.h && (this.h = []);
|
|
1352
1441
|
this.l && (this.l = []);
|
|
1353
1442
|
}
|
|
1354
|
-
if (this.
|
|
1355
|
-
this.k[0] = compute(
|
|
1443
|
+
if (this.q && !this.k[0]) {
|
|
1444
|
+
this.k[0] = compute(
|
|
1445
|
+
this.g[0] = new Owner(),
|
|
1446
|
+
this.q,
|
|
1447
|
+
null
|
|
1448
|
+
);
|
|
1356
1449
|
}
|
|
1357
1450
|
} else if (this.w === 0) {
|
|
1358
|
-
if (this.
|
|
1359
|
-
this.
|
|
1451
|
+
if (this.g[0])
|
|
1452
|
+
this.g[0].dispose();
|
|
1360
1453
|
this.k = new Array(newLen);
|
|
1361
1454
|
for (j = 0; j < newLen; j++) {
|
|
1362
|
-
this.
|
|
1363
|
-
this.k[j] = compute(this.
|
|
1455
|
+
this.r[j] = newItems[j];
|
|
1456
|
+
this.k[j] = compute(this.g[j] = new Owner(), mapper, null);
|
|
1364
1457
|
}
|
|
1365
1458
|
this.w = newLen;
|
|
1366
1459
|
} else {
|
|
1367
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
1368
|
-
for (start = 0, end = Math.min(this.w, newLen); start < end && (this.
|
|
1369
|
-
if (this.
|
|
1370
|
-
this.
|
|
1460
|
+
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.h ? new Array(newLen) : void 0, tempIndexes = this.l ? new Array(newLen) : void 0;
|
|
1461
|
+
for (start = 0, end = Math.min(this.w, newLen); start < end && (this.r[start] === newItems[start] || this.h && compare(this.y, this.r[start], newItems[start])); start++) {
|
|
1462
|
+
if (this.h)
|
|
1463
|
+
this.h[start].write(newItems[start]);
|
|
1371
1464
|
}
|
|
1372
|
-
for (end = this.w - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.
|
|
1465
|
+
for (end = this.w - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.r[end] === newItems[newEnd] || this.h && compare(this.y, this.r[end], newItems[newEnd])); end--, newEnd--) {
|
|
1373
1466
|
temp[newEnd] = this.k[end];
|
|
1374
|
-
tempNodes[newEnd] = this.
|
|
1375
|
-
tempRows && (tempRows[newEnd] = this.
|
|
1467
|
+
tempNodes[newEnd] = this.g[end];
|
|
1468
|
+
tempRows && (tempRows[newEnd] = this.h[end]);
|
|
1376
1469
|
tempIndexes && (tempIndexes[newEnd] = this.l[end]);
|
|
1377
1470
|
}
|
|
1378
1471
|
newIndices = /* @__PURE__ */ new Map();
|
|
@@ -1385,37 +1478,37 @@ function updateKeyedMap() {
|
|
|
1385
1478
|
newIndices.set(key, j);
|
|
1386
1479
|
}
|
|
1387
1480
|
for (i = start; i <= end; i++) {
|
|
1388
|
-
item = this.
|
|
1481
|
+
item = this.r[i];
|
|
1389
1482
|
key = this.y ? this.y(item) : item;
|
|
1390
1483
|
j = newIndices.get(key);
|
|
1391
1484
|
if (j !== void 0 && j !== -1) {
|
|
1392
1485
|
temp[j] = this.k[i];
|
|
1393
|
-
tempNodes[j] = this.
|
|
1394
|
-
tempRows && (tempRows[j] = this.
|
|
1486
|
+
tempNodes[j] = this.g[i];
|
|
1487
|
+
tempRows && (tempRows[j] = this.h[i]);
|
|
1395
1488
|
tempIndexes && (tempIndexes[j] = this.l[i]);
|
|
1396
1489
|
j = newIndicesNext[j];
|
|
1397
1490
|
newIndices.set(key, j);
|
|
1398
1491
|
} else
|
|
1399
|
-
this.
|
|
1492
|
+
this.g[i].dispose();
|
|
1400
1493
|
}
|
|
1401
1494
|
for (j = start; j < newLen; j++) {
|
|
1402
1495
|
if (j in temp) {
|
|
1403
1496
|
this.k[j] = temp[j];
|
|
1404
|
-
this.
|
|
1497
|
+
this.g[j] = tempNodes[j];
|
|
1405
1498
|
if (tempRows) {
|
|
1406
|
-
this.
|
|
1407
|
-
this.
|
|
1499
|
+
this.h[j] = tempRows[j];
|
|
1500
|
+
this.h[j].write(newItems[j]);
|
|
1408
1501
|
}
|
|
1409
1502
|
if (tempIndexes) {
|
|
1410
1503
|
this.l[j] = tempIndexes[j];
|
|
1411
1504
|
this.l[j].write(j);
|
|
1412
1505
|
}
|
|
1413
1506
|
} else {
|
|
1414
|
-
this.k[j] = compute(this.
|
|
1507
|
+
this.k[j] = compute(this.g[j] = new Owner(), mapper, null);
|
|
1415
1508
|
}
|
|
1416
1509
|
}
|
|
1417
1510
|
this.k = this.k.slice(0, this.w = newLen);
|
|
1418
|
-
this.
|
|
1511
|
+
this.r = newItems.slice(0);
|
|
1419
1512
|
}
|
|
1420
1513
|
});
|
|
1421
1514
|
return this.k;
|
|
@@ -1447,6 +1540,7 @@ exports.createRoot = createRoot;
|
|
|
1447
1540
|
exports.createSignal = createSignal;
|
|
1448
1541
|
exports.createStore = createStore;
|
|
1449
1542
|
exports.createSuspense = createSuspense;
|
|
1543
|
+
exports.flatten = flatten;
|
|
1450
1544
|
exports.flushSync = flushSync;
|
|
1451
1545
|
exports.getContext = getContext;
|
|
1452
1546
|
exports.getObserver = getObserver;
|