@zuzjs/core 0.1.4 → 0.1.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.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export declare const colorNames: string[];
8
+ /**
9
+ * colorPalatter contains colors and their corresponding shades.
10
+ */
11
+ export declare const colorPalette: {
12
+ green: {
13
+ 50: string;
14
+ 100: string;
15
+ 200: string;
16
+ 300: string;
17
+ 400: string;
18
+ 500: string;
19
+ 600: string;
20
+ 700: string;
21
+ 800: string;
22
+ 900: string;
23
+ };
24
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export const colorNames = [
8
+ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'
9
+ ];
10
+ /**
11
+ * colorPalatter contains colors and their corresponding shades.
12
+ */
13
+ export const colorPalette = {
14
+ green: {
15
+ 50: '#e8f5e9',
16
+ 100: '#c8e6c9',
17
+ 200: '#a5d6a7',
18
+ 300: '#81c784',
19
+ 400: '#66bb6a',
20
+ 500: '#4caf50',
21
+ 600: '#43a047',
22
+ 700: '#388e3c',
23
+ 800: '#2e7d32',
24
+ 900: '#1b5e20',
25
+ },
26
+ };
@@ -1,5 +1,7 @@
1
- import { AxiosProgressEvent } from "axios";
2
- import { dynamicObject, FormatNumberParams, sortOptions } from "./types";
1
+ import { AxiosProgressEvent, CancelTokenSource } from "axios";
2
+ import { dynamic, FormatNumberParams, sortOptions } from "./types";
3
+ export { CancelTokenSource, AxiosProgressEvent as UploadProgressEvent };
4
+ export * from "./types";
3
5
  export declare const __SALT: string;
4
6
  export { default as "_" } from "./withGlobals";
5
7
  export declare const numberInRange: (min: number, max: number) => number;
@@ -14,10 +16,12 @@ export declare const pluralize: (word: string, count: number) => string;
14
16
  export declare const isHexColor: (color: string) => boolean;
15
17
  export declare const isRgbaColor: (color: string) => boolean;
16
18
  export declare const isHslColor: (color: string) => boolean;
19
+ export declare const isColorName: (color: string) => boolean;
17
20
  export declare const isColor: (color: string) => boolean;
18
21
  export declare const hexToRgba: (hex: string, alpha?: number) => string;
19
22
  export declare const removeDuplicates: <T>(array: T[]) => T[];
20
- export declare const withPost: <T>(uri: string, data: dynamicObject | FormData, timeout?: number, ignoreKind?: boolean, onProgress?: (ev: AxiosProgressEvent) => void) => Promise<T>;
23
+ export declare const getCancelToken: () => CancelTokenSource;
24
+ export declare const withPost: <T>(uri: string, data: dynamic | FormData | string, timeout?: number, ignoreKind?: boolean, headers?: dynamic, onProgress?: (ev: AxiosProgressEvent) => void) => Promise<T>;
21
25
  export declare const withGet: <T>(uri: string, timeout?: number, ignoreKind?: boolean) => Promise<T>;
22
26
  export declare const withTime: (fun: (...args: any[]) => any) => {
23
27
  result: any;
@@ -1,57 +1,41 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.slugify = exports.clamp = exports.camelCaseToDash = exports.camelCase = exports.natsort = exports.copyToClipboard = exports.formatSize = exports.formatNumber = exports.arrayRand = exports.timeSince = exports.time = exports.withTime = exports.withGet = exports.withPost = exports.removeDuplicates = exports.hexToRgba = exports.isColor = exports.isHslColor = exports.isRgbaColor = exports.isHexColor = exports.pluralize = exports.urlencode = exports.urldecode = exports.ucfirst = exports.uuid = exports.MD5 = exports.fromHash = exports.toHash = exports.numberInRange = exports["_"] = exports.__SALT = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const hashids_1 = __importDefault(require("hashids"));
9
- const js_cookie_1 = __importDefault(require("js-cookie"));
10
- const md5_1 = __importDefault(require("md5"));
11
- const moment_1 = __importDefault(require("moment"));
12
- const regexps_1 = require("./regexps");
13
- const types_1 = require("./types");
14
- exports.__SALT = `zuzjs-core`;
15
- var withGlobals_1 = require("./withGlobals");
16
- Object.defineProperty(exports, "_", { enumerable: true, get: function () { return __importDefault(withGlobals_1).default; } });
17
- const numberInRange = (min, max) => {
1
+ import axios from "axios";
2
+ import Hashids from "hashids";
3
+ import Cookies from "js-cookie";
4
+ import md5 from "md5";
5
+ import moment from "moment";
6
+ import { colorNames } from "./colors";
7
+ import { hexColorRegex, hslColorRegex, rgbaColorRegex } from "./regexps";
8
+ import { SORT } from "./types";
9
+ import _ from "./withGlobals";
10
+ export * from "./types";
11
+ export const __SALT = `zuzjs-core`;
12
+ export { default as "_" } from "./withGlobals";
13
+ export const numberInRange = (min, max) => {
18
14
  return Math.floor(Math.random() * (max - min + 1)) + min;
19
15
  };
20
- exports.numberInRange = numberInRange;
21
- const toHash = (n, len = 6, SALT = null) => new hashids_1.default(SALT || exports.__SALT, len).encode(n);
22
- exports.toHash = toHash;
23
- const fromHash = (str, SALT = null) => {
16
+ export const toHash = (n, len = 6, SALT = null) => new Hashids(SALT || __SALT, len).encode(n);
17
+ export const fromHash = (str, SALT = null) => {
24
18
  try {
25
- const n = new hashids_1.default(SALT || exports.__SALT, +process.env.HASHIDS_LENGTH).decode(str);
19
+ const n = new Hashids(SALT || __SALT, +process.env.HASHIDS_LENGTH).decode(str);
26
20
  return n.length >= 0 ? Number(n[0]) : 0;
27
21
  }
28
22
  catch (e) {
29
23
  return 0;
30
24
  }
31
25
  };
32
- exports.fromHash = fromHash;
33
- const MD5 = (str) => (0, md5_1.default)(str);
34
- exports.MD5 = MD5;
35
- const uuid = (len) => (0, exports.toHash)((0, exports.numberInRange)(11111111111, 999999999999));
36
- exports.uuid = uuid;
37
- const ucfirst = (o) => `${o.charAt(0).toUpperCase()}${o.substring(1, o.length)}`;
38
- exports.ucfirst = ucfirst;
39
- const urldecode = (str) => decodeURIComponent(str.replace(/\+/g, '%20'));
40
- exports.urldecode = urldecode;
41
- const urlencode = (str) => encodeURIComponent(str);
42
- exports.urlencode = urlencode;
43
- const pluralize = (word, count) => `${word}${count !== 1 ? 's' : ''}`;
44
- exports.pluralize = pluralize;
45
- const isHexColor = (color) => regexps_1.hexColorRegex.test(color);
46
- exports.isHexColor = isHexColor;
47
- const isRgbaColor = (color) => regexps_1.rgbaColorRegex.test(color);
48
- exports.isRgbaColor = isRgbaColor;
49
- const isHslColor = (color) => regexps_1.hslColorRegex.test(color);
50
- exports.isHslColor = isHslColor;
26
+ export const MD5 = (str) => md5(str);
27
+ export const uuid = (len) => toHash(numberInRange(11111111111, 999999999999));
28
+ export const ucfirst = (o) => `${o.charAt(0).toUpperCase()}${o.substring(1, o.length)}`;
29
+ export const urldecode = (str) => decodeURIComponent(str.replace(/\+/g, '%20'));
30
+ export const urlencode = (str) => encodeURIComponent(str);
31
+ export const pluralize = (word, count) => `${word}${count !== 1 ? 's' : ''}`;
32
+ export const isHexColor = (color) => hexColorRegex.test(color);
33
+ export const isRgbaColor = (color) => rgbaColorRegex.test(color);
34
+ export const isHslColor = (color) => hslColorRegex.test(color);
35
+ export const isColorName = (color) => colorNames.includes(color.toLowerCase());
51
36
  // Function to validate a color string
52
- const isColor = (color) => (0, exports.isHexColor)(color) || (0, exports.isRgbaColor)(color) || (0, exports.isHslColor)(color);
53
- exports.isColor = isColor;
54
- const hexToRgba = (hex, alpha = 1) => {
37
+ export const isColor = (color) => isHexColor(color) || isRgbaColor(color) || isHslColor(color);
38
+ export const hexToRgba = (hex, alpha = 1) => {
55
39
  // Remove the hash symbol if present
56
40
  hex = hex.replace(/^#/, '');
57
41
  // If shorthand hex (#RGB), expand it to full form (#RRGGBB)
@@ -65,8 +49,7 @@ const hexToRgba = (hex, alpha = 1) => {
65
49
  const b = bigint & 255;
66
50
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
67
51
  };
68
- exports.hexToRgba = hexToRgba;
69
- const removeDuplicates = (array) => {
52
+ export const removeDuplicates = (array) => {
70
53
  return array.reduce((accumulator, currentValue) => {
71
54
  if (!accumulator.includes(currentValue)) {
72
55
  accumulator.push(currentValue);
@@ -74,21 +57,22 @@ const removeDuplicates = (array) => {
74
57
  return accumulator;
75
58
  }, []);
76
59
  };
77
- exports.removeDuplicates = removeDuplicates;
78
- const withPost = async (uri, data, timeout = 60, ignoreKind = false, onProgress) => {
79
- const _cookies = js_cookie_1.default.get();
60
+ export const getCancelToken = () => axios.CancelToken.source();
61
+ export const withPost = async (uri, data, timeout = 60, ignoreKind = false, headers, onProgress) => {
62
+ const _cookies = Cookies.get();
80
63
  if (data instanceof FormData) {
81
64
  for (const c in _cookies) {
82
65
  data.append(c, _cookies[c]);
83
66
  }
84
67
  return new Promise((resolve, reject) => {
85
- (0, axios_1.default)({
68
+ axios({
86
69
  method: 'post',
87
70
  url: uri,
88
71
  data: data,
89
72
  timeout: timeout * 1000,
90
73
  headers: {
91
74
  'Content-Type': 'multipart/form-data',
75
+ ...(headers || {})
92
76
  },
93
77
  onUploadProgress: ev => onProgress && onProgress(ev)
94
78
  })
@@ -103,37 +87,67 @@ const withPost = async (uri, data, timeout = 60, ignoreKind = false, onProgress)
103
87
  .catch(err => reject(err));
104
88
  });
105
89
  }
106
- return new Promise((resolve, reject) => {
107
- axios_1.default.post(uri, {
108
- ...data,
109
- ..._cookies,
110
- __stmp: new Date().getTime() / 1000
111
- }, {
112
- timeout: 1000 * timeout,
113
- headers: {
114
- 'Content-Type': 'application/json',
115
- }
116
- })
117
- .then(resp => {
118
- if (resp.data && (ignoreKind || ("kind" in resp.data))) {
119
- resolve(resp.data);
120
- }
121
- else {
122
- reject(resp.data);
123
- }
124
- })
125
- .catch(err => {
126
- if (err?.response?.data)
127
- reject(err.response.data);
128
- else
129
- reject(err.code && err.code == `ERR_NETWORK` ? { error: err.code, message: navigator.onLine ? `Unable to connect to the server. It may be temporarily down.` : `Network error: Unable to connect. Please check your internet connection and try again.` } : err);
90
+ else if (_(data).isString()) {
91
+ return new Promise((resolve, reject) => {
92
+ axios.post(uri, data, {
93
+ timeout: 1000 * timeout,
94
+ headers: {
95
+ 'Content-Type': 'application/json',
96
+ ...(headers || {})
97
+ }
98
+ })
99
+ .then(resp => {
100
+ if (resp.data && (ignoreKind || ("kind" in resp.data))) {
101
+ resolve(resp.data);
102
+ }
103
+ else {
104
+ reject(resp.data);
105
+ }
106
+ })
107
+ .catch(err => {
108
+ if (err?.response?.data)
109
+ reject(err.response.data);
110
+ else
111
+ reject(err.code && err.code == `ERR_NETWORK` ? { error: err.code, message: navigator.onLine ? `Unable to connect to the server. It may be temporarily down.` : `Network error: Unable to connect. Please check your internet connection and try again.` } : err);
112
+ });
130
113
  });
114
+ }
115
+ else if (typeof data === "object" && !Array.isArray(data) && data !== null) {
116
+ return new Promise((resolve, reject) => {
117
+ axios.post(uri, {
118
+ ...data,
119
+ ..._cookies,
120
+ __stmp: new Date().getTime() / 1000
121
+ }, {
122
+ timeout: 1000 * timeout,
123
+ headers: {
124
+ 'Content-Type': 'application/json',
125
+ ...(headers || {})
126
+ }
127
+ })
128
+ .then(resp => {
129
+ if (resp.data && (ignoreKind || ("kind" in resp.data))) {
130
+ resolve(resp.data);
131
+ }
132
+ else {
133
+ reject(resp.data);
134
+ }
135
+ })
136
+ .catch(err => {
137
+ if (err?.response?.data)
138
+ reject(err.response.data);
139
+ else
140
+ reject(err.code && err.code == `ERR_NETWORK` ? { error: err.code, message: navigator.onLine ? `Unable to connect to the server. It may be temporarily down.` : `Network error: Unable to connect. Please check your internet connection and try again.` } : err);
141
+ });
142
+ });
143
+ }
144
+ return new Promise((resolve, reject) => {
145
+ reject();
131
146
  });
132
147
  };
133
- exports.withPost = withPost;
134
- const withGet = async (uri, timeout = 60, ignoreKind = false) => {
148
+ export const withGet = async (uri, timeout = 60, ignoreKind = false) => {
135
149
  return new Promise((resolve, reject) => {
136
- axios_1.default
150
+ axios
137
151
  .get(uri, { timeout: timeout * 1000 })
138
152
  .then((resp) => {
139
153
  if (resp.data && (ignoreKind || "kind" in resp.data)) {
@@ -158,8 +172,7 @@ const withGet = async (uri, timeout = 60, ignoreKind = false) => {
158
172
  });
159
173
  });
160
174
  };
161
- exports.withGet = withGet;
162
- const withTime = (fun) => {
175
+ export const withTime = (fun) => {
163
176
  const start = new Date().getTime();
164
177
  const result = fun();
165
178
  const end = new Date().getTime();
@@ -168,18 +181,14 @@ const withTime = (fun) => {
168
181
  executionTime: end - start
169
182
  };
170
183
  };
171
- exports.withTime = withTime;
172
- const time = (stamp, format) => {
184
+ export const time = (stamp, format) => {
173
185
  return stamp ?
174
- moment_1.default.unix(+stamp / 1000).format(format || `YYYY-MM-DD HH:mm:ss`)
175
- : (0, moment_1.default)().format(format || `YYYY-MM-DD HH:mm:ss`);
186
+ moment.unix(+stamp / 1000).format(format || `YYYY-MM-DD HH:mm:ss`)
187
+ : moment().format(format || `YYYY-MM-DD HH:mm:ss`);
176
188
  };
177
- exports.time = time;
178
- const timeSince = (stamp) => (0, moment_1.default)(stamp).fromNow();
179
- exports.timeSince = timeSince;
180
- const arrayRand = (arr) => arr[Math.floor(Math.random() * arr.length)];
181
- exports.arrayRand = arrayRand;
182
- const formatNumber = ({ number, locale = 'en-US', style = `decimal`, decimal = 2, currency }) => {
189
+ export const timeSince = (stamp) => moment(stamp).fromNow();
190
+ export const arrayRand = (arr) => arr[Math.floor(Math.random() * arr.length)];
191
+ export const formatNumber = ({ number, locale = 'en-US', style = `decimal`, decimal = 2, currency }) => {
183
192
  if (style === 'currency' && !currency) {
184
193
  throw new TypeError('Currency code is required with currency style.');
185
194
  }
@@ -200,8 +209,7 @@ const formatNumber = ({ number, locale = 'en-US', style = `decimal`, decimal = 2
200
209
  maximumFractionDigits: +number % 1 > 0 ? 2 : 0
201
210
  }).format(+number);
202
211
  };
203
- exports.formatNumber = formatNumber;
204
- const formatSize = (bytes) => {
212
+ export const formatSize = (bytes) => {
205
213
  const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
206
214
  const _bytes = `string` == typeof bytes ? parseFloat(bytes) : bytes;
207
215
  if (_bytes == 0)
@@ -211,8 +219,7 @@ const formatSize = (bytes) => {
211
219
  const nx = _bytes / Math.pow(1024, i);
212
220
  return nx.toFixed(2) + ' ' + sizes[i];
213
221
  };
214
- exports.formatSize = formatSize;
215
- const copyToClipboard = (text) => {
222
+ export const copyToClipboard = (text) => {
216
223
  if (navigator.clipboard && navigator.clipboard.writeText) {
217
224
  return navigator.clipboard.writeText(text);
218
225
  }
@@ -236,9 +243,8 @@ const copyToClipboard = (text) => {
236
243
  });
237
244
  }
238
245
  };
239
- exports.copyToClipboard = copyToClipboard;
240
- const natsort = (options = {
241
- direction: types_1.SORT.Asc,
246
+ export const natsort = (options = {
247
+ direction: SORT.Asc,
242
248
  caseSensitive: false,
243
249
  }) => {
244
250
  const ore = /^0/;
@@ -252,7 +258,7 @@ const natsort = (options = {
252
258
  const nre = /(0x[\da-fA-F]+|(^[\+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|\d+)/g;
253
259
  // datetime
254
260
  const dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/; // tslint:disable-line
255
- const GREATER = options.direction == types_1.SORT.Desc ? -1 : 1;
261
+ const GREATER = options.direction == SORT.Desc ? -1 : 1;
256
262
  const SMALLER = -GREATER;
257
263
  const _normalize = !options.caseSensitive
258
264
  ? (s) => s.toString().toLowerCase().replace(tre, '')
@@ -339,24 +345,20 @@ const natsort = (options = {
339
345
  return 0;
340
346
  };
341
347
  };
342
- exports.natsort = natsort;
343
- const camelCase = (str, ucf = false) => {
348
+ export const camelCase = (str, ucf = false) => {
344
349
  return str
345
350
  .toLowerCase()
346
351
  .split(/[^a-zA-Z0-9]+/) // Split by any non-alphanumeric character
347
352
  .map((word, index) => index === 0
348
- ? ucf ? (0, exports.ucfirst)(word) : word
349
- : (0, exports.ucfirst)(word))
353
+ ? ucf ? ucfirst(word) : word
354
+ : ucfirst(word))
350
355
  .join('');
351
356
  };
352
- exports.camelCase = camelCase;
353
- const camelCaseToDash = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
354
- exports.camelCaseToDash = camelCaseToDash;
355
- const clamp = (value, min, max) => {
357
+ export const camelCaseToDash = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
358
+ export const clamp = (value, min, max) => {
356
359
  return Math.min(Math.max(value, min), max);
357
360
  };
358
- exports.clamp = clamp;
359
- const slugify = (text, separator = "-") => {
361
+ export const slugify = (text, separator = "-") => {
360
362
  if (undefined == text) {
361
363
  console.log(text, `is undefined`);
362
364
  return ``;
@@ -369,4 +371,3 @@ const slugify = (text, separator = "-") => {
369
371
  .replace(new RegExp(`\\${separator}{2,}`, "g"), separator) // Remove duplicate separators
370
372
  .replace(new RegExp(`^\\${separator}|\\${separator}$`, "g"), ""); // Trim separators from ends
371
373
  };
372
- exports.slugify = slugify;
@@ -0,0 +1,6 @@
1
+ // Hex color regex (#RGB, #RRGGBB)
2
+ export const hexColorRegex = /^#([A-Fa-f0-9]{3}){1,2}$/;
3
+ // RGBA color regex (rgba(255, 255, 255, 1))
4
+ export const rgbaColorRegex = /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*((0|1|0?\.\d+)\s*))?\)$/;
5
+ // HSL color regex (hsl(360, 100%, 100%))
6
+ export const hslColorRegex = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/;
@@ -1,4 +1,4 @@
1
- export type dynamicObject = {
1
+ export type dynamic = {
2
2
  [x: string]: any;
3
3
  };
4
4
  export interface FormatNumberParams {
@@ -0,0 +1,5 @@
1
+ export var SORT;
2
+ (function (SORT) {
3
+ SORT["Asc"] = "ASC";
4
+ SORT["Desc"] = "DESC";
5
+ })(SORT || (SORT = {}));
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  class withGlobals {
4
2
  _;
5
3
  constructor(value) {
@@ -76,4 +74,4 @@ class withGlobals {
76
74
  }
77
75
  }
78
76
  const _ = (value) => new withGlobals(value);
79
- exports.default = _;
77
+ export default _;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export declare const colorNames: string[];
8
+ /**
9
+ * colorPalatter contains colors and their corresponding shades.
10
+ */
11
+ export declare const colorPalette: {
12
+ green: {
13
+ 50: string;
14
+ 100: string;
15
+ 200: string;
16
+ 300: string;
17
+ 400: string;
18
+ 500: string;
19
+ 600: string;
20
+ 700: string;
21
+ 800: string;
22
+ 900: string;
23
+ };
24
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export const colorNames = [
8
+ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'
9
+ ];
10
+ /**
11
+ * colorPalatter contains colors and their corresponding shades.
12
+ */
13
+ export const colorPalette = {
14
+ green: {
15
+ 50: '#e8f5e9',
16
+ 100: '#c8e6c9',
17
+ 200: '#a5d6a7',
18
+ 300: '#81c784',
19
+ 400: '#66bb6a',
20
+ 500: '#4caf50',
21
+ 600: '#43a047',
22
+ 700: '#388e3c',
23
+ 800: '#2e7d32',
24
+ 900: '#1b5e20',
25
+ },
26
+ };
@@ -0,0 +1,40 @@
1
+ import { AxiosProgressEvent, CancelTokenSource } from "axios";
2
+ import { dynamic, FormatNumberParams, sortOptions } from "./types";
3
+ export { CancelTokenSource, AxiosProgressEvent as UploadProgressEvent };
4
+ export * from "./types";
5
+ export declare const __SALT: string;
6
+ export { default as "_" } from "./withGlobals";
7
+ export declare const numberInRange: (min: number, max: number) => number;
8
+ export declare const toHash: (n: number, len?: number, SALT?: string | null) => string;
9
+ export declare const fromHash: (str: string, SALT?: string | null) => number;
10
+ export declare const MD5: (str: string) => string;
11
+ export declare const uuid: (len: number) => string;
12
+ export declare const ucfirst: (o: any) => string;
13
+ export declare const urldecode: (str: string) => string;
14
+ export declare const urlencode: (str: string) => string;
15
+ export declare const pluralize: (word: string, count: number) => string;
16
+ export declare const isHexColor: (color: string) => boolean;
17
+ export declare const isRgbaColor: (color: string) => boolean;
18
+ export declare const isHslColor: (color: string) => boolean;
19
+ export declare const isColorName: (color: string) => boolean;
20
+ export declare const isColor: (color: string) => boolean;
21
+ export declare const hexToRgba: (hex: string, alpha?: number) => string;
22
+ export declare const removeDuplicates: <T>(array: T[]) => T[];
23
+ export declare const getCancelToken: () => CancelTokenSource;
24
+ export declare const withPost: <T>(uri: string, data: dynamic | FormData | string, timeout?: number, ignoreKind?: boolean, headers?: dynamic, onProgress?: (ev: AxiosProgressEvent) => void) => Promise<T>;
25
+ export declare const withGet: <T>(uri: string, timeout?: number, ignoreKind?: boolean) => Promise<T>;
26
+ export declare const withTime: (fun: (...args: any[]) => any) => {
27
+ result: any;
28
+ executionTime: number;
29
+ };
30
+ export declare const time: (stamp?: number, format?: string) => string;
31
+ export declare const timeSince: (stamp: number) => string;
32
+ export declare const arrayRand: (arr: any[]) => any;
33
+ export declare const formatNumber: ({ number, locale, style, decimal, currency }: FormatNumberParams) => string;
34
+ export declare const formatSize: (bytes: number | string) => string;
35
+ export declare const copyToClipboard: (text: string) => Promise<unknown>;
36
+ export declare const natsort: (options?: sortOptions) => (a: string | number, b: string | number) => number;
37
+ export declare const camelCase: (str: string, ucf?: boolean) => string;
38
+ export declare const camelCaseToDash: (str: string) => string;
39
+ export declare const clamp: (value: number, min: number, max: number) => number;
40
+ export declare const slugify: (text: string, separator?: string) => string;