lkd-web-kit 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/dist/components/EmptyState/index.cjs +38 -52
  3. package/dist/components/EmptyState/index.js +37 -48
  4. package/dist/components/Icon.cjs +46 -50
  5. package/dist/components/Icon.js +44 -46
  6. package/dist/components/InfinityLoadMoreButton/index.cjs +30 -42
  7. package/dist/components/InfinityLoadMoreButton/index.js +28 -38
  8. package/dist/components/InfinitySelect/index.cjs +126 -168
  9. package/dist/components/InfinitySelect/index.js +125 -164
  10. package/dist/components/MyCheckboxGroup/index.cjs +14 -22
  11. package/dist/components/MyCheckboxGroup/index.js +13 -18
  12. package/dist/components/MyDateInput/index.cjs +12 -18
  13. package/dist/components/MyDateInput/index.js +11 -14
  14. package/dist/components/MyDatePickerInput/CalendarIcon.cjs +45 -64
  15. package/dist/components/MyDatePickerInput/CalendarIcon.js +43 -61
  16. package/dist/components/MyDatePickerInput/index.cjs +12 -18
  17. package/dist/components/MyDatePickerInput/index.js +11 -14
  18. package/dist/components/MyDateTimePicker/index.cjs +12 -18
  19. package/dist/components/MyDateTimePicker/index.js +11 -14
  20. package/dist/components/MyMonthPickerInput/index.cjs +12 -18
  21. package/dist/components/MyMonthPickerInput/index.js +11 -14
  22. package/dist/components/MyMultiSelect/index.cjs +9 -9
  23. package/dist/components/MyMultiSelect/index.js +8 -5
  24. package/dist/components/MyNotifications/index.cjs +11 -17
  25. package/dist/components/MyNotifications/index.js +10 -13
  26. package/dist/components/MyNumberInput/index.cjs +9 -15
  27. package/dist/components/MyNumberInput/index.js +8 -11
  28. package/dist/components/MyRadioGroup/index.cjs +14 -22
  29. package/dist/components/MyRadioGroup/index.js +13 -18
  30. package/dist/components/MySelect/index.cjs +9 -15
  31. package/dist/components/MySelect/index.js +8 -11
  32. package/dist/components/MyTextInput/index.cjs +9 -15
  33. package/dist/components/MyTextInput/index.js +8 -11
  34. package/dist/components/MyTextarea/index.cjs +9 -15
  35. package/dist/components/MyTextarea/index.js +8 -11
  36. package/dist/components/MyTimeInput/index.cjs +9 -15
  37. package/dist/components/MyTimeInput/index.js +8 -11
  38. package/dist/components/NavItems.cjs +28 -38
  39. package/dist/components/NavItems.js +26 -34
  40. package/dist/consts/http-status.cjs +66 -69
  41. package/dist/consts/http-status.js +66 -65
  42. package/dist/consts/revalidate.cjs +10 -13
  43. package/dist/consts/revalidate.js +10 -9
  44. package/dist/contexts/NavigationHistoryContext/hook.cjs +41 -42
  45. package/dist/contexts/NavigationHistoryContext/hook.js +40 -38
  46. package/dist/contexts/NavigationHistoryContext/index.cjs +31 -28
  47. package/dist/contexts/NavigationHistoryContext/index.js +30 -24
  48. package/dist/contexts/PageDataContext/index.cjs +15 -18
  49. package/dist/contexts/PageDataContext/index.js +14 -14
  50. package/dist/form/Form.cjs +19 -28
  51. package/dist/form/Form.js +18 -24
  52. package/dist/form/FormSubmitButton.cjs +15 -27
  53. package/dist/form/FormSubmitButton.js +14 -23
  54. package/dist/form/base/FormCheckbox.cjs +15 -23
  55. package/dist/form/base/FormCheckbox.js +14 -19
  56. package/dist/form/base/FormCheckboxGroup.cjs +10 -16
  57. package/dist/form/base/FormCheckboxGroup.js +9 -12
  58. package/dist/form/base/FormDateInput.cjs +10 -16
  59. package/dist/form/base/FormDateInput.js +9 -12
  60. package/dist/form/base/FormDatePickerInput.cjs +10 -16
  61. package/dist/form/base/FormDatePickerInput.js +9 -12
  62. package/dist/form/base/FormDateTimePicker.cjs +10 -16
  63. package/dist/form/base/FormDateTimePicker.js +9 -12
  64. package/dist/form/base/FormMonthPickerInput.cjs +10 -16
  65. package/dist/form/base/FormMonthPickerInput.js +9 -12
  66. package/dist/form/base/FormMultiSelect.cjs +10 -10
  67. package/dist/form/base/FormMultiSelect.js +9 -6
  68. package/dist/form/base/FormNumberInput.cjs +12 -12
  69. package/dist/form/base/FormNumberInput.js +10 -8
  70. package/dist/form/base/FormRadioGroup.cjs +10 -16
  71. package/dist/form/base/FormRadioGroup.js +9 -12
  72. package/dist/form/base/FormSelect.cjs +10 -16
  73. package/dist/form/base/FormSelect.js +9 -12
  74. package/dist/form/base/FormSelectInfinity.cjs +15 -21
  75. package/dist/form/base/FormSelectInfinity.js +14 -17
  76. package/dist/form/base/FormTextInput.cjs +10 -16
  77. package/dist/form/base/FormTextInput.js +9 -12
  78. package/dist/form/base/FormTextarea.cjs +10 -10
  79. package/dist/form/base/FormTextarea.js +9 -6
  80. package/dist/form/base/FormTimeInput.cjs +18 -24
  81. package/dist/form/base/FormTimeInput.js +17 -20
  82. package/dist/form/utils/nullable-but-required.cjs +14 -17
  83. package/dist/form/utils/nullable-but-required.js +13 -13
  84. package/dist/form/utils/optional-but-required.cjs +14 -17
  85. package/dist/form/utils/optional-but-required.js +13 -13
  86. package/dist/form/utils/zodValidator.cjs +9 -13
  87. package/dist/form/utils/zodValidator.js +9 -9
  88. package/dist/hocs/withController.cjs +43 -54
  89. package/dist/hocs/withController.js +42 -50
  90. package/dist/hocs/withModalManager.cjs +29 -35
  91. package/dist/hocs/withModalManager.js +28 -31
  92. package/dist/hooks/useBreakpoint.cjs +8 -12
  93. package/dist/hooks/useBreakpoint.js +7 -8
  94. package/dist/hooks/useFetchNextPageOnScroll.cjs +13 -21
  95. package/dist/hooks/useFetchNextPageOnScroll.js +13 -17
  96. package/dist/hooks/useOnScrollProgress.cjs +33 -37
  97. package/dist/hooks/useOnScrollProgress.js +32 -33
  98. package/dist/hooks/useUpdateSearchParams.cjs +22 -22
  99. package/dist/hooks/useUpdateSearchParams.js +21 -18
  100. package/dist/hooks/useZodConfig.cjs +14 -19
  101. package/dist/hooks/useZodConfig.js +12 -15
  102. package/dist/index.cjs +130 -136
  103. package/dist/index.d.ts +13 -13
  104. package/dist/index.js +62 -61
  105. package/dist/mantine/breakpoints-with-px.cjs +9 -12
  106. package/dist/mantine/breakpoints-with-px.js +9 -8
  107. package/dist/mantine/my-default-theme.cjs +23 -42
  108. package/dist/mantine/my-default-theme.js +22 -38
  109. package/dist/mantine/to-tailwind-colors.cjs +9 -18
  110. package/dist/mantine/to-tailwind-colors.js +9 -14
  111. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +35 -70
  112. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +34 -42
  113. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +700 -870
  114. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +701 -863
  115. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +44 -64
  116. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +44 -60
  117. package/dist/utils/array/groupBy.cjs +30 -40
  118. package/dist/utils/array/groupBy.js +30 -36
  119. package/dist/utils/array/shuffleArray.cjs +11 -17
  120. package/dist/utils/array/shuffleArray.js +11 -13
  121. package/dist/utils/formatBytes.cjs +12 -11
  122. package/dist/utils/formatBytes.js +12 -7
  123. package/dist/utils/isInfinityEmpty.cjs +3 -6
  124. package/dist/utils/isInfinityEmpty.js +3 -2
  125. package/dist/utils/ky/addBodyJsonHook.cjs +9 -14
  126. package/dist/utils/ky/addBodyJsonHook.js +8 -10
  127. package/dist/utils/ky/parseJson.cjs +6 -9
  128. package/dist/utils/ky/parseJson.js +6 -5
  129. package/dist/utils/new-route.cjs +30 -39
  130. package/dist/utils/new-route.js +30 -35
  131. package/dist/utils/query-stringify.cjs +5 -8
  132. package/dist/utils/query-stringify.js +5 -4
  133. package/dist/utils/virtual-styles.cjs +21 -26
  134. package/dist/utils/virtual-styles.js +21 -22
  135. package/package.json +17 -16
@@ -1,74 +1,54 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
1
+ //#region node_modules/@tanstack/virtual-core/dist/esm/utils.js
5
2
  function memo(getDeps, fn, opts) {
6
- let deps = opts.initialDeps ?? [];
7
- let result;
8
- let isInitial = true;
9
- function memoizedFunction() {
10
- var _a, _b, _c;
11
- let depTime;
12
- if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
13
- const newDeps = getDeps();
14
- const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
15
- if (!depsChanged) {
16
- return result;
17
- }
18
- deps = newDeps;
19
- let resultTime;
20
- if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
21
- result = fn(...newDeps);
22
- if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
23
- const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
24
- const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
25
- const resultFpsPercentage = resultEndTime / 16;
26
- const pad = (str, num) => {
27
- str = String(str);
28
- while (str.length < num) {
29
- str = " " + str;
30
- }
31
- return str;
32
- };
33
- console.info(
34
- `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
35
- `
3
+ let deps = opts.initialDeps ?? [];
4
+ let result;
5
+ let isInitial = true;
6
+ function memoizedFunction() {
7
+ var _a, _b, _c;
8
+ let depTime;
9
+ if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
10
+ const newDeps = getDeps();
11
+ if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
12
+ deps = newDeps;
13
+ let resultTime;
14
+ if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
15
+ result = fn(...newDeps);
16
+ if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
17
+ const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
18
+ const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
19
+ const resultFpsPercentage = resultEndTime / 16;
20
+ const pad = (str, num) => {
21
+ str = String(str);
22
+ while (str.length < num) str = " " + str;
23
+ return str;
24
+ };
25
+ console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
36
26
  font-size: .6rem;
37
27
  font-weight: bold;
38
- color: hsl(${Math.max(
39
- 0,
40
- Math.min(120 - 120 * resultFpsPercentage, 120)
41
- )}deg 100% 31%);`,
42
- opts == null ? void 0 : opts.key
43
- );
44
- }
45
- if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
46
- opts.onChange(result);
47
- }
48
- isInitial = false;
49
- return result;
50
- }
51
- memoizedFunction.updateDeps = (newDeps) => {
52
- deps = newDeps;
53
- };
54
- return memoizedFunction;
28
+ color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
29
+ }
30
+ if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
31
+ isInitial = false;
32
+ return result;
33
+ }
34
+ memoizedFunction.updateDeps = (newDeps) => {
35
+ deps = newDeps;
36
+ };
37
+ return memoizedFunction;
55
38
  }
56
39
  function notUndefined(value, msg) {
57
- if (value === void 0) {
58
- throw new Error(`Unexpected undefined${""}`);
59
- } else {
60
- return value;
61
- }
40
+ if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
41
+ else return value;
62
42
  }
63
- const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
64
- const debounce = (targetWindow, fn, ms) => {
65
- let timeoutId;
66
- return function(...args) {
67
- targetWindow.clearTimeout(timeoutId);
68
- timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
69
- };
43
+ var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
44
+ var debounce = (targetWindow, fn, ms) => {
45
+ let timeoutId;
46
+ return function(...args) {
47
+ targetWindow.clearTimeout(timeoutId);
48
+ timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
49
+ };
70
50
  };
71
-
51
+ //#endregion
72
52
  exports.approxEqual = approxEqual;
73
53
  exports.debounce = debounce;
74
54
  exports.memo = memo;
@@ -1,68 +1,52 @@
1
+ //#region node_modules/@tanstack/virtual-core/dist/esm/utils.js
1
2
  function memo(getDeps, fn, opts) {
2
- let deps = opts.initialDeps ?? [];
3
- let result;
4
- let isInitial = true;
5
- function memoizedFunction() {
6
- var _a, _b, _c;
7
- let depTime;
8
- if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
9
- const newDeps = getDeps();
10
- const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
11
- if (!depsChanged) {
12
- return result;
13
- }
14
- deps = newDeps;
15
- let resultTime;
16
- if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
17
- result = fn(...newDeps);
18
- if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
19
- const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
20
- const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
21
- const resultFpsPercentage = resultEndTime / 16;
22
- const pad = (str, num) => {
23
- str = String(str);
24
- while (str.length < num) {
25
- str = " " + str;
26
- }
27
- return str;
28
- };
29
- console.info(
30
- `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
31
- `
3
+ let deps = opts.initialDeps ?? [];
4
+ let result;
5
+ let isInitial = true;
6
+ function memoizedFunction() {
7
+ var _a, _b, _c;
8
+ let depTime;
9
+ if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
10
+ const newDeps = getDeps();
11
+ if (!(newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep))) return result;
12
+ deps = newDeps;
13
+ let resultTime;
14
+ if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
15
+ result = fn(...newDeps);
16
+ if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
17
+ const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
18
+ const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
19
+ const resultFpsPercentage = resultEndTime / 16;
20
+ const pad = (str, num) => {
21
+ str = String(str);
22
+ while (str.length < num) str = " " + str;
23
+ return str;
24
+ };
25
+ console.info(`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`, `
32
26
  font-size: .6rem;
33
27
  font-weight: bold;
34
- color: hsl(${Math.max(
35
- 0,
36
- Math.min(120 - 120 * resultFpsPercentage, 120)
37
- )}deg 100% 31%);`,
38
- opts == null ? void 0 : opts.key
39
- );
40
- }
41
- if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
42
- opts.onChange(result);
43
- }
44
- isInitial = false;
45
- return result;
46
- }
47
- memoizedFunction.updateDeps = (newDeps) => {
48
- deps = newDeps;
49
- };
50
- return memoizedFunction;
28
+ color: hsl(${Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120))}deg 100% 31%);`, opts == null ? void 0 : opts.key);
29
+ }
30
+ if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) opts.onChange(result);
31
+ isInitial = false;
32
+ return result;
33
+ }
34
+ memoizedFunction.updateDeps = (newDeps) => {
35
+ deps = newDeps;
36
+ };
37
+ return memoizedFunction;
51
38
  }
52
39
  function notUndefined(value, msg) {
53
- if (value === void 0) {
54
- throw new Error(`Unexpected undefined${""}`);
55
- } else {
56
- return value;
57
- }
40
+ if (value === void 0) throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
41
+ else return value;
58
42
  }
59
- const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
60
- const debounce = (targetWindow, fn, ms) => {
61
- let timeoutId;
62
- return function(...args) {
63
- targetWindow.clearTimeout(timeoutId);
64
- timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
65
- };
43
+ var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
44
+ var debounce = (targetWindow, fn, ms) => {
45
+ let timeoutId;
46
+ return function(...args) {
47
+ targetWindow.clearTimeout(timeoutId);
48
+ timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
49
+ };
66
50
  };
67
-
51
+ //#endregion
68
52
  export { approxEqual, debounce, memo, notUndefined };
@@ -1,45 +1,35 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
1
+ //#region src/utils/array/groupBy.ts
5
2
  function indexBy(arr, getKey, getValue) {
6
- if (getValue)
7
- return arr.reduce(
8
- (acc, item) => {
9
- const key = getKey(item);
10
- if (key === void 0) return acc;
11
- acc[key] = getValue(item);
12
- return acc;
13
- },
14
- {}
15
- );
16
- return arr.reduce(
17
- (acc, item) => {
18
- const key = getKey(item);
19
- if (key === void 0) return acc;
20
- acc[key] = item;
21
- return acc;
22
- },
23
- {}
24
- );
3
+ if (getValue) return arr.reduce((acc, item) => {
4
+ const key = getKey(item);
5
+ if (key === void 0) return acc;
6
+ acc[key] = getValue(item);
7
+ return acc;
8
+ }, {});
9
+ return arr.reduce((acc, item) => {
10
+ const key = getKey(item);
11
+ if (key === void 0) return acc;
12
+ acc[key] = item;
13
+ return acc;
14
+ }, {});
25
15
  }
26
- const groupBy = (arr, getKey) => {
27
- const groups = {};
28
- arr?.forEach((item) => {
29
- const key = getKey(item);
30
- if (key === null) return;
31
- if (Array.isArray(key)) {
32
- key.forEach((k) => {
33
- if (!groups[k]) groups[k] = [];
34
- groups[k]?.push(item);
35
- });
36
- return;
37
- }
38
- if (!groups[key]) groups[key] = [];
39
- groups[key]?.push(item);
40
- });
41
- return groups;
16
+ var groupBy = (arr, getKey) => {
17
+ const groups = {};
18
+ arr?.forEach((item) => {
19
+ const key = getKey(item);
20
+ if (key === null) return;
21
+ if (Array.isArray(key)) {
22
+ key.forEach((k) => {
23
+ if (!groups[k]) groups[k] = [];
24
+ groups[k]?.push(item);
25
+ });
26
+ return;
27
+ }
28
+ if (!groups[key]) groups[key] = [];
29
+ groups[key]?.push(item);
30
+ });
31
+ return groups;
42
32
  };
43
-
33
+ //#endregion
44
34
  exports.groupBy = groupBy;
45
35
  exports.indexBy = indexBy;
@@ -1,40 +1,34 @@
1
+ //#region src/utils/array/groupBy.ts
1
2
  function indexBy(arr, getKey, getValue) {
2
- if (getValue)
3
- return arr.reduce(
4
- (acc, item) => {
5
- const key = getKey(item);
6
- if (key === void 0) return acc;
7
- acc[key] = getValue(item);
8
- return acc;
9
- },
10
- {}
11
- );
12
- return arr.reduce(
13
- (acc, item) => {
14
- const key = getKey(item);
15
- if (key === void 0) return acc;
16
- acc[key] = item;
17
- return acc;
18
- },
19
- {}
20
- );
3
+ if (getValue) return arr.reduce((acc, item) => {
4
+ const key = getKey(item);
5
+ if (key === void 0) return acc;
6
+ acc[key] = getValue(item);
7
+ return acc;
8
+ }, {});
9
+ return arr.reduce((acc, item) => {
10
+ const key = getKey(item);
11
+ if (key === void 0) return acc;
12
+ acc[key] = item;
13
+ return acc;
14
+ }, {});
21
15
  }
22
- const groupBy = (arr, getKey) => {
23
- const groups = {};
24
- arr?.forEach((item) => {
25
- const key = getKey(item);
26
- if (key === null) return;
27
- if (Array.isArray(key)) {
28
- key.forEach((k) => {
29
- if (!groups[k]) groups[k] = [];
30
- groups[k]?.push(item);
31
- });
32
- return;
33
- }
34
- if (!groups[key]) groups[key] = [];
35
- groups[key]?.push(item);
36
- });
37
- return groups;
16
+ var groupBy = (arr, getKey) => {
17
+ const groups = {};
18
+ arr?.forEach((item) => {
19
+ const key = getKey(item);
20
+ if (key === null) return;
21
+ if (Array.isArray(key)) {
22
+ key.forEach((k) => {
23
+ if (!groups[k]) groups[k] = [];
24
+ groups[k]?.push(item);
25
+ });
26
+ return;
27
+ }
28
+ if (!groups[key]) groups[key] = [];
29
+ groups[key]?.push(item);
30
+ });
31
+ return groups;
38
32
  };
39
-
33
+ //#endregion
40
34
  export { groupBy, indexBy };
@@ -1,19 +1,13 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const shuffleArray = (array) => {
6
- const shuffledArray = [...array];
7
- let currentIndex = shuffledArray.length, randomIndex;
8
- while (currentIndex > 0) {
9
- randomIndex = Math.floor(Math.random() * currentIndex);
10
- currentIndex--;
11
- [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [
12
- shuffledArray[randomIndex],
13
- shuffledArray[currentIndex]
14
- ];
15
- }
16
- return shuffledArray;
1
+ //#region src/utils/array/shuffleArray.ts
2
+ var shuffleArray = (array) => {
3
+ const shuffledArray = [...array];
4
+ let currentIndex = shuffledArray.length, randomIndex;
5
+ while (currentIndex > 0) {
6
+ randomIndex = Math.floor(Math.random() * currentIndex);
7
+ currentIndex--;
8
+ [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [shuffledArray[randomIndex], shuffledArray[currentIndex]];
9
+ }
10
+ return shuffledArray;
17
11
  };
18
-
12
+ //#endregion
19
13
  exports.shuffleArray = shuffleArray;
@@ -1,15 +1,13 @@
1
- const shuffleArray = (array) => {
2
- const shuffledArray = [...array];
3
- let currentIndex = shuffledArray.length, randomIndex;
4
- while (currentIndex > 0) {
5
- randomIndex = Math.floor(Math.random() * currentIndex);
6
- currentIndex--;
7
- [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [
8
- shuffledArray[randomIndex],
9
- shuffledArray[currentIndex]
10
- ];
11
- }
12
- return shuffledArray;
1
+ //#region src/utils/array/shuffleArray.ts
2
+ var shuffleArray = (array) => {
3
+ const shuffledArray = [...array];
4
+ let currentIndex = shuffledArray.length, randomIndex;
5
+ while (currentIndex > 0) {
6
+ randomIndex = Math.floor(Math.random() * currentIndex);
7
+ currentIndex--;
8
+ [shuffledArray[currentIndex], shuffledArray[randomIndex]] = [shuffledArray[randomIndex], shuffledArray[currentIndex]];
9
+ }
10
+ return shuffledArray;
13
11
  };
14
-
12
+ //#endregion
15
13
  export { shuffleArray };
@@ -1,14 +1,15 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
1
+ //#region src/utils/formatBytes.ts
5
2
  function formatBytes(bytes, decimals = 2) {
6
- if (!+bytes) return "0 Bytes";
7
- const k = 1024;
8
- const dm = decimals < 0 ? 0 : decimals;
9
- const sizes = ["Bytes", "KB", "MB"];
10
- const i = Math.floor(Math.log(bytes) / Math.log(k));
11
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
3
+ if (!+bytes) return "0 Bytes";
4
+ const k = 1024;
5
+ const dm = decimals < 0 ? 0 : decimals;
6
+ const sizes = [
7
+ "Bytes",
8
+ "KB",
9
+ "MB"
10
+ ];
11
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
12
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
12
13
  }
13
-
14
+ //#endregion
14
15
  exports.formatBytes = formatBytes;
@@ -1,10 +1,15 @@
1
+ //#region src/utils/formatBytes.ts
1
2
  function formatBytes(bytes, decimals = 2) {
2
- if (!+bytes) return "0 Bytes";
3
- const k = 1024;
4
- const dm = decimals < 0 ? 0 : decimals;
5
- const sizes = ["Bytes", "KB", "MB"];
6
- const i = Math.floor(Math.log(bytes) / Math.log(k));
7
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
3
+ if (!+bytes) return "0 Bytes";
4
+ const k = 1024;
5
+ const dm = decimals < 0 ? 0 : decimals;
6
+ const sizes = [
7
+ "Bytes",
8
+ "KB",
9
+ "MB"
10
+ ];
11
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
12
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
8
13
  }
9
-
14
+ //#endregion
10
15
  export { formatBytes };
@@ -1,7 +1,4 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
6
-
1
+ //#region src/utils/isInfinityEmpty.ts
2
+ var isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
3
+ //#endregion
7
4
  exports.isInfinityEmpty = isInfinityEmpty;
@@ -1,3 +1,4 @@
1
- const isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
2
-
1
+ //#region src/utils/isInfinityEmpty.ts
2
+ var isInfinityEmpty = (data) => data?.pages[0].data.length === 0;
3
+ //#endregion
3
4
  export { isInfinityEmpty };
@@ -1,16 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const ky = require('ky');
6
-
7
- const addBodyJsonHook = async ({ error }) => {
8
- if (!ky.isHTTPError(error)) {
9
- return error;
10
- }
11
- const bodyJson = error.data ?? {};
12
- error.response.bodyJson = bodyJson;
13
- return error;
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ let ky = require("ky");
3
+ //#region src/utils/ky/addBodyJsonHook.ts
4
+ var addBodyJsonHook = async ({ error }) => {
5
+ if (!(0, ky.isHTTPError)(error)) return error;
6
+ const bodyJson = error.data ?? {};
7
+ error.response.bodyJson = bodyJson;
8
+ return error;
14
9
  };
15
-
10
+ //#endregion
16
11
  exports.addBodyJsonHook = addBodyJsonHook;
@@ -1,12 +1,10 @@
1
- import { isHTTPError } from 'ky';
2
-
3
- const addBodyJsonHook = async ({ error }) => {
4
- if (!isHTTPError(error)) {
5
- return error;
6
- }
7
- const bodyJson = error.data ?? {};
8
- error.response.bodyJson = bodyJson;
9
- return error;
1
+ import { isHTTPError } from "ky";
2
+ //#region src/utils/ky/addBodyJsonHook.ts
3
+ var addBodyJsonHook = async ({ error }) => {
4
+ if (!isHTTPError(error)) return error;
5
+ const bodyJson = error.data ?? {};
6
+ error.response.bodyJson = bodyJson;
7
+ return error;
10
8
  };
11
-
9
+ //#endregion
12
10
  export { addBodyJsonHook };
@@ -1,11 +1,8 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const parseJSON = async (response) => {
6
- return response.text().then(function(text) {
7
- return text ? JSON.parse(text) : {};
8
- });
1
+ //#region src/utils/ky/parseJson.ts
2
+ var parseJSON = async (response) => {
3
+ return response.text().then(function(text) {
4
+ return text ? JSON.parse(text) : {};
5
+ });
9
6
  };
10
-
7
+ //#endregion
11
8
  exports.parseJSON = parseJSON;
@@ -1,7 +1,8 @@
1
- const parseJSON = async (response) => {
2
- return response.text().then(function(text) {
3
- return text ? JSON.parse(text) : {};
4
- });
1
+ //#region src/utils/ky/parseJson.ts
2
+ var parseJSON = async (response) => {
3
+ return response.text().then(function(text) {
4
+ return text ? JSON.parse(text) : {};
5
+ });
5
6
  };
6
-
7
+ //#endregion
7
8
  export { parseJSON };