@quidgest/ui 0.16.6 → 0.16.8

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,191 +1,85 @@
1
- import { noop as g, isIOS as $, toRef as w, isClient as C, toArray as x, watchImmediate as F, tryOnScopeDispose as I, isObject as W } from "../shared/index.js";
2
- import { shallowRef as M, watch as O, nextTick as q, computed as P, toValue as v, unref as L, getCurrentInstance as _, onMounted as B } from "vue";
3
- const E = C ? window : void 0;
4
- function y(e) {
5
- var r;
6
- const a = v(e);
7
- return (r = a == null ? void 0 : a.$el) != null ? r : a;
1
+ import { toRef as y, isClient as x, tryOnScopeDispose as _ } from "../shared/index.js";
2
+ import { noop as C } from "../shared/index.js";
3
+ import { shallowRef as m, watch as v, nextTick as b, toValue as h, computed as w, getCurrentInstance as R, onMounted as z } from "vue";
4
+ const p = x ? window : void 0;
5
+ function g(e) {
6
+ var t;
7
+ const r = h(e);
8
+ return (t = r == null ? void 0 : r.$el) != null ? t : r;
8
9
  }
9
- function A(...e) {
10
- const r = [], a = () => {
11
- r.forEach((u) => u()), r.length = 0;
12
- }, o = (u, n, i, s) => (u.addEventListener(n, i, s), () => u.removeEventListener(n, i, s)), c = P(() => {
13
- const u = x(v(e[0])).filter((n) => n != null);
14
- return u.every((n) => typeof n != "string") ? u : void 0;
15
- }), f = F(
16
- () => {
17
- var u, n;
18
- return [
19
- (n = (u = c.value) == null ? void 0 : u.map((i) => y(i))) != null ? n : [E].filter((i) => i != null),
20
- x(v(c.value ? e[1] : e[0])),
21
- x(L(c.value ? e[2] : e[1])),
22
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
23
- v(c.value ? e[3] : e[2])
24
- ];
25
- },
26
- ([u, n, i, s]) => {
27
- if (a(), !(u != null && u.length) || !(n != null && n.length) || !(i != null && i.length))
28
- return;
29
- const d = W(s) ? { ...s } : s;
30
- r.push(
31
- ...u.flatMap(
32
- (m) => n.flatMap(
33
- (b) => i.map((R) => o(m, b, R, d))
34
- )
35
- )
36
- );
37
- },
38
- { flush: "post" }
39
- ), h = () => {
40
- f(), a();
41
- };
42
- return I(a), h;
43
- }
44
- let z = !1;
45
- function J(e, r, a = {}) {
46
- const { window: o = E, ignore: c = [], capture: f = !0, detectIframe: h = !1, controls: u = !1 } = a;
47
- if (!o)
48
- return u ? { stop: g, cancel: g, trigger: g } : g;
49
- if ($ && !z) {
50
- z = !0;
51
- const t = { passive: !0 };
52
- Array.from(o.document.body.children).forEach((l) => A(l, "click", g, t)), A(o.document.documentElement, "click", g, t);
53
- }
54
- let n = !0;
55
- const i = (t) => v(c).some((l) => {
56
- if (typeof l == "string")
57
- return Array.from(o.document.querySelectorAll(l)).some((p) => p === t.target || t.composedPath().includes(p));
58
- {
59
- const p = y(l);
60
- return p && (t.target === p || t.composedPath().includes(p));
61
- }
62
- });
63
- function s(t) {
64
- const l = v(t);
65
- return l && l.$.subTree.shapeFlag === 16;
66
- }
67
- function d(t, l) {
68
- const p = v(t), T = p.$.subTree && p.$.subTree.children;
69
- return T == null || !Array.isArray(T) ? !1 : T.some((S) => S.el === l.target || l.composedPath().includes(S.el));
70
- }
71
- const m = (t) => {
72
- const l = y(e);
73
- if (t.target != null && !(!(l instanceof Element) && s(e) && d(e, t)) && !(!l || l === t.target || t.composedPath().includes(l))) {
74
- if ("detail" in t && t.detail === 0 && (n = !i(t)), !n) {
75
- n = !0;
76
- return;
77
- }
78
- r(t);
79
- }
80
- };
81
- let b = !1;
82
- const R = [
83
- A(o, "click", (t) => {
84
- b || (b = !0, setTimeout(() => {
85
- b = !1;
86
- }, 0), m(t));
87
- }, { passive: !0, capture: f }),
88
- A(o, "pointerdown", (t) => {
89
- const l = y(e);
90
- n = !i(t) && !!(l && !t.composedPath().includes(l));
91
- }, { passive: !0 }),
92
- h && A(o, "blur", (t) => {
93
- setTimeout(() => {
94
- var l;
95
- const p = y(e);
96
- ((l = o.document.activeElement) == null ? void 0 : l.tagName) === "IFRAME" && !(p != null && p.contains(o.document.activeElement)) && r(t);
97
- }, 0);
98
- }, { passive: !0 })
99
- ].filter(Boolean), k = () => R.forEach((t) => t());
100
- return u ? {
101
- stop: k,
102
- cancel: () => {
103
- n = !1;
104
- },
105
- trigger: (t) => {
106
- n = !0, m(t), n = !1;
107
- }
108
- } : k;
109
- }
110
- function H() {
111
- const e = M(!1), r = _();
112
- return r && B(() => {
10
+ function A() {
11
+ const e = m(!1), t = R();
12
+ return t && z(() => {
113
13
  e.value = !0;
114
- }, r), e;
14
+ }, t), e;
115
15
  }
116
- function j(e) {
117
- const r = H();
118
- return P(() => (r.value, !!e()));
16
+ function O(e) {
17
+ const t = A();
18
+ return w(() => (t.value, !!e()));
119
19
  }
120
- function D(e, r, a = {}) {
121
- const { window: o = E, ...c } = a;
122
- let f;
123
- const h = j(() => o && "ResizeObserver" in o), u = () => {
124
- f && (f.disconnect(), f = void 0);
125
- }, n = P(() => {
126
- const d = v(e);
127
- return Array.isArray(d) ? d.map((m) => y(m)) : [y(d)];
128
- }), i = O(
129
- n,
130
- (d) => {
131
- if (u(), h.value && o) {
132
- f = new ResizeObserver(r);
133
- for (const m of d)
134
- m && f.observe(m, c);
20
+ function M(e, t, r = {}) {
21
+ const { window: d = p, ...u } = r;
22
+ let l;
23
+ const o = O(() => d && "ResizeObserver" in d), a = () => {
24
+ l && (l.disconnect(), l = void 0);
25
+ }, f = w(() => {
26
+ const i = h(e);
27
+ return Array.isArray(i) ? i.map((s) => g(s)) : [g(i)];
28
+ }), c = v(
29
+ f,
30
+ (i) => {
31
+ if (a(), o.value && d) {
32
+ l = new ResizeObserver(t);
33
+ for (const s of i)
34
+ s && l.observe(s, u);
135
35
  }
136
36
  },
137
37
  { immediate: !0, flush: "post" }
138
- ), s = () => {
139
- u(), i();
38
+ ), n = () => {
39
+ a(), c();
140
40
  };
141
- return I(s), {
142
- isSupported: h,
143
- stop: s
41
+ return _(n), {
42
+ isSupported: o,
43
+ stop: n
144
44
  };
145
45
  }
146
- function N(e = E, r) {
147
- e && typeof e.requestAnimationFrame == "function" ? e.requestAnimationFrame(r) : r();
46
+ function S(e = p, t) {
47
+ e && typeof e.requestAnimationFrame == "function" ? e.requestAnimationFrame(t) : t();
148
48
  }
149
- function K(e = {}) {
150
- var r, a;
151
- const { window: o = E } = e, c = w(e == null ? void 0 : e.element), f = w((r = e == null ? void 0 : e.input) != null ? r : ""), h = (a = e == null ? void 0 : e.styleProp) != null ? a : "height", u = M(1), n = M(0);
152
- function i() {
153
- var s;
154
- if (!c.value)
49
+ function F(e = {}) {
50
+ var t, r;
51
+ const { window: d = p } = e, u = y(e == null ? void 0 : e.element), l = y((t = e == null ? void 0 : e.input) != null ? t : ""), o = (r = e == null ? void 0 : e.styleProp) != null ? r : "height", a = m(1), f = m(0);
52
+ function c() {
53
+ var n;
54
+ if (!u.value)
155
55
  return;
156
- let d = "";
157
- c.value.style[h] = "1px", u.value = (s = c.value) == null ? void 0 : s.scrollHeight;
158
- const m = v(e == null ? void 0 : e.styleTarget);
159
- m ? m.style[h] = `${u.value}px` : d = `${u.value}px`, c.value.style[h] = d;
56
+ let i = "";
57
+ u.value.style[o] = "1px", a.value = (n = u.value) == null ? void 0 : n.scrollHeight;
58
+ const s = h(e == null ? void 0 : e.styleTarget);
59
+ s ? s.style[o] = `${a.value}px` : i = `${a.value}px`, u.value.style[o] = i;
160
60
  }
161
- return O([f, c], () => q(i), { immediate: !0 }), O(u, () => {
162
- var s;
163
- return (s = e == null ? void 0 : e.onResize) == null ? void 0 : s.call(e);
164
- }), D(c, ([{ contentRect: s }]) => {
165
- n.value !== s.width && N(o, () => {
166
- n.value = s.width, i();
61
+ return v([l, u], () => b(c), { immediate: !0 }), v(a, () => {
62
+ var n;
63
+ return (n = e == null ? void 0 : e.onResize) == null ? void 0 : n.call(e);
64
+ }), M(u, ([{ contentRect: n }]) => {
65
+ f.value !== n.width && S(d, () => {
66
+ f.value = n.width, c();
167
67
  });
168
- }), e != null && e.watch && O(e.watch, i, { immediate: !0, deep: !0 }), {
169
- textarea: c,
170
- input: f,
171
- triggerResize: i
68
+ }), e != null && e.watch && v(e.watch, c, { immediate: !0, deep: !0 }), {
69
+ textarea: u,
70
+ input: l,
71
+ triggerResize: c
172
72
  };
173
73
  }
174
74
  export {
175
- E as defaultWindow,
176
- C as isClient,
177
- $ as isIOS,
178
- W as isObject,
179
- g as noop,
180
- J as onClickOutside,
181
- x as toArray,
182
- w as toRef,
183
- I as tryOnScopeDispose,
184
- y as unrefElement,
185
- A as useEventListener,
186
- H as useMounted,
187
- D as useResizeObserver,
188
- j as useSupported,
189
- K as useTextareaAutosize,
190
- F as watchImmediate
75
+ p as defaultWindow,
76
+ x as isClient,
77
+ C as noop,
78
+ y as toRef,
79
+ _ as tryOnScopeDispose,
80
+ g as unrefElement,
81
+ A as useMounted,
82
+ M as useResizeObserver,
83
+ O as useSupported,
84
+ F as useTextareaAutosize
191
85
  };
@@ -1,41 +1,20 @@
1
- import { toRef as o, readonly as i, ref as r, customRef as u, watch as d, getCurrentScope as c, onScopeDispose as f } from "vue";
2
- function g(n) {
3
- return c() ? (f(n), !0) : !1;
1
+ import { toRef as n, readonly as t, ref as f, customRef as r, getCurrentScope as i, onScopeDispose as c } from "vue";
2
+ function s(e) {
3
+ return i() ? (c(e), !0) : !1;
4
4
  }
5
- const s = typeof window < "u" && typeof document < "u";
5
+ const l = typeof window < "u" && typeof document < "u";
6
6
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
7
- const a = Object.prototype.toString, y = (n) => a.call(n) === "[object Object]", l = () => {
8
- }, m = /* @__PURE__ */ w();
9
- function w() {
10
- var n, e;
11
- return s && ((n = window == null ? void 0 : window.navigator) == null ? void 0 : n.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((e = window == null ? void 0 : window.navigator) == null ? void 0 : e.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
12
- }
13
- function S(...n) {
14
- if (n.length !== 1)
15
- return o(...n);
16
- const e = n[0];
17
- return typeof e == "function" ? i(u(() => ({ get: e, set: l }))) : r(e);
18
- }
19
- function b(n) {
20
- return Array.isArray(n) ? n : [n];
21
- }
22
- function h(n, e, t) {
23
- return d(
24
- n,
25
- e,
26
- {
27
- ...t,
28
- immediate: !0
29
- }
30
- );
7
+ const p = () => {
8
+ };
9
+ function d(...e) {
10
+ if (e.length !== 1)
11
+ return n(...e);
12
+ const o = e[0];
13
+ return typeof o == "function" ? t(r(() => ({ get: o, set: p }))) : f(o);
31
14
  }
32
15
  export {
33
- s as isClient,
34
- m as isIOS,
35
- y as isObject,
36
- l as noop,
37
- b as toArray,
38
- S as toRef,
39
- g as tryOnScopeDispose,
40
- h as watchImmediate
16
+ l as isClient,
17
+ p as noop,
18
+ d as toRef,
19
+ s as tryOnScopeDispose
41
20
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quidgest/ui",
3
3
  "description": "Quidgest's UI framework",
4
- "version": "0.16.6",
4
+ "version": "0.16.8",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "author": "Quidgest",