@cyberskill/shared 2.28.0 → 3.0.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/config.util.cjs +1 -1
- package/dist/config/config.util.js +24 -33
- package/dist/config/eslint/index.cjs +1 -1
- package/dist/config/eslint/index.d.ts +4 -0
- package/dist/config/eslint/index.js +4 -12
- package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -1
- package/dist/config/graphql-codegen/graphql-codegen.util.js +28 -33
- package/dist/config/storybook/storybook.preview.cjs +1 -1
- package/dist/config/storybook/storybook.preview.js +10 -13
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +19 -8
- package/dist/constant/common.cjs +1 -1
- package/dist/constant/common.js +1 -1
- package/dist/node/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/node/apollo-server/apollo-server.util.js +21 -48
- package/dist/node/cli/index.cjs +2 -2
- package/dist/node/cli/index.js +109 -165
- package/dist/node/command/command.util.cjs +2 -2
- package/dist/node/command/command.util.js +135 -170
- package/dist/node/express/express.util.cjs +1 -1
- package/dist/node/express/express.util.js +39 -72
- package/dist/node/fs/fs.util.cjs +3 -3
- package/dist/node/fs/fs.util.js +45 -60
- package/dist/node/log/log.util.cjs +1 -1
- package/dist/node/log/log.util.js +29 -30
- package/dist/node/mongo/mongo.controller.cjs +1 -1
- package/dist/node/mongo/mongo.controller.js +531 -629
- package/dist/node/mongo/mongo.util.cjs +2 -2
- package/dist/node/mongo/mongo.util.js +280 -321
- package/dist/node/package/package.util.cjs +1 -1
- package/dist/node/package/package.util.js +197 -226
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +26 -25
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +2 -0
- package/dist/node/path/path.constant.js +130 -150
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.js +110 -158
- package/dist/node/upload/upload.util.cjs +1 -1
- package/dist/node/upload/upload.util.js +119 -150
- package/dist/node/ws/ts.util.cjs +1 -1
- package/dist/node/ws/ts.util.js +31 -54
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.component.js +4 -4
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +51 -58
- package/dist/react/apollo-client/links/upload.cjs +1 -1
- package/dist/react/apollo-client/links/upload.js +71 -74
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +11 -18
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.component.js +61 -23
- package/dist/react/apollo-error/apollo-error.module.scss.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.module.scss.js +6 -6
- package/dist/react/apollo-error/apollo-error.test.unit.d.ts +1 -0
- package/dist/react/apollo-error/apollo-error.util.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.util.js +6 -6
- package/dist/react/loading/loading.component.cjs +2 -2
- package/dist/react/loading/loading.component.js +30 -46
- package/dist/react/log/log.util.cjs +1 -1
- package/dist/react/log/log.util.js +4 -4
- package/dist/react/next-intl/next-intl.hoc.cjs +1 -1
- package/dist/react/next-intl/next-intl.hoc.js +13 -22
- package/dist/react/next-intl/next-intl.provider.cjs +1 -1
- package/dist/react/next-intl/next-intl.provider.js +7 -7
- package/dist/react/storage/storage.hook.cjs +1 -1
- package/dist/react/storage/storage.hook.js +43 -59
- package/dist/react/storage/storage.util.cjs +1 -1
- package/dist/react/storage/storage.util.js +28 -53
- package/dist/react/userback/userback.component.cjs +1 -1
- package/dist/react/userback/userback.component.js +18 -42
- package/dist/style.css +1 -1
- package/dist/util/common/common.util.cjs +1 -1
- package/dist/util/common/common.util.d.ts +2 -0
- package/dist/util/common/common.util.js +29 -37
- package/dist/util/index.cjs +1 -1
- package/dist/util/index.js +10 -9
- package/dist/util/object/object.util.cjs +1 -1
- package/dist/util/object/object.util.js +72 -76
- package/dist/util/string/index.cjs +1 -1
- package/dist/util/string/index.js +4 -3
- package/dist/util/string/string.util.cjs +1 -1
- package/dist/util/string/string.util.d.ts +12 -0
- package/dist/util/string/string.util.js +63 -44
- package/package.json +25 -16
- package/public/tsconfig.base.json +7 -3
- package/README.md +0 -470
- /package/dist/node_modules/.pnpm/{vitest@4.0.18_@types_node@25.3.0_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 → vitest@4.0.18_@types_node@25.3.3_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.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.18_@types_node@25.3.0_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 → vitest@4.0.18_@types_node@25.3.3_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 -0
|
@@ -1,31 +1,69 @@
|
|
|
1
1
|
import * as t from "react";
|
|
2
|
-
import { use as
|
|
3
|
-
import { validate as
|
|
4
|
-
import { ApolloErrorContext as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { use as g, useRef as d, useEffect as f } from "react";
|
|
3
|
+
import { validate as E } from "../../util/validate/validate.util.js";
|
|
4
|
+
import { ApolloErrorContext as h } from "./apollo-error.context.js";
|
|
5
|
+
import o from "./apollo-error.module.scss.js";
|
|
6
|
+
const N = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
7
|
+
function C() {
|
|
8
|
+
const p = g(h), { error: e, hideError: a } = p ?? {}, l = d(null), s = d(null);
|
|
9
|
+
f(() => {
|
|
10
|
+
if (!e || !a) return;
|
|
11
|
+
const r = (n) => {
|
|
12
|
+
n.key === "Escape" && a();
|
|
13
|
+
};
|
|
14
|
+
return window.addEventListener("keydown", r), () => {
|
|
15
|
+
window.removeEventListener("keydown", r);
|
|
16
|
+
};
|
|
17
|
+
}, [e, a]), f(() => {
|
|
18
|
+
e && l.current ? (s.current = document.activeElement, l.current.focus()) : !e && s.current && (s.current.focus(), s.current = null);
|
|
19
|
+
}, [e]);
|
|
20
|
+
const y = (r) => {
|
|
21
|
+
if (r.key !== "Tab" || !l.current) return;
|
|
22
|
+
const n = Array.from(
|
|
23
|
+
l.current.querySelectorAll(N)
|
|
24
|
+
).filter((b) => !b.hasAttribute("disabled"));
|
|
25
|
+
if (n.length === 0) return;
|
|
26
|
+
const c = n[0], u = n[n.length - 1];
|
|
27
|
+
!c || !u || (r.shiftKey ? document.activeElement === c && (r.preventDefault(), u.focus()) : document.activeElement === u && (r.preventDefault(), c.focus()));
|
|
28
|
+
};
|
|
8
29
|
if (!e)
|
|
9
30
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */ t.createElement("div", { className:
|
|
12
|
-
"
|
|
31
|
+
const i = "locations" in e || "path" in e || "extensions" in e, m = "message" in e ? e.message : "Unknown error occurred";
|
|
32
|
+
return /* @__PURE__ */ t.createElement("div", { className: o["modal-backdrop"] }, /* @__PURE__ */ t.createElement(
|
|
33
|
+
"div",
|
|
13
34
|
{
|
|
14
|
-
|
|
15
|
-
className:
|
|
16
|
-
|
|
35
|
+
ref: l,
|
|
36
|
+
className: o["modal-content"],
|
|
37
|
+
role: "dialog",
|
|
38
|
+
"aria-modal": "true",
|
|
39
|
+
"aria-labelledby": "apollo-error-title",
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
onKeyDown: y
|
|
17
42
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
/* @__PURE__ */ t.createElement(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
className: o["btn-close"],
|
|
48
|
+
onClick: a,
|
|
49
|
+
"aria-label": "Close error details",
|
|
50
|
+
title: "Close error details"
|
|
51
|
+
},
|
|
52
|
+
"✕"
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ t.createElement("div", { id: "apollo-error-title", className: o["error-title"] }, /* @__PURE__ */ t.createElement(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
className: o["btn-retry"],
|
|
59
|
+
onClick: () => window.location.reload(),
|
|
60
|
+
"aria-label": "Reload page"
|
|
61
|
+
},
|
|
62
|
+
"Reload"
|
|
63
|
+
), " ", !E.isEmpty(e) && m),
|
|
64
|
+
/* @__PURE__ */ t.createElement("div", { className: o["error-details"] }, i && "locations" in e && e.locations && /* @__PURE__ */ t.createElement("pre", { className: "locations" }, /* @__PURE__ */ t.createElement("strong", null, "Locations:"), " ", JSON.stringify(e.locations, null, 4)), i && "path" in e && e.path && /* @__PURE__ */ t.createElement("pre", { className: "path" }, /* @__PURE__ */ t.createElement("strong", null, "Path:"), " ", JSON.stringify(e.path, null, 4)), i && "extensions" in e && e.extensions && /* @__PURE__ */ t.createElement("pre", { className: "extensions" }, /* @__PURE__ */ t.createElement("strong", null, "Extensions:"), " ", JSON.stringify(e.extensions, null, 4)), !i && /* @__PURE__ */ t.createElement("pre", { className: "error-details" }, /* @__PURE__ */ t.createElement("strong", null, "Error Details:"), " ", E.isEmpty(e) ? m : JSON.stringify(e, null, 4)))
|
|
65
|
+
));
|
|
28
66
|
}
|
|
29
67
|
export {
|
|
30
|
-
|
|
68
|
+
C as ApolloErrorComponent
|
|
31
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"modal-backdrop":"_modal-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"modal-backdrop":"_modal-backdrop_199u4_1","modal-content":"_modal-content_199u4_11","btn-close":"_btn-close_199u4_22","error-title":"_error-title_199u4_41","btn-retry":"_btn-retry_199u4_45","error-details":"_error-details_199u4_62"};exports.default=e;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const t = {
|
|
2
|
-
"modal-backdrop": "_modal-
|
|
3
|
-
"modal-content": "_modal-
|
|
4
|
-
"btn-close": "_btn-
|
|
5
|
-
"error-title": "_error-
|
|
6
|
-
"btn-retry": "_btn-
|
|
7
|
-
"error-details": "_error-
|
|
2
|
+
"modal-backdrop": "_modal-backdrop_199u4_1",
|
|
3
|
+
"modal-content": "_modal-content_199u4_11",
|
|
4
|
+
"btn-close": "_btn-close_199u4_22",
|
|
5
|
+
"error-title": "_error-title_199u4_41",
|
|
6
|
+
"btn-retry": "_btn-retry_199u4_45",
|
|
7
|
+
"error-details": "_error-details_199u4_62"
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
10
|
t as default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let o=null,r=!1;function e(l,a=!1){o=l,r=a}function t(){o=null,r=!1}function n(){return r}function s(l){o?.(l)}exports.clearGlobalApolloErrorCallback=t;exports.hasCustomApolloErrorHandler=n;exports.setGlobalApolloErrorCallback=e;exports.showGlobalApolloError=s;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
let
|
|
2
|
-
function n(
|
|
3
|
-
|
|
1
|
+
let o = null, r = !1;
|
|
2
|
+
function n(l, a = !1) {
|
|
3
|
+
o = l, r = a;
|
|
4
4
|
}
|
|
5
5
|
function e() {
|
|
6
|
-
|
|
6
|
+
o = null, r = !1;
|
|
7
7
|
}
|
|
8
8
|
function t() {
|
|
9
9
|
return r;
|
|
10
10
|
}
|
|
11
|
-
function s(
|
|
12
|
-
l
|
|
11
|
+
function s(l) {
|
|
12
|
+
o?.(l);
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
15
|
e as clearGlobalApolloErrorCallback,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("clsx"),o=require("react"),n=require("./loading.module.scss.cjs");function s(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const r=s(o);function m(){if(document.getElementById("noscroll-style"))return;const e=document.createElement("style");e.id="noscroll-style",e.innerHTML=`
|
|
2
2
|
.noscroll {
|
|
3
3
|
overflow: hidden !important;
|
|
4
4
|
height: 100vh !important;
|
|
5
5
|
}
|
|
6
|
-
`,document.head.appendChild(e)}function
|
|
6
|
+
`,document.head.appendChild(e)}function f({full:e=!1,className:a="",message:t="Loading",...l}){o.useEffect(()=>{if(e){document.body.classList.add("noscroll");const i=u=>u.preventDefault();return document.addEventListener("contextmenu",i),()=>{document.body.classList.remove("noscroll"),document.removeEventListener("contextmenu",i)}}},[e]),o.useEffect(()=>{m()},[]);function c(){return r.createElement("div",{role:"status","aria-live":"polite","aria-label":t,className:n.default.container,...l},r.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),r.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),r.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),r.createElement("div",{className:n.default.ring,"aria-hidden":"true"}),t&&r.createElement("div",{className:n.default.message},t))}return e?r.createElement("div",{className:d(n.default.full,a)},c()):r.createElement("div",{className:d(n.default.block,a)},c())}exports.Loading=f;
|
|
@@ -1,65 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
for (var t in r || (r = {}))
|
|
7
|
-
u.call(r, t) && f(e, t, r[t]);
|
|
8
|
-
if (i)
|
|
9
|
-
for (var t of i(r))
|
|
10
|
-
v.call(r, t) && f(e, t, r[t]);
|
|
11
|
-
return e;
|
|
12
|
-
}, E = (e, r) => {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var a in e)
|
|
15
|
-
u.call(e, a) && r.indexOf(a) < 0 && (t[a] = e[a]);
|
|
16
|
-
if (e != null && i)
|
|
17
|
-
for (var a of i(e))
|
|
18
|
-
r.indexOf(a) < 0 && v.call(e, a) && (t[a] = e[a]);
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
function h() {
|
|
1
|
+
import l from "clsx";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { useEffect as c } from "react";
|
|
4
|
+
import t from "./loading.module.scss.js";
|
|
5
|
+
function m() {
|
|
22
6
|
if (document.getElementById("noscroll-style"))
|
|
23
7
|
return;
|
|
24
|
-
const
|
|
25
|
-
|
|
8
|
+
const n = document.createElement("style");
|
|
9
|
+
n.id = "noscroll-style", n.innerHTML = `
|
|
26
10
|
.noscroll {
|
|
27
11
|
overflow: hidden !important;
|
|
28
12
|
height: 100vh !important;
|
|
29
13
|
}
|
|
30
|
-
`, document.head.appendChild(
|
|
14
|
+
`, document.head.appendChild(n);
|
|
31
15
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (t) {
|
|
16
|
+
function E({ full: n = !1, className: a = "", message: r = "Loading", ...d }) {
|
|
17
|
+
c(() => {
|
|
18
|
+
if (n) {
|
|
36
19
|
document.body.classList.add("noscroll");
|
|
37
|
-
const
|
|
38
|
-
return document.addEventListener("contextmenu",
|
|
39
|
-
document.body.classList.remove("noscroll"), document.removeEventListener("contextmenu",
|
|
20
|
+
const i = (s) => s.preventDefault();
|
|
21
|
+
return document.addEventListener("contextmenu", i), () => {
|
|
22
|
+
document.body.classList.remove("noscroll"), document.removeEventListener("contextmenu", i);
|
|
40
23
|
};
|
|
41
24
|
}
|
|
42
|
-
}, [
|
|
43
|
-
|
|
25
|
+
}, [n]), c(() => {
|
|
26
|
+
m();
|
|
44
27
|
}, []);
|
|
45
|
-
function
|
|
46
|
-
return /* @__PURE__ */
|
|
28
|
+
function o() {
|
|
29
|
+
return /* @__PURE__ */ e.createElement(
|
|
47
30
|
"div",
|
|
48
|
-
|
|
31
|
+
{
|
|
49
32
|
role: "status",
|
|
50
33
|
"aria-live": "polite",
|
|
51
|
-
"aria-label":
|
|
52
|
-
className:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
34
|
+
"aria-label": r,
|
|
35
|
+
className: t.container,
|
|
36
|
+
...d
|
|
37
|
+
},
|
|
38
|
+
/* @__PURE__ */ e.createElement("div", { className: t.ring, "aria-hidden": "true" }),
|
|
39
|
+
/* @__PURE__ */ e.createElement("div", { className: t.ring, "aria-hidden": "true" }),
|
|
40
|
+
/* @__PURE__ */ e.createElement("div", { className: t.ring, "aria-hidden": "true" }),
|
|
41
|
+
/* @__PURE__ */ e.createElement("div", { className: t.ring, "aria-hidden": "true" }),
|
|
42
|
+
r && /* @__PURE__ */ e.createElement("div", { className: t.message }, r)
|
|
59
43
|
);
|
|
60
44
|
}
|
|
61
|
-
return
|
|
45
|
+
return n ? /* @__PURE__ */ e.createElement("div", { className: l(t.full, a) }, o()) : /* @__PURE__ */ e.createElement("div", { className: l(t.block, a) }, o());
|
|
62
46
|
}
|
|
63
47
|
export {
|
|
64
|
-
|
|
48
|
+
E as Loading
|
|
65
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("consola/browser"),t=require("../../constant/response-status.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("consola/browser"),t=require("../../constant/response-status.cjs"),c={silent:o.consola.silent,level:o.consola.level,fatal:o.consola.fatal,error:o.consola.error,warn:o.consola.warn,log:o.consola.log,info:o.consola.info,success:o.consola.success,ready:o.consola.ready,start:o.consola.start,box:o.consola.box,debug:o.consola.debug,trace:o.consola.trace,verbose:o.consola.verbose};function i(e,n){const{shouldLog:l=!0,returnValue:a,callback:s}=n??{},r=e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error");return l&&c.error(r.message),s&&typeof s=="function"&&s(r),a||{success:!1,message:r.message,code:t.RESPONSE_STATUS.INTERNAL_SERVER_ERROR.CODE}}exports.catchError=i;exports.log=c;
|
|
@@ -16,15 +16,15 @@ const l = {
|
|
|
16
16
|
trace: e.trace,
|
|
17
17
|
verbose: e.verbose
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
const { shouldLog: n = !0, returnValue:
|
|
21
|
-
return n && l.error(s.message), o && typeof o == "function" && o(s),
|
|
19
|
+
function g(r, a) {
|
|
20
|
+
const { shouldLog: n = !0, returnValue: t, callback: o } = a ?? {}, s = r instanceof Error ? r : new Error(typeof r == "string" ? r : "Unknown error");
|
|
21
|
+
return n && l.error(s.message), o && typeof o == "function" && o(s), t || {
|
|
22
22
|
success: !1,
|
|
23
23
|
message: s.message,
|
|
24
24
|
code: c.INTERNAL_SERVER_ERROR.CODE
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
g as catchError,
|
|
29
29
|
l as log
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("next-intl"),f=require("react"),m=require("./next-intl.constant.cjs"),d=require("./next-intl.hook.cjs"),N=require("../log/log.util.cjs");function I(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const u=I(f);function _(e){const a=t=>{const{currentLanguage:n}=d.useNextIntl(),{messages:r,languages:s}=t,l="en",i=r[n?.value||l],o=s.find(c=>c.value===n?.value)?.timezone??m.NEXT_INTL_DEFAULT_LANGUAGE.timezone;return r?u.createElement(g.NextIntlClientProvider,{locale:n?.value||l,messages:i||null,timeZone:o},u.createElement(e,{...t})):(N.log.warn(`Missing messages for language: ${n?.value||l}`),null)};return a.displayName=`withNextIntl(${e.displayName||e.name||"Component"})`,a}exports.withNextIntl=_;
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
import { NextIntlClientProvider as g } from "next-intl";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { NEXT_INTL_DEFAULT_LANGUAGE as
|
|
4
|
-
import { useNextIntl as
|
|
3
|
+
import { NEXT_INTL_DEFAULT_LANGUAGE as c } from "./next-intl.constant.js";
|
|
4
|
+
import { useNextIntl as f } from "./next-intl.hook.js";
|
|
5
5
|
import { log as N } from "../log/log.util.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (var r of u(e))
|
|
11
|
-
y.call(e, r) && m(t, r, e[r]);
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
function L(t) {
|
|
15
|
-
const e = (r) => {
|
|
16
|
-
var l, o;
|
|
17
|
-
const { currentLanguage: n } = d(), { messages: i, languages: f } = r, a = "en", c = i[(n == null ? void 0 : n.value) || a], p = (o = (l = f.find((v) => v.value === (n == null ? void 0 : n.value))) == null ? void 0 : l.timezone) != null ? o : _.timezone;
|
|
18
|
-
return i ? /* @__PURE__ */ s.createElement(
|
|
6
|
+
function x(t) {
|
|
7
|
+
const a = (l) => {
|
|
8
|
+
const { currentLanguage: e } = f(), { messages: r, languages: o } = l, n = "en", i = r[e?.value || n], m = o.find((u) => u.value === e?.value)?.timezone ?? c.timezone;
|
|
9
|
+
return r ? /* @__PURE__ */ s.createElement(
|
|
19
10
|
g,
|
|
20
11
|
{
|
|
21
|
-
locale:
|
|
22
|
-
messages:
|
|
23
|
-
timeZone:
|
|
12
|
+
locale: e?.value || n,
|
|
13
|
+
messages: i || null,
|
|
14
|
+
timeZone: m
|
|
24
15
|
},
|
|
25
|
-
/* @__PURE__ */ s.createElement(t,
|
|
26
|
-
) : (N.warn(`Missing messages for language: ${
|
|
16
|
+
/* @__PURE__ */ s.createElement(t, { ...l })
|
|
17
|
+
) : (N.warn(`Missing messages for language: ${e?.value || n}`), null);
|
|
27
18
|
};
|
|
28
|
-
return
|
|
19
|
+
return a.displayName = `withNextIntl(${t.displayName || t.name || "Component"})`, a;
|
|
29
20
|
}
|
|
30
21
|
export {
|
|
31
|
-
|
|
22
|
+
x as withNextIntl
|
|
32
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),l=require("./next-intl.constant.cjs"),i=require("./next-intl.context.cjs"),s=require("./next-intl.hoc.cjs"),g=require("../storage/storage.hook.cjs");function f(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const o=f(c);function p({children:e}){return o.createElement(o.Fragment,null,e)}const m=s.withNextIntl(p);function x({children:e,languages:t,messages:n}){const{value:r,set:a}=g.useStorage("lang",t[0]),u=c.useMemo(()=>({languages:t,currentLanguage:r??l.NEXT_INTL_DEFAULT_LANGUAGE,setCurrentLanguage:a}),[t,a,r]);return o.createElement(i.NextIntlContext,{value:u},o.createElement(m,{languages:t,messages:n},e))}exports.NextIntlProvider=x;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as t from "react";
|
|
2
2
|
import { useMemo as u } from "react";
|
|
3
3
|
import { NEXT_INTL_DEFAULT_LANGUAGE as c } from "./next-intl.constant.js";
|
|
4
|
-
import { NextIntlContext as
|
|
5
|
-
import { withNextIntl as
|
|
6
|
-
import { useStorage as
|
|
4
|
+
import { NextIntlContext as p } from "./next-intl.context.js";
|
|
5
|
+
import { withNextIntl as i } from "./next-intl.hoc.js";
|
|
6
|
+
import { useStorage as l } from "../storage/storage.hook.js";
|
|
7
7
|
function f({ children: r }) {
|
|
8
8
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, r);
|
|
9
9
|
}
|
|
10
|
-
const L =
|
|
10
|
+
const L = i(f);
|
|
11
11
|
function I({
|
|
12
12
|
children: r,
|
|
13
13
|
languages: e,
|
|
14
14
|
messages: m
|
|
15
15
|
}) {
|
|
16
|
-
const { value: n, set: o } =
|
|
17
|
-
() => ({ languages: e, currentLanguage: n
|
|
16
|
+
const { value: n, set: o } = l("lang", e[0]), a = u(
|
|
17
|
+
() => ({ languages: e, currentLanguage: n ?? c, setCurrentLanguage: o }),
|
|
18
18
|
[e, o, n]
|
|
19
19
|
);
|
|
20
|
-
return /* @__PURE__ */ t.createElement(
|
|
20
|
+
return /* @__PURE__ */ t.createElement(p, { value: a }, /* @__PURE__ */ t.createElement(L, { languages: e, messages: m }, r));
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
23
|
I as NextIntlProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),l=require("./storage.util.cjs"),S=require("../../util/serializer/serializer.util.cjs"),f=require("../log/log.util.cjs");function E(t,r,c=S.serializer){const[u,s]=a.useState(r),[d,g]=a.useState(!1);a.useEffect(()=>{let e=!0;return(async()=>{try{const i=await l.storage.get(t);if(e)if(i!==null){const n=c.deserialize(i);s(n)}else if(r!==void 0){const n=c.serialize(r);await l.storage.set(t,n),s(r)}else s(void 0)}catch(i){f.catchError(i),e&&s(r)}finally{e&&g(!0)}})(),()=>{e=!1,g(!1)}},[t,r,c]),a.useEffect(()=>{if(!d)return;(async()=>{try{if(u!==void 0){const o=c.serialize(u);await l.storage.set(t,o)}}catch(o){f.catchError(o)}})()},[u,t,c,d]);const v=a.useCallback(e=>{s(o=>typeof e=="function"?e(o):e)},[]),h=a.useCallback(async()=>{try{await l.storage.remove(t),s(void 0)}catch(e){f.catchError(e)}},[t]);return{value:u,set:v,remove:h}}exports.useStorage=E;
|
|
@@ -1,75 +1,59 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { storage as
|
|
3
|
-
import { serializer as
|
|
4
|
-
import { catchError as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
o(e);
|
|
11
|
-
}
|
|
12
|
-
}, a = (s) => {
|
|
13
|
-
try {
|
|
14
|
-
u(t.throw(s));
|
|
15
|
-
} catch (e) {
|
|
16
|
-
o(e);
|
|
17
|
-
}
|
|
18
|
-
}, u = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(f, a);
|
|
19
|
-
u((t = t.apply(r, l)).next());
|
|
20
|
-
});
|
|
21
|
-
function b(r, l, t = E) {
|
|
22
|
-
const [n, o] = h(l), [f, a] = h(!1);
|
|
23
|
-
y(() => {
|
|
24
|
-
let e = !0;
|
|
25
|
-
return p(null, null, function* () {
|
|
1
|
+
import { useState as m, useEffect as v, useCallback as p } from "react";
|
|
2
|
+
import { storage as n } from "./storage.util.js";
|
|
3
|
+
import { serializer as w } from "../../util/serializer/serializer.util.js";
|
|
4
|
+
import { catchError as d } from "../log/log.util.js";
|
|
5
|
+
function S(e, o, a = w) {
|
|
6
|
+
const [c, r] = m(o), [i, l] = m(!1);
|
|
7
|
+
v(() => {
|
|
8
|
+
let t = !0;
|
|
9
|
+
return (async () => {
|
|
26
10
|
try {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
} else if (
|
|
33
|
-
const
|
|
34
|
-
|
|
11
|
+
const f = await n.get(e);
|
|
12
|
+
if (t)
|
|
13
|
+
if (f !== null) {
|
|
14
|
+
const u = a.deserialize(f);
|
|
15
|
+
r(u);
|
|
16
|
+
} else if (o !== void 0) {
|
|
17
|
+
const u = a.serialize(o);
|
|
18
|
+
await n.set(e, u), r(o);
|
|
35
19
|
} else
|
|
36
|
-
|
|
37
|
-
} catch (
|
|
38
|
-
|
|
20
|
+
r(void 0);
|
|
21
|
+
} catch (f) {
|
|
22
|
+
d(f), t && r(o);
|
|
39
23
|
} finally {
|
|
40
|
-
|
|
24
|
+
t && l(!0);
|
|
41
25
|
}
|
|
42
|
-
}), () => {
|
|
43
|
-
|
|
26
|
+
})(), () => {
|
|
27
|
+
t = !1, l(!1);
|
|
44
28
|
};
|
|
45
|
-
}, [
|
|
46
|
-
if (!
|
|
29
|
+
}, [e, o, a]), v(() => {
|
|
30
|
+
if (!i)
|
|
47
31
|
return;
|
|
48
|
-
|
|
32
|
+
(async () => {
|
|
49
33
|
try {
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
|
|
34
|
+
if (c !== void 0) {
|
|
35
|
+
const s = a.serialize(c);
|
|
36
|
+
await n.set(e, s);
|
|
53
37
|
}
|
|
54
|
-
} catch (
|
|
55
|
-
|
|
38
|
+
} catch (s) {
|
|
39
|
+
d(s);
|
|
56
40
|
}
|
|
57
|
-
});
|
|
58
|
-
}, [
|
|
59
|
-
const
|
|
60
|
-
(
|
|
61
|
-
|
|
41
|
+
})();
|
|
42
|
+
}, [c, e, a, i]);
|
|
43
|
+
const h = p(
|
|
44
|
+
(t) => {
|
|
45
|
+
r((s) => typeof t == "function" ? t(s) : t);
|
|
62
46
|
},
|
|
63
47
|
[]
|
|
64
|
-
),
|
|
48
|
+
), g = p(async () => {
|
|
65
49
|
try {
|
|
66
|
-
|
|
67
|
-
} catch (
|
|
68
|
-
|
|
50
|
+
await n.remove(e), r(void 0);
|
|
51
|
+
} catch (t) {
|
|
52
|
+
d(t);
|
|
69
53
|
}
|
|
70
|
-
}
|
|
71
|
-
return { value:
|
|
54
|
+
}, [e]);
|
|
55
|
+
return { value: c, set: h, remove: g };
|
|
72
56
|
}
|
|
73
57
|
export {
|
|
74
|
-
|
|
58
|
+
S as useStorage
|
|
75
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("localforage"),a=require("../log/log.util.cjs"),o={async get(r){try{return await t.getItem(r)}catch(e){return a.catchError(e,{returnValue:null})}},async set(r,e){try{await t.setItem(r,e)}catch(c){a.catchError(c)}},async remove(r){try{await t.removeItem(r)}catch(e){a.catchError(e)}},async keys(){try{return await t.keys()??[]}catch(r){return a.catchError(r,{returnValue:[]})}}};exports.storage=o;
|