mhz-helpers 1.3.26 → 1.3.27

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,21 +1,21 @@
1
- import { ref as r, readonly as u } from "vue";
2
- import { getOneYearFromNow as c } from "../date/index.js";
3
- const n = r(!1), k = u(n);
1
+ import { shallowRef as u, readonly as c } from "vue";
2
+ import { getOneYearFromNow as r } from "../date/index.js";
3
+ const n = u(!1), k = c(n);
4
4
  function s(o) {
5
5
  n.value = o;
6
6
  }
7
- function p(o, e, t) {
8
- m(t), e(), globalThis.location.href = o;
7
+ function h(o, e, t) {
8
+ l(t), e(), globalThis.location.href = o;
9
9
  }
10
- function h(o) {
10
+ function p(o) {
11
11
  if (!document.cookie) return;
12
12
  const { [o]: e } = Object.fromEntries(document.cookie.split("; ").map((t) => t.split("=")));
13
13
  return e;
14
14
  }
15
15
  function f(o, e) {
16
- document.cookie = `${e}=${o};Secure;SameSite=strict;expires=${c()}`;
16
+ document.cookie = `${e}=${o};Secure;SameSite=strict;expires=${r()}`;
17
17
  }
18
- function m(o) {
18
+ function l(o) {
19
19
  document.cookie = `${o}=;expires=${(/* @__PURE__ */ new Date(0)).toUTCString()}`;
20
20
  }
21
21
  function d() {
@@ -25,10 +25,10 @@ function d() {
25
25
  return { auth: o };
26
26
  }
27
27
  export {
28
- m as deleteCookieToken,
29
- h as getCookieToken,
28
+ l as deleteCookieToken,
29
+ p as getCookieToken,
30
30
  k as isAuth,
31
- p as logout,
31
+ h as logout,
32
32
  s as setAuth,
33
33
  f as setCookieToken,
34
34
  d as useAuth
@@ -3,8 +3,8 @@ export interface ICalendarDates {
3
3
  dateTo: Date;
4
4
  }
5
5
  export declare function useCalendar(): {
6
- dateFrom: import('vue').Ref<Date | undefined, Date | undefined>;
7
- dateTo: import('vue').Ref<Date | undefined, Date | undefined>;
8
- isDatesReady: import('vue').Ref<boolean, boolean>;
6
+ dateFrom: import('vue').ShallowRef<Date | undefined, Date | undefined>;
7
+ dateTo: import('vue').ShallowRef<Date | undefined, Date | undefined>;
8
+ isDatesReady: import('vue').ShallowRef<boolean, boolean>;
9
9
  updateDates: (dates: ICalendarDates) => void;
10
10
  };
@@ -1,10 +1,10 @@
1
- import { ref as e } from "vue";
1
+ import { shallowRef as e } from "vue";
2
2
  function s() {
3
3
  const t = e(), a = e(), o = e(!1);
4
- function n(r) {
5
- t.value = r.dateFrom, a.value = r.dateTo, o.value = !0;
4
+ function r(n) {
5
+ t.value = n.dateFrom, a.value = n.dateTo, o.value = !0;
6
6
  }
7
- return { dateFrom: t, dateTo: a, isDatesReady: o, updateDates: n };
7
+ return { dateFrom: t, dateTo: a, isDatesReady: o, updateDates: r };
8
8
  }
9
9
  export {
10
10
  s as useCalendar
@@ -1,4 +1,4 @@
1
- import { ref as r, readonly as s, onBeforeMount as d } from "vue";
1
+ import { shallowRef as r, readonly as s, onBeforeMount as d } from "vue";
2
2
  function u() {
3
3
  const e = r(!1), t = s(e);
4
4
  d(() => {
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  export declare function useInfiniteScroll<T>(): {
3
- page: Ref<number, number>;
3
+ page: import('vue').ShallowRef<number, number>;
4
4
  allData: Ref<T[], T[]>;
5
5
  addData: (data: T[]) => void;
6
6
  handleScroll: (isLoading: boolean, pageToSet: number) => void;
@@ -1,13 +1,13 @@
1
- import { ref as o } from "vue";
1
+ import { shallowRef as f, ref as r } from "vue";
2
2
  function c() {
3
- const l = o(1), n = o([]);
4
- function e(a) {
5
- n.value = [...n.value, ...a];
3
+ const a = f(1), l = r([]);
4
+ function t(n) {
5
+ l.value = [...l.value, ...n];
6
6
  }
7
- function r(a, t) {
8
- a || (l.value = t > 0 ? t : 1);
7
+ function e(n, o) {
8
+ n || (a.value = o > 0 ? o : 1);
9
9
  }
10
- return { page: l, allData: n, addData: e, handleScroll: r };
10
+ return { page: a, allData: l, addData: t, handleScroll: e };
11
11
  }
12
12
  export {
13
13
  c as useInfiniteScroll
@@ -24,7 +24,7 @@ export declare function usePage(filter?: object): {
24
24
  setQueryFilter: (filterToSet?: object) => void;
25
25
  };
26
26
  export declare function usePageNumber(): {
27
- page: Ref<number, number>;
27
+ page: import('vue').ShallowRef<number, number>;
28
28
  resetPage: () => void;
29
29
  setPage: (pageToSet: number) => void;
30
30
  };
@@ -1,6 +1,6 @@
1
- import { ref as n, watch as c } from "vue";
2
- import { useRouter as l, useRoute as i } from "vue-router";
3
- function f(t, a) {
1
+ import { ref as p, watch as n, shallowRef as v } from "vue";
2
+ import { useRouter as l, useRoute as c } from "vue-router";
3
+ function y(t, a) {
4
4
  if (typeof t.value == "number")
5
5
  return { page: t.value };
6
6
  const { page: u, sort: e, filter: s } = t.value;
@@ -12,8 +12,8 @@ function f(t, a) {
12
12
  ...s
13
13
  };
14
14
  }
15
- function y(t) {
16
- const a = l(), u = i(), e = n({
15
+ function q(t) {
16
+ const a = l(), u = c(), e = p({
17
17
  page: u.query.page && +(u.query.page > 0) ? Number(u.query.page) : 1,
18
18
  sort: { value: u.query.sort?.toString(), isAsc: u.query.dir !== "desc" },
19
19
  filter: { ...t }
@@ -24,14 +24,14 @@ function y(t) {
24
24
  function o(r) {
25
25
  e.value.page = r > 0 ? r : 1;
26
26
  }
27
- function p(r) {
27
+ function i(r) {
28
28
  e.value = {
29
29
  page: 1,
30
30
  sort: e.value.sort,
31
31
  filter: { ...r }
32
32
  };
33
33
  }
34
- return c(
34
+ return n(
35
35
  () => [e.value.page, e.value.sort.value, e.value.sort.isAsc],
36
36
  () => {
37
37
  a.push({
@@ -43,17 +43,17 @@ function y(t) {
43
43
  }
44
44
  });
45
45
  }
46
- ), { query: e, resetQuery: s, setQueryPage: o, setQueryFilter: p };
46
+ ), { query: e, resetQuery: s, setQueryPage: o, setQueryFilter: i };
47
47
  }
48
- function q() {
49
- const t = l(), a = i(), u = n(Number(a.query.page || 1));
48
+ function h() {
49
+ const t = l(), a = c(), u = v(Number(a.query.page || 1));
50
50
  function e() {
51
51
  u.value = 1;
52
52
  }
53
53
  function s(o) {
54
54
  u.value = o;
55
55
  }
56
- return c(
56
+ return n(
57
57
  () => u.value,
58
58
  () => {
59
59
  t.push({ path: a.path, query: { page: u.value } });
@@ -61,7 +61,7 @@ function q() {
61
61
  ), { page: u, resetPage: e, setPage: s };
62
62
  }
63
63
  export {
64
- f as convertParams,
65
- y as usePage,
66
- q as usePageNumber
64
+ y as convertParams,
65
+ q as usePage,
66
+ h as usePageNumber
67
67
  };
@@ -3,6 +3,6 @@ export interface IPromptEvent extends Event {
3
3
  }
4
4
  export declare function usePwa(): {
5
5
  installPWA: () => Promise<void>;
6
- isShowInstallPWA: import('vue').Ref<boolean, boolean>;
7
- isPWACanBeInstalled: import('vue').Ref<boolean, boolean>;
6
+ isShowInstallPWA: import('vue').ShallowRef<boolean, boolean>;
7
+ isPWACanBeInstalled: import('vue').ShallowRef<boolean, boolean>;
8
8
  };
@@ -1,27 +1,27 @@
1
- import { ref as l, onMounted as r, onBeforeUnmount as u } from "vue";
2
- function p() {
3
- const n = l(!1), o = l(!1), e = l();
1
+ import { shallowRef as a, ref as r, onMounted as u, onBeforeUnmount as f } from "vue";
2
+ function m() {
3
+ const n = a(!1), l = a(!1), t = r();
4
4
  async function s() {
5
- e.value && (await e.value.prompt(), setTimeout(() => {
6
- n.value = !1, e.value = void 0;
5
+ t.value && (await t.value.prompt(), setTimeout(() => {
6
+ n.value = !1, t.value = void 0;
7
7
  }, 100));
8
8
  }
9
- function i(t) {
10
- return !!t && "prompt" in t;
9
+ function i(e) {
10
+ return !!e && "prompt" in e;
11
11
  }
12
- function a(t) {
13
- i(t) && (o.value = !0, n.value = !0, e.value = t);
12
+ function o(e) {
13
+ i(e) && (l.value = !0, n.value = !0, t.value = e);
14
14
  }
15
- return r(() => {
16
- globalThis.addEventListener("beforeinstallprompt", a);
17
- }), u(() => {
18
- globalThis.removeEventListener("beforeinstallprompt", a);
15
+ return u(() => {
16
+ globalThis.addEventListener("beforeinstallprompt", o);
17
+ }), f(() => {
18
+ globalThis.removeEventListener("beforeinstallprompt", o);
19
19
  }), {
20
20
  installPWA: s,
21
21
  isShowInstallPWA: n,
22
- isPWACanBeInstalled: o
22
+ isPWACanBeInstalled: l
23
23
  };
24
24
  }
25
25
  export {
26
- p as usePwa
26
+ m as usePwa
27
27
  };
@@ -1,7 +1,7 @@
1
- import { ref as n, computed as a } from "vue";
2
- import { addZero as l } from "../date/index.js";
1
+ import { shallowRef as a, computed as l } from "vue";
2
+ import { addZero as n } from "../date/index.js";
3
3
  function f() {
4
- const e = n(0), u = n(0), r = a(() => `${l(u.value)}:${l(e.value)}`), o = a(() => u.value * 60 + e.value);
4
+ const e = a(0), u = a(0), o = l(() => `${n(u.value)}:${n(e.value)}`), r = l(() => u.value * 60 + e.value);
5
5
  let t = null;
6
6
  function i() {
7
7
  e.value++, e.value === 60 && (u.value++, e.value = 0);
@@ -9,10 +9,10 @@ function f() {
9
9
  function v() {
10
10
  t || (t = setInterval(i, 1e3));
11
11
  }
12
- function c() {
12
+ function s() {
13
13
  t && (clearInterval(t), t = null), e.value = 0, u.value = 0;
14
14
  }
15
- return { timer: r, duration: o, startTimer: v, stopTimer: c };
15
+ return { timer: o, duration: r, startTimer: v, stopTimer: s };
16
16
  }
17
17
  export {
18
18
  f as useTimer
@@ -1,15 +1,15 @@
1
- import { toRef as de, readonly as ce, customRef as pe, ref as fe, toValue as T, watch as Z, nextTick as k, isRef as le, shallowRef as W, computed as D } from "vue";
1
+ import { toRef as ue, readonly as de, customRef as ce, ref as pe, toValue as T, watch as Z, nextTick as k, isRef as le, shallowRef as U, computed as D } from "vue";
2
2
  import { M as L } from "../index-BpwdWGUI.js";
3
3
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
4
4
  const ye = () => {
5
5
  };
6
6
  function ge(...t) {
7
- if (t.length !== 1) return de(...t);
7
+ if (t.length !== 1) return ue(...t);
8
8
  const e = t[0];
9
- return typeof e == "function" ? ce(pe(() => ({
9
+ return typeof e == "function" ? de(ce(() => ({
10
10
  get: e,
11
11
  set: ye
12
- }))) : fe(e);
12
+ }))) : pe(e);
13
13
  }
14
14
  function ee(t, e = !1, r = "Timeout") {
15
15
  return new Promise((n, i) => {
@@ -128,13 +128,13 @@ function ve() {
128
128
  return !1;
129
129
  }
130
130
  }
131
- function U(t, e, r) {
132
- return ve() ? U = Reflect.construct.bind() : U = function(i, f, a) {
131
+ function W(t, e, r) {
132
+ return ve() ? W = Reflect.construct.bind() : W = function(i, f, a) {
133
133
  var s = [null];
134
134
  s.push.apply(s, f);
135
135
  var u = Function.bind.apply(i, s), h = new u();
136
136
  return a && B(h, a.prototype), h;
137
- }, U.apply(null, arguments);
137
+ }, W.apply(null, arguments);
138
138
  }
139
139
  function we(t) {
140
140
  return Function.toString.call(t).indexOf("[native code]") !== -1;
@@ -150,7 +150,7 @@ function Y(t) {
150
150
  e.set(n, i);
151
151
  }
152
152
  function i() {
153
- return U(n, arguments, z(this).constructor);
153
+ return W(n, arguments, z(this).constructor);
154
154
  }
155
155
  return i.prototype = Object.create(n.prototype, {
156
156
  constructor: {
@@ -162,9 +162,9 @@ function Y(t) {
162
162
  }), B(i, n);
163
163
  }, Y(t);
164
164
  }
165
- var qe = /%[sdj%]/g, se = function() {
165
+ var qe = /%[sdj%]/g, fe = function() {
166
166
  };
167
- typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (se = function(e, r) {
167
+ typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (fe = function(e, r) {
168
168
  typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && r.every(function(n) {
169
169
  return typeof n == "string";
170
170
  }) && console.warn(e, r);
@@ -307,7 +307,7 @@ function ie(t, e) {
307
307
  }
308
308
  return t;
309
309
  }
310
- var oe = function(e, r, n, i, f, a) {
310
+ var se = function(e, r, n, i, f, a) {
311
311
  e.required && (!n.hasOwnProperty(e.field) || b(r, a || e.type)) && i.push(E(f.messages.required, e.fullField));
312
312
  }, Pe = function(e, r, n, i, f) {
313
313
  (/^\s+$/.test(r) || r === "") && i.push(E(f.messages.whitespace, e.fullField));
@@ -387,7 +387,7 @@ var oe = function(e, r, n, i, f, a) {
387
387
  }
388
388
  }, je = function(e, r, n, i, f) {
389
389
  if (e.required && r === void 0) {
390
- oe(e, r, n, i, f);
390
+ se(e, r, n, i, f);
391
391
  return;
392
392
  }
393
393
  var a = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], s = e.type;
@@ -409,7 +409,7 @@ var oe = function(e, r, n, i, f, a) {
409
409
  }
410
410
  }
411
411
  }, y = {
412
- required: oe,
412
+ required: se,
413
413
  whitespace: Pe,
414
414
  type: je,
415
415
  range: _e,
@@ -690,8 +690,8 @@ var Q = H(), V = /* @__PURE__ */ (function() {
690
690
  }), $ = _({}, $, p.rule.fields);
691
691
  var X = {};
692
692
  Object.keys($).forEach(function(R) {
693
- var A = $[R], ue = Array.isArray(A) ? A : [A];
694
- X[R] = ue.map(l.bind(null, R));
693
+ var A = $[R], oe = Array.isArray(A) ? A : [A];
694
+ X[R] = oe.map(l.bind(null, R));
695
695
  });
696
696
  var C = new t(X);
697
697
  C.messages(u.messages), p.rule.options && (p.rule.options.messages = u.messages, p.rule.options.error = u.error), C.validate(p.value, p.rule.options || u, function(R) {
@@ -737,12 +737,12 @@ V.register = function(e, r) {
737
737
  throw new Error("Cannot register a validator by type, validator is not a function");
738
738
  M[e] = r;
739
739
  };
740
- V.warning = se;
740
+ V.warning = fe;
741
741
  V.messages = Q;
742
742
  V.validators = M;
743
743
  const Ke = V.default || V;
744
744
  function He(t, e, r = {}) {
745
- const { validateOption: n = {}, immediate: i = !0, manual: f = !1 } = r, a = ge(t), s = W(null), u = W(!0), h = W(!i || f), m = D(() => {
745
+ const { validateOption: n = {}, immediate: i = !0, manual: f = !1 } = r, a = ge(t), s = U(null), u = U(!0), h = U(!i || f), m = D(() => {
746
746
  var c;
747
747
  return ((c = s.value) === null || c === void 0 ? void 0 : c.errors) || [];
748
748
  }), d = D(() => {
@@ -791,7 +791,7 @@ function He(t, e, r = {}) {
791
791
  function Ce(t, e, r = "ru") {
792
792
  const n = D(() => Object.entries(e).reduce((d, [g, q]) => (d[g] = Array.isArray(q) ? q.map((v) => typeof v == "function" ? v(r) : v) : [], d), {})), { errorFields: i, isFinished: f, pass: a } = He(t, n, {
793
793
  validateOption: { suppressWarning: !0 }
794
- }), s = fe(0);
794
+ }), s = U(0);
795
795
  function u() {
796
796
  return s.value++, a.value && f.value;
797
797
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mhz-helpers",
3
3
  "description": "Mhz helpers and composables",
4
- "version": "1.3.26",
4
+ "version": "1.3.27",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@tanstack/vue-query": "5.92.9",
28
- "@vueuse/core": "14.2.0",
29
- "@vueuse/integrations": "14.2.0",
28
+ "@vueuse/core": "14.2.1",
29
+ "@vueuse/integrations": "14.2.1",
30
30
  "async-validator": "4.2.5",
31
31
  "axios": "1.13.5",
32
- "vue": "3.6.0-beta.5",
32
+ "vue": "3.6.0-beta.6",
33
33
  "vue-router": "5.0.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@eslint/js": "9.39.2",
37
- "@types/node": "25.2.2",
37
+ "@types/node": "25.2.3",
38
38
  "@vitejs/plugin-vue": "6.0.4",
39
39
  "@vitest/coverage-v8": "4.1.0-beta.3",
40
40
  "eslint": "9.39.2",
@@ -42,30 +42,30 @@
42
42
  "eslint-import-resolver-typescript": "4.4.4",
43
43
  "eslint-plugin-import-x": "4.16.1",
44
44
  "eslint-plugin-prettier": "5.5.5",
45
- "eslint-plugin-sonarjs": "3.0.6",
46
- "eslint-plugin-unicorn": "62.0.0",
47
- "eslint-plugin-vue": "10.7.0",
45
+ "eslint-plugin-sonarjs": "3.0.7",
46
+ "eslint-plugin-unicorn": "63.0.0",
47
+ "eslint-plugin-vue": "10.8.0",
48
48
  "globals": "17.3.0",
49
- "happy-dom": "20.5.0",
49
+ "happy-dom": "20.6.1",
50
50
  "postcss-html": "1.8.1",
51
51
  "prettier": "3.8.1",
52
- "stylelint": "17.1.1",
52
+ "stylelint": "17.3.0",
53
53
  "stylelint-config-recess-order": "7.6.1",
54
54
  "stylelint-config-recommended-scss": "17.0.0",
55
55
  "stylelint-config-recommended-vue": "1.6.1",
56
56
  "stylelint-order": "7.0.1",
57
57
  "stylelint-prettier": "5.0.3",
58
58
  "typescript": "5.9.3",
59
- "typescript-eslint": "8.54.0",
59
+ "typescript-eslint": "8.55.0",
60
60
  "vite": "7.3.1",
61
61
  "vite-plugin-dts": "4.5.4",
62
62
  "vitest": "4.1.0-beta.3",
63
- "vue-eslint-parser": "10.2.0",
63
+ "vue-eslint-parser": "10.4.0",
64
64
  "vue-linters-config": "0.5.5",
65
65
  "vue-tsc": "3.2.4"
66
66
  },
67
67
  "peerDependencies": {
68
- "vue": "3.6.0-beta.5",
68
+ "vue": "3.6.0-beta.6",
69
69
  "vue-router": "5.0.2"
70
70
  },
71
71
  "engines": {