adverich-kun-ui 0.1.611 → 0.1.613

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.
@@ -1,63 +1,65 @@
1
- import { ref as p, computed as r, watch as M, nextTick as T } from "vue";
2
- function k({
1
+ import { ref as d, computed as l, watch as j, nextTick as L } from "vue";
2
+ function z({
3
3
  items: S,
4
- search: s,
5
- searchableKeys: m = [],
6
- itemsPerIntersection: i = 20
4
+ search: i,
5
+ searchableKeys: g = [],
6
+ itemsPerIntersection: c = 20
7
7
  }) {
8
- const l = p(1), g = p(null), I = r(() => Array.isArray(m) ? m.filter((e) => e != null && e !== "").map((e) => String(e)) : []), w = r(
9
- () => typeof i == "number" && i > 0 ? i : 20
10
- ), u = r(() => {
11
- const e = S.value || [], t = s.value == null ? "" : String(s.value).trim().toLowerCase();
12
- if (!t) return e;
8
+ const u = d(1), y = d(null), I = l(() => Array.isArray(g) ? g.filter((e) => e != null && e !== "").map((e) => String(e)) : []), B = l(
9
+ () => typeof c == "number" && c > 0 ? c : 20
10
+ ), a = l(() => {
11
+ const e = S.value || [], t = i.value == null ? [] : String(i.value).trim().toLowerCase().split(/\s+/).filter(Boolean);
12
+ if (t.length === 0) return e;
13
13
  const n = I.value;
14
- return e.filter((o) => n.length > 0 ? n.some((v) => {
15
- const d = b(o, v);
16
- return d == null ? !1 : a(d, 1).some((L) => L.toLowerCase().includes(t));
17
- }) : a(o, 1).some((v) => v.toLowerCase().includes(t)));
18
- }), B = (e) => e === null || typeof e != "object" && typeof e != "function", a = (e, t = 1) => e == null ? [] : B(e) ? [String(e)] : Array.isArray(e) ? t <= 0 ? [] : e.flatMap((n) => a(n, t - 1)) : t <= 0 ? [] : Object.values(e).flatMap((n) => a(n, t - 1)), b = (e, t) => {
14
+ return e.filter((s) => {
15
+ let m;
16
+ n.length > 0 ? m = n.flatMap((r) => o(w(s, r), 1)) : m = o(s, 1);
17
+ const C = m.map((r) => r.toLowerCase());
18
+ return t.every((r) => C.some((T) => T.includes(r)));
19
+ });
20
+ }), b = (e) => e === null || typeof e != "object" && typeof e != "function", o = (e, t = 1) => e == null ? [] : b(e) ? [String(e)] : Array.isArray(e) ? t <= 0 ? [] : e.flatMap((n) => o(n, t - 1)) : t <= 0 ? [] : Object.values(e).flatMap((n) => o(n, t - 1)), w = (e, t) => {
19
21
  if (t)
20
- return String(t).split(".").reduce((n, o) => n != null ? n[o] : void 0, e);
21
- }, x = r(() => u.value.length), c = r(
22
- () => u.value.slice(
22
+ return String(t).split(".").reduce((n, s) => n != null ? n[s] : void 0, e);
23
+ }, x = l(() => a.value.length), f = l(
24
+ () => a.value.slice(
23
25
  0,
24
- l.value * w.value
26
+ u.value * B.value
25
27
  )
26
- ), f = r(
27
- () => c.value.length >= u.value.length
28
- ), A = r(() => l.value === 1);
29
- function y() {
30
- f.value || l.value++;
31
- }
28
+ ), v = l(
29
+ () => f.value.length >= a.value.length
30
+ ), A = l(() => u.value === 1);
32
31
  function h() {
33
- l.value = 1;
32
+ v.value || u.value++;
33
+ }
34
+ function p() {
35
+ u.value = 1;
34
36
  }
35
- M(
36
- () => s.value,
37
+ j(
38
+ () => i.value,
37
39
  () => {
38
- h();
40
+ p();
39
41
  },
40
42
  { flush: "pre" }
41
43
  );
42
- async function C(e) {
44
+ async function M(e) {
43
45
  if (typeof e != "number" || e < 0) return;
44
- g.value = e;
45
- const t = u.value.length - 1, n = Math.min(e, t);
46
- for (; n >= c.value.length && !f.value; )
47
- y(), await T();
46
+ y.value = e;
47
+ const t = a.value.length - 1, n = Math.min(e, t);
48
+ for (; n >= f.value.length && !v.value; )
49
+ h(), await L();
48
50
  }
49
51
  return {
50
- visibleItems: c,
51
- loadNextBatch: y,
52
- resetCurrentBatchStep: h,
53
- lastBatchReached: f,
52
+ visibleItems: f,
53
+ loadNextBatch: h,
54
+ resetCurrentBatchStep: p,
55
+ lastBatchReached: v,
54
56
  isFirstBatch: A,
55
57
  totalItems: x,
56
- setScrollToIndex: C,
57
- scrollToIndex: g
58
+ setScrollToIndex: M,
59
+ scrollToIndex: y
58
60
  // opcional, si lo necesitás desde el componente padre
59
61
  };
60
62
  }
61
63
  export {
62
- k as useKunInfiniteScroll
64
+ z as useKunInfiniteScroll
63
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.611",
3
+ "version": "0.1.613",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",