@grasp-labs/ds-microfrontends-integration 0.24.0 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -30
- package/dist/{index-8Q3EeCug.js → index-DWI6fl0D.js} +1285 -1274
- package/dist/{index.esm-fQDYRCEr-Bj1dI6i0.js → index.esm-fQDYRCEr-B_OscmDH.js} +1 -1
- package/dist/index.js +28 -26
- package/dist/mf-common.d.ts +1 -30
- package/dist/mf-common.js +22 -22
- package/dist/types/Navigation.d.ts +52 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/navigation.d.ts +23 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as o } from "./index-
|
|
1
|
+
import { O as o } from "./index-DWI6fl0D.js";
|
|
2
2
|
import { useState as J, useEffect as De, createContext as Zt, useRef as ce, useContext as Gt, useMemo as le, useCallback as Re } from "react";
|
|
3
3
|
const $e = (e, t, n, r, a) => {
|
|
4
4
|
if (!r) throw new Error(a ?? `Invalid property path: ${t}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { A as s, B as
|
|
1
|
+
import { A as s, B as t, D as l, E as r, F as i, G as u, J as d, L as o, N as n, R as F, S as g, T as c, b as m, V as p, f as V, h, d as v, i as S, t as D, w as P, z as b, k as f, l as x, j as y, m as R, v as T, n as E, g as G, y as L, o as N, p as A, q as I, s as j, x as B, r as J, u as O, a as k, c as q, e as w } from "./index-DWI6fl0D.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ArrayField,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
t as BooleanField,
|
|
5
|
+
l as DateField,
|
|
6
|
+
r as EnumField,
|
|
7
|
+
i as FieldError,
|
|
8
|
+
u as GroupsProvider,
|
|
9
9
|
d as JsonField,
|
|
10
10
|
o as LanguageProvider,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
n as NumberField,
|
|
12
|
+
F as RouteGuard,
|
|
13
13
|
g as SchemaFields,
|
|
14
14
|
c as TextField,
|
|
15
15
|
m as ToastProvider,
|
|
@@ -19,22 +19,24 @@ export {
|
|
|
19
19
|
v as VaultProvider,
|
|
20
20
|
S as VaultSecretDialog,
|
|
21
21
|
D as buildDefaultValues,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
E as
|
|
30
|
-
G as
|
|
31
|
-
L as
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
j as
|
|
36
|
-
B as
|
|
37
|
-
J as
|
|
38
|
-
O as
|
|
39
|
-
k as
|
|
22
|
+
P as createFieldDescriptor,
|
|
23
|
+
b as createRuleHandler,
|
|
24
|
+
f as defineNavigation,
|
|
25
|
+
x as extractConstraints,
|
|
26
|
+
y as extractPaths,
|
|
27
|
+
R as getArrayItemsSchema,
|
|
28
|
+
T as getDefaultValue,
|
|
29
|
+
E as getFieldType,
|
|
30
|
+
G as getLanguage,
|
|
31
|
+
L as getSchemaResolver,
|
|
32
|
+
N as isEnumField,
|
|
33
|
+
A as isNullable,
|
|
34
|
+
I as isObjectWithoutProperties,
|
|
35
|
+
j as isReadOnly,
|
|
36
|
+
B as parseSchemaFields,
|
|
37
|
+
J as resolveSchema,
|
|
38
|
+
O as useGroups,
|
|
39
|
+
k as useLanguage,
|
|
40
|
+
q as useToast,
|
|
41
|
+
w as useVault
|
|
40
42
|
};
|
package/dist/mf-common.d.ts
CHANGED
|
@@ -1,38 +1,8 @@
|
|
|
1
|
-
import { IconName } from '@grasp-labs/ds-react-components';
|
|
2
1
|
import { ModuleFederationOptions } from '@module-federation/vite/lib/utils/normalizeModuleFederationOptions';
|
|
3
|
-
export type BaseItem = {
|
|
4
|
-
/**
|
|
5
|
-
* Display label used as fallback when translation is not available
|
|
6
|
-
*/
|
|
7
|
-
label: string;
|
|
8
|
-
/**
|
|
9
|
-
* Translation key for internationalization.
|
|
10
|
-
* Must be placed in 'navigation' translation namespace in the host application for it to work.
|
|
11
|
-
*/
|
|
12
|
-
labelKey: string;
|
|
13
|
-
icon: IconName;
|
|
14
|
-
};
|
|
15
|
-
export type RouteConfig = BaseItem & {
|
|
16
|
-
path: string;
|
|
17
|
-
type?: "hidden" | "visible";
|
|
18
|
-
};
|
|
19
|
-
export type CategoryConfig = BaseItem & {
|
|
20
|
-
type: "category";
|
|
21
|
-
children: Record<string, RouteConfig | CategoryConfig>;
|
|
22
|
-
};
|
|
23
|
-
export type NavigationItem = RouteConfig | CategoryConfig;
|
|
24
|
-
/**
|
|
25
|
-
* INDEX is a mandatory route representing the root of the microfrontend, used as the parent navigation item in the sidebar
|
|
26
|
-
*/
|
|
27
|
-
export type IndexNavigationConfig = {
|
|
28
|
-
INDEX: RouteConfig;
|
|
29
|
-
};
|
|
30
|
-
export type NavigationConfig<TKeys extends string = string> = IndexNavigationConfig & Record<TKeys, NavigationItem>;
|
|
31
2
|
export type MicrofrontendExposes = {
|
|
32
3
|
".": string;
|
|
33
4
|
"./navigationConfig": string;
|
|
34
5
|
} & Record<string, string>;
|
|
35
|
-
export declare const createModuleFederationConfig: (name: string, overrides?: Partial<ModuleFederationOptions>) => ModuleFederationOptions;
|
|
36
6
|
export declare const COMMON_SHARED_DEPS: {
|
|
37
7
|
react: {
|
|
38
8
|
singleton: boolean;
|
|
@@ -52,6 +22,7 @@ export declare const COMMON_SHARED_DEPS: {
|
|
|
52
22
|
};
|
|
53
23
|
};
|
|
54
24
|
export declare const createMicrofrontendsBase: (name: string) => string;
|
|
25
|
+
export declare const createModuleFederationConfig: (name: string, overrides?: Partial<ModuleFederationOptions>) => ModuleFederationOptions;
|
|
55
26
|
/**
|
|
56
27
|
* Creates a configured Vite Module Federation plugin for Data Science microfrontends
|
|
57
28
|
* @param name - The name of the microfrontend
|
package/dist/mf-common.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { federation as o } from "@module-federation/vite";
|
|
2
2
|
const i = { react: "19.2.3", "react-dom": "19.2.3", "react-router": "7.12.0" }, n = {
|
|
3
3
|
peerDependencies: i
|
|
4
|
-
}, s =
|
|
5
|
-
const t = a(e);
|
|
6
|
-
return {
|
|
7
|
-
name: e,
|
|
8
|
-
manifest: !0,
|
|
9
|
-
filename: "remoteEntry.js",
|
|
10
|
-
getPublicPath: `function() {return "${t}"}`,
|
|
11
|
-
exposes: {
|
|
12
|
-
".": "./src/App",
|
|
13
|
-
"./navigationConfig": "./src/navigationConfig"
|
|
14
|
-
},
|
|
15
|
-
shared: {
|
|
16
|
-
...c
|
|
17
|
-
},
|
|
18
|
-
...r
|
|
19
|
-
};
|
|
20
|
-
}, c = {
|
|
4
|
+
}, s = {
|
|
21
5
|
react: {
|
|
22
6
|
singleton: !0,
|
|
23
7
|
requiredVersion: n.peerDependencies.react
|
|
@@ -34,12 +18,28 @@ const i = { react: "19.2.3", "react-dom": "19.2.3", "react-router": "7.12.0" },
|
|
|
34
18
|
singleton: !0,
|
|
35
19
|
requiredVersion: ">=0.17.0 <1.0.0"
|
|
36
20
|
}
|
|
37
|
-
},
|
|
38
|
-
|
|
21
|
+
}, c = (e) => `microfrontends/${e}/`, a = (e, r = {}) => {
|
|
22
|
+
const t = c(e);
|
|
23
|
+
return {
|
|
24
|
+
name: e,
|
|
25
|
+
manifest: !0,
|
|
26
|
+
filename: "remoteEntry.js",
|
|
27
|
+
getPublicPath: `function() {return "${t}"}`,
|
|
28
|
+
exposes: {
|
|
29
|
+
".": "./src/App",
|
|
30
|
+
"./navigationConfig": "./src/navigationConfig"
|
|
31
|
+
},
|
|
32
|
+
shared: {
|
|
33
|
+
...s
|
|
34
|
+
},
|
|
35
|
+
...r
|
|
36
|
+
};
|
|
37
|
+
}, u = (e, r = {}) => o({
|
|
38
|
+
...a(e, r)
|
|
39
39
|
});
|
|
40
40
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
s as COMMON_SHARED_DEPS,
|
|
42
|
+
c as createMicrofrontendsBase,
|
|
43
|
+
a as createModuleFederationConfig,
|
|
44
44
|
u as dsFederation
|
|
45
45
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IconName } from '@grasp-labs/ds-react-components';
|
|
2
|
+
export type BaseItem = {
|
|
3
|
+
/**
|
|
4
|
+
* Display label used as fallback when translation is not available
|
|
5
|
+
*/
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* Translation key for internationalization.
|
|
9
|
+
* Must be placed in 'navigation' translation namespace in the host application for it to work.
|
|
10
|
+
*/
|
|
11
|
+
labelKey: string;
|
|
12
|
+
icon: IconName;
|
|
13
|
+
/**
|
|
14
|
+
* Roles required to access this navigation item.
|
|
15
|
+
* When specified, the item should only be visible to users with at least one of the listed roles.
|
|
16
|
+
*/
|
|
17
|
+
requiredRoles?: string[];
|
|
18
|
+
};
|
|
19
|
+
export type RouteConfig = BaseItem & {
|
|
20
|
+
path: string;
|
|
21
|
+
type?: "hidden" | "visible";
|
|
22
|
+
};
|
|
23
|
+
export type CategoryConfig = BaseItem & {
|
|
24
|
+
type: "category";
|
|
25
|
+
children: Record<string, NavigationItem>;
|
|
26
|
+
};
|
|
27
|
+
export type NavigationItem = RouteConfig | CategoryConfig;
|
|
28
|
+
/**
|
|
29
|
+
* INDEX is a mandatory route representing the root of the microfrontend, used as the parent navigation item in the sidebar
|
|
30
|
+
* @deprecated Use ComposableNavigationConfig for new microfrontends
|
|
31
|
+
*/
|
|
32
|
+
export type IndexNavigationConfig = {
|
|
33
|
+
INDEX: RouteConfig;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use ComposableNavigationConfig for new microfrontends
|
|
37
|
+
*/
|
|
38
|
+
export type NavigationConfig<TKeys extends string = string> = IndexNavigationConfig & Record<TKeys, NavigationItem>;
|
|
39
|
+
/**
|
|
40
|
+
* Composable navigation configuration where each entry is a standalone NavigationItem.
|
|
41
|
+
*/
|
|
42
|
+
export type ComposableNavigationConfig = Record<string, NavigationItem>;
|
|
43
|
+
export type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
44
|
+
/**
|
|
45
|
+
* Recursively extracts a flat path map from a navigation config.
|
|
46
|
+
* For route items, extracts `{ KEY: path }`. For categories, recurses into children.
|
|
47
|
+
*/
|
|
48
|
+
export type ExtractPaths<T extends Record<string, NavigationItem>> = {
|
|
49
|
+
[K in keyof T as T[K] extends CategoryConfig ? never : K]: T[K] extends RouteConfig ? T[K]["path"] : never;
|
|
50
|
+
} & UnionToIntersection<{
|
|
51
|
+
[K in keyof T]: T[K] extends CategoryConfig ? ExtractPaths<T[K]["children"]> : never;
|
|
52
|
+
}[keyof T]>;
|
package/dist/types/index.d.ts
CHANGED
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './navigation';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComposableNavigationConfig, ExtractPaths } from '../types/Navigation';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts a flat `{ KEY: path }` map from a valid navigation config.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const PageRoutes = extractPaths(navigationConfig);
|
|
7
|
+
* // PageRoutes.DASHBOARD === "/dashboard"
|
|
8
|
+
*/
|
|
9
|
+
export declare const extractPaths: <const T extends ComposableNavigationConfig>(config: T) => ExtractPaths<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Defines a navigation config and extracts its page routes in one step.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const { navigationConfig, pageRoutes } = defineNavigation({
|
|
15
|
+
* INDEX: { label: "Home", labelKey: "home", path: "/", icon: "home" },
|
|
16
|
+
* });
|
|
17
|
+
* export const PageRoutes = pageRoutes;
|
|
18
|
+
* export default navigationConfig;
|
|
19
|
+
*/
|
|
20
|
+
export declare const defineNavigation: <const T extends ComposableNavigationConfig>(config: T) => {
|
|
21
|
+
navigationConfig: T;
|
|
22
|
+
pageRoutes: ExtractPaths<T>;
|
|
23
|
+
};
|