@opentiny/tiny-robot 0.5.2-alpha.16 → 0.5.2-alpha.18

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.
@@ -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 be, onBeforeUnmount as oe, nextTick as ke, useAttrs as Ce, toRefs as Me, unref as E, createVNode as se, normalizeProps as ue, guardReactiveProps as de } from "vue";
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 b() {
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(b());
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 k() {
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, k();
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
- k();
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-f39ebac0"]]), Ne = {
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-ff2e0912"]]), Pe = {
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: be(s.value)
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-276fbba1"]]), ze = ["value", "placeholder", "aria-label"], Ve = /* @__PURE__ */ G({
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
- ), b = g(() => {
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 === b.value);
316
+ const t = f.value.findIndex((u) => u.item.id === k.value);
317
317
  return t === -1 ? 0 : t;
318
- }), I = g(() => b.value);
319
- function k() {
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
- k();
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
- k();
350
+ b();
351
351
  return;
352
352
  }
353
353
  if (y.value) {
354
- k();
354
+ b();
355
355
  return;
356
356
  }
357
- h.value && i.value && t.some((u) => u.item.id === i.value) || k();
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 && k();
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 b(o) {
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 k() {
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) || b(o.target) || ["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "].includes(o.key) && y();
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: k,
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(), b = c.getBoundingClientRect().height || 0;
559
- if (!y.height || !b) {
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 - b / 2, H = S + 24, A = Math.max(H, I - b - 24);
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
- ke(() => {
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: b,
692
+ searchOptions: k,
693
693
  searchQuery: S,
694
694
  scrollContainer: I,
695
- targetFeedbackClass: k,
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(() => b.value), t = g(() => o.value ?? {});
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: b,
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: k,
728
+ feedbackClass: b,
729
729
  feedbackDuration: $
730
730
  });
731
731
  function z(m) {
@@ -1,15 +1,16 @@
1
- import { B as a, a as b, b as u, c as r, d as l, e as n, f as t, g as B, h as o, i as d, j as i, k as g } from "../index6.js";
1
+ import { B as b, a, b as r, c as u, d as l, e as n, f as t, g as B, h as o, i as d, j as i, k as R, l as g } from "../index6.js";
2
2
  export {
3
- a as Bubble,
4
- b as BubbleList,
5
- u as BubbleProvider,
6
- r as BubbleRendererMatchPriority,
3
+ b as Bubble,
4
+ a as BubbleList,
5
+ r as BubbleProvider,
6
+ u as BubbleRendererMatchPriority,
7
7
  l as BubbleRenderers,
8
8
  n as useBubbleBoxRenderer,
9
9
  t as useBubbleContentRenderer,
10
- B as useBubbleEventFn,
11
- o as useBubbleStateChangeFn,
12
- d as useMessageContent,
13
- i as useOmitMessageFields,
10
+ B as useBubbleErrorRenderer,
11
+ o as useBubbleEventFn,
12
+ d as useBubbleStateChangeFn,
13
+ i as useMessageContent,
14
+ R as useOmitMessageFields,
14
15
  g as useToolCall
15
16
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as g, useModel as c, computed as w, withDirectives as C, openBlock as B, createElementBlock as y, normalizeClass as I, createElementVNode as e, renderSlot as l, toDisplayString as z, createVNode as u, unref as i, vShow as E, mergeModels as d } from "vue";
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"), t = c(o, "fullscreen"), v = w(() => t.value ? S : $), _ = p, h = () => {
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 (n, s) => C((B(), y("div", {
23
- class: I(["tr-container", { fullscreen: t.value }])
22
+ return (s, l) => w((B(), y("div", {
23
+ class: I(["tr-container", { fullscreen: n.value }])
24
24
  }, [
25
- s[1] || (s[1] = e("div", { class: "tr-container__dragging-bar-wrapper" }, [
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
- l(n.$slots, "title", {}, () => [
29
+ r(s.$slots, "title", {}, () => [
30
30
  e("h3", b, z(m.title), 1)
31
31
  ], !0),
32
32
  e("div", N, [
33
- l(n.$slots, "operations", {}, void 0, !0),
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: s[0] || (s[0] = (q) => t.value = !t.value)
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
- l(n.$slots, "default", {}, void 0, !0),
48
+ r(s.$slots, "default", {}, void 0, !0),
49
49
  e("div", D, [
50
- l(n.$slots, "footer", {}, void 0, !0)
50
+ r(s.$slots, "footer", {}, void 0, !0)
51
51
  ])
52
52
  ], 2)), [
53
53
  [E, a.value]
54
54
  ]);
55
55
  }
56
- }), r = /* @__PURE__ */ M(F, [["__scopeId", "data-v-8bd84c90"]]);
57
- r.name = "TrContainer";
56
+ }), t = /* @__PURE__ */ M(F, [["__scopeId", "data-v-8bd84c90"]]);
57
+ t.name = "TrContainer";
58
58
  const V = function(o) {
59
- o.component(r.name, r);
59
+ o.component(t.name, t);
60
60
  };
61
- r.install = V;
61
+ t.install = V;
62
+ const A = t;
62
63
  export {
63
- r as default
64
+ A as default
64
65
  };
@@ -1,80 +1,80 @@
1
- import { ref as k, onUnmounted as T, watch as C, defineComponent as E, useModel as H, computed as p, openBlock as w, createBlock as I, unref as X, withCtx as y, createElementVNode as j, createElementBlock as _, Fragment as D, renderList as L, toDisplayString as Y, renderSlot as O, mergeModels as M } from "vue";
2
- import { w as S, u as b, o as $ } from "../index4.js";
3
- import { B as A } from "../index8.js";
4
- import { u as F } from "../utils.js";
5
- import { _ as G } from "../_plugin-vue_export-helper.js";
6
- const P = (o, t) => o.x >= t.left && o.x <= t.right && o.y >= t.top && o.y <= t.bottom, N = (o, t, g = !1) => {
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 l = o.x, f = o.y;
9
- let d = !1;
10
- const r = (s, c, a, n, i, e) => {
11
- const m = (i - a) * (c - n) - (e - n) * (s - a);
12
- if (Math.abs(m) > 1e-10) return !1;
13
- const u = Math.min(a, i), h = Math.max(a, i), x = Math.min(n, e), B = Math.max(n, e);
14
- return s >= u && s <= h && c >= x && c <= B;
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 s = 0, c = t.length - 1; s < t.length; c = s++) {
17
- const a = t[s].x, n = t[s].y, i = t[c].x, e = t[c].y;
18
- if (g && r(l, f, a, n, i, e))
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 (n > f && e <= f || e > f && n <= f) {
21
- const u = (i - a) * (f - n) / (e - n) + a;
22
- l < u && (d = !d);
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 d;
26
- }, U = (o, t) => t.bottom < o.top ? [
27
- { x: o.left, y: o.top },
28
- { x: o.right, y: o.top },
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 > o.bottom ? [
32
- { x: o.left, y: o.bottom },
33
- { x: o.right, y: o.bottom },
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: V, y: q } = F(), z = (o, t, g) => {
37
- const { delayEnter: l = 0, delayLeave: f = 0 } = g || {}, d = k(!1), r = k("outside");
38
- let s = null;
39
- const c = () => {
40
- s && (clearTimeout(s), s = null);
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
- T(() => {
43
- c();
42
+ K(() => {
43
+ a();
44
44
  });
45
- const a = (n) => {
46
- const i = n ? l : f;
47
- c(), i ? s = setTimeout(() => d.value = n, i) : d.value = n;
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 C(
50
- r,
51
- (n) => {
52
- ["trigger", "popper", "polygon"].includes(n) ? a(!0) : a(!1);
49
+ return H(
50
+ o,
51
+ (r) => {
52
+ ["trigger", "popper", "polygon"].includes(r) ? u(!0) : u(!1);
53
53
  },
54
54
  { immediate: !0 }
55
- ), S(
56
- [V, q],
57
- ([n, i]) => {
58
- const e = b(o), m = b(t), u = e == null ? void 0 : e.getBoundingClientRect(), h = m == null ? void 0 : m.getBoundingClientRect();
59
- if (u && P({ x: n, y: i }, u)) {
60
- r.value = "trigger";
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 (h && P({ x: n, y: i }, h)) {
64
- r.value = "popper";
63
+ if (p && I({ x: r, y: l }, p)) {
64
+ o.value = "popper";
65
65
  return;
66
66
  }
67
- if (!u || !h || u.width === 0 || u.height === 0 || h.width === 0 || h.height === 0) {
68
- r.value = "outside";
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
- N({ x: n, y: i }, U(u, h), !0) ? r.value = "polygon" : r.value = "outside";
71
+ Q({ x: r, y: l }, W(d, p), !0) ? o.value = "polygon" : o.value = "outside";
72
72
  },
73
73
  { throttle: 10 }
74
- ), d;
75
- }, J = { class: "tr-dropdown-menu__list" }, K = ["onClick"], Q = /* @__PURE__ */ E({
74
+ ), h;
75
+ }, te = ["onClick"], ne = /* @__PURE__ */ S({
76
76
  __name: "index",
77
- props: /* @__PURE__ */ M({
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__ */ M(["item-click", "click-outside"], ["update:show"]),
87
- setup(o, { expose: t, emit: g }) {
88
- const l = o, f = g, d = H(o, "show"), r = p({
89
- get: () => l.trigger === "manual" ? l.show : d.value,
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
- l.trigger !== "manual" && (d.value = e);
91
+ s.trigger !== "manual" && (h.value = e);
92
92
  }
93
- }), s = k(null), c = p(() => {
93
+ }), i = M(null), a = _(() => {
94
94
  var e;
95
- return (e = s.value) == null ? void 0 : e.triggerRef;
96
- }), a = p(() => {
95
+ return (e = i.value) == null ? void 0 : e.triggerRef;
96
+ }), u = _(() => {
97
97
  var e;
98
- return (e = s.value) == null ? void 0 : e.popperRef;
98
+ return (e = i.value) == null ? void 0 : e.popperRef;
99
99
  });
100
- if (l.trigger === "click" || l.trigger === "manual")
101
- $(
102
- a,
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
- f("click-outside", e), r.value = !1;
107
+ g("click-outside", e), o.value = !1;
105
108
  },
106
- { ignore: [c] }
109
+ { ignore: [a] }
107
110
  );
108
- else if (l.trigger === "hover") {
109
- const e = z(c, a, { delayEnter: 100, delayLeave: 100 });
110
- C(e, (m) => {
111
- r.value = m;
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 n = () => {
115
- l.trigger === "click" && (r.value = !r.value);
116
- }, i = (e) => {
117
- r.value = !1, f("item-click", e);
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 = s.value) == null || e.update();
160
+ (e = i.value) == null || e.update();
123
161
  }
124
- }), (e, m) => (w(), I(X(A), {
125
- show: r.value,
162
+ }), (e, f) => (b(), j(L(V), {
163
+ show: o.value,
126
164
  class: "tr-dropdown-menu",
127
165
  ref_key: "basePopperRef",
128
- ref: s,
166
+ ref: i,
129
167
  placement: "top-left",
130
- "append-to": l.appendTo,
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: n }
172
+ "trigger-events": { onClick: r, onKeydown: d }
135
173
  }, {
136
- trigger: y(() => [
137
- O(e.$slots, "trigger", {}, void 0, !0)
174
+ trigger: A(() => [
175
+ F(e.$slots, "trigger", {}, void 0, !0)
138
176
  ]),
139
- content: y(() => [
140
- j("ul", J, [
141
- (w(!0), _(D, null, L(l.items, (u) => (w(), _("li", {
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: u.id,
144
- onClick: (h) => i(u)
145
- }, Y(u.text), 9, K))), 128))
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
- }), v = /* @__PURE__ */ G(Q, [["__scopeId", "data-v-6fc07009"]]);
152
- v.name = "TrDropdownMenu";
153
- const W = function(o) {
154
- o.component(v.name, v);
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
- v.install = W;
200
+ x.install = oe;
157
201
  export {
158
- v as default
202
+ x as default
159
203
  };