adverich-kun-ui 0.1.448 → 0.1.449

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 { ref as c, computed as i, onMounted as ee, onBeforeUnmount as te, watch as ne, createElementBlock as X, openBlock as M, Fragment as ae, withDirectives as oe, createVNode as le, createBlock as ie, resolveDynamicComponent as re, withModifiers as ue, normalizeStyle as L, normalizeClass as se, withCtx as P, renderSlot as V, vShow as de, Transition as ce, createCommentVNode as fe, nextTick as pe } from "vue";
1
+ import { ref as c, computed as i, onMounted as ee, onBeforeUnmount as te, watch as ne, createElementBlock as X, openBlock as V, Fragment as oe, withDirectives as ae, createVNode as ie, createBlock as le, resolveDynamicComponent as re, withModifiers as ue, normalizeStyle as L, normalizeClass as se, withCtx as P, renderSlot as E, vShow as de, Transition as ce, createCommentVNode as fe, nextTick as pe } from "vue";
2
2
  import { useAppbarHeight as me } from "../../../../utils/useLayout.js";
3
3
  const he = {
4
4
  __name: "KunDrawer",
@@ -43,19 +43,19 @@ const he = {
43
43
  "swipe-move",
44
44
  "swipe-end"
45
45
  ],
46
- setup(l, { emit: A }) {
46
+ setup(a, { emit: A }) {
47
47
  const s = A;
48
48
  function d(e) {
49
49
  s("update:model-value", e), s("update:modelValue", e);
50
50
  }
51
- const t = l, E = me(), B = c(null), o = c(256);
51
+ const t = a, B = me(), x = c(null), r = c(256);
52
52
  let v = 256;
53
53
  function w() {
54
54
  var e;
55
- v = ((e = B.value) == null ? void 0 : e.offsetWidth) || v, o.value = v;
55
+ v = ((e = x.value) == null ? void 0 : e.offsetWidth) || v, r.value = v;
56
56
  }
57
- const F = i(() => t.fullHeight ? "0px" : `${E.value}px`), G = i(
58
- () => t.fullHeight ? typeof window < "u" && window.innerWidth < 768 ? "100dvh" : "100vh" : `calc(100vh - ${E.value}px)`
57
+ const F = i(() => t.fullHeight ? "0px" : `${B.value}px`), G = i(
58
+ () => t.fullHeight ? typeof window < "u" && window.innerWidth < 768 ? "100dvh" : "100vh" : `calc(100vh - ${B.value}px)`
59
59
  ), O = i(() => t.rail ? t.railWidth : t.width), u = i(() => ["start", "left"].includes(t.location)), U = i(() => ["end", "right"].includes(t.location)), j = i(() => {
60
60
  switch (t.location) {
61
61
  case "start":
@@ -79,105 +79,109 @@ const he = {
79
79
  I.value,
80
80
  t.color ?? "bg-surface-dark",
81
81
  t.scrollable ? "overflow-auto" : ""
82
- ]), h = c(0), f = c(0), a = c(!1);
82
+ ]), h = c(0), f = c(0), o = c(!1);
83
83
  let g = 0, b = 0, y = 0;
84
84
  const S = i(() => {
85
- const e = k(), n = o.value || 1;
85
+ const e = C(), n = r.value || 1;
86
86
  return Math.min(1, Math.max(0, 1 - Math.abs(e) / n));
87
87
  });
88
88
  function p() {
89
- const e = a.value ? 0 : t.peekSize;
90
- return u.value ? -o.value + e : o.value - e;
89
+ const e = o.value ? 0 : t.peekSize;
90
+ return u.value ? -r.value + e : r.value - e;
91
91
  }
92
- function x() {
92
+ function k() {
93
93
  return 0;
94
94
  }
95
- function k() {
95
+ function C() {
96
96
  if (!t.swipeable)
97
- return t.modelValue ? x() : p();
98
- if (a.value) {
97
+ return t.modelValue ? k() : p();
98
+ if (o.value) {
99
99
  const e = f.value - h.value;
100
- return t.modelValue ? u.value ? Math.min(0, e) : Math.max(0, e) : u.value ? Math.min(o.value, p() + e) : Math.max(-o.value, p() + e);
100
+ return t.modelValue ? u.value ? Math.min(0, e) : Math.max(0, e) : u.value ? Math.min(r.value, p() + e) : Math.max(-r.value, p() + e);
101
101
  }
102
- return t.modelValue ? x() : p();
102
+ return t.modelValue ? k() : p();
103
103
  }
104
104
  const R = i(() => {
105
105
  let e = t.animationDuration;
106
- if (!a.value) {
107
- const n = o.value * (1 - S.value);
106
+ if (!o.value) {
107
+ const n = r.value * (1 - S.value);
108
108
  e = Math.max(120, Math.min(300, n * 1.2));
109
109
  }
110
110
  return {
111
- transform: `translateX(${k()}px)`,
111
+ transform: `translateX(${C()}px)`,
112
112
  top: F.value,
113
113
  height: G.value,
114
- transition: a.value ? "none" : `transform ${e}ms ${t.animationEasing}`
114
+ transition: o.value ? "none" : `transform ${e}ms ${t.animationEasing}`
115
115
  };
116
116
  });
117
117
  function m(e) {
118
- var n, r;
119
- return (n = e == null ? void 0 : e.touches) != null && n.length ? e.touches[0].clientX : (r = e == null ? void 0 : e.changedTouches) != null && r.length ? e.changedTouches[0].clientX : e.clientX;
120
- }
121
- function C(e) {
122
- var r;
123
- return !!e && ((r = e.closest) == null ? void 0 : r.call(e, 'input,textarea,select,button,a,[role="button"],[data-no-drag]'));
118
+ var n, l;
119
+ return (n = e == null ? void 0 : e.touches) != null && n.length ? e.touches[0].clientX : (l = e == null ? void 0 : e.changedTouches) != null && l.length ? e.changedTouches[0].clientX : e.clientX;
124
120
  }
125
121
  function D(e) {
126
- a.value = !0, h.value = e, f.value = e, b = e, g = performance.now(), y = 0, w(), s("swipe-start", { x: e, width: o.value });
122
+ var l;
123
+ return !!e && ((l = e.closest) == null ? void 0 : l.call(e, 'input,textarea,select,button,a,[role="button"],[data-no-drag]'));
127
124
  }
128
- let T = null;
125
+ function T(e) {
126
+ o.value = !0, h.value = e, f.value = e, b = e, g = performance.now(), y = 0, w(), s("swipe-start", { x: e, width: r.value });
127
+ }
128
+ let M = null;
129
129
  function z(e) {
130
- T && cancelAnimationFrame(T), T = requestAnimationFrame(() => {
131
- const n = performance.now(), r = e - b, _ = Math.max(1, n - g);
132
- y = r / _, b = e, g = n, f.value = e, s("swipe-move", { x: e, progress: S.value });
130
+ M && cancelAnimationFrame(M), M = requestAnimationFrame(() => {
131
+ const n = performance.now(), l = e - b, _ = Math.max(1, n - g);
132
+ y = l / _, b = e, g = n, f.value = e, s("swipe-move", { x: e, progress: S.value });
133
133
  });
134
134
  }
135
- function H() {
135
+ function N() {
136
136
  const e = f.value - h.value, n = y;
137
- a.value = !1, u.value ? t.modelValue ? d(!(e < -t.swipeThreshold || n < -t.swipeMinVelocity)) : d(e > t.swipeThreshold || n > t.swipeMinVelocity) : U.value && (t.modelValue ? d(!(e > t.swipeThreshold || n > t.swipeMinVelocity)) : d(e < -t.swipeThreshold || n < -t.swipeMinVelocity)), s("swipe-end", { opened: t.modelValue });
137
+ o.value = !1, u.value ? t.modelValue ? d(!(e < -t.swipeThreshold || n < -t.swipeMinVelocity)) : d(e > t.swipeThreshold || n > t.swipeMinVelocity) : U.value && (t.modelValue ? d(!(e > t.swipeThreshold || n > t.swipeMinVelocity)) : d(e < -t.swipeThreshold || n < -t.swipeMinVelocity)), s("swipe-end", { opened: t.modelValue });
138
138
  }
139
139
  function J(e) {
140
- if (!t.swipeable || !t.modelValue || C(e.target)) return;
140
+ if (!t.swipeable || D(e.target)) return;
141
141
  const n = m(e);
142
142
  pe(() => {
143
- w(), (u.value ? n >= o.value - t.swipeHandleSize && n <= o.value + 8 : n <= window.innerWidth - (o.value - t.swipeHandleSize) && n >= window.innerWidth - o.value - 8) && D(n);
143
+ if (w(), t.modelValue) {
144
+ T(n);
145
+ return;
146
+ }
147
+ (u.value ? n <= t.swipeEdgeSize : n >= window.innerWidth - t.swipeEdgeSize) && T(n);
144
148
  });
145
149
  }
146
150
  function Q(e) {
147
- a.value && (e.preventDefault(), z(m(e)));
151
+ o.value && (e.preventDefault(), z(m(e)));
148
152
  }
149
153
  function Y() {
150
- a.value && H();
154
+ o.value && N();
151
155
  }
152
- function N(e) {
153
- if (!t.swipeable || t.permanent || t.modelValue || C(e.target)) return;
156
+ function $(e) {
157
+ if (!t.swipeable || t.permanent || t.modelValue || D(e.target)) return;
154
158
  const n = m(e);
155
- (u.value ? n <= t.swipeEdgeSize : n >= window.innerWidth - t.swipeEdgeSize) && D(n);
159
+ (u.value ? n <= t.swipeEdgeSize : n >= window.innerWidth - t.swipeEdgeSize) && T(n);
156
160
  }
157
- function $(e) {
158
- a.value && z(m(e));
161
+ function H(e) {
162
+ o.value && z(m(e));
159
163
  }
160
164
  function W() {
161
- a.value && H();
165
+ o.value && N();
162
166
  }
163
167
  function Z() {
164
168
  t.persistent || d(!1);
165
169
  }
166
170
  return ee(() => {
167
- w(), t.swipeable && (window.addEventListener("pointerdown", N, { passive: !0 }), window.addEventListener("pointermove", $, { passive: !0 }), window.addEventListener("pointerup", W, { passive: !0 }));
171
+ w(), t.swipeable && (window.addEventListener("pointerdown", $, { passive: !0 }), window.addEventListener("pointermove", H, { passive: !0 }), window.addEventListener("pointerup", W, { passive: !0 }));
168
172
  }), te(() => {
169
- t.swipeable && (window.removeEventListener("pointerdown", N), window.removeEventListener("pointermove", $), window.removeEventListener("pointerup", W)), a.value = !1;
173
+ t.swipeable && (window.removeEventListener("pointerdown", $), window.removeEventListener("pointermove", H), window.removeEventListener("pointerup", W)), o.value = !1;
170
174
  }), ne(() => t.modelValue, () => {
171
- a.value = !1;
172
- }), (e, n) => (M(), X(ae, null, [
173
- oe((M(), ie(re(l.tag), {
175
+ o.value = !1;
176
+ }), (e, n) => (V(), X(oe, null, [
177
+ ae((V(), le(re(a.tag), {
174
178
  ref_key: "drawerEl",
175
- ref: B,
179
+ ref: x,
176
180
  class: se(["z-[2001] flex flex-col select-none will-change-transform", [
177
181
  K.value,
178
- l.absolute ? "absolute" : "fixed",
179
- l.floating ? "border-none" : "",
180
- a.value ? "transition-none" : l.swipeTransition,
182
+ a.absolute ? "absolute" : "fixed",
183
+ a.floating ? "border-none" : "",
184
+ o.value ? "transition-none" : a.swipeTransition,
181
185
  "touch-pan-y"
182
186
  ]]),
183
187
  style: L(R.value),
@@ -188,17 +192,17 @@ const he = {
188
192
  onTouchendPassive: Y
189
193
  }, {
190
194
  default: P(() => [
191
- V(e.$slots, "prepend"),
192
- V(e.$slots, "default"),
193
- V(e.$slots, "append")
195
+ E(e.$slots, "prepend"),
196
+ E(e.$slots, "default"),
197
+ E(e.$slots, "append")
194
198
  ]),
195
199
  _: 3
196
200
  }, 40, ["class", "style"])), [
197
- [de, l.modelValue || l.permanent || a.value]
201
+ [de, a.modelValue || a.permanent || o.value]
198
202
  ]),
199
- le(ce, { name: "kun-scrim" }, {
203
+ ie(ce, { name: "kun-scrim" }, {
200
204
  default: P(() => [
201
- l.scrim && (l.modelValue || a.value) && !l.permanent && !l.persistent ? (M(), X("div", {
205
+ a.scrim && (a.modelValue || o.value) && !a.permanent && !a.persistent ? (V(), X("div", {
202
206
  key: 0,
203
207
  class: "fixed inset-0 bg-black",
204
208
  style: L({ opacity: 0.4 * (1 - S.value) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.448",
3
+ "version": "0.1.449",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",