@egen-civitas/esm-styleguide 3.0.0 → 3.2.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 +23 -0
- package/dist/staggered-menu/index.d.ts +2 -0
- package/dist/staggered-menu/index.d.ts.map +1 -1
- package/dist/staggered-menu/index.js +1 -0
- package/dist/staggered-menu/staggered-menu-extensions.component.d.ts +26 -0
- package/dist/staggered-menu/staggered-menu-extensions.component.d.ts.map +1 -0
- package/dist/staggered-menu/staggered-menu-extensions.component.js +59 -0
- package/dist/staggered-menu/staggered-menu-panel.component.d.ts +20 -0
- package/dist/staggered-menu/staggered-menu-panel.component.d.ts.map +1 -1
- package/dist/staggered-menu/staggered-menu-panel.component.js +128 -4
- package/dist/staggered-menu/use-staggered-menu-entries.d.ts +14 -0
- package/dist/staggered-menu/use-staggered-menu-entries.d.ts.map +1 -0
- package/dist/staggered-menu/use-staggered-menu-entries.js +26 -0
- package/dist/workbench/compartments.d.ts +47 -0
- package/dist/workbench/compartments.d.ts.map +1 -0
- package/dist/workbench/compartments.js +147 -0
- package/dist/workbench/index.d.ts +1 -0
- package/dist/workbench/index.d.ts.map +1 -1
- package/dist/workbench/index.js +1 -0
- package/dist/workbench/splitter.component.d.ts +18 -0
- package/dist/workbench/splitter.component.d.ts.map +1 -1
- package/dist/workbench/splitter.component.js +68 -1
- package/dist/workbench/tool-window-header.component.d.ts +2 -0
- package/dist/workbench/tool-window-header.component.d.ts.map +1 -1
- package/dist/workbench/tool-window-header.component.js +3 -1
- package/dist/workbench/tool-window-rail.component.d.ts.map +1 -1
- package/dist/workbench/tool-window-rail.component.js +7 -5
- package/dist/workbench/tool-window-zone.component.d.ts +11 -4
- package/dist/workbench/tool-window-zone.component.d.ts.map +1 -1
- package/dist/workbench/tool-window-zone.component.js +144 -57
- package/dist/workbench/use-tool-windows.d.ts +7 -1
- package/dist/workbench/use-tool-windows.d.ts.map +1 -1
- package/dist/workbench/use-tool-windows.js +4 -2
- package/dist/workbench/workbench.module.scss +76 -13
- package/dist/workbench/workbench.store.d.ts +37 -4
- package/dist/workbench/workbench.store.d.ts.map +1 -1
- package/dist/workbench/workbench.store.js +124 -10
- package/package.json +3 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calcul des hauteurs des compartiments verticaux d'une zone latérale (gauche ou droite).
|
|
3
|
+
*
|
|
4
|
+
* Fonctions pures, sans dépendance au DOM ni au store : la zone empile des compartiments dont les
|
|
5
|
+
* hauteurs, en **% de la zone**, totalisent toujours 100 (aucun débordement). Chaque compartiment a une
|
|
6
|
+
* hauteur de base, un minimum et un maximum.
|
|
7
|
+
*/ /** Identifiant réservé du compartiment par défaut d'une zone (aucune fenêtre d'outils ne peut le porter). */ export const DEFAULT_COMPARTMENT_ID = '__default__';
|
|
8
|
+
/**
|
|
9
|
+
* Dimensions du compartiment par défaut (en % de la zone). Fixées par le shell : les apps ne peuvent pas les
|
|
10
|
+
* modifier. Maximum à 100 pour qu'il remplisse la zone quand il est seul.
|
|
11
|
+
*/ export const DEFAULT_COMPARTMENT_LIMITS = {
|
|
12
|
+
height: 60,
|
|
13
|
+
minHeight: 25,
|
|
14
|
+
maxHeight: 100
|
|
15
|
+
};
|
|
16
|
+
const TOTAL = 100;
|
|
17
|
+
const EPSILON = 1e-6;
|
|
18
|
+
/** Arrondit à 0,01 % : assez fin pour un glissement fluide, assez grossier pour ne pas osciller. */ const round = (n)=>Math.round(n * 100) / 100;
|
|
19
|
+
/** Bornes effectives : minimums réduits proportionnellement s'ils dépassent 100, maximums ignorés s'ils n'atteignent pas 100. */ function effectiveLimits(items) {
|
|
20
|
+
const sumMin = items.reduce((total, item)=>total + item.minHeight, 0);
|
|
21
|
+
const sumMax = items.reduce((total, item)=>total + item.maxHeight, 0);
|
|
22
|
+
const minScale = sumMin > TOTAL ? TOTAL / sumMin : 1;
|
|
23
|
+
const mins = items.map((item)=>item.minHeight * minScale);
|
|
24
|
+
const maxs = items.map((item)=>sumMax < TOTAL ? TOTAL : Math.max(item.maxHeight, item.minHeight * minScale));
|
|
25
|
+
return {
|
|
26
|
+
mins,
|
|
27
|
+
maxs
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hauteurs (%) des compartiments ouverts, dans l'ordre : somme exacte de 100, chacune dans ses bornes.
|
|
32
|
+
*
|
|
33
|
+
* `stored` : hauteurs déjà mémorisées. Un compartiment sans valeur mémorisée (nouvellement ouvert) reçoit sa
|
|
34
|
+
* hauteur de base et les autres se partagent le reste proportionnellement à leurs hauteurs.
|
|
35
|
+
*/ export function fitCompartmentHeights(items, stored = {}) {
|
|
36
|
+
if (items.length === 0) return [];
|
|
37
|
+
if (items.length === 1) return [
|
|
38
|
+
TOTAL
|
|
39
|
+
];
|
|
40
|
+
const { mins, maxs } = effectiveLimits(items);
|
|
41
|
+
const known = items.map((item)=>{
|
|
42
|
+
const value = stored[item.key];
|
|
43
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
44
|
+
});
|
|
45
|
+
const fresh = items.reduce((total, item, i)=>total + (known[i] ? 0 : item.height), 0);
|
|
46
|
+
const knownSum = items.reduce((total, item, i)=>total + (known[i] ? stored[item.key] : 0), 0);
|
|
47
|
+
const knownTarget = TOTAL - fresh;
|
|
48
|
+
// Valeurs de départ : nouveaux à leur base, les autres ramenés à la place restante (ou tout ramené à 100 sinon).
|
|
49
|
+
let values;
|
|
50
|
+
if (knownSum > 0 && knownTarget > 0) {
|
|
51
|
+
values = items.map((item, i)=>known[i] ? stored[item.key] * knownTarget / knownSum : item.height);
|
|
52
|
+
} else {
|
|
53
|
+
const raw = items.map((item, i)=>known[i] ? stored[item.key] : item.height);
|
|
54
|
+
const sum = raw.reduce((total, v)=>total + v, 0);
|
|
55
|
+
values = raw.map((v)=>v * TOTAL / sum);
|
|
56
|
+
}
|
|
57
|
+
// Écrêtage itératif : on fige les compartiments qui sortent de leurs bornes et on redistribue le reste.
|
|
58
|
+
const fixed = items.map(()=>undefined);
|
|
59
|
+
for(let pass = 0; pass <= items.length; pass += 1){
|
|
60
|
+
const fixedSum = fixed.reduce((total, v)=>total + (v ?? 0), 0);
|
|
61
|
+
const freeIndexes = items.map((_, i)=>i).filter((i)=>fixed[i] === undefined);
|
|
62
|
+
if (freeIndexes.length === 0) break;
|
|
63
|
+
const freeSum = freeIndexes.reduce((total, i)=>total + values[i], 0);
|
|
64
|
+
const scale = freeSum > 0 ? (TOTAL - fixedSum) / freeSum : 0;
|
|
65
|
+
const scaled = new Map(freeIndexes.map((i)=>[
|
|
66
|
+
i,
|
|
67
|
+
freeSum > 0 ? values[i] * scale : (TOTAL - fixedSum) / freeIndexes.length
|
|
68
|
+
]));
|
|
69
|
+
let excess = 0; // > 0 : trop grand une fois écrêté ; < 0 : trop petit
|
|
70
|
+
for (const i of freeIndexes){
|
|
71
|
+
const v = scaled.get(i);
|
|
72
|
+
excess += Math.min(maxs[i], Math.max(mins[i], v)) - v;
|
|
73
|
+
}
|
|
74
|
+
const tooSmall = freeIndexes.filter((i)=>scaled.get(i) < mins[i] - EPSILON);
|
|
75
|
+
const tooBig = freeIndexes.filter((i)=>scaled.get(i) > maxs[i] + EPSILON);
|
|
76
|
+
if (tooSmall.length === 0 && tooBig.length === 0) {
|
|
77
|
+
for (const i of freeIndexes)fixed[i] = scaled.get(i);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
// Excès positif (on a relevé des minimums) : on fige les minimums ; négatif : les maximums ; nul : les deux.
|
|
81
|
+
const toFix = excess > EPSILON ? tooSmall : excess < -EPSILON ? tooBig : [
|
|
82
|
+
...tooSmall,
|
|
83
|
+
...tooBig
|
|
84
|
+
];
|
|
85
|
+
for (const i of toFix.length > 0 ? toFix : [
|
|
86
|
+
...tooSmall,
|
|
87
|
+
...tooBig
|
|
88
|
+
]){
|
|
89
|
+
fixed[i] = Math.min(maxs[i], Math.max(mins[i], scaled.get(i)));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const result = items.map((_, i)=>fixed[i] ?? values[i]);
|
|
93
|
+
// Somme exacte : l'arrondi est absorbé par le plus grand compartiment.
|
|
94
|
+
const rounded = result.map(round);
|
|
95
|
+
const drift = round(TOTAL - rounded.reduce((total, v)=>total + v, 0));
|
|
96
|
+
if (drift !== 0) {
|
|
97
|
+
let largest = 0;
|
|
98
|
+
rounded.forEach((v, i)=>{
|
|
99
|
+
if (v > rounded[largest]) largest = i;
|
|
100
|
+
});
|
|
101
|
+
rounded[largest] = round(rounded[largest] + drift);
|
|
102
|
+
}
|
|
103
|
+
return rounded;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Déplace la frontière entre le compartiment `index` et le suivant de `delta` points de pourcentage
|
|
107
|
+
* (positif : vers le bas). La somme reste 100 :
|
|
108
|
+
*
|
|
109
|
+
* - le côté qui gagne de la place s'agrandit en commençant par le compartiment contre la frontière,
|
|
110
|
+
* puis le suivant s'il atteint son maximum ;
|
|
111
|
+
* - le côté qui en perd rétrécit de la même façon, jusqu'aux minimums.
|
|
112
|
+
*
|
|
113
|
+
* Le déplacement est borné par ce que les deux côtés peuvent absorber : la frontière s'arrête net.
|
|
114
|
+
*/ export function resizeCompartmentBoundary(heights, items, index, delta) {
|
|
115
|
+
const next = [
|
|
116
|
+
...heights
|
|
117
|
+
];
|
|
118
|
+
if (index < 0 || index >= heights.length - 1 || !Number.isFinite(delta) || delta === 0) return next;
|
|
119
|
+
const { mins, maxs } = effectiveLimits(items);
|
|
120
|
+
const above = Array.from({
|
|
121
|
+
length: index + 1
|
|
122
|
+
}, (_, k)=>index - k); // du plus proche de la frontière au plus loin
|
|
123
|
+
const below = Array.from({
|
|
124
|
+
length: heights.length - index - 1
|
|
125
|
+
}, (_, k)=>index + 1 + k);
|
|
126
|
+
const growing = delta > 0 ? above : below;
|
|
127
|
+
const shrinking = delta > 0 ? below : above;
|
|
128
|
+
const growCapacity = growing.reduce((total, i)=>total + Math.max(0, maxs[i] - next[i]), 0);
|
|
129
|
+
const shrinkCapacity = shrinking.reduce((total, i)=>total + Math.max(0, next[i] - mins[i]), 0);
|
|
130
|
+
const amount = Math.min(Math.abs(delta), growCapacity, shrinkCapacity);
|
|
131
|
+
if (amount <= 0) return next;
|
|
132
|
+
let toGrow = amount;
|
|
133
|
+
for (const i of growing){
|
|
134
|
+
const step = Math.min(toGrow, Math.max(0, maxs[i] - next[i]));
|
|
135
|
+
next[i] += step;
|
|
136
|
+
toGrow -= step;
|
|
137
|
+
if (toGrow <= EPSILON) break;
|
|
138
|
+
}
|
|
139
|
+
let toShrink = amount;
|
|
140
|
+
for (const i of shrinking){
|
|
141
|
+
const step = Math.min(toShrink, Math.max(0, next[i] - mins[i]));
|
|
142
|
+
next[i] -= step;
|
|
143
|
+
toShrink -= step;
|
|
144
|
+
if (toShrink <= EPSILON) break;
|
|
145
|
+
}
|
|
146
|
+
return next.map(round);
|
|
147
|
+
}
|
|
@@ -1 +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,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC"}
|
|
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,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC"}
|
package/dist/workbench/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ToolWindowAnchor } from '@egen-civitas/esm-extensions';
|
|
3
|
+
import { type CompartmentItem } from './compartments.js';
|
|
4
|
+
import { type SideAnchor } from './workbench.store.js';
|
|
3
5
|
interface SplitterProps {
|
|
4
6
|
anchor: ToolWindowAnchor;
|
|
5
7
|
/** Libellé accessible de la poignée. */
|
|
@@ -27,5 +29,21 @@ interface CornerSplitterProps {
|
|
|
27
29
|
* disponibles (souris et clavier) ; l'angle est donc un raccourci pointeur, masqué aux lecteurs d'écran.
|
|
28
30
|
*/
|
|
29
31
|
export declare function CornerSplitter({ side, label }: CornerSplitterProps): React.JSX.Element;
|
|
32
|
+
interface CompartmentSplitterProps {
|
|
33
|
+
anchor: SideAnchor;
|
|
34
|
+
/** Rang de la frontière : celle qui sépare le compartiment `index` du suivant. */
|
|
35
|
+
index: number;
|
|
36
|
+
/** Compartiments affichés dans la zone, dans l'ordre. */
|
|
37
|
+
items: readonly CompartmentItem[];
|
|
38
|
+
/** Hauteurs courantes (%) des compartiments. */
|
|
39
|
+
heights: readonly number[];
|
|
40
|
+
label: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Poignée entre deux compartiments empilés d'une zone latérale : glisser (souris/doigt) ou flèches haut/bas
|
|
44
|
+
* déplacent la frontière ; les autres compartiments s'ajustent selon leurs minimum et maximum, la somme restant
|
|
45
|
+
* à 100 % de la zone. Double-clic : hauteurs de base. Elle occupe l'écart entre les deux cartes.
|
|
46
|
+
*/
|
|
47
|
+
export declare function CompartmentSplitter({ anchor, index, items, heights, label }: CompartmentSplitterProps): React.JSX.Element;
|
|
30
48
|
export {};
|
|
31
49
|
//# sourceMappingURL=splitter.component.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAErE,OAAO,EAAoD,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAM9B,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;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnC,UAAU,mBAAmB;IAC3B,qEAAqE;IACrE,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,mBAAmB,qBA+ClE;AAOD,UAAU,wBAAwB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,gDAAgD;IAChD,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,qBAyDrG"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import { useStore } from "@egen-civitas/esm-react-utils";
|
|
4
|
-
import {
|
|
4
|
+
import { fitCompartmentHeights, resizeCompartmentBoundary } from "./compartments.js";
|
|
5
|
+
import { clampZoneSize, resetZoneSize, setCompartmentHeights, setZoneSize, workbenchStore } from "./workbench.store.js";
|
|
5
6
|
import styles from "./workbench.module.scss";
|
|
6
7
|
const KEYBOARD_STEP = 16;
|
|
7
8
|
const RESIZING_ATTRIBUTE = 'data-workbench-resizing';
|
|
@@ -131,3 +132,69 @@ const RESIZING_ATTRIBUTE = 'data-workbench-resizing';
|
|
|
131
132
|
onDoubleClick: reset
|
|
132
133
|
});
|
|
133
134
|
}
|
|
135
|
+
const COMPARTMENT_KEYBOARD_STEP = 5; // points de pourcentage
|
|
136
|
+
const toRecord = (items, heights)=>Object.fromEntries(items.map((item, i)=>[
|
|
137
|
+
item.key,
|
|
138
|
+
heights[i]
|
|
139
|
+
]));
|
|
140
|
+
/**
|
|
141
|
+
* Poignée entre deux compartiments empilés d'une zone latérale : glisser (souris/doigt) ou flèches haut/bas
|
|
142
|
+
* déplacent la frontière ; les autres compartiments s'ajustent selon leurs minimum et maximum, la somme restant
|
|
143
|
+
* à 100 % de la zone. Double-clic : hauteurs de base. Elle occupe l'écart entre les deux cartes.
|
|
144
|
+
*/ export function CompartmentSplitter({ anchor, index, items, heights, label }) {
|
|
145
|
+
const start = useRef(null);
|
|
146
|
+
const onPointerDown = (event)=>{
|
|
147
|
+
if (event.button !== 0) return;
|
|
148
|
+
const zone = event.currentTarget.parentElement;
|
|
149
|
+
if (!zone) return;
|
|
150
|
+
// Hauteur répartie entre les compartiments = hauteur de la zone moins les écarts (poignées).
|
|
151
|
+
const gap = event.currentTarget.getBoundingClientRect().height;
|
|
152
|
+
const available = zone.getBoundingClientRect().height - gap * (items.length - 1);
|
|
153
|
+
if (!(available > 0)) return;
|
|
154
|
+
start.current = {
|
|
155
|
+
y: event.clientY,
|
|
156
|
+
heights: [
|
|
157
|
+
...heights
|
|
158
|
+
],
|
|
159
|
+
perPixel: 100 / available
|
|
160
|
+
};
|
|
161
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
162
|
+
document.documentElement.setAttribute(RESIZING_ATTRIBUTE, `compartment-${anchor}`);
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
};
|
|
165
|
+
const onPointerMove = (event)=>{
|
|
166
|
+
const origin = start.current;
|
|
167
|
+
if (!origin) return;
|
|
168
|
+
const delta = (event.clientY - origin.y) * origin.perPixel;
|
|
169
|
+
setCompartmentHeights(toRecord(items, resizeCompartmentBoundary(origin.heights, items, index, delta)));
|
|
170
|
+
};
|
|
171
|
+
const stopDragging = (event)=>{
|
|
172
|
+
if (!start.current) return;
|
|
173
|
+
start.current = null;
|
|
174
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
175
|
+
document.documentElement.removeAttribute(RESIZING_ATTRIBUTE);
|
|
176
|
+
};
|
|
177
|
+
const onKeyDown = (event)=>{
|
|
178
|
+
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;
|
|
179
|
+
const delta = event.key === 'ArrowDown' ? COMPARTMENT_KEYBOARD_STEP : -COMPARTMENT_KEYBOARD_STEP;
|
|
180
|
+
setCompartmentHeights(toRecord(items, resizeCompartmentBoundary(heights, items, index, delta)));
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
};
|
|
183
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
184
|
+
role: "separator",
|
|
185
|
+
tabIndex: 0,
|
|
186
|
+
"aria-label": label,
|
|
187
|
+
"aria-orientation": "horizontal",
|
|
188
|
+
"aria-valuenow": Math.round(heights[index]),
|
|
189
|
+
"aria-valuemin": 0,
|
|
190
|
+
"aria-valuemax": 100,
|
|
191
|
+
"data-compartment-splitter": index,
|
|
192
|
+
className: styles.compartmentSplitter,
|
|
193
|
+
onPointerDown: onPointerDown,
|
|
194
|
+
onPointerMove: onPointerMove,
|
|
195
|
+
onPointerUp: stopDragging,
|
|
196
|
+
onPointerCancel: stopDragging,
|
|
197
|
+
onDoubleClick: ()=>setCompartmentHeights(toRecord(items, fitCompartmentHeights(items, {}))),
|
|
198
|
+
onKeyDown: onKeyDown
|
|
199
|
+
});
|
|
200
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
/** Attribut posé sur le conteneur (compartiment) qui affiche une fenêtre d'outils ; son en-tête s'y trouve. */
|
|
3
|
+
export declare const TOOL_WINDOW_CONTAINER_ATTRIBUTE = "data-tool-window-container";
|
|
2
4
|
/** Attribut de l'emplacement d'en-tête d'une zone (entre le titre et le bouton de fermeture). */
|
|
3
5
|
export declare const TOOL_WINDOW_HEADER_ATTRIBUTE = "data-tool-window-header";
|
|
4
6
|
export interface ToolWindowHeaderProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-window-header.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-header.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjF,iGAAiG;AACjG,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"tool-window-header.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-header.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjF,+GAA+G;AAC/G,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAE5E,iGAAiG;AACjG,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBAiBnE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
+
/** Attribut posé sur le conteneur (compartiment) qui affiche une fenêtre d'outils ; son en-tête s'y trouve. */ export const TOOL_WINDOW_CONTAINER_ATTRIBUTE = 'data-tool-window-container';
|
|
4
5
|
/** Attribut de l'emplacement d'en-tête d'une zone (entre le titre et le bouton de fermeture). */ export const TOOL_WINDOW_HEADER_ATTRIBUTE = 'data-tool-window-header';
|
|
5
6
|
/**
|
|
6
7
|
* Place `children` dans l'en-tête de la zone qui affiche la fenêtre d'outils, à droite du titre et à
|
|
@@ -14,7 +15,8 @@ import { createPortal } from "react-dom";
|
|
|
14
15
|
// undefined : pas encore résolu · null : hors zone (rendu sur place) · élément : emplacement de la zone.
|
|
15
16
|
const [slot, setSlot] = useState(undefined);
|
|
16
17
|
useLayoutEffect(()=>{
|
|
17
|
-
|
|
18
|
+
// Compartiment de la fenêtre (une zone latérale peut en empiler plusieurs) ; à défaut, la zone elle-même.
|
|
19
|
+
const zone = markerRef.current?.closest(`[${TOOL_WINDOW_CONTAINER_ATTRIBUTE}], aside[data-anchor]`);
|
|
18
20
|
setSlot(zone?.querySelector(`[${TOOL_WINDOW_HEADER_ATTRIBUTE}]`) ?? null);
|
|
19
21
|
}, []);
|
|
20
22
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-window-rail.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-rail.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-window-rail.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-rail.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAmFlD;;;GAGG;AACH,wBAAgB,QAAQ,sBAQvB;AAED,6GAA6G;AAC7G,wBAAgB,SAAS,sBAQxB"}
|
|
@@ -4,14 +4,15 @@ import { isSafeToolWindowIconUrl } from "@egen-civitas/esm-extensions";
|
|
|
4
4
|
import { useStore } from "@egen-civitas/esm-react-utils";
|
|
5
5
|
import { resolveWorkbenchIcon } from "./workbench-icons.js";
|
|
6
6
|
import { toolWindowTitle, useToolWindows } from "./use-tool-windows.js";
|
|
7
|
-
import { toggleToolWindow, workbenchStore } from "./workbench.store.js";
|
|
7
|
+
import { getOpenCompartments, toggleCompartment, toggleToolWindow, workbenchStore } from "./workbench.store.js";
|
|
8
8
|
import { formatToolWindowBadge, workbenchBadgeStore } from "./workbench-badges.js";
|
|
9
9
|
import styles from "./workbench.module.scss";
|
|
10
10
|
function RailGroup({ anchor, label, rail }) {
|
|
11
11
|
const tools = useToolWindows(anchor, rail);
|
|
12
12
|
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
13
|
-
const
|
|
14
|
-
const activeId = active[anchor];
|
|
13
|
+
const state = useStore(workbenchStore);
|
|
14
|
+
const activeId = state.active[anchor];
|
|
15
|
+
const openOwn = getOpenCompartments(anchor, state);
|
|
15
16
|
if (tools.length === 0) return null;
|
|
16
17
|
return /*#__PURE__*/ _jsx("div", {
|
|
17
18
|
role: "group",
|
|
@@ -20,8 +21,9 @@ function RailGroup({ anchor, label, rail }) {
|
|
|
20
21
|
className: `${styles.railGroup} egen-anim-stagger egen-anim-stagger--fade`,
|
|
21
22
|
children: tools.map((tool)=>/*#__PURE__*/ _jsx(RailButton, {
|
|
22
23
|
tool: tool,
|
|
23
|
-
active: tool.id === activeId,
|
|
24
|
-
onClick: ()
|
|
24
|
+
active: tool.compartment ? openOwn.includes(tool.id) : tool.id === activeId,
|
|
25
|
+
onClick: ()=>// Compartiment propre : s'ouvre/se ferme sans toucher au compartiment par défaut de la zone.
|
|
26
|
+
tool.compartment ? toggleCompartment(anchor, tool.id) : toggleToolWindow(anchor, tool.id)
|
|
25
27
|
}, tool.id))
|
|
26
28
|
});
|
|
27
29
|
}
|
|
@@ -4,10 +4,17 @@ interface ToolWindowZoneProps {
|
|
|
4
4
|
anchor: ToolWindowAnchor;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Zone redimensionnable (gauche, droite ou bas) :
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Zone redimensionnable (gauche, droite ou bas) : empile les compartiments qui affichent les fenêtres d'outils
|
|
8
|
+
* des rails, chacun sous son en-tête (titre + fermeture).
|
|
9
|
+
*
|
|
10
|
+
* - Le **compartiment par défaut** affiche la fenêtre d'outils active du rail (une seule à la fois).
|
|
11
|
+
* - Les fenêtres dont `meta.compartment` est un objet ont chacune **leur compartiment propre**, ouvert à côté
|
|
12
|
+
* du compartiment par défaut (zones gauche et droite uniquement).
|
|
13
|
+
*
|
|
14
|
+
* Les hauteurs des compartiments totalisent toujours 100 % de la zone (aucun débordement) ; chacun défile en
|
|
15
|
+
* interne et se redimensionne face à ses voisins. La zone elle-même est transparente : le fond sombre est
|
|
16
|
+
* porté par les compartiments. Repliée (taille 0) tant qu'aucune fenêtre d'outils valide n'est ouverte : une
|
|
17
|
+
* fenêtre dont l'app n'est plus montée replie donc la zone toute seule.
|
|
11
18
|
*/
|
|
12
19
|
export declare function ToolWindowZone({ anchor }: ToolWindowZoneProps): React.JSX.Element;
|
|
13
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-window-zone.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-zone.component.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-window-zone.component.d.ts","sourceRoot":"","sources":["../../src/workbench/tool-window-zone.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkG,MAAM,OAAO,CAAC;AACvH,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAqDxF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,qBA2H7D"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import React, { Fragment, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { TOOL_WINDOW_SLOTS } from "@egen-civitas/esm-extensions";
|
|
4
4
|
import { ComponentContext, ExtensionSlot, useStore } from "@egen-civitas/esm-react-utils";
|
|
5
5
|
import { X } from "lucide-react";
|
|
6
|
-
import { CornerSplitter, Splitter } from "./splitter.component.js";
|
|
7
|
-
import { TOOL_WINDOW_HEADER_ATTRIBUTE } from "./tool-window-header.component.js";
|
|
6
|
+
import { CompartmentSplitter, CornerSplitter, Splitter } from "./splitter.component.js";
|
|
7
|
+
import { TOOL_WINDOW_CONTAINER_ATTRIBUTE, TOOL_WINDOW_HEADER_ATTRIBUTE } from "./tool-window-header.component.js";
|
|
8
8
|
import { toolWindowTitle, useToolWindows } from "./use-tool-windows.js";
|
|
9
|
-
import {
|
|
9
|
+
import { DEFAULT_COMPARTMENT_ID, DEFAULT_COMPARTMENT_LIMITS, fitCompartmentHeights } from "./compartments.js";
|
|
10
|
+
import { closeToolWindow, compartmentKey, getOpenCompartments, setCompartmentHeights, workbenchStore } from "./workbench.store.js";
|
|
10
11
|
import styles from "./workbench.module.scss";
|
|
11
12
|
/**
|
|
12
13
|
* Contexte de composant des zones. Le shell monte chaque zone dans un `createRoot` autonome, hors de tout
|
|
@@ -33,27 +34,59 @@ const EXIT_CLASS = {
|
|
|
33
34
|
bottom: 'egen-anim-slide-out-to-bottom'
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
|
-
* Zone redimensionnable (gauche, droite ou bas) :
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Zone redimensionnable (gauche, droite ou bas) : empile les compartiments qui affichent les fenêtres d'outils
|
|
38
|
+
* des rails, chacun sous son en-tête (titre + fermeture).
|
|
39
|
+
*
|
|
40
|
+
* - Le **compartiment par défaut** affiche la fenêtre d'outils active du rail (une seule à la fois).
|
|
41
|
+
* - Les fenêtres dont `meta.compartment` est un objet ont chacune **leur compartiment propre**, ouvert à côté
|
|
42
|
+
* du compartiment par défaut (zones gauche et droite uniquement).
|
|
43
|
+
*
|
|
44
|
+
* Les hauteurs des compartiments totalisent toujours 100 % de la zone (aucun débordement) ; chacun défile en
|
|
45
|
+
* interne et se redimensionne face à ses voisins. La zone elle-même est transparente : le fond sombre est
|
|
46
|
+
* porté par les compartiments. Repliée (taille 0) tant qu'aucune fenêtre d'outils valide n'est ouverte : une
|
|
47
|
+
* fenêtre dont l'app n'est plus montée replie donc la zone toute seule.
|
|
40
48
|
*/ export function ToolWindowZone({ anchor }) {
|
|
41
49
|
const tools = useToolWindows(anchor);
|
|
42
50
|
// NB : `useStore` retourne toujours un objet (état étalé) : on lit l'état entier, jamais une valeur primitive.
|
|
43
|
-
const
|
|
51
|
+
const state = useStore(workbenchStore);
|
|
52
|
+
const { active, sizes } = state;
|
|
44
53
|
const activeId = active[anchor];
|
|
45
54
|
const size = sizes[anchor];
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
55
|
+
const side = anchor === 'bottom' ? null : anchor;
|
|
56
|
+
// Compartiments à afficher : le défaut (fenêtre active du rail) puis les propres, dans l'ordre d'ouverture.
|
|
57
|
+
const compartments = [];
|
|
58
|
+
const currentDefault = tools.find((tool)=>!tool.compartment && tool.id === activeId);
|
|
59
|
+
if (currentDefault) {
|
|
60
|
+
compartments.push({
|
|
61
|
+
tool: currentDefault,
|
|
62
|
+
item: {
|
|
63
|
+
key: compartmentKey(side ?? 'left'),
|
|
64
|
+
...DEFAULT_COMPARTMENT_LIMITS
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (side) {
|
|
69
|
+
for (const id of getOpenCompartments(side, state)){
|
|
70
|
+
const tool = tools.find((candidate)=>candidate.id === id && candidate.compartment);
|
|
71
|
+
if (tool?.compartment) compartments.push({
|
|
72
|
+
tool,
|
|
73
|
+
item: {
|
|
74
|
+
key: compartmentKey(side, id),
|
|
75
|
+
...tool.compartment
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const targetOpen = compartments.length > 0;
|
|
81
|
+
// La zone reste montée le temps de l'animation de fermeture : on garde les derniers compartiments affichés.
|
|
82
|
+
const lastRef = useRef([]);
|
|
50
83
|
const wasOpenRef = useRef(false);
|
|
51
84
|
const [phase, setPhase] = useState('open');
|
|
52
|
-
if (
|
|
53
|
-
lastRef.current =
|
|
85
|
+
if (targetOpen) {
|
|
86
|
+
lastRef.current = compartments;
|
|
54
87
|
}
|
|
55
|
-
const displayed =
|
|
56
|
-
const open =
|
|
88
|
+
const displayed = targetOpen ? compartments : phase === 'closing' ? lastRef.current : [];
|
|
89
|
+
const open = displayed.length > 0;
|
|
57
90
|
useLayoutEffect(()=>{
|
|
58
91
|
if (targetOpen === wasOpenRef.current) {
|
|
59
92
|
return;
|
|
@@ -62,7 +95,7 @@ const EXIT_CLASS = {
|
|
|
62
95
|
setPhase(targetOpen ? 'opening' : 'closing');
|
|
63
96
|
const timer = window.setTimeout(()=>{
|
|
64
97
|
if (!targetOpen) {
|
|
65
|
-
lastRef.current =
|
|
98
|
+
lastRef.current = [];
|
|
66
99
|
}
|
|
67
100
|
setPhase('open');
|
|
68
101
|
}, MOTION_MS);
|
|
@@ -83,18 +116,30 @@ const EXIT_CLASS = {
|
|
|
83
116
|
}, [
|
|
84
117
|
anchor
|
|
85
118
|
]);
|
|
86
|
-
//
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
119
|
+
// Hauteurs (%) des compartiments : somme de 100, bornes respectées ; mémorisées dès qu'il y en a plusieurs.
|
|
120
|
+
const items = displayed.map(({ item })=>item);
|
|
121
|
+
const heights = fitCompartmentHeights(items, state.heights ?? {});
|
|
122
|
+
const heightsSignature = items.map((item, i)=>`${item.key}=${heights[i]}`).join('|');
|
|
123
|
+
useEffect(()=>{
|
|
124
|
+
if (!targetOpen || items.length < 2) return;
|
|
125
|
+
setCompartmentHeights(Object.fromEntries(items.map((item, i)=>[
|
|
126
|
+
item.key,
|
|
127
|
+
heights[i]
|
|
128
|
+
])));
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- la signature résume `items` et `heights`
|
|
130
|
+
}, [
|
|
131
|
+
targetOpen,
|
|
132
|
+
heightsSignature
|
|
90
133
|
]);
|
|
91
|
-
const title = displayed ? toolWindowTitle(displayed) : '';
|
|
134
|
+
const title = displayed[0] ? toolWindowTitle(displayed[0].tool) : '';
|
|
92
135
|
const motionClass = phase === 'closing' ? EXIT_CLASS[anchor] : phase === 'opening' ? ENTER_CLASS[anchor] : '';
|
|
136
|
+
const settled = phase !== 'closing';
|
|
93
137
|
return /*#__PURE__*/ _jsx("aside", {
|
|
94
138
|
"data-testid": `workbench-zone-${anchor}`,
|
|
95
139
|
"data-anchor": anchor,
|
|
96
140
|
"data-open": targetOpen,
|
|
97
141
|
"data-phase": phase,
|
|
142
|
+
"data-compartments": displayed.length,
|
|
98
143
|
"aria-label": title || undefined,
|
|
99
144
|
hidden: !open,
|
|
100
145
|
style: {
|
|
@@ -103,41 +148,28 @@ const EXIT_CLASS = {
|
|
|
103
148
|
className: `${styles.zone} ${styles[`zone-${anchor}`]} ${motionClass}`,
|
|
104
149
|
children: open && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
105
150
|
children: [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"aria-hidden": "true"
|
|
151
|
+
displayed.map(({ tool, item }, index)=>/*#__PURE__*/ _jsxs(Fragment, {
|
|
152
|
+
children: [
|
|
153
|
+
index > 0 && settled && side && /*#__PURE__*/ _jsx(CompartmentSplitter, {
|
|
154
|
+
anchor: side,
|
|
155
|
+
index: index - 1,
|
|
156
|
+
items: items,
|
|
157
|
+
heights: heights,
|
|
158
|
+
label: `Redimensionner ${toolWindowTitle(displayed[index - 1].tool)} et ${toolWindowTitle(tool)}`
|
|
159
|
+
}),
|
|
160
|
+
index > 0 && !(settled && side) && /*#__PURE__*/ _jsx("span", {
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
className: styles.compartmentGap
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ _jsx(Compartment, {
|
|
165
|
+
anchor: anchor,
|
|
166
|
+
tool: tool,
|
|
167
|
+
height: heights[index],
|
|
168
|
+
own: item.key !== compartmentKey(side ?? 'left'),
|
|
169
|
+
single: displayed.length === 1
|
|
126
170
|
})
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}),
|
|
130
|
-
/*#__PURE__*/ _jsx("div", {
|
|
131
|
-
className: `${styles.zoneBody} egen-anim-fade-in`,
|
|
132
|
-
children: /*#__PURE__*/ _jsx(ComponentContext.Provider, {
|
|
133
|
-
value: ZONE_CONTEXT,
|
|
134
|
-
children: /*#__PURE__*/ _jsx(ExtensionSlot, {
|
|
135
|
-
name: TOOL_WINDOW_SLOTS[anchor],
|
|
136
|
-
select: selectActive,
|
|
137
|
-
className: styles.zoneSlot
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
}, displayedId),
|
|
171
|
+
]
|
|
172
|
+
}, item.key)),
|
|
141
173
|
phase !== 'closing' && /*#__PURE__*/ _jsx(Splitter, {
|
|
142
174
|
anchor: anchor,
|
|
143
175
|
label: `Redimensionner ${title}`
|
|
@@ -154,3 +186,58 @@ const EXIT_CLASS = {
|
|
|
154
186
|
})
|
|
155
187
|
});
|
|
156
188
|
}
|
|
189
|
+
/** Un compartiment : carte sombre arrondie, en-tête (titre, actions, fermeture) et corps qui défile. */ function Compartment({ anchor, tool, height, own, single }) {
|
|
190
|
+
const title = toolWindowTitle(tool);
|
|
191
|
+
const selectTool = useCallback((extensions)=>extensions.filter((extension)=>extension.name === tool.id), [
|
|
192
|
+
tool.id
|
|
193
|
+
]);
|
|
194
|
+
return /*#__PURE__*/ _jsxs("section", {
|
|
195
|
+
"data-testid": `workbench-compartment-${anchor}-${own ? tool.id : DEFAULT_COMPARTMENT_ID}`,
|
|
196
|
+
"data-compartment": own ? 'own' : 'default',
|
|
197
|
+
"data-height": Math.round(height * 100) / 100,
|
|
198
|
+
[TOOL_WINDOW_CONTAINER_ATTRIBUTE]: '',
|
|
199
|
+
// Hauteur proportionnelle (flex-grow = pourcentage, base nulle) : la somme remplit exactement la zone,
|
|
200
|
+
// écarts entre compartiments compris, sans calcul en pixels.
|
|
201
|
+
style: single ? undefined : {
|
|
202
|
+
flex: `${height} 1 0%`
|
|
203
|
+
},
|
|
204
|
+
className: styles.compartment,
|
|
205
|
+
children: [
|
|
206
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
207
|
+
className: styles.zoneHeader,
|
|
208
|
+
children: [
|
|
209
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
210
|
+
className: styles.zoneTitle,
|
|
211
|
+
children: title
|
|
212
|
+
}),
|
|
213
|
+
/*#__PURE__*/ _jsx("div", {
|
|
214
|
+
className: styles.zoneHeaderTools,
|
|
215
|
+
[TOOL_WINDOW_HEADER_ATTRIBUTE]: ''
|
|
216
|
+
}),
|
|
217
|
+
/*#__PURE__*/ _jsx("button", {
|
|
218
|
+
type: "button",
|
|
219
|
+
className: styles.zoneClose,
|
|
220
|
+
"aria-label": `Fermer ${title}`,
|
|
221
|
+
title: `Fermer ${title}`,
|
|
222
|
+
onClick: ()=>closeToolWindow(anchor, tool.id),
|
|
223
|
+
children: /*#__PURE__*/ _jsx(X, {
|
|
224
|
+
size: 14,
|
|
225
|
+
"aria-hidden": "true"
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
/*#__PURE__*/ _jsx("div", {
|
|
231
|
+
className: `${styles.zoneBody} egen-anim-fade-in`,
|
|
232
|
+
children: /*#__PURE__*/ _jsx(ComponentContext.Provider, {
|
|
233
|
+
value: ZONE_CONTEXT,
|
|
234
|
+
children: /*#__PURE__*/ _jsx(ExtensionSlot, {
|
|
235
|
+
name: TOOL_WINDOW_SLOTS[anchor],
|
|
236
|
+
select: selectTool,
|
|
237
|
+
className: styles.zoneSlot
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
}, tool.id)
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
}
|