@mlightcad/ui-components 0.0.6 → 0.0.8
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 +52 -0
- package/dist/ui-components.es.js +459 -38
- package/dist/ui-components.umd.js +2 -1
- package/lib/MlDropdown.vue.d.ts +59 -0
- package/lib/MlDropdown.vue.js +106 -0
- package/lib/MlLanguage.vue.d.ts +29 -0
- package/lib/MlLanguage.vue.js +67 -0
- package/lib/MlToolPalette.vue.d.ts +2 -0
- package/lib/MlToolPalette.vue.js +149 -0
- package/lib/MlToolbar.vue.d.ts +1 -1
- package/lib/index.d.ts +8 -3
- package/lib/index.js +10 -2
- package/package.json +1 -1
- package/src/components/MlCollapse.vue +55 -0
- package/src/components/MlDropdown.vue +94 -0
- package/src/components/MlLanguage.vue +41 -0
- package/src/components/MlToolPalette.vue +199 -0
- package/src/{MlToolbar.vue → components/MlToolbar.vue} +13 -9
- package/src/composable/types.ts +16 -0
- package/src/composable/useBoundingRect.ts +87 -0
- package/src/composable/useDrag.ts +157 -0
- package/src/composable/useDragEx.ts +50 -0
- package/src/composable/useInitialRect.ts +51 -0
- package/src/composable/useRect.ts +23 -0
- package/src/composable/useResize.ts +184 -0
- package/src/composable/useTransition.ts +67 -0
- package/src/composable/useWindowSize.ts +25 -0
- package/src/index.ts +12 -3
- package/src/svg/arrow-left.svg +11 -0
- package/src/svg/arrow-right.svg +11 -0
- package/src/svg/svg.d.ts +6 -0
- package/dist/style.css +0 -1
package/README.md
CHANGED
|
@@ -6,8 +6,60 @@ This is one common UI component library based on Element Plus.
|
|
|
6
6
|
|
|
7
7
|
The following components are included in this package.
|
|
8
8
|
|
|
9
|
+
- Tool Palette: one dockable, resizable, and floating window, which is quite similar to AutoCAD Tool Palette.
|
|
9
10
|
- Toolbar: one toolbar which can be easily customized by one array of button data.
|
|
10
11
|
|
|
12
|
+
### Tool Palette
|
|
13
|
+
|
|
14
|
+
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.
|
|
15
|
+
|
|
16
|
+
- Dockable: dock to the left or right side of the window
|
|
17
|
+
- Folderable: roll open or closed as your need
|
|
18
|
+
- Auto-hide: roll open and closed as the cursor moves across it. When this option is cleared, the full tool palette stays open continuously.
|
|
19
|
+
|
|
20
|
+
<img src="./doc/palette.jpg" width="400" height="92" alt="Tool Palette Example">
|
|
21
|
+
|
|
22
|
+
You can customize tool palette by the following properties. More properties will be coming soon.
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
/**
|
|
26
|
+
* Properties of MlToolPalette component
|
|
27
|
+
*/
|
|
28
|
+
interface Props {
|
|
29
|
+
/**
|
|
30
|
+
* The title of tool palette dialog
|
|
31
|
+
*/
|
|
32
|
+
title?: string
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It is quite easy to use it.
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
import { MlToolPalette } from '@mlightcad/ui-components'
|
|
41
|
+
const toolPaletteVisible = ref<boolean>(false)
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<ml-tool-palette
|
|
46
|
+
class="tool-palette"
|
|
47
|
+
v-model="toolPaletteVisible"
|
|
48
|
+
title="Tool Palette Test"
|
|
49
|
+
>
|
|
50
|
+
<span>Tool Palette Test</span>
|
|
51
|
+
</ml-tool-palette>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<style scoped>
|
|
55
|
+
.tool-palette {
|
|
56
|
+
position: fixed;
|
|
57
|
+
top: 55px;
|
|
58
|
+
width: 400px;
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
61
|
+
```
|
|
62
|
+
|
|
11
63
|
### Toolbar
|
|
12
64
|
|
|
13
65
|
Toolbar component has the followiing features.
|
package/dist/ui-components.es.js
CHANGED
|
@@ -1,14 +1,159 @@
|
|
|
1
|
-
|
|
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-vertical-toolbar-button-group[data-v-27b5412a]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-27b5412a]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-27b5412a]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-27b5412a]{margin-left:0;margin-top:5px}.ml-tool-palette-dialog[data-v-d69f63b3]{cursor:default;width:300px;min-width:var(--collapsed-width);position:absolute;border:1px solid;border-radius:4px}.ml-tool-palette-dialog-icon[data-v-d69f63b3]{border-bottom:1px solid}.ml-tool-palette-dialog-layout[data-v-d69f63b3]{display:flex;height:100%}.ml-tool-palette-title-bar[data-v-d69f63b3]{width:var(--collapsed-width);display:flex;justify-content:left;align-items:center;cursor:move;writing-mode:vertical-rl;text-align:center;border:1px}.ml-tool-palette-title[data-v-d69f63b3]{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-d69f63b3]{pointer-events:none;-webkit-user-select:none;user-select:none;flex-grow:1;display:flex;justify-content:space-around;align-items:center;background-color:#fff;overflow:hidden}.ml-tool-palette-dialog-layout.left .ml-tool-palette-title-bar[data-v-d69f63b3]{order:1}.ml-tool-palette-dialog-layout.left .ml-tool-palette-content[data-v-d69f63b3],.ml-tool-palette-dialog-layout.right .ml-tool-palette-title-bar[data-v-d69f63b3]{order:2}.ml-tool-palette-dialog-layout.right .ml-tool-palette-content[data-v-d69f63b3]{order:1}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { ElIcon as S, ElDropdownItem as ee, ElDropdownMenu as te, ElDropdown as le, ElButton as ne, ElTooltip as oe, ElButtonGroup as ie } from "element-plus/es";
|
|
2
3
|
import "element-plus/es/components/base/style/css";
|
|
4
|
+
import "element-plus/es/components/icon/style/css";
|
|
5
|
+
import { openBlock as _, createElementBlock as b, createElementVNode as g, defineComponent as D, mergeModels as W, useModel as N, computed as L, createBlock as E, withCtx as M, resolveDynamicComponent as se, createVNode as $, Fragment as O, renderList as F, createTextVNode as ae, toDisplayString as A, pushScopeId as j, popScopeId as q, normalizeClass as J, normalizeStyle as K, createCommentVNode as Q, ref as f, onMounted as I, nextTick as H, watch as C, onBeforeUnmount as Z, onUnmounted as R, unref as ue, renderSlot as ce } from "vue";
|
|
6
|
+
import "element-plus/es/components/dropdown/style/css";
|
|
7
|
+
import "element-plus/es/components/dropdown-menu/style/css";
|
|
8
|
+
import "element-plus/es/components/dropdown-item/style/css";
|
|
3
9
|
import "element-plus/es/components/button-group/style/css";
|
|
4
10
|
import "element-plus/es/components/tooltip/style/css";
|
|
5
11
|
import "element-plus/es/components/button/style/css";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
const re = {
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: "1em",
|
|
15
|
+
height: "1em",
|
|
16
|
+
viewBox: "0 0 1024 1024"
|
|
17
|
+
}, ve = /* @__PURE__ */ g("path", {
|
|
18
|
+
fill: "currentColor",
|
|
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
|
+
}, null, -1), de = [
|
|
21
|
+
ve
|
|
22
|
+
];
|
|
23
|
+
function me(e, l) {
|
|
24
|
+
return _(), b("svg", re, [...de]);
|
|
25
|
+
}
|
|
26
|
+
const X = { render: me }, he = {
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
+
width: "1em",
|
|
29
|
+
height: "1em",
|
|
30
|
+
viewBox: "0 0 1024 1024"
|
|
31
|
+
}, pe = /* @__PURE__ */ g("path", {
|
|
32
|
+
fill: "currentColor",
|
|
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), fe = [
|
|
35
|
+
pe
|
|
36
|
+
];
|
|
37
|
+
function _e(e, l) {
|
|
38
|
+
return _(), b("svg", he, [...fe]);
|
|
39
|
+
}
|
|
40
|
+
const U = { render: _e }, we = /* @__PURE__ */ D({
|
|
41
|
+
__name: "MlCollapse",
|
|
42
|
+
props: /* @__PURE__ */ W({
|
|
43
|
+
size: { default: 18 },
|
|
44
|
+
reverse: { type: Boolean, default: !1 }
|
|
45
|
+
}, {
|
|
46
|
+
modelValue: { default: !0 },
|
|
47
|
+
modelModifiers: {}
|
|
48
|
+
}),
|
|
49
|
+
emits: /* @__PURE__ */ W({
|
|
50
|
+
change: null
|
|
51
|
+
}, ["update:modelValue"]),
|
|
52
|
+
setup(e, { emit: l }) {
|
|
53
|
+
const n = e, t = N(e, "modelValue"), o = l, c = L(() => n.reverse ? t.value ? X : U : t.value ? U : X), s = L(() => `${n.size}px`), v = () => {
|
|
54
|
+
o("change", t.value), t.value = !t.value;
|
|
55
|
+
};
|
|
56
|
+
return (u, h) => {
|
|
57
|
+
const r = S;
|
|
58
|
+
return _(), E(r, {
|
|
59
|
+
size: s.value,
|
|
60
|
+
onClick: v
|
|
61
|
+
}, {
|
|
62
|
+
default: M(() => [
|
|
63
|
+
(_(), E(se(c.value)))
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
}, 8, ["size"]);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}), xe = (e) => (j("data-v-3fc33b5d"), e = e(), q(), e), Le = /* @__PURE__ */ xe(() => /* @__PURE__ */ g("svg", {
|
|
70
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
71
|
+
viewBox: "0 0 24 24",
|
|
72
|
+
width: "1.2em",
|
|
73
|
+
height: "1.2em",
|
|
74
|
+
"data-v-63d067da": ""
|
|
75
|
+
}, [
|
|
76
|
+
/* @__PURE__ */ g("path", {
|
|
77
|
+
fill: "currentColor",
|
|
78
|
+
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"
|
|
79
|
+
})
|
|
80
|
+
], -1)), ge = /* @__PURE__ */ D({
|
|
81
|
+
__name: "MlDropdown",
|
|
82
|
+
props: {
|
|
83
|
+
icon: {},
|
|
84
|
+
items: {},
|
|
85
|
+
current: { default: void 0 }
|
|
86
|
+
},
|
|
87
|
+
emits: {
|
|
88
|
+
click: null
|
|
89
|
+
},
|
|
90
|
+
setup(e, { emit: l }) {
|
|
91
|
+
const n = e, t = l, o = L(() => n.items.filter((s) => s.name !== n.current)), c = (s) => {
|
|
92
|
+
t("click", s);
|
|
93
|
+
};
|
|
94
|
+
return (s, v) => {
|
|
95
|
+
const u = S, h = ee, r = te, i = le;
|
|
96
|
+
return _(), E(i, { onCommand: c }, {
|
|
97
|
+
dropdown: M(() => [
|
|
98
|
+
$(r, null, {
|
|
99
|
+
default: M(() => [
|
|
100
|
+
(_(!0), b(O, null, F(o.value, (a) => (_(), E(h, {
|
|
101
|
+
key: a.text,
|
|
102
|
+
command: a.name
|
|
103
|
+
}, {
|
|
104
|
+
default: M(() => [
|
|
105
|
+
ae(A(a.text), 1)
|
|
106
|
+
]),
|
|
107
|
+
_: 2
|
|
108
|
+
}, 1032, ["command"]))), 128))
|
|
109
|
+
]),
|
|
110
|
+
_: 1
|
|
111
|
+
})
|
|
112
|
+
]),
|
|
113
|
+
default: M(() => [
|
|
114
|
+
$(u, {
|
|
115
|
+
size: "30",
|
|
116
|
+
class: "ml-dropdown-icon"
|
|
117
|
+
}, {
|
|
118
|
+
default: M(() => [
|
|
119
|
+
Le
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
})
|
|
123
|
+
]),
|
|
124
|
+
_: 1
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}), G = (e, l) => {
|
|
129
|
+
const n = e.__vccOpts || e;
|
|
130
|
+
for (const [t, o] of l)
|
|
131
|
+
n[t] = o;
|
|
132
|
+
return n;
|
|
133
|
+
}, Y = /* @__PURE__ */ G(ge, [["__scopeId", "data-v-3fc33b5d"]]), Me = '<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>', ye = /* @__PURE__ */ D({
|
|
134
|
+
__name: "MlLanguage",
|
|
135
|
+
props: {
|
|
136
|
+
languages: {},
|
|
137
|
+
current: {}
|
|
138
|
+
},
|
|
139
|
+
emits: {
|
|
140
|
+
click: null
|
|
141
|
+
},
|
|
142
|
+
setup(e, { emit: l }) {
|
|
143
|
+
const n = e, t = l, o = (c) => {
|
|
144
|
+
t("click", c);
|
|
145
|
+
};
|
|
146
|
+
return (c, s) => (_(), E(Y, {
|
|
147
|
+
icon: Me,
|
|
148
|
+
items: n.languages,
|
|
149
|
+
current: n.current,
|
|
150
|
+
onClick: o
|
|
151
|
+
}, null, 8, ["items", "current"]));
|
|
152
|
+
}
|
|
153
|
+
}), ze = {
|
|
9
154
|
key: 0,
|
|
10
155
|
class: "ml-toolbar-button-text"
|
|
11
|
-
},
|
|
156
|
+
}, Ee = /* @__PURE__ */ D({
|
|
12
157
|
__name: "MlToolbar",
|
|
13
158
|
props: {
|
|
14
159
|
items: {},
|
|
@@ -18,43 +163,43 @@ const G = {
|
|
|
18
163
|
emits: {
|
|
19
164
|
click: null
|
|
20
165
|
},
|
|
21
|
-
setup(e, { emit:
|
|
22
|
-
const
|
|
23
|
-
switch (
|
|
166
|
+
setup(e, { emit: l }) {
|
|
167
|
+
const n = e, t = l, o = L(() => n.direction === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), c = L(() => n.size === "small" ? 20 : 30), s = L(() => {
|
|
168
|
+
switch (n.size) {
|
|
24
169
|
case "small":
|
|
25
170
|
return 30;
|
|
26
171
|
case "medium":
|
|
27
172
|
return 50;
|
|
28
173
|
}
|
|
29
174
|
return 70;
|
|
30
|
-
}),
|
|
31
|
-
|
|
175
|
+
}), v = (r) => r.description ? r.description : r.text, u = L(() => n.size === "large"), h = (r) => {
|
|
176
|
+
t("click", r);
|
|
32
177
|
};
|
|
33
|
-
return (
|
|
34
|
-
const
|
|
35
|
-
return
|
|
36
|
-
class:
|
|
178
|
+
return (r, i) => {
|
|
179
|
+
const a = S, p = ne, x = oe, y = ie;
|
|
180
|
+
return _(), E(y, {
|
|
181
|
+
class: J(o.value)
|
|
37
182
|
}, {
|
|
38
|
-
default:
|
|
39
|
-
(
|
|
40
|
-
key:
|
|
41
|
-
content:
|
|
183
|
+
default: M(() => [
|
|
184
|
+
(_(!0), b(O, null, F(r.items, (w, d) => (_(), E(x, {
|
|
185
|
+
key: w.text,
|
|
186
|
+
content: v(w),
|
|
42
187
|
"hide-after": 0
|
|
43
188
|
}, {
|
|
44
|
-
default:
|
|
45
|
-
(
|
|
189
|
+
default: M(() => [
|
|
190
|
+
(_(), E(p, {
|
|
46
191
|
class: "ml-toolbar-button",
|
|
47
|
-
style:
|
|
48
|
-
key:
|
|
49
|
-
onClick: (
|
|
192
|
+
style: K({ width: s.value + "px", height: s.value + "px" }),
|
|
193
|
+
key: d,
|
|
194
|
+
onClick: (m) => h(w.command)
|
|
50
195
|
}, {
|
|
51
|
-
default:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
size:
|
|
55
|
-
innerHTML:
|
|
196
|
+
default: M(() => [
|
|
197
|
+
g("div", null, [
|
|
198
|
+
$(a, {
|
|
199
|
+
size: c.value,
|
|
200
|
+
innerHTML: w.icon
|
|
56
201
|
}, null, 8, ["size", "innerHTML"]),
|
|
57
|
-
|
|
202
|
+
u.value ? (_(), b("div", ze, A(w.text), 1)) : Q("", !0)
|
|
58
203
|
])
|
|
59
204
|
]),
|
|
60
205
|
_: 2
|
|
@@ -67,18 +212,294 @@ const G = {
|
|
|
67
212
|
}, 8, ["class"]);
|
|
68
213
|
};
|
|
69
214
|
}
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
215
|
+
}), Ce = /* @__PURE__ */ G(Ee, [["__scopeId", "data-v-27b5412a"]]), V = 20;
|
|
216
|
+
function be(e) {
|
|
217
|
+
const l = f({});
|
|
218
|
+
let n = !1;
|
|
219
|
+
const t = () => {
|
|
220
|
+
if (!n && e.value) {
|
|
221
|
+
const o = e.value.getBoundingClientRect();
|
|
222
|
+
l.value.left = o.left, l.value.top = o.top, l.value.width = o.width, l.value.height = o.height, n = !0;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
return I(() => {
|
|
226
|
+
e.value && H(() => {
|
|
227
|
+
t();
|
|
228
|
+
});
|
|
229
|
+
}), C(e, (o) => {
|
|
230
|
+
o && H(() => {
|
|
231
|
+
t();
|
|
232
|
+
});
|
|
233
|
+
}), {
|
|
234
|
+
isIntialized: n,
|
|
235
|
+
initialRect: l
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function ke(e, l = f(!1), n = { width: 20, height: 40 }) {
|
|
239
|
+
const t = f({
|
|
240
|
+
width: null,
|
|
241
|
+
height: null,
|
|
242
|
+
left: null,
|
|
243
|
+
top: null
|
|
244
|
+
}), o = f(!1);
|
|
245
|
+
let c = 0, s = 0, v = 0, u = 0, h = 0;
|
|
246
|
+
const r = 5, i = f(
|
|
247
|
+
null
|
|
248
|
+
), a = (d) => {
|
|
249
|
+
if (e.value)
|
|
250
|
+
if (o.value) {
|
|
251
|
+
const m = d.clientX - u, z = d.clientY - h;
|
|
252
|
+
(i.value === "left" || i.value === "left-bottom-corner") && (t.value.width = Math.max(
|
|
253
|
+
n.width,
|
|
254
|
+
s - m
|
|
255
|
+
), t.value.left = c + m, e.value.style.left = t.value.left + "px", e.value.style.width = t.value.width + "px"), (i.value === "right" || i.value === "right-bottom-corner") && (t.value.width = Math.max(
|
|
256
|
+
n.width,
|
|
257
|
+
s + m
|
|
258
|
+
), e.value.style.width = t.value.width + "px"), (i.value === "bottom" || i.value === "left-bottom-corner" || i.value === "right-bottom-corner") && (t.value.height = Math.max(
|
|
259
|
+
n.height,
|
|
260
|
+
v + z
|
|
261
|
+
), e.value.style.height = t.value.height + "px");
|
|
262
|
+
} else {
|
|
263
|
+
const m = e.value.getBoundingClientRect(), z = d.clientX - m.left, k = d.clientY - m.top, B = z <= r, T = z >= m.width - r, P = k >= m.height - r;
|
|
264
|
+
B && P && l.value ? (e.value.style.cursor = "nesw-resize", i.value = "left-bottom-corner") : T && P && !l.value ? (e.value.style.cursor = "nwse-resize", i.value = "right-bottom-corner") : B && l.value ? (e.value.style.cursor = "ew-resize", i.value = "left") : T && !l.value ? (e.value.style.cursor = "ew-resize", i.value = "right") : P ? (e.value.style.cursor = "ns-resize", i.value = "bottom") : (e.value.style.cursor = "", i.value = null);
|
|
265
|
+
}
|
|
266
|
+
}, p = (d) => {
|
|
267
|
+
if (!e.value || !i.value) return;
|
|
268
|
+
const m = e.value.getBoundingClientRect();
|
|
269
|
+
u = d.clientX, h = d.clientY, s = m.width, v = m.height, c = m.left, t.value.width = s, t.value.height = v, t.value.left = m.left, t.value.top = m.top, o.value = !0, document.addEventListener("mousemove", a), document.addEventListener("mouseup", x);
|
|
270
|
+
}, x = () => {
|
|
271
|
+
o.value = !1, i.value = null, e.value && (e.value.style.cursor = ""), document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", x);
|
|
272
|
+
}, y = () => {
|
|
273
|
+
e.value && (e.value.removeEventListener("mousedown", p), e.value.removeEventListener("mousemove", a)), document.removeEventListener("mouseup", x);
|
|
274
|
+
}, w = () => {
|
|
275
|
+
e.value && (e.value.addEventListener("mousedown", p), e.value.addEventListener("mousemove", a));
|
|
276
|
+
};
|
|
277
|
+
return I(() => {
|
|
278
|
+
e.value && w();
|
|
279
|
+
}), Z(() => {
|
|
280
|
+
y();
|
|
281
|
+
}), C(e, (d) => {
|
|
282
|
+
d ? w() : y();
|
|
283
|
+
}), { rect: t, isResizing: o };
|
|
284
|
+
}
|
|
285
|
+
function Be(e, l, n) {
|
|
286
|
+
function t() {
|
|
287
|
+
e.value && (e.value.style.transition = "");
|
|
288
|
+
}
|
|
289
|
+
const o = () => {
|
|
290
|
+
e.value && e.value.removeEventListener("transitionend", t);
|
|
291
|
+
}, c = () => {
|
|
292
|
+
e.value && e.value.addEventListener("transitionend", t);
|
|
293
|
+
};
|
|
294
|
+
I(() => {
|
|
295
|
+
e.value && e.value.addEventListener("transitionend", t);
|
|
296
|
+
}), Z(() => {
|
|
297
|
+
e.value && e.value.removeEventListener("transitionend", t);
|
|
298
|
+
}), C(e, (s) => {
|
|
299
|
+
s ? c() : o();
|
|
300
|
+
}), C(n, () => {
|
|
301
|
+
if (e.value) {
|
|
302
|
+
const s = e.value;
|
|
303
|
+
l.value ? s.style.transition = "width 0.3s ease-out, left 0.3s ease-out" : s.style.transition = "width 0.3s ease";
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function Te(e, l, n, t) {
|
|
308
|
+
const o = f(window.innerWidth), c = f(window.innerHeight), { initialRect: s } = be(e), { rect: v } = ke(e, l);
|
|
309
|
+
Be(e, l, n);
|
|
310
|
+
const u = L(() => v.value.width && v.value.height ? v.value : s.value), h = (a) => {
|
|
311
|
+
if (e.value && l.value) {
|
|
312
|
+
const p = e.value.getBoundingClientRect();
|
|
313
|
+
e.value.style.left = p.left + a + "px";
|
|
314
|
+
}
|
|
315
|
+
}, r = () => {
|
|
316
|
+
const a = window.innerWidth - o.value;
|
|
317
|
+
o.value = window.innerWidth, c.value = window.innerHeight, h(a);
|
|
318
|
+
};
|
|
319
|
+
I(() => {
|
|
320
|
+
window.addEventListener("resize", r);
|
|
321
|
+
}), R(() => {
|
|
322
|
+
window.removeEventListener("resize", r);
|
|
323
|
+
});
|
|
324
|
+
let i = null;
|
|
325
|
+
return C(n, (a) => {
|
|
326
|
+
a ? (i = u.value.width, u.value.width = V, l.value && u.value.left && i && (u.value.left = u.value.left + i - V)) : (u.value.width = i, l.value && u.value.left && i && (u.value.left = u.value.left - i + V), i = null);
|
|
327
|
+
}), C(t, (a) => {
|
|
328
|
+
if (a && e.value) {
|
|
329
|
+
const x = e.value.getBoundingClientRect();
|
|
330
|
+
u.value.left = x.left, u.value.top = x.top;
|
|
331
|
+
}
|
|
332
|
+
}), { rect: u };
|
|
333
|
+
}
|
|
334
|
+
function $e(e, l) {
|
|
335
|
+
const n = f(!1), t = f({ x: 0, y: 0 }), o = f({ x: 0, y: 0 }), c = L(() => ({
|
|
336
|
+
x: t.value.x - o.value.x,
|
|
337
|
+
y: t.value.y - o.value.y
|
|
338
|
+
})), s = () => {
|
|
339
|
+
if (e.value) {
|
|
340
|
+
const a = e.value.getBoundingClientRect();
|
|
341
|
+
o.value.x = a.left, o.value.y = a.top, t.value.x = a.left, t.value.y = a.top;
|
|
342
|
+
}
|
|
343
|
+
}, v = () => {
|
|
344
|
+
e.value && e.value.addEventListener("mousedown", h);
|
|
345
|
+
}, u = () => {
|
|
346
|
+
e.value && e.value.removeEventListener("mousedown", h);
|
|
347
|
+
}, h = () => {
|
|
348
|
+
n.value = !0, document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
349
|
+
}, r = (a) => {
|
|
350
|
+
if (n.value) {
|
|
351
|
+
const p = window.innerWidth, x = window.innerHeight, y = e.value, w = y.offsetWidth, d = y.offsetHeight, m = t.value.x + a.movementX, z = t.value.y + a.movementY;
|
|
352
|
+
t.value.x = Math.max(
|
|
353
|
+
l ? l.value.leftGap : 0,
|
|
354
|
+
Math.min(m, p - w)
|
|
355
|
+
);
|
|
356
|
+
const k = l && l.value.container ? l.value.container.clientWidth : 0, B = p - k - w;
|
|
357
|
+
if (t.value.x = Math.min(
|
|
358
|
+
l ? B - l.value.rightGap : B,
|
|
359
|
+
t.value.x
|
|
360
|
+
), t.value.y = Math.max(
|
|
361
|
+
0,
|
|
362
|
+
Math.min(z, x - d)
|
|
363
|
+
), l != null && l.value.container) {
|
|
364
|
+
const T = l == null ? void 0 : l.value.container;
|
|
365
|
+
T.style.left = t.value.x + "px", T.style.top = t.value.y + "px";
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}, i = () => {
|
|
369
|
+
n.value = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
370
|
+
};
|
|
371
|
+
return I(() => {
|
|
372
|
+
e.value && H(() => {
|
|
373
|
+
s(), v();
|
|
374
|
+
});
|
|
375
|
+
}), R(() => {
|
|
376
|
+
e.value && (s(), e.value.removeEventListener("mousedown", h));
|
|
377
|
+
}), C(e, (a) => {
|
|
378
|
+
a ? H(() => {
|
|
379
|
+
s(), v();
|
|
380
|
+
}) : u();
|
|
381
|
+
}), {
|
|
382
|
+
isDragging: n,
|
|
383
|
+
movement: c,
|
|
384
|
+
position: t
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function De(e, l) {
|
|
388
|
+
const n = f(!1), t = f("left"), { isDragging: o, movement: c, position: s } = $e(e, l);
|
|
389
|
+
return C(c, (v) => {
|
|
390
|
+
if (v && l.value.container) {
|
|
391
|
+
const h = l.value.container.getBoundingClientRect();
|
|
392
|
+
h.left <= l.value.leftGap ? (t.value = "left", n.value = !0) : window.innerWidth - h.left - h.width - V <= l.value.rightGap ? (t.value = "right", n.value = !0) : n.value = !1;
|
|
393
|
+
}
|
|
394
|
+
}), {
|
|
395
|
+
docked: n,
|
|
396
|
+
orientation: t,
|
|
397
|
+
isDragging: o,
|
|
398
|
+
movement: c,
|
|
399
|
+
position: s
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const Ie = (e) => (j("data-v-d69f63b3"), e = e(), q(), e), Ve = /* @__PURE__ */ Ie(() => /* @__PURE__ */ g("svg", {
|
|
403
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
404
|
+
width: "1em",
|
|
405
|
+
height: "1em",
|
|
406
|
+
viewBox: "0 0 1024 1024"
|
|
407
|
+
}, [
|
|
408
|
+
/* @__PURE__ */ g("path", {
|
|
409
|
+
fill: "currentColor",
|
|
410
|
+
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"
|
|
411
|
+
})
|
|
412
|
+
], -1)), We = { class: "ml-tool-palette-title" }, He = { class: "ml-tool-palette-content" }, Se = /* @__PURE__ */ D({
|
|
413
|
+
__name: "MlToolPalette",
|
|
414
|
+
props: /* @__PURE__ */ W({
|
|
415
|
+
title: { default: "" }
|
|
416
|
+
}, {
|
|
417
|
+
modelValue: { default: !0 },
|
|
418
|
+
modelModifiers: {}
|
|
419
|
+
}),
|
|
420
|
+
emits: /* @__PURE__ */ W(["close"], ["update:modelValue"]),
|
|
421
|
+
setup(e, { emit: l }) {
|
|
422
|
+
const n = e, t = N(e, "modelValue"), o = l, c = f(!1), s = f(null), v = f(null), u = L(() => i.value === "right"), h = L(() => ({
|
|
423
|
+
leftGap: 0,
|
|
424
|
+
rightGap: 0,
|
|
425
|
+
container: v.value
|
|
426
|
+
})), { docked: r, orientation: i, movement: a } = De(
|
|
427
|
+
s,
|
|
428
|
+
h
|
|
429
|
+
), { rect: p } = Te(
|
|
430
|
+
v,
|
|
431
|
+
u,
|
|
432
|
+
c,
|
|
433
|
+
a
|
|
434
|
+
), x = L(() => ({
|
|
435
|
+
left: `${p.value.left}px`,
|
|
436
|
+
top: `${p.value.top}px`,
|
|
437
|
+
width: `${p.value.width}px`,
|
|
438
|
+
height: r.value ? "100%" : `${p.value.height}px`
|
|
439
|
+
})), y = (d) => {
|
|
440
|
+
c.value = d;
|
|
441
|
+
}, w = () => {
|
|
442
|
+
t.value = !1;
|
|
443
|
+
const d = v.value;
|
|
444
|
+
o("close", {
|
|
445
|
+
x: d ? d.clientLeft : 0,
|
|
446
|
+
y: d ? d.clientTop : 0
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
return (d, m) => {
|
|
450
|
+
const z = S;
|
|
451
|
+
return t.value ? (_(), b("div", {
|
|
452
|
+
key: 0,
|
|
453
|
+
ref_key: "toolPaletteElement",
|
|
454
|
+
ref: v,
|
|
455
|
+
style: K([x.value]),
|
|
456
|
+
class: "ml-tool-palette-dialog"
|
|
457
|
+
}, [
|
|
458
|
+
g("div", {
|
|
459
|
+
class: J(["ml-tool-palette-dialog-layout", ue(i)])
|
|
460
|
+
}, [
|
|
461
|
+
g("div", {
|
|
462
|
+
ref_key: "titleBarElement",
|
|
463
|
+
ref: s,
|
|
464
|
+
class: "ml-tool-palette-title-bar"
|
|
465
|
+
}, [
|
|
466
|
+
$(z, {
|
|
467
|
+
size: 18,
|
|
468
|
+
class: "ml-tool-palette-dialog-icon",
|
|
469
|
+
onClick: w
|
|
470
|
+
}, {
|
|
471
|
+
default: M(() => [
|
|
472
|
+
Ve
|
|
473
|
+
]),
|
|
474
|
+
_: 1
|
|
475
|
+
}),
|
|
476
|
+
$(we, {
|
|
477
|
+
class: "ml-tool-palette-dialog-icon",
|
|
478
|
+
modelValue: c.value,
|
|
479
|
+
"onUpdate:modelValue": m[0] || (m[0] = (k) => c.value = k),
|
|
480
|
+
reverse: u.value,
|
|
481
|
+
onChange: y
|
|
482
|
+
}, null, 8, ["modelValue", "reverse"]),
|
|
483
|
+
g("span", We, A(n.title), 1)
|
|
484
|
+
], 512),
|
|
485
|
+
g("div", He, [
|
|
486
|
+
ce(d.$slots, "default", {}, void 0, !0)
|
|
487
|
+
])
|
|
488
|
+
], 2)
|
|
489
|
+
], 4)) : Q("", !0);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
}), Pe = /* @__PURE__ */ G(Se, [["__scopeId", "data-v-d69f63b3"]]), Je = {
|
|
76
493
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
494
|
install(e) {
|
|
78
|
-
e.component("MlToolbar",
|
|
495
|
+
e.component("MlCollapse", Y), e.component("MlDropdown", Y), e.component("MlLanguage", ye), e.component("MlToolbar", Ce), e.component("MlToolPalette", Pe);
|
|
79
496
|
}
|
|
80
497
|
};
|
|
81
498
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
499
|
+
we as MlCollapse,
|
|
500
|
+
Y as MlDropdown,
|
|
501
|
+
ye as MlLanguage,
|
|
502
|
+
Pe as MlToolPalette,
|
|
503
|
+
Ce as MlToolbar,
|
|
504
|
+
Je as default
|
|
84
505
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
(function(
|
|
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-vertical-toolbar-button-group[data-v-27b5412a]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-27b5412a]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-27b5412a]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-27b5412a]{margin-left:0;margin-top:5px}.ml-tool-palette-dialog[data-v-d69f63b3]{cursor:default;width:300px;min-width:var(--collapsed-width);position:absolute;border:1px solid;border-radius:4px}.ml-tool-palette-dialog-icon[data-v-d69f63b3]{border-bottom:1px solid}.ml-tool-palette-dialog-layout[data-v-d69f63b3]{display:flex;height:100%}.ml-tool-palette-title-bar[data-v-d69f63b3]{width:var(--collapsed-width);display:flex;justify-content:left;align-items:center;cursor:move;writing-mode:vertical-rl;text-align:center;border:1px}.ml-tool-palette-title[data-v-d69f63b3]{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-d69f63b3]{pointer-events:none;-webkit-user-select:none;user-select:none;flex-grow:1;display:flex;justify-content:space-around;align-items:center;background-color:#fff;overflow:hidden}.ml-tool-palette-dialog-layout.left .ml-tool-palette-title-bar[data-v-d69f63b3]{order:1}.ml-tool-palette-dialog-layout.left .ml-tool-palette-content[data-v-d69f63b3],.ml-tool-palette-dialog-layout.right .ml-tool-palette-title-bar[data-v-d69f63b3]{order:2}.ml-tool-palette-dialog-layout.right .ml-tool-palette-content[data-v-d69f63b3]{order:1}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
(function(_,w){typeof exports=="object"&&typeof module<"u"?w(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"],w):(_=typeof globalThis<"u"?globalThis:_||self,w(_.UIComponents={},_.es,null,null,_.Vue))})(this,function(_,w,ne,oe,e){"use strict";const N={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 1024 1024"},W=[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 P(t,o){return e.openBlock(),e.createElementBlock("svg",N,[...W])}const V={render:P},H={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 Y(t,o){return e.openBlock(),e.createElementBlock("svg",H,[...q])}const T={render:Y},$=e.defineComponent({__name:"MlCollapse",props:e.mergeModels({size:{default:18},reverse:{type:Boolean,default:!1}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels({change:null},["update:modelValue"]),setup(t,{emit:o}){const l=t,n=e.useModel(t,"modelValue"),s=o,u=e.computed(()=>l.reverse?n.value?V:T:n.value?T:V),c=e.computed(()=>`${l.size}px`),m=()=>{s("change",n.value),n.value=!n.value};return(r,f)=>{const d=w.ElIcon;return e.openBlock(),e.createBlock(d,{size:c.value,onClick:m},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value)))]),_:1},8,["size"])}}}),A=(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:o}){const l=t,n=o,s=e.computed(()=>l.items.filter(c=>c.name!==l.current)),u=c=>{n("click",c)};return(c,m)=>{const r=w.ElIcon,f=w.ElDropdownItem,d=w.ElDropdownMenu,i=w.ElDropdown;return e.openBlock(),e.createBlock(i,{onCommand:u},{dropdown:e.withCtx(()=>[e.createVNode(d,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,a=>(e.openBlock(),e.createBlock(f,{key:a.text,command:a.name},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.text),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(r,{size:"30",class:"ml-dropdown-icon"},{default:e.withCtx(()=>[A]),_:1})]),_:1})}}}),z=(t,o)=>{const l=t.__vccOpts||t;for(const[n,s]of o)l[n]=s;return l},B=z(G,[["__scopeId","data-v-3fc33b5d"]]),U='<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:o}){const l=t,n=o,s=u=>{n("click",u)};return(u,c)=>(e.openBlock(),e.createBlock(B,{icon:U,items:l.languages,current:l.current,onClick:s},null,8,["items","current"]))}}),X={key:0,class:"ml-toolbar-button-text"},D=z(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(t,{emit:o}){const l=t,n=o,s=e.computed(()=>l.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),u=e.computed(()=>l.size==="small"?20:30),c=e.computed(()=>{switch(l.size){case"small":return 30;case"medium":return 50}return 70}),m=d=>d.description?d.description:d.text,r=e.computed(()=>l.size==="large"),f=d=>{n("click",d)};return(d,i)=>{const a=w.ElIcon,v=w.ElButton,y=w.ElTooltip,M=w.ElButtonGroup;return e.openBlock(),e.createBlock(M,{class:e.normalizeClass(s.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.items,(x,p)=>(e.openBlock(),e.createBlock(y,{key:x.text,content:m(x),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(v,{class:"ml-toolbar-button",style:e.normalizeStyle({width:c.value+"px",height:c.value+"px"}),key:p,onClick:h=>f(x.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(a,{size:u.value,innerHTML:x.icon},null,8,["size","innerHTML"]),r.value?(e.openBlock(),e.createElementBlock("div",X,e.toDisplayString(x.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-27b5412a"]]),C=20;function O(t){const o=e.ref({});let l=!1;const n=()=>{if(!l&&t.value){const s=t.value.getBoundingClientRect();o.value.left=s.left,o.value.top=s.top,o.value.width=s.width,o.value.height=s.height,l=!0}};return e.onMounted(()=>{t.value&&e.nextTick(()=>{n()})}),e.watch(t,s=>{s&&e.nextTick(()=>{n()})}),{isIntialized:l,initialRect:o}}function F(t,o=e.ref(!1),l={width:20,height:40}){const n=e.ref({width:null,height:null,left:null,top:null}),s=e.ref(!1);let u=0,c=0,m=0,r=0,f=0;const d=5,i=e.ref(null),a=p=>{if(t.value)if(s.value){const h=p.clientX-r,g=p.clientY-f;(i.value==="left"||i.value==="left-bottom-corner")&&(n.value.width=Math.max(l.width,c-h),n.value.left=u+h,t.value.style.left=n.value.left+"px",t.value.style.width=n.value.width+"px"),(i.value==="right"||i.value==="right-bottom-corner")&&(n.value.width=Math.max(l.width,c+h),t.value.style.width=n.value.width+"px"),(i.value==="bottom"||i.value==="left-bottom-corner"||i.value==="right-bottom-corner")&&(n.value.height=Math.max(l.height,m+g),t.value.style.height=n.value.height+"px")}else{const h=t.value.getBoundingClientRect(),g=p.clientX-h.left,L=p.clientY-h.top,E=g<=d,k=g>=h.width-d,b=L>=h.height-d;E&&b&&o.value?(t.value.style.cursor="nesw-resize",i.value="left-bottom-corner"):k&&b&&!o.value?(t.value.style.cursor="nwse-resize",i.value="right-bottom-corner"):E&&o.value?(t.value.style.cursor="ew-resize",i.value="left"):k&&!o.value?(t.value.style.cursor="ew-resize",i.value="right"):b?(t.value.style.cursor="ns-resize",i.value="bottom"):(t.value.style.cursor="",i.value=null)}},v=p=>{if(!t.value||!i.value)return;const h=t.value.getBoundingClientRect();r=p.clientX,f=p.clientY,c=h.width,m=h.height,u=h.left,n.value.width=c,n.value.height=m,n.value.left=h.left,n.value.top=h.top,s.value=!0,document.addEventListener("mousemove",a),document.addEventListener("mouseup",y)},y=()=>{s.value=!1,i.value=null,t.value&&(t.value.style.cursor=""),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",y)},M=()=>{t.value&&(t.value.removeEventListener("mousedown",v),t.value.removeEventListener("mousemove",a)),document.removeEventListener("mouseup",y)},x=()=>{t.value&&(t.value.addEventListener("mousedown",v),t.value.addEventListener("mousemove",a))};return e.onMounted(()=>{t.value&&x()}),e.onBeforeUnmount(()=>{M()}),e.watch(t,p=>{p?x():M()}),{rect:n,isResizing:s}}function j(t,o,l){function n(){t.value&&(t.value.style.transition="")}const s=()=>{t.value&&t.value.removeEventListener("transitionend",n)},u=()=>{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,c=>{c?u():s()}),e.watch(l,()=>{if(t.value){const c=t.value;o.value?c.style.transition="width 0.3s ease-out, left 0.3s ease-out":c.style.transition="width 0.3s ease"}})}function J(t,o,l,n){const s=e.ref(window.innerWidth),u=e.ref(window.innerHeight),{initialRect:c}=O(t),{rect:m}=F(t,o);j(t,o,l);const r=e.computed(()=>m.value.width&&m.value.height?m.value:c.value),f=a=>{if(t.value&&o.value){const v=t.value.getBoundingClientRect();t.value.style.left=v.left+a+"px"}},d=()=>{const a=window.innerWidth-s.value;s.value=window.innerWidth,u.value=window.innerHeight,f(a)};e.onMounted(()=>{window.addEventListener("resize",d)}),e.onUnmounted(()=>{window.removeEventListener("resize",d)});let i=null;return e.watch(l,a=>{a?(i=r.value.width,r.value.width=C,o.value&&r.value.left&&i&&(r.value.left=r.value.left+i-C)):(r.value.width=i,o.value&&r.value.left&&i&&(r.value.left=r.value.left-i+C),i=null)}),e.watch(n,a=>{if(a&&t.value){const y=t.value.getBoundingClientRect();r.value.left=y.left,r.value.top=y.top}}),{rect:r}}function K(t,o){const l=e.ref(!1),n=e.ref({x:0,y:0}),s=e.ref({x:0,y:0}),u=e.computed(()=>({x:n.value.x-s.value.x,y:n.value.y-s.value.y})),c=()=>{if(t.value){const a=t.value.getBoundingClientRect();s.value.x=a.left,s.value.y=a.top,n.value.x=a.left,n.value.y=a.top}},m=()=>{t.value&&t.value.addEventListener("mousedown",f)},r=()=>{t.value&&t.value.removeEventListener("mousedown",f)},f=()=>{l.value=!0,document.addEventListener("mousemove",d),document.addEventListener("mouseup",i)},d=a=>{if(l.value){const v=window.innerWidth,y=window.innerHeight,M=t.value,x=M.offsetWidth,p=M.offsetHeight,h=n.value.x+a.movementX,g=n.value.y+a.movementY;n.value.x=Math.max(o?o.value.leftGap:0,Math.min(h,v-x));const L=o&&o.value.container?o.value.container.clientWidth:0,E=v-L-x;if(n.value.x=Math.min(o?E-o.value.rightGap:E,n.value.x),n.value.y=Math.max(0,Math.min(g,y-p)),o!=null&&o.value.container){const k=o==null?void 0:o.value.container;k.style.left=n.value.x+"px",k.style.top=n.value.y+"px"}}},i=()=>{l.value=!1,document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",i)};return e.onMounted(()=>{t.value&&e.nextTick(()=>{c(),m()})}),e.onUnmounted(()=>{t.value&&(c(),t.value.removeEventListener("mousedown",f))}),e.watch(t,a=>{a?e.nextTick(()=>{c(),m()}):r()}),{isDragging:l,movement:u,position:n}}function Q(t,o){const l=e.ref(!1),n=e.ref("left"),{isDragging:s,movement:u,position:c}=K(t,o);return e.watch(u,m=>{if(m&&o.value.container){const f=o.value.container.getBoundingClientRect();f.left<=o.value.leftGap?(n.value="left",l.value=!0):window.innerWidth-f.left-f.width-C<=o.value.rightGap?(n.value="right",l.value=!0):l.value=!1}}),{docked:l,orientation:n,isDragging:s,movement:u,position:c}}const Z=(t=>(e.pushScopeId("data-v-d69f63b3"),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)),R={class:"ml-tool-palette-title"},ee={class:"ml-tool-palette-content"},S=z(e.defineComponent({__name:"MlToolPalette",props:e.mergeModels({title:{default:""}},{modelValue:{default:!0},modelModifiers:{}}),emits:e.mergeModels(["close"],["update:modelValue"]),setup(t,{emit:o}){const l=t,n=e.useModel(t,"modelValue"),s=o,u=e.ref(!1),c=e.ref(null),m=e.ref(null),r=e.computed(()=>i.value==="right"),f=e.computed(()=>({leftGap:0,rightGap:0,container:m.value})),{docked:d,orientation:i,movement:a}=Q(c,f),{rect:v}=J(m,r,u,a),y=e.computed(()=>({left:`${v.value.left}px`,top:`${v.value.top}px`,width:`${v.value.width}px`,height:d.value?"100%":`${v.value.height}px`})),M=p=>{u.value=p},x=()=>{n.value=!1;const p=m.value;s("close",{x:p?p.clientLeft:0,y:p?p.clientTop:0})};return(p,h)=>{const g=w.ElIcon;return n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"toolPaletteElement",ref:m,style:e.normalizeStyle([y.value]),class:"ml-tool-palette-dialog"},[e.createElementVNode("div",{class:e.normalizeClass(["ml-tool-palette-dialog-layout",e.unref(i)])},[e.createElementVNode("div",{ref_key:"titleBarElement",ref:c,class:"ml-tool-palette-title-bar"},[e.createVNode(g,{size:18,class:"ml-tool-palette-dialog-icon",onClick:x},{default:e.withCtx(()=>[Z]),_:1}),e.createVNode($,{class:"ml-tool-palette-dialog-icon",modelValue:u.value,"onUpdate:modelValue":h[0]||(h[0]=L=>u.value=L),reverse:r.value,onChange:M},null,8,["modelValue","reverse"]),e.createElementVNode("span",R,e.toDisplayString(l.title),1)],512),e.createElementVNode("div",ee,[e.renderSlot(p.$slots,"default",{},void 0,!0)])],2)],4)):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-d69f63b3"]]),te={install(t){t.component("MlCollapse",B),t.component("MlDropdown",B),t.component("MlLanguage",I),t.component("MlToolbar",D),t.component("MlToolPalette",S)}};_.MlCollapse=$,_.MlDropdown=B,_.MlLanguage=I,_.MlToolPalette=S,_.MlToolbar=D,_.default=te,Object.defineProperties(_,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|