@opentiny/tiny-robot 0.4.2-alpha.7 → 0.4.2-alpha.9
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/bubble/index.js +10 -9
- package/dist/index.d.ts +1130 -909
- package/dist/index.js +129 -118
- package/dist/index4.js +380 -317
- package/dist/index5.js +240 -187
- package/dist/index6.js +565 -514
- package/dist/layout/index.js +1243 -0
- package/dist/sender/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,1243 @@
|
|
|
1
|
+
import { toValue as q, shallowRef as C, computed as f, provide as Ne, inject as $e, defineComponent as k, openBlock as E, createElementBlock as I, normalizeClass as K, createElementVNode as B, ref as ee, createBlock as X, createCommentVNode as N, renderSlot as $, Fragment as Le, renderList as Be, useAttrs as Ye, watch as ze, Teleport as Ve, mergeProps as Xe, unref as Z, createVNode as Ge, isVNode as Ue, Comment as qe, Text as Ze, useSlots as je, isRef as Ke, normalizeStyle as He, withCtx as pe, normalizeProps as Je, guardReactiveProps as Qe, createTextVNode as et, toDisplayString as tt, onBeforeUnmount as nt } from "vue";
|
|
2
|
+
import { g as V, t as at, m as it, b as lt, a as rt, j as De, n as ot } from "../index4.js";
|
|
3
|
+
import { _ as Y } from "../_plugin-vue_export-helper.js";
|
|
4
|
+
function We(e) {
|
|
5
|
+
const t = q(e.value) !== void 0, n = C(q(e.defaultValue));
|
|
6
|
+
return f({
|
|
7
|
+
get() {
|
|
8
|
+
return t ? q(e.value) : n.value;
|
|
9
|
+
},
|
|
10
|
+
set(a) {
|
|
11
|
+
var l;
|
|
12
|
+
t || (n.value = a), (l = e.onChange) == null || l.call(e, a);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const st = [0];
|
|
17
|
+
function Re(e, t) {
|
|
18
|
+
const n = C(null), a = C(null), l = C(null), c = C(null);
|
|
19
|
+
function x(d) {
|
|
20
|
+
const h = q(t.buttons) ?? st, s = d.currentTarget instanceof HTMLElement ? d.currentTarget : null;
|
|
21
|
+
if (!s || n.value || q(t.disabled) || !d.isPrimary || !h.includes(d.button))
|
|
22
|
+
return;
|
|
23
|
+
const v = t.onStart(d);
|
|
24
|
+
if (v) {
|
|
25
|
+
n.value = v, a.value = d.pointerId, l.value = s, c.value = s.ownerDocument.defaultView;
|
|
26
|
+
try {
|
|
27
|
+
s.setPointerCapture(d.pointerId);
|
|
28
|
+
} catch {
|
|
29
|
+
u("manual");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function g(d) {
|
|
34
|
+
var s;
|
|
35
|
+
const h = n.value;
|
|
36
|
+
!h || d.pointerId !== a.value || (s = t.onMove) == null || s.call(t, h, d);
|
|
37
|
+
}
|
|
38
|
+
function u(d, h) {
|
|
39
|
+
var o;
|
|
40
|
+
const s = n.value;
|
|
41
|
+
if (!s || h && h.pointerId !== a.value)
|
|
42
|
+
return;
|
|
43
|
+
const v = a.value, i = l.value;
|
|
44
|
+
n.value = null, a.value = null, l.value = null, c.value = null, i && v !== null && i.hasPointerCapture(v) && i.releasePointerCapture(v), (o = t.onEnd) == null || o.call(t, s, { reason: d, event: h });
|
|
45
|
+
}
|
|
46
|
+
return V(e, "pointerdown", x), V(c, "pointermove", g), V(c, "pointerup", (d) => {
|
|
47
|
+
u("pointerup", d);
|
|
48
|
+
}), V(c, "pointercancel", (d) => {
|
|
49
|
+
u("pointercancel", d);
|
|
50
|
+
}), at(() => {
|
|
51
|
+
u("scope-dispose");
|
|
52
|
+
}), {
|
|
53
|
+
isDragging: f(() => n.value !== null),
|
|
54
|
+
cancel: () => u("manual")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function ne(e) {
|
|
58
|
+
return e === void 0 ? void 0 : `${e}px`;
|
|
59
|
+
}
|
|
60
|
+
const ut = /^(-?(?:\d+|\d*\.\d+))px$/i, dt = /^0(?:\.0+)?$/i;
|
|
61
|
+
function ct(e, t) {
|
|
62
|
+
if (typeof e == "number" && Number.isFinite(e))
|
|
63
|
+
return e;
|
|
64
|
+
if (typeof e != "string" || !e.trim())
|
|
65
|
+
return t;
|
|
66
|
+
const n = e.trim().toLowerCase();
|
|
67
|
+
if (dt.test(n))
|
|
68
|
+
return 0;
|
|
69
|
+
const a = n.match(ut);
|
|
70
|
+
if (a) {
|
|
71
|
+
const l = Number.parseFloat(a[1]);
|
|
72
|
+
return Number.isFinite(l) ? l : t;
|
|
73
|
+
}
|
|
74
|
+
return t;
|
|
75
|
+
}
|
|
76
|
+
function Te(e, t) {
|
|
77
|
+
return {
|
|
78
|
+
value: e.getPropertyValue(t),
|
|
79
|
+
priority: e.getPropertyPriority(t)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function Fe(e, t, n) {
|
|
83
|
+
if (!n.value) {
|
|
84
|
+
e.removeProperty(t);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
e.setProperty(t, n.value, n.priority);
|
|
88
|
+
}
|
|
89
|
+
function we(e, t) {
|
|
90
|
+
const n = e.style, a = Te(n, "cursor"), l = Te(n, "user-select");
|
|
91
|
+
n.setProperty("cursor", t, "important"), n.setProperty("user-select", "none", "important");
|
|
92
|
+
let c = !1;
|
|
93
|
+
return () => {
|
|
94
|
+
c || (c = !0, Fe(n, "cursor", a), Fe(n, "user-select", l));
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function S(e, t, n) {
|
|
98
|
+
return Math.min(Math.max(e, t), n);
|
|
99
|
+
}
|
|
100
|
+
const Oe = Symbol("LayoutContext");
|
|
101
|
+
function gt(e) {
|
|
102
|
+
Ne(Oe, e);
|
|
103
|
+
}
|
|
104
|
+
function Ee() {
|
|
105
|
+
const e = $e(Oe, null);
|
|
106
|
+
if (!e)
|
|
107
|
+
throw new Error("[Layout] useLayoutContext must be used within Layout.");
|
|
108
|
+
return e;
|
|
109
|
+
}
|
|
110
|
+
function ft(e) {
|
|
111
|
+
return Ee()[e];
|
|
112
|
+
}
|
|
113
|
+
const ht = /* @__PURE__ */ k({
|
|
114
|
+
name: "LayoutAsideResizeTrigger",
|
|
115
|
+
__name: "AsideResizeTrigger",
|
|
116
|
+
props: {
|
|
117
|
+
side: {},
|
|
118
|
+
asideEl: {},
|
|
119
|
+
minWidth: {},
|
|
120
|
+
maxWidth: {},
|
|
121
|
+
oppositeDockWidth: {}
|
|
122
|
+
},
|
|
123
|
+
emits: ["width-change", "aside-resize-start", "aside-resize-end"],
|
|
124
|
+
setup(e, { emit: t }) {
|
|
125
|
+
const n = e, a = t, l = C(null), { rootEl: c } = Ee(), { isDragging: x } = Re(l, {
|
|
126
|
+
onStart: (i) => {
|
|
127
|
+
const o = n.asideEl, R = c.value;
|
|
128
|
+
if (!o || !R)
|
|
129
|
+
return null;
|
|
130
|
+
const D = u(R, o), T = R.ownerDocument.body, F = R.ownerDocument.defaultView;
|
|
131
|
+
i.preventDefault();
|
|
132
|
+
const A = d(i, D, F, we(T, "col-resize"));
|
|
133
|
+
return a("aside-resize-start", {
|
|
134
|
+
side: n.side,
|
|
135
|
+
expandedWidth: A.startWidth
|
|
136
|
+
}), A;
|
|
137
|
+
},
|
|
138
|
+
onMove: (i, o) => {
|
|
139
|
+
const R = h(i, o.clientX);
|
|
140
|
+
s(i, R);
|
|
141
|
+
},
|
|
142
|
+
onEnd: (i) => {
|
|
143
|
+
i.frameId !== null && i.view && (i.view.cancelAnimationFrame(i.frameId), i.frameId = null), v(i), i.releaseBodyInteraction(), a("aside-resize-end", {
|
|
144
|
+
side: n.side,
|
|
145
|
+
expandedWidth: i.currentWidth
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}), g = f(() => [
|
|
149
|
+
`tr-layout__resize-trigger--${n.side}`,
|
|
150
|
+
{
|
|
151
|
+
"is-dragging": x.value
|
|
152
|
+
}
|
|
153
|
+
]);
|
|
154
|
+
function u(i, o) {
|
|
155
|
+
const R = i.getBoundingClientRect(), D = getComputedStyle(i).getPropertyValue("--tr-layout-main-min-width").trim(), T = ct(D, 320), F = o.getBoundingClientRect().width, A = R.width - T - n.oppositeDockWidth;
|
|
156
|
+
return {
|
|
157
|
+
startWidth: F,
|
|
158
|
+
minWidth: n.minWidth,
|
|
159
|
+
effectiveMax: Math.max(n.minWidth, Math.min(n.maxWidth, A))
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function d(i, o, R, D) {
|
|
163
|
+
return {
|
|
164
|
+
side: n.side,
|
|
165
|
+
startX: i.clientX,
|
|
166
|
+
startWidth: o.startWidth,
|
|
167
|
+
currentWidth: o.startWidth,
|
|
168
|
+
minWidth: o.minWidth,
|
|
169
|
+
effectiveMax: o.effectiveMax,
|
|
170
|
+
pendingWidth: null,
|
|
171
|
+
frameId: null,
|
|
172
|
+
view: R,
|
|
173
|
+
releaseBodyInteraction: D
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function h(i, o) {
|
|
177
|
+
const R = o - i.startX, D = i.side === "left" ? i.startWidth + R : i.startWidth - R;
|
|
178
|
+
return S(D, i.minWidth, i.effectiveMax);
|
|
179
|
+
}
|
|
180
|
+
function s(i, o) {
|
|
181
|
+
if (o !== i.currentWidth) {
|
|
182
|
+
if (i.pendingWidth = o, i.currentWidth = o, !i.view) {
|
|
183
|
+
v(i);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
i.frameId === null && (i.frameId = i.view.requestAnimationFrame(() => {
|
|
187
|
+
i.frameId = null, v(i);
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function v(i) {
|
|
192
|
+
if (i.pendingWidth === null)
|
|
193
|
+
return;
|
|
194
|
+
const o = i.pendingWidth;
|
|
195
|
+
a("width-change", o), i.pendingWidth = null;
|
|
196
|
+
}
|
|
197
|
+
return (i, o) => (E(), I("div", {
|
|
198
|
+
ref_key: "triggerRef",
|
|
199
|
+
ref: l,
|
|
200
|
+
class: K(["tr-layout__resize-trigger", g.value]),
|
|
201
|
+
"aria-hidden": "true"
|
|
202
|
+
}, [...o[0] || (o[0] = [
|
|
203
|
+
B("span", {
|
|
204
|
+
class: "tr-layout__resize-trigger-indicator",
|
|
205
|
+
"aria-hidden": "true"
|
|
206
|
+
}, null, -1)
|
|
207
|
+
])], 2));
|
|
208
|
+
}
|
|
209
|
+
}), mt = /* @__PURE__ */ Y(ht, [["__scopeId", "data-v-f60b35e1"]]), vt = ["inert"], pt = { class: "tr-layout__aside-mask" }, yt = { class: "tr-layout__aside-body" }, xt = /* @__PURE__ */ k({
|
|
210
|
+
name: "LayoutAsideContent",
|
|
211
|
+
__name: "AsideContent",
|
|
212
|
+
props: {
|
|
213
|
+
panel: {},
|
|
214
|
+
oppositeDockWidth: {}
|
|
215
|
+
},
|
|
216
|
+
emits: ["width-change", "aside-resize-start", "aside-resize-end"],
|
|
217
|
+
setup(e, { emit: t }) {
|
|
218
|
+
const n = ee(null), a = e, l = t, c = f(() => [
|
|
219
|
+
`tr-layout__aside--${a.panel.side}`,
|
|
220
|
+
`tr-layout__aside--effect-${a.panel.collapseEffect.value}`,
|
|
221
|
+
{
|
|
222
|
+
"tr-layout__aside--dock": a.panel.isDock.value,
|
|
223
|
+
"tr-layout__aside--drawer": a.panel.isDrawer.value,
|
|
224
|
+
"tr-layout__aside--expanded": a.panel.isOpen.value,
|
|
225
|
+
"tr-layout__aside--rail": a.panel.isRail.value,
|
|
226
|
+
"tr-layout__aside--hidden": a.panel.isHidden.value
|
|
227
|
+
}
|
|
228
|
+
]);
|
|
229
|
+
return (x, g) => (E(), I("aside", {
|
|
230
|
+
ref_key: "asideRef",
|
|
231
|
+
ref: n,
|
|
232
|
+
class: K(["tr-layout__aside", c.value]),
|
|
233
|
+
inert: a.panel.isHidden.value || void 0
|
|
234
|
+
}, [
|
|
235
|
+
e.panel.canResize.value ? (E(), X(mt, {
|
|
236
|
+
key: 0,
|
|
237
|
+
side: e.panel.side,
|
|
238
|
+
"aside-el": n.value,
|
|
239
|
+
"min-width": e.panel.minExpandedWidth.value,
|
|
240
|
+
"max-width": e.panel.maxExpandedWidth.value,
|
|
241
|
+
"opposite-dock-width": e.oppositeDockWidth,
|
|
242
|
+
onWidthChange: g[0] || (g[0] = (u) => l("width-change", u)),
|
|
243
|
+
onAsideResizeStart: g[1] || (g[1] = (u) => l("aside-resize-start", u)),
|
|
244
|
+
onAsideResizeEnd: g[2] || (g[2] = (u) => l("aside-resize-end", u))
|
|
245
|
+
}, null, 8, ["side", "aside-el", "min-width", "max-width", "opposite-dock-width"])) : N("", !0),
|
|
246
|
+
B("div", pt, [
|
|
247
|
+
B("div", yt, [
|
|
248
|
+
$(x.$slots, "default", {}, void 0, !0)
|
|
249
|
+
])
|
|
250
|
+
])
|
|
251
|
+
], 10, vt));
|
|
252
|
+
}
|
|
253
|
+
}), Ce = /* @__PURE__ */ Y(xt, [["__scopeId", "data-v-76a70135"]]), ce = 420, ge = 560, j = 0, _t = j, le = 24, zt = 320, Wt = 240;
|
|
254
|
+
function Rt(e) {
|
|
255
|
+
return (e == null ? void 0 : e.placement) ?? "center";
|
|
256
|
+
}
|
|
257
|
+
function wt(e) {
|
|
258
|
+
return e !== void 0 && "x" in e && "y" in e;
|
|
259
|
+
}
|
|
260
|
+
function Et(e, t, n, a, l) {
|
|
261
|
+
switch (e) {
|
|
262
|
+
case "top-left":
|
|
263
|
+
return {
|
|
264
|
+
x: t.left + l.x,
|
|
265
|
+
y: t.top + l.y
|
|
266
|
+
};
|
|
267
|
+
case "top-right":
|
|
268
|
+
return {
|
|
269
|
+
x: t.right - n - l.x,
|
|
270
|
+
y: t.top + l.y
|
|
271
|
+
};
|
|
272
|
+
case "bottom-left":
|
|
273
|
+
return {
|
|
274
|
+
x: t.left + l.x,
|
|
275
|
+
y: t.bottom - a - l.y
|
|
276
|
+
};
|
|
277
|
+
case "bottom-right":
|
|
278
|
+
return {
|
|
279
|
+
x: t.right - n - l.x,
|
|
280
|
+
y: t.bottom - a - l.y
|
|
281
|
+
};
|
|
282
|
+
case "center":
|
|
283
|
+
default:
|
|
284
|
+
return {
|
|
285
|
+
x: (t.left + t.right - n) / 2,
|
|
286
|
+
y: (t.top + t.bottom - a) / 2
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function Ie(e) {
|
|
291
|
+
return {
|
|
292
|
+
x: (e == null ? void 0 : e.offsetX) ?? le,
|
|
293
|
+
y: (e == null ? void 0 : e.offsetY) ?? le
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function St(e, t, n) {
|
|
297
|
+
switch (n) {
|
|
298
|
+
case "top-left":
|
|
299
|
+
return {
|
|
300
|
+
x: e.x - t.left,
|
|
301
|
+
y: e.y - t.top
|
|
302
|
+
};
|
|
303
|
+
case "top-right":
|
|
304
|
+
return {
|
|
305
|
+
x: t.right - e.width - e.x,
|
|
306
|
+
y: e.y - t.top
|
|
307
|
+
};
|
|
308
|
+
case "bottom-left":
|
|
309
|
+
return {
|
|
310
|
+
x: e.x - t.left,
|
|
311
|
+
y: t.bottom - e.height - e.y
|
|
312
|
+
};
|
|
313
|
+
case "bottom-right":
|
|
314
|
+
return {
|
|
315
|
+
x: t.right - e.width - e.x,
|
|
316
|
+
y: t.bottom - e.height - e.y
|
|
317
|
+
};
|
|
318
|
+
case "center":
|
|
319
|
+
default:
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function Dt(e, t) {
|
|
324
|
+
const n = e.x + e.width / 2, a = e.y + e.height / 2, l = (t.left + t.right) / 2, c = (t.top + t.bottom) / 2, x = n <= l ? "left" : "right";
|
|
325
|
+
return `${a <= c ? "top" : "bottom"}-${x}`;
|
|
326
|
+
}
|
|
327
|
+
function ke(e, t, n, a) {
|
|
328
|
+
return {
|
|
329
|
+
x: e,
|
|
330
|
+
y: t,
|
|
331
|
+
width: n,
|
|
332
|
+
height: a
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function Tt(e = ce + j * 2, t = ge + j * 2, n = j, a = _t) {
|
|
336
|
+
return {
|
|
337
|
+
left: n,
|
|
338
|
+
top: a,
|
|
339
|
+
right: Math.max(n, e - n),
|
|
340
|
+
bottom: Math.max(a, t - n)
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function te(e, t) {
|
|
344
|
+
const n = Math.max(1, e.right - e.left), a = Math.max(1, e.bottom - e.top), l = S((t == null ? void 0 : t.minWidth) ?? zt, 1, n), c = S((t == null ? void 0 : t.minHeight) ?? Wt, 1, a);
|
|
345
|
+
return {
|
|
346
|
+
minWidth: l,
|
|
347
|
+
maxWidth: S((t == null ? void 0 : t.maxWidth) ?? n, l, n),
|
|
348
|
+
minHeight: c,
|
|
349
|
+
maxHeight: S((t == null ? void 0 : t.maxHeight) ?? a, c, a)
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function fe(e, t, n = te(t)) {
|
|
353
|
+
const a = S(e.width, n.minWidth, n.maxWidth), l = S(e.height, n.minHeight, n.maxHeight), c = Math.max(t.left, t.right - a), x = Math.max(t.top, t.bottom - l), g = S(e.x, t.left, c), u = S(e.y, t.top, x);
|
|
354
|
+
return ke(g, u, a, l);
|
|
355
|
+
}
|
|
356
|
+
function Ft(e, t, n, a = te(n)) {
|
|
357
|
+
const l = e.x + e.width, c = e.y + e.height, x = l - n.left, g = c - n.top;
|
|
358
|
+
let u = e.width, d = e.height, h = e.x, s = e.y;
|
|
359
|
+
if (t.includes("w"))
|
|
360
|
+
if (x >= a.minWidth) {
|
|
361
|
+
const i = Math.min(a.maxWidth, x);
|
|
362
|
+
u = S(e.width, a.minWidth, i), h = l - u;
|
|
363
|
+
} else
|
|
364
|
+
u = a.minWidth, h = n.left;
|
|
365
|
+
else if (t.includes("e")) {
|
|
366
|
+
const i = Math.min(a.maxWidth, Math.max(a.minWidth, n.right - e.x));
|
|
367
|
+
u = S(e.width, a.minWidth, i), h = e.x;
|
|
368
|
+
}
|
|
369
|
+
if (t.includes("n"))
|
|
370
|
+
if (g >= a.minHeight) {
|
|
371
|
+
const i = Math.min(a.maxHeight, g);
|
|
372
|
+
d = S(e.height, a.minHeight, i), s = c - d;
|
|
373
|
+
} else
|
|
374
|
+
d = a.minHeight, s = n.top;
|
|
375
|
+
else if (t.includes("s")) {
|
|
376
|
+
const i = Math.min(a.maxHeight, Math.max(a.minHeight, n.bottom - e.y));
|
|
377
|
+
d = S(e.height, a.minHeight, i), s = e.y;
|
|
378
|
+
}
|
|
379
|
+
const v = {
|
|
380
|
+
...e,
|
|
381
|
+
x: h,
|
|
382
|
+
y: s,
|
|
383
|
+
width: u,
|
|
384
|
+
height: d
|
|
385
|
+
};
|
|
386
|
+
return fe(v, n, a);
|
|
387
|
+
}
|
|
388
|
+
function Ae(e, t) {
|
|
389
|
+
const n = te(e, t), a = S((t == null ? void 0 : t.width) ?? ce, n.minWidth, n.maxWidth), l = S((t == null ? void 0 : t.height) ?? ge, n.minHeight, n.maxHeight), c = Rt(t), x = Ie(t), g = Et(c, e, a, l, x);
|
|
390
|
+
return ke(g.x, g.y, a, l);
|
|
391
|
+
}
|
|
392
|
+
function Ct(e, t) {
|
|
393
|
+
return e ? wt(e) ? fe(e, t) : Ae(t, e) : Ae(t);
|
|
394
|
+
}
|
|
395
|
+
function At(e, t, n, a = !0) {
|
|
396
|
+
const l = te(t, n), c = fe(e, t, l), x = (n == null ? void 0 : n.placement) ?? "center", u = a && x === "center" ? Dt(c, t) : x, d = St(c, t, u), h = Ie(n);
|
|
397
|
+
return {
|
|
398
|
+
placement: u,
|
|
399
|
+
offsetX: (d == null ? void 0 : d.x) ?? h.x,
|
|
400
|
+
offsetY: (d == null ? void 0 : d.y) ?? h.y,
|
|
401
|
+
width: c.width,
|
|
402
|
+
height: c.height
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function bt(e, t) {
|
|
406
|
+
return (e == null ? void 0 : e.x) === (t == null ? void 0 : t.x) && (e == null ? void 0 : e.y) === (t == null ? void 0 : t.y) && (e == null ? void 0 : e.width) === (t == null ? void 0 : t.width) && (e == null ? void 0 : e.height) === (t == null ? void 0 : t.height);
|
|
407
|
+
}
|
|
408
|
+
function Lt(e, t) {
|
|
409
|
+
return {
|
|
410
|
+
...e,
|
|
411
|
+
y: e.y + t,
|
|
412
|
+
height: e.height - t
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function Ht(e, t) {
|
|
416
|
+
return {
|
|
417
|
+
...e,
|
|
418
|
+
height: e.height + t
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function Ot(e, t) {
|
|
422
|
+
return {
|
|
423
|
+
...e,
|
|
424
|
+
width: e.width + t
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function It(e, t) {
|
|
428
|
+
return {
|
|
429
|
+
...e,
|
|
430
|
+
x: e.x + t,
|
|
431
|
+
width: e.width - t
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function kt(e) {
|
|
435
|
+
let t = { ...e.startRect };
|
|
436
|
+
return e.handle.includes("n") && (t = Lt(t, e.deltaY)), e.handle.includes("s") && (t = Ht(t, e.deltaY)), e.handle.includes("e") && (t = Ot(t, e.deltaX)), e.handle.includes("w") && (t = It(t, e.deltaX)), t;
|
|
437
|
+
}
|
|
438
|
+
const Pt = /* @__PURE__ */ k({
|
|
439
|
+
name: "FloatingDragBar",
|
|
440
|
+
__name: "FloatingDragBar",
|
|
441
|
+
props: {
|
|
442
|
+
x: {},
|
|
443
|
+
y: {},
|
|
444
|
+
canDrag: { type: Boolean }
|
|
445
|
+
},
|
|
446
|
+
emits: ["drag-start", "drag", "drag-end"],
|
|
447
|
+
setup(e, { emit: t }) {
|
|
448
|
+
const n = e, a = t, l = C(null), { rootEl: c } = Ee(), x = f(() => n.canDrag), { isDragging: g } = it(c, {
|
|
449
|
+
handle: l,
|
|
450
|
+
initialValue: { x: n.x, y: n.y },
|
|
451
|
+
preventDefault: !0,
|
|
452
|
+
buttons: [0],
|
|
453
|
+
disabled: f(() => !x.value),
|
|
454
|
+
onStart: (d) => {
|
|
455
|
+
a("drag-start", d);
|
|
456
|
+
},
|
|
457
|
+
onMove: (d) => {
|
|
458
|
+
a("drag", d);
|
|
459
|
+
},
|
|
460
|
+
onEnd: (d) => {
|
|
461
|
+
a("drag-end", d);
|
|
462
|
+
}
|
|
463
|
+
}), u = f(() => ({
|
|
464
|
+
"tr-layout__drag-bar--draggable": x.value,
|
|
465
|
+
"tr-layout__drag-bar--dragging": g.value
|
|
466
|
+
}));
|
|
467
|
+
return (d, h) => (E(), I("div", {
|
|
468
|
+
ref_key: "dragBarEl",
|
|
469
|
+
ref: l,
|
|
470
|
+
class: K(["tr-layout__drag-bar", u.value])
|
|
471
|
+
}, null, 2));
|
|
472
|
+
}
|
|
473
|
+
}), Mt = /* @__PURE__ */ Y(Pt, [["__scopeId", "data-v-8be201e5"]]), Nt = /* @__PURE__ */ k({
|
|
474
|
+
name: "FloatingResizeTrigger",
|
|
475
|
+
__name: "FloatingResizeTrigger",
|
|
476
|
+
props: {
|
|
477
|
+
handle: {},
|
|
478
|
+
active: { type: Boolean }
|
|
479
|
+
},
|
|
480
|
+
emits: ["resize-start", "resize", "resize-end"],
|
|
481
|
+
setup(e, { emit: t }) {
|
|
482
|
+
const n = {
|
|
483
|
+
s: "ns",
|
|
484
|
+
e: "ew",
|
|
485
|
+
w: "ew",
|
|
486
|
+
ne: "nesw",
|
|
487
|
+
sw: "nesw",
|
|
488
|
+
nw: "nwse",
|
|
489
|
+
se: "nwse"
|
|
490
|
+
}, a = e, l = t, c = C(null), x = f(() => [
|
|
491
|
+
`tr-layout__floating-resize-trigger--${a.handle}`,
|
|
492
|
+
`tr-layout__floating-resize-trigger--${g(a.handle)}`,
|
|
493
|
+
{
|
|
494
|
+
"is-active": a.active
|
|
495
|
+
}
|
|
496
|
+
]);
|
|
497
|
+
Re(c, {
|
|
498
|
+
onStart: (s) => {
|
|
499
|
+
const v = s.currentTarget instanceof HTMLElement ? s.currentTarget : null;
|
|
500
|
+
if (!v)
|
|
501
|
+
return null;
|
|
502
|
+
s.preventDefault();
|
|
503
|
+
const i = v.ownerDocument.body, o = {
|
|
504
|
+
startX: s.clientX,
|
|
505
|
+
startY: s.clientY,
|
|
506
|
+
lastPointerX: s.clientX,
|
|
507
|
+
lastPointerY: s.clientY,
|
|
508
|
+
releaseBodyInteraction: we(i, `${g(a.handle)}-resize`)
|
|
509
|
+
};
|
|
510
|
+
return l("resize-start", a.handle), o;
|
|
511
|
+
},
|
|
512
|
+
onMove: (s, v) => {
|
|
513
|
+
v.clientX === s.lastPointerX && v.clientY === s.lastPointerY || d(s, v.clientX, v.clientY);
|
|
514
|
+
},
|
|
515
|
+
onEnd: (s) => {
|
|
516
|
+
s.releaseBodyInteraction(), h(s);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
function g(s) {
|
|
520
|
+
return n[s];
|
|
521
|
+
}
|
|
522
|
+
function u(s, v, i) {
|
|
523
|
+
const o = v - s.startX, R = i - s.startY;
|
|
524
|
+
return [o, R];
|
|
525
|
+
}
|
|
526
|
+
function d(s, v, i) {
|
|
527
|
+
const [o, R] = u(s, v, i);
|
|
528
|
+
s.lastPointerX = v, s.lastPointerY = i, l("resize", a.handle, o, R);
|
|
529
|
+
}
|
|
530
|
+
function h(s) {
|
|
531
|
+
const [v, i] = u(s, s.lastPointerX, s.lastPointerY);
|
|
532
|
+
l("resize-end", a.handle, v, i);
|
|
533
|
+
}
|
|
534
|
+
return (s, v) => (E(), I("div", {
|
|
535
|
+
ref_key: "triggerRef",
|
|
536
|
+
ref: c,
|
|
537
|
+
class: K(["tr-layout__floating-resize-trigger", x.value]),
|
|
538
|
+
"aria-hidden": "true"
|
|
539
|
+
}, [...v[0] || (v[0] = [
|
|
540
|
+
B("span", {
|
|
541
|
+
class: "tr-layout__floating-resize-trigger-indicator",
|
|
542
|
+
"aria-hidden": "true"
|
|
543
|
+
}, null, -1)
|
|
544
|
+
])], 2));
|
|
545
|
+
}
|
|
546
|
+
}), $t = /* @__PURE__ */ Y(Nt, [["__scopeId", "data-v-c9536bd0"]]), Bt = /* @__PURE__ */ k({
|
|
547
|
+
name: "FloatingResizeTriggers",
|
|
548
|
+
__name: "FloatingResizeTriggers",
|
|
549
|
+
props: {
|
|
550
|
+
handles: {}
|
|
551
|
+
},
|
|
552
|
+
emits: ["resize-start", "resize", "resize-end"],
|
|
553
|
+
setup(e, { emit: t }) {
|
|
554
|
+
const n = e, a = t, l = C(null);
|
|
555
|
+
function c(u) {
|
|
556
|
+
l.value = u, a("resize-start", u);
|
|
557
|
+
}
|
|
558
|
+
function x(u, d, h) {
|
|
559
|
+
a("resize", u, d, h);
|
|
560
|
+
}
|
|
561
|
+
function g(u, d, h) {
|
|
562
|
+
a("resize-end", u, d, h), l.value = null;
|
|
563
|
+
}
|
|
564
|
+
return (u, d) => (E(!0), I(Le, null, Be(n.handles, (h) => (E(), X($t, {
|
|
565
|
+
key: h,
|
|
566
|
+
handle: h,
|
|
567
|
+
active: l.value === h,
|
|
568
|
+
onResizeStart: c,
|
|
569
|
+
onResize: x,
|
|
570
|
+
onResizeEnd: g
|
|
571
|
+
}, null, 8, ["handle", "active"]))), 128));
|
|
572
|
+
}
|
|
573
|
+
}), Yt = /* @__PURE__ */ k({
|
|
574
|
+
name: "LayoutSurface",
|
|
575
|
+
inheritAttrs: !1,
|
|
576
|
+
__name: "LayoutSurface",
|
|
577
|
+
props: {
|
|
578
|
+
mode: {},
|
|
579
|
+
floatingState: {},
|
|
580
|
+
floatingOptions: {}
|
|
581
|
+
},
|
|
582
|
+
emits: ["update:floatingState", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end"],
|
|
583
|
+
setup(e, { expose: t, emit: n }) {
|
|
584
|
+
const a = ["s", "e", "w", "ne", "nw", "se", "sw"], l = e, c = n, x = Ye(), g = ee(null), { width: u, height: d } = lt({
|
|
585
|
+
type: "visual",
|
|
586
|
+
initialWidth: ce + j * 2,
|
|
587
|
+
initialHeight: ge + j * 2
|
|
588
|
+
}), h = f(() => Tt(u.value, d.value)), s = f(() => l.mode === "floating"), v = f(() => {
|
|
589
|
+
if (!(!s.value || !l.floatingState))
|
|
590
|
+
return {
|
|
591
|
+
...l.floatingOptions,
|
|
592
|
+
...l.floatingState
|
|
593
|
+
};
|
|
594
|
+
}), i = f(() => te(h.value, v.value)), o = f(() => Ct(v.value, h.value)), R = f(() => {
|
|
595
|
+
var r;
|
|
596
|
+
return ((r = v.value) == null ? void 0 : r.draggable) ?? !0;
|
|
597
|
+
}), D = f(() => {
|
|
598
|
+
var r;
|
|
599
|
+
return ((r = v.value) == null ? void 0 : r.resizable) === !0;
|
|
600
|
+
}), T = C(null), F = C(null), A = f(() => T.value !== null), m = f(() => F.value !== null), w = f(() => A.value || m.value), G = f(() => s.value && R.value && !m.value), y = f(() => !s.value || !D.value ? [] : a), _ = f(() => s.value ? {
|
|
601
|
+
left: `${o.value.x}px`,
|
|
602
|
+
top: `${o.value.y}px`,
|
|
603
|
+
width: `${o.value.width}px`,
|
|
604
|
+
height: `${o.value.height}px`
|
|
605
|
+
} : {});
|
|
606
|
+
function W(r) {
|
|
607
|
+
return At(r, h.value, v.value);
|
|
608
|
+
}
|
|
609
|
+
function b(r) {
|
|
610
|
+
const p = fe(r, h.value, i.value);
|
|
611
|
+
return bt(o.value, p) || c("update:floatingState", W(p)), p;
|
|
612
|
+
}
|
|
613
|
+
function H(r, p) {
|
|
614
|
+
return b({
|
|
615
|
+
...p,
|
|
616
|
+
x: r.x,
|
|
617
|
+
y: r.y
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
function L(r, p, z, O) {
|
|
621
|
+
const M = kt({
|
|
622
|
+
handle: r,
|
|
623
|
+
deltaX: p,
|
|
624
|
+
deltaY: z,
|
|
625
|
+
startRect: O
|
|
626
|
+
}), Me = Ft(M, r, h.value, i.value);
|
|
627
|
+
return b(Me);
|
|
628
|
+
}
|
|
629
|
+
function U() {
|
|
630
|
+
T.value = o.value, c("floating-drag-start", W(T.value));
|
|
631
|
+
}
|
|
632
|
+
function P(r) {
|
|
633
|
+
const p = T.value ?? o.value, z = H(r, p);
|
|
634
|
+
c("floating-drag", W(z));
|
|
635
|
+
}
|
|
636
|
+
function J(r) {
|
|
637
|
+
const p = T.value ?? o.value, z = H(r, p);
|
|
638
|
+
c("floating-drag-end", W(z)), T.value = null;
|
|
639
|
+
}
|
|
640
|
+
function Q(r) {
|
|
641
|
+
F.value = o.value, c("floating-resize-start", {
|
|
642
|
+
...W(o.value),
|
|
643
|
+
handle: r
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function me(r, p, z) {
|
|
647
|
+
const O = F.value ?? o.value, M = L(r, p, z, O);
|
|
648
|
+
c("floating-resize", {
|
|
649
|
+
...W(M),
|
|
650
|
+
handle: r
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
function ve(r, p, z) {
|
|
654
|
+
const O = F.value ?? o.value, M = L(r, p, z, O);
|
|
655
|
+
c("floating-resize-end", {
|
|
656
|
+
...W(M),
|
|
657
|
+
handle: r
|
|
658
|
+
}), F.value = null;
|
|
659
|
+
}
|
|
660
|
+
return ze(
|
|
661
|
+
[v, u, d],
|
|
662
|
+
() => {
|
|
663
|
+
!s.value || w.value || b(o.value);
|
|
664
|
+
},
|
|
665
|
+
{ immediate: !0 }
|
|
666
|
+
), t({
|
|
667
|
+
rootEl: g
|
|
668
|
+
}), (r, p) => (E(), X(Ve, {
|
|
669
|
+
to: "body",
|
|
670
|
+
disabled: !s.value
|
|
671
|
+
}, [
|
|
672
|
+
B("div", Xe({
|
|
673
|
+
ref_key: "rootEl",
|
|
674
|
+
ref: g
|
|
675
|
+
}, Z(x), {
|
|
676
|
+
class: ["tr-layout", {
|
|
677
|
+
"tr-layout--floating": s.value,
|
|
678
|
+
"tr-layout--no-select": w.value
|
|
679
|
+
}],
|
|
680
|
+
style: _.value
|
|
681
|
+
}), [
|
|
682
|
+
s.value ? (E(), X(Mt, {
|
|
683
|
+
key: 0,
|
|
684
|
+
x: o.value.x,
|
|
685
|
+
y: o.value.y,
|
|
686
|
+
"can-drag": G.value,
|
|
687
|
+
onDragStart: U,
|
|
688
|
+
onDrag: P,
|
|
689
|
+
onDragEnd: J
|
|
690
|
+
}, null, 8, ["x", "y", "can-drag"])) : N("", !0),
|
|
691
|
+
$(r.$slots, "default", {}, void 0, !0),
|
|
692
|
+
Ge(Bt, {
|
|
693
|
+
handles: y.value,
|
|
694
|
+
onResizeStart: Q,
|
|
695
|
+
onResize: me,
|
|
696
|
+
onResizeEnd: ve
|
|
697
|
+
}, null, 8, ["handles"])
|
|
698
|
+
], 16)
|
|
699
|
+
], 8, ["disabled"]));
|
|
700
|
+
}
|
|
701
|
+
}), Vt = /* @__PURE__ */ Y(Yt, [["__scopeId", "data-v-9e8f161f"]]), he = {
|
|
702
|
+
left: {
|
|
703
|
+
open: !0,
|
|
704
|
+
minWidth: 200,
|
|
705
|
+
expandedWidth: 300,
|
|
706
|
+
maxWidth: 560
|
|
707
|
+
},
|
|
708
|
+
right: {
|
|
709
|
+
open: !1,
|
|
710
|
+
minWidth: 240,
|
|
711
|
+
expandedWidth: 320,
|
|
712
|
+
maxWidth: 640
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
function Xt(e) {
|
|
716
|
+
return he[e].open;
|
|
717
|
+
}
|
|
718
|
+
function Gt(e) {
|
|
719
|
+
return he[e].minWidth;
|
|
720
|
+
}
|
|
721
|
+
function Ut(e) {
|
|
722
|
+
return he[e].expandedWidth;
|
|
723
|
+
}
|
|
724
|
+
function qt(e) {
|
|
725
|
+
return he[e].maxWidth;
|
|
726
|
+
}
|
|
727
|
+
function ae(e, t) {
|
|
728
|
+
return typeof e != "number" || !Number.isFinite(e) ? t : Math.max(0, e);
|
|
729
|
+
}
|
|
730
|
+
function be(e) {
|
|
731
|
+
const { side: t } = e, n = f(() => q(e.config)), a = f(() => {
|
|
732
|
+
var m;
|
|
733
|
+
return ((m = n.value) == null ? void 0 : m.mode) ?? "dock";
|
|
734
|
+
}), l = f(() => {
|
|
735
|
+
var m;
|
|
736
|
+
return ae((m = n.value) == null ? void 0 : m.collapsedWidth, 0);
|
|
737
|
+
}), c = f(() => {
|
|
738
|
+
var m;
|
|
739
|
+
return ((m = n.value) == null ? void 0 : m.collapseEffect) ?? "overlay";
|
|
740
|
+
}), x = f(() => {
|
|
741
|
+
var m;
|
|
742
|
+
return ((m = n.value) == null ? void 0 : m.resizable) ?? !1;
|
|
743
|
+
}), g = f(
|
|
744
|
+
() => {
|
|
745
|
+
var m;
|
|
746
|
+
return ae((m = n.value) == null ? void 0 : m.minExpandedWidth, Gt(t));
|
|
747
|
+
}
|
|
748
|
+
), u = f(() => {
|
|
749
|
+
var w;
|
|
750
|
+
const m = ae(
|
|
751
|
+
(w = n.value) == null ? void 0 : w.maxExpandedWidth,
|
|
752
|
+
qt(t)
|
|
753
|
+
);
|
|
754
|
+
return Math.max(g.value, m);
|
|
755
|
+
});
|
|
756
|
+
function d(m) {
|
|
757
|
+
return S(
|
|
758
|
+
ae(m, Ut(t)),
|
|
759
|
+
g.value,
|
|
760
|
+
u.value
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
const h = We({
|
|
764
|
+
value: () => {
|
|
765
|
+
var m;
|
|
766
|
+
return (m = n.value) == null ? void 0 : m.open;
|
|
767
|
+
},
|
|
768
|
+
defaultValue: () => {
|
|
769
|
+
var m;
|
|
770
|
+
return ((m = n.value) == null ? void 0 : m.defaultOpen) ?? Xt(t);
|
|
771
|
+
},
|
|
772
|
+
onChange: (m) => {
|
|
773
|
+
var w;
|
|
774
|
+
return (w = e.onOpenChange) == null ? void 0 : w.call(e, { side: t, open: m });
|
|
775
|
+
}
|
|
776
|
+
}), s = We({
|
|
777
|
+
value: () => {
|
|
778
|
+
var m;
|
|
779
|
+
return (m = n.value) == null ? void 0 : m.expandedWidth;
|
|
780
|
+
},
|
|
781
|
+
defaultValue: () => {
|
|
782
|
+
var m;
|
|
783
|
+
return d((m = n.value) == null ? void 0 : m.defaultExpandedWidth);
|
|
784
|
+
},
|
|
785
|
+
onChange: (m) => {
|
|
786
|
+
var w;
|
|
787
|
+
return (w = e.onExpandedWidthChange) == null ? void 0 : w.call(e, { side: t, expandedWidth: m });
|
|
788
|
+
}
|
|
789
|
+
}), v = f(() => d(s.value)), i = f(() => a.value === "dock"), o = f(() => a.value === "drawer"), R = f(() => i.value && !h.value && l.value > 0), D = f(() => !h.value && !R.value), T = f(
|
|
790
|
+
() => i.value && h.value && x.value && u.value > g.value
|
|
791
|
+
);
|
|
792
|
+
function F(m) {
|
|
793
|
+
h.value !== m && (h.value = m);
|
|
794
|
+
}
|
|
795
|
+
function A(m) {
|
|
796
|
+
const w = d(m);
|
|
797
|
+
v.value !== w && (s.value = w);
|
|
798
|
+
}
|
|
799
|
+
return {
|
|
800
|
+
side: t,
|
|
801
|
+
isOpen: f(() => h.value),
|
|
802
|
+
expandedWidth: v,
|
|
803
|
+
collapsedWidth: l,
|
|
804
|
+
collapseEffect: c,
|
|
805
|
+
minExpandedWidth: g,
|
|
806
|
+
maxExpandedWidth: u,
|
|
807
|
+
isDock: i,
|
|
808
|
+
isDrawer: o,
|
|
809
|
+
isRail: R,
|
|
810
|
+
isHidden: D,
|
|
811
|
+
canResize: T,
|
|
812
|
+
setOpen: F,
|
|
813
|
+
setExpandedWidth: A
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
function Zt(e) {
|
|
817
|
+
const t = be({
|
|
818
|
+
side: "left",
|
|
819
|
+
config: e.leftConfig,
|
|
820
|
+
onOpenChange: e.onOpenChange,
|
|
821
|
+
onExpandedWidthChange: e.onExpandedWidthChange
|
|
822
|
+
}), n = be({
|
|
823
|
+
side: "right",
|
|
824
|
+
config: e.rightConfig,
|
|
825
|
+
onOpenChange: e.onOpenChange,
|
|
826
|
+
onExpandedWidthChange: e.onExpandedWidthChange
|
|
827
|
+
});
|
|
828
|
+
return {
|
|
829
|
+
leftAsideState: t,
|
|
830
|
+
rightAsideState: n
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
const jt = {
|
|
834
|
+
left: "left-aside-open-change",
|
|
835
|
+
right: "right-aside-open-change"
|
|
836
|
+
}, Kt = {
|
|
837
|
+
start: {
|
|
838
|
+
generic: "aside-resize-start",
|
|
839
|
+
left: "left-aside-resize-start",
|
|
840
|
+
right: "right-aside-resize-start"
|
|
841
|
+
},
|
|
842
|
+
resize: {
|
|
843
|
+
generic: "aside-resize",
|
|
844
|
+
left: "left-aside-resize",
|
|
845
|
+
right: "right-aside-resize"
|
|
846
|
+
},
|
|
847
|
+
end: {
|
|
848
|
+
generic: "aside-resize-end",
|
|
849
|
+
left: "left-aside-resize-end",
|
|
850
|
+
right: "right-aside-resize-end"
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
function Jt(e, t) {
|
|
854
|
+
e("aside-open-change", t), e(jt[t.side], {
|
|
855
|
+
open: t.open
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function ye(e, t, n) {
|
|
859
|
+
const a = Kt[t];
|
|
860
|
+
e(a.generic, n), e(a[n.side], {
|
|
861
|
+
expandedWidth: n.expandedWidth
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
function xe(e) {
|
|
865
|
+
return e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : !0;
|
|
866
|
+
}
|
|
867
|
+
function Pe(e) {
|
|
868
|
+
return Array.isArray(e) ? e.some((t) => Ue(t) ? t.type === qe ? !1 : t.type === Ze ? xe(t.children) : t.type === Le ? Pe(t.children) : !0 : xe(t)) : xe(e);
|
|
869
|
+
}
|
|
870
|
+
function ie(e) {
|
|
871
|
+
return Pe(e == null ? void 0 : e());
|
|
872
|
+
}
|
|
873
|
+
const Qt = { class: "tr-layout__body" }, en = {
|
|
874
|
+
key: 1,
|
|
875
|
+
class: "tr-layout__header"
|
|
876
|
+
}, tn = { class: "tr-layout__main" }, nn = {
|
|
877
|
+
key: 2,
|
|
878
|
+
class: "tr-layout__footer"
|
|
879
|
+
}, an = /* @__PURE__ */ k({
|
|
880
|
+
name: "Layout",
|
|
881
|
+
__name: "Layout",
|
|
882
|
+
props: {
|
|
883
|
+
mode: {},
|
|
884
|
+
floatingState: {},
|
|
885
|
+
defaultFloatingState: {},
|
|
886
|
+
floatingOptions: {},
|
|
887
|
+
leftAside: {},
|
|
888
|
+
rightAside: {}
|
|
889
|
+
},
|
|
890
|
+
emits: ["update:floatingState", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "aside-open-change", "aside-resize-start", "aside-resize", "aside-resize-end", "left-aside-open-change", "left-aside-resize-start", "left-aside-resize", "left-aside-resize-end", "right-aside-open-change", "right-aside-resize-start", "right-aside-resize", "right-aside-resize-end"],
|
|
891
|
+
setup(e, { emit: t }) {
|
|
892
|
+
const n = e, a = t, l = je(), c = ee(null), x = f(() => {
|
|
893
|
+
var r;
|
|
894
|
+
return ((r = c.value) == null ? void 0 : r.rootEl) ?? null;
|
|
895
|
+
}), g = f(() => ie(l["left-aside"])), u = f(() => ie(l.header)), d = f(() => ie(l.footer)), h = f(() => ie(l["right-aside"]));
|
|
896
|
+
function s(r) {
|
|
897
|
+
Jt(a, r);
|
|
898
|
+
}
|
|
899
|
+
function v(r) {
|
|
900
|
+
ye(a, "resize", r);
|
|
901
|
+
}
|
|
902
|
+
const { leftAsideState: i, rightAsideState: o } = Zt({
|
|
903
|
+
leftConfig: () => n.leftAside,
|
|
904
|
+
rightConfig: () => n.rightAside,
|
|
905
|
+
onOpenChange: s,
|
|
906
|
+
onExpandedWidthChange: v
|
|
907
|
+
});
|
|
908
|
+
function R(r, p, z, O) {
|
|
909
|
+
z && r.isDrawer.value && p.isDrawer.value && p.isOpen.value && O && p.setOpen(!1), r.setOpen(z);
|
|
910
|
+
}
|
|
911
|
+
function D(r, p, z) {
|
|
912
|
+
R(r, p, !r.isOpen.value, z);
|
|
913
|
+
}
|
|
914
|
+
function T() {
|
|
915
|
+
D(i, o, h.value);
|
|
916
|
+
}
|
|
917
|
+
function F() {
|
|
918
|
+
D(o, i, g.value);
|
|
919
|
+
}
|
|
920
|
+
const A = f(() => g.value && i.isDrawer.value && i.isOpen.value), m = f(() => h.value && o.isDrawer.value && o.isOpen.value), w = f(() => A.value || m.value);
|
|
921
|
+
function G() {
|
|
922
|
+
A.value && i.setOpen(!1), m.value && o.setOpen(!1);
|
|
923
|
+
}
|
|
924
|
+
gt({
|
|
925
|
+
rootEl: x,
|
|
926
|
+
left: {
|
|
927
|
+
isOpen: i.isOpen,
|
|
928
|
+
toggle: T
|
|
929
|
+
},
|
|
930
|
+
right: {
|
|
931
|
+
isOpen: o.isOpen,
|
|
932
|
+
toggle: F
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
const y = ee(!1);
|
|
936
|
+
function _(r) {
|
|
937
|
+
y.value = !0, ye(a, "start", r);
|
|
938
|
+
}
|
|
939
|
+
function W(r) {
|
|
940
|
+
y.value = !1, ye(a, "end", r);
|
|
941
|
+
}
|
|
942
|
+
function b(r) {
|
|
943
|
+
i.setExpandedWidth(r);
|
|
944
|
+
}
|
|
945
|
+
function H(r) {
|
|
946
|
+
o.setExpandedWidth(r);
|
|
947
|
+
}
|
|
948
|
+
function L(r, p) {
|
|
949
|
+
return !p || !r.isDock.value || r.isHidden.value ? 0 : r.isRail.value ? r.collapsedWidth.value : r.expandedWidth.value;
|
|
950
|
+
}
|
|
951
|
+
const U = {
|
|
952
|
+
placement: "center",
|
|
953
|
+
offsetX: le,
|
|
954
|
+
offsetY: le,
|
|
955
|
+
width: ce,
|
|
956
|
+
height: ge
|
|
957
|
+
}, P = We({
|
|
958
|
+
value: () => n.floatingState,
|
|
959
|
+
defaultValue: () => n.defaultFloatingState ?? U,
|
|
960
|
+
onChange: (r) => a("update:floatingState", r)
|
|
961
|
+
}), J = f(() => L(i, g.value)), Q = f(() => L(o, h.value)), me = f(() => ({
|
|
962
|
+
"tr-layout--left-dock": g.value && i.isDock.value,
|
|
963
|
+
"tr-layout--left-drawer": g.value && i.isDrawer.value,
|
|
964
|
+
"tr-layout--left-expanded": g.value && i.isOpen.value,
|
|
965
|
+
"tr-layout--left-rail": g.value && i.isRail.value,
|
|
966
|
+
"tr-layout--right-dock": h.value && o.isDock.value,
|
|
967
|
+
"tr-layout--right-drawer": h.value && o.isDrawer.value,
|
|
968
|
+
"tr-layout--right-expanded": h.value && o.isOpen.value,
|
|
969
|
+
"tr-layout--right-rail": h.value && o.isRail.value,
|
|
970
|
+
"tr-layout--resizing": y.value
|
|
971
|
+
})), ve = f(() => {
|
|
972
|
+
const r = {}, p = ne(i.expandedWidth.value), z = ne(i.collapsedWidth.value), O = ne(o.expandedWidth.value), M = ne(o.collapsedWidth.value);
|
|
973
|
+
return p && (r["--left-dock-width"] = p), z && (r["--left-collapsed-width"] = z), O && (r["--right-dock-width"] = O), M && (r["--right-collapsed-width"] = M), r;
|
|
974
|
+
});
|
|
975
|
+
return (r, p) => (E(), X(Vt, {
|
|
976
|
+
ref_key: "surfaceRef",
|
|
977
|
+
ref: c,
|
|
978
|
+
mode: e.mode,
|
|
979
|
+
class: K(me.value),
|
|
980
|
+
style: He(ve.value),
|
|
981
|
+
"floating-options": e.floatingOptions,
|
|
982
|
+
"floating-state": Z(P),
|
|
983
|
+
"onUpdate:floatingState": p[0] || (p[0] = (z) => Ke(P) ? P.value = z : null),
|
|
984
|
+
onFloatingDragStart: p[1] || (p[1] = (z) => a("floating-drag-start", z)),
|
|
985
|
+
onFloatingDrag: p[2] || (p[2] = (z) => a("floating-drag", z)),
|
|
986
|
+
onFloatingDragEnd: p[3] || (p[3] = (z) => a("floating-drag-end", z)),
|
|
987
|
+
onFloatingResizeStart: p[4] || (p[4] = (z) => a("floating-resize-start", z)),
|
|
988
|
+
onFloatingResize: p[5] || (p[5] = (z) => a("floating-resize", z)),
|
|
989
|
+
onFloatingResizeEnd: p[6] || (p[6] = (z) => a("floating-resize-end", z))
|
|
990
|
+
}, {
|
|
991
|
+
default: pe(() => [
|
|
992
|
+
B("div", Qt, [
|
|
993
|
+
g.value ? (E(), X(Ce, {
|
|
994
|
+
key: 0,
|
|
995
|
+
panel: Z(i),
|
|
996
|
+
"opposite-dock-width": Q.value,
|
|
997
|
+
onWidthChange: b,
|
|
998
|
+
onAsideResizeStart: _,
|
|
999
|
+
onAsideResizeEnd: W
|
|
1000
|
+
}, {
|
|
1001
|
+
default: pe(() => [
|
|
1002
|
+
$(r.$slots, "left-aside", {}, void 0, !0)
|
|
1003
|
+
]),
|
|
1004
|
+
_: 3
|
|
1005
|
+
}, 8, ["panel", "opposite-dock-width"])) : N("", !0),
|
|
1006
|
+
u.value ? (E(), I("header", en, [
|
|
1007
|
+
$(r.$slots, "header", {}, void 0, !0)
|
|
1008
|
+
])) : N("", !0),
|
|
1009
|
+
B("main", tn, [
|
|
1010
|
+
$(r.$slots, "main", {}, void 0, !0)
|
|
1011
|
+
]),
|
|
1012
|
+
d.value ? (E(), I("footer", nn, [
|
|
1013
|
+
$(r.$slots, "footer", {}, void 0, !0)
|
|
1014
|
+
])) : N("", !0),
|
|
1015
|
+
h.value ? (E(), X(Ce, {
|
|
1016
|
+
key: 3,
|
|
1017
|
+
panel: Z(o),
|
|
1018
|
+
"opposite-dock-width": J.value,
|
|
1019
|
+
onWidthChange: H,
|
|
1020
|
+
onAsideResizeStart: _,
|
|
1021
|
+
onAsideResizeEnd: W
|
|
1022
|
+
}, {
|
|
1023
|
+
default: pe(() => [
|
|
1024
|
+
$(r.$slots, "right-aside", {}, void 0, !0)
|
|
1025
|
+
]),
|
|
1026
|
+
_: 3
|
|
1027
|
+
}, 8, ["panel", "opposite-dock-width"])) : N("", !0),
|
|
1028
|
+
w.value ? (E(), I("div", {
|
|
1029
|
+
key: 4,
|
|
1030
|
+
class: "tr-layout__backdrop",
|
|
1031
|
+
"aria-hidden": "true",
|
|
1032
|
+
onPointerdown: G
|
|
1033
|
+
}, null, 32)) : N("", !0)
|
|
1034
|
+
])
|
|
1035
|
+
]),
|
|
1036
|
+
_: 3
|
|
1037
|
+
}, 8, ["mode", "class", "style", "floating-options", "floating-state"]));
|
|
1038
|
+
}
|
|
1039
|
+
}), re = /* @__PURE__ */ Y(an, [["__scopeId", "data-v-47262b9e"]]), ln = /* @__PURE__ */ k({
|
|
1040
|
+
name: "LayoutAsideToggle",
|
|
1041
|
+
__name: "LayoutAsideToggle",
|
|
1042
|
+
props: {
|
|
1043
|
+
side: {}
|
|
1044
|
+
},
|
|
1045
|
+
setup(e) {
|
|
1046
|
+
const t = e, { isOpen: n, toggle: a } = ft(t.side), l = f(() => ({
|
|
1047
|
+
isOpen: n.value
|
|
1048
|
+
})), c = {
|
|
1049
|
+
left: {
|
|
1050
|
+
expanded: "Collapse navigation",
|
|
1051
|
+
collapsed: "Expand navigation"
|
|
1052
|
+
},
|
|
1053
|
+
right: {
|
|
1054
|
+
expanded: "Hide side panel",
|
|
1055
|
+
collapsed: "Show side panel"
|
|
1056
|
+
}
|
|
1057
|
+
}, x = f(() => {
|
|
1058
|
+
const g = c[t.side];
|
|
1059
|
+
return n.value ? g.expanded : g.collapsed;
|
|
1060
|
+
});
|
|
1061
|
+
return (g, u) => (E(), I("button", {
|
|
1062
|
+
class: "tr-layout-aside-toggle",
|
|
1063
|
+
type: "button",
|
|
1064
|
+
onClick: u[0] || (u[0] = //@ts-ignore
|
|
1065
|
+
(...d) => Z(a) && Z(a)(...d))
|
|
1066
|
+
}, [
|
|
1067
|
+
$(g.$slots, "default", Je(Qe(l.value)), () => [
|
|
1068
|
+
et(tt(x.value), 1)
|
|
1069
|
+
], !0)
|
|
1070
|
+
]));
|
|
1071
|
+
}
|
|
1072
|
+
}), oe = /* @__PURE__ */ Y(ln, [["__scopeId", "data-v-f173f270"]]), rn = 36, _e = "tr-layout-proxy-scrollbar-target", on = /* @__PURE__ */ k({
|
|
1073
|
+
name: "LayoutProxyScrollbar",
|
|
1074
|
+
__name: "LayoutProxyScrollbar",
|
|
1075
|
+
props: {
|
|
1076
|
+
scrollTarget: {}
|
|
1077
|
+
},
|
|
1078
|
+
setup(e) {
|
|
1079
|
+
const t = e, n = ee(null), a = C(null), l = C(R()), c = C(!1), x = C(!1);
|
|
1080
|
+
let g = null;
|
|
1081
|
+
const u = f(() => D(t.scrollTarget)), d = f(() => l.value.isScrollable), { isDragging: h, cancel: s } = Re(a, {
|
|
1082
|
+
disabled: f(() => !l.value.isScrollable),
|
|
1083
|
+
onStart: (y) => {
|
|
1084
|
+
const _ = u.value;
|
|
1085
|
+
if (!_ || !l.value.isScrollable)
|
|
1086
|
+
return null;
|
|
1087
|
+
const W = _.ownerDocument.body;
|
|
1088
|
+
return W ? (y.preventDefault(), {
|
|
1089
|
+
scrollTarget: _,
|
|
1090
|
+
startY: y.clientY,
|
|
1091
|
+
startScrollTop: _.scrollTop,
|
|
1092
|
+
releaseBodyInteraction: we(W, "grabbing")
|
|
1093
|
+
}) : null;
|
|
1094
|
+
},
|
|
1095
|
+
onMove: (y, _) => {
|
|
1096
|
+
const W = l.value;
|
|
1097
|
+
W.isScrollable && (y.scrollTarget.scrollTop = A(y, _.clientY, W), w());
|
|
1098
|
+
},
|
|
1099
|
+
onEnd: (y) => {
|
|
1100
|
+
y.releaseBodyInteraction();
|
|
1101
|
+
}
|
|
1102
|
+
}), v = f(
|
|
1103
|
+
() => d.value && (c.value || x.value || h.value)
|
|
1104
|
+
), i = f(() => ({
|
|
1105
|
+
height: `${l.value.thumbHeight}px`,
|
|
1106
|
+
transform: `translateY(${l.value.thumbOffset}px)`
|
|
1107
|
+
})), o = f(() => ({
|
|
1108
|
+
"tr-layout-proxy-scrollbar--visible": v.value,
|
|
1109
|
+
"tr-layout-proxy-scrollbar--dragging-thumb": h.value
|
|
1110
|
+
}));
|
|
1111
|
+
function R() {
|
|
1112
|
+
return {
|
|
1113
|
+
clientHeight: 0,
|
|
1114
|
+
scrollHeight: 0,
|
|
1115
|
+
scrollTop: 0,
|
|
1116
|
+
trackHeight: 0,
|
|
1117
|
+
thumbHeight: 0,
|
|
1118
|
+
thumbOffset: 0,
|
|
1119
|
+
isScrollable: !1
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
function D(y) {
|
|
1123
|
+
const _ = rt(y);
|
|
1124
|
+
return _ instanceof HTMLElement ? _ : null;
|
|
1125
|
+
}
|
|
1126
|
+
function T(y, _) {
|
|
1127
|
+
return y instanceof HTMLElement ? Math.max(y.clientHeight, 0) : _;
|
|
1128
|
+
}
|
|
1129
|
+
function F(y, _) {
|
|
1130
|
+
const W = y.clientHeight, b = y.scrollHeight, H = y.scrollTop, L = b - W;
|
|
1131
|
+
if (!(L > 1))
|
|
1132
|
+
return {
|
|
1133
|
+
clientHeight: W,
|
|
1134
|
+
scrollHeight: b,
|
|
1135
|
+
scrollTop: H,
|
|
1136
|
+
trackHeight: _,
|
|
1137
|
+
thumbHeight: _,
|
|
1138
|
+
thumbOffset: 0,
|
|
1139
|
+
isScrollable: !1
|
|
1140
|
+
};
|
|
1141
|
+
const P = S(W / b * _, rn, _), J = _ - P, Q = H / L * J;
|
|
1142
|
+
return {
|
|
1143
|
+
clientHeight: W,
|
|
1144
|
+
scrollHeight: b,
|
|
1145
|
+
scrollTop: H,
|
|
1146
|
+
trackHeight: _,
|
|
1147
|
+
thumbHeight: P,
|
|
1148
|
+
thumbOffset: Q,
|
|
1149
|
+
isScrollable: !0
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function A(y, _, W) {
|
|
1153
|
+
const b = _ - y.startY, H = W.scrollHeight - W.clientHeight, L = W.trackHeight - W.thumbHeight, U = L > 0 ? H / L : 0;
|
|
1154
|
+
return y.startScrollTop + b * U;
|
|
1155
|
+
}
|
|
1156
|
+
function m() {
|
|
1157
|
+
g = null;
|
|
1158
|
+
const y = u.value;
|
|
1159
|
+
if (!y) {
|
|
1160
|
+
l.value = R();
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
const _ = T(n.value, y.clientHeight);
|
|
1164
|
+
l.value = F(y, _);
|
|
1165
|
+
}
|
|
1166
|
+
function w() {
|
|
1167
|
+
if (typeof window > "u") {
|
|
1168
|
+
m();
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
g === null && (g = window.requestAnimationFrame(m));
|
|
1172
|
+
}
|
|
1173
|
+
function G(y) {
|
|
1174
|
+
x.value = y;
|
|
1175
|
+
}
|
|
1176
|
+
return V(u, "mouseenter", () => {
|
|
1177
|
+
c.value = !0;
|
|
1178
|
+
}), V(u, "mouseleave", () => {
|
|
1179
|
+
c.value = !1;
|
|
1180
|
+
}), V(u, "scroll", () => {
|
|
1181
|
+
w();
|
|
1182
|
+
}), De(u, () => {
|
|
1183
|
+
w();
|
|
1184
|
+
}), De(n, () => {
|
|
1185
|
+
w();
|
|
1186
|
+
}), ot(
|
|
1187
|
+
u,
|
|
1188
|
+
() => {
|
|
1189
|
+
w();
|
|
1190
|
+
},
|
|
1191
|
+
{ childList: !0, subtree: !0 }
|
|
1192
|
+
), ze(
|
|
1193
|
+
u,
|
|
1194
|
+
(y, _) => {
|
|
1195
|
+
s(), c.value = !1, x.value = !1, _ == null || _.classList.remove(_e), y == null || y.classList.add(_e), w();
|
|
1196
|
+
},
|
|
1197
|
+
{ immediate: !0 }
|
|
1198
|
+
), ze(n, () => {
|
|
1199
|
+
w();
|
|
1200
|
+
}), nt(() => {
|
|
1201
|
+
var y;
|
|
1202
|
+
g !== null && typeof window < "u" && window.cancelAnimationFrame(g), s(), (y = u.value) == null || y.classList.remove(_e);
|
|
1203
|
+
}), (y, _) => d.value ? (E(), I("div", {
|
|
1204
|
+
key: 0,
|
|
1205
|
+
ref_key: "scrollbarRef",
|
|
1206
|
+
ref: n,
|
|
1207
|
+
class: K(["tr-layout-proxy-scrollbar", o.value]),
|
|
1208
|
+
"aria-hidden": "true",
|
|
1209
|
+
onMouseenter: _[0] || (_[0] = (W) => G(!0)),
|
|
1210
|
+
onMouseleave: _[1] || (_[1] = (W) => G(!1))
|
|
1211
|
+
}, [
|
|
1212
|
+
B("div", {
|
|
1213
|
+
ref_key: "thumbRef",
|
|
1214
|
+
ref: a,
|
|
1215
|
+
class: "tr-layout-proxy-scrollbar__thumb",
|
|
1216
|
+
style: He(i.value)
|
|
1217
|
+
}, null, 4)
|
|
1218
|
+
], 34)) : N("", !0);
|
|
1219
|
+
}
|
|
1220
|
+
}), se = /* @__PURE__ */ Y(on, [["__scopeId", "data-v-d7c40335"]]);
|
|
1221
|
+
se.name = "TrLayoutProxyScrollbar";
|
|
1222
|
+
const sn = function(e) {
|
|
1223
|
+
e.component(se.name, se);
|
|
1224
|
+
}, ue = se;
|
|
1225
|
+
ue.install = sn;
|
|
1226
|
+
oe.name = "TrLayoutAsideToggle";
|
|
1227
|
+
const un = function(e) {
|
|
1228
|
+
e.component(oe.name, oe);
|
|
1229
|
+
}, de = oe;
|
|
1230
|
+
de.install = un;
|
|
1231
|
+
re.name = "TrLayout";
|
|
1232
|
+
const dn = function(e) {
|
|
1233
|
+
e.component(re.name, re), e.component(ue.name, ue), e.component(de.name, de);
|
|
1234
|
+
}, Se = re;
|
|
1235
|
+
Se.install = dn;
|
|
1236
|
+
Se.ProxyScrollbar = ue;
|
|
1237
|
+
Se.AsideToggle = de;
|
|
1238
|
+
export {
|
|
1239
|
+
Se as Layout,
|
|
1240
|
+
de as LayoutAsideToggle,
|
|
1241
|
+
ue as LayoutProxyScrollbar,
|
|
1242
|
+
Se as default
|
|
1243
|
+
};
|