@but212/atom-effect-jquery 0.22.0 → 0.22.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 +1 -1
- 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.mjs +91 -89
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -33,12 +33,12 @@ const ut = {
|
|
|
33
33
|
MIN_FLUSH_ITERATIONS: 10,
|
|
34
34
|
// Memory management
|
|
35
35
|
BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
|
|
36
|
-
},
|
|
36
|
+
}, we = {
|
|
37
37
|
WARN_INFINITE_LOOP: !0
|
|
38
38
|
}, te = {
|
|
39
39
|
MAX_ASYNC_RETRIES: 3,
|
|
40
40
|
MAX_PROMISE_ID: Number.MAX_SAFE_INTEGER - 1
|
|
41
|
-
}, It = 1073741823,
|
|
41
|
+
}, It = 1073741823, ke = typeof process < "u" && process.env && !1 || !1, xe = Object.freeze([]);
|
|
42
42
|
class tt extends Error {
|
|
43
43
|
constructor(t, s = null, n = !0) {
|
|
44
44
|
super(t), this.cause = s, this.recoverable = n, this.name = "AtomError";
|
|
@@ -59,10 +59,10 @@ class At extends tt {
|
|
|
59
59
|
super(t, s, !1), this.name = "SchedulerError";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const Pe = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), Me = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ut = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), yt = {
|
|
63
63
|
// Dev mode flag
|
|
64
|
-
enabled:
|
|
65
|
-
warnInfiniteLoop:
|
|
64
|
+
enabled: ke,
|
|
65
|
+
warnInfiniteLoop: we.WARN_INFINITE_LOOP,
|
|
66
66
|
warn(e, t) {
|
|
67
67
|
},
|
|
68
68
|
checkCircular(e, t) {
|
|
@@ -71,11 +71,11 @@ const xe = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), Pe = /* @__PURE__ */
|
|
|
71
71
|
},
|
|
72
72
|
attachDebugInfo(e, t, s) {
|
|
73
73
|
},
|
|
74
|
-
getDebugName: (e) => e?.[
|
|
75
|
-
getDebugType: (e) => e?.[
|
|
74
|
+
getDebugName: (e) => e?.[Pe],
|
|
75
|
+
getDebugType: (e) => e?.[Me]
|
|
76
76
|
};
|
|
77
|
-
let
|
|
78
|
-
const
|
|
77
|
+
let $e = 1;
|
|
78
|
+
const Fe = () => $e++;
|
|
79
79
|
function de(e, t, s) {
|
|
80
80
|
if (typeof t == "function") {
|
|
81
81
|
const i = t;
|
|
@@ -143,7 +143,7 @@ function Z(e, t, s) {
|
|
|
143
143
|
}
|
|
144
144
|
class _e {
|
|
145
145
|
constructor() {
|
|
146
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id =
|
|
146
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id = Fe() & It;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
class Ee extends _e {
|
|
@@ -193,7 +193,7 @@ class Ee extends _e {
|
|
|
193
193
|
let Lt = 0;
|
|
194
194
|
const jt = () => (Lt = Lt + 1 & It || 1, Lt), $t = (e) => e + 1 & It;
|
|
195
195
|
let zt = 0, pt = !1, pe = 0;
|
|
196
|
-
const
|
|
196
|
+
const me = () => pe;
|
|
197
197
|
function se() {
|
|
198
198
|
return pt ? !1 : (pt = !0, pe = jt(), zt = 0, !0);
|
|
199
199
|
}
|
|
@@ -307,7 +307,7 @@ class He {
|
|
|
307
307
|
this._maxFlushIterations = t;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
const rt = new He(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"),
|
|
310
|
+
const rt = new He(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ge = /* @__PURE__ */ Symbol.for("atom-effect/computed"), Ge = /* @__PURE__ */ Symbol.for("atom-effect/effect"), k = {
|
|
311
311
|
/** Active listener. */
|
|
312
312
|
current: null,
|
|
313
313
|
/**
|
|
@@ -456,9 +456,9 @@ function qt(e) {
|
|
|
456
456
|
return e !== null && typeof e == "object" && Vt in e;
|
|
457
457
|
}
|
|
458
458
|
function Ve(e) {
|
|
459
|
-
return e !== null && typeof e == "object" &&
|
|
459
|
+
return e !== null && typeof e == "object" && ge in e;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function Ie(e) {
|
|
462
462
|
return e !== null && typeof e == "object" && typeof e.then == "function";
|
|
463
463
|
}
|
|
464
464
|
var re, oe;
|
|
@@ -469,7 +469,7 @@ function Xe(e) {
|
|
|
469
469
|
class Qe extends Ee {
|
|
470
470
|
constructor(t, s = {}) {
|
|
471
471
|
if (typeof t != "function") throw new z(y.COMPUTED_MUST_BE_FUNCTION);
|
|
472
|
-
super(), this[oe] = !0, this[re] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = O, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._trackEpoch = -1, this._trackLinks = O, this._trackCount = 0, this._value = void 0, this.flags = qe | K | lt, this._equal = s.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in s ? s.defaultValue : Ut, this._onError = s.onError ?? null;
|
|
472
|
+
super(), this[oe] = !0, this[re] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = O, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = -1, this._trackEpoch = -1, this._trackLinks = O, this._trackCount = 0, this._value = void 0, this.flags = qe | K | lt, this._equal = s.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in s ? s.defaultValue : Ut, this._onError = s.onError ?? null;
|
|
473
473
|
const n = s.maxAsyncRetries;
|
|
474
474
|
if (this._maxAsyncRetries = (n ?? te.MAX_ASYNC_RETRIES) & It, yt.attachDebugInfo(this, "computed", this.id), s.lazy === !1)
|
|
475
475
|
try {
|
|
@@ -518,7 +518,7 @@ class Qe extends Ee {
|
|
|
518
518
|
return !this.hasError;
|
|
519
519
|
}
|
|
520
520
|
get errors() {
|
|
521
|
-
if (this._track(), !this.hasError) return
|
|
521
|
+
if (this._track(), !this.hasError) return xe;
|
|
522
522
|
const t = [];
|
|
523
523
|
return this._error && t.push(this._error), this._links.forEach((s) => {
|
|
524
524
|
const n = s.node;
|
|
@@ -544,7 +544,7 @@ class Qe extends Ee {
|
|
|
544
544
|
const t = this._links;
|
|
545
545
|
t !== O && (t.forEach((s) => s.unsub?.()), B.release(t), this._links = O), this._subscribers.length = 0, this.flags = wt | K | lt, this._error = null, this._value = void 0;
|
|
546
546
|
}
|
|
547
|
-
[(oe = Vt, re =
|
|
547
|
+
[(oe = Vt, re = ge, Symbol.dispose)]() {
|
|
548
548
|
this.dispose();
|
|
549
549
|
}
|
|
550
550
|
addDependency(t) {
|
|
@@ -565,7 +565,7 @@ class Qe extends Ee {
|
|
|
565
565
|
let s = !1;
|
|
566
566
|
try {
|
|
567
567
|
const n = k.run(this, this._fn);
|
|
568
|
-
this._trackLinks.length = this._trackCount, ee(this._trackLinks, t, this), this._links = this._trackLinks, s = !0,
|
|
568
|
+
this._trackLinks.length = this._trackCount, ee(this._trackLinks, t, this), this._links = this._trackLinks, s = !0, Ie(n) ? this._handleAsyncComputation(n) : this._finalizeResolution(n);
|
|
569
569
|
} catch (n) {
|
|
570
570
|
if (!s)
|
|
571
571
|
try {
|
|
@@ -583,13 +583,15 @@ class Qe extends Ee {
|
|
|
583
583
|
t.then(
|
|
584
584
|
(n) => {
|
|
585
585
|
if (s === this._promiseId) {
|
|
586
|
-
if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion)
|
|
587
|
-
|
|
586
|
+
if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
|
|
587
|
+
const i = me();
|
|
588
|
+
return this._lastDriftEpoch !== i && (this._lastDriftEpoch = i, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(
|
|
588
589
|
new z(
|
|
589
590
|
`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
|
|
590
591
|
),
|
|
591
592
|
y.COMPUTED_ASYNC_COMPUTATION_FAILED
|
|
592
593
|
);
|
|
594
|
+
}
|
|
593
595
|
this._finalizeResolution(n), this._notifySubscribers(n, void 0);
|
|
594
596
|
}
|
|
595
597
|
},
|
|
@@ -679,7 +681,7 @@ class Ke extends _e {
|
|
|
679
681
|
let n = !1;
|
|
680
682
|
try {
|
|
681
683
|
const i = k.run(this, this._fn);
|
|
682
|
-
this._links = s, n = !0,
|
|
684
|
+
this._links = s, n = !0, Ie(i) ? this._handleAsyncResult(i) : this._cleanup = typeof i == "function" ? i : null;
|
|
683
685
|
} catch (i) {
|
|
684
686
|
this._links = s, n = !0, this._handleExecutionError(i), this._cleanup = null;
|
|
685
687
|
} finally {
|
|
@@ -739,7 +741,7 @@ class Ke extends _e {
|
|
|
739
741
|
}
|
|
740
742
|
}
|
|
741
743
|
_checkInfiniteLoops() {
|
|
742
|
-
const t =
|
|
744
|
+
const t = me();
|
|
743
745
|
this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Be() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
|
|
744
746
|
}
|
|
745
747
|
get isDisposed() {
|
|
@@ -773,7 +775,7 @@ function X(e, t = {}) {
|
|
|
773
775
|
const s = new Ke(e, t);
|
|
774
776
|
return s.execute(), s;
|
|
775
777
|
}
|
|
776
|
-
function
|
|
778
|
+
function ye(e) {
|
|
777
779
|
if (typeof e != "function")
|
|
778
780
|
throw new TypeError("Batch callback must be a function");
|
|
779
781
|
rt.startBatch();
|
|
@@ -829,7 +831,7 @@ const d = {
|
|
|
829
831
|
MOUNT_ERROR: () => "Mount error",
|
|
830
832
|
MOUNT_CLEANUP_ERROR: () => "Cleanup error"
|
|
831
833
|
};
|
|
832
|
-
function
|
|
834
|
+
function Ce(e) {
|
|
833
835
|
return qt(e);
|
|
834
836
|
}
|
|
835
837
|
function Xt(e) {
|
|
@@ -919,7 +921,7 @@ function _s(e) {
|
|
|
919
921
|
}
|
|
920
922
|
return r;
|
|
921
923
|
}
|
|
922
|
-
const Es = {},
|
|
924
|
+
const Es = {}, be = 600, ps = `${be / 1e3}s`;
|
|
923
925
|
function ms() {
|
|
924
926
|
if (typeof window < "u") {
|
|
925
927
|
const e = window.__ATOM_DEBUG__;
|
|
@@ -1012,15 +1014,15 @@ function ys(e) {
|
|
|
1012
1014
|
e,
|
|
1013
1015
|
setTimeout(() => {
|
|
1014
1016
|
e.classList.remove(Ht), kt.delete(e);
|
|
1015
|
-
},
|
|
1017
|
+
}, be)
|
|
1016
1018
|
);
|
|
1017
1019
|
});
|
|
1018
1020
|
xt.set(e, n);
|
|
1019
1021
|
}
|
|
1020
|
-
function
|
|
1022
|
+
function Se(e, t) {
|
|
1021
1023
|
return Ft(e, t);
|
|
1022
1024
|
}
|
|
1023
|
-
Object.defineProperty(
|
|
1025
|
+
Object.defineProperty(Se, "debug", {
|
|
1024
1026
|
enumerable: !0,
|
|
1025
1027
|
// configurable: true allows tests and advanced consumers to redefine or
|
|
1026
1028
|
// delete the accessor if needed. The default (false) would permanently lock
|
|
@@ -1041,14 +1043,14 @@ const bs = {
|
|
|
1041
1043
|
// TypeScript cannot see it through the declared function type, so the double
|
|
1042
1044
|
// cast is unavoidable. The NamespaceExtensions annotation still verifies all
|
|
1043
1045
|
// other fields; only `atom`'s shape escapes static checking here.
|
|
1044
|
-
atom:
|
|
1046
|
+
atom: Se,
|
|
1045
1047
|
computed: Ct,
|
|
1046
1048
|
effect: X,
|
|
1047
|
-
batch:
|
|
1049
|
+
batch: ye,
|
|
1048
1050
|
untracked: H,
|
|
1049
1051
|
isAtom: qt,
|
|
1050
1052
|
isComputed: Ve,
|
|
1051
|
-
isReactive:
|
|
1053
|
+
isReactive: Ce,
|
|
1052
1054
|
nextTick: Cs
|
|
1053
1055
|
};
|
|
1054
1056
|
c.extend(bs);
|
|
@@ -1138,7 +1140,7 @@ class Ss {
|
|
|
1138
1140
|
}
|
|
1139
1141
|
const g = new Ss();
|
|
1140
1142
|
let it = null, Et = null;
|
|
1141
|
-
function
|
|
1143
|
+
function Rs(e) {
|
|
1142
1144
|
if (it !== null) {
|
|
1143
1145
|
Et !== e && f.warn(
|
|
1144
1146
|
d.BINDING,
|
|
@@ -1157,7 +1159,7 @@ function Gs() {
|
|
|
1157
1159
|
it?.disconnect(), it = null, Et = null;
|
|
1158
1160
|
}
|
|
1159
1161
|
function Q(e, t, s, n) {
|
|
1160
|
-
if (
|
|
1162
|
+
if (Ce(t)) {
|
|
1161
1163
|
const i = t;
|
|
1162
1164
|
g.trackEffect(
|
|
1163
1165
|
e,
|
|
@@ -1186,18 +1188,18 @@ function Q(e, t, s, n) {
|
|
|
1186
1188
|
}
|
|
1187
1189
|
const F = /* @__PURE__ */ Symbol("atom-effect-internal"), mt = /* @__PURE__ */ new WeakMap();
|
|
1188
1190
|
let w = null;
|
|
1189
|
-
const
|
|
1191
|
+
const Re = (e) => {
|
|
1190
1192
|
if (e[F]) return e;
|
|
1191
1193
|
let t = mt.get(e);
|
|
1192
1194
|
return t || (t = function(...s) {
|
|
1193
|
-
return
|
|
1195
|
+
return ye(() => e.apply(this, s));
|
|
1194
1196
|
}, t[F] = !0, mt.set(e, t)), t;
|
|
1195
1197
|
};
|
|
1196
|
-
function
|
|
1198
|
+
function Ts(e) {
|
|
1197
1199
|
const t = {};
|
|
1198
1200
|
return Object.keys(e).forEach((s) => {
|
|
1199
1201
|
const n = e[s];
|
|
1200
|
-
n && (t[s] =
|
|
1202
|
+
n && (t[s] = Re(n));
|
|
1201
1203
|
}), t;
|
|
1202
1204
|
}
|
|
1203
1205
|
function Os(e) {
|
|
@@ -1240,11 +1242,11 @@ function Ns() {
|
|
|
1240
1242
|
}, c.fn.on = function(...t) {
|
|
1241
1243
|
const s = t[0];
|
|
1242
1244
|
if (s && typeof s == "object")
|
|
1243
|
-
t[0] =
|
|
1245
|
+
t[0] = Ts(s);
|
|
1244
1246
|
else
|
|
1245
1247
|
for (let n = t.length - 1; n >= 0; n--)
|
|
1246
1248
|
if (typeof t[n] == "function") {
|
|
1247
|
-
t[n] =
|
|
1249
|
+
t[n] = Re(t[n]);
|
|
1248
1250
|
break;
|
|
1249
1251
|
}
|
|
1250
1252
|
return e.on.apply(this, t);
|
|
@@ -1265,18 +1267,18 @@ function Ns() {
|
|
|
1265
1267
|
function js() {
|
|
1266
1268
|
w !== null && (c.fn.on = w.on, c.fn.off = w.off, c.fn.remove = w.remove, c.fn.empty = w.empty, c.fn.detach = w.detach, w = null);
|
|
1267
1269
|
}
|
|
1268
|
-
var
|
|
1270
|
+
var T = /* @__PURE__ */ ((e) => (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))(T || {});
|
|
1269
1271
|
let vs = 0;
|
|
1270
1272
|
class Ds {
|
|
1271
1273
|
constructor(t, s, n) {
|
|
1272
1274
|
this.flags = 0, this.timeoutId = void 0, this.ns = `.atomBind-${++vs}`, this.handleCompositionStart = () => {
|
|
1273
|
-
this.flags |=
|
|
1275
|
+
this.flags |= T.Composing;
|
|
1274
1276
|
}, this.handleCompositionEnd = () => {
|
|
1275
|
-
this.flags &= ~
|
|
1277
|
+
this.flags &= ~T.Composing, this.handleInput();
|
|
1276
1278
|
}, this.handleFocus = () => {
|
|
1277
|
-
this.flags |=
|
|
1279
|
+
this.flags |= T.Focused;
|
|
1278
1280
|
}, this.handleBlur = () => {
|
|
1279
|
-
this.flags &= ~
|
|
1281
|
+
this.flags &= ~T.Focused, this.timeoutId !== void 0 && (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom());
|
|
1280
1282
|
const r = this.options.format(this.atom.peek());
|
|
1281
1283
|
this.el.value !== r && (this.el.value = r);
|
|
1282
1284
|
}, this.syncDomFromAtom = () => {
|
|
@@ -1284,13 +1286,13 @@ class Ds {
|
|
|
1284
1286
|
H(() => {
|
|
1285
1287
|
const o = this.options.format(r), l = this.el.value;
|
|
1286
1288
|
if (l === o) return;
|
|
1287
|
-
const p = !!(this.flags &
|
|
1289
|
+
const p = !!(this.flags & T.Focused);
|
|
1288
1290
|
if (p)
|
|
1289
1291
|
try {
|
|
1290
1292
|
if (this.options.equal(this.options.parse(l), r)) return;
|
|
1291
1293
|
} catch {
|
|
1292
1294
|
}
|
|
1293
|
-
this.flags |=
|
|
1295
|
+
this.flags |= T.SyncingToDom;
|
|
1294
1296
|
try {
|
|
1295
1297
|
if (p && (this.el instanceof HTMLInputElement || this.el instanceof HTMLTextAreaElement)) {
|
|
1296
1298
|
const C = this.el.selectionStart, b = this.el.selectionEnd;
|
|
@@ -1301,7 +1303,7 @@ class Ds {
|
|
|
1301
1303
|
this.el.value = o;
|
|
1302
1304
|
f.domUpdated(this.$el, "val", o);
|
|
1303
1305
|
} finally {
|
|
1304
|
-
this.flags &= ~
|
|
1306
|
+
this.flags &= ~T.SyncingToDom;
|
|
1305
1307
|
}
|
|
1306
1308
|
});
|
|
1307
1309
|
}, this.cleanup = () => {
|
|
@@ -1315,22 +1317,22 @@ class Ds {
|
|
|
1315
1317
|
format: n.format ?? ((r) => String(r ?? "")),
|
|
1316
1318
|
equal: n.equal ?? Object.is
|
|
1317
1319
|
}, i > 0 ? this.handleInput = () => {
|
|
1318
|
-
this.flags &
|
|
1320
|
+
this.flags & T.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), i));
|
|
1319
1321
|
} : this.handleInput = () => {
|
|
1320
|
-
this.flags &
|
|
1322
|
+
this.flags & T.Composing || this.syncAtomFromDom();
|
|
1321
1323
|
}, this.handleFocus[F] = !0, this.handleBlur[F] = !0, this.handleCompositionStart[F] = !0, this.handleCompositionEnd[F] = !0, this.handleInput[F] = !0, this.bindEvents();
|
|
1322
1324
|
}
|
|
1323
1325
|
// --- Sync Logic ---
|
|
1324
1326
|
syncAtomFromDom() {
|
|
1325
|
-
if (!(this.flags &
|
|
1326
|
-
this.flags |=
|
|
1327
|
+
if (!(this.flags & T.Busy)) {
|
|
1328
|
+
this.flags |= T.SyncingToAtom;
|
|
1327
1329
|
try {
|
|
1328
1330
|
const t = this.options.parse(this.el.value);
|
|
1329
1331
|
this.options.equal(this.atom.peek(), t) || (this.atom.value = t);
|
|
1330
1332
|
} catch (t) {
|
|
1331
1333
|
f.warn(d.BINDING, `${S.PARSE_ERROR()}:`, t);
|
|
1332
1334
|
} finally {
|
|
1333
|
-
this.flags &= ~
|
|
1335
|
+
this.flags &= ~T.SyncingToAtom;
|
|
1334
1336
|
}
|
|
1335
1337
|
}
|
|
1336
1338
|
}
|
|
@@ -1371,7 +1373,7 @@ function Te(e, t, s) {
|
|
|
1371
1373
|
"text"
|
|
1372
1374
|
);
|
|
1373
1375
|
}
|
|
1374
|
-
function
|
|
1376
|
+
function Oe(e, t) {
|
|
1375
1377
|
const s = e.el, n = qt(t) ? Ls(t) : t;
|
|
1376
1378
|
Q(
|
|
1377
1379
|
s,
|
|
@@ -1382,7 +1384,7 @@ function Re(e, t) {
|
|
|
1382
1384
|
"html"
|
|
1383
1385
|
);
|
|
1384
1386
|
}
|
|
1385
|
-
function
|
|
1387
|
+
function Ne(e, t) {
|
|
1386
1388
|
Object.entries(t).forEach(([s, n]) => {
|
|
1387
1389
|
Q(
|
|
1388
1390
|
e.el,
|
|
@@ -1394,7 +1396,7 @@ function Oe(e, t) {
|
|
|
1394
1396
|
);
|
|
1395
1397
|
});
|
|
1396
1398
|
}
|
|
1397
|
-
function
|
|
1399
|
+
function ve(e, t) {
|
|
1398
1400
|
const s = e.el, n = s.style;
|
|
1399
1401
|
Object.entries(t).forEach(([i, r]) => {
|
|
1400
1402
|
const o = Us(i), [l, p] = Array.isArray(r) ? r : [r, ""];
|
|
@@ -1409,7 +1411,7 @@ function Ne(e, t) {
|
|
|
1409
1411
|
);
|
|
1410
1412
|
});
|
|
1411
1413
|
}
|
|
1412
|
-
function
|
|
1414
|
+
function De(e, t) {
|
|
1413
1415
|
const s = e.el;
|
|
1414
1416
|
Object.keys(t).forEach((n) => {
|
|
1415
1417
|
n.toLowerCase().startsWith("on") || Q(
|
|
@@ -1427,7 +1429,7 @@ function ve(e, t) {
|
|
|
1427
1429
|
);
|
|
1428
1430
|
});
|
|
1429
1431
|
}
|
|
1430
|
-
function
|
|
1432
|
+
function Ae(e, t) {
|
|
1431
1433
|
const s = e.el;
|
|
1432
1434
|
Object.keys(t).forEach((n) => {
|
|
1433
1435
|
Je.has(n) || Q(
|
|
@@ -1461,7 +1463,7 @@ function Gt(e, t, s = {}) {
|
|
|
1461
1463
|
const { fx: i, cleanup: r } = As(e.$el, t, s);
|
|
1462
1464
|
g.trackEffect(e.el, i), e.trackCleanup(r);
|
|
1463
1465
|
}
|
|
1464
|
-
function
|
|
1466
|
+
function Ue(e, t) {
|
|
1465
1467
|
const s = e.el, n = e.$el, i = () => {
|
|
1466
1468
|
const o = s.checked;
|
|
1467
1469
|
t.value !== o && (t.value = o);
|
|
@@ -1483,7 +1485,7 @@ function ks(e, t, s) {
|
|
|
1483
1485
|
const n = e.$el;
|
|
1484
1486
|
n.on(t, s), e.trackCleanup(() => n.off(t, s));
|
|
1485
1487
|
}
|
|
1486
|
-
function
|
|
1488
|
+
function Le(e) {
|
|
1487
1489
|
g.cleanupTree(e);
|
|
1488
1490
|
}
|
|
1489
1491
|
c.fn.atomText = function(e, t) {
|
|
@@ -1493,7 +1495,7 @@ c.fn.atomText = function(e, t) {
|
|
|
1493
1495
|
};
|
|
1494
1496
|
c.fn.atomHtml = function(e) {
|
|
1495
1497
|
return this.each(function() {
|
|
1496
|
-
|
|
1498
|
+
Oe(D(this), e);
|
|
1497
1499
|
});
|
|
1498
1500
|
};
|
|
1499
1501
|
c.fn.atomClass = function(e, t) {
|
|
@@ -1501,7 +1503,7 @@ c.fn.atomClass = function(e, t) {
|
|
|
1501
1503
|
return console.warn(`${d.BINDING} ${S.MISSING_CONDITION("atomClass")}`), this;
|
|
1502
1504
|
const s = typeof e == "string" ? { [e]: t } : e;
|
|
1503
1505
|
return this.each(function() {
|
|
1504
|
-
|
|
1506
|
+
Ne(D(this), s);
|
|
1505
1507
|
});
|
|
1506
1508
|
};
|
|
1507
1509
|
c.fn.atomCss = function(e, t, s) {
|
|
@@ -1509,7 +1511,7 @@ c.fn.atomCss = function(e, t, s) {
|
|
|
1509
1511
|
return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomCss")}`), this;
|
|
1510
1512
|
const n = typeof e == "string" ? { [e]: s ? [t, s] : t } : e;
|
|
1511
1513
|
return this.each(function() {
|
|
1512
|
-
|
|
1514
|
+
ve(D(this), n);
|
|
1513
1515
|
});
|
|
1514
1516
|
};
|
|
1515
1517
|
c.fn.atomAttr = function(e, t) {
|
|
@@ -1517,7 +1519,7 @@ c.fn.atomAttr = function(e, t) {
|
|
|
1517
1519
|
return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomAttr")}`), this;
|
|
1518
1520
|
const s = typeof e == "string" ? { [e]: t } : e;
|
|
1519
1521
|
return this.each(function() {
|
|
1520
|
-
|
|
1522
|
+
De(D(this), s);
|
|
1521
1523
|
});
|
|
1522
1524
|
};
|
|
1523
1525
|
c.fn.atomProp = function(e, t) {
|
|
@@ -1525,7 +1527,7 @@ c.fn.atomProp = function(e, t) {
|
|
|
1525
1527
|
return console.warn(`${d.BINDING} ${S.MISSING_SOURCE("atomProp")}`), this;
|
|
1526
1528
|
const s = typeof e == "string" ? { [e]: t } : e;
|
|
1527
1529
|
return this.each(function() {
|
|
1528
|
-
|
|
1530
|
+
Ae(D(this), s);
|
|
1529
1531
|
});
|
|
1530
1532
|
};
|
|
1531
1533
|
c.fn.atomShow = function(e) {
|
|
@@ -1545,7 +1547,7 @@ c.fn.atomVal = function(e, t = {}) {
|
|
|
1545
1547
|
};
|
|
1546
1548
|
c.fn.atomChecked = function(e) {
|
|
1547
1549
|
return this.each(function() {
|
|
1548
|
-
|
|
1550
|
+
Ue(D(this), e);
|
|
1549
1551
|
});
|
|
1550
1552
|
};
|
|
1551
1553
|
c.fn.atomOn = function(e, t) {
|
|
@@ -1556,18 +1558,18 @@ c.fn.atomOn = function(e, t) {
|
|
|
1556
1558
|
c.fn.atomBind = function(e) {
|
|
1557
1559
|
return this.each(function() {
|
|
1558
1560
|
const t = D(this);
|
|
1559
|
-
if (e.text !== void 0 && Te(t, e.text), e.html !== void 0 &&
|
|
1561
|
+
if (e.text !== void 0 && Te(t, e.text), e.html !== void 0 && Oe(t, e.html), e.class !== void 0 && Ne(t, e.class), e.css !== void 0 && ve(t, e.css), e.attr !== void 0 && De(t, e.attr), e.prop !== void 0 && Ae(t, e.prop), e.show !== void 0 && gt(t, e.show, !1), e.hide !== void 0 && gt(t, e.hide, !0), e.val !== void 0)
|
|
1560
1562
|
if (Array.isArray(e.val)) {
|
|
1561
1563
|
const [s, n] = e.val;
|
|
1562
1564
|
Gt(t, s, n);
|
|
1563
1565
|
} else
|
|
1564
1566
|
Gt(t, e.val);
|
|
1565
|
-
e.checked !== void 0 &&
|
|
1567
|
+
e.checked !== void 0 && Ue(t, e.checked), e.on !== void 0 && ws(t, e.on);
|
|
1566
1568
|
});
|
|
1567
1569
|
};
|
|
1568
1570
|
c.fn.atomUnbind = function() {
|
|
1569
1571
|
return this.each(function() {
|
|
1570
|
-
|
|
1572
|
+
Le(this);
|
|
1571
1573
|
});
|
|
1572
1574
|
};
|
|
1573
1575
|
function xs(e, t, s) {
|
|
@@ -1578,23 +1580,23 @@ c.fn.atomList = function(e, t) {
|
|
|
1578
1580
|
return this.each(function() {
|
|
1579
1581
|
const b = c(this), N = Xt(this), E = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
|
|
1580
1582
|
let P = [], U = null;
|
|
1581
|
-
const G = (v,
|
|
1583
|
+
const G = (v, R) => {
|
|
1582
1584
|
const j = () => {
|
|
1583
|
-
bt?.isDisposed || (
|
|
1585
|
+
bt?.isDisposed || (R.$el.remove(), m.delete(v), f.log("list", `${N} removed item:`, v));
|
|
1584
1586
|
};
|
|
1585
1587
|
if (l) {
|
|
1586
|
-
const M = l(
|
|
1588
|
+
const M = l(R.$el);
|
|
1587
1589
|
M instanceof Promise ? M.then(j, j) : j();
|
|
1588
1590
|
} else
|
|
1589
1591
|
j();
|
|
1590
|
-
}, Qt = (v,
|
|
1591
|
-
E.delete(v), m.add(v), G(v,
|
|
1592
|
+
}, Qt = (v, R) => {
|
|
1593
|
+
E.delete(v), m.add(v), G(v, R);
|
|
1592
1594
|
};
|
|
1593
1595
|
let bt;
|
|
1594
1596
|
bt = X(() => {
|
|
1595
|
-
const v = e.value,
|
|
1597
|
+
const v = e.value, R = v.length;
|
|
1596
1598
|
H(() => {
|
|
1597
|
-
if (U &&
|
|
1599
|
+
if (U && R > 0 && (U.remove(), U = null), R === 0) {
|
|
1598
1600
|
if (p && !U) {
|
|
1599
1601
|
const a = typeof p == "string" ? Bt(p) : p;
|
|
1600
1602
|
U = c(a).appendTo(b);
|
|
@@ -1604,12 +1606,12 @@ c.fn.atomList = function(e, t) {
|
|
|
1604
1606
|
}), P = [];
|
|
1605
1607
|
return;
|
|
1606
1608
|
}
|
|
1607
|
-
f.log("list", `${N} updating with ${
|
|
1609
|
+
f.log("list", `${N} updating with ${R} items`);
|
|
1608
1610
|
const j = /* @__PURE__ */ new Map();
|
|
1609
1611
|
for (let a = 0; a < P.length; a++)
|
|
1610
1612
|
j.set(P[a], a);
|
|
1611
|
-
const M = new Array(
|
|
1612
|
-
for (let a = 0; a <
|
|
1613
|
+
const M = new Array(R), St = /* @__PURE__ */ new Set(), ot = new Int32Array(R), ct = [], Rt = [], Tt = [];
|
|
1614
|
+
for (let a = 0; a < R; a++) {
|
|
1613
1615
|
const h = v[a], _ = C(h, a);
|
|
1614
1616
|
if (M[a] = _, St.has(_)) {
|
|
1615
1617
|
f.warn(d.LIST, S.DUPLICATE_KEY(_, a)), ot[a] = -1;
|
|
@@ -1619,15 +1621,15 @@ c.fn.atomList = function(e, t) {
|
|
|
1619
1621
|
const I = E.get(_);
|
|
1620
1622
|
if (I) {
|
|
1621
1623
|
const u = I.item;
|
|
1622
|
-
!r && u !== h && !ds(u, h) && (ct.push(_),
|
|
1624
|
+
!r && u !== h && !ds(u, h) && (ct.push(_), Rt.push(h), Tt.push(a)), ot[a] = m.has(_) ? -1 : j.get(_) ?? -1;
|
|
1623
1625
|
} else
|
|
1624
|
-
ct.push(_),
|
|
1626
|
+
ct.push(_), Rt.push(h), Tt.push(a), ot[a] = -1;
|
|
1625
1627
|
}
|
|
1626
1628
|
const Kt = "<!--sep-->", at = ct.length, Yt = new Array(
|
|
1627
1629
|
at
|
|
1628
1630
|
), Ot = [];
|
|
1629
1631
|
for (let a = 0; a < at; a++) {
|
|
1630
|
-
const h = n(
|
|
1632
|
+
const h = n(Rt[a], Tt[a]);
|
|
1631
1633
|
Yt[a] = h, typeof h == "string" && Ot.push(h);
|
|
1632
1634
|
}
|
|
1633
1635
|
let ht = null;
|
|
@@ -1652,7 +1654,7 @@ c.fn.atomList = function(e, t) {
|
|
|
1652
1654
|
if (vt && ht !== null && Wt === at && !i && !o && !l && m.size === 0) {
|
|
1653
1655
|
this.innerHTML = ht.join("");
|
|
1654
1656
|
let a = 0;
|
|
1655
|
-
for (let h = 0; h <
|
|
1657
|
+
for (let h = 0; h < R; h++) {
|
|
1656
1658
|
const _ = M[h], I = v[h], u = E.get(_);
|
|
1657
1659
|
if (!u) continue;
|
|
1658
1660
|
const A = this.children[a++];
|
|
@@ -1661,7 +1663,7 @@ c.fn.atomList = function(e, t) {
|
|
|
1661
1663
|
} else {
|
|
1662
1664
|
const a = vt ? document.createDocumentFragment() : null;
|
|
1663
1665
|
if (vt && a) {
|
|
1664
|
-
for (let h =
|
|
1666
|
+
for (let h = R - 1; h >= 0; h--) {
|
|
1665
1667
|
const _ = M[h], I = v[h], u = E.get(_);
|
|
1666
1668
|
if (!u) continue;
|
|
1667
1669
|
const A = u.state, x = A === "new", et = A === "replaced";
|
|
@@ -1672,7 +1674,7 @@ c.fn.atomList = function(e, t) {
|
|
|
1672
1674
|
}
|
|
1673
1675
|
this.appendChild(a);
|
|
1674
1676
|
} else
|
|
1675
|
-
for (let h =
|
|
1677
|
+
for (let h = R - 1; h >= 0; h--) {
|
|
1676
1678
|
const _ = M[h], I = v[h], u = E.get(_);
|
|
1677
1679
|
if (!u) continue;
|
|
1678
1680
|
const A = u.state, x = A === "new", et = A === "replaced";
|
|
@@ -1704,7 +1706,7 @@ c.fn.atomMount = function(e, t) {
|
|
|
1704
1706
|
};
|
|
1705
1707
|
c.fn.atomUnmount = function() {
|
|
1706
1708
|
return this.each(function() {
|
|
1707
|
-
|
|
1709
|
+
Le(this);
|
|
1708
1710
|
});
|
|
1709
1711
|
};
|
|
1710
1712
|
function le(e, t) {
|
|
@@ -1994,21 +1996,21 @@ c.extend({
|
|
|
1994
1996
|
}
|
|
1995
1997
|
});
|
|
1996
1998
|
c(() => {
|
|
1997
|
-
Ns(),
|
|
1999
|
+
Ns(), Rs(document.body);
|
|
1998
2000
|
});
|
|
1999
2001
|
export {
|
|
2000
2002
|
Ft as atom,
|
|
2001
|
-
|
|
2003
|
+
ye as batch,
|
|
2002
2004
|
Ct as computed,
|
|
2003
2005
|
qs as default,
|
|
2004
2006
|
Gs as disableAutoCleanup,
|
|
2005
2007
|
js as disablejQueryOverrides,
|
|
2006
2008
|
X as effect,
|
|
2007
|
-
|
|
2009
|
+
Rs as enableAutoCleanup,
|
|
2008
2010
|
Ns as enablejQueryOverrides,
|
|
2009
2011
|
qt as isAtom,
|
|
2010
2012
|
Ve as isComputed,
|
|
2011
|
-
|
|
2013
|
+
Ce as isReactive,
|
|
2012
2014
|
Cs as nextTick,
|
|
2013
2015
|
g as registry,
|
|
2014
2016
|
H as untracked
|