@bluealba/pae-ui-react-core 4.6.0 → 4.7.0-develop-423
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 +33 -0
- package/dist/index.cjs.js +46 -46
- package/dist/index.esm.js +3275 -3116
- package/dist/index.systemjs.js +46 -46
- package/dist/index.umd.js +47 -47
- package/dist/src/components/PortalContainerContext.d.ts +12 -0
- package/dist/src/components/index.d.ts +2 -0
- package/dist/src/hooks/file-storage/index.d.ts +2 -0
- package/dist/src/hooks/file-storage/types.d.ts +35 -0
- package/dist/src/hooks/file-storage/uploadWithProgress.d.ts +7 -0
- package/dist/src/hooks/file-storage/uploadWithProgress.test.d.ts +1 -0
- package/dist/src/hooks/file-storage/useFileStorage.d.ts +9 -0
- package/dist/src/hooks/file-storage/useFileStorage.test.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/utils/initializeMicroFrontend.d.ts +35 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PortalContainerProviderProps {
|
|
4
|
+
container: HTMLElement | null;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const PortalContainerProvider: FC<PortalContainerProviderProps>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the portal container to use, or undefined to let Radix default to
|
|
10
|
+
* document.body.
|
|
11
|
+
*/
|
|
12
|
+
export declare const usePortalContainer: () => HTMLElement | undefined;
|
|
@@ -8,3 +8,5 @@ export { default as ThemeToggle } from './ThemeToggle/ThemeToggle';
|
|
|
8
8
|
export { useTheme } from './ThemeToggle/useTheme';
|
|
9
9
|
export { default as FragmentSlot } from './FragmentSlot';
|
|
10
10
|
export type { FragmentSlotProps } from './FragmentSlot';
|
|
11
|
+
export { PortalContainerProvider, usePortalContainer } from './PortalContainerContext';
|
|
12
|
+
export type { PortalContainerProviderProps } from './PortalContainerContext';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface FileDto {
|
|
2
|
+
id: number;
|
|
3
|
+
originalName: string;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
extension: string;
|
|
6
|
+
size: number;
|
|
7
|
+
isPublic: boolean;
|
|
8
|
+
description?: string;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
url: string;
|
|
11
|
+
createdBy: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UploadOptions {
|
|
16
|
+
isPublic?: boolean;
|
|
17
|
+
description?: string;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
onProgress?: (percent: number) => void;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}
|
|
22
|
+
export interface UpdateMetadataOptions {
|
|
23
|
+
originalName?: string;
|
|
24
|
+
isPublic?: boolean;
|
|
25
|
+
description?: string;
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface UseFileStorageResult {
|
|
29
|
+
isEnabled: boolean;
|
|
30
|
+
upload(file: File, options?: UploadOptions): Promise<FileDto>;
|
|
31
|
+
updateMetadata(id: number, options: UpdateMetadataOptions): Promise<FileDto>;
|
|
32
|
+
remove(id: number): Promise<void>;
|
|
33
|
+
download(id: number): Promise<void>;
|
|
34
|
+
getPreviewUrl(id: number): Promise<string>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseFileStorageResult } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook providing client-side access to the platform File Storage API.
|
|
5
|
+
*
|
|
6
|
+
* The hook is a no-op when `fileStorageEnabled` is `false` in the platform state —
|
|
7
|
+
* every method will reject with a descriptive error.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFileStorage(): UseFileStorageResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -43,3 +43,5 @@ export { useResource } from './commons/useResource';
|
|
|
43
43
|
export { useTenants } from './tenants/useTenants';
|
|
44
44
|
export { useUserState } from './userState/useUserState';
|
|
45
45
|
export { useAppStatus } from './useAppStatus';
|
|
46
|
+
export { useFileStorage } from './file-storage/useFileStorage';
|
|
47
|
+
export type { FileDto, UploadOptions, UpdateMetadataOptions, UseFileStorageResult } from './file-storage/types';
|
|
@@ -4,6 +4,34 @@ import { RootComponentProps } from '../MicrofrontendProps';
|
|
|
4
4
|
|
|
5
5
|
export interface MicroFrontendOptions<T extends RootComponentProps> extends SingleSpaReactOpts<T> {
|
|
6
6
|
rootComponent: FC<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Mount this module inside its own shadow root (attached to the host
|
|
9
|
+
* element the platform resolves from ui.mountAtSelector).
|
|
10
|
+
*
|
|
11
|
+
* Why: global CSS from OTHER modules mounted at the same time (a framework
|
|
12
|
+
* reset, unlayered utilities, ...) cannot reach this module's DOM, and this
|
|
13
|
+
* module's own DOM cannot be affected by it. This is the only isolation
|
|
14
|
+
* that works for SIMULTANEOUSLY mounted modules (e.g. fragments side by side).
|
|
15
|
+
*
|
|
16
|
+
* What module authors must know:
|
|
17
|
+
* - Design tokens (CSS custom properties) inherit into the shadow root —
|
|
18
|
+
* they keep working.
|
|
19
|
+
* - Selectors like `:root`, `html` or `body` do NOT match inside a shadow
|
|
20
|
+
* root; use `:host` instead.
|
|
21
|
+
* - CSS built with the SDK (`pae-ui-sdk`) is automatically encapsulated: the
|
|
22
|
+
* platform moves every `<style data-pae-module>` node from `document.head`
|
|
23
|
+
* into the shadow root at mount time, including lazy chunks and HMR updates.
|
|
24
|
+
* No extra setup needed for webpack-imported stylesheets.
|
|
25
|
+
* - If you inject styles by other means (e.g. dynamic `<style>` creation,
|
|
26
|
+
* third-party runtime CSS-in-JS), access the shadow root via:
|
|
27
|
+
* `usePortalContainer()?.getRootNode() as ShadowRoot | undefined`
|
|
28
|
+
* - Platform core components (Dialog, Tooltip) portal into the shadow root
|
|
29
|
+
* automatically when the module author passes the container from
|
|
30
|
+
* `usePortalContainer()` to the `container` prop of their portal component.
|
|
31
|
+
* Third-party overlay libraries default to document.body: pass them the
|
|
32
|
+
* container from `usePortalContainer()` to keep them inside the shadow root.
|
|
33
|
+
*/
|
|
34
|
+
shadowDom?: boolean;
|
|
7
35
|
}
|
|
8
36
|
/**
|
|
9
37
|
* Main function to create a PAE micro-frontend module.
|
|
@@ -12,6 +40,12 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
|
|
|
12
40
|
*
|
|
13
41
|
* All PAE micro-frontends are wrapped in PAE components that provides react context later used
|
|
14
42
|
* by the provided hooks.
|
|
43
|
+
*
|
|
44
|
+
* When `shadowDom: true` is passed the module is mounted inside its own open
|
|
45
|
+
* shadow root attached to the host element supplied by the platform orchestrator,
|
|
46
|
+
* isolating it from global CSS in the light DOM. A portal container node inside
|
|
47
|
+
* the shadow root is exposed via `usePortalContainer()` so that overlay components
|
|
48
|
+
* (modals, dropdowns, tooltips) can render inside the shadow root as well.
|
|
15
49
|
*/
|
|
16
|
-
declare const initializeMicroFrontend: <T extends RootComponentProps>({ rootComponent, ...opts }: MicroFrontendOptions<T>) => ReactAppOrParcel<T>;
|
|
50
|
+
declare const initializeMicroFrontend: <T extends RootComponentProps>({ rootComponent, shadowDom, ...opts }: MicroFrontendOptions<T>) => ReactAppOrParcel<T>;
|
|
17
51
|
export default initializeMicroFrontend;
|