@wikicasa-dev/components 2.0.20 → 2.0.22

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,8 +1,8 @@
1
- import { defineComponent as S, mergeModels as y, useCssVars as T, useTemplateRef as k, useModel as E, ref as m, onMounted as C, openBlock as X, createElementBlock as $, createElementVNode as s, withModifiers as B } from "vue";
1
+ import { defineComponent as V, mergeModels as L, useCssVars as S, useTemplateRef as T, useModel as y, ref as m, watch as E, onMounted as C, openBlock as X, createElementBlock as $, createElementVNode as s, withModifiers as B } from "vue";
2
2
  import { _ as D } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
3
- import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax", "aria-valuenow"], P = /* @__PURE__ */ S({
3
+ import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax", "aria-valuenow"], P = /* @__PURE__ */ V({
4
4
  __name: "SimpleSlider",
5
- props: /* @__PURE__ */ y({
5
+ props: /* @__PURE__ */ L({
6
6
  min: { default: 0 },
7
7
  max: { default: 100 },
8
8
  step: { default: 1 },
@@ -14,23 +14,23 @@ import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax",
14
14
  }),
15
15
  emits: ["update:modelValue"],
16
16
  setup(t) {
17
- T((i) => ({
18
- "7be5c793": d.value,
19
- "415995c7": r.value
17
+ S((i) => ({
18
+ "0f43c897": r.value,
19
+ ec9c737a: d.value
20
20
  }));
21
- const u = k("customSlider"), x = k("thumb"), o = E(t, "modelValue"), l = m(!1), r = m("50%"), d = m("50%"), c = (i = 0) => {
22
- const e = t.logarithmic ? V(i) : b(i), a = (e - t.min) / (t.max - t.min), f = t.logarithmic ? h(e) : a * 100;
23
- o.value = Math.round(e), r.value = `${Math.round(f)}%`, d.value = t.logarithmic ? `${Math.round(h(e))}%` : `${a * 100}%`;
24
- }, b = (i = 0) => {
21
+ const o = T("customSlider"), u = y(t, "modelValue"), l = m(!1), d = m("50%"), r = m("50%"), c = (i = 0) => {
22
+ const e = t.logarithmic ? b(i) : k(i), a = (e - t.min) / (t.max - t.min), f = t.logarithmic ? h(e) : a * 100;
23
+ u.value = Math.round(e), d.value = `${Math.round(f)}%`, r.value = t.logarithmic ? `${Math.round(h(e))}%` : `${a * 100}%`;
24
+ }, k = (i = 0) => {
25
25
  const e = Math.round((i - t.min) / t.step) * t.step + t.min;
26
26
  return Math.max(t.min, Math.min(t.max, e));
27
- }, w = (i = 0) => {
27
+ }, x = (i = 0) => {
28
28
  const e = Math.log10(t.min), a = Math.log10(t.max);
29
29
  return Math.pow(10, e + i / 100 * (a - e));
30
30
  }, h = (i = 0) => {
31
31
  const e = Math.log10(t.min), a = Math.log10(t.max);
32
32
  return (Math.log10(i) - e) / (a - e) * 100;
33
- }, V = (i = 0) => {
33
+ }, b = (i = 0) => {
34
34
  if (t.step === 1)
35
35
  return Math.max(t.min, Math.min(t.max, i));
36
36
  const e = Math.pow(
@@ -39,18 +39,24 @@ import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax",
39
39
  );
40
40
  return Math.max(t.min, Math.min(t.max, e));
41
41
  }, v = (i) => {
42
- if (!l.value || !u.value) return;
43
- const e = u.value.getBoundingClientRect(), a = u.value.offsetWidth;
42
+ if (!l.value || !o.value) return;
43
+ const e = o.value.getBoundingClientRect(), a = o.value.offsetWidth;
44
44
  let n = ("touches" in i ? i.touches[0].clientX : i.clientX) - e.left;
45
45
  n = Math.max(0, Math.min(a, n));
46
- const L = t.logarithmic ? w(n / a * 100) : n / a * (t.max - t.min) + t.min;
47
- c(L);
46
+ const w = t.logarithmic ? x(n / a * 100) : n / a * (t.max - t.min) + t.min;
47
+ c(w);
48
48
  }, M = () => {
49
49
  l.value = !0;
50
50
  }, g = () => {
51
51
  l.value = !1;
52
52
  };
53
- return c(o.value), C(() => {
53
+ return E(
54
+ u,
55
+ (i) => {
56
+ c(i);
57
+ },
58
+ { immediate: !0 }
59
+ ), C(() => {
54
60
  document.addEventListener("mousemove", v), document.addEventListener("mouseup", g), document.addEventListener("touchmove", v, { passive: !0 }), document.addEventListener("touchend", g, { passive: !0 });
55
61
  }), (i, e) => (X(), $("div", null, [
56
62
  s("div", {
@@ -59,21 +65,19 @@ import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax",
59
65
  role: "slider",
60
66
  "aria-valuemin": i.min,
61
67
  "aria-valuemax": i.max,
62
- "aria-valuenow": o.value,
68
+ "aria-valuenow": u.value,
63
69
  tabindex: "0"
64
70
  }, [
65
71
  e[2] || (e[2] = s("div", { class: "slider-track uikit-absolute uikit-left-0 uikit-top-0 uikit-h-full uikit-rounded-2xs uikit-bg-w-primary" }, null, -1)),
66
72
  s("div", {
67
- ref_key: "thumb",
68
- ref: x,
69
73
  class: "slider-thumb uikit-absolute -uikit-top-2 uikit-size-20px -uikit-translate-x-1/2 uikit-cursor-pointer uikit-rounded-full uikit-border-2 uikit-border-solid uikit-border-w-primary uikit-bg-white",
70
74
  onMousedown: e[0] || (e[0] = (a) => M()),
71
75
  onTouchstart: e[1] || (e[1] = B((a) => M(), ["prevent"]))
72
- }, null, 544)
76
+ }, null, 32)
73
77
  ], 8, W)
74
78
  ]));
75
79
  }
76
- }), I = /* @__PURE__ */ D(P, [["__scopeId", "data-v-88aa2169"]]);
80
+ }), I = /* @__PURE__ */ D(P, [["__scopeId", "data-v-54b825e3"]]);
77
81
  export {
78
82
  I as default
79
83
  };
@@ -1 +1 @@
1
- .slider-track[data-v-88aa2169]{width:var(--7be5c793)}.slider-thumb[data-v-88aa2169]{left:var(--415995c7)}
1
+ .slider-track[data-v-54b825e3]{width:var(--0f43c897)}.slider-thumb[data-v-54b825e3]{left:var(--ec9c737a)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",