vue-composable-ui 1.1.3 → 1.1.5

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,23 +1,23 @@
1
- import { defineComponent as r, inject as a, useModel as m, watch as p, withDirectives as d, openBlock as s, createElementBlock as f, mergeProps as v, unref as n, vModelDynamic as c } from "vue";
1
+ import { defineComponent as i, inject as r, useModel as m, watch as p, withDirectives as d, openBlock as s, createElementBlock as f, mergeProps as v, unref as n, vModelDynamic as c } from "vue";
2
2
  import { injectCombobox as b } from "./composable-ui19.js";
3
- const y = /* @__PURE__ */ r({
3
+ const y = /* @__PURE__ */ i({
4
4
  __name: "comboboxInput",
5
5
  props: {
6
6
  modelValue: {},
7
7
  modelModifiers: {}
8
8
  },
9
9
  emits: ["update:modelValue"],
10
- setup(i) {
11
- const e = a(b);
10
+ setup(a) {
11
+ const e = r(b);
12
12
  if (!e)
13
13
  throw new Error("Combobox injectable context is not provided");
14
- const l = m(i, "modelValue");
14
+ const l = m(a, "modelValue");
15
15
  function u() {
16
16
  l.value = e.displayValue.value;
17
17
  }
18
18
  return p(e.displayValue, u, { immediate: !0 }), (w, o) => d((s(), f("input", v({
19
19
  "onUpdate:modelValue": o[0] || (o[0] = (t) => l.value = t)
20
- }, n(e).activatorAttrs, {
20
+ }, n(e).activatorAttrs.value, {
21
21
  onClick: o[1] || (o[1] = (t) => n(e).open({ focus: !1 })),
22
22
  onKeydown: o[2] || (o[2] = //@ts-ignore
23
23
  (...t) => n(e).activatorOnKeyDown && n(e).activatorOnKeyDown(...t)),
@@ -18,7 +18,7 @@ import { _ as y } from "./menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js";
18
18
  import { _ as A } from "./menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js";
19
19
  import { _ as G } from "./menuItem.vue_vue_type_script_setup_true_lang-IZgj64N4.js";
20
20
  import { _ as K } from "./combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js";
21
- import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-Be5FBBbM.js";
21
+ import { _ as Q } from "./comboboxInput.vue_vue_type_script_setup_true_lang-BTDqx7mj.js";
22
22
  import { _ as S } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js";
23
23
  import { _ as W } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DmF_EaqI.js";
24
24
  export {
@@ -1,90 +1,95 @@
1
- import { ref as T, onBeforeMount as _, onMounted as F, watch as U, nextTick as P, onBeforeUnmount as j } from "vue";
2
- import { useHTMLElement as k } from "./composable-ui24.js";
3
- function G(y, z, {
1
+ import { ref as _, watch as F, nextTick as y, onBeforeMount as U, onMounted as V, onBeforeUnmount as j, toValue as z } from "vue";
2
+ import { useHTMLElement as A } from "./composable-ui24.js";
3
+ function G(L, B, {
4
4
  direction: c = "down",
5
5
  align: u = "left",
6
- position: L = "fixed",
7
- closeOnOutsideClick: A = !0,
8
- closeOnInsideClick: M = !1
6
+ position: C = "fixed",
7
+ closeOnOutsideClick: M = !0,
8
+ closeOnInsideClick: O = !1
9
9
  } = {}) {
10
- const s = T(!1);
10
+ const s = _(!1);
11
11
  function v() {
12
- const t = k(y);
13
- if (!t.value) throw new Error("Activator element is undefined");
14
- return t.value;
12
+ const e = A(L);
13
+ if (!e.value)
14
+ throw new Error(
15
+ "Activator element is undefined: " + z(L)
16
+ );
17
+ return e.value;
15
18
  }
16
19
  function $() {
17
- const t = k(z);
18
- if (!t.value) throw new Error("Popover element is undefined");
19
- return t.value;
20
+ const e = A(B);
21
+ if (!e.value)
22
+ throw new Error("Popover element is undefined: " + z(B));
23
+ return e.value;
20
24
  }
21
- function B({ focus: t = !0 } = {}) {
22
- s.value = !0, t && P(() => {
25
+ function P({ focus: e = !0 } = {}) {
26
+ s.value = !0, e && y(() => {
23
27
  $().focus();
24
28
  });
25
29
  }
26
- function E({ focus: t = !0 } = {}) {
27
- s.value = !1, t && v().focus();
30
+ function E({ focus: e = !0 } = {}) {
31
+ s.value = !1, e && v().focus();
28
32
  }
29
- function O(t) {
30
- s.value ? E(t) : B(t);
33
+ function R(e) {
34
+ s.value ? E(e) : P(e);
31
35
  }
32
36
  function h() {
33
37
  if (!s.value) return;
34
- const t = v(), r = $();
35
- r.style.position = L;
38
+ const e = v(), r = $();
39
+ r.style.position = C;
36
40
  const {
37
41
  top: f,
38
42
  right: l,
39
43
  bottom: w,
40
- left: p,
44
+ left: a,
41
45
  width: m,
42
46
  height: W
43
- } = t.getBoundingClientRect(), a = r.offsetHeight, d = r.offsetWidth, x = document.documentElement.clientHeight, b = document.documentElement.clientWidth;
47
+ } = e.getBoundingClientRect(), p = r.offsetHeight, d = r.offsetWidth, x = document.documentElement.clientHeight, b = document.documentElement.clientWidth;
44
48
  let i = c;
45
- c == "up" ? f - a < 0 && (i = "down") : c == "down" ? w + a > x && (i = "up") : c == "right" ? l + d > b && (i = "left") : c == "left" && p - d < 0 && (i = "right");
49
+ c == "up" ? f - p < 0 && (i = "down") : c == "down" ? w + p > x && (i = "up") : c == "right" ? l + d > b && (i = "left") : c == "left" && a - d < 0 && (i = "right");
46
50
  let o = u;
47
- u == "left" ? p + d > b && (o = "right") : u == "right" ? l - d < 0 && (o = "left") : u == "top" ? f + a > x && (o = "bottom") : u == "bottom" && w - a < 0 && (o = "top");
48
- const e = {
51
+ u == "left" ? a + d > b && (o = "right") : u == "right" ? l - d < 0 && (o = "left") : u == "top" ? f + p > x && (o = "bottom") : u == "bottom" && w - p < 0 && (o = "top");
52
+ const t = {
49
53
  top: "auto",
50
54
  bottom: "auto",
51
55
  left: "auto",
52
56
  right: "auto",
53
57
  width: "auto"
54
- }, n = L === "fixed";
55
- i == "up" ? e.bottom = `${W + (n ? x - w : 0)}px` : i == "down" ? e.top = `${W + (n ? f : 0)}px` : i == "right" ? e.left = `${m + (n ? p : 0)}px` : i == "left" && (e.right = `${m + (n ? b - l : 0)}px`), ["up", "down"].includes(i) ? o == "right" ? e.right = `${n ? b - l : 0}px` : o == "left" || o == "stretch" ? e.left = `${n ? p : 0}px` : o == "center" && (e.left = `${(n ? p : 0) - (d - m) / 2}px`) : o == "bottom" ? e.bottom = `${n ? x - w : 0}px` : o == "top" ? e.top = `${n ? f : 0}px` : o == "center" && (e.top = `${(n ? f : 0) - (a - W) / 2}px`), ["up", "down"].includes(i) && o === "stretch" && (e.width = m + "px");
56
- for (const C in e)
57
- r.style[C] = e[C];
58
+ }, n = C === "fixed";
59
+ i == "up" ? t.bottom = `${W + (n ? x - w : 0)}px` : i == "down" ? t.top = `${W + (n ? f : 0)}px` : i == "right" ? t.left = `${m + (n ? a : 0)}px` : i == "left" && (t.right = `${m + (n ? b - l : 0)}px`), ["up", "down"].includes(i) ? o == "right" ? t.right = `${n ? b - l : 0}px` : o == "left" || o == "stretch" ? t.left = `${n ? a : 0}px` : o == "center" && (t.left = `${(n ? a : 0) - (d - m) / 2}px`) : o == "bottom" ? t.bottom = `${n ? x - w : 0}px` : o == "top" ? t.top = `${n ? f : 0}px` : o == "center" && (t.top = `${(n ? f : 0) - (p - W) / 2}px`), ["up", "down"].includes(i) && o === "stretch" && (t.width = m + "px");
60
+ for (const k in t)
61
+ r.style[k] = t[k];
58
62
  }
59
- function R(t) {
60
- const r = t.target;
63
+ F(
64
+ s,
65
+ (e) => {
66
+ e && y(() => {
67
+ h();
68
+ });
69
+ },
70
+ { flush: "pre" }
71
+ );
72
+ function T(e) {
73
+ const r = e.target;
61
74
  if (!v().contains(r))
62
75
  try {
63
- $().contains(r) ? M && E() : A && (s.value = !1);
76
+ $().contains(r) ? O && E() : M && (s.value = !1);
64
77
  } catch {
65
78
  }
66
79
  }
67
80
  let H;
68
81
  const g = new AbortController();
69
- return _(() => {
82
+ return U(() => {
70
83
  H = new ResizeObserver(h);
71
- }), F(() => {
72
- U(
73
- s,
74
- (t) => {
75
- t && P(() => {
76
- h();
77
- });
78
- },
79
- { flush: "post" }
80
- ), window.addEventListener("resize", h, {
84
+ }), V(() => {
85
+ window.addEventListener("resize", h, {
81
86
  passive: !0,
82
87
  signal: g.signal
83
88
  }), window.addEventListener("scroll", h, {
84
89
  passive: !0,
85
90
  //capture: true,
86
91
  signal: g.signal
87
- }), window.addEventListener("click", R, {
92
+ }), window.addEventListener("click", T, {
88
93
  passive: !0,
89
94
  signal: g.signal
90
95
  }), H.observe(v());
@@ -92,9 +97,9 @@ function G(y, z, {
92
97
  g.abort(), H.disconnect();
93
98
  }), {
94
99
  isOpen: s,
95
- open: B,
100
+ open: P,
96
101
  close: E,
97
- toggle: O
102
+ toggle: R
98
103
  };
99
104
  }
100
105
  export {
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-Be5FBBbM.js";
1
+ import { _ as f } from "./comboboxInput.vue_vue_type_script_setup_true_lang-BTDqx7mj.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-composable-ui",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",