@moubing/bing-ui 0.9.1 → 0.9.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.
- package/dist/bing-ui.es.js +82 -57
- package/dist/bing-ui.umd.js +6 -5
- package/package.json +1 -1
package/dist/bing-ui.es.js
CHANGED
|
@@ -15690,24 +15690,49 @@ function xh(e) {
|
|
|
15690
15690
|
//#region src/components/BingCursor/BingCursor.controller.ts
|
|
15691
15691
|
var Sh = /* @__PURE__ */ new WeakMap(), Ch = "data-bing-cursor-native", wh = 100;
|
|
15692
15692
|
function Th(e) {
|
|
15693
|
-
let t = e.defaultView, n = /* @__PURE__ */ new Set(), r = [], i = t.matchMedia?.("(any-pointer: fine)"), a = t.matchMedia?.("(any-hover: hover)"), o = t.matchMedia?.("(forced-colors: active)"), s, c, l =
|
|
15694
|
-
T.dataset.bingCursorStyle = "",
|
|
15695
|
-
let E =
|
|
15696
|
-
function
|
|
15697
|
-
|
|
15693
|
+
let t = e.defaultView, n = /* @__PURE__ */ new Set(), r = [], i = t.matchMedia?.("(any-pointer: fine)"), a = t.matchMedia?.("(any-hover: hover)"), o = t.matchMedia?.("(forced-colors: active)"), s, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = 0, d = null, f = null, p = null, m = 0, h = 0, g = 0, _ = !1, v = !1, y = !1, b = 0, ee = !0, x = -Infinity, S = -Infinity, C, w = !1, T = e.createElement("style");
|
|
15694
|
+
T.dataset.bingCursorStyle = "", e.head.append(T);
|
|
15695
|
+
let E = xh(e);
|
|
15696
|
+
function D() {
|
|
15697
|
+
T.textContent = [...l.values()].flatMap((e) => [...e.values()].map(({ value: e, token: t }) => {
|
|
15698
|
+
let n = `[${Ch}="${t}"]`;
|
|
15699
|
+
return `${n}, ${n}::before, ${n}::after { cursor: ${e} !important; }`;
|
|
15700
|
+
})).join("\n");
|
|
15701
|
+
}
|
|
15702
|
+
function O(e, t) {
|
|
15703
|
+
let n = e.nativeCursor(t);
|
|
15704
|
+
if (!n) return;
|
|
15705
|
+
let r = l.get(e)?.get(t);
|
|
15706
|
+
if (r?.value === n) return r.token;
|
|
15707
|
+
let i = /* @__PURE__ */ new Map(), a = ++u;
|
|
15708
|
+
for (let r of Object.keys(gh)) {
|
|
15709
|
+
let o = r === t ? n : e.nativeCursor(r);
|
|
15710
|
+
o && i.set(r, {
|
|
15711
|
+
value: o,
|
|
15712
|
+
token: `${a}-${r}`
|
|
15713
|
+
});
|
|
15714
|
+
}
|
|
15715
|
+
return l.set(e, i), D(), i.get(t)?.token;
|
|
15698
15716
|
}
|
|
15699
|
-
function k() {
|
|
15700
|
-
|
|
15717
|
+
function k(e, t) {
|
|
15718
|
+
t === null ? e.removeAttribute(Ch) : e.setAttribute(Ch, t);
|
|
15701
15719
|
}
|
|
15702
|
-
function A(
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
l = e.getAttribute(Ch), c = e, e.setAttribute(Ch, ""), n && (r === null ? n.removeAttribute(Ch) : n.setAttribute(Ch, r));
|
|
15720
|
+
function A() {
|
|
15721
|
+
for (let [e, t] of c) k(e, t);
|
|
15722
|
+
c.clear();
|
|
15706
15723
|
}
|
|
15707
15724
|
function j() {
|
|
15708
|
-
|
|
15725
|
+
A(), s?.hide(), s = void 0;
|
|
15726
|
+
}
|
|
15727
|
+
function M(e, t) {
|
|
15728
|
+
let n = new Set(e);
|
|
15729
|
+
for (let e of n) c.has(e) || c.set(e, e.getAttribute(Ch)), e.getAttribute(Ch) !== t && e.setAttribute(Ch, t);
|
|
15730
|
+
for (let [e, t] of c) n.has(e) || (k(e, t), c.delete(e));
|
|
15731
|
+
}
|
|
15732
|
+
function N() {
|
|
15733
|
+
p = null, v = !1, _ = !1, f = null, C = void 0, ee = !0, b && t.cancelAnimationFrame(b), b = 0, j();
|
|
15709
15734
|
}
|
|
15710
|
-
function
|
|
15735
|
+
function P(n) {
|
|
15711
15736
|
if (h >= e.documentElement.clientWidth || g >= e.documentElement.clientHeight) return !0;
|
|
15712
15737
|
let r = t.getComputedStyle(n), i = ["auto", "scroll"].includes(r.overflowY) && n.scrollHeight > n.clientHeight, a = ["auto", "scroll"].includes(r.overflowX) && n.scrollWidth > n.clientWidth;
|
|
15713
15738
|
if (C = void 0, !i && !a) return !1;
|
|
@@ -15719,22 +15744,22 @@ function Th(e) {
|
|
|
15719
15744
|
bottom: c + n.clientHeight,
|
|
15720
15745
|
vertical: i,
|
|
15721
15746
|
horizontal: a
|
|
15722
|
-
},
|
|
15747
|
+
}, F();
|
|
15723
15748
|
}
|
|
15724
|
-
function
|
|
15749
|
+
function F() {
|
|
15725
15750
|
return !!(C && (C.vertical && (h < C.left || h >= C.right) || C.horizontal && (g < C.top || g >= C.bottom)));
|
|
15726
15751
|
}
|
|
15727
|
-
function
|
|
15752
|
+
function I() {
|
|
15728
15753
|
let r = p;
|
|
15729
15754
|
p = null;
|
|
15730
15755
|
let c = t.performance.now();
|
|
15731
15756
|
if (x = c, !v || y || e.hidden || o?.matches || !i?.matches || !a?.matches) {
|
|
15732
|
-
|
|
15757
|
+
j();
|
|
15733
15758
|
return;
|
|
15734
15759
|
}
|
|
15735
15760
|
let l = r?.isConnected && !r.hasPointerCapture?.(m) ? r : e.elementFromPoint(h, g);
|
|
15736
|
-
if (w = !!(l &&
|
|
15737
|
-
|
|
15761
|
+
if (w = !!(l && P(l)), !l || l.getRootNode() !== e || l.shadowRoot || w) {
|
|
15762
|
+
j();
|
|
15738
15763
|
return;
|
|
15739
15764
|
}
|
|
15740
15765
|
d = _ && f?.hasPointerCapture?.(m) ? f : l;
|
|
@@ -15744,40 +15769,40 @@ function Th(e) {
|
|
|
15744
15769
|
t.disabled || !e.root.isConnected || !t.global && !e.root.contains(d) || (!u || !t.global && (u.options().global || u.root.contains(e.root)) || t.global && u.options().global) && (u = e);
|
|
15745
15770
|
}
|
|
15746
15771
|
if (!u) {
|
|
15747
|
-
|
|
15772
|
+
j();
|
|
15748
15773
|
return;
|
|
15749
15774
|
}
|
|
15750
|
-
let b = ee || c - S >= wh, C =
|
|
15775
|
+
let b = ee || c - S >= wh, C = E.read(d, b);
|
|
15751
15776
|
b && (ee = !1, S = c);
|
|
15752
15777
|
let T = yh(d, C, u.options().type, _);
|
|
15753
15778
|
if (!T) {
|
|
15754
|
-
|
|
15779
|
+
j();
|
|
15755
15780
|
return;
|
|
15756
15781
|
}
|
|
15757
|
-
let
|
|
15758
|
-
if (!
|
|
15759
|
-
|
|
15782
|
+
let D = O(u, T);
|
|
15783
|
+
if (!D) {
|
|
15784
|
+
j();
|
|
15760
15785
|
return;
|
|
15761
15786
|
}
|
|
15762
|
-
s !== u && s?.hide(), s = u,
|
|
15787
|
+
s !== u && s?.hide(), s = u, M([l, d], D), u.show(T);
|
|
15763
15788
|
}
|
|
15764
|
-
function
|
|
15789
|
+
function L() {
|
|
15765
15790
|
!b && v && (b = t.requestAnimationFrame(() => {
|
|
15766
|
-
b = 0,
|
|
15791
|
+
b = 0, I();
|
|
15767
15792
|
}));
|
|
15768
15793
|
}
|
|
15769
|
-
function
|
|
15770
|
-
p = null,
|
|
15794
|
+
function R() {
|
|
15795
|
+
p = null, L();
|
|
15771
15796
|
}
|
|
15772
|
-
function
|
|
15797
|
+
function z(e) {
|
|
15773
15798
|
if (e.pointerType !== "mouse") {
|
|
15774
|
-
|
|
15799
|
+
N();
|
|
15775
15800
|
return;
|
|
15776
15801
|
}
|
|
15777
|
-
let n = e.target instanceof Element ? e.target : null, r = (e.buttons & 1) == 1, i = !v || f !== n || _ !== r || t.performance.now() - x >= wh;
|
|
15778
|
-
v = !0, h = e.clientX, g = e.clientY, _ = r, m = e.pointerId, f = n, _ || (y = !1), p = f, (i ||
|
|
15802
|
+
let n = e.target instanceof Element ? e.target : null, r = (e.buttons & 1) == 1, i = !v || f !== n || _ !== r || !!(r && n?.hasPointerCapture?.(e.pointerId)) || t.performance.now() - x >= wh;
|
|
15803
|
+
v = !0, h = e.clientX, g = e.clientY, _ = r, m = e.pointerId, f = n, _ || (y = !1), p = f, (i || F() !== w) && L();
|
|
15779
15804
|
}
|
|
15780
|
-
function
|
|
15805
|
+
function B(e, t, n) {
|
|
15781
15806
|
e.addEventListener(t, n, {
|
|
15782
15807
|
capture: !0,
|
|
15783
15808
|
passive: !0
|
|
@@ -15788,28 +15813,28 @@ function Th(e) {
|
|
|
15788
15813
|
"pointerover",
|
|
15789
15814
|
"pointerdown",
|
|
15790
15815
|
"pointerup"
|
|
15791
|
-
])
|
|
15792
|
-
|
|
15793
|
-
e.relatedTarget ||
|
|
15794
|
-
})),
|
|
15795
|
-
e.target === t &&
|
|
15796
|
-
}),
|
|
15797
|
-
e.hidden &&
|
|
15798
|
-
}),
|
|
15799
|
-
(e.key === "Tab" || e.key === "Escape") &&
|
|
15800
|
-
})),
|
|
15801
|
-
e.target?.matches?.("link[rel=\"stylesheet\"]") && (ee = !0,
|
|
15802
|
-
}),
|
|
15803
|
-
y = !0,
|
|
15804
|
-
}),
|
|
15805
|
-
y = !1,
|
|
15816
|
+
]) B(e, t, z);
|
|
15817
|
+
B(e, "pointerout", ((e) => {
|
|
15818
|
+
e.relatedTarget || N();
|
|
15819
|
+
})), B(e, "pointercancel", N), B(e, "gotpointercapture", R), B(e, "lostpointercapture", R), B(t, "blur", (e) => {
|
|
15820
|
+
e.target === t && N();
|
|
15821
|
+
}), B(t, "resize", N), B(e, "visibilitychange", () => {
|
|
15822
|
+
e.hidden && N();
|
|
15823
|
+
}), B(e, "keydown", ((e) => {
|
|
15824
|
+
(e.key === "Tab" || e.key === "Escape") && N();
|
|
15825
|
+
})), B(e, "scroll", R), B(e, "load", (e) => {
|
|
15826
|
+
e.target?.matches?.("link[rel=\"stylesheet\"]") && (ee = !0, R());
|
|
15827
|
+
}), B(e, "dragstart", () => {
|
|
15828
|
+
y = !0, N();
|
|
15829
|
+
}), B(e, "dragend", () => {
|
|
15830
|
+
y = !1, N();
|
|
15806
15831
|
});
|
|
15807
15832
|
for (let e of [
|
|
15808
15833
|
i,
|
|
15809
15834
|
a,
|
|
15810
15835
|
o
|
|
15811
|
-
]) e?.addEventListener?.("change",
|
|
15812
|
-
let
|
|
15836
|
+
]) e?.addEventListener?.("change", R), r.push(() => e?.removeEventListener?.("change", R));
|
|
15837
|
+
let V = new MutationObserver((e) => {
|
|
15813
15838
|
if (!v) return;
|
|
15814
15839
|
let t = !1;
|
|
15815
15840
|
for (let n of e) {
|
|
@@ -15818,9 +15843,9 @@ function Th(e) {
|
|
|
15818
15843
|
let r = e?.matches("style, link") || [...n.addedNodes, ...n.removedNodes].some((e) => e.nodeType === 1 && (e.matches("style, link") || e.querySelector("style, link")));
|
|
15819
15844
|
r && (ee = !0), (r || n.type === "childList" || d && e?.contains(d)) && (t = !0);
|
|
15820
15845
|
}
|
|
15821
|
-
t &&
|
|
15846
|
+
t && R();
|
|
15822
15847
|
});
|
|
15823
|
-
return
|
|
15848
|
+
return V.observe(e.documentElement, {
|
|
15824
15849
|
subtree: !0,
|
|
15825
15850
|
childList: !0,
|
|
15826
15851
|
characterData: !0,
|
|
@@ -15838,10 +15863,10 @@ function Th(e) {
|
|
|
15838
15863
|
"data-bing-cursor"
|
|
15839
15864
|
]
|
|
15840
15865
|
}), { add(t) {
|
|
15841
|
-
return n.add(t),
|
|
15842
|
-
refresh:
|
|
15866
|
+
return n.add(t), R(), {
|
|
15867
|
+
refresh: R,
|
|
15843
15868
|
destroy() {
|
|
15844
|
-
s === t &&
|
|
15869
|
+
s === t && j(), n.delete(t), l.delete(t), n.size ? (D(), R()) : (N(), V.disconnect(), r.forEach((e) => e()), E.destroy(), T.remove(), Sh.delete(e));
|
|
15845
15870
|
}
|
|
15846
15871
|
};
|
|
15847
15872
|
} };
|