ag-common 0.0.894 → 0.0.896

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.
Files changed (236) hide show
  1. package/LICENSE.md +2 -3
  2. package/README.md +2 -2
  3. package/dist/api/helpers/acm.d.ts +1 -1
  4. package/dist/api/helpers/acm.js +3 -3
  5. package/dist/api/helpers/api.d.ts +2 -2
  6. package/dist/api/helpers/api.js +26 -22
  7. package/dist/api/helpers/apigw.js +4 -4
  8. package/dist/api/helpers/aws.js +2 -2
  9. package/dist/api/helpers/cosmos/delete.d.ts +1 -1
  10. package/dist/api/helpers/cosmos/delete.js +15 -16
  11. package/dist/api/helpers/cosmos/get.d.ts +3 -3
  12. package/dist/api/helpers/cosmos/get.js +26 -32
  13. package/dist/api/helpers/cosmos/index.d.ts +3 -3
  14. package/dist/api/helpers/cosmos/index.js +1 -1
  15. package/dist/api/helpers/cosmos/utils.d.ts +1 -1
  16. package/dist/api/helpers/cosmos/utils.js +3 -7
  17. package/dist/api/helpers/cosmos/write.d.ts +1 -1
  18. package/dist/api/helpers/cosmos/write.js +11 -12
  19. package/dist/api/helpers/dynamo/delete.d.ts +1 -1
  20. package/dist/api/helpers/dynamo/delete.js +3 -3
  21. package/dist/api/helpers/dynamo/get.d.ts +2 -2
  22. package/dist/api/helpers/dynamo/get.js +20 -14
  23. package/dist/api/helpers/dynamo/index.d.ts +10 -38
  24. package/dist/api/helpers/dynamo/index.js +4 -4
  25. package/dist/api/helpers/dynamo/set.d.ts +1 -1
  26. package/dist/api/helpers/dynamo/set.js +10 -10
  27. package/dist/api/helpers/dynamo/types.d.ts +3 -3
  28. package/dist/api/helpers/dynamo/types.js +1 -1
  29. package/dist/api/helpers/enforceDynamoProvisionCap.d.ts +13 -1
  30. package/dist/api/helpers/enforceDynamoProvisionCap.js +3 -4
  31. package/dist/api/helpers/google/apikey.js +1 -1
  32. package/dist/api/helpers/google/gemini.d.ts +1 -1
  33. package/dist/api/helpers/google/gemini.js +43 -45
  34. package/dist/api/helpers/google/index.d.ts +2 -2
  35. package/dist/api/helpers/index.d.ts +17 -17
  36. package/dist/api/helpers/retryOnError.js +6 -11
  37. package/dist/api/helpers/s3.d.ts +9 -9
  38. package/dist/api/helpers/s3.js +19 -16
  39. package/dist/api/helpers/ses.d.ts +1 -1
  40. package/dist/api/helpers/ses.js +9 -9
  41. package/dist/api/helpers/sqs.d.ts +1 -1
  42. package/dist/api/helpers/sqs.js +1 -1
  43. package/dist/api/helpers/ssm.d.ts +1 -1
  44. package/dist/api/helpers/ssm.js +2 -2
  45. package/dist/api/helpers/ssmInfra/apigw.d.ts +6 -6
  46. package/dist/api/helpers/ssmInfra/apigw.js +6 -10
  47. package/dist/api/helpers/ssmInfra/dynamo.d.ts +2 -2
  48. package/dist/api/helpers/ssmInfra/dynamo.js +1 -1
  49. package/dist/api/helpers/ssmInfra/index.d.ts +4 -4
  50. package/dist/api/helpers/ssmInfra/s3.d.ts +3 -3
  51. package/dist/api/helpers/ssmInfra/s3.js +1 -1
  52. package/dist/api/helpers/ssmInfra/sqs.d.ts +3 -3
  53. package/dist/api/helpers/ssmInfra/sqs.js +1 -1
  54. package/dist/api/helpers/sts.d.ts +1 -1
  55. package/dist/api/helpers/sts.js +4 -4
  56. package/dist/api/helpers/validations.d.ts +2 -2
  57. package/dist/api/helpers/validations.js +14 -14
  58. package/dist/api/helpers/zod.d.ts +1 -1
  59. package/dist/api/helpers/zod.js +21 -27
  60. package/dist/api/index.d.ts +2 -2
  61. package/dist/api/types/aws.d.ts +0 -56
  62. package/dist/api/types/aws.js +0 -1
  63. package/dist/api/types/index.d.ts +1 -1
  64. package/dist/common/helpers/array.js +9 -10
  65. package/dist/common/helpers/async.js +2 -2
  66. package/dist/common/helpers/binary.d.ts +1 -1
  67. package/dist/common/helpers/binary.js +1 -1
  68. package/dist/common/helpers/csv.d.ts +4 -2
  69. package/dist/common/helpers/csv.js +8 -12
  70. package/dist/common/helpers/date.d.ts +2 -4
  71. package/dist/common/helpers/date.js +2 -2
  72. package/dist/common/helpers/email.js +2 -2
  73. package/dist/common/helpers/fetch.js +8 -8
  74. package/dist/common/helpers/generator.js +2 -2
  75. package/dist/common/helpers/groupBy.js +0 -2
  76. package/dist/common/helpers/hashCode.js +2 -6
  77. package/dist/common/helpers/headers.d.ts +20 -20
  78. package/dist/common/helpers/headers.js +38 -38
  79. package/dist/common/helpers/i18n.d.ts +2 -2
  80. package/dist/common/helpers/i18n.js +5 -6
  81. package/dist/common/helpers/index.d.ts +25 -25
  82. package/dist/common/helpers/log.d.ts +1 -1
  83. package/dist/common/helpers/log.js +30 -30
  84. package/dist/common/helpers/math.d.ts +2 -2
  85. package/dist/common/helpers/math.js +6 -6
  86. package/dist/common/helpers/memo.d.ts +1 -1
  87. package/dist/common/helpers/memo.js +1 -3
  88. package/dist/common/helpers/node-cache.d.ts +2 -2
  89. package/dist/common/helpers/node-cache.js +0 -1
  90. package/dist/common/helpers/object.d.ts +1 -1
  91. package/dist/common/helpers/object.js +16 -27
  92. package/dist/common/helpers/secondsInNearest.js +5 -5
  93. package/dist/common/helpers/stream.js +4 -6
  94. package/dist/common/helpers/string/base64.js +2 -2
  95. package/dist/common/helpers/string/chunk.js +1 -1
  96. package/dist/common/helpers/string/contains.js +1 -3
  97. package/dist/common/helpers/string/getExtendedStringSegment.js +1 -1
  98. package/dist/common/helpers/string/index.d.ts +11 -11
  99. package/dist/common/helpers/string/json.js +1 -1
  100. package/dist/common/helpers/string/redact.js +38 -39
  101. package/dist/common/helpers/string/trim.js +4 -4
  102. package/dist/common/helpers/string/truncate.js +1 -1
  103. package/dist/common/helpers/string/url.js +7 -8
  104. package/dist/common/helpers/withRetry.js +7 -7
  105. package/dist/common/helpers/xml.d.ts +7 -3
  106. package/dist/common/helpers/xml.js +33 -36
  107. package/dist/common/index.d.ts +2 -2
  108. package/dist/index.d.ts +3 -3
  109. package/dist/node/helpers/fetch.js +1 -2
  110. package/dist/node/helpers/fs.js +2 -2
  111. package/dist/node/helpers/index.d.ts +2 -2
  112. package/dist/node/index.d.ts +1 -1
  113. package/dist/ui/components/DarkMode/Base.d.ts +4 -4
  114. package/dist/ui/components/DarkMode/Base.js +26 -31
  115. package/dist/ui/components/DarkMode/index.d.ts +2 -2
  116. package/dist/ui/components/DarkMode/types.d.ts +5 -5
  117. package/dist/ui/components/HeadersRaw/index.d.ts +2 -2
  118. package/dist/ui/components/HeadersRaw/index.js +5 -5
  119. package/dist/ui/components/Markdown/index.d.ts +1 -1
  120. package/dist/ui/components/Markdown/index.js +10 -10
  121. package/dist/ui/components/index.d.ts +4 -4
  122. package/dist/ui/components/shadcn/accordion.d.ts +4 -4
  123. package/dist/ui/components/shadcn/accordion.js +6 -6
  124. package/dist/ui/components/shadcn/alert.d.ts +2 -2
  125. package/dist/ui/components/shadcn/alert.js +6 -6
  126. package/dist/ui/components/shadcn/avatar.d.ts +2 -2
  127. package/dist/ui/components/shadcn/avatar.js +4 -4
  128. package/dist/ui/components/shadcn/button.d.ts +4 -4
  129. package/dist/ui/components/shadcn/button.js +14 -14
  130. package/dist/ui/components/shadcn/card.d.ts +2 -2
  131. package/dist/ui/components/shadcn/card.js +6 -6
  132. package/dist/ui/components/shadcn/checkbox.d.ts +2 -2
  133. package/dist/ui/components/shadcn/checkbox.js +3 -3
  134. package/dist/ui/components/shadcn/dialog.d.ts +10 -10
  135. package/dist/ui/components/shadcn/dialog.js +9 -11
  136. package/dist/ui/components/shadcn/divider.d.ts +1 -1
  137. package/dist/ui/components/shadcn/divider.js +1 -1
  138. package/dist/ui/components/shadcn/dropdown-list.d.ts +1 -1
  139. package/dist/ui/components/shadcn/dropdown-list.js +5 -5
  140. package/dist/ui/components/shadcn/dropdown-menu.d.ts +6 -6
  141. package/dist/ui/components/shadcn/dropdown-menu.js +11 -11
  142. package/dist/ui/components/shadcn/index.d.ts +21 -21
  143. package/dist/ui/components/shadcn/input-selector.d.ts +1 -1
  144. package/dist/ui/components/shadcn/input-selector.js +10 -12
  145. package/dist/ui/components/shadcn/input.d.ts +1 -1
  146. package/dist/ui/components/shadcn/input.js +1 -1
  147. package/dist/ui/components/shadcn/label.d.ts +3 -3
  148. package/dist/ui/components/shadcn/label.js +2 -2
  149. package/dist/ui/components/shadcn/popover.d.ts +2 -2
  150. package/dist/ui/components/shadcn/popover.js +3 -3
  151. package/dist/ui/components/shadcn/radio-group.d.ts +2 -2
  152. package/dist/ui/components/shadcn/radio-group.js +2 -2
  153. package/dist/ui/components/shadcn/scroll-area.d.ts +2 -2
  154. package/dist/ui/components/shadcn/scroll-area.js +3 -5
  155. package/dist/ui/components/shadcn/select.d.ts +2 -2
  156. package/dist/ui/components/shadcn/select.js +12 -12
  157. package/dist/ui/components/shadcn/sheet.d.ts +12 -12
  158. package/dist/ui/components/shadcn/sheet.js +15 -15
  159. package/dist/ui/components/shadcn/switch.d.ts +2 -2
  160. package/dist/ui/components/shadcn/switch.js +3 -3
  161. package/dist/ui/components/shadcn/textarea.d.ts +1 -1
  162. package/dist/ui/components/shadcn/textarea.js +1 -1
  163. package/dist/ui/components/shadcn/toast.d.ts +2 -2
  164. package/dist/ui/components/shadcn/toast.js +25 -25
  165. package/dist/ui/helpers/cognito.d.ts +1 -1
  166. package/dist/ui/helpers/cookie/const.js +1 -1
  167. package/dist/ui/helpers/cookie/get.js +3 -4
  168. package/dist/ui/helpers/cookie/index.d.ts +5 -5
  169. package/dist/ui/helpers/cookie/raw.d.ts +1 -1
  170. package/dist/ui/helpers/cookie/raw.js +8 -9
  171. package/dist/ui/helpers/cookie/use.d.ts +1 -1
  172. package/dist/ui/helpers/cookie/use.js +4 -4
  173. package/dist/ui/helpers/date.js +8 -8
  174. package/dist/ui/helpers/debounce.js +1 -1
  175. package/dist/ui/helpers/dom.d.ts +1 -1
  176. package/dist/ui/helpers/dom.js +4 -14
  177. package/dist/ui/helpers/index.d.ts +26 -26
  178. package/dist/ui/helpers/jwt.d.ts +3 -3
  179. package/dist/ui/helpers/openDialog.d.ts +2 -2
  180. package/dist/ui/helpers/openDialog.js +8 -8
  181. package/dist/ui/helpers/plural.js +1 -1
  182. package/dist/ui/helpers/routes.d.ts +2 -2
  183. package/dist/ui/helpers/routes.js +14 -15
  184. package/dist/ui/helpers/serviceWorker.js +1 -1
  185. package/dist/ui/helpers/useContextMenu.d.ts +1 -1
  186. package/dist/ui/helpers/useContextMenu.js +9 -10
  187. package/dist/ui/helpers/useElementAttribute.js +3 -5
  188. package/dist/ui/helpers/useGranularHook.d.ts +1 -1
  189. package/dist/ui/helpers/useGranularHook.js +2 -3
  190. package/dist/ui/helpers/useInterval.d.ts +2 -2
  191. package/dist/ui/helpers/useInterval.js +2 -2
  192. package/dist/ui/helpers/useIsInViewport.d.ts +1 -1
  193. package/dist/ui/helpers/useIsInViewport.js +0 -1
  194. package/dist/ui/helpers/useLocalStorage.js +6 -6
  195. package/dist/ui/helpers/useLockBodyScroll.js +2 -2
  196. package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
  197. package/dist/ui/helpers/useOnClickOutside.js +3 -6
  198. package/dist/ui/helpers/useOnScroll.d.ts +1 -1
  199. package/dist/ui/helpers/useOnScroll.js +3 -4
  200. package/dist/ui/helpers/useOverloadPageSearch.js +8 -10
  201. package/dist/ui/helpers/useQueryString.js +7 -7
  202. package/dist/ui/helpers/useResize.js +5 -6
  203. package/dist/ui/helpers/useTimeout.js +1 -1
  204. package/dist/ui/helpers/useTooltip.d.ts +2 -2
  205. package/dist/ui/helpers/useTooltip.js +5 -7
  206. package/dist/ui/helpers/utils.d.ts +2 -2
  207. package/dist/ui/icons/Checkmark.d.ts +2 -2
  208. package/dist/ui/icons/Checkmark.js +1 -1
  209. package/dist/ui/icons/ChevronRight.d.ts +1 -1
  210. package/dist/ui/icons/Circle.d.ts +2 -2
  211. package/dist/ui/icons/Circle.js +1 -1
  212. package/dist/ui/icons/CircleDot.d.ts +2 -2
  213. package/dist/ui/icons/Cog.d.ts +2 -2
  214. package/dist/ui/icons/Computer.d.ts +2 -2
  215. package/dist/ui/icons/Door.d.ts +1 -1
  216. package/dist/ui/icons/Hamburger.d.ts +1 -1
  217. package/dist/ui/icons/HorizontalDots.d.ts +1 -1
  218. package/dist/ui/icons/House.d.ts +2 -2
  219. package/dist/ui/icons/Magnify.d.ts +2 -2
  220. package/dist/ui/icons/Magnify.js +1 -1
  221. package/dist/ui/icons/Moon.d.ts +2 -2
  222. package/dist/ui/icons/Pencil.d.ts +1 -1
  223. package/dist/ui/icons/Save.d.ts +1 -1
  224. package/dist/ui/icons/Sun.d.ts +1 -1
  225. package/dist/ui/icons/Sun.js +1 -1
  226. package/dist/ui/icons/Undo.d.ts +1 -1
  227. package/dist/ui/icons/UserOutline.d.ts +1 -1
  228. package/dist/ui/icons/Warning.d.ts +2 -2
  229. package/dist/ui/icons/Warning.js +1 -1
  230. package/dist/ui/icons/index.d.ts +32 -74
  231. package/dist/ui/index.d.ts +3 -3
  232. package/dist/ui/styles/colours.js +29 -29
  233. package/dist/ui/styles/common.d.ts +1 -1
  234. package/dist/ui/styles/common.js +10 -10
  235. package/dist/ui/styles/index.d.ts +3 -3
  236. package/package.json +65 -75
@@ -1,5 +1,5 @@
1
- export * from './const';
2
- export * from './get';
3
- export * from './raw';
4
- export * from './set';
5
- export * from './use';
1
+ export * from "./const";
2
+ export * from "./get";
3
+ export * from "./raw";
4
+ export * from "./set";
5
+ export * from "./use";
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export declare const getAllCookies: (cookieString?: string) => Partial<Record<string, string>>;
7
7
  /** get a cookie by name*/
8
- export declare const getCookie: ({ name, cookieDocument, }: {
8
+ export declare const getCookie: ({ name, cookieDocument }: {
9
9
  name: string;
10
10
  cookieDocument?: string;
11
11
  }) => string | undefined;
@@ -15,16 +15,16 @@ const getAllCookies = (cookieString) => {
15
15
  if (!cookieString) {
16
16
  return cookieKeyValuePairs;
17
17
  }
18
- const cookieArr = cookieString.split(';');
18
+ const cookieArr = cookieString.split(";");
19
19
  for (let i = 0; i < cookieArr.length; i++) {
20
- const cookieKeyValue = cookieArr[i].split('=');
20
+ const cookieKeyValue = cookieArr[i].split("=");
21
21
  cookieKeyValuePairs[cookieKeyValue[0].trim()] = cookieKeyValue[1]?.trim();
22
22
  }
23
23
  return cookieKeyValuePairs;
24
24
  };
25
25
  exports.getAllCookies = getAllCookies;
26
26
  /** get a cookie by name*/
27
- const getCookie = ({ name, cookieDocument, }) => (0, exports.getAllCookies)(cookieDocument)[name];
27
+ const getCookie = ({ name, cookieDocument }) => (0, exports.getAllCookies)(cookieDocument)[name];
28
28
  exports.getCookie = getCookie;
29
29
  /**
30
30
  * Sets a cookie with the specified name and value
@@ -32,28 +32,27 @@ exports.getCookie = getCookie;
32
32
  * @returns
33
33
  */
34
34
  function setCookie({ name, value, expiryDays = 1, }) {
35
- if (typeof window === 'undefined') {
35
+ if (typeof window === "undefined") {
36
36
  return;
37
37
  }
38
38
  const d = new Date();
39
39
  d.setTime(d.getTime() + expiryDays * 24 * 60 * 60 * 1000);
40
40
  const expires = `expires=${!value || expiryDays < 0 ? const_1.expireDate : d.toUTCString()}`;
41
- document.cookie = `${name}=${!value ? '' : value};${expires};path=/; SameSite=Strict; Secure`;
41
+ document.cookie = `${name}=${!value ? "" : value};${expires};path=/; SameSite=Strict; Secure`;
42
42
  }
43
43
  /** delete all non httponly cookies */
44
44
  function wipeCookies(name) {
45
- if (typeof window === 'undefined') {
46
- (0, log_1.warn)('cant wipe cookies on server');
45
+ if (typeof window === "undefined") {
46
+ (0, log_1.warn)("cant wipe cookies on server");
47
47
  return;
48
48
  }
49
49
  let currentCount = 0;
50
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
51
50
  while (true) {
52
51
  if ((0, exports.getCookie)({
53
52
  name: name + currentCount,
54
53
  cookieDocument: document.cookie,
55
54
  })) {
56
- setCookie({ name: name + currentCount, value: '', expiryDays: -1 });
55
+ setCookie({ name: name + currentCount, value: "", expiryDays: -1 });
57
56
  currentCount += 1;
58
57
  }
59
58
  else {
@@ -1,4 +1,4 @@
1
- import type { ReturnType, TParse } from './const';
1
+ import type { ReturnType, TParse } from "./const";
2
2
  export declare function useCookie<T>(p: {
3
3
  defaultValue: T;
4
4
  name: string;
@@ -31,21 +31,21 @@ function useCookie(p) {
31
31
  }
32
32
  const useCookieString = (p) => useCookie({
33
33
  ...p,
34
- parse: (s) => s ?? '',
34
+ parse: (s) => s ?? "",
35
35
  stringify: (s) => s,
36
- defaultValue: p.defaultValue ?? '',
36
+ defaultValue: p.defaultValue ?? "",
37
37
  });
38
38
  exports.useCookieString = useCookieString;
39
39
  const useCookieNumber = (p) => useCookie({
40
40
  ...p,
41
41
  parse: (s) => (!s ? undefined : Number.parseFloat(s)),
42
- stringify: (s) => (!s ? '' : s.toString()),
42
+ stringify: (s) => (!s ? "" : s.toString()),
43
43
  defaultValue: p.defaultValue,
44
44
  });
45
45
  exports.useCookieNumber = useCookieNumber;
46
46
  const useCookieBoolean = (p) => useCookie({
47
47
  ...p,
48
- parse: (s) => s === 'true',
48
+ parse: (s) => s === "true",
49
49
  stringify: (s) => s.toString(),
50
50
  });
51
51
  exports.useCookieBoolean = useCookieBoolean;
@@ -12,25 +12,25 @@ const plural_1 = require("./plural");
12
12
  const dateDiffToString = (lowDate, highDate) => {
13
13
  const d = (0, date_1.dateDiff)(lowDate, highDate ?? new Date());
14
14
  if (isNaN(d.totalYears)) {
15
- return '';
15
+ return "";
16
16
  }
17
- let ts = `${d.totalYears} ${(0, plural_1.plural)('yr', d.totalYears)} ago `;
17
+ let ts = `${d.totalYears} ${(0, plural_1.plural)("yr", d.totalYears)} ago `;
18
18
  if (d.totalMinutes < 60) {
19
- ts = `${d.totalMinutes} ${(0, plural_1.plural)('min', d.totalMinutes)} ago `;
19
+ ts = `${d.totalMinutes} ${(0, plural_1.plural)("min", d.totalMinutes)} ago `;
20
20
  }
21
21
  else if (d.totalHours < 24) {
22
- ts = `${d.totalHours} ${(0, plural_1.plural)('hr', d.totalHours)} ago `;
22
+ ts = `${d.totalHours} ${(0, plural_1.plural)("hr", d.totalHours)} ago `;
23
23
  }
24
24
  else if (d.totalDays < 365) {
25
- ts = `${d.totalDays} ${(0, plural_1.plural)('day', d.totalDays)} ago `;
25
+ ts = `${d.totalDays} ${(0, plural_1.plural)("day", d.totalDays)} ago `;
26
26
  }
27
27
  return ts;
28
28
  };
29
29
  exports.dateDiffToString = dateDiffToString;
30
30
  const getDMY = (date, opt) => {
31
31
  const date1 = (0, date_1.addDays)(date, opt?.dayOffset ?? 0);
32
- const d = String(date1.getDate()).padStart(2, '0');
33
- const m = String(date1.getMonth() + 1).padStart(2, '0'); // January is 0!
32
+ const d = String(date1.getDate()).padStart(2, "0");
33
+ const m = String(date1.getMonth() + 1).padStart(2, "0"); // January is 0!
34
34
  const y = date1.getFullYear();
35
35
  if (opt?.short) {
36
36
  return `${y.toString().substring(2, 4)}-${m}-${d}`;
@@ -45,6 +45,6 @@ const isDate = (d) => {
45
45
  return false;
46
46
  }
47
47
  }
48
- return new Date(d).toString() !== 'Invalid Date';
48
+ return new Date(d).toString() !== "Invalid Date";
49
49
  };
50
50
  exports.isDate = isDate;
@@ -1,5 +1,5 @@
1
- 'use client';
2
1
  "use strict";
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useDebounce = useDebounce;
5
5
  exports.debounce = debounce;
@@ -5,5 +5,5 @@ export declare const convertRemToPixels: (rem: number) => number;
5
5
  * @param p
6
6
  * @returns
7
7
  */
8
- export declare const filterDataProps: (p: any) => Record<string, string>;
8
+ export declare const filterDataProps: (p: Record<string, unknown>) => Record<string, unknown>;
9
9
  export declare const isRightClick: (event: MouseEvent | TouchEvent) => boolean;
@@ -10,8 +10,8 @@ const domContains = (e, x, y) => {
10
10
  };
11
11
  exports.domContains = domContains;
12
12
  const convertRemToPixels = (rem) => {
13
- let fontSize = '16px';
14
- if (typeof window !== 'undefined') {
13
+ let fontSize = "16px";
14
+ if (typeof window !== "undefined") {
15
15
  fontSize = getComputedStyle(document.documentElement).fontSize;
16
16
  }
17
17
  return rem * parseFloat(fontSize);
@@ -22,24 +22,14 @@ exports.convertRemToPixels = convertRemToPixels;
22
22
  * @param p
23
23
  * @returns
24
24
  */
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
25
  const filterDataProps = (p) => {
27
26
  const x = Object.entries(p)
28
- .filter((r) => r[0].startsWith('data-'))
27
+ .filter((r) => r[0].startsWith("data-"))
29
28
  .map((r) => r);
30
29
  return (0, array_1.arrayToObject)(x, (s) => s[0], (s) => s[1]);
31
30
  };
32
31
  exports.filterDataProps = filterDataProps;
33
32
  const isRightClick = (event) => {
34
- //
35
- let isRightMB = false;
36
- if ('which' in event)
37
- // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
38
- isRightMB = event.which == 3;
39
- else if ('button' in event)
40
- // IE, Opera
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- isRightMB = event.button == 2;
43
- return isRightMB;
33
+ return "button" in event && event.button === 2;
44
34
  };
45
35
  exports.isRightClick = isRightClick;
@@ -1,26 +1,26 @@
1
- export type * from './cognito';
2
- export * from './cookie';
3
- export * from './date';
4
- export * from './debounce';
5
- export * from './dom';
6
- export * from './extractAttributes';
7
- export type * from './jwt';
8
- export * from './openDialog';
9
- export * from './plural';
10
- export * from './routes';
11
- export * from './serviceWorker';
12
- export * from './useContextMenu';
13
- export * from './useElementAttribute';
14
- export * from './useGranularHook';
15
- export * from './useInterval';
16
- export * from './useIsInViewport';
17
- export * from './useLocalStorage';
18
- export * from './useLockBodyScroll';
19
- export * from './useOnClickOutside';
20
- export * from './useOnScroll';
21
- export * from './useOverloadPageSearch';
22
- export * from './useQueryString';
23
- export * from './useResize';
24
- export * from './useTimeout';
25
- export * from './useTooltip';
26
- export * from './utils';
1
+ export type * from "./cognito";
2
+ export * from "./cookie";
3
+ export * from "./date";
4
+ export * from "./debounce";
5
+ export * from "./dom";
6
+ export * from "./extractAttributes";
7
+ export type * from "./jwt";
8
+ export * from "./openDialog";
9
+ export * from "./plural";
10
+ export * from "./routes";
11
+ export * from "./serviceWorker";
12
+ export * from "./useContextMenu";
13
+ export * from "./useElementAttribute";
14
+ export * from "./useGranularHook";
15
+ export * from "./useInterval";
16
+ export * from "./useIsInViewport";
17
+ export * from "./useLocalStorage";
18
+ export * from "./useLockBodyScroll";
19
+ export * from "./useOnClickOutside";
20
+ export * from "./useOnScroll";
21
+ export * from "./useOverloadPageSearch";
22
+ export * from "./useQueryString";
23
+ export * from "./useResize";
24
+ export * from "./useTimeout";
25
+ export * from "./useTooltip";
26
+ export * from "./utils";
@@ -18,9 +18,9 @@ export interface IdJwt {
18
18
  at_hash: string;
19
19
  aud: string;
20
20
  auth_time: number;
21
- 'cognito:groups': string[];
22
- 'cognito:preferred_role': string;
23
- 'cognito:username': string;
21
+ "cognito:groups": string[];
22
+ "cognito:preferred_role": string;
23
+ "cognito:username": string;
24
24
  email: string;
25
25
  exp: number;
26
26
  iat: number;
@@ -1,8 +1,8 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactNode } from "react";
2
2
  type DialogAction = {
3
3
  label: string;
4
4
  onClick?: () => void;
5
- variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
5
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
6
6
  };
7
7
  type DialogConfig = {
8
8
  key: string;
@@ -41,13 +41,13 @@ const button_1 = require("../components/shadcn/button");
41
41
  const dialog_1 = require("../components/shadcn/dialog");
42
42
  const openDialog = (config) => {
43
43
  return new Promise((resolve) => {
44
- const idName = 'dialog-' + config.key;
45
- if (document.body.querySelectorAll('#' + idName).length !== 0) {
46
- (0, log_1.error)('Dialog already open:' + idName);
44
+ const idName = "dialog-" + config.key;
45
+ if (document.body.querySelectorAll("#" + idName).length !== 0) {
46
+ (0, log_1.error)("Dialog already open:" + idName);
47
47
  resolve(undefined);
48
48
  return;
49
49
  }
50
- const wrapper = document.body.appendChild(document.createElement('div'));
50
+ const wrapper = document.body.appendChild(document.createElement("div"));
51
51
  wrapper.id = idName;
52
52
  const root = (0, client_1.createRoot)(wrapper);
53
53
  const onAction = (actionLabel) => {
@@ -60,14 +60,14 @@ const openDialog = (config) => {
60
60
  wrapper.remove();
61
61
  }
62
62
  catch (e) {
63
- (0, log_1.error)('Error unmounting dialog', e);
63
+ (0, log_1.error)("Error unmounting dialog", e);
64
64
  }
65
65
  }
66
66
  };
67
67
  const DialogComponent = () => {
68
68
  const [open, setOpen] = (0, react_1.useState)(true);
69
69
  (0, react_1.useEffect)(() => {
70
- if ('asyncAction' in config) {
70
+ if ("asyncAction" in config) {
71
71
  void config.asyncAction().then(() => {
72
72
  onAction(undefined);
73
73
  });
@@ -83,10 +83,10 @@ const openDialog = (config) => {
83
83
  react_1.default.createElement(dialog_1.DialogTitle, null, config.title),
84
84
  react_1.default.createElement(dialog_1.DialogDescription, null),
85
85
  config.content({ onClose: () => onAction() }),
86
- 'actions' in config && (react_1.default.createElement(dialog_1.DialogFooter, null, config.actions.map((action) => (react_1.default.createElement(button_1.Button, { key: action.label, onClick: () => {
86
+ "actions" in config && (react_1.default.createElement(dialog_1.DialogFooter, null, config.actions.map((action) => (react_1.default.createElement(button_1.Button, { key: action.label, onClick: () => {
87
87
  action.onClick?.();
88
88
  onAction(action);
89
- }, variant: action.variant || 'default', className: "cursor-pointer" }, action.label))))))));
89
+ }, variant: action.variant || "default", className: "cursor-pointer" }, action.label))))))));
90
90
  };
91
91
  root.render(react_1.default.createElement(DialogComponent, null));
92
92
  });
@@ -5,7 +5,7 @@ function plural(word, count) {
5
5
  if (!word || !count) {
6
6
  return word;
7
7
  }
8
- if (count > 1 && !['s', 'g'].find((w) => word.endsWith(w))) {
8
+ if (count > 1 && !["s", "g"].find((w) => word.endsWith(w))) {
9
9
  return `${word}s`;
10
10
  }
11
11
  return word;
@@ -1,5 +1,5 @@
1
- import type { TLang } from '../../common/helpers/i18n';
2
- export type TProtocol = 'http:' | 'https:';
1
+ import type { TLang } from "../../common/helpers/i18n";
2
+ export type TProtocol = "http:" | "https:";
3
3
  export interface URLLite {
4
4
  hash: string;
5
5
  host: string;
@@ -6,33 +6,32 @@ const i18n_1 = require("../../common/helpers/i18n");
6
6
  const object_1 = require("../../common/helpers/object");
7
7
  const object_2 = require("../../common/helpers/string/object");
8
8
  const url_1 = require("../../common/helpers/string/url");
9
- const calculateServerHref = ({ host, pathname, }) => {
9
+ const calculateServerHref = ({ host, pathname }) => {
10
10
  if (!host) {
11
11
  return undefined;
12
12
  }
13
- let href = '';
14
- if (host.includes('localhost')) {
15
- href += 'http://';
13
+ let href = "";
14
+ if (host.includes("localhost")) {
15
+ href += "http://";
16
16
  }
17
17
  else {
18
- href += 'https://';
18
+ href += "https://";
19
19
  }
20
20
  href += host + pathname;
21
21
  return decodeURIComponent(href);
22
22
  };
23
23
  const getRenderLanguage = (host) => {
24
24
  if (!host) {
25
- return 'en';
25
+ return "en";
26
26
  }
27
- const l = i18n_1.AllLang.find((l) => host.startsWith(l + '.'));
27
+ const l = i18n_1.AllLang.find((l) => host.startsWith(l + "."));
28
28
  if (l) {
29
29
  return l;
30
30
  }
31
- return 'en';
31
+ return "en";
32
32
  };
33
33
  exports.getRenderLanguage = getRenderLanguage;
34
- const getQuery = (url) => (0, object_2.stringToObject)((0, common_1.trimSide)(decodeURIComponent(url.search.replace(/\+/g, '%20')), true, '?') ||
35
- '', '=', '&');
34
+ const getQuery = (url) => (0, object_2.stringToObject)((0, common_1.trimSide)(decodeURIComponent(url.search.replace(/\+/g, "%20")), true, "?") || "", "=", "&");
36
35
  const getClientReqHref = () => {
37
36
  const nu = new URL(window.location.href);
38
37
  const url = (0, url_1.stripUrl)(nu);
@@ -47,11 +46,11 @@ exports.getClientReqHref = getClientReqHref;
47
46
  * @returns
48
47
  */
49
48
  const getClientOrServerReqHref = ({ url, query, userAgent, }) => {
50
- if (typeof window !== 'undefined') {
49
+ if (typeof window !== "undefined") {
51
50
  return (0, exports.getClientReqHref)();
52
51
  }
53
52
  if (!url) {
54
- throw new Error('no href');
53
+ throw new Error("no href");
55
54
  }
56
55
  return {
57
56
  url,
@@ -59,7 +58,7 @@ const getClientOrServerReqHref = ({ url, query, userAgent, }) => {
59
58
  ...query,
60
59
  ...getQuery(url),
61
60
  },
62
- userAgent: userAgent ?? '?',
61
+ userAgent: userAgent ?? "?",
63
62
  lang: (0, exports.getRenderLanguage)(url.host),
64
63
  };
65
64
  };
@@ -70,14 +69,14 @@ exports.getClientOrServerReqHref = getClientOrServerReqHref;
70
69
  */
71
70
  const getServerReq = ({ pathname, query, headers, }) => {
72
71
  const href = calculateServerHref({
73
- host: headers.host || 'testhost',
72
+ host: headers.host || "testhost",
74
73
  pathname,
75
74
  });
76
75
  const parsedQuery = Object.keys(query).length === 0 ? {} : (0, object_1.castStringlyObject)(query);
77
76
  const ret = (0, exports.getClientOrServerReqHref)({
78
77
  url: !href ? undefined : new URL(href),
79
78
  query: parsedQuery,
80
- userAgent: headers['user-agent']?.toLowerCase(),
79
+ userAgent: headers["user-agent"]?.toLowerCase(),
81
80
  });
82
81
  return ret;
83
82
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uninstallServiceWorkers = uninstallServiceWorkers;
4
4
  const async_1 = require("../../common/helpers/async");
5
5
  async function uninstallServiceWorkers() {
6
- if (typeof navigator === 'undefined') {
6
+ if (typeof navigator === "undefined") {
7
7
  return;
8
8
  }
9
9
  await navigator.serviceWorker
@@ -1,4 +1,4 @@
1
- export declare const useContextMenu: ({ ref, }: {
1
+ export declare const useContextMenu: ({ ref }: {
2
2
  ref: React.RefObject<HTMLDivElement | null>;
3
3
  }) => {
4
4
  xPos: string;
@@ -1,11 +1,11 @@
1
- 'use client';
2
1
  "use strict";
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useContextMenu = void 0;
5
5
  const react_1 = require("react");
6
- const useContextMenu = ({ ref, }) => {
7
- const [xPos, setXPos] = (0, react_1.useState)('0px');
8
- const [yPos, setYPos] = (0, react_1.useState)('0px');
6
+ const useContextMenu = ({ ref }) => {
7
+ const [xPos, setXPos] = (0, react_1.useState)("0px");
8
+ const [yPos, setYPos] = (0, react_1.useState)("0px");
9
9
  const [showMenu, setShowMenu] = (0, react_1.useState)(false);
10
10
  const handleContextMenu = (0, react_1.useCallback)((e) => {
11
11
  if (!e.target) {
@@ -26,15 +26,14 @@ const useContextMenu = ({ ref, }) => {
26
26
  setShowMenu(false);
27
27
  }, [showMenu]);
28
28
  (0, react_1.useEffect)(() => {
29
- document.addEventListener('click', handleClick);
30
- document.addEventListener('contextmenu', handleContextMenu);
29
+ document.addEventListener("click", handleClick);
30
+ document.addEventListener("contextmenu", handleContextMenu);
31
31
  return () => {
32
32
  try {
33
- document.addEventListener('click', handleClick);
34
- document.removeEventListener('contextmenu', handleContextMenu);
35
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ document.addEventListener("click", handleClick);
34
+ document.removeEventListener("contextmenu", handleContextMenu);
36
35
  }
37
- catch (e) {
36
+ catch {
38
37
  //
39
38
  }
40
39
  };
@@ -1,5 +1,5 @@
1
- 'use client';
2
1
  "use strict";
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useElementAttribute = useElementAttribute;
5
5
  const react_1 = require("react");
@@ -19,17 +19,15 @@ function useElementAttribute({ enabled, key, value, element, }) {
19
19
  else {
20
20
  element.removeAttribute(key);
21
21
  }
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
22
  }
24
- catch (e) {
23
+ catch {
25
24
  //
26
25
  }
27
26
  return () => {
28
27
  try {
29
28
  element.removeAttribute(key);
30
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
29
  }
32
- catch (e) {
30
+ catch {
33
31
  //
34
32
  }
35
33
  };
@@ -1,4 +1,4 @@
1
- import type { DependencyList, EffectCallback } from 'react';
1
+ import type { DependencyList, EffectCallback } from "react";
2
2
  type HookWithDependencies<C, R> = (callback: C, deps: DependencyList) => R;
3
3
  export declare const useGranularHook: <T extends HookWithDependencies<C, ReturnType<T>>, C>(hook: T, callback: C, primaryDeps: DependencyList, secondaryDeps: DependencyList) => ReturnType<T>;
4
4
  export declare const useGranularEffect: (effect: EffectCallback, primaryDeps: DependencyList, secondaryDeps: DependencyList) => void;
@@ -1,12 +1,11 @@
1
- 'use client';
2
1
  "use strict";
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useGranularEffect = exports.useGranularHook = void 0;
5
5
  const react_1 = require("react");
6
6
  const useGranularHook = (hook, callback, primaryDeps, secondaryDeps) => {
7
7
  const ref = (0, react_1.useRef)(null);
8
- if (!ref.current ||
9
- !primaryDeps.every((w, i) => Object.is(w, ref.current?.[i])))
8
+ if (!ref.current || !primaryDeps.every((w, i) => Object.is(w, ref.current?.[i])))
10
9
  ref.current = [...primaryDeps, ...secondaryDeps];
11
10
  return hook(callback, ref.current);
12
11
  };
@@ -1,5 +1,5 @@
1
- import { useEffect } from 'react';
2
- export declare const useIsomorphicLayoutEffect: typeof useEffect;
1
+ import { useLayoutEffect } from "react";
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
3
3
  export default useIsomorphicLayoutEffect;
4
4
  export declare function useInterval<T>(callback: () => T,
5
5
  /** ms delay */
@@ -1,10 +1,10 @@
1
- 'use client';
2
1
  "use strict";
2
+ "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.useIsomorphicLayoutEffect = void 0;
5
5
  exports.useInterval = useInterval;
6
6
  const react_1 = require("react");
7
- exports.useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
7
+ exports.useIsomorphicLayoutEffect = typeof window !== "undefined" ? react_1.useLayoutEffect : react_1.useEffect;
8
8
  exports.default = exports.useIsomorphicLayoutEffect;
9
9
  function useInterval(callback,
10
10
  /** ms delay */
@@ -1,2 +1,2 @@
1
- import type { RefObject } from 'react';
1
+ import type { RefObject } from "react";
2
2
  export declare function useIsInViewport(ref: RefObject<HTMLElement>): boolean;
@@ -8,7 +8,6 @@ function useIsInViewport(ref) {
8
8
  const observer = new IntersectionObserver((entries) => {
9
9
  setIsInViewport(entries[0].isIntersecting);
10
10
  });
11
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
12
11
  if (ref.current) {
13
12
  observer.observe(ref.current);
14
13
  }
@@ -7,20 +7,20 @@ const date_1 = require("../../common/helpers/date");
7
7
  const log_1 = require("../../common/helpers/log");
8
8
  const object_1 = require("../../common/helpers/object");
9
9
  const clearLocalStorageItem = (key) => {
10
- if (typeof window === 'undefined') {
10
+ if (typeof window === "undefined") {
11
11
  return;
12
12
  }
13
13
  try {
14
14
  window.localStorage.removeItem(key);
15
15
  }
16
16
  catch (e) {
17
- (0, log_1.warn)('error clearing local storage:', e);
17
+ (0, log_1.warn)("error clearing local storage:", e);
18
18
  }
19
19
  };
20
20
  exports.clearLocalStorageItem = clearLocalStorageItem;
21
21
  const clearAllLocalStorage = (except) => {
22
22
  try {
23
- if (typeof window === 'undefined') {
23
+ if (typeof window === "undefined") {
24
24
  return;
25
25
  }
26
26
  for (let i = 0; i < localStorage.length; i += 1) {
@@ -32,13 +32,13 @@ const clearAllLocalStorage = (except) => {
32
32
  }
33
33
  }
34
34
  catch (e) {
35
- (0, log_1.warn)('error clearing local storage:', e);
35
+ (0, log_1.warn)("error clearing local storage:", e);
36
36
  }
37
37
  };
38
38
  exports.clearAllLocalStorage = clearAllLocalStorage;
39
39
  const setLocalStorageItem = (key, value, ttl) => {
40
40
  try {
41
- if (typeof window === 'undefined') {
41
+ if (typeof window === "undefined") {
42
42
  return;
43
43
  }
44
44
  const set = {
@@ -54,7 +54,7 @@ const setLocalStorageItem = (key, value, ttl) => {
54
54
  };
55
55
  exports.setLocalStorageItem = setLocalStorageItem;
56
56
  const getLocalStorageItem = (key, initialValue, ttl) => {
57
- if (typeof window === 'undefined') {
57
+ if (typeof window === "undefined") {
58
58
  return initialValue;
59
59
  }
60
60
  const itemraw = window.localStorage.getItem(key);