@rivm-loculus-tools/common-frontend 0.4.0 → 0.6.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/_chunks/EmotionCacheService.js +10 -11
- package/dist/_chunks/EmotionCacheService.js.map +1 -1
- package/dist/_chunks/decorate.js +1 -2
- package/dist/_chunks/react.js +2 -3
- package/dist/_chunks/react.js.map +1 -1
- package/dist/classes/services/FastaDataEventBusService/index.js +1 -2
- package/dist/components/SearchBar/index.js +1 -2
- package/dist/components/app/App/App.d.ts +2 -5
- package/dist/components/app/App/index.js +35 -38
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/fasta/FastaDataImportDialog/index.js +1 -2
- package/dist/components/fasta/FastaDataImportDialogLoader/index.js +1 -2
- package/dist/components/fasta/FastaNotLoaded/index.js +1 -2
- package/dist/components/fasta/FastaPageHeaderCenterComponent/index.js +1 -2
- package/dist/components/fasta/FastaPageHeaderImportButton/index.js +1 -2
- package/dist/components/fasta/FastaPageHeaderResetButton/index.js +1 -2
- package/dist/components/ui/ButtonWithMenu/index.js +1 -2
- package/dist/components/ui/GenericErrorMessage/index.js +1 -2
- package/dist/components/ui/I18nWrapper/index.js +1 -2
- package/dist/components/ui/PageCommon/index.js +1 -2
- package/dist/components/ui/PageCommonDrawer/index.js +1 -2
- package/dist/components/ui/PageCommonHeader/index.js +1 -2
- package/dist/constants/config.constants.d.ts +0 -6
- package/dist/constants/config.constants.js +3 -4
- package/dist/constants/config.constants.js.map +1 -1
- package/dist/constants/page.constants.js +1 -2
- package/dist/context/pageCommonContext/index.js +1 -2
- package/dist/hooks/useConfig/index.js +3 -4
- package/dist/hooks/useConfig/index.js.map +1 -1
- package/dist/hooks/useUpdateDocumentTitle/index.js +1 -2
- package/dist/models/fasta.models.js +1 -2
- package/dist/models/fasta.models.js.map +1 -1
- package/dist/pages/ErrorPage/index.js +1 -2
- package/dist/stores/fastaDataStore/index.js +1 -2
- package/dist/theme/index.js +1 -2
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +1 -1
- package/dist/utils/DependencyContainerUtil/index.js +9 -13
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
- package/dist/utils/DownloadUtil/index.js +1 -2
- package/dist/utils/ErrorUtil/index.js +1 -2
- package/dist/utils/ExportUtil/index.js +1 -2
- package/dist/utils/FastaUtil/index.js +1 -2
- package/dist/utils/MetaDataUtil/index.js +1 -2
- package/dist/utils/StandardConfigUtil/index.js +1 -2
- package/dist/utils/UrlUtil/index.js +5 -6
- package/dist/utils/UrlUtil/index.js.map +1 -1
- package/package.json +16 -20
- package/dist/context/commonConfigContext/CommonConfigContext.d.ts +0 -9
- package/dist/context/commonConfigContext/CommonConfigContextProvider.d.ts +0 -6
- package/dist/context/commonConfigContext/index.d.ts +0 -3
- package/dist/context/commonConfigContext/index.js +0 -34
- package/dist/context/commonConfigContext/index.js.map +0 -1
- package/dist/context/commonConfigContext/useCommonConfigContext.d.ts +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DependencyContainer } from 'tsyringe';
|
|
2
2
|
import { ConfigBase } from '../../models/config.models';
|
|
3
3
|
export declare class DependencyContainerUtil {
|
|
4
|
-
static
|
|
4
|
+
static registerConfig<TConfig extends ConfigBase>(config: TConfig): void;
|
|
5
5
|
static resolveConfig<TConfig extends ConfigBase = ConfigBase>(dependencyContainer?: DependencyContainer): TConfig;
|
|
6
6
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { CONFIG_TOKEN as e
|
|
2
|
-
import { container as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var c = class {
|
|
8
|
-
static createContainer() {
|
|
9
|
-
return i.registerInstance(r, a.getInstance()), i.registerInstance(t, o.getInstance()), i.registerInstance(n, s.getInstance()), i;
|
|
1
|
+
import { CONFIG_TOKEN as e } from "../../constants/config.constants.js";
|
|
2
|
+
import { container as t } from "tsyringe";
|
|
3
|
+
// src/utils/DependencyContainerUtil/DependencyContainerUtil.ts
|
|
4
|
+
var n = class {
|
|
5
|
+
static registerConfig(n) {
|
|
6
|
+
t.register(e, { useValue: n });
|
|
10
7
|
}
|
|
11
|
-
static resolveConfig(
|
|
12
|
-
return
|
|
8
|
+
static resolveConfig(n = t) {
|
|
9
|
+
return n.resolve(e);
|
|
13
10
|
}
|
|
14
11
|
};
|
|
15
|
-
|
|
16
|
-
export { c as DependencyContainerUtil };
|
|
12
|
+
export { n as DependencyContainerUtil };
|
|
17
13
|
|
|
18
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DependencyContainerUtil","
|
|
1
|
+
{"version":3,"file":"index.js","names":["DependencyContainerUtil","CONFIG_TOKEN","config","container","dependencyContainer"],"sources":["../../../src/utils/DependencyContainerUtil/DependencyContainerUtil.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { DependencyContainer } from 'tsyringe';\n\nimport type { ConfigBase } from '../../models/config.models';\nimport { CONFIG_TOKEN } from '../../constants/config.constants';\n\nexport class DependencyContainerUtil {\n public static registerConfig<TConfig extends ConfigBase>(config: TConfig): void {\n container.register(CONFIG_TOKEN, { useValue: config });\n }\n\n public static resolveConfig<TConfig extends ConfigBase = ConfigBase>(dependencyContainer: DependencyContainer = container): TConfig {\n return dependencyContainer.resolve(CONFIG_TOKEN) as TConfig;\n }\n}\n"],"mappings":";;;AAMA,IAAaA,IAAb,MAAqC;CACnC,OAAc,eAA2C,GAAuB;EAC9E,EAAU,SAASC,GAAc,EAAE,UAAUC,EAAO,CAAC;CACvD;CAEA,OAAc,cAAuD,IAA2CC,GAAoB;EAClI,OAAOC,EAAoB,QAAQH,CAAY;CACjD;AACF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/DownloadUtil/DownloadUtil.ts
|
|
2
2
|
var e = class {
|
|
3
3
|
static datasetFilename(e) {
|
|
4
4
|
return `${e.trim().replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9._-]+/g, "_").replace(/^\.+|\.+$/g, "").slice(0, 80) || "alignment"}.fasta`;
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
|
-
//#endregion
|
|
8
7
|
export { e as DownloadUtil };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/ErrorUtil/ErrorUtil.ts
|
|
2
2
|
var e = class {
|
|
3
3
|
static getErrorMessage(e, t) {
|
|
4
4
|
return e instanceof Error ? e.message : t;
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
|
-
//#endregion
|
|
8
7
|
export { e as ErrorUtil };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DownloadUtil as e } from "@gen-epix/ui-core/utils/DownloadUtil";
|
|
2
|
-
|
|
2
|
+
// src/utils/ExportUtil/ExportUtil.ts
|
|
3
3
|
var t = class {
|
|
4
4
|
static downloadCanvasAsImage(t, n, r = "phylogenetic_tree") {
|
|
5
5
|
if (!t) {
|
|
@@ -36,7 +36,6 @@ var t = class {
|
|
|
36
36
|
e.createDownloadUrl(i, n), URL.revokeObjectURL(i);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
//#endregion
|
|
40
39
|
export { t as ExportUtil };
|
|
41
40
|
|
|
42
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/FastaUtil/FastaUtil.ts
|
|
2
2
|
var e = class e {
|
|
3
3
|
static parseFasta(t) {
|
|
4
4
|
if (!t?.trim()) return e.createErrorResult("The FASTA input is empty.");
|
|
@@ -50,7 +50,6 @@ var e = class e {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
//#endregion
|
|
54
53
|
export { e as FastaUtil };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/MetaDataUtil/MetaDataUtil.ts
|
|
2
2
|
var e = class e {
|
|
3
3
|
static findBestMatchingColumn = (t, n, r) => {
|
|
4
4
|
let i = e.getMatchCounts(t, n, r), a = null, o = -1;
|
|
@@ -127,7 +127,6 @@ var e = class e {
|
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
|
-
//#endregion
|
|
131
130
|
export { e as MetaDataUtil };
|
|
132
131
|
|
|
133
132
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WindowService as e } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
2
|
-
|
|
2
|
+
// src/utils/StandardConfigUtil/StandardConfigUtil.ts
|
|
3
3
|
var t = class {
|
|
4
4
|
static createConfig() {
|
|
5
5
|
return {
|
|
@@ -12,7 +12,6 @@ var t = class {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { t as StandardConfigUtil };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { container as e } from "tsyringe";
|
|
2
|
+
import { WindowService as t } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
3
|
+
// src/utils/UrlUtil/UrlUtil.ts
|
|
4
4
|
var n = class {
|
|
5
5
|
static clearSearchParams() {
|
|
6
|
-
let n = new URL(
|
|
7
|
-
n.search = "",
|
|
6
|
+
let n = new URL(e.resolve(t).window.location.href);
|
|
7
|
+
n.search = "", e.resolve(t).window.history.replaceState(null, "", n.toString());
|
|
8
8
|
}
|
|
9
9
|
static fastaLabelFromUrl(e) {
|
|
10
10
|
try {
|
|
@@ -25,7 +25,6 @@ var n = class {
|
|
|
25
25
|
return t.href;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { n as UrlUtil };
|
|
30
29
|
|
|
31
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["UrlUtil","url","container","
|
|
1
|
+
{"version":3,"file":"index.js","names":["UrlUtil","url","container","WindowService","urlObject","segment"],"sources":["../../../src/utils/UrlUtil/UrlUtil.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\n\nexport class UrlUtil {\n public static clearSearchParams(): void {\n const url = new URL(container.resolve(WindowService).window.location.href);\n url.search = '';\n container.resolve(WindowService).window.history.replaceState(null, '', url.toString());\n }\n\n public static fastaLabelFromUrl(url: string): string {\n try {\n const urlObject = new URL(url);\n const segment = urlObject.pathname.split('/').filter(Boolean).pop();\n if (segment) {\n return decodeURIComponent(segment);\n }\n return `${urlObject.hostname}.fasta`;\n } catch {\n return 'remote-alignment.fasta';\n }\n }\n\n public static validateFastaUrl(url: string): string {\n let urlObject: URL;\n try {\n urlObject = new URL(url.trim());\n } catch {\n throw new Error('Enter a valid FASTA URL.');\n }\n if (urlObject.protocol !== 'http:' && urlObject.protocol !== 'https:') {\n throw new Error('FASTA URLs must use HTTP or HTTPS.');\n }\n return urlObject.href;\n }\n}\n"],"mappings":";;;AAIA,IAAaA,IAAb,MAAqB;CACnB,OAAc,oBAA0B;EACtC,IAAMC,IAAM,IAAI,IAAIC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,SAAS,IAAI;EAEzE,AADA,EAAI,SAAS,IACbD,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAO,QAAQ,aAAa,MAAM,IAAIF,EAAI,SAAS,CAAC;CACvF;CAEA,OAAc,kBAAkB,GAAqB;EACnD,IAAI;GACF,IAAMG,IAAY,IAAI,IAAIH,CAAG,GACvBI,IAAUD,EAAU,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI;GAIlE,OAHIC,IACK,mBAAmBA,CAAO,IAE5B,GAAGD,EAAU,SAAS;EAC/B,QAAQ;GACN,OAAO;EACT;CACF;CAEA,OAAc,iBAAiB,GAAqB;EAClD,IAAIA;EACJ,IAAI;GACF,IAAY,IAAI,IAAIH,EAAI,KAAK,CAAC;EAChC,QAAQ;GACN,MAAU,MAAM,0BAA0B;EAC5C;EACA,IAAIG,EAAU,aAAa,WAAWA,EAAU,aAAa,UAC3D,MAAU,MAAM,oCAAoC;EAEtD,OAAOA,EAAU;CACnB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivm-loculus-tools/common-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"@emotion/cache": "*",
|
|
12
12
|
"@emotion/react": "*",
|
|
13
13
|
"@emotion/styled": "*",
|
|
14
|
-
"@gen-epix/ui-core-components": "^4.
|
|
15
|
-
"@gen-epix/ui-core-form": "^4.
|
|
16
|
-
"@gen-epix/ui-core": "^3.
|
|
14
|
+
"@gen-epix/ui-core-components": "^4.6.0",
|
|
15
|
+
"@gen-epix/ui-core-form": "^4.5.0",
|
|
16
|
+
"@gen-epix/ui-core": "^3.10.0",
|
|
17
17
|
"@mui/icons-material": "*",
|
|
18
18
|
"@mui/material": "*",
|
|
19
19
|
"@mui/styled-engine": "*",
|
|
@@ -29,39 +29,39 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"lodash": "4.18.1",
|
|
32
|
-
"zustand": "5.0.
|
|
32
|
+
"zustand": "5.0.16"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@emotion/cache": "11.14.0",
|
|
36
36
|
"@emotion/react": "11.14.0",
|
|
37
37
|
"@emotion/styled": "11.14.1",
|
|
38
38
|
"@gen-epix/eslint-config": "0.8.0",
|
|
39
|
-
"@gen-epix/ui-core-components": "4.
|
|
40
|
-
"@gen-epix/ui-core-form": "4.
|
|
41
|
-
"@gen-epix/ui-core": "3.
|
|
39
|
+
"@gen-epix/ui-core-components": "4.6.0",
|
|
40
|
+
"@gen-epix/ui-core-form": "4.5.0",
|
|
41
|
+
"@gen-epix/ui-core": "3.10.0",
|
|
42
42
|
"@mui/icons-material": "9.5.0",
|
|
43
43
|
"@mui/material": "9.5.0",
|
|
44
44
|
"@mui/styled-engine": "9.5.0",
|
|
45
45
|
"@mui/system": "9.5.0",
|
|
46
46
|
"@mui/utils": "9.5.0",
|
|
47
|
-
"@types/lodash": "4.17.
|
|
47
|
+
"@types/lodash": "4.17.27",
|
|
48
48
|
"@types/node": "26.6.5",
|
|
49
49
|
"@types/react-dom": "19.3.0",
|
|
50
50
|
"@types/react": "19.3.0",
|
|
51
51
|
"@vitejs/plugin-react": "6.1.2",
|
|
52
|
-
"eslint": "10.
|
|
53
|
-
"i18next": "26.
|
|
54
|
-
"react-dom": "19.3.
|
|
52
|
+
"eslint": "10.13.0",
|
|
53
|
+
"i18next": "26.5.11",
|
|
54
|
+
"react-dom": "19.3.1",
|
|
55
55
|
"react-error-boundary": "6.1.6",
|
|
56
|
-
"react-hook-form": "7.
|
|
57
|
-
"react-i18next": "17.
|
|
58
|
-
"react": "19.3.
|
|
56
|
+
"react-hook-form": "7.91.0",
|
|
57
|
+
"react-i18next": "17.1.9",
|
|
58
|
+
"react": "19.3.1",
|
|
59
59
|
"reflect-metadata": "0.2.2",
|
|
60
60
|
"tsyringe": "4.10.0",
|
|
61
61
|
"typescript": "6.0.3",
|
|
62
62
|
"vite-plugin-dts": "5.1.2",
|
|
63
63
|
"vite-plugin-static-copy": "4.1.1",
|
|
64
|
-
"vite": "8.3.
|
|
64
|
+
"vite": "8.3.5"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"dist"
|
|
@@ -139,10 +139,6 @@
|
|
|
139
139
|
"types": "./dist/constants/page.constants.d.ts",
|
|
140
140
|
"import": "./dist/constants/page.constants.js"
|
|
141
141
|
},
|
|
142
|
-
"./context/commonConfigContext": {
|
|
143
|
-
"types": "./dist/context/commonConfigContext/index.d.ts",
|
|
144
|
-
"import": "./dist/context/commonConfigContext/index.js"
|
|
145
|
-
},
|
|
146
142
|
"./context/pageCommonContext": {
|
|
147
143
|
"types": "./dist/context/pageCommonContext/index.d.ts",
|
|
148
144
|
"import": "./dist/context/pageCommonContext/index.js"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CoreComponentsConfig } from '@gen-epix/ui-core-components/context/CoreComponentsConfigContext';
|
|
2
|
-
import { DependencyContainer } from 'tsyringe';
|
|
3
|
-
import { ConfigBase } from '../../models/config.models';
|
|
4
|
-
export type CommonConfig<TConfig extends ConfigBase = ConfigBase> = {
|
|
5
|
-
config: TConfig;
|
|
6
|
-
container: DependencyContainer;
|
|
7
|
-
genEpixCoreComponentsConfig: CoreComponentsConfig;
|
|
8
|
-
};
|
|
9
|
-
export declare const CommonConfigContext: import('react').Context<CommonConfig<ConfigBase> | null>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { DependencyContainer } from 'tsyringe';
|
|
3
|
-
export type CommonConfigContextProviderProps = PropsWithChildren<{
|
|
4
|
-
readonly container: DependencyContainer;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const CommonConfigContextProvider: (props: CommonConfigContextProviderProps) => import('react').JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { DependencyContainerUtil as e } from "../../utils/DependencyContainerUtil/index.js";
|
|
2
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { createContext as n, use as r, useMemo as i } from "react";
|
|
4
|
-
import { CoreComponentsConfigContext as a } from "@gen-epix/ui-core-components/context/CoreComponentsConfigContext";
|
|
5
|
-
//#region src/context/commonConfigContext/CommonConfigContext.tsx
|
|
6
|
-
var o = n(null), s = (n) => {
|
|
7
|
-
let { children: r, container: s } = n, c = e.resolveConfig(s), l = i(() => ({ spinner: {
|
|
8
|
-
defaultCircularProgressSize: c.spinner.DEFAULT_CIRCULAR_PROGRESS_SIZE,
|
|
9
|
-
defaultTakingLongerTimeoutMs: c.spinner.DEFAULT_TAKING_LONGER_TIMEOUT_MS
|
|
10
|
-
} }), [c.spinner]), u = i(() => ({
|
|
11
|
-
config: c,
|
|
12
|
-
container: s,
|
|
13
|
-
genEpixCoreComponentsConfig: l
|
|
14
|
-
}), [
|
|
15
|
-
c,
|
|
16
|
-
s,
|
|
17
|
-
l
|
|
18
|
-
]);
|
|
19
|
-
return /* @__PURE__ */ t(a, {
|
|
20
|
-
value: l,
|
|
21
|
-
children: /* @__PURE__ */ t(o, {
|
|
22
|
-
value: u,
|
|
23
|
-
children: r
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
}, c = () => {
|
|
27
|
-
let e = r(o);
|
|
28
|
-
if (!e) throw Error("CommonConfigContext is not available");
|
|
29
|
-
return e;
|
|
30
|
-
};
|
|
31
|
-
//#endregion
|
|
32
|
-
export { o as CommonConfigContext, s as CommonConfigContextProvider, c as useCommonConfigContext };
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CommonConfigContext","createContext","CommonConfigContextProvider","props","config","DependencyContainerUtil","container","genEpixCoreComponentsConfig","useMemo","CommonConfig","CoreComponentsConfigContext","useCommonConfigContext","use"],"sources":["../../../src/context/commonConfigContext/CommonConfigContext.tsx","../../../src/context/commonConfigContext/CommonConfigContextProvider.tsx","../../../src/context/commonConfigContext/useCommonConfigContext.tsx"],"sourcesContent":["import type { CoreComponentsConfig } from '@gen-epix/ui-core-components/context/CoreComponentsConfigContext';\nimport { createContext } from 'react';\nimport type { DependencyContainer } from 'tsyringe';\n\nimport type { ConfigBase } from '../../models/config.models';\n\nexport type CommonConfig<TConfig extends ConfigBase = ConfigBase> = {\n config: TConfig;\n container: DependencyContainer;\n genEpixCoreComponentsConfig: CoreComponentsConfig;\n};\n\nexport const CommonConfigContext = createContext<CommonConfig | null>(null);\n","import { useMemo } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport { CoreComponentsConfigContext } from '@gen-epix/ui-core-components/context/CoreComponentsConfigContext';\nimport type { DependencyContainer } from 'tsyringe';\n\nimport { DependencyContainerUtil } from '../../utils/DependencyContainerUtil';\nimport type { ConfigBase } from '../../models/config.models';\n\nimport type { CommonConfig } from './CommonConfigContext';\nimport { CommonConfigContext } from './CommonConfigContext';\n\n\nexport type CommonConfigContextProviderProps = PropsWithChildren<{\n readonly container: DependencyContainer;\n}>;\n\nexport const CommonConfigContextProvider = (\n props: CommonConfigContextProviderProps,\n) => {\n const { children, container } = props;\n const config = DependencyContainerUtil.resolveConfig<ConfigBase>(container);\n const genEpixCoreComponentsConfig = useMemo<CommonConfig['genEpixCoreComponentsConfig']>(() => ({\n spinner: {\n defaultCircularProgressSize: config.spinner.DEFAULT_CIRCULAR_PROGRESS_SIZE!,\n defaultTakingLongerTimeoutMs: config.spinner.DEFAULT_TAKING_LONGER_TIMEOUT_MS,\n },\n }), [config.spinner]);\n const CommonConfig = useMemo(() => ({ config, container, genEpixCoreComponentsConfig }), [config, container, genEpixCoreComponentsConfig]);\n\n return (\n <CoreComponentsConfigContext value={genEpixCoreComponentsConfig}>\n <CommonConfigContext value={CommonConfig}>\n {children}\n </CommonConfigContext>\n </CoreComponentsConfigContext>\n );\n};\n","import { use } from 'react';\n\nimport type { ConfigBase } from '../../models/config.models';\n\nimport type { CommonConfig } from './CommonConfigContext';\nimport { CommonConfigContext } from './CommonConfigContext';\n\nexport const useCommonConfigContext = <TConfig extends ConfigBase = ConfigBase>(): CommonConfig<TConfig> => {\n const config = use(CommonConfigContext);\n if (!config) {\n throw new Error('CommonConfigContext is not available');\n }\n return config as CommonConfig<TConfig>;\n};\n"],"mappings":";;;;;AAYA,IAAaA,IAAsBC,EAAmC,IAAI,GCI7DC,KACX,MACG;CACH,IAAM,EAAE,aAAU,iBAAcC,GAC1BC,IAASC,EAAwB,cAA0BC,CAAS,GACpEC,IAA8BC,SAA4D,EAC9F,SAAS;EACP,6BAA6BJ,EAAO,QAAQ;EAC5C,8BAA8BA,EAAO,QAAQ;CAC/C,EACF,IAAI,CAACA,EAAO,OAAO,CAAC,GACdK,IAAeD,SAAe;EAAE;EAAQ;EAAW;CAA4B,IAAI;EAACJ;EAAQE;EAAWC;CAA2B,CAAC;CAEzI,OACE,kBAACG,GAAD;EAA6B,OAAOH;EAClC,UAAA,kBAACP,GAAD;GAAqB,OAAOS;GACzB;EACkB,CAAA;CACM,CAAA;AAEjC,GC7BaE,UAA+F;CAC1G,IAAMP,IAASQ,EAAIZ,CAAmB;CACtC,IAAI,CAACI,GACH,MAAU,MAAM,sCAAsC;CAExD,OAAOA;AACT"}
|