@egen-civitas/esm-styleguide 1.11.0 → 1.12.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 +17 -0
- package/dist/components/_general.scss +110 -8
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/public.d.ts +1 -0
- package/dist/public.d.ts.map +1 -1
- package/dist/public.js +1 -0
- package/dist/workbench/index.d.ts +9 -0
- package/dist/workbench/index.d.ts.map +1 -0
- package/dist/workbench/index.js +8 -0
- package/dist/workbench/splitter.component.d.ts +15 -0
- package/dist/workbench/splitter.component.d.ts.map +1 -0
- package/dist/workbench/splitter.component.js +75 -0
- package/dist/workbench/tool-window-rail.component.d.ts +9 -0
- package/dist/workbench/tool-window-rail.component.d.ts.map +1 -0
- package/dist/workbench/tool-window-rail.component.js +79 -0
- package/dist/workbench/tool-window-zone.component.d.ts +14 -0
- package/dist/workbench/tool-window-zone.component.d.ts.map +1 -0
- package/dist/workbench/tool-window-zone.component.js +90 -0
- package/dist/workbench/use-active-app-modules.d.ts +8 -0
- package/dist/workbench/use-active-app-modules.d.ts.map +1 -0
- package/dist/workbench/use-active-app-modules.js +30 -0
- package/dist/workbench/use-tool-windows.d.ts +17 -0
- package/dist/workbench/use-tool-windows.d.ts.map +1 -0
- package/dist/workbench/use-tool-windows.js +33 -0
- package/dist/workbench/workbench-icons.d.ts +8 -0
- package/dist/workbench/workbench-icons.d.ts.map +1 -0
- package/dist/workbench/workbench-icons.js +28 -0
- package/dist/workbench/workbench.module.scss +190 -0
- package/dist/workbench/workbench.render.d.ts +16 -0
- package/dist/workbench/workbench.render.d.ts.map +1 -0
- package/dist/workbench/workbench.render.js +24 -0
- package/dist/workbench/workbench.store.d.ts +37 -0
- package/dist/workbench/workbench.store.d.ts.map +1 -0
- package/dist/workbench/workbench.store.js +114 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @egen-civitas/esm-styleguide
|
|
2
2
|
|
|
3
|
+
## 1.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6ddbd06: Shell : plan de travail façon IntelliJ (rails fixes et zones redimensionnables).
|
|
8
|
+
|
|
9
|
+
- `esm-extensions` : contrat des fenêtres d'outils — slots `shell-rail-left-slot`, `shell-rail-bottom-slot` et `shell-rail-right-slot`, `ToolWindowMeta` (`title`, `titleKey`, `icon`, `order`) et `isToolWindowMeta`.
|
|
10
|
+
- `esm-styleguide` : composants `LeftRail`, `RightRail`, `ToolWindowZone` et `Splitter`, store `workbenchStore` (tailles et fenêtres actives mémorisées dans le navigateur), `renderWorkbench`, `useToolWindows`, `useActiveAppModules`. La grille du body passe à rail | zone gauche | centre | zone droite | rail | workspaces, avec une zone basse entre les rails ; la zone centrale devient une carte arrondie.
|
|
11
|
+
- `esm-app-shell` : nouveaux conteneurs `egen-rail-*-container` et `egen-zone-*-container`, montés au démarrage par `renderWorkbench`.
|
|
12
|
+
|
|
13
|
+
Le rail gauche (groupe haut → zone gauche, groupe bas → zone basse) n'affiche que les outils de l'app montée ; le rail droit est global. Rails et zones sont masqués sur les routes publiques, en dessous de 768 px et à l'impression.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [6ddbd06]
|
|
18
|
+
- @egen-civitas/esm-extensions@1.3.0
|
|
19
|
+
|
|
3
20
|
## 1.11.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -28,9 +28,25 @@ html[data-public-route='true'] {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
#egen-workspaces-container,
|
|
31
|
-
#egen-footer-app-container
|
|
31
|
+
#egen-footer-app-container,
|
|
32
|
+
#egen-rail-left-container,
|
|
33
|
+
#egen-rail-right-container,
|
|
34
|
+
#egen-zone-left-container,
|
|
35
|
+
#egen-zone-right-container,
|
|
36
|
+
#egen-zone-bottom-container {
|
|
32
37
|
display: none;
|
|
33
38
|
}
|
|
39
|
+
|
|
40
|
+
// Plus de rails ni de zones : le contenu occupe toute la largeur (cf. grille du body).
|
|
41
|
+
body {
|
|
42
|
+
grid-template-columns: 0 0 minmax(0, 1fr) 0 0 min-content;
|
|
43
|
+
grid-template-rows: auto minmax(0, 1fr) 0 var(--egen-footer-height, 0px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#egen-scroll-region {
|
|
47
|
+
margin: 0;
|
|
48
|
+
border-radius: 0;
|
|
49
|
+
}
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
.egen-app-error {
|
|
@@ -79,7 +95,52 @@ html[data-public-route='true'] {
|
|
|
79
95
|
overflow-y: auto;
|
|
80
96
|
overscroll-behavior: contain;
|
|
81
97
|
// La ligne de grille définit la hauteur : la région ne dépasse jamais.
|
|
82
|
-
height:
|
|
98
|
+
height: auto;
|
|
99
|
+
// Carte centrale du plan de travail : 2px de marge (4px avec la carte voisine) et coins
|
|
100
|
+
// arrondis ; le contenu est coupé net à ces bords. Les routes publiques la remettent plein cadre.
|
|
101
|
+
margin: 2px;
|
|
102
|
+
border-radius: 0.625rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ── Plan de travail : rails fixes + zones redimensionnables (façon IntelliJ) ──
|
|
106
|
+
// Chaque conteneur est une cellule de la grille du body ; la zone de scroll ci-dessus en est
|
|
107
|
+
// le centre. Les tailles des zones viennent de variables CSS publiées par le shell
|
|
108
|
+
// (--egen-zone-left-width, --egen-zone-right-width, --egen-zone-bottom-height : 0 quand la zone
|
|
109
|
+
// est repliée) ; les rails ont une largeur fixe.
|
|
110
|
+
:root {
|
|
111
|
+
--egen-rail-width: 2.5rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#egen-rail-left-container {
|
|
115
|
+
grid-area: railL;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
min-height: 0;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
#egen-rail-right-container {
|
|
122
|
+
grid-area: railR;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
min-height: 0;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#egen-zone-left-container {
|
|
129
|
+
grid-area: zoneL;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
min-height: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#egen-zone-right-container {
|
|
135
|
+
grid-area: zoneR;
|
|
136
|
+
min-width: 0;
|
|
137
|
+
min-height: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#egen-zone-bottom-container {
|
|
141
|
+
grid-area: zoneB;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
min-height: 0;
|
|
83
144
|
}
|
|
84
145
|
|
|
85
146
|
#egen-apps-container {
|
|
@@ -150,12 +211,27 @@ body {
|
|
|
150
211
|
// la TopBar et se termine au bord haut du footer, et son contenu y est coupé.
|
|
151
212
|
// NB : on n'utilise PAS padding-bottom sur le body : des resets globaux
|
|
152
213
|
// chargés plus tard (`html, body { padding: 0 }`) l'écrasent.
|
|
214
|
+
//
|
|
215
|
+
// Plan de travail : colonnes = rail gauche | zone gauche | centre | zone droite | rail droit |
|
|
216
|
+
// workspaces ; lignes = TopBar | corps | zone basse | footer. Les rails couvrent corps + zone
|
|
217
|
+
// basse ; la zone basse s'étend entre les deux rails.
|
|
153
218
|
grid-template-areas:
|
|
154
|
-
'topNav topNav'
|
|
155
|
-
'appRoots workspace'
|
|
156
|
-
'
|
|
157
|
-
|
|
158
|
-
grid-template-
|
|
219
|
+
'topNav topNav topNav topNav topNav topNav'
|
|
220
|
+
'railL zoneL appRoots zoneR railR workspace'
|
|
221
|
+
'railL zoneB zoneB zoneB railR workspace'
|
|
222
|
+
'footerGap footerGap footerGap footerGap footerGap footerGap';
|
|
223
|
+
grid-template-columns:
|
|
224
|
+
var(--egen-rail-width, 2.5rem)
|
|
225
|
+
var(--egen-zone-left-width, 0px)
|
|
226
|
+
minmax(0, 1fr)
|
|
227
|
+
var(--egen-zone-right-width, 0px)
|
|
228
|
+
var(--egen-rail-width, 2.5rem)
|
|
229
|
+
min-content;
|
|
230
|
+
grid-template-rows:
|
|
231
|
+
auto
|
|
232
|
+
minmax(0, 1fr)
|
|
233
|
+
var(--egen-zone-bottom-height, 0px)
|
|
234
|
+
var(--egen-footer-height, 0px);
|
|
159
235
|
box-sizing: border-box;
|
|
160
236
|
height: 100vh;
|
|
161
237
|
height: 100dvh;
|
|
@@ -163,6 +239,27 @@ body {
|
|
|
163
239
|
container-type: inline-size;
|
|
164
240
|
}
|
|
165
241
|
|
|
242
|
+
// Petits écrans : pas de place pour des rails et des zones, le contenu prend toute la largeur.
|
|
243
|
+
@media (max-width: 767px) {
|
|
244
|
+
#egen-rail-left-container,
|
|
245
|
+
#egen-rail-right-container,
|
|
246
|
+
#egen-zone-left-container,
|
|
247
|
+
#egen-zone-right-container,
|
|
248
|
+
#egen-zone-bottom-container {
|
|
249
|
+
display: none;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
body {
|
|
253
|
+
grid-template-columns: 0 0 minmax(0, 1fr) 0 0 min-content;
|
|
254
|
+
grid-template-rows: auto minmax(0, 1fr) 0 var(--egen-footer-height, 0px);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
#egen-scroll-region {
|
|
258
|
+
margin: 0;
|
|
259
|
+
border-radius: 0;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
166
263
|
@media print {
|
|
167
264
|
html,
|
|
168
265
|
body {
|
|
@@ -174,7 +271,12 @@ body {
|
|
|
174
271
|
|
|
175
272
|
#egen-workspaces-container,
|
|
176
273
|
#egen-top-nav-app-container,
|
|
177
|
-
#egen-footer-app-container
|
|
274
|
+
#egen-footer-app-container,
|
|
275
|
+
#egen-rail-left-container,
|
|
276
|
+
#egen-rail-right-container,
|
|
277
|
+
#egen-zone-left-container,
|
|
278
|
+
#egen-zone-right-container,
|
|
279
|
+
#egen-zone-bottom-container {
|
|
178
280
|
display: none;
|
|
179
281
|
}
|
|
180
282
|
|
package/dist/internal.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export * from './sheet/index.js';
|
|
|
38
38
|
export * from './glass-card/index.js';
|
|
39
39
|
export * from './containers/index.js';
|
|
40
40
|
export * from './master-detail/index.js';
|
|
41
|
+
export * from './workbench/index.js';
|
|
41
42
|
export * from './dialogs/index.js';
|
|
42
43
|
export * from './selections/index.js';
|
|
43
44
|
export * from './carousel/index.js';
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sDAAsD,CAAC;AACrE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uDAAuD,CAAC;AACtE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sDAAsD,CAAC;AACrE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AACnE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uDAAuD,CAAC;AACtE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./sheet/index.js";
|
|
|
38
38
|
export * from "./glass-card/index.js";
|
|
39
39
|
export * from "./containers/index.js";
|
|
40
40
|
export * from "./master-detail/index.js";
|
|
41
|
+
export * from "./workbench/index.js";
|
|
41
42
|
export * from "./dialogs/index.js";
|
|
42
43
|
export * from "./selections/index.js";
|
|
43
44
|
export * from "./carousel/index.js";
|
package/dist/public.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from './sheet/index.js';
|
|
|
33
33
|
export * from './glass-card/index.js';
|
|
34
34
|
export * from './containers/index.js';
|
|
35
35
|
export * from './master-detail/index.js';
|
|
36
|
+
export * from './workbench/index.js';
|
|
36
37
|
export * from './dialogs/index.js';
|
|
37
38
|
export * from './selections/index.js';
|
|
38
39
|
export * from './carousel/index.js';
|
package/dist/public.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,GAChC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACrH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,GAChC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACrH,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
package/dist/public.js
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./sheet/index.js";
|
|
|
30
30
|
export * from "./glass-card/index.js";
|
|
31
31
|
export * from "./containers/index.js";
|
|
32
32
|
export * from "./master-detail/index.js";
|
|
33
|
+
export * from "./workbench/index.js";
|
|
33
34
|
export * from "./dialogs/index.js";
|
|
34
35
|
export * from "./selections/index.js";
|
|
35
36
|
export * from "./carousel/index.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './use-active-app-modules.js';
|
|
2
|
+
export * from './use-tool-windows.js';
|
|
3
|
+
export * from './tool-window-rail.component.js';
|
|
4
|
+
export * from './tool-window-zone.component.js';
|
|
5
|
+
export * from './splitter.component.js';
|
|
6
|
+
export * from './workbench-icons.js';
|
|
7
|
+
export * from './workbench.render.js';
|
|
8
|
+
export * from './workbench.store.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workbench/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./use-active-app-modules.js";
|
|
2
|
+
export * from "./use-tool-windows.js";
|
|
3
|
+
export * from "./tool-window-rail.component.js";
|
|
4
|
+
export * from "./tool-window-zone.component.js";
|
|
5
|
+
export * from "./splitter.component.js";
|
|
6
|
+
export * from "./workbench-icons.js";
|
|
7
|
+
export * from "./workbench.render.js";
|
|
8
|
+
export * from "./workbench.store.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ToolWindowAnchor } from '@egen-civitas/esm-extensions';
|
|
3
|
+
interface SplitterProps {
|
|
4
|
+
anchor: ToolWindowAnchor;
|
|
5
|
+
/** Libellé accessible de la poignée. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Poignée de redimensionnement d'une zone : glisser à la souris/au doigt, flèches au clavier,
|
|
10
|
+
* double-clic pour revenir à la taille par défaut. La poignée est posée sur le bord de la zone
|
|
11
|
+
* tourné vers le contenu central ; la taille est calculée à partir du bord opposé, qui ne bouge pas.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Splitter({ anchor, label }: SplitterProps): React.JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=splitter.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.component.d.ts","sourceRoot":"","sources":["../../src/workbench/splitter.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAQrE,UAAU,aAAa;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,aAAa,qBAqExD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
|
+
import { useStore } from "@egen-civitas/esm-react-utils";
|
|
4
|
+
import { clampZoneSize, resetZoneSize, setZoneSize, workbenchStore } from "./workbench.store.js";
|
|
5
|
+
import styles from "./workbench.module.scss";
|
|
6
|
+
const KEYBOARD_STEP = 16;
|
|
7
|
+
const RESIZING_ATTRIBUTE = 'data-workbench-resizing';
|
|
8
|
+
/**
|
|
9
|
+
* Poignée de redimensionnement d'une zone : glisser à la souris/au doigt, flèches au clavier,
|
|
10
|
+
* double-clic pour revenir à la taille par défaut. La poignée est posée sur le bord de la zone
|
|
11
|
+
* tourné vers le contenu central ; la taille est calculée à partir du bord opposé, qui ne bouge pas.
|
|
12
|
+
*/ export function Splitter({ anchor, label }) {
|
|
13
|
+
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
14
|
+
const { sizes } = useStore(workbenchStore);
|
|
15
|
+
const size = sizes[anchor];
|
|
16
|
+
const dragging = useRef(null);
|
|
17
|
+
const vertical = anchor !== 'bottom'; // poignée verticale (redimensionne la largeur)
|
|
18
|
+
const sizeFromPointer = (clientX, clientY, edge)=>{
|
|
19
|
+
if (anchor === 'left') return clientX - edge;
|
|
20
|
+
if (anchor === 'right') return edge - clientX;
|
|
21
|
+
return edge - clientY;
|
|
22
|
+
};
|
|
23
|
+
const onPointerDown = (event)=>{
|
|
24
|
+
if (event.button !== 0) return;
|
|
25
|
+
const cell = event.currentTarget.parentElement?.parentElement ?? event.currentTarget.parentElement;
|
|
26
|
+
if (!cell) return;
|
|
27
|
+
const rect = cell.getBoundingClientRect();
|
|
28
|
+
// Bord fixe de la zone : gauche pour `left`, droite pour `right`, bas pour `bottom`.
|
|
29
|
+
const edge = anchor === 'left' ? rect.left : anchor === 'right' ? rect.right : rect.bottom;
|
|
30
|
+
dragging.current = {
|
|
31
|
+
edge
|
|
32
|
+
};
|
|
33
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
34
|
+
document.documentElement.setAttribute(RESIZING_ATTRIBUTE, anchor);
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
};
|
|
37
|
+
const onPointerMove = (event)=>{
|
|
38
|
+
if (!dragging.current) return;
|
|
39
|
+
setZoneSize(anchor, sizeFromPointer(event.clientX, event.clientY, dragging.current.edge));
|
|
40
|
+
};
|
|
41
|
+
const stopDragging = (event)=>{
|
|
42
|
+
if (!dragging.current) return;
|
|
43
|
+
dragging.current = null;
|
|
44
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
45
|
+
document.documentElement.removeAttribute(RESIZING_ATTRIBUTE);
|
|
46
|
+
};
|
|
47
|
+
const onKeyDown = (event)=>{
|
|
48
|
+
// Le sens « agrandir » dépend du bord : une zone gauche grandit vers la droite, etc.
|
|
49
|
+
const grow = anchor === 'left' ? 'ArrowRight' : anchor === 'right' ? 'ArrowLeft' : 'ArrowUp';
|
|
50
|
+
const shrink = anchor === 'left' ? 'ArrowLeft' : anchor === 'right' ? 'ArrowRight' : 'ArrowDown';
|
|
51
|
+
if (event.key === grow) setZoneSize(anchor, workbenchStore.getState().sizes[anchor] + KEYBOARD_STEP);
|
|
52
|
+
else if (event.key === shrink) setZoneSize(anchor, workbenchStore.getState().sizes[anchor] - KEYBOARD_STEP);
|
|
53
|
+
else if (event.key === 'Home') setZoneSize(anchor, 0);
|
|
54
|
+
else if (event.key === 'End') setZoneSize(anchor, Number.MAX_SAFE_INTEGER);
|
|
55
|
+
else return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
59
|
+
role: "separator",
|
|
60
|
+
tabIndex: 0,
|
|
61
|
+
"aria-label": label,
|
|
62
|
+
"aria-orientation": vertical ? 'vertical' : 'horizontal',
|
|
63
|
+
"aria-valuenow": size,
|
|
64
|
+
"aria-valuemin": clampZoneSize(anchor, 0),
|
|
65
|
+
"aria-valuemax": clampZoneSize(anchor, Number.MAX_SAFE_INTEGER),
|
|
66
|
+
"data-anchor": anchor,
|
|
67
|
+
className: `${styles.splitter} ${styles[`splitter-${anchor}`]}`,
|
|
68
|
+
onPointerDown: onPointerDown,
|
|
69
|
+
onPointerMove: onPointerMove,
|
|
70
|
+
onPointerUp: stopDragging,
|
|
71
|
+
onPointerCancel: stopDragging,
|
|
72
|
+
onDoubleClick: ()=>resetZoneSize(anchor),
|
|
73
|
+
onKeyDown: onKeyDown
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Rail gauche (fixe) : en haut, les fenêtres d'outils de l'app active affichées dans la zone
|
|
4
|
+
* gauche ; en bas, celles affichées dans la zone basse (ex. terminal).
|
|
5
|
+
*/
|
|
6
|
+
export declare function LeftRail(): React.JSX.Element;
|
|
7
|
+
/** Rail droit (fixe) : options globales, affichées dans la zone droite. */
|
|
8
|
+
export declare function RightRail(): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=tool-window-rail.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-window-rail.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-rail.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiD1B;;;GAGG;AACH,wBAAgB,QAAQ,sBAQvB;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,sBAMxB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useStore } from "@egen-civitas/esm-react-utils";
|
|
4
|
+
import { resolveWorkbenchIcon } from "./workbench-icons.js";
|
|
5
|
+
import { toolWindowTitle, useToolWindows } from "./use-tool-windows.js";
|
|
6
|
+
import { toggleToolWindow, workbenchStore } from "./workbench.store.js";
|
|
7
|
+
import styles from "./workbench.module.scss";
|
|
8
|
+
function RailGroup({ anchor, label }) {
|
|
9
|
+
const tools = useToolWindows(anchor);
|
|
10
|
+
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
11
|
+
const { active } = useStore(workbenchStore);
|
|
12
|
+
const activeId = active[anchor];
|
|
13
|
+
if (tools.length === 0) return null;
|
|
14
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
15
|
+
role: "group",
|
|
16
|
+
"aria-label": label,
|
|
17
|
+
"data-anchor": anchor,
|
|
18
|
+
className: styles.railGroup,
|
|
19
|
+
children: tools.map((tool)=>/*#__PURE__*/ _jsx(RailButton, {
|
|
20
|
+
tool: tool,
|
|
21
|
+
active: tool.id === activeId,
|
|
22
|
+
onClick: ()=>toggleToolWindow(anchor, tool.id)
|
|
23
|
+
}, tool.id))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function RailButton({ tool, active, onClick }) {
|
|
27
|
+
const title = toolWindowTitle(tool);
|
|
28
|
+
const Icon = resolveWorkbenchIcon(tool.meta.icon);
|
|
29
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
className: styles.railButton,
|
|
32
|
+
"aria-pressed": active,
|
|
33
|
+
"aria-label": title,
|
|
34
|
+
title: title,
|
|
35
|
+
"data-active": active,
|
|
36
|
+
onClick: onClick,
|
|
37
|
+
children: Icon ? /*#__PURE__*/ _jsx(Icon, {
|
|
38
|
+
size: 18,
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
}) : /*#__PURE__*/ _jsx("span", {
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: title.charAt(0).toUpperCase()
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Rail gauche (fixe) : en haut, les fenêtres d'outils de l'app active affichées dans la zone
|
|
48
|
+
* gauche ; en bas, celles affichées dans la zone basse (ex. terminal).
|
|
49
|
+
*/ export function LeftRail() {
|
|
50
|
+
return /*#__PURE__*/ _jsxs("nav", {
|
|
51
|
+
"aria-label": "Outils de l'application",
|
|
52
|
+
"data-testid": "workbench-rail-left",
|
|
53
|
+
className: styles.rail,
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ _jsx(RailGroup, {
|
|
56
|
+
anchor: "left",
|
|
57
|
+
label: "Panneau latéral"
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ _jsx("span", {
|
|
60
|
+
className: styles.railSpacer
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsx(RailGroup, {
|
|
63
|
+
anchor: "bottom",
|
|
64
|
+
label: "Panneau inférieur"
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Rail droit (fixe) : options globales, affichées dans la zone droite. */ export function RightRail() {
|
|
70
|
+
return /*#__PURE__*/ _jsx("nav", {
|
|
71
|
+
"aria-label": "Outils globaux",
|
|
72
|
+
"data-testid": "workbench-rail-right",
|
|
73
|
+
className: styles.rail,
|
|
74
|
+
children: /*#__PURE__*/ _jsx(RailGroup, {
|
|
75
|
+
anchor: "right",
|
|
76
|
+
label: "Panneau droit"
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ToolWindowAnchor } from '@egen-civitas/esm-extensions';
|
|
3
|
+
interface ToolWindowZoneProps {
|
|
4
|
+
anchor: ToolWindowAnchor;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Zone redimensionnable (gauche, droite ou bas) : affiche le contenu de la fenêtre d'outils
|
|
8
|
+
* active du rail correspondant, sous un en-tête (titre + fermeture). Repliée (taille 0) tant
|
|
9
|
+
* qu'aucune fenêtre d'outils valide n'est active : une fenêtre dont l'app n'est plus montée
|
|
10
|
+
* replie donc la zone toute seule.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ToolWindowZone({ anchor }: ToolWindowZoneProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=tool-window-zone.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-window-zone.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-zone.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAC;AACtD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAexF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,qBA2D7D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useEffect } from "react";
|
|
3
|
+
import { TOOL_WINDOW_SLOTS } from "@egen-civitas/esm-extensions";
|
|
4
|
+
import { ExtensionSlot, useStore } from "@egen-civitas/esm-react-utils";
|
|
5
|
+
import { X } from "lucide-react";
|
|
6
|
+
import { Splitter } from "./splitter.component.js";
|
|
7
|
+
import { toolWindowTitle, useToolWindows } from "./use-tool-windows.js";
|
|
8
|
+
import { closeToolWindow, workbenchStore } from "./workbench.store.js";
|
|
9
|
+
import styles from "./workbench.module.scss";
|
|
10
|
+
/** Variable CSS lue par la grille du body (`_general.scss`) pour dimensionner chaque zone. */ const ZONE_SIZE_VARIABLES = {
|
|
11
|
+
left: '--egen-zone-left-width',
|
|
12
|
+
right: '--egen-zone-right-width',
|
|
13
|
+
bottom: '--egen-zone-bottom-height'
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Zone redimensionnable (gauche, droite ou bas) : affiche le contenu de la fenêtre d'outils
|
|
17
|
+
* active du rail correspondant, sous un en-tête (titre + fermeture). Repliée (taille 0) tant
|
|
18
|
+
* qu'aucune fenêtre d'outils valide n'est active : une fenêtre dont l'app n'est plus montée
|
|
19
|
+
* replie donc la zone toute seule.
|
|
20
|
+
*/ export function ToolWindowZone({ anchor }) {
|
|
21
|
+
const tools = useToolWindows(anchor);
|
|
22
|
+
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
23
|
+
const { active, sizes } = useStore(workbenchStore);
|
|
24
|
+
const activeId = active[anchor];
|
|
25
|
+
const size = sizes[anchor];
|
|
26
|
+
const current = tools.find((tool)=>tool.id === activeId);
|
|
27
|
+
const open = Boolean(current);
|
|
28
|
+
// Publie la taille de la zone pour la grille du body ; 0 quand elle est repliée.
|
|
29
|
+
useEffect(()=>{
|
|
30
|
+
document.documentElement.style.setProperty(ZONE_SIZE_VARIABLES[anchor], open ? `${size}px` : '0px');
|
|
31
|
+
}, [
|
|
32
|
+
anchor,
|
|
33
|
+
open,
|
|
34
|
+
size
|
|
35
|
+
]);
|
|
36
|
+
useEffect(()=>()=>{
|
|
37
|
+
document.documentElement.style.removeProperty(ZONE_SIZE_VARIABLES[anchor]);
|
|
38
|
+
}, [
|
|
39
|
+
anchor
|
|
40
|
+
]);
|
|
41
|
+
// Seule la fenêtre active est rendue (et donc chargée) dans la zone.
|
|
42
|
+
const selectActive = useCallback((extensions)=>extensions.filter((extension)=>extension.name === activeId), [
|
|
43
|
+
activeId
|
|
44
|
+
]);
|
|
45
|
+
const title = current ? toolWindowTitle(current) : '';
|
|
46
|
+
return /*#__PURE__*/ _jsx("aside", {
|
|
47
|
+
"data-testid": `workbench-zone-${anchor}`,
|
|
48
|
+
"data-anchor": anchor,
|
|
49
|
+
"data-open": open,
|
|
50
|
+
"aria-label": title || undefined,
|
|
51
|
+
hidden: !open,
|
|
52
|
+
className: `${styles.zone} ${styles[`zone-${anchor}`]}`,
|
|
53
|
+
children: open && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
56
|
+
className: styles.zoneHeader,
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
59
|
+
className: styles.zoneTitle,
|
|
60
|
+
children: title
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsx("button", {
|
|
63
|
+
type: "button",
|
|
64
|
+
className: styles.zoneClose,
|
|
65
|
+
"aria-label": `Fermer ${title}`,
|
|
66
|
+
title: `Fermer ${title}`,
|
|
67
|
+
onClick: ()=>closeToolWindow(anchor),
|
|
68
|
+
children: /*#__PURE__*/ _jsx(X, {
|
|
69
|
+
size: 14,
|
|
70
|
+
"aria-hidden": "true"
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ _jsx("div", {
|
|
76
|
+
className: styles.zoneBody,
|
|
77
|
+
children: /*#__PURE__*/ _jsx(ExtensionSlot, {
|
|
78
|
+
name: TOOL_WINDOW_SLOTS[anchor],
|
|
79
|
+
select: selectActive,
|
|
80
|
+
className: styles.zoneSlot
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx(Splitter, {
|
|
84
|
+
anchor: anchor,
|
|
85
|
+
label: `Redimensionner ${title}`
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Noms des modules (apps) dont au moins une page est actuellement montée. */
|
|
2
|
+
export declare function getActiveModuleNames(): ReadonlySet<string>;
|
|
3
|
+
/**
|
|
4
|
+
* Modules (apps) actifs, réévalués à chaque changement de route (`single-spa:routing-event`).
|
|
5
|
+
* La référence retournée reste stable tant que l'ensemble ne change pas.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useActiveAppModules(): ReadonlySet<string>;
|
|
8
|
+
//# sourceMappingURL=use-active-app-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-active-app-modules.d.ts","sourceRoot":"","sources":["../../src/workbench/use-active-app-modules.ts"],"names":[],"mappings":"AASA,8EAA8E;AAC9E,wBAAgB,oBAAoB,IAAI,WAAW,CAAC,MAAM,CAAC,CAE1D;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,CAAC,MAAM,CAAC,CAezD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { getMountedApps } from "single-spa";
|
|
3
|
+
/**
|
|
4
|
+
* Les pages d'une app sont enregistrées dans single-spa sous `<module>-page-<index>`
|
|
5
|
+
* (voir `esm-routes`). On retrouve donc le nom du module en retirant ce suffixe.
|
|
6
|
+
*/ const PAGE_SUFFIX = /-page-\d+$/;
|
|
7
|
+
/** Noms des modules (apps) dont au moins une page est actuellement montée. */ export function getActiveModuleNames() {
|
|
8
|
+
return new Set(getMountedApps().map((name)=>name.replace(PAGE_SUFFIX, '')));
|
|
9
|
+
}
|
|
10
|
+
function sameSet(a, b) {
|
|
11
|
+
return a.size === b.size && [
|
|
12
|
+
...a
|
|
13
|
+
].every((name)=>b.has(name));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Modules (apps) actifs, réévalués à chaque changement de route (`single-spa:routing-event`).
|
|
17
|
+
* La référence retournée reste stable tant que l'ensemble ne change pas.
|
|
18
|
+
*/ export function useActiveAppModules() {
|
|
19
|
+
const [modules, setModules] = useState(getActiveModuleNames);
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
const update = ()=>setModules((previous)=>{
|
|
22
|
+
const next = getActiveModuleNames();
|
|
23
|
+
return sameSet(previous, next) ? previous : next;
|
|
24
|
+
});
|
|
25
|
+
window.addEventListener('single-spa:routing-event', update);
|
|
26
|
+
update();
|
|
27
|
+
return ()=>window.removeEventListener('single-spa:routing-event', update);
|
|
28
|
+
}, []);
|
|
29
|
+
return modules;
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ToolWindowAnchor, type ToolWindowMeta } from '@egen-civitas/esm-extensions';
|
|
2
|
+
export interface ToolWindow {
|
|
3
|
+
/** Nom de l'extension : identifiant de la fenêtre d'outils dans sa zone. */
|
|
4
|
+
id: string;
|
|
5
|
+
moduleName: string;
|
|
6
|
+
meta: ToolWindowMeta;
|
|
7
|
+
}
|
|
8
|
+
/** Titre affiché (traduit si `titleKey` a une traduction dans le module de l'app). */
|
|
9
|
+
export declare function toolWindowTitle({ moduleName, meta }: ToolWindow): string;
|
|
10
|
+
/**
|
|
11
|
+
* Fenêtres d'outils d'une zone, triées par `meta.order` (puis ordre du slot).
|
|
12
|
+
*
|
|
13
|
+
* Zones `left` et `bottom` : uniquement celles de l'app active (le rail change avec l'app).
|
|
14
|
+
* Zone `right` : globale, toujours toutes les extensions déclarées.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useToolWindows(anchor: ToolWindowAnchor): ToolWindow[];
|
|
17
|
+
//# sourceMappingURL=use-tool-windows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tool-windows.d.ts","sourceRoot":"","sources":["../../src/workbench/use-tool-windows.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAKtC,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,UAAU,GAAG,MAAM,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,EAAE,CAsBrE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { isToolWindowMeta, TOOL_WINDOW_SLOTS } from "@egen-civitas/esm-extensions";
|
|
3
|
+
import { useAssignedExtensions } from "@egen-civitas/esm-react-utils";
|
|
4
|
+
import { translateFrom } from "@egen-civitas/esm-translations";
|
|
5
|
+
import { useActiveAppModules } from "./use-active-app-modules.js";
|
|
6
|
+
/** Titre affiché (traduit si `titleKey` a une traduction dans le module de l'app). */ export function toolWindowTitle({ moduleName, meta }) {
|
|
7
|
+
return meta.titleKey ? translateFrom(moduleName, meta.titleKey, meta.title) : meta.title;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fenêtres d'outils d'une zone, triées par `meta.order` (puis ordre du slot).
|
|
11
|
+
*
|
|
12
|
+
* Zones `left` et `bottom` : uniquement celles de l'app active (le rail change avec l'app).
|
|
13
|
+
* Zone `right` : globale, toujours toutes les extensions déclarées.
|
|
14
|
+
*/ export function useToolWindows(anchor) {
|
|
15
|
+
const assigned = useAssignedExtensions(TOOL_WINDOW_SLOTS[anchor]);
|
|
16
|
+
const activeModules = useActiveAppModules();
|
|
17
|
+
return useMemo(()=>assigned.map((extension, index)=>({
|
|
18
|
+
extension,
|
|
19
|
+
index
|
|
20
|
+
})).filter(({ extension })=>isToolWindowMeta(extension.meta)).filter(({ extension })=>anchor === 'right' || activeModules.has(extension.moduleName)).sort((a, b)=>{
|
|
21
|
+
const orderA = a.extension.meta.order ?? a.index;
|
|
22
|
+
const orderB = b.extension.meta.order ?? b.index;
|
|
23
|
+
return orderA - orderB || a.index - b.index;
|
|
24
|
+
}).map(({ extension })=>({
|
|
25
|
+
id: extension.name,
|
|
26
|
+
moduleName: extension.moduleName,
|
|
27
|
+
meta: extension.meta
|
|
28
|
+
})), [
|
|
29
|
+
assigned,
|
|
30
|
+
activeModules,
|
|
31
|
+
anchor
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
/**
|
|
3
|
+
* Icônes autorisées pour `ToolWindowMeta.icon` (liste blanche : une app ne peut pas faire
|
|
4
|
+
* charger au shell une icône arbitraire). Un nom inconnu affiche l'initiale du titre.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WORKBENCH_ICONS: Readonly<Record<string, LucideIcon>>;
|
|
7
|
+
export declare function resolveWorkbenchIcon(name?: string): LucideIcon | undefined;
|
|
8
|
+
//# sourceMappingURL=workbench-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbench-icons.d.ts","sourceRoot":"","sources":["../../src/workbench/workbench-icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAoBL,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAoBhE,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE1E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BookOpen, Bell, Bot, Building2, CalendarDays, CircleHelp, Folder, FolderTree, House, Info, LayoutGrid, ListTree, MapPin, Megaphone, Newspaper, Search, Settings, Terminal, Users } from "lucide-react";
|
|
2
|
+
/**
|
|
3
|
+
* Icônes autorisées pour `ToolWindowMeta.icon` (liste blanche : une app ne peut pas faire
|
|
4
|
+
* charger au shell une icône arbitraire). Un nom inconnu affiche l'initiale du titre.
|
|
5
|
+
*/ export const WORKBENCH_ICONS = {
|
|
6
|
+
BookOpen,
|
|
7
|
+
Bell,
|
|
8
|
+
Bot,
|
|
9
|
+
Building2,
|
|
10
|
+
CalendarDays,
|
|
11
|
+
CircleHelp,
|
|
12
|
+
Folder,
|
|
13
|
+
FolderTree,
|
|
14
|
+
House,
|
|
15
|
+
Info,
|
|
16
|
+
LayoutGrid,
|
|
17
|
+
ListTree,
|
|
18
|
+
MapPin,
|
|
19
|
+
Megaphone,
|
|
20
|
+
Newspaper,
|
|
21
|
+
Search,
|
|
22
|
+
Settings,
|
|
23
|
+
Terminal,
|
|
24
|
+
Users
|
|
25
|
+
};
|
|
26
|
+
export function resolveWorkbenchIcon(name) {
|
|
27
|
+
return name ? WORKBENCH_ICONS[name] : undefined;
|
|
28
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Plan de travail du shell : rails fixes + zones redimensionnables (façon IntelliJ).
|
|
2
|
+
// Le placement dans la grille du body (colonnes/lignes, tailles) est dans
|
|
3
|
+
// components/_general.scss ; ici : l'apparence des rails, des zones et des poignées.
|
|
4
|
+
|
|
5
|
+
$radius: 0.625rem;
|
|
6
|
+
$handle: 0.375rem;
|
|
7
|
+
|
|
8
|
+
// ── Rails ───────────────────────────────────────────────────────────────────
|
|
9
|
+
.rail {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
padding: 0.5rem 0;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
scrollbar-width: none;
|
|
20
|
+
background: var(--colors-surface-translucent, rgb(0 0 0 / 20%));
|
|
21
|
+
backdrop-filter: blur(12px);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.railGroup {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 0.25rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.railSpacer {
|
|
32
|
+
flex: 1 1 auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.railButton {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
flex: 0 0 auto;
|
|
40
|
+
width: 2rem;
|
|
41
|
+
height: 2rem;
|
|
42
|
+
padding: 0;
|
|
43
|
+
border: 0;
|
|
44
|
+
border-radius: 0.5rem;
|
|
45
|
+
background: transparent;
|
|
46
|
+
color: var(--colors-surface-muted-foreground, #9ca3af);
|
|
47
|
+
font: inherit;
|
|
48
|
+
font-size: 0.75rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition:
|
|
52
|
+
background-color 120ms ease,
|
|
53
|
+
color 120ms ease;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 10%));
|
|
57
|
+
color: var(--colors-surface-foreground, #fff);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:focus-visible {
|
|
61
|
+
outline: 2px solid var(--colors-border-ring, var(--colors-primary-500, #3b82f6));
|
|
62
|
+
outline-offset: 1px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-active='true'] {
|
|
66
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 14%));
|
|
67
|
+
color: var(--colors-surface-foreground, #fff);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── Zones ───────────────────────────────────────────────────────────────────
|
|
72
|
+
.zone {
|
|
73
|
+
position: relative;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
// Les marges (2px) s'additionnent à celles des voisins : 4px entre deux cartes.
|
|
78
|
+
margin: 2px;
|
|
79
|
+
height: calc(100% - 4px);
|
|
80
|
+
min-width: 0;
|
|
81
|
+
min-height: 0;
|
|
82
|
+
border: 1px solid var(--colors-border-default, rgb(255 255 255 / 8%));
|
|
83
|
+
border-radius: $radius;
|
|
84
|
+
background: var(--colors-surface-card, rgb(20 22 26 / 72%));
|
|
85
|
+
backdrop-filter: blur(12px);
|
|
86
|
+
color: var(--colors-surface-foreground, #fff);
|
|
87
|
+
|
|
88
|
+
&[hidden] {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.zoneHeader {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
gap: 0.5rem;
|
|
98
|
+
flex: 0 0 auto;
|
|
99
|
+
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.zoneTitle {
|
|
103
|
+
margin: 0;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
font-size: 0.8125rem;
|
|
106
|
+
font-weight: 600;
|
|
107
|
+
line-height: 1.25rem;
|
|
108
|
+
text-overflow: ellipsis;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.zoneClose {
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
width: 1.5rem;
|
|
117
|
+
height: 1.5rem;
|
|
118
|
+
padding: 0;
|
|
119
|
+
border: 0;
|
|
120
|
+
border-radius: 0.375rem;
|
|
121
|
+
background: transparent;
|
|
122
|
+
color: var(--colors-surface-muted-foreground, #9ca3af);
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 10%));
|
|
127
|
+
color: var(--colors-surface-foreground, #fff);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:focus-visible {
|
|
131
|
+
outline: 2px solid var(--colors-border-ring, var(--colors-primary-500, #3b82f6));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.zoneBody {
|
|
136
|
+
flex: 1 1 auto;
|
|
137
|
+
min-height: 0;
|
|
138
|
+
overflow: auto;
|
|
139
|
+
border-bottom-left-radius: $radius;
|
|
140
|
+
border-bottom-right-radius: $radius;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.zoneSlot {
|
|
144
|
+
min-height: 100%;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// La zone basse prend toute la largeur entre les rails : sa hauteur vient de la ligne de grille.
|
|
148
|
+
.zone-bottom {
|
|
149
|
+
height: calc(100% - 4px);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// ── Poignées de redimensionnement ───────────────────────────────────────────
|
|
153
|
+
// Posées dans l'interstice entre la zone et le contenu central (marges de 2px + bord).
|
|
154
|
+
.splitter {
|
|
155
|
+
position: absolute;
|
|
156
|
+
z-index: 2;
|
|
157
|
+
background: transparent;
|
|
158
|
+
touch-action: none;
|
|
159
|
+
transition: background-color 120ms ease;
|
|
160
|
+
|
|
161
|
+
&:hover,
|
|
162
|
+
&:focus-visible {
|
|
163
|
+
background: var(--colors-primary-500, #3b82f6);
|
|
164
|
+
outline: none;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.splitter-left {
|
|
169
|
+
top: 0;
|
|
170
|
+
bottom: 0;
|
|
171
|
+
right: -$handle;
|
|
172
|
+
width: $handle;
|
|
173
|
+
cursor: col-resize;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.splitter-right {
|
|
177
|
+
top: 0;
|
|
178
|
+
bottom: 0;
|
|
179
|
+
left: -$handle;
|
|
180
|
+
width: $handle;
|
|
181
|
+
cursor: col-resize;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.splitter-bottom {
|
|
185
|
+
left: 0;
|
|
186
|
+
right: 0;
|
|
187
|
+
top: -$handle;
|
|
188
|
+
height: $handle;
|
|
189
|
+
cursor: row-resize;
|
|
190
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WorkbenchTargets {
|
|
2
|
+
railLeft: HTMLElement | null;
|
|
3
|
+
railRight: HTMLElement | null;
|
|
4
|
+
zoneLeft: HTMLElement | null;
|
|
5
|
+
zoneRight: HTMLElement | null;
|
|
6
|
+
zoneBottom: HTMLElement | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Monte le plan de travail du shell : rails gauche/droit fixes et zones gauche, droite, bas
|
|
10
|
+
* redimensionnables. À utiliser uniquement par le shell, une seule fois ; les apps y déclarent
|
|
11
|
+
* leurs fenêtres d'outils par extensions (voir `ToolWindowMeta`).
|
|
12
|
+
*
|
|
13
|
+
* Tant qu'aucune extension n'est déclarée, les rails sont vides et les zones repliées.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderWorkbench({ railLeft, railRight, zoneLeft, zoneRight, zoneBottom }: WorkbenchTargets): void;
|
|
16
|
+
//# sourceMappingURL=workbench.render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbench.render.d.ts","sourceRoot":"","sources":["../../src/workbench/workbench.render.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,gBAAgB,QAMzG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** @module @category Workbench */ import React from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { LeftRail, RightRail } from "./tool-window-rail.component.js";
|
|
5
|
+
import { ToolWindowZone } from "./tool-window-zone.component.js";
|
|
6
|
+
/**
|
|
7
|
+
* Monte le plan de travail du shell : rails gauche/droit fixes et zones gauche, droite, bas
|
|
8
|
+
* redimensionnables. À utiliser uniquement par le shell, une seule fois ; les apps y déclarent
|
|
9
|
+
* leurs fenêtres d'outils par extensions (voir `ToolWindowMeta`).
|
|
10
|
+
*
|
|
11
|
+
* Tant qu'aucune extension n'est déclarée, les rails sont vides et les zones repliées.
|
|
12
|
+
*/ export function renderWorkbench({ railLeft, railRight, zoneLeft, zoneRight, zoneBottom }) {
|
|
13
|
+
if (railLeft) createRoot(railLeft).render(/*#__PURE__*/ _jsx(LeftRail, {}));
|
|
14
|
+
if (railRight) createRoot(railRight).render(/*#__PURE__*/ _jsx(RightRail, {}));
|
|
15
|
+
if (zoneLeft) createRoot(zoneLeft).render(/*#__PURE__*/ _jsx(ToolWindowZone, {
|
|
16
|
+
anchor: "left"
|
|
17
|
+
}));
|
|
18
|
+
if (zoneRight) createRoot(zoneRight).render(/*#__PURE__*/ _jsx(ToolWindowZone, {
|
|
19
|
+
anchor: "right"
|
|
20
|
+
}));
|
|
21
|
+
if (zoneBottom) createRoot(zoneBottom).render(/*#__PURE__*/ _jsx(ToolWindowZone, {
|
|
22
|
+
anchor: "bottom"
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ToolWindowAnchor } from '@egen-civitas/esm-extensions';
|
|
2
|
+
/**
|
|
3
|
+
* État global du plan de travail du shell (rails + zones façon IntelliJ).
|
|
4
|
+
*
|
|
5
|
+
* Il passe par `@egen-civitas/esm-state` et non par un contexte React : le shell et chaque
|
|
6
|
+
* app micro-frontend vivent dans des racines React distinctes. La taille des zones et la
|
|
7
|
+
* fenêtre d'outils active de chaque zone sont mémorisées dans le navigateur (localStorage),
|
|
8
|
+
* comme IntelliJ restaure sa disposition.
|
|
9
|
+
*/
|
|
10
|
+
export declare const WORKBENCH_STORAGE_KEY = "egen-workbench-layout";
|
|
11
|
+
export declare const ZONE_ANCHORS: readonly ToolWindowAnchor[];
|
|
12
|
+
/** Taille par défaut des zones, en pixels (largeur pour left/right, hauteur pour bottom). */
|
|
13
|
+
export declare const DEFAULT_ZONE_SIZES: Readonly<Record<ToolWindowAnchor, number>>;
|
|
14
|
+
export interface WorkbenchState {
|
|
15
|
+
/** Largeur (left/right) ou hauteur (bottom) de chaque zone, en pixels. */
|
|
16
|
+
sizes: Record<ToolWindowAnchor, number>;
|
|
17
|
+
/** Fenêtre d'outils (nom de l'extension) affichée dans chaque zone ; `null` : zone repliée. */
|
|
18
|
+
active: Record<ToolWindowAnchor, string | null>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Borne une taille de zone : minimum fixe, maximum = plafond fixe ET part de la fenêtre
|
|
22
|
+
* (50 % de la largeur, 70 % de la hauteur), pour que le contenu central reste toujours visible.
|
|
23
|
+
*/
|
|
24
|
+
export declare function clampZoneSize(anchor: ToolWindowAnchor, size: number, viewport?: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}): number;
|
|
28
|
+
export declare const workbenchStore: import("zustand").StoreApi<WorkbenchState>;
|
|
29
|
+
/** Ouvre la fenêtre d'outils `id` dans la zone `anchor` ; un second appel sur la même la referme. */
|
|
30
|
+
export declare function toggleToolWindow(anchor: ToolWindowAnchor, id: string): void;
|
|
31
|
+
/** Replie la zone `anchor`. */
|
|
32
|
+
export declare function closeToolWindow(anchor: ToolWindowAnchor): void;
|
|
33
|
+
/** Redimensionne la zone `anchor` (valeur bornée par `clampZoneSize`). */
|
|
34
|
+
export declare function setZoneSize(anchor: ToolWindowAnchor, size: number): void;
|
|
35
|
+
/** Rétablit la taille par défaut de la zone `anchor`. */
|
|
36
|
+
export declare function resetZoneSize(anchor: ToolWindowAnchor): void;
|
|
37
|
+
//# sourceMappingURL=workbench.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbench.store.d.ts","sourceRoot":"","sources":["../../src/workbench/workbench.store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,YAAY,EAAE,SAAS,gBAAgB,EAAgC,CAAC;AAErF,6FAA6F;AAC7F,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAA0C,CAAC;AAQrH,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACxC,+FAA+F;IAC/F,MAAM,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CACjD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAA6D,GACrG,MAAM,CAMR;AA2BD,eAAO,MAAM,cAAc,4CAAiE,CAAC;AAU7F,qGAAqG;AACrG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,QAGpE;AAED,+BAA+B;AAC/B,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,QAGvD;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,QAIjE;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,QAErD"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { getGlobalStore } from "@egen-civitas/esm-state";
|
|
2
|
+
/**
|
|
3
|
+
* État global du plan de travail du shell (rails + zones façon IntelliJ).
|
|
4
|
+
*
|
|
5
|
+
* Il passe par `@egen-civitas/esm-state` et non par un contexte React : le shell et chaque
|
|
6
|
+
* app micro-frontend vivent dans des racines React distinctes. La taille des zones et la
|
|
7
|
+
* fenêtre d'outils active de chaque zone sont mémorisées dans le navigateur (localStorage),
|
|
8
|
+
* comme IntelliJ restaure sa disposition.
|
|
9
|
+
*/ export const WORKBENCH_STORAGE_KEY = 'egen-workbench-layout';
|
|
10
|
+
export const ZONE_ANCHORS = [
|
|
11
|
+
'left',
|
|
12
|
+
'bottom',
|
|
13
|
+
'right'
|
|
14
|
+
];
|
|
15
|
+
/** Taille par défaut des zones, en pixels (largeur pour left/right, hauteur pour bottom). */ export const DEFAULT_ZONE_SIZES = {
|
|
16
|
+
left: 280,
|
|
17
|
+
right: 320,
|
|
18
|
+
bottom: 240
|
|
19
|
+
};
|
|
20
|
+
const ZONE_LIMITS = {
|
|
21
|
+
left: {
|
|
22
|
+
min: 200,
|
|
23
|
+
max: 640
|
|
24
|
+
},
|
|
25
|
+
right: {
|
|
26
|
+
min: 220,
|
|
27
|
+
max: 640
|
|
28
|
+
},
|
|
29
|
+
bottom: {
|
|
30
|
+
min: 120,
|
|
31
|
+
max: 720
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Borne une taille de zone : minimum fixe, maximum = plafond fixe ET part de la fenêtre
|
|
36
|
+
* (50 % de la largeur, 70 % de la hauteur), pour que le contenu central reste toujours visible.
|
|
37
|
+
*/ export function clampZoneSize(anchor, size, viewport = {
|
|
38
|
+
width: window.innerWidth,
|
|
39
|
+
height: window.innerHeight
|
|
40
|
+
}) {
|
|
41
|
+
const { min, max } = ZONE_LIMITS[anchor];
|
|
42
|
+
const viewportMax = Math.floor((anchor === 'bottom' ? viewport.height * 0.7 : viewport.width * 0.5) || max);
|
|
43
|
+
const upper = Math.max(min, Math.min(max, viewportMax));
|
|
44
|
+
if (!Number.isFinite(size)) return DEFAULT_ZONE_SIZES[anchor];
|
|
45
|
+
return Math.round(Math.min(upper, Math.max(min, size)));
|
|
46
|
+
}
|
|
47
|
+
function defaultState() {
|
|
48
|
+
return {
|
|
49
|
+
sizes: {
|
|
50
|
+
...DEFAULT_ZONE_SIZES
|
|
51
|
+
},
|
|
52
|
+
active: {
|
|
53
|
+
left: null,
|
|
54
|
+
right: null,
|
|
55
|
+
bottom: null
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function readStoredState() {
|
|
60
|
+
const state = defaultState();
|
|
61
|
+
try {
|
|
62
|
+
const raw = window.localStorage.getItem(WORKBENCH_STORAGE_KEY);
|
|
63
|
+
if (!raw) return state;
|
|
64
|
+
const parsed = JSON.parse(raw);
|
|
65
|
+
for (const anchor of ZONE_ANCHORS){
|
|
66
|
+
const size = parsed?.sizes?.[anchor];
|
|
67
|
+
if (typeof size === 'number') state.sizes[anchor] = clampZoneSize(anchor, size);
|
|
68
|
+
const active = parsed?.active?.[anchor];
|
|
69
|
+
if (typeof active === 'string' && active.length > 0) state.active[anchor] = active;
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
// stockage indisponible ou contenu corrompu : disposition par défaut
|
|
73
|
+
}
|
|
74
|
+
return state;
|
|
75
|
+
}
|
|
76
|
+
export const workbenchStore = getGlobalStore('workbench', readStoredState());
|
|
77
|
+
workbenchStore.subscribe((state)=>{
|
|
78
|
+
try {
|
|
79
|
+
window.localStorage.setItem(WORKBENCH_STORAGE_KEY, JSON.stringify(state));
|
|
80
|
+
} catch {
|
|
81
|
+
// quota dépassé ou stockage désactivé : la disposition reste valable pour la session
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
/** Ouvre la fenêtre d'outils `id` dans la zone `anchor` ; un second appel sur la même la referme. */ export function toggleToolWindow(anchor, id) {
|
|
85
|
+
const { active } = workbenchStore.getState();
|
|
86
|
+
workbenchStore.setState({
|
|
87
|
+
active: {
|
|
88
|
+
...active,
|
|
89
|
+
[anchor]: active[anchor] === id ? null : id
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Replie la zone `anchor`. */ export function closeToolWindow(anchor) {
|
|
94
|
+
const { active } = workbenchStore.getState();
|
|
95
|
+
if (active[anchor] !== null) workbenchStore.setState({
|
|
96
|
+
active: {
|
|
97
|
+
...active,
|
|
98
|
+
[anchor]: null
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Redimensionne la zone `anchor` (valeur bornée par `clampZoneSize`). */ export function setZoneSize(anchor, size) {
|
|
103
|
+
const { sizes } = workbenchStore.getState();
|
|
104
|
+
const next = clampZoneSize(anchor, size);
|
|
105
|
+
if (sizes[anchor] !== next) workbenchStore.setState({
|
|
106
|
+
sizes: {
|
|
107
|
+
...sizes,
|
|
108
|
+
[anchor]: next
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/** Rétablit la taille par défaut de la zone `anchor`. */ export function resetZoneSize(anchor) {
|
|
113
|
+
setZoneSize(anchor, DEFAULT_ZONE_SIZES[anchor]);
|
|
114
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/esm-styleguide",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for Egen SPA",
|
|
6
6
|
"main": "dist/internal.js",
|
|
@@ -97,7 +97,7 @@
|
|
|
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.
|
|
100
|
+
"@egen-civitas/esm-extensions": "^1.3.0",
|
|
101
101
|
"@egen-civitas/esm-globals": "^1.0.0",
|
|
102
102
|
"@egen-civitas/esm-navigation": "^1.0.2",
|
|
103
103
|
"@egen-civitas/esm-react-utils": "^1.0.5",
|
|
@@ -120,7 +120,7 @@
|
|
|
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.
|
|
123
|
+
"@egen-civitas/esm-extensions": "^1.3.0",
|
|
124
124
|
"@egen-civitas/esm-globals": "^1.0.0",
|
|
125
125
|
"@egen-civitas/esm-navigation": "^1.0.2",
|
|
126
126
|
"@egen-civitas/esm-react-utils": "^1.0.5",
|