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.0 to 2.2.1

203

./dist/index.js

@@ -1,13 +0,13 @@

var R = Object.defineProperty, j = Object.defineProperties;
var B = Object.getOwnPropertyDescriptors;
var T = Object.getOwnPropertySymbols;
var F = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
var k = (e, r, t) => r in e ? R(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, S = (e, r) => {
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) => {
for (var t in r || (r = {}))
F.call(r, t) && k(e, t, r[t]);
if (T)
for (var t of T(r))
q.call(r, t) && k(e, t, r[t]);
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]);
return e;
}, v = (e, r) => j(e, B(r));
}, b = (e, r) => B(e, F(r));
var w = (e, r, t) => new Promise((n, s) => {

@@ -29,7 +29,7 @@ var c = (o) => {

});
import { createEffect as E, on as H, createSignal as $, untrack as J, createMemo as I, batch as b, onCleanup as N } from "solid-js";
import { debounce as M, throttle as _ } from "lodash-es";
import { createEffect as x, on as $, createSignal as J, untrack as N, 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;
return z(
return C(
(s) => n ? (n = !1, null) : e(s),

@@ -39,14 +39,14 @@ r,

);
}, V = A, z = (e, r, t = null) => {
}, ee = A, C = (e, r, t = null) => {
let n = t;
return E(
H(r, () => (n = e(n), n))
return x(
$(r, () => (n = e(n), n))
);
}, d = Symbol("AtomTypeSymbol"), ee = (e) => e[d], f = (e, r) => {
const [t, n] = $(e, r);
}, d = Symbol("AtomTypeSymbol"), te = (e) => e[d], f = (e, r) => {
const [t, n] = J(e, r);
return Object.assign(
(...s) => s.length === 0 ? t() : n(...s),
{ reflux: C, [d]: "atom" }
{ reflux: K, [d]: "atom" }
);
}, C = function(e, r, t) {
}, K = function(e, r, t) {
const n = this, s = f(e, t);

@@ -56,17 +56,17 @@ return A(() => {

}, [s]), s[d] = "reflux", s;
}, x = (e, {
}, P = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => {
const n = f(r ? J(() => e(t)) : t);
return E((s) => {
const n = f(r ? N(() => e(t)) : t);
return x((s) => {
n(() => e(s));
}, t), n[d] = "reflect", n;
}, K = (e, {
}, U = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => I((n) => {
} = {}) => M((n) => {
const s = e(n);
return r ? s : (r = !0, t);
}, t), U = (e, {
}, t), W = (e, {
initValue: r = null,

@@ -76,35 +76,36 @@ immediately: t = !0,

refetch: s = {},
tap: c = (u) => {
}
tap: c = (a) => {
},
ignoreError: u = !1
} = {}) => {
const u = f(r), a = f(!1), o = f(!1), l = I(() => !a() && !o());
let i = Promise.resolve(!1);
const h = (...Ae) => w(void 0, [...Ae], function* ({ warn: g = !0, cancelCallback: P } = s) {
l() || (P ? P(i) : g && console.warn(
const a = f(r), o = f(!1), l = f(!1), i = M(() => !o() && !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(
"Resource Atom: some fetch has been covered; Recommend to add a cancelCallback to some Hook"
)), a(!0);
const p = e().then((m) => (b(() => {
u(() => m), a(!1), o(!1);
}), p === i && c(m), !0)).catch((m) => (b(() => {
o(m), a(!1);
}), m));
return i = p, p;
)), 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);
}), u || console.error(m), m));
return h = S, S;
});
return t && h(), n && n.length && A(() => h(s), n), Object.assign(u, {
error: o,
loading: a,
mutate(g) {
u(() => g);
return t && g(), n && n.length && A(() => g(s), n), Object.assign(a, {
error: l,
loading: o,
mutate(p) {
a(() => p);
},
isReady: l,
refetch: h,
promise: () => i,
isReady: i,
refetch: g,
promise: () => h,
[d]: "resource"
});
};
let D = () => {
let L = () => {
};
const te = (e) => {
e && (D = e);
}, W = function(e, r = D) {
const re = (e) => {
e && (L = e);
}, G = function(e, r = L) {
let t = !1;

@@ -114,5 +115,5 @@ return function(...n) {

};
}, re = W;
function O(e) {
return typeof e == "function" ? y(e) ? e : x(e()) : f(e);
}, ne = G;
function I(e) {
return typeof e == "function" ? y(e) ? e : P(e()) : f(e);
}

@@ -122,4 +123,4 @@ function y(e) {

}
const ne = (e) => e().map((r, t) => x(() => e()[t])), G = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), se = (e) => [...Array(e).keys()];
function L(e, r) {
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()];
function R(e, r) {
const t = y(e) ? e : f(e, r), n = (c, u, a) => {

@@ -133,3 +134,3 @@ const o = c.findIndex((l) => l === u);

};
return Object.assign(t, v(S({}, {
return Object.assign(t, b(v({}, {
replace(c, u) {

@@ -174,3 +175,3 @@ return t((a) => n(a, c, (o, l) => {

}
function oe(e, r) {
function ce(e, r) {
const t = y(e) ? e : f(e, { equals: !1 }), n = y(e) ? e() : e;

@@ -195,7 +196,7 @@ t[d] = "object";

}
function ce(e, r = 150) {
function ae(e, r = 150) {
let t = e();
const n = f(t);
return A(
M(() => {
D(() => {
const s = e();

@@ -207,7 +208,7 @@ s !== void 0 && n(() => s);

}
function ae(e, r = 150, t) {
function ue(e, r = 150, t) {
let n = e();
const s = f(n);
return A(
_(
z(
() => {

@@ -223,3 +224,3 @@ const c = e();

}
const ue = () => {
const le = () => {
const e = /* @__PURE__ */ new Map();

@@ -249,6 +250,6 @@ return {

};
}, Q = (e, r = {}) => {
}, X = (e, r = {}) => {
var a, o;
r.debounceTime = (a = r.debounceTime) != null ? a : 100;
const t = f((o = r.initIndex) != null ? o : 0), n = f(10), s = U(() => e(t(), n), r), c = M(() => s.refetch(), r.debounceTime), u = (i) => {
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())

@@ -264,3 +265,3 @@ return !1;

currentIndex: t,
currentPage: K(() => t() + 1),
currentPage: U(() => t() + 1),
maxPage: n,

@@ -275,3 +276,3 @@ prev() {

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

@@ -283,10 +284,10 @@ },

};
}, le = (e, r) => {
const t = f([], { equals: !1 }), n = Q((...s) => w(void 0, null, function* () {
}, 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;
}), r);
return v(S({}, n), {
return b(v({}, n), {
resetStack(s = !0) {
b(() => {
E(() => {
t([]), n.currentIndex(0), s && n.currentData.refetch();

@@ -297,6 +298,6 @@ });

});
}, ie = function(e = {}) {
}, fe = function(e = {}) {
var u, a;
const r = L(O((u = e.activeIds) != null ? u : [])), t = O((a = e.multi) != null ? a : !0), n = f(new Set(r()));
E(() => {
const r = R(I((u = e.activeIds) != null ? u : [])), t = I((a = e.multi) != null ? a : !0), n = f(new Set(r()));
x(() => {
!t() && r((o) => o.slice(0, 1)), n(() => new Set(r()));

@@ -319,10 +320,10 @@ });

};
}, fe = (e, r, t, {
}, he = (e, r, t, {
on: n = (c) => c.addEventListener,
off: s = (c) => c.removeEventListener
} = {}) => {
n(e).call(e, r, t), N(() => {
n(e).call(e, r, t), _(() => {
s(e).call(e, r, t);
});
}, he = (e) => {
}, de = (e) => {
const r = (t, n, s) => {

@@ -336,3 +337,3 @@ const c = s != null ? s : new n();

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

@@ -360,30 +361,30 @@ toEntries() {

export {
L as ArrayAtom,
ne as AtomToArray,
R as ArrayAtom,
se as AtomToArray,
d as AtomTypeSymbol,
ce as DebounceAtom,
he as EntriesTransform,
oe as ObjectAtom,
ae as ThrottleAtom,
fe as addListener,
W as asyncLock,
ae as DebounceAtom,
de as EntriesTransform,
ce as ObjectAtom,
ue as ThrottleAtom,
he as addListener,
G as asyncLock,
f as atom,
O as atomization,
ue as createBlackBoard,
V as createIgnoreFirst,
se as genArray,
ee as getAtomType,
I as atomization,
le as createBlackBoard,
ee as createIgnoreFirst,
oe as genArray,
te as getAtomType,
y as isAtom,
x as reflect,
K as reflectMemo,
U as resource,
te as setAsyncLockDefaultRefuse,
G as sleep,
z as useEffect,
P as reflect,
U as reflectMemo,
W as resource,
re as setAsyncLockDefaultRefuse,
Q as sleep,
C as useEffect,
A as useEffectWithoutFirst,
Q as usePagination,
le as usePaginationStack,
ie as useSelect,
re as useSingleAsync
X as usePagination,
ie as usePaginationStack,
fe as useSelect,
ne as useSingleAsync
};
//# sourceMappingURL=index.js.map

@@ -23,2 +23,4 @@ import { Accessor } from 'solid-js';

tap?: (data: T) => void;
/** 忽略报错提示 */
ignoreError?: boolean;
}

@@ -35,2 +37,2 @@ export interface RefetchOption {

*/
export declare const resource: <T>(fetcher: () => Promise<T>, { initValue, immediately, deps, refetch: defaultRefetch, tap: tapFn, }?: ResourceOptions<T>) => ResourceAtom<T>;
export declare const resource: <T>(fetcher: () => Promise<T>, { initValue, immediately, deps, refetch: defaultRefetch, tap: tapFn, ignoreError, }?: ResourceOptions<T>) => ResourceAtom<T>;

@@ -1,13 +0,13 @@

var R = Object.defineProperty, j = Object.defineProperties;
var B = Object.getOwnPropertyDescriptors;
var T = Object.getOwnPropertySymbols;
var F = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
var k = (e, r, t) => r in e ? R(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, S = (e, r) => {
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) => {
for (var t in r || (r = {}))
F.call(r, t) && k(e, t, r[t]);
if (T)
for (var t of T(r))
q.call(r, t) && k(e, t, r[t]);
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]);
return e;
}, v = (e, r) => j(e, B(r));
}, b = (e, r) => B(e, F(r));
var w = (e, r, t) => new Promise((n, s) => {

@@ -29,7 +29,7 @@ var c = (o) => {

});
import { createEffect as E, on as H, createSignal as $, untrack as J, createMemo as I, batch as b, onCleanup as N } from "solid-js";
import { debounce as M, throttle as _ } from "lodash-es";
import { createEffect as x, on as $, createSignal as J, untrack as N, 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;
return z(
return C(
(s) => n ? (n = !1, null) : e(s),

@@ -39,14 +39,14 @@ r,

);
}, V = A, z = (e, r, t = null) => {
}, ee = A, C = (e, r, t = null) => {
let n = t;
return E(
H(r, () => (n = e(n), n))
return x(
$(r, () => (n = e(n), n))
);
}, d = Symbol("AtomTypeSymbol"), ee = (e) => e[d], f = (e, r) => {
const [t, n] = $(e, r);
}, d = Symbol("AtomTypeSymbol"), te = (e) => e[d], f = (e, r) => {
const [t, n] = J(e, r);
return Object.assign(
(...s) => s.length === 0 ? t() : n(...s),
{ reflux: C, [d]: "atom" }
{ reflux: K, [d]: "atom" }
);
}, C = function(e, r, t) {
}, K = function(e, r, t) {
const n = this, s = f(e, t);

@@ -56,17 +56,17 @@ return A(() => {

}, [s]), s[d] = "reflux", s;
}, x = (e, {
}, P = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => {
const n = f(r ? J(() => e(t)) : t);
return E((s) => {
const n = f(r ? N(() => e(t)) : t);
return x((s) => {
n(() => e(s));
}, t), n[d] = "reflect", n;
}, K = (e, {
}, U = (e, {
immediately: r = !0,
initValue: t = null
} = {}) => I((n) => {
} = {}) => M((n) => {
const s = e(n);
return r ? s : (r = !0, t);
}, t), U = (e, {
}, t), W = (e, {
initValue: r = null,

@@ -76,35 +76,36 @@ immediately: t = !0,

refetch: s = {},
tap: c = (u) => {
}
tap: c = (a) => {
},
ignoreError: u = !1
} = {}) => {
const u = f(r), a = f(!1), o = f(!1), l = I(() => !a() && !o());
let i = Promise.resolve(!1);
const h = (...Ae) => w(void 0, [...Ae], function* ({ warn: g = !0, cancelCallback: P } = s) {
l() || (P ? P(i) : g && console.warn(
const a = f(r), o = f(!1), l = f(!1), i = M(() => !o() && !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(
"Resource Atom: some fetch has been covered; Recommend to add a cancelCallback to some Hook"
)), a(!0);
const p = e().then((m) => (b(() => {
u(() => m), a(!1), o(!1);
}), p === i && c(m), !0)).catch((m) => (b(() => {
o(m), a(!1);
}), m));
return i = p, p;
)), 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);
}), u || console.error(m), m));
return h = S, S;
});
return t && h(), n && n.length && A(() => h(s), n), Object.assign(u, {
error: o,
loading: a,
mutate(g) {
u(() => g);
return t && g(), n && n.length && A(() => g(s), n), Object.assign(a, {
error: l,
loading: o,
mutate(p) {
a(() => p);
},
isReady: l,
refetch: h,
promise: () => i,
isReady: i,
refetch: g,
promise: () => h,
[d]: "resource"
});
};
let D = () => {
let L = () => {
};
const te = (e) => {
e && (D = e);
}, W = function(e, r = D) {
const re = (e) => {
e && (L = e);
}, G = function(e, r = L) {
let t = !1;

@@ -114,5 +115,5 @@ return function(...n) {

};
}, re = W;
function O(e) {
return typeof e == "function" ? y(e) ? e : x(e()) : f(e);
}, ne = G;
function I(e) {
return typeof e == "function" ? y(e) ? e : P(e()) : f(e);
}

@@ -122,4 +123,4 @@ function y(e) {

}
const ne = (e) => e().map((r, t) => x(() => e()[t])), G = (e, r) => new Promise((t) => setTimeout(() => t(r), e)), se = (e) => [...Array(e).keys()];
function L(e, r) {
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()];
function R(e, r) {
const t = y(e) ? e : f(e, r), n = (c, u, a) => {

@@ -133,3 +134,3 @@ const o = c.findIndex((l) => l === u);

};
return Object.assign(t, v(S({}, {
return Object.assign(t, b(v({}, {
replace(c, u) {

@@ -174,3 +175,3 @@ return t((a) => n(a, c, (o, l) => {

}
function oe(e, r) {
function ce(e, r) {
const t = y(e) ? e : f(e, { equals: !1 }), n = y(e) ? e() : e;

@@ -195,7 +196,7 @@ t[d] = "object";

}
function ce(e, r = 150) {
function ae(e, r = 150) {
let t = e();
const n = f(t);
return A(
M(() => {
D(() => {
const s = e();

@@ -207,7 +208,7 @@ s !== void 0 && n(() => s);

}
function ae(e, r = 150, t) {
function ue(e, r = 150, t) {
let n = e();
const s = f(n);
return A(
_(
z(
() => {

@@ -223,3 +224,3 @@ const c = e();

}
const ue = () => {
const le = () => {
const e = /* @__PURE__ */ new Map();

@@ -249,6 +250,6 @@ return {

};
}, Q = (e, r = {}) => {
}, X = (e, r = {}) => {
var a, o;
r.debounceTime = (a = r.debounceTime) != null ? a : 100;
const t = f((o = r.initIndex) != null ? o : 0), n = f(10), s = U(() => e(t(), n), r), c = M(() => s.refetch(), r.debounceTime), u = (i) => {
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())

@@ -264,3 +265,3 @@ return !1;

currentIndex: t,
currentPage: K(() => t() + 1),
currentPage: U(() => t() + 1),
maxPage: n,

@@ -275,3 +276,3 @@ prev() {

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

@@ -283,10 +284,10 @@ },

};
}, le = (e, r) => {
const t = f([], { equals: !1 }), n = Q((...s) => w(void 0, null, function* () {
}, 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;
}), r);
return v(S({}, n), {
return b(v({}, n), {
resetStack(s = !0) {
b(() => {
E(() => {
t([]), n.currentIndex(0), s && n.currentData.refetch();

@@ -297,6 +298,6 @@ });

});
}, ie = function(e = {}) {
}, fe = function(e = {}) {
var u, a;
const r = L(O((u = e.activeIds) != null ? u : [])), t = O((a = e.multi) != null ? a : !0), n = f(new Set(r()));
E(() => {
const r = R(I((u = e.activeIds) != null ? u : [])), t = I((a = e.multi) != null ? a : !0), n = f(new Set(r()));
x(() => {
!t() && r((o) => o.slice(0, 1)), n(() => new Set(r()));

@@ -319,10 +320,10 @@ });

};
}, fe = (e, r, t, {
}, he = (e, r, t, {
on: n = (c) => c.addEventListener,
off: s = (c) => c.removeEventListener
} = {}) => {
n(e).call(e, r, t), N(() => {
n(e).call(e, r, t), _(() => {
s(e).call(e, r, t);
});
}, he = (e) => {
}, de = (e) => {
const r = (t, n, s) => {

@@ -336,3 +337,3 @@ const c = s != null ? s : new n();

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

@@ -360,30 +361,30 @@ toEntries() {

export {
L as ArrayAtom,
ne as AtomToArray,
R as ArrayAtom,
se as AtomToArray,
d as AtomTypeSymbol,
ce as DebounceAtom,
he as EntriesTransform,
oe as ObjectAtom,
ae as ThrottleAtom,
fe as addListener,
W as asyncLock,
ae as DebounceAtom,
de as EntriesTransform,
ce as ObjectAtom,
ue as ThrottleAtom,
he as addListener,
G as asyncLock,
f as atom,
O as atomization,
ue as createBlackBoard,
V as createIgnoreFirst,
se as genArray,
ee as getAtomType,
I as atomization,
le as createBlackBoard,
ee as createIgnoreFirst,
oe as genArray,
te as getAtomType,
y as isAtom,
x as reflect,
K as reflectMemo,
U as resource,
te as setAsyncLockDefaultRefuse,
G as sleep,
z as useEffect,
P as reflect,
U as reflectMemo,
W as resource,
re as setAsyncLockDefaultRefuse,
Q as sleep,
C as useEffect,
A as useEffectWithoutFirst,
Q as usePagination,
le as usePaginationStack,
ie as useSelect,
re as useSingleAsync
X as usePagination,
ie as usePaginationStack,
fe as useSelect,
ne as useSingleAsync
};
//# sourceMappingURL=index.js.map
{
"name": "@cn-ui/reactive",
"version": "2.2.0",
"version": "2.2.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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