@opentiny/tiny-robot 0.3.0-alpha.3 → 0.3.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-group/index.js +42 -39
- package/dist/attachments/index.js +526 -0
- package/dist/base-popper/index.js +4 -0
- package/dist/bubble/index.js +1613 -1624
- package/dist/container/index.js +44 -40
- package/dist/drag-overlay/index.js +57 -0
- package/dist/dropdown-menu/index.js +151 -64
- package/dist/feedback/index.js +73 -74
- package/dist/flow-layout-buttons/index.js +31 -28
- package/dist/history/index.js +2 -225
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +1370 -934
- package/dist/index.js +218 -77
- package/dist/index2.js +277 -534
- package/dist/index3.js +693 -290
- package/dist/index4.js +146 -622
- package/dist/mcp-add-form/index.js +212 -0
- package/dist/mcp-server-picker/index.js +556 -0
- package/dist/no-data.js +4 -0
- package/dist/prompts/index.js +36 -39
- package/dist/sender/index.js +1132 -1212
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +131 -155
- package/dist/suggestion-popover/index.js +253 -221
- package/dist/theme-provider/index.js +83 -0
- package/dist/useSlotRefs.js +36 -0
- package/dist/utils.js +8 -13
- package/package.json +4 -9
- package/dist/close.js +0 -29
- package/dist/index5.js +0 -2157
- package/dist/index6.js +0 -4752
- package/dist/question/index.js +0 -429
- package/dist/suggestion/index.js +0 -497
- package/dist/tiny-robot-svgs.js +0 -643
package/dist/index2.js
CHANGED
|
@@ -1,552 +1,295 @@
|
|
|
1
|
-
import { onMounted as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, ie = typeof window < "u" && typeof document < "u";
|
|
12
|
-
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
13
|
-
const be = (e) => e != null, we = Object.prototype.toString, ge = (e) => we.call(e) === "[object Object]", M = () => {
|
|
14
|
-
}, ye = /* @__PURE__ */ Se();
|
|
15
|
-
function Se() {
|
|
16
|
-
var e, t;
|
|
17
|
-
return ie && ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
|
|
18
|
-
}
|
|
19
|
-
function $(e, t) {
|
|
20
|
-
function o(...n) {
|
|
21
|
-
return new Promise((f, a) => {
|
|
22
|
-
Promise.resolve(e(() => t.apply(this, n), { fn: t, thisArg: this, args: n })).then(f).catch(a);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return o;
|
|
26
|
-
}
|
|
27
|
-
const Ee = (e) => e();
|
|
28
|
-
function re(e, t = {}) {
|
|
29
|
-
let o, n, f = M;
|
|
30
|
-
const a = (r) => {
|
|
31
|
-
clearTimeout(r), f(), f = M;
|
|
1
|
+
import { ref as y, onMounted as ee, onBeforeUnmount as te, defineComponent as N, createElementBlock as r, openBlock as s, createElementVNode as R, createVNode as b, unref as n, toDisplayString as B, mergeModels as K, useModel as W, computed as x, normalizeStyle as ne, Fragment as O, renderList as V, createBlock as Q, resolveDynamicComponent as oe, nextTick as ie, normalizeClass as S, withDirectives as j, createCommentVNode as U, withKeys as q, withModifiers as A, isRef as se, vModelText as le, vShow as re } from "vue";
|
|
2
|
+
import { IconEmptySearch as ae, IconEditPen as ue, IconDelete as ce, IconCheck as de, IconClose as me, IconMenu2 as fe } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { _ as P } from "./_plugin-vue_export-helper.js";
|
|
4
|
+
import { o as X, a as pe, d as ve, c as _e } from "./index3.js";
|
|
5
|
+
import { t as G } from "./utils.js";
|
|
6
|
+
const D = y(!1);
|
|
7
|
+
let T = 0, $;
|
|
8
|
+
function ge() {
|
|
9
|
+
const i = window.matchMedia("(hover: none) and (pointer: coarse)"), m = () => {
|
|
10
|
+
D.value = i.matches;
|
|
32
11
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return o && a(o), c <= 0 || u !== void 0 && u <= 0 ? (n && (a(n), n = void 0), Promise.resolve(r())) : new Promise((s, v) => {
|
|
37
|
-
f = t.rejectOnCancel ? v : s, d = r, u && !n && (n = setTimeout(() => {
|
|
38
|
-
o && a(o), n = void 0, s(d());
|
|
39
|
-
}, u)), o = setTimeout(() => {
|
|
40
|
-
n && a(n), n = void 0, s(r());
|
|
41
|
-
}, c);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function Te(...e) {
|
|
46
|
-
let t = 0, o, n = !0, f = M, a, d, i, r, c;
|
|
47
|
-
!fe(e[0]) && typeof e[0] == "object" ? { delay: d, trailing: i = !0, leading: r = !0, rejectOnCancel: c = !1 } = e[0] : [d, i = !0, r = !0, c = !1] = e;
|
|
48
|
-
const u = () => {
|
|
49
|
-
o && (clearTimeout(o), o = void 0, f(), f = M);
|
|
12
|
+
m(), i.addEventListener("change", m);
|
|
13
|
+
const t = (c) => {
|
|
14
|
+
D.value = c.pointerType !== "mouse";
|
|
50
15
|
};
|
|
51
|
-
return (
|
|
52
|
-
|
|
53
|
-
return u(), h <= 0 ? (t = Date.now(), S()) : (b > h && (r || !n) ? (t = Date.now(), S()) : i && (a = new Promise((l, m) => {
|
|
54
|
-
f = c ? m : l, o = setTimeout(() => {
|
|
55
|
-
t = Date.now(), n = !0, l(S()), u();
|
|
56
|
-
}, Math.max(0, h - b));
|
|
57
|
-
})), !r && !o && (o = setTimeout(() => n = !0, h)), n = !1, a);
|
|
16
|
+
return window.addEventListener("pointerdown", t, !0), () => {
|
|
17
|
+
i.removeEventListener("change", m), window.removeEventListener("pointerdown", t, !0);
|
|
58
18
|
};
|
|
59
19
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
function D(e) {
|
|
64
|
-
return Array.isArray(e) ? e : [e];
|
|
65
|
-
}
|
|
66
|
-
function xe(e) {
|
|
67
|
-
return B();
|
|
68
|
-
}
|
|
69
|
-
function We(e, t = 200, o = {}) {
|
|
70
|
-
return $(
|
|
71
|
-
re(t, o),
|
|
72
|
-
e
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
function Me(e, t = 200, o = !1, n = !0, f = !1) {
|
|
76
|
-
return $(
|
|
77
|
-
Te(t, o, n, f),
|
|
78
|
-
e
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
function Oe(e, t, o = {}) {
|
|
82
|
-
const {
|
|
83
|
-
eventFilter: n = Ee,
|
|
84
|
-
...f
|
|
85
|
-
} = o;
|
|
86
|
-
return L(
|
|
87
|
-
e,
|
|
88
|
-
$(
|
|
89
|
-
n,
|
|
90
|
-
t
|
|
91
|
-
),
|
|
92
|
-
f
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
function z(e, t = !0, o) {
|
|
96
|
-
xe() ? ne(e, o) : t ? e() : ce(e);
|
|
97
|
-
}
|
|
98
|
-
function Le(e, t, o = {}) {
|
|
99
|
-
const {
|
|
100
|
-
debounce: n = 0,
|
|
101
|
-
maxWait: f = void 0,
|
|
102
|
-
...a
|
|
103
|
-
} = o;
|
|
104
|
-
return Oe(
|
|
105
|
-
e,
|
|
106
|
-
t,
|
|
107
|
-
{
|
|
108
|
-
...a,
|
|
109
|
-
eventFilter: re(n, { maxWait: f })
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
function Ie(e, t, o) {
|
|
114
|
-
return L(
|
|
115
|
-
e,
|
|
116
|
-
t,
|
|
117
|
-
{
|
|
118
|
-
...o,
|
|
119
|
-
immediate: !0
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
const P = ie ? window : void 0;
|
|
124
|
-
function E(e) {
|
|
125
|
-
var t;
|
|
126
|
-
const o = g(e);
|
|
127
|
-
return (t = o == null ? void 0 : o.$el) != null ? t : o;
|
|
20
|
+
function ye() {
|
|
21
|
+
$ == null || $(), $ = void 0;
|
|
128
22
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return [
|
|
139
|
-
(r = (i = f.value) == null ? void 0 : i.map((c) => E(c))) != null ? r : [P].filter((c) => c != null),
|
|
140
|
-
D(g(f.value ? e[1] : e[0])),
|
|
141
|
-
D(he(f.value ? e[2] : e[1])),
|
|
142
|
-
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
143
|
-
g(f.value ? e[3] : e[2])
|
|
144
|
-
];
|
|
145
|
-
},
|
|
146
|
-
([i, r, c, u]) => {
|
|
147
|
-
if (o(), !(i != null && i.length) || !(r != null && r.length) || !(c != null && c.length))
|
|
148
|
-
return;
|
|
149
|
-
const s = ge(u) ? { ...u } : u;
|
|
150
|
-
t.push(
|
|
151
|
-
...i.flatMap(
|
|
152
|
-
(v) => r.flatMap(
|
|
153
|
-
(h) => c.map((b) => n(v, h, b, s))
|
|
154
|
-
)
|
|
155
|
-
)
|
|
156
|
-
);
|
|
157
|
-
},
|
|
158
|
-
{ flush: "post" }
|
|
159
|
-
), d = () => {
|
|
160
|
-
a(), o();
|
|
161
|
-
};
|
|
162
|
-
return N(o), d;
|
|
163
|
-
}
|
|
164
|
-
let ee = !1;
|
|
165
|
-
function Ce(e, t, o = {}) {
|
|
166
|
-
const { window: n = P, ignore: f = [], capture: a = !0, detectIframe: d = !1, controls: i = !1 } = o;
|
|
167
|
-
if (!n)
|
|
168
|
-
return i ? { stop: M, cancel: M, trigger: M } : M;
|
|
169
|
-
if (ye && !ee) {
|
|
170
|
-
ee = !0;
|
|
171
|
-
const l = { passive: !0 };
|
|
172
|
-
Array.from(n.document.body.children).forEach((m) => m.addEventListener("click", M, l)), n.document.documentElement.addEventListener("click", M, l);
|
|
173
|
-
}
|
|
174
|
-
let r = !0;
|
|
175
|
-
const c = (l) => g(f).some((m) => {
|
|
176
|
-
if (typeof m == "string")
|
|
177
|
-
return Array.from(n.document.querySelectorAll(m)).some((w) => w === l.target || l.composedPath().includes(w));
|
|
178
|
-
{
|
|
179
|
-
const w = E(m);
|
|
180
|
-
return w && (l.target === w || l.composedPath().includes(w));
|
|
181
|
-
}
|
|
23
|
+
function he() {
|
|
24
|
+
return typeof window > "u" ? {
|
|
25
|
+
isTouchDevice: D
|
|
26
|
+
} : (ee(() => {
|
|
27
|
+
T++, T === 1 && ($ = ge());
|
|
28
|
+
}), te(() => {
|
|
29
|
+
T = Math.max(0, T - 1), T === 0 && ye();
|
|
30
|
+
}), {
|
|
31
|
+
isTouchDevice: D
|
|
182
32
|
});
|
|
183
|
-
function u(l) {
|
|
184
|
-
const m = g(l);
|
|
185
|
-
return m && m.$.subTree.shapeFlag === 16;
|
|
186
|
-
}
|
|
187
|
-
function s(l, m) {
|
|
188
|
-
const w = g(l), T = w.$.subTree && w.$.subTree.children;
|
|
189
|
-
return T == null || !Array.isArray(T) ? !1 : T.some((x) => x.el === m.target || m.composedPath().includes(x.el));
|
|
190
|
-
}
|
|
191
|
-
const v = (l) => {
|
|
192
|
-
const m = E(e);
|
|
193
|
-
if (l.target != null && !(!(m instanceof Element) && u(e) && s(e, l)) && !(!m || m === l.target || l.composedPath().includes(m))) {
|
|
194
|
-
if ("detail" in l && l.detail === 0 && (r = !c(l)), !r) {
|
|
195
|
-
r = !0;
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
t(l);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
let h = !1;
|
|
202
|
-
const b = [
|
|
203
|
-
I(n, "click", (l) => {
|
|
204
|
-
h || (h = !0, setTimeout(() => {
|
|
205
|
-
h = !1;
|
|
206
|
-
}, 0), v(l));
|
|
207
|
-
}, { passive: !0, capture: a }),
|
|
208
|
-
I(n, "pointerdown", (l) => {
|
|
209
|
-
const m = E(e);
|
|
210
|
-
r = !c(l) && !!(m && !l.composedPath().includes(m));
|
|
211
|
-
}, { passive: !0 }),
|
|
212
|
-
d && I(n, "blur", (l) => {
|
|
213
|
-
setTimeout(() => {
|
|
214
|
-
var m;
|
|
215
|
-
const w = E(e);
|
|
216
|
-
((m = n.document.activeElement) == null ? void 0 : m.tagName) === "IFRAME" && !(w != null && w.contains(n.document.activeElement)) && t(l);
|
|
217
|
-
}, 0);
|
|
218
|
-
}, { passive: !0 })
|
|
219
|
-
].filter(Boolean), S = () => b.forEach((l) => l());
|
|
220
|
-
return i ? {
|
|
221
|
-
stop: S,
|
|
222
|
-
cancel: () => {
|
|
223
|
-
r = !1;
|
|
224
|
-
},
|
|
225
|
-
trigger: (l) => {
|
|
226
|
-
r = !0, v(l), r = !1;
|
|
227
|
-
}
|
|
228
|
-
} : S;
|
|
229
|
-
}
|
|
230
|
-
function Re() {
|
|
231
|
-
const e = y(!1), t = B();
|
|
232
|
-
return t && ne(() => {
|
|
233
|
-
e.value = !0;
|
|
234
|
-
}, t), e;
|
|
235
|
-
}
|
|
236
|
-
function G(e) {
|
|
237
|
-
const t = Re();
|
|
238
|
-
return _(() => (t.value, !!e()));
|
|
239
|
-
}
|
|
240
|
-
function se(e, t, o = {}) {
|
|
241
|
-
const { window: n = P, ...f } = o;
|
|
242
|
-
let a;
|
|
243
|
-
const d = G(() => n && "MutationObserver" in n), i = () => {
|
|
244
|
-
a && (a.disconnect(), a = void 0);
|
|
245
|
-
}, r = _(() => {
|
|
246
|
-
const v = g(e), h = D(v).map(E).filter(be);
|
|
247
|
-
return new Set(h);
|
|
248
|
-
}), c = L(
|
|
249
|
-
() => r.value,
|
|
250
|
-
(v) => {
|
|
251
|
-
i(), d.value && v.size && (a = new MutationObserver(t), v.forEach((h) => a.observe(h, f)));
|
|
252
|
-
},
|
|
253
|
-
{ immediate: !0, flush: "post" }
|
|
254
|
-
), u = () => a == null ? void 0 : a.takeRecords(), s = () => {
|
|
255
|
-
c(), i();
|
|
256
|
-
};
|
|
257
|
-
return N(s), {
|
|
258
|
-
isSupported: d,
|
|
259
|
-
stop: s,
|
|
260
|
-
takeRecords: u
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const _e = Symbol("vueuse-ssr-width");
|
|
264
|
-
function Pe() {
|
|
265
|
-
const e = oe() ? pe(_e, null) : null;
|
|
266
|
-
return typeof e == "number" ? e : void 0;
|
|
267
|
-
}
|
|
268
|
-
function Ae(e, t = {}) {
|
|
269
|
-
const { window: o = P, ssrWidth: n = Pe() } = t, f = G(() => o && "matchMedia" in o && typeof o.matchMedia == "function"), a = y(typeof n == "number"), d = y(), i = y(!1), r = (c) => {
|
|
270
|
-
i.value = c.matches;
|
|
271
|
-
};
|
|
272
|
-
return me(() => {
|
|
273
|
-
if (a.value) {
|
|
274
|
-
a.value = !f.value;
|
|
275
|
-
const c = g(e).split(",");
|
|
276
|
-
i.value = c.some((u) => {
|
|
277
|
-
const s = u.includes("not all"), v = u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), h = u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
278
|
-
let b = !!(v || h);
|
|
279
|
-
return v && b && (b = n >= Z(v[1])), h && b && (b = n <= Z(h[1])), s ? !b : b;
|
|
280
|
-
});
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
f.value && (d.value = o.matchMedia(g(e)), i.value = d.value.matches);
|
|
284
|
-
}), I(d, "change", r, { passive: !0 }), _(() => i.value);
|
|
285
|
-
}
|
|
286
|
-
function le(e, t, o = {}) {
|
|
287
|
-
const { window: n = P, ...f } = o;
|
|
288
|
-
let a;
|
|
289
|
-
const d = G(() => n && "ResizeObserver" in n), i = () => {
|
|
290
|
-
a && (a.disconnect(), a = void 0);
|
|
291
|
-
}, r = _(() => {
|
|
292
|
-
const s = g(e);
|
|
293
|
-
return Array.isArray(s) ? s.map((v) => E(v)) : [E(s)];
|
|
294
|
-
}), c = L(
|
|
295
|
-
r,
|
|
296
|
-
(s) => {
|
|
297
|
-
if (i(), d.value && n) {
|
|
298
|
-
a = new ResizeObserver(t);
|
|
299
|
-
for (const v of s)
|
|
300
|
-
v && a.observe(v, f);
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
{ immediate: !0, flush: "post" }
|
|
304
|
-
), u = () => {
|
|
305
|
-
i(), c();
|
|
306
|
-
};
|
|
307
|
-
return N(u), {
|
|
308
|
-
isSupported: d,
|
|
309
|
-
stop: u
|
|
310
|
-
};
|
|
311
33
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
const w = m.getBoundingClientRect();
|
|
327
|
-
i.value = w.height, r.value = w.bottom, c.value = w.left, u.value = w.right, s.value = w.top, v.value = w.width, h.value = w.x, b.value = w.y;
|
|
34
|
+
const Ce = { class: "tr-history__empty" }, ke = { class: "tr-history__empty-icon" }, Le = { class: "tr-history__empty-text" }, Ee = /* @__PURE__ */ N({
|
|
35
|
+
__name: "Empty",
|
|
36
|
+
props: {
|
|
37
|
+
text: { default: "暂无内容" }
|
|
38
|
+
},
|
|
39
|
+
setup(i) {
|
|
40
|
+
const m = i;
|
|
41
|
+
return (t, c) => (s(), r("div", Ce, [
|
|
42
|
+
R("span", ke, [
|
|
43
|
+
b(n(ae))
|
|
44
|
+
]),
|
|
45
|
+
R("span", Le, B(m.text), 1)
|
|
46
|
+
]));
|
|
328
47
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
() => E(e),
|
|
376
|
-
(s) => {
|
|
377
|
-
d.value = s ? t.width : 0, i.value = s ? t.height : 0;
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
function u() {
|
|
381
|
-
r(), c();
|
|
48
|
+
}), we = /* @__PURE__ */ P(Ee, [["__scopeId", "data-v-d0340c39"]]), Re = ["onClick"], F = 4, xe = /* @__PURE__ */ N({
|
|
49
|
+
__name: "MenuList",
|
|
50
|
+
props: /* @__PURE__ */ K({
|
|
51
|
+
items: {},
|
|
52
|
+
menuListGap: { default: 8 }
|
|
53
|
+
}, {
|
|
54
|
+
trigger: { default: null },
|
|
55
|
+
triggerModifiers: {},
|
|
56
|
+
data: { default: null },
|
|
57
|
+
dataModifiers: {}
|
|
58
|
+
}),
|
|
59
|
+
emits: /* @__PURE__ */ K(["item-click"], ["update:trigger", "update:data"]),
|
|
60
|
+
setup(i, { emit: m }) {
|
|
61
|
+
const t = W(i, "trigger"), c = W(i, "data"), h = i, C = m, E = y(null);
|
|
62
|
+
X(
|
|
63
|
+
E,
|
|
64
|
+
() => {
|
|
65
|
+
t.value = null, c.value = null;
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
ignore: [t]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
const { top: p, bottom: I, left: g } = pe(t), { width: M, height: k } = ve(E, void 0, { box: "border-box" }), { height: w } = _e(), o = x(() => {
|
|
72
|
+
const L = {
|
|
73
|
+
left: `min(${G(g.value)}, calc(100% - ${G(M.value + F)}))`
|
|
74
|
+
}, _ = I.value + h.menuListGap;
|
|
75
|
+
return _ + k.value + F > w.value ? L.bottom = `calc(100% - ${G(p.value - h.menuListGap)})` : L.top = G(_), L;
|
|
76
|
+
}), v = (L) => {
|
|
77
|
+
C("item-click", L), t.value = null, c.value = null;
|
|
78
|
+
};
|
|
79
|
+
return (L, _) => (s(), r("ul", {
|
|
80
|
+
class: "tr-history__menu-list",
|
|
81
|
+
ref_key: "menuRef",
|
|
82
|
+
ref: E,
|
|
83
|
+
style: ne(o.value)
|
|
84
|
+
}, [
|
|
85
|
+
(s(!0), r(O, null, V(h.items, (a) => (s(), r("li", {
|
|
86
|
+
class: "tr-history__menu-list__item",
|
|
87
|
+
key: a.id,
|
|
88
|
+
onClick: (z) => v(a)
|
|
89
|
+
}, [
|
|
90
|
+
(s(), Q(oe(a.icon))),
|
|
91
|
+
R("span", null, B(a.text), 1)
|
|
92
|
+
], 8, Re))), 128))
|
|
93
|
+
], 4));
|
|
382
94
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
bottom: 0
|
|
401
|
-
},
|
|
402
|
-
observe: i = {
|
|
403
|
-
mutation: !1
|
|
404
|
-
},
|
|
405
|
-
eventListenerOptions: r = {
|
|
406
|
-
capture: !1,
|
|
407
|
-
passive: !0
|
|
408
|
-
},
|
|
409
|
-
behavior: c = "auto",
|
|
410
|
-
window: u = P,
|
|
411
|
-
onError: s = (p) => {
|
|
412
|
-
console.error(p);
|
|
413
|
-
}
|
|
414
|
-
} = t, v = typeof i == "boolean" ? {
|
|
415
|
-
mutation: i
|
|
416
|
-
} : i, h = y(0), b = y(0), S = _({
|
|
417
|
-
get() {
|
|
418
|
-
return h.value;
|
|
419
|
-
},
|
|
420
|
-
set(p) {
|
|
421
|
-
m(p, void 0);
|
|
422
|
-
}
|
|
423
|
-
}), l = _({
|
|
424
|
-
get() {
|
|
425
|
-
return b.value;
|
|
426
|
-
},
|
|
427
|
-
set(p) {
|
|
428
|
-
m(void 0, p);
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
function m(p, A) {
|
|
432
|
-
var W, C, k, V;
|
|
433
|
-
if (!u)
|
|
434
|
-
return;
|
|
435
|
-
const O = g(e);
|
|
436
|
-
if (!O)
|
|
437
|
-
return;
|
|
438
|
-
(k = O instanceof Document ? u.document.body : O) == null || k.scrollTo({
|
|
439
|
-
top: (W = g(A)) != null ? W : l.value,
|
|
440
|
-
left: (C = g(p)) != null ? C : S.value,
|
|
441
|
-
behavior: g(c)
|
|
95
|
+
}), Ie = /* @__PURE__ */ P(xe, [["__scopeId", "data-v-c8365732"]]), Me = ({
|
|
96
|
+
renameControlOnClickOutside: i,
|
|
97
|
+
onItemTitleChange: m
|
|
98
|
+
}) => {
|
|
99
|
+
const t = y(void 0), c = y(null), h = x(() => {
|
|
100
|
+
var o;
|
|
101
|
+
return (o = c.value) == null ? void 0 : o.at(0);
|
|
102
|
+
}), C = y(null), E = x(() => {
|
|
103
|
+
var o;
|
|
104
|
+
return (o = C.value) == null ? void 0 : o.at(0);
|
|
105
|
+
}), p = y(null), I = x(() => {
|
|
106
|
+
var o;
|
|
107
|
+
return (o = p.value) == null ? void 0 : o.at(0);
|
|
108
|
+
}), g = y(""), M = (o) => {
|
|
109
|
+
t.value = o, g.value = o.title, ie(() => {
|
|
110
|
+
const v = h.value;
|
|
111
|
+
v && (v.focus(), v.select());
|
|
442
112
|
});
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
left: !0,
|
|
448
|
-
right: !1,
|
|
449
|
-
top: !0,
|
|
450
|
-
bottom: !1
|
|
451
|
-
}), x = K({
|
|
452
|
-
left: !1,
|
|
453
|
-
right: !1,
|
|
454
|
-
top: !1,
|
|
455
|
-
bottom: !1
|
|
456
|
-
}), Y = (p) => {
|
|
457
|
-
w.value && (w.value = !1, x.left = !1, x.right = !1, x.top = !1, x.bottom = !1, f(p));
|
|
458
|
-
}, ue = We(Y, o + n), j = (p) => {
|
|
459
|
-
var A;
|
|
460
|
-
if (!u)
|
|
461
|
-
return;
|
|
462
|
-
const W = ((A = p == null ? void 0 : p.document) == null ? void 0 : A.documentElement) || (p == null ? void 0 : p.documentElement) || E(p), { display: C, flexDirection: k, direction: V } = getComputedStyle(W), O = V === "rtl" ? -1 : 1, R = W.scrollLeft;
|
|
463
|
-
x.left = R < h.value, x.right = R > h.value;
|
|
464
|
-
const X = Math.abs(R * O) <= (d.left || 0), U = Math.abs(R * O) + W.clientWidth >= W.scrollWidth - (d.right || 0) - te;
|
|
465
|
-
C === "flex" && k === "row-reverse" ? (T.left = U, T.right = X) : (T.left = X, T.right = U), h.value = R;
|
|
466
|
-
let F = W.scrollTop;
|
|
467
|
-
p === u.document && !F && (F = u.document.body.scrollTop), x.top = F < b.value, x.bottom = F > b.value;
|
|
468
|
-
const q = Math.abs(F) <= (d.top || 0), J = Math.abs(F) + W.clientHeight >= W.scrollHeight - (d.bottom || 0) - te;
|
|
469
|
-
C === "flex" && k === "column-reverse" ? (T.top = J, T.bottom = q) : (T.top = q, T.bottom = J), b.value = F;
|
|
470
|
-
}, Q = (p) => {
|
|
471
|
-
var A;
|
|
472
|
-
if (!u)
|
|
473
|
-
return;
|
|
474
|
-
const W = (A = p.target.documentElement) != null ? A : p.target;
|
|
475
|
-
j(W), w.value = !0, ue(p), a(p);
|
|
113
|
+
}, k = () => {
|
|
114
|
+
t.value = void 0, g.value = "";
|
|
115
|
+
}, w = () => {
|
|
116
|
+
t.value && m(g.value, t.value), t.value = void 0, g.value = "";
|
|
476
117
|
};
|
|
477
|
-
return
|
|
478
|
-
|
|
479
|
-
"scroll",
|
|
480
|
-
o ? Me(Q, o, !0, !1) : Q,
|
|
481
|
-
r
|
|
482
|
-
), z(() => {
|
|
483
|
-
try {
|
|
484
|
-
const p = g(e);
|
|
485
|
-
if (!p)
|
|
486
|
-
return;
|
|
487
|
-
j(p);
|
|
488
|
-
} catch (p) {
|
|
489
|
-
s(p);
|
|
490
|
-
}
|
|
491
|
-
}), v != null && v.mutation && e != null && e !== u && e !== document && se(
|
|
492
|
-
e,
|
|
118
|
+
return (i === "confirm" || i === "cancel") && X(
|
|
119
|
+
h,
|
|
493
120
|
() => {
|
|
494
|
-
|
|
495
|
-
p && j(p);
|
|
121
|
+
i === "confirm" ? w() : k();
|
|
496
122
|
},
|
|
497
|
-
{
|
|
498
|
-
attributes: !0,
|
|
499
|
-
childList: !0,
|
|
500
|
-
subtree: !0
|
|
501
|
-
}
|
|
502
|
-
), I(
|
|
503
|
-
e,
|
|
504
|
-
"scrollend",
|
|
505
|
-
Y,
|
|
506
|
-
r
|
|
123
|
+
{ ignore: [E, I] }
|
|
507
124
|
), {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function Ve(e = {}) {
|
|
520
|
-
const {
|
|
521
|
-
window: t = P,
|
|
522
|
-
initialWidth: o = Number.POSITIVE_INFINITY,
|
|
523
|
-
initialHeight: n = Number.POSITIVE_INFINITY,
|
|
524
|
-
listenOrientation: f = !0,
|
|
525
|
-
includeScrollbar: a = !0,
|
|
526
|
-
type: d = "inner"
|
|
527
|
-
} = e, i = y(o), r = y(n), c = () => {
|
|
528
|
-
if (t)
|
|
529
|
-
if (d === "outer")
|
|
530
|
-
i.value = t.outerWidth, r.value = t.outerHeight;
|
|
531
|
-
else if (d === "visual" && t.visualViewport) {
|
|
532
|
-
const { width: s, height: v, scale: h } = t.visualViewport;
|
|
533
|
-
i.value = Math.round(s * h), r.value = Math.round(v * h);
|
|
534
|
-
} else a ? (i.value = t.innerWidth, r.value = t.innerHeight) : (i.value = t.document.documentElement.clientWidth, r.value = t.document.documentElement.clientHeight);
|
|
125
|
+
editingItem: t,
|
|
126
|
+
editorRefList: c,
|
|
127
|
+
editorConfirmRefList: C,
|
|
128
|
+
editorCancelRefList: p,
|
|
129
|
+
editorValue: g,
|
|
130
|
+
handleEdit: M,
|
|
131
|
+
handleEditCancel: k,
|
|
132
|
+
handleEditConfirm: w
|
|
535
133
|
};
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
134
|
+
}, J = Symbol("NO_GROUP"), Te = {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: "tr-history__group-title"
|
|
137
|
+
}, be = { class: "tr-history__group-items" }, $e = ["onClick"], Ge = ["title"], Oe = ["onClick"], Be = /* @__PURE__ */ N({
|
|
138
|
+
__name: "index",
|
|
139
|
+
props: {
|
|
140
|
+
data: {},
|
|
141
|
+
selected: {},
|
|
142
|
+
showRenameControls: { type: Boolean, default: !1 },
|
|
143
|
+
renameControlOnClickOutside: { default: "confirm" },
|
|
144
|
+
menuItems: { default: () => [
|
|
145
|
+
{ id: "rename", text: "重命名", icon: ue },
|
|
146
|
+
{ id: "delete", text: "删除", icon: ce }
|
|
147
|
+
] },
|
|
148
|
+
menuListGap: { default: 8 }
|
|
149
|
+
},
|
|
150
|
+
emits: ["item-click", "item-title-change", "item-action"],
|
|
151
|
+
setup(i, { emit: m }) {
|
|
152
|
+
const t = i, c = m, h = (l) => {
|
|
153
|
+
var f;
|
|
154
|
+
const e = typeof ((f = l[0]) == null ? void 0 : f.group);
|
|
155
|
+
return e === "string" || e === "symbol";
|
|
156
|
+
}, C = x(() => {
|
|
157
|
+
const l = t.data;
|
|
158
|
+
return h(l) ? l : [{ group: J, items: l }];
|
|
159
|
+
}), E = x(() => C.value.length === 0 || C.value.every((l) => l.items.length === 0)), {
|
|
160
|
+
editingItem: p,
|
|
161
|
+
editorRefList: I,
|
|
162
|
+
editorConfirmRefList: g,
|
|
163
|
+
editorCancelRefList: M,
|
|
164
|
+
editorValue: k,
|
|
165
|
+
handleEdit: w,
|
|
166
|
+
handleEditCancel: o,
|
|
167
|
+
handleEditConfirm: v
|
|
168
|
+
} = Me({
|
|
169
|
+
renameControlOnClickOutside: t.renameControlOnClickOutside,
|
|
170
|
+
onItemTitleChange: (l, e) => {
|
|
171
|
+
c("item-title-change", l, e);
|
|
172
|
+
}
|
|
173
|
+
}), { isTouchDevice: L } = he(), _ = y(null), a = y(null), z = (l, e) => {
|
|
174
|
+
if (l.currentTarget instanceof HTMLButtonElement) {
|
|
175
|
+
if (a.value === e) {
|
|
176
|
+
_.value = null, a.value = null;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
_.value = l.currentTarget, a.value = e;
|
|
180
|
+
} else
|
|
181
|
+
_.value = null, a.value = null;
|
|
182
|
+
}, Y = (l) => {
|
|
183
|
+
const e = a.value;
|
|
184
|
+
e && (l.id === "rename" && w(e), c("item-action", l, e));
|
|
185
|
+
};
|
|
186
|
+
return (l, e) => (s(), r("div", {
|
|
187
|
+
class: S(["tr-history", { "touch-device": n(L) }])
|
|
188
|
+
}, [
|
|
189
|
+
E.value ? (s(), Q(we, { key: 1 })) : (s(), r(O, { key: 0 }, [
|
|
190
|
+
(s(!0), r(O, null, V(C.value, (f) => (s(), r("div", {
|
|
191
|
+
class: "tr-history__group",
|
|
192
|
+
key: f.group
|
|
193
|
+
}, [
|
|
194
|
+
f.group !== n(J) ? (s(), r("div", Te, B(f.group), 1)) : U("", !0),
|
|
195
|
+
R("div", be, [
|
|
196
|
+
(s(!0), r(O, null, V(f.items, (u, Z) => (s(), r("div", {
|
|
197
|
+
class: S(["tr-history__item", {
|
|
198
|
+
selected: u.id && u.id === t.selected,
|
|
199
|
+
editing: n(p) === u,
|
|
200
|
+
active: a.value === u
|
|
201
|
+
}]),
|
|
202
|
+
key: u.id || Z,
|
|
203
|
+
onClick: (d) => c("item-click", u)
|
|
204
|
+
}, [
|
|
205
|
+
n(p) === u ? j((s(), r("input", {
|
|
206
|
+
key: 0,
|
|
207
|
+
class: "tr-history__item-editor",
|
|
208
|
+
type: "text",
|
|
209
|
+
onClick: e[0] || (e[0] = A(() => {
|
|
210
|
+
}, ["stop"])),
|
|
211
|
+
ref_for: !0,
|
|
212
|
+
ref_key: "editorRefList",
|
|
213
|
+
ref: I,
|
|
214
|
+
"onUpdate:modelValue": e[1] || (e[1] = (d) => se(k) ? k.value = d : null),
|
|
215
|
+
onKeydown: [
|
|
216
|
+
e[2] || (e[2] = q(
|
|
217
|
+
//@ts-ignore
|
|
218
|
+
(...d) => n(v) && n(v)(...d),
|
|
219
|
+
["enter"]
|
|
220
|
+
)),
|
|
221
|
+
e[3] || (e[3] = q(
|
|
222
|
+
//@ts-ignore
|
|
223
|
+
(...d) => n(o) && n(o)(...d),
|
|
224
|
+
["escape"]
|
|
225
|
+
))
|
|
226
|
+
]
|
|
227
|
+
}, null, 544)), [
|
|
228
|
+
[le, n(k)]
|
|
229
|
+
]) : (s(), r("span", {
|
|
230
|
+
key: 1,
|
|
231
|
+
class: "text",
|
|
232
|
+
title: u.title
|
|
233
|
+
}, B(u.title), 9, Ge)),
|
|
234
|
+
R("span", {
|
|
235
|
+
class: "tr-history__item-actions",
|
|
236
|
+
onClick: e[6] || (e[6] = A(() => {
|
|
237
|
+
}, ["stop"]))
|
|
238
|
+
}, [
|
|
239
|
+
t.showRenameControls && n(p) === u ? (s(), r("button", {
|
|
240
|
+
key: 0,
|
|
241
|
+
class: "editor-confirm",
|
|
242
|
+
ref_for: !0,
|
|
243
|
+
ref_key: "editorConfirmRefList",
|
|
244
|
+
ref: g,
|
|
245
|
+
onClick: e[4] || (e[4] = //@ts-ignore
|
|
246
|
+
(...d) => n(v) && n(v)(...d))
|
|
247
|
+
}, [
|
|
248
|
+
b(n(de))
|
|
249
|
+
], 512)) : U("", !0),
|
|
250
|
+
t.showRenameControls && n(p) === u ? (s(), r("button", {
|
|
251
|
+
key: 1,
|
|
252
|
+
class: "editor-cancel",
|
|
253
|
+
ref_for: !0,
|
|
254
|
+
ref_key: "editorCancelRefList",
|
|
255
|
+
ref: M,
|
|
256
|
+
onClick: e[5] || (e[5] = //@ts-ignore
|
|
257
|
+
(...d) => n(o) && n(o)(...d))
|
|
258
|
+
}, [
|
|
259
|
+
b(n(me))
|
|
260
|
+
], 512)) : U("", !0),
|
|
261
|
+
R("button", {
|
|
262
|
+
class: S(["menu", { hidden: n(p) === u }]),
|
|
263
|
+
onClick: (d) => z(d, u)
|
|
264
|
+
}, [
|
|
265
|
+
b(n(fe))
|
|
266
|
+
], 10, Oe)
|
|
267
|
+
])
|
|
268
|
+
], 10, $e))), 128))
|
|
269
|
+
])
|
|
270
|
+
]))), 128)),
|
|
271
|
+
j(b(Ie, {
|
|
272
|
+
trigger: _.value,
|
|
273
|
+
"onUpdate:trigger": e[7] || (e[7] = (f) => _.value = f),
|
|
274
|
+
data: a.value,
|
|
275
|
+
"onUpdate:data": e[8] || (e[8] = (f) => a.value = f),
|
|
276
|
+
items: t.menuItems,
|
|
277
|
+
"menu-list-gap": t.menuListGap,
|
|
278
|
+
onItemClick: Y
|
|
279
|
+
}, null, 8, ["trigger", "data", "items", "menu-list-gap"]), [
|
|
280
|
+
[re, _.value]
|
|
281
|
+
])
|
|
282
|
+
], 64))
|
|
283
|
+
], 2));
|
|
541
284
|
}
|
|
542
|
-
|
|
543
|
-
|
|
285
|
+
}), H = /* @__PURE__ */ P(Be, [["__scopeId", "data-v-b8f23455"]]), De = function(i) {
|
|
286
|
+
i.component(H.name, H);
|
|
287
|
+
};
|
|
288
|
+
Object.assign(H, {
|
|
289
|
+
name: "TrHistory",
|
|
290
|
+
install: De
|
|
291
|
+
});
|
|
544
292
|
export {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
ke as c,
|
|
548
|
-
Ae as d,
|
|
549
|
-
Ce as o,
|
|
550
|
-
je as u,
|
|
551
|
-
Le as w
|
|
293
|
+
H,
|
|
294
|
+
he as u
|
|
552
295
|
};
|