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