vue-composable-ui 1.1.5 → 1.3.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.
Files changed (40) hide show
  1. package/dist/combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js +144 -0
  2. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js +21 -0
  3. package/dist/composable-ui.js +27 -27
  4. package/dist/composable-ui11.js +1 -1
  5. package/dist/composable-ui12.js +1 -1
  6. package/dist/composable-ui13.js +1 -1
  7. package/dist/composable-ui15.js +1 -1
  8. package/dist/composable-ui18.js +1 -1
  9. package/dist/composable-ui2.js +1 -1
  10. package/dist/composable-ui20.js +17 -18
  11. package/dist/composable-ui22.js +117 -105
  12. package/dist/composable-ui23.js +71 -82
  13. package/dist/composable-ui24.js +7 -4
  14. package/dist/composable-ui6.js +1 -1
  15. package/dist/composable-ui9.js +1 -1
  16. package/dist/menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js +82 -0
  17. package/dist/{menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js → menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js} +10 -9
  18. package/dist/popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js +64 -0
  19. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js +23 -0
  20. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js +42 -0
  21. package/dist/tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js +81 -0
  22. package/dist/types/components/combobox/combobox.vue.d.ts +9 -1
  23. package/dist/types/components/injectionKeys.d.ts +20 -2
  24. package/dist/types/components/menu/menu.vue.d.ts +2 -0
  25. package/dist/types/components/popover/popover.vue.d.ts +21 -7
  26. package/dist/types/components/tooltip.vue.d.ts +2 -2
  27. package/dist/types/composables/formControl.d.ts +3 -4
  28. package/dist/types/composables/list.d.ts +8 -4
  29. package/dist/types/composables/listOption.d.ts +3 -4
  30. package/dist/types/composables/popover.d.ts +19 -11
  31. package/dist/types/main.d.ts +2 -2
  32. package/dist/types/utils/element.d.ts +10 -3
  33. package/package.json +1 -1
  34. package/dist/combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js +0 -139
  35. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js +0 -20
  36. package/dist/menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js +0 -82
  37. package/dist/popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js +0 -50
  38. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js +0 -30
  39. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js +0 -40
  40. package/dist/tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js +0 -85
@@ -0,0 +1,144 @@
1
+ import { defineComponent as R, computed as o, useModel as T, useId as U, shallowRef as _, ref as q, watch as z, provide as G, openBlock as c, createElementBlock as p, Fragment as b, unref as k, renderList as J, createBlock as x, createCommentVNode as Q, renderSlot as W, mergeModels as X, nextTick as A } from "vue";
2
+ import { toElement as O } from "./composable-ui24.js";
3
+ import { usePopover as Y } from "./composable-ui23.js";
4
+ import { useList as Z } from "./composable-ui22.js";
5
+ import { _ as S } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-BtODyQnH.js";
6
+ import { injectCombobox as ee } from "./composable-ui19.js";
7
+ const ne = /* @__PURE__ */ R({
8
+ inheritAttrs: !1,
9
+ __name: "combobox",
10
+ props: /* @__PURE__ */ X({
11
+ displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((a) => a.toString()).join(", ") : e?.toString() },
12
+ id: {},
13
+ activator: {},
14
+ name: {},
15
+ formValue: { type: Function, default: (e) => e }
16
+ }, {
17
+ modelValue: {},
18
+ modelModifiers: {}
19
+ }),
20
+ emits: ["update:modelValue"],
21
+ setup(e) {
22
+ const a = e, I = o(() => i.value ? r.value.map((t) => a.formValue(t)) : a.formValue(r.value)), r = T(e, "modelValue"), w = a.id ?? U(), f = `${w}-popover`, m = _(
23
+ null
24
+ ), y = q(null), C = o(() => a.activator ?? O(m)), { isOpen: l, toggle: D, open: n, close: s } = Y(C, y, {
25
+ direction: "down",
26
+ align: "stretch",
27
+ position: "fixed",
28
+ closeOnOutsideClick: !0,
29
+ closeOnInsideClick: !1
30
+ }), {
31
+ items: E,
32
+ activeItem: u,
33
+ selectedItem: $,
34
+ isMultiselectable: i,
35
+ selectActiveItem: d,
36
+ activateSelectedItem: F,
37
+ activateFirstItem: v,
38
+ activateLastItem: V,
39
+ activateNextItem: M,
40
+ activatePrevItem: B
41
+ } = Z(r), g = o(() => a.displayValue(r.value)), L = o(() => u.value?.element.value ?? null), j = o(
42
+ () => $.value?.element.value ?? null
43
+ );
44
+ z(E, () => {
45
+ !u.value && E.value.length && (F({ focus: !1 }), u.value || v({ focus: !1 }));
46
+ });
47
+ function H() {
48
+ O(m)?.focus();
49
+ }
50
+ function K(t) {
51
+ if (l.value)
52
+ switch (t.code) {
53
+ case "Space":
54
+ d(), i.value || s({ focus: !0 });
55
+ break;
56
+ case "Enter":
57
+ d(), s({ focus: !0 });
58
+ break;
59
+ case "Tab":
60
+ d(), s({ focus: !0 });
61
+ return;
62
+ case "ArrowUp":
63
+ B({ focus: !1, loop: !1 });
64
+ break;
65
+ case "ArrowDown":
66
+ M({ focus: !1, loop: !1 });
67
+ break;
68
+ case "Home":
69
+ v({ focus: !1 });
70
+ break;
71
+ case "End":
72
+ V({ focus: !1 });
73
+ break;
74
+ case "Escape":
75
+ s({ focus: !0 });
76
+ break;
77
+ default:
78
+ return;
79
+ }
80
+ else
81
+ switch (t.code) {
82
+ case "Space":
83
+ case "Enter":
84
+ n({ focus: !1 });
85
+ break;
86
+ case "End":
87
+ case "ArrowUp":
88
+ n({ focus: !1 }), A(() => V({ focus: !1 }));
89
+ break;
90
+ case "Home":
91
+ case "ArrowDown":
92
+ n({ focus: !1 }), A(() => v({ focus: !1 }));
93
+ break;
94
+ default:
95
+ return;
96
+ }
97
+ t.preventDefault();
98
+ }
99
+ const h = o(() => ({
100
+ ref: m,
101
+ id: w,
102
+ "aria-controls": l.value ? f : void 0,
103
+ "aria-expanded": l.value,
104
+ "aria-activedescendant": u.value?.element.value?.id,
105
+ "aria-haspopup": "listbox",
106
+ role: "combobox"
107
+ }));
108
+ return G(ee, {
109
+ displayValue: g,
110
+ popoverId: f,
111
+ popoverRef: y,
112
+ activeItemEl: L,
113
+ selectedItemEl: j,
114
+ isOpen: l,
115
+ open: n,
116
+ close: s,
117
+ focus: H,
118
+ isMultiselectable: i,
119
+ activatorAttrs: h,
120
+ activatorOnKeyDown: K
121
+ }), (t, ae) => (c(), p(b, null, [
122
+ e.name ? (c(), p(b, { key: 0 }, [
123
+ k(i) ? (c(!0), p(b, { key: 0 }, J(I.value, (N, P) => (c(), x(S, {
124
+ name: `${e.name}[${P}]`,
125
+ value: N
126
+ }, null, 8, ["name", "value"]))), 256)) : (c(), x(S, {
127
+ key: 1,
128
+ name: e.name,
129
+ value: I.value
130
+ }, null, 8, ["name", "value"]))
131
+ ], 64)) : Q("", !0),
132
+ W(t.$slots, "default", {
133
+ popoverId: f,
134
+ isOpen: k(l),
135
+ toggle: () => k(D)(),
136
+ displayValue: g.value,
137
+ attrs: h.value
138
+ })
139
+ ], 64));
140
+ }
141
+ });
142
+ export {
143
+ ne as _
144
+ };
@@ -0,0 +1,21 @@
1
+ import { defineComponent as r, inject as n, unref as e, openBlock as i, createElementBlock as c, renderSlot as p, createCommentVNode as m } from "vue";
2
+ import { injectCombobox as s } from "./composable-ui19.js";
3
+ const d = ["id"], f = /* @__PURE__ */ r({
4
+ __name: "comboboxOptions",
5
+ setup(b) {
6
+ const o = n(s);
7
+ if (!o)
8
+ throw new Error("Combobox injectable context is not provided");
9
+ return (t, l) => e(o).isOpen.value ? (i(), c("div", {
10
+ key: 0,
11
+ ref: e(o).popoverRef,
12
+ id: e(o).popoverId,
13
+ role: "listbox"
14
+ }, [
15
+ p(t.$slots, "default")
16
+ ], 8, d)) : m("", !0);
17
+ }
18
+ });
19
+ export {
20
+ f as _
21
+ };
@@ -1,51 +1,51 @@
1
1
  import { usePopover as e } from "./composable-ui23.js";
2
2
  import { useList as p } from "./composable-ui22.js";
3
- import { useListOption as s } from "./composable-ui21.js";
3
+ import { useListOption as x } from "./composable-ui21.js";
4
4
  import { useFormControl as a } from "./composable-ui20.js";
5
- import { useHTMLElement as n } from "./composable-ui24.js";
5
+ import { toElement as n } from "./composable-ui24.js";
6
6
  import { useValidation as b } from "./composable-ui25.js";
7
- import { injectCombobox as u, injectMenu as C, injectPopover as T, injectTabs as l } from "./composable-ui19.js";
8
- import { _ as M } from "./listbox.vue_vue_type_script_setup_true_lang-OvzuliPQ.js";
9
- import { _ as c } from "./listboxOption.vue_vue_type_script_setup_true_lang-BhQm7GxW.js";
10
- import { _ as v } from "./tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js";
7
+ import { injectCombobox as u, injectMenu as C, injectPopover as l, injectTabs as T } from "./composable-ui19.js";
8
+ import { _ as P } from "./listbox.vue_vue_type_script_setup_true_lang-OvzuliPQ.js";
9
+ import { _ as j } from "./listboxOption.vue_vue_type_script_setup_true_lang-BhQm7GxW.js";
10
+ import { _ as M } from "./tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js";
11
11
  import { _ as I } from "./tabList.vue_vue_type_script_setup_true_lang-BjKRcoyi.js";
12
12
  import { _ as g } from "./tab.vue_vue_type_script_setup_true_lang-C12uJKqo.js";
13
13
  import { _ as E } from "./tabPanel.vue_vue_type_script_setup_true_lang-DwEwu3p7.js";
14
- import { _ as H } from "./popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js";
15
- import { _ as h } from "./popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js";
16
- import { _ as q } from "./tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js";
17
- import { _ as y } from "./menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js";
18
- import { _ as A } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js";
19
- import { _ as G } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
20
- import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
14
+ import { _ as V } from "./popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js";
15
+ import { _ as k } from "./popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js";
16
+ import { _ as w } from "./tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js";
17
+ import { _ as z } from "./menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js";
18
+ import { _ as B } from "./menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js";
19
+ import { _ as H } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
20
+ import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js";
21
21
  import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-BTDqx7mj.js";
22
- import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js";
22
+ import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js";
23
23
  import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js";
24
24
  export {
25
25
  K as Combobox,
26
26
  Q as ComboboxInput,
27
27
  W as ComboboxOption,
28
28
  S as ComboboxOptions,
29
- M as Listbox,
30
- c as ListboxOption,
31
- y as Menu,
32
- G as MenuItem,
33
- A as MenuItems,
34
- H as Popover,
35
- h as PopoverDialog,
29
+ P as Listbox,
30
+ j as ListboxOption,
31
+ z as Menu,
32
+ H as MenuItem,
33
+ B as MenuItems,
34
+ V as Popover,
35
+ k as PopoverDialog,
36
36
  g as Tab,
37
- v as TabContainer,
37
+ M as TabContainer,
38
38
  I as TabList,
39
39
  E as TabPanel,
40
- q as Tooltip,
40
+ w as Tooltip,
41
41
  u as injectCombobox,
42
42
  C as injectMenu,
43
- T as injectPopover,
44
- l as injectTabs,
43
+ l as injectPopover,
44
+ T as injectTabs,
45
+ n as toElement,
45
46
  a as useFormControl,
46
- n as useHTMLElement,
47
47
  p as useList,
48
- s as useListOption,
48
+ x as useListOption,
49
49
  e as usePopover,
50
50
  b as useValidation
51
51
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js";
1
+ import { _ as f } from "./menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-D1gc6B-4.js";
1
+ import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./popoverDialog.vue_vue_type_script_setup_true_lang-ApsJsSDN.js";
1
+ import { _ as f } from "./popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js";
1
+ import { _ as f } from "./tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./tooltip.vue_vue_type_script_setup_true_lang-kslDnoRH.js";
1
+ import { _ as f } from "./tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
1
+ import { _ as f } from "./combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,19 +1,18 @@
1
- import { ref as t, onMounted as V, onBeforeUnmount as M, readonly as m, unref as g } from "vue";
2
- import { useHTMLElement as b } from "./composable-ui24.js";
3
- function k(y, h = [], w = !0) {
4
- const a = t(!1), n = t(!0), l = t(), r = t("");
1
+ import { ref as n, onMounted as p, onBeforeUnmount as b, readonly as m, unref as g } from "vue";
2
+ function M(y, h = [], w = !0) {
3
+ const o = n(!1), t = n(!0), l = n(), r = n("");
5
4
  let e, u;
6
5
  function s() {
7
6
  e?.focus();
8
7
  }
9
8
  function d() {
10
- n.value = e.validity.valid, l.value = e.validity, r.value = e.validationMessage;
9
+ t.value = e.validity.valid, l.value = e.validity, r.value = e.validationMessage;
11
10
  }
12
11
  function f() {
13
12
  if (!e) throw new Error("Form element is undefined");
14
- const o = e.value;
15
- for (const p of g(h)) {
16
- const c = p(o);
13
+ const a = e.value;
14
+ for (const V of g(h)) {
15
+ const c = V(a);
17
16
  if (c !== !0) {
18
17
  e.setCustomValidity(c);
19
18
  break;
@@ -22,34 +21,34 @@ function k(y, h = [], w = !0) {
22
21
  }
23
22
  function v() {
24
23
  if (!e) throw new Error("Form element is undefined");
25
- return e.setCustomValidity(""), e.validity.valid && f(), d(), n.value;
24
+ return e.setCustomValidity(""), e.validity.valid && f(), d(), t.value;
26
25
  }
27
- function C(o) {
28
- d(), g(w) || o.preventDefault();
26
+ function C(a) {
27
+ d(), g(w) || a.preventDefault();
29
28
  }
30
29
  function E() {
31
- v(), a.value = u !== e.value;
30
+ v(), o.value = u !== e.value;
32
31
  }
33
32
  let i = new AbortController();
34
- return V(() => {
35
- if (e = b(y).value, !e) throw new Error("Form element is undefined");
33
+ return p(() => {
34
+ if (e = y.value, !e) throw new Error("Form element is undefined");
36
35
  f(), u = e.value, e.addEventListener("change", E, {
37
36
  signal: i.signal,
38
37
  passive: !0
39
38
  }), e.addEventListener("invalid", C, {
40
39
  signal: i.signal
41
40
  }), e?.autofocus && s();
42
- }), M(() => {
41
+ }), b(() => {
43
42
  i.abort();
44
43
  }), {
45
44
  focus: s,
46
45
  validate: v,
47
- isValid: n,
46
+ isValid: t,
48
47
  validity: m(l),
49
48
  validationMessage: m(r),
50
- isChanged: a
49
+ isChanged: o
51
50
  };
52
51
  }
53
52
  export {
54
- k as useFormControl
53
+ M as useFormControl
55
54
  };
@@ -1,144 +1,156 @@
1
- import { shallowRef as N, ref as R, computed as g, provide as B, readonly as h, shallowReadonly as J, triggerRef as S, unref as s } from "vue";
2
- import { useHTMLElement as _ } from "./composable-ui24.js";
3
- const q = /* @__PURE__ */ Symbol();
4
- function d(r, c) {
5
- const [n, l] = [s(r), s(c)];
6
- return typeof n == "object" ? typeof l == "object" ? JSON.stringify(n) === JSON.stringify(l) : !1 : n === l;
1
+ import { shallowRef as F, ref as J, computed as d, provide as T, readonly as b, shallowReadonly as q, triggerRef as E, unref as f } from "vue";
2
+ import { toElement as C } from "./composable-ui24.js";
3
+ const G = /* @__PURE__ */ Symbol();
4
+ function w(u, s) {
5
+ return !!(u.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
7
6
  }
8
- function P(r) {
9
- let c = 0;
10
- const n = N([]), l = R(), v = g(() => Array.isArray(r.value));
11
- function o(e) {
12
- const t = n.value.find((i) => i.id === e);
13
- if (!t) throw new Error(`Item not found: (${e})`);
14
- return t;
7
+ function h(u, s) {
8
+ const [t, i] = [f(u), f(s)];
9
+ return typeof t == "object" ? typeof i == "object" ? JSON.stringify(t) === JSON.stringify(i) : !1 : t === i;
10
+ }
11
+ function W(u) {
12
+ let s = 0;
13
+ const t = F([]), i = J(), m = d(() => Array.isArray(u.value));
14
+ function c(e) {
15
+ const n = t.value.find((l) => l.id === e);
16
+ if (!n) throw new Error(`Item not found: (${e})`);
17
+ return n;
15
18
  }
16
- function b(e) {
17
- const t = s(e.element);
18
- if (t)
19
- return t.focus(), t;
19
+ function L(e) {
20
+ const n = e.element.value;
21
+ if (n)
22
+ return n.focus(), n;
20
23
  }
21
- function f(e, { focus: t = !1 } = {}) {
22
- l.value = e?.id ?? void 0, e !== void 0 && t && b(e);
24
+ function o(e, { focus: n = !1 } = {}) {
25
+ i.value = e?.id ?? void 0, e !== void 0 && n && L(e);
23
26
  }
24
- function O(e, { focus: t = !1 } = {}) {
25
- const i = o(e);
26
- return f(i, { focus: t });
27
+ function A(e, { focus: n = !1 } = {}) {
28
+ const l = c(e);
29
+ return o(l, { focus: n });
27
30
  }
28
- function m(e) {
29
- return l.value === e;
31
+ function x(e) {
32
+ return i.value === e;
30
33
  }
31
- function w(e, t, i = !1) {
32
- const a = _(e), u = c++;
33
- return n.value.push({
34
- id: u,
35
- value: t,
36
- element: a,
37
- disabled: i
38
- }), S(n), u;
34
+ function _(e, n, l = !1) {
35
+ const r = s++, a = {
36
+ id: r,
37
+ value: n,
38
+ // Derived rather than captured: the ref is re-read on every access, so
39
+ // an option that remounts — a filtered list re-rendering, say — is
40
+ // still the element the list focuses and reads its id from, and one
41
+ // registered through a component resolves to that component's root.
42
+ element: d(() => C(e)),
43
+ disabled: l
44
+ }, g = a.element.value, S = t.value[t.value.length - 1]?.element.value;
45
+ let v = t.value.length;
46
+ return g && S && !w(S, g) && (v = t.value.findIndex((D) => {
47
+ const N = D.element.value;
48
+ return !!N && w(g, N);
49
+ }), v === -1 && (v = t.value.length)), t.value.splice(v, 0, a), E(t), r;
39
50
  }
40
- function A(e) {
41
- m(e) && f();
42
- const t = o(e), i = n.value.indexOf(t);
43
- n.value.splice(i, 1), S(n);
51
+ function j(e) {
52
+ x(e) && o();
53
+ const n = c(e), l = t.value.indexOf(n);
54
+ t.value.splice(l, 1), E(t);
44
55
  }
45
- function I(e) {
46
- const t = o(e);
47
- if (s(t.disabled)) return;
48
- const i = s(t.value);
49
- if (i !== void 0) {
50
- if (s(v)) {
51
- const a = r.value.findIndex(
52
- (u) => d(i, u)
56
+ function p(e) {
57
+ const n = c(e);
58
+ if (f(n.disabled)) return;
59
+ const l = f(n.value);
60
+ if (l !== void 0) {
61
+ if (f(m)) {
62
+ const r = u.value.findIndex(
63
+ (a) => h(l, a)
53
64
  );
54
- a > -1 ? r.value.splice(a, 1) : r.value = [...r.value, i];
65
+ r > -1 ? u.value.splice(r, 1) : u.value = [...u.value, l];
55
66
  } else
56
- r.value = i;
57
- f(t);
67
+ u.value = l;
68
+ o(n);
58
69
  }
59
70
  }
60
- function y(e) {
61
- return s(v) ? !!r.value.find(
62
- (t) => d(e.value, t)
63
- ) : d(r, e.value);
71
+ function I(e) {
72
+ return f(m) ? !!u.value.find(
73
+ (n) => h(e.value, n)
74
+ ) : h(u, e.value);
64
75
  }
65
- function L(e) {
76
+ function M(e) {
66
77
  try {
67
- const t = o(e);
68
- return y(t);
78
+ const n = c(e);
79
+ return I(n);
69
80
  } catch {
70
81
  return !1;
71
82
  }
72
83
  }
73
- function j({ focus: e = !1 } = {}) {
74
- for (let t of n.value)
75
- if (y(t))
76
- return f(t, { focus: e });
84
+ function P({ focus: e = !1 } = {}) {
85
+ for (let n of t.value)
86
+ if (I(n))
87
+ return o(n, { focus: e });
77
88
  }
78
- function p({ focus: e = !1 } = {}) {
79
- if (n.value.length)
80
- return f(n.value[0], { focus: e });
89
+ function y({ focus: e = !1 } = {}) {
90
+ if (t.value.length)
91
+ return o(t.value[0], { focus: e });
81
92
  }
82
- function x({ focus: e = !1 } = {}) {
83
- if (n.value.length)
84
- return f(n.value[n.value.length - 1], { focus: e });
93
+ function O({ focus: e = !1 } = {}) {
94
+ if (t.value.length)
95
+ return o(t.value[t.value.length - 1], { focus: e });
85
96
  }
86
- function E({
97
+ function R({
87
98
  focus: e = !1,
88
- loop: t = !1
99
+ loop: n = !1
89
100
  } = {}) {
90
- if (l.value === void 0) return p({ focus: e });
91
- const i = o(l.value), a = n.value.indexOf(i);
92
- let u;
93
- if (a + 1 < n.value.length)
94
- u = n.value[a + 1];
95
- else if (t)
96
- u = n.value[0];
101
+ if (i.value === void 0) return y({ focus: e });
102
+ const l = c(i.value), r = t.value.indexOf(l);
103
+ let a;
104
+ if (r + 1 < t.value.length)
105
+ a = t.value[r + 1];
106
+ else if (n)
107
+ a = t.value[0];
97
108
  else
98
109
  return;
99
- return f(u, { focus: e });
110
+ return o(a, { focus: e });
100
111
  }
101
- function M({
112
+ function B({
102
113
  focus: e = !1,
103
- loop: t = !1
114
+ loop: n = !1
104
115
  } = {}) {
105
- if (l.value === void 0) return x({ focus: e });
106
- const i = o(l.value), a = n.value.indexOf(i);
107
- let u;
108
- if (a - 1 > -1)
109
- u = n.value[a - 1];
110
- else if (t)
111
- u = n.value[n.value.length - 1];
116
+ if (i.value === void 0) return O({ focus: e });
117
+ const l = c(i.value), r = t.value.indexOf(l);
118
+ let a;
119
+ if (r - 1 > -1)
120
+ a = t.value[r - 1];
121
+ else if (n)
122
+ a = t.value[t.value.length - 1];
112
123
  else
113
124
  return;
114
- return f(u, { focus: e });
125
+ return o(a, { focus: e });
115
126
  }
116
- return B(q, {
117
- value: h(r),
118
- selectItem: I,
119
- activateItem: O,
120
- deactivateItem: () => f(),
121
- isSelected: L,
122
- isActive: m,
123
- addItem: w,
124
- removeItem: A
127
+ return T(G, {
128
+ value: b(u),
129
+ selectItem: p,
130
+ activateItem: A,
131
+ deactivateItem: () => o(),
132
+ isSelected: M,
133
+ isActive: x,
134
+ addItem: _,
135
+ removeItem: j
125
136
  }), {
126
- items: J(n),
127
- isMultiselectable: h(v),
128
- activeItem: g(
129
- () => l.value !== void 0 ? o(l.value) : void 0
137
+ items: q(t),
138
+ isMultiselectable: b(m),
139
+ activeItem: d(
140
+ () => i.value !== void 0 ? c(i.value) : void 0
130
141
  ),
142
+ selectedItem: d(() => t.value.find(I)),
131
143
  selectActiveItem: () => {
132
- l.value !== void 0 && I(l.value);
144
+ i.value !== void 0 && p(i.value);
133
145
  },
134
- activateSelectedItem: j,
135
- activateFirstItem: p,
136
- activateLastItem: x,
137
- activateNextItem: E,
138
- activatePrevItem: M
146
+ activateSelectedItem: P,
147
+ activateFirstItem: y,
148
+ activateLastItem: O,
149
+ activateNextItem: R,
150
+ activatePrevItem: B
139
151
  };
140
152
  }
141
153
  export {
142
- q as injectList,
143
- P as useList
154
+ G as injectList,
155
+ W as useList
144
156
  };