melonykit 0.16.1 → 0.16.3

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-CexzzAfY.js";
1
+ import { h as e } from "./functions-CGixFbFT.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-WVsjaJ9n.js";
1
+ import { i as e, n as t, r as n, t as r } from "./browser-CFswWLIi.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,18 +160,23 @@ 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();
165
170
  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;
166
171
  };
167
172
  //#endregion
173
+ //#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(" ") : "";
176
+ }
177
+ //#endregion
168
178
  //#region src/functions/_request.js
169
- async function h({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
179
+ async function _({ url: e, body: t, method: n = "POST", headers: r = {} } = {}) {
170
180
  let i = n !== "GET" && t !== void 0 ? JSON.stringify(t) : void 0, a = await fetch(e, {
171
181
  method: n,
172
182
  headers: {
@@ -187,12 +197,12 @@ async function h({ url: e, body: t, method: n = "POST", headers: r = {} } = {})
187
197
  }
188
198
  //#endregion
189
199
  //#region src/functions/_size.js
190
- function g(e) {
200
+ function v(e) {
191
201
  return e == null ? 0 : Array.isArray(e) || typeof e == "string" ? e.length : typeof e == "object" || typeof e == "function" ? Object.keys(e).length : 0;
192
202
  }
193
203
  //#endregion
194
204
  //#region src/functions/_to-number.js
195
- function _(e, t = null) {
205
+ function y(e, t = null) {
196
206
  let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
197
207
  if (!Number.isFinite(n)) return null;
198
208
  if (t == null) return n;
@@ -201,32 +211,32 @@ function _(e, t = null) {
201
211
  }
202
212
  //#endregion
203
213
  //#region src/functions/checks/_is-array.js
204
- function v(e) {
214
+ function b(e) {
205
215
  return Array.isArray(e);
206
216
  }
207
217
  //#endregion
208
218
  //#region src/functions/checks/_is-empty-array.js
209
- function y(e) {
210
- return v(e) && e.length === 0;
219
+ function x(e) {
220
+ return b(e) && e.length === 0;
211
221
  }
212
222
  //#endregion
213
223
  //#region src/functions/checks/_is-function.js
214
- function b(e) {
224
+ function S(e) {
215
225
  return typeof e == "function";
216
226
  }
217
227
  //#endregion
218
228
  //#region src/functions/checks/_is-number.js
219
- function x(e) {
229
+ function C(e) {
220
230
  return typeof e == "number" && Number.isFinite(e);
221
231
  }
222
232
  //#endregion
223
233
  //#region src/functions/checks/_is-positive-number.js
224
- function S(e) {
225
- return x(e) && e > 0;
234
+ function w(e) {
235
+ return C(e) && e > 0;
226
236
  }
227
237
  //#endregion
228
238
  //#region src/functions/_create-cache.js
229
- function C({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
239
+ function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
230
240
  let i = /* @__PURE__ */ new Map();
231
241
  async function a(t, n) {
232
242
  if (i.has(t)) return !1;
@@ -235,12 +245,12 @@ function C({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
235
245
  ...n,
236
246
  createdAt: r,
237
247
  lastUpdate: r
238
- }), b(e) && await e(t), !0;
248
+ }), S(e) && await e(t), !0;
239
249
  }
240
250
  async function o(e, n) {
241
251
  if (!i.has(e) || typeof n != "function") return !1;
242
252
  let r = i.get(e);
243
- return await n(r), r.lastUpdate = Date.now(), b(t) && await t(e), !0;
253
+ return await n(r), r.lastUpdate = Date.now(), S(t) && await t(e), !0;
244
254
  }
245
255
  function s(e) {
246
256
  return i.get(e) ?? null;
@@ -257,10 +267,10 @@ function C({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
257
267
  async function d(e) {
258
268
  if (!i.has(e)) return !1;
259
269
  let t = i.get(e);
260
- return i.delete(e), b(n) && await n(e, t), !0;
270
+ return i.delete(e), S(n) && await n(e, t), !0;
261
271
  }
262
272
  function f({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
263
- S(e) && v(t) && !y(t) && t.every((e) => b(e)) && b(n) && b(r) && r(async () => {
273
+ w(e) && b(t) && !x(t) && t.every((e) => S(e)) && S(n) && S(r) && r(async () => {
264
274
  let e = n();
265
275
  for (let [n, r] of i) t.some((t) => t(r, e)) && await d(n);
266
276
  }, e)?.unref?.();
@@ -277,33 +287,33 @@ function C({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
277
287
  }
278
288
  //#endregion
279
289
  //#region src/functions/checks/_is-nil.js
280
- function w(e) {
290
+ function E(e) {
281
291
  return e == null;
282
292
  }
283
293
  //#endregion
284
294
  //#region src/functions/checks/_is-object.js
285
- function T(e) {
286
- return !w(e) && typeof e == "object" && !v(e);
295
+ function D(e) {
296
+ return !E(e) && typeof e == "object" && !b(e);
287
297
  }
288
298
  //#endregion
289
299
  //#region src/functions/checks/_is-empty-object.js
290
- function E(e) {
291
- return T(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
300
+ function O(e) {
301
+ return D(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
292
302
  }
293
303
  //#endregion
294
304
  //#region src/functions/checks/_is-empty-string.js
295
- function D(e) {
296
- return r(e) && e.trim().length === 0;
305
+ function k(e) {
306
+ return n(e) && e.trim().length === 0;
297
307
  }
298
308
  //#endregion
299
309
  //#region src/functions/checks/_is-empty.js
300
- function O(e) {
310
+ function A(e) {
301
311
  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;
302
312
  }
303
313
  //#endregion
304
314
  //#region src/functions/checks/_is-negative-number.js
305
- function k(e) {
306
- return x(e) && e < 0;
315
+ function j(e) {
316
+ return C(e) && e < 0;
307
317
  }
308
318
  //#endregion
309
- export { r as _, T as a, S as c, y as d, v as f, u as g, h, E as i, x as l, g as m, O as n, w as o, _ as p, D as r, C as s, k as t, b as u, n as v, t as y };
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 };
package/dist/functions.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./functions-CexzzAfY.js";
2
- export { v as convertHexToRgba, m as createCache, _ as darkenHexColor, a as formatDate, i as isArray, u as isEmpty, r as isEmptyArray, s as isEmptyObject, p as isEmptyString, g as isFunction, h as isNegativeNumber, d as isNil, c as isNumber, t as isObject, n as isPositiveNumber, e as isString, o as request, l as size, f 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, x as y, y as b } from "./functions-CGixFbFT.js";
2
+ export { b as camelCaseToTitleCase, y as convertHexToRgba, h as createCache, v 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, n as isString, o as kebabCaseToTitleCase, s as request, u as size, p as toNumber };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as e, t } from "./browser-WVsjaJ9n.js";
2
- import { r as n, v as r } from "./functions-CexzzAfY.js";
1
+ import { n as e, t } from "./browser-CFswWLIi.js";
2
+ import { r as n, v as r } from "./functions-CGixFbFT.js";
3
3
  import { useSignal as i } from "@preact/signals";
4
4
  import { useEffect as a, useId as o, useRef as s, useState as c } from "preact/hooks";
5
5
  import { Fragment as l, jsx as u, jsxs as d } from "preact/jsx-runtime";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Vadim Hermann",
3
3
  "name": "melonykit",
4
- "version": "0.16.1",
4
+ "version": "0.16.3",
5
5
  "type": "module",
6
6
  "description": "Preact based ui and utility functions toolkit",
7
7
  "main": "./dist/index.js",