@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.
- 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.vue.js +7 -7
- package/dist/components/data/nmorph-tag-list/NmorphTagList.vue2.js +22 -16
- 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.vue2.js +8 -8
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.js +27 -22
- package/dist/components/navigation/nmorph-context-menu/NmorphContextMenu.vue2.js +75 -46
- package/dist/hooks/use-placement.js +65 -61
- package/dist/index.umd.js +26 -26
- 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 +4 -1
- package/dist/src/components/data/nmorph-tag-list/types.d.ts +1 -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,17 +1,17 @@
|
|
|
1
1
|
import n from "./NmorphTagList.vue2.js";
|
|
2
|
-
import { openBlock as e, createElementBlock as t, normalizeClass as
|
|
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,
|
|
4
|
+
function p(f, d, _, r, u, g) {
|
|
5
5
|
return e(), t(
|
|
6
6
|
"div",
|
|
7
7
|
{
|
|
8
|
-
class:
|
|
8
|
+
class: l(r.modifiers)
|
|
9
9
|
},
|
|
10
10
|
[
|
|
11
11
|
(e(!0), t(
|
|
12
|
-
|
|
12
|
+
s,
|
|
13
13
|
null,
|
|
14
|
-
|
|
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
|
|
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
|
-
|
|
33
|
+
v as default
|
|
34
34
|
};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useModifiers as
|
|
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
|
|
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(
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
() =>
|
|
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
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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);
|
|
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)}
|
package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './NmorphTagItem.css';
|
|
2
|
-
import { defineComponent as
|
|
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
|
|
7
|
-
const N = /* @__PURE__ */
|
|
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:
|
|
17
|
+
setup(o, { expose: n, emit: i }) {
|
|
18
18
|
n();
|
|
19
|
-
const e = o,
|
|
19
|
+
const e = o, m = s(
|
|
20
20
|
() => u({
|
|
21
21
|
nmorph: [a[e.height]],
|
|
22
|
-
"nmorph-tag-item": [
|
|
22
|
+
"nmorph-tag-item": [e.design]
|
|
23
23
|
})
|
|
24
|
-
), r =
|
|
24
|
+
), r = i, t = { props: e, modifiers: m, emit: r, closeHandler: () => {
|
|
25
25
|
r("close", e.value);
|
|
26
26
|
}, get NmorphIcon() {
|
|
27
|
-
return
|
|
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
|
|
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
|
|
6
|
+
const v = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "nmorph-context-menu__options"
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
return o(),
|
|
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
|
|
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(),
|
|
45
|
-
(o(!0),
|
|
49
|
+
e.hasOptions ? (o(), r("div", v, [
|
|
50
|
+
(o(!0), r(
|
|
46
51
|
c,
|
|
47
52
|
null,
|
|
48
|
-
h(e.normalizedOptions, (n,
|
|
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(),
|
|
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,
|
|
62
|
-
onKeydown: (t) => e.optionKeydownHandler(t, n,
|
|
66
|
+
onClick: (t) => e.optionClickHandler(n, l),
|
|
67
|
+
onKeydown: (t) => e.optionKeydownHandler(t, n, l)
|
|
63
68
|
}, [
|
|
64
69
|
(o(), d(
|
|
65
|
-
|
|
66
|
-
|
|
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,
|
|
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,
|
|
83
|
+
onClick: (t) => e.optionClickHandler(n, l)
|
|
79
84
|
}, [
|
|
80
85
|
f(
|
|
81
86
|
"span",
|
|
82
|
-
|
|
87
|
+
H,
|
|
83
88
|
_(n.label),
|
|
84
89
|
1
|
|
85
90
|
/* TEXT */
|
|
86
91
|
)
|
|
87
|
-
], 12,
|
|
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
|
|
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"])) :
|
|
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",
|
|
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
|
|
3
|
-
import
|
|
4
|
-
const
|
|
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(
|
|
28
|
-
const l =
|
|
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 ?
|
|
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
|
-
|
|
48
|
+
P(
|
|
49
49
|
() => l.modelValue,
|
|
50
50
|
(e) => {
|
|
51
|
-
typeof e == "boolean" && (
|
|
51
|
+
typeof e == "boolean" && (y.value = e);
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
|
-
const
|
|
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
|
-
}),
|
|
68
|
-
const t =
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
l.disabled
|
|
78
|
-
|
|
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 :
|
|
81
|
-
t &&
|
|
82
|
-
},
|
|
83
|
-
if (l.disabled || e.key !== "ContextMenu" && !(e.shiftKey && e.key === "F10"))
|
|
84
|
-
|
|
85
|
-
t
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
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
|
-
}),
|
|
97
|
-
l.closeOnScroll &&
|
|
125
|
+
}), O = () => {
|
|
126
|
+
l.closeOnScroll && g.value === "point" && u();
|
|
98
127
|
};
|
|
99
|
-
|
|
100
|
-
|
|
128
|
+
P(
|
|
129
|
+
v,
|
|
101
130
|
(e) => {
|
|
102
|
-
typeof window > "u" || (e ? window.addEventListener("scroll",
|
|
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
|
-
),
|
|
106
|
-
typeof window < "u" && window.removeEventListener("scroll",
|
|
107
|
-
}),
|
|
108
|
-
const
|
|
109
|
-
return Object.defineProperty(
|
|
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
|
-
|
|
142
|
+
le as default
|
|
114
143
|
};
|
|
@@ -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
|
};
|