@bluealba/pae-ui-react-core 4.5.0 → 4.5.1-develop-364

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.
@@ -0,0 +1,82 @@
1
+ import { default as React, FC } from 'react';
2
+
3
+ export interface FragmentSlotProps {
4
+ /** Full module name of the fragment (e.g. "@org/myapp-admin") */
5
+ moduleName: string;
6
+ /** Additional CSS classes for the host element */
7
+ className?: string;
8
+ /** Additional inline styles for the host element */
9
+ style?: React.CSSProperties;
10
+ /**
11
+ * Component to render while the fragment bundle is loading.
12
+ * Receives `{ moduleName }` as props. Renders nothing if not provided.
13
+ */
14
+ LoadingComponent?: FC<{
15
+ moduleName: string;
16
+ }>;
17
+ /**
18
+ * Component to render when the fragment bundle fails to load.
19
+ * Receives `{ moduleName }` as props. Renders nothing if not provided.
20
+ */
21
+ ErrorComponent?: FC<{
22
+ moduleName: string;
23
+ }>;
24
+ /**
25
+ * Component to render when the fragment is in an inactive state — i.e. registered in
26
+ * single-spa but not currently loading, mounted, or broken. This covers the statuses:
27
+ * `NOT_LOADED`, `NOT_BOOTSTRAPPED`, `NOT_MOUNTED`, and `UNMOUNTING`.
28
+ *
29
+ * Receives `{ moduleName, status }` where `status` is the raw single-spa status string,
30
+ * useful for branching on specific inactive phases.
31
+ * Renders nothing if not provided.
32
+ */
33
+ IdleComponent?: FC<{
34
+ moduleName: string;
35
+ status: string;
36
+ }>;
37
+ }
38
+ /**
39
+ * Renders the host element where a `fragment` microfrontend will be mounted by single-spa.
40
+ *
41
+ * The component looks up the module in the platform catalog by `moduleName`, validates that it
42
+ * is of type `fragment`, derives the element `id` from `ui.mountAtSelector`, and renders a
43
+ * plain `<div>` with that `id`. single-spa then mounts/unmounts the fragment into that element
44
+ * automatically when the fragment's route matches.
45
+ *
46
+ * The component intentionally does NOT manage the fragment lifecycle — that is single-spa's
47
+ * responsibility. The parent app is only responsible for rendering (or not rendering) this host
48
+ * element at the right time.
49
+ *
50
+ * Optional `LoadingComponent`, `ErrorComponent`, and `IdleComponent` props can be provided to
51
+ * show feedback during the various single-spa lifecycle phases. All three render as **siblings**
52
+ * of the host `<div>` (not children) because single-spa owns the host element's DOM content
53
+ * exclusively — mixing React-managed children inside it causes `removeChild` errors.
54
+ * When not provided, nothing extra is rendered.
55
+ *
56
+ * @example
57
+ * // Minimal usage:
58
+ * <FragmentSlot moduleName="@myorg/myapp-admin" className="admin-host" />
59
+ *
60
+ * @example
61
+ * // With loading and error feedback:
62
+ * <FragmentSlot
63
+ * moduleName="@myorg/myapp-admin"
64
+ * LoadingComponent={({ moduleName }) => <span>Loading {moduleName}…</span>}
65
+ * ErrorComponent={({ moduleName }) => <span>Failed to load {moduleName}</span>}
66
+ * />
67
+ *
68
+ * @example
69
+ * // With all three slots and branching on idle status:
70
+ * <FragmentSlot
71
+ * moduleName="@myorg/myapp-admin"
72
+ * LoadingComponent={({ moduleName }) => <Spinner label={moduleName} />}
73
+ * ErrorComponent={({ moduleName }) => <Alert>Failed to load {moduleName}</Alert>}
74
+ * IdleComponent={({ moduleName, status }) =>
75
+ * status === 'NOT_MOUNTED'
76
+ * ? <p>{moduleName} is ready — navigate to its route to activate it.</p>
77
+ * : null
78
+ * }
79
+ * />
80
+ */
81
+ declare const FragmentSlot: FC<FragmentSlotProps>;
82
+ export default FragmentSlot;
@@ -6,3 +6,5 @@ export { default as PlatformEventListener } from './PlatformEventListener';
6
6
  export { default as ApplicationIcon } from './ApplicationIcon';
7
7
  export { default as ThemeToggle } from './ThemeToggle/ThemeToggle';
8
8
  export { useTheme } from './ThemeToggle/useTheme';
9
+ export { default as FragmentSlot } from './FragmentSlot';
10
+ export type { FragmentSlotProps } from './FragmentSlot';
@@ -42,3 +42,4 @@ export { useResourceActions } from './commons/useResourceActions';
42
42
  export { useResource } from './commons/useResource';
43
43
  export { useTenants } from './tenants/useTenants';
44
44
  export { useUserState } from './userState/useUserState';
45
+ export { useAppStatus } from './useAppStatus';
@@ -1,6 +1,18 @@
1
1
  import { ModuleMetadata } from '@bluealba/pae-core';
2
2
  import { PlatformApplication } from '../hooks';
3
3
 
4
+ /**
5
+ * Returns true for modules that are the *primary* UI of an application (`app` or `tool`).
6
+ * These are eligible to appear in the navbar/launcher and to be resolved as "the UI" of an app.
7
+ * `fragment` modules are intentionally excluded — they are embedded UIs, not primary UIs.
8
+ */
4
9
  export declare const isUIModule: (module: ModuleMetadata) => boolean;
10
+ /**
11
+ * Returns true for any module that is a microfrontend registered in single-spa,
12
+ * including embedded fragments. Use this predicate when deciding whether a module
13
+ * should appear in the import-map or be registered with single-spa.
14
+ * Contrast with `isUIModule` which only covers primary (navbar-visible) UIs.
15
+ */
16
+ export declare const isMicrofrontendModule: (module: ModuleMetadata) => boolean;
5
17
  export declare const isShellUIModule: (module: ModuleMetadata) => boolean;
6
18
  export declare const isUIApplication: (app: PlatformApplication) => boolean | "" | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluealba/pae-ui-react-core",
3
- "version": "4.5.0",
3
+ "version": "4.5.1-develop-364",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",