@opentiny/tiny-robot 0.5.2-alpha.8 → 0.5.2-beta.0
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/anchor/index.js +32 -32
- package/dist/container/index.js +16 -15
- package/dist/dropdown-menu/index.js +141 -97
- package/dist/extension-manager/index.js +1006 -0
- package/dist/floating-ui.dom.js +970 -0
- package/dist/index.d.ts +745 -176
- package/dist/index.js +103 -89
- package/dist/index3.js +92 -95
- package/dist/index4.js +2 -2
- package/dist/index6.js +408 -399
- package/dist/index7.js +271 -180
- package/dist/index8.js +87 -102
- package/dist/layout/index.js +1 -1
- package/dist/model-selector/index.js +1003 -0
- package/dist/sender/index.js +1127 -2060
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +37 -36
- package/dist/useSlotRefs.js +1 -1
- package/dist/useTeleportTarget.js +25 -0
- package/dist/utils.js +1 -1
- package/package.json +4 -4
package/dist/anchor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as G, ref as _, computed as g, watch as F, openBlock as M, createElementBlock as R, normalizeClass as pe, createElementVNode as D, renderSlot as L, Fragment as W, renderList as ye, toDisplayString as te, createTextVNode as Te, createCommentVNode as re, createBlock as xe, createSlots as ne, withCtx as P, mergeProps as ae, useSlots as Ae, normalizeStyle as
|
|
1
|
+
import { defineComponent as G, ref as _, computed as g, watch as F, openBlock as M, createElementBlock as R, normalizeClass as pe, createElementVNode as D, renderSlot as L, Fragment as W, renderList as ye, toDisplayString as te, createTextVNode as Te, createCommentVNode as re, createBlock as xe, createSlots as ne, withCtx as P, mergeProps as ae, useSlots as Ae, normalizeStyle as ke, onBeforeUnmount as oe, nextTick as be, useAttrs as Ce, toRefs as Me, unref as E, createVNode as se, normalizeProps as ue, guardReactiveProps as de } from "vue";
|
|
2
2
|
import { h as Ee, i as _e, g as V, j as he } from "../index4.js";
|
|
3
3
|
import { _ as Y } from "../_plugin-vue_export-helper.js";
|
|
4
4
|
const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"], we = { class: "tr-anchor__marker-slot" }, Re = { class: "tr-anchor__item-content" }, Le = {
|
|
@@ -38,24 +38,24 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
38
38
|
function y(p) {
|
|
39
39
|
return !!(p && p.scrollWidth > p.clientWidth);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function k() {
|
|
42
42
|
var p;
|
|
43
43
|
return ((p = h.value) == null ? void 0 : p.querySelector(".tr-anchor__item-label")) ?? null;
|
|
44
44
|
}
|
|
45
45
|
function S() {
|
|
46
|
-
n.value = l.expanded && r.value && y(
|
|
46
|
+
n.value = l.expanded && r.value && y(k());
|
|
47
47
|
}
|
|
48
48
|
function I() {
|
|
49
49
|
s(), n.value = !1, !(!l.expanded || !r.value) && c();
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function b() {
|
|
52
52
|
s(), n.value = !1;
|
|
53
53
|
}
|
|
54
54
|
function $() {
|
|
55
55
|
r.value = !0, I();
|
|
56
56
|
}
|
|
57
57
|
function H() {
|
|
58
|
-
r.value = !1,
|
|
58
|
+
r.value = !1, b();
|
|
59
59
|
}
|
|
60
60
|
function A(p) {
|
|
61
61
|
p.propertyName === "max-width" && r.value && S();
|
|
@@ -64,7 +64,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
64
64
|
() => l.expanded,
|
|
65
65
|
(p) => {
|
|
66
66
|
if (!p) {
|
|
67
|
-
|
|
67
|
+
b();
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
r.value && I();
|
|
@@ -118,7 +118,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
118
118
|
], 40, He)
|
|
119
119
|
], 10, Oe));
|
|
120
120
|
}
|
|
121
|
-
}), Be = /* @__PURE__ */ Y($e, [["__scopeId", "data-v-
|
|
121
|
+
}), Be = /* @__PURE__ */ Y($e, [["__scopeId", "data-v-667ce12a"]]), Ne = {
|
|
122
122
|
class: "tr-anchor__list",
|
|
123
123
|
role: "list"
|
|
124
124
|
}, De = {
|
|
@@ -173,7 +173,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
173
173
|
]), 1032, ["entry", "active-id", "expanded", "highlighted", "placement", "tooltip-delay"]))), 128))
|
|
174
174
|
]));
|
|
175
175
|
}
|
|
176
|
-
}), Qe = /* @__PURE__ */ Y(Fe, [["__scopeId", "data-v-
|
|
176
|
+
}), Qe = /* @__PURE__ */ Y(Fe, [["__scopeId", "data-v-bd4f2cd0"]]), Pe = {
|
|
177
177
|
key: 0,
|
|
178
178
|
class: "tr-anchor__search-cap"
|
|
179
179
|
}, Ue = { class: "tr-anchor__surface" }, Ke = /* @__PURE__ */ G({
|
|
@@ -203,7 +203,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
203
203
|
ref_key: "hostEl",
|
|
204
204
|
ref: i,
|
|
205
205
|
class: pe(c.value),
|
|
206
|
-
style:
|
|
206
|
+
style: ke(s.value)
|
|
207
207
|
}, [
|
|
208
208
|
D("div", {
|
|
209
209
|
ref_key: "overlayEl",
|
|
@@ -227,7 +227,7 @@ const Oe = ["data-tooltip"], He = ["data-item-id", "aria-current", "tabindex"],
|
|
|
227
227
|
], 512)
|
|
228
228
|
], 6));
|
|
229
229
|
}
|
|
230
|
-
}), qe = /* @__PURE__ */ Y(Ke, [["__scopeId", "data-v-
|
|
230
|
+
}), qe = /* @__PURE__ */ Y(Ke, [["__scopeId", "data-v-ed3e7e50"]]), ze = ["value", "placeholder", "aria-label"], Ve = /* @__PURE__ */ G({
|
|
231
231
|
name: "AnchorSearch",
|
|
232
232
|
__name: "AnchorSearch",
|
|
233
233
|
props: {
|
|
@@ -307,16 +307,16 @@ function Ze(e) {
|
|
|
307
307
|
var t;
|
|
308
308
|
return (t = f.value.find((u) => u.item.id === e.activeId.value)) == null ? void 0 : t.item.id;
|
|
309
309
|
}
|
|
310
|
-
),
|
|
310
|
+
), k = g(() => {
|
|
311
311
|
var t;
|
|
312
312
|
return h.value && i.value && f.value.some((u) => u.item.id === i.value) ? i.value : y.value ?? ((t = f.value[0]) == null ? void 0 : t.item.id);
|
|
313
313
|
}), S = g(() => {
|
|
314
314
|
if (!f.value.length)
|
|
315
315
|
return 0;
|
|
316
|
-
const t = f.value.findIndex((u) => u.item.id ===
|
|
316
|
+
const t = f.value.findIndex((u) => u.item.id === k.value);
|
|
317
317
|
return t === -1 ? 0 : t;
|
|
318
|
-
}), I = g(() =>
|
|
319
|
-
function
|
|
318
|
+
}), I = g(() => k.value);
|
|
319
|
+
function b() {
|
|
320
320
|
h.value = !1, i.value = void 0;
|
|
321
321
|
}
|
|
322
322
|
function $(t) {
|
|
@@ -330,7 +330,7 @@ function Ze(e) {
|
|
|
330
330
|
function A(t) {
|
|
331
331
|
var v;
|
|
332
332
|
if (!f.value.length) {
|
|
333
|
-
|
|
333
|
+
b();
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
const u = Math.max(0, Math.min(t, f.value.length - 1));
|
|
@@ -347,20 +347,20 @@ function Ze(e) {
|
|
|
347
347
|
f,
|
|
348
348
|
(t) => {
|
|
349
349
|
if (!t.length) {
|
|
350
|
-
|
|
350
|
+
b();
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
353
|
if (y.value) {
|
|
354
|
-
|
|
354
|
+
b();
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
|
-
h.value && i.value && t.some((u) => u.item.id === i.value) ||
|
|
357
|
+
h.value && i.value && t.some((u) => u.item.id === i.value) || b();
|
|
358
358
|
},
|
|
359
359
|
{ immediate: !0, flush: "sync" }
|
|
360
360
|
), F(
|
|
361
361
|
() => e.activeId.value,
|
|
362
362
|
(t) => {
|
|
363
|
-
t &&
|
|
363
|
+
t && b();
|
|
364
364
|
},
|
|
365
365
|
{ immediate: !0, flush: "sync" }
|
|
366
366
|
), {
|
|
@@ -433,7 +433,7 @@ function Xe(e) {
|
|
|
433
433
|
function y() {
|
|
434
434
|
d(), f();
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function k(o) {
|
|
437
437
|
return o instanceof HTMLElement ? o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement || o.isContentEditable : !1;
|
|
438
438
|
}
|
|
439
439
|
function S(o) {
|
|
@@ -448,7 +448,7 @@ function Xe(e) {
|
|
|
448
448
|
const t = Number.parseFloat(window.getComputedStyle(o).scrollMarginTop || "0");
|
|
449
449
|
return Number.isFinite(t) ? t : 0;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function b() {
|
|
452
452
|
var Q, K;
|
|
453
453
|
const o = le(e.container.value);
|
|
454
454
|
if (!o)
|
|
@@ -506,7 +506,7 @@ function Xe(e) {
|
|
|
506
506
|
if (o.defaultPrevented || o.altKey || o.ctrlKey || o.metaKey)
|
|
507
507
|
return;
|
|
508
508
|
const t = (u = e.host) == null ? void 0 : u.value;
|
|
509
|
-
t && o.target instanceof Node && t.contains(o.target) ||
|
|
509
|
+
t && o.target instanceof Node && t.contains(o.target) || k(o.target) || ["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "].includes(o.key) && y();
|
|
510
510
|
}
|
|
511
511
|
return F(
|
|
512
512
|
() => {
|
|
@@ -521,7 +521,7 @@ function Xe(e) {
|
|
|
521
521
|
}), {
|
|
522
522
|
activeId: n,
|
|
523
523
|
scrollTo: $,
|
|
524
|
-
sync:
|
|
524
|
+
sync: b,
|
|
525
525
|
clearPendingScroll: d,
|
|
526
526
|
releaseSelectionLock: y,
|
|
527
527
|
handleUserScrollIntent: H,
|
|
@@ -555,12 +555,12 @@ function et(e) {
|
|
|
555
555
|
a.value = 0;
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
|
-
const f = d.getBoundingClientRect(), y = s.getBoundingClientRect(),
|
|
559
|
-
if (!y.height || !
|
|
558
|
+
const f = d.getBoundingClientRect(), y = s.getBoundingClientRect(), k = c.getBoundingClientRect().height || 0;
|
|
559
|
+
if (!y.height || !k) {
|
|
560
560
|
a.value = 0;
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
|
-
const S = y.top - f.top, I = y.bottom - f.top, $ = S + y.height / 2 -
|
|
563
|
+
const S = y.top - f.top, I = y.bottom - f.top, $ = S + y.height / 2 - k / 2, H = S + 24, A = Math.max(H, I - k - 24);
|
|
564
564
|
a.value = Math.max(H, Math.min($, A));
|
|
565
565
|
}
|
|
566
566
|
return {
|
|
@@ -584,7 +584,7 @@ function ot(e) {
|
|
|
584
584
|
return n instanceof HTMLElement ? n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement || n.isContentEditable : !1;
|
|
585
585
|
}
|
|
586
586
|
function l() {
|
|
587
|
-
|
|
587
|
+
be(() => {
|
|
588
588
|
var s, d;
|
|
589
589
|
const n = e.highlightedId.value, c = (s = e.overlay.value) == null ? void 0 : s.navEl;
|
|
590
590
|
!n || !c || (d = rt(c, n)) == null || d.focus();
|
|
@@ -689,16 +689,16 @@ const j = /* @__PURE__ */ G({
|
|
|
689
689
|
expanded: d,
|
|
690
690
|
items: f,
|
|
691
691
|
placement: y,
|
|
692
|
-
searchOptions:
|
|
692
|
+
searchOptions: k,
|
|
693
693
|
searchQuery: S,
|
|
694
694
|
scrollContainer: I,
|
|
695
|
-
targetFeedbackClass:
|
|
695
|
+
targetFeedbackClass: b,
|
|
696
696
|
targetFeedbackDuration: $,
|
|
697
697
|
tooltipDelay: H
|
|
698
698
|
} = Me(l), A = _(null), p = g(() => {
|
|
699
699
|
var m;
|
|
700
700
|
return ((m = A.value) == null ? void 0 : m.hostEl) ?? null;
|
|
701
|
-
}), o = g(() =>
|
|
701
|
+
}), o = g(() => k.value), t = g(() => o.value ?? {});
|
|
702
702
|
function u(m) {
|
|
703
703
|
const O = I.value;
|
|
704
704
|
return O ? ge(O, m) ?? null : ge(document, m) ?? null;
|
|
@@ -717,7 +717,7 @@ const j = /* @__PURE__ */ G({
|
|
|
717
717
|
expanded: d,
|
|
718
718
|
expandTrigger: s,
|
|
719
719
|
searchQuery: S,
|
|
720
|
-
searchOptions:
|
|
720
|
+
searchOptions: k,
|
|
721
721
|
onUpdateExpanded: (m) => i("update:expanded", m),
|
|
722
722
|
onUpdateSearchQuery: (m) => i("update:searchQuery", m)
|
|
723
723
|
}), U = g(() => v.value.length > 0), Q = g(() => !!o.value && x.expanded.value), K = g(() => s.value === "hover"), C = g(() => le(I.value)), w = et({
|
|
@@ -725,7 +725,7 @@ const j = /* @__PURE__ */ G({
|
|
|
725
725
|
host: p
|
|
726
726
|
}), J = ct({
|
|
727
727
|
resolveTarget: u,
|
|
728
|
-
feedbackClass:
|
|
728
|
+
feedbackClass: b,
|
|
729
729
|
feedbackDuration: $
|
|
730
730
|
});
|
|
731
731
|
function z(m) {
|
package/dist/container/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as g, useModel as c, computed as
|
|
1
|
+
import { defineComponent as g, useModel as c, computed as C, withDirectives as w, openBlock as B, createElementBlock as y, normalizeClass as I, createElementVNode as e, renderSlot as r, toDisplayString as z, createVNode as u, unref as i, vShow as E, mergeModels as d } from "vue";
|
|
2
2
|
import { IconExitFullScreen as S, IconEnterFullScreen as $, IconClose as k } from "@opentiny/tiny-robot-svgs";
|
|
3
3
|
import f from "../icon-button/index.js";
|
|
4
4
|
import { _ as M } from "../_plugin-vue_export-helper.js";
|
|
@@ -16,26 +16,26 @@ const T = { class: "tr-container__header" }, b = { class: "tr-container__title"
|
|
|
16
16
|
}),
|
|
17
17
|
emits: /* @__PURE__ */ d(["close"], ["update:show", "update:fullscreen"]),
|
|
18
18
|
setup(o, { emit: p }) {
|
|
19
|
-
const m = o, a = c(o, "show"),
|
|
19
|
+
const m = o, a = c(o, "show"), n = c(o, "fullscreen"), v = C(() => n.value ? S : $), _ = p, h = () => {
|
|
20
20
|
a.value = !1, _("close");
|
|
21
21
|
};
|
|
22
|
-
return (
|
|
23
|
-
class: I(["tr-container", { fullscreen:
|
|
22
|
+
return (s, l) => w((B(), y("div", {
|
|
23
|
+
class: I(["tr-container", { fullscreen: n.value }])
|
|
24
24
|
}, [
|
|
25
|
-
|
|
25
|
+
l[1] || (l[1] = e("div", { class: "tr-container__dragging-bar-wrapper" }, [
|
|
26
26
|
e("div", { class: "tr-container__dragging-bar" })
|
|
27
27
|
], -1)),
|
|
28
28
|
e("div", T, [
|
|
29
|
-
|
|
29
|
+
r(s.$slots, "title", {}, () => [
|
|
30
30
|
e("h3", b, z(m.title), 1)
|
|
31
31
|
], !0),
|
|
32
32
|
e("div", N, [
|
|
33
|
-
|
|
33
|
+
r(s.$slots, "operations", {}, void 0, !0),
|
|
34
34
|
u(i(f), {
|
|
35
35
|
size: "28",
|
|
36
36
|
"svg-size": "20",
|
|
37
37
|
icon: v.value,
|
|
38
|
-
onClick:
|
|
38
|
+
onClick: l[0] || (l[0] = (q) => n.value = !n.value)
|
|
39
39
|
}, null, 8, ["icon"]),
|
|
40
40
|
u(i(f), {
|
|
41
41
|
size: "28",
|
|
@@ -45,20 +45,21 @@ const T = { class: "tr-container__header" }, b = { class: "tr-container__title"
|
|
|
45
45
|
}, null, 8, ["icon"])
|
|
46
46
|
])
|
|
47
47
|
]),
|
|
48
|
-
|
|
48
|
+
r(s.$slots, "default", {}, void 0, !0),
|
|
49
49
|
e("div", D, [
|
|
50
|
-
|
|
50
|
+
r(s.$slots, "footer", {}, void 0, !0)
|
|
51
51
|
])
|
|
52
52
|
], 2)), [
|
|
53
53
|
[E, a.value]
|
|
54
54
|
]);
|
|
55
55
|
}
|
|
56
|
-
}),
|
|
57
|
-
|
|
56
|
+
}), t = /* @__PURE__ */ M(F, [["__scopeId", "data-v-8bd84c90"]]);
|
|
57
|
+
t.name = "TrContainer";
|
|
58
58
|
const V = function(o) {
|
|
59
|
-
o.component(
|
|
59
|
+
o.component(t.name, t);
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
t.install = V;
|
|
62
|
+
const A = t;
|
|
62
63
|
export {
|
|
63
|
-
|
|
64
|
+
A as default
|
|
64
65
|
};
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { w as
|
|
3
|
-
import { B as
|
|
4
|
-
import { u as
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { ref as M, onUnmounted as K, watch as H, defineComponent as S, useModel as U, computed as _, watchEffect as X, openBlock as b, createBlock as j, unref as L, withCtx as A, createElementVNode as O, createElementBlock as T, Fragment as Y, renderList as $, toDisplayString as q, renderSlot as F, mergeModels as P, nextTick as B } from "vue";
|
|
2
|
+
import { w as G, u as C, o as N } from "../index4.js";
|
|
3
|
+
import { B as V } from "../index8.js";
|
|
4
|
+
import { u as z } from "../utils.js";
|
|
5
|
+
import { _ as J } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const I = (n, t) => n.x >= t.left && n.x <= t.right && n.y >= t.top && n.y <= t.bottom, Q = (n, t, k = !1) => {
|
|
7
7
|
if (t.length < 3) return !1;
|
|
8
|
-
const
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
if (Math.abs(
|
|
13
|
-
const
|
|
14
|
-
return
|
|
8
|
+
const s = n.x, g = n.y;
|
|
9
|
+
let h = !1;
|
|
10
|
+
const o = (i, a, u, r, l, c) => {
|
|
11
|
+
const w = (l - u) * (a - r) - (c - r) * (i - u);
|
|
12
|
+
if (Math.abs(w) > 1e-10) return !1;
|
|
13
|
+
const d = Math.min(u, l), p = Math.max(u, l), v = Math.min(r, c), e = Math.max(r, c);
|
|
14
|
+
return i >= d && i <= p && a >= v && a <= e;
|
|
15
15
|
};
|
|
16
|
-
for (let
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
16
|
+
for (let i = 0, a = t.length - 1; i < t.length; a = i++) {
|
|
17
|
+
const u = t[i].x, r = t[i].y, l = t[a].x, c = t[a].y;
|
|
18
|
+
if (k && o(s, g, u, r, l, c))
|
|
19
19
|
return !0;
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
if (r > g && c <= g || c > g && r <= g) {
|
|
21
|
+
const d = (l - u) * (g - r) / (c - r) + u;
|
|
22
|
+
s < d && (h = !h);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
},
|
|
27
|
-
{ x:
|
|
28
|
-
{ x:
|
|
25
|
+
return h;
|
|
26
|
+
}, W = (n, t) => t.bottom < n.top ? [
|
|
27
|
+
{ x: n.left, y: n.top },
|
|
28
|
+
{ x: n.right, y: n.top },
|
|
29
29
|
{ x: t.right, y: t.bottom },
|
|
30
30
|
{ x: t.left, y: t.bottom }
|
|
31
|
-
] : t.top >
|
|
32
|
-
{ x:
|
|
33
|
-
{ x:
|
|
31
|
+
] : t.top > n.bottom ? [
|
|
32
|
+
{ x: n.left, y: n.bottom },
|
|
33
|
+
{ x: n.right, y: n.bottom },
|
|
34
34
|
{ x: t.right, y: t.top },
|
|
35
35
|
{ x: t.left, y: t.top }
|
|
36
|
-
] : [], { x:
|
|
37
|
-
const { delayEnter:
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
|
|
36
|
+
] : [], { x: Z, y: R } = z(), ee = (n, t, k) => {
|
|
37
|
+
const { delayEnter: s = 0, delayLeave: g = 0 } = k || {}, h = M(!1), o = M("outside");
|
|
38
|
+
let i = null;
|
|
39
|
+
const a = () => {
|
|
40
|
+
i && (clearTimeout(i), i = null);
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
K(() => {
|
|
43
|
+
a();
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
45
|
+
const u = (r) => {
|
|
46
|
+
const l = r ? s : g;
|
|
47
|
+
a(), l ? i = setTimeout(() => h.value = r, l) : h.value = r;
|
|
48
48
|
};
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
(
|
|
52
|
-
["trigger", "popper", "polygon"].includes(
|
|
49
|
+
return H(
|
|
50
|
+
o,
|
|
51
|
+
(r) => {
|
|
52
|
+
["trigger", "popper", "polygon"].includes(r) ? u(!0) : u(!1);
|
|
53
53
|
},
|
|
54
54
|
{ immediate: !0 }
|
|
55
|
-
),
|
|
56
|
-
[
|
|
57
|
-
([
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
|
|
55
|
+
), G(
|
|
56
|
+
[Z, R],
|
|
57
|
+
([r, l]) => {
|
|
58
|
+
const c = C(n), w = C(t), d = c == null ? void 0 : c.getBoundingClientRect(), p = w == null ? void 0 : w.getBoundingClientRect();
|
|
59
|
+
if (d && I({ x: r, y: l }, d)) {
|
|
60
|
+
o.value = "trigger";
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
if (
|
|
64
|
-
|
|
63
|
+
if (p && I({ x: r, y: l }, p)) {
|
|
64
|
+
o.value = "popper";
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (!
|
|
68
|
-
|
|
67
|
+
if (!d || !p || d.width === 0 || d.height === 0 || p.width === 0 || p.height === 0) {
|
|
68
|
+
o.value = "outside";
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Q({ x: r, y: l }, W(d, p), !0) ? o.value = "polygon" : o.value = "outside";
|
|
72
72
|
},
|
|
73
73
|
{ throttle: 10 }
|
|
74
|
-
),
|
|
75
|
-
},
|
|
74
|
+
), h;
|
|
75
|
+
}, te = ["onClick"], ne = /* @__PURE__ */ S({
|
|
76
76
|
__name: "index",
|
|
77
|
-
props: /* @__PURE__ */
|
|
77
|
+
props: /* @__PURE__ */ P({
|
|
78
78
|
appendTo: {},
|
|
79
79
|
items: {},
|
|
80
80
|
show: { type: Boolean },
|
|
@@ -83,77 +83,121 @@ const P = (o, t) => o.x >= t.left && o.x <= t.right && o.y >= t.top && o.y <= t.
|
|
|
83
83
|
show: { type: Boolean, default: !1 },
|
|
84
84
|
showModifiers: {}
|
|
85
85
|
}),
|
|
86
|
-
emits: /* @__PURE__ */
|
|
87
|
-
setup(
|
|
88
|
-
const
|
|
89
|
-
get: () =>
|
|
86
|
+
emits: /* @__PURE__ */ P(["item-click", "click-outside"], ["update:show"]),
|
|
87
|
+
setup(n, { expose: t, emit: k }) {
|
|
88
|
+
const s = n, g = k, h = U(n, "show"), o = _({
|
|
89
|
+
get: () => s.trigger === "manual" ? s.show : h.value,
|
|
90
90
|
set: (e) => {
|
|
91
|
-
|
|
91
|
+
s.trigger !== "manual" && (h.value = e);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
93
|
+
}), i = M(null), a = _(() => {
|
|
94
94
|
var e;
|
|
95
|
-
return (e =
|
|
96
|
-
}),
|
|
95
|
+
return (e = i.value) == null ? void 0 : e.triggerRef;
|
|
96
|
+
}), u = _(() => {
|
|
97
97
|
var e;
|
|
98
|
-
return (e =
|
|
98
|
+
return (e = i.value) == null ? void 0 : e.popperRef;
|
|
99
99
|
});
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if (X(() => {
|
|
101
|
+
const e = a.value;
|
|
102
|
+
e && (e.setAttribute("aria-haspopup", "menu"), e.setAttribute("aria-expanded", String(!!o.value)));
|
|
103
|
+
}), s.trigger === "click" || s.trigger === "manual")
|
|
104
|
+
N(
|
|
105
|
+
u,
|
|
103
106
|
(e) => {
|
|
104
|
-
|
|
107
|
+
g("click-outside", e), o.value = !1;
|
|
105
108
|
},
|
|
106
|
-
{ ignore: [
|
|
109
|
+
{ ignore: [a] }
|
|
107
110
|
);
|
|
108
|
-
else if (
|
|
109
|
-
const e =
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
else if (s.trigger === "hover") {
|
|
112
|
+
const e = ee(a, u, { delayEnter: 100, delayLeave: 100 });
|
|
113
|
+
H(e, (f) => {
|
|
114
|
+
o.value = f;
|
|
112
115
|
});
|
|
113
116
|
}
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
117
|
+
const r = () => {
|
|
118
|
+
s.trigger === "click" && (o.value = !o.value);
|
|
119
|
+
}, l = async () => {
|
|
120
|
+
var e;
|
|
121
|
+
await B(), o.value || (e = a.value) == null || e.focus();
|
|
122
|
+
}, c = () => {
|
|
123
|
+
var e;
|
|
124
|
+
return Array.from(((e = u.value) == null ? void 0 : e.querySelectorAll('[role="menuitem"]')) || []);
|
|
125
|
+
}, w = async (e) => {
|
|
126
|
+
var m;
|
|
127
|
+
await B();
|
|
128
|
+
const f = c();
|
|
129
|
+
(m = f[e === "first" ? 0 : f.length - 1]) == null || m.focus();
|
|
130
|
+
}, d = (e) => {
|
|
131
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
132
|
+
if (s.trigger === "manual" && !o.value) return;
|
|
133
|
+
e.preventDefault(), s.trigger !== "manual" && (o.value = !0), w(e.key === "ArrowDown" ? "first" : "last");
|
|
134
|
+
} else (e.key === "Enter" || e.key === " ") && s.trigger !== "manual" ? (e.preventDefault(), o.value = !0, w("first")) : e.key === "Escape" && o.value && (e.preventDefault(), o.value = !1);
|
|
135
|
+
}, p = (e) => {
|
|
136
|
+
var E, D;
|
|
137
|
+
const f = c(), m = f.indexOf(document.activeElement);
|
|
138
|
+
if (e.key === "Tab") {
|
|
139
|
+
s.trigger !== "manual" && (o.value = !1);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (e.key === "Escape") {
|
|
143
|
+
e.preventDefault(), o.value = !1, l();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
147
|
+
e.preventDefault(), (E = f[m]) == null || E.click();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) || f.length === 0) return;
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
let y = m;
|
|
153
|
+
e.key === "Home" && (y = 0), e.key === "End" && (y = f.length - 1), e.key === "ArrowDown" && (y = m < f.length - 1 ? m + 1 : 0), e.key === "ArrowUp" && (y = m > 0 ? m - 1 : f.length - 1), (D = f[y]) == null || D.focus();
|
|
154
|
+
}, v = (e) => {
|
|
155
|
+
o.value = !1, g("item-click", e), l();
|
|
118
156
|
};
|
|
119
157
|
return t({
|
|
120
158
|
update: () => {
|
|
121
159
|
var e;
|
|
122
|
-
(e =
|
|
160
|
+
(e = i.value) == null || e.update();
|
|
123
161
|
}
|
|
124
|
-
}), (e,
|
|
125
|
-
show:
|
|
162
|
+
}), (e, f) => (b(), j(L(V), {
|
|
163
|
+
show: o.value,
|
|
126
164
|
class: "tr-dropdown-menu",
|
|
127
165
|
ref_key: "basePopperRef",
|
|
128
|
-
ref:
|
|
166
|
+
ref: i,
|
|
129
167
|
placement: "top-left",
|
|
130
|
-
"append-to":
|
|
168
|
+
"append-to": s.appendTo,
|
|
131
169
|
offset: 8,
|
|
132
170
|
"transition-props": { name: "tr-dropdown-menu" },
|
|
133
171
|
"prevent-overflow": !0,
|
|
134
|
-
"trigger-events": { onClick:
|
|
172
|
+
"trigger-events": { onClick: r, onKeydown: d }
|
|
135
173
|
}, {
|
|
136
|
-
trigger:
|
|
137
|
-
|
|
174
|
+
trigger: A(() => [
|
|
175
|
+
F(e.$slots, "trigger", {}, void 0, !0)
|
|
138
176
|
]),
|
|
139
|
-
content:
|
|
140
|
-
|
|
141
|
-
|
|
177
|
+
content: A(() => [
|
|
178
|
+
O("ul", {
|
|
179
|
+
class: "tr-dropdown-menu__list",
|
|
180
|
+
role: "menu",
|
|
181
|
+
onKeydown: p
|
|
182
|
+
}, [
|
|
183
|
+
(b(!0), T(Y, null, $(s.items, (m) => (b(), T("li", {
|
|
142
184
|
class: "tr-dropdown-menu__list-item",
|
|
143
|
-
key:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
185
|
+
key: m.id,
|
|
186
|
+
role: "menuitem",
|
|
187
|
+
tabindex: "-1",
|
|
188
|
+
onClick: (y) => v(m)
|
|
189
|
+
}, q(m.text), 9, te))), 128))
|
|
190
|
+
], 32)
|
|
147
191
|
]),
|
|
148
192
|
_: 3
|
|
149
193
|
}, 8, ["show", "append-to", "trigger-events"]));
|
|
150
194
|
}
|
|
151
|
-
}),
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
195
|
+
}), x = /* @__PURE__ */ J(ne, [["__scopeId", "data-v-0d296a61"]]);
|
|
196
|
+
x.name = "TrDropdownMenu";
|
|
197
|
+
const oe = function(n) {
|
|
198
|
+
n.component(x.name, x);
|
|
155
199
|
};
|
|
156
|
-
|
|
200
|
+
x.install = oe;
|
|
157
201
|
export {
|
|
158
|
-
|
|
202
|
+
x as default
|
|
159
203
|
};
|