@mjsz-vbr-elements/core 2.1.10 → 2.2.0

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,16 +1,16 @@
1
1
  /**
2
2
  * name: @mjsz-vbr-elements/core
3
- * version: v2.1.10 - 02/01/2024, 13:37:56
3
+ * version: v2.2.0 - 04/01/2024, 13:03:06
4
4
  * (c) 2024
5
5
  * description: Data visualization for MJSZ VBR
6
6
  * author: Ákos Stegner <akos.stegner@gmail.com>
7
7
  */
8
- import { j as S, k as b, n as p, l as D, m as E, p as I } from "./useSort-f443338c.js";
9
- import { c as nt, i as rt, u as it, b as st, a as at, d as ot, e as ct, f as ut, g as ft, v as dt } from "./useSort-f443338c.js";
10
- import { unref as u, ref as P, watch as T, nextTick as B } from "vue";
11
- import { VBR_API_BASE_URL as V } from "./constants.js";
12
- import { E as m, H as x, p as y, G as g, z as C, w as O, i as _, f as $ } from "./datetime-2fb02df2.js";
13
- var M = /* @__PURE__ */ function() {
8
+ import { j as S, k as D, n as p, l as E, m as I, p as P } from "./useSort-WcJ_BIws.js";
9
+ import { c as U, i as tt, u as et, b as nt, a as rt, d as it, e as st, f as at, g as ot, v as ut } from "./useSort-WcJ_BIws.js";
10
+ import { unref as c, ref as b, watch as T, nextTick as B } from "vue";
11
+ import { VBR_API_BASE_URL as C } from "./constants.js";
12
+ import { E as m, H as x, p as y, G as g, v as V, z as M, i as v, f as O } from "./datetime-EyEBo0-h.js";
13
+ var R = /* @__PURE__ */ function() {
14
14
  function e(t, n) {
15
15
  this.xf = n, this.f = t, this.found = !1;
16
16
  }
@@ -20,22 +20,20 @@ var M = /* @__PURE__ */ function() {
20
20
  return this.f(n) && (this.found = !0, t = x(this.xf["@@transducer/step"](t, n))), t;
21
21
  }, e;
22
22
  }();
23
- function R(e) {
23
+ function A(e) {
24
24
  return function(t) {
25
- return new M(e, t);
25
+ return new R(e, t);
26
26
  };
27
27
  }
28
- var A = /* @__PURE__ */ y(
29
- /* @__PURE__ */ g(["find"], R, function(t, n) {
28
+ var F = /* @__PURE__ */ y(
29
+ /* @__PURE__ */ g(["find"], A, function(t, n) {
30
30
  for (var r = 0, i = n.length; r < i; ) {
31
31
  if (t(n[r]))
32
32
  return n[r];
33
33
  r += 1;
34
34
  }
35
35
  })
36
- );
37
- const F = A;
38
- var G = /* @__PURE__ */ function() {
36
+ ), G = /* @__PURE__ */ function() {
39
37
  function e(t, n) {
40
38
  this.xf = n, this.f = t, this.idx = -1, this.found = !1;
41
39
  }
@@ -59,20 +57,18 @@ var Y = /* @__PURE__ */ y(
59
57
  }
60
58
  return -1;
61
59
  })
62
- );
63
- const j = Y;
64
- var K = /* @__PURE__ */ C(function(t, n, r) {
65
- return t(O(n, r));
60
+ ), _ = /* @__PURE__ */ V(function(t, n, r) {
61
+ return t(M(n, r));
66
62
  });
67
- const v = K, L = async (e, t, n) => {
68
- const r = `${V}${u(e)}?${k(n)}`;
63
+ const j = async (e, t, n) => {
64
+ const r = `${C}${c(e)}?${K(n)}`;
69
65
  return new Promise((i, o) => {
70
66
  fetch(r, {
71
67
  method: "GET",
72
68
  cache: "no-cache",
73
69
  headers: {
74
70
  "Content-Type": "application/json",
75
- "X-API-KEY": N(t)
71
+ "X-API-KEY": L(t)
76
72
  }
77
73
  }).then((s) => s.json()).then((s) => {
78
74
  if (s.error)
@@ -82,15 +78,15 @@ const v = K, L = async (e, t, n) => {
82
78
  o(s);
83
79
  });
84
80
  });
85
- }, k = (e) => Object.keys(e).map((t) => t + "=" + e[t]).join("&"), N = (e) => {
81
+ }, K = (e) => Object.keys(e).map((t) => t + "=" + e[t]).join("&"), L = (e) => {
86
82
  var t;
87
- return e || ((t = window.__MJSZ_VBR_WIDGET__) != null && t.apiKey ? window.__MJSZ_VBR_WIDGET__.apiKey : {}.NODE_ENV !== "production" ? "dd8adf5fdb738b3741fa579b5ede5ce69b681f62" : "");
88
- }, q = (e = {}) => {
89
- const { initial: t = 1, items: n = [], limit: r, auto: i = !1 } = e, o = P(u(t)), s = (a) => _(a, "day");
83
+ return e || ((t = window.__MJSZ_VBR_WIDGET__) != null && t.apiKey ? window.__MJSZ_VBR_WIDGET__.apiKey : "");
84
+ }, W = (e = {}) => {
85
+ const { initial: t = 1, items: n = [], limit: r, auto: i = !1 } = e, o = b(c(t)), s = (a) => v(a, "day");
90
86
  return S(n, () => {
91
87
  if (!i)
92
88
  return;
93
- const a = j(v(s, "gameDate"))(u(n));
89
+ const a = Y(_(s, "gameDate"))(c(n));
94
90
  o.value = a === -1 ? 1 : Math.floor(a / r) + 1;
95
91
  }), {
96
92
  page: o,
@@ -98,15 +94,15 @@ const v = K, L = async (e, t, n) => {
98
94
  o.value = a;
99
95
  }
100
96
  };
101
- }, H = ({ options: e = {}, transform: t = (i) => i, onError: n = p, onSuccess: r = p }) => {
102
- const { path: i, apiKey: o, params: s, resetOnExecute: c = !1, immediate: f = !1 } = e, {
97
+ }, Z = ({ options: e = {}, transform: t = (i) => i, onError: n = p, onSuccess: r = p }) => {
98
+ const { path: i, apiKey: o, params: s, resetOnExecute: u = !1, immediate: f = !1 } = e, {
103
99
  state: a,
104
100
  error: h,
105
101
  isLoading: l,
106
102
  execute: d
107
- } = b(() => L(i, o, u(s)).then((w) => t(w)), [], {
103
+ } = D(() => j(i, o, c(s)).then((w) => t(w)), [], {
108
104
  immediate: f,
109
- resetOnExecute: c,
105
+ resetOnExecute: u,
110
106
  onError: n,
111
107
  onSuccess: r
112
108
  });
@@ -117,52 +113,52 @@ const v = K, L = async (e, t, n) => {
117
113
  execute: d
118
114
  };
119
115
  };
120
- function Q(e = !1, t = p, n = p) {
121
- const r = D();
116
+ function q(e = !1, t = p, n = p) {
117
+ const r = E();
122
118
  T(r, (i) => {
123
- if (u(e)) {
119
+ if (c(e)) {
124
120
  if (i === "visible")
125
121
  return t();
126
122
  n();
127
123
  }
128
124
  });
129
125
  }
130
- const U = (e = {}) => {
131
- const { items: t = [], element: n, offset: r = 0 } = e, i = (c) => _(c, "day"), o = () => {
126
+ const H = (e = {}) => {
127
+ const { items: t = [], element: n, offset: r = 0 } = e, i = (u) => v(u, "day"), o = () => {
132
128
  var d;
133
129
  s();
134
- const c = F(v(i, "gameDate"))(u(t));
135
- if (!c)
130
+ const u = F(_(i, "gameDate"))(c(t));
131
+ if (!u)
136
132
  return;
137
- const f = $(c.gameDate, "YYYY-MM-DD"), a = I(n).querySelector(`div[data-gamedate="${f}"]`);
133
+ const f = O(u.gameDate, "YYYY-MM-DD"), a = P(n).querySelector(`div[data-gamedate="${f}"]`);
138
134
  if (!a)
139
135
  return;
140
- const h = getComputedStyle(a).getPropertyValue("--vbr-widget-sticky-top-offset") || 0, l = (((d = a.getBoundingClientRect()) == null ? void 0 : d.top) ?? 0) - u(r) - parseFloat(h);
136
+ const h = getComputedStyle(a).getPropertyValue("--vbr-widget-sticky-top-offset") || 0, l = (((d = a.getBoundingClientRect()) == null ? void 0 : d.top) ?? 0) - c(r) - parseFloat(h);
141
137
  window.scrollTo(0, l);
142
- }, { stop: s } = E(
138
+ }, { stop: s } = I(
143
139
  () => ({
144
- items: u(t),
145
- element: u(n)
140
+ items: c(t),
141
+ element: c(n)
146
142
  }),
147
- async ({ items: c, element: f }) => {
148
- c.length === 0 || !f || (await B(), o());
143
+ async ({ items: u, element: f }) => {
144
+ u.length === 0 || !f || (await B(), o());
149
145
  }
150
146
  );
151
147
  };
152
148
  export {
153
- nt as createI18n,
154
- L as fetchVBRData,
155
- rt as i18n,
156
- it as useColumns,
157
- st as useError,
158
- at as useErrorProvider,
159
- ot as useI18n,
160
- ct as useLazyLoadingState,
161
- ut as useMainClass,
162
- q as usePage,
163
- U as useScrollToGameDate,
164
- H as useServices,
165
- ft as useSort,
166
- Q as useVisibilityChange,
167
- dt as validateColumnsName
149
+ U as createI18n,
150
+ j as fetchVBRData,
151
+ tt as i18n,
152
+ et as useColumns,
153
+ nt as useError,
154
+ rt as useErrorProvider,
155
+ it as useI18n,
156
+ st as useLazyLoadingState,
157
+ at as useMainClass,
158
+ W as usePage,
159
+ H as useScrollToGameDate,
160
+ Z as useServices,
161
+ ot as useSort,
162
+ q as useVisibilityChange,
163
+ ut as validateColumnsName
168
164
  };
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @mjsz-vbr-elements/core
3
- * version: v2.1.10 - 02/01/2024, 13:37:56
3
+ * version: v2.2.0 - 04/01/2024, 13:03:06
4
4
  * (c) 2024
5
5
  * description: Data visualization for MJSZ VBR
6
6
  * author: Ákos Stegner <akos.stegner@gmail.com>