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

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,4 +1,4 @@
1
1
  export declare const useTheme: () => {
2
- theme: "light" | "dark";
2
+ theme: "dark" | "light";
3
3
  setTheme: (value: "light" | "dark") => void;
4
4
  };
@@ -19,10 +19,10 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
19
19
  * they keep working.
20
20
  * - Selectors like `:root`, `html` or `body` do NOT match inside a shadow
21
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.
22
+ * - CSS built with the SDK (`pae-ui-sdk`) is automatically encapsulated. The
23
+ * module's `<style data-pae-module>` nodes are kept out of the light-DOM
24
+ * `document.head` and live inside the shadow root, including lazy chunks and
25
+ * HMR updates. No extra setup needed for webpack-imported stylesheets.
26
26
  * - If you inject styles by other means (e.g. dynamic `<style>` creation,
27
27
  * third-party runtime CSS-in-JS), access the shadow root via:
28
28
  * `usePortalContainer()?.getRootNode() as ShadowRoot | undefined`
@@ -34,6 +34,15 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
34
34
  */
35
35
  shadowDom?: boolean;
36
36
  }
37
+ /**
38
+ * Marker set on a shadow module's exported `mount` so other core code can detect,
39
+ * after a bare `System.import` (e.g. reading a module's `menu`/`icon` without
40
+ * mounting it), that the module is shadow-isolated and its styles must be evacuated
41
+ * from `document.head`. See {@link hasShadowDomMarker} and useApplicationJSModule.
42
+ */
43
+ export declare const SHADOW_DOM_MARKER = "__paeShadowDom";
44
+ /** True if `mount` is a shadow module's lifecycle (carries {@link SHADOW_DOM_MARKER}). */
45
+ export declare const hasShadowDomMarker: (mount: unknown) => boolean;
37
46
  /**
38
47
  * Main function to create a PAE micro-frontend module.
39
48
  * Internally we use single-spa so currently our API is pretty similar.
@@ -42,11 +51,9 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
42
51
  * All PAE micro-frontends are wrapped in PAE components that provides react context later used
43
52
  * by the provided hooks.
44
53
  *
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.
54
+ * When `shadowDom: true` is passed the module is mounted inside its own open shadow
55
+ * root (see {@link withShadowDom}), isolating it from global CSS in the light DOM and
56
+ * keeping its own CSS out of `document.head`.
50
57
  */
51
58
  declare const initializeMicroFrontend: <T extends RootComponentProps>({ rootComponent, shadowDom, ...opts }: MicroFrontendOptions<T>) => ReactAppOrParcel<T>;
52
59
  export default initializeMicroFrontend;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Per-module style routing registry, shared process-wide via `window`.
3
+ *
4
+ * The CSS of an isolated (`shadowDom`) micro-frontend must never leak into the
5
+ * light-DOM `document.head`. style-loader injects `<style data-pae-module=name>`
6
+ * nodes into the head at bundle-load (e.g. when the shell imports a module just to
7
+ * read its `menu`/`icon`, long before — or without ever — mounting it). This
8
+ * registry holds, per module, a DETACHED holder element that owns those nodes
9
+ * while the module is not mounted (a detached node is not rendered, so its CSS does
10
+ * not apply ⇒ no leak), plus the current `target` where new nodes should go.
11
+ *
12
+ * `initializeMicroFrontend` flips `target` across the lifecycle (holder ⇄ shadow
13
+ * root) and `useApplicationJSModule` evacuates a shadow module's head styles into
14
+ * the holder right after importing it for its exports.
15
+ */
16
+ export interface StyleEntry {
17
+ /** The module name (equals the `data-pae-module` attribute of its style nodes). */
18
+ name: string;
19
+ /** Where newly injected `<style data-pae-module=name>` nodes should be placed now. */
20
+ target: Node;
21
+ /** Detached `<div>` that owns the module's style nodes while it is not mounted. */
22
+ holder: HTMLElement;
23
+ mode: 'detached' | 'shadow';
24
+ }
25
+ /** Get or lazily create the registry entry (with a detached holder) for a module. */
26
+ export declare const getStyleEntry: (moduleName: string) => StyleEntry;
27
+ /**
28
+ * Move every `<style|link data-pae-module=name>` node currently under `from` into
29
+ * `to`. Used to evacuate a module's styles out of `document.head` (into its holder
30
+ * or shadow root) and back into the holder on unmount.
31
+ */
32
+ export declare const moveModuleStyles: (from: ParentNode, to: Node, name: string) => void;
33
+ /**
34
+ * Evacuate a shadow module's styles out of the light-DOM `document.head` into its
35
+ * detached holder, and route future styles there too — unless the module is
36
+ * currently mounted (its target is the live shadow root). Returns the entry.
37
+ */
38
+ export declare const evacuateToHolder: (moduleName: string) => StyleEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluealba/pae-ui-react-core",
3
- "version": "4.7.0-develop-427",
3
+ "version": "4.7.0-develop-428",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",