melonykit 0.15.4 → 0.15.6

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.
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { m as e } from "./functions-lglYN2Ig.js";
1
+ import { h as e } from "./functions-BOOnIVPG.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
@@ -210,49 +210,96 @@ function y(e) {
210
210
  return v(e) && e.length === 0;
211
211
  }
212
212
  //#endregion
213
- //#region src/functions/checks/_is-nil.js
213
+ //#region src/functions/checks/_is-function.js
214
214
  function b(e) {
215
- return e == null;
215
+ return typeof e == "function";
216
216
  }
217
217
  //#endregion
218
- //#region src/functions/checks/_is-object.js
218
+ //#region src/functions/checks/_is-number.js
219
219
  function x(e) {
220
- return !b(e) && typeof e == "object" && !v(e);
220
+ return typeof e == "number" && Number.isFinite(e);
221
221
  }
222
222
  //#endregion
223
- //#region src/functions/checks/_is-empty-object.js
223
+ //#region src/functions/checks/_is-positive-number.js
224
224
  function S(e) {
225
- return x(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
225
+ return x(e) && e > 0;
226
226
  }
227
227
  //#endregion
228
- //#region src/functions/checks/_is-empty-string.js
229
- function C(e) {
230
- return r(e) && e.trim().length === 0;
228
+ //#region src/functions/_create-cache.js
229
+ function C({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
230
+ let i = /* @__PURE__ */ new Map();
231
+ async function a(t, n) {
232
+ if (i.has(t)) return !1;
233
+ let r = Date.now();
234
+ return i.set(t, {
235
+ ...n,
236
+ createdAt: r,
237
+ lastUpdate: r
238
+ }), b(e) && await e(t), !0;
239
+ }
240
+ async function o(e, n) {
241
+ if (!i.has(e) || typeof n != "function") return !1;
242
+ let r = i.get(e);
243
+ return await n(r), r.lastUpdate = Date.now(), b(t) && await t(e), !0;
244
+ }
245
+ function s(e) {
246
+ return i.get(e) ?? null;
247
+ }
248
+ function c() {
249
+ return i.entries();
250
+ }
251
+ function l(e) {
252
+ return i.has(e);
253
+ }
254
+ async function u(e) {
255
+ if (!i.has(e)) return !1;
256
+ let t = i.get(e);
257
+ return i.delete(e), b(n) && await n(e, t), !0;
258
+ }
259
+ function d({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
260
+ S(e) && v(t) && !y(t) && t.every((e) => b(e)) && b(n) && b(r) && r(async () => {
261
+ let e = n();
262
+ for (let [n, r] of i) t.some((t) => t(r, e)) && await u(n);
263
+ }, e)?.unref?.();
264
+ }
265
+ return d(r), {
266
+ add: a,
267
+ get: s,
268
+ entries: c,
269
+ update: o,
270
+ has: l,
271
+ remove: u
272
+ };
231
273
  }
232
274
  //#endregion
233
- //#region src/functions/checks/_is-empty.js
275
+ //#region src/functions/checks/_is-nil.js
234
276
  function w(e) {
235
- 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;
277
+ return e == null;
236
278
  }
237
279
  //#endregion
238
- //#region src/functions/checks/_is-function.js
280
+ //#region src/functions/checks/_is-object.js
239
281
  function T(e) {
240
- return typeof e == "function";
282
+ return !w(e) && typeof e == "object" && !v(e);
241
283
  }
242
284
  //#endregion
243
- //#region src/functions/checks/_is-number.js
285
+ //#region src/functions/checks/_is-empty-object.js
244
286
  function E(e) {
245
- return typeof e == "number" && Number.isFinite(e);
287
+ return T(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
246
288
  }
247
289
  //#endregion
248
- //#region src/functions/checks/_is-negative-number.js
290
+ //#region src/functions/checks/_is-empty-string.js
249
291
  function D(e) {
250
- return E(e) && e < 0;
292
+ return r(e) && e.trim().length === 0;
251
293
  }
252
294
  //#endregion
253
- //#region src/functions/checks/_is-positive-number.js
295
+ //#region src/functions/checks/_is-empty.js
254
296
  function O(e) {
255
- return E(e) && e > 0;
297
+ 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;
298
+ }
299
+ //#endregion
300
+ //#region src/functions/checks/_is-negative-number.js
301
+ function k(e) {
302
+ return x(e) && e < 0;
256
303
  }
257
304
  //#endregion
258
- export { n as _, w as a, x as c, v as d, _ as f, r as g, u as h, T as i, b as l, h as m, D as n, C as o, g as p, E as r, S as s, O as t, y as u, t as v };
305
+ 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 };
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 _ } from "./functions-lglYN2Ig.js";
2
- export { _ as convertHexToRgba, e as darkenHexColor, o as formatDate, r as isArray, t as isEmpty, g as isEmptyArray, m as isEmptyObject, d as isEmptyString, s as isFunction, u as isNegativeNumber, c as isNil, p as isNumber, n as isObject, h as isPositiveNumber, a as isString, l as request, f as size, i as toNumber };
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-BOOnIVPG.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 };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as e, o as t } from "./functions-lglYN2Ig.js";
1
+ import { r as e, v as t } from "./functions-BOOnIVPG.js";
2
2
  import { useSignal as n } from "@preact/signals";
3
3
  import { useEffect as r, useId as i, useRef as a } from "preact/hooks";
4
4
  import { Fragment as o, jsx as s, jsxs as c } from "preact/jsx-runtime";
@@ -1268,15 +1268,15 @@ var J = {
1268
1268
  transition: width .3s ease;
1269
1269
  `,
1270
1270
  normal: U`
1271
- border: solid 1px ${e(W.colors.primary, .3)};
1271
+ border: solid 1px ${t(W.colors.primary, .3)};
1272
1272
  background-color: ${W.colors.primary};
1273
1273
  `,
1274
1274
  warn: U`
1275
- border: solid 1px ${e(W.colors.secondary, .2)};
1275
+ border: solid 1px ${t(W.colors.secondary, .2)};
1276
1276
  background-color: ${W.colors.secondary};
1277
1277
  `,
1278
1278
  danger: U`
1279
- border: solid 1px ${e(W.colors.danger, .3)};
1279
+ border: solid 1px ${t(W.colors.danger, .3)};
1280
1280
  background-color: ${W.colors.danger};
1281
1281
  `
1282
1282
  };
@@ -1389,13 +1389,13 @@ var St = rt`
1389
1389
  &[has-icon] { padding-left: 2rem; }
1390
1390
  `,
1391
1391
  primary: U`
1392
- color: ${e(W.colors.primary, .5)};
1393
- border-bottom: solid 3px ${e(W.colors.primary, .25)};
1392
+ color: ${t(W.colors.primary, .5)};
1393
+ border-bottom: solid 3px ${t(W.colors.primary, .25)};
1394
1394
  background-color: ${W.colors.primary};
1395
1395
  `,
1396
1396
  secondary: U`
1397
- color: ${e(W.colors.secondary, .5)};
1398
- border-bottom: solid 3px ${e(W.colors.secondary, .25)};
1397
+ color: ${t(W.colors.secondary, .5)};
1398
+ border-bottom: solid 3px ${t(W.colors.secondary, .25)};
1399
1399
  background-color: ${W.colors.secondary};
1400
1400
  `,
1401
1401
  ripple: U`
@@ -1670,41 +1670,43 @@ var X = {
1670
1670
  };
1671
1671
  //#endregion
1672
1672
  //#region src/components/_slider.jsx
1673
- function Mt({ label: e, items: t = [], value: l, isDisabled: u = !1, onSlide: d, onChange: f }) {
1674
- let p = i(), m = n(l ?? t[0]?.value), h = Math.max(t.findIndex((e) => e.value === m.value), 0), g = t[h], _ = a(g?.value), v = u || t.length < 2;
1673
+ function Mt({ label: e, items: t = [], value: a, isDisabled: l = !1, onSlide: u, onChange: d }) {
1674
+ let f = i(), p = n(a ?? t[0]?.value), m = Math.max(t.findIndex((e) => e.value === p.value), 0);
1675
+ t[m];
1676
+ let h = l || t.length < 2;
1675
1677
  r(() => {
1676
- l !== void 0 && (m.value = l, _.current = l);
1677
- }, [l]);
1678
- function y(e) {
1678
+ a !== void 0 && (p.value = a);
1679
+ }, [a]);
1680
+ function g(e) {
1679
1681
  return t[Number(e.currentTarget.value)];
1680
1682
  }
1681
- function b(e) {
1682
- let t = y(e);
1683
- t && (m.value = t.value, d?.(t.value, t));
1683
+ function _(e) {
1684
+ let t = g(e);
1685
+ t && (p.value = t.value, u?.(t.value, t));
1684
1686
  }
1685
- function x(e) {
1686
- let t = y(e);
1687
- t && _.current !== t.value && (_.current = t.value, f?.(t.value, t));
1687
+ function v(e) {
1688
+ let t = g(e);
1689
+ t && d?.(t.value, t);
1688
1690
  }
1689
1691
  return /* @__PURE__ */ s(o, { children: /* @__PURE__ */ c("div", {
1690
1692
  className: Nt.base,
1691
1693
  children: [
1692
1694
  e && /* @__PURE__ */ s("label", {
1693
1695
  className: Nt.label,
1694
- htmlFor: p,
1696
+ htmlFor: f,
1695
1697
  children: e
1696
1698
  }),
1697
1699
  /* @__PURE__ */ s("input", {
1698
- id: p,
1700
+ id: f,
1699
1701
  type: "range",
1700
1702
  className: Nt.input,
1701
1703
  min: "0",
1702
1704
  max: Math.max(t.length - 1, 0),
1703
1705
  step: "1",
1704
- value: h,
1705
- disabled: v,
1706
- onInput: b,
1707
- onChange: x
1706
+ value: m,
1707
+ disabled: h,
1708
+ onInput: _,
1709
+ onChange: v
1708
1710
  }),
1709
1711
  /* @__PURE__ */ s("div", {
1710
1712
  className: Nt.items,
@@ -1747,7 +1749,7 @@ var Nt = {
1747
1749
  margin-top: -.375rem;
1748
1750
  border: solid 2px ${W.colors.back.primary};
1749
1751
  border-radius: 50%;
1750
- border: solid 1px ${e(W.colors.primary, .3)};
1752
+ border: solid 1px ${t(W.colors.primary, .3)};
1751
1753
  background-color: ${W.colors.primary};
1752
1754
  }
1753
1755
 
@@ -1962,10 +1964,10 @@ var zt = {
1962
1964
  };
1963
1965
  //#endregion
1964
1966
  //#region src/components/_tag.jsx
1965
- function Bt({ className: e, variant: n = "normal", iconName: r = "", label: i }) {
1967
+ function Bt({ className: t, variant: n = "normal", iconName: r = "", label: i }) {
1966
1968
  return /* @__PURE__ */ s(o, { children: /* @__PURE__ */ c("div", {
1967
- className: H(Vt.base, Vt[n] ?? Vt.normal, e),
1968
- "has-icon": !t(r),
1969
+ className: H(Vt.base, Vt[n] ?? Vt.normal, t),
1970
+ "has-icon": !e(r),
1969
1971
  children: [r && /* @__PURE__ */ s(o, { children: /* @__PURE__ */ s(G, {
1970
1972
  className: U`
1971
1973
  ${W.extends.verticalCenter}
@@ -2345,14 +2347,14 @@ var $ = {
2345
2347
  number: U`
2346
2348
  width: 3rem;
2347
2349
  color: ${W.colors.fore.secondary};
2348
- text-align: right !important;
2350
+ text-align: right;
2349
2351
  `,
2350
2352
  empty: U`
2351
2353
  position: relative;
2352
2354
  height: 8.25rem;
2353
- padding: 0 !important;
2355
+ padding: 0;
2354
2356
  color: ${W.colors.fore.secondary};
2355
- text-align: center !important;
2357
+ text-align: center;
2356
2358
  `,
2357
2359
  emptyContent: U`
2358
2360
  display: grid;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Vadim Hermann",
3
3
  "name": "melonykit",
4
- "version": "0.15.4",
4
+ "version": "0.15.6",
5
5
  "type": "module",
6
6
  "description": "Preact based ui and utility functions toolkit",
7
7
  "main": "./dist/index.js",