@relia-fe/core 0.0.1
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/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +94 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +60 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +10 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +92 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +60 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +62 -0
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
cloneDeep: () => import_lodash_es.cloneDeep,
|
|
24
|
+
copyToClipboard: () => copyToClipboard,
|
|
25
|
+
debounce: () => import_radash.debounce,
|
|
26
|
+
formatCurrency: () => formatCurrency,
|
|
27
|
+
formatDate: () => formatDate,
|
|
28
|
+
generateId: () => generateId,
|
|
29
|
+
get: () => import_lodash_es.get,
|
|
30
|
+
groupBy: () => import_lodash_es.groupBy,
|
|
31
|
+
isEmpty: () => import_lodash_es.isEmpty,
|
|
32
|
+
isEqual: () => import_lodash_es.isEqual,
|
|
33
|
+
merge: () => import_lodash_es.merge,
|
|
34
|
+
omit: () => import_radash.omit,
|
|
35
|
+
orderBy: () => import_lodash_es.orderBy,
|
|
36
|
+
pick: () => import_radash.pick,
|
|
37
|
+
set: () => import_lodash_es.set,
|
|
38
|
+
sleep: () => sleep,
|
|
39
|
+
sortBy: () => import_lodash_es.sortBy,
|
|
40
|
+
throttle: () => import_radash.throttle,
|
|
41
|
+
uniq: () => import_lodash_es.uniq,
|
|
42
|
+
uniqBy: () => import_lodash_es.uniqBy
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(src_exports);
|
|
45
|
+
|
|
46
|
+
// src/utils/index.ts
|
|
47
|
+
var import_radash = require("radash");
|
|
48
|
+
var import_lodash_es = require("lodash-es");
|
|
49
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
50
|
+
var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
|
|
51
|
+
return new Intl.NumberFormat(locale, {
|
|
52
|
+
style: "currency",
|
|
53
|
+
currency
|
|
54
|
+
}).format(amount);
|
|
55
|
+
};
|
|
56
|
+
var formatDate = (date, options, locale = "en-US") => {
|
|
57
|
+
return new Intl.DateTimeFormat(locale, options).format(new Date(date));
|
|
58
|
+
};
|
|
59
|
+
var generateId = () => {
|
|
60
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
61
|
+
};
|
|
62
|
+
var copyToClipboard = async (text) => {
|
|
63
|
+
try {
|
|
64
|
+
await navigator.clipboard.writeText(text);
|
|
65
|
+
return true;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error("Failed to copy to clipboard:", error);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
cloneDeep,
|
|
74
|
+
copyToClipboard,
|
|
75
|
+
debounce,
|
|
76
|
+
formatCurrency,
|
|
77
|
+
formatDate,
|
|
78
|
+
generateId,
|
|
79
|
+
get,
|
|
80
|
+
groupBy,
|
|
81
|
+
isEmpty,
|
|
82
|
+
isEqual,
|
|
83
|
+
merge,
|
|
84
|
+
omit,
|
|
85
|
+
orderBy,
|
|
86
|
+
pick,
|
|
87
|
+
set,
|
|
88
|
+
sleep,
|
|
89
|
+
sortBy,
|
|
90
|
+
throttle,
|
|
91
|
+
uniq,
|
|
92
|
+
uniqBy
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/index.ts"],"sourcesContent":["// Providers\n// export * from \"./providers\";\n\n// Hooks\n// export * from \"./hooks\";\n\n// Components\n// export * from \"./components\";\n\n// Utils\nexport * from \"./utils\";\n\n// Theme\n// export * from \"./theme\";","// Re-export commonly used utilities\nexport { omit, pick, debounce, throttle } from \"radash\";\nexport { \n isEmpty, \n isEqual, \n cloneDeep, \n merge, \n get, \n set, \n uniq, \n uniqBy,\n groupBy,\n orderBy,\n sortBy\n} from \"lodash-es\";\n\n// Custom utility functions\nexport const sleep = (ms: number): Promise<void> => \n new Promise(resolve => setTimeout(resolve, ms));\n\nexport const formatCurrency = (\n amount: number, \n currency = 'USD', \n locale = 'en-US'\n): string => {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n};\n\nexport const formatDate = (\n date: Date | string | number, \n options?: Intl.DateTimeFormatOptions,\n locale = 'en-US'\n): string => {\n return new Intl.DateTimeFormat(locale, options).format(new Date(date));\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n};\n\nexport const copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch (error) {\n console.error('Failed to copy to clipboard:', error);\n return false;\n }\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oBAA+C;AAC/C,uBAYO;AAGA,IAAM,QAAQ,CAAC,OACpB,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAEzC,IAAM,iBAAiB,CAC5B,QACA,WAAW,OACX,SAAS,YACE;AACX,SAAO,IAAI,KAAK,aAAa,QAAQ;AAAA,IACnC,OAAO;AAAA,IACP;AAAA,EACF,CAAC,EAAE,OAAO,MAAM;AAClB;AAEO,IAAM,aAAa,CACxB,MACA,SACA,SAAS,YACE;AACX,SAAO,IAAI,KAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,IAAI,KAAK,IAAI,CAAC;AACvE;AAEO,IAAM,aAAa,MAAc;AACtC,SAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE;AACzE;AAEO,IAAM,kBAAkB,OAAO,SAAmC;AACvE,MAAI;AACF,UAAM,UAAU,UAAU,UAAU,IAAI;AACxC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,gCAAgC,KAAK;AACnD,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/utils/index.ts
|
|
2
|
+
import { omit, pick, debounce, throttle } from "radash";
|
|
3
|
+
import {
|
|
4
|
+
isEmpty,
|
|
5
|
+
isEqual,
|
|
6
|
+
cloneDeep,
|
|
7
|
+
merge,
|
|
8
|
+
get,
|
|
9
|
+
set,
|
|
10
|
+
uniq,
|
|
11
|
+
uniqBy,
|
|
12
|
+
groupBy,
|
|
13
|
+
orderBy,
|
|
14
|
+
sortBy
|
|
15
|
+
} from "lodash-es";
|
|
16
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
17
|
+
var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
|
|
18
|
+
return new Intl.NumberFormat(locale, {
|
|
19
|
+
style: "currency",
|
|
20
|
+
currency
|
|
21
|
+
}).format(amount);
|
|
22
|
+
};
|
|
23
|
+
var formatDate = (date, options, locale = "en-US") => {
|
|
24
|
+
return new Intl.DateTimeFormat(locale, options).format(new Date(date));
|
|
25
|
+
};
|
|
26
|
+
var generateId = () => {
|
|
27
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
28
|
+
};
|
|
29
|
+
var copyToClipboard = async (text) => {
|
|
30
|
+
try {
|
|
31
|
+
await navigator.clipboard.writeText(text);
|
|
32
|
+
return true;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Failed to copy to clipboard:", error);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
cloneDeep,
|
|
40
|
+
copyToClipboard,
|
|
41
|
+
debounce,
|
|
42
|
+
formatCurrency,
|
|
43
|
+
formatDate,
|
|
44
|
+
generateId,
|
|
45
|
+
get,
|
|
46
|
+
groupBy,
|
|
47
|
+
isEmpty,
|
|
48
|
+
isEqual,
|
|
49
|
+
merge,
|
|
50
|
+
omit,
|
|
51
|
+
orderBy,
|
|
52
|
+
pick,
|
|
53
|
+
set,
|
|
54
|
+
sleep,
|
|
55
|
+
sortBy,
|
|
56
|
+
throttle,
|
|
57
|
+
uniq,
|
|
58
|
+
uniqBy
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["// Re-export commonly used utilities\nexport { omit, pick, debounce, throttle } from \"radash\";\nexport { \n isEmpty, \n isEqual, \n cloneDeep, \n merge, \n get, \n set, \n uniq, \n uniqBy,\n groupBy,\n orderBy,\n sortBy\n} from \"lodash-es\";\n\n// Custom utility functions\nexport const sleep = (ms: number): Promise<void> => \n new Promise(resolve => setTimeout(resolve, ms));\n\nexport const formatCurrency = (\n amount: number, \n currency = 'USD', \n locale = 'en-US'\n): string => {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n};\n\nexport const formatDate = (\n date: Date | string | number, \n options?: Intl.DateTimeFormatOptions,\n locale = 'en-US'\n): string => {\n return new Intl.DateTimeFormat(locale, options).format(new Date(date));\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n};\n\nexport const copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch (error) {\n console.error('Failed to copy to clipboard:', error);\n return false;\n }\n};"],"mappings":";AACA,SAAS,MAAM,MAAM,UAAU,gBAAgB;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,IAAM,QAAQ,CAAC,OACpB,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAEzC,IAAM,iBAAiB,CAC5B,QACA,WAAW,OACX,SAAS,YACE;AACX,SAAO,IAAI,KAAK,aAAa,QAAQ;AAAA,IACnC,OAAO;AAAA,IACP;AAAA,EACF,CAAC,EAAE,OAAO,MAAM;AAClB;AAEO,IAAM,aAAa,CACxB,MACA,SACA,SAAS,YACE;AACX,SAAO,IAAI,KAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,IAAI,KAAK,IAAI,CAAC;AACvE;AAEO,IAAM,aAAa,MAAc;AACtC,SAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE;AACzE;AAEO,IAAM,kBAAkB,OAAO,SAAmC;AACvE,MAAI;AACF,UAAM,UAAU,UAAU,UAAU,IAAI;AACxC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,gCAAgC,KAAK;AACnD,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { debounce, omit, pick, throttle } from 'radash';
|
|
2
|
+
export { cloneDeep, get, groupBy, isEmpty, isEqual, merge, orderBy, set, sortBy, uniq, uniqBy } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
declare const sleep: (ms: number) => Promise<void>;
|
|
5
|
+
declare const formatCurrency: (amount: number, currency?: string, locale?: string) => string;
|
|
6
|
+
declare const formatDate: (date: Date | string | number, options?: Intl.DateTimeFormatOptions, locale?: string) => string;
|
|
7
|
+
declare const generateId: () => string;
|
|
8
|
+
declare const copyToClipboard: (text: string) => Promise<boolean>;
|
|
9
|
+
|
|
10
|
+
export { copyToClipboard, formatCurrency, formatDate, generateId, sleep };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { debounce, omit, pick, throttle } from 'radash';
|
|
2
|
+
export { cloneDeep, get, groupBy, isEmpty, isEqual, merge, orderBy, set, sortBy, uniq, uniqBy } from 'lodash-es';
|
|
3
|
+
|
|
4
|
+
declare const sleep: (ms: number) => Promise<void>;
|
|
5
|
+
declare const formatCurrency: (amount: number, currency?: string, locale?: string) => string;
|
|
6
|
+
declare const formatDate: (date: Date | string | number, options?: Intl.DateTimeFormatOptions, locale?: string) => string;
|
|
7
|
+
declare const generateId: () => string;
|
|
8
|
+
declare const copyToClipboard: (text: string) => Promise<boolean>;
|
|
9
|
+
|
|
10
|
+
export { copyToClipboard, formatCurrency, formatDate, generateId, sleep };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/index.ts
|
|
21
|
+
var utils_exports = {};
|
|
22
|
+
__export(utils_exports, {
|
|
23
|
+
cloneDeep: () => import_lodash_es.cloneDeep,
|
|
24
|
+
copyToClipboard: () => copyToClipboard,
|
|
25
|
+
debounce: () => import_radash.debounce,
|
|
26
|
+
formatCurrency: () => formatCurrency,
|
|
27
|
+
formatDate: () => formatDate,
|
|
28
|
+
generateId: () => generateId,
|
|
29
|
+
get: () => import_lodash_es.get,
|
|
30
|
+
groupBy: () => import_lodash_es.groupBy,
|
|
31
|
+
isEmpty: () => import_lodash_es.isEmpty,
|
|
32
|
+
isEqual: () => import_lodash_es.isEqual,
|
|
33
|
+
merge: () => import_lodash_es.merge,
|
|
34
|
+
omit: () => import_radash.omit,
|
|
35
|
+
orderBy: () => import_lodash_es.orderBy,
|
|
36
|
+
pick: () => import_radash.pick,
|
|
37
|
+
set: () => import_lodash_es.set,
|
|
38
|
+
sleep: () => sleep,
|
|
39
|
+
sortBy: () => import_lodash_es.sortBy,
|
|
40
|
+
throttle: () => import_radash.throttle,
|
|
41
|
+
uniq: () => import_lodash_es.uniq,
|
|
42
|
+
uniqBy: () => import_lodash_es.uniqBy
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(utils_exports);
|
|
45
|
+
var import_radash = require("radash");
|
|
46
|
+
var import_lodash_es = require("lodash-es");
|
|
47
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
48
|
+
var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
|
|
49
|
+
return new Intl.NumberFormat(locale, {
|
|
50
|
+
style: "currency",
|
|
51
|
+
currency
|
|
52
|
+
}).format(amount);
|
|
53
|
+
};
|
|
54
|
+
var formatDate = (date, options, locale = "en-US") => {
|
|
55
|
+
return new Intl.DateTimeFormat(locale, options).format(new Date(date));
|
|
56
|
+
};
|
|
57
|
+
var generateId = () => {
|
|
58
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
59
|
+
};
|
|
60
|
+
var copyToClipboard = async (text) => {
|
|
61
|
+
try {
|
|
62
|
+
await navigator.clipboard.writeText(text);
|
|
63
|
+
return true;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("Failed to copy to clipboard:", error);
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
cloneDeep,
|
|
72
|
+
copyToClipboard,
|
|
73
|
+
debounce,
|
|
74
|
+
formatCurrency,
|
|
75
|
+
formatDate,
|
|
76
|
+
generateId,
|
|
77
|
+
get,
|
|
78
|
+
groupBy,
|
|
79
|
+
isEmpty,
|
|
80
|
+
isEqual,
|
|
81
|
+
merge,
|
|
82
|
+
omit,
|
|
83
|
+
orderBy,
|
|
84
|
+
pick,
|
|
85
|
+
set,
|
|
86
|
+
sleep,
|
|
87
|
+
sortBy,
|
|
88
|
+
throttle,
|
|
89
|
+
uniq,
|
|
90
|
+
uniqBy
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Re-export commonly used utilities\nexport { omit, pick, debounce, throttle } from \"radash\";\nexport { \n isEmpty, \n isEqual, \n cloneDeep, \n merge, \n get, \n set, \n uniq, \n uniqBy,\n groupBy,\n orderBy,\n sortBy\n} from \"lodash-es\";\n\n// Custom utility functions\nexport const sleep = (ms: number): Promise<void> => \n new Promise(resolve => setTimeout(resolve, ms));\n\nexport const formatCurrency = (\n amount: number, \n currency = 'USD', \n locale = 'en-US'\n): string => {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n};\n\nexport const formatDate = (\n date: Date | string | number, \n options?: Intl.DateTimeFormatOptions,\n locale = 'en-US'\n): string => {\n return new Intl.DateTimeFormat(locale, options).format(new Date(date));\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n};\n\nexport const copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch (error) {\n console.error('Failed to copy to clipboard:', error);\n return false;\n }\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA+C;AAC/C,uBAYO;AAGA,IAAM,QAAQ,CAAC,OACpB,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAEzC,IAAM,iBAAiB,CAC5B,QACA,WAAW,OACX,SAAS,YACE;AACX,SAAO,IAAI,KAAK,aAAa,QAAQ;AAAA,IACnC,OAAO;AAAA,IACP;AAAA,EACF,CAAC,EAAE,OAAO,MAAM;AAClB;AAEO,IAAM,aAAa,CACxB,MACA,SACA,SAAS,YACE;AACX,SAAO,IAAI,KAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,IAAI,KAAK,IAAI,CAAC;AACvE;AAEO,IAAM,aAAa,MAAc;AACtC,SAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE;AACzE;AAEO,IAAM,kBAAkB,OAAO,SAAmC;AACvE,MAAI;AACF,UAAM,UAAU,UAAU,UAAU,IAAI;AACxC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,gCAAgC,KAAK;AACnD,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/utils/index.ts
|
|
2
|
+
import { omit, pick, debounce, throttle } from "radash";
|
|
3
|
+
import {
|
|
4
|
+
isEmpty,
|
|
5
|
+
isEqual,
|
|
6
|
+
cloneDeep,
|
|
7
|
+
merge,
|
|
8
|
+
get,
|
|
9
|
+
set,
|
|
10
|
+
uniq,
|
|
11
|
+
uniqBy,
|
|
12
|
+
groupBy,
|
|
13
|
+
orderBy,
|
|
14
|
+
sortBy
|
|
15
|
+
} from "lodash-es";
|
|
16
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
17
|
+
var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
|
|
18
|
+
return new Intl.NumberFormat(locale, {
|
|
19
|
+
style: "currency",
|
|
20
|
+
currency
|
|
21
|
+
}).format(amount);
|
|
22
|
+
};
|
|
23
|
+
var formatDate = (date, options, locale = "en-US") => {
|
|
24
|
+
return new Intl.DateTimeFormat(locale, options).format(new Date(date));
|
|
25
|
+
};
|
|
26
|
+
var generateId = () => {
|
|
27
|
+
return Math.random().toString(36).substring(2) + Date.now().toString(36);
|
|
28
|
+
};
|
|
29
|
+
var copyToClipboard = async (text) => {
|
|
30
|
+
try {
|
|
31
|
+
await navigator.clipboard.writeText(text);
|
|
32
|
+
return true;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Failed to copy to clipboard:", error);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
cloneDeep,
|
|
40
|
+
copyToClipboard,
|
|
41
|
+
debounce,
|
|
42
|
+
formatCurrency,
|
|
43
|
+
formatDate,
|
|
44
|
+
generateId,
|
|
45
|
+
get,
|
|
46
|
+
groupBy,
|
|
47
|
+
isEmpty,
|
|
48
|
+
isEqual,
|
|
49
|
+
merge,
|
|
50
|
+
omit,
|
|
51
|
+
orderBy,
|
|
52
|
+
pick,
|
|
53
|
+
set,
|
|
54
|
+
sleep,
|
|
55
|
+
sortBy,
|
|
56
|
+
throttle,
|
|
57
|
+
uniq,
|
|
58
|
+
uniqBy
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Re-export commonly used utilities\nexport { omit, pick, debounce, throttle } from \"radash\";\nexport { \n isEmpty, \n isEqual, \n cloneDeep, \n merge, \n get, \n set, \n uniq, \n uniqBy,\n groupBy,\n orderBy,\n sortBy\n} from \"lodash-es\";\n\n// Custom utility functions\nexport const sleep = (ms: number): Promise<void> => \n new Promise(resolve => setTimeout(resolve, ms));\n\nexport const formatCurrency = (\n amount: number, \n currency = 'USD', \n locale = 'en-US'\n): string => {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(amount);\n};\n\nexport const formatDate = (\n date: Date | string | number, \n options?: Intl.DateTimeFormatOptions,\n locale = 'en-US'\n): string => {\n return new Intl.DateTimeFormat(locale, options).format(new Date(date));\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2) + Date.now().toString(36);\n};\n\nexport const copyToClipboard = async (text: string): Promise<boolean> => {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch (error) {\n console.error('Failed to copy to clipboard:', error);\n return false;\n }\n};"],"mappings":";AACA,SAAS,MAAM,MAAM,UAAU,gBAAgB;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,IAAM,QAAQ,CAAC,OACpB,IAAI,QAAQ,aAAW,WAAW,SAAS,EAAE,CAAC;AAEzC,IAAM,iBAAiB,CAC5B,QACA,WAAW,OACX,SAAS,YACE;AACX,SAAO,IAAI,KAAK,aAAa,QAAQ;AAAA,IACnC,OAAO;AAAA,IACP;AAAA,EACF,CAAC,EAAE,OAAO,MAAM;AAClB;AAEO,IAAM,aAAa,CACxB,MACA,SACA,SAAS,YACE;AACX,SAAO,IAAI,KAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,IAAI,KAAK,IAAI,CAAC;AACvE;AAEO,IAAM,aAAa,MAAc;AACtC,SAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,IAAI,KAAK,IAAI,EAAE,SAAS,EAAE;AACzE;AAEO,IAAM,kBAAkB,OAAO,SAAmC;AACvE,MAAI;AACF,UAAM,UAAU,UAAU,UAAU,IAAI;AACxC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,gCAAgC,KAAK;AACnD,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@relia-fe/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Shared core utilities, providers, and hooks for startup projects",
|
|
5
|
+
"keywords": ["react", "utilities", "hooks", "providers", "startup", "core", "tanstack-query"],
|
|
6
|
+
"author": "Relia FE Team",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/issues"
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"module": "./dist/index.mjs",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./utils": {
|
|
27
|
+
"types": "./dist/utils/index.d.ts",
|
|
28
|
+
"import": "./dist/utils/index.mjs",
|
|
29
|
+
"require": "./dist/utils/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
37
|
+
"dev": "tsup --watch",
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"type-check": "tsc --noEmit",
|
|
40
|
+
"lint": "echo 'ESLint not configured for core package'",
|
|
41
|
+
"lint:errors-only": "echo 'ESLint not configured for core package'",
|
|
42
|
+
"lint:fix": "echo 'ESLint not configured for core package'"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@emotion/react": "^11.14.0",
|
|
46
|
+
"@emotion/styled": "^11.14.1",
|
|
47
|
+
"@tanstack/react-query": "^5.85.6",
|
|
48
|
+
"react": ">=18.0.0",
|
|
49
|
+
"react-dom": ">=18.0.0"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lodash-es": "^4.17.21",
|
|
53
|
+
"radash": "^12.1.1"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/lodash-es": "^4.17.7",
|
|
57
|
+
"@types/react": "^19.0.0",
|
|
58
|
+
"@types/react-dom": "^19.0.0",
|
|
59
|
+
"tsup": "^8.0.2",
|
|
60
|
+
"typescript": "^5.4.5"
|
|
61
|
+
}
|
|
62
|
+
}
|