ag-common 0.0.728 → 0.0.729
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/api/helpers/api.js +0 -6
- package/dist/api/helpers/dynamo.d.ts +1 -1
- package/dist/api/helpers/dynamo.js +11 -12
- package/dist/api/helpers/enforceDynamoProvisionCap.js +0 -1
- package/dist/api/helpers/openApiHelpers.js +1 -2
- package/dist/api/helpers/s3.d.ts +0 -1
- package/dist/api/helpers/s3.js +11 -11
- package/dist/api/helpers/ses.d.ts +1 -1
- package/dist/api/helpers/sts.js +2 -2
- package/dist/api/helpers/validateOpenApi.js +1 -4
- package/dist/api/helpers/validations.js +3 -5
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/openapi-postfix.js +0 -3
- package/dist/api/openapi-prefix.js +0 -6
- package/dist/api/types/index.d.ts +1 -1
- package/dist/api/types/index.js +0 -15
- package/dist/common/helpers/array.d.ts +1 -1
- package/dist/common/helpers/array.js +3 -4
- package/dist/common/helpers/async.js +2 -3
- package/dist/common/helpers/binary.d.ts +3 -4
- package/dist/common/helpers/binary.js +4 -4
- package/dist/common/helpers/csv.js +1 -3
- package/dist/common/helpers/date.js +0 -1
- package/dist/common/helpers/func.js +1 -2
- package/dist/common/helpers/generator.js +1 -3
- package/dist/common/helpers/groupBy.js +3 -4
- package/dist/common/helpers/hashCode.js +0 -1
- package/dist/common/helpers/log.js +0 -2
- package/dist/common/helpers/math.js +6 -8
- package/dist/common/helpers/memo.js +1 -4
- package/dist/common/helpers/object.js +9 -14
- package/dist/common/helpers/random.js +3 -3
- package/dist/common/helpers/stream.js +3 -3
- package/dist/common/helpers/string/contains.js +3 -3
- package/dist/common/helpers/string/json.js +0 -1
- package/dist/common/helpers/string/object.js +1 -2
- package/dist/common/helpers/string/redact.js +3 -3
- package/dist/common/helpers/string/trim.js +2 -3
- package/dist/common/helpers/string/truncate.js +1 -2
- package/dist/common/helpers/string/url.js +3 -2
- package/dist/common/helpers/xml.js +0 -1
- package/dist/node/helpers/fetch.js +2 -2
- package/dist/node/helpers/fs.js +2 -3
- package/dist/ui/components/Accordion/index.js +17 -7
- package/dist/ui/components/BarChart/index.d.ts +1 -1
- package/dist/ui/components/BarChart/index.js +0 -1
- package/dist/ui/components/Button/index.d.ts +2 -3
- package/dist/ui/components/Button/index.js +1 -4
- package/dist/ui/components/Confirm/Dialog.js +1 -0
- package/dist/ui/components/Confirm/index.d.ts +1 -1
- package/dist/ui/components/Confirm/index.js +0 -1
- package/dist/ui/components/DarkMode/Base.d.ts +3 -4
- package/dist/ui/components/DarkMode/Base.js +18 -7
- package/dist/ui/components/DropdownList/Base.d.ts +2 -2
- package/dist/ui/components/DropdownList/Base.js +19 -10
- package/dist/ui/components/DropdownList/Dialog.d.ts +1 -1
- package/dist/ui/components/DropdownList/Dialog.js +2 -0
- package/dist/ui/components/DropdownList/types.d.ts +1 -1
- package/dist/ui/components/HorizontalScrollBar/index.js +18 -7
- package/dist/ui/components/Icon/index.d.ts +2 -2
- package/dist/ui/components/Image/index.js +17 -7
- package/dist/ui/components/InfiniteScroll/index.js +17 -8
- package/dist/ui/components/LineChart/index.d.ts +1 -1
- package/dist/ui/components/LineChart/index.js +0 -1
- package/dist/ui/components/Loader/index.js +17 -7
- package/dist/ui/components/Markdown/index.d.ts +2 -2
- package/dist/ui/components/MinSidebar/index.js +17 -7
- package/dist/ui/components/Modal/Dialog.js +1 -0
- package/dist/ui/components/Modal/Modal.d.ts +2 -2
- package/dist/ui/components/Modal/Modal.js +18 -7
- package/dist/ui/components/Modal/index.d.ts +1 -1
- package/dist/ui/components/Modal/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/curl/index.d.ts +2 -2
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.d.ts +4 -5
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.d.ts +1 -1
- package/dist/ui/components/OpenApiCodeBlock/index.js +0 -1
- package/dist/ui/components/OpenApiCodeBlock/types.d.ts +1 -1
- package/dist/ui/components/ProgressBar/index.js +17 -7
- package/dist/ui/components/Prompt/Modal.js +18 -7
- package/dist/ui/components/Prompt/index.d.ts +1 -1
- package/dist/ui/components/Prompt/index.js +0 -1
- package/dist/ui/components/RadioGroup/index.d.ts +2 -2
- package/dist/ui/components/RadioGroup/index.js +17 -8
- package/dist/ui/components/Search/AutoHideSearchBox.js +17 -7
- package/dist/ui/components/Search/Dialog.js +1 -0
- package/dist/ui/components/Search/Inline.js +17 -8
- package/dist/ui/components/Search/SearchBox.d.ts +1 -1
- package/dist/ui/components/Search/SearchBox.js +17 -7
- package/dist/ui/components/Search/index.d.ts +1 -1
- package/dist/ui/components/Search/index.js +0 -1
- package/dist/ui/components/Search/types.d.ts +2 -2
- package/dist/ui/components/Sidebar/index.js +17 -7
- package/dist/ui/components/TabBar/index.d.ts +2 -2
- package/dist/ui/components/TabBar/index.js +17 -7
- package/dist/ui/components/Table/index.d.ts +2 -2
- package/dist/ui/components/TextEdit/CheckboxEdit.js +17 -7
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -7
- package/dist/ui/components/TextEdit/ListboxEdit.js +20 -18
- package/dist/ui/components/TextEdit/TextEdit.d.ts +2 -2
- package/dist/ui/components/TextEdit/TextEdit.js +20 -18
- package/dist/ui/components/TextEdit/common.d.ts +6 -7
- package/dist/ui/components/TextEdit/index.d.ts +1 -1
- package/dist/ui/components/TextEdit/index.js +0 -1
- package/dist/ui/components/TextEdit/types.d.ts +1 -0
- package/dist/ui/components/TextWithButton/index.js +17 -7
- package/dist/ui/components/Toast/base.js +18 -7
- package/dist/ui/components/Toast/index.d.ts +1 -1
- package/dist/ui/components/Toast/index.js +0 -1
- package/dist/ui/components/Toast/types.d.ts +1 -1
- package/dist/ui/components/TreeChart/base.js +17 -7
- package/dist/ui/components/TreeChart/index.d.ts +1 -1
- package/dist/ui/components/TreeChart/index.js +0 -1
- package/dist/ui/components/UserImage/index.js +17 -7
- package/dist/ui/helpers/axiosHelper.d.ts +1 -1
- package/dist/ui/helpers/axiosHelper.js +0 -2
- package/dist/ui/helpers/callOpenApi/direct.js +2 -7
- package/dist/ui/helpers/callOpenApi/helpers.js +1 -2
- package/dist/ui/helpers/callOpenApi/hook.d.ts +0 -1
- package/dist/ui/helpers/callOpenApi/index.d.ts +1 -1
- package/dist/ui/helpers/callOpenApi/index.js +0 -1
- package/dist/ui/helpers/cookie/get.js +3 -3
- package/dist/ui/helpers/cookie/raw.js +4 -4
- package/dist/ui/helpers/cookie/set.js +2 -2
- package/dist/ui/helpers/cookie/use.js +2 -2
- package/dist/ui/helpers/debounce.js +2 -3
- package/dist/ui/helpers/dom.js +0 -2
- package/dist/ui/helpers/extractAttributes.js +0 -1
- package/dist/ui/helpers/index.d.ts +2 -2
- package/dist/ui/helpers/index.js +0 -2
- package/dist/ui/helpers/plural.js +1 -2
- package/dist/ui/helpers/routes.d.ts +2 -2
- package/dist/ui/helpers/serviceWorker.js +1 -2
- package/dist/ui/helpers/useContextMenu.d.ts +1 -1
- package/dist/ui/helpers/useContextMenu.js +2 -3
- package/dist/ui/helpers/useElementAttribute.js +3 -2
- package/dist/ui/helpers/useGranularHook.js +1 -1
- package/dist/ui/helpers/useInterval.js +2 -2
- package/dist/ui/helpers/useIsInViewport.js +1 -2
- package/dist/ui/helpers/useLocalStorage.js +2 -2
- package/dist/ui/helpers/useLockBodyScroll.js +1 -2
- package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
- package/dist/ui/helpers/useOnClickOutside.js +3 -3
- package/dist/ui/helpers/useOnScroll.js +6 -7
- package/dist/ui/helpers/useOverloadPageSearch.js +2 -0
- package/dist/ui/helpers/useQueryString.js +1 -1
- package/dist/ui/helpers/useResize.js +2 -2
- package/dist/ui/helpers/useTimeout.js +1 -2
- package/dist/ui/helpers/useTooltip.d.ts +1 -0
- package/dist/ui/helpers/useTooltip.js +18 -7
- package/dist/ui/icons/index.d.ts +27 -28
- package/dist/ui/styles/common.d.ts +2 -2
- package/dist/ui/styles/standaloneStyles.d.ts +12 -13
- package/package.json +36 -33
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.interpolatePercentInRange = exports.
|
|
3
|
+
exports.interpolatePercentInRange = exports.isNumber = exports.toFixed = void 0;
|
|
4
|
+
exports.roundToHalf = roundToHalf;
|
|
5
|
+
exports.clamp = clamp;
|
|
6
|
+
exports.sumArray = sumArray;
|
|
7
|
+
exports.toFixedDown = toFixedDown;
|
|
8
|
+
exports.rangePercentage = rangePercentage;
|
|
4
9
|
const toFixed = (num, fixed) => {
|
|
5
10
|
var _a;
|
|
6
11
|
const re = new RegExp(`^-?\\d+(?:.\\d{0,${fixed || -1}})?`);
|
|
@@ -22,7 +27,6 @@ function roundToHalf(converted) {
|
|
|
22
27
|
}
|
|
23
28
|
return parseInt(converted.toString(), 10) + 0.5;
|
|
24
29
|
}
|
|
25
|
-
exports.roundToHalf = roundToHalf;
|
|
26
30
|
/** restricts value between two numbers */
|
|
27
31
|
function clamp({ value, min, max, }) {
|
|
28
32
|
if (value < min) {
|
|
@@ -33,16 +37,13 @@ function clamp({ value, min, max, }) {
|
|
|
33
37
|
}
|
|
34
38
|
return value;
|
|
35
39
|
}
|
|
36
|
-
exports.clamp = clamp;
|
|
37
40
|
function sumArray(array) {
|
|
38
41
|
return array.reduce((a, b) => a + b, 0);
|
|
39
42
|
}
|
|
40
|
-
exports.sumArray = sumArray;
|
|
41
43
|
const isNumber = (num) => !isNaN(Number(num));
|
|
42
44
|
exports.isNumber = isNumber;
|
|
43
45
|
function toFixedDown(num, scale) {
|
|
44
46
|
if (!`${num}`.includes('e')) {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
47
|
// @ts-ignore
|
|
47
48
|
return +`${Math.round(`${num}e+${scale}`)}e-${scale}`;
|
|
48
49
|
}
|
|
@@ -51,11 +52,9 @@ function toFixedDown(num, scale) {
|
|
|
51
52
|
if (+arr[1] + scale > 0) {
|
|
52
53
|
sig = '+';
|
|
53
54
|
}
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
55
55
|
// @ts-ignore
|
|
56
56
|
return +`${Math.round(`${+arr[0]}e${sig}${+arr[1] + scale}`)}e-${scale}`;
|
|
57
57
|
}
|
|
58
|
-
exports.toFixedDown = toFixedDown;
|
|
59
58
|
/**
|
|
60
59
|
* get percentage of value within supplied range
|
|
61
60
|
* eg value of 5 between 0-10 = 0.5. value of 5 between 5-10 = 0
|
|
@@ -70,7 +69,6 @@ function rangePercentage({ value, min, max, }) {
|
|
|
70
69
|
}
|
|
71
70
|
return r;
|
|
72
71
|
}
|
|
73
|
-
exports.rangePercentage = rangePercentage;
|
|
74
72
|
/** will interpolate value of percent inside range. 0.5 between 100 and 200 = 150 */
|
|
75
73
|
const interpolatePercentInRange = ({ percent, min, max, }) => (max - min) * percent + min;
|
|
76
74
|
exports.interpolatePercentInRange = interpolatePercentInRange;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.memo =
|
|
3
|
+
exports.memo = memo;
|
|
4
4
|
const hashCode_1 = require("./hashCode");
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
5
|
const memoData = {};
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
6
|
function memo(func, ...args) {
|
|
9
7
|
const hc = (0, hashCode_1.hashCode)(JSON.stringify(args));
|
|
10
8
|
if (!memoData[hc]) {
|
|
@@ -12,4 +10,3 @@ function memo(func, ...args) {
|
|
|
12
10
|
}
|
|
13
11
|
return memoData[hc];
|
|
14
12
|
}
|
|
15
|
-
exports.memo = memo;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copy = exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObjectAdditional = exports.removeUndefValuesFromObject = exports.filterObject = exports.castObject = exports.
|
|
3
|
+
exports.copy = exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObjectAdditional = exports.removeUndefValuesFromObject = exports.filterObject = exports.castObject = exports.objectAlphaSort = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.tryJsonParse = void 0;
|
|
4
|
+
exports.isJson = isJson;
|
|
5
|
+
exports.objectToArray = objectToArray;
|
|
6
|
+
exports.paramsToObject = paramsToObject;
|
|
7
|
+
exports.objectToString = objectToString;
|
|
4
8
|
const tryJsonParse = (str, defaultValue) => {
|
|
5
9
|
if (!str) {
|
|
6
10
|
return null;
|
|
7
11
|
}
|
|
8
12
|
try {
|
|
9
13
|
return JSON.parse(str);
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
15
|
}
|
|
11
16
|
catch (e) {
|
|
12
17
|
return defaultValue;
|
|
@@ -16,13 +21,13 @@ exports.tryJsonParse = tryJsonParse;
|
|
|
16
21
|
function isJson(str) {
|
|
17
22
|
try {
|
|
18
23
|
JSON.parse(typeof str === 'string' ? str : JSON.stringify(str));
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
25
|
}
|
|
20
26
|
catch (e) {
|
|
21
27
|
return false;
|
|
22
28
|
}
|
|
23
29
|
return true;
|
|
24
30
|
}
|
|
25
|
-
exports.isJson = isJson;
|
|
26
31
|
const objectKeysToLowerCase = (origObj) => {
|
|
27
32
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
28
33
|
if (!origObj || Object.keys(origObj).length === 0) {
|
|
@@ -30,11 +35,9 @@ const objectKeysToLowerCase = (origObj) => {
|
|
|
30
35
|
}
|
|
31
36
|
return Object.keys(origObj).reduce((newObj, key) => {
|
|
32
37
|
const val = origObj[key];
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
38
|
const newVal = typeof val === 'object'
|
|
35
39
|
? (0, exports.objectKeysToLowerCase)(val)
|
|
36
40
|
: val;
|
|
37
|
-
// eslint-disable-next-line no-param-reassign
|
|
38
41
|
newObj[key.toLowerCase()] = newVal;
|
|
39
42
|
return newObj;
|
|
40
43
|
}, {});
|
|
@@ -53,27 +56,24 @@ function objectToArray(obj) {
|
|
|
53
56
|
});
|
|
54
57
|
return ret;
|
|
55
58
|
}
|
|
56
|
-
exports.objectToArray = objectToArray;
|
|
57
59
|
/**
|
|
58
60
|
* Recursively alphabetically sort an object
|
|
59
61
|
* @param object
|
|
60
62
|
* @param depthLeft
|
|
61
63
|
* @returns
|
|
62
64
|
*/
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
65
|
const objectAlphaSort = (object, depthLeft = -1) => {
|
|
65
66
|
if (depthLeft === 0) {
|
|
66
67
|
return object;
|
|
67
68
|
}
|
|
68
69
|
if (object !== null && typeof object === 'object') {
|
|
69
|
-
return
|
|
70
|
+
return Object.keys(object)
|
|
70
71
|
.sort((a, b) => (a.toLowerCase() < b.toLowerCase() ? -1 : 1))
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
72
|
.reduce((result, key) => {
|
|
73
73
|
//@ts-ignore
|
|
74
74
|
result[key] = (0, exports.objectAlphaSort)(object[key], depthLeft - 1);
|
|
75
75
|
return result;
|
|
76
|
-
}, {})
|
|
76
|
+
}, {});
|
|
77
77
|
}
|
|
78
78
|
else if (Array.isArray(object)) {
|
|
79
79
|
//@ts-ignore
|
|
@@ -89,7 +89,6 @@ exports.objectAlphaSort = objectAlphaSort;
|
|
|
89
89
|
* @param entries Could be URLSearchParams
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
92
|
function paramsToObject(entries) {
|
|
94
93
|
const result = {};
|
|
95
94
|
for (const [key, value] of entries) {
|
|
@@ -97,7 +96,6 @@ function paramsToObject(entries) {
|
|
|
97
96
|
}
|
|
98
97
|
return result;
|
|
99
98
|
}
|
|
100
|
-
exports.paramsToObject = paramsToObject;
|
|
101
99
|
/**
|
|
102
100
|
* stringify an object of key values. Could be used to stringify a querystring url
|
|
103
101
|
* @param obj
|
|
@@ -118,7 +116,6 @@ joinKeys) {
|
|
|
118
116
|
const ret = raw.join(joinKeys);
|
|
119
117
|
return ret;
|
|
120
118
|
}
|
|
121
|
-
exports.objectToString = objectToString;
|
|
122
119
|
/**
|
|
123
120
|
* run func over values in object. can be used to cast value type string[]|string to string
|
|
124
121
|
* @param orig
|
|
@@ -155,7 +152,6 @@ const removeUndefValuesFromObject = (orig) => {
|
|
|
155
152
|
const ret = {};
|
|
156
153
|
Object.entries(orig).forEach(([k, v]) => {
|
|
157
154
|
if (v !== null && v !== undefined) {
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
155
|
ret[k] = v;
|
|
160
156
|
}
|
|
161
157
|
});
|
|
@@ -190,7 +186,6 @@ const castStringlyObject = (orig) => {
|
|
|
190
186
|
});
|
|
191
187
|
};
|
|
192
188
|
exports.castStringlyObject = castStringlyObject;
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
189
|
const isObject = (o) => o && typeof o === 'object' && !Array.isArray(o);
|
|
195
190
|
exports.isObject = isObject;
|
|
196
191
|
const copy = (v) => JSON.parse(JSON.stringify(v));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.randomDecimal = void 0;
|
|
4
|
+
exports.random = random;
|
|
5
|
+
exports.shuffle = shuffle;
|
|
4
6
|
/** random number up to max. seed defaults to now.getTime() */
|
|
5
7
|
function random(max, seed) {
|
|
6
8
|
seed = seed !== null && seed !== void 0 ? seed : new Date().getTime();
|
|
@@ -8,7 +10,6 @@ function random(max, seed) {
|
|
|
8
10
|
const rnd = ret / 233280;
|
|
9
11
|
return Math.ceil(rnd * max);
|
|
10
12
|
}
|
|
11
|
-
exports.random = random;
|
|
12
13
|
/** between 0 and 1. seed defaults to now.getTime() */
|
|
13
14
|
const randomDecimal = function (seed) {
|
|
14
15
|
seed = seed !== null && seed !== void 0 ? seed : new Date().getTime();
|
|
@@ -33,4 +34,3 @@ function shuffle(array, seed) {
|
|
|
33
34
|
}
|
|
34
35
|
return array;
|
|
35
36
|
}
|
|
36
|
-
exports.shuffle = shuffle;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getStringFromStream =
|
|
12
|
+
exports.getStringFromStream = getStringFromStream;
|
|
13
13
|
const log_1 = require("./log");
|
|
14
14
|
function getStringFromStream(stream) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17,7 +17,7 @@ function getStringFromStream(stream) {
|
|
|
17
17
|
const reader = stream.getReader();
|
|
18
18
|
let result = '';
|
|
19
19
|
try {
|
|
20
|
-
// eslint-disable-next-line
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
21
21
|
while (true) {
|
|
22
22
|
const { done, value } = yield reader.read();
|
|
23
23
|
if (done)
|
|
@@ -27,6 +27,7 @@ function getStringFromStream(stream) {
|
|
|
27
27
|
// Append the chunk to the final result
|
|
28
28
|
result += chunkString;
|
|
29
29
|
}
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
31
|
}
|
|
31
32
|
catch (e) {
|
|
32
33
|
(0, log_1.error)('error converting stream');
|
|
@@ -37,4 +38,3 @@ function getStringFromStream(stream) {
|
|
|
37
38
|
return result;
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
exports.getStringFromStream = getStringFromStream;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.containsInsensitive = void 0;
|
|
4
|
+
exports.containsInsensitiveIndex = containsInsensitiveIndex;
|
|
5
|
+
exports.containsInsensitiveIndexes = containsInsensitiveIndexes;
|
|
4
6
|
/**
|
|
5
7
|
* returns >-1 if found
|
|
6
8
|
* @param str
|
|
@@ -22,7 +24,6 @@ function containsInsensitiveIndex({ str, fromLast = false, }, ...args) {
|
|
|
22
24
|
}
|
|
23
25
|
return !fromLast ? finds[0] : finds[finds.length - 1];
|
|
24
26
|
}
|
|
25
|
-
exports.containsInsensitiveIndex = containsInsensitiveIndex;
|
|
26
27
|
/**
|
|
27
28
|
* returns true if text is found
|
|
28
29
|
* @param str
|
|
@@ -59,4 +60,3 @@ function containsInsensitiveIndexes({ haystack, needle, fromLast = false, maxFou
|
|
|
59
60
|
}
|
|
60
61
|
return indexes;
|
|
61
62
|
}
|
|
62
|
-
exports.containsInsensitiveIndexes = containsInsensitiveIndexes;
|
|
@@ -8,7 +8,6 @@ exports.safeStringify = void 0;
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
const safeStringify = (obj, indent = 2) => {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
11
|
let cache = [];
|
|
13
12
|
const retVal = JSON.stringify(obj, (_key, value) => typeof value === 'object' && value !== null
|
|
14
13
|
? cache.includes(value)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringToObject =
|
|
3
|
+
exports.stringToObject = stringToObject;
|
|
4
4
|
/**
|
|
5
5
|
* object to string - can be used for querystring a=b&c=d etc
|
|
6
6
|
* @param raw eg a=b&c=d
|
|
@@ -17,4 +17,3 @@ function stringToObject(raw, splitKeyValue, splitKeys) {
|
|
|
17
17
|
});
|
|
18
18
|
return ret;
|
|
19
19
|
}
|
|
20
|
-
exports.stringToObject = stringToObject;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.redactString = redactString;
|
|
4
|
+
exports.redactObject = redactObject;
|
|
4
5
|
function redactString(str) {
|
|
5
6
|
let ret = str;
|
|
6
7
|
ret = ret || '';
|
|
@@ -11,7 +12,6 @@ function redactString(str) {
|
|
|
11
12
|
ret = ret.replace(/(eyJ[\w-_.]*\.[\w-_.]*\.[\w-_.]*)/gim, '<redacted>');
|
|
12
13
|
return ret;
|
|
13
14
|
}
|
|
14
|
-
exports.redactString = redactString;
|
|
15
15
|
function redactObject(ob) {
|
|
16
16
|
if (typeof ob === 'string') {
|
|
17
17
|
return redactString(ob);
|
|
@@ -19,6 +19,7 @@ function redactObject(ob) {
|
|
|
19
19
|
else if (typeof ob === 'object') {
|
|
20
20
|
try {
|
|
21
21
|
return JSON.parse(redactString(JSON.stringify(ob)));
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
23
|
}
|
|
23
24
|
catch (e) {
|
|
24
25
|
return ob;
|
|
@@ -26,4 +27,3 @@ function redactObject(ob) {
|
|
|
26
27
|
}
|
|
27
28
|
return ob;
|
|
28
29
|
}
|
|
29
|
-
exports.redactObject = redactObject;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.trimSide = trimSide;
|
|
4
|
+
exports.trim = trim;
|
|
4
5
|
function trimSide(str, fromStart = true, ...params) {
|
|
5
6
|
const pstr = params.join('');
|
|
6
7
|
if (!str) {
|
|
@@ -12,7 +13,6 @@ function trimSide(str, fromStart = true, ...params) {
|
|
|
12
13
|
}
|
|
13
14
|
return ret;
|
|
14
15
|
}
|
|
15
|
-
exports.trimSide = trimSide;
|
|
16
16
|
function trim(str, ...params) {
|
|
17
17
|
if (!str) {
|
|
18
18
|
return '';
|
|
@@ -21,4 +21,3 @@ function trim(str, ...params) {
|
|
|
21
21
|
str = trimSide(str, false, ...params);
|
|
22
22
|
return str;
|
|
23
23
|
}
|
|
24
|
-
exports.trim = trim;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.truncate =
|
|
3
|
+
exports.truncate = truncate;
|
|
4
4
|
/** truncate text */
|
|
5
5
|
function truncate(
|
|
6
6
|
/** string to truncate */
|
|
@@ -14,4 +14,3 @@ ellip = '...') {
|
|
|
14
14
|
}
|
|
15
15
|
return str.length > n ? str.substr(0, n - 1) + ellip : str;
|
|
16
16
|
}
|
|
17
|
-
exports.truncate = truncate;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripUrl = exports.
|
|
3
|
+
exports.stripUrl = exports.niceUrl = void 0;
|
|
4
|
+
exports.isValidUrl = isValidUrl;
|
|
4
5
|
const trim_1 = require("./trim");
|
|
5
6
|
/**
|
|
6
7
|
* removes protocol, and trailing slashes
|
|
@@ -22,12 +23,12 @@ function isValidUrl(raw) {
|
|
|
22
23
|
try {
|
|
23
24
|
const url = new URL(raw);
|
|
24
25
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
27
|
}
|
|
26
28
|
catch (_) {
|
|
27
29
|
return false;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
exports.isValidUrl = isValidUrl;
|
|
31
32
|
const stripUrl = (nu) => ({
|
|
32
33
|
hash: nu.hash,
|
|
33
34
|
host: nu.host,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.fetchFile =
|
|
15
|
+
exports.fetchFile = fetchFile;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
/**
|
|
18
18
|
* download(fetch) file
|
|
@@ -38,10 +38,10 @@ function fetchFile(p) {
|
|
|
38
38
|
yield write();
|
|
39
39
|
try {
|
|
40
40
|
fileStream.close();
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
42
|
}
|
|
42
43
|
catch (e) {
|
|
43
44
|
//
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
exports.fetchFile = fetchFile;
|
package/dist/node/helpers/fs.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getAllFiles = getAllFiles;
|
|
7
|
+
exports.getFileNameAndExtension = getFileNameAndExtension;
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
/**
|
|
@@ -33,7 +34,6 @@ function getAllFiles(dirPath, extension) {
|
|
|
33
34
|
getFilesRecursively(dirPath);
|
|
34
35
|
return files;
|
|
35
36
|
}
|
|
36
|
-
exports.getAllFiles = getAllFiles;
|
|
37
37
|
/**
|
|
38
38
|
* Extracts the file name and extension from a given file path.
|
|
39
39
|
*
|
|
@@ -50,4 +50,3 @@ function getFileNameAndExtension(filePath) {
|
|
|
50
50
|
directory,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
exports.getFileNameAndExtension = getFileNameAndExtension;
|
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
38
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Base';
|
|
2
|
-
export * from './types';
|
|
2
|
+
export type * from './types';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import type { JSX, KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
3
2
|
export declare const ButtonBase: import("@emotion/react").SerializedStyles;
|
|
4
3
|
export interface IButton {
|
|
5
4
|
title?: string;
|
|
@@ -12,4 +11,4 @@ export interface IButton {
|
|
|
12
11
|
href?: string;
|
|
13
12
|
colourTheme?: 'green' | 'red';
|
|
14
13
|
}
|
|
15
|
-
export declare const Button: (props: IButton) =>
|
|
14
|
+
export declare const Button: (props: IButton) => JSX.Element;
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Button = exports.ButtonBase = void 0;
|
|
8
|
-
/* eslint-disable react/destructuring-assignment */
|
|
9
8
|
const react_1 = require("@emotion/react");
|
|
10
9
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
11
10
|
const react_2 = __importDefault(require("react"));
|
|
@@ -61,10 +60,8 @@ const BaseA = styled_1.default.a `
|
|
|
61
60
|
`;
|
|
62
61
|
const Button = (props) => {
|
|
63
62
|
var _a, _b;
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
63
|
const Component = props.href
|
|
66
|
-
?
|
|
67
|
-
BaseA
|
|
64
|
+
? BaseA
|
|
68
65
|
: BaseButton;
|
|
69
66
|
return (react_2.default.createElement(Component, Object.assign({ className: props.className, "data-invert": props.invert, "data-disabled": (_a = props.disabled) !== null && _a !== void 0 ? _a : false, role: "button", title: props.title || undefined, "data-theme": (_b = props.colourTheme) !== null && _b !== void 0 ? _b : 'green' }, props), props.children));
|
|
70
67
|
};
|
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Dialog"), exports);
|
|
18
18
|
__exportStar(require("./Modal"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import type { CSSProperties, Dispatch, JSX, SetStateAction } from 'react';
|
|
3
2
|
import { TDarkMode, TDarkModeCalc } from './types';
|
|
4
3
|
export interface IDarkMode {
|
|
5
4
|
onSubmit?: (p: TDarkMode) => void;
|
|
@@ -25,6 +24,6 @@ export declare const UseDarkMode: ({ cookieDocument, }: {
|
|
|
25
24
|
*/
|
|
26
25
|
export declare const DarkModeAux: ({ iconSize, className, mode, onSubmit, style, dm, }: IDarkMode & {
|
|
27
26
|
dm: IUseDarkMode;
|
|
28
|
-
}) =>
|
|
27
|
+
}) => JSX.Element;
|
|
29
28
|
/** shows darkmode toggle. Persists to cookie, and modifies html classList with either dark-mode or light-mode */
|
|
30
|
-
export declare const DarkMode: (p: IDarkMode) =>
|
|
29
|
+
export declare const DarkMode: (p: IDarkMode) => JSX.Element;
|
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
38
|
};
|
|
@@ -131,6 +141,7 @@ const DarkModeAux = ({ iconSize = '2.5rem', className, mode, onSubmit, style, dm
|
|
|
131
141
|
if (className) {
|
|
132
142
|
document.getElementsByTagName('html')[0].classList.add(className);
|
|
133
143
|
}
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
134
145
|
}
|
|
135
146
|
catch (e) {
|
|
136
147
|
//
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
2
|
import type { IDropdownList } from './types';
|
|
3
|
-
export declare function DropdownList<T>(p: IDropdownList<T>):
|
|
3
|
+
export declare function DropdownList<T>(p: IDropdownList<T>): JSX.Element;
|
|
@@ -16,18 +16,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
38
|
};
|
|
29
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.DropdownList =
|
|
40
|
+
exports.DropdownList = DropdownList;
|
|
31
41
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
42
|
const react_1 = __importStar(require("react"));
|
|
33
43
|
const dom_1 = require("../../helpers/dom");
|
|
@@ -103,7 +113,7 @@ function DropdownList(p) {
|
|
|
103
113
|
const [state, setState] = (0, react_1.useState)(p.value);
|
|
104
114
|
const [open, setOpen] = (0, react_1.useState)(p.open);
|
|
105
115
|
const [bounced, setBounced] = (0, react_1.useState)(false);
|
|
106
|
-
(0, useOnClickOutside_1.useOnClickOutside)({ disabled: !open, ref, moveMouseOutside: false }, () => {
|
|
116
|
+
(0, useOnClickOutside_1.useOnClickOutside)({ disabled: !open, ref: ref, moveMouseOutside: false }, () => {
|
|
107
117
|
var _a;
|
|
108
118
|
setOpen(false);
|
|
109
119
|
setBounced(false);
|
|
@@ -166,4 +176,3 @@ function DropdownList(p) {
|
|
|
166
176
|
p.options.map((s, i) => (react_1.default.createElement(ListItem, { key: typeof s === 'string' ? s : p.renderF(s, i).key, render: p.renderF(s, i), onChange: () => p.onChange(s, i), selected: s === state })))),
|
|
167
177
|
openDisplay));
|
|
168
178
|
}
|
|
169
|
-
exports.DropdownList = DropdownList;
|