@cn-ui/reactive
Advanced tools
Comparing version 4.10.3 to 4.11.0
import { createEffect as I, on as ke, untrack as j, createMemo as v, children as ne, onCleanup as de, createSignal as Ce, batch as R, createContext as _e, useContext as Te, onMount as Ne, mergeProps as Le, Switch as Pe, Match as X, For as je, Show as Be } from "solid-js"; | ||
import { watch as z, useDebouncedHistoryTravel as Fe, useElementBounding as Ue, useBreakpoints as He, breakpointsTailwind as Re } from "solidjs-use"; | ||
import { watch as z, useDebouncedHistoryTravel as Fe, useElementBounding as He, useBreakpoints as Ue, breakpointsTailwind as Re } from "solidjs-use"; | ||
import { debounce as me, throttle as We } from "radash"; | ||
import { debounce as xr, throttle as Ir } from "radash"; | ||
import { use as qe, spread as Ye, mergeProps as ge, insert as Ve, template as Je, createComponent as x, memo as ce, Portal as ze, isServer as Ze } from "solid-js/web"; | ||
import { debounce as kr, throttle as Cr } from "radash"; | ||
import { getNextElement as qe, use as Ye, spread as Ve, mergeProps as ge, insert as Je, runHydrationEvents as ze, template as Ze, createComponent as x, memo as ce, Portal as Ge, isServer as Ke } from "solid-js/web"; | ||
const W = (r, e, t = null) => { | ||
let n = !0; | ||
return Ge( | ||
return Qe( | ||
(s) => n ? (n = !1, null) : r(s), | ||
@@ -13,3 +13,3 @@ e, | ||
); | ||
}, jt = W, Ge = (r, e, t = null) => { | ||
}, Ft = W, Qe = (r, e, t = null) => { | ||
let n = t; | ||
@@ -20,7 +20,7 @@ return I( | ||
}; | ||
let Se = () => { | ||
let ye = () => { | ||
}; | ||
const Bt = (r) => { | ||
r && (Se = r); | ||
}, Ke = function(r, e = Se) { | ||
const Ht = (r) => { | ||
r && (ye = r); | ||
}, Xe = function(r, e = ye) { | ||
let t = !1; | ||
@@ -30,3 +30,3 @@ return function(...n) { | ||
}; | ||
}, Ft = Ke, q = (r, { | ||
}, Ut = Xe, q = (r, { | ||
/** 是否立刻求值 (是否忽略第一次求值) */ | ||
@@ -42,3 +42,3 @@ immediately: e = !0, | ||
} = {}) => { | ||
const a = S(e ? j(() => r(t)) : t, { | ||
const a = y(e ? j(() => r(t)) : t, { | ||
equals: o | ||
@@ -55,3 +55,3 @@ }); | ||
}); | ||
}, Z = q, Ut = (r, { | ||
}, Z = q, Rt = (r, { | ||
/** 是否立刻求值 (是否忽略第一次求值) */ | ||
@@ -66,7 +66,7 @@ immediately: e = !0, | ||
}, t); | ||
function Ht(r) { | ||
function Wt(r) { | ||
return typeof r == "function" ? G(r) ? r : ( | ||
// biome-ignore lint/complexity/noBannedTypes: <explanation> | ||
q(r()) | ||
) : S(r); | ||
) : y(r); | ||
} | ||
@@ -76,3 +76,3 @@ function G(r) { | ||
} | ||
const Rt = (r) => r().map((e, t) => q(() => r()[t])), Qe = (r, e) => new Promise((t) => setTimeout(() => t(e), r)), B = (r, e, t) => typeof r == "function" ? r.apply(t, e ?? []) : r, Wt = (r) => Array.isArray(r) ? r : [r], qt = (r, e = 10) => new Proxy(r, { | ||
const qt = (r) => r().map((e, t) => q(() => r()[t])), et = (r, e) => new Promise((t) => setTimeout(() => t(e), r)), B = (r, e, t) => typeof r == "function" ? r.apply(t, e ?? []) : r, Yt = (r) => Array.isArray(r) ? r : [r], Vt = (r, e = 10) => new Proxy(r, { | ||
get(t, n) { | ||
@@ -85,3 +85,3 @@ if (n === "length") | ||
} | ||
}), Yt = (r, e = 1) => v(() => { | ||
}), Jt = (r, e = 1) => v(() => { | ||
const t = ne(r).toArray(); | ||
@@ -91,3 +91,3 @@ if (t.length > e) | ||
return t; | ||
}), Vt = (r, e = !0) => v(() => { | ||
}), zt = (r, e = !0) => v(() => { | ||
const t = ne(r).toArray(); | ||
@@ -97,3 +97,3 @@ if (t.length > 1 && e) | ||
return t[0]; | ||
}), Jt = (r) => { | ||
}), Zt = (r) => { | ||
const e = ne(r).toArray(); | ||
@@ -104,12 +104,10 @@ return [ | ||
]; | ||
}, se = (r) => [...Array(r).keys()], Xe = (r, e, t, n, s) => { | ||
}, se = (r) => [...Array(r).keys()], tt = (r, e, t, n, s) => { | ||
let o; | ||
const a = s?.aEqual ?? ((c) => c === o), u = s?.bEqual ?? ((c) => c === o), l = z([e], () => { | ||
if (u(e())) | ||
return; | ||
if (u(e())) return; | ||
const c = n(e()); | ||
r(() => c), o = c; | ||
}), i = z([r], () => { | ||
if (a(r())) | ||
return; | ||
if (a(r())) return; | ||
const c = t(r()); | ||
@@ -128,6 +126,6 @@ e(() => c), o = c; | ||
}; | ||
}, O = Symbol("AtomTypeSymbol"), zt = (r) => r[O], S = (r, e) => { | ||
}, O = Symbol("AtomTypeSymbol"), Gt = (r) => r[O], y = (r, e) => { | ||
const t = Ce(r, e); | ||
return et(t); | ||
}, et = (r) => { | ||
return rt(t); | ||
}, rt = (r) => { | ||
const [e, t] = r; | ||
@@ -137,3 +135,3 @@ return Object.assign( | ||
{ | ||
reflux: ye, | ||
reflux: Se, | ||
sync: ve, | ||
@@ -153,3 +151,3 @@ /** 转换为原来的写法,为了兼容其他 api 的要求 */ | ||
); | ||
}, Zt = (r, e) => { | ||
}, Kt = (r, e) => { | ||
const [t, n] = r; | ||
@@ -159,3 +157,3 @@ return Object.assign( | ||
{ | ||
reflux: ye, | ||
reflux: Se, | ||
sync: ve, | ||
@@ -165,4 +163,4 @@ [O]: "store-atom" | ||
); | ||
}, ye = function(r, e, t) { | ||
const n = S(r, t); | ||
}, Se = function(r, e, t) { | ||
const n = y(r, t); | ||
return W(() => { | ||
@@ -172,3 +170,3 @@ this(() => e(n())); | ||
}, ve = function(r, e, t) { | ||
const n = S(r()), { breakSync: s } = Xe(this, n, r, e, t); | ||
const n = y(r()), { breakSync: s } = tt(this, n, r, e, t); | ||
return Object.assign(n, { | ||
@@ -188,6 +186,6 @@ stopSync: s | ||
} = {}) => { | ||
const u = S(e), l = S(!1), i = S(!1), c = v(() => !l() && !i()); | ||
const u = y(e), l = y(!1), i = y(!1), c = v(() => !l() && !i()); | ||
let f = Promise.resolve(!1); | ||
const h = async (d, { warn: y = !0, cancelCallback: w } = s) => { | ||
c() || (w ? w(f) : y && console.warn( | ||
const h = async (d, { warn: S = !0, cancelCallback: w } = s) => { | ||
c() || (w ? w(f) : S && console.warn( | ||
"Resource Atom: some fetch has been covered; Recommend to add a cancelCallback to some Hook" | ||
@@ -213,3 +211,3 @@ )), l(!0); | ||
}); | ||
}, Gt = (r, { | ||
}, Qt = (r, { | ||
/** @ts-ignore */ | ||
@@ -223,3 +221,3 @@ initValue: e = null, | ||
} = {}) => { | ||
const o = S(e), a = S(!1), u = S(!1), l = v(() => !a() && !u()); | ||
const o = y(e), a = y(!1), u = y(!1), l = v(() => !a() && !u()); | ||
let i = Promise.resolve(!1); | ||
@@ -232,8 +230,8 @@ const c = async (f, { warn: h = !0, cancelCallback: d } = t) => { | ||
}); | ||
const y = r(f).then((w) => (R(() => { | ||
const S = r(f).then((w) => (R(() => { | ||
o(() => w), a(!1), u(!1); | ||
}), y === i && n(w), !0)).catch((w) => (R(() => { | ||
}), S === i && n(w), !0)).catch((w) => (R(() => { | ||
u(w), a(!1); | ||
}), s(w), w)); | ||
return i = y, y; | ||
return i = S, S; | ||
}; | ||
@@ -252,4 +250,4 @@ return I(() => c(void 0, t)), Object.assign(o, { | ||
}; | ||
function tt(r, e) { | ||
const t = G(r) ? r : S(r, e), n = (o, a, u) => { | ||
function nt(r, e) { | ||
const t = G(r) ? r : y(r, e), n = (o, a, u) => { | ||
const l = o.findIndex((i) => i === a); | ||
@@ -307,4 +305,4 @@ if (l >= 0) { | ||
} | ||
function Kt(r) { | ||
const e = G(r) ? r : S(r, { equals: !1 }), t = G(r) ? r() : r; | ||
function Xt(r) { | ||
const e = G(r) ? r : y(r, { equals: !1 }), t = G(r) ? r() : r; | ||
e[O] = "object"; | ||
@@ -314,4 +312,3 @@ const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([O, ...Object.keys(t)]); | ||
get(o, a) { | ||
if (!s.has(a)) | ||
throw new Error(`key: ${a} can't be found in formObject!`); | ||
if (!s.has(a)) throw new Error(`key: ${a} can't be found in formObject!`); | ||
if (n.has(a)) | ||
@@ -329,4 +326,4 @@ return n.get(a); | ||
} | ||
function Qt(r, e = 150) { | ||
const t = r(), n = S(t); | ||
function er(r, e = 150) { | ||
const t = r(), n = y(t); | ||
return W( | ||
@@ -340,4 +337,4 @@ me({ delay: e }, () => { | ||
} | ||
function Xt(r, e = 150) { | ||
const t = r(), n = S(t); | ||
function tr(r, e = 150) { | ||
const t = r(), n = y(t); | ||
return W( | ||
@@ -351,4 +348,4 @@ We({ interval: e }, () => { | ||
} | ||
const er = S, tr = (r = {}) => { | ||
const e = rt({ | ||
const rr = y, nr = (r = {}) => { | ||
const e = st({ | ||
...r, | ||
@@ -358,5 +355,5 @@ onUpdate() { | ||
} | ||
}), t = S(e.store, { equals: !1 }); | ||
}), t = y(e.store, { equals: !1 }); | ||
return t; | ||
}, rt = (r = {}) => { | ||
}, st = (r = {}) => { | ||
const e = /* @__PURE__ */ new Map(); | ||
@@ -382,4 +379,3 @@ return { | ||
deleteFn: (n) => { | ||
if (!e.has(n)) | ||
throw new Error(`Blackboard app ${n.toString()} isn't init yet`); | ||
if (!e.has(n)) throw new Error(`Blackboard app ${n.toString()} isn't init yet`); | ||
e.delete(n), r.onUpdate?.(); | ||
@@ -395,3 +391,3 @@ }, | ||
}; | ||
}, rr = (r, e = !1) => { | ||
}, sr = (r, e = !1) => { | ||
const t = _e(r); | ||
@@ -407,5 +403,5 @@ return { | ||
}; | ||
}, nt = (r, e = {}) => { | ||
}, ot = (r, e = {}) => { | ||
e.debounceTime = e.debounceTime ?? 100; | ||
const t = S(e.initIndex ?? 0), n = S(10), s = S(10), o = we(() => r(t(), n, s), e), a = () => o.refetch(), u = me({ delay: e.debounceTime }, a), l = (c, f = !1) => { | ||
const t = y(e.initIndex ?? 0), n = y(10), s = y(10), o = we(() => r(t(), n, s), e), a = () => o.refetch(), u = me({ delay: e.debounceTime }, a), l = (c, f = !1) => { | ||
if (c < 0 || c >= n()) | ||
@@ -439,3 +435,3 @@ return !1; | ||
async waitForDone() { | ||
return Qe(e.debounceTime + 10).then(o.promise); | ||
return et(e.debounceTime + 10).then(o.promise); | ||
}, | ||
@@ -457,4 +453,4 @@ /** 重新异步获取 */ | ||
}; | ||
}, nr = (r, e) => { | ||
const t = S([], { equals: !1 }), n = nt(async (...s) => { | ||
}, or = (r, e) => { | ||
const t = y([], { equals: !1 }), n = ot(async (...s) => { | ||
const o = await r(...s); | ||
@@ -480,4 +476,4 @@ return t((a) => (a[s[0]] = o, a)), o; | ||
}; | ||
function st(r, e = {}) { | ||
const t = e.multi ?? (() => !0), n = e.getId ?? ((i) => i.value), s = Z(() => new Map(r().map((i) => [n(i), i]))), o = S(/* @__PURE__ */ new Map()), a = S(/* @__PURE__ */ new Map()); | ||
function at(r, e = {}) { | ||
const t = e.multi ?? (() => !0), n = e.getId ?? ((i) => i.value), s = Z(() => new Map(r().map((i) => [n(i), i]))), o = y(/* @__PURE__ */ new Map()), a = y(/* @__PURE__ */ new Map()); | ||
I(() => { | ||
@@ -488,6 +484,4 @@ !t() && j(o).size >= 1 && o((i) => { | ||
if (s().has(f[0])) { | ||
if (c.set(f[0], f[1]), !e.keepUndefinedOption) | ||
break; | ||
} else | ||
e.keepUndefinedOption && c.set(f[0], f[1]); | ||
if (c.set(f[0], f[1]), !e.keepUndefinedOption) break; | ||
} else e.keepUndefinedOption && c.set(f[0], f[1]); | ||
return c; | ||
@@ -507,4 +501,4 @@ }); | ||
let i = !1, c = !1; | ||
for (const y of s().keys()) | ||
o().has(y) ? i = !0 : c = !0; | ||
for (const S of s().keys()) | ||
o().has(S) ? i = !0 : c = !0; | ||
const f = i && c, h = i && !c, d = !i && c || s().size === 0; | ||
@@ -576,7 +570,5 @@ return { isAll: h, isNone: d, isPartial: f }; | ||
const f = (h, d) => { | ||
if (!h || !d || h.length !== d.length) | ||
return !1; | ||
for (let y = 0; y < h.length; y++) | ||
if (h[y] !== d[y]) | ||
return !1; | ||
if (!h || !d || h.length !== d.length) return !1; | ||
for (let S = 0; S < h.length; S++) | ||
if (h[S] !== d[S]) return !1; | ||
return !0; | ||
@@ -593,3 +585,3 @@ }; | ||
} | ||
const ot = (r, e) => ({ | ||
const it = (r, e) => ({ | ||
label: () => e.label ?? e.value, | ||
@@ -605,3 +597,3 @@ selectHandle() { | ||
} | ||
}), at = (r) => { | ||
}), ct = (r) => { | ||
const e = (t) => { | ||
@@ -632,3 +624,3 @@ r((n) => { | ||
}; | ||
function it(r) { | ||
function ut(r) { | ||
let e, t = !1; | ||
@@ -639,4 +631,4 @@ return function(...n) { | ||
} | ||
const sr = (r, e, t) => { | ||
const n = it(r); | ||
const ar = (r, e, t) => { | ||
const n = ut(r); | ||
return Ne(() => { | ||
@@ -652,4 +644,4 @@ if (t.onMountInit || e()) | ||
}; | ||
var $e = 60, De = $e * 60, Me = De * 24, ct = Me * 7, F = 1e3, ee = $e * F, ue = De * F, ut = Me * F, lt = ct * F, oe = "millisecond", T = "second", N = "minute", L = "hour", b = "day", J = "week", A = "month", Ae = "quarter", E = "year", P = "date", ft = "YYYY-MM-DDTHH:mm:ssZ", le = "Invalid Date", ht = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, dt = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; | ||
const mt = { | ||
var $e = 60, De = $e * 60, Me = De * 24, lt = Me * 7, F = 1e3, ee = $e * F, ue = De * F, ft = Me * F, ht = lt * F, oe = "millisecond", T = "second", N = "minute", L = "hour", b = "day", J = "week", A = "month", Ae = "quarter", E = "year", P = "date", dt = "YYYY-MM-DDTHH:mm:ssZ", le = "Invalid Date", mt = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, gt = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; | ||
const yt = { | ||
name: "en", | ||
@@ -666,13 +658,12 @@ weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), | ||
return !s || s.length >= t ? e : "" + Array(t + 1 - s.length).join(n) + e; | ||
}, gt = function(e) { | ||
}, St = function(e) { | ||
var t = -e.utcOffset(), n = Math.abs(t), s = Math.floor(n / 60), o = n % 60; | ||
return (t <= 0 ? "+" : "-") + te(s, 2, "0") + ":" + te(o, 2, "0"); | ||
}, St = function r(e, t) { | ||
if (e.date() < t.date()) | ||
return -r(t, e); | ||
}, vt = function r(e, t) { | ||
if (e.date() < t.date()) return -r(t, e); | ||
var n = (t.year() - e.year()) * 12 + (t.month() - e.month()), s = e.clone().add(n, A), o = t - s < 0, a = e.clone().add(n + (o ? -1 : 1), A); | ||
return +(-(n + (t - s) / (o ? s - a : a - s)) || 0); | ||
}, yt = function(e) { | ||
}, wt = function(e) { | ||
return e < 0 ? Math.ceil(e) || 0 : Math.floor(e); | ||
}, vt = function(e) { | ||
}, $t = function(e) { | ||
var t = { | ||
@@ -691,15 +682,15 @@ M: A, | ||
return t[e] || String(e || "").toLowerCase().replace(/s$/, ""); | ||
}, wt = function(e) { | ||
}, Dt = function(e) { | ||
return e === void 0; | ||
}; | ||
const $t = { | ||
const Mt = { | ||
s: te, | ||
z: gt, | ||
m: St, | ||
a: yt, | ||
p: vt, | ||
u: wt | ||
z: St, | ||
m: vt, | ||
a: wt, | ||
p: $t, | ||
u: Dt | ||
}; | ||
var H = "en", k = {}; | ||
k[H] = mt; | ||
var U = "en", k = {}; | ||
k[U] = yt; | ||
var Oe = "$isDayjsObject", ae = function(e) { | ||
@@ -709,4 +700,3 @@ return e instanceof Q || !!(e && e[Oe]); | ||
var s; | ||
if (!e) | ||
return H; | ||
if (!e) return U; | ||
if (typeof e == "string") { | ||
@@ -722,3 +712,3 @@ var o = e.toLowerCase(); | ||
} | ||
return !n && s && (H = s), s || !n && H; | ||
return !n && s && (U = s), s || !n && U; | ||
}, g = function(e, t) { | ||
@@ -729,3 +719,3 @@ if (ae(e)) | ||
return n.date = e, n.args = arguments, new Q(n); | ||
}, Dt = function(e, t) { | ||
}, At = function(e, t) { | ||
return g(e, { | ||
@@ -738,16 +728,13 @@ locale: t.$L, | ||
}); | ||
}, m = $t; | ||
}, m = Mt; | ||
m.l = K; | ||
m.i = ae; | ||
m.w = Dt; | ||
var Mt = function(e) { | ||
m.w = At; | ||
var Ot = function(e) { | ||
var t = e.date, n = e.utc; | ||
if (t === null) | ||
return /* @__PURE__ */ new Date(NaN); | ||
if (m.u(t)) | ||
return /* @__PURE__ */ new Date(); | ||
if (t instanceof Date) | ||
return new Date(t); | ||
if (t === null) return /* @__PURE__ */ new Date(NaN); | ||
if (m.u(t)) return /* @__PURE__ */ new Date(); | ||
if (t instanceof Date) return new Date(t); | ||
if (typeof t == "string" && !/Z$/i.test(t)) { | ||
var s = t.match(ht); | ||
var s = t.match(mt); | ||
if (s) { | ||
@@ -765,3 +752,3 @@ var o = s[2] - 1 || 0, a = (s[7] || "0").substring(0, 3); | ||
return e.parse = function(n) { | ||
this.$d = Mt(n), this.init(); | ||
this.$d = Ot(n), this.init(); | ||
}, e.init = function() { | ||
@@ -805,3 +792,3 @@ var n = this.$d; | ||
case J: { | ||
var y = this.$locale().weekStart || 0, w = (c < y ? c + 7 : c) - y; | ||
var S = this.$locale().weekStart || 0, w = (c < S ? c + 7 : c) - S; | ||
return l(a ? h - w : h + (6 - w), f); | ||
@@ -828,4 +815,3 @@ } | ||
c.$d[l](i), c.init(), this.$d = c.set(P, Math.min(this.$D, c.daysInMonth())).$d; | ||
} else | ||
l && this.$d[l](i); | ||
} else l && this.$d[l](i); | ||
return this.init(), this; | ||
@@ -857,5 +843,4 @@ }, e.set = function(n, s) { | ||
var s = this, o = this.$locale(); | ||
if (!this.isValid()) | ||
return o.invalidDate || le; | ||
var a = n || ft, u = m.z(this), l = this.$H, i = this.$m, c = this.$M, f = o.weekdays, h = o.months, d = o.meridiem, y = function($, C, Y, Ie) { | ||
if (!this.isValid()) return o.invalidDate || le; | ||
var a = n || dt, u = m.z(this), l = this.$H, i = this.$m, c = this.$M, f = o.weekdays, h = o.months, d = o.meridiem, S = function($, C, Y, Ie) { | ||
return $ && ($[C] || $(s, a)) || Y[C].slice(0, Ie); | ||
@@ -878,5 +863,5 @@ }, w = function($) { | ||
case "MMM": | ||
return y(o.monthsShort, c, h, 3); | ||
return S(o.monthsShort, c, h, 3); | ||
case "MMMM": | ||
return y(h, c); | ||
return S(h, c); | ||
case "D": | ||
@@ -889,5 +874,5 @@ return s.$D; | ||
case "dd": | ||
return y(o.weekdaysMin, s.$W, f, 2); | ||
return S(o.weekdaysMin, s.$W, f, 2); | ||
case "ddd": | ||
return y(o.weekdaysShort, s.$W, f, 3); | ||
return S(o.weekdaysShort, s.$W, f, 3); | ||
case "dddd": | ||
@@ -922,3 +907,3 @@ return f[s.$W]; | ||
}; | ||
return a.replace(dt, function(M, $) { | ||
return a.replace(gt, function(M, $) { | ||
return $ || D(M) || u.replace(":", ""); | ||
@@ -943,6 +928,6 @@ }); | ||
case J: | ||
h = (c - i) / lt; | ||
h = (c - i) / ht; | ||
break; | ||
case b: | ||
h = (c - i) / ut; | ||
h = (c - i) / ft; | ||
break; | ||
@@ -968,4 +953,3 @@ case L: | ||
}, e.locale = function(n, s) { | ||
if (!n) | ||
return this.$L; | ||
if (!n) return this.$L; | ||
var o = this.clone(), a = K(n, s, !0); | ||
@@ -999,6 +983,6 @@ return a && (o.$L = a), o; | ||
}; | ||
g.en = k[H]; | ||
g.en = k[U]; | ||
g.Ls = k; | ||
g.p = {}; | ||
const At = function(r, e, t) { | ||
const pt = function(r, e, t) { | ||
e.prototype.isBetween = function(n, s, o, a) { | ||
@@ -1010,3 +994,3 @@ var u = t(n), l = t(s); | ||
}; | ||
}, Ot = function(r, e, t) { | ||
}, bt = function(r, e, t) { | ||
var n = function(o, a) { | ||
@@ -1037,6 +1021,6 @@ if (!a || !a.length || a.length === 1 && !a[0] || a.length === 1 && Array.isArray(a[0]) && !a[0].length) | ||
let fe; | ||
const or = () => { | ||
fe || (g.extend(Ot), g.extend(At), fe = !0); | ||
}, ar = (r, e) => { | ||
const t = r, n = v(() => e.mode()), s = v(() => e.unit()), o = S(g()), a = () => t().length === 1, u = (i, c) => t().length === 0 ? !1 : ["single", "multiple"].includes(n()) ? t().some((f) => i.isSame(f, c ?? s())) : a() ? l(i, c) : i.isBetween(t()[0], t()[1], c ?? s(), "[]"), l = (i, c) => { | ||
const ir = () => { | ||
fe || (g.extend(bt), g.extend(pt), fe = !0); | ||
}, cr = (r, e) => { | ||
const t = r, n = v(() => e.mode()), s = v(() => e.unit()), o = y(g()), a = () => t().length === 1, u = (i, c) => t().length === 0 ? !1 : ["single", "multiple"].includes(n()) ? t().some((f) => i.isSame(f, c ?? s())) : a() ? l(i, c) : i.isBetween(t()[0], t()[1], c ?? s(), "[]"), l = (i, c) => { | ||
const f = [t()[0], o()]; | ||
@@ -1076,3 +1060,3 @@ return i.isBetween(g.min(f), g.max(f), c ?? s()); | ||
}; | ||
}, ir = (r, e) => { | ||
}, ur = (r, e) => { | ||
const t = v(() => { | ||
@@ -1088,5 +1072,5 @@ const o = r().startOf("month"), a = r().endOf("month"), u = o.day(e().startOfWeek ?? 0), l = a.add( | ||
lastDateOfMonth: a, | ||
dayInMonth: U(o, a), | ||
paddingStart: U(u, o.add(-1, "d")), | ||
paddingEnd: U(a.add(1, "d"), l) | ||
dayInMonth: H(o, a), | ||
paddingStart: H(u, o.add(-1, "d")), | ||
paddingEnd: H(a.add(1, "d"), l) | ||
}; | ||
@@ -1097,3 +1081,3 @@ }), n = v(() => { | ||
const a = t().firstDateOfCalendar; | ||
return U(a.add(-o, "w"), a.add(-1, "d")); | ||
return H(a.add(-o, "w"), a.add(-1, "d")); | ||
} else | ||
@@ -1105,3 +1089,3 @@ return []; | ||
const a = t().lastDateOfCalendar; | ||
return U(a.add(1, "d"), a.add(o, "w")); | ||
return H(a.add(1, "d"), a.add(o, "w")); | ||
} else | ||
@@ -1117,6 +1101,6 @@ return []; | ||
const o = e().locales; | ||
return bt(o, { month: "short", locale: o }); | ||
return xt(o, { month: "short", locale: o }); | ||
}, | ||
weekHeader() { | ||
const o = e().locales, a = pt(o, { weekday: "narrow" }); | ||
const o = e().locales, a = Et(o, { weekday: "narrow" }); | ||
return se(7).map((u) => ((e().startOfWeek ?? 0) + u) % 7).map((u) => a[u]); | ||
@@ -1128,3 +1112,3 @@ }, | ||
}; | ||
}, pt = (r, e) => { | ||
}, Et = (r, e) => { | ||
const t = se(7), n = g(), s = new Intl.DateTimeFormat(r, e); | ||
@@ -1135,3 +1119,3 @@ return t.map((o) => { | ||
}); | ||
}, bt = (r, e) => { | ||
}, xt = (r, e) => { | ||
const t = new Intl.DateTimeFormat(r, e); | ||
@@ -1142,3 +1126,3 @@ return se(12).map((n) => { | ||
}); | ||
}, U = (r, e) => { | ||
}, H = (r, e) => { | ||
if (e < r) | ||
@@ -1151,3 +1135,3 @@ return console.warn("getDaysInRange end > start"), []; | ||
return t; | ||
}, cr = () => { | ||
}, lr = () => { | ||
let r, e; | ||
@@ -1158,4 +1142,4 @@ const t = new Promise((n, s) => { | ||
return { resolve: r, reject: e, promise: t }; | ||
}, ur = (r) => { | ||
const e = r.paths, t = Et(e), n = we( | ||
}, fr = (r) => { | ||
const e = r.paths, t = It(e), n = we( | ||
async () => r.listItems(e()), | ||
@@ -1171,3 +1155,3 @@ { | ||
}; | ||
}, Et = (r) => { | ||
}, It = (r) => { | ||
const { undo: e, redo: t, canRedo: n, canUndo: s } = Fe(r.toSignal()); | ||
@@ -1192,3 +1176,3 @@ return { | ||
}; | ||
}, lr = (r) => { | ||
}, hr = (r) => { | ||
const e = (t, n, s) => { | ||
@@ -1202,3 +1186,3 @@ const o = s ?? new n(); | ||
toKeysAtom() { | ||
return q(() => tt(Object.keys(r))); | ||
return q(() => nt(Object.keys(r))); | ||
}, | ||
@@ -1225,3 +1209,3 @@ toEntries() { | ||
}; | ||
function fr(r, e) { | ||
function dr(r, e) { | ||
return Z( | ||
@@ -1268,3 +1252,3 @@ () => B( | ||
} | ||
function hr(...r) { | ||
function mr(...r) { | ||
const e = []; | ||
@@ -1300,7 +1284,7 @@ for (let t = 0; t < r.length; t++) { | ||
); | ||
}, xt = (r, e = {}) => (t) => { | ||
}, kt = (r, e = {}) => (t) => { | ||
const n = (...l) => Object.assign({}, t.style ?? {}, ...l), s = (...l) => v(() => { | ||
const i = typeof t.class == "function" ? t.class() : t.class, c = typeof t.className == "function" ? t.className() : t.className, f = typeof t.classList == "function" ? t.classList() : t.classList; | ||
return ie(i, c, f, ...l); | ||
})(), o = t["v-model"] ?? S(e?.modelValue ?? null), u = Le(t, { | ||
})(), o = t["v-model"] ?? y(e?.modelValue ?? null), u = Le(t, { | ||
style: n, | ||
@@ -1318,4 +1302,4 @@ class: s, | ||
}; | ||
var It = /* @__PURE__ */ Je("<div>"); | ||
const dr = (r, e) => ({ | ||
var Ct = /* @__PURE__ */ Ze("<div>"); | ||
const gr = (r, e) => ({ | ||
...r, | ||
@@ -1328,3 +1312,3 @@ ref: (t) => { | ||
...re(r) | ||
}), mr = xt((r) => { | ||
}), yr = kt((r) => { | ||
const e = v(() => ({ | ||
@@ -1335,6 +1319,6 @@ ...r.style(), | ||
return (() => { | ||
var t = It(); | ||
return qe((n) => { | ||
var t = qe(Ct); | ||
return Ye((n) => { | ||
r.prop.ref?.(n), r.ref?.(n); | ||
}, t), Ye(t, ge({ | ||
}, t), Ve(t, ge({ | ||
get class() { | ||
@@ -1346,5 +1330,5 @@ return r.prop.class("cn-div", r.class()); | ||
} | ||
}, () => re(r), () => re(r.prop)), !1, !0), Ve(t, () => r.children), t; | ||
}, () => re(r), () => re(r.prop)), !1, !0), Je(t, () => r.children), ze(), t; | ||
})(); | ||
}), kt = function(r) { | ||
}), _t = function(r) { | ||
const e = v(() => { | ||
@@ -1383,5 +1367,5 @@ if (r.children && (r.resource.isReady() || r.keepLastState)) | ||
}; | ||
function Ct(r) { | ||
function Tt(r) { | ||
return function(e) { | ||
return x(kt, ge(e, { | ||
return x(_t, ge(e, { | ||
get resource() { | ||
@@ -1410,9 +1394,9 @@ return e.resource; | ||
}; | ||
function gr(r) { | ||
return Ct(Ee)(r); | ||
function Sr(r) { | ||
return Tt(Ee)(r); | ||
} | ||
const Sr = (r) => Object.assign(Ee, r), yr = (r) => { | ||
const e = st(() => r.options(), { | ||
const vr = (r) => Object.assign(Ee, r), wr = (r) => { | ||
const e = at(() => r.options(), { | ||
multi: () => !1 | ||
}), t = at(r.options); | ||
}), t = ct(r.options); | ||
return x(je, { | ||
@@ -1423,3 +1407,3 @@ get each() { | ||
children: (n, s) => { | ||
const o = ot(e, n); | ||
const o = it(e, n); | ||
return r.children(n, o, { | ||
@@ -1433,3 +1417,3 @@ index: s, | ||
}; | ||
function vr(r) { | ||
function $r(r) { | ||
return x(Be, { | ||
@@ -1443,7 +1427,7 @@ get when() { | ||
get children() { | ||
return x(ze, r); | ||
return x(Ge, r); | ||
} | ||
}); | ||
} | ||
class wr { | ||
class Dr { | ||
constructor(e, t) { | ||
@@ -1469,3 +1453,3 @@ this.spaceName = e, this.slots = t; | ||
} | ||
const $r = async (r, e, { | ||
const Mr = async (r, e, { | ||
step: t = 16, | ||
@@ -1490,10 +1474,8 @@ horizontal: n = !1, | ||
}, 50); | ||
})) | ||
return; | ||
if (Date.now() - o > s) | ||
throw new Error("scroll long time"); | ||
})) return; | ||
if (Date.now() - o > s) throw new Error("scroll long time"); | ||
r[n ? "scrollLeft" : "scrollTop"] += t; | ||
} while (n ? r.scrollLeft < r.scrollWidth : r.scrollTop < r.scrollHeight); | ||
throw new Error("Cant find an element when scroll "); | ||
}, Dr = (r) => new Promise((e) => { | ||
}, Ar = (r) => new Promise((e) => { | ||
const t = new IntersectionObserver((n) => { | ||
@@ -1517,4 +1499,4 @@ n.forEach((s) => { | ||
getIndex: () => xe.incr++ | ||
}, Mr = (r) => { | ||
const e = v(() => r.children ? r.children : typeof r.target == "string" ? Ze ? null : document.querySelector(r.target) : r.target?.()), t = Ue(e), n = Z(() => r.show?.() !== !1); | ||
}, Or = (r) => { | ||
const e = v(() => r.children ? r.children : typeof r.target == "string" ? Ke ? null : document.querySelector(r.target) : r.target?.()), t = He(e), n = Z(() => r.show?.() !== !1); | ||
return { | ||
@@ -1532,18 +1514,12 @@ coverStyle: v(() => ({ | ||
}; | ||
}, Ar = (r, e = 24) => (r * 100 / e).toFixed(6) + "%"; | ||
function Or(r) { | ||
const e = He(Re), t = e.smaller("sm"), n = e.greaterOrEqual("sm"), s = e.greaterOrEqual("md"), o = e.greaterOrEqual("lg"), a = e.greaterOrEqual("xl"), u = e.greaterOrEqual("2xl"); | ||
}, pr = (r, e = 24) => (r * 100 / e).toFixed(6) + "%"; | ||
function br(r) { | ||
const e = Ue(Re), t = e.smaller("sm"), n = e.greaterOrEqual("sm"), s = e.greaterOrEqual("md"), o = e.greaterOrEqual("lg"), a = e.greaterOrEqual("xl"), u = e.greaterOrEqual("2xl"); | ||
return q(() => { | ||
if (u()) | ||
return r.xxl; | ||
if (a()) | ||
return r.xl; | ||
if (o()) | ||
return r.lg; | ||
if (s()) | ||
return r.md; | ||
if (n()) | ||
return r.sm; | ||
if (t()) | ||
return r.xs; | ||
if (u()) return r.xxl; | ||
if (a()) return r.xl; | ||
if (o()) return r.lg; | ||
if (s()) return r.md; | ||
if (n()) return r.sm; | ||
if (t()) return r.xs; | ||
}); | ||
@@ -1556,3 +1532,3 @@ } | ||
}; | ||
const _t = function() { | ||
const Nt = function() { | ||
return { | ||
@@ -1571,3 +1547,3 @@ storage: localStorage, | ||
}; | ||
}, pr = (r, e, t = _t()) => { | ||
}, Er = (r, e, t = Nt()) => { | ||
const n = () => t.storage.setItem(e, t.toStorage(r())), s = (a = !1) => { | ||
@@ -1584,81 +1560,82 @@ const u = t.storage.getItem(e); | ||
export { | ||
gr as AC, | ||
kt as AS, | ||
tt as ArrayAtom, | ||
qt as ArrayFolder, | ||
Rt as AtomToArray, | ||
Sr as AC, | ||
_t as AS, | ||
nt as ArrayAtom, | ||
Vt as ArrayFolder, | ||
qt as AtomToArray, | ||
O as AtomTypeSymbol, | ||
wr as ComponentSlots, | ||
Qt as DebounceAtom, | ||
Dr as ComponentSlots, | ||
er as DebounceAtom, | ||
Ee as DefaultAC, | ||
Sr as DefineAC, | ||
lr as EntriesTransform, | ||
bt as MonthLocale, | ||
er as NullAtom, | ||
Kt as ObjectAtom, | ||
xt as OriginComponent, | ||
mr as OriginDiv, | ||
vr as PortalEasy, | ||
yr as SelectableList, | ||
et as SignalToAtom, | ||
Zt as StoreToAtom, | ||
pr as SyncStorage, | ||
Xt as ThrottleAtom, | ||
pt as WeekTitleLocale, | ||
Ke as asyncLock, | ||
S as atom, | ||
Ht as atomization, | ||
Gt as autoResource, | ||
vr as DefineAC, | ||
hr as EntriesTransform, | ||
xt as MonthLocale, | ||
rr as NullAtom, | ||
Xt as ObjectAtom, | ||
kt as OriginComponent, | ||
yr as OriginDiv, | ||
$r as PortalEasy, | ||
wr as SelectableList, | ||
rt as SignalToAtom, | ||
Kt as StoreToAtom, | ||
Er as SyncStorage, | ||
tr as ThrottleAtom, | ||
Et as WeekTitleLocale, | ||
Xe as asyncLock, | ||
y as atom, | ||
Wt as atomization, | ||
Qt as autoResource, | ||
he as classHelper, | ||
ie as classNames, | ||
hr as classNamesWithModule, | ||
mr as classNamesWithModule, | ||
Z as computed, | ||
rt as createBlackBoard, | ||
tr as createBlackBoardAtom, | ||
rr as createCtx, | ||
jt as createIgnoreFirst, | ||
Xe as createSync, | ||
st as createBlackBoard, | ||
nr as createBlackBoardAtom, | ||
sr as createCtx, | ||
Ft as createIgnoreFirst, | ||
tt as createSync, | ||
g as dayjs, | ||
xr as debounce, | ||
Wt as ensureArrayReturn, | ||
Yt as ensureChildren, | ||
kr as debounce, | ||
Yt as ensureArrayReturn, | ||
Jt as ensureChildren, | ||
B as ensureFunctionResult, | ||
Vt as ensureOnlyChild, | ||
dr as extendsComponents, | ||
zt as ensureOnlyChild, | ||
gr as extendsComponents, | ||
re as extendsEvent, | ||
he as firstClass, | ||
se as genArray, | ||
zt as getAtomType, | ||
U as getDaysInRange, | ||
_t as getDefaultSyncStorageOptions, | ||
or as initDayjs, | ||
Gt as getAtomType, | ||
H as getDaysInRange, | ||
Nt as getDefaultSyncStorageOptions, | ||
ir as initDayjs, | ||
G as isAtom, | ||
Dr as isElementRealVisible, | ||
Ar as isElementRealVisible, | ||
q as reflect, | ||
Ut as reflectMemo, | ||
Rt as reflectMemo, | ||
we as resource, | ||
$r as scrollElement, | ||
Bt as setAsyncLockDefaultRefuse, | ||
Qe as sleep, | ||
Ar as spanToWidth, | ||
Jt as splitOneChild, | ||
Ir as throttle, | ||
Mr as scrollElement, | ||
Ht as setAsyncLockDefaultRefuse, | ||
et as sleep, | ||
pr as spanToWidth, | ||
Zt as splitOneChild, | ||
Cr as throttle, | ||
V as toCSSPx, | ||
Or as useBreakPointMapper, | ||
ar as useCalendarSelect, | ||
ir as useDateCalendar, | ||
at as useDynamicList, | ||
Ge as useEffect, | ||
br as useBreakPointMapper, | ||
cr as useCalendarSelect, | ||
ur as useDateCalendar, | ||
ct as useDynamicList, | ||
Qe as useEffect, | ||
W as useEffectWithoutFirst, | ||
ur as useFileExplorer, | ||
Mr as useFloatingCover, | ||
sr as useLazyMount, | ||
fr as useMapper, | ||
nt as usePagination, | ||
nr as usePaginationStack, | ||
cr as usePromise, | ||
st as useSelect, | ||
ot as useSelectItem, | ||
Ft as useSingleAsync, | ||
fr as useFileExplorer, | ||
Or as useFloatingCover, | ||
ar as useLazyMount, | ||
dr as useMapper, | ||
ot as usePagination, | ||
or as usePaginationStack, | ||
lr as usePromise, | ||
at as useSelect, | ||
it as useSelectItem, | ||
Ut as useSingleAsync, | ||
xe as zIndexManager | ||
}; | ||
//# sourceMappingURL=client.js.map |
@@ -97,9 +97,7 @@ import { createEffect as I, on as Ie, untrack as j, createMemo as v, children as ne, onCleanup as he, createSignal as ke, batch as R, createContext as Ce, useContext as _e, onMount as Te, mergeProps as Ne, Switch as Le, Match as X, For as Pe, Show as je } from "solid-js"; | ||
const a = s?.aEqual ?? ((c) => c === o), u = s?.bEqual ?? ((c) => c === o), l = z([e], () => { | ||
if (u(e())) | ||
return; | ||
if (u(e())) return; | ||
const c = n(e()); | ||
r(() => c), o = c; | ||
}), i = z([r], () => { | ||
if (a(r())) | ||
return; | ||
if (a(r())) return; | ||
const c = t(r()); | ||
@@ -292,4 +290,3 @@ e(() => c), o = c; | ||
get(o, a) { | ||
if (!s.has(a)) | ||
throw new Error(`key: ${a} can't be found in formObject!`); | ||
if (!s.has(a)) throw new Error(`key: ${a} can't be found in formObject!`); | ||
if (n.has(a)) | ||
@@ -356,4 +353,3 @@ return n.get(a); | ||
deleteFn: (n) => { | ||
if (!e.has(n)) | ||
throw new Error(`Blackboard app ${n.toString()} isn't init yet`); | ||
if (!e.has(n)) throw new Error(`Blackboard app ${n.toString()} isn't init yet`); | ||
e.delete(n), r.onUpdate?.(); | ||
@@ -457,6 +453,4 @@ }, | ||
if (s().has(f[0])) { | ||
if (c.set(f[0], f[1]), !e.keepUndefinedOption) | ||
break; | ||
} else | ||
e.keepUndefinedOption && c.set(f[0], f[1]); | ||
if (c.set(f[0], f[1]), !e.keepUndefinedOption) break; | ||
} else e.keepUndefinedOption && c.set(f[0], f[1]); | ||
return c; | ||
@@ -544,7 +538,5 @@ }); | ||
const f = (h, d) => { | ||
if (!h || !d || h.length !== d.length) | ||
return !1; | ||
if (!h || !d || h.length !== d.length) return !1; | ||
for (let y = 0; y < h.length; y++) | ||
if (h[y] !== d[y]) | ||
return !1; | ||
if (h[y] !== d[y]) return !1; | ||
return !0; | ||
@@ -633,4 +625,3 @@ }; | ||
}, dt = function r(e, t) { | ||
if (e.date() < t.date()) | ||
return -r(t, e); | ||
if (e.date() < t.date()) return -r(t, e); | ||
var n = (t.year() - e.year()) * 12 + (t.month() - e.month()), s = e.clone().add(n, A), o = t - s < 0, a = e.clone().add(n + (o ? -1 : 1), A); | ||
@@ -671,4 +662,3 @@ return +(-(n + (t - s) / (o ? s - a : a - s)) || 0); | ||
var s; | ||
if (!e) | ||
return H; | ||
if (!e) return H; | ||
if (typeof e == "string") { | ||
@@ -704,8 +694,5 @@ var o = e.toLowerCase(); | ||
var t = e.date, n = e.utc; | ||
if (t === null) | ||
return /* @__PURE__ */ new Date(NaN); | ||
if (m.u(t)) | ||
return /* @__PURE__ */ new Date(); | ||
if (t instanceof Date) | ||
return new Date(t); | ||
if (t === null) return /* @__PURE__ */ new Date(NaN); | ||
if (m.u(t)) return /* @__PURE__ */ new Date(); | ||
if (t instanceof Date) return new Date(t); | ||
if (typeof t == "string" && !/Z$/i.test(t)) { | ||
@@ -786,4 +773,3 @@ var s = t.match(ut); | ||
c.$d[l](i), c.init(), this.$d = c.set(P, Math.min(this.$D, c.daysInMonth())).$d; | ||
} else | ||
l && this.$d[l](i); | ||
} else l && this.$d[l](i); | ||
return this.init(), this; | ||
@@ -815,4 +801,3 @@ }, e.set = function(n, s) { | ||
var s = this, o = this.$locale(); | ||
if (!this.isValid()) | ||
return o.invalidDate || ue; | ||
if (!this.isValid()) return o.invalidDate || ue; | ||
var a = n || ct, u = m.z(this), l = this.$H, i = this.$m, c = this.$M, f = o.weekdays, h = o.months, d = o.meridiem, y = function($, C, Y, xe) { | ||
@@ -922,4 +907,3 @@ return $ && ($[C] || $(s, a)) || Y[C].slice(0, xe); | ||
}, e.locale = function(n, s) { | ||
if (!n) | ||
return this.$L; | ||
if (!n) return this.$L; | ||
var o = this.clone(), a = K(n, s, !0); | ||
@@ -1408,6 +1392,4 @@ return a && (o.$L = a), o; | ||
}, 50); | ||
})) | ||
return; | ||
if (Date.now() - o > s) | ||
throw new Error("scroll long time"); | ||
})) return; | ||
if (Date.now() - o > s) throw new Error("scroll long time"); | ||
r[n ? "scrollLeft" : "scrollTop"] += t; | ||
@@ -1453,14 +1435,8 @@ } while (n ? r.scrollLeft < r.scrollWidth : r.scrollTop < r.scrollHeight); | ||
return q(() => { | ||
if (u()) | ||
return r.xxl; | ||
if (a()) | ||
return r.xl; | ||
if (o()) | ||
return r.lg; | ||
if (s()) | ||
return r.md; | ||
if (n()) | ||
return r.sm; | ||
if (t()) | ||
return r.xs; | ||
if (u()) return r.xxl; | ||
if (a()) return r.xl; | ||
if (o()) return r.lg; | ||
if (s()) return r.md; | ||
if (n()) return r.sm; | ||
if (t()) return r.xs; | ||
}); | ||
@@ -1579,1 +1555,2 @@ } | ||
}; | ||
//# sourceMappingURL=server.js.map |
{ | ||
"name": "@cn-ui/reactive", | ||
"version": "4.10.3", | ||
"description": "", | ||
"version": "4.11.0", | ||
"description": "a reactivity utils for solid-js", | ||
"main": "./dist/server.js", | ||
"browser": "./dist/client.js", | ||
"types": "./src/index.ts", | ||
"types": "./dist/ssr/index.d.ts", | ||
"publishConfig": { | ||
@@ -33,4 +33,3 @@ "registry": "https://registry.npmjs.org" | ||
"scripts": { | ||
"doc": "typedoc --tsconfig tsconfig.node.json --out docs src/index.ts", | ||
"build": " vite build && vite build --config vite.config.client.mjs && node ./scripts/build-unimport-entry.mjs", | ||
"build": "vite build --mode server && vite build --mode client && node ./scripts/build-unimport-entry.mjs", | ||
"test": "vitest run", | ||
@@ -37,0 +36,0 @@ "test-watch": "vitest", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
554944
135
7449