@bluealba/pae-ui-react-core 4.7.0-develop-417 → 4.7.0-develop-427

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.
@@ -1,14 +1 @@
1
- /**
2
- * Applies a tenant customization stylesheet.
3
- *
4
- * The stylesheet is wrapped in `@layer pae.customization`, the highest layer
5
- * of the platform cascade contract (declared first in the document by the
6
- * gateway). That makes the override deterministic: it always wins over
7
- * `pae.theme`/`pae.base` regardless of when it loads — no artificial delay
8
- * needed (this used to wait 1s to win by source order).
9
- *
10
- * Styles go through the StyleRegistry, so they reach both the document and
11
- * the shell shadow root (theme variables are inherited custom properties
12
- * either way).
13
- */
14
1
  export declare const useDynamicStyleSheet: (styleSheet?: string) => void;
@@ -1,4 +1,4 @@
1
- export { StyleRegistry } from './styles/StyleRegistry';
1
+
2
2
  export type { ModuleMetadata, AuthUser, AuthUserWithApplications, BaseUser } from '@bluealba/pae-core';
3
3
  export * from './core';
4
4
  export * from './hooks';
@@ -5,29 +5,32 @@ import { RootComponentProps } from '../MicrofrontendProps';
5
5
  export interface MicroFrontendOptions<T extends RootComponentProps> extends SingleSpaReactOpts<T> {
6
6
  rootComponent: FC<T>;
7
7
  /**
8
- * Mount this module inside its own shadow root (attached to the host
9
- * element the platform resolves from ui.mountAtSelector).
8
+ * Mount this module inside its own shadow root (attached to a dedicated child
9
+ * of the host element the platform resolves from ui.mountAtSelector, so the
10
+ * shared host stays usable by other modules mounted there later).
10
11
  *
11
12
  * Why: global CSS from OTHER modules mounted at the same time (a framework
12
13
  * reset, unlayered utilities, ...) cannot reach this module's DOM, and this
13
- * module's own style-loader CSS is moved into the shadow root so it cannot
14
- * leak out. This is the only isolation that works for SIMULTANEOUSLY
15
- * mounted modules (e.g. fragments side by side) — the suspend/restore
16
- * lifecycle alone only helps across navigation.
14
+ * module's own DOM cannot be affected by it. This is the only isolation
15
+ * that works for SIMULTANEOUSLY mounted modules (e.g. fragments side by side).
17
16
  *
18
17
  * What module authors must know:
19
18
  * - Design tokens (CSS custom properties) inherit into the shadow root —
20
19
  * they keep working.
21
20
  * - Selectors like `:root`, `html` or `body` do NOT match inside a shadow
22
- * root; use `:host` (Tailwind v4 already emits `:root, :host`).
23
- * - @keyframes and @layer order statements are scoped per tree — keep them
24
- * in the module's own CSS (style-loader output is moved wholesale, so
25
- * this is automatic for bundled CSS).
21
+ * root; use `:host` instead.
22
+ * - CSS built with the SDK (`pae-ui-sdk`) is automatically encapsulated: the
23
+ * platform moves every `<style data-pae-module>` node from `document.head`
24
+ * into the shadow root at mount time, including lazy chunks and HMR updates.
25
+ * No extra setup needed for webpack-imported stylesheets.
26
+ * - If you inject styles by other means (e.g. dynamic `<style>` creation,
27
+ * third-party runtime CSS-in-JS), access the shadow root via:
28
+ * `usePortalContainer()?.getRootNode() as ShadowRoot | undefined`
26
29
  * - Platform core components (Dialog, Tooltip) portal into the shadow root
27
- * automatically. Third-party overlay libraries default to document.body:
28
- * pass them the container from usePortalContainer(), and point runtime
29
- * CSS-in-JS (e.g. Emotion: createCache({ container })) at the shadow
30
- * root, or their floating content will render unstyled outside it.
30
+ * automatically when the module author passes the container from
31
+ * `usePortalContainer()` to the `container` prop of their portal component.
32
+ * Third-party overlay libraries default to document.body: pass them the
33
+ * container from `usePortalContainer()` to keep them inside the shadow root.
31
34
  */
32
35
  shadowDom?: boolean;
33
36
  }
@@ -39,12 +42,11 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
39
42
  * All PAE micro-frontends are wrapped in PAE components that provides react context later used
40
43
  * by the provided hooks.
41
44
  *
42
- * On top of the single-spa lifecycles, the module's global styles (tagged
43
- * with data-pae-module by the UI SDK) are suspended on unmount and restored
44
- * on mount, so CSS frameworks imported by one module don't leak into other
45
- * modules across navigation (see styles/moduleStyleLifecycle). With
46
- * `shadowDom: true` the module is additionally mounted inside its own shadow
47
- * root, isolating it from modules mounted at the same time.
45
+ * When `shadowDom: true` is passed the module is mounted inside its own open
46
+ * shadow root attached to the host element supplied by the platform orchestrator,
47
+ * isolating it from global CSS in the light DOM. A portal container node inside
48
+ * the shadow root is exposed via `usePortalContainer()` so that overlay components
49
+ * (modals, dropdowns, tooltips) can render inside the shadow root as well.
48
50
  */
49
51
  declare const initializeMicroFrontend: <T extends RootComponentProps>({ rootComponent, shadowDom, ...opts }: MicroFrontendOptions<T>) => ReactAppOrParcel<T>;
50
52
  export default initializeMicroFrontend;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@bluealba/pae-ui-react-core",
3
- "version": "4.7.0-develop-417",
3
+ "version": "4.7.0-develop-427",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
7
7
  "types": "./dist/src/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "src/global.css"
10
11
  ],
11
12
  "description": "React utilities for PAE",
12
13
  "scripts": {
package/src/global.css ADDED
@@ -0,0 +1,32 @@
1
+ :root {
2
+ /* Input */
3
+ --platform-label-color: var(--platform-text-secondary-color);
4
+ --platform-input-border-color: var(--platform-lines);
5
+ --platform-input-background-color: var(--platform-background-secondary-color);
6
+ --platform-input-color: var(--platform-text-primary-color);
7
+ --platform-input-focus-border-color: var(--platform-color-primary);
8
+
9
+ /* Button */
10
+ --platform-button-base-padding: 4px 16px;
11
+ --platform-button-base-border-radius: 6px;
12
+ --platform-button-base-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
13
+ --platform-button-base-font-size: 1em;
14
+ --platform-button-base-line-height: 16px;
15
+ --platform-button-base-height: calc(2 * var(--platform-button-base-font-size));
16
+ /* Contained Primary variant */
17
+ --platform-button-contained-primary-background-color: var(--platform-color-primary);
18
+ --platform-button-contained-primary-color: #ffffff;
19
+ /* Outlined Primary variant */
20
+ --platform-button-outlined-primary-color: var(--platform-color-primary);
21
+ /* Text Primary variant */
22
+ --platform-button-text-primary-color: var(--platform-text-primary-color);
23
+
24
+ /* Contained danger variant */
25
+ --platform-button-contained-danger-background-color: var(--platform-color-danger);
26
+ --platform-button-contained-danger-color: #ffffff;
27
+ /* Outlined danger variant */
28
+ --platform-button-outlined-danger-color: var(--platform-color-danger);
29
+ /* Text danger variant */
30
+ --platform-button-text-danger-color: var(--platform-color-danger);
31
+
32
+ }
@@ -1,41 +0,0 @@
1
- /**
2
- * StyleRegistry — single distribution point for pae-ui-react-core styles.
3
- *
4
- * pae-ui-react-core is loaded once (shared via the platform import map) but
5
- * its components render in two different style scopes:
6
- * - the document (micro-frontends mounted in the light DOM)
7
- * - the shell shadow root (<pae-shell-host>)
8
- *
9
- * Every stylesheet registered here is applied to the document AND to every
10
- * shadow root adopted via adoptInto(). Uses constructable stylesheets
11
- * (adoptedStyleSheets) when available, falling back to <style> elements
12
- * (jsdom, older browsers).
13
- */
14
- declare class StyleRegistryImpl {
15
- private styles;
16
- private shadowRoots;
17
- /**
18
- * Registers a stylesheet and applies it to the document and to every
19
- * adopted shadow root. Returns an unregister function.
20
- */
21
- register(cssText: string): () => void;
22
- /**
23
- * Applies every registered stylesheet to the given shadow root and keeps
24
- * it in sync with future registrations. Used by the shell host.
25
- */
26
- adoptInto(root: ShadowRoot): void;
27
- /**
28
- * Stops syncing styles into the given shadow root (e.g. when the shell
29
- * host disconnects). Already-adopted sheets are removed.
30
- */
31
- releaseRoot(root: ShadowRoot): void;
32
- private unregister;
33
- private appendStyleElement;
34
- }
35
- export declare const StyleRegistry: StyleRegistryImpl;
36
- /**
37
- * Drains CSS bundled at build time (the build prepends the package CSS to
38
- * the bundle as globalThis.__PAE_UI_CORE_CSS__) into the registry.
39
- */
40
- export declare const registerBundledCss: () => void;
41
- export {};
@@ -1,43 +0,0 @@
1
- /**
2
- * Suspend/restore a micro-frontend module's global styles across single-spa
3
- * mount/unmount.
4
- *
5
- * style-loader injects a module's CSS into document.head when the bundle is
6
- * LOADED, and single-spa unmount never removes it (SystemJS keeps the module
7
- * cached). A module that imports a global stylesheet (a CSS framework reset,
8
- * preflight, etc.) therefore permanently contaminates every app visited
9
- * afterwards in the same session.
10
- *
11
- * The UI SDK tags every <style> it emits with data-pae-module="<name>"
12
- * (see pae-ui-react-sdk getBaseConfig). initializeMicroFrontend calls
13
- * suspendModuleStyles on unmount — detaching those elements from the
14
- * document while keeping them in memory — and restoreModuleStyles on mount,
15
- * so re-entering the app is instant (no re-parse, CSSOM preserved).
16
- *
17
- * For modules that opt into per-module shadow DOM, restoreModuleStyles
18
- * accepts the module's shadow root as target: the tagged styles are moved
19
- * INTO the shadow root (scoping them to the module) instead of back into
20
- * document.head, and suspendModuleStyles also sweeps that root on unmount.
21
- *
22
- * NOTE: this only covers CSS that goes through style-loader. Runtime
23
- * CSS-in-JS (e.g. Emotion/MUI) injects its own tags and is not affected.
24
- *
25
- * pae-ui-react-core is a shared singleton (one instance via the import map),
26
- * so this module-scoped store is global across all micro-frontends.
27
- */
28
- /**
29
- * Detach the module's style elements from the document (and from the given
30
- * extra root, e.g. the module's shadow root), keeping them in memory for a
31
- * later restoreModuleStyles call. Safe to call when the module has no tagged
32
- * styles (no-op).
33
- */
34
- export declare const suspendModuleStyles: (moduleName: string, extraRoot?: ParentNode) => void;
35
- /**
36
- * Attach the module's style elements to the target (document.head by
37
- * default, or the module's shadow root in per-module shadow DOM mode).
38
- * Sources, in order: previously suspended elements, plus any still sitting
39
- * in document.head when a non-document target is given (first mount of a
40
- * shadow module — style-loader injected them at bundle load time).
41
- * Safe to call when there is nothing to attach (no-op).
42
- */
43
- export declare const restoreModuleStyles: (moduleName: string, target?: ShadowRoot) => void;