melonykit 0.16.2 → 0.17.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-HFX7hCQR.js";
1
+ import { m as e } from "./functions-CSuMpnOY.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,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "./browser-DEPpkjr9.js";
1
+ import { i as e, n as t, r as n, t as r } from "./browser-BBrs7hJl.js";
2
2
  export { t as getClientSetting, e as routeTo, r as setClientSetting, n as useQuery };
@@ -17,8 +17,18 @@ function t(t, n) {
17
17
  return `rgba(${r}, ${i}, ${a}, ${n})`;
18
18
  }
19
19
  //#endregion
20
+ //#region src/functions/checks/_is-string.js
21
+ function n(e) {
22
+ return typeof e == "string";
23
+ }
24
+ //#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(" ") : "";
28
+ }
29
+ //#endregion
20
30
  //#region src/functions/_darken-hex-color.js
21
- function n(t, n) {
31
+ function i(t, n) {
22
32
  let r = e(t);
23
33
  if (!Number.isFinite(n)) throw TypeError("amount must be a finite number");
24
34
  if (n < 0 || n > 1) throw RangeError("amount must be between 0 and 1");
@@ -26,16 +36,11 @@ function n(t, n) {
26
36
  return `#${r.map((e) => Math.round(e * i)).map((e) => e.toString(16).padStart(2, "0")).join("")}`;
27
37
  }
28
38
  //#endregion
29
- //#region src/functions/checks/_is-string.js
30
- function r(e) {
31
- return typeof e == "string";
32
- }
33
- //#endregion
34
39
  //#region src/functions/_format-date.js
35
- function i(e) {
40
+ function a(e) {
36
41
  return Object.prototype.toString.call(e) === "[object Date]" && !isNaN(e);
37
42
  }
38
- var a = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g, o = /\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g, s = /[^-+\dA-Z]/g, c = (e, t = 2) => String(e).padStart(t, "0"), l = {
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 = {
39
44
  dayNames: [
40
45
  "So",
41
46
  "Mo",
@@ -89,64 +94,64 @@ var a = /d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'
89
94
  "PM"
90
95
  ]
91
96
  };
92
- function u(e, t = "dd.mm.yyyy", n, o) {
93
- if (!i(e) || !r(t)) return "";
94
- let s = () => n ? "getUTC" : "get", u = () => e[s() + "Date"](), h = () => 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 = () => n ? 0 : e.getTimezoneOffset(), C = () => d(e), w = () => f(e), T = {
95
- d: () => u(),
96
- dd: () => c(u()),
97
- ddd: () => l.dayNames[h()],
98
- DDD: () => m({
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({
99
104
  y: _(),
100
105
  m: g(),
101
- d: u(),
106
+ d: c(),
102
107
  _: s(),
103
- dayName: l.dayNames[h()],
108
+ dayName: u.dayNames[d()],
104
109
  short: !0
105
110
  }),
106
- dddd: () => l.dayNames[h() + 7],
107
- DDDD: () => m({
111
+ dddd: () => u.dayNames[d() + 7],
112
+ DDDD: () => h({
108
113
  y: _(),
109
114
  m: g(),
110
- d: u(),
115
+ d: c(),
111
116
  _: s(),
112
- dayName: l.dayNames[h() + 7]
117
+ dayName: u.dayNames[d() + 7]
113
118
  }),
114
119
  m: () => g() + 1,
115
- mm: () => c(g() + 1),
116
- mmm: () => l.monthNames[g()],
117
- mmmm: () => l.monthNames[g() + 12],
120
+ mm: () => l(g() + 1),
121
+ mmm: () => u.monthNames[g()],
122
+ mmmm: () => u.monthNames[g() + 12],
118
123
  yy: () => String(_()).slice(2),
119
- yyyy: () => c(_(), 4),
124
+ yyyy: () => l(_(), 4),
120
125
  h: () => v() % 12 || 12,
121
- hh: () => c(v() % 12 || 12),
126
+ hh: () => l(v() % 12 || 12),
122
127
  H: () => v(),
123
- HH: () => c(v()),
128
+ HH: () => l(v()),
124
129
  M: () => y(),
125
- MM: () => c(y()),
130
+ MM: () => l(y()),
126
131
  s: () => b(),
127
- ss: () => c(b()),
128
- l: () => c(x(), 3),
129
- L: () => c(Math.floor(x() / 10)),
130
- t: () => v() < 12 ? l.timeNames[0] : l.timeNames[1],
131
- tt: () => v() < 12 ? l.timeNames[2] : l.timeNames[3],
132
- T: () => v() < 12 ? l.timeNames[4] : l.timeNames[5],
133
- TT: () => v() < 12 ? l.timeNames[6] : l.timeNames[7],
134
- Z: () => o ? "GMT" : n ? "UTC" : p(e),
135
- o: () => (S() > 0 ? "-" : "+") + c(Math.floor(Math.abs(S()) / 60) * 100 + Math.abs(S()) % 60, 4),
136
- p: () => (S() > 0 ? "-" : "+") + c(Math.floor(Math.abs(S()) / 60), 2) + ":" + c(Math.floor(Math.abs(S()) % 60), 2),
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),
137
142
  S: () => [
138
143
  "th",
139
144
  "st",
140
145
  "nd",
141
146
  "rd"
142
- ][u() % 10 > 3 ? 0 : (u() % 100 - u() % 10 != 10) * u() % 10],
147
+ ][c() % 10 > 3 ? 0 : (c() % 100 - c() % 10 != 10) * c() % 10],
143
148
  W: () => C(),
144
- WW: () => c(C()),
149
+ WW: () => l(C()),
145
150
  N: () => w()
146
151
  };
147
- return t.replace(a, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
152
+ return t.replace(o, (e) => e in T ? T[e]() : e.slice(1, e.length - 1));
148
153
  }
149
- var d = (e) => {
154
+ var f = (e) => {
150
155
  let t = new Date(e.getFullYear(), e.getMonth(), e.getDate());
151
156
  t.setDate(t.getDate() - (t.getDay() + 6) % 7 + 3);
152
157
  let n = new Date(t.getFullYear(), 0, 4);
@@ -155,10 +160,10 @@ var d = (e) => {
155
160
  t.setHours(t.getHours() - r);
156
161
  let i = (t - n) / 6048e5;
157
162
  return 1 + Math.floor(i);
158
- }, f = (e) => {
163
+ }, p = (e) => {
159
164
  let t = e.getDay();
160
165
  return t === 0 && (t = 7), t;
161
- }, p = (e) => (String(e).match(o) || [""]).pop().replace(s, "").replace(/GMT\+0000/g, "UTC"), m = ({ y: e, m: t, d: n, _: r, dayName: i, short: a = !1 }) => {
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 }) => {
162
167
  let o = /* @__PURE__ */ new Date(), s = /* @__PURE__ */ new Date();
163
168
  s.setDate(s[r + "Date"]() - 1);
164
169
  let c = /* @__PURE__ */ new Date();
@@ -166,12 +171,12 @@ var d = (e) => {
166
171
  };
167
172
  //#endregion
168
173
  //#region src/functions/_kebab-case-to-title-case.js
169
- function h(e) {
170
- return r(e) ? e.split("-").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
174
+ function g(e) {
175
+ return n(e) ? e.split("-").filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "";
171
176
  }
172
177
  //#endregion
173
178
  //#region src/functions/_request.js
174
- async function g({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
179
+ async function _({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
175
180
  let i = n !== "GET" && t !== void 0 ? JSON.stringify(t) : void 0, a = await fetch(e, {
176
181
  method: n,
177
182
  headers: {
@@ -192,12 +197,12 @@ async function g({ url: e, body: t, method: n = "POST", headers: r = {} } = {})
192
197
  }
193
198
  //#endregion
194
199
  //#region src/functions/_size.js
195
- function _(e) {
200
+ function v(e) {
196
201
  return e == null ? 0 : Array.isArray(e) || typeof e == "string" ? e.length : typeof e == "object" || typeof e == "function" ? Object.keys(e).length : 0;
197
202
  }
198
203
  //#endregion
199
204
  //#region src/functions/_to-number.js
200
- function v(e, t = null) {
205
+ function y(e, t = null) {
201
206
  let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
202
207
  if (!Number.isFinite(n)) return null;
203
208
  if (t == null) return n;
@@ -206,32 +211,32 @@ function v(e, t = null) {
206
211
  }
207
212
  //#endregion
208
213
  //#region src/functions/checks/_is-array.js
209
- function y(e) {
214
+ function b(e) {
210
215
  return Array.isArray(e);
211
216
  }
212
217
  //#endregion
213
218
  //#region src/functions/checks/_is-empty-array.js
214
- function b(e) {
215
- return y(e) && e.length === 0;
219
+ function x(e) {
220
+ return b(e) && e.length === 0;
216
221
  }
217
222
  //#endregion
218
223
  //#region src/functions/checks/_is-function.js
219
- function x(e) {
224
+ function S(e) {
220
225
  return typeof e == "function";
221
226
  }
222
227
  //#endregion
223
228
  //#region src/functions/checks/_is-number.js
224
- function S(e) {
229
+ function C(e) {
225
230
  return typeof e == "number" && Number.isFinite(e);
226
231
  }
227
232
  //#endregion
228
233
  //#region src/functions/checks/_is-positive-number.js
229
- function C(e) {
230
- return S(e) && e > 0;
234
+ function w(e) {
235
+ return C(e) && e > 0;
231
236
  }
232
237
  //#endregion
233
238
  //#region src/functions/_create-cache.js
234
- function w({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
239
+ function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
235
240
  let i = /* @__PURE__ */ new Map();
236
241
  async function a(t, n) {
237
242
  if (i.has(t)) return !1;
@@ -240,12 +245,12 @@ function w({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
240
245
  ...n,
241
246
  createdAt: r,
242
247
  lastUpdate: r
243
- }), x(e) && await e(t), !0;
248
+ }), S(e) && await e(t), !0;
244
249
  }
245
250
  async function o(e, n) {
246
251
  if (!i.has(e) || typeof n != "function") return !1;
247
252
  let r = i.get(e);
248
- return await n(r), r.lastUpdate = Date.now(), x(t) && await t(e), !0;
253
+ return await n(r), r.lastUpdate = Date.now(), S(t) && await t(e), !0;
249
254
  }
250
255
  function s(e) {
251
256
  return i.get(e) ?? null;
@@ -262,10 +267,10 @@ function w({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
262
267
  async function d(e) {
263
268
  if (!i.has(e)) return !1;
264
269
  let t = i.get(e);
265
- return i.delete(e), x(n) && await n(e, t), !0;
270
+ return i.delete(e), S(n) && await n(e, t), !0;
266
271
  }
267
272
  function f({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
268
- C(e) && y(t) && !b(t) && t.every((e) => x(e)) && x(n) && x(r) && r(async () => {
273
+ w(e) && b(t) && !x(t) && t.every((e) => S(e)) && S(n) && S(r) && r(async () => {
269
274
  let e = n();
270
275
  for (let [n, r] of i) t.some((t) => t(r, e)) && await d(n);
271
276
  }, e)?.unref?.();
@@ -282,33 +287,28 @@ function w({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
282
287
  }
283
288
  //#endregion
284
289
  //#region src/functions/checks/_is-nil.js
285
- function T(e) {
290
+ function E(e) {
286
291
  return e == null;
287
292
  }
288
293
  //#endregion
289
294
  //#region src/functions/checks/_is-object.js
290
- function E(e) {
291
- return !T(e) && typeof e == "object" && !y(e);
292
- }
293
- //#endregion
294
- //#region src/functions/checks/_is-empty-object.js
295
295
  function D(e) {
296
- return E(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
296
+ return !E(e) && typeof e == "object" && !b(e);
297
297
  }
298
298
  //#endregion
299
- //#region src/functions/checks/_is-empty-string.js
299
+ //#region src/functions/checks/_is-empty-object.js
300
300
  function O(e) {
301
- return r(e) && e.trim().length === 0;
301
+ return D(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
302
302
  }
303
303
  //#endregion
304
- //#region src/functions/checks/_is-empty.js
304
+ //#region src/functions/checks/_is-empty-string.js
305
305
  function k(e) {
306
- return e == null ? !0 : typeof e == "function" ? !1 : typeof e == "number" ? !Number.isFinite(e) : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 : typeof e != "object" || Object.keys(e).length === 0 && Object.getOwnPropertySymbols(e).length === 0;
306
+ return n(e) && e.trim().length === 0;
307
307
  }
308
308
  //#endregion
309
309
  //#region src/functions/checks/_is-negative-number.js
310
310
  function A(e) {
311
- return S(e) && e < 0;
311
+ return C(e) && e < 0;
312
312
  }
313
313
  //#endregion
314
- export { u as _, E as a, t as b, C as c, b as d, y as f, h as g, g as h, D as i, S as l, _ as m, k as n, T as o, v as p, O as r, w as s, A as t, x as u, r as v, n as y };
314
+ export { i as _, E as a, t as b, C as c, b as d, y as f, d as g, g as h, D as i, S as l, _ as m, k as n, T as o, v as p, O as r, w as s, A as t, x as u, r as v, n as y };
package/dist/functions.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "./functions-HFX7hCQR.js";
2
- export { n as convertHexToRgba, h as createCache, y as darkenHexColor, e as formatDate, a as isArray, d as isEmpty, i as isEmptyArray, c as isEmptyObject, m as isEmptyString, _ as isFunction, g as isNegativeNumber, f as isNil, l as isNumber, t as isObject, r as isPositiveNumber, v as isString, o as kebabCaseToTitleCase, s as request, u as size, p as toNumber };
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, y } from "./functions-CSuMpnOY.js";
2
+ export { v as camelCaseToTitleCase, n as convertHexToRgba, f as createCache, e as darkenHexColor, o as formatDate, i as isArray, _ as isEmptyArray, m as isEmptyObject, d as isEmptyString, l as isFunction, g as isNegativeNumber, t as isNil, r as isNumber, c as isObject, h as isPositiveNumber, y as isString, s as kebabCaseToTitleCase, u as request, p as size, a as toNumber };