@bluealba/pae-ui-react-core 4.6.0-integration-css.403 → 4.6.0-integration-css.408

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,34 @@
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
+ * NOTE: this only covers CSS that goes through style-loader. Runtime
18
+ * CSS-in-JS (e.g. Emotion/MUI) injects its own tags and is not affected.
19
+ *
20
+ * pae-ui-react-core is a shared singleton (one instance via the import map),
21
+ * so this module-scoped store is global across all micro-frontends.
22
+ */
23
+ /**
24
+ * Detach the module's style elements from the document, keeping them in
25
+ * memory for a later restoreModuleStyles call. Safe to call when the module
26
+ * has no tagged styles (no-op).
27
+ */
28
+ export declare const suspendModuleStyles: (moduleName: string) => void;
29
+ /**
30
+ * Re-attach any previously suspended style elements for the module. Safe to
31
+ * call when nothing was suspended (no-op — e.g. the very first mount, where
32
+ * style-loader already injected the styles at load time).
33
+ */
34
+ export declare const restoreModuleStyles: (moduleName: string) => void;
@@ -12,6 +12,11 @@ export interface MicroFrontendOptions<T extends RootComponentProps> extends Sing
12
12
  *
13
13
  * All PAE micro-frontends are wrapped in PAE components that provides react context later used
14
14
  * by the provided hooks.
15
+ *
16
+ * On top of the single-spa lifecycles, the module's global styles (tagged
17
+ * with data-pae-module by the UI SDK) are suspended on unmount and restored
18
+ * on mount, so CSS frameworks imported by one module don't leak into other
19
+ * modules across navigation (see styles/moduleStyleLifecycle).
15
20
  */
16
21
  declare const initializeMicroFrontend: <T extends RootComponentProps>({ rootComponent, ...opts }: MicroFrontendOptions<T>) => ReactAppOrParcel<T>;
17
22
  export default initializeMicroFrontend;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluealba/pae-ui-react-core",
3
- "version": "4.6.0-integration-css.403",
3
+ "version": "4.6.0-integration-css.408",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",