@bquery/bquery 1.3.0 → 1.4.0
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.
- package/README.md +527 -501
- package/dist/{batch-4LAvfLE7.js → batch-x7b2eZST.js} +2 -2
- package/dist/{batch-4LAvfLE7.js.map → batch-x7b2eZST.js.map} +1 -1
- package/dist/component.es.mjs +1 -1
- package/dist/core/collection.d.ts +19 -3
- package/dist/core/collection.d.ts.map +1 -1
- package/dist/core/element.d.ts +23 -4
- package/dist/core/element.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/utils/function.d.ts +21 -4
- package/dist/core/utils/function.d.ts.map +1 -1
- package/dist/{core-COenAZjD.js → core-BhpuvPhy.js} +62 -37
- package/dist/core-BhpuvPhy.js.map +1 -0
- package/dist/core.es.mjs +174 -131
- package/dist/core.es.mjs.map +1 -1
- package/dist/full.es.mjs +7 -7
- package/dist/full.iife.js +2 -2
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +2 -2
- package/dist/full.umd.js.map +1 -1
- package/dist/index.es.mjs +7 -7
- package/dist/motion.es.mjs.map +1 -1
- package/dist/{persisted-Dz_ryNuC.js → persisted-DHoi3uEs.js} +4 -4
- package/dist/{persisted-Dz_ryNuC.js.map → persisted-DHoi3uEs.js.map} +1 -1
- package/dist/platform/storage.d.ts.map +1 -1
- package/dist/platform.es.mjs +12 -7
- package/dist/platform.es.mjs.map +1 -1
- package/dist/reactive/core.d.ts +12 -0
- package/dist/reactive/core.d.ts.map +1 -1
- package/dist/reactive/effect.d.ts.map +1 -1
- package/dist/reactive/internals.d.ts +6 -0
- package/dist/reactive/internals.d.ts.map +1 -1
- package/dist/reactive.es.mjs +6 -6
- package/dist/router.es.mjs +1 -1
- package/dist/{sanitize-1FBEPAFH.js → sanitize-Cxvxa-DX.js} +50 -39
- package/dist/sanitize-Cxvxa-DX.js.map +1 -0
- package/dist/security/sanitize-core.d.ts.map +1 -1
- package/dist/security.es.mjs +2 -2
- package/dist/store.es.mjs +2 -2
- package/dist/type-guards-BdKlYYlS.js +32 -0
- package/dist/type-guards-BdKlYYlS.js.map +1 -0
- package/dist/untrack-DNnnqdlR.js +6 -0
- package/dist/{untrack-BuEQKH7_.js.map → untrack-DNnnqdlR.js.map} +1 -1
- package/dist/view/evaluate.d.ts.map +1 -1
- package/dist/view.es.mjs +157 -151
- package/dist/view.es.mjs.map +1 -1
- package/dist/{watch-CXyaBC_9.js → watch-DXXv3iAI.js} +3 -3
- package/dist/{watch-CXyaBC_9.js.map → watch-DXXv3iAI.js.map} +1 -1
- package/package.json +132 -132
- package/src/core/collection.ts +628 -588
- package/src/core/element.ts +774 -746
- package/src/core/index.ts +48 -47
- package/src/core/utils/function.ts +151 -110
- package/src/motion/animate.ts +113 -113
- package/src/motion/flip.ts +176 -176
- package/src/motion/scroll.ts +57 -57
- package/src/motion/spring.ts +150 -150
- package/src/motion/timeline.ts +246 -246
- package/src/motion/transition.ts +51 -51
- package/src/platform/storage.ts +215 -208
- package/src/reactive/core.ts +114 -93
- package/src/reactive/effect.ts +54 -43
- package/src/reactive/internals.ts +122 -105
- package/src/security/sanitize-core.ts +364 -343
- package/src/view/evaluate.ts +290 -274
- package/dist/core-COenAZjD.js.map +0 -1
- package/dist/sanitize-1FBEPAFH.js.map +0 -1
- package/dist/type-guards-DRma3-Kc.js +0 -16
- package/dist/type-guards-DRma3-Kc.js.map +0 -1
- package/dist/untrack-BuEQKH7_.js +0 -6
package/dist/core.es.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as f } from "./sanitize-
|
|
2
|
-
const g = (n) => Array.isArray(n) ? n : [n],
|
|
1
|
+
import { s as f } from "./sanitize-Cxvxa-DX.js";
|
|
2
|
+
const g = (n) => Array.isArray(n) ? n : [n], l = (n, e) => {
|
|
3
3
|
for (const t of n)
|
|
4
4
|
e(t);
|
|
5
5
|
}, p = (n) => f(n), w = (n, e) => {
|
|
@@ -13,8 +13,8 @@ const g = (n) => Array.isArray(n) ? n : [n], o = (n, e) => {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const r = g(e), i = t === "afterbegin" || t === "afterend" ? r.slice().reverse() : r;
|
|
16
|
-
|
|
17
|
-
n.insertAdjacentElement(t,
|
|
16
|
+
l(i, (o) => {
|
|
17
|
+
n.insertAdjacentElement(t, o);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
class h {
|
|
@@ -105,25 +105,13 @@ class h {
|
|
|
105
105
|
htmlUnsafe(e) {
|
|
106
106
|
return this.element.innerHTML = e, this;
|
|
107
107
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Gets or sets CSS styles on the element.
|
|
110
|
-
*
|
|
111
|
-
* @param property - A CSS property name or an object of property-value pairs
|
|
112
|
-
* @param value - The value when setting a single property
|
|
113
|
-
* @returns The instance for method chaining
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```ts
|
|
117
|
-
* // Single property
|
|
118
|
-
* $('#box').css('color', 'red');
|
|
119
|
-
*
|
|
120
|
-
* // Multiple properties
|
|
121
|
-
* $('#box').css({ color: 'red', 'font-size': '16px' });
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
108
|
css(e, t) {
|
|
125
|
-
if (typeof e == "string")
|
|
126
|
-
|
|
109
|
+
if (typeof e == "string") {
|
|
110
|
+
if (t !== void 0)
|
|
111
|
+
return this.element.style.setProperty(e, t), this;
|
|
112
|
+
const r = this.element.ownerDocument?.defaultView;
|
|
113
|
+
return !r || typeof r.getComputedStyle != "function" ? "" : r.getComputedStyle(this.element).getPropertyValue(e);
|
|
114
|
+
}
|
|
127
115
|
for (const [r, s] of Object.entries(e))
|
|
128
116
|
this.element.style.setProperty(r, s);
|
|
129
117
|
return this;
|
|
@@ -386,9 +374,9 @@ class h {
|
|
|
386
374
|
* ```
|
|
387
375
|
*/
|
|
388
376
|
delegate(e, t, r) {
|
|
389
|
-
const s = `${e}:${t}`, i = (
|
|
390
|
-
const u =
|
|
391
|
-
u && this.element.contains(u) && r(
|
|
377
|
+
const s = `${e}:${t}`, i = (o) => {
|
|
378
|
+
const u = o.target.closest(t);
|
|
379
|
+
u && this.element.contains(u) && r(o, u);
|
|
392
380
|
};
|
|
393
381
|
return this.delegatedHandlers.has(s) || this.delegatedHandlers.set(s, /* @__PURE__ */ new Map()), this.delegatedHandlers.get(s).set(r, i), this.element.addEventListener(e, i), this;
|
|
394
382
|
}
|
|
@@ -412,8 +400,8 @@ class h {
|
|
|
412
400
|
undelegate(e, t, r) {
|
|
413
401
|
const s = `${e}:${t}`, i = this.delegatedHandlers.get(s);
|
|
414
402
|
if (i) {
|
|
415
|
-
const
|
|
416
|
-
|
|
403
|
+
const o = i.get(r);
|
|
404
|
+
o && (this.element.removeEventListener(e, o), i.delete(r), i.size === 0 && this.delegatedHandlers.delete(s));
|
|
417
405
|
}
|
|
418
406
|
return this;
|
|
419
407
|
}
|
|
@@ -426,6 +414,22 @@ class h {
|
|
|
426
414
|
matches(e) {
|
|
427
415
|
return this.element.matches(e);
|
|
428
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Alias for `matches()`. Checks if the element matches a CSS selector.
|
|
419
|
+
*
|
|
420
|
+
* @param selector - CSS selector to match against
|
|
421
|
+
* @returns True if the element matches the selector
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* if ($('#el').is('.active')) {
|
|
426
|
+
* console.log('Element is active');
|
|
427
|
+
* }
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
is(e) {
|
|
431
|
+
return this.matches(e);
|
|
432
|
+
}
|
|
429
433
|
/**
|
|
430
434
|
* Checks if the element has a specific class.
|
|
431
435
|
*
|
|
@@ -509,8 +513,8 @@ class h {
|
|
|
509
513
|
for (const [s, i] of r.entries())
|
|
510
514
|
if (typeof i == "string")
|
|
511
515
|
if (s in t) {
|
|
512
|
-
const
|
|
513
|
-
Array.isArray(
|
|
516
|
+
const o = t[s];
|
|
517
|
+
Array.isArray(o) ? o.push(i) : t[s] = [o, i];
|
|
514
518
|
} else
|
|
515
519
|
t[s] = i;
|
|
516
520
|
return t;
|
|
@@ -661,15 +665,15 @@ class c {
|
|
|
661
665
|
}
|
|
662
666
|
/** Add one or more classes to all elements. */
|
|
663
667
|
addClass(...e) {
|
|
664
|
-
return
|
|
668
|
+
return l(this.elements, (t) => t.classList.add(...e)), this;
|
|
665
669
|
}
|
|
666
670
|
/** Remove one or more classes from all elements. */
|
|
667
671
|
removeClass(...e) {
|
|
668
|
-
return
|
|
672
|
+
return l(this.elements, (t) => t.classList.remove(...e)), this;
|
|
669
673
|
}
|
|
670
674
|
/** Toggle a class on all elements. */
|
|
671
675
|
toggleClass(e, t) {
|
|
672
|
-
return
|
|
676
|
+
return l(this.elements, (r) => r.classList.toggle(e, t)), this;
|
|
673
677
|
}
|
|
674
678
|
/**
|
|
675
679
|
* Sets an attribute on all elements or gets from first.
|
|
@@ -679,7 +683,7 @@ class c {
|
|
|
679
683
|
* @returns Attribute value when getting, instance when setting
|
|
680
684
|
*/
|
|
681
685
|
attr(e, t) {
|
|
682
|
-
return t === void 0 ? this.first()?.getAttribute(e) ?? "" : (
|
|
686
|
+
return t === void 0 ? this.first()?.getAttribute(e) ?? "" : (l(this.elements, (r) => r.setAttribute(e, t)), this);
|
|
683
687
|
}
|
|
684
688
|
/**
|
|
685
689
|
* Removes an attribute from all elements.
|
|
@@ -688,11 +692,11 @@ class c {
|
|
|
688
692
|
* @returns The instance for method chaining
|
|
689
693
|
*/
|
|
690
694
|
removeAttr(e) {
|
|
691
|
-
return
|
|
695
|
+
return l(this.elements, (t) => t.removeAttribute(e)), this;
|
|
692
696
|
}
|
|
693
697
|
/** Toggle an attribute on all elements. */
|
|
694
698
|
toggleAttr(e, t) {
|
|
695
|
-
return
|
|
699
|
+
return l(this.elements, (r) => {
|
|
696
700
|
const s = r.hasAttribute(e);
|
|
697
701
|
t ?? !s ? r.setAttribute(e, "") : r.removeAttribute(e);
|
|
698
702
|
}), this;
|
|
@@ -704,7 +708,7 @@ class c {
|
|
|
704
708
|
* @returns Text content when getting, instance when setting
|
|
705
709
|
*/
|
|
706
710
|
text(e) {
|
|
707
|
-
return e === void 0 ? this.first()?.textContent ?? "" : (
|
|
711
|
+
return e === void 0 ? this.first()?.textContent ?? "" : (l(this.elements, (t) => {
|
|
708
712
|
t.textContent = e;
|
|
709
713
|
}), this);
|
|
710
714
|
}
|
|
@@ -718,7 +722,7 @@ class c {
|
|
|
718
722
|
if (e === void 0)
|
|
719
723
|
return this.first()?.innerHTML ?? "";
|
|
720
724
|
const t = p(e);
|
|
721
|
-
return
|
|
725
|
+
return l(this.elements, (r) => {
|
|
722
726
|
r.innerHTML = t;
|
|
723
727
|
}), this;
|
|
724
728
|
}
|
|
@@ -730,7 +734,7 @@ class c {
|
|
|
730
734
|
* @warning Bypasses XSS protection
|
|
731
735
|
*/
|
|
732
736
|
htmlUnsafe(e) {
|
|
733
|
-
return
|
|
737
|
+
return l(this.elements, (t) => {
|
|
734
738
|
t.innerHTML = e;
|
|
735
739
|
}), this;
|
|
736
740
|
}
|
|
@@ -750,20 +754,22 @@ class c {
|
|
|
750
754
|
after(e) {
|
|
751
755
|
return this.insertAll(e, "afterend"), this;
|
|
752
756
|
}
|
|
753
|
-
/**
|
|
754
|
-
* Applies CSS styles to all elements.
|
|
755
|
-
*
|
|
756
|
-
* @param property - Property name or object of properties
|
|
757
|
-
* @param value - Value when setting single property
|
|
758
|
-
* @returns The instance for method chaining
|
|
759
|
-
*/
|
|
760
757
|
css(e, t) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
758
|
+
if (typeof e == "string") {
|
|
759
|
+
if (t !== void 0)
|
|
760
|
+
return l(this.elements, (i) => {
|
|
761
|
+
i.style.setProperty(e, t);
|
|
762
|
+
}), this;
|
|
763
|
+
const r = this.first();
|
|
764
|
+
if (!r)
|
|
765
|
+
return "";
|
|
766
|
+
const s = r.ownerDocument?.defaultView;
|
|
767
|
+
return !s || typeof s.getComputedStyle != "function" ? "" : s.getComputedStyle(r).getPropertyValue(e);
|
|
768
|
+
}
|
|
769
|
+
return l(this.elements, (r) => {
|
|
764
770
|
for (const [s, i] of Object.entries(e))
|
|
765
771
|
r.style.setProperty(s, i);
|
|
766
|
-
}), this
|
|
772
|
+
}), this;
|
|
767
773
|
}
|
|
768
774
|
/** Wrap each element with a wrapper element or tag. */
|
|
769
775
|
wrap(e) {
|
|
@@ -818,7 +824,7 @@ class c {
|
|
|
818
824
|
* @returns The instance for method chaining
|
|
819
825
|
*/
|
|
820
826
|
show(e = "") {
|
|
821
|
-
return
|
|
827
|
+
return l(this.elements, (t) => {
|
|
822
828
|
t.removeAttribute("hidden"), t.style.display = e;
|
|
823
829
|
}), this;
|
|
824
830
|
}
|
|
@@ -828,7 +834,7 @@ class c {
|
|
|
828
834
|
* @returns The instance for method chaining
|
|
829
835
|
*/
|
|
830
836
|
hide() {
|
|
831
|
-
return
|
|
837
|
+
return l(this.elements, (e) => {
|
|
832
838
|
e.style.display = "none";
|
|
833
839
|
}), this;
|
|
834
840
|
}
|
|
@@ -840,7 +846,7 @@ class c {
|
|
|
840
846
|
* @returns The instance for method chaining
|
|
841
847
|
*/
|
|
842
848
|
on(e, t) {
|
|
843
|
-
return
|
|
849
|
+
return l(this.elements, (r) => r.addEventListener(e, t)), this;
|
|
844
850
|
}
|
|
845
851
|
/**
|
|
846
852
|
* Adds a one-time event listener to all elements.
|
|
@@ -850,7 +856,7 @@ class c {
|
|
|
850
856
|
* @returns The instance for method chaining
|
|
851
857
|
*/
|
|
852
858
|
once(e, t) {
|
|
853
|
-
return
|
|
859
|
+
return l(this.elements, (r) => r.addEventListener(e, t, { once: !0 })), this;
|
|
854
860
|
}
|
|
855
861
|
/**
|
|
856
862
|
* Removes an event listener from all elements.
|
|
@@ -860,7 +866,7 @@ class c {
|
|
|
860
866
|
* @returns The instance for method chaining
|
|
861
867
|
*/
|
|
862
868
|
off(e, t) {
|
|
863
|
-
return
|
|
869
|
+
return l(this.elements, (r) => r.removeEventListener(e, t)), this;
|
|
864
870
|
}
|
|
865
871
|
/**
|
|
866
872
|
* Triggers a custom event on all elements.
|
|
@@ -870,7 +876,7 @@ class c {
|
|
|
870
876
|
* @returns The instance for method chaining
|
|
871
877
|
*/
|
|
872
878
|
trigger(e, t) {
|
|
873
|
-
return
|
|
879
|
+
return l(this.elements, (r) => {
|
|
874
880
|
r.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 }));
|
|
875
881
|
}), this;
|
|
876
882
|
}
|
|
@@ -896,14 +902,14 @@ class c {
|
|
|
896
902
|
*/
|
|
897
903
|
delegate(e, t, r) {
|
|
898
904
|
const s = `${e}:${t}`;
|
|
899
|
-
return
|
|
900
|
-
const
|
|
905
|
+
return l(this.elements, (i) => {
|
|
906
|
+
const o = (a) => {
|
|
901
907
|
const m = a.target.closest(t);
|
|
902
908
|
m && i.contains(m) && r(a, m);
|
|
903
909
|
};
|
|
904
910
|
this.delegatedHandlers.has(i) || this.delegatedHandlers.set(i, /* @__PURE__ */ new Map());
|
|
905
911
|
const u = this.delegatedHandlers.get(i);
|
|
906
|
-
u.has(s) || u.set(s, /* @__PURE__ */ new Map()), u.get(s).set(r,
|
|
912
|
+
u.has(s) || u.set(s, /* @__PURE__ */ new Map()), u.get(s).set(r, o), i.addEventListener(e, o);
|
|
907
913
|
}), this;
|
|
908
914
|
}
|
|
909
915
|
/**
|
|
@@ -925,22 +931,43 @@ class c {
|
|
|
925
931
|
*/
|
|
926
932
|
undelegate(e, t, r) {
|
|
927
933
|
const s = `${e}:${t}`;
|
|
928
|
-
return
|
|
929
|
-
const
|
|
930
|
-
if (!
|
|
931
|
-
const u =
|
|
934
|
+
return l(this.elements, (i) => {
|
|
935
|
+
const o = this.delegatedHandlers.get(i);
|
|
936
|
+
if (!o) return;
|
|
937
|
+
const u = o.get(s);
|
|
932
938
|
if (!u) return;
|
|
933
939
|
const a = u.get(r);
|
|
934
|
-
a && (i.removeEventListener(e, a), u.delete(r), u.size === 0 &&
|
|
940
|
+
a && (i.removeEventListener(e, a), u.delete(r), u.size === 0 && o.delete(s), o.size === 0 && this.delegatedHandlers.delete(i));
|
|
935
941
|
}), this;
|
|
936
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* Finds all descendant elements matching the selector across all elements
|
|
945
|
+
* in the collection. Returns a new BQueryCollection with the results.
|
|
946
|
+
*
|
|
947
|
+
* @param selector - CSS selector to match
|
|
948
|
+
* @returns A new BQueryCollection with all matching descendants
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```ts
|
|
952
|
+
* $$('.container').find('.item').addClass('highlight');
|
|
953
|
+
* ```
|
|
954
|
+
*/
|
|
955
|
+
find(e) {
|
|
956
|
+
const t = /* @__PURE__ */ new Set(), r = [];
|
|
957
|
+
for (const s of this.elements) {
|
|
958
|
+
const i = s.querySelectorAll(e);
|
|
959
|
+
for (let o = 0; o < i.length; o++)
|
|
960
|
+
t.has(i[o]) || (t.add(i[o]), r.push(i[o]));
|
|
961
|
+
}
|
|
962
|
+
return new c(r);
|
|
963
|
+
}
|
|
937
964
|
/**
|
|
938
965
|
* Removes all elements from the DOM.
|
|
939
966
|
*
|
|
940
967
|
* @returns The instance for method chaining
|
|
941
968
|
*/
|
|
942
969
|
remove() {
|
|
943
|
-
return
|
|
970
|
+
return l(this.elements, (e) => e.remove()), this;
|
|
944
971
|
}
|
|
945
972
|
/**
|
|
946
973
|
* Clears all child nodes from all elements.
|
|
@@ -948,7 +975,7 @@ class c {
|
|
|
948
975
|
* @returns The instance for method chaining
|
|
949
976
|
*/
|
|
950
977
|
empty() {
|
|
951
|
-
return
|
|
978
|
+
return l(this.elements, (e) => {
|
|
952
979
|
e.innerHTML = "";
|
|
953
980
|
}), this;
|
|
954
981
|
}
|
|
@@ -956,15 +983,15 @@ class c {
|
|
|
956
983
|
insertAll(e, t) {
|
|
957
984
|
if (typeof e == "string") {
|
|
958
985
|
const s = p(e);
|
|
959
|
-
|
|
986
|
+
l(this.elements, (i) => {
|
|
960
987
|
i.insertAdjacentHTML(t, s);
|
|
961
988
|
});
|
|
962
989
|
return;
|
|
963
990
|
}
|
|
964
991
|
const r = g(e);
|
|
965
992
|
this.elements.forEach((s, i) => {
|
|
966
|
-
const
|
|
967
|
-
b(s,
|
|
993
|
+
const o = i === 0 ? r : r.map((u) => u.cloneNode(!0));
|
|
994
|
+
b(s, o, t);
|
|
968
995
|
});
|
|
969
996
|
}
|
|
970
997
|
}
|
|
@@ -989,10 +1016,10 @@ function L(n, e) {
|
|
|
989
1016
|
t.push(n.slice(r, r + e));
|
|
990
1017
|
return t;
|
|
991
1018
|
}
|
|
992
|
-
function
|
|
1019
|
+
function v(n) {
|
|
993
1020
|
return n.filter(Boolean);
|
|
994
1021
|
}
|
|
995
|
-
function
|
|
1022
|
+
function H(n) {
|
|
996
1023
|
const e = [];
|
|
997
1024
|
for (const t of n)
|
|
998
1025
|
Array.isArray(t) ? e.push(...t) : e.push(t);
|
|
@@ -1000,22 +1027,38 @@ function v(n) {
|
|
|
1000
1027
|
}
|
|
1001
1028
|
function N(n, e) {
|
|
1002
1029
|
let t;
|
|
1003
|
-
return (
|
|
1004
|
-
|
|
1005
|
-
|
|
1030
|
+
return Object.assign(
|
|
1031
|
+
(...s) => {
|
|
1032
|
+
t !== void 0 && clearTimeout(t), t = setTimeout(() => {
|
|
1033
|
+
t = void 0, n(...s);
|
|
1034
|
+
}, e);
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
cancel: () => {
|
|
1038
|
+
t !== void 0 && (clearTimeout(t), t = void 0);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1006
1042
|
}
|
|
1007
|
-
function
|
|
1043
|
+
function S(n, e) {
|
|
1008
1044
|
let t = 0;
|
|
1009
|
-
return (
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1045
|
+
return Object.assign(
|
|
1046
|
+
(...s) => {
|
|
1047
|
+
const i = Date.now();
|
|
1048
|
+
i - t >= e && (t = i, n(...s));
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
cancel: () => {
|
|
1052
|
+
t = 0;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1013
1056
|
}
|
|
1014
|
-
function
|
|
1057
|
+
function $(n) {
|
|
1015
1058
|
let e = !1, t;
|
|
1016
1059
|
return (...r) => (e || (t = n(...r), e = !0), t);
|
|
1017
1060
|
}
|
|
1018
|
-
function
|
|
1061
|
+
function M() {
|
|
1019
1062
|
}
|
|
1020
1063
|
function j(n = "bQuery") {
|
|
1021
1064
|
return `${n}_${Math.random().toString(36).slice(2, 9)}`;
|
|
@@ -1030,16 +1073,16 @@ function T(n, e) {
|
|
|
1030
1073
|
return e;
|
|
1031
1074
|
}
|
|
1032
1075
|
}
|
|
1033
|
-
function
|
|
1076
|
+
function P(n) {
|
|
1034
1077
|
return n == null ? !0 : typeof n == "string" ? n.trim().length === 0 : Array.isArray(n) ? n.length === 0 : typeof n == "object" ? Object.keys(n).length === 0 : !1;
|
|
1035
1078
|
}
|
|
1036
|
-
function
|
|
1079
|
+
function k(n, e) {
|
|
1037
1080
|
return Math.floor(Math.random() * (e - n + 1)) + n;
|
|
1038
1081
|
}
|
|
1039
1082
|
function z(n, e, t) {
|
|
1040
1083
|
return Math.min(Math.max(n, e), t);
|
|
1041
1084
|
}
|
|
1042
|
-
function
|
|
1085
|
+
function D(n, e, t, r = !0) {
|
|
1043
1086
|
return r ? n >= e && n <= t : n > e && n < t;
|
|
1044
1087
|
}
|
|
1045
1088
|
function q(n, e = 0) {
|
|
@@ -1049,7 +1092,7 @@ function q(n, e = 0) {
|
|
|
1049
1092
|
function d(n) {
|
|
1050
1093
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1051
1094
|
}
|
|
1052
|
-
function
|
|
1095
|
+
function x(n) {
|
|
1053
1096
|
return n === "__proto__" || n === "constructor" || n === "prototype";
|
|
1054
1097
|
}
|
|
1055
1098
|
function R(n) {
|
|
@@ -1059,7 +1102,7 @@ function A(...n) {
|
|
|
1059
1102
|
const e = {};
|
|
1060
1103
|
for (const t of n)
|
|
1061
1104
|
for (const [r, s] of Object.entries(t))
|
|
1062
|
-
|
|
1105
|
+
x(r) || (d(s) && d(e[r]) ? e[r] = A(
|
|
1063
1106
|
e[r],
|
|
1064
1107
|
s
|
|
1065
1108
|
) : e[r] = s);
|
|
@@ -1083,37 +1126,37 @@ function F(n, e) {
|
|
|
1083
1126
|
function U(n) {
|
|
1084
1127
|
return n && n.charAt(0).toUpperCase() + n.slice(1);
|
|
1085
1128
|
}
|
|
1086
|
-
function
|
|
1129
|
+
function J(n) {
|
|
1087
1130
|
return n.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
1088
1131
|
}
|
|
1089
|
-
function
|
|
1132
|
+
function V(n) {
|
|
1090
1133
|
return n.replace(/[-_\s]+(.)?/g, (e, t) => t ? t.toUpperCase() : "").replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
1091
1134
|
}
|
|
1092
|
-
function
|
|
1135
|
+
function _(n, e, t = "…") {
|
|
1093
1136
|
if (e <= 0) return "";
|
|
1094
1137
|
if (n.length <= e) return n;
|
|
1095
1138
|
const r = Math.max(0, e - t.length);
|
|
1096
1139
|
return `${n.slice(0, r)}${t}`;
|
|
1097
1140
|
}
|
|
1098
|
-
function
|
|
1141
|
+
function I(n) {
|
|
1099
1142
|
return n.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\w\s-]/g, "").trim().replace(/[\s_-]+/g, "-").toLowerCase();
|
|
1100
1143
|
}
|
|
1101
|
-
function
|
|
1144
|
+
function Z(n) {
|
|
1102
1145
|
return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1103
1146
|
}
|
|
1104
|
-
function
|
|
1147
|
+
function K(n) {
|
|
1105
1148
|
return typeof Element < "u" && n instanceof Element;
|
|
1106
1149
|
}
|
|
1107
|
-
function
|
|
1150
|
+
function G(n) {
|
|
1108
1151
|
return !!(n && typeof n == "object" && "elements" in n);
|
|
1109
1152
|
}
|
|
1110
|
-
function
|
|
1153
|
+
function X(n) {
|
|
1111
1154
|
return typeof n == "function";
|
|
1112
1155
|
}
|
|
1113
|
-
function
|
|
1156
|
+
function Y(n) {
|
|
1114
1157
|
return typeof n == "string";
|
|
1115
1158
|
}
|
|
1116
|
-
function
|
|
1159
|
+
function Q(n) {
|
|
1117
1160
|
return typeof n == "number" && !Number.isNaN(n);
|
|
1118
1161
|
}
|
|
1119
1162
|
function ee(n) {
|
|
@@ -1138,17 +1181,17 @@ const ue = {
|
|
|
1138
1181
|
omit: W,
|
|
1139
1182
|
hasOwn: F,
|
|
1140
1183
|
debounce: N,
|
|
1141
|
-
throttle:
|
|
1142
|
-
once:
|
|
1143
|
-
noop:
|
|
1184
|
+
throttle: S,
|
|
1185
|
+
once: $,
|
|
1186
|
+
noop: M,
|
|
1144
1187
|
uid: j,
|
|
1145
|
-
isElement:
|
|
1146
|
-
isCollection:
|
|
1147
|
-
isEmpty:
|
|
1188
|
+
isElement: K,
|
|
1189
|
+
isCollection: G,
|
|
1190
|
+
isEmpty: P,
|
|
1148
1191
|
isPlainObject: d,
|
|
1149
|
-
isFunction:
|
|
1150
|
-
isString:
|
|
1151
|
-
isNumber:
|
|
1192
|
+
isFunction: X,
|
|
1193
|
+
isString: Y,
|
|
1194
|
+
isNumber: Q,
|
|
1152
1195
|
isBoolean: ee,
|
|
1153
1196
|
isArray: te,
|
|
1154
1197
|
isDate: ne,
|
|
@@ -1156,21 +1199,21 @@ const ue = {
|
|
|
1156
1199
|
isObject: se,
|
|
1157
1200
|
parseJson: T,
|
|
1158
1201
|
sleep: O,
|
|
1159
|
-
randomInt:
|
|
1202
|
+
randomInt: k,
|
|
1160
1203
|
clamp: z,
|
|
1161
|
-
inRange:
|
|
1204
|
+
inRange: D,
|
|
1162
1205
|
toNumber: q,
|
|
1163
1206
|
capitalize: U,
|
|
1164
|
-
toKebabCase:
|
|
1165
|
-
toCamelCase:
|
|
1166
|
-
truncate:
|
|
1167
|
-
slugify:
|
|
1168
|
-
escapeRegExp:
|
|
1207
|
+
toKebabCase: J,
|
|
1208
|
+
toCamelCase: V,
|
|
1209
|
+
truncate: _,
|
|
1210
|
+
slugify: I,
|
|
1211
|
+
escapeRegExp: Z,
|
|
1169
1212
|
ensureArray: E,
|
|
1170
1213
|
unique: C,
|
|
1171
1214
|
chunk: L,
|
|
1172
|
-
compact:
|
|
1173
|
-
flatten:
|
|
1215
|
+
compact: v,
|
|
1216
|
+
flatten: H
|
|
1174
1217
|
};
|
|
1175
1218
|
export {
|
|
1176
1219
|
oe as $,
|
|
@@ -1181,39 +1224,39 @@ export {
|
|
|
1181
1224
|
L as chunk,
|
|
1182
1225
|
z as clamp,
|
|
1183
1226
|
R as clone,
|
|
1184
|
-
|
|
1227
|
+
v as compact,
|
|
1185
1228
|
N as debounce,
|
|
1186
1229
|
E as ensureArray,
|
|
1187
|
-
|
|
1188
|
-
|
|
1230
|
+
Z as escapeRegExp,
|
|
1231
|
+
H as flatten,
|
|
1189
1232
|
F as hasOwn,
|
|
1190
|
-
|
|
1233
|
+
D as inRange,
|
|
1191
1234
|
te as isArray,
|
|
1192
1235
|
ee as isBoolean,
|
|
1193
|
-
|
|
1236
|
+
G as isCollection,
|
|
1194
1237
|
ne as isDate,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1238
|
+
K as isElement,
|
|
1239
|
+
P as isEmpty,
|
|
1240
|
+
X as isFunction,
|
|
1241
|
+
Q as isNumber,
|
|
1199
1242
|
se as isObject,
|
|
1200
1243
|
d as isPlainObject,
|
|
1201
1244
|
re as isPromise,
|
|
1202
|
-
|
|
1245
|
+
Y as isString,
|
|
1203
1246
|
A as merge,
|
|
1204
|
-
|
|
1247
|
+
M as noop,
|
|
1205
1248
|
W as omit,
|
|
1206
|
-
|
|
1249
|
+
$ as once,
|
|
1207
1250
|
T as parseJson,
|
|
1208
1251
|
B as pick,
|
|
1209
|
-
|
|
1252
|
+
k as randomInt,
|
|
1210
1253
|
O as sleep,
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1254
|
+
I as slugify,
|
|
1255
|
+
S as throttle,
|
|
1256
|
+
V as toCamelCase,
|
|
1257
|
+
J as toKebabCase,
|
|
1215
1258
|
q as toNumber,
|
|
1216
|
-
|
|
1259
|
+
_ as truncate,
|
|
1217
1260
|
j as uid,
|
|
1218
1261
|
C as unique,
|
|
1219
1262
|
ue as utils
|