melonykit 1.1.2 → 1.1.4

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 { m as e } from "./functions-CSuMpnOY.js";
1
+ import { h as e } from "./functions-CZylI2gQ.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-BQLPMs0_.js";
1
+ export { n as getClientSetting, i as routeTo, t as setClientSetting, r as useQuery } from "./browser-Cr0Wr7Lc.js";
@@ -201,8 +201,13 @@ function v(e) {
201
201
  return e == null ? 0 : Array.isArray(e) || typeof e == "string" ? e.length : typeof e == "object" || typeof e == "function" ? Object.keys(e).length : 0;
202
202
  }
203
203
  //#endregion
204
+ //#region src/functions/_slugify.js
205
+ function y(e) {
206
+ 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
+ }
208
+ //#endregion
204
209
  //#region src/functions/_to-number.js
205
- function y(e, t = null) {
210
+ function b(e, t = null) {
206
211
  let n = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
207
212
  if (!Number.isFinite(n)) return null;
208
213
  if (t == null) return n;
@@ -211,32 +216,32 @@ function y(e, t = null) {
211
216
  }
212
217
  //#endregion
213
218
  //#region src/functions/checks/_is-array.js
214
- function b(e) {
219
+ function x(e) {
215
220
  return Array.isArray(e);
216
221
  }
217
222
  //#endregion
218
223
  //#region src/functions/checks/_is-empty-array.js
219
- function x(e) {
220
- return b(e) && e.length === 0;
224
+ function S(e) {
225
+ return x(e) && e.length === 0;
221
226
  }
222
227
  //#endregion
223
228
  //#region src/functions/checks/_is-function.js
224
- function S(e) {
229
+ function C(e) {
225
230
  return typeof e == "function";
226
231
  }
227
232
  //#endregion
228
233
  //#region src/functions/checks/_is-number.js
229
- function C(e) {
234
+ function w(e) {
230
235
  return typeof e == "number" && Number.isFinite(e);
231
236
  }
232
237
  //#endregion
233
238
  //#region src/functions/checks/_is-positive-number.js
234
- function w(e) {
235
- return C(e) && e > 0;
239
+ function T(e) {
240
+ return w(e) && e > 0;
236
241
  }
237
242
  //#endregion
238
243
  //#region src/functions/_create-cache.js
239
- function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
244
+ function E({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
240
245
  let i = /* @__PURE__ */ new Map();
241
246
  async function a(t, n) {
242
247
  if (i.has(t)) return !1;
@@ -245,12 +250,12 @@ function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
245
250
  ...n,
246
251
  createdAt: r,
247
252
  lastUpdate: r
248
- }), S(e) && await e(t), !0;
253
+ }), C(e) && await e(t), !0;
249
254
  }
250
255
  async function o(e, n) {
251
256
  if (!i.has(e) || typeof n != "function") return !1;
252
257
  let r = i.get(e);
253
- return await n(r), r.lastUpdate = Date.now(), S(t) && await t(e), !0;
258
+ return await n(r), r.lastUpdate = Date.now(), C(t) && await t(e), !0;
254
259
  }
255
260
  function s(e) {
256
261
  return i.get(e) ?? null;
@@ -267,10 +272,10 @@ function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
267
272
  async function d(e) {
268
273
  if (!i.has(e)) return !1;
269
274
  let t = i.get(e);
270
- return i.delete(e), S(n) && await n(e, t), !0;
275
+ return i.delete(e), C(n) && await n(e, t), !0;
271
276
  }
272
277
  function f({ interval: e, checks: t, now: n = Date.now, setIntervalFn: r = setInterval } = {}) {
273
- w(e) && b(t) && !x(t) && t.every((e) => S(e)) && S(n) && S(r) && r(async () => {
278
+ T(e) && x(t) && !S(t) && t.every((e) => C(e)) && C(n) && C(r) && r(async () => {
274
279
  let e = n();
275
280
  for (let [n, r] of i) t.some((t) => t(r, e)) && await d(n);
276
281
  }, e)?.unref?.();
@@ -287,28 +292,28 @@ function T({ onCreate: e, onUpdate: t, onDelete: n, autoCleanup: r } = {}) {
287
292
  }
288
293
  //#endregion
289
294
  //#region src/functions/checks/_is-nil.js
290
- function E(e) {
295
+ function D(e) {
291
296
  return e == null;
292
297
  }
293
298
  //#endregion
294
299
  //#region src/functions/checks/_is-object.js
295
- function D(e) {
296
- return !E(e) && typeof e == "object" && !b(e);
300
+ function O(e) {
301
+ return !D(e) && typeof e == "object" && !x(e);
297
302
  }
298
303
  //#endregion
299
304
  //#region src/functions/checks/_is-empty-object.js
300
- function O(e) {
301
- return D(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
305
+ function k(e) {
306
+ return O(e) && Reflect.ownKeys(e).every((t) => !Object.prototype.propertyIsEnumerable.call(e, t));
302
307
  }
303
308
  //#endregion
304
309
  //#region src/functions/checks/_is-empty-string.js
305
- function k(e) {
310
+ function A(e) {
306
311
  return n(e) && e.trim().length === 0;
307
312
  }
308
313
  //#endregion
309
314
  //#region src/functions/checks/_is-negative-number.js
310
- function A(e) {
311
- return C(e) && e < 0;
315
+ function j(e) {
316
+ return w(e) && e < 0;
312
317
  }
313
318
  //#endregion
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 };
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 +1 @@
1
- export { v as camelCaseToTitleCase, b as convertHexToRgba, o as createCache, _ as darkenHexColor, g 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, y as isString, h as kebabCaseToTitleCase, m as request, p as size, f as toNumber } from "./functions-CSuMpnOY.js";
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";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { n as e, t } from "./browser-BQLPMs0_.js";
2
- import { _ as n, n as r } from "./functions-CSuMpnOY.js";
1
+ import { n as e, t } from "./browser-Cr0Wr7Lc.js";
2
+ import { n, v as r } from "./functions-CZylI2gQ.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";
@@ -1011,7 +1011,7 @@ var Dt = bt`
1011
1011
  `,
1012
1012
  secondary: O`
1013
1013
  color: ${k.colors.fore.primary};
1014
- border-color: ${n(k.colors.secondary, .2)};
1014
+ border-color: ${r(k.colors.secondary, .2)};
1015
1015
  background-color: ${k.colors.secondary};
1016
1016
  `,
1017
1017
  neutral: O`
@@ -1032,11 +1032,11 @@ var Dt = bt`
1032
1032
  };
1033
1033
  //#endregion
1034
1034
  //#region src/components/_popup-box.jsx
1035
- function kt({ className: e, trigger: t, children: n, isOpen: r = !1, origin: i = "center", width: a }) {
1035
+ function kt({ className: e, trigger: t, children: n, isOpen: r = !1, origin: i = "bottom", width: a }) {
1036
1036
  return /* @__PURE__ */ l(c, { children: /* @__PURE__ */ u("div", {
1037
1037
  className: At.base,
1038
1038
  children: [t, r && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l("div", {
1039
- className: D(At.popup, At[i] ?? At.center, e),
1039
+ className: D(At.popup, At[i.replace(/-([a-z])/g, (e, t) => t.toUpperCase())] ?? At.center, e),
1040
1040
  style: { width: a },
1041
1041
  children: n
1042
1042
  }) })]
@@ -1050,7 +1050,6 @@ var At = {
1050
1050
  popup: O`
1051
1051
  position: absolute;
1052
1052
  z-index: ${k.zIndex.front + 1};
1053
- top: calc(100% + .5rem);
1054
1053
  min-width: 100%;
1055
1054
  width: max-content;
1056
1055
  max-width: calc(100vw - 2rem);
@@ -1063,22 +1062,45 @@ var At = {
1063
1062
  font-family: ${k.fontFamily}, sans-serif;
1064
1063
  `,
1065
1064
  center: O`
1065
+ top: calc(100% + .5rem);
1066
1066
  left: 50%;
1067
1067
  transform: translateX(-50%);
1068
1068
  `,
1069
1069
  left: O`
1070
- left: 0;
1070
+ top: 50%;
1071
+ right: calc(100% + .5rem);
1072
+ transform: translateY(-50%);
1071
1073
  `,
1072
1074
  right: O`
1075
+ top: 50%;
1076
+ left: calc(100% + .5rem);
1077
+ transform: translateY(-50%);
1078
+ `,
1079
+ topLeft: O`
1080
+ bottom: calc(100% + .5rem);
1081
+ left: 0;
1082
+ `,
1083
+ top: O`
1084
+ bottom: calc(100% + .5rem);
1085
+ left: 50%;
1086
+ transform: translateX(-50%);
1087
+ `,
1088
+ topRight: O`
1073
1089
  right: 0;
1090
+ bottom: calc(100% + .5rem);
1074
1091
  `,
1075
- leftSide: O`
1076
- top: 0;
1077
- right: calc(100% + 1rem);
1092
+ bottomLeft: O`
1093
+ top: calc(100% + .5rem);
1094
+ left: 0;
1078
1095
  `,
1079
- rightSide: O`
1080
- top: 0;
1081
- left: calc(100% + 1rem);
1096
+ bottom: O`
1097
+ top: calc(100% + .5rem);
1098
+ left: 50%;
1099
+ transform: translateX(-50%);
1100
+ `,
1101
+ bottomRight: O`
1102
+ top: calc(100% + .5rem);
1103
+ right: 0;
1082
1104
  `
1083
1105
  };
1084
1106
  //#endregion
@@ -1117,7 +1139,7 @@ function Mt({ item: e }) {
1117
1139
  onClick: d
1118
1140
  }),
1119
1141
  isOpen: n.value,
1120
- origin: "right",
1142
+ origin: "bottom-right",
1121
1143
  children: r.map((e, t) => /* @__PURE__ */ u("button", {
1122
1144
  type: "button",
1123
1145
  className: Nt.option,
@@ -1276,7 +1298,6 @@ var Lt = {
1276
1298
  logo: O`
1277
1299
  display: block;
1278
1300
  pointer-events: auto;
1279
- display: block;
1280
1301
  max-width: 8rem;
1281
1302
  max-height: 3rem;
1282
1303
  `,
@@ -1465,15 +1486,15 @@ var Ht = {
1465
1486
  transition: width .3s ease;
1466
1487
  `,
1467
1488
  normal: O`
1468
- border: solid 1px ${n(k.colors.primary, .3)};
1489
+ border: solid 1px ${r(k.colors.primary, .3)};
1469
1490
  background-color: ${k.colors.primary};
1470
1491
  `,
1471
1492
  warn: O`
1472
- border: solid 1px ${n(k.colors.secondary, .2)};
1493
+ border: solid 1px ${r(k.colors.secondary, .2)};
1473
1494
  background-color: ${k.colors.secondary};
1474
1495
  `,
1475
1496
  danger: O`
1476
- border: solid 1px ${n(k.colors.danger, .3)};
1497
+ border: solid 1px ${r(k.colors.danger, .3)};
1477
1498
  background-color: ${k.colors.danger};
1478
1499
  `
1479
1500
  };
@@ -1703,7 +1724,7 @@ function en({ items: e = [], value: t, width: n, isDisabled: r = !1, onChange: o
1703
1724
  className: tn.popup,
1704
1725
  trigger: b,
1705
1726
  isOpen: m.value,
1706
- origin: "left",
1727
+ origin: "bottom-left",
1707
1728
  children: e.map((e) => /* @__PURE__ */ l("button", {
1708
1729
  type: "button",
1709
1730
  className: tn.option,
@@ -1880,7 +1901,7 @@ var rn = {
1880
1901
  height: 1rem;
1881
1902
  margin-top: -.375rem;
1882
1903
  border-radius: 50%;
1883
- border: solid 1px ${n(k.colors.primary, .3)};
1904
+ border: solid 1px ${r(k.colors.primary, .3)};
1884
1905
  background-color: ${k.colors.primary};
1885
1906
  transition: transform .15s ease;
1886
1907
  }
@@ -2092,7 +2113,7 @@ var cn = bt`
2092
2113
  --checked-background-color: ${k.colors.primary};
2093
2114
  `,
2094
2115
  secondary: O`
2095
- --checked-border-color: ${n(k.colors.secondary, .2)};
2116
+ --checked-border-color: ${r(k.colors.secondary, .2)};
2096
2117
  --checked-background-color: ${k.colors.secondary};
2097
2118
  `,
2098
2119
  input: O`
@@ -2200,7 +2221,7 @@ var hn = {
2200
2221
  background-color: ${k.colors.back.secondary};
2201
2222
 
2202
2223
  &:before {
2203
- border-color: ${n(k.colors.primary, .3)};
2224
+ border-color: ${r(k.colors.primary, .3)};
2204
2225
  background-color: ${k.colors.primary};
2205
2226
  transform: translate(${pn}px, -50%);
2206
2227
  }
@@ -2239,16 +2260,16 @@ var hn = {
2239
2260
  };
2240
2261
  //#endregion
2241
2262
  //#region src/components/_tag.jsx
2242
- function gn({ className: e, variant: t = "normal", iconName: n = "", label: i }) {
2263
+ function gn({ className: e, variant: t = "normal", iconName: r = "", label: i }) {
2243
2264
  return /* @__PURE__ */ l(c, { children: /* @__PURE__ */ u("div", {
2244
2265
  className: D(_n.base, _n[t] ?? _n.normal, e),
2245
- "has-icon": !r(n),
2246
- children: [n && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l(wt, {
2266
+ "has-icon": !n(r),
2267
+ children: [r && /* @__PURE__ */ l(c, { children: /* @__PURE__ */ l(wt, {
2247
2268
  className: O`
2248
2269
  ${k.extends.verticalCenter}
2249
2270
  left: .4rem;
2250
2271
  `,
2251
- iconName: n,
2272
+ iconName: r,
2252
2273
  size: ".9rem"
2253
2274
  }) }), i]
2254
2275
  }) });
@@ -2661,7 +2682,7 @@ function On({ id: e, settings: n, headerContent: r, title: o, description: d, co
2661
2682
  }
2662
2683
  }),
2663
2684
  isOpen: S.value,
2664
- origin: "right",
2685
+ origin: "bottom-right",
2665
2686
  children: f.map((e) => /* @__PURE__ */ l(sn, {
2666
2687
  label: e.label ?? e.key,
2667
2688
  isChecked: C.value[e.key] !== !1,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Vadim Hermann",
3
3
  "name": "melonykit",
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "type": "module",
6
6
  "description": "Preact based ui and utility functions toolkit",
7
7
  "main": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@pivanov/vite-plugin-svg-sprite": "3.1.8",
43
- "@playwright/test": "1.64.0",
43
+ "@playwright/test": "1.64.1",
44
44
  "@preact/preset-vite": "2.10.6",
45
45
  "@preact/signals": "2.11.2",
46
46
  "@types/node": "26.6.5",