meticulous-ui 3.2.5 → 3.2.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/README.md CHANGED
@@ -142,79 +142,19 @@ import blue from 'meticulous-ui/colors/blue';
142
142
 
143
143
  ## 📦 Utils
144
144
 
145
- ### General
146
-
147
- | Function | Signature | Description |
148
- | ------------- | -------------------------- | ----------------------------------------- |
149
- | `compose` | `(...funcs) (val) any` | Right-to-left function composition |
150
- | `randomInt` | `(min, max) number` | Random integer in `[min, floor(max + 1))` |
151
- | `randomValue` | `(min, max) number` | Random float in `[min, max + 1)` |
152
-
153
- ### Data Utilities
154
-
155
- | Function | Signature | Description |
156
- | ----------------- | -------------------------------- | ------------------------------------------------------------------------ |
157
- | `deepClone` | `(obj) any` | Recursively clones objects, arrays, and Dates with no shared references |
158
- | `mergeDeep` | `(target, source) → object` | Deep-merges source into target; source wins on conflicts |
159
- | `pick` | `(obj, keys) → object` | Returns a new object with only the specified keys |
160
- | `omit` | `(obj, keys) → object` | Returns a new object without the specified keys |
161
- | `isEmpty` | `(value) → boolean` | `true` for `null`, `undefined`, `""`, `[]`, `{}` |
162
- | `isEqual` | `(a, b) → boolean` | Deep structural equality — handles objects, arrays, and Dates |
163
- | `hasEqualProps` | `(oldProps, newProps) → boolean` | Deep equality ignoring function-valued keys; ideal for `React.memo` |
164
- | `isNonEmptyArray` | `(arr) → boolean` | `true` only when the value is an array with at least one element |
165
- | `flattenObject` | `(obj, prefix?) → object` | Collapses nested object to dot-notation keys |
166
- | `groupBy` | `(array, key) → object` | Groups array items into an object of arrays keyed by a field or function |
167
- | `keyBy` | `(array, key) → object` | Converts an array into a lookup object keyed by a field or function |
168
- | `uniqueBy` | `(array, key) → array` | Removes duplicates by a field or function; first occurrence wins |
169
- | `sortBy` | `(array, key) → array` | Ascending sort by a field or function; non-mutating |
170
- | `chunk` | `(array, size) → array[]` | Splits array into consecutive chunks of the given size |
171
-
172
- ### String Utilities
173
-
174
- | Function | Signature | Description |
175
- | ------------------- | ----------------------- | ------------------------------------------------------------------- |
176
- | `capFirstLetter` | `(str) → string` | Takes a string and returns with first letter capitalised |
177
- | `capitalize` | `(str) → string` | Uppercases first character, lowercases the rest |
178
- | `titleCase` | `(str) → string` | Capitalizes the first letter of every word |
179
- | `camelCase` | `(str) → string` | Converts to `camelCase` from spaces, hyphens, or underscores |
180
- | `snakeCase` | `(str) → string` | Converts to `snake_case` from camelCase, spaces, or hyphens |
181
- | `kebabCase` | `(str) → string` | Converts to `kebab-case` from camelCase, spaces, or underscores |
182
- | `truncate` | `(str, limit) → string` | Trims to `limit` characters and appends `…` |
183
- | `slugify` | `(str) → string` | URL-safe slug — strips diacritics, removes special chars |
184
- | `removeExtraSpaces` | `(str) → string` | Trims and collapses internal whitespace runs to a single space |
185
- | `maskEmail` | `(str) → string` | Shows only the first character of the local part, e.g. `j***@x.com` |
186
- | `maskPhone` | `(str) → string` | Masks all digits except the last four; preserves formatting chars |
187
- | `generateInitials` | `(name) → string` | Extracts uppercased first letter of each word, e.g. `"JD"` |
188
-
189
- ### Device Utilities
190
-
191
- | Function | Signature | Description |
192
- | ----------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------ |
193
- | `isMobile` | `() → boolean` | `true` when the UA matches any known mobile platform |
194
- | `isIOS` | `() → boolean` | `true` on iPhone, iPad, and iPod; handles iPadOS 13+ UA quirk |
195
- | `isAndroid` | `() → boolean` | `true` when the UA string contains `Android` |
196
- | `isSafari` | `() → boolean` | `true` for genuine Safari; excludes Chrome/Android which also include "Safari" |
197
- | `isDarkMode` | `() → boolean` | `true` when the OS/browser prefers dark color scheme |
198
- | `isOnline` | `() → boolean` | `true` when the browser reports network connectivity |
199
- | `copyToClipboard` | `(text: string) → Promise<void>` | Copies text using Clipboard API with `execCommand` fallback |
200
- | `downloadFile` | `(url: string, filename?: string) → void` | Triggers a file download; filename inferred from URL if omitted |
201
- | `openInNewTab` | `(url: string) → void` | Opens URL in a new tab with `noopener,noreferrer` |
202
- | `getScreenSize` | `() → { width, height, deviceWidth, deviceHeight, pixelRatio }` | Returns viewport size, physical screen size, and device pixel ratio |
203
-
204
- ### Validation Utilities
205
-
206
- | Function | Signature | Description |
207
- | ------------------ | ---------------------- | ------------------------------------------------------------------------- |
208
- | `isEmail` | `(value) → boolean` | Valid email — must have local part, `@`, and domain with dot |
209
- | `isPhone` | `(value) → boolean` | Plausible phone — optional `+`, 7–15 digits, allows spaces/hyphens/parens |
210
- | `isURL` | `(value) → boolean` | Valid `http` or `https` URL via native `URL` constructor |
211
- | `isPasswordStrong` | `(value) → boolean` | 8+ chars with uppercase, lowercase, digit, and special character |
212
- | `isPAN` | `(value) → boolean` | Indian PAN — `AAAAA0000A` (5 letters, 4 digits, 1 letter) |
213
- | `isAadhaar` | `(value) → boolean` | Indian Aadhaar — 12 digits, first digit non-zero; strips spaces |
214
- | `isGST` | `(value) → boolean` | Indian GSTIN — 2-digit state code + PAN + entity digit + `Z` + check char |
215
- | `isRequired` | `(value) → boolean` | `false` for `null`, `undefined`, blank strings, and empty arrays |
216
- | `minLength` | `(value, n) → boolean` | `true` when `value.length >= n` |
217
- | `maxLength` | `(value, n) → boolean` | `true` when `value.length <= n` |
145
+ | Category | Functions |
146
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
147
+ | **String** | `capFirstLetter` `capitalize` `titleCase` `camelCase` `snakeCase` `kebabCase` `slugify` `truncate` `removeExtraSpaces` `maskEmail` `maskPhone` `generateInitials` |
148
+ | **Number** | `clamp` `formatCurrency` `formatNumber` `formatCompactNumber` `percentage` `randomInt` `randomBetween` `randomValue` `roundTo` |
149
+ | **Date-Time** | `formatDate` `formatTime` `addDays` `differenceInDays` `isToday` `isPast` `timeAgo` `getGreetingByTime` `countdown` |
150
+ | **Data** | `deepClone` `mergeDeep` `pick` `omit` `isEmpty` `isEqual` `hasEqualProps` `isNonEmptyArray` `flattenObject` `groupBy` `keyBy` `uniqueBy` `sortBy` `chunk` `compose` |
151
+ | **Validation** | `isEmail` `isPhone` `isURL` `isPasswordStrong` `isPAN` `isAadhaar` `isGST` `isRequired` `minLength` `maxLength` |
152
+ | **Device** | `isMobile` `isIOS` `isAndroid` `isSafari` `isDarkMode` `isOnline` `copyToClipboard` `downloadFile` `openInNewTab` `getScreenSize` |
153
+ | **Storage** | `setLocalStorage` `getLocalStorage` `removeLocalStorage` `setSessionStorage` `getSessionStorage` `clearStorage` |
154
+ | **Routing** | `getQueryParams` `setQueryParam` `removeQueryParam` `buildURL` `redirectTo` `getCurrentPath` `isActiveRoute` |
155
+ | **UI** | `scrollToTop` `scrollToElement` `lockBodyScroll` `unlockBodyScroll` `toggleFullscreen` `focusElement` `detectOutsideClick` `measureElement` |
156
+ | **Performance** | `debounce` `throttle` `memoize` `lazyLoadComponent` `requestIdleTask` `rafThrottle` |
157
+ | **Async** | `retry` `sleep` `withTimeout` `parallel` `sequential` `safeAsync` `cancelablePromise` |
218
158
 
219
159
  ## 🌱 Features
220
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meticulous-ui",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
4
4
  "license": "ISC",
5
5
  "description": "A comprehensive React UI component library with a wide range of customizable components, icons, colors, and utilities for building modern web applications.",
6
6
  "main": "./index.js",
@@ -0,0 +1,9 @@
1
+ const a = (r, e = {}) => {
2
+ const t = new URL(r, window.location.origin);
3
+ return Object.entries(e).forEach(([n, o]) => {
4
+ t.searchParams.set(n, o);
5
+ }), t.toString();
6
+ };
7
+ export {
8
+ a as default
9
+ };
@@ -0,0 +1,17 @@
1
+ const t = (c) => {
2
+ let e = !1;
3
+ return {
4
+ promise: new Promise((n, a) => {
5
+ c.then(
6
+ (r) => e ? a({ canceled: !0 }) : n(r),
7
+ (r) => a(e ? { canceled: !0 } : r)
8
+ );
9
+ }),
10
+ cancel: () => {
11
+ e = !0;
12
+ }
13
+ };
14
+ };
15
+ export {
16
+ t as default
17
+ };
@@ -0,0 +1,6 @@
1
+ const a = () => {
2
+ localStorage.clear(), sessionStorage.clear();
3
+ };
4
+ export {
5
+ a as default
6
+ };
@@ -0,0 +1,9 @@
1
+ const u = (t, o) => {
2
+ let e;
3
+ return (...r) => {
4
+ clearTimeout(e), e = setTimeout(() => t(...r), o);
5
+ };
6
+ };
7
+ export {
8
+ u as default
9
+ };
@@ -0,0 +1,10 @@
1
+ const s = (t, d) => {
2
+ const e = (n) => {
3
+ const o = (t == null ? void 0 : t.current) ?? t;
4
+ o && !o.contains(n.target) && d(n);
5
+ };
6
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
7
+ };
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,7 @@
1
+ const o = (t) => {
2
+ const c = (t == null ? void 0 : t.current) ?? t;
3
+ c == null || c.focus();
4
+ };
5
+ export {
6
+ o as default
7
+ };
@@ -0,0 +1,4 @@
1
+ const t = () => window.location.pathname;
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,11 @@
1
+ const l = (e) => {
2
+ try {
3
+ const t = localStorage.getItem(e);
4
+ return t !== null ? JSON.parse(t) : null;
5
+ } catch {
6
+ return null;
7
+ }
8
+ };
9
+ export {
10
+ l as default
11
+ };
@@ -0,0 +1,9 @@
1
+ const o = () => {
2
+ const a = {};
3
+ return new URLSearchParams(window.location.search).forEach((r, e) => {
4
+ a[e] = r;
5
+ }), a;
6
+ };
7
+ export {
8
+ o as default
9
+ };
@@ -0,0 +1,11 @@
1
+ const n = (e) => {
2
+ try {
3
+ const t = sessionStorage.getItem(e);
4
+ return t !== null ? JSON.parse(t) : null;
5
+ } catch {
6
+ return null;
7
+ }
8
+ };
9
+ export {
10
+ n as default
11
+ };
package/utils/index.js CHANGED
@@ -1,51 +1,51 @@
1
1
  import o from "./capFirstLetter.js";
2
2
  import r from "./capitalize.js";
3
3
  import m from "./camelCase.js";
4
- import i from "./chunk.js";
5
- import t from "./clamp.js";
6
- import p from "./compose.js";
7
- import f from "./deepClone.js";
8
- import e from "./flattenObject.js";
4
+ import t from "./chunk.js";
5
+ import i from "./clamp.js";
6
+ import e from "./compose.js";
7
+ import p from "./deepClone.js";
8
+ import f from "./flattenObject.js";
9
9
  import a from "./formatCompactNumber.js";
10
10
  import s from "./formatCurrency.js";
11
- import n from "./formatDate.js";
12
- import d from "./formatNumber.js";
13
- import l from "./formatTime.js";
14
- import c from "./generateInitials.js";
15
- import u from "./getGreetingByTime.js";
16
- import y from "./groupBy.js";
17
- import g from "./hasEqualProps.js";
18
- import b from "./addDays.js";
19
- import k from "./countdown.js";
20
- import C from "./differenceInDays.js";
21
- import h from "./isEmpty.js";
22
- import E from "./isEqual.js";
23
- import S from "./isNonEmptyArray.js";
24
- import T from "./isPast.js";
25
- import B from "./isToday.js";
26
- import P from "./kebabCase.js";
27
- import w from "./keyBy.js";
11
+ import l from "./formatDate.js";
12
+ import n from "./formatNumber.js";
13
+ import c from "./formatTime.js";
14
+ import u from "./generateInitials.js";
15
+ import d from "./getGreetingByTime.js";
16
+ import g from "./groupBy.js";
17
+ import y from "./hasEqualProps.js";
18
+ import S from "./addDays.js";
19
+ import T from "./countdown.js";
20
+ import k from "./differenceInDays.js";
21
+ import b from "./isEmpty.js";
22
+ import h from "./isEqual.js";
23
+ import C from "./isNonEmptyArray.js";
24
+ import P from "./isPast.js";
25
+ import E from "./isToday.js";
26
+ import L from "./kebabCase.js";
27
+ import B from "./keyBy.js";
28
28
  import A from "./maskEmail.js";
29
- import D from "./maskPhone.js";
30
- import I from "./mergeDeep.js";
31
- import N from "./omit.js";
32
- import q from "./percentage.js";
33
- import x from "./pick.js";
34
- import L from "./randomBetween.js";
35
- import O from "./randomInt.js";
29
+ import q from "./maskPhone.js";
30
+ import w from "./mergeDeep.js";
31
+ import I from "./omit.js";
32
+ import D from "./percentage.js";
33
+ import N from "./pick.js";
34
+ import v from "./randomBetween.js";
35
+ import x from "./randomInt.js";
36
36
  import z from "./randomValue.js";
37
- import F from "./removeExtraSpaces.js";
38
- import G from "./roundTo.js";
39
- import M from "./slugify.js";
40
- import R from "./snakeCase.js";
41
- import j from "./sortBy.js";
42
- import v from "./timeAgo.js";
37
+ import O from "./removeExtraSpaces.js";
38
+ import R from "./roundTo.js";
39
+ import F from "./slugify.js";
40
+ import Q from "./snakeCase.js";
41
+ import G from "./sortBy.js";
42
+ import M from "./timeAgo.js";
43
43
  import U from "./titleCase.js";
44
- import V from "./truncate.js";
45
- import H from "./uniqueBy.js";
46
- import J from "./isEmail.js";
47
- import K from "./isPhone.js";
48
- import Q from "./isURL.js";
44
+ import j from "./truncate.js";
45
+ import V from "./uniqueBy.js";
46
+ import H from "./isEmail.js";
47
+ import J from "./isPhone.js";
48
+ import K from "./isURL.js";
49
49
  import W from "./isPasswordStrong.js";
50
50
  import X from "./isPAN.js";
51
51
  import Y from "./isAadhaar.js";
@@ -55,68 +55,102 @@ import $ from "./minLength.js";
55
55
  import oo from "./maxLength.js";
56
56
  import ro from "./isMobile.js";
57
57
  import mo from "./isIOS.js";
58
- import io from "./isAndroid.js";
59
- import to from "./isSafari.js";
60
- import po from "./isDarkMode.js";
61
- import fo from "./isOnline.js";
62
- import eo from "./copyToClipboard.js";
58
+ import to from "./isAndroid.js";
59
+ import io from "./isSafari.js";
60
+ import eo from "./isDarkMode.js";
61
+ import po from "./isOnline.js";
62
+ import fo from "./copyToClipboard.js";
63
63
  import ao from "./downloadFile.js";
64
64
  import so from "./openInNewTab.js";
65
- import no from "./getScreenSize.js";
66
- const Tr = {
65
+ import lo from "./getScreenSize.js";
66
+ import no from "./getQueryParams.js";
67
+ import co from "./setQueryParam.js";
68
+ import uo from "./removeQueryParam.js";
69
+ import go from "./buildURL.js";
70
+ import yo from "./redirectTo.js";
71
+ import So from "./getCurrentPath.js";
72
+ import To from "./isActiveRoute.js";
73
+ import ko from "./setLocalStorage.js";
74
+ import bo from "./getLocalStorage.js";
75
+ import ho from "./removeLocalStorage.js";
76
+ import Co from "./setSessionStorage.js";
77
+ import Po from "./getSessionStorage.js";
78
+ import Eo from "./clearStorage.js";
79
+ import Lo from "./debounce.js";
80
+ import Bo from "./throttle.js";
81
+ import Ao from "./memoize.js";
82
+ import qo from "./lazyLoadComponent.js";
83
+ import wo from "./requestIdleTask.js";
84
+ import Io from "./rafThrottle.js";
85
+ import Do from "./scrollToTop.js";
86
+ import No from "./scrollToElement.js";
87
+ import vo from "./lockBodyScroll.js";
88
+ import xo from "./unlockBodyScroll.js";
89
+ import zo from "./toggleFullscreen.js";
90
+ import Oo from "./focusElement.js";
91
+ import Ro from "./detectOutsideClick.js";
92
+ import Fo from "./measureElement.js";
93
+ import Qo from "./retry.js";
94
+ import Go from "./sleep.js";
95
+ import Mo from "./withTimeout.js";
96
+ import Uo from "./parallel.js";
97
+ import jo from "./sequential.js";
98
+ import Vo from "./safeAsync.js";
99
+ import Ho from "./cancelablePromise.js";
100
+ const Rm = {
67
101
  // string
68
102
  capFirstLetter: o,
69
103
  capitalize: r,
70
104
  camelCase: m,
71
- generateInitials: c,
72
- kebabCase: P,
105
+ generateInitials: u,
106
+ kebabCase: L,
73
107
  maskEmail: A,
74
- maskPhone: D,
75
- removeExtraSpaces: F,
76
- slugify: M,
77
- snakeCase: R,
108
+ maskPhone: q,
109
+ removeExtraSpaces: O,
110
+ slugify: F,
111
+ snakeCase: Q,
78
112
  titleCase: U,
79
- truncate: V,
113
+ truncate: j,
80
114
  // number
81
- clamp: t,
115
+ clamp: i,
82
116
  formatCompactNumber: a,
83
117
  formatCurrency: s,
84
- formatNumber: d,
85
- percentage: q,
86
- randomBetween: L,
87
- randomInt: O,
118
+ formatNumber: n,
119
+ percentage: D,
120
+ randomBetween: v,
121
+ randomInt: x,
88
122
  randomValue: z,
89
- roundTo: G,
123
+ roundTo: R,
90
124
  // date-time
91
- addDays: b,
92
- countdown: k,
93
- differenceInDays: C,
94
- formatDate: n,
95
- formatTime: l,
96
- getGreetingByTime: u,
97
- isPast: T,
98
- isToday: B,
99
- timeAgo: v,
125
+ addDays: S,
126
+ countdown: T,
127
+ differenceInDays: k,
128
+ formatDate: l,
129
+ formatTime: c,
130
+ getGreetingByTime: d,
131
+ isPast: P,
132
+ isToday: E,
133
+ timeAgo: M,
100
134
  // object / array
101
- chunk: i,
102
- compose: p,
103
- deepClone: f,
104
- flattenObject: e,
105
- groupBy: y,
106
- hasEqualProps: g,
107
- isEmpty: h,
108
- isEqual: E,
109
- isNonEmptyArray: S,
110
- keyBy: w,
111
- mergeDeep: I,
112
- omit: N,
113
- pick: x,
114
- sortBy: j,
115
- uniqueBy: H,
135
+ chunk: t,
136
+ compose: e,
137
+ deepClone: p,
138
+ flattenObject: f,
139
+ groupBy: g,
140
+ hasEqualProps: y,
141
+ isEmpty: b,
142
+ isEqual: h,
143
+ isNonEmptyArray: C,
144
+ keyBy: B,
145
+ mergeDeep: w,
146
+ omit: I,
147
+ pick: N,
148
+ sortBy: G,
149
+ uniqueBy: V,
116
150
  // validation
117
- isEmail: J,
118
- isPhone: K,
119
- isURL: Q,
151
+ isEmail: H,
152
+ isPhone: J,
153
+ isURL: K,
120
154
  isPasswordStrong: W,
121
155
  isPAN: X,
122
156
  isAadhaar: Y,
@@ -127,15 +161,54 @@ const Tr = {
127
161
  // device
128
162
  isMobile: ro,
129
163
  isIOS: mo,
130
- isAndroid: io,
131
- isSafari: to,
132
- isDarkMode: po,
133
- isOnline: fo,
134
- copyToClipboard: eo,
164
+ isAndroid: to,
165
+ isSafari: io,
166
+ isDarkMode: eo,
167
+ isOnline: po,
168
+ copyToClipboard: fo,
135
169
  downloadFile: ao,
136
170
  openInNewTab: so,
137
- getScreenSize: no
171
+ getScreenSize: lo,
172
+ // routing
173
+ getQueryParams: no,
174
+ setQueryParam: co,
175
+ removeQueryParam: uo,
176
+ buildURL: go,
177
+ redirectTo: yo,
178
+ getCurrentPath: So,
179
+ isActiveRoute: To,
180
+ // storage
181
+ setLocalStorage: ko,
182
+ getLocalStorage: bo,
183
+ removeLocalStorage: ho,
184
+ setSessionStorage: Co,
185
+ getSessionStorage: Po,
186
+ clearStorage: Eo,
187
+ // performance
188
+ debounce: Lo,
189
+ throttle: Bo,
190
+ memoize: Ao,
191
+ lazyLoadComponent: qo,
192
+ requestIdleTask: wo,
193
+ rafThrottle: Io,
194
+ // ui / dom
195
+ scrollToTop: Do,
196
+ scrollToElement: No,
197
+ lockBodyScroll: vo,
198
+ unlockBodyScroll: xo,
199
+ toggleFullscreen: zo,
200
+ focusElement: Oo,
201
+ detectOutsideClick: Ro,
202
+ measureElement: Fo,
203
+ // async / api
204
+ retry: Qo,
205
+ sleep: Go,
206
+ withTimeout: Mo,
207
+ parallel: Uo,
208
+ sequential: jo,
209
+ safeAsync: Vo,
210
+ cancelablePromise: Ho
138
211
  };
139
212
  export {
140
- Tr as default
213
+ Rm as default
141
214
  };
@@ -0,0 +1,4 @@
1
+ const o = (t) => window.location.pathname === t;
2
+ export {
3
+ o as default
4
+ };
@@ -0,0 +1,5 @@
1
+ import { lazy as a } from "react";
2
+ const e = (o) => a(o);
3
+ export {
4
+ e as default
5
+ };
@@ -0,0 +1,6 @@
1
+ const o = () => {
2
+ document.body.style.overflow = "hidden";
3
+ };
4
+ export {
5
+ o as default
6
+ };
@@ -0,0 +1,7 @@
1
+ const e = (t) => {
2
+ const n = (t == null ? void 0 : t.current) ?? t;
3
+ return n ? n.getBoundingClientRect() : null;
4
+ };
5
+ export {
6
+ e as default
7
+ };
@@ -0,0 +1,12 @@
1
+ const c = (s) => {
2
+ const e = /* @__PURE__ */ new Map();
3
+ return (...n) => {
4
+ const t = JSON.stringify(n);
5
+ if (e.has(t)) return e.get(t);
6
+ const r = s(...n);
7
+ return e.set(t, r), r;
8
+ };
9
+ };
10
+ export {
11
+ c as default
12
+ };
@@ -0,0 +1,4 @@
1
+ const a = (l) => Promise.all(l);
2
+ export {
3
+ a as default
4
+ };
@@ -0,0 +1,11 @@
1
+ const l = (t) => {
2
+ let r = null;
3
+ return (...e) => {
4
+ r === null && (r = requestAnimationFrame(() => {
5
+ t(...e), r = null;
6
+ }));
7
+ };
8
+ };
9
+ export {
10
+ l as default
11
+ };
@@ -0,0 +1,6 @@
1
+ const e = (o) => {
2
+ window.location.href = o;
3
+ };
4
+ export {
5
+ e as default
6
+ };
@@ -0,0 +1,6 @@
1
+ const o = (e) => {
2
+ localStorage.removeItem(e);
3
+ };
4
+ export {
5
+ o as default
6
+ };
@@ -0,0 +1,7 @@
1
+ const o = (a) => {
2
+ const e = new URL(window.location.href);
3
+ e.searchParams.delete(a), window.history.pushState({}, "", e);
4
+ };
5
+ export {
6
+ o as default
7
+ };
@@ -0,0 +1,6 @@
1
+ const l = (e) => {
2
+ typeof requestIdleCallback < "u" ? requestIdleCallback(e) : setTimeout(e, 1);
3
+ };
4
+ export {
5
+ l as default
6
+ };
package/utils/retry.js ADDED
@@ -0,0 +1,13 @@
1
+ const c = async (a, e = 3) => {
2
+ let r;
3
+ for (let t = 0; t < e; t++)
4
+ try {
5
+ return await a();
6
+ } catch (o) {
7
+ r = o;
8
+ }
9
+ throw r;
10
+ };
11
+ export {
12
+ c as default
13
+ };
@@ -0,0 +1,10 @@
1
+ const n = (r) => async (...e) => {
2
+ try {
3
+ return [null, await r(...e)];
4
+ } catch (t) {
5
+ return [t, null];
6
+ }
7
+ };
8
+ export {
9
+ n as default
10
+ };
@@ -0,0 +1,7 @@
1
+ const l = (o, e = "smooth") => {
2
+ const t = document.getElementById(o);
3
+ t && t.scrollIntoView({ behavior: e, block: "start" });
4
+ };
5
+ export {
6
+ l as default
7
+ };
@@ -0,0 +1,6 @@
1
+ const l = (o = "smooth") => {
2
+ window.scrollTo({ top: 0, behavior: o });
3
+ };
4
+ export {
5
+ l as default
6
+ };
@@ -0,0 +1,9 @@
1
+ const e = async (t) => {
2
+ const s = [];
3
+ for (const a of t)
4
+ s.push(await a());
5
+ return s;
6
+ };
7
+ export {
8
+ e as default
9
+ };
@@ -0,0 +1,9 @@
1
+ const e = (t, a) => {
2
+ try {
3
+ localStorage.setItem(t, JSON.stringify(a));
4
+ } catch {
5
+ }
6
+ };
7
+ export {
8
+ e as default
9
+ };
@@ -0,0 +1,7 @@
1
+ const s = (a, e) => {
2
+ const t = new URL(window.location.href);
3
+ t.searchParams.set(a, e), window.history.pushState({}, "", t);
4
+ };
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,9 @@
1
+ const e = (t, s) => {
2
+ try {
3
+ sessionStorage.setItem(t, JSON.stringify(s));
4
+ } catch {
5
+ }
6
+ };
7
+ export {
8
+ e as default
9
+ };
package/utils/sleep.js ADDED
@@ -0,0 +1,4 @@
1
+ const t = (e) => new Promise((s) => setTimeout(s, e));
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,10 @@
1
+ const n = (l, o) => {
2
+ let t = 0;
3
+ return (...a) => {
4
+ const e = Date.now();
5
+ e - t >= o && (t = e, l(...a));
6
+ };
7
+ };
8
+ export {
9
+ n as default
10
+ };
@@ -0,0 +1,7 @@
1
+ const l = (e = document.documentElement) => {
2
+ var u, c;
3
+ document.fullscreenElement ? (c = document.exitFullscreen) == null || c.call(document) : (u = e.requestFullscreen) == null || u.call(e);
4
+ };
5
+ export {
6
+ l as default
7
+ };
@@ -0,0 +1,6 @@
1
+ const o = () => {
2
+ document.body.style.overflow = "";
3
+ };
4
+ export {
5
+ o as default
6
+ };
@@ -0,0 +1,9 @@
1
+ const m = (t, e) => {
2
+ const o = new Promise(
3
+ (i, r) => setTimeout(() => r(new Error(`Timed out after ${e}ms`)), e)
4
+ );
5
+ return Promise.race([t, o]);
6
+ };
7
+ export {
8
+ m as default
9
+ };