@sentropic/design-system-svelte 0.34.70 → 0.34.72
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/dist/AppShell.panelCollapse.test.d.ts +2 -0
- package/dist/AppShell.panelCollapse.test.d.ts.map +1 -0
- package/dist/AppShell.panelCollapse.test.js +129 -0
- package/dist/AppShell.panelResize.test.d.ts +2 -0
- package/dist/AppShell.panelResize.test.d.ts.map +1 -0
- package/dist/AppShell.panelResize.test.js +338 -0
- package/dist/AppShell.svelte +488 -7
- package/dist/AppShell.svelte.d.ts +33 -0
- package/dist/AppShell.svelte.d.ts.map +1 -1
- package/dist/TimeRangePicker.svelte +618 -0
- package/dist/TimeRangePicker.svelte.d.ts +36 -0
- package/dist/TimeRangePicker.svelte.d.ts.map +1 -0
- package/dist/TimeRangePicker.test.d.ts +2 -0
- package/dist/TimeRangePicker.test.d.ts.map +1 -0
- package/dist/TimeRangePicker.test.js +482 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/timeRange.d.ts +75 -0
- package/dist/timeRange.d.ts.map +1 -0
- package/dist/timeRange.js +198 -0
- package/package.json +1 -1
package/dist/AppShell.svelte
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export type AppShellVariant = "site" | "workspace";
|
|
6
6
|
export type AppShellUtilityMode = "reserve" | "overlay" | "floating";
|
|
7
7
|
export type AppShellUtilitySide = "left" | "right" | "bottom";
|
|
8
|
+
export type AppShellPanelCollapse = "stack" | "accordion";
|
|
9
|
+
export type AppShellPanelKey = "navigationPanel" | "contextPanel" | "utilityPanel";
|
|
8
10
|
|
|
9
11
|
export type AppShellProps = {
|
|
10
12
|
variant?: AppShellVariant;
|
|
@@ -23,6 +25,37 @@
|
|
|
23
25
|
utilityLabel?: string;
|
|
24
26
|
utilityMode?: AppShellUtilityMode;
|
|
25
27
|
utilitySide?: AppShellUtilitySide;
|
|
28
|
+
/**
|
|
29
|
+
* Below the 48rem breakpoint, `"stack"` (default) keeps today's behaviour —
|
|
30
|
+
* panels stack full-width in document order, always expanded. `"accordion"`
|
|
31
|
+
* degrades each present panel to a keyboard-accessible disclosure (collapsed
|
|
32
|
+
* by default) instead of squeezing the main content. Desktop (>48rem)
|
|
33
|
+
* rendering is IDENTICAL in both modes — side panels stay side-by-side
|
|
34
|
+
* columns. Panel content is mounted once regardless of mode/breakpoint;
|
|
35
|
+
* collapsing hides/sizes the region rather than destroying it, so stateful
|
|
36
|
+
* widgets (maps, live panels…) mounted in a panel never remount.
|
|
37
|
+
*/
|
|
38
|
+
panelCollapse?: AppShellPanelCollapse;
|
|
39
|
+
/** Disclosure label for `primaryRail` when `panelCollapse="accordion"`. */
|
|
40
|
+
primaryRailLabel?: string;
|
|
41
|
+
/** Disclosure label for `navigationPanel` when `panelCollapse="accordion"`. Defaults to `navigationLabel`. */
|
|
42
|
+
navigationPanelLabel?: string;
|
|
43
|
+
/** Disclosure label for `contextPanel` when `panelCollapse="accordion"`. Defaults to `contextLabel`. */
|
|
44
|
+
contextPanelLabel?: string;
|
|
45
|
+
/** Disclosure label for `utilityPanel` when `panelCollapse="accordion"`. Defaults to `utilityLabel`. */
|
|
46
|
+
utilityPanelLabel?: string;
|
|
47
|
+
/** Enables drag-to-resize handles on side panels above 48rem. Default false — zero regression. */
|
|
48
|
+
panelResize?: boolean;
|
|
49
|
+
/** Controlled panel widths in px. When provided the component never mutates width itself. */
|
|
50
|
+
panelWidths?: Partial<Record<AppShellPanelKey, number>>;
|
|
51
|
+
/** Seeds uncontrolled widths in px. */
|
|
52
|
+
defaultPanelWidths?: Partial<Record<AppShellPanelKey, number>>;
|
|
53
|
+
/** Fired on every committed resize. Persistence is the CONSUMER's job — the DS stays presentational. */
|
|
54
|
+
onPanelResize?: (key: AppShellPanelKey, width: number) => void;
|
|
55
|
+
/** Lower clamp in px. Default 180. */
|
|
56
|
+
panelMinWidth?: number;
|
|
57
|
+
/** Upper clamp in px. Default 640. */
|
|
58
|
+
panelMaxWidth?: number;
|
|
26
59
|
class?: string;
|
|
27
60
|
};
|
|
28
61
|
</script>
|
|
@@ -33,6 +66,7 @@
|
|
|
33
66
|
// identité = DS IdentityMenu ; barre = DS Header. Le look vient donc des tokens DS
|
|
34
67
|
// (--st-component-control-*) → pixel-cohérent avec le header de référence, et les
|
|
35
68
|
// menus sont ceux du DS (fonctionnels). Piloté par `siteConfig`.
|
|
69
|
+
import { untrack } from "svelte";
|
|
36
70
|
import Header from "./Header.svelte";
|
|
37
71
|
import Button from "./Button.svelte";
|
|
38
72
|
import IconButton from "./IconButton.svelte";
|
|
@@ -41,6 +75,31 @@
|
|
|
41
75
|
import { Boxes, ChevronDown, Globe, Moon, Palette, Search as SearchIcon, Sun } from "@lucide/svelte";
|
|
42
76
|
import IdentityButton from "./IdentityButton.svelte";
|
|
43
77
|
|
|
78
|
+
// CSS custom property each resizable panel is sized by (see the
|
|
79
|
+
// `.st-appShell` base rule in the style block below) — setting it inline
|
|
80
|
+
// on the shell root is the intended resize mechanism, it simply
|
|
81
|
+
// out-specificities the token-driven default declared there.
|
|
82
|
+
const PANEL_VAR: Record<AppShellPanelKey, string> = {
|
|
83
|
+
navigationPanel: "--st-appShell-navigation-width",
|
|
84
|
+
contextPanel: "--st-appShell-context-width",
|
|
85
|
+
utilityPanel: "--st-appShell-utility-width",
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Nominal px equivalent of each panel's own CSS-token default (navigation
|
|
89
|
+
// 20rem, context 22rem, utility 24rem, all at a 16px root) — used ONLY as a
|
|
90
|
+
// display/ARIA fallback (aria-valuenow, drag-start anchor) before any width
|
|
91
|
+
// has ever been supplied or committed. Never written back as an inline
|
|
92
|
+
// style, so a themed override of the underlying token is never fought
|
|
93
|
+
// until the consumer/user actually establishes a concrete width.
|
|
94
|
+
// NOTE: `primaryRail` is intentionally NOT a resizable panel — it is a
|
|
95
|
+
// fixed-width icon rail (à la VS Code's activity bar), not a splittable
|
|
96
|
+
// pane; see `AppShellPanelKey` above.
|
|
97
|
+
const PANEL_NOMINAL_PX: Record<AppShellPanelKey, number> = {
|
|
98
|
+
navigationPanel: 320,
|
|
99
|
+
contextPanel: 352,
|
|
100
|
+
utilityPanel: 384,
|
|
101
|
+
};
|
|
102
|
+
|
|
44
103
|
let {
|
|
45
104
|
variant,
|
|
46
105
|
config,
|
|
@@ -58,9 +117,153 @@
|
|
|
58
117
|
utilityLabel = "Utility panel",
|
|
59
118
|
utilityMode = "reserve",
|
|
60
119
|
utilitySide = "right",
|
|
120
|
+
panelCollapse = "stack",
|
|
121
|
+
primaryRailLabel = "Primary rail",
|
|
122
|
+
navigationPanelLabel,
|
|
123
|
+
contextPanelLabel,
|
|
124
|
+
utilityPanelLabel,
|
|
125
|
+
panelResize = false,
|
|
126
|
+
panelWidths,
|
|
127
|
+
defaultPanelWidths,
|
|
128
|
+
onPanelResize,
|
|
129
|
+
panelMinWidth = 180,
|
|
130
|
+
panelMaxWidth = 640,
|
|
61
131
|
class: className
|
|
62
132
|
}: AppShellProps = $props();
|
|
63
133
|
|
|
134
|
+
// Resolved disclosure labels: default to the existing aria-label props so a
|
|
135
|
+
// consumer who already customized navigationLabel/contextLabel/utilityLabel
|
|
136
|
+
// doesn't need to duplicate the translation for the accordion trigger text.
|
|
137
|
+
const navigationPanelLabelResolved = $derived(navigationPanelLabel ?? navigationLabel);
|
|
138
|
+
const contextPanelLabelResolved = $derived(contextPanelLabel ?? contextLabel);
|
|
139
|
+
const utilityPanelLabelResolved = $derived(utilityPanelLabel ?? utilityLabel);
|
|
140
|
+
|
|
141
|
+
// Uncontrolled per-panel disclosure state (v1) — each accordion panel starts
|
|
142
|
+
// collapsed. Desktop rendering never reads these (CSS scopes the collapse to
|
|
143
|
+
// `@media (max-width: 48rem)`), so they have zero effect above the breakpoint.
|
|
144
|
+
let primaryRailPanelOpen = $state(false);
|
|
145
|
+
let navigationPanelOpen = $state(false);
|
|
146
|
+
let contextPanelOpen = $state(false);
|
|
147
|
+
let utilityPanelOpen = $state(false);
|
|
148
|
+
|
|
149
|
+
// ── Resizable panels (panelResize) ────────────────────────────────────────
|
|
150
|
+
// Controlled/uncontrolled mirrors RangeSlider.svelte: `panelWidths` present
|
|
151
|
+
// (even as `{}`) means controlled — the component reads it but never writes
|
|
152
|
+
// it; otherwise widths live in `internalWidths`, seeded once from
|
|
153
|
+
// `defaultPanelWidths`.
|
|
154
|
+
let internalWidths = $state<Partial<Record<AppShellPanelKey, number>>>(untrack(() => ({ ...defaultPanelWidths })));
|
|
155
|
+
|
|
156
|
+
let navigationPanelEl = $state<HTMLElement | null>(null);
|
|
157
|
+
let contextPanelEl = $state<HTMLElement | null>(null);
|
|
158
|
+
let utilityPanelEl = $state<HTMLElement | null>(null);
|
|
159
|
+
|
|
160
|
+
const isWidthControlled = $derived(panelWidths !== undefined);
|
|
161
|
+
|
|
162
|
+
// `utilityPanel` mirrors a left panel (grow-on-drag-right) unless it sits on
|
|
163
|
+
// the right edge; the "bottom" side never renders a handle at all (checked
|
|
164
|
+
// at the call sites), so its `positive` value is never read.
|
|
165
|
+
const utilityPositive = $derived(utilitySide !== "right");
|
|
166
|
+
|
|
167
|
+
function widthFor(key: AppShellPanelKey): number | undefined {
|
|
168
|
+
const source = isWidthControlled ? panelWidths : internalWidths;
|
|
169
|
+
return source?.[key];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function clampWidth(n: number): number {
|
|
173
|
+
return Math.min(Math.max(n, panelMinWidth), panelMaxWidth);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Current width for rendering/ARIA — always a concrete, clamped number so
|
|
177
|
+
// aria-valuenow is never NaN and is always within [aria-valuemin, aria-valuemax].
|
|
178
|
+
function displayWidth(key: AppShellPanelKey): number {
|
|
179
|
+
return clampWidth(widthFor(key) ?? PANEL_NOMINAL_PX[key]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function panelElFor(key: AppShellPanelKey): HTMLElement | null {
|
|
183
|
+
if (key === "navigationPanel") return navigationPanelEl;
|
|
184
|
+
if (key === "contextPanel") return contextPanelEl;
|
|
185
|
+
return utilityPanelEl;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Only the CSS vars for panels with an explicit (controlled or committed)
|
|
189
|
+
// width are emitted — an untouched panel keeps deferring to its token
|
|
190
|
+
// default (`.st-appShell` base rule), so a theme's own width override is
|
|
191
|
+
// never silently overridden just because `panelResize` is on.
|
|
192
|
+
const panelStyle = $derived.by(() => {
|
|
193
|
+
if (!panelResize) return undefined;
|
|
194
|
+
const parts: string[] = [];
|
|
195
|
+
for (const key of Object.keys(PANEL_VAR) as AppShellPanelKey[]) {
|
|
196
|
+
const width = widthFor(key);
|
|
197
|
+
if (width !== undefined) parts.push(`${PANEL_VAR[key]}: ${clampWidth(width)}px`);
|
|
198
|
+
}
|
|
199
|
+
return parts.length ? parts.join("; ") : undefined;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
function commitWidth(key: AppShellPanelKey, next: number) {
|
|
203
|
+
const clamped = clampWidth(next);
|
|
204
|
+
if (!isWidthControlled) internalWidths = { ...internalWidths, [key]: clamped };
|
|
205
|
+
onPanelResize?.(key, clamped);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Pointer-drag bookkeeping — plain (non-reactive) fields, never read from
|
|
209
|
+
// the template, only from the pointer handlers below.
|
|
210
|
+
let dragKey: AppShellPanelKey | null = null;
|
|
211
|
+
let dragPositive = true;
|
|
212
|
+
let dragStartX = 0;
|
|
213
|
+
let dragStartWidth = 0;
|
|
214
|
+
|
|
215
|
+
function onHandlePointerDown(event: PointerEvent, key: AppShellPanelKey, positive: boolean) {
|
|
216
|
+
const handle = event.currentTarget as HTMLElement;
|
|
217
|
+
handle.setPointerCapture?.(event.pointerId);
|
|
218
|
+
dragKey = key;
|
|
219
|
+
dragPositive = positive;
|
|
220
|
+
dragStartX = event.clientX;
|
|
221
|
+
const measured = panelElFor(key)?.getBoundingClientRect().width ?? 0;
|
|
222
|
+
dragStartWidth = measured > 0 ? measured : displayWidth(key);
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function onHandlePointerMove(event: PointerEvent) {
|
|
227
|
+
if (dragKey === null) return;
|
|
228
|
+
const dx = event.clientX - dragStartX;
|
|
229
|
+
const delta = dragPositive ? dx : -dx;
|
|
230
|
+
commitWidth(dragKey, dragStartWidth + delta);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function onHandlePointerUp(event: PointerEvent) {
|
|
234
|
+
if (dragKey === null) return;
|
|
235
|
+
const handle = event.currentTarget as HTMLElement;
|
|
236
|
+
if (handle.hasPointerCapture?.(event.pointerId)) handle.releasePointerCapture?.(event.pointerId);
|
|
237
|
+
dragKey = null;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Arrow keys move the splitter itself (WAI-ARIA window-splitter pattern):
|
|
241
|
+
// for a "positive" (left-edge) panel, moving the splitter right grows it;
|
|
242
|
+
// for a "negative" (right-edge) panel, moving the splitter right shrinks
|
|
243
|
+
// it. Home/End always jump to the absolute clamp bounds.
|
|
244
|
+
function onHandleKeydown(event: KeyboardEvent, key: AppShellPanelKey, positive: boolean) {
|
|
245
|
+
const current = displayWidth(key);
|
|
246
|
+
let next: number;
|
|
247
|
+
switch (event.key) {
|
|
248
|
+
case "ArrowLeft":
|
|
249
|
+
next = current + (positive ? -16 : 16);
|
|
250
|
+
break;
|
|
251
|
+
case "ArrowRight":
|
|
252
|
+
next = current + (positive ? 16 : -16);
|
|
253
|
+
break;
|
|
254
|
+
case "Home":
|
|
255
|
+
next = panelMinWidth;
|
|
256
|
+
break;
|
|
257
|
+
case "End":
|
|
258
|
+
next = panelMaxWidth;
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
commitWidth(key, next);
|
|
265
|
+
}
|
|
266
|
+
|
|
64
267
|
const mode = $derived(variant ?? (config ? "site" : "workspace"));
|
|
65
268
|
const siteConfig = $derived(config ?? ({ brand: { name: "Sentropic" }, nav: [], theming: { themes: [], theme: "" } } as SiteConfig));
|
|
66
269
|
const brand = $derived(siteConfig.brand ?? { name: "Sentropic" });
|
|
@@ -182,6 +385,8 @@
|
|
|
182
385
|
data-st-app-shell-variant="workspace"
|
|
183
386
|
data-utility-mode={utilityMode}
|
|
184
387
|
data-utility-side={utilitySide}
|
|
388
|
+
data-panel-collapse={panelCollapse}
|
|
389
|
+
style={panelStyle}
|
|
185
390
|
>
|
|
186
391
|
{#if topChrome}
|
|
187
392
|
<div class="st-appShell__topChrome">
|
|
@@ -191,12 +396,82 @@
|
|
|
191
396
|
<div class="st-appShell__body">
|
|
192
397
|
{#if primaryRail}
|
|
193
398
|
<aside class="st-appShell__primaryRail" aria-label="Primary rail">
|
|
194
|
-
{
|
|
399
|
+
{#if panelCollapse === "accordion"}
|
|
400
|
+
<button
|
|
401
|
+
type="button"
|
|
402
|
+
class="st-appShell__panelDisclosure"
|
|
403
|
+
aria-expanded={primaryRailPanelOpen}
|
|
404
|
+
aria-controls="st-appShell-primaryRail-region"
|
|
405
|
+
id="st-appShell-primaryRail-trigger"
|
|
406
|
+
onclick={() => (primaryRailPanelOpen = !primaryRailPanelOpen)}
|
|
407
|
+
>
|
|
408
|
+
<span class="st-appShell__panelDisclosureLabel">{primaryRailLabel}</span>
|
|
409
|
+
<span class="st-appShell__panelDisclosureIcon" class:st-appShell__panelDisclosureIcon--expanded={primaryRailPanelOpen}>
|
|
410
|
+
<ChevronDown size={16} aria-hidden="true" />
|
|
411
|
+
</span>
|
|
412
|
+
</button>
|
|
413
|
+
<div
|
|
414
|
+
class="st-appShell__panelRegion"
|
|
415
|
+
class:st-appShell__panelRegion--collapsed={!primaryRailPanelOpen}
|
|
416
|
+
id="st-appShell-primaryRail-region"
|
|
417
|
+
role="region"
|
|
418
|
+
aria-labelledby="st-appShell-primaryRail-trigger"
|
|
419
|
+
>
|
|
420
|
+
{@render primaryRail()}
|
|
421
|
+
</div>
|
|
422
|
+
{:else}
|
|
423
|
+
{@render primaryRail()}
|
|
424
|
+
{/if}
|
|
425
|
+
<!-- No resize handle here: `primaryRail` is a fixed-width icon
|
|
426
|
+
rail (à la VS Code's activity bar), not a resizable panel —
|
|
427
|
+
see `AppShellPanelKey`. -->
|
|
195
428
|
</aside>
|
|
196
429
|
{/if}
|
|
197
430
|
{#if navigationPanel}
|
|
198
|
-
<aside class="st-appShell__navigationPanel" aria-label={navigationLabel}>
|
|
199
|
-
{
|
|
431
|
+
<aside class="st-appShell__navigationPanel" aria-label={navigationLabel} bind:this={navigationPanelEl}>
|
|
432
|
+
{#if panelCollapse === "accordion"}
|
|
433
|
+
<button
|
|
434
|
+
type="button"
|
|
435
|
+
class="st-appShell__panelDisclosure"
|
|
436
|
+
aria-expanded={navigationPanelOpen}
|
|
437
|
+
aria-controls="st-appShell-navigationPanel-region"
|
|
438
|
+
id="st-appShell-navigationPanel-trigger"
|
|
439
|
+
onclick={() => (navigationPanelOpen = !navigationPanelOpen)}
|
|
440
|
+
>
|
|
441
|
+
<span class="st-appShell__panelDisclosureLabel">{navigationPanelLabelResolved}</span>
|
|
442
|
+
<span class="st-appShell__panelDisclosureIcon" class:st-appShell__panelDisclosureIcon--expanded={navigationPanelOpen}>
|
|
443
|
+
<ChevronDown size={16} aria-hidden="true" />
|
|
444
|
+
</span>
|
|
445
|
+
</button>
|
|
446
|
+
<div
|
|
447
|
+
class="st-appShell__panelRegion"
|
|
448
|
+
class:st-appShell__panelRegion--collapsed={!navigationPanelOpen}
|
|
449
|
+
id="st-appShell-navigationPanel-region"
|
|
450
|
+
role="region"
|
|
451
|
+
aria-labelledby="st-appShell-navigationPanel-trigger"
|
|
452
|
+
>
|
|
453
|
+
{@render navigationPanel()}
|
|
454
|
+
</div>
|
|
455
|
+
{:else}
|
|
456
|
+
{@render navigationPanel()}
|
|
457
|
+
{/if}
|
|
458
|
+
{#if panelResize}
|
|
459
|
+
<div
|
|
460
|
+
class="st-appShell__resizeHandle"
|
|
461
|
+
role="separator"
|
|
462
|
+
aria-orientation="vertical"
|
|
463
|
+
tabindex="0"
|
|
464
|
+
aria-valuenow={displayWidth("navigationPanel")}
|
|
465
|
+
aria-valuemin={panelMinWidth}
|
|
466
|
+
aria-valuemax={panelMaxWidth}
|
|
467
|
+
aria-label={`Resize ${navigationLabel}`}
|
|
468
|
+
onpointerdown={(event) => onHandlePointerDown(event, "navigationPanel", true)}
|
|
469
|
+
onpointermove={onHandlePointerMove}
|
|
470
|
+
onpointerup={onHandlePointerUp}
|
|
471
|
+
onpointercancel={onHandlePointerUp}
|
|
472
|
+
onkeydown={(event) => onHandleKeydown(event, "navigationPanel", true)}
|
|
473
|
+
></div>
|
|
474
|
+
{/if}
|
|
200
475
|
</aside>
|
|
201
476
|
{/if}
|
|
202
477
|
<main class="st-appShell__main" id={mainId}>
|
|
@@ -207,13 +482,97 @@
|
|
|
207
482
|
{/if}
|
|
208
483
|
</main>
|
|
209
484
|
{#if contextPanel}
|
|
210
|
-
<aside class="st-appShell__contextPanel" aria-label={contextLabel}>
|
|
211
|
-
{
|
|
485
|
+
<aside class="st-appShell__contextPanel" aria-label={contextLabel} bind:this={contextPanelEl}>
|
|
486
|
+
{#if panelCollapse === "accordion"}
|
|
487
|
+
<button
|
|
488
|
+
type="button"
|
|
489
|
+
class="st-appShell__panelDisclosure"
|
|
490
|
+
aria-expanded={contextPanelOpen}
|
|
491
|
+
aria-controls="st-appShell-contextPanel-region"
|
|
492
|
+
id="st-appShell-contextPanel-trigger"
|
|
493
|
+
onclick={() => (contextPanelOpen = !contextPanelOpen)}
|
|
494
|
+
>
|
|
495
|
+
<span class="st-appShell__panelDisclosureLabel">{contextPanelLabelResolved}</span>
|
|
496
|
+
<span class="st-appShell__panelDisclosureIcon" class:st-appShell__panelDisclosureIcon--expanded={contextPanelOpen}>
|
|
497
|
+
<ChevronDown size={16} aria-hidden="true" />
|
|
498
|
+
</span>
|
|
499
|
+
</button>
|
|
500
|
+
<div
|
|
501
|
+
class="st-appShell__panelRegion"
|
|
502
|
+
class:st-appShell__panelRegion--collapsed={!contextPanelOpen}
|
|
503
|
+
id="st-appShell-contextPanel-region"
|
|
504
|
+
role="region"
|
|
505
|
+
aria-labelledby="st-appShell-contextPanel-trigger"
|
|
506
|
+
>
|
|
507
|
+
{@render contextPanel()}
|
|
508
|
+
</div>
|
|
509
|
+
{:else}
|
|
510
|
+
{@render contextPanel()}
|
|
511
|
+
{/if}
|
|
512
|
+
{#if panelResize}
|
|
513
|
+
<div
|
|
514
|
+
class="st-appShell__resizeHandle"
|
|
515
|
+
role="separator"
|
|
516
|
+
aria-orientation="vertical"
|
|
517
|
+
tabindex="0"
|
|
518
|
+
aria-valuenow={displayWidth("contextPanel")}
|
|
519
|
+
aria-valuemin={panelMinWidth}
|
|
520
|
+
aria-valuemax={panelMaxWidth}
|
|
521
|
+
aria-label={`Resize ${contextLabel}`}
|
|
522
|
+
onpointerdown={(event) => onHandlePointerDown(event, "contextPanel", false)}
|
|
523
|
+
onpointermove={onHandlePointerMove}
|
|
524
|
+
onpointerup={onHandlePointerUp}
|
|
525
|
+
onpointercancel={onHandlePointerUp}
|
|
526
|
+
onkeydown={(event) => onHandleKeydown(event, "contextPanel", false)}
|
|
527
|
+
></div>
|
|
528
|
+
{/if}
|
|
212
529
|
</aside>
|
|
213
530
|
{/if}
|
|
214
531
|
{#if utilityPanel}
|
|
215
|
-
<aside class="st-appShell__utilityPanel" aria-label={utilityLabel}>
|
|
216
|
-
{
|
|
532
|
+
<aside class="st-appShell__utilityPanel" aria-label={utilityLabel} bind:this={utilityPanelEl}>
|
|
533
|
+
{#if panelCollapse === "accordion"}
|
|
534
|
+
<button
|
|
535
|
+
type="button"
|
|
536
|
+
class="st-appShell__panelDisclosure"
|
|
537
|
+
aria-expanded={utilityPanelOpen}
|
|
538
|
+
aria-controls="st-appShell-utilityPanel-region"
|
|
539
|
+
id="st-appShell-utilityPanel-trigger"
|
|
540
|
+
onclick={() => (utilityPanelOpen = !utilityPanelOpen)}
|
|
541
|
+
>
|
|
542
|
+
<span class="st-appShell__panelDisclosureLabel">{utilityPanelLabelResolved}</span>
|
|
543
|
+
<span class="st-appShell__panelDisclosureIcon" class:st-appShell__panelDisclosureIcon--expanded={utilityPanelOpen}>
|
|
544
|
+
<ChevronDown size={16} aria-hidden="true" />
|
|
545
|
+
</span>
|
|
546
|
+
</button>
|
|
547
|
+
<div
|
|
548
|
+
class="st-appShell__panelRegion"
|
|
549
|
+
class:st-appShell__panelRegion--collapsed={!utilityPanelOpen}
|
|
550
|
+
id="st-appShell-utilityPanel-region"
|
|
551
|
+
role="region"
|
|
552
|
+
aria-labelledby="st-appShell-utilityPanel-trigger"
|
|
553
|
+
>
|
|
554
|
+
{@render utilityPanel()}
|
|
555
|
+
</div>
|
|
556
|
+
{:else}
|
|
557
|
+
{@render utilityPanel()}
|
|
558
|
+
{/if}
|
|
559
|
+
{#if panelResize && utilitySide !== "bottom"}
|
|
560
|
+
<div
|
|
561
|
+
class="st-appShell__resizeHandle"
|
|
562
|
+
role="separator"
|
|
563
|
+
aria-orientation="vertical"
|
|
564
|
+
tabindex="0"
|
|
565
|
+
aria-valuenow={displayWidth("utilityPanel")}
|
|
566
|
+
aria-valuemin={panelMinWidth}
|
|
567
|
+
aria-valuemax={panelMaxWidth}
|
|
568
|
+
aria-label={`Resize ${utilityLabel}`}
|
|
569
|
+
onpointerdown={(event) => onHandlePointerDown(event, "utilityPanel", utilityPositive)}
|
|
570
|
+
onpointermove={onHandlePointerMove}
|
|
571
|
+
onpointerup={onHandlePointerUp}
|
|
572
|
+
onpointercancel={onHandlePointerUp}
|
|
573
|
+
onkeydown={(event) => onHandleKeydown(event, "utilityPanel", utilityPositive)}
|
|
574
|
+
></div>
|
|
575
|
+
{/if}
|
|
217
576
|
</aside>
|
|
218
577
|
{/if}
|
|
219
578
|
</div>
|
|
@@ -343,6 +702,7 @@
|
|
|
343
702
|
min-block-size: 0;
|
|
344
703
|
min-inline-size: 0;
|
|
345
704
|
overflow: hidden;
|
|
705
|
+
position: relative;
|
|
346
706
|
}
|
|
347
707
|
|
|
348
708
|
.st-appShell__primaryRail,
|
|
@@ -419,6 +779,94 @@
|
|
|
419
779
|
margin: var(--st-spacing-4, 1rem);
|
|
420
780
|
}
|
|
421
781
|
|
|
782
|
+
/* Disclosure trigger for panelCollapse="accordion". Hidden by default (this
|
|
783
|
+
rule has no `@media` guard, so it also hides the button on desktop where
|
|
784
|
+
accordion mode is not active) — only shown by the max-width:48rem rule
|
|
785
|
+
below, and only when `data-panel-collapse="accordion"`. This keeps desktop
|
|
786
|
+
rendering byte-identical in both modes. */
|
|
787
|
+
.st-appShell__panelDisclosure {
|
|
788
|
+
align-items: center;
|
|
789
|
+
background: transparent;
|
|
790
|
+
border: 0;
|
|
791
|
+
color: inherit;
|
|
792
|
+
cursor: pointer;
|
|
793
|
+
display: none;
|
|
794
|
+
font: inherit;
|
|
795
|
+
font-weight: 650;
|
|
796
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
797
|
+
justify-content: space-between;
|
|
798
|
+
padding: var(--st-spacing-3, 0.75rem) var(--st-spacing-4, 1rem);
|
|
799
|
+
text-align: start;
|
|
800
|
+
width: 100%;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.st-appShell__panelDisclosure:focus-visible {
|
|
804
|
+
outline: 2px solid var(--st-semantic-border-focus, var(--st-semantic-brand-default));
|
|
805
|
+
outline-offset: -2px;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.st-appShell__panelDisclosureIcon {
|
|
809
|
+
display: inline-flex;
|
|
810
|
+
flex-shrink: 0;
|
|
811
|
+
transition: transform var(--st-motion-duration-fast, 0.15s) ease;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
.st-appShell__panelDisclosureIcon--expanded {
|
|
815
|
+
transform: rotate(180deg);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/* The region stays mounted at all times — it is only ever resized/hidden via
|
|
819
|
+
CSS below, never removed from the DOM, so panel content (maps, live
|
|
820
|
+
widgets…) never remounts when a panel collapses or expands. */
|
|
821
|
+
.st-appShell__panelRegion {
|
|
822
|
+
min-block-size: 0;
|
|
823
|
+
min-inline-size: 0;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/* Drag-to-resize handle (panelResize). Desktop-only: visible by default
|
|
827
|
+
here, forced to `display:none` under the 48rem breakpoint below — the
|
|
828
|
+
element is only ever rendered to the DOM at all when `panelResize` is
|
|
829
|
+
true, so a `panelResize`-less shell never pays for or shows any of this.
|
|
830
|
+
Sits fully inside its panel's own `overflow:hidden` box (no negative
|
|
831
|
+
inset), flush against the edge shared with the next region in flow. */
|
|
832
|
+
.st-appShell__resizeHandle {
|
|
833
|
+
background: transparent;
|
|
834
|
+
block-size: auto;
|
|
835
|
+
cursor: col-resize;
|
|
836
|
+
display: block;
|
|
837
|
+
inset-block: 0;
|
|
838
|
+
inline-size: var(--st-component-appShell-resizeHandle-width, 0.5rem);
|
|
839
|
+
position: absolute;
|
|
840
|
+
touch-action: none;
|
|
841
|
+
z-index: var(--st-component-appShell-resizeHandle-zIndex, 5);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.st-appShell__resizeHandle:hover,
|
|
845
|
+
.st-appShell__resizeHandle:focus-visible {
|
|
846
|
+
background: var(--st-component-appShell-resizeHandle-activeBackground, var(--st-semantic-border-interactive));
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.st-appShell__resizeHandle:focus-visible {
|
|
850
|
+
outline: 2px solid var(--st-semantic-border-focus, var(--st-semantic-brand-default));
|
|
851
|
+
outline-offset: -2px;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.st-appShell__navigationPanel > .st-appShell__resizeHandle {
|
|
855
|
+
inset-inline-end: 0;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.st-appShell__contextPanel > .st-appShell__resizeHandle {
|
|
859
|
+
inset-inline-start: 0;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
.st-appShell[data-utility-side="left"] .st-appShell__utilityPanel > .st-appShell__resizeHandle {
|
|
863
|
+
inset-inline-end: 0;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.st-appShell[data-utility-side="right"] .st-appShell__utilityPanel > .st-appShell__resizeHandle {
|
|
867
|
+
inset-inline-start: 0;
|
|
868
|
+
}
|
|
869
|
+
|
|
422
870
|
@media (max-width: 48rem) {
|
|
423
871
|
.st-appShell__body {
|
|
424
872
|
flex-flow: column nowrap;
|
|
@@ -433,5 +881,38 @@
|
|
|
433
881
|
inline-size: auto;
|
|
434
882
|
max-block-size: min(60vh, 28rem);
|
|
435
883
|
}
|
|
884
|
+
|
|
885
|
+
/* Resize is desktop-only (>48rem) — panels stack/accordion below this
|
|
886
|
+
breakpoint instead, where a drag handle has no meaning. */
|
|
887
|
+
.st-appShell__resizeHandle {
|
|
888
|
+
display: none;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/* Accordion mode: the panel's own max-block-size cap is superseded by the
|
|
892
|
+
region's (below) so a collapsed panel can shrink to 0 and an expanded
|
|
893
|
+
one keeps the same 60vh/28rem ceiling the stack mode always had. */
|
|
894
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__primaryRail,
|
|
895
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__navigationPanel,
|
|
896
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__contextPanel,
|
|
897
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__utilityPanel {
|
|
898
|
+
max-block-size: none;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__panelDisclosure {
|
|
902
|
+
display: flex;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__panelRegion {
|
|
906
|
+
max-block-size: min(60vh, 28rem);
|
|
907
|
+
overflow: auto;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.st-appShell[data-panel-collapse="accordion"] .st-appShell__panelRegion--collapsed {
|
|
911
|
+
block-size: 0;
|
|
912
|
+
max-block-size: 0;
|
|
913
|
+
overflow: hidden;
|
|
914
|
+
padding-block: 0;
|
|
915
|
+
visibility: hidden;
|
|
916
|
+
}
|
|
436
917
|
}
|
|
437
918
|
</style>
|
|
@@ -3,6 +3,8 @@ import type { SiteConfig } from "./site-config";
|
|
|
3
3
|
export type AppShellVariant = "site" | "workspace";
|
|
4
4
|
export type AppShellUtilityMode = "reserve" | "overlay" | "floating";
|
|
5
5
|
export type AppShellUtilitySide = "left" | "right" | "bottom";
|
|
6
|
+
export type AppShellPanelCollapse = "stack" | "accordion";
|
|
7
|
+
export type AppShellPanelKey = "navigationPanel" | "contextPanel" | "utilityPanel";
|
|
6
8
|
export type AppShellProps = {
|
|
7
9
|
variant?: AppShellVariant;
|
|
8
10
|
config?: SiteConfig;
|
|
@@ -20,6 +22,37 @@ export type AppShellProps = {
|
|
|
20
22
|
utilityLabel?: string;
|
|
21
23
|
utilityMode?: AppShellUtilityMode;
|
|
22
24
|
utilitySide?: AppShellUtilitySide;
|
|
25
|
+
/**
|
|
26
|
+
* Below the 48rem breakpoint, `"stack"` (default) keeps today's behaviour —
|
|
27
|
+
* panels stack full-width in document order, always expanded. `"accordion"`
|
|
28
|
+
* degrades each present panel to a keyboard-accessible disclosure (collapsed
|
|
29
|
+
* by default) instead of squeezing the main content. Desktop (>48rem)
|
|
30
|
+
* rendering is IDENTICAL in both modes — side panels stay side-by-side
|
|
31
|
+
* columns. Panel content is mounted once regardless of mode/breakpoint;
|
|
32
|
+
* collapsing hides/sizes the region rather than destroying it, so stateful
|
|
33
|
+
* widgets (maps, live panels…) mounted in a panel never remount.
|
|
34
|
+
*/
|
|
35
|
+
panelCollapse?: AppShellPanelCollapse;
|
|
36
|
+
/** Disclosure label for `primaryRail` when `panelCollapse="accordion"`. */
|
|
37
|
+
primaryRailLabel?: string;
|
|
38
|
+
/** Disclosure label for `navigationPanel` when `panelCollapse="accordion"`. Defaults to `navigationLabel`. */
|
|
39
|
+
navigationPanelLabel?: string;
|
|
40
|
+
/** Disclosure label for `contextPanel` when `panelCollapse="accordion"`. Defaults to `contextLabel`. */
|
|
41
|
+
contextPanelLabel?: string;
|
|
42
|
+
/** Disclosure label for `utilityPanel` when `panelCollapse="accordion"`. Defaults to `utilityLabel`. */
|
|
43
|
+
utilityPanelLabel?: string;
|
|
44
|
+
/** Enables drag-to-resize handles on side panels above 48rem. Default false — zero regression. */
|
|
45
|
+
panelResize?: boolean;
|
|
46
|
+
/** Controlled panel widths in px. When provided the component never mutates width itself. */
|
|
47
|
+
panelWidths?: Partial<Record<AppShellPanelKey, number>>;
|
|
48
|
+
/** Seeds uncontrolled widths in px. */
|
|
49
|
+
defaultPanelWidths?: Partial<Record<AppShellPanelKey, number>>;
|
|
50
|
+
/** Fired on every committed resize. Persistence is the CONSUMER's job — the DS stays presentational. */
|
|
51
|
+
onPanelResize?: (key: AppShellPanelKey, width: number) => void;
|
|
52
|
+
/** Lower clamp in px. Default 180. */
|
|
53
|
+
panelMinWidth?: number;
|
|
54
|
+
/** Upper clamp in px. Default 640. */
|
|
55
|
+
panelMaxWidth?: number;
|
|
23
56
|
class?: string;
|
|
24
57
|
};
|
|
25
58
|
declare const AppShell: import("svelte").Component<AppShellProps, {}, "">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AppShell.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"","sources":["../src/lib/AppShell.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC9D,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,WAAW,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,cAAc,GAAG,cAAc,CAAC;AAEnF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8GAA8G;IAC9G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wGAAwG;IACxG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wGAAwG;IACxG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,wGAAwG;IACxG,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAsbJ,QAAA,MAAM,QAAQ,mDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|