vlite3 0.1.10 → 0.2.2

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.
Files changed (55) hide show
  1. package/README.md +226 -150
  2. package/components/Button.vue.js +1 -1
  3. package/components/Chip/Chip.vue.js +15 -15
  4. package/components/DataTable/DataTable.vue.js +2 -2
  5. package/components/DataTable/DataTable.vue2.js +41 -39
  6. package/components/DataTable/types.d.ts +1 -0
  7. package/components/DatePicker.vue.d.ts +12 -3
  8. package/components/DatePicker.vue.js +80 -39
  9. package/components/Dropdown/DropdownMenu.vue.js +48 -47
  10. package/components/Form/Form.vue.d.ts +2 -0
  11. package/components/Form/Form.vue.js +2 -2
  12. package/components/Form/Form.vue2.js +104 -101
  13. package/components/Form/FormField.vue.d.ts +4 -0
  14. package/components/Form/FormField.vue.js +248 -148
  15. package/components/Form/FormFields.vue.d.ts +2 -0
  16. package/components/Form/FormFields.vue.js +2 -2
  17. package/components/Form/FormFields.vue2.js +45 -39
  18. package/components/Form/types.d.ts +24 -4
  19. package/components/Form/utils/form.utils.d.ts +5 -1
  20. package/components/Form/utils/form.utils.js +69 -60
  21. package/components/GoogleLogin.vue.d.ts +41 -0
  22. package/components/GoogleLogin.vue.js +60 -0
  23. package/components/GoogleLogin.vue2.js +4 -0
  24. package/components/Input.vue.js +120 -111
  25. package/components/NumberInput.vue.d.ts +38 -0
  26. package/components/NumberInput.vue.js +7 -0
  27. package/components/NumberInput.vue2.js +191 -0
  28. package/components/Pagination/Pagination.vue.d.ts +1 -0
  29. package/components/Pagination/Pagination.vue.js +60 -46
  30. package/components/ProgressBar/ProgressBar.vue.d.ts +12 -0
  31. package/components/ProgressBar/ProgressBar.vue.js +7 -0
  32. package/components/ProgressBar/ProgressBar.vue2.js +158 -0
  33. package/components/ProgressBar/index.d.ts +3 -0
  34. package/components/Spinner/Spinner.vue.d.ts +8 -0
  35. package/components/Spinner/Spinner.vue.js +89 -0
  36. package/components/Spinner/Spinner.vue2.js +4 -0
  37. package/components/Spinner/index.d.ts +2 -0
  38. package/components/Spinner/types.d.ts +9 -0
  39. package/components/Tabes/Tabes.vue.d.ts +3 -1
  40. package/components/Tabes/Tabes.vue.js +103 -44
  41. package/directives/vScrollReveal.d.ts +2 -0
  42. package/directives/vScrollReveal.js +48 -0
  43. package/index.d.ts +8 -0
  44. package/index.js +180 -147
  45. package/package.json +6 -3
  46. package/style.css +56 -4
  47. package/types/form.type.d.ts +2 -2
  48. package/types/progressbar.d.ts +75 -0
  49. package/utils/env.d.ts +14 -0
  50. package/utils/env.js +4 -0
  51. package/utils/functions.d.ts +99 -0
  52. package/utils/functions.js +91 -7
  53. package/utils/index.d.ts +2 -0
  54. package/utils/search.util.d.ts +127 -0
  55. package/utils/search.util.js +363 -0
@@ -0,0 +1,363 @@
1
+ const v = /* @__PURE__ */ new Map();
2
+ function C(e) {
3
+ e ? v.delete(e) : v.clear();
4
+ }
5
+ function w(e, n) {
6
+ if (!n.includes(".")) return e?.[n];
7
+ const i = n.split(".");
8
+ let t = e;
9
+ for (const s of i) {
10
+ if (t == null || typeof t != "object") return;
11
+ t = t[s];
12
+ }
13
+ return t;
14
+ }
15
+ function x(e, n = "") {
16
+ const i = [];
17
+ if (!e || typeof e != "object" || Array.isArray(e)) return i;
18
+ for (const t of Object.keys(e)) {
19
+ const s = n ? `${n}.${t}` : t, o = e[t];
20
+ if (o != null && typeof o == "object" && !Array.isArray(o) && !(o instanceof Date) && !(o instanceof RegExp)) {
21
+ const c = x(o, s);
22
+ c.length > 0 ? i.push(...c) : i.push(s), i.push(s);
23
+ } else
24
+ i.push(s);
25
+ }
26
+ return i;
27
+ }
28
+ function j(e, n = "") {
29
+ const i = {};
30
+ for (const t of Object.keys(e)) {
31
+ const s = n ? `${n}.${t}` : t, o = e[t];
32
+ o != null && typeof o == "object" && !Array.isArray(o) && !(o instanceof RegExp) && !p(o) ? Object.assign(i, j(o, s)) : i[s] = o;
33
+ }
34
+ return i;
35
+ }
36
+ function N(e, n) {
37
+ return e.dataRef ? e.dataRef === n : e.dataLength === n.length;
38
+ }
39
+ function P(e, n, i) {
40
+ let t = !1;
41
+ if (n == null) return { isNum: t };
42
+ const s = Array.isArray(n) ? JSON.stringify(n) : String(n), o = e.hash.get(s);
43
+ if (o ? o.add(i) : e.hash.set(s, /* @__PURE__ */ new Set([i])), typeof n == "string") {
44
+ const c = n.toLowerCase(), r = e.inverted.get(c);
45
+ r ? r.add(i) : e.inverted.set(c, /* @__PURE__ */ new Set([i]));
46
+ } else if (Array.isArray(n)) {
47
+ for (const c of n)
48
+ if (typeof c == "string") {
49
+ const r = c.toLowerCase(), h = e.inverted.get(r);
50
+ h ? h.add(i) : e.inverted.set(r, /* @__PURE__ */ new Set([i]));
51
+ }
52
+ }
53
+ return typeof n == "number" && Number.isFinite(n) && (t = !0, e.sorted.push({ value: n, idx: i })), { isNum: t };
54
+ }
55
+ function O(e, n) {
56
+ if (n) {
57
+ const s = v.get(n);
58
+ if (s && N(s, e))
59
+ return s;
60
+ }
61
+ const i = e.length === 0 || typeof e[0] != "object" || e[0] === null, t = {
62
+ fields: /* @__PURE__ */ new Map(),
63
+ dataRef: null,
64
+ dataLength: e.length,
65
+ primitiveInverted: null
66
+ };
67
+ if (t.dataRef = e, i) {
68
+ const s = /* @__PURE__ */ new Map();
69
+ for (let o = 0; o < e.length; o++) {
70
+ const c = String(e[o]).toLowerCase(), r = s.get(c);
71
+ r ? r.push(o) : s.set(c, [o]);
72
+ }
73
+ t.primitiveInverted = s;
74
+ } else {
75
+ const s = /* @__PURE__ */ new Set(), o = Math.min(e.length, 100);
76
+ for (let c = 0; c < o; c++) {
77
+ const r = e[c];
78
+ if (r && typeof r == "object")
79
+ for (const h of x(r))
80
+ s.add(h);
81
+ }
82
+ for (const c of s) {
83
+ const r = {
84
+ hash: /* @__PURE__ */ new Map(),
85
+ inverted: /* @__PURE__ */ new Map(),
86
+ sorted: [],
87
+ isNumeric: !1
88
+ };
89
+ let h = !1;
90
+ for (let f = 0; f < e.length; f++) {
91
+ const l = e[f];
92
+ if (!l || typeof l != "object") continue;
93
+ const u = w(l, c), { isNum: d } = P(r, u, f);
94
+ d && (h = !0);
95
+ }
96
+ h && (r.sorted.sort((f, l) => f.value - l.value), r.isNumeric = !0), t.fields.set(c, r);
97
+ }
98
+ }
99
+ return n && v.set(n, t), t;
100
+ }
101
+ function m(e, n) {
102
+ let i = 0, t = e.length;
103
+ for (; i < t; ) {
104
+ const s = i + t >>> 1;
105
+ e[s].value < n ? i = s + 1 : t = s;
106
+ }
107
+ return i;
108
+ }
109
+ function b(e, n) {
110
+ let i = 0, t = e.length;
111
+ for (; i < t; ) {
112
+ const s = i + t >>> 1;
113
+ e[s].value <= n ? i = s + 1 : t = s;
114
+ }
115
+ return i;
116
+ }
117
+ function k(e, n, i) {
118
+ const t = /* @__PURE__ */ new Set();
119
+ for (let s = n; s < i; s++)
120
+ t.add(e[s].idx);
121
+ return t;
122
+ }
123
+ const E = /* @__PURE__ */ new Set([
124
+ "$eq",
125
+ "$ne",
126
+ "$gt",
127
+ "$gte",
128
+ "$lt",
129
+ "$lte",
130
+ "$in",
131
+ "$nin",
132
+ "$regex",
133
+ "$exists"
134
+ ]);
135
+ function p(e) {
136
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : Object.keys(e).some((n) => E.has(n));
137
+ }
138
+ function L(e, n) {
139
+ if (n.$exists !== void 0) {
140
+ const i = e != null;
141
+ if (n.$exists !== i) return !1;
142
+ }
143
+ if (n.$eq !== void 0 && e !== n.$eq || n.$ne !== void 0 && e === n.$ne || n.$gt !== void 0 && (typeof e != "number" || e <= n.$gt) || n.$gte !== void 0 && (typeof e != "number" || e < n.$gte) || n.$lt !== void 0 && (typeof e != "number" || e >= n.$lt) || n.$lte !== void 0 && (typeof e != "number" || e > n.$lte))
144
+ return !1;
145
+ if (n.$in !== void 0) {
146
+ const i = String(n.$in).toLowerCase();
147
+ if (Array.isArray(e)) {
148
+ if (!e.some((s) => typeof s == "string" && s.toLowerCase().includes(i))) return !1;
149
+ } else if (typeof e != "string" || !e.toLowerCase().includes(i)) return !1;
150
+ }
151
+ if (n.$nin !== void 0) {
152
+ const i = String(n.$nin).toLowerCase();
153
+ if (Array.isArray(e)) {
154
+ if (e.some((s) => typeof s == "string" && s.toLowerCase().includes(i))) return !1;
155
+ } else if (typeof e == "string" && e.toLowerCase().includes(i)) return !1;
156
+ }
157
+ return !(n.$regex !== void 0 && !(n.$regex instanceof RegExp ? n.$regex : new RegExp(n.$regex, "i")).test(String(e)));
158
+ }
159
+ function M(e, n, i) {
160
+ if (!p(n)) {
161
+ if (typeof n == "string") {
162
+ const h = n.toLowerCase(), f = /* @__PURE__ */ new Set();
163
+ for (const [l, u] of e.inverted)
164
+ if (l.includes(h))
165
+ for (const d of u) f.add(d);
166
+ return f;
167
+ }
168
+ const c = Array.isArray(n) ? JSON.stringify(n) : String(n), r = e.hash.get(c);
169
+ return r ? new Set(r) : /* @__PURE__ */ new Set();
170
+ }
171
+ const t = n, s = t.$gt !== void 0 || t.$gte !== void 0 || t.$lt !== void 0 || t.$lte !== void 0;
172
+ if (s && t.$in === void 0 && t.$nin === void 0 && t.$regex === void 0 && t.$exists === void 0 && t.$ne === void 0 && e.isNumeric && e.sorted.length > 0) {
173
+ let c = 0, r = e.sorted.length;
174
+ t.$gte !== void 0 ? c = m(e.sorted, t.$gte) : t.$gt !== void 0 && (c = b(e.sorted, t.$gt)), t.$lte !== void 0 ? r = b(e.sorted, t.$lte) : t.$lt !== void 0 && (r = m(e.sorted, t.$lt));
175
+ let h = k(e.sorted, c, r);
176
+ if (t.$eq !== void 0) {
177
+ const f = /* @__PURE__ */ new Set();
178
+ for (const l of h)
179
+ e.sorted.find((u) => u.idx === l && u.value === t.$eq) && f.add(l);
180
+ h = f;
181
+ }
182
+ return h;
183
+ }
184
+ if (t.$eq !== void 0 && t.$in === void 0 && t.$nin === void 0 && t.$regex === void 0 && !s) {
185
+ const c = String(t.$eq), r = e.hash.get(c);
186
+ return r ? new Set(r) : /* @__PURE__ */ new Set();
187
+ }
188
+ if (t.$in !== void 0 && t.$eq === void 0 && t.$ne === void 0 && t.$nin === void 0 && t.$regex === void 0 && !s) {
189
+ const c = String(t.$in).toLowerCase(), r = /* @__PURE__ */ new Set();
190
+ for (const [h, f] of e.inverted)
191
+ if (h.includes(c))
192
+ for (const l of f) r.add(l);
193
+ return r;
194
+ }
195
+ return null;
196
+ }
197
+ function A(e, n, i) {
198
+ const t = j(n), s = Object.keys(t);
199
+ if (s.length === 0) {
200
+ const c = /* @__PURE__ */ new Set();
201
+ for (let r = 0; r < e.length; r++) c.add(r);
202
+ return c;
203
+ }
204
+ let o = null;
205
+ for (const c of s) {
206
+ const r = t[c], h = i.fields.get(c);
207
+ let f;
208
+ if (h) {
209
+ const l = M(h, r, e.length);
210
+ if (l !== null)
211
+ f = l;
212
+ else {
213
+ f = /* @__PURE__ */ new Set();
214
+ const u = o ?? Array.from({ length: e.length }, (d, g) => g);
215
+ for (const d of u) {
216
+ const g = e[d];
217
+ if (!g || typeof g != "object") continue;
218
+ const a = w(g, c);
219
+ if (p(r))
220
+ L(a, r) && f.add(d);
221
+ else if (typeof r == "string") {
222
+ const y = r.toLowerCase();
223
+ (typeof a == "string" && a.toLowerCase().includes(y) || Array.isArray(a) && a.some(($) => typeof $ == "string" && $.toLowerCase().includes(y))) && f.add(d);
224
+ } else
225
+ a === r && f.add(d);
226
+ }
227
+ }
228
+ } else {
229
+ f = /* @__PURE__ */ new Set();
230
+ const l = o ?? Array.from({ length: e.length }, (u, d) => d);
231
+ for (const u of l) {
232
+ const d = e[u];
233
+ if (!d || typeof d != "object") continue;
234
+ const g = w(d, c);
235
+ if (p(r))
236
+ L(g, r) && f.add(u);
237
+ else if (typeof r == "string") {
238
+ const a = r.toLowerCase();
239
+ (typeof g == "string" && g.toLowerCase().includes(a) || Array.isArray(g) && g.some((y) => typeof y == "string" && y.toLowerCase().includes(a))) && f.add(u);
240
+ } else
241
+ g === r && f.add(u);
242
+ }
243
+ }
244
+ if (o === null)
245
+ o = f;
246
+ else {
247
+ const l = /* @__PURE__ */ new Set();
248
+ for (const u of o)
249
+ f.has(u) && l.add(u);
250
+ o = l;
251
+ }
252
+ if (o.size === 0) break;
253
+ }
254
+ return o ?? /* @__PURE__ */ new Set();
255
+ }
256
+ function R(e, n, i) {
257
+ const t = n.toLowerCase(), s = /* @__PURE__ */ new Set();
258
+ if (i.primitiveInverted) {
259
+ for (const [o, c] of i.primitiveInverted)
260
+ if (o.includes(t))
261
+ for (const r of c) s.add(r);
262
+ } else
263
+ for (let o = 0; o < e.length; o++)
264
+ String(e[o]).toLowerCase().includes(t) && s.add(o);
265
+ return s;
266
+ }
267
+ function q(e, ...n) {
268
+ if (!Array.isArray(e) || e.length === 0)
269
+ return { results: [], reset: () => {
270
+ }, loading: !1 };
271
+ let i, t = n;
272
+ if (n.length >= 2 && typeof n[n.length - 1] == "string") {
273
+ const f = n[n.length - 1];
274
+ e.length > 0 && (typeof e[0] != "object" || e[0] === null) ? (n.length >= 3 || n.length === 2) && (i = f, t = n.slice(0, -1)) : (i = f, t = n.slice(0, -1));
275
+ }
276
+ const s = O(e, i), o = () => {
277
+ i && C(i);
278
+ };
279
+ if (t.length === 0)
280
+ return { results: [...e], reset: o, loading: !1 };
281
+ const c = t[0];
282
+ if (typeof c == "string") {
283
+ const f = R(e, c, s);
284
+ return { results: Array.from(f).sort((u, d) => u - d).map((u) => e[u]), reset: o, loading: !1 };
285
+ }
286
+ if (Array.isArray(c)) {
287
+ const f = c, l = /* @__PURE__ */ new Set();
288
+ for (const g of f) {
289
+ const a = A(e, g, s);
290
+ for (const y of a) l.add(y);
291
+ }
292
+ let u = l;
293
+ for (let g = 1; g < t.length; g++) {
294
+ const a = t[g];
295
+ if (typeof a != "object" || Array.isArray(a)) continue;
296
+ const y = A(e, a, s), $ = /* @__PURE__ */ new Set();
297
+ for (const S of u)
298
+ y.has(S) && $.add(S);
299
+ u = $;
300
+ }
301
+ return { results: Array.from(u).sort((g, a) => g - a).map((g) => e[g]), reset: o, loading: !1 };
302
+ }
303
+ let r = null;
304
+ for (let f = 0; f < t.length; f++) {
305
+ const l = t[f];
306
+ if (typeof l != "object" || l === null || Array.isArray(l)) continue;
307
+ const u = A(e, l, s);
308
+ if (r === null)
309
+ r = u;
310
+ else {
311
+ const d = /* @__PURE__ */ new Set();
312
+ for (const g of r)
313
+ u.has(g) && d.add(g);
314
+ r = d;
315
+ }
316
+ if (r.size === 0) break;
317
+ }
318
+ return { results: r ? Array.from(r).sort((f, l) => f - l).map((f) => e[f]) : [], reset: o, loading: !1 };
319
+ }
320
+ function Q(e, n, i) {
321
+ const t = {
322
+ search: () => [],
323
+ reset: () => {
324
+ },
325
+ loading: !0
326
+ };
327
+ if (!Array.isArray(e) || e.length === 0)
328
+ return t.loading = !1, t;
329
+ const s = O(e, i);
330
+ t.loading = !1;
331
+ const o = e.length > 0 && (typeof e[0] != "object" || e[0] === null);
332
+ return t.reset = () => {
333
+ i && C(i);
334
+ }, t.search = (c) => {
335
+ if (!c || typeof c != "string") return [...e];
336
+ const r = c.toLowerCase();
337
+ if (o) {
338
+ const l = R(e, c, s);
339
+ return Array.from(l).sort((u, d) => u - d).map((u) => e[u]);
340
+ }
341
+ const h = n && n.length > 0 ? n : Array.from(s.fields.keys()), f = /* @__PURE__ */ new Set();
342
+ for (const l of h) {
343
+ const u = s.fields.get(l);
344
+ if (u) {
345
+ for (const [d, g] of u.inverted)
346
+ if (d.includes(r))
347
+ for (const a of g) f.add(a);
348
+ } else
349
+ for (let d = 0; d < e.length; d++) {
350
+ const g = e[d];
351
+ if (!g || typeof g != "object") continue;
352
+ const a = w(g, l);
353
+ a != null && (typeof a == "string" && a.toLowerCase().includes(r) || Array.isArray(a) && a.some((y) => typeof y == "string" && y.toLowerCase().includes(r))) && f.add(d);
354
+ }
355
+ }
356
+ return Array.from(f).sort((l, u) => l - u).map((l) => e[l]);
357
+ }, t;
358
+ }
359
+ export {
360
+ Q as lazySearch,
361
+ C as resetSearchIndex,
362
+ q as search
363
+ };