@cyberskill/shared 3.2.0 β 3.3.0
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/config/commitlint/index.js +8 -9
- package/dist/config/commitlint/index.js.map +1 -1
- package/dist/config/config.type.js +8 -5
- package/dist/config/config.type.js.map +1 -1
- package/dist/config/config.util.js +33 -42
- package/dist/config/config.util.js.map +1 -1
- package/dist/config/env/env.constant.js +6 -5
- package/dist/config/env/env.constant.js.map +1 -1
- package/dist/config/env/env.util.js +26 -27
- package/dist/config/env/env.util.js.map +1 -1
- package/dist/config/env/index.js +2 -7
- package/dist/config/eslint/index.js +23 -19
- package/dist/config/eslint/index.js.map +1 -1
- package/dist/config/graphql-codegen/graphql-codegen.util.js +30 -38
- package/dist/config/graphql-codegen/graphql-codegen.util.js.map +1 -1
- package/dist/config/graphql-codegen/index.js +2 -5
- package/dist/config/index.js +3 -7
- package/dist/config/lint-staged/index.js +8 -7
- package/dist/config/lint-staged/index.js.map +1 -1
- package/dist/config/storybook/index.js +2 -6
- package/dist/config/storybook/storybook.main.js +19 -18
- package/dist/config/storybook/storybook.main.js.map +1 -1
- package/dist/config/storybook/storybook.preview.js +31 -37
- package/dist/config/storybook/storybook.preview.js.map +1 -1
- package/dist/config/vitest/index.js +3 -7
- package/dist/config/vitest/vitest.e2e.js +14 -17
- package/dist/config/vitest/vitest.e2e.js.map +1 -1
- package/dist/config/vitest/vitest.unit.js +31 -32
- package/dist/config/vitest/vitest.unit.js.map +1 -1
- package/dist/constant/common.js +6 -5
- package/dist/constant/common.js.map +1 -1
- package/dist/constant/index.js +3 -7
- package/dist/constant/response-status.d.ts +186 -186
- package/dist/constant/response-status.js +254 -253
- package/dist/constant/response-status.js.map +1 -1
- package/dist/node/apollo-server/apollo-server.util.js +27 -29
- package/dist/node/apollo-server/apollo-server.util.js.map +1 -1
- package/dist/node/apollo-server/index.js +2 -7
- package/dist/node/cli/index.js +112 -113
- package/dist/node/cli/index.js.map +1 -1
- package/dist/node/command/command.type.js +8 -5
- package/dist/node/command/command.type.js.map +1 -1
- package/dist/node/command/command.util.js +136 -149
- package/dist/node/command/command.util.js.map +1 -1
- package/dist/node/command/index.js +3 -12
- package/dist/node/express/express.type.d.ts +11 -0
- package/dist/node/express/express.type.js +2 -0
- package/dist/node/express/express.util.js +74 -65
- package/dist/node/express/express.util.js.map +1 -1
- package/dist/node/express/index.js +3 -14
- package/dist/node/fs/fs.util.js +27 -51
- package/dist/node/fs/fs.util.js.map +1 -1
- package/dist/node/fs/index.js +2 -19
- package/dist/node/log/index.js +2 -8
- package/dist/node/log/log.type.js +8 -5
- package/dist/node/log/log.type.js.map +1 -1
- package/dist/node/log/log.util.js +51 -68
- package/dist/node/log/log.util.js.map +1 -1
- package/dist/node/mongo/index.js +8 -26
- package/dist/node/mongo/mongo.constant.js +6 -6
- package/dist/node/mongo/mongo.constant.js.map +1 -1
- package/dist/node/mongo/mongo.controller.mongoose.d.ts +6 -1
- package/dist/node/mongo/mongo.controller.mongoose.js +333 -467
- package/dist/node/mongo/mongo.controller.mongoose.js.map +1 -1
- package/dist/node/mongo/mongo.controller.native.js +153 -212
- package/dist/node/mongo/mongo.controller.native.js.map +1 -1
- package/dist/node/mongo/mongo.dynamic-populate.js +164 -192
- package/dist/node/mongo/mongo.dynamic-populate.js.map +1 -1
- package/dist/node/mongo/mongo.populate.js +229 -262
- package/dist/node/mongo/mongo.populate.js.map +1 -1
- package/dist/node/mongo/mongo.type.js +8 -17
- package/dist/node/mongo/mongo.type.js.map +1 -1
- package/dist/node/mongo/mongo.util.js +134 -293
- package/dist/node/mongo/mongo.util.js.map +1 -1
- package/dist/node/package/index.js +3 -11
- package/dist/node/package/package.type.js +8 -5
- package/dist/node/package/package.type.js.map +1 -1
- package/dist/node/package/package.util.js +216 -225
- package/dist/node/package/package.util.js.map +1 -1
- package/dist/node/path/index.js +3 -58
- package/dist/node/path/path.constant.js +211 -298
- package/dist/node/path/path.constant.js.map +1 -1
- package/dist/node/path/path.util.js +13 -16
- package/dist/node/path/path.util.js.map +1 -1
- package/dist/node/storage/index.js +3 -10
- package/dist/node/storage/storage.constant.js +6 -8
- package/dist/node/storage/storage.constant.js.map +1 -1
- package/dist/node/storage/storage.util.js +127 -178
- package/dist/node/storage/storage.util.js.map +1 -1
- package/dist/node/upload/index.js +4 -16
- package/dist/node/upload/upload.constant.js +58 -32
- package/dist/node/upload/upload.constant.js.map +1 -1
- package/dist/node/upload/upload.type.js +8 -5
- package/dist/node/upload/upload.type.js.map +1 -1
- package/dist/node/upload/upload.util.js +125 -137
- package/dist/node/upload/upload.util.js.map +1 -1
- package/dist/node/ws/index.js +2 -6
- package/dist/node/ws/ws.type.d.ts +7 -8
- package/dist/node/ws/ws.util.js +46 -44
- package/dist/node/ws/ws.util.js.map +1 -1
- package/dist/node_modules/.pnpm/vitest@4.1.0_@types_node@25.5.0_jsdom@29.0.0_@noble_hashes@1.8.0__vite@8.0.0_@types_nod_53aa4254f295b3c40bb8f17b6ab226b5/node_modules/vitest/dist/config.js +8 -0
- package/dist/node_modules/.pnpm/vitest@4.1.0_@types_node@25.5.0_jsdom@29.0.0_@noble_hashes@1.8.0__vite@8.0.0_@types_nod_53aa4254f295b3c40bb8f17b6ab226b5/node_modules/vitest/dist/config.js.map +1 -0
- package/dist/react/apollo-client/apollo-client.component.js +16 -18
- package/dist/react/apollo-client/apollo-client.component.js.map +1 -1
- package/dist/react/apollo-client/apollo-client.constant.js +6 -5
- package/dist/react/apollo-client/apollo-client.constant.js.map +1 -1
- package/dist/react/apollo-client/apollo-client.context.js +10 -13
- package/dist/react/apollo-client/apollo-client.context.js.map +1 -1
- package/dist/react/apollo-client/apollo-client.module.scss.js +8 -7
- package/dist/react/apollo-client/apollo-client.module.scss.js.map +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +57 -75
- package/dist/react/apollo-client/apollo-client.util.js.map +1 -1
- package/dist/react/apollo-client/index.js +7 -30
- package/dist/react/apollo-client/links/index.js +2 -5
- package/dist/react/apollo-client/links/upload.js +63 -107
- package/dist/react/apollo-client/links/upload.js.map +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +14 -16
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js.map +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js +8 -7
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js.map +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +14 -14
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js.map +1 -1
- package/dist/react/apollo-client-nextjs/index.js +3 -7
- package/dist/react/apollo-error/apollo-error.component.js +57 -69
- package/dist/react/apollo-error/apollo-error.component.js.map +1 -1
- package/dist/react/apollo-error/apollo-error.context.js +7 -6
- package/dist/react/apollo-error/apollo-error.context.js.map +1 -1
- package/dist/react/apollo-error/apollo-error.hook.js +10 -10
- package/dist/react/apollo-error/apollo-error.hook.js.map +1 -1
- package/dist/react/apollo-error/apollo-error.module.scss.js +15 -11
- package/dist/react/apollo-error/apollo-error.module.scss.js.map +1 -1
- package/dist/react/apollo-error/apollo-error.provider.js +31 -25
- package/dist/react/apollo-error/apollo-error.provider.js.map +1 -1
- package/dist/react/apollo-error/apollo-error.util.js +14 -16
- package/dist/react/apollo-error/apollo-error.util.js.map +1 -1
- package/dist/react/apollo-error/index.js +5 -15
- package/dist/react/i18next/i18next.hook.js +7 -6
- package/dist/react/i18next/i18next.hook.js.map +1 -1
- package/dist/react/i18next/i18next.util.js +9 -8
- package/dist/react/i18next/i18next.util.js.map +1 -1
- package/dist/react/i18next/index.js +3 -7
- package/dist/react/loading/index.js +3 -9
- package/dist/react/loading/loading.component.js +47 -48
- package/dist/react/loading/loading.component.js.map +1 -1
- package/dist/react/loading/loading.context.js +7 -6
- package/dist/react/loading/loading.context.js.map +1 -1
- package/dist/react/loading/loading.hook.js +11 -11
- package/dist/react/loading/loading.hook.js.map +1 -1
- package/dist/react/loading/loading.module.scss.js +18 -15
- package/dist/react/loading/loading.module.scss.js.map +1 -1
- package/dist/react/loading/loading.provider.js +26 -18
- package/dist/react/loading/loading.provider.js.map +1 -1
- package/dist/react/log/index.js +2 -6
- package/dist/react/log/log.util.d.ts +8 -0
- package/dist/react/log/log.util.js +33 -29
- package/dist/react/log/log.util.js.map +1 -1
- package/dist/react/next-intl/index.js +6 -14
- package/dist/react/next-intl/next-intl.constant.js +16 -15
- package/dist/react/next-intl/next-intl.constant.js.map +1 -1
- package/dist/react/next-intl/next-intl.context.js +7 -6
- package/dist/react/next-intl/next-intl.context.js.map +1 -1
- package/dist/react/next-intl/next-intl.hoc.js +20 -23
- package/dist/react/next-intl/next-intl.hoc.js.map +1 -1
- package/dist/react/next-intl/next-intl.hook.js +13 -14
- package/dist/react/next-intl/next-intl.hook.js.map +1 -1
- package/dist/react/next-intl/next-intl.provider.js +28 -23
- package/dist/react/next-intl/next-intl.provider.js.map +1 -1
- package/dist/react/storage/index.js +3 -7
- package/dist/react/storage/storage.hook.js +61 -58
- package/dist/react/storage/storage.hook.js.map +1 -1
- package/dist/react/storage/storage.util.js +36 -68
- package/dist/react/storage/storage.util.js.map +1 -1
- package/dist/react/toast/index.js +2 -6
- package/dist/react/userback/index.js +2 -5
- package/dist/react/userback/userback.component.js +27 -27
- package/dist/react/userback/userback.component.js.map +1 -1
- package/dist/style.css +2 -1
- package/dist/typescript/common.type.js +8 -5
- package/dist/typescript/common.type.js.map +1 -1
- package/dist/typescript/index.js +2 -5
- package/dist/util/common/common.util.js +119 -48
- package/dist/util/common/common.util.js.map +1 -1
- package/dist/util/common/index.js +2 -9
- package/dist/util/index.js +6 -27
- package/dist/util/object/index.d.ts +3 -0
- package/dist/util/object/index.js +2 -10
- package/dist/util/object/object.util.js +94 -128
- package/dist/util/object/object.util.js.map +1 -1
- package/dist/util/serializer/index.js +2 -5
- package/dist/util/serializer/serializer.util.js +73 -78
- package/dist/util/serializer/serializer.util.js.map +1 -1
- package/dist/util/string/index.d.ts +3 -0
- package/dist/util/string/index.js +2 -10
- package/dist/util/string/string.util.js +59 -71
- package/dist/util/string/string.util.js.map +1 -1
- package/dist/util/validate/index.d.ts +3 -0
- package/dist/util/validate/index.js +2 -5
- package/dist/util/validate/validate.util.js +13 -39
- package/dist/util/validate/validate.util.js.map +1 -1
- package/package.json +29 -27
- package/dist/config/env/index.js.map +0 -1
- package/dist/config/graphql-codegen/index.js.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/config/storybook/index.js.map +0 -1
- package/dist/config/vitest/index.js.map +0 -1
- package/dist/constant/index.js.map +0 -1
- package/dist/node/apollo-server/index.js.map +0 -1
- package/dist/node/command/index.js.map +0 -1
- package/dist/node/express/index.js.map +0 -1
- package/dist/node/fs/index.js.map +0 -1
- package/dist/node/log/index.js.map +0 -1
- package/dist/node/mongo/index.js.map +0 -1
- package/dist/node/package/index.js.map +0 -1
- package/dist/node/path/index.js.map +0 -1
- package/dist/node/storage/index.js.map +0 -1
- package/dist/node/upload/index.js.map +0 -1
- package/dist/node/ws/index.js.map +0 -1
- package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.5_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js +0 -7
- package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.5_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js.map +0 -1
- package/dist/react/apollo-client/index.js.map +0 -1
- package/dist/react/apollo-client/links/index.js.map +0 -1
- package/dist/react/apollo-client-nextjs/index.js.map +0 -1
- package/dist/react/apollo-error/index.js.map +0 -1
- package/dist/react/i18next/index.js.map +0 -1
- package/dist/react/loading/index.js.map +0 -1
- package/dist/react/log/index.js.map +0 -1
- package/dist/react/next-intl/index.js.map +0 -1
- package/dist/react/storage/index.js.map +0 -1
- package/dist/react/toast/index.js.map +0 -1
- package/dist/react/userback/index.js.map +0 -1
- package/dist/typescript/index.js.map +0 -1
- package/dist/util/common/index.js.map +0 -1
- package/dist/util/index.js.map +0 -1
- package/dist/util/object/index.js.map +0 -1
- package/dist/util/serializer/index.js.map +0 -1
- package/dist/util/string/index.js.map +0 -1
- package/dist/util/validate/index.js.map +0 -1
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { Loading as e } from "./loading.component.js";
|
|
2
|
-
import { LoadingContext as
|
|
2
|
+
import { LoadingContext as t } from "./loading.context.js";
|
|
3
3
|
import { useLoading as n } from "./loading.hook.js";
|
|
4
|
-
import { LoadingProvider as
|
|
5
|
-
export {
|
|
6
|
-
e as Loading,
|
|
7
|
-
d as LoadingContext,
|
|
8
|
-
a as LoadingProvider,
|
|
9
|
-
n as useLoading
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
+
import { LoadingProvider as r } from "./loading.provider.js";
|
|
5
|
+
export { e as Loading, t as LoadingContext, r as LoadingProvider, n as useLoading };
|
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.noscroll {
|
|
11
|
-
overflow: hidden !important;
|
|
12
|
-
height: 100vh !important;
|
|
13
|
-
}
|
|
14
|
-
`, document.head.appendChild(n);
|
|
1
|
+
import e from "./loading.module.scss.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
|
+
import r from "clsx";
|
|
5
|
+
//#region src/react/loading/loading.component.tsx
|
|
6
|
+
function i() {
|
|
7
|
+
if (document.getElementById("noscroll-style")) return;
|
|
8
|
+
let e = document.createElement("style");
|
|
9
|
+
e.id = "noscroll-style", e.innerHTML = "\n .noscroll {\n overflow: hidden !important;\n height: 100vh !important;\n }\n ", document.head.appendChild(e);
|
|
15
10
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
11
|
+
function a({ full: a = !1, className: o = "", message: s = "Loading", ...c }) {
|
|
12
|
+
n(() => {
|
|
13
|
+
if (a) {
|
|
14
|
+
document.body.classList.add("noscroll");
|
|
15
|
+
let e = (e) => e.preventDefault();
|
|
16
|
+
return document.addEventListener("contextmenu", e), () => {
|
|
17
|
+
document.body.classList.remove("noscroll"), document.removeEventListener("contextmenu", e);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}, [a]), n(() => {
|
|
21
|
+
i();
|
|
22
|
+
}, []);
|
|
23
|
+
function l() {
|
|
24
|
+
return /* @__PURE__ */ t.createElement("div", {
|
|
25
|
+
role: "status",
|
|
26
|
+
"aria-live": "polite",
|
|
27
|
+
"aria-label": s,
|
|
28
|
+
className: e.container,
|
|
29
|
+
...c
|
|
30
|
+
}, /* @__PURE__ */ t.createElement("div", {
|
|
31
|
+
className: e.ring,
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
}), /* @__PURE__ */ t.createElement("div", {
|
|
34
|
+
className: e.ring,
|
|
35
|
+
"aria-hidden": "true"
|
|
36
|
+
}), /* @__PURE__ */ t.createElement("div", {
|
|
37
|
+
className: e.ring,
|
|
38
|
+
"aria-hidden": "true"
|
|
39
|
+
}), /* @__PURE__ */ t.createElement("div", {
|
|
40
|
+
className: e.ring,
|
|
41
|
+
"aria-hidden": "true"
|
|
42
|
+
}), s && /* @__PURE__ */ t.createElement("div", { className: e.message }, s));
|
|
43
|
+
}
|
|
44
|
+
return a ? /* @__PURE__ */ t.createElement("div", { className: r(e.full, o) }, l()) : /* @__PURE__ */ t.createElement("div", { className: r(e.block, o) }, l());
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=loading.component.js.map
|
|
46
|
+
//#endregion
|
|
47
|
+
export { a as Loading };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=loading.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.component.js","sources":["../../../src/react/loading/loading.component.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport * as React from 'react';\nimport { useEffect } from 'react';\n\nimport type { I_LoadingProps } from './loading.type.js';\n\nimport style from './loading.module.scss';\n\n/**\n * Injects CSS styles to prevent scrolling when full-screen loading is active.\n * This function creates and injects a style element that adds the 'noscroll' class\n * to prevent body scrolling and sets a fixed height. It ensures the style is only\n * injected once by checking for an existing style element with the same ID.\n */\nfunction injectNoScrollStyle() {\n if (document.getElementById('noscroll-style')) {\n return;\n }\n\n const style = document.createElement('style');\n style.id = 'noscroll-style';\n style.innerHTML = `\n .noscroll {\n overflow: hidden !important;\n height: 100vh !important;\n }\n `;\n document.head.appendChild(style);\n}\n\n/**\n * Loading component that displays animated loading indicators.\n * This component provides a customizable loading interface with animated rings\n * and optional full-screen overlay. It includes features for preventing user\n * interaction during loading states and supports both inline and full-screen modes.\n *\n * Features:\n * - Animated loading rings with multiple colors\n * - Full-screen overlay mode with scroll prevention\n * - Context menu prevention during full-screen loading\n * - Customizable loading message\n * - Responsive design with CSS modules\n * - Accessibility considerations with reduced motion support\n *\n * @param props - Component props containing loading configuration.\n * @param props.full - Whether to display the loading indicator in full-screen mode (default: false).\n * @param props.className - Additional CSS classes to apply to the loading container.\n * @param props.message - Custom message to display below the loading animation.\n * @param props.rest - Additional props to spread to the loading container.\n * @returns A React component displaying the loading animation with optional full-screen overlay.\n */\nexport function Loading({ full = false, className = '', message = 'Loading', ...rest }: I_LoadingProps) {\n useEffect(() => {\n if (full) {\n document.body.classList.add('noscroll');\n\n const handleContextMenu = (e: MouseEvent) => e.preventDefault();\n document.addEventListener('contextmenu', handleContextMenu);\n\n return () => {\n document.body.classList.remove('noscroll');\n document.removeEventListener('contextmenu', handleContextMenu);\n };\n }\n }, [full]);\n\n useEffect(() => {\n injectNoScrollStyle();\n }, []);\n\n /**\n * Renders the core loading animation with rings and message.\n * This function creates the animated loading rings and optional message\n * that are used in both full-screen and inline loading modes.\n *\n * @returns A React element containing the loading animation and message.\n */\n function _renderLoading() {\n return (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={message}\n className={style['container']}\n {...rest}\n >\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n {message && <div className={style['message']}>{message}</div>}\n </div>\n );\n }\n\n if (full) {\n return (\n <div className={clsx(style['full'], className)}>\n {_renderLoading()}\n </div>\n );\n }\n\n return (\n <div className={clsx(style['block'], className)}>\n {_renderLoading()}\n </div>\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"loading.component.js","names":[],"sources":["../../../src/react/loading/loading.component.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport * as React from 'react';\nimport { useEffect } from 'react';\n\nimport type { I_LoadingProps } from './loading.type.js';\n\nimport style from './loading.module.scss';\n\n/**\n * Injects CSS styles to prevent scrolling when full-screen loading is active.\n * This function creates and injects a style element that adds the 'noscroll' class\n * to prevent body scrolling and sets a fixed height. It ensures the style is only\n * injected once by checking for an existing style element with the same ID.\n */\nfunction injectNoScrollStyle() {\n if (document.getElementById('noscroll-style')) {\n return;\n }\n\n const style = document.createElement('style');\n style.id = 'noscroll-style';\n style.innerHTML = `\n .noscroll {\n overflow: hidden !important;\n height: 100vh !important;\n }\n `;\n document.head.appendChild(style);\n}\n\n/**\n * Loading component that displays animated loading indicators.\n * This component provides a customizable loading interface with animated rings\n * and optional full-screen overlay. It includes features for preventing user\n * interaction during loading states and supports both inline and full-screen modes.\n *\n * Features:\n * - Animated loading rings with multiple colors\n * - Full-screen overlay mode with scroll prevention\n * - Context menu prevention during full-screen loading\n * - Customizable loading message\n * - Responsive design with CSS modules\n * - Accessibility considerations with reduced motion support\n *\n * @param props - Component props containing loading configuration.\n * @param props.full - Whether to display the loading indicator in full-screen mode (default: false).\n * @param props.className - Additional CSS classes to apply to the loading container.\n * @param props.message - Custom message to display below the loading animation.\n * @param props.rest - Additional props to spread to the loading container.\n * @returns A React component displaying the loading animation with optional full-screen overlay.\n */\nexport function Loading({ full = false, className = '', message = 'Loading', ...rest }: I_LoadingProps) {\n useEffect(() => {\n if (full) {\n document.body.classList.add('noscroll');\n\n const handleContextMenu = (e: MouseEvent) => e.preventDefault();\n document.addEventListener('contextmenu', handleContextMenu);\n\n return () => {\n document.body.classList.remove('noscroll');\n document.removeEventListener('contextmenu', handleContextMenu);\n };\n }\n }, [full]);\n\n useEffect(() => {\n injectNoScrollStyle();\n }, []);\n\n /**\n * Renders the core loading animation with rings and message.\n * This function creates the animated loading rings and optional message\n * that are used in both full-screen and inline loading modes.\n *\n * @returns A React element containing the loading animation and message.\n */\n function _renderLoading() {\n return (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={message}\n className={style['container']}\n {...rest}\n >\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n <div className={style['ring']} aria-hidden=\"true\"></div>\n {message && <div className={style['message']}>{message}</div>}\n </div>\n );\n }\n\n if (full) {\n return (\n <div className={clsx(style['full'], className)}>\n {_renderLoading()}\n </div>\n );\n }\n\n return (\n <div className={clsx(style['block'], className)}>\n {_renderLoading()}\n </div>\n );\n}\n"],"mappings":";;;;;AAcA,SAAS,IAAsB;AAC3B,KAAI,SAAS,eAAe,iBAAiB,CACzC;CAGJ,IAAM,IAAQ,SAAS,cAAc,QAAQ;AAQ7C,CAPA,EAAM,KAAK,kBACX,EAAM,YAAY,2GAMlB,SAAS,KAAK,YAAY,EAAM;;AAwBpC,SAAgB,EAAQ,EAAE,UAAO,IAAO,eAAY,IAAI,aAAU,WAAW,GAAG,KAAwB;AAepG,CAdA,QAAgB;AACZ,MAAI,GAAM;AACN,YAAS,KAAK,UAAU,IAAI,WAAW;GAEvC,IAAM,KAAqB,MAAkB,EAAE,gBAAgB;AAG/D,UAFA,SAAS,iBAAiB,eAAe,EAAkB,QAE9C;AAET,IADA,SAAS,KAAK,UAAU,OAAO,WAAW,EAC1C,SAAS,oBAAoB,eAAe,EAAkB;;;IAGvE,CAAC,EAAK,CAAC,EAEV,QAAgB;AACZ,KAAqB;IACtB,EAAE,CAAC;CASN,SAAS,IAAiB;AACtB,SACI,kBAAA,cAAC,OAAD;GACI,MAAK;GACL,aAAU;GACV,cAAY;GACZ,WAAW,EAAM;GACjB,GAAI;GAOF,EALF,kBAAA,cAAC,OAAD;GAAK,WAAW,EAAM;GAAS,eAAY;GAAa,CAAA,EACxD,kBAAA,cAAC,OAAD;GAAK,WAAW,EAAM;GAAS,eAAY;GAAa,CAAA,EACxD,kBAAA,cAAC,OAAD;GAAK,WAAW,EAAM;GAAS,eAAY;GAAa,CAAA,EACxD,kBAAA,cAAC,OAAD;GAAK,WAAW,EAAM;GAAS,eAAY;GAAa,CAAA,EACvD,KAAW,kBAAA,cAAC,OAAD,EAAK,WAAW,EAAM,SAA2B,EAAd,EAAc,CAC3D;;AAYd,QARI,IAEI,kBAAA,cAAC,OAAD,EAAK,WAAW,EAAK,EAAM,MAAS,EAAU,EAExC,EADD,GAAgB,CACf,GAKV,kBAAA,cAAC,OAAD,EAAK,WAAW,EAAK,EAAM,OAAU,EAAU,EAEzC,EADD,GAAgB,CACf"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
//#region src/react/loading/loading.context.tsx
|
|
3
|
+
var t = e(void 0);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t as LoadingContext };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=loading.context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.context.js","sources":["../../../src/react/loading/loading.context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { I_LoadingContext } from './loading.type.js';\n\nexport const LoadingContext = createContext<I_LoadingContext | undefined>(undefined);\n"],"
|
|
1
|
+
{"version":3,"file":"loading.context.js","names":[],"sources":["../../../src/react/loading/loading.context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { I_LoadingContext } from './loading.type.js';\n\nexport const LoadingContext = createContext<I_LoadingContext | undefined>(undefined);\n"],"mappings":";;AAIA,IAAa,IAAiB,EAA4C,KAAA,EAAU"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { LoadingContext as e } from "./loading.context.js";
|
|
2
|
+
import { use as t } from "react";
|
|
3
|
+
//#region src/react/loading/loading.hook.tsx
|
|
4
|
+
function n() {
|
|
5
|
+
let n = t(e);
|
|
6
|
+
if (!n) throw Error("useLoading must be used within a LoadingProvider");
|
|
7
|
+
return n;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=loading.hook.js.map
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as useLoading };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=loading.hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.hook.js","sources":["../../../src/react/loading/loading.hook.tsx"],"sourcesContent":["import { use } from 'react';\n\nimport { LoadingContext } from './loading.context.js';\n\n/**\n * React hook that provides access to loading context.\n * This hook retrieves the loading context which contains loading state and\n * control methods. It provides a convenient way to access loading functionality\n * within components, allowing them to show and hide loading states.\n *\n * The hook will throw an error if used outside of a LoadingProvider,\n * ensuring proper context usage and providing clear error messages for debugging.\n *\n * @returns The loading context containing loading state and control methods.\n * @throws {Error} When used outside of a LoadingProvider context.\n */\nexport function useLoading() {\n const context = use(LoadingContext);\n if (!context) {\n throw new Error('useLoading must be used within a LoadingProvider');\n }\n return context;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"loading.hook.js","names":[],"sources":["../../../src/react/loading/loading.hook.tsx"],"sourcesContent":["import { use } from 'react';\n\nimport { LoadingContext } from './loading.context.js';\n\n/**\n * React hook that provides access to loading context.\n * This hook retrieves the loading context which contains loading state and\n * control methods. It provides a convenient way to access loading functionality\n * within components, allowing them to show and hide loading states.\n *\n * The hook will throw an error if used outside of a LoadingProvider,\n * ensuring proper context usage and providing clear error messages for debugging.\n *\n * @returns The loading context containing loading state and control methods.\n * @throws {Error} When used outside of a LoadingProvider context.\n */\nexport function useLoading() {\n const context = use(LoadingContext);\n if (!context) {\n throw new Error('useLoading must be used within a LoadingProvider');\n }\n return context;\n}\n"],"mappings":";;;AAgBA,SAAgB,IAAa;CACzB,IAAM,IAAU,EAAI,EAAe;AACnC,KAAI,CAAC,EACD,OAAU,MAAM,mDAAmD;AAEvE,QAAO"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/react/loading/loading.module.scss
|
|
2
|
+
var e = "_overlay_b1d9o_1", t = "_full_b1d9o_1", n = "_block_b1d9o_2", r = "_container_b1d9o_40", i = "_ring_b1d9o_50", a = "_rotate1_b1d9o_1", o = "_rotate2_b1d9o_1", s = "_rotate3_b1d9o_1", c = "_rotate4_b1d9o_1", l = "_message_b1d9o_74", u = {
|
|
3
|
+
overlay: e,
|
|
4
|
+
full: t,
|
|
5
|
+
block: n,
|
|
6
|
+
"overlay-fade-in": "_overlay-fade-in_b1d9o_1",
|
|
7
|
+
container: r,
|
|
8
|
+
ring: i,
|
|
9
|
+
rotate1: a,
|
|
10
|
+
rotate2: o,
|
|
11
|
+
rotate3: s,
|
|
12
|
+
rotate4: c,
|
|
13
|
+
message: l,
|
|
14
|
+
"text-fade": "_text-fade_b1d9o_1"
|
|
7
15
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
o as full,
|
|
13
|
-
c as message,
|
|
14
|
-
s as ring
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=loading.module.scss.js.map
|
|
16
|
+
//#endregion
|
|
17
|
+
export { u as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=loading.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.module.scss.js","
|
|
1
|
+
{"version":3,"file":"loading.module.scss.js","names":[],"sources":["../../../src/react/loading/loading.module.scss"],"sourcesContent":["@use 'sass:map';\n\n$colors: (\n 1: hsl(315, 90%, 60%),\n 2: hsl(345, 90%, 50%),\n 3: hsl(180, 80%, 40%),\n 4: hsl(40, 100%, 45%),\n);\n\n$size-small: clamp(40px, 8vw, 100px);\n$size-medium: clamp(60px, 10vw, 150px);\n$size-large: clamp(80px, 12vw, 190px);\n\n.overlay {\n z-index: 999999;\n background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.7));\n backdrop-filter: blur(20px) saturate(200%);\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n animation: overlay-fade-in 0.5s ease-out;\n border: 1.5px solid rgba(255, 255, 255, 0.35);\n box-shadow:\n 0 4px 32px rgba(31, 38, 135, 0.18),\n inset 0 1.5px 8px rgba(255, 255, 255, 0.25);\n}\n\n.full,\n.block {\n pointer-events: none;\n\n @extend .overlay;\n}\n\n.full {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n\n.block {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n background: rgba(255, 255, 255, 0.1);\n backdrop-filter: blur(4px);\n}\n\n.container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n position: relative;\n padding: 1rem;\n gap: 1.5rem;\n text-align: center;\n\n .ring {\n width: $size-medium;\n height: $size-medium;\n border: 2px solid transparent;\n border-radius: 50%;\n position: absolute;\n transition: transform 0.3s ease;\n\n @for $i from 1 through 4 {\n &:nth-child(#{$i}) {\n border-bottom: 8px solid map.get($colors, $i);\n animation: rotate#{$i} 1s linear infinite;\n }\n }\n }\n\n .message {\n font-weight: bold;\n color: hsl(240, 8%, 20%);\n text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);\n animation: text-fade 2s ease-in-out infinite alternate;\n word-break: break-word;\n hyphens: auto;\n }\n}\n\n@keyframes rotate1 {\n from {\n transform: rotateX(50deg) rotateZ(110deg);\n }\n\n to {\n transform: rotateX(50deg) rotateZ(470deg);\n }\n}\n\n@keyframes rotate2 {\n from {\n transform: rotateX(20deg) rotateY(50deg) rotateZ(20deg);\n }\n\n to {\n transform: rotateX(20deg) rotateY(50deg) rotateZ(380deg);\n }\n}\n\n@keyframes rotate3 {\n from {\n transform: rotateX(40deg) rotateY(130deg) rotateZ(450deg);\n }\n\n to {\n transform: rotateX(40deg) rotateY(130deg) rotateZ(90deg);\n }\n}\n\n@keyframes rotate4 {\n from {\n transform: rotateX(70deg) rotateZ(270deg);\n }\n\n to {\n transform: rotateX(70deg) rotateZ(630deg);\n }\n}\n\n@keyframes text-fade {\n 0% {\n opacity: 0.6;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes overlay-fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ring,\n .message,\n .overlay {\n animation: none !important;\n }\n}\n"],"mappings":""}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Loading as e } from "./loading.component.js";
|
|
2
|
+
import { LoadingContext as t } from "./loading.context.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { useCallback as r, useMemo as i, useState as a } from "react";
|
|
5
|
+
//#region src/react/loading/loading.provider.tsx
|
|
6
|
+
function o({ children: o }) {
|
|
7
|
+
let [s, c] = a(!1), [l, u] = a(!1), d = r((e = !1) => {
|
|
8
|
+
c(!0), u(e);
|
|
9
|
+
}, []), f = r(() => {
|
|
10
|
+
c(!1), u(!1);
|
|
11
|
+
}, []), p = i(() => ({
|
|
12
|
+
isLoading: s,
|
|
13
|
+
isGlobalLoading: l,
|
|
14
|
+
showLoading: d,
|
|
15
|
+
hideLoading: f
|
|
16
|
+
}), [
|
|
17
|
+
s,
|
|
18
|
+
l,
|
|
19
|
+
d,
|
|
20
|
+
f
|
|
21
|
+
]);
|
|
22
|
+
return /* @__PURE__ */ n.createElement(t, { value: p }, s ? /* @__PURE__ */ n.createElement(e, { full: l }) : o);
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=loading.provider.js.map
|
|
24
|
+
//#endregion
|
|
25
|
+
export { o as LoadingProvider };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=loading.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.provider.js","sources":["../../../src/react/loading/loading.provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport { Loading } from './loading.component.js';\nimport { LoadingContext } from './loading.context.js';\n\n/**\n * Provider component that manages loading state and provides loading context.\n * This component sets up loading state management for the application and provides\n * loading context to all child components through React context.\n *\n * Features:\n * - Global loading state management\n * - Loading context provision to child components\n * - Automatic loading state synchronization\n * - Integration with loading components\n *\n * @param props - Component props containing children.\n * @param props.children - React children that will have access to the loading context.\n * @returns A React component that provides loading context to its children.\n */\nexport function LoadingProvider({ children }: I_Children) {\n const [isLoading, setIsLoading] = useState(false);\n const [isGlobalLoading, setIsGlobalLoading] = useState(false);\n\n const showLoading = useCallback((global = false) => {\n setIsLoading(true);\n setIsGlobalLoading(global);\n }, []);\n\n const hideLoading = useCallback(() => {\n setIsLoading(false);\n setIsGlobalLoading(false);\n }, []);\n\n const contextValue = useMemo(\n () => ({ isLoading, isGlobalLoading, showLoading, hideLoading }),\n [isLoading, isGlobalLoading, showLoading, hideLoading],\n );\n\n return (\n <LoadingContext value={contextValue}>\n {isLoading ? <Loading full={isGlobalLoading} /> : children}\n </LoadingContext>\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"loading.provider.js","names":[],"sources":["../../../src/react/loading/loading.provider.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport { Loading } from './loading.component.js';\nimport { LoadingContext } from './loading.context.js';\n\n/**\n * Provider component that manages loading state and provides loading context.\n * This component sets up loading state management for the application and provides\n * loading context to all child components through React context.\n *\n * Features:\n * - Global loading state management\n * - Loading context provision to child components\n * - Automatic loading state synchronization\n * - Integration with loading components\n *\n * @param props - Component props containing children.\n * @param props.children - React children that will have access to the loading context.\n * @returns A React component that provides loading context to its children.\n */\nexport function LoadingProvider({ children }: I_Children) {\n const [isLoading, setIsLoading] = useState(false);\n const [isGlobalLoading, setIsGlobalLoading] = useState(false);\n\n const showLoading = useCallback((global = false) => {\n setIsLoading(true);\n setIsGlobalLoading(global);\n }, []);\n\n const hideLoading = useCallback(() => {\n setIsLoading(false);\n setIsGlobalLoading(false);\n }, []);\n\n const contextValue = useMemo(\n () => ({ isLoading, isGlobalLoading, showLoading, hideLoading }),\n [isLoading, isGlobalLoading, showLoading, hideLoading],\n );\n\n return (\n <LoadingContext value={contextValue}>\n {isLoading ? <Loading full={isGlobalLoading} /> : children}\n </LoadingContext>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAgB,EAAgB,EAAE,eAAwB;CACtD,IAAM,CAAC,GAAW,KAAgB,EAAS,GAAM,EAC3C,CAAC,GAAiB,KAAsB,EAAS,GAAM,EAEvD,IAAc,GAAa,IAAS,OAAU;AAEhD,EADA,EAAa,GAAK,EAClB,EAAmB,EAAO;IAC3B,EAAE,CAAC,EAEA,IAAc,QAAkB;AAElC,EADA,EAAa,GAAM,EACnB,EAAmB,GAAM;IAC1B,EAAE,CAAC,EAEA,IAAe,SACV;EAAE;EAAW;EAAiB;EAAa;EAAa,GAC/D;EAAC;EAAW;EAAiB;EAAa;EAAY,CACzD;AAED,QACI,kBAAA,cAAC,GAAD,EAAgB,OAAO,GAEN,EADZ,IAAY,kBAAA,cAAC,GAAD,EAAS,MAAM,GAAmB,CAAA,GAAG,EACrC"}
|
package/dist/react/log/index.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import { catchError as
|
|
2
|
-
export {
|
|
3
|
-
c as catchError,
|
|
4
|
-
t as log
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { catchError as e, log as t, throwError as n } from "./log.util.js";
|
|
2
|
+
export { e as catchError, t as log, n as throwError };
|
|
@@ -22,3 +22,11 @@ export declare function catchError<T = unknown>(errorInput: unknown, options: I_
|
|
|
22
22
|
returnValue: T;
|
|
23
23
|
}): T;
|
|
24
24
|
export declare function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Throws a standardized error with a message and optional HTTP status code.
|
|
27
|
+
* Provides a consistent way to throw errors across React and Node environments.
|
|
28
|
+
*
|
|
29
|
+
* @param message - The error message.
|
|
30
|
+
* @param code - Optional HTTP status code (defaults to 500).
|
|
31
|
+
*/
|
|
32
|
+
export declare function throwError(message: string, code?: number): never;
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { RESPONSE_STATUS as e } from "../../constant/response-status.js";
|
|
2
|
+
import { consola as t } from "consola/browser";
|
|
3
|
+
//#region src/react/log/log.util.ts
|
|
4
|
+
var n = {
|
|
5
|
+
silent: t.silent,
|
|
6
|
+
level: t.level,
|
|
7
|
+
fatal: t.fatal,
|
|
8
|
+
error: t.error,
|
|
9
|
+
warn: t.warn,
|
|
10
|
+
log: t.log,
|
|
11
|
+
info: t.info,
|
|
12
|
+
success: t.success,
|
|
13
|
+
ready: t.ready,
|
|
14
|
+
start: t.start,
|
|
15
|
+
box: t.box,
|
|
16
|
+
debug: t.debug,
|
|
17
|
+
trace: t.trace,
|
|
18
|
+
verbose: t.verbose
|
|
18
19
|
};
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function r(t, r) {
|
|
21
|
+
let { shouldLog: i = !0, returnValue: a, callback: o } = r ?? {}, s = t instanceof Error ? t : Error(typeof t == "string" ? t : "Unknown error");
|
|
22
|
+
return i && n.error(s.message), o && typeof o == "function" && o(s), a === void 0 ? {
|
|
23
|
+
success: !1,
|
|
24
|
+
message: s.message,
|
|
25
|
+
code: e.INTERNAL_SERVER_ERROR.CODE
|
|
26
|
+
} : a;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
//#
|
|
28
|
+
function i(t, n) {
|
|
29
|
+
let r = Error(t);
|
|
30
|
+
throw r.code = n ?? e.INTERNAL_SERVER_ERROR.CODE, r;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { r as catchError, n as log, i as throwError };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=log.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.util.js","sources":["../../../src/react/log/log.util.ts"],"sourcesContent":["import { consola } from 'consola/browser';\n\nimport type { I_Log, I_Return } from '#typescript/index.js';\n\nimport { RESPONSE_STATUS } from '#constant/index.js';\n\nimport type { I_CatchErrorOptions } from './log.type.js';\n\n/**\n * Browser-compatible logging interface using consola.\n * This object provides all standard consola logging methods for use in browser environments,\n * including error, warning, info, success, and debug logging capabilities.\n */\nexport const log: I_Log = {\n silent: consola.silent,\n level: consola.level,\n fatal: consola.fatal,\n error: consola.error,\n warn: consola.warn,\n log: consola.log,\n info: consola.info,\n success: consola.success,\n ready: consola.ready,\n start: consola.start,\n box: consola.box,\n debug: consola.debug,\n trace: consola.trace,\n verbose: consola.verbose,\n};\n\n/**\n * Catches and handles errors with configurable behavior for React applications.\n * This function provides a standardized way to handle errors in React components\n * with options for logging control, return value specification, and custom callback execution.\n *\n * The function handles different error input types and provides consistent error\n * response formatting for React applications.\n *\n * @param errorInput - The error to catch and handle, can be Error object, string, or unknown type.\n * @param options - Configuration options for error handling behavior.\n * @returns Either the specified return value or a standardized error response object.\n */\nexport function catchError<T = unknown>(errorInput: unknown, options: I_CatchErrorOptions & { returnValue: T }): T;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T>;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T> | T {\n const { shouldLog = true, returnValue, callback } = options ?? {};\n\n const error = errorInput instanceof Error\n ? errorInput\n : new Error(typeof errorInput === 'string' ? errorInput : 'Unknown error');\n\n if (shouldLog) {\n log.error(error.message);\n }\n\n if (callback && typeof callback === 'function') {\n callback(error);\n }\n\n if (returnValue) {\n return returnValue as I_Return<T>;\n }\n\n return {\n success: false,\n message: error.message,\n code: RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE,\n };\n}\n
|
|
1
|
+
{"version":3,"file":"log.util.js","names":[],"sources":["../../../src/react/log/log.util.ts"],"sourcesContent":["import { consola } from 'consola/browser';\n\nimport type { I_Log, I_Return } from '#typescript/index.js';\n\nimport { RESPONSE_STATUS } from '#constant/index.js';\n\nimport type { I_CatchErrorOptions } from './log.type.js';\n\n/**\n * Browser-compatible logging interface using consola.\n * This object provides all standard consola logging methods for use in browser environments,\n * including error, warning, info, success, and debug logging capabilities.\n */\nexport const log: I_Log = {\n silent: consola.silent,\n level: consola.level,\n fatal: consola.fatal,\n error: consola.error,\n warn: consola.warn,\n log: consola.log,\n info: consola.info,\n success: consola.success,\n ready: consola.ready,\n start: consola.start,\n box: consola.box,\n debug: consola.debug,\n trace: consola.trace,\n verbose: consola.verbose,\n};\n\n/**\n * Catches and handles errors with configurable behavior for React applications.\n * This function provides a standardized way to handle errors in React components\n * with options for logging control, return value specification, and custom callback execution.\n *\n * The function handles different error input types and provides consistent error\n * response formatting for React applications.\n *\n * @param errorInput - The error to catch and handle, can be Error object, string, or unknown type.\n * @param options - Configuration options for error handling behavior.\n * @returns Either the specified return value or a standardized error response object.\n */\nexport function catchError<T = unknown>(errorInput: unknown, options: I_CatchErrorOptions & { returnValue: T }): T;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T>;\nexport function catchError<T = unknown>(errorInput: unknown, options?: I_CatchErrorOptions): I_Return<T> | T {\n const { shouldLog = true, returnValue, callback } = options ?? {};\n\n const error = errorInput instanceof Error\n ? errorInput\n : new Error(typeof errorInput === 'string' ? errorInput : 'Unknown error');\n\n if (shouldLog) {\n log.error(error.message);\n }\n\n if (callback && typeof callback === 'function') {\n callback(error);\n }\n\n if (returnValue !== undefined) {\n return returnValue as I_Return<T>;\n }\n\n return {\n success: false,\n message: error.message,\n code: RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE,\n };\n}\n\n/**\n * Throws a standardized error with a message and optional HTTP status code.\n * Provides a consistent way to throw errors across React and Node environments.\n *\n * @param message - The error message.\n * @param code - Optional HTTP status code (defaults to 500).\n */\nexport function throwError(message: string, code?: number): never {\n const error = new Error(message);\n (error as Error & { code?: number }).code = code ?? RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE;\n throw error;\n}\n"],"mappings":";;;AAaA,IAAa,IAAa;CACtB,QAAQ,EAAQ;CAChB,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,MAAM,EAAQ;CACd,KAAK,EAAQ;CACb,MAAM,EAAQ;CACd,SAAS,EAAQ;CACjB,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,KAAK,EAAQ;CACb,OAAO,EAAQ;CACf,OAAO,EAAQ;CACf,SAAS,EAAQ;CACpB;AAgBD,SAAgB,EAAwB,GAAqB,GAAgD;CACzG,IAAM,EAAE,eAAY,IAAM,gBAAa,gBAAa,KAAW,EAAE,EAE3D,IAAQ,aAAsB,QAC9B,IACI,MAAM,OAAO,KAAe,WAAW,IAAa,gBAAgB;AAc9E,QAZI,KACA,EAAI,MAAM,EAAM,QAAQ,EAGxB,KAAY,OAAO,KAAa,cAChC,EAAS,EAAM,EAGf,MAAgB,KAAA,IAIb;EACH,SAAS;EACT,SAAS,EAAM;EACf,MAAM,EAAgB,sBAAsB;EAC/C,GAPU;;AAiBf,SAAgB,EAAW,GAAiB,GAAsB;CAC9D,IAAM,IAAY,MAAM,EAAQ;AAEhC,OADC,EAAoC,OAAO,KAAQ,EAAgB,sBAAsB,MACpF"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { NEXT_INTL_DEFAULT_LANGUAGE as
|
|
2
|
-
import { NextIntlContext as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { NextIntlProvider as
|
|
6
|
-
export {
|
|
7
|
-
r as NEXT_INTL_DEFAULT_LANGUAGE,
|
|
8
|
-
x as NextIntlContext,
|
|
9
|
-
p as NextIntlProvider,
|
|
10
|
-
I as useNextIntl,
|
|
11
|
-
f as useTranslateNextIntl,
|
|
12
|
-
n as withNextIntl
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { NEXT_INTL_DEFAULT_LANGUAGE as e } from "./next-intl.constant.js";
|
|
2
|
+
import { NextIntlContext as t } from "./next-intl.context.js";
|
|
3
|
+
import { useNextIntl as n, useTranslateNextIntl as r } from "./next-intl.hook.js";
|
|
4
|
+
import { withNextIntl as i } from "./next-intl.hoc.js";
|
|
5
|
+
import { NextIntlProvider as a } from "./next-intl.provider.js";
|
|
6
|
+
export { e as NEXT_INTL_DEFAULT_LANGUAGE, t as NextIntlContext, a as NextIntlProvider, n as useNextIntl, r as useTranslateNextIntl, i as withNextIntl };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { enUS as e } from "date-fns/locale";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
//#region src/react/next-intl/next-intl.constant.ts
|
|
3
|
+
var t = {
|
|
4
|
+
label: "English",
|
|
5
|
+
value: "en",
|
|
6
|
+
flag: "πΊπΈ",
|
|
7
|
+
adapterLocale: e,
|
|
8
|
+
icon: "flagpack:gb-nir",
|
|
9
|
+
numberFormat: {
|
|
10
|
+
code: "en-US",
|
|
11
|
+
currency: "USD"
|
|
12
|
+
},
|
|
13
|
+
timezone: "America/New_York"
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=next-intl.constant.js.map
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as NEXT_INTL_DEFAULT_LANGUAGE };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=next-intl.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.constant.js","sources":["../../../src/react/next-intl/next-intl.constant.ts"],"sourcesContent":["import { enUS as enUSAdapter } from 'date-fns/locale';\n\n/**\n * Default language configuration for Next.js internationalization.\n * This constant provides the default English (US) language settings including:\n * - Language label and value for display and identification\n * - Flag emoji and icon for UI representation\n * - Date-fns locale adapter for date formatting\n * - Number formatting configuration (locale and currency)\n * - Timezone setting for date/time operations\n */\nexport const NEXT_INTL_DEFAULT_LANGUAGE = {\n label: 'English',\n value: 'en',\n flag: 'πΊπΈ',\n adapterLocale: enUSAdapter,\n icon: 'flagpack:gb-nir',\n numberFormat: {\n code: 'en-US',\n currency: 'USD',\n },\n timezone: 'America/New_York',\n};\n"],"
|
|
1
|
+
{"version":3,"file":"next-intl.constant.js","names":[],"sources":["../../../src/react/next-intl/next-intl.constant.ts"],"sourcesContent":["import { enUS as enUSAdapter } from 'date-fns/locale';\n\n/**\n * Default language configuration for Next.js internationalization.\n * This constant provides the default English (US) language settings including:\n * - Language label and value for display and identification\n * - Flag emoji and icon for UI representation\n * - Date-fns locale adapter for date formatting\n * - Number formatting configuration (locale and currency)\n * - Timezone setting for date/time operations\n */\nexport const NEXT_INTL_DEFAULT_LANGUAGE = {\n label: 'English',\n value: 'en',\n flag: 'πΊπΈ',\n adapterLocale: enUSAdapter,\n icon: 'flagpack:gb-nir',\n numberFormat: {\n code: 'en-US',\n currency: 'USD',\n },\n timezone: 'America/New_York',\n};\n"],"mappings":";;AAWA,IAAa,IAA6B;CACtC,OAAO;CACP,OAAO;CACP,MAAM;CACN,eAAe;CACf,MAAM;CACN,cAAc;EACV,MAAM;EACN,UAAU;EACb;CACD,UAAU;CACb"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
1
|
+
import { createContext as e } from "react";
|
|
2
|
+
//#region src/react/next-intl/next-intl.context.tsx
|
|
3
|
+
var t = e(void 0);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t as NextIntlContext };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=next-intl.context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.context.js","sources":["../../../src/react/next-intl/next-intl.context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { I_NextIntlContext } from './next-intl.type.js';\n\nexport const NextIntlContext = createContext<I_NextIntlContext | undefined>(undefined);\n"],"
|
|
1
|
+
{"version":3,"file":"next-intl.context.js","names":[],"sources":["../../../src/react/next-intl/next-intl.context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { I_NextIntlContext } from './next-intl.type.js';\n\nexport const NextIntlContext = createContext<I_NextIntlContext | undefined>(undefined);\n"],"mappings":";;AAIA,IAAa,IAAkB,EAA6C,KAAA,EAAU"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
) : (N.warn(`Missing messages for language: ${e?.value || n}`), null);
|
|
18
|
-
};
|
|
19
|
-
return a.displayName = `withNextIntl(${t.displayName || t.name || "Component"})`, a;
|
|
1
|
+
import { log as e } from "../log/log.util.js";
|
|
2
|
+
import { NEXT_INTL_DEFAULT_LANGUAGE as t } from "./next-intl.constant.js";
|
|
3
|
+
import { useNextIntl as n } from "./next-intl.hook.js";
|
|
4
|
+
import * as r from "react";
|
|
5
|
+
import { NextIntlClientProvider as i } from "next-intl";
|
|
6
|
+
//#region src/react/next-intl/next-intl.hoc.tsx
|
|
7
|
+
function a(a) {
|
|
8
|
+
let o = (o) => {
|
|
9
|
+
let { currentLanguage: s } = n(), { messages: c, languages: l } = o, u = c[s?.value || "en"], d = l.find((e) => e.value === s?.value)?.timezone ?? t.timezone;
|
|
10
|
+
return c ? /* @__PURE__ */ r.createElement(i, {
|
|
11
|
+
locale: s?.value || "en",
|
|
12
|
+
messages: u || null,
|
|
13
|
+
timeZone: d
|
|
14
|
+
}, /* @__PURE__ */ r.createElement(a, o)) : (e.warn(`Missing messages for language: ${s?.value || "en"}`), null);
|
|
15
|
+
};
|
|
16
|
+
return o.displayName = `withNextIntl(${a.displayName || a.name || "Component"})`, o;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=next-intl.hoc.js.map
|
|
18
|
+
//#endregion
|
|
19
|
+
export { a as withNextIntl };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=next-intl.hoc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.hoc.js","sources":["../../../src/react/next-intl/next-intl.hoc.tsx"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { NextIntlClientProvider } from 'next-intl';\nimport * as React from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport type { I_NextIntlLanguage, T_NextIntlMessageList } from './next-intl.type.js';\n\nimport { log } from '../log/index.js';\nimport { NEXT_INTL_DEFAULT_LANGUAGE } from './next-intl.constant.js';\nimport { useNextIntl } from './next-intl.hook.js';\n\n/**\n * Higher-Order Component (HOC) that wraps components with Next.js internationalization support.\n * This HOC provides internationalization capabilities to React components by wrapping them\n * with the NextIntlClientProvider. It automatically handles language detection, message\n * loading, and timezone configuration based on the current language settings.\n *\n * Features:\n * - Automatic language detection and message loading\n * - Timezone configuration based on language settings\n * - Fallback to default language when messages are missing\n * - Warning logging for missing message configurations\n * - Proper display name preservation for debugging\n *\n * @param Component - The React component to wrap with internationalization support.\n * @returns A new component with internationalization capabilities and additional props for languages and messages.\n */\nexport function withNextIntl<T extends I_Children>(Component: ComponentType<T>) {\n const PageWithI18n = (props: T & { languages: I_NextIntlLanguage[]; messages: T_NextIntlMessageList }) => {\n const { currentLanguage } = useNextIntl();\n const { messages, languages } = props;\n const defaultLang = 'en';\n\n const defaultMessages = messages[currentLanguage?.value || defaultLang];\n const timeZone = languages.find(lang => lang.value === currentLanguage?.value)?.timezone ?? NEXT_INTL_DEFAULT_LANGUAGE.timezone;\n\n if (!messages) {\n log.warn(`Missing messages for language: ${currentLanguage?.value || defaultLang}`);\n return null;\n }\n\n return (\n <NextIntlClientProvider\n locale={currentLanguage?.value || defaultLang}\n messages={defaultMessages || null}\n timeZone={timeZone}\n >\n <Component {...(props as T)} />\n </NextIntlClientProvider>\n );\n };\n\n PageWithI18n.displayName = `withNextIntl(${Component.displayName || Component.name || 'Component'})`;\n\n return PageWithI18n;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"next-intl.hoc.js","names":[],"sources":["../../../src/react/next-intl/next-intl.hoc.tsx"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { NextIntlClientProvider } from 'next-intl';\nimport * as React from 'react';\n\nimport type { I_Children } from '#typescript/index.js';\n\nimport type { I_NextIntlLanguage, T_NextIntlMessageList } from './next-intl.type.js';\n\nimport { log } from '../log/index.js';\nimport { NEXT_INTL_DEFAULT_LANGUAGE } from './next-intl.constant.js';\nimport { useNextIntl } from './next-intl.hook.js';\n\n/**\n * Higher-Order Component (HOC) that wraps components with Next.js internationalization support.\n * This HOC provides internationalization capabilities to React components by wrapping them\n * with the NextIntlClientProvider. It automatically handles language detection, message\n * loading, and timezone configuration based on the current language settings.\n *\n * Features:\n * - Automatic language detection and message loading\n * - Timezone configuration based on language settings\n * - Fallback to default language when messages are missing\n * - Warning logging for missing message configurations\n * - Proper display name preservation for debugging\n *\n * @param Component - The React component to wrap with internationalization support.\n * @returns A new component with internationalization capabilities and additional props for languages and messages.\n */\nexport function withNextIntl<T extends I_Children>(Component: ComponentType<T>) {\n const PageWithI18n = (props: T & { languages: I_NextIntlLanguage[]; messages: T_NextIntlMessageList }) => {\n const { currentLanguage } = useNextIntl();\n const { messages, languages } = props;\n const defaultLang = 'en';\n\n const defaultMessages = messages[currentLanguage?.value || defaultLang];\n const timeZone = languages.find(lang => lang.value === currentLanguage?.value)?.timezone ?? NEXT_INTL_DEFAULT_LANGUAGE.timezone;\n\n if (!messages) {\n log.warn(`Missing messages for language: ${currentLanguage?.value || defaultLang}`);\n return null;\n }\n\n return (\n <NextIntlClientProvider\n locale={currentLanguage?.value || defaultLang}\n messages={defaultMessages || null}\n timeZone={timeZone}\n >\n <Component {...(props as T)} />\n </NextIntlClientProvider>\n );\n };\n\n PageWithI18n.displayName = `withNextIntl(${Component.displayName || Component.name || 'Component'})`;\n\n return PageWithI18n;\n}\n"],"mappings":";;;;;;AA6BA,SAAgB,EAAmC,GAA6B;CAC5E,IAAM,KAAgB,MAAoF;EACtG,IAAM,EAAE,uBAAoB,GAAa,EACnC,EAAE,aAAU,iBAAc,GAG1B,IAAkB,EAAS,GAAiB,SAAS,OACrD,IAAW,EAAU,MAAK,MAAQ,EAAK,UAAU,GAAiB,MAAM,EAAE,YAAY,EAA2B;AAOvH,SALK,IAMD,kBAAA,cAAC,GAAD;GACI,QAAQ,GAAiB,SAAS;GAClC,UAAU,KAAmB;GACnB;GAGW,EADrB,kBAAA,cAAC,GAAe,EAAe,CACV,IAXzB,EAAI,KAAK,kCAAkC,GAAiB,SAAS,OAAc,EAC5E;;AAgBf,QAFA,EAAa,cAAc,gBAAgB,EAAU,eAAe,EAAU,QAAQ,YAAY,IAE3F"}
|