melonykit 1.4.0 → 1.5.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 { a as e } from "./functions-huvj-bhb.js";
1
+ import { a as e } from "./functions-BMRWm341.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-jtptg5Z4.js";
1
+ export { n as getClientSetting, i as routeTo, t as setClientSetting, r as useQuery } from "./browser-DNeBx_93.js";
@@ -59,15 +59,10 @@ function c(e) {
59
59
  return typeof e == "number" && Number.isFinite(e);
60
60
  }
61
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
62
  //#region src/functions/_create-cache.js
68
- function u({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
63
+ function l({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
69
64
  let i = /* @__PURE__ */ new Map();
70
- async function c(t, n) {
65
+ async function l(t, n) {
71
66
  if (i.has(t)) return !1;
72
67
  let r = Date.now();
73
68
  return i.set(t, {
@@ -99,13 +94,13 @@ function u({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
99
94
  return i.delete(e), s(n) && await n(e, t), !0;
100
95
  }
101
96
  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 () => {
97
+ !c(e) || e <= 0 || a(t) && !o(t) && t.every((e) => s(e)) && s(n) && s(r) && r(async () => {
103
98
  let e = n();
104
99
  for (let [n, r] of i) t.some((t) => t(r, e)) && await h(n);
105
100
  }, e)?.unref?.();
106
101
  }
107
102
  return g(r), {
108
- add: c,
103
+ add: l,
109
104
  get: d,
110
105
  size: f,
111
106
  entries: p,
@@ -116,7 +111,7 @@ function u({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
116
111
  }
117
112
  //#endregion
118
113
  //#region src/functions/_darken-hex-color.js
119
- function d(e, t) {
114
+ function u(e, t) {
120
115
  let n = r(e);
121
116
  if (!Number.isFinite(t)) throw TypeError("amount must be a finite number");
122
117
  if (t < 0 || t > 1) throw RangeError("amount must be between 0 and 1");
@@ -125,10 +120,10 @@ function d(e, t) {
125
120
  }
126
121
  //#endregion
127
122
  //#region src/functions/_format-date.js
128
- function f(e) {
123
+ function d(e) {
129
124
  return Object.prototype.toString.call(e) === "[object Date]" && !isNaN(e);
130
125
  }
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"), _ = {
126
+ var f = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g, p = /\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g, m = /[^-+\dA-Z]/g, h = (e, t = 2) => String(e).padStart(t, "0"), g = {
132
127
  dayNames: [
133
128
  "So",
134
129
  "Mo",
@@ -182,51 +177,51 @@ var p = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'
182
177
  "PM"
183
178
  ]
184
179
  };
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 = {
180
+ function _(e, n = "dd.mm.yyyy", r, i) {
181
+ if (!d(e) || !t(n)) return "";
182
+ 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"](), p = () => e[a() + "Minutes"](), m = () => e[a() + "Seconds"](), _ = () => e[a() + "Milliseconds"](), S = () => r ? 0 : e.getTimezoneOffset(), C = () => v(e), w = () => y(e), T = {
188
183
  d: () => o(),
189
- dd: () => g(o()),
190
- ddd: () => _.dayNames[s()],
191
- DDD: () => S({
184
+ dd: () => h(o()),
185
+ ddd: () => g.dayNames[s()],
186
+ DDD: () => x({
192
187
  y: l(),
193
188
  m: c(),
194
189
  d: o(),
195
190
  _: a(),
196
- dayName: _.dayNames[s()],
191
+ dayName: g.dayNames[s()],
197
192
  short: !0
198
193
  }),
199
- dddd: () => _.dayNames[s() + 7],
200
- DDDD: () => S({
194
+ dddd: () => g.dayNames[s() + 7],
195
+ DDDD: () => x({
201
196
  y: l(),
202
197
  m: c(),
203
198
  d: o(),
204
199
  _: a(),
205
- dayName: _.dayNames[s() + 7]
200
+ dayName: g.dayNames[s() + 7]
206
201
  }),
207
202
  m: () => c() + 1,
208
- mm: () => g(c() + 1),
209
- mmm: () => _.monthNames[c()],
210
- mmmm: () => _.monthNames[c() + 12],
203
+ mm: () => h(c() + 1),
204
+ mmm: () => g.monthNames[c()],
205
+ mmmm: () => g.monthNames[c() + 12],
211
206
  yy: () => String(l()).slice(2),
212
- yyyy: () => g(l(), 4),
207
+ yyyy: () => h(l(), 4),
213
208
  h: () => u() % 12 || 12,
214
- hh: () => g(u() % 12 || 12),
209
+ hh: () => h(u() % 12 || 12),
215
210
  H: () => u(),
216
- HH: () => g(u()),
217
- M: () => d(),
218
- MM: () => g(d()),
211
+ HH: () => h(u()),
212
+ M: () => p(),
213
+ MM: () => h(p()),
219
214
  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),
215
+ ss: () => h(m()),
216
+ l: () => h(_(), 3),
217
+ L: () => h(Math.floor(_() / 10)),
218
+ t: () => u() < 12 ? g.timeNames[0] : g.timeNames[1],
219
+ tt: () => u() < 12 ? g.timeNames[2] : g.timeNames[3],
220
+ T: () => u() < 12 ? g.timeNames[4] : g.timeNames[5],
221
+ TT: () => u() < 12 ? g.timeNames[6] : g.timeNames[7],
222
+ Z: () => i ? "GMT" : r ? "UTC" : b(e),
223
+ o: () => (S() > 0 ? "-" : "+") + h(Math.floor(Math.abs(S()) / 60) * 100 + Math.abs(S()) % 60, 4),
224
+ p: () => (S() > 0 ? "-" : "+") + h(Math.floor(Math.abs(S()) / 60), 2) + ":" + h(Math.floor(Math.abs(S()) % 60), 2),
230
225
  S: () => [
231
226
  "th",
232
227
  "st",
@@ -234,12 +229,12 @@ function v(e, n = "dd.mm.yyyy", r, i) {
234
229
  "rd"
235
230
  ][o() % 10 > 3 ? 0 : (o() % 100 - o() % 10 != 10) * o() % 10],
236
231
  W: () => C(),
237
- WW: () => g(C()),
232
+ WW: () => h(C()),
238
233
  N: () => w()
239
234
  };
240
- return n.replace(p, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
235
+ return n.replace(f, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
241
236
  }
242
- var y = (e) => {
237
+ var v = (e) => {
243
238
  let t = new Date(e.getFullYear(), e.getMonth(), e.getDate());
244
239
  t.setDate(t.getDate() - (t.getDay() + 6) % 7 + 3);
245
240
  let n = new Date(t.getFullYear(), 0, 4);
@@ -248,10 +243,10 @@ var y = (e) => {
248
243
  t.setHours(t.getHours() - r);
249
244
  let i = (t - n) / 6048e5;
250
245
  return 1 + Math.floor(i);
251
- }, b = (e) => {
246
+ }, y = (e) => {
252
247
  let t = e.getDay();
253
248
  return t === 0 && (t = 7), t;
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 }) => {
249
+ }, b = (e) => (String(e).match(p) || [""]).pop().replace(m, "").replace(/GMT\+0000/g, "UTC"), x = ({ y: e, m: t, d: n, _: r, dayName: i, short: a = !1 }) => {
255
250
  let o = /* @__PURE__ */ new Date(), s = /* @__PURE__ */ new Date();
256
251
  s.setDate(s[r + "Date"]() - 1);
257
252
  let c = /* @__PURE__ */ new Date();
@@ -259,37 +254,47 @@ var y = (e) => {
259
254
  };
260
255
  //#endregion
261
256
  //#region src/functions/checks/_is-nil.js
262
- function C(e) {
257
+ function S(e) {
263
258
  return e == null;
264
259
  }
265
260
  //#endregion
266
261
  //#region src/functions/checks/_is-object.js
267
- function w(e) {
268
- return !C(e) && typeof e == "object" && !a(e);
262
+ function C(e) {
263
+ return !S(e) && typeof e == "object" && !a(e);
269
264
  }
270
265
  //#endregion
271
266
  //#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));
267
+ function w(e) {
268
+ return C(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
274
269
  }
275
270
  //#endregion
276
271
  //#region src/functions/checks/_is-empty-string.js
277
- function E(e) {
272
+ function T(e) {
278
273
  return t(e) && e.trim().length === 0;
279
274
  }
280
275
  //#endregion
281
- //#region src/functions/checks/_is-negative-number.js
276
+ //#region src/functions/checks/_is-float.js
277
+ function E(e) {
278
+ return c(e) && !Number.isInteger(e);
279
+ }
280
+ //#endregion
281
+ //#region src/functions/checks/_is-integer.js
282
282
  function D(e) {
283
+ return Number.isInteger(e);
284
+ }
285
+ //#endregion
286
+ //#region src/functions/checks/_is-negative-number.js
287
+ function O(e) {
283
288
  return c(e) && e < 0;
284
289
  }
285
290
  //#endregion
286
291
  //#region src/functions/_kebab-case-to-title-case.js
287
- function O(e) {
292
+ function k(e) {
288
293
  return t(e) ? e.split("-").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
289
294
  }
290
295
  //#endregion
291
296
  //#region src/functions/_median.js
292
- function k(e) {
297
+ function A(e) {
293
298
  if (!Array.isArray(e) || e.length === 0) return null;
294
299
  for (let t of e) if (!Number.isFinite(t)) return null;
295
300
  let t = [...e].sort((e, t) => e - t), n = Math.floor(t.length / 2);
@@ -297,7 +302,7 @@ function k(e) {
297
302
  }
298
303
  //#endregion
299
304
  //#region src/functions/_request.js
300
- async function A({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
305
+ async function j({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
301
306
  let i = n !== "GET" && t !== void 0 ? JSON.stringify(t) : void 0, a = await fetch(e, {
302
307
  method: n,
303
308
  headers: {
@@ -318,7 +323,7 @@ async function A({ url: e, body: t, method: n = "POST", headers: r = {} } = {})
318
323
  }
319
324
  //#endregion
320
325
  //#region src/functions/_risk-reward.js
321
- function j(e = {}) {
326
+ function M(e = {}) {
322
327
  let { entry: t, exit: n, riskRatio: r = 20 } = e ?? {};
323
328
  if (!c(t) || t <= 0 || !c(n) || n <= 0 || !c(r) || r <= 0) return null;
324
329
  let i = (n - t) / t / (r / 100);
@@ -326,17 +331,17 @@ function j(e = {}) {
326
331
  }
327
332
  //#endregion
328
333
  //#region src/functions/_size.js
329
- function M(e) {
334
+ function N(e) {
330
335
  return e == null ? 0 : Array.isArray(e) || typeof e == "string" ? e.length : typeof e == "object" || typeof e == "function" ? Object.keys(e).length : 0;
331
336
  }
332
337
  //#endregion
333
338
  //#region src/functions/_slugify.js
334
- function N(e) {
339
+ function P(e) {
335
340
  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, "") : "";
336
341
  }
337
342
  //#endregion
338
343
  //#region src/functions/_to-number.js
339
- function P(e, t = null) {
344
+ function F(e, t = null) {
340
345
  let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
341
346
  if (!Number.isFinite(n)) return null;
342
347
  if (t == null) return n;
@@ -344,4 +349,4 @@ function P(e, t = null) {
344
349
  return Math.round(n * r) / r;
345
350
  }
346
351
  //#endregion
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 };
352
+ export { n as C, i as S, e as T, l as _, j as a, o as b, O as c, T as d, w as f, u as g, _ as h, M as i, D as l, S as m, P as n, A as o, C as p, N as r, k as s, F as t, E as u, c as v, t as w, a as x, s as y };
package/dist/functions.js CHANGED
@@ -1 +1 @@
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";
1
+ export { T as average, C as camelCaseToTitleCase, S as convertHexToRgba, _ as createCache, g as darkenHexColor, h as formatDate, x as isArray, b as isEmptyArray, f as isEmptyObject, d as isEmptyString, u as isFloat, y as isFunction, l as isInteger, c as isNegativeNumber, m as isNil, v as isNumber, p as isObject, w 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-BMRWm341.js";