@but212/atom-effect-jquery 0.12.0 → 0.13.1
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/atom-effect-jquery.min.js +1 -1
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +357 -346
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import u from "jquery";
|
|
2
|
-
import { default as
|
|
3
|
-
const
|
|
2
|
+
import { default as wt } from "jquery";
|
|
3
|
+
const Be = {
|
|
4
4
|
/** One second in milliseconds */
|
|
5
5
|
ONE_SECOND_MS: 1e3
|
|
6
|
-
},
|
|
6
|
+
}, ce = {
|
|
7
7
|
IDLE: "idle",
|
|
8
8
|
PENDING: "pending",
|
|
9
9
|
RESOLVED: "resolved",
|
|
@@ -48,12 +48,12 @@ const je = {
|
|
|
48
48
|
MAX_FLUSH_ITERATIONS: 1e3,
|
|
49
49
|
/** Minimum allowed value for max flush iterations */
|
|
50
50
|
MIN_FLUSH_ITERATIONS: 10
|
|
51
|
-
},
|
|
51
|
+
}, Se = {
|
|
52
52
|
/** Maximum dependencies before warning about large dependency graphs */
|
|
53
53
|
MAX_DEPENDENCIES: 1e3,
|
|
54
54
|
/** Enable infinite loop detection warnings */
|
|
55
55
|
WARN_INFINITE_LOOP: !0
|
|
56
|
-
}, F = 1073741823,
|
|
56
|
+
}, F = 1073741823, qe = 20, de = 1 << qe - 1, C = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", ze = Object.freeze([]);
|
|
57
57
|
class U extends Error {
|
|
58
58
|
/**
|
|
59
59
|
* Creates a new AtomError
|
|
@@ -147,16 +147,16 @@ const b = {
|
|
|
147
147
|
* @remarks This prevents cascading failures from masking the original error.
|
|
148
148
|
*/
|
|
149
149
|
CALLBACK_ERROR_IN_ERROR_HANDLER: "Error occurred during onError callback execution"
|
|
150
|
-
},
|
|
151
|
-
function
|
|
150
|
+
}, le = /* @__PURE__ */ Symbol("debugName"), Qe = /* @__PURE__ */ Symbol("id"), fe = /* @__PURE__ */ Symbol("type"), De = /* @__PURE__ */ Symbol("noDefaultValue");
|
|
151
|
+
function $e(t) {
|
|
152
152
|
return "dependencies" in t && Array.isArray(t.dependencies);
|
|
153
153
|
}
|
|
154
|
-
let
|
|
154
|
+
let Ie = 0;
|
|
155
155
|
function ve(t, e, s) {
|
|
156
156
|
if (t._visitedEpoch !== s) {
|
|
157
157
|
if (t._visitedEpoch = s, t === e)
|
|
158
158
|
throw new B("Indirect circular dependency detected");
|
|
159
|
-
if (
|
|
159
|
+
if ($e(t)) {
|
|
160
160
|
const n = t.dependencies;
|
|
161
161
|
for (let i = 0; i < n.length; i++) {
|
|
162
162
|
const r = n[i];
|
|
@@ -165,10 +165,10 @@ function ve(t, e, s) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
const
|
|
168
|
+
const v = {
|
|
169
169
|
enabled: typeof process < "u" && process.env?.NODE_ENV === "development",
|
|
170
|
-
maxDependencies:
|
|
171
|
-
warnInfiniteLoop:
|
|
170
|
+
maxDependencies: Se.MAX_DEPENDENCIES,
|
|
171
|
+
warnInfiniteLoop: Se.WARN_INFINITE_LOOP,
|
|
172
172
|
warn(t, e) {
|
|
173
173
|
this.enabled && t && console.warn(`[Atom Effect] ${e}`);
|
|
174
174
|
},
|
|
@@ -180,28 +180,28 @@ const N = {
|
|
|
180
180
|
checkCircular(t, e) {
|
|
181
181
|
if (t === e)
|
|
182
182
|
throw new B("Direct circular dependency detected");
|
|
183
|
-
this.enabled && (
|
|
183
|
+
this.enabled && (Ie++, ve(t, e, Ie));
|
|
184
184
|
},
|
|
185
185
|
attachDebugInfo(t, e, s) {
|
|
186
186
|
if (!this.enabled)
|
|
187
187
|
return;
|
|
188
188
|
const n = t;
|
|
189
|
-
n[
|
|
189
|
+
n[le] = `${e}_${s}`, n[Qe] = s, n[fe] = e;
|
|
190
190
|
},
|
|
191
191
|
getDebugName(t) {
|
|
192
|
-
if (t != null && ae in t)
|
|
193
|
-
return t[ae];
|
|
194
|
-
},
|
|
195
|
-
getDebugType(t) {
|
|
196
192
|
if (t != null && le in t)
|
|
197
193
|
return t[le];
|
|
194
|
+
},
|
|
195
|
+
getDebugType(t) {
|
|
196
|
+
if (t != null && fe in t)
|
|
197
|
+
return t[fe];
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
let
|
|
201
|
-
const
|
|
202
|
-
class
|
|
200
|
+
let Xe = 1;
|
|
201
|
+
const He = () => Xe++;
|
|
202
|
+
class Ae {
|
|
203
203
|
constructor() {
|
|
204
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id =
|
|
204
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id = He() & F;
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Rotates the phase by 1, automatically incrementing cycle on overflow.
|
|
@@ -243,7 +243,7 @@ class Ne {
|
|
|
243
243
|
return this.version - e & F;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class Re extends Ae {
|
|
247
247
|
/**
|
|
248
248
|
* Subscribes a listener function or Subscriber object to value changes.
|
|
249
249
|
*
|
|
@@ -310,26 +310,138 @@ class Ae extends Ne {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
class pe {
|
|
314
|
+
constructor() {
|
|
315
|
+
this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = C ? {
|
|
316
|
+
acquired: 0,
|
|
317
|
+
released: 0,
|
|
318
|
+
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
319
|
+
} : null;
|
|
320
|
+
}
|
|
321
|
+
/** Acquires an array from the pool or creates a new one if the pool is empty. */
|
|
322
|
+
acquire() {
|
|
323
|
+
return C && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Releases an array back to the pool.
|
|
327
|
+
* Clears the array before storing it.
|
|
328
|
+
* @param arr - The array to release.
|
|
329
|
+
* @param emptyConst - Optional reference to a constant empty array to skip.
|
|
330
|
+
*/
|
|
331
|
+
release(e, s) {
|
|
332
|
+
if (!(s && e === s)) {
|
|
333
|
+
if (Object.isFrozen(e)) {
|
|
334
|
+
C && this.stats && this.stats.rejected.frozen++;
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (e.length > this.maxReusableCapacity) {
|
|
338
|
+
C && this.stats && this.stats.rejected.tooLarge++;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (this.pool.length >= this.maxPoolSize) {
|
|
342
|
+
C && this.stats && this.stats.rejected.poolFull++;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
e.length = 0, this.pool.push(e), C && this.stats && this.stats.released++;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/** Returns current stats for the pool (dev mode only). */
|
|
349
|
+
getStats() {
|
|
350
|
+
if (!C || !this.stats) return null;
|
|
351
|
+
const { acquired: e, released: s, rejected: n } = this.stats, i = n.frozen + n.tooLarge + n.poolFull;
|
|
352
|
+
return {
|
|
353
|
+
acquired: e,
|
|
354
|
+
released: s,
|
|
355
|
+
rejected: n,
|
|
356
|
+
leaked: e - s - i,
|
|
357
|
+
poolSize: this.pool.length
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
/** Resets the pool and its stats. */
|
|
361
|
+
reset() {
|
|
362
|
+
this.pool.length = 0, C && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const y = Object.freeze([]), N = Object.freeze([]), S = Object.freeze([]), w = new pe(), z = new pe(), T = new pe();
|
|
366
|
+
function _e(t) {
|
|
367
|
+
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t && typeof t.subscribe == "function";
|
|
316
368
|
}
|
|
317
|
-
function
|
|
318
|
-
|
|
369
|
+
function Ce(t) {
|
|
370
|
+
if (v.enabled && (t == null || typeof t == "object")) {
|
|
371
|
+
const e = v.getDebugType(t);
|
|
372
|
+
if (e)
|
|
373
|
+
return e === "computed";
|
|
374
|
+
}
|
|
375
|
+
return _e(t) && "invalidate" in t && typeof t.invalidate == "function";
|
|
376
|
+
}
|
|
377
|
+
function Oe(t) {
|
|
378
|
+
return t != null && typeof t.then == "function";
|
|
379
|
+
}
|
|
380
|
+
function Ge(t) {
|
|
381
|
+
return typeof t == "object" && t !== null;
|
|
382
|
+
}
|
|
383
|
+
function Ye(t) {
|
|
384
|
+
return (typeof t == "object" || typeof t == "function") && t !== null && typeof t.addDependency == "function";
|
|
385
|
+
}
|
|
386
|
+
function Je(t) {
|
|
387
|
+
return typeof t == "function" && typeof t.addDependency != "function";
|
|
319
388
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
389
|
+
function Ke(t) {
|
|
390
|
+
return Ge(t) && typeof t.execute == "function";
|
|
391
|
+
}
|
|
392
|
+
function Ue(t, e, s, n) {
|
|
393
|
+
if (e) {
|
|
394
|
+
if (Ye(e)) {
|
|
395
|
+
e.addDependency(t);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (Je(e)) {
|
|
399
|
+
const i = e;
|
|
400
|
+
s.indexOf(i) === -1 && s.push(i);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
Ke(e) && n.indexOf(e) === -1 && n.push(e);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function We(t, e, s, n) {
|
|
407
|
+
if (e !== y && s !== N)
|
|
408
|
+
for (let r = 0; r < e.length; r++) {
|
|
409
|
+
const o = e[r];
|
|
410
|
+
o && (o._tempUnsub = s[r]);
|
|
411
|
+
}
|
|
412
|
+
const i = z.acquire();
|
|
413
|
+
i.length = t.length;
|
|
414
|
+
for (let r = 0; r < t.length; r++) {
|
|
415
|
+
const o = t[r];
|
|
416
|
+
o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (v.checkCircular(o, n), i[r] = o.subscribe(n)));
|
|
417
|
+
}
|
|
418
|
+
if (e !== y)
|
|
419
|
+
for (let r = 0; r < e.length; r++) {
|
|
420
|
+
const o = e[r];
|
|
421
|
+
o?._tempUnsub && (o._tempUnsub(), o._tempUnsub = void 0);
|
|
422
|
+
}
|
|
423
|
+
return s !== N && z.release(s), i;
|
|
424
|
+
}
|
|
425
|
+
let ne = 0;
|
|
426
|
+
function we() {
|
|
427
|
+
return ne = ne + 1 & F || 1, ne;
|
|
428
|
+
}
|
|
429
|
+
function Ze() {
|
|
430
|
+
return ne;
|
|
431
|
+
}
|
|
432
|
+
let re = 0, ge = 0, oe = !1;
|
|
433
|
+
function xe() {
|
|
434
|
+
return oe ? (C && console.warn(
|
|
323
435
|
"Warning: startFlush() called during flush - ignored to prevent infinite loop detection bypass"
|
|
324
|
-
), !1) : (
|
|
436
|
+
), !1) : (oe = !0, re = re + 1 & F, ge = 0, !0);
|
|
325
437
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
438
|
+
function Ne() {
|
|
439
|
+
oe = !1;
|
|
328
440
|
}
|
|
329
|
-
function
|
|
330
|
-
return
|
|
441
|
+
function et() {
|
|
442
|
+
return oe ? ++ge : 0;
|
|
331
443
|
}
|
|
332
|
-
class
|
|
444
|
+
class tt {
|
|
333
445
|
constructor() {
|
|
334
446
|
this.queueA = [], this.queueB = [], this.queue = this.queueA, this.queueSize = 0, this.urgentQueueA = [], this.urgentQueueB = [], this.urgentQueue = this.urgentQueueA, this.urgentQueueSize = 0, this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = q.MAX_FLUSH_ITERATIONS;
|
|
335
447
|
}
|
|
@@ -375,14 +487,14 @@ class Ge {
|
|
|
375
487
|
if (!s || e._cachedVersion === void 0)
|
|
376
488
|
return 0;
|
|
377
489
|
const n = s.getShift(e._cachedVersion);
|
|
378
|
-
return
|
|
490
|
+
return de - 1 - n >>> 31 & 1;
|
|
379
491
|
}
|
|
380
492
|
flush() {
|
|
381
493
|
this.isProcessing || this.queueSize === 0 && this.urgentQueueSize === 0 || (this.isProcessing = !0, queueMicrotask(() => {
|
|
382
494
|
try {
|
|
383
495
|
if (this.queueSize === 0 && this.urgentQueueSize === 0) return;
|
|
384
|
-
const e =
|
|
385
|
-
this._drainQueue(), e &&
|
|
496
|
+
const e = xe();
|
|
497
|
+
this._drainQueue(), e && Ne();
|
|
386
498
|
} finally {
|
|
387
499
|
this.isProcessing = !1, (this.queueSize > 0 || this.urgentQueueSize > 0) && !this.isBatching && this.flush();
|
|
388
500
|
}
|
|
@@ -390,11 +502,11 @@ class Ge {
|
|
|
390
502
|
}
|
|
391
503
|
flushSync() {
|
|
392
504
|
this.isFlushingSync = !0;
|
|
393
|
-
const e =
|
|
505
|
+
const e = xe();
|
|
394
506
|
try {
|
|
395
507
|
this._mergeBatchQueue(), this._drainQueue();
|
|
396
508
|
} finally {
|
|
397
|
-
this.isFlushingSync = !1, e &&
|
|
509
|
+
this.isFlushingSync = !1, e && Ne();
|
|
398
510
|
}
|
|
399
511
|
}
|
|
400
512
|
_mergeBatchQueue() {
|
|
@@ -482,18 +594,8 @@ class Ge {
|
|
|
482
594
|
this.maxFlushIterations = e;
|
|
483
595
|
}
|
|
484
596
|
}
|
|
485
|
-
const W = new
|
|
486
|
-
|
|
487
|
-
if (typeof t != "function")
|
|
488
|
-
throw new U("Batch callback must be a function");
|
|
489
|
-
W.startBatch();
|
|
490
|
-
try {
|
|
491
|
-
return t();
|
|
492
|
-
} finally {
|
|
493
|
-
W.endBatch();
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
class Je {
|
|
597
|
+
const W = new tt();
|
|
598
|
+
class st {
|
|
497
599
|
constructor() {
|
|
498
600
|
this.current = null;
|
|
499
601
|
}
|
|
@@ -520,8 +622,8 @@ class Je {
|
|
|
520
622
|
return this.current;
|
|
521
623
|
}
|
|
522
624
|
}
|
|
523
|
-
const Q = new
|
|
524
|
-
function
|
|
625
|
+
const Q = new st();
|
|
626
|
+
function Fe(t) {
|
|
525
627
|
if (typeof t != "function")
|
|
526
628
|
throw new U("Untracked callback must be a function");
|
|
527
629
|
const e = Q.current;
|
|
@@ -532,121 +634,9 @@ function Oe(t) {
|
|
|
532
634
|
Q.current = e;
|
|
533
635
|
}
|
|
534
636
|
}
|
|
535
|
-
class
|
|
536
|
-
constructor() {
|
|
537
|
-
this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = C ? {
|
|
538
|
-
acquired: 0,
|
|
539
|
-
released: 0,
|
|
540
|
-
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
541
|
-
} : null;
|
|
542
|
-
}
|
|
543
|
-
/** Acquires an array from the pool or creates a new one if the pool is empty. */
|
|
544
|
-
acquire() {
|
|
545
|
-
return C && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Releases an array back to the pool.
|
|
549
|
-
* Clears the array before storing it.
|
|
550
|
-
* @param arr - The array to release.
|
|
551
|
-
* @param emptyConst - Optional reference to a constant empty array to skip.
|
|
552
|
-
*/
|
|
553
|
-
release(e, s) {
|
|
554
|
-
if (!(s && e === s)) {
|
|
555
|
-
if (Object.isFrozen(e)) {
|
|
556
|
-
C && this.stats && this.stats.rejected.frozen++;
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
if (e.length > this.maxReusableCapacity) {
|
|
560
|
-
C && this.stats && this.stats.rejected.tooLarge++;
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
if (this.pool.length >= this.maxPoolSize) {
|
|
564
|
-
C && this.stats && this.stats.rejected.poolFull++;
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
e.length = 0, this.pool.push(e), C && this.stats && this.stats.released++;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
/** Returns current stats for the pool (dev mode only). */
|
|
571
|
-
getStats() {
|
|
572
|
-
if (!C || !this.stats) return null;
|
|
573
|
-
const { acquired: e, released: s, rejected: n } = this.stats, i = n.frozen + n.tooLarge + n.poolFull;
|
|
574
|
-
return {
|
|
575
|
-
acquired: e,
|
|
576
|
-
released: s,
|
|
577
|
-
rejected: n,
|
|
578
|
-
leaked: e - s - i,
|
|
579
|
-
poolSize: this.pool.length
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
/** Resets the pool and its stats. */
|
|
583
|
-
reset() {
|
|
584
|
-
this.pool.length = 0, C && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
const y = Object.freeze([]), T = Object.freeze([]), S = Object.freeze([]), w = new pe(), z = new pe(), v = new pe();
|
|
588
|
-
function de(t) {
|
|
589
|
-
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t && typeof t.subscribe == "function";
|
|
590
|
-
}
|
|
591
|
-
function xe(t) {
|
|
592
|
-
if (N.enabled && (t == null || typeof t == "object")) {
|
|
593
|
-
const e = N.getDebugType(t);
|
|
594
|
-
if (e)
|
|
595
|
-
return e === "computed";
|
|
596
|
-
}
|
|
597
|
-
return de(t) && "invalidate" in t && typeof t.invalidate == "function";
|
|
598
|
-
}
|
|
599
|
-
function Ue(t) {
|
|
600
|
-
return t != null && typeof t.then == "function";
|
|
601
|
-
}
|
|
602
|
-
function Ke(t) {
|
|
603
|
-
return typeof t == "object" && t !== null;
|
|
604
|
-
}
|
|
605
|
-
function We(t) {
|
|
606
|
-
return (typeof t == "object" || typeof t == "function") && t !== null && typeof t.addDependency == "function";
|
|
607
|
-
}
|
|
608
|
-
function Ze(t) {
|
|
609
|
-
return typeof t == "function" && typeof t.addDependency != "function";
|
|
610
|
-
}
|
|
611
|
-
function et(t) {
|
|
612
|
-
return Ke(t) && typeof t.execute == "function";
|
|
613
|
-
}
|
|
614
|
-
function we(t, e, s, n) {
|
|
615
|
-
if (e) {
|
|
616
|
-
if (We(e)) {
|
|
617
|
-
e.addDependency(t);
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
if (Ze(e)) {
|
|
621
|
-
const i = e;
|
|
622
|
-
s.indexOf(i) === -1 && s.push(i);
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
et(e) && n.indexOf(e) === -1 && n.push(e);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function tt(t, e, s, n) {
|
|
629
|
-
if (e !== y && s !== T)
|
|
630
|
-
for (let r = 0; r < e.length; r++) {
|
|
631
|
-
const o = e[r];
|
|
632
|
-
o && (o._tempUnsub = s[r]);
|
|
633
|
-
}
|
|
634
|
-
const i = z.acquire();
|
|
635
|
-
i.length = t.length;
|
|
636
|
-
for (let r = 0; r < t.length; r++) {
|
|
637
|
-
const o = t[r];
|
|
638
|
-
o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (N.checkCircular(o, n), i[r] = o.subscribe(n)));
|
|
639
|
-
}
|
|
640
|
-
if (e !== y)
|
|
641
|
-
for (let r = 0; r < e.length; r++) {
|
|
642
|
-
const o = e[r];
|
|
643
|
-
o?._tempUnsub && (o._tempUnsub(), o._tempUnsub = void 0);
|
|
644
|
-
}
|
|
645
|
-
return s !== T && z.release(s), i;
|
|
646
|
-
}
|
|
647
|
-
class st extends Ae {
|
|
637
|
+
class nt extends Re {
|
|
648
638
|
constructor(e, s) {
|
|
649
|
-
super(), this._fnSubs = null, this._objSubs = null, this._value = e, s && (this.flags |= G.SYNC),
|
|
639
|
+
super(), this._fnSubs = null, this._objSubs = null, this._value = e, s && (this.flags |= G.SYNC), v.attachDebugInfo(this, "atom", this.id);
|
|
650
640
|
}
|
|
651
641
|
_getFnSubs() {
|
|
652
642
|
return this._fnSubs ??= [], this._fnSubs;
|
|
@@ -659,7 +649,7 @@ class st extends Ae {
|
|
|
659
649
|
*/
|
|
660
650
|
get value() {
|
|
661
651
|
const e = Q.current;
|
|
662
|
-
return e &&
|
|
652
|
+
return e && Ue(this, e, this._getFnSubs(), this._getObjSubs()), this._value;
|
|
663
653
|
}
|
|
664
654
|
/**
|
|
665
655
|
* Sets a new value and schedules notifications if the value has changed.
|
|
@@ -691,8 +681,8 @@ class st extends Ae {
|
|
|
691
681
|
this._fnSubs = null, this._objSubs = null, this._value = void 0, this._notifyTask = void 0;
|
|
692
682
|
}
|
|
693
683
|
}
|
|
694
|
-
function
|
|
695
|
-
return new
|
|
684
|
+
function it(t, e = {}) {
|
|
685
|
+
return new nt(t, e.sync ?? !1);
|
|
696
686
|
}
|
|
697
687
|
function J(t, e, s) {
|
|
698
688
|
if (t instanceof TypeError)
|
|
@@ -704,15 +694,15 @@ function J(t, e, s) {
|
|
|
704
694
|
const n = t instanceof Error ? t.message : String(t), i = t instanceof Error ? t : null;
|
|
705
695
|
return new e(`Unexpected error (${s}): ${n}`, i);
|
|
706
696
|
}
|
|
707
|
-
const
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
class
|
|
697
|
+
const ke = l.RESOLVED | l.PENDING | l.REJECTED, ue = Array(ke + 1).fill(ce.IDLE);
|
|
698
|
+
ue[l.RESOLVED] = ce.RESOLVED;
|
|
699
|
+
ue[l.PENDING] = ce.PENDING;
|
|
700
|
+
ue[l.REJECTED] = ce.REJECTED;
|
|
701
|
+
class Le extends Re {
|
|
712
702
|
constructor(e, s = {}) {
|
|
713
703
|
if (typeof e != "function")
|
|
714
704
|
throw new B(b.COMPUTED_MUST_BE_FUNCTION);
|
|
715
|
-
if (super(), this._fnSubs = null, this._objSubs = null, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this.MAX_ASYNC_RETRIES = 3, this._value = void 0, this.flags = l.DIRTY | l.IDLE, this._error = null, this._promiseId = 0, this._equal = s.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in s ? s.defaultValue :
|
|
705
|
+
if (super(), this._fnSubs = null, this._objSubs = null, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this.MAX_ASYNC_RETRIES = 3, this._value = void 0, this.flags = l.DIRTY | l.IDLE, this._error = null, this._promiseId = 0, this._equal = s.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in s ? s.defaultValue : De, this._hasDefaultValue = this._defaultValue !== De, this._onError = s.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._dependencies = y, this._dependencyVersions = S, this._unsubscribes = N, this._notifyJob = () => {
|
|
716
706
|
const n = this._fnSubs;
|
|
717
707
|
if (n)
|
|
718
708
|
for (let r = n.length - 1; r >= 0; r--)
|
|
@@ -734,7 +724,7 @@ class ke extends Ae {
|
|
|
734
724
|
}, this._trackable = Object.assign(() => this._markDirty(), {
|
|
735
725
|
addDependency: (n) => {
|
|
736
726
|
}
|
|
737
|
-
}),
|
|
727
|
+
}), v.attachDebugInfo(this, "computed", this.id), v.enabled) {
|
|
738
728
|
const n = this;
|
|
739
729
|
n.subscriberCount = this.subscriberCount.bind(this), n.isDirty = () => this._isDirty(), n.dependencies = this._dependencies, n.stateFlags = this._getFlagsAsString();
|
|
740
730
|
}
|
|
@@ -774,8 +764,8 @@ class ke extends Ae {
|
|
|
774
764
|
}
|
|
775
765
|
get errors() {
|
|
776
766
|
if (this._registerTracking(), !this.hasError)
|
|
777
|
-
return
|
|
778
|
-
const e =
|
|
767
|
+
return ze;
|
|
768
|
+
const e = Ze();
|
|
779
769
|
if (this._errorCacheEpoch === e && this._cachedErrors !== null)
|
|
780
770
|
return this._cachedErrors;
|
|
781
771
|
const s = /* @__PURE__ */ new Set();
|
|
@@ -802,17 +792,17 @@ class ke extends Ae {
|
|
|
802
792
|
return this._registerTracking(), this._isResolved();
|
|
803
793
|
}
|
|
804
794
|
invalidate() {
|
|
805
|
-
this._markDirty(), this._dependencyVersions !== S && (
|
|
795
|
+
this._markDirty(), this._dependencyVersions !== S && (T.release(this._dependencyVersions), this._dependencyVersions = S), this._errorCacheEpoch = -1, this._cachedErrors = null;
|
|
806
796
|
}
|
|
807
797
|
dispose() {
|
|
808
|
-
if (this._unsubscribes !==
|
|
798
|
+
if (this._unsubscribes !== N) {
|
|
809
799
|
for (let e = 0; e < this._unsubscribes.length; e++) {
|
|
810
800
|
const s = this._unsubscribes[e];
|
|
811
801
|
s && s();
|
|
812
802
|
}
|
|
813
|
-
z.release(this._unsubscribes), this._unsubscribes =
|
|
803
|
+
z.release(this._unsubscribes), this._unsubscribes = N;
|
|
814
804
|
}
|
|
815
|
-
this._dependencies !== y && (w.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== S && (
|
|
805
|
+
this._dependencies !== y && (w.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== S && (T.release(this._dependencyVersions), this._dependencyVersions = S), this._fnSubs = null, this._objSubs = null, this.flags = l.DIRTY | l.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
816
806
|
}
|
|
817
807
|
// State flag operations
|
|
818
808
|
_isDirty() {
|
|
@@ -856,7 +846,7 @@ class ke extends Ae {
|
|
|
856
846
|
this.flags = this.flags & ~s | -Number(e) & s;
|
|
857
847
|
}
|
|
858
848
|
_getAsyncState() {
|
|
859
|
-
return
|
|
849
|
+
return ue[this.flags & ke];
|
|
860
850
|
}
|
|
861
851
|
_getFlagsAsString() {
|
|
862
852
|
const e = [];
|
|
@@ -872,7 +862,7 @@ class ke extends Ae {
|
|
|
872
862
|
let s = !1;
|
|
873
863
|
try {
|
|
874
864
|
const n = Q.run(this._trackable, this._fn);
|
|
875
|
-
this._commitDependencies(e), s = !0,
|
|
865
|
+
this._commitDependencies(e), s = !0, Oe(n) ? this._handleAsyncComputation(n) : this._handleSyncResult(n);
|
|
876
866
|
} catch (n) {
|
|
877
867
|
if (!s)
|
|
878
868
|
try {
|
|
@@ -886,17 +876,17 @@ class ke extends Ae {
|
|
|
886
876
|
}
|
|
887
877
|
}
|
|
888
878
|
_prepareComputationContext() {
|
|
889
|
-
const e = this._dependencies, s = this._dependencyVersions, n = w.acquire(), i =
|
|
890
|
-
|
|
879
|
+
const e = this._dependencies, s = this._dependencyVersions, n = w.acquire(), i = T.acquire(), r = we(), o = { depCount: 0 }, c = (d) => {
|
|
880
|
+
d._lastSeenEpoch !== r && (d._lastSeenEpoch = r, o.depCount < n.length ? (n[o.depCount] = d, i[o.depCount] = d.version) : (n.push(d), i.push(d.version)), o.depCount++);
|
|
891
881
|
}, h = this._trackable.addDependency;
|
|
892
882
|
return this._trackable.addDependency = c, { prevDeps: e, prevVersions: s, nextDeps: n, nextVersions: i, originalAdd: h, state: o };
|
|
893
883
|
}
|
|
894
884
|
_commitDependencies(e) {
|
|
895
885
|
const { nextDeps: s, nextVersions: n, state: i, prevDeps: r } = e;
|
|
896
|
-
s.length = i.depCount, n.length = i.depCount, this._unsubscribes =
|
|
886
|
+
s.length = i.depCount, n.length = i.depCount, this._unsubscribes = We(s, r, this._unsubscribes, this), this._dependencies = s, this._dependencyVersions = n;
|
|
897
887
|
}
|
|
898
888
|
_cleanupContext(e, s) {
|
|
899
|
-
this._trackable.addDependency = e.originalAdd, s ? (e.prevDeps !== y && w.release(e.prevDeps), e.prevVersions !== S &&
|
|
889
|
+
this._trackable.addDependency = e.originalAdd, s ? (e.prevDeps !== y && w.release(e.prevDeps), e.prevVersions !== S && T.release(e.prevVersions)) : (w.release(e.nextDeps), T.release(e.nextVersions));
|
|
900
890
|
}
|
|
901
891
|
/**
|
|
902
892
|
* Calculates aggregate shift from all dependencies.
|
|
@@ -923,7 +913,7 @@ class ke extends Ae {
|
|
|
923
913
|
* @returns true if aggregate shift exceeds PHASE_THRESHOLD
|
|
924
914
|
*/
|
|
925
915
|
isUrgent() {
|
|
926
|
-
return this._getAggregateShift() >=
|
|
916
|
+
return this._getAggregateShift() >= de;
|
|
927
917
|
}
|
|
928
918
|
_handleSyncResult(e) {
|
|
929
919
|
this._finalizeResolution(e);
|
|
@@ -934,7 +924,7 @@ class ke extends Ae {
|
|
|
934
924
|
e.then((n) => {
|
|
935
925
|
if (s !== this._promiseId) return;
|
|
936
926
|
const i = this._captureVersionSnapshot() - this._asyncStartAggregateVersion & F;
|
|
937
|
-
if (
|
|
927
|
+
if (de - 1 - i >>> 31 & 1) {
|
|
938
928
|
if (this._asyncRetryCount < this.MAX_ASYNC_RETRIES) {
|
|
939
929
|
this._asyncRetryCount++, this._markDirty();
|
|
940
930
|
return;
|
|
@@ -1013,14 +1003,14 @@ class ke extends Ae {
|
|
|
1013
1003
|
this._isRecomputing() || this._isDirty() || (this._setDirty(), this._notifyJob());
|
|
1014
1004
|
}
|
|
1015
1005
|
_registerTracking() {
|
|
1016
|
-
|
|
1006
|
+
Ue(this, Q.getCurrent(), this._getFnSubs(), this._getObjSubs());
|
|
1017
1007
|
}
|
|
1018
1008
|
}
|
|
1019
|
-
Object.freeze(
|
|
1020
|
-
function
|
|
1021
|
-
return new
|
|
1009
|
+
Object.freeze(Le.prototype);
|
|
1010
|
+
function rt(t, e = {}) {
|
|
1011
|
+
return new Le(t, e);
|
|
1022
1012
|
}
|
|
1023
|
-
class
|
|
1013
|
+
class ot extends Ae {
|
|
1024
1014
|
/**
|
|
1025
1015
|
* Creates a new EffectImpl instance.
|
|
1026
1016
|
* @param fn - The effect function to run.
|
|
@@ -1030,17 +1020,17 @@ class rt extends Ne {
|
|
|
1030
1020
|
super(), this.run = () => {
|
|
1031
1021
|
if (this.isDisposed)
|
|
1032
1022
|
throw new j(b.EFFECT_MUST_BE_FUNCTION);
|
|
1033
|
-
this._dependencyVersions !== S && (
|
|
1023
|
+
this._dependencyVersions !== S && (T.release(this._dependencyVersions), this._dependencyVersions = S), this.execute();
|
|
1034
1024
|
}, this.dispose = () => {
|
|
1035
1025
|
if (!this.isDisposed) {
|
|
1036
|
-
if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !==
|
|
1026
|
+
if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !== N) {
|
|
1037
1027
|
for (let i = 0; i < this._unsubscribes.length; i++) {
|
|
1038
1028
|
const r = this._unsubscribes[i];
|
|
1039
1029
|
r && r();
|
|
1040
1030
|
}
|
|
1041
|
-
z.release(this._unsubscribes), this._unsubscribes =
|
|
1031
|
+
z.release(this._unsubscribes), this._unsubscribes = N;
|
|
1042
1032
|
}
|
|
1043
|
-
this._dependencies !== y && (w.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== S && (
|
|
1033
|
+
this._dependencies !== y && (w.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== S && (T.release(this._dependencyVersions), this._dependencyVersions = S);
|
|
1044
1034
|
}
|
|
1045
1035
|
}, this.addDependency = (i) => {
|
|
1046
1036
|
if (this.isExecuting && this._nextDeps && this._nextUnsubs && this._nextVersions) {
|
|
@@ -1055,7 +1045,7 @@ class rt extends Ne {
|
|
|
1055
1045
|
let r = !1;
|
|
1056
1046
|
try {
|
|
1057
1047
|
const o = Q.run(this, this._fn);
|
|
1058
|
-
this._commitEffect(i), r = !0, this._checkLoopWarnings(),
|
|
1048
|
+
this._commitEffect(i), r = !0, this._checkLoopWarnings(), Oe(o) ? o.then((c) => {
|
|
1059
1049
|
!this.isDisposed && typeof c == "function" && (this._cleanup = c);
|
|
1060
1050
|
}).catch((c) => {
|
|
1061
1051
|
this._handleExecutionError(c);
|
|
@@ -1065,20 +1055,20 @@ class rt extends Ne {
|
|
|
1065
1055
|
} finally {
|
|
1066
1056
|
this._cleanupEffect(i, r), this._setExecuting(!1);
|
|
1067
1057
|
}
|
|
1068
|
-
}, this._cleanup = null, this._dependencies = y, this._dependencyVersions = S, this._unsubscribes =
|
|
1058
|
+
}, this._cleanup = null, this._dependencies = y, this._dependencyVersions = S, this._unsubscribes = N, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._onError = s.onError ?? null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? q.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? q.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = s.trackModifications ?? !1, this._historyPtr = 0;
|
|
1069
1059
|
const n = Number.isFinite(this._maxExecutions);
|
|
1070
|
-
this._historyCapacity = n ? Math.min(this._maxExecutions + 1, q.MAX_EXECUTIONS_PER_SECOND + 1) : 0, this._history = C && n && this._historyCapacity > 0 ? new Array(this._historyCapacity).fill(0) : null, this._executionCount = 0,
|
|
1060
|
+
this._historyCapacity = n ? Math.min(this._maxExecutions + 1, q.MAX_EXECUTIONS_PER_SECOND + 1) : 0, this._history = C && n && this._historyCapacity > 0 ? new Array(this._historyCapacity).fill(0) : null, this._executionCount = 0, v.attachDebugInfo(this, "effect", this.id);
|
|
1071
1061
|
}
|
|
1072
1062
|
/**
|
|
1073
1063
|
* Prepares the execution context by acquiring pools and setting up epoch.
|
|
1074
1064
|
* @returns The prepared EffectExecutionContext.
|
|
1075
1065
|
*/
|
|
1076
1066
|
_prepareEffectExecutionContext() {
|
|
1077
|
-
const e = this._dependencies, s = this._dependencyVersions, n = this._unsubscribes, i = w.acquire(), r =
|
|
1078
|
-
if (e !== y && n !==
|
|
1067
|
+
const e = this._dependencies, s = this._dependencyVersions, n = this._unsubscribes, i = w.acquire(), r = T.acquire(), o = z.acquire(), c = we();
|
|
1068
|
+
if (e !== y && n !== N)
|
|
1079
1069
|
for (let h = 0; h < e.length; h++) {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1070
|
+
const d = e[h];
|
|
1071
|
+
d && (d._tempUnsub = n[h]);
|
|
1082
1072
|
}
|
|
1083
1073
|
return this._nextDeps = i, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: s, prevUnsubs: n, nextDeps: i, nextVersions: r, nextUnsubs: o };
|
|
1084
1074
|
}
|
|
@@ -1104,9 +1094,9 @@ class rt extends Ne {
|
|
|
1104
1094
|
}
|
|
1105
1095
|
w.release(e.prevDeps);
|
|
1106
1096
|
}
|
|
1107
|
-
e.prevUnsubs !==
|
|
1097
|
+
e.prevUnsubs !== N && z.release(e.prevUnsubs), e.prevVersions !== S && T.release(e.prevVersions);
|
|
1108
1098
|
} else {
|
|
1109
|
-
w.release(e.nextDeps),
|
|
1099
|
+
w.release(e.nextDeps), T.release(e.nextVersions);
|
|
1110
1100
|
for (let n = 0; n < e.nextUnsubs.length; n++)
|
|
1111
1101
|
e.nextUnsubs[n]?.();
|
|
1112
1102
|
if (z.release(e.nextUnsubs), e.prevDeps !== y)
|
|
@@ -1174,11 +1164,11 @@ class rt extends Ne {
|
|
|
1174
1164
|
* @throws {EffectError} If an infinite loop is detected.
|
|
1175
1165
|
*/
|
|
1176
1166
|
_checkInfiniteLoop() {
|
|
1177
|
-
if (this._lastFlushEpoch !==
|
|
1167
|
+
if (this._lastFlushEpoch !== re && (this._lastFlushEpoch = re, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), et() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history && this._maxExecutions > 0) {
|
|
1178
1168
|
const e = Date.now(), s = this._historyPtr, n = this._historyCapacity;
|
|
1179
1169
|
this._history[s] = e;
|
|
1180
1170
|
const i = (s + 1) % n, r = this._history[i] ?? 0;
|
|
1181
|
-
if (this._historyPtr = i, r > 0 && e - r <
|
|
1171
|
+
if (this._historyPtr = i, r > 0 && e - r < Be.ONE_SECOND_MS) {
|
|
1182
1172
|
const o = new j(
|
|
1183
1173
|
`Effect executed ${n} times within 1 second. Infinite loop suspected`
|
|
1184
1174
|
);
|
|
@@ -1189,7 +1179,7 @@ class rt extends Ne {
|
|
|
1189
1179
|
}
|
|
1190
1180
|
_throwInfiniteLoopError(e) {
|
|
1191
1181
|
const s = new j(
|
|
1192
|
-
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
1182
|
+
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${ge}`
|
|
1193
1183
|
);
|
|
1194
1184
|
throw this.dispose(), console.error(s), s;
|
|
1195
1185
|
}
|
|
@@ -1205,7 +1195,7 @@ class rt extends Ne {
|
|
|
1205
1195
|
if (s) {
|
|
1206
1196
|
if ("value" in s)
|
|
1207
1197
|
try {
|
|
1208
|
-
|
|
1198
|
+
Fe(() => s.value);
|
|
1209
1199
|
} catch {
|
|
1210
1200
|
return !0;
|
|
1211
1201
|
}
|
|
@@ -1228,13 +1218,13 @@ class rt extends Ne {
|
|
|
1228
1218
|
* Only active if trackModifications is enabled and debug is on.
|
|
1229
1219
|
*/
|
|
1230
1220
|
_checkLoopWarnings() {
|
|
1231
|
-
if (this._trackModifications &&
|
|
1221
|
+
if (this._trackModifications && v.enabled) {
|
|
1232
1222
|
const e = this._dependencies;
|
|
1233
1223
|
for (let s = 0; s < e.length; s++) {
|
|
1234
1224
|
const n = e[s];
|
|
1235
|
-
n && n._modifiedAtEpoch === this._currentEpoch &&
|
|
1225
|
+
n && n._modifiedAtEpoch === this._currentEpoch && v.warn(
|
|
1236
1226
|
!0,
|
|
1237
|
-
`Effect is reading a dependency (${
|
|
1227
|
+
`Effect is reading a dependency (${v.getDebugName(n) || "unknown"}) that it just modified. Infinite loop may occur`
|
|
1238
1228
|
);
|
|
1239
1229
|
}
|
|
1240
1230
|
}
|
|
@@ -1243,13 +1233,23 @@ class rt extends Ne {
|
|
|
1243
1233
|
function $(t, e = {}) {
|
|
1244
1234
|
if (typeof t != "function")
|
|
1245
1235
|
throw new j(b.EFFECT_MUST_BE_FUNCTION);
|
|
1246
|
-
const s = new
|
|
1236
|
+
const s = new ot(t, e);
|
|
1247
1237
|
return s.execute(), s;
|
|
1248
1238
|
}
|
|
1249
|
-
function
|
|
1239
|
+
function ct(t) {
|
|
1240
|
+
if (typeof t != "function")
|
|
1241
|
+
throw new U("Batch callback must be a function");
|
|
1242
|
+
W.startBatch();
|
|
1243
|
+
try {
|
|
1244
|
+
return t();
|
|
1245
|
+
} finally {
|
|
1246
|
+
W.endBatch();
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
function ut(t) {
|
|
1250
1250
|
return t !== null && typeof t == "object" && "value" in t && "subscribe" in t;
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function he(t) {
|
|
1253
1253
|
if (!t) return "unknown";
|
|
1254
1254
|
const e = "jquery" in t ? t[0] : t;
|
|
1255
1255
|
if (!e) return "unknown";
|
|
@@ -1260,7 +1260,31 @@ function ue(t) {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
return e.tagName.toLowerCase();
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function ht(t) {
|
|
1264
|
+
const e = t.length;
|
|
1265
|
+
if (e === 0) return new Int32Array(0);
|
|
1266
|
+
const s = new Int32Array(e), n = new Int32Array(e);
|
|
1267
|
+
let i = 0;
|
|
1268
|
+
for (let o = 0; o < e; o++) {
|
|
1269
|
+
const c = t[o];
|
|
1270
|
+
if (c === -1) continue;
|
|
1271
|
+
if (i === 0 || t[n[i - 1]] < c) {
|
|
1272
|
+
s[o] = i > 0 ? n[i - 1] : -1, n[i++] = o;
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
let h = 0, d = i - 1;
|
|
1276
|
+
for (; h < d; ) {
|
|
1277
|
+
const m = h + d >>> 1;
|
|
1278
|
+
t[n[m]] < c ? h = m + 1 : d = m;
|
|
1279
|
+
}
|
|
1280
|
+
c < t[n[h]] && (h > 0 && (s[o] = n[h - 1]), n[h] = o);
|
|
1281
|
+
}
|
|
1282
|
+
const r = new Int32Array(i);
|
|
1283
|
+
for (let o = i - 1, c = n[i - 1]; o >= 0; o--)
|
|
1284
|
+
r[o] = c, c = s[c];
|
|
1285
|
+
return r;
|
|
1286
|
+
}
|
|
1287
|
+
function at() {
|
|
1264
1288
|
if (typeof window < "u") {
|
|
1265
1289
|
const t = window.__ATOM_DEBUG__;
|
|
1266
1290
|
if (typeof t == "boolean")
|
|
@@ -1273,7 +1297,7 @@ function ct() {
|
|
|
1273
1297
|
}
|
|
1274
1298
|
return !1;
|
|
1275
1299
|
}
|
|
1276
|
-
let M =
|
|
1300
|
+
let M = at();
|
|
1277
1301
|
const g = {
|
|
1278
1302
|
get enabled() {
|
|
1279
1303
|
return M;
|
|
@@ -1292,8 +1316,8 @@ const g = {
|
|
|
1292
1316
|
*/
|
|
1293
1317
|
domUpdated(t, e, s) {
|
|
1294
1318
|
if (!M) return;
|
|
1295
|
-
const n =
|
|
1296
|
-
console.log(`[atom-effect-jquery] DOM updated: ${n}.${e} =`, s),
|
|
1319
|
+
const n = he(t);
|
|
1320
|
+
console.log(`[atom-effect-jquery] DOM updated: ${n}.${e} =`, s), lt(t);
|
|
1297
1321
|
},
|
|
1298
1322
|
cleanup(t) {
|
|
1299
1323
|
M && console.log(`[atom-effect-jquery] Cleanup: ${t}`);
|
|
@@ -1302,7 +1326,7 @@ const g = {
|
|
|
1302
1326
|
M && console.warn("[atom-effect-jquery]", ...t);
|
|
1303
1327
|
}
|
|
1304
1328
|
};
|
|
1305
|
-
function
|
|
1329
|
+
function lt(t) {
|
|
1306
1330
|
const e = t[0];
|
|
1307
1331
|
if (!e || !document.contains(e)) return;
|
|
1308
1332
|
const s = "atom_debug_timer", n = "atom_debug_cleanup_timer", i = "atom_debug_org_style";
|
|
@@ -1331,12 +1355,12 @@ function ut(t) {
|
|
|
1331
1355
|
}, 100);
|
|
1332
1356
|
t.data(s, r);
|
|
1333
1357
|
}
|
|
1334
|
-
const
|
|
1335
|
-
function
|
|
1336
|
-
const s =
|
|
1337
|
-
return e.name &&
|
|
1358
|
+
const ft = /* @__PURE__ */ new WeakMap();
|
|
1359
|
+
function Pe(t, e = {}) {
|
|
1360
|
+
const s = it(t, e);
|
|
1361
|
+
return e.name && ft.set(s, { name: e.name }), s;
|
|
1338
1362
|
}
|
|
1339
|
-
Object.defineProperty(
|
|
1363
|
+
Object.defineProperty(Pe, "debug", {
|
|
1340
1364
|
get() {
|
|
1341
1365
|
return g.enabled;
|
|
1342
1366
|
},
|
|
@@ -1344,45 +1368,54 @@ Object.defineProperty(Le, "debug", {
|
|
|
1344
1368
|
g.enabled = t;
|
|
1345
1369
|
}
|
|
1346
1370
|
});
|
|
1347
|
-
function
|
|
1371
|
+
function dt() {
|
|
1348
1372
|
return new Promise((t) => setTimeout(t, 0));
|
|
1349
1373
|
}
|
|
1350
1374
|
u.extend({
|
|
1351
|
-
atom:
|
|
1352
|
-
computed:
|
|
1375
|
+
atom: Pe,
|
|
1376
|
+
computed: rt,
|
|
1353
1377
|
effect: $,
|
|
1354
|
-
batch:
|
|
1355
|
-
untracked:
|
|
1356
|
-
isAtom:
|
|
1357
|
-
isComputed:
|
|
1358
|
-
isReactive: (t) =>
|
|
1359
|
-
nextTick:
|
|
1378
|
+
batch: ct,
|
|
1379
|
+
untracked: Fe,
|
|
1380
|
+
isAtom: _e,
|
|
1381
|
+
isComputed: Ce,
|
|
1382
|
+
isReactive: (t) => _e(t) || Ce(t),
|
|
1383
|
+
nextTick: dt
|
|
1360
1384
|
});
|
|
1361
|
-
|
|
1385
|
+
const se = "_aes-bound";
|
|
1386
|
+
class _t {
|
|
1362
1387
|
effects = /* @__PURE__ */ new WeakMap();
|
|
1363
1388
|
cleanups = /* @__PURE__ */ new WeakMap();
|
|
1364
1389
|
boundElements = /* @__PURE__ */ new WeakSet();
|
|
1365
1390
|
preservedNodes = /* @__PURE__ */ new WeakSet();
|
|
1391
|
+
ignoredNodes = /* @__PURE__ */ new WeakSet();
|
|
1392
|
+
// Prevent redundant cleanup
|
|
1366
1393
|
keep(e) {
|
|
1367
1394
|
this.preservedNodes.add(e);
|
|
1368
1395
|
}
|
|
1369
1396
|
isKept(e) {
|
|
1370
1397
|
return this.preservedNodes.has(e);
|
|
1371
1398
|
}
|
|
1399
|
+
markIgnored(e) {
|
|
1400
|
+
this.ignoredNodes.add(e);
|
|
1401
|
+
}
|
|
1402
|
+
isIgnored(e) {
|
|
1403
|
+
return this.ignoredNodes.has(e);
|
|
1404
|
+
}
|
|
1372
1405
|
trackEffect(e, s) {
|
|
1373
1406
|
let n = this.effects.get(e);
|
|
1374
|
-
n || (n = [], this.effects.set(e, n), this.boundElements.add(e)), n.push(s);
|
|
1407
|
+
n || (n = [], this.effects.set(e, n), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(se))), n.push(s);
|
|
1375
1408
|
}
|
|
1376
1409
|
trackCleanup(e, s) {
|
|
1377
1410
|
let n = this.cleanups.get(e);
|
|
1378
|
-
n || (n = [], this.cleanups.set(e, n), this.boundElements.add(e)), n.push(s);
|
|
1411
|
+
n || (n = [], this.cleanups.set(e, n), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(se))), n.push(s);
|
|
1379
1412
|
}
|
|
1380
1413
|
hasBind(e) {
|
|
1381
1414
|
return this.boundElements.has(e);
|
|
1382
1415
|
}
|
|
1383
1416
|
cleanup(e) {
|
|
1384
1417
|
if (!this.boundElements.delete(e)) return;
|
|
1385
|
-
g.cleanup(
|
|
1418
|
+
e.classList.remove(se), g.cleanup(he(e));
|
|
1386
1419
|
const s = this.effects.get(e);
|
|
1387
1420
|
if (s) {
|
|
1388
1421
|
this.effects.delete(e);
|
|
@@ -1410,18 +1443,20 @@ class lt {
|
|
|
1410
1443
|
}
|
|
1411
1444
|
}
|
|
1412
1445
|
}
|
|
1413
|
-
|
|
1414
|
-
const s = e.querySelectorAll(
|
|
1446
|
+
cleanupDescendants(e) {
|
|
1447
|
+
const s = e.querySelectorAll(`.${se}`);
|
|
1415
1448
|
for (let n = 0, i = s.length; n < i; n++) {
|
|
1416
1449
|
const r = s[n];
|
|
1417
1450
|
r && this.boundElements.has(r) && this.cleanup(r);
|
|
1418
1451
|
}
|
|
1419
|
-
|
|
1452
|
+
}
|
|
1453
|
+
cleanupTree(e) {
|
|
1454
|
+
this.cleanupDescendants(e), this.cleanup(e);
|
|
1420
1455
|
}
|
|
1421
1456
|
}
|
|
1422
|
-
const
|
|
1457
|
+
const f = new _t();
|
|
1423
1458
|
let K = null;
|
|
1424
|
-
function
|
|
1459
|
+
function pt(t = document.body) {
|
|
1425
1460
|
K || (K = new MutationObserver((e) => {
|
|
1426
1461
|
for (let s = 0, n = e.length; s < n; s++) {
|
|
1427
1462
|
const i = e[s];
|
|
@@ -1429,40 +1464,40 @@ function ft(t = document.body) {
|
|
|
1429
1464
|
const r = i.removedNodes;
|
|
1430
1465
|
for (let o = 0, c = r.length; o < c; o++) {
|
|
1431
1466
|
const h = r[o];
|
|
1432
|
-
h && (
|
|
1467
|
+
h && (f.isKept(h) || f.isIgnored(h) || h.isConnected || h.nodeType === 1 && f.cleanupTree(h));
|
|
1433
1468
|
}
|
|
1434
1469
|
}
|
|
1435
1470
|
}), K.observe(t, { childList: !0, subtree: !0 }));
|
|
1436
1471
|
}
|
|
1437
|
-
function
|
|
1472
|
+
function At() {
|
|
1438
1473
|
K?.disconnect(), K = null;
|
|
1439
1474
|
}
|
|
1440
1475
|
function _(t, e, s, n) {
|
|
1441
1476
|
const i = u(t), r = t;
|
|
1442
|
-
if (
|
|
1477
|
+
if (ut(e)) {
|
|
1443
1478
|
const o = $(() => {
|
|
1444
1479
|
const c = e.value;
|
|
1445
1480
|
s(c), g.domUpdated(i, n, c);
|
|
1446
1481
|
});
|
|
1447
|
-
|
|
1482
|
+
f.trackEffect(r, o);
|
|
1448
1483
|
} else
|
|
1449
1484
|
s(e);
|
|
1450
1485
|
}
|
|
1451
|
-
function
|
|
1486
|
+
function Ve() {
|
|
1452
1487
|
return { timeoutId: null, phase: "idle", hasFocus: !1 };
|
|
1453
1488
|
}
|
|
1454
|
-
function
|
|
1489
|
+
function Me(t, e, s = {}) {
|
|
1455
1490
|
const {
|
|
1456
1491
|
debounce: n,
|
|
1457
1492
|
event: i = "input",
|
|
1458
1493
|
parse: r = (D) => D,
|
|
1459
1494
|
format: o = (D) => String(D ?? "")
|
|
1460
|
-
} = s, c =
|
|
1495
|
+
} = s, c = Ve(), h = () => {
|
|
1461
1496
|
c.phase = "composing";
|
|
1462
|
-
},
|
|
1497
|
+
}, d = () => {
|
|
1463
1498
|
c.phase = "idle", x();
|
|
1464
1499
|
};
|
|
1465
|
-
t.on("compositionstart", h), t.on("compositionend",
|
|
1500
|
+
t.on("compositionstart", h), t.on("compositionend", d);
|
|
1466
1501
|
const m = () => {
|
|
1467
1502
|
c.hasFocus = !0;
|
|
1468
1503
|
}, X = () => {
|
|
@@ -1484,7 +1519,7 @@ function Ve(t, e, s = {}) {
|
|
|
1484
1519
|
c.phase = "syncing-to-dom", t.val(D), g.domUpdated(t, "val", D), c.phase = "idle";
|
|
1485
1520
|
}
|
|
1486
1521
|
}, cleanup: () => {
|
|
1487
|
-
t.off(i, A), t.off("change", A), t.off("compositionstart", h), t.off("compositionend",
|
|
1522
|
+
t.off(i, A), t.off("change", A), t.off("compositionstart", h), t.off("compositionend", d), t.off("focus", m), t.off("blur", X), c.timeoutId && clearTimeout(c.timeoutId);
|
|
1488
1523
|
} };
|
|
1489
1524
|
}
|
|
1490
1525
|
u.fn.atomText = function(t, e) {
|
|
@@ -1558,8 +1593,8 @@ u.fn.atomHide = function(t) {
|
|
|
1558
1593
|
};
|
|
1559
1594
|
u.fn.atomVal = function(t, e = {}) {
|
|
1560
1595
|
return this.each(function() {
|
|
1561
|
-
const s = u(this), { effect: n, cleanup: i } =
|
|
1562
|
-
|
|
1596
|
+
const s = u(this), { effect: n, cleanup: i } = Me(s, t, e), r = $(n);
|
|
1597
|
+
f.trackEffect(this, r), f.trackCleanup(this, i);
|
|
1563
1598
|
});
|
|
1564
1599
|
};
|
|
1565
1600
|
u.fn.atomChecked = function(t) {
|
|
@@ -1569,27 +1604,27 @@ u.fn.atomChecked = function(t) {
|
|
|
1569
1604
|
const n = () => {
|
|
1570
1605
|
s || (t.value = !!e.prop("checked"));
|
|
1571
1606
|
};
|
|
1572
|
-
e.on("change", n),
|
|
1607
|
+
e.on("change", n), f.trackCleanup(this, () => e.off("change", n));
|
|
1573
1608
|
const i = $(() => {
|
|
1574
1609
|
s = !0;
|
|
1575
1610
|
const r = !!t.value;
|
|
1576
1611
|
e.prop("checked", r), g.domUpdated(e, "checked", r), s = !1;
|
|
1577
1612
|
});
|
|
1578
|
-
|
|
1613
|
+
f.trackEffect(this, i);
|
|
1579
1614
|
});
|
|
1580
1615
|
};
|
|
1581
1616
|
u.fn.atomOn = function(t, e) {
|
|
1582
1617
|
return this.each(function() {
|
|
1583
1618
|
const s = u(this);
|
|
1584
|
-
s.on(t, e),
|
|
1619
|
+
s.on(t, e), f.trackCleanup(this, () => s.off(t, e));
|
|
1585
1620
|
});
|
|
1586
1621
|
};
|
|
1587
1622
|
u.fn.atomUnbind = function() {
|
|
1588
1623
|
return this.each(function() {
|
|
1589
|
-
|
|
1624
|
+
f.cleanupTree(this);
|
|
1590
1625
|
});
|
|
1591
1626
|
};
|
|
1592
|
-
function
|
|
1627
|
+
function gt(t, e) {
|
|
1593
1628
|
_(
|
|
1594
1629
|
t.el,
|
|
1595
1630
|
e,
|
|
@@ -1599,7 +1634,7 @@ function dt(t, e) {
|
|
|
1599
1634
|
"text"
|
|
1600
1635
|
);
|
|
1601
1636
|
}
|
|
1602
|
-
function
|
|
1637
|
+
function Et(t, e) {
|
|
1603
1638
|
_(
|
|
1604
1639
|
t.el,
|
|
1605
1640
|
e,
|
|
@@ -1609,7 +1644,7 @@ function _t(t, e) {
|
|
|
1609
1644
|
"html"
|
|
1610
1645
|
);
|
|
1611
1646
|
}
|
|
1612
|
-
function
|
|
1647
|
+
function bt(t, e) {
|
|
1613
1648
|
for (const s in e)
|
|
1614
1649
|
_(
|
|
1615
1650
|
t.el,
|
|
@@ -1620,7 +1655,7 @@ function pt(t, e) {
|
|
|
1620
1655
|
`class.${s}`
|
|
1621
1656
|
);
|
|
1622
1657
|
}
|
|
1623
|
-
function
|
|
1658
|
+
function mt(t, e) {
|
|
1624
1659
|
const s = t.el.style;
|
|
1625
1660
|
for (const n in e) {
|
|
1626
1661
|
const i = e[n];
|
|
@@ -1647,7 +1682,7 @@ function gt(t, e) {
|
|
|
1647
1682
|
);
|
|
1648
1683
|
}
|
|
1649
1684
|
}
|
|
1650
|
-
function
|
|
1685
|
+
function yt(t, e) {
|
|
1651
1686
|
const s = t.el;
|
|
1652
1687
|
for (const n in e) {
|
|
1653
1688
|
const i = e[n];
|
|
@@ -1665,7 +1700,7 @@ function Et(t, e) {
|
|
|
1665
1700
|
);
|
|
1666
1701
|
}
|
|
1667
1702
|
}
|
|
1668
|
-
function
|
|
1703
|
+
function St(t, e) {
|
|
1669
1704
|
const s = t.el;
|
|
1670
1705
|
for (const n in e)
|
|
1671
1706
|
_(
|
|
@@ -1677,7 +1712,7 @@ function bt(t, e) {
|
|
|
1677
1712
|
`prop.${n}`
|
|
1678
1713
|
);
|
|
1679
1714
|
}
|
|
1680
|
-
function
|
|
1715
|
+
function Dt(t, e) {
|
|
1681
1716
|
_(
|
|
1682
1717
|
t.el,
|
|
1683
1718
|
e,
|
|
@@ -1687,7 +1722,7 @@ function mt(t, e) {
|
|
|
1687
1722
|
"show"
|
|
1688
1723
|
);
|
|
1689
1724
|
}
|
|
1690
|
-
function
|
|
1725
|
+
function It(t, e) {
|
|
1691
1726
|
_(
|
|
1692
1727
|
t.el,
|
|
1693
1728
|
e,
|
|
@@ -1697,12 +1732,12 @@ function yt(t, e) {
|
|
|
1697
1732
|
"hide"
|
|
1698
1733
|
);
|
|
1699
1734
|
}
|
|
1700
|
-
function
|
|
1701
|
-
const s = Array.isArray(e) ? e[0] : e, n = Array.isArray(e) ? e[1] : {}, { effect: i, cleanup: r } =
|
|
1702
|
-
|
|
1735
|
+
function Ct(t, e) {
|
|
1736
|
+
const s = Array.isArray(e) ? e[0] : e, n = Array.isArray(e) ? e[1] : {}, { effect: i, cleanup: r } = Me(t.$el, s, n), o = $(i);
|
|
1737
|
+
f.trackEffect(t.el, o), t.trackCleanup(r);
|
|
1703
1738
|
}
|
|
1704
|
-
function
|
|
1705
|
-
const s =
|
|
1739
|
+
function xt(t, e) {
|
|
1740
|
+
const s = Ve(), n = () => {
|
|
1706
1741
|
s.phase === "idle" && (e.value = t.$el.prop("checked"));
|
|
1707
1742
|
};
|
|
1708
1743
|
t.$el.on("change", n), t.trackCleanup(() => t.$el.off("change", n));
|
|
@@ -1711,9 +1746,9 @@ function Dt(t, e) {
|
|
|
1711
1746
|
const r = !!e.value;
|
|
1712
1747
|
t.$el.prop("checked", r), g.domUpdated(t.$el, "checked", r), s.phase = "idle";
|
|
1713
1748
|
});
|
|
1714
|
-
|
|
1749
|
+
f.trackEffect(t.el, i);
|
|
1715
1750
|
}
|
|
1716
|
-
function
|
|
1751
|
+
function Nt(t, e) {
|
|
1717
1752
|
const s = t.el;
|
|
1718
1753
|
for (const n in e) {
|
|
1719
1754
|
const i = e[n];
|
|
@@ -1728,39 +1763,15 @@ u.fn.atomBind = function(t) {
|
|
|
1728
1763
|
$el: u(this),
|
|
1729
1764
|
el: this,
|
|
1730
1765
|
effects: [],
|
|
1731
|
-
trackCleanup: (n) =>
|
|
1766
|
+
trackCleanup: (n) => f.trackCleanup(this, n)
|
|
1732
1767
|
};
|
|
1733
|
-
t.text !== void 0 &&
|
|
1768
|
+
t.text !== void 0 && gt(s, t.text), t.html !== void 0 && Et(s, t.html), t.class && bt(s, t.class), t.css && mt(s, t.css), t.attr && yt(s, t.attr), t.prop && St(s, t.prop), t.show !== void 0 && Dt(s, t.show), t.hide !== void 0 && It(s, t.hide), t.val !== void 0 && Ct(s, t.val), t.checked !== void 0 && xt(s, t.checked), t.on && Nt(s, t.on);
|
|
1734
1769
|
});
|
|
1735
1770
|
};
|
|
1736
|
-
function Ct(t) {
|
|
1737
|
-
const e = t.length;
|
|
1738
|
-
if (e === 0) return new Int32Array(0);
|
|
1739
|
-
const s = new Int32Array(e), n = new Int32Array(e);
|
|
1740
|
-
let i = 0;
|
|
1741
|
-
for (let o = 0; o < e; o++) {
|
|
1742
|
-
const c = t[o];
|
|
1743
|
-
if (c === -1) continue;
|
|
1744
|
-
if (i === 0 || t[n[i - 1]] < c) {
|
|
1745
|
-
s[o] = i > 0 ? n[i - 1] : -1, n[i++] = o;
|
|
1746
|
-
continue;
|
|
1747
|
-
}
|
|
1748
|
-
let h = 0, f = i - 1;
|
|
1749
|
-
for (; h < f; ) {
|
|
1750
|
-
const m = h + f >>> 1;
|
|
1751
|
-
t[n[m]] < c ? h = m + 1 : f = m;
|
|
1752
|
-
}
|
|
1753
|
-
c < t[n[h]] && (h > 0 && (s[o] = n[h - 1]), n[h] = o);
|
|
1754
|
-
}
|
|
1755
|
-
const r = new Int32Array(i);
|
|
1756
|
-
for (let o = i - 1, c = n[i - 1]; o >= 0; o--)
|
|
1757
|
-
r[o] = c, c = s[c];
|
|
1758
|
-
return r;
|
|
1759
|
-
}
|
|
1760
1771
|
u.fn.atomList = function(t, e) {
|
|
1761
|
-
const { key: s, render: n, bind: i, update: r, onAdd: o, onRemove: c, empty: h } = e,
|
|
1772
|
+
const { key: s, render: n, bind: i, update: r, onAdd: o, onRemove: c, empty: h } = e, d = typeof s == "function" ? s : (m) => m[s];
|
|
1762
1773
|
return this.each(function() {
|
|
1763
|
-
const m = u(this), X =
|
|
1774
|
+
const m = u(this), X = he(this), x = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set();
|
|
1764
1775
|
let k = [], L = null;
|
|
1765
1776
|
const D = $(() => {
|
|
1766
1777
|
const H = t.value, R = H.length;
|
|
@@ -1769,17 +1780,17 @@ u.fn.atomList = function(t, e) {
|
|
|
1769
1780
|
return;
|
|
1770
1781
|
}
|
|
1771
1782
|
g.log("list", `${X} updating with ${R} items`);
|
|
1772
|
-
const Z = new Array(R),
|
|
1783
|
+
const Z = new Array(R), Ee = /* @__PURE__ */ new Set();
|
|
1773
1784
|
for (let a = 0; a < R; a++) {
|
|
1774
|
-
const p = H[a], I =
|
|
1775
|
-
Z[a] = I,
|
|
1785
|
+
const p = H[a], I = d(p, a);
|
|
1786
|
+
Z[a] = I, Ee.add(I);
|
|
1776
1787
|
}
|
|
1777
1788
|
for (const [a, p] of x) {
|
|
1778
|
-
if (
|
|
1789
|
+
if (Ee.has(a) || A.has(a)) continue;
|
|
1779
1790
|
const I = () => {
|
|
1780
1791
|
p.$el.remove();
|
|
1781
1792
|
const E = p.$el[0];
|
|
1782
|
-
E &&
|
|
1793
|
+
E && f.cleanup(E), A.delete(a), g.log("list", `${X} removed item:`, a);
|
|
1783
1794
|
};
|
|
1784
1795
|
if (x.delete(a), A.add(a), c) {
|
|
1785
1796
|
const E = c(p.$el);
|
|
@@ -1791,25 +1802,25 @@ u.fn.atomList = function(t, e) {
|
|
|
1791
1802
|
k = [];
|
|
1792
1803
|
return;
|
|
1793
1804
|
}
|
|
1794
|
-
const
|
|
1805
|
+
const be = /* @__PURE__ */ new Map();
|
|
1795
1806
|
for (let a = 0; a < k.length; a++) {
|
|
1796
1807
|
const p = k[a];
|
|
1797
|
-
p !== void 0 &&
|
|
1808
|
+
p !== void 0 && be.set(p, a);
|
|
1798
1809
|
}
|
|
1799
|
-
const
|
|
1810
|
+
const me = new Int32Array(R);
|
|
1800
1811
|
for (let a = 0; a < R; a++) {
|
|
1801
1812
|
const p = Z[a];
|
|
1802
|
-
|
|
1813
|
+
me[a] = p !== void 0 ? be.get(p) ?? -1 : -1;
|
|
1803
1814
|
}
|
|
1804
|
-
const
|
|
1805
|
-
let
|
|
1815
|
+
const ye = ht(me);
|
|
1816
|
+
let ae = ye.length - 1, O = null;
|
|
1806
1817
|
for (let a = R - 1; a >= 0; a--) {
|
|
1807
1818
|
const p = Z[a], I = H[a], E = x.get(p);
|
|
1808
1819
|
if (E) {
|
|
1809
1820
|
E.item = I;
|
|
1810
1821
|
const P = E.$el[0];
|
|
1811
1822
|
if (!P) continue;
|
|
1812
|
-
r && r(E.$el, I, a),
|
|
1823
|
+
r && r(E.$el, I, a), ae >= 0 && ye[ae] === a ? (ae--, P.nextSibling !== O && (O ? E.$el.insertBefore(O) : E.$el.appendTo(m))) : O ? E.$el.insertBefore(O) : E.$el.appendTo(m), O = P;
|
|
1813
1824
|
} else {
|
|
1814
1825
|
const P = n(I, a), V = P instanceof Element ? u(P) : u(P);
|
|
1815
1826
|
x.set(p, { $el: V, item: I }), O ? V.insertBefore(O) : V.appendTo(m), i && i(V, I, a), o && o(V), g.log("list", `${X} added item:`, p), O = V[0] || null;
|
|
@@ -1817,15 +1828,15 @@ u.fn.atomList = function(t, e) {
|
|
|
1817
1828
|
}
|
|
1818
1829
|
k = Z;
|
|
1819
1830
|
});
|
|
1820
|
-
|
|
1831
|
+
f.trackEffect(this, D), f.trackCleanup(this, () => {
|
|
1821
1832
|
x.clear(), A.clear(), k = [], L?.remove();
|
|
1822
1833
|
});
|
|
1823
1834
|
});
|
|
1824
1835
|
};
|
|
1825
|
-
const
|
|
1836
|
+
const ie = /* @__PURE__ */ new WeakMap();
|
|
1826
1837
|
u.fn.atomMount = function(t, e = {}) {
|
|
1827
1838
|
return this.each(function() {
|
|
1828
|
-
const s = u(this), n =
|
|
1839
|
+
const s = u(this), n = he(this), i = ie.get(this);
|
|
1829
1840
|
i && (g.log("mount", `${n} unmounting existing component`), i()), g.log("mount", `${n} mounting component`);
|
|
1830
1841
|
let r;
|
|
1831
1842
|
try {
|
|
@@ -1842,34 +1853,34 @@ u.fn.atomMount = function(t, e = {}) {
|
|
|
1842
1853
|
r();
|
|
1843
1854
|
} catch {
|
|
1844
1855
|
}
|
|
1845
|
-
|
|
1856
|
+
f.cleanupTree(this), ie.delete(this);
|
|
1846
1857
|
}
|
|
1847
1858
|
};
|
|
1848
|
-
|
|
1859
|
+
ie.set(this, c), f.trackCleanup(this, c);
|
|
1849
1860
|
});
|
|
1850
1861
|
};
|
|
1851
1862
|
u.fn.atomUnmount = function() {
|
|
1852
1863
|
return this.each(function() {
|
|
1853
|
-
|
|
1864
|
+
ie.get(this)?.();
|
|
1854
1865
|
});
|
|
1855
1866
|
};
|
|
1856
1867
|
const Y = /* @__PURE__ */ new WeakMap();
|
|
1857
1868
|
let Te = !1;
|
|
1858
|
-
function
|
|
1869
|
+
function je() {
|
|
1859
1870
|
if (Te) return;
|
|
1860
1871
|
Te = !0;
|
|
1861
1872
|
const t = u.fn.on, e = u.fn.off, s = u.fn.remove, n = u.fn.empty, i = u.fn.detach;
|
|
1862
1873
|
u.fn.remove = function(r) {
|
|
1863
1874
|
return (r ? this.filter(r) : this).each(function() {
|
|
1864
|
-
|
|
1875
|
+
f.cleanupTree(this), f.markIgnored(this);
|
|
1865
1876
|
}), s.call(this, r);
|
|
1866
1877
|
}, u.fn.empty = function() {
|
|
1867
1878
|
return this.each(function() {
|
|
1868
|
-
|
|
1879
|
+
f.cleanupDescendants(this);
|
|
1869
1880
|
}), n.call(this);
|
|
1870
1881
|
}, u.fn.detach = function(r) {
|
|
1871
1882
|
return (r ? this.filter(r) : this).each(function() {
|
|
1872
|
-
|
|
1883
|
+
f.keep(this);
|
|
1873
1884
|
}), i.call(this, r);
|
|
1874
1885
|
}, u.fn.on = function(...r) {
|
|
1875
1886
|
let o = -1;
|
|
@@ -1881,8 +1892,8 @@ function Me() {
|
|
|
1881
1892
|
if (o !== -1) {
|
|
1882
1893
|
const c = r[o];
|
|
1883
1894
|
let h;
|
|
1884
|
-
Y.has(c) ? h = Y.get(c) : (h = function(...
|
|
1885
|
-
return c.apply(this,
|
|
1895
|
+
Y.has(c) ? h = Y.get(c) : (h = function(...d) {
|
|
1896
|
+
return c.apply(this, d);
|
|
1886
1897
|
}, Y.set(c, h)), r[o] = h;
|
|
1887
1898
|
}
|
|
1888
1899
|
return t.apply(this, r);
|
|
@@ -1900,22 +1911,22 @@ function Me() {
|
|
|
1900
1911
|
return e.apply(this, r);
|
|
1901
1912
|
};
|
|
1902
1913
|
}
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1914
|
+
const Rt = je;
|
|
1915
|
+
je();
|
|
1905
1916
|
u(() => {
|
|
1906
|
-
|
|
1917
|
+
pt(document.body);
|
|
1907
1918
|
});
|
|
1908
1919
|
export {
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1920
|
+
it as atom,
|
|
1921
|
+
ct as batch,
|
|
1922
|
+
rt as computed,
|
|
1923
|
+
wt as default,
|
|
1924
|
+
At as disableAutoCleanup,
|
|
1914
1925
|
$ as effect,
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1926
|
+
pt as enableAutoCleanup,
|
|
1927
|
+
Rt as enablejQueryBatching,
|
|
1928
|
+
je as enablejQueryOverrides,
|
|
1929
|
+
f as registry,
|
|
1930
|
+
Fe as untracked
|
|
1920
1931
|
};
|
|
1921
1932
|
//# sourceMappingURL=index.mjs.map
|