@nmorph/nmorph-ui-kit 2.2.39 → 2.2.40

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 (22) 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.vue.js +7 -7
  7. package/dist/components/data/nmorph-tag-list/NmorphTagList.vue2.js +22 -16
  8. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.css +1 -1
  9. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js +8 -8
  10. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +27 -22
  11. package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +75 -46
  12. package/dist/hooks/use-placement.js +65 -61
  13. package/dist/index.umd.js +26 -26
  14. package/dist/package.json.js +1 -1
  15. package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +6 -0
  16. package/dist/src/components/data/nmorph-image-preview/types.d.ts +4 -0
  17. package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +4 -1
  18. package/dist/src/components/data/nmorph-tag-list/types.d.ts +1 -0
  19. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +5 -3
  20. package/dist/src/components/navigation/nmorph-context-menu/types.d.ts +8 -2
  21. package/dist/style.css +1 -1
  22. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
  import n from "./NmorphTagList.vue2.js";
2
- import { openBlock as e, createElementBlock as t, normalizeClass as a, Fragment as l, renderList as s, createBlock as m, mergeProps as i } from "vue";
2
+ import { openBlock as e, createElementBlock as t, normalizeClass as l, Fragment as s, renderList as a, createBlock as m, mergeProps as i } from "vue";
3
3
  import c from "../../../_virtual/_plugin-vue_export-helper.js";
4
- function p(f, _, d, r, u, g) {
4
+ function p(f, d, _, r, u, g) {
5
5
  return e(), t(
6
6
  "div",
7
7
  {
8
- class: a(r.modifiers)
8
+ class: l(r.modifiers)
9
9
  },
10
10
  [
11
11
  (e(!0), t(
12
- l,
12
+ s,
13
13
  null,
14
- s(r.tagList, (o) => (e(), m(
14
+ a(r.resolvedTagList, (o) => (e(), m(
15
15
  r.NmorphTagItem,
16
16
  i({
17
17
  key: o.value
@@ -28,7 +28,7 @@ function p(f, _, d, r, u, g) {
28
28
  /* CLASS */
29
29
  );
30
30
  }
31
- const T = /* @__PURE__ */ c(n, [["render", p], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/NmorphTagList.vue"]]);
31
+ const v = /* @__PURE__ */ c(n, [["render", p], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-tag-list/NmorphTagList.vue"]]);
32
32
  export {
33
- T as default
33
+ v as default
34
34
  };
@@ -1,26 +1,32 @@
1
- import { defineComponent as p, computed as n, ref as d } from "vue";
2
- import { useModifiers as c } from "../../../utils/create-modifiers.js";
1
+ import { defineComponent as d, computed as a, ref as c } from "vue";
2
+ import { useModifiers as g } from "../../../utils/create-modifiers.js";
3
3
  import f from "./components/nmorph-tag-item/NmorphTagItem.vue.js";
4
- const h = /* @__PURE__ */ p({
4
+ const L = /* @__PURE__ */ d({
5
5
  __name: "NmorphTagList",
6
6
  props: {
7
- modelValue: { type: Array, required: !0 }
7
+ modelValue: { type: Array, required: !0 },
8
+ design: { type: String, required: !1, default: "nmorph" }
8
9
  },
9
10
  emits: ["close", "update:model-value"],
10
- setup(a, { expose: m, emit: l }) {
11
- m();
12
- const o = a, r = l, u = n(
13
- () => c({
11
+ setup(i, { expose: l, emit: m }) {
12
+ l();
13
+ const r = i, o = m, n = a(
14
+ () => g({
14
15
  "nmorph-list": []
15
16
  })
16
17
  );
17
- let e = d(o.modelValue);
18
- const s = { props: o, emit: r, modifiers: u, get tagList() {
19
- return e;
20
- }, set tagList(t) {
21
- e = t;
22
- }, closeTagHandler: (t) => {
23
- e.value = e.value.filter((i) => i.value !== t), r("close", t), r("update:model-value", e.value);
18
+ let t = c(r.modelValue);
19
+ const u = a(
20
+ () => t.value.map((e) => ({
21
+ ...e,
22
+ design: e.design ?? r.design
23
+ }))
24
+ ), s = { props: r, emit: o, modifiers: n, get tagList() {
25
+ return t;
26
+ }, set tagList(e) {
27
+ t = e;
28
+ }, resolvedTagList: u, closeTagHandler: (e) => {
29
+ t.value = t.value.filter((p) => p.value !== e), o("close", e), o("update:model-value", t.value);
24
30
  }, get NmorphTagItem() {
25
31
  return f;
26
32
  } };
@@ -28,5 +34,5 @@ const h = /* @__PURE__ */ p({
28
34
  }
29
35
  });
30
36
  export {
31
- h as default
37
+ L as default
32
38
  };
@@ -1 +1 @@
1
- .nmorph-tag-item{display:inline-flex;margin-right:var(--indentation-02);padding:var(--indentation-00) var(--indentation-03);border:solid 2px var(--nmorph-text-color);border-radius:var(--default-border-radius);cursor:default}.nmorph-tag-item .nmorph-tag-item__content{display:flex;align-items:center;height:100%}.nmorph-tag-item .nmorph-tag-item__close-icon{margin-left:4px;cursor:pointer}.nmorph-tag-item.nmorph-tag-item--nmorph-design{background:var(--nmorph-main-color);border:none;box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-tag-item.nmorph-tag-item--thin{--height: var(--thin-component)}.nmorph-tag-item.nmorph-tag-item--thin span{font-weight:400;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-tag-item.nmorph-tag-item--thick{--height: var(--thick-component)}
1
+ .nmorph-tag-item{display:inline-flex;margin-right:var(--indentation-02);padding:var(--indentation-00) var(--indentation-03);color:var(--nmorph-tag-item-content-color, var(--nmorph-tag-item-color, var(--nmorph-text-color)));border-radius:var(--default-border-radius);cursor:default}.nmorph-tag-item .nmorph-tag-item__content{display:flex;align-items:center;height:100%}.nmorph-tag-item span{color:inherit}.nmorph-tag-item .nmorph-tag-item__close-icon{margin-left:4px;cursor:pointer;--color: var(--nmorph-tag-item-content-color, var(--nmorph-tag-item-color, var(--nmorph-text-color)))}.nmorph-tag-item.nmorph-tag-item--nmorph{background:var(--nmorph-main-color);border:none;box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-tag-item.nmorph-tag-item--common{--nmorph-tag-item-content-color: var(--nmorph-tag-item-color, var(--nmorph-contrast-text-color));background:var(--nmorph-tag-item-background, var(--nmorph-gray-color));border:none;box-shadow:none}.nmorph-tag-item.nmorph-tag-item--thin{--height: var(--thin-component)}.nmorph-tag-item.nmorph-tag-item--thin span{font-weight:400;font-size:var(--font-size-extra-small);line-height:var(--line-height-regular)}.nmorph-tag-item.nmorph-tag-item--thick{--height: var(--thick-component)}
@@ -1,10 +1,10 @@
1
1
  import './NmorphTagItem.css';
2
- import { defineComponent as i, computed as s } from "vue";
2
+ import { defineComponent as p, computed as s } from "vue";
3
3
  import { useModifiers as u } from "../../../../../utils/create-modifiers.js";
4
4
  import { NmorphComponentHeight as a } from "../../../../../types/common.types.js";
5
5
  import l from "../../../../../assets/icons/error.svg.js";
6
- import d from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
7
- const N = /* @__PURE__ */ i({
6
+ import c from "../../../../basic/nmorph-icon/NmorphIcon.vue.js";
7
+ const N = /* @__PURE__ */ p({
8
8
  __name: "NmorphTagItem",
9
9
  props: {
10
10
  value: { type: String, required: !0 },
@@ -14,17 +14,17 @@ const N = /* @__PURE__ */ i({
14
14
  design: { type: String, required: !1, default: "nmorph" }
15
15
  },
16
16
  emits: ["close"],
17
- setup(o, { expose: n, emit: m }) {
17
+ setup(o, { expose: n, emit: i }) {
18
18
  n();
19
- const e = o, p = s(
19
+ const e = o, m = s(
20
20
  () => u({
21
21
  nmorph: [a[e.height]],
22
- "nmorph-tag-item": [`${e.design === "nmorph" ? "nmorph-design" : ""}`]
22
+ "nmorph-tag-item": [e.design]
23
23
  })
24
- ), r = m, t = { props: e, modifiers: p, emit: r, closeHandler: () => {
24
+ ), r = i, t = { props: e, modifiers: m, emit: r, closeHandler: () => {
25
25
  r("close", e.value);
26
26
  }, get NmorphIcon() {
27
- return d;
27
+ return c;
28
28
  }, get NmorphIconError() {
29
29
  return l;
30
30
  } };
@@ -1,24 +1,29 @@
1
1
  import './NmorphContextMenu.css';
2
2
  import s from "./NmorphContextMenu.vue2.js";
3
- import { openBlock as o, createElementBlock as l, renderSlot as i, createBlock as d, withCtx as p, Fragment as c, renderList as h, normalizeStyle as m, createElementVNode as f, toDisplayString as _, normalizeClass as y, resolveDynamicComponent as x, mergeProps as k, createCommentVNode as w } from "vue";
3
+ import { openBlock as o, createElementBlock as r, renderSlot as a, createBlock as d, withCtx as p, Fragment as c, renderList as h, normalizeStyle as m, createElementVNode as f, toDisplayString as _, normalizeClass as y, resolveDynamicComponent as w, mergeProps as x, createCommentVNode as k } from "vue";
4
4
  /* empty css */
5
5
  import b from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const C = {
6
+ const v = {
7
7
  key: 0,
8
8
  class: "nmorph-context-menu__options"
9
- }, v = ["disabled", "onClick"], O = { class: "nmorph-context-menu__item-label" }, g = ["tabindex", "aria-disabled", "onClick", "onKeydown"];
10
- function H(a, u, z, e, E, S) {
11
- return o(), l(
9
+ }, C = ["disabled", "onClick"], H = { class: "nmorph-context-menu__item-label" }, O = ["tabindex", "aria-disabled", "onClick", "onKeydown"];
10
+ function E(i, g, P, e, z, S) {
11
+ return o(), r(
12
12
  "div",
13
13
  {
14
14
  ref: "triggerDOMRef",
15
15
  class: "nmorph-context-menu",
16
16
  onClick: e.clickHandler,
17
17
  onContextmenu: e.contextMenuHandler,
18
- onKeydown: e.keydownHandler
18
+ onKeydown: e.keydownHandler,
19
+ onPointerdown: e.pointerDownHandler,
20
+ onPointermove: e.pointerMoveHandler,
21
+ onPointerup: e.pointerEndHandler,
22
+ onPointercancel: e.pointerEndHandler,
23
+ onPointerleave: e.pointerEndHandler
19
24
  },
20
25
  [
21
- i(a.$slots, "default"),
26
+ a(i.$slots, "default"),
22
27
  e.relativeElement ? (o(), d(e.NmorphDropdown, {
23
28
  key: 0,
24
29
  open: e.isOpen,
@@ -41,50 +46,50 @@ function H(a, u, z, e, E, S) {
41
46
  onOnEscapeKeydown: e.escapeHandler
42
47
  }, {
43
48
  default: p(() => [
44
- e.hasOptions ? (o(), l("div", C, [
45
- (o(!0), l(
49
+ e.hasOptions ? (o(), r("div", v, [
50
+ (o(!0), r(
46
51
  c,
47
52
  null,
48
- h(e.normalizedOptions, (n, r) => (o(), l(
53
+ h(e.normalizedOptions, (n, l) => (o(), r(
49
54
  c,
50
55
  {
51
56
  key: n.key
52
57
  },
53
58
  [
54
- n.component ? (o(), l("div", {
59
+ n.component ? (o(), r("div", {
55
60
  key: 1,
56
61
  class: y(["nmorph-context-menu__item", { "nmorph-context-menu__item--disabled": n.disabled }]),
57
62
  role: "menuitem",
58
63
  tabindex: n.disabled ? -1 : 0,
59
64
  "aria-disabled": n.disabled,
60
65
  style: m(e.getOptionStyle(n)),
61
- onClick: (t) => e.optionClickHandler(n, r),
62
- onKeydown: (t) => e.optionKeydownHandler(t, n, r)
66
+ onClick: (t) => e.optionClickHandler(n, l),
67
+ onKeydown: (t) => e.optionKeydownHandler(t, n, l)
63
68
  }, [
64
69
  (o(), d(
65
- x(n.component),
66
- k({ ref_for: !0 }, n.componentProps),
70
+ w(n.component),
71
+ x({ ref_for: !0 }, n.componentProps),
67
72
  null,
68
73
  16
69
74
  /* FULL_PROPS */
70
75
  ))
71
- ], 46, g)) : (o(), l("button", {
76
+ ], 46, O)) : (o(), r("button", {
72
77
  key: 0,
73
78
  type: "button",
74
79
  class: "nmorph-context-menu__item",
75
80
  role: "menuitem",
76
81
  disabled: n.disabled,
77
82
  style: m(e.getOptionStyle(n)),
78
- onClick: (t) => e.optionClickHandler(n, r)
83
+ onClick: (t) => e.optionClickHandler(n, l)
79
84
  }, [
80
85
  f(
81
86
  "span",
82
- O,
87
+ H,
83
88
  _(n.label),
84
89
  1
85
90
  /* TEXT */
86
91
  )
87
- ], 12, v))
92
+ ], 12, C))
88
93
  ],
89
94
  64
90
95
  /* STABLE_FRAGMENT */
@@ -92,20 +97,20 @@ function H(a, u, z, e, E, S) {
92
97
  128
93
98
  /* KEYED_FRAGMENT */
94
99
  ))
95
- ])) : i(a.$slots, "menu", {
100
+ ])) : a(i.$slots, "menu", {
96
101
  key: 1,
97
102
  close: e.close
98
103
  })
99
104
  ]),
100
105
  _: 3
101
106
  /* FORWARDED */
102
- }, 8, ["open", "relative-element", "placement", "width", "min-width", "max-width", "x-offset", "y-offset", "fill-width", "z-index", "close-on-escape", "trap-focus", "role", "aria-label", "hide-shadow"])) : w("v-if", !0)
107
+ }, 8, ["open", "relative-element", "placement", "width", "min-width", "max-width", "x-offset", "y-offset", "fill-width", "z-index", "close-on-escape", "trap-focus", "role", "aria-label", "hide-shadow"])) : k("v-if", !0)
103
108
  ],
104
109
  544
105
110
  /* NEED_HYDRATION, NEED_PATCH */
106
111
  );
107
112
  }
108
- const B = /* @__PURE__ */ b(s, [["render", H], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue"]]);
113
+ const B = /* @__PURE__ */ b(s, [["render", E], ["__file", "/builds/ketjo/nmorph/library/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue"]]);
109
114
  export {
110
115
  B as default
111
116
  };
@@ -1,7 +1,7 @@
1
1
  import './NmorphContextMenu.css';
2
- import { defineComponent as L, ref as i, computed as y, markRaw as M, toRaw as D, watch as k, onBeforeUnmount as V } from "vue";
3
- import P from "../nmorph-dropdown/NmorphDropdown.vue.js";
4
- const $ = /* @__PURE__ */ L({
2
+ import { defineComponent as j, ref as r, computed as m, markRaw as J, toRaw as U, watch as P, onBeforeUnmount as Q } from "vue";
3
+ import Z from "../nmorph-dropdown/NmorphDropdown.vue.js";
4
+ const H = 600, _ = 8, le = /* @__PURE__ */ j({
5
5
  __name: "NmorphContextMenu",
6
6
  props: {
7
7
  modelValue: { type: [Boolean, null], required: !1, default: null },
@@ -24,8 +24,8 @@ const $ = /* @__PURE__ */ L({
24
24
  hideShadow: { type: Boolean, required: !1, default: !1 }
25
25
  },
26
26
  emits: ["update:model-value", "open", "close", "select", "on-outside-click", "on-escape-keydown"],
27
- setup(q, { expose: O, emit: v }) {
28
- const l = q, r = v, d = i(null), c = i(null), o = i("point"), a = i(!!l.modelValue), f = y(() => typeof l.modelValue == "boolean" ? l.modelValue : a.value), S = y(() => l.options.length > 0), B = y(
27
+ setup(M, { expose: D, emit: B }) {
28
+ const l = M, n = B, S = r(null), E = r(null), g = r("point"), y = r(!!l.modelValue), o = r(null), i = r(null), a = r(null), b = r(!1), c = r(null), v = m(() => typeof l.modelValue == "boolean" ? l.modelValue : y.value), I = m(() => l.options.length > 0), q = m(() => l.trigger === "longpress"), T = m(() => l.trigger === "contextmenu" || l.trigger === "both"), R = m(
29
29
  () => l.options.map((e, t) => typeof e == "string" || typeof e == "number" ? {
30
30
  key: `${e}-${t}`,
31
31
  label: e,
@@ -37,7 +37,7 @@ const $ = /* @__PURE__ */ L({
37
37
  key: `${String(e.value ?? e.label ?? t)}-${t}`,
38
38
  label: e.label,
39
39
  value: e.value ?? e.label ?? t,
40
- component: e.component ? M(D(e.component)) : void 0,
40
+ component: e.component ? J(U(e.component)) : void 0,
41
41
  componentProps: e.componentProps,
42
42
  disabled: !!e.disabled,
43
43
  color: e.color,
@@ -45,13 +45,13 @@ const $ = /* @__PURE__ */ L({
45
45
  raw: e
46
46
  })
47
47
  );
48
- k(
48
+ P(
49
49
  () => l.modelValue,
50
50
  (e) => {
51
- typeof e == "boolean" && (a.value = e);
51
+ typeof e == "boolean" && (y.value = e);
52
52
  }
53
53
  );
54
- const g = (e, t) => ({
54
+ const x = (e, t) => ({
55
55
  clientWidth: 0,
56
56
  getBoundingClientRect: () => ({
57
57
  x: e,
@@ -64,51 +64,80 @@ const $ = /* @__PURE__ */ L({
64
64
  bottom: t,
65
65
  toJSON: () => ({})
66
66
  })
67
- }), u = (e) => {
68
- const t = f.value;
69
- a.value = e, r("update:model-value", e), t && !e && r("close");
70
- }, n = () => {
71
- u(!1);
72
- }, b = (e, t, m) => {
73
- o.value = "point", c.value = g(e, t), u(!0), r("open", m);
74
- }, p = (e, t) => {
75
- o.value = "element", c.value = e, u(!0), r("open", t);
76
- }, C = (e) => {
77
- l.disabled || l.trigger !== "contextmenu" && l.trigger !== "both" || (e.preventDefault(), b(e.clientX, e.clientY, e));
78
- }, E = (e) => {
67
+ }), w = (e) => {
68
+ const t = v.value;
69
+ y.value = e, n("update:model-value", e), t && !e && n("close");
70
+ }, u = () => {
71
+ w(!1);
72
+ }, d = (e, t, p) => {
73
+ l.disabled || (g.value = "point", E.value = x(e, t), w(!0), n("open", p));
74
+ }, h = (e, t) => {
75
+ l.disabled || (g.value = "element", E.value = e, w(!0), n("open", t));
76
+ }, V = (e) => {
77
+ if (!l.disabled) {
78
+ if (l.trigger === "longpress") {
79
+ e.preventDefault();
80
+ return;
81
+ }
82
+ T.value && (e.preventDefault(), d(e.clientX, e.clientY, e));
83
+ }
84
+ }, k = (e) => {
85
+ !v.value || l.disabled || !T.value || (e.preventDefault(), e.stopPropagation(), d(e.clientX, e.clientY, e));
86
+ }, X = (e) => {
87
+ if (b.value) {
88
+ f(), e.preventDefault();
89
+ return;
90
+ }
79
91
  if (l.disabled || l.trigger !== "click" && l.trigger !== "both" || e.button !== 0) return;
80
- const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : d.value;
81
- t && p(t, e);
82
- }, H = (e) => {
83
- if (l.disabled || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10")) return;
84
- const t = e.target instanceof HTMLElement ? e.target : d.value;
85
- t && (e.preventDefault(), p(t, e));
86
- }, _ = () => {
87
- r("on-outside-click"), n();
92
+ const t = e.currentTarget instanceof HTMLElement ? e.currentTarget : S.value;
93
+ t && h(t, e);
94
+ }, Y = (e) => {
95
+ if (l.disabled || l.trigger === "manual" || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10"))
96
+ return;
97
+ const t = e.target instanceof HTMLElement ? e.target : S.value;
98
+ t && (e.preventDefault(), h(t, e));
99
+ }, A = () => {
100
+ n("on-outside-click"), u();
101
+ }, W = () => {
102
+ n("on-escape-keydown"), u();
103
+ }, C = (e, t) => {
104
+ e.disabled || (n("select", e.raw, t), e.closeOnClick && u());
105
+ }, $ = (e, t, p) => {
106
+ e.key !== "Enter" && e.key !== " " || (e.preventDefault(), C(t, p));
107
+ }, s = () => {
108
+ o.value && clearTimeout(o.value), o.value = null, i.value = null, a.value = null;
109
+ }, f = () => {
110
+ c.value && clearTimeout(c.value), b.value = !1, c.value = null;
88
111
  }, N = () => {
89
- r("on-escape-keydown"), n();
90
- }, w = (e, t) => {
91
- e.disabled || (r("select", e.raw, t), e.closeOnClick && n());
92
- }, x = (e, t, m) => {
93
- e.key !== "Enter" && e.key !== " " || (e.preventDefault(), w(t, m));
94
- }, T = (e) => ({
112
+ f(), b.value = !0, c.value = setTimeout(f, 700);
113
+ }, z = (e) => {
114
+ l.disabled || !q.value || e.pointerType !== "touch" && e.pointerType !== "pen" || (s(), i.value = e.pointerId, a.value = { x: e.clientX, y: e.clientY }, o.value = setTimeout(() => {
115
+ N(), s(), d(e.clientX, e.clientY, e);
116
+ }, H));
117
+ }, F = (e) => {
118
+ if (!o.value || i.value !== e.pointerId || !a.value) return;
119
+ const t = Math.abs(e.clientX - a.value.x), p = Math.abs(e.clientY - a.value.y);
120
+ (t > _ || p > _) && s();
121
+ }, G = (e) => {
122
+ i.value === e.pointerId && s();
123
+ }, K = (e) => ({
95
124
  "--nmorph-context-menu-item-color": e.color
96
- }), s = () => {
97
- l.closeOnScroll && o.value === "point" && n();
125
+ }), O = () => {
126
+ l.closeOnScroll && g.value === "point" && u();
98
127
  };
99
- k(
100
- f,
128
+ P(
129
+ v,
101
130
  (e) => {
102
- typeof window > "u" || (e ? window.addEventListener("scroll", s, { passive: !0, capture: !0 }) : window.removeEventListener("scroll", s, !0));
131
+ typeof window > "u" || (e ? (window.addEventListener("scroll", O, { passive: !0, capture: !0 }), document.addEventListener("contextmenu", k, !0)) : (window.removeEventListener("scroll", O, !0), document.removeEventListener("contextmenu", k, !0)));
103
132
  },
104
133
  { immediate: !0 }
105
- ), V(() => {
106
- typeof window < "u" && window.removeEventListener("scroll", s, !0);
107
- }), O({ close: n });
108
- const h = { props: l, emit: r, triggerDOMRef: d, relativeElement: c, anchorType: o, openState: a, isOpen: f, hasOptions: S, normalizedOptions: B, createPointElement: g, setOpen: u, close: n, openAt: b, openAtElement: p, contextMenuHandler: C, clickHandler: E, keydownHandler: H, outsideClickHandler: _, escapeHandler: N, optionClickHandler: w, optionKeydownHandler: x, getOptionStyle: T, scrollHandler: s, NmorphDropdown: P };
109
- return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
134
+ ), Q(() => {
135
+ typeof window < "u" && window.removeEventListener("scroll", O, !0), typeof document < "u" && document.removeEventListener("contextmenu", k, !0), s(), f();
136
+ }), D({ close: u, openAt: d, openAtElement: h });
137
+ const L = { LONG_PRESS_DELAY_IN_MS: H, LONG_PRESS_MOVE_TOLERANCE_IN_PX: _, props: l, emit: n, triggerDOMRef: S, relativeElement: E, anchorType: g, openState: y, longPressTimer: o, longPressPointerId: i, longPressStartPoint: a, suppressNextClick: b, suppressNextClickTimer: c, isOpen: v, hasOptions: I, isLongPressTrigger: q, isContextMenuTrigger: T, normalizedOptions: R, createPointElement: x, setOpen: w, close: u, openAt: d, openAtElement: h, contextMenuHandler: V, documentContextMenuHandler: k, clickHandler: X, keydownHandler: Y, outsideClickHandler: A, escapeHandler: W, optionClickHandler: C, optionKeydownHandler: $, clearLongPressTimer: s, clearClickSuppression: f, suppressNextClickTemporarily: N, pointerDownHandler: z, pointerMoveHandler: F, pointerEndHandler: G, getOptionStyle: K, scrollHandler: O, NmorphDropdown: Z };
138
+ return Object.defineProperty(L, "__isScriptSetup", { enumerable: !1, value: !0 }), L;
110
139
  }
111
140
  });
112
141
  export {
113
- $ as default
142
+ le as default
114
143
  };
@@ -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
  };