@nmorph/nmorph-ui-kit 2.2.39 → 2.2.41
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/components/basic/nmorph-button/NmorphButton.css +1 -1
- package/dist/components/basic/nmorph-button/NmorphButton.vue.js +13 -10
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.css +1 -1
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +122 -75
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +100 -75
- package/dist/components/data/nmorph-tag-list/NmorphTagList.css +1 -0
- package/dist/components/data/nmorph-tag-list/NmorphTagList.vue.js +17 -12
- package/dist/components/data/nmorph-tag-list/NmorphTagList.vue2.js +31 -19
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.css +1 -1
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.js +18 -15
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js +84 -21
- package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +27 -22
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +80 -45
- package/dist/hooks/use-placement.js +65 -61
- package/dist/index.umd.js +29 -29
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +6 -0
- package/dist/src/components/data/nmorph-image-preview/types.d.ts +4 -0
- package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +10 -1
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +6 -1
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/types.d.ts +1 -0
- package/dist/src/components/data/nmorph-tag-list/types.d.ts +7 -0
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +5 -3
- package/dist/src/components/navigation/nmorph-context-menu/types.d.ts +8 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,89 +1,93 @@
|
|
|
1
|
-
import { ref as b, unref as
|
|
2
|
-
const
|
|
3
|
-
const { initialPlacement:
|
|
1
|
+
import { ref as b, unref as i, inject as U, watch as X, onMounted as J, onUnmounted as K, nextTick as $ } from "vue";
|
|
2
|
+
const F = 4, Z = (H) => {
|
|
3
|
+
const { initialPlacement: p, relativeElement: O, contentDOMElement: d, yOffset: R = 0, xOffset: M = 0, enabled: g } = H, y = b(i(p)), L = b({ x: "0px", y: "0px" }), m = b(!1), I = U("nmorph"), P = { passive: !0, capture: !0 };
|
|
4
4
|
let w = null;
|
|
5
|
-
|
|
6
|
-
() =>
|
|
5
|
+
X(
|
|
6
|
+
() => I?.browser,
|
|
7
7
|
() => {
|
|
8
|
-
|
|
8
|
+
r();
|
|
9
9
|
},
|
|
10
10
|
{ deep: !0 }
|
|
11
|
-
),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}), w.observe(document.body, { childList: !0, subtree: !0 }),
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
() => [
|
|
11
|
+
), J(() => {
|
|
12
|
+
r(), Y(), window.addEventListener("resize", r, { passive: !0 }), w = new MutationObserver(() => {
|
|
13
|
+
C();
|
|
14
|
+
}), w.observe(document.body, { childList: !0, subtree: !0 }), C();
|
|
15
|
+
}), K(() => {
|
|
16
|
+
_(), window.removeEventListener("resize", r), w?.disconnect();
|
|
17
|
+
}), X(
|
|
18
|
+
() => [i(p), i(O), i(M), i(R), i(g)],
|
|
19
19
|
() => {
|
|
20
|
-
|
|
20
|
+
r();
|
|
21
21
|
},
|
|
22
22
|
{ flush: "post" }
|
|
23
23
|
);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const C = () => {
|
|
25
|
+
$(() => {
|
|
26
|
+
d.value && r();
|
|
27
27
|
});
|
|
28
|
-
},
|
|
29
|
-
const [
|
|
28
|
+
}, W = () => g === void 0 || i(g) !== !1, N = (t) => {
|
|
29
|
+
const [n, e] = t.split("-");
|
|
30
30
|
return {
|
|
31
|
-
side:
|
|
32
|
-
align:
|
|
33
|
-
hasAlign: !!
|
|
31
|
+
side: n,
|
|
32
|
+
align: e || "start",
|
|
33
|
+
hasAlign: !!e
|
|
34
34
|
};
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
}, S = (t, n, e) => e ? `${t}-${n}` : t, A = () => i(O), B = (t, n, e) => {
|
|
36
|
+
const o = F, a = Math.max(e - n - F, o);
|
|
37
|
+
return Math.min(Math.max(t, o), a);
|
|
38
|
+
}, T = (t, n, e, o, a, s, l) => t === "top" && e - l < 0 ? "bottom" : t === "bottom" && e + a + l > window.innerHeight ? "top" : t === "left" && n - s < 0 ? "right" : t === "right" && n + o + s > window.innerWidth ? "left" : t, Y = () => {
|
|
39
|
+
window.addEventListener("scroll", r, P);
|
|
40
|
+
}, _ = () => {
|
|
41
|
+
window.removeEventListener("scroll", r, P);
|
|
42
|
+
}, r = () => {
|
|
43
|
+
$(() => {
|
|
41
44
|
if (typeof window > "u") return;
|
|
42
|
-
if (!
|
|
43
|
-
|
|
45
|
+
if (!W()) {
|
|
46
|
+
m.value = !1;
|
|
44
47
|
return;
|
|
45
48
|
}
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
|
|
49
|
+
const t = A();
|
|
50
|
+
if (!d.value || !t) {
|
|
51
|
+
m.value = !1;
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
|
-
const
|
|
54
|
+
const n = d.value.getBoundingClientRect(), e = n.width, o = n.height, a = t.getBoundingClientRect(), { x: s, y: l } = a, v = a.width, h = a.height, j = i(M) || 0, k = i(R) || 0, f = N(i(p)), c = T(
|
|
52
55
|
f.side,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
s,
|
|
57
|
+
l,
|
|
58
|
+
v,
|
|
59
|
+
h,
|
|
60
|
+
e,
|
|
61
|
+
o
|
|
59
62
|
);
|
|
60
|
-
let
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
start:
|
|
64
|
-
center:
|
|
65
|
-
end:
|
|
63
|
+
let x = s, E = l;
|
|
64
|
+
if (c === "top" || c === "bottom") {
|
|
65
|
+
const u = {
|
|
66
|
+
start: s,
|
|
67
|
+
center: s + v / 2 - e / 2,
|
|
68
|
+
end: s + v - e
|
|
66
69
|
};
|
|
67
|
-
|
|
70
|
+
x = u[f.align] ?? u.start, E = c === "top" ? l - o : l + h;
|
|
68
71
|
}
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
start:
|
|
72
|
-
center:
|
|
73
|
-
end:
|
|
72
|
+
if (c === "left" || c === "right") {
|
|
73
|
+
const u = {
|
|
74
|
+
start: l,
|
|
75
|
+
center: l + h / 2 - o / 2,
|
|
76
|
+
end: l + h - o
|
|
74
77
|
};
|
|
75
|
-
|
|
78
|
+
x = c === "left" ? s - e : s + v, E = u[f.align] ?? u.start;
|
|
76
79
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const q = x + j, z = E + k, D = B(q, e, window.innerWidth), G = B(z, o, window.innerHeight);
|
|
81
|
+
y.value = S(c, f.align, f.hasAlign), L.value = { x: `${D}px`, y: `${G}px` }, m.value = !0, typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
82
|
+
const u = A();
|
|
83
|
+
if (!d.value || !u || !W()) return;
|
|
84
|
+
const V = d.value.getBoundingClientRect();
|
|
85
|
+
(V.width !== e || V.height !== o) && r();
|
|
82
86
|
});
|
|
83
87
|
});
|
|
84
88
|
};
|
|
85
|
-
return { placement:
|
|
89
|
+
return { placement: y, placementCoords: L, placementReady: m, adjustPlacement: r };
|
|
86
90
|
};
|
|
87
91
|
export {
|
|
88
|
-
|
|
92
|
+
Z as usePlacement
|
|
89
93
|
};
|