@egen-civitas/esm-styleguide 1.7.0 → 1.9.0
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/CHANGELOG.md +18 -0
- package/dist/components/_canvas.scss +12 -1
- package/dist/components/_general.scss +13 -9
- package/dist/components/_panel-overrides.scss +0 -6
- package/dist/left-nav/index.d.ts +3 -0
- package/dist/left-nav/index.d.ts.map +1 -1
- package/dist/left-nav/index.js +2 -0
- package/dist/page-background/index.d.ts +1 -0
- package/dist/page-background/index.d.ts.map +1 -1
- package/dist/page-background/index.js +1 -0
- package/dist/page-background/page-background.component.d.ts +13 -5
- package/dist/page-background/page-background.component.d.ts.map +1 -1
- package/dist/page-background/page-background.component.js +38 -29
- package/dist/page-background/page-background.context.d.ts +7 -6
- package/dist/page-background/page-background.context.d.ts.map +1 -1
- package/dist/page-background/page-background.context.js +19 -22
- package/dist/page-background/page-background.render.d.ts +12 -0
- package/dist/page-background/page-background.render.d.ts.map +1 -0
- package/dist/page-background/page-background.render.js +21 -0
- package/dist/page-background/page-background.store.d.ts +26 -0
- package/dist/page-background/page-background.store.d.ts.map +1 -0
- package/dist/page-background/page-background.store.js +25 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @egen-civitas/esm-styleguide
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f939c5e: Arrière-plan de page monté une seule fois, dans le shell. L'état de `page-background` passe d'un contexte React (qui ne traversait pas les racines React des apps) à un store global `@egen-civitas/esm-state` : `<PageBackground>` fonctionne désormais depuis n'importe quelle app, sans provider. Nouveau `renderPageBackground(conteneur)` (appelé par le shell, conteneur `#egen-page-background-container`, rendu vide tant qu'aucune page ne déclare de fond) ; `<GlobalPageBackground>` gagne `fallback="animated" | "none"`. Le démontage d'une page ne libère que son propre fond (un démontage tardif n'efface plus celui de la page suivante) et un changement de props ne repasse plus par le fond par défaut. `<PageBackgroundProvider>` est déprécié et ne fait plus que rendre ses enfants. Styles : le fond de canevas est porté par `html` seul (`body` transparent) pour ne pas masquer l'arrière-plan global.
|
|
8
|
+
|
|
9
|
+
## 1.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- b49f9e8: Suppression définitive de la barre latérale globale : le conteneur `#egen-left-nav-container` est retiré du shell (il n'était plus que masqué) ainsi que ses règles CSS. `LeftNavMenu`, `useLeftNav`, `setLeftNav` et `unsetLeftNav` sont marqués `@deprecated` : la navigation de niveau 2 est portée par la TopBar (slot `topbar-level2-nav`) ; une app qui veut une navigation interne affiche sa propre barre latérale.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b49f9e8]
|
|
18
|
+
- @egen-civitas/esm-react-utils@1.0.5
|
|
19
|
+
- @egen-civitas/esm-extensions@1.1.1
|
|
20
|
+
|
|
3
21
|
## 1.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
@use '../vars' as *;
|
|
2
2
|
|
|
3
|
+
// La couleur de fond du canevas est portée par `html` seul. `body` reste
|
|
4
|
+
// transparent : un fond opaque sur body cacherait l'arrière-plan global de page
|
|
5
|
+
// (#egen-page-background-container, z-index négatif — voir _general.scss).
|
|
6
|
+
// Le rendu est identique : body occupe toute la fenêtre.
|
|
7
|
+
html {
|
|
8
|
+
background-color: $ui-01;
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
html,
|
|
4
12
|
body {
|
|
5
|
-
background-color: $ui-01;
|
|
6
13
|
margin: 0;
|
|
7
14
|
padding: 0;
|
|
8
15
|
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
}
|
|
@@ -27,7 +27,6 @@ html[data-public-route='true'] {
|
|
|
27
27
|
min-height: 100%;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
#egen-left-nav-container,
|
|
31
30
|
#egen-workspaces-container,
|
|
32
31
|
#egen-footer-app-container {
|
|
33
32
|
display: none;
|
|
@@ -53,6 +52,19 @@ html[data-public-route='true'] {
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
// Arrière-plan global de page : un seul hôte, rendu par le shell
|
|
56
|
+
// (renderPageBackground). Il couvre la fenêtre, DERRIÈRE tout le contenu
|
|
57
|
+
// (z-index négatif : au-dessus du fond de html, sous le body et les apps) et
|
|
58
|
+
// n'intercepte aucun clic. Tant qu'aucune page n'a déclaré de fond
|
|
59
|
+
// (<PageBackground>), il est vide : aucun changement d'apparence.
|
|
60
|
+
// Prérequis : body n'a pas de fond opaque (voir _canvas.scss), sinon il le cacherait.
|
|
61
|
+
#egen-page-background-container {
|
|
62
|
+
position: fixed;
|
|
63
|
+
inset: 0;
|
|
64
|
+
z-index: -1;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
// Zone de scroll : le contenu des apps défile ICI (et non plus sur la fenêtre),
|
|
57
69
|
// dans la ligne de grille située SOUS la TopBar et AU-DESSUS du Footer. Le
|
|
58
70
|
// contenu est ainsi coupé net aux deux frontières (TopBar / Footer) : on ne le
|
|
@@ -79,13 +91,6 @@ html[data-public-route='true'] {
|
|
|
79
91
|
overflow-x: auto;
|
|
80
92
|
}
|
|
81
93
|
|
|
82
|
-
// La navigation latérale n'est plus globale : la navigation d'app vit dans le
|
|
83
|
-
// niveau 2 de la TopBar (slot `topbar-level2-nav`). Une app qui veut une
|
|
84
|
-
// sidebar interne la fournit elle-même dans son propre contenu.
|
|
85
|
-
#egen-left-nav-container {
|
|
86
|
-
display: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
94
|
#egen-workspaces-container {
|
|
90
95
|
grid-area: workspace;
|
|
91
96
|
position: sticky;
|
|
@@ -167,7 +172,6 @@ body {
|
|
|
167
172
|
container-type: normal;
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
#egen-left-nav-container,
|
|
171
175
|
#egen-workspaces-container,
|
|
172
176
|
#egen-top-nav-app-container,
|
|
173
177
|
#egen-footer-app-container {
|
|
@@ -135,12 +135,6 @@
|
|
|
135
135
|
// est défini UNIQUEMENT dans _general.scss (zone de scroll du shell). Ne pas le
|
|
136
136
|
// redéfinir ici : ce fichier est chargé après et écraserait le z-index.
|
|
137
137
|
|
|
138
|
-
#egen-left-nav-container .cds--side-nav {
|
|
139
|
-
height: calc(100dvh - var(--egen-navbar-height) - var(--egen-footer-height, 0px));
|
|
140
|
-
top: var(--egen-navbar-height);
|
|
141
|
-
position: sticky;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
138
|
// Panneau workspace
|
|
145
139
|
#egen-workspaces-container {
|
|
146
140
|
backdrop-filter: var(--panel-lg-backdrop-filter);
|
package/dist/left-nav/index.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ interface LeftNavMenuProps extends SideNavProps {
|
|
|
19
19
|
* Use of this component by anything other than <SideMenuPanel> (where isChildOfHeader == false)
|
|
20
20
|
* is deprecated; it simply renders nothing.
|
|
21
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Il n'existe plus de barre latérale globale : la navigation de niveau 2 est portée par la TopBar (slot `topbar-level2-nav`, type `NavEntryMeta`). Une app qui a besoin d'une navigation interne affiche sa propre barre latérale.
|
|
24
|
+
*/
|
|
22
25
|
export declare const LeftNavMenu: React.ForwardRefExoticComponent<LeftNavMenuProps & React.RefAttributes<HTMLElement>>;
|
|
23
26
|
export {};
|
|
24
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/left-nav/index.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAW3D;;GAEG;AACH,UAAU,gBAAiB,SAAQ,YAAY;IAC7C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,sFA8BtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/left-nav/index.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAW3D;;GAEG;AACH,UAAU,gBAAiB,SAAQ,YAAY;IAC7C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH;;GAEG;AACH,eAAO,MAAM,WAAW,sFA8BtB,CAAC"}
|
package/dist/left-nav/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import styles from "./left-nav.module.scss";
|
|
|
10
10
|
*
|
|
11
11
|
* Use of this component by anything other than <SideMenuPanel> (where isChildOfHeader == false)
|
|
12
12
|
* is deprecated; it simply renders nothing.
|
|
13
|
+
*/ /**
|
|
14
|
+
* @deprecated Il n'existe plus de barre latérale globale : la navigation de niveau 2 est portée par la TopBar (slot `topbar-level2-nav`, type `NavEntryMeta`). Une app qui a besoin d'une navigation interne affiche sa propre barre latérale.
|
|
13
15
|
*/ export const LeftNavMenu = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
14
16
|
const { slotName, basePath, componentContext, state } = useLeftNavStore();
|
|
15
17
|
const currentPath = window.location ?? {
|
|
@@ -2,4 +2,5 @@ export * from './gradient-wave.component.js';
|
|
|
2
2
|
export * from './page-background.utils.js';
|
|
3
3
|
export * from './page-background.context.js';
|
|
4
4
|
export * from './page-background.component.js';
|
|
5
|
+
export * from './page-background.render.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page-background/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page-background/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
|
|
@@ -71,15 +71,23 @@ export interface PageBackgroundProps extends DefaultBackgroundProps {
|
|
|
71
71
|
*/
|
|
72
72
|
customComponent?: React.ReactNode;
|
|
73
73
|
}
|
|
74
|
+
export interface GlobalPageBackgroundProps {
|
|
75
|
+
/**
|
|
76
|
+
* Rendu quand aucune page n'a déclaré de fond : `'animated'` (défaut) affiche
|
|
77
|
+
* le dégradé animé d'accueil, `'none'` ne rend rien.
|
|
78
|
+
*/
|
|
79
|
+
fallback?: 'animated' | 'none';
|
|
80
|
+
}
|
|
74
81
|
/**
|
|
75
|
-
* Rendu de l'arrière-plan global unique de l'application. À monter une
|
|
76
|
-
*
|
|
82
|
+
* Rendu de l'arrière-plan global unique de l'application. À monter une seule
|
|
83
|
+
* fois — c'est le shell qui le fait (voir `renderPageBackground`). Il lit le
|
|
84
|
+
* store global renseigné par `<PageBackground>`, depuis n'importe quelle app.
|
|
77
85
|
*/
|
|
78
|
-
export declare function GlobalPageBackground(): React.JSX.Element;
|
|
86
|
+
export declare function GlobalPageBackground({ fallback }?: GlobalPageBackgroundProps): React.JSX.Element | null;
|
|
79
87
|
/**
|
|
80
88
|
* Composant déclaratif d'arrière-plan pour une page : s'enregistre auprès du
|
|
81
|
-
*
|
|
82
|
-
*
|
|
89
|
+
* store global pendant sa durée de vie et restaure le fond par défaut au
|
|
90
|
+
* démontage (sauf si une autre page a repris le fond entre-temps). Ne rend rien lui-même — le rendu effectif se
|
|
83
91
|
* fait via `<GlobalPageBackground>`.
|
|
84
92
|
*
|
|
85
93
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-background.component.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.component.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"page-background.component.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.component.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,KAA4B,MAAM,OAAO,CAAC;AASjD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,qBA0B3E;AAED,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACxC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAkC,EAClC,QAAkB,EAClB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAsB,EACtB,QAAe,EACf,YAAmB,EACnB,MAAM,EACN,QAAQ,GACT,EAAE,sBAAsB,qBA6FxB;AAED,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAqB,EAAE,GAAE,yBAA8B,4BAkC7F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,QAAQ,GACT,EAAE,mBAAmB,QA6CrB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/** @category Page Background */ import React, { useEffect } from "react";
|
|
2
|
+
/** @category Page Background */ import React, { useEffect, useRef } from "react";
|
|
3
3
|
import { GradientWave } from "./gradient-wave.component.js";
|
|
4
4
|
import { usePageBackground } from "./page-background.context.js";
|
|
5
|
+
import { claimPageBackground, releasePageBackground } from "./page-background.store.js";
|
|
5
6
|
import { cn } from "./page-background.utils.js";
|
|
6
7
|
/** Palette par défaut du fond animé de la page d'accueil. */ const DEFAULT_HOME_GRADIENT_COLORS = [
|
|
7
8
|
'#008080',
|
|
@@ -115,9 +116,10 @@ import { cn } from "./page-background.utils.js";
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
|
-
* Rendu de l'arrière-plan global unique de l'application. À monter une
|
|
119
|
-
*
|
|
120
|
-
|
|
119
|
+
* Rendu de l'arrière-plan global unique de l'application. À monter une seule
|
|
120
|
+
* fois — c'est le shell qui le fait (voir `renderPageBackground`). Il lit le
|
|
121
|
+
* store global renseigné par `<PageBackground>`, depuis n'importe quelle app.
|
|
122
|
+
*/ export function GlobalPageBackground({ fallback = 'animated' } = {}) {
|
|
121
123
|
const { config } = usePageBackground();
|
|
122
124
|
if (config?.customComponent) {
|
|
123
125
|
return /*#__PURE__*/ _jsx("div", {
|
|
@@ -141,14 +143,15 @@ import { cn } from "./page-background.utils.js";
|
|
|
141
143
|
children: config.children
|
|
142
144
|
});
|
|
143
145
|
}
|
|
146
|
+
if (fallback === 'none') return null;
|
|
144
147
|
return /*#__PURE__*/ _jsx(AnimatedHomeBackground, {
|
|
145
148
|
className: config?.className
|
|
146
149
|
});
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
* Composant déclaratif d'arrière-plan pour une page : s'enregistre auprès du
|
|
150
|
-
*
|
|
151
|
-
*
|
|
153
|
+
* store global pendant sa durée de vie et restaure le fond par défaut au
|
|
154
|
+
* démontage (sauf si une autre page a repris le fond entre-temps). Ne rend rien lui-même — le rendu effectif se
|
|
152
155
|
* fait via `<GlobalPageBackground>`.
|
|
153
156
|
*
|
|
154
157
|
* @example
|
|
@@ -161,9 +164,12 @@ import { cn } from "./page-background.utils.js";
|
|
|
161
164
|
* );
|
|
162
165
|
* }
|
|
163
166
|
*/ export function PageBackground({ customComponent, imageSrc, imageAlt, imageFit, className, imageClassName, overlayClassName, glowClassName, showAtmosphere, showGlow, showDarkWash, accent, children }) {
|
|
164
|
-
|
|
167
|
+
// Identité de cette page : permet de ne libérer que SON fond au démontage.
|
|
168
|
+
const owner = useRef({});
|
|
169
|
+
// Déclare / met à jour le fond. Pas de libération ici : un simple changement
|
|
170
|
+
// de props ne doit pas faire repasser par le fond par défaut (clignotement).
|
|
165
171
|
useEffect(()=>{
|
|
166
|
-
|
|
172
|
+
claimPageBackground(owner.current, {
|
|
167
173
|
customComponent,
|
|
168
174
|
imageSrc,
|
|
169
175
|
imageAlt,
|
|
@@ -178,11 +184,7 @@ import { cn } from "./page-background.utils.js";
|
|
|
178
184
|
accent,
|
|
179
185
|
children
|
|
180
186
|
});
|
|
181
|
-
return ()=>{
|
|
182
|
-
setPageBackground(null);
|
|
183
|
-
};
|
|
184
187
|
}, [
|
|
185
|
-
setPageBackground,
|
|
186
188
|
customComponent,
|
|
187
189
|
imageSrc,
|
|
188
190
|
imageAlt,
|
|
@@ -197,6 +199,11 @@ import { cn } from "./page-background.utils.js";
|
|
|
197
199
|
accent,
|
|
198
200
|
children
|
|
199
201
|
]);
|
|
202
|
+
// Libère le fond au démontage de la page.
|
|
203
|
+
useEffect(()=>{
|
|
204
|
+
const id = owner.current;
|
|
205
|
+
return ()=>releasePageBackground(id);
|
|
206
|
+
}, []);
|
|
200
207
|
return null;
|
|
201
208
|
} /* ============================================================================
|
|
202
209
|
* GUIDE D'UTILISATION — @egen-civitas/esm-styleguide/page-background
|
|
@@ -205,32 +212,34 @@ import { cn } from "./page-background.utils.js";
|
|
|
205
212
|
* ni de CSS Modules). Porté et durci depuis Civitas-GED, où il habillait
|
|
206
213
|
* déjà toutes les pages de l'intranet.
|
|
207
214
|
*
|
|
208
|
-
* 1. INSTALLATION
|
|
215
|
+
* 1. INSTALLATION
|
|
209
216
|
* ----------------------------------------------------------------------
|
|
210
|
-
*
|
|
211
|
-
* (
|
|
217
|
+
* Rien à monter côté app : le shell héberge l'unique rendu global de
|
|
218
|
+
* l'arrière-plan (`renderPageBackground`, conteneur `#egen-page-background-container`)
|
|
219
|
+
* et l'état est un store global (@egen-civitas/esm-state) partagé entre toutes
|
|
220
|
+
* les racines React des apps. S'assurer seulement que le preset Tailwind du
|
|
221
|
+
* framework est importé (voir @egen-civitas/tailwind-preset) :
|
|
212
222
|
*
|
|
213
223
|
* import '@egen-civitas/tailwind-preset/tailwind.tw.css';
|
|
214
224
|
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
225
|
+
* `<PageBackgroundProvider>` est conservé pour compatibilité mais n'a plus
|
|
226
|
+
* aucun effet (inutile de l'utiliser).
|
|
217
227
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* GlobalPageBackground,
|
|
221
|
-
* } from '@egen-civitas/esm-styleguide';
|
|
228
|
+
* Hors shell (storybook, tests), monter soi-même `<GlobalPageBackground />`
|
|
229
|
+
* une fois : il lit le même store.
|
|
222
230
|
*
|
|
223
231
|
* function Root() {
|
|
224
232
|
* return (
|
|
225
|
-
*
|
|
226
|
-
* <GlobalPageBackground /> // rendu réel de l'arrière-plan (
|
|
227
|
-
* <AppShell />
|
|
228
|
-
*
|
|
233
|
+
* <>
|
|
234
|
+
* <GlobalPageBackground /> // rendu réel de l'arrière-plan (fixed, derrière le contenu)
|
|
235
|
+
* <AppShell />
|
|
236
|
+
* </>
|
|
229
237
|
* );
|
|
230
238
|
* }
|
|
231
239
|
*
|
|
232
|
-
* Sans imageSrc déclaré par aucune page, <GlobalPageBackground> retombe
|
|
233
|
-
*
|
|
240
|
+
* Sans imageSrc déclaré par aucune page, <GlobalPageBackground> retombe sur
|
|
241
|
+
* <AnimatedHomeBackground> (fond WebGL animé) — sauf avec fallback="none" : c'est
|
|
242
|
+
* le réglage du shell, pour que les pages sans fond gardent leur apparence.
|
|
234
243
|
*
|
|
235
244
|
* 2. USAGE DANS UNE PAGE (déclaratif, cas le plus courant)
|
|
236
245
|
* ----------------------------------------------------------------------
|
|
@@ -250,8 +259,8 @@ import { cn } from "./page-background.utils.js";
|
|
|
250
259
|
* );
|
|
251
260
|
* }
|
|
252
261
|
*
|
|
253
|
-
* <PageBackground> ne rend rien lui-même : il s'enregistre auprès du
|
|
254
|
-
*
|
|
262
|
+
* <PageBackground> ne rend rien lui-même : il s'enregistre auprès du store
|
|
263
|
+
* global au montage et restaure le fond par défaut au démontage — donc
|
|
255
264
|
* UNE SEULE instance active à la fois, celle de la page actuellement
|
|
256
265
|
* affichée.
|
|
257
266
|
*
|
|
@@ -6,18 +6,19 @@ interface PageBackgroundContextValue {
|
|
|
6
6
|
setPageBackground: (config: PageBackgroundProps | null) => void;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `<GlobalPageBackground
|
|
9
|
+
* @deprecated N'a plus aucun effet : l'état de l'arrière-plan est désormais un
|
|
10
|
+
* store global (`@egen-civitas/esm-state`), partagé entre toutes les racines
|
|
11
|
+
* React des apps. Le shell monte l'unique `<GlobalPageBackground>` ; une app
|
|
12
|
+
* n'a plus qu'à utiliser `<PageBackground>`. Conservé pour compatibilité :
|
|
13
|
+
* il se contente de rendre ses enfants.
|
|
12
14
|
*/
|
|
13
15
|
export declare function PageBackgroundProvider({ children }: {
|
|
14
16
|
children: React.ReactNode;
|
|
15
17
|
}): React.JSX.Element;
|
|
16
18
|
/**
|
|
17
19
|
* Accès direct au gestionnaire d'arrière-plan global. Utilisé en interne par
|
|
18
|
-
* `<
|
|
19
|
-
*
|
|
20
|
-
* synchronisation plus complexe qu'un simple montage/démontage de page).
|
|
20
|
+
* `<GlobalPageBackground>` ; à réserver aux cas où le composant déclaratif
|
|
21
|
+
* `<PageBackground>` ne suffit pas.
|
|
21
22
|
*/
|
|
22
23
|
export declare function usePageBackground(): PageBackgroundContextValue;
|
|
23
24
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-background.context.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.context.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"page-background.context.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.context.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAG1E,UAAU,0BAA0B;IAClC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;CACjE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAEjF;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,CAG9D"}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/** @category Page Background */ import React, {
|
|
3
|
-
|
|
4
|
-
config: null,
|
|
5
|
-
setPageBackground: ()=>{}
|
|
6
|
-
});
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/** @category Page Background */ import React, { useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { pageBackgroundStore, setGlobalPageBackground } from "./page-background.store.js";
|
|
7
4
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `<GlobalPageBackground
|
|
5
|
+
* @deprecated N'a plus aucun effet : l'état de l'arrière-plan est désormais un
|
|
6
|
+
* store global (`@egen-civitas/esm-state`), partagé entre toutes les racines
|
|
7
|
+
* React des apps. Le shell monte l'unique `<GlobalPageBackground>` ; une app
|
|
8
|
+
* n'a plus qu'à utiliser `<PageBackground>`. Conservé pour compatibilité :
|
|
9
|
+
* il se contente de rendre ses enfants.
|
|
11
10
|
*/ export function PageBackgroundProvider({ children }) {
|
|
12
|
-
|
|
13
|
-
const value = useMemo(()=>({
|
|
14
|
-
config,
|
|
15
|
-
setPageBackground: setConfig
|
|
16
|
-
}), [
|
|
17
|
-
config
|
|
18
|
-
]);
|
|
19
|
-
return /*#__PURE__*/ _jsx(PageBackgroundContext.Provider, {
|
|
20
|
-
value: value,
|
|
11
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
21
12
|
children: children
|
|
22
13
|
});
|
|
23
14
|
}
|
|
15
|
+
const selectConfig = ()=>pageBackgroundStore.getState().config;
|
|
24
16
|
/**
|
|
25
17
|
* Accès direct au gestionnaire d'arrière-plan global. Utilisé en interne par
|
|
26
|
-
* `<
|
|
27
|
-
*
|
|
28
|
-
* synchronisation plus complexe qu'un simple montage/démontage de page).
|
|
18
|
+
* `<GlobalPageBackground>` ; à réserver aux cas où le composant déclaratif
|
|
19
|
+
* `<PageBackground>` ne suffit pas.
|
|
29
20
|
*/ export function usePageBackground() {
|
|
30
|
-
|
|
21
|
+
const config = useSyncExternalStore(pageBackgroundStore.subscribe, selectConfig, selectConfig);
|
|
22
|
+
return useMemo(()=>({
|
|
23
|
+
config,
|
|
24
|
+
setPageBackground: setGlobalPageBackground
|
|
25
|
+
}), [
|
|
26
|
+
config
|
|
27
|
+
]);
|
|
31
28
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Démarre l'hôte de rendu de l'arrière-plan global de page. À utiliser
|
|
3
|
+
* uniquement par le shell (une seule fois) ; les apps déclarent leur fond avec
|
|
4
|
+
* `<PageBackground>`.
|
|
5
|
+
*
|
|
6
|
+
* Tant qu'aucune page n'a déclaré de fond, rien n'est affiché (`fallback="none"`) :
|
|
7
|
+
* monter l'hôte ne change donc l'apparence d'aucune app existante.
|
|
8
|
+
*
|
|
9
|
+
* @param target Le conteneur qui héberge l'arrière-plan.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderPageBackground(target: HTMLElement | null): void;
|
|
12
|
+
//# sourceMappingURL=page-background.render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-background.render.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.render.tsx"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,QAK9D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** @module @category Page Background */ import React from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { GlobalPageBackground } from "./page-background.component.js";
|
|
5
|
+
/**
|
|
6
|
+
* Démarre l'hôte de rendu de l'arrière-plan global de page. À utiliser
|
|
7
|
+
* uniquement par le shell (une seule fois) ; les apps déclarent leur fond avec
|
|
8
|
+
* `<PageBackground>`.
|
|
9
|
+
*
|
|
10
|
+
* Tant qu'aucune page n'a déclaré de fond, rien n'est affiché (`fallback="none"`) :
|
|
11
|
+
* monter l'hôte ne change donc l'apparence d'aucune app existante.
|
|
12
|
+
*
|
|
13
|
+
* @param target Le conteneur qui héberge l'arrière-plan.
|
|
14
|
+
*/ export function renderPageBackground(target) {
|
|
15
|
+
if (target) {
|
|
16
|
+
const root = createRoot(target);
|
|
17
|
+
root.render(/*#__PURE__*/ _jsx(GlobalPageBackground, {
|
|
18
|
+
fallback: "none"
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PageBackgroundProps } from './page-background.component.js';
|
|
2
|
+
/**
|
|
3
|
+
* État global (unique pour toute l'application) de l'arrière-plan de page.
|
|
4
|
+
*
|
|
5
|
+
* Il passe par `@egen-civitas/esm-state` et non par un contexte React : chaque
|
|
6
|
+
* app micro-frontend est montée dans sa propre racine React, et un contexte ne
|
|
7
|
+
* traverserait pas ces racines. Le shell monte un unique `<GlobalPageBackground>`
|
|
8
|
+
* (voir `renderPageBackground`) qui lit cet état ; n'importe quelle app le
|
|
9
|
+
* renseigne avec `<PageBackground>`.
|
|
10
|
+
*
|
|
11
|
+
* `owner` identifie la page qui a déclaré le fond : un démontage tardif d'une
|
|
12
|
+
* ancienne page (ex. changement d'app) ne doit pas effacer le fond que la
|
|
13
|
+
* nouvelle page vient de déclarer.
|
|
14
|
+
*/
|
|
15
|
+
export interface PageBackgroundState {
|
|
16
|
+
config: PageBackgroundProps | null;
|
|
17
|
+
owner: object | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const pageBackgroundStore: import("zustand").StoreApi<PageBackgroundState>;
|
|
20
|
+
/** Déclare (ou met à jour) le fond de la page `owner`. */
|
|
21
|
+
export declare function claimPageBackground(owner: object, config: PageBackgroundProps): void;
|
|
22
|
+
/** Libère le fond de la page `owner` — sans effet si une autre page l'a repris entre-temps. */
|
|
23
|
+
export declare function releasePageBackground(owner: object): void;
|
|
24
|
+
/** Définit directement le fond global (sans propriétaire). Préférer `<PageBackground>`. */
|
|
25
|
+
export declare function setGlobalPageBackground(config: PageBackgroundProps | null): void;
|
|
26
|
+
//# sourceMappingURL=page-background.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-background.store.d.ts","sourceRoot":"","sources":["../../src/page-background/page-background.store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,iDAG9B,CAAC;AAEH,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,QAE7E;AAED,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,QAIlD;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,QAEzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getGlobalStore } from "@egen-civitas/esm-state";
|
|
2
|
+
export const pageBackgroundStore = getGlobalStore('pageBackground', {
|
|
3
|
+
config: null,
|
|
4
|
+
owner: null
|
|
5
|
+
});
|
|
6
|
+
/** Déclare (ou met à jour) le fond de la page `owner`. */ export function claimPageBackground(owner, config) {
|
|
7
|
+
pageBackgroundStore.setState({
|
|
8
|
+
config,
|
|
9
|
+
owner
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** Libère le fond de la page `owner` — sans effet si une autre page l'a repris entre-temps. */ export function releasePageBackground(owner) {
|
|
13
|
+
if (pageBackgroundStore.getState().owner === owner) {
|
|
14
|
+
pageBackgroundStore.setState({
|
|
15
|
+
config: null,
|
|
16
|
+
owner: null
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Définit directement le fond global (sans propriétaire). Préférer `<PageBackground>`. */ export function setGlobalPageBackground(config) {
|
|
21
|
+
pageBackgroundStore.setState({
|
|
22
|
+
config,
|
|
23
|
+
owner: null
|
|
24
|
+
});
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/esm-styleguide",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for Egen SPA",
|
|
6
6
|
"main": "dist/internal.js",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"@egen-civitas/esm-config": "^1.0.0",
|
|
98
98
|
"@egen-civitas/esm-data-api": "^1.0.2",
|
|
99
99
|
"@egen-civitas/esm-error-handling": "^1.0.0",
|
|
100
|
-
"@egen-civitas/esm-extensions": "^1.1.
|
|
100
|
+
"@egen-civitas/esm-extensions": "^1.1.1",
|
|
101
101
|
"@egen-civitas/esm-globals": "^1.0.0",
|
|
102
102
|
"@egen-civitas/esm-navigation": "^1.0.2",
|
|
103
|
-
"@egen-civitas/esm-react-utils": "^1.0.
|
|
103
|
+
"@egen-civitas/esm-react-utils": "^1.0.5",
|
|
104
104
|
"@egen-civitas/esm-routes": "^1.0.0",
|
|
105
105
|
"@egen-civitas/esm-state": "^1.0.0",
|
|
106
106
|
"@egen-civitas/esm-translations": "^1.0.0",
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
"@egen-civitas/esm-data-api": "^1.0.2",
|
|
121
121
|
"@egen-civitas/esm-error-handling": "^1.0.0",
|
|
122
122
|
"@egen-civitas/esm-expression-evaluator": "^1.0.0",
|
|
123
|
-
"@egen-civitas/esm-extensions": "^1.1.
|
|
123
|
+
"@egen-civitas/esm-extensions": "^1.1.1",
|
|
124
124
|
"@egen-civitas/esm-globals": "^1.0.0",
|
|
125
125
|
"@egen-civitas/esm-navigation": "^1.0.2",
|
|
126
|
-
"@egen-civitas/esm-react-utils": "^1.0.
|
|
126
|
+
"@egen-civitas/esm-react-utils": "^1.0.5",
|
|
127
127
|
"@egen-civitas/esm-routes": "^1.0.0",
|
|
128
128
|
"@egen-civitas/esm-state": "^1.0.0",
|
|
129
129
|
"@egen-civitas/esm-translations": "^1.0.0",
|