@egen-civitas/esm-styleguide 1.11.0 → 1.12.1
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 +28 -0
- package/dist/components/_general.scss +136 -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 +17 -0
- package/dist/workbench/splitter.component.d.ts.map +1 -0
- package/dist/workbench/splitter.component.js +81 -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 +233 -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,33 @@
|
|
|
1
1
|
# @egen-civitas/esm-styleguide
|
|
2
2
|
|
|
3
|
+
## 1.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2468548: Plan de travail : rails transparents, cartes assombries et séparées par un écart.
|
|
8
|
+
|
|
9
|
+
- Les rails gauche et droit sont toujours transparents (plus de fond ni de flou) et sans bordure : collés à la TopBar, ils se fondent avec elle sans aucune discontinuité.
|
|
10
|
+
- Les zones et la carte centrale reçoivent un léger assombrissement de fond (`--egen-workbench-card-bg`, plus faible en thème clair) ; la bordure des zones disparaît.
|
|
11
|
+
- Les cartes voisines sont séparées par un écart visible (`--egen-workbench-gap`, 6 px par défaut) : il matérialise la frontière, et la poignée de redimensionnement y est centrée. Elle s'illumine au survol, au focus et pendant le glissement, et la frontière suit le pointeur sans saut à la prise.
|
|
12
|
+
- Routes publiques, écrans de moins de 768 px et impression : la carte centrale reste plein cadre, sans teinte.
|
|
13
|
+
|
|
14
|
+
## 1.12.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 6ddbd06: Shell : plan de travail façon IntelliJ (rails fixes et zones redimensionnables).
|
|
19
|
+
|
|
20
|
+
- `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`.
|
|
21
|
+
- `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.
|
|
22
|
+
- `esm-app-shell` : nouveaux conteneurs `egen-rail-*-container` et `egen-zone-*-container`, montés au démarrage par `renderWorkbench`.
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [6ddbd06]
|
|
29
|
+
- @egen-civitas/esm-extensions@1.3.0
|
|
30
|
+
|
|
3
31
|
## 1.11.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
|
@@ -28,9 +28,26 @@ 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
|
+
background: transparent;
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
.egen-app-error {
|
|
@@ -79,7 +96,70 @@ html[data-public-route='true'] {
|
|
|
79
96
|
overflow-y: auto;
|
|
80
97
|
overscroll-behavior: contain;
|
|
81
98
|
// La ligne de grille définit la hauteur : la région ne dépasse jamais.
|
|
82
|
-
height:
|
|
99
|
+
height: auto;
|
|
100
|
+
// Carte centrale du plan de travail : une demi-marge de chaque côté (l'écart entre deux cartes
|
|
101
|
+
// voisines vaut donc --egen-workbench-gap), coins arrondis et léger assombrissement du fond pour
|
|
102
|
+
// la distinguer des rails et de la TopBar, qui restent transparents. Le contenu est coupé net à
|
|
103
|
+
// ces bords. Les routes publiques la remettent plein cadre, sans teinte.
|
|
104
|
+
margin: calc(var(--egen-workbench-gap, 0.375rem) / 2);
|
|
105
|
+
border-radius: 0.625rem;
|
|
106
|
+
background: var(--egen-workbench-card-bg, rgb(0 0 0 / 16%));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ── Plan de travail : rails fixes + zones redimensionnables (façon IntelliJ) ──
|
|
110
|
+
// Chaque conteneur est une cellule de la grille du body ; la zone de scroll ci-dessus en est
|
|
111
|
+
// le centre. Les tailles des zones viennent de variables CSS publiées par le shell
|
|
112
|
+
// (--egen-zone-left-width, --egen-zone-right-width, --egen-zone-bottom-height : 0 quand la zone
|
|
113
|
+
// est repliée) ; les rails ont une largeur fixe.
|
|
114
|
+
:root {
|
|
115
|
+
--egen-rail-width: 2.5rem;
|
|
116
|
+
// Écart visible entre deux cartes voisines (zones, centre) : il matérialise leur frontière et
|
|
117
|
+
// la poignée de redimensionnement qui s'y trouve.
|
|
118
|
+
--egen-workbench-gap: 0.375rem;
|
|
119
|
+
// Fond des cartes (zones + centre) : un léger assombrissement, jamais un aplat opaque, pour que
|
|
120
|
+
// le fond global reste visible. Les rails et la TopBar n'ont, eux, AUCUN fond.
|
|
121
|
+
--egen-workbench-card-bg: rgb(0 0 0 / 16%);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:root[data-theme='light'] {
|
|
125
|
+
--egen-workbench-card-bg: rgb(0 0 0 / 5%);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Pendant un redimensionnement : pas de sélection de texte qui suit le pointeur.
|
|
129
|
+
html[data-workbench-resizing] {
|
|
130
|
+
user-select: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#egen-rail-left-container {
|
|
134
|
+
grid-area: railL;
|
|
135
|
+
min-width: 0;
|
|
136
|
+
min-height: 0;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#egen-rail-right-container {
|
|
141
|
+
grid-area: railR;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
min-height: 0;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#egen-zone-left-container {
|
|
148
|
+
grid-area: zoneL;
|
|
149
|
+
min-width: 0;
|
|
150
|
+
min-height: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#egen-zone-right-container {
|
|
154
|
+
grid-area: zoneR;
|
|
155
|
+
min-width: 0;
|
|
156
|
+
min-height: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#egen-zone-bottom-container {
|
|
160
|
+
grid-area: zoneB;
|
|
161
|
+
min-width: 0;
|
|
162
|
+
min-height: 0;
|
|
83
163
|
}
|
|
84
164
|
|
|
85
165
|
#egen-apps-container {
|
|
@@ -150,12 +230,27 @@ body {
|
|
|
150
230
|
// la TopBar et se termine au bord haut du footer, et son contenu y est coupé.
|
|
151
231
|
// NB : on n'utilise PAS padding-bottom sur le body : des resets globaux
|
|
152
232
|
// chargés plus tard (`html, body { padding: 0 }`) l'écrasent.
|
|
233
|
+
//
|
|
234
|
+
// Plan de travail : colonnes = rail gauche | zone gauche | centre | zone droite | rail droit |
|
|
235
|
+
// workspaces ; lignes = TopBar | corps | zone basse | footer. Les rails couvrent corps + zone
|
|
236
|
+
// basse ; la zone basse s'étend entre les deux rails.
|
|
153
237
|
grid-template-areas:
|
|
154
|
-
'topNav topNav'
|
|
155
|
-
'appRoots workspace'
|
|
156
|
-
'
|
|
157
|
-
|
|
158
|
-
grid-template-
|
|
238
|
+
'topNav topNav topNav topNav topNav topNav'
|
|
239
|
+
'railL zoneL appRoots zoneR railR workspace'
|
|
240
|
+
'railL zoneB zoneB zoneB railR workspace'
|
|
241
|
+
'footerGap footerGap footerGap footerGap footerGap footerGap';
|
|
242
|
+
grid-template-columns:
|
|
243
|
+
var(--egen-rail-width, 2.5rem)
|
|
244
|
+
var(--egen-zone-left-width, 0px)
|
|
245
|
+
minmax(0, 1fr)
|
|
246
|
+
var(--egen-zone-right-width, 0px)
|
|
247
|
+
var(--egen-rail-width, 2.5rem)
|
|
248
|
+
min-content;
|
|
249
|
+
grid-template-rows:
|
|
250
|
+
auto
|
|
251
|
+
minmax(0, 1fr)
|
|
252
|
+
var(--egen-zone-bottom-height, 0px)
|
|
253
|
+
var(--egen-footer-height, 0px);
|
|
159
254
|
box-sizing: border-box;
|
|
160
255
|
height: 100vh;
|
|
161
256
|
height: 100dvh;
|
|
@@ -163,6 +258,28 @@ body {
|
|
|
163
258
|
container-type: inline-size;
|
|
164
259
|
}
|
|
165
260
|
|
|
261
|
+
// Petits écrans : pas de place pour des rails et des zones, le contenu prend toute la largeur.
|
|
262
|
+
@media (max-width: 767px) {
|
|
263
|
+
#egen-rail-left-container,
|
|
264
|
+
#egen-rail-right-container,
|
|
265
|
+
#egen-zone-left-container,
|
|
266
|
+
#egen-zone-right-container,
|
|
267
|
+
#egen-zone-bottom-container {
|
|
268
|
+
display: none;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
body {
|
|
272
|
+
grid-template-columns: 0 0 minmax(0, 1fr) 0 0 min-content;
|
|
273
|
+
grid-template-rows: auto minmax(0, 1fr) 0 var(--egen-footer-height, 0px);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
#egen-scroll-region {
|
|
277
|
+
margin: 0;
|
|
278
|
+
border-radius: 0;
|
|
279
|
+
background: transparent;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
166
283
|
@media print {
|
|
167
284
|
html,
|
|
168
285
|
body {
|
|
@@ -174,7 +291,12 @@ body {
|
|
|
174
291
|
|
|
175
292
|
#egen-workspaces-container,
|
|
176
293
|
#egen-top-nav-app-container,
|
|
177
|
-
#egen-footer-app-container
|
|
294
|
+
#egen-footer-app-container,
|
|
295
|
+
#egen-rail-left-container,
|
|
296
|
+
#egen-rail-right-container,
|
|
297
|
+
#egen-zone-left-container,
|
|
298
|
+
#egen-zone-right-container,
|
|
299
|
+
#egen-zone-bottom-container {
|
|
178
300
|
display: none;
|
|
179
301
|
}
|
|
180
302
|
|
|
@@ -184,4 +306,10 @@ body {
|
|
|
184
306
|
min-height: auto;
|
|
185
307
|
overflow: visible;
|
|
186
308
|
}
|
|
309
|
+
|
|
310
|
+
#egen-scroll-region {
|
|
311
|
+
margin: 0;
|
|
312
|
+
border-radius: 0;
|
|
313
|
+
background: transparent;
|
|
314
|
+
}
|
|
187
315
|
}
|
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,17 @@
|
|
|
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 centrée dans l'écart entre la
|
|
11
|
+
* zone et le contenu central ; la taille est calculée à partir du bord opposé, qui ne bouge pas.
|
|
12
|
+
* L'écart entre le point saisi et la frontière est mémorisé : la frontière suit le pointeur sans
|
|
13
|
+
* saut au début du glissement, même si la poignée a été saisie à côté de son centre.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Splitter({ anchor, label }: SplitterProps): React.JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# 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;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,aAAa,qBAwExD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 centrée dans l'écart entre la
|
|
11
|
+
* zone et le contenu central ; la taille est calculée à partir du bord opposé, qui ne bouge pas.
|
|
12
|
+
* L'écart entre le point saisi et la frontière est mémorisé : la frontière suit le pointeur sans
|
|
13
|
+
* saut au début du glissement, même si la poignée a été saisie à côté de son centre.
|
|
14
|
+
*/ export function Splitter({ anchor, label }) {
|
|
15
|
+
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
16
|
+
const { sizes } = useStore(workbenchStore);
|
|
17
|
+
const size = sizes[anchor];
|
|
18
|
+
const dragging = useRef(null);
|
|
19
|
+
const vertical = anchor !== 'bottom'; // poignée verticale (redimensionne la largeur)
|
|
20
|
+
const sizeFromPointer = (clientX, clientY, edge, grab)=>{
|
|
21
|
+
if (anchor === 'left') return clientX - grab - edge;
|
|
22
|
+
if (anchor === 'right') return edge - (clientX - grab);
|
|
23
|
+
return edge - (clientY - grab);
|
|
24
|
+
};
|
|
25
|
+
const onPointerDown = (event)=>{
|
|
26
|
+
if (event.button !== 0) return;
|
|
27
|
+
const cell = event.currentTarget.parentElement?.parentElement ?? event.currentTarget.parentElement;
|
|
28
|
+
if (!cell) return;
|
|
29
|
+
const rect = cell.getBoundingClientRect();
|
|
30
|
+
// Bord fixe de la zone : gauche pour `left`, droite pour `right`, bas pour `bottom`.
|
|
31
|
+
const edge = anchor === 'left' ? rect.left : anchor === 'right' ? rect.right : rect.bottom;
|
|
32
|
+
// Bord mobile de la cellule, au milieu de l'écart où se trouve la poignée.
|
|
33
|
+
const movingEdge = anchor === 'left' ? rect.right : anchor === 'right' ? rect.left : rect.top;
|
|
34
|
+
const pointer = anchor === 'bottom' ? event.clientY : event.clientX;
|
|
35
|
+
dragging.current = {
|
|
36
|
+
edge,
|
|
37
|
+
grab: pointer - movingEdge
|
|
38
|
+
};
|
|
39
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
40
|
+
document.documentElement.setAttribute(RESIZING_ATTRIBUTE, anchor);
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
};
|
|
43
|
+
const onPointerMove = (event)=>{
|
|
44
|
+
if (!dragging.current) return;
|
|
45
|
+
setZoneSize(anchor, sizeFromPointer(event.clientX, event.clientY, dragging.current.edge, dragging.current.grab));
|
|
46
|
+
};
|
|
47
|
+
const stopDragging = (event)=>{
|
|
48
|
+
if (!dragging.current) return;
|
|
49
|
+
dragging.current = null;
|
|
50
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
51
|
+
document.documentElement.removeAttribute(RESIZING_ATTRIBUTE);
|
|
52
|
+
};
|
|
53
|
+
const onKeyDown = (event)=>{
|
|
54
|
+
// Le sens « agrandir » dépend du bord : une zone gauche grandit vers la droite, etc.
|
|
55
|
+
const grow = anchor === 'left' ? 'ArrowRight' : anchor === 'right' ? 'ArrowLeft' : 'ArrowUp';
|
|
56
|
+
const shrink = anchor === 'left' ? 'ArrowLeft' : anchor === 'right' ? 'ArrowRight' : 'ArrowDown';
|
|
57
|
+
if (event.key === grow) setZoneSize(anchor, workbenchStore.getState().sizes[anchor] + KEYBOARD_STEP);
|
|
58
|
+
else if (event.key === shrink) setZoneSize(anchor, workbenchStore.getState().sizes[anchor] - KEYBOARD_STEP);
|
|
59
|
+
else if (event.key === 'Home') setZoneSize(anchor, 0);
|
|
60
|
+
else if (event.key === 'End') setZoneSize(anchor, Number.MAX_SAFE_INTEGER);
|
|
61
|
+
else return;
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
};
|
|
64
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
65
|
+
role: "separator",
|
|
66
|
+
tabIndex: 0,
|
|
67
|
+
"aria-label": label,
|
|
68
|
+
"aria-orientation": vertical ? 'vertical' : 'horizontal',
|
|
69
|
+
"aria-valuenow": size,
|
|
70
|
+
"aria-valuemin": clampZoneSize(anchor, 0),
|
|
71
|
+
"aria-valuemax": clampZoneSize(anchor, Number.MAX_SAFE_INTEGER),
|
|
72
|
+
"data-anchor": anchor,
|
|
73
|
+
className: `${styles.splitter} ${styles[`splitter-${anchor}`]}`,
|
|
74
|
+
onPointerDown: onPointerDown,
|
|
75
|
+
onPointerMove: onPointerMove,
|
|
76
|
+
onPointerUp: stopDragging,
|
|
77
|
+
onPointerCancel: stopDragging,
|
|
78
|
+
onDoubleClick: ()=>resetZoneSize(anchor),
|
|
79
|
+
onKeyDown: onKeyDown
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -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,233 @@
|
|
|
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
|
+
// Écart entre deux cartes voisines (zones, centre) : défini dans components/_general.scss.
|
|
7
|
+
$gap: var(--egen-workbench-gap, 0.375rem);
|
|
8
|
+
|
|
9
|
+
// ── Rails ───────────────────────────────────────────────────────────────────
|
|
10
|
+
.rail {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
min-height: 0;
|
|
18
|
+
padding: 0.5rem 0;
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
scrollbar-width: none;
|
|
21
|
+
// Toujours transparent, sans bordure : le rail se fond avec la TopBar (aussi transparente) et
|
|
22
|
+
// laisse voir le fond global, sans aucune discontinuité à leur jonction.
|
|
23
|
+
border: 0;
|
|
24
|
+
background: transparent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.railGroup {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 0.25rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.railSpacer {
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.railButton {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
width: 2rem;
|
|
44
|
+
height: 2rem;
|
|
45
|
+
padding: 0;
|
|
46
|
+
border: 0;
|
|
47
|
+
border-radius: 0.5rem;
|
|
48
|
+
background: transparent;
|
|
49
|
+
color: var(--colors-surface-muted-foreground, #9ca3af);
|
|
50
|
+
font: inherit;
|
|
51
|
+
font-size: 0.75rem;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
transition:
|
|
55
|
+
background-color 120ms ease,
|
|
56
|
+
color 120ms ease;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 10%));
|
|
60
|
+
color: var(--colors-surface-foreground, #fff);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:focus-visible {
|
|
64
|
+
outline: 2px solid var(--colors-border-ring, var(--colors-primary-500, #3b82f6));
|
|
65
|
+
outline-offset: 1px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&[data-active='true'] {
|
|
69
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 14%));
|
|
70
|
+
color: var(--colors-surface-foreground, #fff);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── Zones ───────────────────────────────────────────────────────────────────
|
|
75
|
+
.zone {
|
|
76
|
+
position: relative;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
// Une demi-marge de chaque côté : elle s'additionne à celle du voisin et laisse un écart de
|
|
81
|
+
// --egen-workbench-gap entre deux cartes. Pas de bordure : c'est cet écart qui marque la frontière.
|
|
82
|
+
margin: calc(#{$gap} / 2);
|
|
83
|
+
height: calc(100% - #{$gap});
|
|
84
|
+
min-width: 0;
|
|
85
|
+
min-height: 0;
|
|
86
|
+
border-radius: $radius;
|
|
87
|
+
// Même léger assombrissement que la carte centrale (voir _general.scss).
|
|
88
|
+
background: var(--egen-workbench-card-bg, rgb(0 0 0 / 16%));
|
|
89
|
+
color: var(--colors-surface-foreground, #fff);
|
|
90
|
+
|
|
91
|
+
&[hidden] {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.zoneHeader {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
gap: 0.5rem;
|
|
101
|
+
flex: 0 0 auto;
|
|
102
|
+
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.zoneTitle {
|
|
106
|
+
margin: 0;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
font-size: 0.8125rem;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
line-height: 1.25rem;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.zoneClose {
|
|
116
|
+
display: inline-flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
width: 1.5rem;
|
|
120
|
+
height: 1.5rem;
|
|
121
|
+
padding: 0;
|
|
122
|
+
border: 0;
|
|
123
|
+
border-radius: 0.375rem;
|
|
124
|
+
background: transparent;
|
|
125
|
+
color: var(--colors-surface-muted-foreground, #9ca3af);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
background: var(--colors-surface-translucent-hover, rgb(255 255 255 / 10%));
|
|
130
|
+
color: var(--colors-surface-foreground, #fff);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:focus-visible {
|
|
134
|
+
outline: 2px solid var(--colors-border-ring, var(--colors-primary-500, #3b82f6));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.zoneBody {
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
min-height: 0;
|
|
141
|
+
overflow: auto;
|
|
142
|
+
border-bottom-left-radius: $radius;
|
|
143
|
+
border-bottom-right-radius: $radius;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.zoneSlot {
|
|
147
|
+
min-height: 100%;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// La zone basse prend toute la largeur entre les rails : sa hauteur vient de la ligne de grille.
|
|
151
|
+
.zone-bottom {
|
|
152
|
+
height: calc(100% - #{$gap});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ── Poignées de redimensionnement ───────────────────────────────────────────
|
|
156
|
+
// Posées au milieu de l'écart entre la zone et sa voisine : l'écart montre la limite, la poignée
|
|
157
|
+
// l'endroit où saisir. La zone de saisie déborde de 2px de chaque côté de l'écart pour rester
|
|
158
|
+
// facile à attraper ; au survol, au focus et pendant le glissement, un filet d'accent y apparaît.
|
|
159
|
+
.splitter {
|
|
160
|
+
--splitter-hit: calc(#{$gap} + 0.25rem);
|
|
161
|
+
// Distance entre le bord de la zone et le bord extérieur de la poignée (milieu de l'écart + moitié de la poignée).
|
|
162
|
+
--splitter-offset: calc(-1 * (#{$gap} + 0.125rem));
|
|
163
|
+
|
|
164
|
+
position: absolute;
|
|
165
|
+
z-index: 2;
|
|
166
|
+
background: transparent;
|
|
167
|
+
touch-action: none;
|
|
168
|
+
|
|
169
|
+
&::after {
|
|
170
|
+
content: '';
|
|
171
|
+
position: absolute;
|
|
172
|
+
border-radius: 999px;
|
|
173
|
+
background: var(--colors-primary-500, #3b82f6);
|
|
174
|
+
opacity: 0;
|
|
175
|
+
transition: opacity 120ms ease;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&:hover::after,
|
|
179
|
+
&:focus-visible::after {
|
|
180
|
+
opacity: 0.8;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&:focus-visible {
|
|
184
|
+
outline: none;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Pendant le glissement le pointeur peut quitter la poignée : le filet reste allumé.
|
|
189
|
+
:global(html[data-workbench-resizing='left']) .splitter-left::after,
|
|
190
|
+
:global(html[data-workbench-resizing='right']) .splitter-right::after,
|
|
191
|
+
:global(html[data-workbench-resizing='bottom']) .splitter-bottom::after {
|
|
192
|
+
opacity: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.splitter-left,
|
|
196
|
+
.splitter-right {
|
|
197
|
+
top: 0;
|
|
198
|
+
bottom: 0;
|
|
199
|
+
width: var(--splitter-hit);
|
|
200
|
+
cursor: col-resize;
|
|
201
|
+
|
|
202
|
+
&::after {
|
|
203
|
+
top: 0;
|
|
204
|
+
bottom: 0;
|
|
205
|
+
left: 50%;
|
|
206
|
+
width: 2px;
|
|
207
|
+
transform: translateX(-50%);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.splitter-left {
|
|
212
|
+
right: var(--splitter-offset);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.splitter-right {
|
|
216
|
+
left: var(--splitter-offset);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.splitter-bottom {
|
|
220
|
+
left: 0;
|
|
221
|
+
right: 0;
|
|
222
|
+
top: var(--splitter-offset);
|
|
223
|
+
height: var(--splitter-hit);
|
|
224
|
+
cursor: row-resize;
|
|
225
|
+
|
|
226
|
+
&::after {
|
|
227
|
+
left: 0;
|
|
228
|
+
right: 0;
|
|
229
|
+
top: 50%;
|
|
230
|
+
height: 2px;
|
|
231
|
+
transform: translateY(-50%);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -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.1",
|
|
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",
|