@but212/atom-effect-jquery 0.30.0 → 0.30.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/README.md +12 -1
- package/dist/atom-effect-jquery.min.js +5 -5
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +441 -442
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -142,10 +142,10 @@ function y(e, t, n) {
|
|
|
142
142
|
}
|
|
143
143
|
return new t(m.format("Unexpected error", n, String(e)), e);
|
|
144
144
|
}
|
|
145
|
-
var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symbol("AtomEffect.Id"), S = /* @__PURE__ */ Symbol("AtomEffect.Type"), C = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"),
|
|
145
|
+
var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symbol("AtomEffect.Id"), S = /* @__PURE__ */ Symbol("AtomEffect.Type"), C = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), ee = "[Atom Effect]", w = f ? new class {
|
|
146
146
|
constructor() {
|
|
147
147
|
this.enabled = !0, this.warnInfiniteLoop = c.WARN_INFINITE_LOOP, this._updateCounts = /* @__PURE__ */ new Map(), this._nodeRegistry = /* @__PURE__ */ new Map(), this._threshold = c.LOOP_THRESHOLD, this._cleanupScheduled = !1, this.warn = (e, t) => {
|
|
148
|
-
this.enabled && e && console.warn(`${
|
|
148
|
+
this.enabled && e && console.warn(`${ee} ${t}`);
|
|
149
149
|
}, this.registerNode = (e) => {
|
|
150
150
|
this._nodeRegistry.set(e.id, new WeakRef(e));
|
|
151
151
|
}, this.attachDebugInfo = (e, t, n, r) => {
|
|
@@ -197,7 +197,7 @@ var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symb
|
|
|
197
197
|
dumpGraph: () => [],
|
|
198
198
|
getDebugName: () => {},
|
|
199
199
|
getDebugType: () => {}
|
|
200
|
-
},
|
|
200
|
+
}, te = 1, ne = () => te++ | 0, re = class {
|
|
201
201
|
constructor() {
|
|
202
202
|
this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._actualCount = 0, this._overflow = null, this._freeIndices = null;
|
|
203
203
|
}
|
|
@@ -312,7 +312,7 @@ var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symb
|
|
|
312
312
|
dispose() {
|
|
313
313
|
this.clear();
|
|
314
314
|
}
|
|
315
|
-
},
|
|
315
|
+
}, ie = class extends re {
|
|
316
316
|
constructor(...e) {
|
|
317
317
|
super(...e), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1;
|
|
318
318
|
}
|
|
@@ -380,46 +380,46 @@ var b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symb
|
|
|
380
380
|
disposeAll() {
|
|
381
381
|
this.truncateFrom(0), this.hasComputeds = !1;
|
|
382
382
|
}
|
|
383
|
-
},
|
|
383
|
+
}, T = /* @__PURE__ */ Symbol.for("atom-effect/brand"), E = {
|
|
384
384
|
Atom: 1,
|
|
385
385
|
Writable: 2,
|
|
386
386
|
Computed: 4,
|
|
387
387
|
Effect: 8
|
|
388
388
|
};
|
|
389
|
-
function
|
|
389
|
+
function ae(e, t) {
|
|
390
390
|
if (!e) return !1;
|
|
391
391
|
let n = typeof e;
|
|
392
|
-
return (n === "object" || n === "function") && !!((e[
|
|
393
|
-
}
|
|
394
|
-
function ae(e) {
|
|
395
|
-
return ie(e, D.Atom);
|
|
392
|
+
return (n === "object" || n === "function") && !!((e[T] ?? 0) & t);
|
|
396
393
|
}
|
|
397
394
|
function oe(e) {
|
|
398
|
-
return
|
|
395
|
+
return ae(e, E.Atom);
|
|
399
396
|
}
|
|
400
397
|
function se(e) {
|
|
398
|
+
return ae(e, E.Computed);
|
|
399
|
+
}
|
|
400
|
+
function ce(e) {
|
|
401
401
|
if (e instanceof Promise) return !0;
|
|
402
402
|
if (!e) return !1;
|
|
403
403
|
let t = typeof e;
|
|
404
404
|
return (t === "object" || t === "function") && typeof e.then == "function";
|
|
405
405
|
}
|
|
406
|
-
var
|
|
406
|
+
var le = class {
|
|
407
407
|
constructor(e, t, n = void 0) {
|
|
408
408
|
this.node = e, this.version = t, this.unsub = n;
|
|
409
409
|
}
|
|
410
|
-
},
|
|
410
|
+
}, ue = class {
|
|
411
411
|
constructor(e = void 0, t = void 0) {
|
|
412
412
|
this.fn = e, this.sub = t;
|
|
413
413
|
}
|
|
414
414
|
notify(e, t) {
|
|
415
|
-
|
|
415
|
+
O(() => {
|
|
416
416
|
let n = this.fn;
|
|
417
417
|
n !== void 0 && n(e, t);
|
|
418
418
|
let r = this.sub;
|
|
419
419
|
r !== void 0 && r.execute();
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
},
|
|
422
|
+
}, D = new class {
|
|
423
423
|
constructor() {
|
|
424
424
|
this.current = null;
|
|
425
425
|
}
|
|
@@ -429,14 +429,14 @@ var ce = class {
|
|
|
429
429
|
this.current = e;
|
|
430
430
|
try {
|
|
431
431
|
let e = t();
|
|
432
|
-
return f &&
|
|
432
|
+
return f && w.warn(ce(e), "Detected Promise returned within tracking context. Dependencies accessed after \"await\" will NOT be tracked. Consider using synchronous tracking before the async boundary."), e;
|
|
433
433
|
} finally {
|
|
434
434
|
this.current = n;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
}();
|
|
438
|
-
function
|
|
439
|
-
let t =
|
|
438
|
+
function O(e) {
|
|
439
|
+
let t = D, n = t.current;
|
|
440
440
|
if (n === null) return e();
|
|
441
441
|
t.current = null;
|
|
442
442
|
try {
|
|
@@ -445,9 +445,9 @@ function k(e) {
|
|
|
445
445
|
t.current = n;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
var
|
|
448
|
+
var de = class {
|
|
449
449
|
constructor() {
|
|
450
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = u.UNINITIALIZED, this._nextEpoch = void 0, this._notifying = 0, this._hotIndex = -1, this._slots = null, this._deps = null, this.id =
|
|
450
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = u.UNINITIALIZED, this._nextEpoch = void 0, this._notifying = 0, this._hotIndex = -1, this._slots = null, this._deps = null, this.id = ne() & s;
|
|
451
451
|
}
|
|
452
452
|
get isDisposed() {
|
|
453
453
|
return (this.flags & i.DISPOSED) !== 0;
|
|
@@ -462,7 +462,7 @@ var ue = class {
|
|
|
462
462
|
let t = typeof e == "function";
|
|
463
463
|
if (!t && (!e || typeof e.execute != "function")) throw y(/* @__PURE__ */ TypeError("Invalid subscriber"), m, v.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
|
|
464
464
|
let n = this._slots;
|
|
465
|
-
n || (n = new
|
|
465
|
+
n || (n = new re(), this._slots = n);
|
|
466
466
|
let r = !1;
|
|
467
467
|
if (n._s0 != null && (t ? n._s0.fn === e : n._s0.sub === e)) r = !0;
|
|
468
468
|
else if (n._s1 != null && (t ? n._s1.fn === e : n._s1.sub === e)) r = !0;
|
|
@@ -479,7 +479,7 @@ var ue = class {
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
if (r) return f && console.warn(`[atom-effect] Duplicate subscription ignored on node ${this.id}`), () => {};
|
|
482
|
-
let i = new
|
|
482
|
+
let i = new ue(t ? e : void 0, t ? void 0 : e);
|
|
483
483
|
return n.add(i), () => this._unsubscribe(i);
|
|
484
484
|
}
|
|
485
485
|
_unsubscribe(e) {
|
|
@@ -543,32 +543,32 @@ var ue = class {
|
|
|
543
543
|
}
|
|
544
544
|
return this._deepDirtyCheck();
|
|
545
545
|
}
|
|
546
|
-
},
|
|
547
|
-
function
|
|
548
|
-
let e =
|
|
549
|
-
return
|
|
546
|
+
}, fe = 0;
|
|
547
|
+
function pe() {
|
|
548
|
+
let e = fe + 1 & s;
|
|
549
|
+
return fe = e === 0 ? 1 : e, fe;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function me(e) {
|
|
552
552
|
let t = e + 1 & s;
|
|
553
553
|
return t === 0 ? 1 : t;
|
|
554
554
|
}
|
|
555
|
-
var
|
|
556
|
-
function _e() {
|
|
557
|
-
return ge;
|
|
558
|
-
}
|
|
555
|
+
var he = 0, ge = !1, _e = 0;
|
|
559
556
|
function ve() {
|
|
560
|
-
return
|
|
557
|
+
return _e;
|
|
561
558
|
}
|
|
562
559
|
function ye() {
|
|
563
|
-
he = !
|
|
560
|
+
return ge ? (f && console.warn("startFlush() called during flush - ignored"), !1) : (ge = !0, _e = pe(), he = 0, !0);
|
|
564
561
|
}
|
|
565
562
|
function be() {
|
|
566
|
-
|
|
567
|
-
|
|
563
|
+
ge = !1;
|
|
564
|
+
}
|
|
565
|
+
function xe() {
|
|
566
|
+
if (!ge) return 0;
|
|
567
|
+
let e = ++he;
|
|
568
568
|
if (e <= o.MAX_EXECUTIONS_PER_FLUSH) return e;
|
|
569
569
|
throw Error(`[atom-effect] Infinite loop detected: flush execution count exceeded ${o.MAX_EXECUTIONS_PER_FLUSH}`);
|
|
570
570
|
}
|
|
571
|
-
var
|
|
571
|
+
var k = new class {
|
|
572
572
|
constructor() {
|
|
573
573
|
this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = o.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
|
|
574
574
|
}
|
|
@@ -595,8 +595,8 @@ var A = new class {
|
|
|
595
595
|
_runLoop() {
|
|
596
596
|
try {
|
|
597
597
|
if (this._size === 0 && this._batchQueueSize === 0) return;
|
|
598
|
-
let e =
|
|
599
|
-
this._drainQueue(), e &&
|
|
598
|
+
let e = ye();
|
|
599
|
+
this._drainQueue(), e && be();
|
|
600
600
|
} finally {
|
|
601
601
|
this._isProcessing = !1;
|
|
602
602
|
}
|
|
@@ -605,11 +605,11 @@ var A = new class {
|
|
|
605
605
|
if (this._size === 0 && this._batchQueueSize === 0) return;
|
|
606
606
|
let e = this._isFlushingSync;
|
|
607
607
|
this._isFlushingSync = !0;
|
|
608
|
-
let t =
|
|
608
|
+
let t = ye();
|
|
609
609
|
try {
|
|
610
610
|
this._mergeBatchQueue(), this._drainQueue();
|
|
611
611
|
} finally {
|
|
612
|
-
this._isFlushingSync = e, t &&
|
|
612
|
+
this._isFlushingSync = e, t && be();
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
_mergeBatchQueue() {
|
|
@@ -669,18 +669,18 @@ var A = new class {
|
|
|
669
669
|
this._maxFlushIterations = e;
|
|
670
670
|
}
|
|
671
671
|
}();
|
|
672
|
-
function
|
|
672
|
+
function Se(e) {
|
|
673
673
|
if (f && typeof e != "function") throw TypeError(v.BATCH_CALLBACK_MUST_BE_FUNCTION);
|
|
674
|
-
|
|
674
|
+
k.startBatch();
|
|
675
675
|
try {
|
|
676
676
|
return e();
|
|
677
677
|
} finally {
|
|
678
|
-
|
|
678
|
+
k.endBatch();
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
var
|
|
681
|
+
var Ce = class extends de {
|
|
682
682
|
constructor(e, t) {
|
|
683
|
-
super(), this[
|
|
683
|
+
super(), this[T] = E.Atom | E.Writable, this._value = e, this._equal = t.equal ?? Object.is, t.sync && (this.flags |= a.SYNC), w.attachDebugInfo(this, "atom", this.id, t.name);
|
|
684
684
|
}
|
|
685
685
|
get isNotificationScheduled() {
|
|
686
686
|
return (this.flags & a.NOTIFICATION_SCHEDULED) !== 0;
|
|
@@ -689,13 +689,13 @@ var Se = class extends ue {
|
|
|
689
689
|
return (this.flags & a.SYNC) !== 0;
|
|
690
690
|
}
|
|
691
691
|
get value() {
|
|
692
|
-
return
|
|
692
|
+
return D.current?.addDependency(this), this._value;
|
|
693
693
|
}
|
|
694
694
|
set value(e) {
|
|
695
695
|
let t = this._value;
|
|
696
|
-
if (this._equal(t, e) || (this._value = e, this.version =
|
|
696
|
+
if (this._equal(t, e) || (this._value = e, this.version = me(this.version), w.trackUpdate(this.id, w.getDebugName(this)), (this.flags & a.NOTIFICATION_SCHEDULED) !== 0)) return;
|
|
697
697
|
let n = this._slots;
|
|
698
|
-
n == null || n.size === 0 || (this._pendingOldValue = t, this.flags |= a.NOTIFICATION_SCHEDULED, (this.flags & a.SYNC) !== 0 && !
|
|
698
|
+
n == null || n.size === 0 || (this._pendingOldValue = t, this.flags |= a.NOTIFICATION_SCHEDULED, (this.flags & a.SYNC) !== 0 && !k.isBatching ? this._notifying === 0 && this._flushNotifications() : k.schedule(this));
|
|
699
699
|
}
|
|
700
700
|
execute() {
|
|
701
701
|
this._flushNotifications();
|
|
@@ -704,7 +704,7 @@ var Se = class extends ue {
|
|
|
704
704
|
let e = a.NOTIFICATION_SCHEDULED, t = a.DISPOSED, n = a.SYNC;
|
|
705
705
|
for (; (this.flags & (e | t)) === e;) {
|
|
706
706
|
let t = this._pendingOldValue;
|
|
707
|
-
if (this._pendingOldValue = void 0, this.flags &= ~e, this._equal(this._value, t) || this._notifySubscribers(this._value, t), (this.flags & n) === 0 ||
|
|
707
|
+
if (this._pendingOldValue = void 0, this.flags &= ~e, this._equal(this._value, t) || this._notifySubscribers(this._value, t), (this.flags & n) === 0 || k.isBatching) break;
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
710
|
peek() {
|
|
@@ -721,51 +721,51 @@ var Se = class extends ue {
|
|
|
721
721
|
this.dispose();
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
|
-
function
|
|
725
|
-
return new
|
|
724
|
+
function we(e, t = {}) {
|
|
725
|
+
return new Ce(e, t);
|
|
726
726
|
}
|
|
727
|
-
var { IDLE:
|
|
727
|
+
var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: Te, RECOMPUTING: F, DISPOSED: Ee, IS_COMPUTED: I, FORCE_COMPUTE: De } = i, Oe = class extends de {
|
|
728
728
|
constructor(e, t = {}) {
|
|
729
729
|
if (typeof e != "function") throw new h(v.COMPUTED_MUST_BE_FUNCTION);
|
|
730
|
-
if (super(), this[
|
|
730
|
+
if (super(), this[T] = E.Atom | E.Computed, this._error = null, this._promiseId = 0, this._deps = new ie(), this._trackEpoch = u.UNINITIALIZED, this._trackCount = 0, this._value = void 0, this.flags = I | j | A, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : C, this._onError = t.onError ?? null, w.attachDebugInfo(this, "computed", this.id, t.name), t.lazy === !1) try {
|
|
731
731
|
this._recompute();
|
|
732
732
|
} catch {}
|
|
733
733
|
}
|
|
734
734
|
get isDirty() {
|
|
735
|
-
return (this.flags &
|
|
735
|
+
return (this.flags & j) !== 0;
|
|
736
736
|
}
|
|
737
737
|
get isRejected() {
|
|
738
|
-
return (this.flags &
|
|
738
|
+
return (this.flags & P) !== 0;
|
|
739
739
|
}
|
|
740
740
|
get isRecomputing() {
|
|
741
|
-
return (this.flags &
|
|
741
|
+
return (this.flags & F) !== 0;
|
|
742
742
|
}
|
|
743
743
|
get _hasErrorInternal() {
|
|
744
|
-
return (this.flags &
|
|
744
|
+
return (this.flags & Te) !== 0;
|
|
745
745
|
}
|
|
746
746
|
_track() {
|
|
747
|
-
|
|
747
|
+
D.current?.addDependency(this);
|
|
748
748
|
}
|
|
749
749
|
get value() {
|
|
750
|
-
|
|
750
|
+
D.current?.addDependency(this);
|
|
751
751
|
let e = this.flags;
|
|
752
|
-
if ((e & (
|
|
753
|
-
if ((e &
|
|
754
|
-
if ((e &
|
|
752
|
+
if ((e & (N | j | A)) === N) return this._value;
|
|
753
|
+
if ((e & Ee) !== 0) throw new h(v.COMPUTED_DISPOSED);
|
|
754
|
+
if ((e & F) !== 0) {
|
|
755
755
|
let e = this._defaultValue;
|
|
756
756
|
if (e !== C) return e;
|
|
757
757
|
throw new h(v.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
758
758
|
}
|
|
759
|
-
if ((e & (
|
|
759
|
+
if ((e & (j | A)) !== 0) {
|
|
760
760
|
let t = this._deps;
|
|
761
|
-
if ((e &
|
|
761
|
+
if ((e & A) === 0 && (e & De) === 0 && t.size > 0 && !this._isDirty() ? e = this.flags &= ~j : (this._recompute(), e = this.flags), (e & N) !== 0) return this._value;
|
|
762
762
|
}
|
|
763
763
|
let t = this._defaultValue, n = t !== C;
|
|
764
|
-
if ((e &
|
|
764
|
+
if ((e & M) !== 0) {
|
|
765
765
|
if (n) return t;
|
|
766
766
|
throw new h(v.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
767
767
|
}
|
|
768
|
-
if ((e &
|
|
768
|
+
if ((e & P) !== 0) {
|
|
769
769
|
if (n) return t;
|
|
770
770
|
throw this._error;
|
|
771
771
|
}
|
|
@@ -775,14 +775,14 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
775
775
|
return this._value;
|
|
776
776
|
}
|
|
777
777
|
get state() {
|
|
778
|
-
|
|
778
|
+
D.current?.addDependency(this);
|
|
779
779
|
let e = this.flags;
|
|
780
|
-
return (e &
|
|
780
|
+
return (e & N) === 0 ? (e & M) === 0 ? (e & P) === 0 ? n.IDLE : n.REJECTED : n.PENDING : n.RESOLVED;
|
|
781
781
|
}
|
|
782
782
|
get hasError() {
|
|
783
|
-
if (
|
|
783
|
+
if (D.current?.addDependency(this), (this.flags & (P | Te)) !== 0) return !0;
|
|
784
784
|
let e = this._deps;
|
|
785
|
-
return e.hasComputeds ?
|
|
785
|
+
return e.hasComputeds ? O(() => {
|
|
786
786
|
let t = e.size;
|
|
787
787
|
for (let n = 0; n < t; n++) if (e.getAt(n)?.node.hasError) return !0;
|
|
788
788
|
return !1;
|
|
@@ -792,15 +792,15 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
792
792
|
return !this.hasError;
|
|
793
793
|
}
|
|
794
794
|
get errors() {
|
|
795
|
-
|
|
795
|
+
D.current?.addDependency(this);
|
|
796
796
|
let e = this._error, t = this._deps;
|
|
797
797
|
if (!t.hasComputeds) return e == null ? p : Object.freeze([e]);
|
|
798
798
|
let n = [];
|
|
799
|
-
return e != null && n.push(e),
|
|
799
|
+
return e != null && n.push(e), O(() => {
|
|
800
800
|
let e = t.size;
|
|
801
801
|
for (let r = 0; r < e; r++) {
|
|
802
802
|
let e = t.getAt(r)?.node;
|
|
803
|
-
e != null && (e.flags &
|
|
803
|
+
e != null && (e.flags & I) !== 0 && this._accumulateErrors(e, n);
|
|
804
804
|
}
|
|
805
805
|
}), n.length === 0 ? p : Object.freeze(n);
|
|
806
806
|
}
|
|
@@ -812,23 +812,23 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
812
812
|
let i = r.size;
|
|
813
813
|
for (let e = 0; e < i; e++) {
|
|
814
814
|
let n = r.getAt(e)?.node;
|
|
815
|
-
n != null && (n.flags &
|
|
815
|
+
n != null && (n.flags & I) !== 0 && this._accumulateErrors(n, t);
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
get lastError() {
|
|
819
|
-
return
|
|
819
|
+
return D.current?.addDependency(this), this._error;
|
|
820
820
|
}
|
|
821
821
|
get isPending() {
|
|
822
|
-
return
|
|
822
|
+
return D.current?.addDependency(this), (this.flags & M) !== 0;
|
|
823
823
|
}
|
|
824
824
|
get isResolved() {
|
|
825
|
-
return
|
|
825
|
+
return D.current?.addDependency(this), (this.flags & N) !== 0;
|
|
826
826
|
}
|
|
827
827
|
invalidate() {
|
|
828
|
-
this.flags |=
|
|
828
|
+
this.flags |= De, this._markDirty();
|
|
829
829
|
}
|
|
830
830
|
dispose() {
|
|
831
|
-
(this.flags &
|
|
831
|
+
(this.flags & Ee) === 0 && (this._deps.disposeAll(), this._slots != null && this._slots.clear(), this.flags = Ee | j | A, this._error = null, this._value = void 0, this._hotIndex = -1);
|
|
832
832
|
}
|
|
833
833
|
[Symbol.dispose]() {
|
|
834
834
|
this.dispose();
|
|
@@ -840,18 +840,18 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
840
840
|
let n = this._trackCount++, r = this._deps, i = r.getAt(n);
|
|
841
841
|
if (i != null && i.node === e) i.version = e.version;
|
|
842
842
|
else if (!r.claimExisting(e, n)) {
|
|
843
|
-
let t = new
|
|
843
|
+
let t = new le(e, e.version, e.subscribe(this));
|
|
844
844
|
r.insertNew(n, t);
|
|
845
845
|
}
|
|
846
|
-
(e.flags &
|
|
846
|
+
(e.flags & I) !== 0 && (r.hasComputeds = !0);
|
|
847
847
|
}
|
|
848
848
|
_recompute() {
|
|
849
849
|
if (this.isRecomputing) return;
|
|
850
|
-
this.flags = (this.flags |
|
|
850
|
+
this.flags = (this.flags | F) & ~De, this._trackEpoch = pe(), this._trackCount = 0, this._deps.prepareTracking(), this._hotIndex = -1;
|
|
851
851
|
let e = !1;
|
|
852
852
|
try {
|
|
853
|
-
let t =
|
|
854
|
-
this._deps.truncateFrom(this._trackCount), e = !0,
|
|
853
|
+
let t = D.run(this, this._fn);
|
|
854
|
+
this._deps.truncateFrom(this._trackCount), e = !0, ce(t) ? this._handleAsyncComputation(t) : this._finalizeResolution(t);
|
|
855
855
|
} catch (t) {
|
|
856
856
|
if (!e) try {
|
|
857
857
|
this._deps.truncateFrom(this._trackCount);
|
|
@@ -860,11 +860,11 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
860
860
|
}
|
|
861
861
|
this._handleError(t, v.COMPUTED_COMPUTATION_FAILED, !0);
|
|
862
862
|
} finally {
|
|
863
|
-
this._trackEpoch = u.UNINITIALIZED, this._trackCount = 0, this.flags &= ~
|
|
863
|
+
this._trackEpoch = u.UNINITIALIZED, this._trackCount = 0, this.flags &= ~F;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
_handleAsyncComputation(e) {
|
|
867
|
-
this.flags = (this.flags |
|
|
867
|
+
this.flags = (this.flags | M) & ~(A | j | N | P), this._notifySubscribers(void 0, void 0), this._promiseId = (this._promiseId + 1) % l.MAX_PROMISE_ID;
|
|
868
868
|
let t = this._promiseId;
|
|
869
869
|
e.then((e) => {
|
|
870
870
|
if (t === this._promiseId) {
|
|
@@ -875,7 +875,7 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
875
875
|
}
|
|
876
876
|
_handleError(e, t, n = !1) {
|
|
877
877
|
let r = y(e, h, t);
|
|
878
|
-
if ((!this.isRejected || this._error !== r) && (this.version =
|
|
878
|
+
if ((!this.isRejected || this._error !== r) && (this.version = me(this.version)), this._error = r, this.flags = this.flags & ~(A | j | M | N) | P | Te, this._onError) try {
|
|
879
879
|
this._onError(r);
|
|
880
880
|
} catch (e) {
|
|
881
881
|
console.error(v.CALLBACK_ERROR_IN_ERROR_HANDLER, e);
|
|
@@ -884,24 +884,24 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
884
884
|
}
|
|
885
885
|
_finalizeResolution(e) {
|
|
886
886
|
let t = this.flags;
|
|
887
|
-
((t &
|
|
887
|
+
((t & N) === 0 || !this._equal(this._value, e)) && (this.version = me(this.version)), this._value = e, this._error = null, this.flags = (t | N) & ~(A | j | M | P | Te);
|
|
888
888
|
}
|
|
889
889
|
execute() {
|
|
890
890
|
this._markDirty();
|
|
891
891
|
}
|
|
892
892
|
_markDirty() {
|
|
893
893
|
let e = this.flags;
|
|
894
|
-
(e & (
|
|
894
|
+
(e & (F | j)) === 0 && (this.flags = e | j, w.trackUpdate(this.id, w.getDebugName(this)), this._notifySubscribers(void 0, void 0));
|
|
895
895
|
}
|
|
896
896
|
_deepDirtyCheck() {
|
|
897
897
|
let e = this._deps;
|
|
898
|
-
return
|
|
898
|
+
return O(() => {
|
|
899
899
|
let t = e.size;
|
|
900
900
|
for (let n = 0; n < t; n++) {
|
|
901
901
|
let t = e.getAt(n);
|
|
902
902
|
if (t == null) continue;
|
|
903
903
|
let r = t.node;
|
|
904
|
-
if ((r.flags &
|
|
904
|
+
if ((r.flags & I) !== 0) try {
|
|
905
905
|
r.value;
|
|
906
906
|
} catch {
|
|
907
907
|
f && console.warn(`[atom-effect] Dependency #${r.id} threw during dirty check`);
|
|
@@ -912,12 +912,12 @@ var { IDLE: j, DIRTY: M, PENDING: N, RESOLVED: P, REJECTED: F, HAS_ERROR: we, RE
|
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
};
|
|
915
|
-
function
|
|
916
|
-
return new
|
|
915
|
+
function L(e, t = {}) {
|
|
916
|
+
return new Oe(e, t);
|
|
917
917
|
}
|
|
918
|
-
var ke = class extends
|
|
918
|
+
var ke = class extends de {
|
|
919
919
|
constructor(e, t = {}) {
|
|
920
|
-
super(), this[
|
|
920
|
+
super(), this[T] = E.Effect, this._cleanup = null, this._deps = new ie(), this._currentEpoch = u.UNINITIALIZED, this._lastFlushEpoch = u.UNINITIALIZED, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? o.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? o.MAX_EXECUTIONS_PER_EFFECT, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => k.schedule(this), w.attachDebugInfo(this, "effect", this.id, t.name);
|
|
921
921
|
}
|
|
922
922
|
run() {
|
|
923
923
|
if (this.isDisposed) throw new g(v.EFFECT_DISPOSED);
|
|
@@ -956,13 +956,13 @@ var ke = class extends ue {
|
|
|
956
956
|
let n;
|
|
957
957
|
try {
|
|
958
958
|
let t = e.subscribe(this._notifyCallback);
|
|
959
|
-
n = new
|
|
959
|
+
n = new le(e, e.version, t);
|
|
960
960
|
} catch (t) {
|
|
961
961
|
let r = y(t, g, v.EFFECT_EXECUTION_FAILED);
|
|
962
962
|
if (console.error(r), this._onError) try {
|
|
963
963
|
this._onError(r);
|
|
964
964
|
} catch {}
|
|
965
|
-
n = new
|
|
965
|
+
n = new le(e, e.version, void 0);
|
|
966
966
|
}
|
|
967
967
|
this._deps.insertNew(t, n);
|
|
968
968
|
}
|
|
@@ -971,11 +971,11 @@ var ke = class extends ue {
|
|
|
971
971
|
if ((t & (r.DISPOSED | r.EXECUTING)) !== 0) return;
|
|
972
972
|
let n = this._deps;
|
|
973
973
|
if (!e && n.size > 0 && !this._isDirty()) return;
|
|
974
|
-
this._checkInfiniteLoops(),
|
|
974
|
+
this._checkInfiniteLoops(), w.trackUpdate(this.id, w.getDebugName(this)), this.flags = t | r.EXECUTING, this._execCleanup(), this._currentEpoch = pe(), this._trackCount = 0, n.prepareTracking(), this._hotIndex = -1;
|
|
975
975
|
let i = !1;
|
|
976
976
|
try {
|
|
977
|
-
let e =
|
|
978
|
-
n.truncateFrom(this._trackCount), i = !0,
|
|
977
|
+
let e = D.run(this, this._fn);
|
|
978
|
+
n.truncateFrom(this._trackCount), i = !0, ce(e) ? this._handleAsyncResult(e) : this._cleanup = typeof e == "function" ? e : null;
|
|
979
979
|
} catch (e) {
|
|
980
980
|
if (!i) try {
|
|
981
981
|
n.truncateFrom(this._trackCount);
|
|
@@ -1002,8 +1002,8 @@ var ke = class extends ue {
|
|
|
1002
1002
|
}, (e) => t === this._execId && this._handleExecutionError(e));
|
|
1003
1003
|
}
|
|
1004
1004
|
_deepDirtyCheck() {
|
|
1005
|
-
let e =
|
|
1006
|
-
|
|
1005
|
+
let e = D.current;
|
|
1006
|
+
D.current = null;
|
|
1007
1007
|
let t = this._deps;
|
|
1008
1008
|
try {
|
|
1009
1009
|
let e = t.size;
|
|
@@ -1015,7 +1015,7 @@ var ke = class extends ue {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
return !1;
|
|
1017
1017
|
} finally {
|
|
1018
|
-
|
|
1018
|
+
D.current = e;
|
|
1019
1019
|
}
|
|
1020
1020
|
}
|
|
1021
1021
|
_tryPullComputed(e) {
|
|
@@ -1037,8 +1037,8 @@ var ke = class extends ue {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
_checkInfiniteLoops() {
|
|
1040
|
-
let e =
|
|
1041
|
-
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"),
|
|
1040
|
+
let e = ve();
|
|
1041
|
+
this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), xe() > o.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, f && this._checkFrequencyLimit();
|
|
1042
1042
|
}
|
|
1043
1043
|
_checkFrequencyLimit() {
|
|
1044
1044
|
if (!Number.isFinite(this._maxExecutions)) return;
|
|
@@ -1059,7 +1059,7 @@ var ke = class extends ue {
|
|
|
1059
1059
|
return (this.flags & r.EXECUTING) !== 0;
|
|
1060
1060
|
}
|
|
1061
1061
|
_throwInfiniteLoopError(e) {
|
|
1062
|
-
let t = new g(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
1062
|
+
let t = new g(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${he}`);
|
|
1063
1063
|
throw this.dispose(), console.error(t), t;
|
|
1064
1064
|
}
|
|
1065
1065
|
_handleExecutionError(e, t = v.EFFECT_EXECUTION_FAILED) {
|
|
@@ -1076,13 +1076,16 @@ function R(e, t = {}) {
|
|
|
1076
1076
|
let n = new ke(e, t);
|
|
1077
1077
|
return n.execute(), n;
|
|
1078
1078
|
}
|
|
1079
|
-
|
|
1079
|
+
var Ae = /^(?:__proto__|constructor|prototype)$/;
|
|
1080
|
+
function je(e, t, n, r) {
|
|
1080
1081
|
if (n === t.length) return r;
|
|
1081
|
-
let i = t[n]
|
|
1082
|
+
let i = t[n];
|
|
1083
|
+
if (Ae.test(i)) return e;
|
|
1084
|
+
let a = typeof e == "object" && e ? e : {}, o = a[i], s = je(o, t, n + 1, r);
|
|
1082
1085
|
if (Object.is(o, s)) return e;
|
|
1083
1086
|
if (Array.isArray(a)) {
|
|
1084
|
-
let e = a.slice(), t = Number
|
|
1085
|
-
return Number.
|
|
1087
|
+
let e = a.slice(), t = Number(i);
|
|
1088
|
+
return i.trim() !== "" && Number.isInteger(t) && t >= 0 ? e[t] = s : e[i] = s, e;
|
|
1086
1089
|
}
|
|
1087
1090
|
return {
|
|
1088
1091
|
...a,
|
|
@@ -1093,11 +1096,13 @@ function z(e, t) {
|
|
|
1093
1096
|
let n = e, r = t.length;
|
|
1094
1097
|
for (let e = 0; e < r; e++) {
|
|
1095
1098
|
if (n == null) return;
|
|
1096
|
-
|
|
1099
|
+
let r = t[e];
|
|
1100
|
+
if (Ae.test(r)) return;
|
|
1101
|
+
n = n[r];
|
|
1097
1102
|
}
|
|
1098
1103
|
return n;
|
|
1099
1104
|
}
|
|
1100
|
-
function
|
|
1105
|
+
function Me(e, t) {
|
|
1101
1106
|
let n = t.includes(".") ? t.split(".") : [t], r = /* @__PURE__ */ new Set(), i = () => {
|
|
1102
1107
|
r.forEach((e) => e()), r.clear();
|
|
1103
1108
|
};
|
|
@@ -1106,7 +1111,7 @@ function je(e, t) {
|
|
|
1106
1111
|
return z(e.value, n);
|
|
1107
1112
|
},
|
|
1108
1113
|
set value(t) {
|
|
1109
|
-
let r = e.peek(), i =
|
|
1114
|
+
let r = e.peek(), i = je(r, n, 0, t);
|
|
1110
1115
|
i !== r && (e.value = i);
|
|
1111
1116
|
},
|
|
1112
1117
|
peek: () => z(e.peek(), n),
|
|
@@ -1122,11 +1127,11 @@ function je(e, t) {
|
|
|
1122
1127
|
subscriberCount: () => r.size,
|
|
1123
1128
|
dispose: i,
|
|
1124
1129
|
[Symbol.dispose]: i,
|
|
1125
|
-
[
|
|
1130
|
+
[T]: E.Atom | E.Writable
|
|
1126
1131
|
};
|
|
1127
1132
|
}
|
|
1128
|
-
var
|
|
1129
|
-
function
|
|
1133
|
+
var Ne = (e, t) => Me(e, t), Pe = (e) => (t) => Me(e, t), Fe = (e) => typeof e == "object" && !!e, Ie = (e) => oe(e), Le = (e) => (Fe(e) || typeof e == "function") && typeof e.then == "function";
|
|
1134
|
+
function Re(e) {
|
|
1130
1135
|
let { localName: t, id: n, className: r } = e, i = t;
|
|
1131
1136
|
n && (i += `#${n}`);
|
|
1132
1137
|
let a = typeof r == "string" ? r : r.baseVal;
|
|
@@ -1138,9 +1143,9 @@ function Le(e) {
|
|
|
1138
1143
|
return o && typeof o == "string" && o !== "text" && (i += `.${o}`), i;
|
|
1139
1144
|
}
|
|
1140
1145
|
var B = Object.prototype.hasOwnProperty;
|
|
1141
|
-
function
|
|
1146
|
+
function ze(e, t) {
|
|
1142
1147
|
if (e === t) return !0;
|
|
1143
|
-
if (!
|
|
1148
|
+
if (!Fe(e) || !Fe(t)) return !1;
|
|
1144
1149
|
let n = e, r = t, i = Object.keys(n), a = Object.keys(r);
|
|
1145
1150
|
if (i.length !== a.length) return !1;
|
|
1146
1151
|
for (let e of i) if (!B.call(r, e) || !Object.is(n[e], r[e])) return !1;
|
|
@@ -1153,26 +1158,26 @@ var V = {
|
|
|
1153
1158
|
BINDING: "[atom-binding]",
|
|
1154
1159
|
LIST: "[atom-list]",
|
|
1155
1160
|
MOUNT: "[atom-mount]"
|
|
1156
|
-
},
|
|
1161
|
+
}, Be = Object.freeze({
|
|
1157
1162
|
mode: "hash",
|
|
1158
1163
|
basePath: "",
|
|
1159
1164
|
autoBindLinks: !1,
|
|
1160
1165
|
activeClass: "active"
|
|
1161
|
-
}),
|
|
1166
|
+
}), Ve = Object.freeze({
|
|
1162
1167
|
EVENT: "input",
|
|
1163
1168
|
DEBOUNCE: 0
|
|
1164
|
-
}),
|
|
1169
|
+
}), He = Object.freeze({ HIGHLIGHT_DURATION_MS: 500 }), Ue = new Set([
|
|
1165
1170
|
"input",
|
|
1166
1171
|
"select",
|
|
1167
1172
|
"textarea"
|
|
1168
|
-
]),
|
|
1173
|
+
]), We = new Set([
|
|
1169
1174
|
"innerHTML",
|
|
1170
1175
|
"outerHTML",
|
|
1171
1176
|
"srcdoc",
|
|
1172
1177
|
"__proto__",
|
|
1173
1178
|
"constructor",
|
|
1174
1179
|
"prototype"
|
|
1175
|
-
]),
|
|
1180
|
+
]), Ge = "(?:j\\s*a\\s*v\\s*a\\s*s\\s*c\\s*r\\s*i\\s*p\\s*t|v\\s*b\\s*s\\s*c\\s*r\\s*i\\s*p\\s*t)", H = {
|
|
1176
1181
|
ROUTE: {
|
|
1177
1182
|
NOT_FOUND: (e) => `Route "${e}" not found and no notFound route configured`,
|
|
1178
1183
|
TEMPLATE_NOT_FOUND: (e) => `Template "${e}" not found`,
|
|
@@ -1200,25 +1205,25 @@ var V = {
|
|
|
1200
1205
|
CLEANUP_ERROR: (e) => `Cleanup error${e ? ` in component <${e}>` : ""}`
|
|
1201
1206
|
},
|
|
1202
1207
|
CORE: { EFFECT_DISPOSE_ERROR: (e) => `Effect dispose error${e ? `: ${e}` : ""}` }
|
|
1203
|
-
},
|
|
1208
|
+
}, Ke = "atom-debug-highlight", U = "data-atom-debug", qe = typeof window < "u", Je = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), Xe = !1, Ze = () => `${He.HIGHLIGHT_DURATION_MS / 1e3}s`, Qe = () => `
|
|
1204
1209
|
[${U}] {
|
|
1205
|
-
transition: outline ${
|
|
1210
|
+
transition: outline ${Ze()} ease-out;
|
|
1206
1211
|
}
|
|
1207
|
-
.${
|
|
1212
|
+
.${Ke} {
|
|
1208
1213
|
outline: 2px solid rgba(255, 68, 68, 0.8);
|
|
1209
1214
|
outline-offset: 1px;
|
|
1210
1215
|
}
|
|
1211
1216
|
`.replace(/\s+/g, " ");
|
|
1212
|
-
function
|
|
1213
|
-
if (
|
|
1217
|
+
function $e() {
|
|
1218
|
+
if (Xe || !qe) return;
|
|
1214
1219
|
if (document.querySelector(`style[${U}]`)) {
|
|
1215
|
-
|
|
1220
|
+
Xe = !0;
|
|
1216
1221
|
return;
|
|
1217
1222
|
}
|
|
1218
1223
|
let e = document.createElement("style");
|
|
1219
|
-
e.setAttribute(U, ""), e.textContent =
|
|
1224
|
+
e.setAttribute(U, ""), e.textContent = Qe(), document.head.appendChild(e), Xe = !0;
|
|
1220
1225
|
}
|
|
1221
|
-
function
|
|
1226
|
+
function et() {
|
|
1222
1227
|
let e = globalThis;
|
|
1223
1228
|
if (e.__ATOM_DEBUG__ !== void 0) return !!e.__ATOM_DEBUG__;
|
|
1224
1229
|
try {
|
|
@@ -1226,7 +1231,7 @@ function $e() {
|
|
|
1226
1231
|
} catch {}
|
|
1227
1232
|
return e.process?.env?.NODE_ENV !== "production" && e.process?.env?.NODE_ENV !== void 0 ? !0 : e.__DEV__ === void 0 ? !1 : !!e.__DEV__;
|
|
1228
1233
|
}
|
|
1229
|
-
var
|
|
1234
|
+
var tt = class {
|
|
1230
1235
|
constructor() {
|
|
1231
1236
|
this.enabled = !0;
|
|
1232
1237
|
}
|
|
@@ -1248,20 +1253,20 @@ var et = class {
|
|
|
1248
1253
|
domUpdated(e, t, n, r) {
|
|
1249
1254
|
if (!this.enabled) return;
|
|
1250
1255
|
let i = "jquery" in t ? t[0] : t;
|
|
1251
|
-
i && i.nodeType === 1 && i.isConnected && (console.log(`${e} DOM updated: ${
|
|
1256
|
+
i && i.nodeType === 1 && i.isConnected && (console.log(`${e} DOM updated: ${Re(i)}.${n} =`, r), this._triggerVisualHighlight(i));
|
|
1252
1257
|
}
|
|
1253
1258
|
_triggerVisualHighlight(e) {
|
|
1254
1259
|
let t = globalThis, n = t.requestAnimationFrame, r = t.cancelAnimationFrame;
|
|
1255
|
-
if (!
|
|
1256
|
-
|
|
1257
|
-
let i =
|
|
1258
|
-
i !== void 0 && typeof r == "function" && r(i), a !== void 0 && (clearTimeout(a),
|
|
1259
|
-
|
|
1260
|
-
e.classList.remove(
|
|
1261
|
-
},
|
|
1260
|
+
if (!qe || typeof n != "function") return;
|
|
1261
|
+
$e();
|
|
1262
|
+
let i = Ye.get(e), a = Je.get(e);
|
|
1263
|
+
i !== void 0 && typeof r == "function" && r(i), a !== void 0 && (clearTimeout(a), Je.delete(e)), e.hasAttribute(U) || e.setAttribute(U, ""), Ye.set(e, n(() => {
|
|
1264
|
+
Ye.delete(e), e.isConnected && (e.classList.add(Ke), Je.set(e, setTimeout(() => {
|
|
1265
|
+
e.classList.remove(Ke), Je.delete(e);
|
|
1266
|
+
}, He.HIGHLIGHT_DURATION_MS)));
|
|
1262
1267
|
}));
|
|
1263
1268
|
}
|
|
1264
|
-
}, W =
|
|
1269
|
+
}, W = et() ? new tt() : {
|
|
1265
1270
|
enabled: !1,
|
|
1266
1271
|
log: () => {},
|
|
1267
1272
|
atomChanged: () => {},
|
|
@@ -1272,10 +1277,10 @@ var et = class {
|
|
|
1272
1277
|
};
|
|
1273
1278
|
//#endregion
|
|
1274
1279
|
//#region src/core/namespace.ts
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1280
|
+
function nt(e, t) {
|
|
1281
|
+
return we(e, t);
|
|
1277
1282
|
}
|
|
1278
|
-
Object.defineProperty(
|
|
1283
|
+
Object.defineProperty(nt, "debug", {
|
|
1279
1284
|
enumerable: !0,
|
|
1280
1285
|
configurable: !0,
|
|
1281
1286
|
get: () => W.enabled,
|
|
@@ -1283,24 +1288,24 @@ Object.defineProperty(tt, "debug", {
|
|
|
1283
1288
|
W.enabled = e;
|
|
1284
1289
|
}
|
|
1285
1290
|
});
|
|
1286
|
-
var
|
|
1291
|
+
var rt = () => Promise.resolve();
|
|
1287
1292
|
e.extend({
|
|
1288
|
-
atom:
|
|
1289
|
-
computed:
|
|
1293
|
+
atom: nt,
|
|
1294
|
+
computed: L,
|
|
1290
1295
|
effect: R,
|
|
1291
|
-
batch:
|
|
1292
|
-
untracked:
|
|
1293
|
-
isAtom:
|
|
1294
|
-
isComputed:
|
|
1295
|
-
isReactive:
|
|
1296
|
-
nextTick:
|
|
1297
|
-
atomLens:
|
|
1298
|
-
composeLens:
|
|
1299
|
-
lensFor:
|
|
1296
|
+
batch: Se,
|
|
1297
|
+
untracked: O,
|
|
1298
|
+
isAtom: oe,
|
|
1299
|
+
isComputed: se,
|
|
1300
|
+
isReactive: Ie,
|
|
1301
|
+
nextTick: rt,
|
|
1302
|
+
atomLens: Me,
|
|
1303
|
+
composeLens: Ne,
|
|
1304
|
+
lensFor: Pe
|
|
1300
1305
|
});
|
|
1301
1306
|
//#endregion
|
|
1302
1307
|
//#region src/utils/pool.ts
|
|
1303
|
-
var
|
|
1308
|
+
var it = class {
|
|
1304
1309
|
constructor(e = 50, t = 256) {
|
|
1305
1310
|
this.limit = e, this.capacity = t, this.pool = [];
|
|
1306
1311
|
}
|
|
@@ -1315,7 +1320,7 @@ var rt = class {
|
|
|
1315
1320
|
reset() {
|
|
1316
1321
|
this.pool.length = 0;
|
|
1317
1322
|
}
|
|
1318
|
-
},
|
|
1323
|
+
}, at = class {
|
|
1319
1324
|
constructor(e, t, n = 64) {
|
|
1320
1325
|
this.factory = e, this.reset = t, this.limit = n, this.pool = [];
|
|
1321
1326
|
}
|
|
@@ -1331,7 +1336,7 @@ var rt = class {
|
|
|
1331
1336
|
get size() {
|
|
1332
1337
|
return this.pool.length;
|
|
1333
1338
|
}
|
|
1334
|
-
},
|
|
1339
|
+
}, ot = 128, st = new it(ot), ct = new it(ot), lt = new at(() => ({
|
|
1335
1340
|
effects: void 0,
|
|
1336
1341
|
cleanups: void 0,
|
|
1337
1342
|
componentCleanup: void 0
|
|
@@ -1341,14 +1346,14 @@ var rt = class {
|
|
|
1341
1346
|
for (let n = 0; n < t; n++) try {
|
|
1342
1347
|
e.effects[n].dispose();
|
|
1343
1348
|
} catch {}
|
|
1344
|
-
|
|
1349
|
+
st.release(e.effects), e.effects = void 0;
|
|
1345
1350
|
}
|
|
1346
1351
|
if (e.cleanups) {
|
|
1347
1352
|
let t = e.cleanups.length;
|
|
1348
1353
|
for (let n = 0; n < t; n++) try {
|
|
1349
1354
|
e.cleanups[n]();
|
|
1350
1355
|
} catch {}
|
|
1351
|
-
|
|
1356
|
+
ct.release(e.cleanups), e.cleanups = void 0;
|
|
1352
1357
|
}
|
|
1353
1358
|
if (e.componentCleanup) {
|
|
1354
1359
|
try {
|
|
@@ -1356,9 +1361,9 @@ var rt = class {
|
|
|
1356
1361
|
} catch {}
|
|
1357
1362
|
e.componentCleanup = void 0;
|
|
1358
1363
|
}
|
|
1359
|
-
},
|
|
1360
|
-
function
|
|
1361
|
-
|
|
1364
|
+
}, ot), ut = !1;
|
|
1365
|
+
function dt() {
|
|
1366
|
+
ut || typeof document < "u" && document.body && (ut = !0, pt(document.body));
|
|
1362
1367
|
}
|
|
1363
1368
|
var G = "_aes-bound", K = new class {
|
|
1364
1369
|
constructor() {
|
|
@@ -1377,17 +1382,17 @@ var G = "_aes-bound", K = new class {
|
|
|
1377
1382
|
return this.ignoredNodes.has(e);
|
|
1378
1383
|
}
|
|
1379
1384
|
getOrCreateRecord(e) {
|
|
1380
|
-
|
|
1385
|
+
dt();
|
|
1381
1386
|
let t = this.records.get(e);
|
|
1382
|
-
return t || (t =
|
|
1387
|
+
return t || (t = lt.acquire(), this.records.set(e, t), e.classList.add(G)), t;
|
|
1383
1388
|
}
|
|
1384
1389
|
trackEffect(e, t) {
|
|
1385
1390
|
let n = this.getOrCreateRecord(e);
|
|
1386
|
-
n.effects ||=
|
|
1391
|
+
n.effects ||= st.acquire(), n.effects.push(t);
|
|
1387
1392
|
}
|
|
1388
1393
|
trackCleanup(e, t) {
|
|
1389
1394
|
let n = this.getOrCreateRecord(e);
|
|
1390
|
-
n.cleanups ||=
|
|
1395
|
+
n.cleanups ||= ct.acquire(), n.cleanups.push(t);
|
|
1391
1396
|
}
|
|
1392
1397
|
setComponentCleanup(e, t) {
|
|
1393
1398
|
this.getOrCreateRecord(e).componentCleanup = t;
|
|
@@ -1403,7 +1408,7 @@ var G = "_aes-bound", K = new class {
|
|
|
1403
1408
|
return;
|
|
1404
1409
|
}
|
|
1405
1410
|
this.records.delete(t), t.classList.remove(G);
|
|
1406
|
-
let r =
|
|
1411
|
+
let r = Re(t);
|
|
1407
1412
|
if (W.cleanup(V.BINDING, r), n.componentCleanup) {
|
|
1408
1413
|
try {
|
|
1409
1414
|
n.componentCleanup();
|
|
@@ -1418,7 +1423,7 @@ var G = "_aes-bound", K = new class {
|
|
|
1418
1423
|
} catch (e) {
|
|
1419
1424
|
W.error(V.BINDING, H.CORE.EFFECT_DISPOSE_ERROR(r), e);
|
|
1420
1425
|
}
|
|
1421
|
-
|
|
1426
|
+
st.release(n.effects), n.effects = void 0;
|
|
1422
1427
|
}
|
|
1423
1428
|
if (n.cleanups) {
|
|
1424
1429
|
for (let e of n.cleanups) try {
|
|
@@ -1426,9 +1431,9 @@ var G = "_aes-bound", K = new class {
|
|
|
1426
1431
|
} catch (e) {
|
|
1427
1432
|
W.error(V.BINDING, H.BINDING.CLEANUP_ERROR(r), e);
|
|
1428
1433
|
}
|
|
1429
|
-
|
|
1434
|
+
ct.release(n.cleanups), n.cleanups = void 0;
|
|
1430
1435
|
}
|
|
1431
|
-
|
|
1436
|
+
lt.release(n);
|
|
1432
1437
|
}
|
|
1433
1438
|
cleanupDescendants(e) {
|
|
1434
1439
|
let t = "getElementsByClassName" in e ? e.getElementsByClassName(G) : e.querySelectorAll(`.${G}`), n = t.length;
|
|
@@ -1443,9 +1448,9 @@ var G = "_aes-bound", K = new class {
|
|
|
1443
1448
|
cleanupTree(e) {
|
|
1444
1449
|
(e.nodeType === 1 || e.nodeType === 11) && this.cleanupDescendants(e), this.cleanup(e);
|
|
1445
1450
|
}
|
|
1446
|
-
}(),
|
|
1447
|
-
function
|
|
1448
|
-
if (
|
|
1451
|
+
}(), ft = /* @__PURE__ */ new Map();
|
|
1452
|
+
function pt(e) {
|
|
1453
|
+
if (ft.has(e)) return;
|
|
1449
1454
|
let t = new MutationObserver((e) => {
|
|
1450
1455
|
let t = K;
|
|
1451
1456
|
for (let n = 0, r = e.length; n < r; n++) {
|
|
@@ -1461,78 +1466,81 @@ function dt(e) {
|
|
|
1461
1466
|
t.observe(e, {
|
|
1462
1467
|
childList: !0,
|
|
1463
1468
|
subtree: !0
|
|
1464
|
-
}),
|
|
1469
|
+
}), ft.set(e, t);
|
|
1465
1470
|
}
|
|
1466
|
-
function
|
|
1467
|
-
|
|
1471
|
+
function mt() {
|
|
1472
|
+
ft.forEach((e) => e.disconnect()), ft.clear();
|
|
1468
1473
|
}
|
|
1469
1474
|
//#endregion
|
|
1470
1475
|
//#region src/core/dom.ts
|
|
1471
|
-
function
|
|
1476
|
+
function ht(e) {
|
|
1472
1477
|
return {
|
|
1473
1478
|
el: e,
|
|
1474
1479
|
trackCleanup: (t) => K.trackCleanup(e, t)
|
|
1475
1480
|
};
|
|
1476
1481
|
}
|
|
1477
|
-
function
|
|
1478
|
-
|
|
1479
|
-
|
|
1482
|
+
function q(e, t, n = {}) {
|
|
1483
|
+
let r = !!n.needsCtx, i = e.length;
|
|
1484
|
+
for (let n = 0; n < i; n++) {
|
|
1485
|
+
let i = e[n];
|
|
1480
1486
|
if (i?.nodeType === 1) {
|
|
1481
1487
|
let e = i;
|
|
1482
|
-
t(
|
|
1488
|
+
t(r ? ht(e) : null, e);
|
|
1483
1489
|
} else i && W.log(V.BINDING, `Skipping non-Element node (nodeType=${i.nodeType})`);
|
|
1484
1490
|
}
|
|
1485
1491
|
return e;
|
|
1486
1492
|
}
|
|
1487
|
-
function
|
|
1488
|
-
|
|
1493
|
+
function gt(e) {
|
|
1494
|
+
if (!Array.isArray(e) || e.length !== 2) return [e];
|
|
1495
|
+
let t = e[1];
|
|
1496
|
+
return typeof t == "function" || typeof t == "object" && t && !Array.isArray(t) && !("value" in t) && !("then" in t) ? e : [e];
|
|
1489
1497
|
}
|
|
1490
1498
|
//#endregion
|
|
1491
1499
|
//#region src/core/jquery-patch.ts
|
|
1492
|
-
var
|
|
1500
|
+
var J = Symbol.for("atom-effect-internal"), _t = Symbol.for("atom-effect-wrapped"), vt = /* @__PURE__ */ new WeakMap(), Y = null, yt = (e) => {
|
|
1493
1501
|
let t = e;
|
|
1494
|
-
if (t[
|
|
1495
|
-
let n = t[
|
|
1502
|
+
if (t[J]) return e;
|
|
1503
|
+
let n = t[_t];
|
|
1496
1504
|
if (n) return n;
|
|
1497
|
-
if (n =
|
|
1505
|
+
if (n = vt.get(e), !n) {
|
|
1498
1506
|
n = function(...t) {
|
|
1499
|
-
return
|
|
1500
|
-
}, n[
|
|
1507
|
+
return Se(() => e.apply(this, t));
|
|
1508
|
+
}, n[J] = !0, vt.set(e, n);
|
|
1501
1509
|
try {
|
|
1502
|
-
t[
|
|
1510
|
+
t[_t] = n;
|
|
1503
1511
|
} catch {}
|
|
1504
1512
|
}
|
|
1505
1513
|
return n;
|
|
1506
|
-
},
|
|
1507
|
-
function
|
|
1514
|
+
}, bt = (e) => e[_t] ?? vt.get(e) ?? e;
|
|
1515
|
+
function xt(e) {
|
|
1508
1516
|
let t = {};
|
|
1509
1517
|
for (let n in e) {
|
|
1510
1518
|
let r = e[n];
|
|
1511
|
-
typeof r == "function" ? t[n] =
|
|
1519
|
+
typeof r == "function" ? t[n] = yt(r) : r !== void 0 && (t[n] = r);
|
|
1512
1520
|
}
|
|
1513
1521
|
return t;
|
|
1514
1522
|
}
|
|
1515
|
-
function
|
|
1523
|
+
function St(e) {
|
|
1516
1524
|
let t = {};
|
|
1517
1525
|
for (let n in e) {
|
|
1518
1526
|
let r = e[n];
|
|
1519
|
-
typeof r == "function" ? t[n] =
|
|
1527
|
+
typeof r == "function" ? t[n] = bt(r) : t[n] = r;
|
|
1520
1528
|
}
|
|
1521
1529
|
return t;
|
|
1522
1530
|
}
|
|
1523
|
-
function
|
|
1531
|
+
function Ct(e, t, n) {
|
|
1524
1532
|
let r = e[0];
|
|
1525
1533
|
if (r && typeof r == "object") e[0] = t(r);
|
|
1526
1534
|
else for (let t = 1; t < e.length; t++) typeof e[t] == "function" && (e[t] = n(e[t]));
|
|
1527
1535
|
}
|
|
1528
|
-
function
|
|
1536
|
+
function wt(e) {
|
|
1529
1537
|
return function(...t) {
|
|
1530
|
-
return
|
|
1538
|
+
return Ct(t, xt, yt), e.apply(this, t) ?? this;
|
|
1531
1539
|
};
|
|
1532
1540
|
}
|
|
1533
|
-
function
|
|
1534
|
-
if (
|
|
1535
|
-
|
|
1541
|
+
function Tt() {
|
|
1542
|
+
if (Y !== null) return;
|
|
1543
|
+
Y = {
|
|
1536
1544
|
on: e.fn.on,
|
|
1537
1545
|
one: e.fn.one,
|
|
1538
1546
|
off: e.fn.off,
|
|
@@ -1540,7 +1548,7 @@ function Ct() {
|
|
|
1540
1548
|
empty: e.fn.empty,
|
|
1541
1549
|
detach: e.fn.detach
|
|
1542
1550
|
};
|
|
1543
|
-
let t =
|
|
1551
|
+
let t = Y;
|
|
1544
1552
|
e.fn.remove = function(e) {
|
|
1545
1553
|
let n = e ? this.filter(e) : this, r = n.length;
|
|
1546
1554
|
for (let e = 0; e < r; e++) {
|
|
@@ -1562,66 +1570,66 @@ function Ct() {
|
|
|
1562
1570
|
t && K.keep(t);
|
|
1563
1571
|
}
|
|
1564
1572
|
return t.detach.call(this, e) ?? this;
|
|
1565
|
-
}, e.fn.on =
|
|
1566
|
-
return
|
|
1573
|
+
}, e.fn.on = wt(t.on), e.fn.one = wt(t.one), e.fn.off = function(...e) {
|
|
1574
|
+
return Ct(e, St, bt), t.off.apply(this, e) ?? this;
|
|
1567
1575
|
};
|
|
1568
1576
|
}
|
|
1569
|
-
function
|
|
1570
|
-
|
|
1577
|
+
function Et() {
|
|
1578
|
+
Y !== null && (e.fn.on = Y.on, e.fn.one = Y.one, e.fn.off = Y.off, e.fn.remove = Y.remove, e.fn.empty = Y.empty, e.fn.detach = Y.detach, Y = null);
|
|
1571
1579
|
}
|
|
1572
1580
|
//#endregion
|
|
1573
1581
|
//#region src/types.ts
|
|
1574
|
-
var
|
|
1582
|
+
var X = /* @__PURE__ */ function(e) {
|
|
1575
1583
|
return e[e.None = 0] = "None", e[e.Focused = 1] = "Focused", e[e.Composing = 2] = "Composing", e[e.SyncingToAtom = 4] = "SyncingToAtom", e[e.SyncingToDom = 8] = "SyncingToDom", e[e.Busy = 14] = "Busy", e;
|
|
1576
|
-
}({}),
|
|
1577
|
-
function
|
|
1578
|
-
e[
|
|
1584
|
+
}({}), Dt = 0;
|
|
1585
|
+
function Ot(e) {
|
|
1586
|
+
e[J] = !0;
|
|
1579
1587
|
}
|
|
1580
|
-
var
|
|
1588
|
+
var kt = class {
|
|
1581
1589
|
constructor(e, t, n) {
|
|
1582
1590
|
this.flags = 0, this.timeoutId = void 0, this.handleCompositionStart = () => {
|
|
1583
|
-
this.flags |=
|
|
1591
|
+
this.flags |= X.Composing;
|
|
1584
1592
|
}, this.handleCompositionEnd = () => {
|
|
1585
|
-
this.flags &= ~
|
|
1593
|
+
this.flags &= ~X.Composing, this.handleInput();
|
|
1586
1594
|
}, this.handleFocus = () => {
|
|
1587
|
-
this.flags |=
|
|
1595
|
+
this.flags |= X.Focused;
|
|
1588
1596
|
}, this.handleBlur = () => {
|
|
1589
|
-
this.flags &= ~
|
|
1590
|
-
let e = !!(this.flags &
|
|
1591
|
-
this.flags &= ~
|
|
1597
|
+
this.flags &= ~X.Focused;
|
|
1598
|
+
let e = !!(this.flags & X.Composing);
|
|
1599
|
+
this.flags &= ~X.Composing;
|
|
1592
1600
|
let t = this.flushPendingDebounce();
|
|
1593
1601
|
e && !t && this.syncAtomFromDom(), this.normalizeDomValue();
|
|
1594
1602
|
}, this.syncDomFromAtom = () => {
|
|
1595
1603
|
let e = this.atom.value;
|
|
1596
|
-
this.flags &
|
|
1604
|
+
this.flags & X.Busy || O(() => {
|
|
1597
1605
|
if (this.isDomUpToDate(e)) return;
|
|
1598
1606
|
let t = this.format(e);
|
|
1599
|
-
this.flags |=
|
|
1607
|
+
this.flags |= X.SyncingToDom;
|
|
1600
1608
|
try {
|
|
1601
1609
|
this.writeDom(e, t), W.domUpdated(V.BINDING, this.$el, "val", t);
|
|
1602
1610
|
} finally {
|
|
1603
|
-
this.flags &= ~
|
|
1611
|
+
this.flags &= ~X.SyncingToDom;
|
|
1604
1612
|
}
|
|
1605
1613
|
});
|
|
1606
1614
|
}, this.cleanup = () => {
|
|
1607
1615
|
this.$el.off(this.ns), clearTimeout(this.timeoutId), this.timeoutId = void 0;
|
|
1608
1616
|
}, this.$el = e, this.el = e[0], this.atom = t;
|
|
1609
1617
|
let r = this.el.tagName;
|
|
1610
|
-
this.isMultipleSelect = r === "SELECT" && this.el.multiple, this.isTextControl = r === "INPUT" || r === "TEXTAREA", this.ns = `.atomBind-${++
|
|
1618
|
+
this.isMultipleSelect = r === "SELECT" && this.el.multiple, this.isTextControl = r === "INPUT" || r === "TEXTAREA", this.ns = `.atomBind-${++Dt}`;
|
|
1611
1619
|
let { parse: i, format: a, equal: o, readDom: s, getRawDom: c, writeDom: l } = this.initStrategies(n);
|
|
1612
1620
|
this.parse = i, this.format = a, this.equal = o, this.readDom = s, this.getRawDom = c, this.writeDom = l;
|
|
1613
1621
|
let u = n.debounce ?? 0;
|
|
1614
1622
|
u > 0 ? this.handleInput = () => {
|
|
1615
|
-
this.flags &
|
|
1623
|
+
this.flags & X.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), u));
|
|
1616
1624
|
} : this.handleInput = () => {
|
|
1617
|
-
this.flags &
|
|
1625
|
+
this.flags & X.Composing || this.syncAtomFromDom();
|
|
1618
1626
|
}, [
|
|
1619
1627
|
this.handleFocus,
|
|
1620
1628
|
this.handleBlur,
|
|
1621
1629
|
this.handleCompositionStart,
|
|
1622
1630
|
this.handleCompositionEnd,
|
|
1623
1631
|
this.handleInput
|
|
1624
|
-
].forEach(
|
|
1632
|
+
].forEach(Ot), this.bindEvents(n.event ?? Ve.EVENT);
|
|
1625
1633
|
}
|
|
1626
1634
|
initStrategies(e) {
|
|
1627
1635
|
let t = e.parse ?? ((e) => e), n = e.equal ?? Object.is;
|
|
@@ -1656,7 +1664,7 @@ var Dt = class {
|
|
|
1656
1664
|
}
|
|
1657
1665
|
writeTextValue(e) {
|
|
1658
1666
|
let t = this.el;
|
|
1659
|
-
if (this.flags &
|
|
1667
|
+
if (this.flags & X.Focused) try {
|
|
1660
1668
|
let n = t.selectionStart, r = t.selectionEnd;
|
|
1661
1669
|
t.value = e;
|
|
1662
1670
|
let i = e.length;
|
|
@@ -1674,15 +1682,15 @@ var Dt = class {
|
|
|
1674
1682
|
this.isMultipleSelect ? this.equal(n, e) || this.writeDom(e, t) : n !== t && this.writeDom(e, t);
|
|
1675
1683
|
}
|
|
1676
1684
|
syncAtomFromDom() {
|
|
1677
|
-
if (!(this.flags &
|
|
1678
|
-
this.flags |=
|
|
1685
|
+
if (!(this.flags & X.Busy)) {
|
|
1686
|
+
this.flags |= X.SyncingToAtom;
|
|
1679
1687
|
try {
|
|
1680
1688
|
let e = this.readDom();
|
|
1681
1689
|
this.equal(this.atom.peek(), e) || (this.atom.value = e);
|
|
1682
1690
|
} catch (e) {
|
|
1683
1691
|
W.warn(V.BINDING, H.BINDING.PARSE_ERROR(e instanceof Error ? e.message : String(e)), e);
|
|
1684
1692
|
} finally {
|
|
1685
|
-
this.flags &= ~
|
|
1693
|
+
this.flags &= ~X.SyncingToAtom;
|
|
1686
1694
|
}
|
|
1687
1695
|
}
|
|
1688
1696
|
}
|
|
@@ -1690,7 +1698,7 @@ var Dt = class {
|
|
|
1690
1698
|
let t = this.getRawDom();
|
|
1691
1699
|
if (this.isMultipleSelect) return this.equal(t, e);
|
|
1692
1700
|
if (t === this.format(e)) return !0;
|
|
1693
|
-
if (this.flags &
|
|
1701
|
+
if (this.flags & X.Focused) try {
|
|
1694
1702
|
return this.equal(this.readDom(), e);
|
|
1695
1703
|
} catch {}
|
|
1696
1704
|
return !1;
|
|
@@ -1700,8 +1708,8 @@ var Dt = class {
|
|
|
1700
1708
|
this.$el.on(`focus${t}`, this.handleFocus).on(`blur${t}`, this.handleBlur).on(`compositionstart${t}`, this.handleCompositionStart).on(`compositionend${t}`, this.handleCompositionEnd).on(n, this.handleInput);
|
|
1701
1709
|
}
|
|
1702
1710
|
};
|
|
1703
|
-
function
|
|
1704
|
-
let r = new
|
|
1711
|
+
function At(e, t, n) {
|
|
1712
|
+
let r = new kt(e, t, n);
|
|
1705
1713
|
return {
|
|
1706
1714
|
fx: R(r.syncDomFromAtom),
|
|
1707
1715
|
cleanup: () => {
|
|
@@ -1711,7 +1719,7 @@ function Ot(e, t, n) {
|
|
|
1711
1719
|
}
|
|
1712
1720
|
//#endregion
|
|
1713
1721
|
//#region src/core/effect-factory.ts
|
|
1714
|
-
function
|
|
1722
|
+
function jt(e, t, n, r) {
|
|
1715
1723
|
let i = {
|
|
1716
1724
|
latestId: 0,
|
|
1717
1725
|
isDisposed: !1
|
|
@@ -1720,8 +1728,8 @@ function kt(e, t, n, r) {
|
|
|
1720
1728
|
i.isDisposed = !0;
|
|
1721
1729
|
});
|
|
1722
1730
|
let a = (t) => {
|
|
1723
|
-
if (!
|
|
1724
|
-
i.latestId++,
|
|
1731
|
+
if (!Le(t)) {
|
|
1732
|
+
i.latestId++, O(() => {
|
|
1725
1733
|
try {
|
|
1726
1734
|
n(t), W.domUpdated(V.BINDING, e, r, t);
|
|
1727
1735
|
} catch (e) {
|
|
@@ -1732,7 +1740,7 @@ function kt(e, t, n, r) {
|
|
|
1732
1740
|
}
|
|
1733
1741
|
let a = ++i.latestId;
|
|
1734
1742
|
t.then((t) => {
|
|
1735
|
-
a === i.latestId && !i.isDisposed &&
|
|
1743
|
+
a === i.latestId && !i.isDisposed && O(() => {
|
|
1736
1744
|
try {
|
|
1737
1745
|
n(t), W.domUpdated(V.BINDING, e, `${r} (async)`, t);
|
|
1738
1746
|
} catch (e) {
|
|
@@ -1742,15 +1750,15 @@ function kt(e, t, n, r) {
|
|
|
1742
1750
|
}).catch((e) => {
|
|
1743
1751
|
a === i.latestId && !i.isDisposed && W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1744
1752
|
});
|
|
1745
|
-
}, o =
|
|
1753
|
+
}, o = Ie(t);
|
|
1746
1754
|
o || typeof t == "function" ? K.trackEffect(e, R(() => {
|
|
1747
1755
|
a(o ? t.value : t());
|
|
1748
1756
|
}, { name: r })) : a(t);
|
|
1749
1757
|
}
|
|
1750
|
-
function
|
|
1758
|
+
function Mt(e, t, n, r) {
|
|
1751
1759
|
let i = Object.keys(t), a = [], o = [], s = [], c = {};
|
|
1752
1760
|
for (let e = 0, n = i.length; e < n; e++) {
|
|
1753
|
-
let n = i[e], r = t[n], l =
|
|
1761
|
+
let n = i[e], r = t[n], l = Ie(r);
|
|
1754
1762
|
l || typeof r == "function" ? (a.push(n), o.push(r), s.push(l)) : c[n] = r;
|
|
1755
1763
|
}
|
|
1756
1764
|
let l = {
|
|
@@ -1765,14 +1773,14 @@ function At(e, t, n, r) {
|
|
|
1765
1773
|
let a = [], o = {}, s = i.length;
|
|
1766
1774
|
for (let e = 0; e < s; e++) {
|
|
1767
1775
|
let n = i[e], r = t[n];
|
|
1768
|
-
if (
|
|
1776
|
+
if (Le(r) && B.call(l.cache, n)) {
|
|
1769
1777
|
let e = l.cache[n];
|
|
1770
1778
|
if (e.p === r) {
|
|
1771
1779
|
o[n] = e.v;
|
|
1772
1780
|
continue;
|
|
1773
1781
|
}
|
|
1774
1782
|
}
|
|
1775
|
-
|
|
1783
|
+
Le(r) ? a.push(r.then((e) => (l.cache[n] = {
|
|
1776
1784
|
p: r,
|
|
1777
1785
|
v: e
|
|
1778
1786
|
}, {
|
|
@@ -1788,7 +1796,7 @@ function At(e, t, n, r) {
|
|
|
1788
1796
|
let t = i[e];
|
|
1789
1797
|
o[t.key] = t.val;
|
|
1790
1798
|
}
|
|
1791
|
-
|
|
1799
|
+
O(() => {
|
|
1792
1800
|
try {
|
|
1793
1801
|
n(o), W.domUpdated(V.BINDING, e, `${r} (async)`, o);
|
|
1794
1802
|
} catch (e) {
|
|
@@ -1799,7 +1807,7 @@ function At(e, t, n, r) {
|
|
|
1799
1807
|
}, (e) => {
|
|
1800
1808
|
t === l.latestId && !l.isDisposed && W.error(V.BINDING, H.BINDING.UPDATER_ERROR(r), e);
|
|
1801
1809
|
});
|
|
1802
|
-
} else l.latestId++,
|
|
1810
|
+
} else l.latestId++, O(() => {
|
|
1803
1811
|
try {
|
|
1804
1812
|
n(o), W.domUpdated(V.BINDING, e, r, o);
|
|
1805
1813
|
} catch (e) {
|
|
@@ -1818,7 +1826,7 @@ function At(e, t, n, r) {
|
|
|
1818
1826
|
}
|
|
1819
1827
|
//#endregion
|
|
1820
1828
|
//#region src/utils/sanitize.ts
|
|
1821
|
-
var
|
|
1829
|
+
var Nt = new Set([
|
|
1822
1830
|
"href",
|
|
1823
1831
|
"src",
|
|
1824
1832
|
"action",
|
|
@@ -1839,26 +1847,27 @@ var jt = new Set([
|
|
|
1839
1847
|
"marker-start",
|
|
1840
1848
|
"marker-mid",
|
|
1841
1849
|
"marker-end",
|
|
1842
|
-
"clip-path"
|
|
1843
|
-
|
|
1850
|
+
"clip-path",
|
|
1851
|
+
"srcdoc"
|
|
1852
|
+
]), Pt = {
|
|
1844
1853
|
colon: ":",
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
},
|
|
1848
|
-
function
|
|
1849
|
-
return e.replace(
|
|
1854
|
+
tab: " ",
|
|
1855
|
+
newline: "\n"
|
|
1856
|
+
}, Ft = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, It = /&(colon|tab|newline);?/gi, Lt = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, Rt = /[<&\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/, zt = /<\?[\s\S]*?\?>/g, Bt = /(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi, Vt = /\bon\w+\s*=/gim, Ht = `${Ge}\\s*:`, Ut = new RegExp(Ht, "gi"), Wt = RegExp(`(?:^|url\\s*\\(\\s*["']?)\\s*${Ht}`, "i"), Gt = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, Kt = `(?:expression\\s*\\(|behavior\\s*:|-moz-binding\\s*:|url\\s*\\(\\s*["']?\\s*${Ht}(?!image\\/)|data\\s*:\\s*(?!image\\/))`, qt = new RegExp(Kt, "gim"), Jt = new RegExp(Kt, "im");
|
|
1857
|
+
function Yt(e) {
|
|
1858
|
+
return typeof e == "string" ? e.replace(Ft, (e, t, n) => {
|
|
1850
1859
|
let r = t ? parseInt(t, 16) : parseInt(n, 10);
|
|
1851
1860
|
return r >= 0 && r <= 1114111 ? String.fromCodePoint(r) : "";
|
|
1852
|
-
}).replace(
|
|
1861
|
+
}).replace(It, (e, t) => Pt[t.toLowerCase()] ?? "").replace(Lt, "") : "";
|
|
1853
1862
|
}
|
|
1854
|
-
function
|
|
1855
|
-
return
|
|
1863
|
+
function Xt(e) {
|
|
1864
|
+
return Wt.test(e) || Gt.test(e);
|
|
1856
1865
|
}
|
|
1857
|
-
function
|
|
1858
|
-
return
|
|
1866
|
+
function Zt(e) {
|
|
1867
|
+
return Bt.test(e) || Vt.test(e) || Ut.test(e);
|
|
1859
1868
|
}
|
|
1860
|
-
function
|
|
1861
|
-
if (
|
|
1869
|
+
function Qt(e) {
|
|
1870
|
+
if (Rt.test(e) || e.includes(":")) return !0;
|
|
1862
1871
|
let t = e.toLowerCase(), n = t.indexOf("on");
|
|
1863
1872
|
for (; n !== -1 && n < e.length - 2;) {
|
|
1864
1873
|
let e = t.charCodeAt(n + 2);
|
|
@@ -1867,56 +1876,61 @@ function Xt(e) {
|
|
|
1867
1876
|
}
|
|
1868
1877
|
return !1;
|
|
1869
1878
|
}
|
|
1870
|
-
function
|
|
1879
|
+
function Z(e) {
|
|
1871
1880
|
if (!e) return "";
|
|
1872
1881
|
let t = String(e);
|
|
1873
|
-
if (!
|
|
1874
|
-
let n =
|
|
1875
|
-
if (n.
|
|
1876
|
-
n = n.replace(
|
|
1882
|
+
if (!Qt(t)) return t;
|
|
1883
|
+
let n = Yt(t);
|
|
1884
|
+
if (n.includes("<")) {
|
|
1885
|
+
n = n.replace(zt, "");
|
|
1877
1886
|
let e;
|
|
1878
1887
|
do
|
|
1879
|
-
e = n, n = n.replace(
|
|
1888
|
+
e = n, n = n.replace(Bt, "");
|
|
1880
1889
|
while (n !== e);
|
|
1881
1890
|
}
|
|
1882
|
-
return n.replace(
|
|
1891
|
+
return n.replace(qt, "data-unsafe-css:").replace(Ut, "data-unsafe-protocol:").replace(Gt, "data-unsafe-protocol:").replace(Vt, "data-unsafe-attr=");
|
|
1883
1892
|
}
|
|
1884
|
-
var
|
|
1893
|
+
var $t = (e, t) => {
|
|
1885
1894
|
let n = e.toLowerCase();
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
return t === void 0 ? (t = e.includes("-") ? e.replace(/-./g, (e) => e[1].toUpperCase()) : e, $t.set(e, t), t) : t;
|
|
1891
|
-
}
|
|
1892
|
-
var tn = /* @__PURE__ */ new WeakMap();
|
|
1895
|
+
if (!Nt.has(n)) return !1;
|
|
1896
|
+
let r = Yt(t);
|
|
1897
|
+
return n === "srcdoc" ? Zt(r) : Xt(r);
|
|
1898
|
+
}, en = (e) => Jt.test(Yt(e)), tn = /* @__PURE__ */ new Map();
|
|
1893
1899
|
function nn(e) {
|
|
1894
1900
|
let t = tn.get(e);
|
|
1895
|
-
return t
|
|
1901
|
+
return t === void 0 ? (t = e.includes("-") ? e.replace(/-./g, (e) => e[1].toUpperCase()) : e, tn.set(e, t), t) : t;
|
|
1902
|
+
}
|
|
1903
|
+
var rn = /* @__PURE__ */ new WeakMap();
|
|
1904
|
+
function an(e) {
|
|
1905
|
+
let t = rn.get(e);
|
|
1906
|
+
return t || (t = L(() => {
|
|
1896
1907
|
let t = e.value;
|
|
1897
|
-
return
|
|
1898
|
-
}),
|
|
1908
|
+
return Le(t) ? t.then((e) => Z(e)) : Z(t);
|
|
1909
|
+
}), rn.set(e, t)), t;
|
|
1910
|
+
}
|
|
1911
|
+
function on(e, t) {
|
|
1912
|
+
return e.toLowerCase().startsWith("on") ? (console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_EVENT_HANDLER(e)}`), !1) : t && We.has(e) ? (console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_PROP(e)}`), !1) : !0;
|
|
1899
1913
|
}
|
|
1900
|
-
function
|
|
1901
|
-
|
|
1914
|
+
function sn({ el: e }, t, n) {
|
|
1915
|
+
jt(e, t, (t) => {
|
|
1902
1916
|
let r = n ? n(t) : String(t ?? "");
|
|
1903
1917
|
e.textContent !== r && (e.textContent = r);
|
|
1904
1918
|
}, "text");
|
|
1905
1919
|
}
|
|
1906
|
-
function
|
|
1907
|
-
let n =
|
|
1908
|
-
|
|
1909
|
-
let a = n === t ?
|
|
1920
|
+
function cn({ el: e }, t) {
|
|
1921
|
+
let n = oe(t) ? an(t) : t, r = null;
|
|
1922
|
+
jt(e, n, (i) => {
|
|
1923
|
+
let a = n === t ? Z(i) : i;
|
|
1910
1924
|
r !== a && (K.cleanupDescendants(e), e.innerHTML = a, r = a);
|
|
1911
1925
|
}, "html");
|
|
1912
1926
|
}
|
|
1913
|
-
function
|
|
1927
|
+
function ln({ el: e }, t) {
|
|
1914
1928
|
let n = {}, r = {};
|
|
1915
1929
|
for (let e in t) if (B.call(t, e)) {
|
|
1916
1930
|
let t = e.trim();
|
|
1917
1931
|
n[e] = /\s/.test(t) ? t.split(/\s+/).filter(Boolean) : [t];
|
|
1918
1932
|
}
|
|
1919
|
-
|
|
1933
|
+
Mt(e, t, (t) => {
|
|
1920
1934
|
for (let i in t) {
|
|
1921
1935
|
let a = !!t[i];
|
|
1922
1936
|
if (r[i] === a) continue;
|
|
@@ -1934,37 +1948,30 @@ function on({ el: e }, t) {
|
|
|
1934
1948
|
}
|
|
1935
1949
|
}, "class");
|
|
1936
1950
|
}
|
|
1937
|
-
function
|
|
1951
|
+
function un({ el: e }, t) {
|
|
1938
1952
|
let n = e.style, r = {}, i = {}, a = {};
|
|
1939
1953
|
for (let e in t) if (B.call(t, e)) {
|
|
1940
1954
|
let n = t[e], [a, o] = Array.isArray(n) ? n : [n, ""];
|
|
1941
1955
|
r[e] = a, i[e] = {
|
|
1942
|
-
camel:
|
|
1956
|
+
camel: nn(e),
|
|
1943
1957
|
unit: o
|
|
1944
1958
|
};
|
|
1945
1959
|
}
|
|
1946
|
-
|
|
1960
|
+
Mt(e, r, (e) => {
|
|
1947
1961
|
for (let t in e) {
|
|
1948
1962
|
let r = i[t], o = e[t], s = r.unit ? `${o}${r.unit}` : String(o), c = r.camel;
|
|
1949
|
-
a[t] !== s && (
|
|
1963
|
+
a[t] !== s && (en(s) || (n[c] = s), a[t] = s);
|
|
1950
1964
|
}
|
|
1951
1965
|
}, "css");
|
|
1952
1966
|
}
|
|
1953
|
-
function
|
|
1967
|
+
function dn({ el: e }, t) {
|
|
1954
1968
|
let n = {}, r = {}, i = {};
|
|
1955
1969
|
for (let a in t) {
|
|
1956
|
-
if (!B.call(t, a)) continue;
|
|
1970
|
+
if (!B.call(t, a) || !on(a, !1)) continue;
|
|
1957
1971
|
let o = a.toLowerCase();
|
|
1958
|
-
|
|
1959
|
-
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_EVENT_HANDLER(a)}`);
|
|
1960
|
-
continue;
|
|
1961
|
-
}
|
|
1962
|
-
n[a] = t[a], r[a] = {
|
|
1963
|
-
isAria: o.startsWith("aria-"),
|
|
1964
|
-
isUrl: jt.has(o)
|
|
1965
|
-
}, i[a] = e.getAttribute(a);
|
|
1972
|
+
n[a] = t[a], r[a] = { isAria: o.startsWith("aria-") }, i[a] = e.getAttribute(a);
|
|
1966
1973
|
}
|
|
1967
|
-
|
|
1974
|
+
Mt(e, n, (t) => {
|
|
1968
1975
|
for (let n in t) {
|
|
1969
1976
|
let a = r[n], o = t[n];
|
|
1970
1977
|
if (o == null || o === !1 && !a.isAria) {
|
|
@@ -1972,7 +1979,7 @@ function cn({ el: e }, t) {
|
|
|
1972
1979
|
continue;
|
|
1973
1980
|
}
|
|
1974
1981
|
let s = o === !0 ? a.isAria ? "true" : n : String(o);
|
|
1975
|
-
if (
|
|
1982
|
+
if ($t(n, s)) {
|
|
1976
1983
|
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_PROTOCOL(n)}`);
|
|
1977
1984
|
continue;
|
|
1978
1985
|
}
|
|
@@ -1980,81 +1987,73 @@ function cn({ el: e }, t) {
|
|
|
1980
1987
|
}
|
|
1981
1988
|
}, "attr");
|
|
1982
1989
|
}
|
|
1983
|
-
function
|
|
1984
|
-
let n = e.el, r = {}, i = {}
|
|
1985
|
-
for (let e in t)
|
|
1986
|
-
|
|
1987
|
-
let n = e.toLowerCase();
|
|
1988
|
-
if (n.startsWith("on") || Ue.has(e)) {
|
|
1989
|
-
console.warn(`${V.BINDING} ${n.startsWith("on") ? H.SECURITY.BLOCKED_EVENT_HANDLER(e) : H.SECURITY.BLOCKED_PROP(e)}`);
|
|
1990
|
-
continue;
|
|
1991
|
-
}
|
|
1992
|
-
r[e] = t[e], i[e] = { isUrl: jt.has(n) };
|
|
1993
|
-
}
|
|
1994
|
-
At(e.el, r, (e) => {
|
|
1990
|
+
function fn(e, t) {
|
|
1991
|
+
let n = e.el, r = {}, i = {};
|
|
1992
|
+
for (let e in t) B.call(t, e) && on(e, !0) && (r[e] = t[e]);
|
|
1993
|
+
Mt(e.el, r, (e) => {
|
|
1995
1994
|
for (let t in e) {
|
|
1996
1995
|
let r = e[t];
|
|
1997
|
-
if (
|
|
1998
|
-
if (typeof r == "string" &&
|
|
1996
|
+
if (i[t] !== r) {
|
|
1997
|
+
if (typeof r == "string" && $t(t, r)) {
|
|
1999
1998
|
console.warn(`${V.BINDING} ${H.SECURITY.BLOCKED_PROTOCOL(t)}`);
|
|
2000
1999
|
continue;
|
|
2001
2000
|
}
|
|
2002
|
-
n[t] = r,
|
|
2001
|
+
n[t] = r, i[t] = r;
|
|
2003
2002
|
}
|
|
2004
2003
|
}
|
|
2005
2004
|
}, "prop");
|
|
2006
2005
|
}
|
|
2007
|
-
function
|
|
2006
|
+
function pn({ el: e }, t, n) {
|
|
2008
2007
|
let r = e.style.display === "none" ? "" : e.style.display;
|
|
2009
|
-
|
|
2008
|
+
jt(e, t, (t) => {
|
|
2010
2009
|
n === !!t ? e.style.display !== "none" && (r = e.style.display, e.style.display = "none") : e.style.display === "none" && (e.style.display = r);
|
|
2011
2010
|
}, n ? "hide" : "show");
|
|
2012
2011
|
}
|
|
2013
|
-
function
|
|
2012
|
+
function mn(t, n, r = {}) {
|
|
2014
2013
|
let i = t.el.tagName.toLowerCase();
|
|
2015
|
-
if (!
|
|
2014
|
+
if (!Ue.has(i)) {
|
|
2016
2015
|
console.warn(`${V.BINDING} ${H.BINDING.INVALID_INPUT_ELEMENT(i)}`);
|
|
2017
2016
|
return;
|
|
2018
2017
|
}
|
|
2019
|
-
let { fx: a, cleanup: o } =
|
|
2018
|
+
let { fx: a, cleanup: o } = At(e(t.el), n, r);
|
|
2020
2019
|
K.trackEffect(t.el, a), t.trackCleanup(o);
|
|
2021
2020
|
}
|
|
2022
|
-
function
|
|
2021
|
+
function hn(t) {
|
|
2023
2022
|
t.type === "radio" && t.name && (t.form ? e(t.form) : e(document)).find(`input[type="radio"][name="${e.escapeSelector(t.name)}"]`).not(t).trigger("change.atomRadioSync");
|
|
2024
2023
|
}
|
|
2025
|
-
function
|
|
2024
|
+
function gn(t, n) {
|
|
2026
2025
|
let r = t.el, i = e(r), a = () => {
|
|
2027
|
-
n.peek() !== r.checked && (n.value = r.checked,
|
|
2026
|
+
n.peek() !== r.checked && (n.value = r.checked, hn(r));
|
|
2028
2027
|
};
|
|
2029
|
-
a[
|
|
2028
|
+
a[J] = !0, i.on("change change.atomRadioSync", a), t.trackCleanup(() => i.off("change change.atomRadioSync", a)), K.trackEffect(r, R(() => {
|
|
2030
2029
|
let e = !!n.value;
|
|
2031
|
-
|
|
2032
|
-
r.checked !== e && (r.checked = e, W.domUpdated(V.BINDING, r, "checked", e), e &&
|
|
2030
|
+
O(() => {
|
|
2031
|
+
r.checked !== e && (r.checked = e, W.domUpdated(V.BINDING, r, "checked", e), e && hn(r));
|
|
2033
2032
|
});
|
|
2034
2033
|
}));
|
|
2035
2034
|
}
|
|
2036
|
-
function
|
|
2035
|
+
function _n(t, n) {
|
|
2037
2036
|
let r = e(t.el);
|
|
2038
2037
|
r.on(n), t.trackCleanup(() => r.off(n));
|
|
2039
2038
|
}
|
|
2040
|
-
function
|
|
2039
|
+
function vn({ el: t, trackCleanup: n }, r, i) {
|
|
2041
2040
|
let a = e(t);
|
|
2042
2041
|
a.on(r, i), n(() => a.off(r, i));
|
|
2043
2042
|
}
|
|
2044
|
-
function
|
|
2043
|
+
function yn(e) {
|
|
2045
2044
|
K.cleanupTree(e);
|
|
2046
2045
|
}
|
|
2047
2046
|
//#endregion
|
|
2048
2047
|
//#region src/bindings/form.ts
|
|
2049
|
-
var
|
|
2048
|
+
var bn = "input, select, textarea", xn = class {
|
|
2050
2049
|
constructor(e, t, n = {}) {
|
|
2051
2050
|
this.form = e, this.atom = t, this.options = n, this.fieldMap = /* @__PURE__ */ new Map(), this.fields = [], this.elementNames = /* @__PURE__ */ new WeakMap(), this.isSyncingFromLeaf = !1, this.init();
|
|
2052
2051
|
}
|
|
2053
2052
|
init() {
|
|
2054
2053
|
let e = R(() => {
|
|
2055
2054
|
let e = this.atom.value;
|
|
2056
|
-
this.isSyncingFromLeaf || !this.fields.length ||
|
|
2057
|
-
|
|
2055
|
+
this.isSyncingFromLeaf || !this.fields.length || Se(() => {
|
|
2056
|
+
O(() => {
|
|
2058
2057
|
for (let t = 0; t < this.fields.length; t++) {
|
|
2059
2058
|
let n = this.fields[t], r = z(e, n.parts);
|
|
2060
2059
|
Object.is(n.atom.peek(), r) || (n.atom.value = r);
|
|
@@ -2065,7 +2064,7 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2065
2064
|
K.trackEffect(this.form, e), this.bindElement(this.form), this.setupObserver();
|
|
2066
2065
|
}
|
|
2067
2066
|
bindElement(e) {
|
|
2068
|
-
let t = e.matches?.(
|
|
2067
|
+
let t = e.matches?.(bn) ? [e] : e.querySelectorAll?.(bn) || [];
|
|
2069
2068
|
for (let e = 0, n = t.length; e < n; e++) this.bindControl(t[e]);
|
|
2070
2069
|
}
|
|
2071
2070
|
bindControl(e) {
|
|
@@ -2076,8 +2075,8 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2076
2075
|
if (r !== void 0 && r !== n && K.cleanup(t), this.elementNames.has(t) && r === n) return;
|
|
2077
2076
|
let i = this.acquireField(n);
|
|
2078
2077
|
this.elementNames.set(t, n);
|
|
2079
|
-
let a =
|
|
2080
|
-
a.trackCleanup(() => this.releaseField(t, n)), t instanceof HTMLInputElement && (t.type === "radio" || t.type === "checkbox") ? this.bindToggle(a, i.atom, t.value, t.type === "checkbox") :
|
|
2078
|
+
let a = ht(t);
|
|
2079
|
+
a.trackCleanup(() => this.releaseField(t, n)), t instanceof HTMLInputElement && (t.type === "radio" || t.type === "checkbox") ? this.bindToggle(a, i.atom, t.value, t.type === "checkbox") : mn(a, i.atom, this.options);
|
|
2081
2080
|
}
|
|
2082
2081
|
bindToggle(t, n, r, i) {
|
|
2083
2082
|
let a = t.el, o = () => {
|
|
@@ -2087,7 +2086,7 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2087
2086
|
a.checked ? t.add(r) : t.delete(r), n.value = Array.from(t);
|
|
2088
2087
|
} else n.value = i ? a.checked : r;
|
|
2089
2088
|
};
|
|
2090
|
-
o[
|
|
2089
|
+
o[J] = !0, e(a).on("change", o), t.trackCleanup(() => e(a).off("change", o)), K.trackEffect(a, R(() => {
|
|
2091
2090
|
let e = n.value, t = i ? Array.isArray(e) ? e.some((e) => String(e) === r) : !!e : String(e) === r;
|
|
2092
2091
|
a.checked !== t && (a.checked = t);
|
|
2093
2092
|
}));
|
|
@@ -2095,7 +2094,7 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2095
2094
|
acquireField(e) {
|
|
2096
2095
|
let t = this.fieldMap.get(e);
|
|
2097
2096
|
if (t) return t.refCount++, t;
|
|
2098
|
-
let n = e.replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean), r =
|
|
2097
|
+
let n = e.replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean), r = we(z(this.atom.peek(), n));
|
|
2099
2098
|
return t = {
|
|
2100
2099
|
atom: r,
|
|
2101
2100
|
parts: n,
|
|
@@ -2105,11 +2104,11 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2105
2104
|
}, t.effect = R(() => {
|
|
2106
2105
|
let t = r.value;
|
|
2107
2106
|
this.options.transform && (t = this.options.transform(e, t));
|
|
2108
|
-
let i = this.atom.peek(), a =
|
|
2107
|
+
let i = this.atom.peek(), a = je(i, n, 0, t);
|
|
2109
2108
|
if (a !== i) {
|
|
2110
2109
|
this.isSyncingFromLeaf = !0;
|
|
2111
2110
|
try {
|
|
2112
|
-
this.atom.value = a, this.options.onChange &&
|
|
2111
|
+
this.atom.value = a, this.options.onChange && O(() => this.options.onChange(e, t));
|
|
2113
2112
|
} finally {
|
|
2114
2113
|
this.isSyncingFromLeaf = !1;
|
|
2115
2114
|
}
|
|
@@ -2143,74 +2142,74 @@ var _n = "input, select, textarea", vn = class {
|
|
|
2143
2142
|
}), K.trackCleanup(this.form, () => e.disconnect());
|
|
2144
2143
|
}
|
|
2145
2144
|
};
|
|
2146
|
-
function
|
|
2147
|
-
new
|
|
2145
|
+
function Sn(e, t, n = {}) {
|
|
2146
|
+
new xn(e, t, n);
|
|
2148
2147
|
}
|
|
2149
2148
|
e.fn.atomText = function(e, t) {
|
|
2150
|
-
return
|
|
2149
|
+
return q(this, (n) => sn(n, e, t), { needsCtx: !0 });
|
|
2151
2150
|
}, e.fn.atomHtml = function(e) {
|
|
2152
|
-
return
|
|
2151
|
+
return q(this, (t) => cn(t, e), { needsCtx: !0 });
|
|
2153
2152
|
}, e.fn.atomClass = function(e, t) {
|
|
2154
2153
|
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2155
|
-
return n ?
|
|
2154
|
+
return n ? q(this, (e) => ln(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_CONDITION("atomClass")}`), this);
|
|
2156
2155
|
}, e.fn.atomCss = function(e, t, n) {
|
|
2157
2156
|
let r = typeof e == "string" ? t === void 0 ? null : { [e]: n ? [t, n] : t } : e;
|
|
2158
|
-
return r ?
|
|
2157
|
+
return r ? q(this, (e) => un(e, r), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomCss")}`), this);
|
|
2159
2158
|
}, e.fn.atomAttr = function(e, t) {
|
|
2160
2159
|
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2161
|
-
return n ?
|
|
2160
|
+
return n ? q(this, (e) => dn(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomAttr")}`), this);
|
|
2162
2161
|
}, e.fn.atomProp = function(e, t) {
|
|
2163
2162
|
let n = typeof e == "string" ? t === void 0 ? null : { [e]: t } : e;
|
|
2164
|
-
return n ?
|
|
2163
|
+
return n ? q(this, (e) => fn(e, n), { needsCtx: !0 }) : (console.warn(`${V.BINDING} ${H.BINDING.MISSING_SOURCE("atomProp")}`), this);
|
|
2165
2164
|
}, e.fn.atomShow = function(e) {
|
|
2166
|
-
return
|
|
2165
|
+
return q(this, (t) => pn(t, e, !1), { needsCtx: !0 });
|
|
2167
2166
|
}, e.fn.atomHide = function(e) {
|
|
2168
|
-
return
|
|
2167
|
+
return q(this, (t) => pn(t, e, !0), { needsCtx: !0 });
|
|
2169
2168
|
}, e.fn.atomVal = function(e, t = {}) {
|
|
2170
|
-
return
|
|
2169
|
+
return q(this, (n) => mn(n, e, t), { needsCtx: !0 });
|
|
2171
2170
|
}, e.fn.atomChecked = function(e) {
|
|
2172
|
-
return
|
|
2171
|
+
return q(this, (t) => gn(t, e), { needsCtx: !0 });
|
|
2173
2172
|
}, e.fn.atomForm = function(e, t = {}) {
|
|
2174
|
-
return
|
|
2175
|
-
r instanceof HTMLFormElement ?
|
|
2173
|
+
return q(this, (n, r) => {
|
|
2174
|
+
r instanceof HTMLFormElement ? Sn(r, e, t) : W.log(V.BINDING, "Skipping non-Form element for atomForm");
|
|
2176
2175
|
}, { needsCtx: !1 });
|
|
2177
2176
|
}, e.fn.atomOn = function(e, t) {
|
|
2178
|
-
return
|
|
2177
|
+
return q(this, (n) => vn(n, e, t), { needsCtx: !0 });
|
|
2179
2178
|
};
|
|
2180
|
-
var
|
|
2181
|
-
(e, t) =>
|
|
2182
|
-
(e, t) =>
|
|
2183
|
-
(e, t) =>
|
|
2184
|
-
(e, t) =>
|
|
2185
|
-
(e, t) =>
|
|
2186
|
-
(e, t) =>
|
|
2187
|
-
(e, t) =>
|
|
2188
|
-
(e, t) =>
|
|
2189
|
-
(e, t) =>
|
|
2190
|
-
(e, t) =>
|
|
2179
|
+
var Cn = [
|
|
2180
|
+
(e, t) => sn(e, ...gt(t.text)),
|
|
2181
|
+
(e, t) => cn(e, t.html),
|
|
2182
|
+
(e, t) => ln(e, t.class),
|
|
2183
|
+
(e, t) => un(e, t.css),
|
|
2184
|
+
(e, t) => dn(e, t.attr),
|
|
2185
|
+
(e, t) => fn(e, t.prop),
|
|
2186
|
+
(e, t) => pn(e, t.show, !1),
|
|
2187
|
+
(e, t) => pn(e, t.hide, !0),
|
|
2188
|
+
(e, t) => mn(e, ...gt(t.val)),
|
|
2189
|
+
(e, t) => gn(e, t.checked),
|
|
2191
2190
|
(e, t) => {
|
|
2192
|
-
e.el instanceof HTMLFormElement &&
|
|
2191
|
+
e.el instanceof HTMLFormElement && Sn(e.el, ...gt(t.form));
|
|
2193
2192
|
},
|
|
2194
|
-
(e, t) =>
|
|
2193
|
+
(e, t) => _n(e, t.on)
|
|
2195
2194
|
];
|
|
2196
2195
|
e.fn.atomBind = function(e) {
|
|
2197
2196
|
let t = 0;
|
|
2198
|
-
return e.text !== void 0 && (t |= 1), e.html !== void 0 && (t |= 2), e.class !== void 0 && (t |= 4), e.css !== void 0 && (t |= 8), e.attr !== void 0 && (t |= 16), e.prop !== void 0 && (t |= 32), e.show !== void 0 && (t |= 64), e.hide !== void 0 && (t |= 128), e.val !== void 0 && (t |= 256), e.checked !== void 0 && (t |= 512), e.form !== void 0 && (t |= 1024), e.on !== void 0 && (t |= 2048), t === 0 ? this :
|
|
2197
|
+
return e.text !== void 0 && (t |= 1), e.html !== void 0 && (t |= 2), e.class !== void 0 && (t |= 4), e.css !== void 0 && (t |= 8), e.attr !== void 0 && (t |= 16), e.prop !== void 0 && (t |= 32), e.show !== void 0 && (t |= 64), e.hide !== void 0 && (t |= 128), e.val !== void 0 && (t |= 256), e.checked !== void 0 && (t |= 512), e.form !== void 0 && (t |= 1024), e.on !== void 0 && (t |= 2048), t === 0 ? this : q(this, (n) => {
|
|
2199
2198
|
let r = t;
|
|
2200
2199
|
for (; r > 0;) {
|
|
2201
2200
|
let t = r & -r;
|
|
2202
|
-
|
|
2201
|
+
Cn[31 - Math.clz32(t)](n, e), r ^= t;
|
|
2203
2202
|
}
|
|
2204
2203
|
}, { needsCtx: !0 });
|
|
2205
2204
|
}, e.fn.atomUnbind = function() {
|
|
2206
|
-
return
|
|
2205
|
+
return q(this, (e, t) => yn(t), { needsCtx: !1 });
|
|
2207
2206
|
};
|
|
2208
2207
|
//#endregion
|
|
2209
2208
|
//#region src/bindings/list/utils.ts
|
|
2210
|
-
function
|
|
2209
|
+
function Q(t) {
|
|
2211
2210
|
return t instanceof Element ? e(t) : t;
|
|
2212
2211
|
}
|
|
2213
|
-
function
|
|
2212
|
+
function wn(e, t) {
|
|
2214
2213
|
if (e instanceof Element) t === null ? e.removeAttribute("data-atom-key") : e.setAttribute("data-atom-key", t);
|
|
2215
2214
|
else if (!e.nodeType) {
|
|
2216
2215
|
let n = e;
|
|
@@ -2220,7 +2219,7 @@ function Sn(e, t) {
|
|
|
2220
2219
|
}
|
|
2221
2220
|
}
|
|
2222
2221
|
}
|
|
2223
|
-
function
|
|
2222
|
+
function Tn(e) {
|
|
2224
2223
|
if (e instanceof Element) K.cleanupTree(e);
|
|
2225
2224
|
else for (let t = 0, n = e.length; t < n; t++) {
|
|
2226
2225
|
let n = e[t];
|
|
@@ -2229,7 +2228,7 @@ function Cn(e) {
|
|
|
2229
2228
|
}
|
|
2230
2229
|
//#endregion
|
|
2231
2230
|
//#region src/bindings/list/context.ts
|
|
2232
|
-
var
|
|
2231
|
+
var En = class {
|
|
2233
2232
|
constructor(e, t, n) {
|
|
2234
2233
|
this.$container = e, this.containerSelector = t, this.onRemove = n, this.oldKeys = [], this.oldItems = [], this.oldNodes = [], this.removingKeys = /* @__PURE__ */ new Set(), this.$emptyEl = null, this.keyToIndex = /* @__PURE__ */ new Map(), this.statesBuffer = new Uint8Array(256), this.indicesBuffer = new Int32Array(256);
|
|
2235
2234
|
}
|
|
@@ -2240,7 +2239,7 @@ var wn = class {
|
|
|
2240
2239
|
r instanceof Promise ? r.then(n, n) : n();
|
|
2241
2240
|
}
|
|
2242
2241
|
removeItem(e, t) {
|
|
2243
|
-
|
|
2242
|
+
wn(t, null), this.removingKeys.add(e), this.scheduleRemoval(e, t);
|
|
2244
2243
|
}
|
|
2245
2244
|
dispose() {
|
|
2246
2245
|
this.removingKeys.clear(), this.oldKeys.length = 0, this.oldItems.length = 0, this.oldNodes.length = 0, this.keyToIndex.clear(), this.$emptyEl?.remove(), this.$container.off(".atomList"), this.statesBuffer = new Uint8Array(), this.indicesBuffer = new Int32Array();
|
|
@@ -2251,8 +2250,8 @@ var wn = class {
|
|
|
2251
2250
|
};
|
|
2252
2251
|
//#endregion
|
|
2253
2252
|
//#region src/bindings/list/diff.ts
|
|
2254
|
-
function
|
|
2255
|
-
let { oldKeys: s, oldItems: c, oldNodes: l, removingKeys: u, keyToIndex: d } = e, f = s.length, p = 0, m = f - 1, h = n - 1, g = a ||
|
|
2253
|
+
function Dn(e, t, n, r, i, a, o) {
|
|
2254
|
+
let { oldKeys: s, oldItems: c, oldNodes: l, removingKeys: u, keyToIndex: d } = e, f = s.length, p = 0, m = f - 1, h = n - 1, g = a || ze;
|
|
2256
2255
|
for (; p <= m && p <= h;) {
|
|
2257
2256
|
let e = t[p], n = r(e, p);
|
|
2258
2257
|
if (s[p] !== n || !g(c[p], e) || !l[p]) break;
|
|
@@ -2273,7 +2272,7 @@ function Tn(e, t, n, r, i, a, o) {
|
|
|
2273
2272
|
b.length = n;
|
|
2274
2273
|
let x = o.array.acquire();
|
|
2275
2274
|
x.length = n;
|
|
2276
|
-
let S = e.statesBuffer, C = e.indicesBuffer,
|
|
2275
|
+
let S = e.statesBuffer, C = e.indicesBuffer, ee = o.array.acquire(), w = o.array.acquire(), te = o.array.acquire();
|
|
2277
2276
|
for (let e = 0; e < p; e++) {
|
|
2278
2277
|
let n = s[e];
|
|
2279
2278
|
y[e] = n, b[e] = t[e], x[e] = l[e], S[e] = 3, C[e] = e, v.add(n);
|
|
@@ -2291,11 +2290,11 @@ function Tn(e, t, n, r, i, a, o) {
|
|
|
2291
2290
|
v.add(s);
|
|
2292
2291
|
let f = _.get(s);
|
|
2293
2292
|
if (f === void 0) {
|
|
2294
|
-
|
|
2293
|
+
ee.push(s), w.push(o), te.push(n), C[n] = -1, S[n] = 1;
|
|
2295
2294
|
continue;
|
|
2296
2295
|
}
|
|
2297
2296
|
let p = c[f];
|
|
2298
|
-
x[n] = l[f], !i && p !== o && !(a ? a(p, o) :
|
|
2297
|
+
x[n] = l[f], !i && p !== o && !(a ? a(p, o) : ze(p, o)) ? (ee.push(s), w.push(o), te.push(n), S[n] = 2) : S[n] = 0, C[n] = u.has(s) ? -1 : f;
|
|
2299
2298
|
}
|
|
2300
2299
|
return o.map.release(_), {
|
|
2301
2300
|
newKeys: y,
|
|
@@ -2304,9 +2303,9 @@ function Tn(e, t, n, r, i, a, o) {
|
|
|
2304
2303
|
newNodes: x,
|
|
2305
2304
|
newStates: S,
|
|
2306
2305
|
newIndices: C,
|
|
2307
|
-
trKeys:
|
|
2308
|
-
trItems:
|
|
2309
|
-
trIdxs:
|
|
2306
|
+
trKeys: ee,
|
|
2307
|
+
trItems: w,
|
|
2308
|
+
trIdxs: te,
|
|
2310
2309
|
startIndex: p,
|
|
2311
2310
|
oldEndIndex: m,
|
|
2312
2311
|
newEndIndex: h
|
|
@@ -2314,8 +2313,8 @@ function Tn(e, t, n, r, i, a, o) {
|
|
|
2314
2313
|
}
|
|
2315
2314
|
//#endregion
|
|
2316
2315
|
//#region src/bindings/list/dom.ts
|
|
2317
|
-
var
|
|
2318
|
-
function
|
|
2316
|
+
var On = 0;
|
|
2317
|
+
function kn(e, t, n) {
|
|
2319
2318
|
if (!e) return;
|
|
2320
2319
|
if (e instanceof Element) {
|
|
2321
2320
|
n.insertBefore(e, t);
|
|
@@ -2327,53 +2326,53 @@ function Dn(e, t, n) {
|
|
|
2327
2326
|
r && n.insertBefore(r, t);
|
|
2328
2327
|
}
|
|
2329
2328
|
}
|
|
2330
|
-
function
|
|
2329
|
+
function An(t, n, r, i, a) {
|
|
2331
2330
|
if (t.$emptyEl && n > 0 && (t.$emptyEl.remove(), t.$emptyEl = null), n !== 0) return;
|
|
2332
2331
|
let { oldKeys: o, oldNodes: s, onRemove: c } = t;
|
|
2333
2332
|
if (c) for (let e = 0, n = o.length; e < n; e++) {
|
|
2334
2333
|
let n = o[e];
|
|
2335
|
-
s[e] && t.removeItem(n,
|
|
2334
|
+
s[e] && t.removeItem(n, Q(s[e]));
|
|
2336
2335
|
}
|
|
2337
2336
|
else {
|
|
2338
2337
|
for (let e = 0, n = o.length; e < n; e++) t.removingKeys.delete(o[e]);
|
|
2339
2338
|
r.empty();
|
|
2340
2339
|
}
|
|
2341
|
-
i && !t.$emptyEl && (t.$emptyEl = e(typeof i == "string" ?
|
|
2340
|
+
i && !t.$emptyEl && (t.$emptyEl = e(typeof i == "string" ? Z(i) : i), t.$emptyEl.appendTo(r)), a.release(t.oldKeys), a.release(t.oldItems), a.release(t.oldNodes), t.oldKeys = [], t.oldItems = [], t.oldNodes = [];
|
|
2342
2341
|
}
|
|
2343
|
-
function
|
|
2342
|
+
function jn(t, n, r) {
|
|
2344
2343
|
let { trKeys: i, trItems: a, trIdxs: o, newNodes: s, newStates: c } = t, l = i.length, u = Array(l), d = [], f = 0;
|
|
2345
2344
|
for (let e = 0; e < l; e++) {
|
|
2346
2345
|
let t = n.render(a[e], o[e]);
|
|
2347
2346
|
u[e] = t, typeof t == "string" && (d.push(t), f++);
|
|
2348
2347
|
}
|
|
2349
2348
|
let p = null;
|
|
2350
|
-
if (d.length > 0) if (d.length === 1) p = [
|
|
2349
|
+
if (d.length > 0) if (d.length === 1) p = [Z(d[0])];
|
|
2351
2350
|
else {
|
|
2352
|
-
let e = `<template data-atom-sep="${(
|
|
2353
|
-
p =
|
|
2351
|
+
let e = `<template data-atom-sep="${(On++).toString(36)}"></template>`;
|
|
2352
|
+
p = Z(d.join(e)).split(e);
|
|
2354
2353
|
}
|
|
2355
2354
|
if (r && p && f === l && !n.bind && !n.onAdd && !n.onRemove && !n.events && e.parseHTML(p.join("")).length === l) return p;
|
|
2356
2355
|
let m = 0;
|
|
2357
2356
|
for (let t = 0; t < l; t++) {
|
|
2358
2357
|
let n = u[t], r = e(typeof n == "string" ? e.parseHTML(p[m++]) : n), a = o[t];
|
|
2359
|
-
if (
|
|
2358
|
+
if (wn(r, String(i[t])), c[a] === 2 && s[a]) {
|
|
2360
2359
|
let e = s[a];
|
|
2361
|
-
|
|
2362
|
-
let t =
|
|
2360
|
+
Tn(e);
|
|
2361
|
+
let t = Q(e);
|
|
2363
2362
|
t.first().before(r), t.remove();
|
|
2364
2363
|
}
|
|
2365
2364
|
s[a] = r.length === 1 ? r[0] : r;
|
|
2366
2365
|
}
|
|
2367
2366
|
return null;
|
|
2368
2367
|
}
|
|
2369
|
-
function
|
|
2368
|
+
function Mn(e, t) {
|
|
2370
2369
|
let { startIndex: n, oldEndIndex: r, newKeySet: i } = t;
|
|
2371
2370
|
for (let t = n; t <= r; t++) {
|
|
2372
2371
|
let n = e.oldKeys[t];
|
|
2373
|
-
!i.has(n) && e.oldNodes[t] && e.removeItem(n,
|
|
2372
|
+
!i.has(n) && e.oldNodes[t] && e.removeItem(n, Q(e.oldNodes[t]));
|
|
2374
2373
|
}
|
|
2375
2374
|
}
|
|
2376
|
-
function
|
|
2375
|
+
function Nn(t, n, r, i, a) {
|
|
2377
2376
|
let { newKeys: o, newItems: s, newNodes: c, newStates: l, newIndices: u } = n, d = o.length;
|
|
2378
2377
|
if (a !== null) {
|
|
2379
2378
|
r.innerHTML = a.join("");
|
|
@@ -2393,7 +2392,7 @@ function jn(t, n, r, i, a) {
|
|
|
2393
2392
|
let e = null, t = 2147483647;
|
|
2394
2393
|
for (let n = d - 1; n >= 0; n--) {
|
|
2395
2394
|
let i = u[n], a = c[n];
|
|
2396
|
-
a && (i !== -1 && i < t ? t = i :
|
|
2395
|
+
a && (i !== -1 && i < t ? t = i : kn(a, e, r), e = a instanceof Element ? a : a[0] ?? null);
|
|
2397
2396
|
}
|
|
2398
2397
|
}
|
|
2399
2398
|
for (let e = 0; e < d; e++) {
|
|
@@ -2401,19 +2400,19 @@ function jn(t, n, r, i, a) {
|
|
|
2401
2400
|
if (n !== 3) {
|
|
2402
2401
|
let r = c[e];
|
|
2403
2402
|
if (!r) continue;
|
|
2404
|
-
let a =
|
|
2403
|
+
let a = Q(r), l = s[e];
|
|
2405
2404
|
n === 0 ? i.update?.(a, l, e) : i.bind?.(a, l, e), n === 1 && (i.onAdd?.(a), t.removingKeys.delete(o[e]), W.domUpdated(V.LIST, a, "list.add", l));
|
|
2406
2405
|
}
|
|
2407
2406
|
}
|
|
2408
2407
|
}
|
|
2409
2408
|
//#endregion
|
|
2410
2409
|
//#region src/bindings/list/index.ts
|
|
2411
|
-
var
|
|
2412
|
-
map:
|
|
2413
|
-
set:
|
|
2410
|
+
var Pn = /* @__PURE__ */ new WeakMap(), Fn = new at(() => /* @__PURE__ */ new Map(), (e) => e.clear()), In = new at(() => /* @__PURE__ */ new Set(), (e) => e.clear()), $ = new it(100, 1024), Ln = {
|
|
2411
|
+
map: Fn,
|
|
2412
|
+
set: In,
|
|
2414
2413
|
array: $
|
|
2415
2414
|
};
|
|
2416
|
-
function
|
|
2415
|
+
function Rn(t, n) {
|
|
2417
2416
|
let r = typeof n.key == "function" ? n.key : (e) => e[n.key], i = {
|
|
2418
2417
|
bind: n.bind,
|
|
2419
2418
|
update: n.update,
|
|
@@ -2424,16 +2423,16 @@ function In(t, n) {
|
|
|
2424
2423
|
for (let a = 0, o = this.length; a < o; a++) {
|
|
2425
2424
|
let o = this[a], s = e(o);
|
|
2426
2425
|
s.off(".atomList");
|
|
2427
|
-
let c =
|
|
2426
|
+
let c = Pn.get(o);
|
|
2428
2427
|
c && (c.fx.dispose(), c.ctx.dispose());
|
|
2429
|
-
let l = new
|
|
2428
|
+
let l = new En(s, Re(o), n.onRemove), u = R(() => {
|
|
2430
2429
|
let e = t.value, a = e.length;
|
|
2431
|
-
|
|
2432
|
-
if (
|
|
2430
|
+
O(() => {
|
|
2431
|
+
if (An(l, a, s, n.empty, $), a === 0) return;
|
|
2433
2432
|
W.log(V.LIST, `${l.containerSelector} updating with ${a} items`);
|
|
2434
|
-
let t =
|
|
2435
|
-
if (
|
|
2436
|
-
$.release(l.oldKeys), $.release(l.oldItems), $.release(l.oldNodes), l.oldKeys = t.newKeys, l.oldItems = t.newItems, l.oldNodes = t.newNodes,
|
|
2433
|
+
let t = Dn(l, e, a, r, n.update, n.isEqual, Ln), c = jn(t, n, l.oldKeys.length === 0);
|
|
2434
|
+
if (Mn(l, t), Nn(l, t, o, i, c), n.events) for (let e = t.startIndex; e <= t.oldEndIndex; e++) t.newKeySet.has(l.oldKeys[e]) || l.keyToIndex.delete(l.oldKeys[e]);
|
|
2435
|
+
$.release(l.oldKeys), $.release(l.oldItems), $.release(l.oldNodes), l.oldKeys = t.newKeys, l.oldItems = t.newItems, l.oldNodes = t.newNodes, In.release(t.newKeySet), $.release(t.trKeys), $.release(t.trItems), $.release(t.trIdxs);
|
|
2437
2436
|
});
|
|
2438
2437
|
});
|
|
2439
2438
|
if (l.fx = u, n.events) for (let e in n.events) {
|
|
@@ -2451,43 +2450,43 @@ function In(t, n) {
|
|
|
2451
2450
|
i !== void 0 && a.call(t, l.oldItems[i], i, e);
|
|
2452
2451
|
});
|
|
2453
2452
|
}
|
|
2454
|
-
K.trackEffect(o, u),
|
|
2453
|
+
K.trackEffect(o, u), Pn.set(o, {
|
|
2455
2454
|
fx: u,
|
|
2456
2455
|
ctx: l
|
|
2457
2456
|
}), K.trackCleanup(o, () => {
|
|
2458
|
-
l.dispose(),
|
|
2457
|
+
l.dispose(), Pn.delete(o);
|
|
2459
2458
|
});
|
|
2460
2459
|
}
|
|
2461
2460
|
return this;
|
|
2462
2461
|
}
|
|
2463
|
-
e.fn.atomList =
|
|
2462
|
+
e.fn.atomList = Rn;
|
|
2464
2463
|
//#endregion
|
|
2465
2464
|
//#region src/bindings/mount.ts
|
|
2466
|
-
var
|
|
2465
|
+
var zn = Object.freeze({});
|
|
2467
2466
|
e.fn.atomMount = function(t, n) {
|
|
2468
|
-
let r = n ??
|
|
2469
|
-
return
|
|
2467
|
+
let r = n ?? zn, i = t.name || "Component";
|
|
2468
|
+
return q(this, (n, a) => {
|
|
2470
2469
|
K.cleanupTree(a);
|
|
2471
2470
|
try {
|
|
2472
|
-
let n =
|
|
2471
|
+
let n = O(() => Se(() => t(e(a), r)));
|
|
2473
2472
|
typeof n == "function" && K.setComponentCleanup(a, n);
|
|
2474
2473
|
} catch (e) {
|
|
2475
2474
|
W.error(V.MOUNT, H.MOUNT.ERROR(i), e);
|
|
2476
2475
|
}
|
|
2477
2476
|
});
|
|
2478
2477
|
}, e.fn.atomUnmount = function() {
|
|
2479
|
-
return
|
|
2478
|
+
return q(this, (e, t) => yn(t));
|
|
2480
2479
|
};
|
|
2481
2480
|
//#endregion
|
|
2482
2481
|
//#region src/features/route.ts
|
|
2483
|
-
function
|
|
2482
|
+
function Bn(e, t) {
|
|
2484
2483
|
try {
|
|
2485
2484
|
history.pushState(e, "", t);
|
|
2486
2485
|
} catch (e) {
|
|
2487
2486
|
W.warn(V.ROUTE, "PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.", e);
|
|
2488
2487
|
}
|
|
2489
2488
|
}
|
|
2490
|
-
var
|
|
2489
|
+
var Vn = class {
|
|
2491
2490
|
parseQueryParams(e) {
|
|
2492
2491
|
let t = {};
|
|
2493
2492
|
return e && new URLSearchParams(e).forEach((e, n) => {
|
|
@@ -2496,22 +2495,22 @@ var zn = class {
|
|
|
2496
2495
|
}
|
|
2497
2496
|
constructor(t) {
|
|
2498
2497
|
this.isDestroyed = !1, this.previousRoute = "", this.cleanups = [], this.templateCache = /* @__PURE__ */ new Map(), this.routeCleanups = [], this.lastRawQuery = "", this.cachedParams = {}, this.config = {
|
|
2499
|
-
mode:
|
|
2500
|
-
basePath:
|
|
2501
|
-
autoBindLinks:
|
|
2502
|
-
activeClass:
|
|
2498
|
+
mode: Be.mode,
|
|
2499
|
+
basePath: Be.basePath,
|
|
2500
|
+
autoBindLinks: Be.autoBindLinks,
|
|
2501
|
+
activeClass: Be.activeClass,
|
|
2503
2502
|
notFound: t.notFound || "",
|
|
2504
2503
|
beforeTransition: t.beforeTransition || (() => {}),
|
|
2505
2504
|
afterTransition: t.afterTransition || (() => {}),
|
|
2506
2505
|
...t
|
|
2507
|
-
}, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom =
|
|
2506
|
+
}, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom = we(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = we(this.getQueryParams()), this.queryParams = L(() => this.queryParamsAtom.value), this.init();
|
|
2508
2507
|
}
|
|
2509
2508
|
init() {
|
|
2510
2509
|
let e = this.isHistoryMode ? "popstate" : "hashchange", t = this.handleUrlChange.bind(this);
|
|
2511
2510
|
window.addEventListener(e, t), this.cleanups.push(() => window.removeEventListener(e, t));
|
|
2512
2511
|
let n = R(() => {
|
|
2513
2512
|
let e = this.currentRouteAtom.value;
|
|
2514
|
-
|
|
2513
|
+
O(() => {
|
|
2515
2514
|
for (let e of this.routeCleanups) try {
|
|
2516
2515
|
e();
|
|
2517
2516
|
} catch {}
|
|
@@ -2556,7 +2555,7 @@ var zn = class {
|
|
|
2556
2555
|
}
|
|
2557
2556
|
setUrl(e) {
|
|
2558
2557
|
let { route: t, query: n } = this.splitPath(e), r = n ? `${t}?${n}` : t, i = this.isHistoryMode ? `${this.basePath}/${r}` : `#${r}`;
|
|
2559
|
-
this.isHistoryMode ?
|
|
2558
|
+
this.isHistoryMode ? Bn(null, i) : location.hash = i, this.previousUrl = this.isHistoryMode ? i : location.hash;
|
|
2560
2559
|
}
|
|
2561
2560
|
restoreUrl() {
|
|
2562
2561
|
try {
|
|
@@ -2573,10 +2572,10 @@ var zn = class {
|
|
|
2573
2572
|
return;
|
|
2574
2573
|
}
|
|
2575
2574
|
let o = this.getQueryParams(), s = this.previousRoute;
|
|
2576
|
-
r &&
|
|
2575
|
+
r && O(() => r(s, e)), this.$target.empty();
|
|
2577
2576
|
let c = o;
|
|
2578
2577
|
if (a.onEnter) {
|
|
2579
|
-
let e =
|
|
2578
|
+
let e = O(() => a.onEnter(o, this));
|
|
2580
2579
|
e && (c = {
|
|
2581
2580
|
...o,
|
|
2582
2581
|
...e
|
|
@@ -2596,7 +2595,7 @@ var zn = class {
|
|
|
2596
2595
|
}
|
|
2597
2596
|
this.$target.append(e.content.cloneNode(!0)), a.onMount && a.onMount(this.$target.children(), l, this);
|
|
2598
2597
|
}
|
|
2599
|
-
i &&
|
|
2598
|
+
i && O(() => i(s, e)), this.previousRoute = e;
|
|
2600
2599
|
}
|
|
2601
2600
|
handleUrlChange() {
|
|
2602
2601
|
if (this.isDestroyed) return;
|
|
@@ -2604,7 +2603,7 @@ var zn = class {
|
|
|
2604
2603
|
if (e === this.previousUrl) return;
|
|
2605
2604
|
let t = this.getRouteName(), n = this.currentRouteAtom.peek();
|
|
2606
2605
|
if (n !== t) {
|
|
2607
|
-
if (
|
|
2606
|
+
if (O(() => this.config.routes[n]?.onLeave?.(this)) === !1) {
|
|
2608
2607
|
this.restoreUrl();
|
|
2609
2608
|
return;
|
|
2610
2609
|
}
|
|
@@ -2622,7 +2621,7 @@ var zn = class {
|
|
|
2622
2621
|
e(document).on("click", "[data-route]", t), this.cleanups.push(() => e(document).off("click", "[data-route]", t));
|
|
2623
2622
|
let n = [], r = R(() => {
|
|
2624
2623
|
let e = this.currentRouteAtom.value, t = this.activeClass;
|
|
2625
|
-
|
|
2624
|
+
O(() => {
|
|
2626
2625
|
for (let e of n) e.classList.remove(t), e.removeAttribute("aria-current");
|
|
2627
2626
|
try {
|
|
2628
2627
|
let r = `[data-route="${e.replace(/"/g, "\\\"")}"]`, i = Array.from(document.querySelectorAll(r));
|
|
@@ -2658,13 +2657,13 @@ var zn = class {
|
|
|
2658
2657
|
}
|
|
2659
2658
|
}
|
|
2660
2659
|
};
|
|
2661
|
-
function
|
|
2662
|
-
return new
|
|
2660
|
+
function Hn(e) {
|
|
2661
|
+
return new Vn(e);
|
|
2663
2662
|
}
|
|
2664
|
-
e.extend({ route:
|
|
2663
|
+
e.extend({ route: Hn });
|
|
2665
2664
|
//#endregion
|
|
2666
2665
|
//#region src/features/fetch.ts
|
|
2667
|
-
var
|
|
2666
|
+
var Un = class {
|
|
2668
2667
|
constructor(t, n) {
|
|
2669
2668
|
this.abortController = null, this.execute = async () => {
|
|
2670
2669
|
this.abort();
|
|
@@ -2731,7 +2730,7 @@ var Vn = class {
|
|
|
2731
2730
|
//#endregion
|
|
2732
2731
|
//#region src/index.ts
|
|
2733
2732
|
e.extend({ atomFetch(e, t) {
|
|
2734
|
-
let n = new
|
|
2733
|
+
let n = new Un(e, t), r = L(n.execute, {
|
|
2735
2734
|
defaultValue: t.defaultValue,
|
|
2736
2735
|
lazy: t.eager === !1
|
|
2737
2736
|
}), i = r.dispose.bind(r);
|
|
@@ -2739,10 +2738,10 @@ e.extend({ atomFetch(e, t) {
|
|
|
2739
2738
|
n.abort(), i();
|
|
2740
2739
|
}, Object.assign(r, { abort: () => n.abort() });
|
|
2741
2740
|
} }), e(() => {
|
|
2742
|
-
|
|
2741
|
+
Tt(), document.body && pt(document.body);
|
|
2743
2742
|
});
|
|
2744
|
-
var
|
|
2743
|
+
var Wn = e;
|
|
2745
2744
|
//#endregion
|
|
2746
|
-
export {
|
|
2745
|
+
export { Wn as default, mt as disableAutoCleanup, Et as disablejQueryOverrides, pt as enableAutoCleanup, Tt as enablejQueryOverrides, Ie as isReactive, rt as nextTick, K as registry };
|
|
2747
2746
|
|
|
2748
2747
|
//# sourceMappingURL=index.mjs.map
|