lkd-web-kit 0.8.0 → 0.8.2

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 (136) 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/utils/array/groupBy.cjs +30 -40
  112. package/dist/utils/array/groupBy.js +30 -36
  113. package/dist/utils/array/shuffleArray.cjs +11 -17
  114. package/dist/utils/array/shuffleArray.js +11 -13
  115. package/dist/utils/formatBytes.cjs +12 -11
  116. package/dist/utils/formatBytes.js +12 -7
  117. package/dist/utils/isInfinityEmpty.cjs +3 -6
  118. package/dist/utils/isInfinityEmpty.js +3 -2
  119. package/dist/utils/ky/addBodyJsonHook.cjs +9 -14
  120. package/dist/utils/ky/addBodyJsonHook.js +8 -10
  121. package/dist/utils/ky/parseJson.cjs +6 -9
  122. package/dist/utils/ky/parseJson.js +6 -5
  123. package/dist/utils/new-route.cjs +30 -39
  124. package/dist/utils/new-route.js +30 -35
  125. package/dist/utils/query-stringify.cjs +5 -8
  126. package/dist/utils/query-stringify.js +5 -4
  127. package/dist/utils/virtual-styles.cjs +21 -26
  128. package/dist/utils/virtual-styles.js +21 -22
  129. package/package.json +20 -19
  130. package/dist/node_modules/@mantine/notifications/styles.css +0 -42
  131. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +0 -74
  132. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +0 -45
  133. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +0 -886
  134. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -872
  135. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +0 -75
  136. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -68
@@ -1,44 +1,25 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const core = require('@mantine/core');
6
- const breakpointsWithPx = require('./breakpoints-with-px.cjs');
7
-
8
- const myDefaultTheme = {
9
- breakpoints: breakpointsWithPx.breakpointsWithPx,
10
- cursorType: "pointer",
11
- defaultRadius: "sm",
12
- components: {
13
- Notification: core.Notification.extend({
14
- defaultProps: {
15
- withBorder: true
16
- }
17
- }),
18
- AppShell: core.AppShell.extend({
19
- defaultProps: {
20
- padding: 0
21
- }
22
- }),
23
- Select: core.Select.extend({
24
- defaultProps: {
25
- allowDeselect: false,
26
- withCheckIcon: false,
27
- clearable: true
28
- }
29
- }),
30
- Menu: core.Menu.extend({
31
- defaultProps: {
32
- position: "bottom-end"
33
- }
34
- }),
35
- Tooltip: core.Tooltip.extend({
36
- defaultProps: {
37
- multiline: true,
38
- maw: 300
39
- }
40
- })
41
- }
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_breakpoints_with_px = require("./breakpoints-with-px.cjs");
3
+ let _mantine_core = require("@mantine/core");
4
+ //#region src/mantine/my-default-theme.ts
5
+ var myDefaultTheme = {
6
+ breakpoints: require_breakpoints_with_px.breakpointsWithPx,
7
+ cursorType: "pointer",
8
+ defaultRadius: "sm",
9
+ components: {
10
+ Notification: _mantine_core.Notification.extend({ defaultProps: { withBorder: true } }),
11
+ AppShell: _mantine_core.AppShell.extend({ defaultProps: { padding: 0 } }),
12
+ Select: _mantine_core.Select.extend({ defaultProps: {
13
+ allowDeselect: false,
14
+ withCheckIcon: false,
15
+ clearable: true
16
+ } }),
17
+ Menu: _mantine_core.Menu.extend({ defaultProps: { position: "bottom-end" } }),
18
+ Tooltip: _mantine_core.Tooltip.extend({ defaultProps: {
19
+ multiline: true,
20
+ maw: 300
21
+ } })
22
+ }
42
23
  };
43
-
24
+ //#endregion
44
25
  exports.myDefaultTheme = myDefaultTheme;
@@ -1,40 +1,24 @@
1
- import { Tooltip, Menu, Select, AppShell, Notification } from '@mantine/core';
2
- import { breakpointsWithPx } from './breakpoints-with-px.js';
3
-
4
- const myDefaultTheme = {
5
- breakpoints: breakpointsWithPx,
6
- cursorType: "pointer",
7
- defaultRadius: "sm",
8
- components: {
9
- Notification: Notification.extend({
10
- defaultProps: {
11
- withBorder: true
12
- }
13
- }),
14
- AppShell: AppShell.extend({
15
- defaultProps: {
16
- padding: 0
17
- }
18
- }),
19
- Select: Select.extend({
20
- defaultProps: {
21
- allowDeselect: false,
22
- withCheckIcon: false,
23
- clearable: true
24
- }
25
- }),
26
- Menu: Menu.extend({
27
- defaultProps: {
28
- position: "bottom-end"
29
- }
30
- }),
31
- Tooltip: Tooltip.extend({
32
- defaultProps: {
33
- multiline: true,
34
- maw: 300
35
- }
36
- })
37
- }
1
+ import { breakpointsWithPx } from "./breakpoints-with-px.js";
2
+ import { AppShell, Menu, Notification, Select, Tooltip } from "@mantine/core";
3
+ //#region src/mantine/my-default-theme.ts
4
+ var myDefaultTheme = {
5
+ breakpoints: breakpointsWithPx,
6
+ cursorType: "pointer",
7
+ defaultRadius: "sm",
8
+ components: {
9
+ Notification: Notification.extend({ defaultProps: { withBorder: true } }),
10
+ AppShell: AppShell.extend({ defaultProps: { padding: 0 } }),
11
+ Select: Select.extend({ defaultProps: {
12
+ allowDeselect: false,
13
+ withCheckIcon: false,
14
+ clearable: true
15
+ } }),
16
+ Menu: Menu.extend({ defaultProps: { position: "bottom-end" } }),
17
+ Tooltip: Tooltip.extend({ defaultProps: {
18
+ multiline: true,
19
+ maw: 300
20
+ } })
21
+ }
38
22
  };
39
-
23
+ //#endregion
40
24
  export { myDefaultTheme };
@@ -1,19 +1,10 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const toTailwindColors = (colors) => Object.entries(colors).reduce(
6
- (acc, [key, value]) => {
7
- acc[key] = value.reduce(
8
- (acc2, color, index) => {
9
- acc2[index] = color;
10
- return acc2;
11
- },
12
- {}
13
- );
14
- return acc;
15
- },
16
- {}
17
- );
18
-
1
+ //#region src/mantine/to-tailwind-colors.ts
2
+ var toTailwindColors = (colors) => Object.entries(colors).reduce((acc, [key, value]) => {
3
+ acc[key] = value.reduce((acc, color, index) => {
4
+ acc[index] = color;
5
+ return acc;
6
+ }, {});
7
+ return acc;
8
+ }, {});
9
+ //#endregion
19
10
  exports.toTailwindColors = toTailwindColors;
@@ -1,15 +1,10 @@
1
- const toTailwindColors = (colors) => Object.entries(colors).reduce(
2
- (acc, [key, value]) => {
3
- acc[key] = value.reduce(
4
- (acc2, color, index) => {
5
- acc2[index] = color;
6
- return acc2;
7
- },
8
- {}
9
- );
10
- return acc;
11
- },
12
- {}
13
- );
14
-
1
+ //#region src/mantine/to-tailwind-colors.ts
2
+ var toTailwindColors = (colors) => Object.entries(colors).reduce((acc, [key, value]) => {
3
+ acc[key] = value.reduce((acc, color, index) => {
4
+ acc[index] = color;
5
+ return acc;
6
+ }, {});
7
+ return acc;
8
+ }, {});
9
+ //#endregion
15
10
  export { toTailwindColors };
@@ -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 };
@@ -1,45 +1,36 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const queryStringify = require('./query-stringify.cjs');
6
-
1
+ const require_query_stringify = require("./query-stringify.cjs");
2
+ //#region src/utils/new-route.ts
7
3
  function buildPathFromTemplate(path, params) {
8
- return path.replace(/:([a-zA-Z0-9_]+)/g, (_, key) => {
9
- const value = params[key];
10
- if (value === void 0) {
11
- throw new Error(`Falta el parámetro de ruta: ${key}`);
12
- }
13
- return encodeURIComponent(String(value));
14
- });
4
+ return path.replace(/:([a-zA-Z0-9_]+)/g, (_, key) => {
5
+ const value = params[key];
6
+ if (value === void 0) throw new Error(`Falta el parámetro de ruta: ${key}`);
7
+ return encodeURIComponent(String(value));
8
+ });
15
9
  }
16
10
  function createNewRoute(config) {
17
- const globalQueryBuilder = config?.queryBuilder;
18
- function getPathStrategy(arg, options) {
19
- if (options?.pathBuilder) {
20
- return (params) => options.pathBuilder(params);
21
- } else if (typeof arg === "string") {
22
- const template = arg;
23
- return (params) => buildPathFromTemplate(template, params);
24
- } else {
25
- const fn = arg;
26
- return (params) => fn(params);
27
- }
28
- }
29
- function newRoute2(arg, options) {
30
- const pathStrategy = getPathStrategy(arg, options);
31
- const queryBuilder = options?.queryBuilder || globalQueryBuilder;
32
- const queryStrategy = queryBuilder ? (query) => queryBuilder(query) : queryStringify.queryStringify;
33
- return (params = {}) => {
34
- const { query = {}, ...pathParams } = params;
35
- const path = pathStrategy(pathParams);
36
- const queryString = queryStrategy(query);
37
- return path + queryString;
38
- };
39
- }
40
- return newRoute2;
11
+ const globalQueryBuilder = config?.queryBuilder;
12
+ function getPathStrategy(arg, options) {
13
+ if (options?.pathBuilder) return (params) => options.pathBuilder(params);
14
+ else if (typeof arg === "string") {
15
+ const template = arg;
16
+ return (params) => buildPathFromTemplate(template, params);
17
+ } else {
18
+ const fn = arg;
19
+ return (params) => fn(params);
20
+ }
21
+ }
22
+ function newRoute(arg, options) {
23
+ const pathStrategy = getPathStrategy(arg, options);
24
+ const queryBuilder = options?.queryBuilder || globalQueryBuilder;
25
+ const queryStrategy = queryBuilder ? (query) => queryBuilder(query) : require_query_stringify.queryStringify;
26
+ return (params = {}) => {
27
+ const { query = {}, ...pathParams } = params;
28
+ return pathStrategy(pathParams) + queryStrategy(query);
29
+ };
30
+ }
31
+ return newRoute;
41
32
  }
42
- const newRoute = createNewRoute();
43
-
33
+ var newRoute = createNewRoute();
34
+ //#endregion
44
35
  exports.createNewRoute = createNewRoute;
45
36
  exports.newRoute = newRoute;