melonykit 1.2.0 → 1.4.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,4 +1,4 @@
1
- import { h as e } from "./functions-CZylI2gQ.js";
1
+ import { a as e } from "./functions-huvj-bhb.js";
2
2
  import { signal as t } from "@preact/signals";
3
3
  import { useEffect as n, useMemo as r } from "preact/hooks";
4
4
  //#region src/browser/_route-to.js
package/dist/browser.js CHANGED
@@ -1 +1 @@
1
- export { n as getClientSetting, i as routeTo, t as setClientSetting, r as useQuery } from "./browser-Cr0Wr7Lc.js";
1
+ export { n as getClientSetting, i as routeTo, t as setClientSetting, r as useQuery } from "./browser-jtptg5Z4.js";
@@ -1,5 +1,27 @@
1
- //#region src/functions/_parse-hex-color.js
1
+ //#region src/functions/_average.js
2
2
  function e(e) {
3
+ if (!Array.isArray(e) || e.length === 0) return null;
4
+ let t = 0, n = 0;
5
+ for (let r of e) {
6
+ if (!Number.isFinite(r)) return null;
7
+ let i = r / e.length - n, a = t + i;
8
+ n = a - t - i, t = a;
9
+ }
10
+ return t;
11
+ }
12
+ //#endregion
13
+ //#region src/functions/checks/_is-string.js
14
+ function t(e) {
15
+ return typeof e == "string";
16
+ }
17
+ //#endregion
18
+ //#region src/functions/_camel-case-to-title-case.js
19
+ function n(e) {
20
+ return t(e) ? e.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(" ").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
21
+ }
22
+ //#endregion
23
+ //#region src/functions/_parse-hex-color.js
24
+ function r(e) {
3
25
  if (typeof e != "string" || !/^#([\da-f]{3}|[\da-f]{6})$/i.test(e)) throw TypeError("hex must be a three- or six-digit hexadecimal color");
4
26
  let t = e.slice(1), n = t.length === 3 ? [...t].map((e) => e.repeat(2)).join("") : t;
5
27
  return [
@@ -10,37 +32,103 @@ function e(e) {
10
32
  }
11
33
  //#endregion
12
34
  //#region src/functions/_convert-hex-to-rgba.js
13
- function t(t, n) {
14
- let [r, i, a] = e(t);
15
- if (!Number.isFinite(n)) throw TypeError("alpha must be a finite number");
16
- if (n < 0 || n > 1) throw RangeError("alpha must be between 0 and 1");
17
- return `rgba(${r}, ${i}, ${a}, ${n})`;
35
+ function i(e, t) {
36
+ let [n, i, a] = r(e);
37
+ if (!Number.isFinite(t)) throw TypeError("alpha must be a finite number");
38
+ if (t < 0 || t > 1) throw RangeError("alpha must be between 0 and 1");
39
+ return `rgba(${n}, ${i}, ${a}, ${t})`;
18
40
  }
19
41
  //#endregion
20
- //#region src/functions/checks/_is-string.js
21
- function n(e) {
22
- return typeof e == "string";
42
+ //#region src/functions/checks/_is-array.js
43
+ function a(e) {
44
+ return Array.isArray(e);
23
45
  }
24
46
  //#endregion
25
- //#region src/functions/_camel-case-to-title-case.js
26
- function r(e) {
27
- return n(e) ? e.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(" ").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
47
+ //#region src/functions/checks/_is-empty-array.js
48
+ function o(e) {
49
+ return a(e) && e.length === 0;
50
+ }
51
+ //#endregion
52
+ //#region src/functions/checks/_is-function.js
53
+ function s(e) {
54
+ return typeof e == "function";
55
+ }
56
+ //#endregion
57
+ //#region src/functions/checks/_is-number.js
58
+ function c(e) {
59
+ return typeof e == "number" && Number.isFinite(e);
60
+ }
61
+ //#endregion
62
+ //#region src/functions/checks/_is-positive-number.js
63
+ function l(e) {
64
+ return c(e) && e > 0;
65
+ }
66
+ //#endregion
67
+ //#region src/functions/_create-cache.js
68
+ function u({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
69
+ let i = /* @__PURE__ */ new Map();
70
+ async function c(t, n) {
71
+ if (i.has(t)) return !1;
72
+ let r = Date.now();
73
+ return i.set(t, {
74
+ ...n,
75
+ createdAt: r,
76
+ lastUpdate: r
77
+ }), s(e) && await e(t), !0;
78
+ }
79
+ async function u(e, n) {
80
+ if (!i.has(e) || typeof n != "function") return !1;
81
+ let r = i.get(e);
82
+ return await n(r), r.lastUpdate = Date.now(), s(t) && await t(e), !0;
83
+ }
84
+ function d(e) {
85
+ return i.get(e) ?? null;
86
+ }
87
+ function f() {
88
+ return i.size;
89
+ }
90
+ function p() {
91
+ return i.entries();
92
+ }
93
+ function m(e) {
94
+ return i.has(e);
95
+ }
96
+ async function h(e) {
97
+ if (!i.has(e)) return !1;
98
+ let t = i.get(e);
99
+ return i.delete(e), s(n) && await n(e, t), !0;
100
+ }
101
+ function g({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
102
+ l(e) && a(t) && !o(t) && t.every((e) => s(e)) && s(n) && s(r) && r(async () => {
103
+ let e = n();
104
+ for (let [n, r] of i) t.some((t) => t(r, e)) && await h(n);
105
+ }, e)?.unref?.();
106
+ }
107
+ return g(r), {
108
+ add: c,
109
+ get: d,
110
+ size: f,
111
+ entries: p,
112
+ update: u,
113
+ has: m,
114
+ remove: h
115
+ };
28
116
  }
29
117
  //#endregion
30
118
  //#region src/functions/_darken-hex-color.js
31
- function i(t, n) {
32
- let r = e(t);
33
- if (!Number.isFinite(n)) throw TypeError("amount must be a finite number");
34
- if (n < 0 || n > 1) throw RangeError("amount must be between 0 and 1");
35
- let i = 1 - n;
36
- return `#${r.map((e) => Math.round(e * i)).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
119
+ function d(e, t) {
120
+ let n = r(e);
121
+ if (!Number.isFinite(t)) throw TypeError("amount must be a finite number");
122
+ if (t < 0 || t > 1) throw RangeError("amount must be between 0 and 1");
123
+ let i = 1 - t;
124
+ return `#${n.map((e) => Math.round(e * i)).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
37
125
  }
38
126
  //#endregion
39
127
  //#region src/functions/_format-date.js
40
- function a(e) {
128
+ function f(e) {
41
129
  return Object.prototype.toString.call(e) === "[object Date]" && !isNaN(e);
42
130
  }
43
- var o = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g, s = /\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g, c = /[^-+\dA-Z]/g, l = (e, t = 2) => String(e).padStart(t, "0"), u = {
131
+ var p = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g, m = /\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g, h = /[^-+\dA-Z]/g, g = (e, t = 2) => String(e).padStart(t, "0"), _ = {
44
132
  dayNames: [
45
133
  "So",
46
134
  "Mo",
@@ -94,64 +182,64 @@ var o = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'
94
182
  "PM"
95
183
  ]
96
184
  };
97
- function d(e, t = "dd.mm.yyyy", r, i) {
98
- if (!a(e) || !n(t)) return "";
99
- let s = () => r ? "getUTC" : "get", c = () => e[s() + "Date"](), d = () => e[s() + "Day"](), g = () => e[s() + "Month"](), _ = () => e[s() + "FullYear"](), v = () => e[s() + "Hours"](), y = () => e[s() + "Minutes"](), b = () => e[s() + "Seconds"](), x = () => e[s() + "Milliseconds"](), S = () => r ? 0 : e.getTimezoneOffset(), C = () => f(e), w = () => p(e), T = {
100
- d: () => c(),
101
- dd: () => l(c()),
102
- ddd: () => u.dayNames[d()],
103
- DDD: () => h({
104
- y: _(),
105
- m: g(),
106
- d: c(),
107
- _: s(),
108
- dayName: u.dayNames[d()],
185
+ function v(e, n = "dd.mm.yyyy", r, i) {
186
+ if (!f(e) || !t(n)) return "";
187
+ let a = () => r ? "getUTC" : "get", o = () => e[a() + "Date"](), s = () => e[a() + "Day"](), c = () => e[a() + "Month"](), l = () => e[a() + "FullYear"](), u = () => e[a() + "Hours"](), d = () => e[a() + "Minutes"](), m = () => e[a() + "Seconds"](), h = () => e[a() + "Milliseconds"](), v = () => r ? 0 : e.getTimezoneOffset(), C = () => y(e), w = () => b(e), T = {
188
+ d: () => o(),
189
+ dd: () => g(o()),
190
+ ddd: () => _.dayNames[s()],
191
+ DDD: () => S({
192
+ y: l(),
193
+ m: c(),
194
+ d: o(),
195
+ _: a(),
196
+ dayName: _.dayNames[s()],
109
197
  short: !0
110
198
  }),
111
- dddd: () => u.dayNames[d() + 7],
112
- DDDD: () => h({
113
- y: _(),
114
- m: g(),
115
- d: c(),
116
- _: s(),
117
- dayName: u.dayNames[d() + 7]
199
+ dddd: () => _.dayNames[s() + 7],
200
+ DDDD: () => S({
201
+ y: l(),
202
+ m: c(),
203
+ d: o(),
204
+ _: a(),
205
+ dayName: _.dayNames[s() + 7]
118
206
  }),
119
- m: () => g() + 1,
120
- mm: () => l(g() + 1),
121
- mmm: () => u.monthNames[g()],
122
- mmmm: () => u.monthNames[g() + 12],
123
- yy: () => String(_()).slice(2),
124
- yyyy: () => l(_(), 4),
125
- h: () => v() % 12 || 12,
126
- hh: () => l(v() % 12 || 12),
127
- H: () => v(),
128
- HH: () => l(v()),
129
- M: () => y(),
130
- MM: () => l(y()),
131
- s: () => b(),
132
- ss: () => l(b()),
133
- l: () => l(x(), 3),
134
- L: () => l(Math.floor(x() / 10)),
135
- t: () => v() < 12 ? u.timeNames[0] : u.timeNames[1],
136
- tt: () => v() < 12 ? u.timeNames[2] : u.timeNames[3],
137
- T: () => v() < 12 ? u.timeNames[4] : u.timeNames[5],
138
- TT: () => v() < 12 ? u.timeNames[6] : u.timeNames[7],
139
- Z: () => i ? "GMT" : r ? "UTC" : m(e),
140
- o: () => (S() > 0 ? "-" : "+") + l(Math.floor(Math.abs(S()) / 60) * 100 + Math.abs(S()) % 60, 4),
141
- p: () => (S() > 0 ? "-" : "+") + l(Math.floor(Math.abs(S()) / 60), 2) + ":" + l(Math.floor(Math.abs(S()) % 60), 2),
207
+ m: () => c() + 1,
208
+ mm: () => g(c() + 1),
209
+ mmm: () => _.monthNames[c()],
210
+ mmmm: () => _.monthNames[c() + 12],
211
+ yy: () => String(l()).slice(2),
212
+ yyyy: () => g(l(), 4),
213
+ h: () => u() % 12 || 12,
214
+ hh: () => g(u() % 12 || 12),
215
+ H: () => u(),
216
+ HH: () => g(u()),
217
+ M: () => d(),
218
+ MM: () => g(d()),
219
+ s: () => m(),
220
+ ss: () => g(m()),
221
+ l: () => g(h(), 3),
222
+ L: () => g(Math.floor(h() / 10)),
223
+ t: () => u() < 12 ? _.timeNames[0] : _.timeNames[1],
224
+ tt: () => u() < 12 ? _.timeNames[2] : _.timeNames[3],
225
+ T: () => u() < 12 ? _.timeNames[4] : _.timeNames[5],
226
+ TT: () => u() < 12 ? _.timeNames[6] : _.timeNames[7],
227
+ Z: () => i ? "GMT" : r ? "UTC" : x(e),
228
+ o: () => (v() > 0 ? "-" : "+") + g(Math.floor(Math.abs(v()) / 60) * 100 + Math.abs(v()) % 60, 4),
229
+ p: () => (v() > 0 ? "-" : "+") + g(Math.floor(Math.abs(v()) / 60), 2) + ":" + g(Math.floor(Math.abs(v()) % 60), 2),
142
230
  S: () => [
143
231
  "th",
144
232
  "st",
145
233
  "nd",
146
234
  "rd"
147
- ][c() % 10 > 3 ? 0 : (c() % 100 - c() % 10 != 10) * c() % 10],
235
+ ][o() % 10 > 3 ? 0 : (o() % 100 - o() % 10 != 10) * o() % 10],
148
236
  W: () => C(),
149
- WW: () => l(C()),
237
+ WW: () => g(C()),
150
238
  N: () => w()
151
239
  };
152
- return t.replace(o, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
240
+ return n.replace(p, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
153
241
  }
154
- var f = (e) => {
242
+ var y = (e) => {
155
243
  let t = new Date(e.getFullYear(), e.getMonth(), e.getDate());
156
244
  t.setDate(t.getDate() - (t.getDay() + 6) % 7 + 3);
157
245
  let n = new Date(t.getFullYear(), 0, 4);
@@ -160,23 +248,56 @@ var f = (e) => {
160
248
  t.setHours(t.getHours() - r);
161
249
  let i = (t - n) / 6048e5;
162
250
  return 1 + Math.floor(i);
163
- }, p = (e) => {
251
+ }, b = (e) => {
164
252
  let t = e.getDay();
165
253
  return t === 0 && (t = 7), t;
166
- }, m = (e) => (String(e).match(s) || [""]).pop().replace(c, "").replace(/GMT\+0000/g, "UTC"), h = ({ y: e, m: t, d: n, _: r, dayName: i, short: a = !1 }) => {
254
+ }, x = (e) => (String(e).match(m) || [""]).pop().replace(h, "").replace(/GMT\+0000/g, "UTC"), S = ({ y: e, m: t, d: n, _: r, dayName: i, short: a = !1 }) => {
167
255
  let o = /* @__PURE__ */ new Date(), s = /* @__PURE__ */ new Date();
168
256
  s.setDate(s[r + "Date"]() - 1);
169
257
  let c = /* @__PURE__ */ new Date();
170
258
  return c.setDate(c[r + "Date"]() + 1), o[r + "FullYear"]() === e && o[r + "Month"]() === t && o[r + "Date"]() === n ? a ? "Tdy" : "Today" : s[r + "FullYear"]() === e && s[r + "Month"]() === t && s[r + "Date"]() === n ? a ? "Ysd" : "Yesterday" : c[r + "FullYear"]() === e && c[r + "Month"]() === t && c[r + "Date"]() === n ? a ? "Tmw" : "Tomorrow" : i;
171
259
  };
172
260
  //#endregion
261
+ //#region src/functions/checks/_is-nil.js
262
+ function C(e) {
263
+ return e == null;
264
+ }
265
+ //#endregion
266
+ //#region src/functions/checks/_is-object.js
267
+ function w(e) {
268
+ return !C(e) && typeof e == "object" && !a(e);
269
+ }
270
+ //#endregion
271
+ //#region src/functions/checks/_is-empty-object.js
272
+ function T(e) {
273
+ return w(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
274
+ }
275
+ //#endregion
276
+ //#region src/functions/checks/_is-empty-string.js
277
+ function E(e) {
278
+ return t(e) && e.trim().length === 0;
279
+ }
280
+ //#endregion
281
+ //#region src/functions/checks/_is-negative-number.js
282
+ function D(e) {
283
+ return c(e) && e < 0;
284
+ }
285
+ //#endregion
173
286
  //#region src/functions/_kebab-case-to-title-case.js
174
- function g(e) {
175
- return n(e) ? e.split("-").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
287
+ function O(e) {
288
+ return t(e) ? e.split("-").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
289
+ }
290
+ //#endregion
291
+ //#region src/functions/_median.js
292
+ function k(e) {
293
+ if (!Array.isArray(e) || e.length === 0) return null;
294
+ for (let t of e) if (!Number.isFinite(t)) return null;
295
+ let t = [...e].sort((e, t) => e - t), n = Math.floor(t.length / 2);
296
+ return t.length % 2 == 0 ? (t[n - 1] + t[n]) / 2 : t[n];
176
297
  }
177
298
  //#endregion
178
299
  //#region src/functions/_request.js
179
- async function _({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
300
+ async function A({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
180
301
  let i = n !== "GET" && t !== void 0 ? JSON.stringify(t) : void 0, a = await fetch(e, {
181
302
  method: n,
182
303
  headers: {
@@ -196,18 +317,26 @@ async function _({ url: e, body: t, method: n = "POST", headers: r = {} } = {})
196
317
  return a.ok || (s.error = s.data ?? /* @__PURE__ */ Error(`Request failed with status ${a.status}.`)), s;
197
318
  }
198
319
  //#endregion
320
+ //#region src/functions/_risk-reward.js
321
+ function j(e = {}) {
322
+ let { entry: t, exit: n, riskRatio: r = 20 } = e ?? {};
323
+ if (!c(t) || t <= 0 || !c(n) || n <= 0 || !c(r) || r <= 0) return null;
324
+ let i = (n - t) / t / (r / 100);
325
+ return Math.round(i * 10) / 10;
326
+ }
327
+ //#endregion
199
328
  //#region src/functions/_size.js
200
- function v(e) {
329
+ function M(e) {
201
330
  return e == null ? 0 : Array.isArray(e) || typeof e == "string" ? e.length : typeof e == "object" || typeof e == "function" ? Object.keys(e).length : 0;
202
331
  }
203
332
  //#endregion
204
333
  //#region src/functions/_slugify.js
205
- function y(e) {
334
+ function N(e) {
206
335
  return typeof e == "string" ? e.trim().toLowerCase().replace(/ä/g, "ae").replace(/ö/g, "oe").replace(/ü/g, "ue").replace(/ß/g, "ss").replace(/æ/g, "ae").replace(/œ/g, "oe").replace(/ø/g, "o").normalize("NFD").replace(/\p{Diacritic}/gu, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") : "";
207
336
  }
208
337
  //#endregion
209
338
  //#region src/functions/_to-number.js
210
- function b(e, t = null) {
339
+ function P(e, t = null) {
211
340
  let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
212
341
  if (!Number.isFinite(n)) return null;
213
342
  if (t == null) return n;
@@ -215,105 +344,4 @@ function b(e, t = null) {
215
344
  return Math.round(n * r) / r;
216
345
  }
217
346
  //#endregion
218
- //#region src/functions/checks/_is-array.js
219
- function x(e) {
220
- return Array.isArray(e);
221
- }
222
- //#endregion
223
- //#region src/functions/checks/_is-empty-array.js
224
- function S(e) {
225
- return x(e) && e.length === 0;
226
- }
227
- //#endregion
228
- //#region src/functions/checks/_is-function.js
229
- function C(e) {
230
- return typeof e == "function";
231
- }
232
- //#endregion
233
- //#region src/functions/checks/_is-number.js
234
- function w(e) {
235
- return typeof e == "number" && Number.isFinite(e);
236
- }
237
- //#endregion
238
- //#region src/functions/checks/_is-positive-number.js
239
- function T(e) {
240
- return w(e) && e > 0;
241
- }
242
- //#endregion
243
- //#region src/functions/_create-cache.js
244
- function E({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
245
- let i = /* @__PURE__ */ new Map();
246
- async function a(t, n) {
247
- if (i.has(t)) return !1;
248
- let r = Date.now();
249
- return i.set(t, {
250
- ...n,
251
- createdAt: r,
252
- lastUpdate: r
253
- }), C(e) && await e(t), !0;
254
- }
255
- async function o(e, n) {
256
- if (!i.has(e) || typeof n != "function") return !1;
257
- let r = i.get(e);
258
- return await n(r), r.lastUpdate = Date.now(), C(t) && await t(e), !0;
259
- }
260
- function s(e) {
261
- return i.get(e) ?? null;
262
- }
263
- function c() {
264
- return i.size;
265
- }
266
- function l() {
267
- return i.entries();
268
- }
269
- function u(e) {
270
- return i.has(e);
271
- }
272
- async function d(e) {
273
- if (!i.has(e)) return !1;
274
- let t = i.get(e);
275
- return i.delete(e), C(n) && await n(e, t), !0;
276
- }
277
- function f({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
278
- T(e) && x(t) && !S(t) && t.every((e) => C(e)) && C(n) && C(r) && r(async () => {
279
- let e = n();
280
- for (let [n, r] of i) t.some((t) => t(r, e)) && await d(n);
281
- }, e)?.unref?.();
282
- }
283
- return f(r), {
284
- add: a,
285
- get: s,
286
- size: c,
287
- entries: l,
288
- update: o,
289
- has: u,
290
- remove: d
291
- };
292
- }
293
- //#endregion
294
- //#region src/functions/checks/_is-nil.js
295
- function D(e) {
296
- return e == null;
297
- }
298
- //#endregion
299
- //#region src/functions/checks/_is-object.js
300
- function O(e) {
301
- return !D(e) && typeof e == "object" && !x(e);
302
- }
303
- //#endregion
304
- //#region src/functions/checks/_is-empty-object.js
305
- function k(e) {
306
- return O(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
307
- }
308
- //#endregion
309
- //#region src/functions/checks/_is-empty-string.js
310
- function A(e) {
311
- return n(e) && e.trim().length === 0;
312
- }
313
- //#endregion
314
- //#region src/functions/checks/_is-negative-number.js
315
- function j(e) {
316
- return w(e) && e < 0;
317
- }
318
- //#endregion
319
- export { d as _, D as a, n as b, w as c, x as d, b as f, g, _ as h, O as i, C as l, v as m, A as n, E as o, y as p, k as r, T as s, j as t, S as u, i as v, t as x, r as y };
347
+ export { t as C, n as S, c as _, A as a, a as b, D as c, w as d, C as f, l as g, u as h, j as i, E as l, d as m, N as n, k as o, v as p, M as r, O as s, P as t, T as u, s as v, e as w, i as x, o as y };
package/dist/functions.js CHANGED
@@ -1 +1 @@
1
- export { y as camelCaseToTitleCase, x as convertHexToRgba, o as createCache, v as darkenHexColor, _ as formatDate, d as isArray, u as isEmptyArray, r as isEmptyObject, n as isEmptyString, l as isFunction, t as isNegativeNumber, a as isNil, c as isNumber, i as isObject, s as isPositiveNumber, b as isString, g as kebabCaseToTitleCase, h as request, m as size, p as slugify, f as toNumber } from "./functions-CZylI2gQ.js";
1
+ export { w as average, S as camelCaseToTitleCase, x as convertHexToRgba, h as createCache, m as darkenHexColor, p as formatDate, b as isArray, y as isEmptyArray, u as isEmptyObject, l as isEmptyString, v as isFunction, c as isNegativeNumber, f as isNil, _ as isNumber, d as isObject, g as isPositiveNumber, C as isString, s as kebabCaseToTitleCase, o as median, a as request, i as riskReward, r as size, n as slugify, t as toNumber } from "./functions-huvj-bhb.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as e, t } from "./browser-Cr0Wr7Lc.js";
2
- import { n, v as r } from "./functions-CZylI2gQ.js";
1
+ import { n as e, t } from "./browser-jtptg5Z4.js";
2
+ import { l as n, m as r } from "./functions-huvj-bhb.js";
3
3
  import { useSignal as i } from "@preact/signals";
4
4
  import { useEffect as a, useId as o, useRef as s } from "preact/hooks";
5
5
  import { Fragment as c, jsx as l, jsxs as u } from "preact/jsx-runtime";
@@ -1009,84 +1009,84 @@ var At = {
1009
1009
  };
1010
1010
  //#endregion
1011
1011
  //#region src/components/_button.jsx
1012
- function jt({ type: e = "primary", label: t, iconName: n, isDisabled: r = !1, isLoading: a = !1, enableConfirmation: o = !1, confirmation: s, onClick: d }) {
1013
- let f = i(!1), p = f.value, m = p ? "cursor-question" : n, h = m || a, g = h && !t, _ = i(null), v = i(0), y = _.value, b = o && !!s, x = (b || !!d) && !r && !a && !p;
1014
- function S(e) {
1012
+ function jt({ type: e = "primary", label: t, iconName: n, isDisabled: r = !1, isLoading: a = !1, confirmation: o, onClick: s }) {
1013
+ let d = i(!1), f = d.value, p = f ? "cursor-question" : n, m = p || a, h = m && !t, g = i(null), _ = i(0), v = g.value, y = !!o, b = (y || !!s) && !r && !a && !f;
1014
+ function x(e) {
1015
1015
  if (r || a) return;
1016
1016
  e.stopPropagation(), e.preventDefault();
1017
1017
  let t = e.currentTarget.getBoundingClientRect();
1018
- v.value += 1, _.value = {
1019
- id: v.value,
1018
+ _.value += 1, g.value = {
1019
+ id: _.value,
1020
1020
  x: e.clientX - t.left,
1021
1021
  y: e.clientY - t.top,
1022
1022
  size: Math.max(t.width, t.height) * 2
1023
- }, b ? f.value = !0 : d?.(e);
1023
+ }, y ? d.value = !0 : s?.(e);
1024
1024
  }
1025
- function C(e) {
1026
- f.value = !1, s?.onCancel?.(e);
1025
+ function S(e) {
1026
+ d.value = !1, o?.onCancel?.(e);
1027
1027
  }
1028
- function ee(e) {
1029
- f.value = !1, (s?.onConfirm ?? d)?.(e);
1028
+ function C(e) {
1029
+ d.value = !1, (o?.onConfirm ?? s)?.(e);
1030
1030
  }
1031
- let te = /* @__PURE__ */ u("button", {
1031
+ let ee = /* @__PURE__ */ u("button", {
1032
1032
  type: "button",
1033
1033
  className: D(Nt.base, Nt[e] ?? Nt.neutral),
1034
- "has-icon": h,
1035
- "is-icon-only": g || void 0,
1036
- "is-disabled": r || p || void 0,
1034
+ "has-icon": m,
1035
+ "is-icon-only": h || void 0,
1036
+ "is-disabled": r || f || void 0,
1037
1037
  "is-loading": a || void 0,
1038
- "is-clickable": x || void 0,
1039
- disabled: r || a || p,
1040
- onClick: x ? S : void 0,
1038
+ "is-clickable": b || void 0,
1039
+ disabled: r || a || f,
1040
+ onClick: b ? x : void 0,
1041
1041
  children: [
1042
- h && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l("div", {
1042
+ m && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l("div", {
1043
1043
  className: Nt.icon,
1044
1044
  children: a ? /* @__PURE__ */ l(wt, {
1045
1045
  iconName: "loader",
1046
1046
  isSpinning: !0,
1047
1047
  size: "1rem"
1048
1048
  }) : /* @__PURE__ */ l(wt, {
1049
- iconName: m,
1049
+ iconName: p,
1050
1050
  size: "1rem"
1051
1051
  })
1052
1052
  }) }),
1053
1053
  t,
1054
- y && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l("span", {
1054
+ v && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l("span", {
1055
1055
  className: Nt.ripple,
1056
1056
  style: `
1057
- left: ${y.x}px;
1058
- top: ${y.y}px;
1059
- width: ${y.size}px;
1060
- height: ${y.size}px;
1057
+ left: ${v.x}px;
1058
+ top: ${v.y}px;
1059
+ width: ${v.size}px;
1060
+ height: ${v.size}px;
1061
1061
  `,
1062
1062
  onAnimationEnd: () => {
1063
- _.value?.id === y.id && (_.value = null);
1063
+ g.value?.id === v.id && (g.value = null);
1064
1064
  }
1065
- }, y.id) })
1065
+ }, v.id) })
1066
1066
  ]
1067
1067
  });
1068
- return b ? /* @__PURE__ */ l(c, { children: /* @__PURE__ */ u(Ot, {
1068
+ return y ? /* @__PURE__ */ l(c, { children: /* @__PURE__ */ u(Ot, {
1069
1069
  className: Nt.confirmation,
1070
- trigger: te,
1071
- isOpen: f.value,
1070
+ trigger: ee,
1071
+ isOpen: d.value,
1072
1072
  origin: "bottom",
1073
- width: s.width,
1073
+ width: o.width,
1074
1074
  children: [/* @__PURE__ */ l(Et, {
1075
1075
  size: "small",
1076
- children: s.text
1076
+ children: o.text
1077
1077
  }), /* @__PURE__ */ u("div", {
1078
1078
  className: Nt.confirmationActions,
1079
1079
  children: [/* @__PURE__ */ l(jt, {
1080
1080
  type: "neutral",
1081
1081
  label: "Abbrechen",
1082
- onClick: C
1082
+ onClick: S
1083
1083
  }), /* @__PURE__ */ l(jt, {
1084
1084
  type: "secondary",
1085
1085
  label: "Bestätigen",
1086
- onClick: ee
1086
+ onClick: C
1087
1087
  })]
1088
1088
  })]
1089
- }) }) : /* @__PURE__ */ l(c, { children: te });
1089
+ }) }) : /* @__PURE__ */ l(c, { children: ee });
1090
1090
  }
1091
1091
  var Mt = bt`
1092
1092
  from {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Vadim Hermann",
3
3
  "name": "melonykit",
4
- "version": "1.2.0",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "description": "Preact based ui and utility functions toolkit",
7
7
  "main": "./dist/index.js",