@mlightcad/ui-components 0.0.15 → 0.0.16
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/README.md +2 -0
- package/dist/ui-components.es.js +251 -209
- package/dist/ui-components.umd.js +2 -2
- package/lib/index.d.ts +4 -1
- package/lib/index.js +4 -1
- package/package.json +3 -1
- package/src/components/MlToggleButton.vue +88 -0
- package/src/components/MlToolBar.vue +2 -2
- package/src/components/types.ts +3 -0
- package/src/index.ts +5 -0
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ The following components are included in this package.
|
|
|
9
9
|
- Tool Palette: one dockable, resizable, and floating window, which is quite similar to AutoCAD Tool Palette.
|
|
10
10
|
- Toolbar: one toolbar which can be easily customized by one array of button data.
|
|
11
11
|
|
|
12
|
+
You can play with them through [this live demo](https://mlight-lee.github.io/ui-components/).
|
|
13
|
+
|
|
12
14
|
### Tool Palette
|
|
13
15
|
|
|
14
16
|
AutoCAD uses [tool palettes](https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-167A8594-92CB-4FCC-B72C-0F546383E97C) to organize blocks, hatches, and custom tools in a tabbed window. Tool Palette component is quite similar to one in AutoCAD. It supports the following features.
|
package/dist/ui-components.es.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ml-dropdown-icon[data-v-3fc33b5d],.ml-dropdown-icon[data-v-3fc33b5d]:hover{outline:none;border:none}.ml-status-bar[data-v-d6a59cf0]{position:fixed;bottom:0;left:0;right:0;height:30px;display:flex;justify-content:space-between;align-items:center;background-color:var(--el-fill-color);box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-status-bar-left[data-v-d6a59cf0],.ml-status-bar-right[data-v-d6a59cf0]{display:flex;align-items:center}.ml-status-bar-left[data-v-d6a59cf0]>*{margin-right:10px}.ml-status-bar-right[data-v-d6a59cf0]>*{margin-left:10px}.ml-vertical-toolbar-button-group[data-v-
|
|
2
|
-
import { ElIcon as A, ElDropdownItem as
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ml-dropdown-icon[data-v-3fc33b5d],.ml-dropdown-icon[data-v-3fc33b5d]:hover{outline:none;border:none}.ml-status-bar[data-v-d6a59cf0]{position:fixed;bottom:0;left:0;right:0;height:30px;display:flex;justify-content:space-between;align-items:center;background-color:var(--el-fill-color);box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-status-bar-left[data-v-d6a59cf0],.ml-status-bar-right[data-v-d6a59cf0]{display:flex;align-items:center}.ml-status-bar-left[data-v-d6a59cf0]>*{margin-right:10px}.ml-status-bar-right[data-v-d6a59cf0]>*{margin-left:10px}.ml-vertical-toolbar-button-group[data-v-3eed2087]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-3eed2087]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-3eed2087]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-3eed2087]{margin-left:0;margin-top:5px}.ml-tool-palette-dialog[data-v-11a64c54]{cursor:default;width:300px;min-width:var(--collapsed-width);position:fixed;box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-tool-palette-dialog-icon[data-v-11a64c54]{border-bottom:1px solid var(--el-border-color)}.ml-tool-palette-dialog-layout[data-v-11a64c54]{display:flex;height:100%}.ml-tool-palette-title-bar[data-v-11a64c54]{width:var(--collapsed-width);display:flex;justify-content:left;align-items:center;cursor:move;writing-mode:vertical-rl;text-align:center;background-color:var(--el-fill-color)}.ml-tool-palette-title[data-v-11a64c54]{pointer-events:none;margin-top:10px;margin-bottom:10px;font-size:small;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ml-tool-palette-content[data-v-11a64c54]{-webkit-user-select:none;user-select:none;flex-grow:1;display:flex;justify-content:space-around;background-color:var(--el-fill-color);overflow:hidden}.ml-tool-palette-dialog-layout.left .ml-tool-palette-title-bar[data-v-11a64c54]{order:1}.ml-tool-palette-dialog-layout.left .ml-tool-palette-content[data-v-11a64c54],.ml-tool-palette-dialog-layout.right .ml-tool-palette-title-bar[data-v-11a64c54]{order:2}.ml-tool-palette-dialog-layout.right .ml-tool-palette-content[data-v-11a64c54]{order:1}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { ElIcon as A, ElDropdownItem as ue, ElDropdownMenu as ae, ElDropdown as ce, ElButton as Z, ElTooltip as P, ElButtonGroup as re } from "element-plus/es";
|
|
3
3
|
import "element-plus/es/components/base/style/css";
|
|
4
4
|
import "element-plus/es/components/icon/style/css";
|
|
5
|
-
import { openBlock as y, createElementBlock as I, createElementVNode as
|
|
5
|
+
import { openBlock as y, createElementBlock as I, createElementVNode as B, defineComponent as S, mergeModels as D, useModel as U, computed as _, createBlock as T, withCtx as b, resolveDynamicComponent as F, createVNode as V, Fragment as R, renderList as ee, createTextVNode as ve, toDisplayString as G, pushScopeId as te, popScopeId as ne, renderSlot as O, normalizeClass as le, normalizeStyle as X, createCommentVNode as oe, ref as m, onMounted as Y, onUnmounted as j, watch as L, onBeforeUnmount as se, unref as q } from "vue";
|
|
6
6
|
import "element-plus/es/components/dropdown/style/css";
|
|
7
7
|
import "element-plus/es/components/dropdown-menu/style/css";
|
|
8
8
|
import "element-plus/es/components/dropdown-item/style/css";
|
|
9
|
-
import "element-plus/es/components/button-group/style/css";
|
|
10
9
|
import "element-plus/es/components/tooltip/style/css";
|
|
11
10
|
import "element-plus/es/components/button/style/css";
|
|
11
|
+
import "element-plus/es/components/button-group/style/css";
|
|
12
12
|
const de = {
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: "1em",
|
|
15
15
|
height: "1em",
|
|
16
16
|
viewBox: "0 0 1024 1024"
|
|
17
|
-
}, me = /* @__PURE__ */
|
|
17
|
+
}, me = /* @__PURE__ */ B("path", {
|
|
18
18
|
fill: "currentColor",
|
|
19
19
|
d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"
|
|
20
20
|
}, null, -1), he = [
|
|
@@ -23,59 +23,59 @@ const de = {
|
|
|
23
23
|
function fe(e, s) {
|
|
24
24
|
return y(), I("svg", de, [...he]);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const J = { render: fe }, pe = {
|
|
27
27
|
xmlns: "http://www.w3.org/2000/svg",
|
|
28
28
|
width: "1em",
|
|
29
29
|
height: "1em",
|
|
30
30
|
viewBox: "0 0 1024 1024"
|
|
31
|
-
},
|
|
31
|
+
}, _e = /* @__PURE__ */ B("path", {
|
|
32
32
|
fill: "currentColor",
|
|
33
33
|
d: "M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
|
|
34
|
-
}, null, -1),
|
|
35
|
-
|
|
34
|
+
}, null, -1), we = [
|
|
35
|
+
_e
|
|
36
36
|
];
|
|
37
37
|
function ge(e, s) {
|
|
38
|
-
return y(), I("svg", pe, [...
|
|
38
|
+
return y(), I("svg", pe, [...we]);
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const K = { render: ge }, Le = /* @__PURE__ */ S({
|
|
41
41
|
__name: "MlCollapse",
|
|
42
|
-
props: /* @__PURE__ */
|
|
42
|
+
props: /* @__PURE__ */ D({
|
|
43
43
|
size: { default: 18 },
|
|
44
44
|
reverse: { type: Boolean, default: !1 }
|
|
45
45
|
}, {
|
|
46
46
|
modelValue: { default: !0 },
|
|
47
47
|
modelModifiers: {}
|
|
48
48
|
}),
|
|
49
|
-
emits: /* @__PURE__ */
|
|
49
|
+
emits: /* @__PURE__ */ D(["change"], ["update:modelValue"]),
|
|
50
50
|
setup(e, { emit: s }) {
|
|
51
|
-
const t = e, o =
|
|
51
|
+
const t = e, o = U(e, "modelValue"), l = s, n = _(() => t.reverse ? o.value ? J : K : o.value ? K : J), i = _(() => `${t.size}px`), d = () => {
|
|
52
52
|
l("change", o.value), o.value = !o.value;
|
|
53
53
|
};
|
|
54
|
-
return (
|
|
54
|
+
return (u, a) => {
|
|
55
55
|
const r = A;
|
|
56
|
-
return y(),
|
|
57
|
-
size:
|
|
56
|
+
return y(), T(r, {
|
|
57
|
+
size: i.value,
|
|
58
58
|
onClick: d
|
|
59
59
|
}, {
|
|
60
|
-
default:
|
|
61
|
-
(y(),
|
|
60
|
+
default: b(() => [
|
|
61
|
+
(y(), T(F(n.value)))
|
|
62
62
|
]),
|
|
63
63
|
_: 1
|
|
64
64
|
}, 8, ["size"]);
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
}), xe = (e) => (
|
|
67
|
+
}), xe = (e) => (te("data-v-3fc33b5d"), e = e(), ne(), e), ye = /* @__PURE__ */ xe(() => /* @__PURE__ */ B("svg", {
|
|
68
68
|
preserveAspectRatio: "xMidYMid meet",
|
|
69
69
|
viewBox: "0 0 24 24",
|
|
70
70
|
width: "1.2em",
|
|
71
71
|
height: "1.2em",
|
|
72
72
|
"data-v-63d067da": ""
|
|
73
73
|
}, [
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ B("path", {
|
|
75
75
|
fill: "currentColor",
|
|
76
76
|
d: "m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"
|
|
77
77
|
})
|
|
78
|
-
], -1)), Me = /* @__PURE__ */
|
|
78
|
+
], -1)), Me = /* @__PURE__ */ S({
|
|
79
79
|
__name: "MlDropdown",
|
|
80
80
|
props: {
|
|
81
81
|
icon: {},
|
|
@@ -86,21 +86,21 @@ const q = { render: ge }, Le = /* @__PURE__ */ V({
|
|
|
86
86
|
click: null
|
|
87
87
|
},
|
|
88
88
|
setup(e, { emit: s }) {
|
|
89
|
-
const t = e, o = s, l =
|
|
90
|
-
o("click",
|
|
89
|
+
const t = e, o = s, l = _(() => t.items.filter((i) => i.name !== t.current)), n = (i) => {
|
|
90
|
+
o("click", i);
|
|
91
91
|
};
|
|
92
|
-
return (
|
|
93
|
-
const
|
|
94
|
-
return y(),
|
|
95
|
-
dropdown:
|
|
96
|
-
|
|
97
|
-
default:
|
|
98
|
-
(y(!0), I(
|
|
92
|
+
return (i, d) => {
|
|
93
|
+
const u = A, a = ue, r = ae, p = ce;
|
|
94
|
+
return y(), T(p, { onCommand: n }, {
|
|
95
|
+
dropdown: b(() => [
|
|
96
|
+
V(r, null, {
|
|
97
|
+
default: b(() => [
|
|
98
|
+
(y(!0), I(R, null, ee(l.value, (c) => (y(), T(a, {
|
|
99
99
|
key: c.text,
|
|
100
100
|
command: c.name
|
|
101
101
|
}, {
|
|
102
|
-
default:
|
|
103
|
-
ve(
|
|
102
|
+
default: b(() => [
|
|
103
|
+
ve(G(c.text), 1)
|
|
104
104
|
]),
|
|
105
105
|
_: 2
|
|
106
106
|
}, 1032, ["command"]))), 128))
|
|
@@ -108,12 +108,12 @@ const q = { render: ge }, Le = /* @__PURE__ */ V({
|
|
|
108
108
|
_: 1
|
|
109
109
|
})
|
|
110
110
|
]),
|
|
111
|
-
default:
|
|
112
|
-
|
|
111
|
+
default: b(() => [
|
|
112
|
+
V(u, {
|
|
113
113
|
size: "30",
|
|
114
114
|
class: "ml-dropdown-icon"
|
|
115
115
|
}, {
|
|
116
|
-
default:
|
|
116
|
+
default: b(() => [
|
|
117
117
|
ye
|
|
118
118
|
]),
|
|
119
119
|
_: 1
|
|
@@ -128,7 +128,7 @@ const q = { render: ge }, Le = /* @__PURE__ */ V({
|
|
|
128
128
|
for (const [o, l] of s)
|
|
129
129
|
t[o] = l;
|
|
130
130
|
return t;
|
|
131
|
-
}, N = /* @__PURE__ */ H(Me, [["__scopeId", "data-v-3fc33b5d"]]),
|
|
131
|
+
}, N = /* @__PURE__ */ H(Me, [["__scopeId", "data-v-3fc33b5d"]]), ze = '<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>', be = /* @__PURE__ */ S({
|
|
132
132
|
__name: "MlLanguage",
|
|
133
133
|
props: {
|
|
134
134
|
languages: {},
|
|
@@ -141,28 +141,69 @@ const q = { render: ge }, Le = /* @__PURE__ */ V({
|
|
|
141
141
|
const t = e, o = s, l = (n) => {
|
|
142
142
|
o("click", n);
|
|
143
143
|
};
|
|
144
|
-
return (n,
|
|
145
|
-
icon:
|
|
144
|
+
return (n, i) => (y(), T(N, {
|
|
145
|
+
icon: ze,
|
|
146
146
|
items: t.languages,
|
|
147
147
|
current: t.current,
|
|
148
148
|
onClick: l
|
|
149
149
|
}, null, 8, ["items", "current"]));
|
|
150
150
|
}
|
|
151
|
-
}),
|
|
152
|
-
function
|
|
153
|
-
return y(), I("div",
|
|
154
|
-
|
|
151
|
+
}), Ee = {}, Be = { class: "ml-status-bar" }, Ce = { class: "ml-status-bar-left" }, ke = { class: "ml-status-bar-right" };
|
|
152
|
+
function Te(e, s) {
|
|
153
|
+
return y(), I("div", Be, [
|
|
154
|
+
B("div", Ce, [
|
|
155
155
|
O(e.$slots, "left", {}, void 0, !0)
|
|
156
156
|
]),
|
|
157
|
-
|
|
157
|
+
B("div", ke, [
|
|
158
158
|
O(e.$slots, "right", {}, void 0, !0)
|
|
159
159
|
])
|
|
160
160
|
]);
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const $e = /* @__PURE__ */ H(Ee, [["render", Te], ["__scopeId", "data-v-d6a59cf0"]]), We = /* @__PURE__ */ S({
|
|
163
|
+
__name: "MlToggleButton",
|
|
164
|
+
props: /* @__PURE__ */ D({
|
|
165
|
+
size: { default: "default" },
|
|
166
|
+
type: {},
|
|
167
|
+
data: {}
|
|
168
|
+
}, {
|
|
169
|
+
modelValue: { default: !1 },
|
|
170
|
+
modelModifiers: {}
|
|
171
|
+
}),
|
|
172
|
+
emits: /* @__PURE__ */ D(["click"], ["update:modelValue"]),
|
|
173
|
+
setup(e, { emit: s }) {
|
|
174
|
+
const t = e, o = U(e, "modelValue"), l = s, n = _(() => o.value ? t.data.onIcon : t.data.offIcon), i = _(() => o.value ? t.data.onTooltip : t.data.offTooltip), d = () => {
|
|
175
|
+
o.value = !o.value, l("click", o.value);
|
|
176
|
+
};
|
|
177
|
+
return (u, a) => {
|
|
178
|
+
const r = A, p = Z, c = P;
|
|
179
|
+
return y(), T(c, {
|
|
180
|
+
content: i.value,
|
|
181
|
+
"hide-after": 0
|
|
182
|
+
}, {
|
|
183
|
+
default: b(() => [
|
|
184
|
+
V(p, {
|
|
185
|
+
type: t.type,
|
|
186
|
+
size: t.size
|
|
187
|
+
}, {
|
|
188
|
+
default: b(() => [
|
|
189
|
+
V(r, { onClick: d }, {
|
|
190
|
+
default: b(() => [
|
|
191
|
+
(y(), T(F(n.value)))
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
})
|
|
195
|
+
]),
|
|
196
|
+
_: 1
|
|
197
|
+
}, 8, ["type", "size"])
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
}, 8, ["content"]);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}), Ie = {
|
|
163
204
|
key: 0,
|
|
164
205
|
class: "ml-toolbar-button-text"
|
|
165
|
-
},
|
|
206
|
+
}, Ve = /* @__PURE__ */ S({
|
|
166
207
|
__name: "MlToolBar",
|
|
167
208
|
props: {
|
|
168
209
|
items: {},
|
|
@@ -173,7 +214,7 @@ const Te = /* @__PURE__ */ H(ze, [["render", $e], ["__scopeId", "data-v-d6a59cf0
|
|
|
173
214
|
click: null
|
|
174
215
|
},
|
|
175
216
|
setup(e, { emit: s }) {
|
|
176
|
-
const t = e, o = s, l =
|
|
217
|
+
const t = e, o = s, l = _(() => t.direction === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), n = _(() => t.size === "small" ? 20 : 30), i = _(() => {
|
|
177
218
|
switch (t.size) {
|
|
178
219
|
case "small":
|
|
179
220
|
return 30;
|
|
@@ -181,36 +222,36 @@ const Te = /* @__PURE__ */ H(ze, [["render", $e], ["__scopeId", "data-v-d6a59cf0
|
|
|
181
222
|
return 50;
|
|
182
223
|
}
|
|
183
224
|
return 70;
|
|
184
|
-
}), d = (r) => r.description ? r.description : r.text,
|
|
225
|
+
}), d = (r) => r.description ? r.description : r.text, u = _(() => t.size === "large"), a = (r) => {
|
|
185
226
|
o("click", r);
|
|
186
227
|
};
|
|
187
|
-
return (r,
|
|
188
|
-
const c = A, h =
|
|
189
|
-
return y(),
|
|
190
|
-
class:
|
|
228
|
+
return (r, p) => {
|
|
229
|
+
const c = A, h = Z, v = P, f = re;
|
|
230
|
+
return y(), T(f, {
|
|
231
|
+
class: le(l.value)
|
|
191
232
|
}, {
|
|
192
|
-
default:
|
|
193
|
-
(y(!0), I(
|
|
233
|
+
default: b(() => [
|
|
234
|
+
(y(!0), I(R, null, ee(r.items, (x, C) => (y(), T(v, {
|
|
194
235
|
key: x.text,
|
|
195
236
|
content: d(x),
|
|
196
237
|
"hide-after": 0
|
|
197
238
|
}, {
|
|
198
|
-
default:
|
|
199
|
-
(y(),
|
|
239
|
+
default: b(() => [
|
|
240
|
+
(y(), T(h, {
|
|
200
241
|
class: "ml-toolbar-button",
|
|
201
|
-
style: X({ width:
|
|
242
|
+
style: X({ width: i.value + "px", height: i.value + "px" }),
|
|
202
243
|
key: C,
|
|
203
|
-
onClick: (
|
|
244
|
+
onClick: (k) => a(x.command)
|
|
204
245
|
}, {
|
|
205
|
-
default:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
default:
|
|
209
|
-
(y(),
|
|
246
|
+
default: b(() => [
|
|
247
|
+
B("div", null, [
|
|
248
|
+
V(c, { size: n.value }, {
|
|
249
|
+
default: b(() => [
|
|
250
|
+
(y(), T(F(x.icon)))
|
|
210
251
|
]),
|
|
211
252
|
_: 2
|
|
212
253
|
}, 1032, ["size"]),
|
|
213
|
-
|
|
254
|
+
u.value ? (y(), I("div", Ie, G(x.text), 1)) : oe("", !0)
|
|
214
255
|
])
|
|
215
256
|
]),
|
|
216
257
|
_: 2
|
|
@@ -223,35 +264,35 @@ const Te = /* @__PURE__ */ H(ze, [["render", $e], ["__scopeId", "data-v-d6a59cf0
|
|
|
223
264
|
}, 8, ["class"]);
|
|
224
265
|
};
|
|
225
266
|
}
|
|
226
|
-
}), De = /* @__PURE__ */ H(
|
|
267
|
+
}), De = /* @__PURE__ */ H(Ve, [["__scopeId", "data-v-3eed2087"]]), Q = 20;
|
|
227
268
|
function Se(e, s, t) {
|
|
228
|
-
const o = m(!1), l = (
|
|
269
|
+
const o = m(!1), l = (u) => {
|
|
229
270
|
if (t.value && e.value) {
|
|
230
|
-
const a = e.value.getBoundingClientRect(), r =
|
|
271
|
+
const a = e.value.getBoundingClientRect(), r = u.clientX < a.left || u.clientX > a.right || u.clientY < a.top || u.clientY > a.bottom;
|
|
231
272
|
o.value = !r;
|
|
232
273
|
}
|
|
233
274
|
}, n = () => {
|
|
234
275
|
t.value && (o.value = !0);
|
|
235
|
-
},
|
|
276
|
+
}, i = () => {
|
|
236
277
|
s.value && s.value.addEventListener("mousemove", n), e.value && e.value.addEventListener("mousemove", n);
|
|
237
278
|
}, d = () => {
|
|
238
279
|
s.value && s.value.removeEventListener("mousemove", n), e.value && e.value.removeEventListener("mousemove", n);
|
|
239
280
|
};
|
|
240
|
-
return
|
|
281
|
+
return Y(() => {
|
|
241
282
|
window.addEventListener("mousemove", l);
|
|
242
|
-
}),
|
|
283
|
+
}), j(() => {
|
|
243
284
|
window.removeEventListener("mousemove", l);
|
|
244
|
-
}), L(t, (
|
|
245
|
-
|
|
246
|
-
}), L(e, (
|
|
247
|
-
|
|
285
|
+
}), L(t, (u) => {
|
|
286
|
+
u && (o.value = !1);
|
|
287
|
+
}), L(e, (u) => {
|
|
288
|
+
u ? i() : d();
|
|
248
289
|
}), { autoOpened: o };
|
|
249
290
|
}
|
|
250
|
-
function
|
|
251
|
-
const o = m(!1), l = m(null), n = m(null),
|
|
291
|
+
function Ye(e, s, t) {
|
|
292
|
+
const o = m(!1), l = m(null), n = m(null), i = { x: 0, y: 0 }, d = _(() => l.value == null || n.value == null ? { x: 0, y: 0 } : {
|
|
252
293
|
x: l.value.x - n.value.x,
|
|
253
294
|
y: l.value.y - n.value.y
|
|
254
|
-
}),
|
|
295
|
+
}), u = () => {
|
|
255
296
|
if (e.value) {
|
|
256
297
|
const v = e.value.getBoundingClientRect();
|
|
257
298
|
n.value = {
|
|
@@ -263,33 +304,33 @@ function Ve(e, s, t) {
|
|
|
263
304
|
};
|
|
264
305
|
}
|
|
265
306
|
}, a = () => {
|
|
266
|
-
e.value && e.value.addEventListener("mousedown",
|
|
307
|
+
e.value && e.value.addEventListener("mousedown", p);
|
|
267
308
|
}, r = () => {
|
|
268
|
-
e.value && e.value.removeEventListener("mousedown",
|
|
269
|
-
},
|
|
309
|
+
e.value && e.value.removeEventListener("mousedown", p);
|
|
310
|
+
}, p = (v) => {
|
|
270
311
|
if (e.value != null) {
|
|
271
312
|
if (s && s.value) {
|
|
272
313
|
const f = s.value.getBoundingClientRect();
|
|
273
314
|
if (v.clientX < f.left || v.clientX > f.right || v.clientY < f.top || v.clientY > f.bottom) return;
|
|
274
315
|
}
|
|
275
|
-
o.value = !0,
|
|
316
|
+
o.value = !0, i.x = v.clientX, i.y = v.clientY, u(), document.addEventListener("mousemove", c), document.addEventListener("mouseup", h);
|
|
276
317
|
}
|
|
277
318
|
}, c = (v) => {
|
|
278
319
|
if (o.value && n.value && l.value) {
|
|
279
|
-
const f = window.innerWidth, x = window.innerHeight, C = e.value,
|
|
320
|
+
const f = window.innerWidth, x = window.innerHeight, C = e.value, k = C.getBoundingClientRect(), E = k.width, w = k.height, W = n.value.x + (v.clientX - i.x), z = n.value.y + (v.clientY - i.y);
|
|
280
321
|
l.value.x = Math.max(
|
|
281
322
|
t ? t.value.offset.value.left : 0,
|
|
282
|
-
|
|
323
|
+
W
|
|
283
324
|
);
|
|
284
|
-
const
|
|
325
|
+
const g = f - E;
|
|
285
326
|
l.value.x = Math.min(
|
|
286
|
-
t ?
|
|
327
|
+
t ? g - t.value.offset.value.right : g,
|
|
287
328
|
l.value.x
|
|
288
329
|
), l.value.y = Math.max(
|
|
289
330
|
t ? t.value.offset.value.top : 0,
|
|
290
|
-
Math.min(
|
|
331
|
+
Math.min(z, x - w)
|
|
291
332
|
);
|
|
292
|
-
const M = x -
|
|
333
|
+
const M = x - w;
|
|
293
334
|
l.value.y = Math.min(
|
|
294
335
|
t ? M - t.value.offset.value.bottom : M,
|
|
295
336
|
l.value.y
|
|
@@ -298,26 +339,26 @@ function Ve(e, s, t) {
|
|
|
298
339
|
}, h = () => {
|
|
299
340
|
o.value = !1, document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", h);
|
|
300
341
|
};
|
|
301
|
-
return
|
|
302
|
-
e.value && (
|
|
303
|
-
}),
|
|
304
|
-
e.value && e.value.removeEventListener("mousedown",
|
|
342
|
+
return Y(() => {
|
|
343
|
+
e.value && (u(), a());
|
|
344
|
+
}), j(() => {
|
|
345
|
+
e.value && e.value.removeEventListener("mousedown", p);
|
|
305
346
|
}), L(e, (v) => {
|
|
306
|
-
v ? (
|
|
347
|
+
v ? (u(), a()) : r();
|
|
307
348
|
}), {
|
|
308
349
|
isDragging: o,
|
|
309
350
|
movement: d,
|
|
310
351
|
position: l
|
|
311
352
|
};
|
|
312
353
|
}
|
|
313
|
-
function
|
|
314
|
-
const o = m(!1), l = m("left"), { isDragging: n, movement:
|
|
354
|
+
function Ae(e, s, t) {
|
|
355
|
+
const o = m(!1), l = m("left"), { isDragging: n, movement: i, position: d } = Ye(
|
|
315
356
|
e,
|
|
316
357
|
s,
|
|
317
358
|
t
|
|
318
359
|
);
|
|
319
|
-
return L(
|
|
320
|
-
if (
|
|
360
|
+
return L(i, (u) => {
|
|
361
|
+
if (u && e.value) {
|
|
321
362
|
const r = e.value.getBoundingClientRect();
|
|
322
363
|
r.left <= t.value.offset.value.left ? (l.value = "left", o.value = !0) : window.innerWidth - r.left - r.width <= t.value.offset.value.right ? (l.value = "right", o.value = !0) : o.value = !1;
|
|
323
364
|
}
|
|
@@ -325,36 +366,36 @@ function Ye(e, s, t) {
|
|
|
325
366
|
docked: o,
|
|
326
367
|
orientation: l,
|
|
327
368
|
isDragging: n,
|
|
328
|
-
movement:
|
|
369
|
+
movement: i,
|
|
329
370
|
position: d
|
|
330
371
|
};
|
|
331
372
|
}
|
|
332
|
-
function
|
|
333
|
-
const l = m(null), n = m(null),
|
|
334
|
-
return L(e, (
|
|
373
|
+
function He(e, s, t, o) {
|
|
374
|
+
const l = m(null), n = m(null), i = m(null), d = m(null);
|
|
375
|
+
return L(e, (u, a) => {
|
|
335
376
|
l.value = a;
|
|
336
|
-
}), L(s, (
|
|
377
|
+
}), L(s, (u, a) => {
|
|
337
378
|
n.value = a;
|
|
338
|
-
}), L(t, (
|
|
339
|
-
|
|
340
|
-
}), L(o, (
|
|
379
|
+
}), L(t, (u, a) => {
|
|
380
|
+
i.value = a;
|
|
381
|
+
}), L(o, (u, a) => {
|
|
341
382
|
d.value = a;
|
|
342
383
|
}), {
|
|
343
384
|
lastLeft: l,
|
|
344
385
|
lastTop: n,
|
|
345
|
-
lastWidth:
|
|
386
|
+
lastWidth: i,
|
|
346
387
|
lastHeight: d
|
|
347
388
|
};
|
|
348
389
|
}
|
|
349
|
-
function
|
|
350
|
-
const l = m(e.value.width), n = m(e.value.left),
|
|
351
|
-
return L([
|
|
390
|
+
function Oe(e, s, t, o) {
|
|
391
|
+
const l = m(e.value.width), n = m(e.value.left), i = _(() => e.value.width), d = _(() => e.value.left), u = _(() => t.value ? t.value.x : null);
|
|
392
|
+
return L([i, d], ([a, r]) => {
|
|
352
393
|
(l.value == null || n.value == null || s.value) && (l.value = a, n.value = r);
|
|
353
|
-
}), L(
|
|
394
|
+
}), L(u, (a) => {
|
|
354
395
|
o.value && t.value && (n.value = a);
|
|
355
396
|
}), { left: n, width: l };
|
|
356
397
|
}
|
|
357
|
-
function
|
|
398
|
+
function Xe(e, s = m({ left: 0, right: 0, top: 0, bottom: 0 })) {
|
|
358
399
|
const t = m({});
|
|
359
400
|
let o = !1;
|
|
360
401
|
const l = () => {
|
|
@@ -363,7 +404,7 @@ function Oe(e, s = m({ left: 0, right: 0, top: 0, bottom: 0 })) {
|
|
|
363
404
|
t.value.left = Math.max(n.left, s.value.left), t.value.top = Math.max(n.top, s.value.top), t.value.width = n.width, t.value.height = n.height, o = !0;
|
|
364
405
|
}
|
|
365
406
|
};
|
|
366
|
-
return
|
|
407
|
+
return Y(() => {
|
|
367
408
|
e.value && l();
|
|
368
409
|
}), L(e, (n) => {
|
|
369
410
|
n && l();
|
|
@@ -372,145 +413,145 @@ function Oe(e, s = m({ left: 0, right: 0, top: 0, bottom: 0 })) {
|
|
|
372
413
|
initialRect: t
|
|
373
414
|
};
|
|
374
415
|
}
|
|
375
|
-
function
|
|
376
|
-
const { initialRect: n } =
|
|
377
|
-
let d = 0,
|
|
378
|
-
const c = 5, h = m(null), v = (
|
|
416
|
+
function Ne(e, s = m(!1), t = m(!1), o = m({ left: 0, right: 0, top: 0, bottom: 0 }), l = { width: 20, height: 40 }) {
|
|
417
|
+
const { initialRect: n } = Xe(e, o), i = m(!1);
|
|
418
|
+
let d = 0, u = 0, a = 0, r = 0, p = 0;
|
|
419
|
+
const c = 5, h = m(null), v = (E) => {
|
|
379
420
|
if (!(!e.value || s.value))
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
421
|
+
if (i.value) {
|
|
422
|
+
const w = E.clientX - r, W = E.clientY - p;
|
|
382
423
|
if (h.value === "left" || h.value === "left-bottom-corner") {
|
|
383
|
-
const
|
|
384
|
-
|
|
424
|
+
const z = u - w;
|
|
425
|
+
z > l.width && (n.value.width = z, n.value.left = d + w, e.value.style.left = n.value.left + "px", e.value.style.width = n.value.width + "px");
|
|
385
426
|
}
|
|
386
427
|
if (h.value === "right" || h.value === "right-bottom-corner") {
|
|
387
|
-
const
|
|
388
|
-
|
|
428
|
+
const z = u + w;
|
|
429
|
+
z > l.width && (n.value.width = z, e.value.style.width = n.value.width + "px");
|
|
389
430
|
}
|
|
390
431
|
if (h.value === "bottom" || h.value === "left-bottom-corner" || h.value === "right-bottom-corner") {
|
|
391
|
-
const
|
|
392
|
-
|
|
432
|
+
const z = a + W;
|
|
433
|
+
z > l.height && (n.value.height = z, e.value.style.height = n.value.height + "px");
|
|
393
434
|
}
|
|
394
435
|
} else {
|
|
395
|
-
const
|
|
396
|
-
|
|
436
|
+
const w = e.value.getBoundingClientRect(), W = E.clientX - w.left, z = E.clientY - w.top, g = W <= c, M = W >= w.width - c, $ = z >= w.height - c;
|
|
437
|
+
g && $ && t.value ? (e.value.style.cursor = "nesw-resize", h.value = "left-bottom-corner") : M && $ && !t.value ? (e.value.style.cursor = "nwse-resize", h.value = "right-bottom-corner") : g && t.value ? (e.value.style.cursor = "ew-resize", h.value = "left") : M && !t.value ? (e.value.style.cursor = "ew-resize", h.value = "right") : $ ? (e.value.style.cursor = "ns-resize", h.value = "bottom") : (e.value.style.cursor = "", h.value = null);
|
|
397
438
|
}
|
|
398
|
-
}, f = (
|
|
439
|
+
}, f = (E) => {
|
|
399
440
|
if (!e.value || !h.value) return;
|
|
400
|
-
const
|
|
401
|
-
r =
|
|
441
|
+
const w = e.value.getBoundingClientRect();
|
|
442
|
+
r = E.clientX, p = E.clientY, u = w.width, a = w.height, d = w.left, n.value.width = u, n.value.height = a, n.value.left = w.left, n.value.top = w.top, i.value = !0, document.addEventListener("mousemove", v), document.addEventListener("mouseup", x);
|
|
402
443
|
}, x = () => {
|
|
403
|
-
|
|
444
|
+
i.value = !1, h.value = null, e.value && (e.value.style.cursor = ""), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", x);
|
|
404
445
|
}, C = () => {
|
|
405
446
|
e.value && (e.value.removeEventListener("mousedown", f), e.value.removeEventListener("mousemove", v)), document.removeEventListener("mouseup", x);
|
|
406
|
-
},
|
|
447
|
+
}, k = () => {
|
|
407
448
|
e.value && (e.value.addEventListener("mousedown", f), e.value.addEventListener("mousemove", v));
|
|
408
449
|
};
|
|
409
|
-
return
|
|
410
|
-
e.value &&
|
|
411
|
-
}),
|
|
450
|
+
return Y(() => {
|
|
451
|
+
e.value && k();
|
|
452
|
+
}), se(() => {
|
|
412
453
|
C();
|
|
413
|
-
}), L(e, (
|
|
414
|
-
|
|
415
|
-
}), { rect: n, isResizing:
|
|
454
|
+
}), L(e, (E) => {
|
|
455
|
+
E ? k() : C();
|
|
456
|
+
}), { rect: n, isResizing: i };
|
|
416
457
|
}
|
|
417
|
-
function
|
|
458
|
+
function Ue(e, s, t, o) {
|
|
418
459
|
const l = () => {
|
|
419
460
|
if (e.value) {
|
|
420
|
-
const
|
|
421
|
-
s.value ?
|
|
461
|
+
const u = e.value;
|
|
462
|
+
s.value ? u.style.transition = "width 0.3s ease-out, left 0.3s ease-out" : u.style.transition = "width 0.3s ease";
|
|
422
463
|
}
|
|
423
464
|
}, n = () => {
|
|
424
465
|
e.value && (e.value.style.transition = "");
|
|
425
|
-
},
|
|
466
|
+
}, i = () => {
|
|
426
467
|
e.value && e.value.removeEventListener("transitionend", n);
|
|
427
468
|
}, d = () => {
|
|
428
469
|
e.value && e.value.addEventListener("transitionend", n);
|
|
429
470
|
};
|
|
430
|
-
|
|
471
|
+
Y(() => {
|
|
431
472
|
e.value && e.value.addEventListener("transitionend", n);
|
|
432
|
-
}),
|
|
473
|
+
}), se(() => {
|
|
433
474
|
e.value && e.value.removeEventListener("transitionend", n);
|
|
434
|
-
}), L(e, (
|
|
435
|
-
|
|
475
|
+
}), L(e, (u) => {
|
|
476
|
+
u ? d() : i();
|
|
436
477
|
}), L(t, () => {
|
|
437
478
|
l();
|
|
438
479
|
}), L(o, () => {
|
|
439
480
|
l();
|
|
440
481
|
});
|
|
441
482
|
}
|
|
442
|
-
function
|
|
443
|
-
const l = m(window.innerWidth), n = m(window.innerHeight), { docked:
|
|
483
|
+
function Fe(e, s, t, o) {
|
|
484
|
+
const l = m(window.innerWidth), n = m(window.innerHeight), { docked: i, orientation: d, movement: u, position: a, isDragging: r } = Ae(
|
|
444
485
|
e,
|
|
445
486
|
s,
|
|
446
487
|
o
|
|
447
|
-
),
|
|
488
|
+
), p = _(() => d.value === "right"), { rect: c, isResizing: h } = Ne(
|
|
448
489
|
e,
|
|
449
490
|
t,
|
|
450
|
-
|
|
491
|
+
p,
|
|
451
492
|
o.value.offset
|
|
452
|
-
), { width: v, left: f } =
|
|
493
|
+
), { width: v, left: f } = Oe(
|
|
453
494
|
c,
|
|
454
495
|
h,
|
|
455
496
|
a,
|
|
456
497
|
r
|
|
457
|
-
), { lastTop: x, lastHeight: C } =
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
), { autoOpened:
|
|
463
|
-
|
|
464
|
-
const
|
|
498
|
+
), { lastTop: x, lastHeight: C } = He(
|
|
499
|
+
_(() => c.value.left),
|
|
500
|
+
_(() => c.value.top),
|
|
501
|
+
_(() => c.value.width),
|
|
502
|
+
_(() => c.value.height)
|
|
503
|
+
), { autoOpened: k } = Se(e, s, t);
|
|
504
|
+
Ue(e, p, t, k);
|
|
505
|
+
const E = (g) => {
|
|
465
506
|
if (e.value) {
|
|
466
|
-
const M = e.value.getBoundingClientRect(), $ = M.left +
|
|
467
|
-
if (
|
|
507
|
+
const M = e.value.getBoundingClientRect(), $ = M.left + g;
|
|
508
|
+
if (p.value) {
|
|
468
509
|
c.value.left = $;
|
|
469
|
-
const
|
|
470
|
-
M.left <= 0 &&
|
|
510
|
+
const ie = window.innerWidth - M.width - M.left;
|
|
511
|
+
M.left <= 0 && ie >= 0 && g < 0 && (c.value.left = Math.max(0, $)), window.innerWidth - M.width <= 0 && (c.value.left = window.innerWidth - M.width);
|
|
471
512
|
} else
|
|
472
|
-
M.left + M.width >= window.innerWidth &&
|
|
513
|
+
M.left + M.width >= window.innerWidth && g < 0 && (c.value.left = Math.max(0, $));
|
|
473
514
|
}
|
|
474
|
-
},
|
|
475
|
-
const
|
|
476
|
-
l.value = window.innerWidth, n.value = window.innerHeight,
|
|
515
|
+
}, w = () => {
|
|
516
|
+
const g = window.innerWidth - l.value;
|
|
517
|
+
l.value = window.innerWidth, n.value = window.innerHeight, E(g);
|
|
477
518
|
};
|
|
478
|
-
|
|
479
|
-
window.addEventListener("resize",
|
|
480
|
-
}),
|
|
481
|
-
window.removeEventListener("resize",
|
|
519
|
+
Y(() => {
|
|
520
|
+
window.addEventListener("resize", w);
|
|
521
|
+
}), j(() => {
|
|
522
|
+
window.removeEventListener("resize", w);
|
|
482
523
|
});
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
},
|
|
486
|
-
|
|
524
|
+
const W = (g) => {
|
|
525
|
+
g ? (c.value.width = Q, p.value && f.value && v.value && (c.value.left = f.value + v.value - Q)) : (c.value.width = v.value, p.value && f.value && v.value && (c.value.left = f.value));
|
|
526
|
+
}, z = () => {
|
|
527
|
+
i.value ? (c.value.top = o.value.offset.value.top, c.value.height = window.innerHeight - o.value.offset.value.top - o.value.offset.value.bottom) : (c.value.top = x.value, c.value.height = C.value);
|
|
487
528
|
};
|
|
488
|
-
return L(
|
|
489
|
-
|
|
490
|
-
}), L(t, (
|
|
491
|
-
|
|
492
|
-
}), L(
|
|
493
|
-
t.value && !r.value &&
|
|
494
|
-
}), L(
|
|
495
|
-
if (
|
|
529
|
+
return L(i, () => {
|
|
530
|
+
z();
|
|
531
|
+
}), L(t, (g) => {
|
|
532
|
+
W(g);
|
|
533
|
+
}), L(k, (g) => {
|
|
534
|
+
t.value && !r.value && W(!g);
|
|
535
|
+
}), L(u, (g) => {
|
|
536
|
+
if (g && e.value) {
|
|
496
537
|
const $ = e.value.getBoundingClientRect();
|
|
497
538
|
c.value.left = $.left, c.value.top = $.top;
|
|
498
539
|
}
|
|
499
|
-
}), { rect: c, orientation: d, reversed:
|
|
540
|
+
}), { rect: c, orientation: d, reversed: p };
|
|
500
541
|
}
|
|
501
|
-
const
|
|
542
|
+
const Ge = (e) => (te("data-v-11a64c54"), e = e(), ne(), e), je = /* @__PURE__ */ Ge(() => /* @__PURE__ */ B("svg", {
|
|
502
543
|
xmlns: "http://www.w3.org/2000/svg",
|
|
503
544
|
width: "1em",
|
|
504
545
|
height: "1em",
|
|
505
546
|
viewBox: "0 0 1024 1024"
|
|
506
547
|
}, [
|
|
507
|
-
/* @__PURE__ */
|
|
548
|
+
/* @__PURE__ */ B("path", {
|
|
508
549
|
fill: "currentColor",
|
|
509
550
|
d: "M764.288 214.592L512 466.88L259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512L214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
510
551
|
})
|
|
511
|
-
], -1)),
|
|
552
|
+
], -1)), qe = { class: "ml-tool-palette-title" }, Je = { class: "ml-tool-palette-content" }, Ke = /* @__PURE__ */ S({
|
|
512
553
|
__name: "MlToolPalette",
|
|
513
|
-
props: /* @__PURE__ */
|
|
554
|
+
props: /* @__PURE__ */ D({
|
|
514
555
|
title: { default: "" },
|
|
515
556
|
leftOffset: { default: 0 },
|
|
516
557
|
rightOffset: { default: 0 },
|
|
@@ -520,9 +561,9 @@ const Fe = (e) => (R("data-v-11a64c54"), e = e(), ee(), e), Ge = /* @__PURE__ */
|
|
|
520
561
|
modelValue: { default: !0 },
|
|
521
562
|
modelModifiers: {}
|
|
522
563
|
}),
|
|
523
|
-
emits: /* @__PURE__ */
|
|
564
|
+
emits: /* @__PURE__ */ D(["close"], ["update:modelValue"]),
|
|
524
565
|
setup(e, { emit: s }) {
|
|
525
|
-
const t = e, o =
|
|
566
|
+
const t = e, o = U(e, "modelValue"), l = s, n = m(!1), i = m(null), d = m(null), u = _(() => ({
|
|
526
567
|
offset: m({
|
|
527
568
|
left: t.leftOffset,
|
|
528
569
|
right: t.rightOffset,
|
|
@@ -532,13 +573,13 @@ const Fe = (e) => (R("data-v-11a64c54"), e = e(), ee(), e), Ge = /* @__PURE__ */
|
|
|
532
573
|
})), {
|
|
533
574
|
rect: a,
|
|
534
575
|
orientation: r,
|
|
535
|
-
reversed:
|
|
536
|
-
} =
|
|
576
|
+
reversed: p
|
|
577
|
+
} = Fe(d, i, n, u), c = _(() => ({
|
|
537
578
|
left: `${a.value.left}px`,
|
|
538
579
|
top: `${a.value.top}px`,
|
|
539
580
|
width: `${a.value.width}px`,
|
|
540
581
|
height: `${a.value.height}px`
|
|
541
|
-
})), h =
|
|
582
|
+
})), h = _(() => p.value ? {
|
|
542
583
|
borderLeft: "1px solid var(--el-border-color)",
|
|
543
584
|
borderRight: null
|
|
544
585
|
} : {
|
|
@@ -561,52 +602,53 @@ const Fe = (e) => (R("data-v-11a64c54"), e = e(), ee(), e), Ge = /* @__PURE__ */
|
|
|
561
602
|
style: X([c.value]),
|
|
562
603
|
class: "ml-tool-palette-dialog"
|
|
563
604
|
}, [
|
|
564
|
-
|
|
565
|
-
class:
|
|
605
|
+
B("div", {
|
|
606
|
+
class: le(["ml-tool-palette-dialog-layout", q(r)])
|
|
566
607
|
}, [
|
|
567
|
-
|
|
608
|
+
B("div", {
|
|
568
609
|
ref_key: "titleBarElement",
|
|
569
|
-
ref:
|
|
610
|
+
ref: i,
|
|
570
611
|
class: "ml-tool-palette-title-bar",
|
|
571
612
|
style: X(h.value)
|
|
572
613
|
}, [
|
|
573
|
-
|
|
614
|
+
V(C, {
|
|
574
615
|
size: 18,
|
|
575
616
|
class: "ml-tool-palette-dialog-icon",
|
|
576
617
|
onClick: v
|
|
577
618
|
}, {
|
|
578
|
-
default:
|
|
579
|
-
|
|
619
|
+
default: b(() => [
|
|
620
|
+
je
|
|
580
621
|
]),
|
|
581
622
|
_: 1
|
|
582
623
|
}),
|
|
583
|
-
|
|
624
|
+
V(Le, {
|
|
584
625
|
class: "ml-tool-palette-dialog-icon",
|
|
585
626
|
modelValue: n.value,
|
|
586
|
-
"onUpdate:modelValue": x[0] || (x[0] = (
|
|
587
|
-
reverse:
|
|
627
|
+
"onUpdate:modelValue": x[0] || (x[0] = (k) => n.value = k),
|
|
628
|
+
reverse: q(p)
|
|
588
629
|
}, null, 8, ["modelValue", "reverse"]),
|
|
589
|
-
|
|
630
|
+
B("span", qe, G(t.title), 1)
|
|
590
631
|
], 4),
|
|
591
|
-
|
|
632
|
+
B("div", Je, [
|
|
592
633
|
O(f.$slots, "default", {}, void 0, !0)
|
|
593
634
|
])
|
|
594
635
|
], 2)
|
|
595
|
-
], 4)) :
|
|
636
|
+
], 4)) : oe("", !0);
|
|
596
637
|
};
|
|
597
638
|
}
|
|
598
|
-
}),
|
|
639
|
+
}), Qe = /* @__PURE__ */ H(Ke, [["__scopeId", "data-v-11a64c54"]]), ut = {
|
|
599
640
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
600
641
|
install(e) {
|
|
601
|
-
e.component("MlCollapse", N), e.component("MlDropdown", N), e.component("MlLanguage", be), e.component("MlStatusBar",
|
|
642
|
+
e.component("MlCollapse", N), e.component("MlDropdown", N), e.component("MlLanguage", be), e.component("MlStatusBar", $e), e.component("MlToggleButton", We), e.component("MlToolBar", De), e.component("MlToolPalette", Qe);
|
|
602
643
|
}
|
|
603
644
|
};
|
|
604
645
|
export {
|
|
605
646
|
Le as MlCollapse,
|
|
606
647
|
N as MlDropdown,
|
|
607
648
|
be as MlLanguage,
|
|
608
|
-
|
|
649
|
+
$e as MlStatusBar,
|
|
650
|
+
We as MlToggleButton,
|
|
609
651
|
De as MlToolBar,
|
|
610
|
-
|
|
611
|
-
|
|
652
|
+
Qe as MlToolPalette,
|
|
653
|
+
ut as default
|
|
612
654
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ml-dropdown-icon[data-v-3fc33b5d],.ml-dropdown-icon[data-v-3fc33b5d]:hover{outline:none;border:none}.ml-status-bar[data-v-d6a59cf0]{position:fixed;bottom:0;left:0;right:0;height:30px;display:flex;justify-content:space-between;align-items:center;background-color:var(--el-fill-color);box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-status-bar-left[data-v-d6a59cf0],.ml-status-bar-right[data-v-d6a59cf0]{display:flex;align-items:center}.ml-status-bar-left[data-v-d6a59cf0]>*{margin-right:10px}.ml-status-bar-right[data-v-d6a59cf0]>*{margin-left:10px}.ml-vertical-toolbar-button-group[data-v-
|
|
2
|
-
(function(L,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/icon/style/css"),require("vue"),require("element-plus/es/components/dropdown/style/css"),require("element-plus/es/components/dropdown-menu/style/css"),require("element-plus/es/components/dropdown-item/style/css"),require("element-plus/es/components/button-group/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/icon/style/css","vue","element-plus/es/components/dropdown/style/css","element-plus/es/components/dropdown-menu/style/css","element-plus/es/components/dropdown-item/style/css","element-plus/es/components/button-group/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css"],x):(L=typeof globalThis<"u"?globalThis:L||self,x(L.UIComponents={},L.es,null,null,L.Vue))})(this,function(L,x,pe,fe,e){"use strict";const Y={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},A=[e.createElementVNode("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"},null,-1)];function H(t,i){return e.openBlock(),e.createElementBlock("svg",Y,[...A])}const $={render:H},X={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},q=[e.createElementVNode("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"},null,-1)];function U(t,i){return e.openBlock(),e.createElementBlock("svg",X,[...q])}const T={render:U},S=e.defineComponent({__name:"MlCollapse",props:e.mergeModels({size:{default:18},reverse:{type:Boolean,default:!1}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(t,{emit:i}){const n=t,s=e.useModel(t,"modelValue"),l=i,o=e.computed(()=>n.reverse?s.value?$:T:s.value?T:$),c=e.computed(()=>`${n.size}px`),h=()=>{l("change",s.value),s.value=!s.value};return(a,r)=>{const d=x.ElIcon;return e.openBlock(),e.createBlock(d,{size:c.value,onClick:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value)))]),_:1},8,["size"])}}}),F=(t=>(e.pushScopeId("data-v-3fc33b5d"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em","data-v-63d067da":""},[e.createElementVNode("path",{fill:"currentColor",d:"m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"})],-1)),j=e.defineComponent({__name:"MlDropdown",props:{icon:{},items:{},current:{default:void 0}},emits:{click:null},setup(t,{emit:i}){const n=t,s=i,l=e.computed(()=>n.items.filter(c=>c.name!==n.current)),o=c=>{s("click",c)};return(c,h)=>{const a=x.ElIcon,r=x.ElDropdownItem,d=x.ElDropdownMenu,w=x.ElDropdown;return e.openBlock(),e.createBlock(w,{onCommand:o},{dropdown:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,u=>(e.openBlock(),e.createBlock(r,{key:u.text,command:u.name},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.text),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(a,{size:"30",class:"ml-dropdown-icon"},{default:e.withCtx(()=>[F]),_:1})]),_:1})}}}),z=(t,i)=>{const n=t.__vccOpts||t;for(const[s,l]of i)n[s]=l;return n},V=z(j,[["__scopeId","data-v-3fc33b5d"]]),G='<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>',I=e.defineComponent({__name:"MlLanguage",props:{languages:{},current:{}},emits:{click:null},setup(t,{emit:i}){const n=t,s=i,l=o=>{s("click",o)};return(o,c)=>(e.openBlock(),e.createBlock(V,{icon:G,items:n.languages,current:n.current,onClick:l},null,8,["items","current"]))}}),J={},K={class:"ml-status-bar"},Q={class:"ml-status-bar-left"},Z={class:"ml-status-bar-right"};function P(t,i){return e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Q,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),e.createElementVNode("div",Z,[e.renderSlot(t.$slots,"right",{},void 0,!0)])])}const N=z(J,[["render",P],["__scopeId","data-v-d6a59cf0"]]),R={key:0,class:"ml-toolbar-button-text"},W=z(e.defineComponent({__name:"MlToolBar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(t,{emit:i}){const n=t,s=i,l=e.computed(()=>n.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),o=e.computed(()=>n.size==="small"?20:30),c=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),h=d=>d.description?d.description:d.text,a=e.computed(()=>n.size==="large"),r=d=>{s("click",d)};return(d,w)=>{const u=x.ElIcon,p=x.ElButton,m=x.ElTooltip,f=x.ElButtonGroup;return e.openBlock(),e.createBlock(f,{class:e.normalizeClass(l.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(g,M)=>(e.openBlock(),e.createBlock(m,{key:g.text,content:h(g),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(p,{class:"ml-toolbar-button",style:e.normalizeStyle({width:c.value+"px",height:c.value+"px"}),key:M,onClick:k=>r(g.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(u,{size:o.value},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.icon)))]),_:2},1032,["size"]),a.value?(e.openBlock(),e.createElementBlock("div",R,e.toDisplayString(g.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-d5511111"]]),D=20;function ee(t,i,n){const s=e.ref(!1),l=a=>{if(n.value&&t.value){const r=t.value.getBoundingClientRect(),d=a.clientX<r.left||a.clientX>r.right||a.clientY<r.top||a.clientY>r.bottom;s.value=!d}},o=()=>{n.value&&(s.value=!0)},c=()=>{i.value&&i.value.addEventListener("mousemove",o),t.value&&t.value.addEventListener("mousemove",o)},h=()=>{i.value&&i.value.removeEventListener("mousemove",o),t.value&&t.value.removeEventListener("mousemove",o)};return e.onMounted(()=>{window.addEventListener("mousemove",l)}),e.onUnmounted(()=>{window.removeEventListener("mousemove",l)}),e.watch(n,a=>{a&&(s.value=!1)}),e.watch(t,a=>{a?c():h()}),{autoOpened:s}}function te(t,i,n){const s=e.ref(!1),l=e.ref(null),o=e.ref(null),c={x:0,y:0},h=e.computed(()=>l.value==null||o.value==null?{x:0,y:0}:{x:l.value.x-o.value.x,y:l.value.y-o.value.y}),a=()=>{if(t.value){const m=t.value.getBoundingClientRect();o.value={x:m.left,y:m.top},l.value={x:m.left,y:m.top}}},r=()=>{t.value&&t.value.addEventListener("mousedown",w)},d=()=>{t.value&&t.value.removeEventListener("mousedown",w)},w=m=>{if(t.value!=null){if(i&&i.value){const f=i.value.getBoundingClientRect();if(m.clientX<f.left||m.clientX>f.right||m.clientY<f.top||m.clientY>f.bottom)return}s.value=!0,c.x=m.clientX,c.y=m.clientY,a(),document.addEventListener("mousemove",u),document.addEventListener("mouseup",p)}},u=m=>{if(s.value&&o.value&&l.value){const f=window.innerWidth,g=window.innerHeight,M=t.value,k=M.getBoundingClientRect(),E=k.width,v=k.height,b=o.value.x+(m.clientX-c.x),B=o.value.y+(m.clientY-c.y);l.value.x=Math.max(n?n.value.offset.value.left:0,b);const _=f-E;l.value.x=Math.min(n?_-n.value.offset.value.right:_,l.value.x),l.value.y=Math.max(n?n.value.offset.value.top:0,Math.min(B,g-v));const y=g-v;l.value.y=Math.min(n?y-n.value.offset.value.bottom:y,l.value.y),M.style.left=l.value.x+"px",M.style.top=l.value.y+"px"}},p=()=>{s.value=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};return e.onMounted(()=>{t.value&&(a(),r())}),e.onUnmounted(()=>{t.value&&t.value.removeEventListener("mousedown",w)}),e.watch(t,m=>{m?(a(),r()):d()}),{isDragging:s,movement:h,position:l}}function ne(t,i,n){const s=e.ref(!1),l=e.ref("left"),{isDragging:o,movement:c,position:h}=te(t,i,n);return e.watch(c,a=>{if(a&&t.value){const d=t.value.getBoundingClientRect();d.left<=n.value.offset.value.left?(l.value="left",s.value=!0):window.innerWidth-d.left-d.width<=n.value.offset.value.right?(l.value="right",s.value=!0):s.value=!1}}),{docked:s,orientation:l,isDragging:o,movement:c,position:h}}function oe(t,i,n,s){const l=e.ref(null),o=e.ref(null),c=e.ref(null),h=e.ref(null);return e.watch(t,(a,r)=>{l.value=r}),e.watch(i,(a,r)=>{o.value=r}),e.watch(n,(a,r)=>{c.value=r}),e.watch(s,(a,r)=>{h.value=r}),{lastLeft:l,lastTop:o,lastWidth:c,lastHeight:h}}function le(t,i,n,s){const l=e.ref(t.value.width),o=e.ref(t.value.left),c=e.computed(()=>t.value.width),h=e.computed(()=>t.value.left),a=e.computed(()=>n.value?n.value.x:null);return e.watch([c,h],([r,d])=>{(l.value==null||o.value==null||i.value)&&(l.value=r,o.value=d)}),e.watch(a,r=>{s.value&&n.value&&(o.value=r)}),{left:o,width:l}}function se(t,i=e.ref({left:0,right:0,top:0,bottom:0})){const n=e.ref({});let s=!1;const l=()=>{if(!s&&t.value){const o=t.value.getBoundingClientRect();n.value.left=Math.max(o.left,i.value.left),n.value.top=Math.max(o.top,i.value.top),n.value.width=o.width,n.value.height=o.height,s=!0}};return e.onMounted(()=>{t.value&&l()}),e.watch(t,o=>{o&&l()}),{isIntialized:s,initialRect:n}}function ie(t,i=e.ref(!1),n=e.ref(!1),s=e.ref({left:0,right:0,top:0,bottom:0}),l={width:20,height:40}){const{initialRect:o}=se(t,s),c=e.ref(!1);let h=0,a=0,r=0,d=0,w=0;const u=5,p=e.ref(null),m=E=>{if(!(!t.value||i.value))if(c.value){const v=E.clientX-d,b=E.clientY-w;if(p.value==="left"||p.value==="left-bottom-corner"){const B=a-v;B>l.width&&(o.value.width=B,o.value.left=h+v,t.value.style.left=o.value.left+"px",t.value.style.width=o.value.width+"px")}if(p.value==="right"||p.value==="right-bottom-corner"){const B=a+v;B>l.width&&(o.value.width=B,t.value.style.width=o.value.width+"px")}if(p.value==="bottom"||p.value==="left-bottom-corner"||p.value==="right-bottom-corner"){const B=r+b;B>l.height&&(o.value.height=B,t.value.style.height=o.value.height+"px")}}else{const v=t.value.getBoundingClientRect(),b=E.clientX-v.left,B=E.clientY-v.top,_=b<=u,y=b>=v.width-u,C=B>=v.height-u;_&&C&&n.value?(t.value.style.cursor="nesw-resize",p.value="left-bottom-corner"):y&&C&&!n.value?(t.value.style.cursor="nwse-resize",p.value="right-bottom-corner"):_&&n.value?(t.value.style.cursor="ew-resize",p.value="left"):y&&!n.value?(t.value.style.cursor="ew-resize",p.value="right"):C?(t.value.style.cursor="ns-resize",p.value="bottom"):(t.value.style.cursor="",p.value=null)}},f=E=>{if(!t.value||!p.value)return;const v=t.value.getBoundingClientRect();d=E.clientX,w=E.clientY,a=v.width,r=v.height,h=v.left,o.value.width=a,o.value.height=r,o.value.left=v.left,o.value.top=v.top,c.value=!0,document.addEventListener("mousemove",m),document.addEventListener("mouseup",g)},g=()=>{c.value=!1,p.value=null,t.value&&(t.value.style.cursor=""),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g)},M=()=>{t.value&&(t.value.removeEventListener("mousedown",f),t.value.removeEventListener("mousemove",m)),document.removeEventListener("mouseup",g)},k=()=>{t.value&&(t.value.addEventListener("mousedown",f),t.value.addEventListener("mousemove",m))};return e.onMounted(()=>{t.value&&k()}),e.onBeforeUnmount(()=>{M()}),e.watch(t,E=>{E?k():M()}),{rect:o,isResizing:c}}function ae(t,i,n,s){const l=()=>{if(t.value){const a=t.value;i.value?a.style.transition="width 0.3s ease-out, left 0.3s ease-out":a.style.transition="width 0.3s ease"}},o=()=>{t.value&&(t.value.style.transition="")},c=()=>{t.value&&t.value.removeEventListener("transitionend",o)},h=()=>{t.value&&t.value.addEventListener("transitionend",o)};e.onMounted(()=>{t.value&&t.value.addEventListener("transitionend",o)}),e.onBeforeUnmount(()=>{t.value&&t.value.removeEventListener("transitionend",o)}),e.watch(t,a=>{a?h():c()}),e.watch(n,()=>{l()}),e.watch(s,()=>{l()})}function ce(t,i,n,s){const l=e.ref(window.innerWidth),o=e.ref(window.innerHeight),{docked:c,orientation:h,movement:a,position:r,isDragging:d}=ne(t,i,s),w=e.computed(()=>h.value==="right"),{rect:u,isResizing:p}=ie(t,n,w,s.value.offset),{width:m,left:f}=le(u,p,r,d),{lastTop:g,lastHeight:M}=oe(e.computed(()=>u.value.left),e.computed(()=>u.value.top),e.computed(()=>u.value.width),e.computed(()=>u.value.height)),{autoOpened:k}=ee(t,i,n);ae(t,w,n,k);const E=_=>{if(t.value){const y=t.value.getBoundingClientRect(),C=y.left+_;if(w.value){u.value.left=C;const he=window.innerWidth-y.width-y.left;y.left<=0&&he>=0&&_<0&&(u.value.left=Math.max(0,C)),window.innerWidth-y.width<=0&&(u.value.left=window.innerWidth-y.width)}else y.left+y.width>=window.innerWidth&&_<0&&(u.value.left=Math.max(0,C))}},v=()=>{const _=window.innerWidth-l.value;l.value=window.innerWidth,o.value=window.innerHeight,E(_)};e.onMounted(()=>{window.addEventListener("resize",v)}),e.onUnmounted(()=>{window.removeEventListener("resize",v)});const b=_=>{_?(u.value.width=D,w.value&&f.value&&m.value&&(u.value.left=f.value+m.value-D)):(u.value.width=m.value,w.value&&f.value&&m.value&&(u.value.left=f.value))},B=()=>{c.value?(u.value.top=s.value.offset.value.top,u.value.height=window.innerHeight-s.value.offset.value.top-s.value.offset.value.bottom):(u.value.top=g.value,u.value.height=M.value)};return e.watch(c,()=>{B()}),e.watch(n,_=>{b(_)}),e.watch(k,_=>{n.value&&!d.value&&b(!_)}),e.watch(a,_=>{if(_&&t.value){const C=t.value.getBoundingClientRect();u.value.left=C.left,u.value.top=C.top}}),{rect:u,orientation:h,reversed:w}}const re=(t=>(e.pushScopeId("data-v-11a64c54"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592L512 466.88L259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512L214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})],-1)),ue={class:"ml-tool-palette-title"},de={class:"ml-tool-palette-content"},O=z(e.defineComponent({__name:"MlToolPalette",props:e.mergeModels({title:{default:""},leftOffset:{default:0},rightOffset:{default:0},topOffset:{default:0},bottomOffset:{default:0}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["close"],["update:modelValue"]),setup(t,{emit:i}){const n=t,s=e.useModel(t,"modelValue"),l=i,o=e.ref(!1),c=e.ref(null),h=e.ref(null),a=e.computed(()=>({offset:e.ref({left:n.leftOffset,right:n.rightOffset,top:n.topOffset,bottom:n.bottomOffset})})),{rect:r,orientation:d,reversed:w}=ce(h,c,o,a),u=e.computed(()=>({left:`${r.value.left}px`,top:`${r.value.top}px`,width:`${r.value.width}px`,height:`${r.value.height}px`})),p=e.computed(()=>w.value?{borderLeft:"1px solid var(--el-border-color)",borderRight:null}:{borderLeft:null,borderRight:"1px solid var(--el-border-color)"}),m=()=>{s.value=!1;const f=h.value;l("close",{x:f?f.clientLeft:0,y:f?f.clientTop:0})};return(f,g)=>{const M=x.ElIcon;return s.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"toolPaletteElement",ref:h,style:e.normalizeStyle([u.value]),class:"ml-tool-palette-dialog"},[e.createElementVNode("div",{class:e.normalizeClass(["ml-tool-palette-dialog-layout",e.unref(d)])},[e.createElementVNode("div",{ref_key:"titleBarElement",ref:c,class:"ml-tool-palette-title-bar",style:e.normalizeStyle(p.value)},[e.createVNode(M,{size:18,class:"ml-tool-palette-dialog-icon",onClick:m},{default:e.withCtx(()=>[re]),_:1}),e.createVNode(S,{class:"ml-tool-palette-dialog-icon",modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=k=>o.value=k),reverse:e.unref(w)},null,8,["modelValue","reverse"]),e.createElementVNode("span",ue,e.toDisplayString(n.title),1)],4),e.createElementVNode("div",de,[e.renderSlot(f.$slots,"default",{},void 0,!0)])],2)],4)):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-11a64c54"]]),me={install(t){t.component("MlCollapse",V),t.component("MlDropdown",V),t.component("MlLanguage",I),t.component("MlStatusBar",N),t.component("MlToolBar",W),t.component("MlToolPalette",O)}};L.MlCollapse=S,L.MlDropdown=V,L.MlLanguage=I,L.MlStatusBar=N,L.MlToolBar=W,L.MlToolPalette=O,L.default=me,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ml-dropdown-icon[data-v-3fc33b5d],.ml-dropdown-icon[data-v-3fc33b5d]:hover{outline:none;border:none}.ml-status-bar[data-v-d6a59cf0]{position:fixed;bottom:0;left:0;right:0;height:30px;display:flex;justify-content:space-between;align-items:center;background-color:var(--el-fill-color);box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-status-bar-left[data-v-d6a59cf0],.ml-status-bar-right[data-v-d6a59cf0]{display:flex;align-items:center}.ml-status-bar-left[data-v-d6a59cf0]>*{margin-right:10px}.ml-status-bar-right[data-v-d6a59cf0]>*{margin-left:10px}.ml-vertical-toolbar-button-group[data-v-3eed2087]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-3eed2087]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-3eed2087]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-3eed2087]{margin-left:0;margin-top:5px}.ml-tool-palette-dialog[data-v-11a64c54]{cursor:default;width:300px;min-width:var(--collapsed-width);position:fixed;box-sizing:border-box;border:1px solid var(--el-border-color)}.ml-tool-palette-dialog-icon[data-v-11a64c54]{border-bottom:1px solid var(--el-border-color)}.ml-tool-palette-dialog-layout[data-v-11a64c54]{display:flex;height:100%}.ml-tool-palette-title-bar[data-v-11a64c54]{width:var(--collapsed-width);display:flex;justify-content:left;align-items:center;cursor:move;writing-mode:vertical-rl;text-align:center;background-color:var(--el-fill-color)}.ml-tool-palette-title[data-v-11a64c54]{pointer-events:none;margin-top:10px;margin-bottom:10px;font-size:small;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ml-tool-palette-content[data-v-11a64c54]{-webkit-user-select:none;user-select:none;flex-grow:1;display:flex;justify-content:space-around;background-color:var(--el-fill-color);overflow:hidden}.ml-tool-palette-dialog-layout.left .ml-tool-palette-title-bar[data-v-11a64c54]{order:1}.ml-tool-palette-dialog-layout.left .ml-tool-palette-content[data-v-11a64c54],.ml-tool-palette-dialog-layout.right .ml-tool-palette-title-bar[data-v-11a64c54]{order:2}.ml-tool-palette-dialog-layout.right .ml-tool-palette-content[data-v-11a64c54]{order:1}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
(function(B,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/icon/style/css"),require("vue"),require("element-plus/es/components/dropdown/style/css"),require("element-plus/es/components/dropdown-menu/style/css"),require("element-plus/es/components/dropdown-item/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/button-group/style/css")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/icon/style/css","vue","element-plus/es/components/dropdown/style/css","element-plus/es/components/dropdown-menu/style/css","element-plus/es/components/dropdown-item/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css","element-plus/es/components/button-group/style/css"],y):(B=typeof globalThis<"u"?globalThis:B||self,y(B.UIComponents={},B.es,null,null,B.Vue))})(this,function(B,y,fe,ve,e){"use strict";const A={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},H=[e.createElementVNode("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"},null,-1)];function X(t,i){return e.openBlock(),e.createElementBlock("svg",A,[...H])}const T={render:X},q={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},U=[e.createElementVNode("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"},null,-1)];function F(t,i){return e.openBlock(),e.createElementBlock("svg",q,[...U])}const $={render:F},I=e.defineComponent({__name:"MlCollapse",props:e.mergeModels({size:{default:18},reverse:{type:Boolean,default:!1}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(t,{emit:i}){const o=t,s=e.useModel(t,"modelValue"),l=i,n=e.computed(()=>o.reverse?s.value?T:$:s.value?$:T),c=e.computed(()=>`${o.size}px`),h=()=>{l("change",s.value),s.value=!s.value};return(a,r)=>{const d=y.ElIcon;return e.openBlock(),e.createBlock(d,{size:c.value,onClick:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value)))]),_:1},8,["size"])}}}),j=(t=>(e.pushScopeId("data-v-3fc33b5d"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em","data-v-63d067da":""},[e.createElementVNode("path",{fill:"currentColor",d:"m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"})],-1)),G=e.defineComponent({__name:"MlDropdown",props:{icon:{},items:{},current:{default:void 0}},emits:{click:null},setup(t,{emit:i}){const o=t,s=i,l=e.computed(()=>o.items.filter(c=>c.name!==o.current)),n=c=>{s("click",c)};return(c,h)=>{const a=y.ElIcon,r=y.ElDropdownItem,d=y.ElDropdownMenu,v=y.ElDropdown;return e.openBlock(),e.createBlock(v,{onCommand:n},{dropdown:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,u=>(e.openBlock(),e.createBlock(r,{key:u.text,command:u.name},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.text),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(a,{size:"30",class:"ml-dropdown-icon"},{default:e.withCtx(()=>[j]),_:1})]),_:1})}}}),z=(t,i)=>{const o=t.__vccOpts||t;for(const[s,l]of i)o[s]=l;return o},V=z(G,[["__scopeId","data-v-3fc33b5d"]]),J='<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>',S=e.defineComponent({__name:"MlLanguage",props:{languages:{},current:{}},emits:{click:null},setup(t,{emit:i}){const o=t,s=i,l=n=>{s("click",n)};return(n,c)=>(e.openBlock(),e.createBlock(V,{icon:J,items:o.languages,current:o.current,onClick:l},null,8,["items","current"]))}}),K={},Q={class:"ml-status-bar"},Z={class:"ml-status-bar-left"},P={class:"ml-status-bar-right"};function R(t,i){return e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",Z,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),e.createElementVNode("div",P,[e.renderSlot(t.$slots,"right",{},void 0,!0)])])}const N=z(K,[["render",R],["__scopeId","data-v-d6a59cf0"]]),D=e.defineComponent({__name:"MlToggleButton",props:e.mergeModels({size:{default:"default"},type:{},data:{}},{modelValue:{default:!1},modelModifiers:{}}),emits:e.mergeModels(["click"],["update:modelValue"]),setup(t,{emit:i}){const o=t,s=e.useModel(t,"modelValue"),l=i,n=e.computed(()=>s.value?o.data.onIcon:o.data.offIcon),c=e.computed(()=>s.value?o.data.onTooltip:o.data.offTooltip),h=()=>{s.value=!s.value,l("click",s.value)};return(a,r)=>{const d=y.ElIcon,v=y.ElButton,u=y.ElTooltip;return e.openBlock(),e.createBlock(u,{content:c.value,"hide-after":0},{default:e.withCtx(()=>[e.createVNode(v,{type:o.type,size:o.size},{default:e.withCtx(()=>[e.createVNode(d,{onClick:h},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value)))]),_:1})]),_:1},8,["type","size"])]),_:1},8,["content"])}}}),ee={key:0,class:"ml-toolbar-button-text"},W=z(e.defineComponent({__name:"MlToolBar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(t,{emit:i}){const o=t,s=i,l=e.computed(()=>o.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),n=e.computed(()=>o.size==="small"?20:30),c=e.computed(()=>{switch(o.size){case"small":return 30;case"medium":return 50}return 70}),h=d=>d.description?d.description:d.text,a=e.computed(()=>o.size==="large"),r=d=>{s("click",d)};return(d,v)=>{const u=y.ElIcon,p=y.ElButton,m=y.ElTooltip,f=y.ElButtonGroup;return e.openBlock(),e.createBlock(f,{class:e.normalizeClass(l.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(g,E)=>(e.openBlock(),e.createBlock(m,{key:g.text,content:h(g),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(p,{class:"ml-toolbar-button",style:e.normalizeStyle({width:c.value+"px",height:c.value+"px"}),key:E,onClick:k=>r(g.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(u,{size:n.value},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.icon)))]),_:2},1032,["size"]),a.value?(e.openBlock(),e.createElementBlock("div",ee,e.toDisplayString(g.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-3eed2087"]]),O=20;function te(t,i,o){const s=e.ref(!1),l=a=>{if(o.value&&t.value){const r=t.value.getBoundingClientRect(),d=a.clientX<r.left||a.clientX>r.right||a.clientY<r.top||a.clientY>r.bottom;s.value=!d}},n=()=>{o.value&&(s.value=!0)},c=()=>{i.value&&i.value.addEventListener("mousemove",n),t.value&&t.value.addEventListener("mousemove",n)},h=()=>{i.value&&i.value.removeEventListener("mousemove",n),t.value&&t.value.removeEventListener("mousemove",n)};return e.onMounted(()=>{window.addEventListener("mousemove",l)}),e.onUnmounted(()=>{window.removeEventListener("mousemove",l)}),e.watch(o,a=>{a&&(s.value=!1)}),e.watch(t,a=>{a?c():h()}),{autoOpened:s}}function oe(t,i,o){const s=e.ref(!1),l=e.ref(null),n=e.ref(null),c={x:0,y:0},h=e.computed(()=>l.value==null||n.value==null?{x:0,y:0}:{x:l.value.x-n.value.x,y:l.value.y-n.value.y}),a=()=>{if(t.value){const m=t.value.getBoundingClientRect();n.value={x:m.left,y:m.top},l.value={x:m.left,y:m.top}}},r=()=>{t.value&&t.value.addEventListener("mousedown",v)},d=()=>{t.value&&t.value.removeEventListener("mousedown",v)},v=m=>{if(t.value!=null){if(i&&i.value){const f=i.value.getBoundingClientRect();if(m.clientX<f.left||m.clientX>f.right||m.clientY<f.top||m.clientY>f.bottom)return}s.value=!0,c.x=m.clientX,c.y=m.clientY,a(),document.addEventListener("mousemove",u),document.addEventListener("mouseup",p)}},u=m=>{if(s.value&&n.value&&l.value){const f=window.innerWidth,g=window.innerHeight,E=t.value,k=E.getBoundingClientRect(),M=k.width,w=k.height,b=n.value.x+(m.clientX-c.x),x=n.value.y+(m.clientY-c.y);l.value.x=Math.max(o?o.value.offset.value.left:0,b);const _=f-M;l.value.x=Math.min(o?_-o.value.offset.value.right:_,l.value.x),l.value.y=Math.max(o?o.value.offset.value.top:0,Math.min(x,g-w));const L=g-w;l.value.y=Math.min(o?L-o.value.offset.value.bottom:L,l.value.y),E.style.left=l.value.x+"px",E.style.top=l.value.y+"px"}},p=()=>{s.value=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",p)};return e.onMounted(()=>{t.value&&(a(),r())}),e.onUnmounted(()=>{t.value&&t.value.removeEventListener("mousedown",v)}),e.watch(t,m=>{m?(a(),r()):d()}),{isDragging:s,movement:h,position:l}}function ne(t,i,o){const s=e.ref(!1),l=e.ref("left"),{isDragging:n,movement:c,position:h}=oe(t,i,o);return e.watch(c,a=>{if(a&&t.value){const d=t.value.getBoundingClientRect();d.left<=o.value.offset.value.left?(l.value="left",s.value=!0):window.innerWidth-d.left-d.width<=o.value.offset.value.right?(l.value="right",s.value=!0):s.value=!1}}),{docked:s,orientation:l,isDragging:n,movement:c,position:h}}function le(t,i,o,s){const l=e.ref(null),n=e.ref(null),c=e.ref(null),h=e.ref(null);return e.watch(t,(a,r)=>{l.value=r}),e.watch(i,(a,r)=>{n.value=r}),e.watch(o,(a,r)=>{c.value=r}),e.watch(s,(a,r)=>{h.value=r}),{lastLeft:l,lastTop:n,lastWidth:c,lastHeight:h}}function se(t,i,o,s){const l=e.ref(t.value.width),n=e.ref(t.value.left),c=e.computed(()=>t.value.width),h=e.computed(()=>t.value.left),a=e.computed(()=>o.value?o.value.x:null);return e.watch([c,h],([r,d])=>{(l.value==null||n.value==null||i.value)&&(l.value=r,n.value=d)}),e.watch(a,r=>{s.value&&o.value&&(n.value=r)}),{left:n,width:l}}function ie(t,i=e.ref({left:0,right:0,top:0,bottom:0})){const o=e.ref({});let s=!1;const l=()=>{if(!s&&t.value){const n=t.value.getBoundingClientRect();o.value.left=Math.max(n.left,i.value.left),o.value.top=Math.max(n.top,i.value.top),o.value.width=n.width,o.value.height=n.height,s=!0}};return e.onMounted(()=>{t.value&&l()}),e.watch(t,n=>{n&&l()}),{isIntialized:s,initialRect:o}}function ce(t,i=e.ref(!1),o=e.ref(!1),s=e.ref({left:0,right:0,top:0,bottom:0}),l={width:20,height:40}){const{initialRect:n}=ie(t,s),c=e.ref(!1);let h=0,a=0,r=0,d=0,v=0;const u=5,p=e.ref(null),m=M=>{if(!(!t.value||i.value))if(c.value){const w=M.clientX-d,b=M.clientY-v;if(p.value==="left"||p.value==="left-bottom-corner"){const x=a-w;x>l.width&&(n.value.width=x,n.value.left=h+w,t.value.style.left=n.value.left+"px",t.value.style.width=n.value.width+"px")}if(p.value==="right"||p.value==="right-bottom-corner"){const x=a+w;x>l.width&&(n.value.width=x,t.value.style.width=n.value.width+"px")}if(p.value==="bottom"||p.value==="left-bottom-corner"||p.value==="right-bottom-corner"){const x=r+b;x>l.height&&(n.value.height=x,t.value.style.height=n.value.height+"px")}}else{const w=t.value.getBoundingClientRect(),b=M.clientX-w.left,x=M.clientY-w.top,_=b<=u,L=b>=w.width-u,C=x>=w.height-u;_&&C&&o.value?(t.value.style.cursor="nesw-resize",p.value="left-bottom-corner"):L&&C&&!o.value?(t.value.style.cursor="nwse-resize",p.value="right-bottom-corner"):_&&o.value?(t.value.style.cursor="ew-resize",p.value="left"):L&&!o.value?(t.value.style.cursor="ew-resize",p.value="right"):C?(t.value.style.cursor="ns-resize",p.value="bottom"):(t.value.style.cursor="",p.value=null)}},f=M=>{if(!t.value||!p.value)return;const w=t.value.getBoundingClientRect();d=M.clientX,v=M.clientY,a=w.width,r=w.height,h=w.left,n.value.width=a,n.value.height=r,n.value.left=w.left,n.value.top=w.top,c.value=!0,document.addEventListener("mousemove",m),document.addEventListener("mouseup",g)},g=()=>{c.value=!1,p.value=null,t.value&&(t.value.style.cursor=""),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g)},E=()=>{t.value&&(t.value.removeEventListener("mousedown",f),t.value.removeEventListener("mousemove",m)),document.removeEventListener("mouseup",g)},k=()=>{t.value&&(t.value.addEventListener("mousedown",f),t.value.addEventListener("mousemove",m))};return e.onMounted(()=>{t.value&&k()}),e.onBeforeUnmount(()=>{E()}),e.watch(t,M=>{M?k():E()}),{rect:n,isResizing:c}}function ae(t,i,o,s){const l=()=>{if(t.value){const a=t.value;i.value?a.style.transition="width 0.3s ease-out, left 0.3s ease-out":a.style.transition="width 0.3s ease"}},n=()=>{t.value&&(t.value.style.transition="")},c=()=>{t.value&&t.value.removeEventListener("transitionend",n)},h=()=>{t.value&&t.value.addEventListener("transitionend",n)};e.onMounted(()=>{t.value&&t.value.addEventListener("transitionend",n)}),e.onBeforeUnmount(()=>{t.value&&t.value.removeEventListener("transitionend",n)}),e.watch(t,a=>{a?h():c()}),e.watch(o,()=>{l()}),e.watch(s,()=>{l()})}function re(t,i,o,s){const l=e.ref(window.innerWidth),n=e.ref(window.innerHeight),{docked:c,orientation:h,movement:a,position:r,isDragging:d}=ne(t,i,s),v=e.computed(()=>h.value==="right"),{rect:u,isResizing:p}=ce(t,o,v,s.value.offset),{width:m,left:f}=se(u,p,r,d),{lastTop:g,lastHeight:E}=le(e.computed(()=>u.value.left),e.computed(()=>u.value.top),e.computed(()=>u.value.width),e.computed(()=>u.value.height)),{autoOpened:k}=te(t,i,o);ae(t,v,o,k);const M=_=>{if(t.value){const L=t.value.getBoundingClientRect(),C=L.left+_;if(v.value){u.value.left=C;const pe=window.innerWidth-L.width-L.left;L.left<=0&&pe>=0&&_<0&&(u.value.left=Math.max(0,C)),window.innerWidth-L.width<=0&&(u.value.left=window.innerWidth-L.width)}else L.left+L.width>=window.innerWidth&&_<0&&(u.value.left=Math.max(0,C))}},w=()=>{const _=window.innerWidth-l.value;l.value=window.innerWidth,n.value=window.innerHeight,M(_)};e.onMounted(()=>{window.addEventListener("resize",w)}),e.onUnmounted(()=>{window.removeEventListener("resize",w)});const b=_=>{_?(u.value.width=O,v.value&&f.value&&m.value&&(u.value.left=f.value+m.value-O)):(u.value.width=m.value,v.value&&f.value&&m.value&&(u.value.left=f.value))},x=()=>{c.value?(u.value.top=s.value.offset.value.top,u.value.height=window.innerHeight-s.value.offset.value.top-s.value.offset.value.bottom):(u.value.top=g.value,u.value.height=E.value)};return e.watch(c,()=>{x()}),e.watch(o,_=>{b(_)}),e.watch(k,_=>{o.value&&!d.value&&b(!_)}),e.watch(a,_=>{if(_&&t.value){const C=t.value.getBoundingClientRect();u.value.left=C.left,u.value.top=C.top}}),{rect:u,orientation:h,reversed:v}}const ue=(t=>(e.pushScopeId("data-v-11a64c54"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592L512 466.88L259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512L214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})],-1)),de={class:"ml-tool-palette-title"},me={class:"ml-tool-palette-content"},Y=z(e.defineComponent({__name:"MlToolPalette",props:e.mergeModels({title:{default:""},leftOffset:{default:0},rightOffset:{default:0},topOffset:{default:0},bottomOffset:{default:0}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["close"],["update:modelValue"]),setup(t,{emit:i}){const o=t,s=e.useModel(t,"modelValue"),l=i,n=e.ref(!1),c=e.ref(null),h=e.ref(null),a=e.computed(()=>({offset:e.ref({left:o.leftOffset,right:o.rightOffset,top:o.topOffset,bottom:o.bottomOffset})})),{rect:r,orientation:d,reversed:v}=re(h,c,n,a),u=e.computed(()=>({left:`${r.value.left}px`,top:`${r.value.top}px`,width:`${r.value.width}px`,height:`${r.value.height}px`})),p=e.computed(()=>v.value?{borderLeft:"1px solid var(--el-border-color)",borderRight:null}:{borderLeft:null,borderRight:"1px solid var(--el-border-color)"}),m=()=>{s.value=!1;const f=h.value;l("close",{x:f?f.clientLeft:0,y:f?f.clientTop:0})};return(f,g)=>{const E=y.ElIcon;return s.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"toolPaletteElement",ref:h,style:e.normalizeStyle([u.value]),class:"ml-tool-palette-dialog"},[e.createElementVNode("div",{class:e.normalizeClass(["ml-tool-palette-dialog-layout",e.unref(d)])},[e.createElementVNode("div",{ref_key:"titleBarElement",ref:c,class:"ml-tool-palette-title-bar",style:e.normalizeStyle(p.value)},[e.createVNode(E,{size:18,class:"ml-tool-palette-dialog-icon",onClick:m},{default:e.withCtx(()=>[ue]),_:1}),e.createVNode(I,{class:"ml-tool-palette-dialog-icon",modelValue:n.value,"onUpdate:modelValue":g[0]||(g[0]=k=>n.value=k),reverse:e.unref(v)},null,8,["modelValue","reverse"]),e.createElementVNode("span",de,e.toDisplayString(o.title),1)],4),e.createElementVNode("div",me,[e.renderSlot(f.$slots,"default",{},void 0,!0)])],2)],4)):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-11a64c54"]]),he={install(t){t.component("MlCollapse",V),t.component("MlDropdown",V),t.component("MlLanguage",S),t.component("MlStatusBar",N),t.component("MlToggleButton",D),t.component("MlToolBar",W),t.component("MlToolPalette",Y)}};B.MlCollapse=I,B.MlDropdown=V,B.MlLanguage=S,B.MlStatusBar=N,B.MlToggleButton=D,B.MlToolBar=W,B.MlToolPalette=Y,B.default=he,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/lib/index.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import MlCollapse from './components/MlCollapse.vue';
|
|
|
2
2
|
import MlDropdown from './components/MlDropdown.vue';
|
|
3
3
|
import MlLanguage from './components/MlLanguage.vue';
|
|
4
4
|
import MlStatusBar from './components/MlStatusBar.vue';
|
|
5
|
+
import MlToggleButton from './components/MlToggleButton.vue';
|
|
5
6
|
import MlToolBar from './components/MlToolBar.vue';
|
|
6
7
|
import MlToolPalette from './components/MlToolPalette.vue';
|
|
7
|
-
export { MlCollapse, MlDropdown, MlLanguage, MlStatusBar, MlToolBar, MlToolPalette };
|
|
8
|
+
export { MlCollapse, MlDropdown, MlLanguage, MlStatusBar, MlToggleButton, MlToolBar, MlToolPalette };
|
|
8
9
|
export type { MlDropdownMenuItem } from './components/MlDropdown.vue';
|
|
10
|
+
export type { MlToggleButtonData } from './components/MlToggleButton.vue';
|
|
9
11
|
export type { MlButtonData } from './components/MlToolBar.vue';
|
|
12
|
+
export * from './components/types';
|
|
10
13
|
declare const _default: {
|
|
11
14
|
install(app: any): void;
|
|
12
15
|
};
|
package/lib/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import MlCollapse from './components/MlCollapse.vue';
|
|
|
2
2
|
import MlDropdown from './components/MlDropdown.vue';
|
|
3
3
|
import MlLanguage from './components/MlLanguage.vue';
|
|
4
4
|
import MlStatusBar from './components/MlStatusBar.vue';
|
|
5
|
+
import MlToggleButton from './components/MlToggleButton.vue';
|
|
5
6
|
import MlToolBar from './components/MlToolBar.vue';
|
|
6
7
|
import MlToolPalette from './components/MlToolPalette.vue';
|
|
7
|
-
export { MlCollapse, MlDropdown, MlLanguage, MlStatusBar, MlToolBar, MlToolPalette };
|
|
8
|
+
export { MlCollapse, MlDropdown, MlLanguage, MlStatusBar, MlToggleButton, MlToolBar, MlToolPalette };
|
|
9
|
+
export * from './components/types';
|
|
8
10
|
// Optionally, export them as a plugin for Vue
|
|
9
11
|
export default {
|
|
10
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -13,6 +15,7 @@ export default {
|
|
|
13
15
|
app.component('MlDropdown', MlDropdown);
|
|
14
16
|
app.component('MlLanguage', MlLanguage);
|
|
15
17
|
app.component('MlStatusBar', MlStatusBar);
|
|
18
|
+
app.component('MlToggleButton', MlToggleButton);
|
|
16
19
|
app.component('MlToolBar', MlToolBar);
|
|
17
20
|
app.component('MlToolPalette', MlToolPalette);
|
|
18
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlightcad/ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "One common UI component library based on Element Plus",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "MLight Lee <mlight.lee@outlook.com>",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"vue",
|
|
15
15
|
"element plus",
|
|
16
16
|
"cad",
|
|
17
|
+
"AutoCAD",
|
|
18
|
+
"tool palette",
|
|
17
19
|
"mlight"
|
|
18
20
|
],
|
|
19
21
|
"main": "dist/ui-components.umd.js",
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip :content="tooltip" :hide-after="0">
|
|
3
|
+
<el-button class="ml-toggle-button" :icon="icon" @click="handleClicked" />
|
|
4
|
+
</el-tooltip>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
import { MlIconType } from './types'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Data to descibe toggle button
|
|
14
|
+
*/
|
|
15
|
+
export interface MlToggleButtonData {
|
|
16
|
+
/**
|
|
17
|
+
* Icon used when button is 'on'
|
|
18
|
+
*/
|
|
19
|
+
onIcon: MlIconType
|
|
20
|
+
/**
|
|
21
|
+
* Icon used when button is 'off'.
|
|
22
|
+
*/
|
|
23
|
+
offIcon: MlIconType
|
|
24
|
+
/**
|
|
25
|
+
* Tooltip when button is 'on'
|
|
26
|
+
*/
|
|
27
|
+
onTooltip: string
|
|
28
|
+
/**
|
|
29
|
+
* Tooltip when button is 'off'
|
|
30
|
+
*/
|
|
31
|
+
offTooltip: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Properties of MlToggleButton component
|
|
36
|
+
*/
|
|
37
|
+
interface Props {
|
|
38
|
+
/**
|
|
39
|
+
* Button size
|
|
40
|
+
*/
|
|
41
|
+
size?: number | string
|
|
42
|
+
/**
|
|
43
|
+
* Data to descibe toggle button
|
|
44
|
+
*/
|
|
45
|
+
data: MlToggleButtonData
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Events {
|
|
49
|
+
/**
|
|
50
|
+
* Trigger this event when toggle button is clicked.
|
|
51
|
+
* @param state New state of toggle button
|
|
52
|
+
*/
|
|
53
|
+
(e: 'click', state: boolean): void
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
57
|
+
size: 30,
|
|
58
|
+
})
|
|
59
|
+
const on = defineModel({ default: false })
|
|
60
|
+
const emit = defineEmits<Events>()
|
|
61
|
+
|
|
62
|
+
const icon = computed(() => {
|
|
63
|
+
return on.value ? props.data.onIcon : props.data.offIcon
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const size = computed(() => {
|
|
67
|
+
return props.size + 'px'
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const tooltip = computed(() => {
|
|
71
|
+
return on.value ? props.data.onTooltip : props.data.offTooltip
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const handleClicked = () => {
|
|
75
|
+
on.value = !on.value
|
|
76
|
+
emit('click', on.value)
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style scoped>
|
|
81
|
+
.ml-toggle-button {
|
|
82
|
+
border: none;
|
|
83
|
+
padding: 0px;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
width: v-bind(size);
|
|
86
|
+
height: v-bind(size);
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
|
-
import { computed
|
|
29
|
+
import { computed } from 'vue'
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
import { MlIconType } from './types'
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Data to descibe button appearance
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import MlCollapse from './components/MlCollapse.vue'
|
|
|
2
2
|
import MlDropdown from './components/MlDropdown.vue'
|
|
3
3
|
import MlLanguage from './components/MlLanguage.vue'
|
|
4
4
|
import MlStatusBar from './components/MlStatusBar.vue'
|
|
5
|
+
import MlToggleButton from './components/MlToggleButton.vue'
|
|
5
6
|
import MlToolBar from './components/MlToolBar.vue'
|
|
6
7
|
import MlToolPalette from './components/MlToolPalette.vue'
|
|
7
8
|
export {
|
|
@@ -9,11 +10,14 @@ export {
|
|
|
9
10
|
MlDropdown,
|
|
10
11
|
MlLanguage,
|
|
11
12
|
MlStatusBar,
|
|
13
|
+
MlToggleButton,
|
|
12
14
|
MlToolBar,
|
|
13
15
|
MlToolPalette
|
|
14
16
|
}
|
|
15
17
|
export type { MlDropdownMenuItem } from './components/MlDropdown.vue'
|
|
18
|
+
export type { MlToggleButtonData } from './components/MlToggleButton.vue'
|
|
16
19
|
export type { MlButtonData } from './components/MlToolBar.vue'
|
|
20
|
+
export * from './components/types'
|
|
17
21
|
|
|
18
22
|
// Optionally, export them as a plugin for Vue
|
|
19
23
|
export default {
|
|
@@ -23,6 +27,7 @@ export default {
|
|
|
23
27
|
app.component('MlDropdown', MlDropdown)
|
|
24
28
|
app.component('MlLanguage', MlLanguage)
|
|
25
29
|
app.component('MlStatusBar', MlStatusBar)
|
|
30
|
+
app.component('MlToggleButton', MlToggleButton)
|
|
26
31
|
app.component('MlToolBar', MlToolBar)
|
|
27
32
|
app.component('MlToolPalette', MlToolPalette)
|
|
28
33
|
}
|