Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cn-ui/reactive

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cn-ui/reactive - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

dist/utils/localSync.d.ts

307

./dist/index.js
var j = Object.defineProperty, B = Object.defineProperties;
var F = Object.getOwnPropertyDescriptors;
var k = Object.getOwnPropertySymbols;
var q = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
var O = (e, r, t) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, v = (e, r) => {
var P = Object.getOwnPropertySymbols;
var J = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
var T = (e, r, t) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, b = (e, r) => {
for (var t in r || (r = {}))
q.call(r, t) && O(e, t, r[t]);
if (k)
for (var t of k(r))
H.call(r, t) && O(e, t, r[t]);
J.call(r, t) && T(e, t, r[t]);
if (P)
for (var t of P(r))
N.call(r, t) && T(e, t, r[t]);
return e;
}, b = (e, r) => B(e, F(r));
var w = (e, r, t) => new Promise((n, s) => {
var c = (o) => {
}, p = (e, r) => B(e, F(r));
var y = (e, r, t) => new Promise((s, o) => {
var c = (n) => {
try {
a(t.next(o));
a(t.next(n));
} catch (l) {
s(l);
o(l);
}
}, u = (o) => {
}, u = (n) => {
try {
a(t.throw(o));
a(t.throw(n));
} catch (l) {
s(l);
o(l);
}
}, a = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(c, u);
}, a = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(c, u);
a((t = t.apply(e, r)).next());
});
import { createEffect as x, on as $, createSignal as J, untrack as N, createMemo as M, batch as E, onCleanup as _ } from "solid-js";
import { createEffect as x, on as q, createSignal as H, untrack as $, createMemo as M, batch as E, onCleanup as _ } from "solid-js";
import { debounce as D, throttle as z } from "lodash-es";
const A = (e, r, t = null) => {
let n = !0;
const g = (e, r, t = null) => {
let s = !0;
return C(
(s) => n ? (n = !1, null) : e(s),
(o) => s ? (s = !1, null) : e(o),
r,
t
);
}, ee = A, C = (e, r, t = null) => {
let n = t;
}, ee = g, C = (e, r, t = null) => {
let s = t;
return x(
$(r, () => (n = e(n), n))
q(r, () => (s = e(s), s))
);
}, d = Symbol("AtomTypeSymbol"), te = (e) => e[d], f = (e, r) => {
const [t, n] = J(e, r);
const [t, s] = H(e, r);
return Object.assign(
(...s) => s.length === 0 ? t() : n(...s),
(...o) => o.length === 0 ? t() : s(...o),
{ reflux: K, [d]: "atom" }
);
}, K = function(e, r, t) {
const n = this, s = f(e, t);
return A(() => {
n(() => r(s()));
}, [s]), s[d] = "reflux", s;
}, P = (e, {
const s = this, o = f(e, t);
return g(() => {
s(() => r(o()));
}, [o]), o[d] = "reflux", o;
}, O = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => {
const n = f(r ? N(() => e(t)) : t);
return x((s) => {
n(() => e(s));
}, t), n[d] = "reflect", n;
const s = f(r ? $(() => e(t)) : t);
return x((o) => {
s(() => e(o));
}, t), s[d] = "reflect", s;
}, U = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => M((n) => {
const s = e(n);
return r ? s : (r = !0, t);
} = {}) => M((s) => {
const o = e(s);
return r ? o : (r = !0, t);
}, t), W = (e, {
initValue: r = null,
immediately: t = !0,
deps: n,
refetch: s = {},
deps: s,
refetch: o = {},
tap: c = (a) => {

@@ -77,23 +77,23 @@ },

} = {}) => {
const a = f(r), o = f(!1), l = f(!1), i = M(() => !o() && !l());
const a = f(r), n = f(!1), l = f(!1), i = M(() => !n() && !l());
let h = Promise.resolve(!1);
const g = (...we) => w(void 0, [...we], function* ({ warn: p = !0, cancelCallback: T } = s) {
i() || (T ? T(h) : p && console.warn(
const w = (...we) => y(void 0, [...we], function* ({ warn: S = !0, cancelCallback: I } = o) {
i() || (I ? I(h) : S && console.warn(
"Resource Atom: some fetch has been covered; Recommend to add a cancelCallback to some Hook"
)), o(!0);
const S = e().then((m) => (E(() => {
a(() => m), o(!1), l(!1);
}), S === h && c(m), !0)).catch((m) => (E(() => {
l(m), o(!1);
)), n(!0);
const v = e().then((m) => (E(() => {
a(() => m), n(!1), l(!1);
}), v === h && c(m), !0)).catch((m) => (E(() => {
l(m), n(!1);
}), u || console.error(m), m));
return h = S, S;
return h = v, v;
});
return t && g(), n && n.length && A(() => g(s), n), Object.assign(a, {
return t && w(), s && s.length && g(() => w(o), s), Object.assign(a, {
error: l,
loading: o,
mutate(p) {
a(() => p);
loading: n,
mutate(S) {
a(() => S);
},
isReady: i,
refetch: g,
refetch: w,
promise: () => h,

@@ -109,26 +109,39 @@ [d]: "resource"

let t = !1;
return function(...n) {
return t ? (r && r(), t) : (t = Promise.resolve(e.apply(this, n)).then((s) => (t = !1, s)), t);
return function(...s) {
return t ? (r && r(), t) : (t = Promise.resolve(e.apply(this, s)).then((o) => (t = !1, o)), t);
};
}, ne = G;
function I(e) {
return typeof e == "function" ? y(e) ? e : P(e()) : f(e);
function k(e) {
return typeof e == "function" ? A(e) ? e : O(e()) : f(e);
}
function y(e) {
function A(e) {
return typeof e[d] == "string";
}
const se = (e) => e().map((r, t) => P(() => e()[t])), Q = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), oe = (e) => [...Array(e).keys()];
const se = (e) => e().map((r, t) => O(() => e()[t])), Q = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), oe = (e) => ({
value: e(),
"on:input": (r) => e(() => r.target.value)
}), ce = (e, r, t) => {
var c, u, a;
const s = (c = t == null ? void 0 : t.parse) != null ? c : (n) => JSON.parse(n), o = (u = t == null ? void 0 : t.stringify) != null ? u : (n) => JSON.stringify(n);
if ((a = t == null ? void 0 : t.immediately) == null || a) {
const n = localStorage.getItem(r);
n && e(s(n));
}
return g(() => {
localStorage.setItem(r, o(e()));
}, [e]), e;
}, ae = (e) => [...Array(e).keys()];
function R(e, r) {
const t = y(e) ? e : f(e, r), n = (c, u, a) => {
const o = c.findIndex((l) => l === u);
if (o >= 0) {
const t = A(e) ? e : f(e, r), s = (c, u, a) => {
const n = c.findIndex((l) => l === u);
if (n >= 0) {
const l = [...c];
return a(l, o), l;
return a(l, n), l;
} else
return console.warn("Can't find array atom Item: ", u), c;
};
return Object.assign(t, b(v({}, {
return Object.assign(t, p(b({}, {
replace(c, u) {
return t((a) => n(a, c, (o, l) => {
o[l] = u;
return t((a) => s(a, c, (n, l) => {
n[l] = u;
})), this;

@@ -138,11 +151,11 @@ },

return t((a) => {
const o = [];
a.forEach((i, h) => i === c && o.push(h));
const n = [];
a.forEach((i, h) => i === c && n.push(h));
const l = [...a];
return o.forEach((i) => l[i] = u), l;
return n.forEach((i) => l[i] = u), l;
}), this;
},
remove(c) {
return t((u) => n(u, c, (a, o) => {
a.splice(o, 1);
return t((u) => s(u, c, (a, n) => {
a.splice(n, 1);
})), this;

@@ -154,3 +167,3 @@ },

insert(c, u, a = "before") {
return t((o) => n(o, u, (l, i) => {
return t((n) => s(n, u, (l, i) => {
l.splice(a === "before" ? i : i + 1, 0, c);

@@ -164,6 +177,6 @@ })), this;

return t((a) => {
const o = [...a], l = t().findIndex((h) => h === c), i = t().findIndex((h) => h === u);
const n = [...a], l = t().findIndex((h) => h === c), i = t().findIndex((h) => h === u);
if (l === -1 || i === -1)
throw new Error("ArrayAtom: Please check the Items you want to switch ");
return o[l] = u, o[i] = c, o;
return n[l] = u, n[i] = c, n;
}), this;

@@ -173,41 +186,41 @@ }

}
function ce(e, r) {
const t = y(e) ? e : f(e, { equals: !1 }), n = y(e) ? e() : e;
function ue(e, r) {
const t = A(e) ? e : f(e, { equals: !1 }), s = A(e) ? e() : e;
t[d] = "object";
const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set([d, ...Object.keys(n)]);
const o = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set([d, ...Object.keys(s)]);
return new Proxy(t, {
get(u, a, o) {
get(u, a, n) {
if (!c.has(a))
throw new Error(`key: ${a} can't be found in formObject!`);
if (s.has(a))
return s.get(a);
if (o.has(a))
return o.get(a);
{
const l = u.reflux(u()[a], (i) => (u()[a] = i, u()));
return s.set(a, l), l;
return o.set(a, l), l.bind(l);
}
},
apply(u, a, o) {
return Reflect.apply(u, a, o);
apply(u, a, n) {
return Reflect.apply(u, a, n);
}
});
}
function ae(e, r = 150) {
function le(e, r = 150) {
let t = e();
const n = f(t);
return A(
const s = f(t);
return g(
D(() => {
const s = e();
s !== void 0 && n(() => s);
const o = e();
o !== void 0 && s(() => o);
}, r),
[e]
), n;
), s;
}
function ue(e, r = 150, t) {
let n = e();
const s = f(n);
return A(
function ie(e, r = 150, t) {
let s = e();
const o = f(s);
return g(
z(
() => {
const c = e();
c !== void 0 && s(() => c);
c !== void 0 && o(() => c);
},

@@ -218,5 +231,5 @@ r,

[e]
), s;
), o;
}
const le = () => {
const fe = () => {
const e = /* @__PURE__ */ new Map();

@@ -246,7 +259,7 @@ return {

};
}, X = (e, r = {}) => {
var a, o;
}, V = (e, r = {}) => {
var a, n;
r.debounceTime = (a = r.debounceTime) != null ? a : 100;
const t = f((o = r.initIndex) != null ? o : 0), n = f(10), s = W(() => e(t(), n), r), c = D(() => s.refetch(), r.debounceTime), u = (i) => {
if (i < 0 || i >= n())
const t = f((n = r.initIndex) != null ? n : 0), s = f(10), o = W(() => e(t(), s), r), c = D(() => o.refetch(), r.debounceTime), u = (i) => {
if (i < 0 || i >= s())
return !1;

@@ -262,3 +275,3 @@ {

currentPage: U(() => t() + 1),
maxPage: n,
maxPage: s,
prev() {

@@ -271,4 +284,4 @@ return u(t() - 1);

waitForDone() {
return w(this, null, function* () {
return Q(r.debounceTime + 10).then(s.promise);
return y(this, null, function* () {
return Q(r.debounceTime + 10).then(o.promise);
});

@@ -278,13 +291,13 @@ },

goto: u,
currentData: s
currentData: o
};
}, ie = (e, r) => {
const t = f([], { equals: !1 }), n = X((...s) => w(void 0, null, function* () {
const c = yield e(...s);
return t((u) => (u[s[0]] = c, u)), c;
}, he = (e, r) => {
const t = f([], { equals: !1 }), s = V((...o) => y(void 0, null, function* () {
const c = yield e(...o);
return t((u) => (u[o[0]] = c, u)), c;
}), r);
return b(v({}, n), {
resetStack(s = !0) {
return p(b({}, s), {
resetStack(o = !0) {
E(() => {
t([]), n.currentIndex(0), s && n.currentData.refetch();
t([]), s.currentIndex(0), o && s.currentData.refetch();
});

@@ -294,33 +307,33 @@ },

});
}, fe = function(e = {}) {
}, de = function(e = {}) {
var u, a;
const r = R(I((u = e.activeIds) != null ? u : [])), t = I((a = e.multi) != null ? a : !0), n = f(new Set(r()));
const r = R(k((u = e.activeIds) != null ? u : [])), t = k((a = e.multi) != null ? a : !0), s = f(new Set(r()));
x(() => {
!t() && r((o) => o.slice(0, 1)), n(() => new Set(r()));
!t() && r((n) => n.slice(0, 1)), s(() => new Set(r()));
});
const s = f(/* @__PURE__ */ new Set(), { equals: !1 }), c = (o, l) => {
l === void 0 && (l = !n().has(o)), l === !0 && !n().has(o) ? r((i) => t() ? [...i, o] : [o]) : l === !1 && r.removeAll(o);
const o = f(/* @__PURE__ */ new Set(), { equals: !1 }), c = (n, l) => {
l === void 0 && (l = !s().has(n)), l === !0 && !s().has(n) ? r((i) => t() ? [...i, n] : [n]) : l === !1 && r.removeAll(n);
};
return {
changeSelected: c,
register(o, l = !1) {
s((i) => (i.add(o), i)), c(o, l);
register(n, l = !1) {
o((i) => (i.add(n), i)), c(n, l);
},
deregister(o) {
r.removeAll(o), s((l) => (l.delete(o), l));
deregister(n) {
r.removeAll(n), o((l) => (l.delete(n), l));
},
allRegistered: s,
activeIds: n,
isSelected: (o) => n().has(o)
allRegistered: o,
activeIds: s,
isSelected: (n) => s().has(n)
};
}, he = (e, r, t, {
on: n = (c) => c.addEventListener,
off: s = (c) => c.removeEventListener
}, me = (e, r, t, {
on: s = (c) => c.addEventListener,
off: o = (c) => c.removeEventListener
} = {}) => {
n(e).call(e, r, t), _(() => {
s(e).call(e, r, t);
s(e).call(e, r, t), _(() => {
o(e).call(e, r, t);
});
}, de = (e) => {
const r = (t, n, s) => {
const c = s != null ? s : new n();
}, ge = (e) => {
const r = (t, s, o) => {
const c = o != null ? o : new s();
return Object.entries(t()).forEach(([u, a]) => {

@@ -332,3 +345,3 @@ c.set(u, a.toString());

toKeysAtom() {
return P(() => R(Object.keys(e)));
return O(() => R(Object.keys(e)));
},

@@ -359,16 +372,18 @@ toEntries() {

d as AtomTypeSymbol,
ae as DebounceAtom,
de as EntriesTransform,
ce as ObjectAtom,
ue as ThrottleAtom,
he as addListener,
le as DebounceAtom,
ge as EntriesTransform,
ue as ObjectAtom,
ie as ThrottleAtom,
oe as VModel,
me as addListener,
G as asyncLock,
f as atom,
I as atomization,
le as createBlackBoard,
k as atomization,
fe as createBlackBoard,
ee as createIgnoreFirst,
oe as genArray,
ae as genArray,
te as getAtomType,
y as isAtom,
P as reflect,
A as isAtom,
ce as localSync,
O as reflect,
U as reflectMemo,

@@ -379,8 +394,8 @@ W as resource,

C as useEffect,
A as useEffectWithoutFirst,
X as usePagination,
ie as usePaginationStack,
fe as useSelect,
g as useEffectWithoutFirst,
V as usePagination,
he as usePaginationStack,
de as useSelect,
ne as useSingleAsync
};
//# sourceMappingURL=index.js.map
var j = Object.defineProperty, B = Object.defineProperties;
var F = Object.getOwnPropertyDescriptors;
var k = Object.getOwnPropertySymbols;
var q = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
var O = (e, r, t) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, v = (e, r) => {
var P = Object.getOwnPropertySymbols;
var J = Object.prototype.hasOwnProperty, N = Object.prototype.propertyIsEnumerable;
var T = (e, r, t) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, b = (e, r) => {
for (var t in r || (r = {}))
q.call(r, t) && O(e, t, r[t]);
if (k)
for (var t of k(r))
H.call(r, t) && O(e, t, r[t]);
J.call(r, t) && T(e, t, r[t]);
if (P)
for (var t of P(r))
N.call(r, t) && T(e, t, r[t]);
return e;
}, b = (e, r) => B(e, F(r));
var w = (e, r, t) => new Promise((n, s) => {
var c = (o) => {
}, p = (e, r) => B(e, F(r));
var y = (e, r, t) => new Promise((s, o) => {
var c = (n) => {
try {
a(t.next(o));
a(t.next(n));
} catch (l) {
s(l);
o(l);
}
}, u = (o) => {
}, u = (n) => {
try {
a(t.throw(o));
a(t.throw(n));
} catch (l) {
s(l);
o(l);
}
}, a = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(c, u);
}, a = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(c, u);
a((t = t.apply(e, r)).next());
});
import { createEffect as x, on as $, createSignal as J, untrack as N, createMemo as M, batch as E, onCleanup as _ } from "solid-js";
import { createEffect as x, on as q, createSignal as H, untrack as $, createMemo as M, batch as E, onCleanup as _ } from "solid-js";
import { debounce as D, throttle as z } from "lodash-es";
const A = (e, r, t = null) => {
let n = !0;
const g = (e, r, t = null) => {
let s = !0;
return C(
(s) => n ? (n = !1, null) : e(s),
(o) => s ? (s = !1, null) : e(o),
r,
t
);
}, ee = A, C = (e, r, t = null) => {
let n = t;
}, ee = g, C = (e, r, t = null) => {
let s = t;
return x(
$(r, () => (n = e(n), n))
q(r, () => (s = e(s), s))
);
}, d = Symbol("AtomTypeSymbol"), te = (e) => e[d], f = (e, r) => {
const [t, n] = J(e, r);
const [t, s] = H(e, r);
return Object.assign(
(...s) => s.length === 0 ? t() : n(...s),
(...o) => o.length === 0 ? t() : s(...o),
{ reflux: K, [d]: "atom" }
);
}, K = function(e, r, t) {
const n = this, s = f(e, t);
return A(() => {
n(() => r(s()));
}, [s]), s[d] = "reflux", s;
}, P = (e, {
const s = this, o = f(e, t);
return g(() => {
s(() => r(o()));
}, [o]), o[d] = "reflux", o;
}, O = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => {
const n = f(r ? N(() => e(t)) : t);
return x((s) => {
n(() => e(s));
}, t), n[d] = "reflect", n;
const s = f(r ? $(() => e(t)) : t);
return x((o) => {
s(() => e(o));
}, t), s[d] = "reflect", s;
}, U = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => M((n) => {
const s = e(n);
return r ? s : (r = !0, t);
} = {}) => M((s) => {
const o = e(s);
return r ? o : (r = !0, t);
}, t), W = (e, {
initValue: r = null,
immediately: t = !0,
deps: n,
refetch: s = {},
deps: s,
refetch: o = {},
tap: c = (a) => {

@@ -77,23 +77,23 @@ },

} = {}) => {
const a = f(r), o = f(!1), l = f(!1), i = M(() => !o() && !l());
const a = f(r), n = f(!1), l = f(!1), i = M(() => !n() && !l());
let h = Promise.resolve(!1);
const g = (...we) => w(void 0, [...we], function* ({ warn: p = !0, cancelCallback: T } = s) {
i() || (T ? T(h) : p && console.warn(
const w = (...we) => y(void 0, [...we], function* ({ warn: S = !0, cancelCallback: I } = o) {
i() || (I ? I(h) : S && console.warn(
"Resource Atom: some fetch has been covered; Recommend to add a cancelCallback to some Hook"
)), o(!0);
const S = e().then((m) => (E(() => {
a(() => m), o(!1), l(!1);
}), S === h && c(m), !0)).catch((m) => (E(() => {
l(m), o(!1);
)), n(!0);
const v = e().then((m) => (E(() => {
a(() => m), n(!1), l(!1);
}), v === h && c(m), !0)).catch((m) => (E(() => {
l(m), n(!1);
}), u || console.error(m), m));
return h = S, S;
return h = v, v;
});
return t && g(), n && n.length && A(() => g(s), n), Object.assign(a, {
return t && w(), s && s.length && g(() => w(o), s), Object.assign(a, {
error: l,
loading: o,
mutate(p) {
a(() => p);
loading: n,
mutate(S) {
a(() => S);
},
isReady: i,
refetch: g,
refetch: w,
promise: () => h,

@@ -109,26 +109,39 @@ [d]: "resource"

let t = !1;
return function(...n) {
return t ? (r && r(), t) : (t = Promise.resolve(e.apply(this, n)).then((s) => (t = !1, s)), t);
return function(...s) {
return t ? (r && r(), t) : (t = Promise.resolve(e.apply(this, s)).then((o) => (t = !1, o)), t);
};
}, ne = G;
function I(e) {
return typeof e == "function" ? y(e) ? e : P(e()) : f(e);
function k(e) {
return typeof e == "function" ? A(e) ? e : O(e()) : f(e);
}
function y(e) {
function A(e) {
return typeof e[d] == "string";
}
const se = (e) => e().map((r, t) => P(() => e()[t])), Q = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), oe = (e) => [...Array(e).keys()];
const se = (e) => e().map((r, t) => O(() => e()[t])), Q = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), oe = (e) => ({
value: e(),
"on:input": (r) => e(() => r.target.value)
}), ce = (e, r, t) => {
var c, u, a;
const s = (c = t == null ? void 0 : t.parse) != null ? c : (n) => JSON.parse(n), o = (u = t == null ? void 0 : t.stringify) != null ? u : (n) => JSON.stringify(n);
if ((a = t == null ? void 0 : t.immediately) == null || a) {
const n = localStorage.getItem(r);
n && e(s(n));
}
return g(() => {
localStorage.setItem(r, o(e()));
}, [e]), e;
}, ae = (e) => [...Array(e).keys()];
function R(e, r) {
const t = y(e) ? e : f(e, r), n = (c, u, a) => {
const o = c.findIndex((l) => l === u);
if (o >= 0) {
const t = A(e) ? e : f(e, r), s = (c, u, a) => {
const n = c.findIndex((l) => l === u);
if (n >= 0) {
const l = [...c];
return a(l, o), l;
return a(l, n), l;
} else
return console.warn("Can't find array atom Item: ", u), c;
};
return Object.assign(t, b(v({}, {
return Object.assign(t, p(b({}, {
replace(c, u) {
return t((a) => n(a, c, (o, l) => {
o[l] = u;
return t((a) => s(a, c, (n, l) => {
n[l] = u;
})), this;

@@ -138,11 +151,11 @@ },

return t((a) => {
const o = [];
a.forEach((i, h) => i === c && o.push(h));
const n = [];
a.forEach((i, h) => i === c && n.push(h));
const l = [...a];
return o.forEach((i) => l[i] = u), l;
return n.forEach((i) => l[i] = u), l;
}), this;
},
remove(c) {
return t((u) => n(u, c, (a, o) => {
a.splice(o, 1);
return t((u) => s(u, c, (a, n) => {
a.splice(n, 1);
})), this;

@@ -154,3 +167,3 @@ },

insert(c, u, a = "before") {
return t((o) => n(o, u, (l, i) => {
return t((n) => s(n, u, (l, i) => {
l.splice(a === "before" ? i : i + 1, 0, c);

@@ -164,6 +177,6 @@ })), this;

return t((a) => {
const o = [...a], l = t().findIndex((h) => h === c), i = t().findIndex((h) => h === u);
const n = [...a], l = t().findIndex((h) => h === c), i = t().findIndex((h) => h === u);
if (l === -1 || i === -1)
throw new Error("ArrayAtom: Please check the Items you want to switch ");
return o[l] = u, o[i] = c, o;
return n[l] = u, n[i] = c, n;
}), this;

@@ -173,41 +186,41 @@ }

}
function ce(e, r) {
const t = y(e) ? e : f(e, { equals: !1 }), n = y(e) ? e() : e;
function ue(e, r) {
const t = A(e) ? e : f(e, { equals: !1 }), s = A(e) ? e() : e;
t[d] = "object";
const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set([d, ...Object.keys(n)]);
const o = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set([d, ...Object.keys(s)]);
return new Proxy(t, {
get(u, a, o) {
get(u, a, n) {
if (!c.has(a))
throw new Error(`key: ${a} can't be found in formObject!`);
if (s.has(a))
return s.get(a);
if (o.has(a))
return o.get(a);
{
const l = u.reflux(u()[a], (i) => (u()[a] = i, u()));
return s.set(a, l), l;
return o.set(a, l), l.bind(l);
}
},
apply(u, a, o) {
return Reflect.apply(u, a, o);
apply(u, a, n) {
return Reflect.apply(u, a, n);
}
});
}
function ae(e, r = 150) {
function le(e, r = 150) {
let t = e();
const n = f(t);
return A(
const s = f(t);
return g(
D(() => {
const s = e();
s !== void 0 && n(() => s);
const o = e();
o !== void 0 && s(() => o);
}, r),
[e]
), n;
), s;
}
function ue(e, r = 150, t) {
let n = e();
const s = f(n);
return A(
function ie(e, r = 150, t) {
let s = e();
const o = f(s);
return g(
z(
() => {
const c = e();
c !== void 0 && s(() => c);
c !== void 0 && o(() => c);
},

@@ -218,5 +231,5 @@ r,

[e]
), s;
), o;
}
const le = () => {
const fe = () => {
const e = /* @__PURE__ */ new Map();

@@ -246,7 +259,7 @@ return {

};
}, X = (e, r = {}) => {
var a, o;
}, V = (e, r = {}) => {
var a, n;
r.debounceTime = (a = r.debounceTime) != null ? a : 100;
const t = f((o = r.initIndex) != null ? o : 0), n = f(10), s = W(() => e(t(), n), r), c = D(() => s.refetch(), r.debounceTime), u = (i) => {
if (i < 0 || i >= n())
const t = f((n = r.initIndex) != null ? n : 0), s = f(10), o = W(() => e(t(), s), r), c = D(() => o.refetch(), r.debounceTime), u = (i) => {
if (i < 0 || i >= s())
return !1;

@@ -262,3 +275,3 @@ {

currentPage: U(() => t() + 1),
maxPage: n,
maxPage: s,
prev() {

@@ -271,4 +284,4 @@ return u(t() - 1);

waitForDone() {
return w(this, null, function* () {
return Q(r.debounceTime + 10).then(s.promise);
return y(this, null, function* () {
return Q(r.debounceTime + 10).then(o.promise);
});

@@ -278,13 +291,13 @@ },

goto: u,
currentData: s
currentData: o
};
}, ie = (e, r) => {
const t = f([], { equals: !1 }), n = X((...s) => w(void 0, null, function* () {
const c = yield e(...s);
return t((u) => (u[s[0]] = c, u)), c;
}, he = (e, r) => {
const t = f([], { equals: !1 }), s = V((...o) => y(void 0, null, function* () {
const c = yield e(...o);
return t((u) => (u[o[0]] = c, u)), c;
}), r);
return b(v({}, n), {
resetStack(s = !0) {
return p(b({}, s), {
resetStack(o = !0) {
E(() => {
t([]), n.currentIndex(0), s && n.currentData.refetch();
t([]), s.currentIndex(0), o && s.currentData.refetch();
});

@@ -294,33 +307,33 @@ },

});
}, fe = function(e = {}) {
}, de = function(e = {}) {
var u, a;
const r = R(I((u = e.activeIds) != null ? u : [])), t = I((a = e.multi) != null ? a : !0), n = f(new Set(r()));
const r = R(k((u = e.activeIds) != null ? u : [])), t = k((a = e.multi) != null ? a : !0), s = f(new Set(r()));
x(() => {
!t() && r((o) => o.slice(0, 1)), n(() => new Set(r()));
!t() && r((n) => n.slice(0, 1)), s(() => new Set(r()));
});
const s = f(/* @__PURE__ */ new Set(), { equals: !1 }), c = (o, l) => {
l === void 0 && (l = !n().has(o)), l === !0 && !n().has(o) ? r((i) => t() ? [...i, o] : [o]) : l === !1 && r.removeAll(o);
const o = f(/* @__PURE__ */ new Set(), { equals: !1 }), c = (n, l) => {
l === void 0 && (l = !s().has(n)), l === !0 && !s().has(n) ? r((i) => t() ? [...i, n] : [n]) : l === !1 && r.removeAll(n);
};
return {
changeSelected: c,
register(o, l = !1) {
s((i) => (i.add(o), i)), c(o, l);
register(n, l = !1) {
o((i) => (i.add(n), i)), c(n, l);
},
deregister(o) {
r.removeAll(o), s((l) => (l.delete(o), l));
deregister(n) {
r.removeAll(n), o((l) => (l.delete(n), l));
},
allRegistered: s,
activeIds: n,
isSelected: (o) => n().has(o)
allRegistered: o,
activeIds: s,
isSelected: (n) => s().has(n)
};
}, he = (e, r, t, {
on: n = (c) => c.addEventListener,
off: s = (c) => c.removeEventListener
}, me = (e, r, t, {
on: s = (c) => c.addEventListener,
off: o = (c) => c.removeEventListener
} = {}) => {
n(e).call(e, r, t), _(() => {
s(e).call(e, r, t);
s(e).call(e, r, t), _(() => {
o(e).call(e, r, t);
});
}, de = (e) => {
const r = (t, n, s) => {
const c = s != null ? s : new n();
}, ge = (e) => {
const r = (t, s, o) => {
const c = o != null ? o : new s();
return Object.entries(t()).forEach(([u, a]) => {

@@ -332,3 +345,3 @@ c.set(u, a.toString());

toKeysAtom() {
return P(() => R(Object.keys(e)));
return O(() => R(Object.keys(e)));
},

@@ -359,16 +372,18 @@ toEntries() {

d as AtomTypeSymbol,
ae as DebounceAtom,
de as EntriesTransform,
ce as ObjectAtom,
ue as ThrottleAtom,
he as addListener,
le as DebounceAtom,
ge as EntriesTransform,
ue as ObjectAtom,
ie as ThrottleAtom,
oe as VModel,
me as addListener,
G as asyncLock,
f as atom,
I as atomization,
le as createBlackBoard,
k as atomization,
fe as createBlackBoard,
ee as createIgnoreFirst,
oe as genArray,
ae as genArray,
te as getAtomType,
y as isAtom,
P as reflect,
A as isAtom,
ce as localSync,
O as reflect,
U as reflectMemo,

@@ -379,8 +394,8 @@ W as resource,

C as useEffect,
A as useEffectWithoutFirst,
X as usePagination,
ie as usePaginationStack,
fe as useSelect,
g as useEffectWithoutFirst,
V as usePagination,
he as usePaginationStack,
de as useSelect,
ne as useSingleAsync
};
//# sourceMappingURL=index.js.map

@@ -5,1 +5,3 @@ export * from './asyncLock';

export declare const genArray: (num: number) => number[];
export * from './VModel';
export * from './localSync';
{
"name": "@cn-ui/reactive",
"version": "2.2.1",
"version": "2.2.2",
"description": "",

@@ -35,3 +35,3 @@ "main": "./dist/index.js",

"mitt": "^3.0.0",
"solid-js": "^1.6.15"
"solid-js": "^1.7.11"
},

@@ -38,0 +38,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc