adverich-kun-ui 0.1.458 → 0.1.459

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,14 +1,14 @@
1
- import { ref as w, computed as q, watch as G, nextTick as y } from "vue";
2
- import { format as d, clamp as x, toRawNumberString as D, fromRawString as L } from "./numberFormatUtils.js";
3
- function Q(i, s) {
4
- const l = w(""), c = w(null), F = w(null), R = w(!1), m = w(0);
1
+ import { ref as w, computed as q, watch as G, nextTick as T } from "vue";
2
+ import { format as d, clamp as x, toRawNumberString as D, fromRawString as y } from "./numberFormatUtils.js";
3
+ function W(i, s) {
4
+ const l = w(""), c = w(null), k = w(null), R = w(!1), m = w(0);
5
5
  let t = "";
6
- const K = q(() => {
6
+ const F = q(() => {
7
7
  const e = Number(i.precision);
8
8
  return e > 0 ? e + 1 : 1;
9
9
  });
10
10
  function h(e) {
11
- return Number(i.precision) === 0 ? e === "" ? "0" : e.replace(/^0+(\d)/, "$1") : e.padStart(K.value, "0");
11
+ return Number(i.precision) === 0 ? e === "" ? "0" : e.replace(/^0+(\d)/, "$1") : e.padStart(F.value, "0");
12
12
  }
13
13
  G(
14
14
  [() => i.modelValue, () => i.precision],
@@ -23,10 +23,12 @@ function Q(i, s) {
23
23
  },
24
24
  { immediate: !0 }
25
25
  );
26
- function $(e) {
26
+ function K(e) {
27
27
  const { key: n, target: r } = e, u = /^[0-9]$/.test(n), N = n === "Backspace", v = n === "Delete", o = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(n), b = e.ctrlKey || e.metaKey, f = n === "Home", U = n === "End";
28
+ if (n === "Tab")
29
+ return;
28
30
  if (f) {
29
- y(() => {
31
+ T(() => {
30
32
  if (!c.value) return;
31
33
  const S = l.value.search(/\d/);
32
34
  c.value.setSelectionRange(S, S);
@@ -34,7 +36,7 @@ function Q(i, s) {
34
36
  return;
35
37
  }
36
38
  if (U) {
37
- y(() => {
39
+ T(() => {
38
40
  if (!c.value) return;
39
41
  const a = l.value;
40
42
  c.value.setSelectionRange(a.length, a.length);
@@ -42,10 +44,10 @@ function Q(i, s) {
42
44
  return;
43
45
  }
44
46
  if (o || b) return;
45
- const V = E(l.value, r.selectionStart);
47
+ const V = B(l.value, r.selectionStart);
46
48
  e.preventDefault();
47
- const k = Number(i.precision) + 1;
48
- for (; t.length < k; )
49
+ const L = Number(i.precision) + 1;
50
+ for (; t.length < L; )
49
51
  t = "0" + t;
50
52
  const g = A(l.value, V);
51
53
  if (u)
@@ -59,7 +61,7 @@ function Q(i, s) {
59
61
  }
60
62
  a > 0 && (t = t.slice(0, S) + t.slice(a), t = h(t), m.value = S);
61
63
  } else v && V < l.value.length && g < t.length && (t = t.substring(0, g) + t.substring(g + 1), m.value = g);
62
- for (t = h(t); t.length < k; )
64
+ for (t = h(t); t.length < L; )
63
65
  t = "0" + t;
64
66
  C();
65
67
  }
@@ -69,7 +71,7 @@ function Q(i, s) {
69
71
  /\d/.test(e[u]) && r++;
70
72
  return r;
71
73
  }
72
- function B(e, n) {
74
+ function $(e, n) {
73
75
  let r = 0;
74
76
  for (let u = 0; u < e.length; u++)
75
77
  if (/\d/.test(e[u])) {
@@ -82,7 +84,7 @@ function Q(i, s) {
82
84
  return u + 1;
83
85
  return e.length;
84
86
  }
85
- function E(e, n) {
87
+ function B(e, n) {
86
88
  for (; n < e.length && !/\d/.test(e[n]); )
87
89
  n++;
88
90
  if (n >= e.length)
@@ -95,11 +97,11 @@ function Q(i, s) {
95
97
  const e = Number(i.precision) + 1;
96
98
  t.padStart(e, "0");
97
99
  const n = Math.max(1, t.length - Number(i.precision)), r = t.slice(0, n) || "0", u = t.slice(n).padEnd(Number(i.precision), "0").slice(0, Number(i.precision)), N = `${r}.${u}`, v = parseFloat(N), o = x(v, i.min, i.max);
98
- t = D(o, Number(i.precision)), l.value = d(o, i), s("update:modelValue", o), s("input", o), y(() => {
100
+ t = D(o, Number(i.precision)), l.value = d(o, i), s("update:modelValue", o), s("input", o), T(() => {
99
101
  if (c.value)
100
102
  try {
101
103
  const b = l.value;
102
- let f = B(b, m.value);
104
+ let f = $(b, m.value);
103
105
  for (; f < b.length && !/\d/.test(b[f]); )
104
106
  f++;
105
107
  c.value.setSelectionRange(f, f);
@@ -108,23 +110,23 @@ function Q(i, s) {
108
110
  }
109
111
  });
110
112
  }
111
- function M() {
113
+ function E() {
112
114
  R.value = !1, t = h(t);
113
- const e = L(t, Number(i.precision)), n = x(e, i.min, i.max);
115
+ const e = y(t, Number(i.precision)), n = x(e, i.min, i.max);
114
116
  t = D(n, Number(i.precision)), t = h(t), l.value = d(n, i), s("update:modelValue", n), s("blur");
115
117
  }
116
- function T() {
118
+ function M() {
117
119
  var n;
118
120
  R.value = !0;
119
121
  const e = ((n = c.value) == null ? void 0 : n.selectionStart) || 0;
120
122
  m.value = A(l.value, e), s("focus");
121
123
  }
122
124
  function H() {
123
- let e = L(t, Number(i.precision)) || 0;
125
+ let e = y(t, Number(i.precision)) || 0;
124
126
  e = x(e + Number(i.step), i.min, i.max), t = D(e, Number(i.precision)), l.value = d(e, i), s("update:modelValue", e);
125
127
  }
126
128
  function I() {
127
- let e = L(t, Number(i.precision)) || 0;
129
+ let e = y(t, Number(i.precision)) || 0;
128
130
  e = x(e - Number(i.step), i.min, i.max), t = D(e, Number(i.precision)), l.value = d(e, i), s("update:modelValue", e);
129
131
  }
130
132
  function z() {
@@ -134,10 +136,10 @@ function Q(i, s) {
134
136
  return {
135
137
  inputValue: l,
136
138
  numberInput: c,
137
- rootRef: F,
138
- validateKey: $,
139
- handleFocus: T,
140
- handleBlur: M,
139
+ rootRef: k,
140
+ validateKey: K,
141
+ handleFocus: M,
142
+ handleBlur: E,
141
143
  onIncrement: H,
142
144
  onDecrement: I,
143
145
  onClear: z,
@@ -146,5 +148,5 @@ function Q(i, s) {
146
148
  };
147
149
  }
148
150
  export {
149
- Q as useKunNumberField
151
+ W as useKunNumberField
150
152
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.458",
3
+ "version": "0.1.459",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",