@juice-js/layout 2.5.0-alpha.4 → 3.0.0-alpha.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.
@@ -1,38 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, signal, Optional, Injectable, inject, computed, viewChild, ChangeDetectionStrategy, Component, booleanAttribute, HostListener, Input, Directive, input, ChangeDetectorRef, DestroyRef, forwardRef, HostBinding, afterNextRender, effect, untracked, NgModule } from '@angular/core';
3
- import * as i1 from '@juice-js/core';
4
- import { TenantService, AsyncDialog } from '@juice-js/core';
5
- import * as i2$1 from '@angular/material/dialog';
6
- import { MatDialog, MatDialogModule } from '@angular/material/dialog';
7
- import * as i4$2 from '@angular/cdk/layout';
8
- import { Breakpoints } from '@angular/cdk/layout';
9
- import * as i1$1 from '@angular/common';
10
- import { DOCUMENT, CommonModule } from '@angular/common';
11
- import * as i3$1 from '@angular/router';
12
- import { Router, NavigationEnd, RouterModule, RouterLink } from '@angular/router';
13
- import * as i2 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import * as i5 from '@ngx-translate/core';
16
- import { TranslatePipe, TranslateDirective } from '@ngx-translate/core';
17
- import { trigger, transition, style, animate, state } from '@angular/animations';
18
- import * as i8 from '@angular/material/toolbar';
19
- import { MatToolbarModule } from '@angular/material/toolbar';
20
- import * as i9 from '@angular/material/sidenav';
21
- import { MatSidenavModule } from '@angular/material/sidenav';
22
- import * as i3 from '@angular/material/button';
23
- import { MatButtonModule } from '@angular/material/button';
24
- import * as i4 from '@angular/material/tooltip';
25
- import { MatTooltipModule } from '@angular/material/tooltip';
26
- import * as i4$1 from '@angular/material/menu';
27
- import { MatMenuModule } from '@angular/material/menu';
2
+ import { InjectionToken, inject, signal, computed, Injectable, viewChild, ChangeDetectionStrategy, Component, booleanAttribute, HostListener, Input, Directive, input, ChangeDetectorRef, output, DestroyRef, ViewEncapsulation, forwardRef, HostBinding, Optional, model, DOCUMENT as DOCUMENT$1, effect, untracked, makeEnvironmentProviders, NgModule, numberAttribute, ElementRef } from '@angular/core';
3
+ import { TenantService, MenuService, AsyncDialog } from '@juice-js/core';
4
+ import { JUICE_ACCENTS, ThemeService, JUICE_THEME_OPTIONS } from '@juice-js/ui/theme';
5
+ import * as i1 from '@angular/common';
6
+ import { DOCUMENT, NgTemplateOutlet, NgComponentOutlet, CommonModule } from '@angular/common';
7
+ import * as i4 from '@angular/router';
8
+ import { Router, NavigationEnd, RouterLink, ActivatedRoute, RouterOutlet, RouterModule } from '@angular/router';
9
+ import * as i1$1 from '@angular/cdk/dialog';
10
+ import { Dialog, DialogModule, DialogRef } from '@angular/cdk/dialog';
11
+ import { Overlay } from '@angular/cdk/overlay';
12
+ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
13
+ import { TranslatePipe } from '@ngx-translate/core';
14
+ import { JuiceIcon, provideJuiceIcons } from '@juice-js/icons';
15
+ import { JuiceIconButton, JuiceButton } from '@juice-js/ui';
28
16
  import { filter } from 'rxjs/operators';
29
- import * as i7 from '@angular/material/list';
30
- import { MatListModule } from '@angular/material/list';
31
- import * as i3$2 from '@angular/material/expansion';
32
- import { MatExpansionPanel, MatExpansionModule } from '@angular/material/expansion';
33
- import * as i3$3 from 'angular-oauth2-oidc';
34
- import { MatFormFieldModule } from '@angular/material/form-field';
35
- import { MatInputModule } from '@angular/material/input';
17
+ import { CdkMenu, CdkMenuItemRadio, CdkMenuTrigger } from '@angular/cdk/menu';
18
+ import * as i3 from 'angular-oauth2-oidc';
19
+ import { FocusTrapFactory } from '@angular/cdk/a11y';
20
+ import { Check, X, LogIn, CircleUser, Palette, SunMoon, Moon, Sun, PanelLeftOpen, PanelLeftClose, ChevronRight, ChevronDown, Settings, TextSearch, Search, Menu, NotebookPen, AtSign, SlidersHorizontal, Inbox, Bell, Shield, LayoutDashboard, House } from 'lucide';
36
21
 
37
22
  var ThemeMode;
38
23
  (function (ThemeMode) {
@@ -56,11 +41,8 @@ class LayoutConfig {
56
41
  }
57
42
  }
58
43
  }
59
- /** The palettes `layout.theme()` ships. */
60
- const LAYOUT_PALETTES = [
61
- { id: "teal", name: "Teal", color: "#0f766e" },
62
- { id: "indigo", name: "Indigo", color: "#4f46e5" },
63
- ];
44
+ /** The accents the design tokens ship: indigo (the default), teal and violet. */
45
+ const LAYOUT_PALETTES = JUICE_ACCENTS;
64
46
  const IS_PRODUCTION = new InjectionToken('production');
65
47
  /**
66
48
  * Components an app adds to the toolbar, before the dark mode switch (a notification bell): provide each with `multi: true`.
@@ -68,6 +50,12 @@ const IS_PRODUCTION = new InjectionToken('production');
68
50
  */
69
51
  const LAYOUT_TOOLBAR_ITEMS = new InjectionToken('LAYOUT_TOOLBAR_ITEMS');
70
52
 
53
+ const MODES$1 = { light: ThemeMode.Light, dark: ThemeMode.Dark, system: ThemeMode.Auto };
54
+ const JUICE_MODES = { [ThemeMode.Light]: 'light', [ThemeMode.Dark]: 'dark', [ThemeMode.Auto]: 'system' };
55
+ /**
56
+ * The shell's state: brand and tenant, the menu's open state, and the 2.x theme API (palette, dark mode), which delegates to
57
+ * {@link ThemeService} (`@juice-js/ui/theme`): one source of truth for `data-theme`, `data-accent` and the legacy mirrors.
58
+ */
71
59
  class LayoutService {
72
60
  static { this.DARK_MODE = "IS_DARK_MODE"; }
73
61
  static { this.MENU_OPEN = "IS_MENU_OPEN"; }
@@ -78,113 +66,69 @@ class LayoutService {
78
66
  set tenantIdentifier(value) {
79
67
  this._tenantIdentifier.set(value);
80
68
  }
81
- constructor(options, tenantService) {
69
+ constructor() {
70
+ this.theme = inject(ThemeService);
71
+ this._options = inject(LayoutConfig, { optional: true }) ?? new LayoutConfig();
82
72
  // Signals, not plain fields: the tenant arrives after the shell has rendered, and templates reading
83
73
  // brandName()/brandLogo()/tenantIdentifier must re-render then, also in zoneless apps.
84
74
  this._tenantIdentifier = signal("", /* @ts-ignore */
85
75
  ...(ngDevMode ? [{ debugName: "_tenantIdentifier" }] : /* istanbul ignore next */ []));
86
76
  this._tenant = signal(null, /* @ts-ignore */
87
77
  ...(ngDevMode ? [{ debugName: "_tenant" }] : /* istanbul ignore next */ []));
88
- this._palette = signal(null, /* @ts-ignore */
89
- ...(ngDevMode ? [{ debugName: "_palette" }] : /* istanbul ignore next */ []));
90
- /** The palette in use: the viewer's choice, else LayoutConfig.defaultPalette; null means the stylesheet's default. */
91
- this.palette = this._palette.asReadonly();
92
- tenantService?.getTenantInfo().then(tenantInfo => {
78
+ this._menuOpen = signal(this.readMenuOpen(), /* @ts-ignore */
79
+ ...(ngDevMode ? [{ debugName: "_menuOpen" }] : /* istanbul ignore next */ []));
80
+ /** The accent in use (ThemeService.accent). */
81
+ this.palette = computed(() => this.theme.accent(), /* @ts-ignore */
82
+ ...(ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []));
83
+ /** Whether the viewer keeps the side menu open (unfolded), remembered under `IS_MENU_OPEN`. */
84
+ this.menuOpen = this._menuOpen.asReadonly();
85
+ inject(TenantService, { optional: true })?.getTenantInfo().then(tenantInfo => {
93
86
  this._tenantIdentifier.set(tenantInfo?.identifier ?? "");
94
87
  this._tenant.set(tenantInfo);
95
88
  });
96
- this._options = options ?? new LayoutConfig();
97
- this.applyPalette(this.storedPalette() ?? this._options.defaultPalette ?? null);
89
+ this.adoptLegacyKeys();
98
90
  }
99
91
  /** The palettes the viewer can pick from (LayoutConfig.palettes). */
100
92
  palettes() {
101
93
  // A config given as a plain object (not new LayoutConfig()) may have none.
102
- return this._options.palettes ?? [...LAYOUT_PALETTES];
94
+ return [...(this._options.palettes ?? LAYOUT_PALETTES)];
103
95
  }
104
96
  /**
105
- * Switches every page to a palette and remembers it in this browser: it sets `data-juice-palette` on `<html>`, which
106
- * `layout.theme()` and the Juice pages' tokens follow. Null goes back to the app's default.
97
+ * Switches every page to an accent and remembers it in this browser (ThemeService.setAccent: `data-accent`, and
98
+ * `data-juice-palette` for 2.x pages, on `<html>`). Null goes back to the app's default. An id the theme does not offer is ignored.
107
99
  */
108
100
  setPalette(id) {
109
- try {
110
- if (id)
111
- localStorage.setItem(LayoutService.PALETTE, id);
112
- else
113
- localStorage.removeItem(LayoutService.PALETTE);
114
- }
115
- catch {
116
- // Storage blocked: the choice lasts until the page reloads.
117
- }
118
- this.applyPalette(id ?? this._options.defaultPalette ?? null);
119
- }
120
- storedPalette() {
121
- try {
122
- const id = localStorage.getItem(LayoutService.PALETTE);
123
- return id && this.palettes().some(p => p.id === id) ? id : null;
124
- }
125
- catch {
126
- return null;
127
- }
128
- }
129
- applyPalette(id) {
130
- this._palette.set(id);
131
- if (typeof document === "undefined")
132
- return;
133
- if (id)
134
- document.documentElement.setAttribute("data-juice-palette", id);
135
- else
136
- document.documentElement.removeAttribute("data-juice-palette");
101
+ const target = id ?? this._options.defaultPalette ?? this.theme.accent();
102
+ this.theme.setAccent(target);
137
103
  }
104
+ /** The theme mode, in 2.x terms (Auto = follow the system). */
138
105
  getThemeMode() {
139
- const fallback = this._options.defaultThemeMode ?? ThemeMode.Auto;
140
- let stored = null;
141
- try {
142
- stored = localStorage.getItem(LayoutService.DARK_MODE);
143
- }
144
- catch {
145
- return fallback;
146
- }
147
- if (!stored)
148
- return fallback;
149
- const modes = Object.values(ThemeMode);
150
- // A value written by something else may be the bare name (`dark`) rather than JSON (`"dark"`): never let it throw.
151
- let value = stored;
152
- try {
153
- value = JSON.parse(stored);
154
- }
155
- catch {
156
- // not JSON: try it as written
157
- }
158
- return typeof value === 'string' && modes.includes(value) ? value : fallback;
106
+ return MODES$1[this.theme.mode()] ?? ThemeMode.Auto;
159
107
  }
108
+ setThemeMode(mode) {
109
+ const m = JUICE_MODES[mode];
110
+ if (m)
111
+ this.theme.setMode(m);
112
+ }
113
+ /** Auto, then Light, then Dark, then Auto again: the dark mode button. */
160
114
  toggleDarkMode() {
161
- var state = this.getThemeMode();
162
- if (state == ThemeMode.Auto) {
163
- state = ThemeMode.Light;
164
- }
165
- else if (state == ThemeMode.Light) {
166
- state = ThemeMode.Dark;
167
- }
168
- else {
169
- state = ThemeMode.Auto;
170
- }
171
- localStorage.setItem(LayoutService.DARK_MODE, JSON.stringify(state));
115
+ const state = this.getThemeMode();
116
+ this.setThemeMode(state === ThemeMode.Auto ? ThemeMode.Light : state === ThemeMode.Light ? ThemeMode.Dark : ThemeMode.Auto);
172
117
  }
173
118
  isMenuOpen() {
174
- let isMenuOpen = localStorage.getItem(LayoutService.MENU_OPEN);
175
- if (isMenuOpen) {
176
- try {
177
- return JSON.parse(isMenuOpen) === true;
178
- }
179
- catch {
180
- // not JSON: the default
181
- }
119
+ return this._menuOpen();
120
+ }
121
+ setMenuOpen(open) {
122
+ this._menuOpen.set(open);
123
+ try {
124
+ localStorage.setItem(LayoutService.MENU_OPEN, JSON.stringify(open));
125
+ }
126
+ catch {
127
+ // Storage blocked: the choice lasts until the page reloads.
182
128
  }
183
- return this._options.defaultMenuOpen;
184
129
  }
185
130
  toggleMenu() {
186
- let state = !this.isMenuOpen();
187
- localStorage.setItem(LayoutService.MENU_OPEN, JSON.stringify(state));
131
+ this.setMenuOpen(!this._menuOpen());
188
132
  }
189
133
  favicon() {
190
134
  return this._tenant()?.favicon ?? this._options.favicon;
@@ -205,7 +149,47 @@ class LayoutService {
205
149
  userImageUrl(username) {
206
150
  return this._options.userImageUrl ? this._options.userImageUrl.replace("{username}", username) : "";
207
151
  }
208
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutService, deps: [{ token: LayoutConfig, optional: true }, { token: i1.TenantService }], target: i0.ɵɵFactoryTarget.Injectable }); }
152
+ readMenuOpen() {
153
+ try {
154
+ const stored = localStorage.getItem(LayoutService.MENU_OPEN);
155
+ if (stored !== null && stored.length < 16) {
156
+ const value = JSON.parse(stored);
157
+ if (typeof value === 'boolean')
158
+ return value;
159
+ }
160
+ }
161
+ catch {
162
+ // not JSON, or storage blocked: the default
163
+ }
164
+ return this._options.defaultMenuOpen ?? false;
165
+ }
166
+ /**
167
+ * A 2.x app on the same origin writes only the legacy keys (`IS_DARK_MODE`, `JUICE_PALETTE`); ThemeService prefers its own record
168
+ * once it has one, and mirrors the legacy keys on every change. So legacy keys that differ from the theme were written later by a
169
+ * 2.x app: adopt them, so both apps show the same theme. Values off the allow-lists are ignored.
170
+ */
171
+ adoptLegacyKeys() {
172
+ const options = inject(JUICE_THEME_OPTIONS, { optional: true });
173
+ if (options?.legacy === false)
174
+ return;
175
+ let rawMode = null;
176
+ let rawPalette = null;
177
+ try {
178
+ rawMode = localStorage.getItem(LayoutService.DARK_MODE);
179
+ rawPalette = localStorage.getItem(LayoutService.PALETTE);
180
+ }
181
+ catch {
182
+ return;
183
+ }
184
+ const mode = legacyMode(rawMode);
185
+ if (mode && mode !== this.theme.mode())
186
+ this.theme.setMode(mode);
187
+ if (rawPalette && rawPalette.length <= 64 && rawPalette !== this.theme.accent()
188
+ && this.palettes().some(p => p.id === rawPalette)) {
189
+ this.theme.setAccent(rawPalette);
190
+ }
191
+ }
192
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
209
193
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutService, providedIn: 'root' }); }
210
194
  }
211
195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutService, decorators: [{
@@ -213,9 +197,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
213
197
  args: [{
214
198
  providedIn: 'root'
215
199
  }]
216
- }], ctorParameters: () => [{ type: LayoutConfig, decorators: [{
217
- type: Optional
218
- }] }, { type: i1.TenantService }] });
200
+ }], ctorParameters: () => [] });
201
+ /** A 2.x `IS_DARK_MODE` value (JSON `"dark"`, or written bare) as a theme mode; null when it names none. */
202
+ function legacyMode(raw) {
203
+ if (raw === null || raw.length > 32)
204
+ return null;
205
+ let value = raw;
206
+ try {
207
+ value = JSON.parse(raw);
208
+ }
209
+ catch {
210
+ // not JSON: try it as written
211
+ }
212
+ switch (value) {
213
+ case 'dark':
214
+ case true:
215
+ case 'true': return 'dark';
216
+ case 'light':
217
+ case false:
218
+ case 'false': return 'light';
219
+ case 'auto':
220
+ case 'system': return 'system';
221
+ default: return null;
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Structural type guard used by the shell to detect {@link SearchablePage}.
227
+ *
228
+ * TypeScript interfaces are erased at runtime, so support is detected by shape
229
+ * rather than by nominal type. See research.md Decision 1 for the trade-off.
230
+ */
231
+ function isSearchablePage(value) {
232
+ return (typeof value === 'object' &&
233
+ value !== null &&
234
+ typeof value.onSearch === 'function');
235
+ }
236
+
237
+ /**
238
+ * Mediates between the shell's single toolbar search box and the page on display.
239
+ *
240
+ * The box appears only while the displayed page implements {@link SearchablePage}.
241
+ * The shell binds and unbinds the page from its own `router-outlet` lifecycle — this
242
+ * service deliberately does NOT listen to router events. Revoking on `NavigationStart`
243
+ * (as it once did) fires before guards run and before a reused component is rebuilt,
244
+ * which silently lost the box on a cancelled navigation or a tenant switch.
245
+ */
246
+ class SearchService {
247
+ constructor() {
248
+ this._page = signal(null, /* @ts-ignore */
249
+ ...(ngDevMode ? [{ debugName: "_page" }] : /* istanbul ignore next */ []));
250
+ this._query = signal('', /* @ts-ignore */
251
+ ...(ngDevMode ? [{ debugName: "_query" }] : /* istanbul ignore next */ []));
252
+ /** Set only by the deprecated {@link enable}. */
253
+ this._legacyCallback = signal(null, /* @ts-ignore */
254
+ ...(ngDevMode ? [{ debugName: "_legacyCallback" }] : /* istanbul ignore next */ []));
255
+ /**
256
+ * Whether the toolbar should offer search — true iff a page is bound.
257
+ *
258
+ * Derived, with no setter: presence cannot be set independently of page support.
259
+ */
260
+ this.isEnabled = computed(() => this._page() !== null || this._legacyCallback() !== null, /* @ts-ignore */
261
+ ...(ngDevMode ? [{ debugName: "isEnabled" }] : /* istanbul ignore next */ []));
262
+ /** What the user has currently typed for the displayed page. */
263
+ this.query = this._query.asReadonly();
264
+ }
265
+ /**
266
+ * Bind the page now on display. Called by the shell on outlet activation.
267
+ *
268
+ * A page that does not implement {@link SearchablePage} binds nothing, leaving the
269
+ * box hidden — support is opt-in.
270
+ */
271
+ bindPage(instance) {
272
+ this._page.set(isSearchablePage(instance) ? instance : null);
273
+ }
274
+ /**
275
+ * Release the page. Called by the shell on outlet deactivation.
276
+ *
277
+ * Also discards the query: the box is mounted once and shared, so a term left here
278
+ * would surface on the next page, which never received it.
279
+ */
280
+ unbindPage() {
281
+ this._page.set(null);
282
+ this._legacyCallback.set(null);
283
+ this._query.set('');
284
+ }
285
+ /** Forward what the user typed to the bound page. Called by the search box. */
286
+ submit(query, event) {
287
+ this._query.set(query);
288
+ const page = this._page();
289
+ if (page) {
290
+ page.onSearch(query, event);
291
+ return;
292
+ }
293
+ const legacy = this._legacyCallback();
294
+ if (legacy) {
295
+ legacy(query, event);
296
+ }
297
+ }
298
+ /**
299
+ * @deprecated Implement {@link SearchablePage} on the page component instead — it ties
300
+ * the declaration to the handler, so search cannot be claimed without being served.
301
+ * Still functional; scheduled for removal in the next major.
302
+ */
303
+ enable(callback) {
304
+ this._legacyCallback.set(callback);
305
+ }
306
+ /**
307
+ * @deprecated The shell now revokes automatically when the page changes; there is
308
+ * nothing to call. Still functional; scheduled for removal in the next major.
309
+ */
310
+ disable() {
311
+ this._page.set(null);
312
+ this._legacyCallback.set(null);
313
+ }
314
+ /**
315
+ * @deprecated Renamed to {@link submit}, which also records the query for the box.
316
+ */
317
+ callback(searchText, event) {
318
+ this.submit(searchText ?? '', event);
319
+ }
320
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
321
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, providedIn: 'root' }); }
322
+ }
323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, decorators: [{
324
+ type: Injectable,
325
+ args: [{
326
+ providedIn: 'root'
327
+ }]
328
+ }] });
219
329
 
220
330
  /** How long a go-to sequence waits for its next key. */
221
331
  const SequenceTimeout = 1500;
@@ -433,8 +543,8 @@ function isTyping(el) {
433
543
 
434
544
  /**
435
545
  * The page switcher's content: a box to type a page's name in and the pages that match, with their group and go-to
436
- * keys. Arrow keys move, Enter opens. The shell shows it in a dialog (which brings the focus trap, Escape and the
437
- * backdrop) while {@link PageSwitcherService.isOpen}.
546
+ * keys. Arrow keys move, Enter opens. The shell shows it in a CDK dialog (which brings the focus trap, Escape and the
547
+ * backdrop, and gives the focus back) while {@link PageSwitcherService.isOpen}.
438
548
  */
439
549
  class PageSwitcherComponent {
440
550
  constructor() {
@@ -498,183 +608,13 @@ class PageSwitcherComponent {
498
608
  this.list()?.nativeElement.querySelector(`#${this.optionId(index)}`)?.scrollIntoView({ block: 'nearest' });
499
609
  }
500
610
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageSwitcherComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
501
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageSwitcherComponent, isStandalone: false, selector: "juice-page-switcher", viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"switcher\" (keydown)=\"onKeydown($event)\">\n <div class=\"field\">\n <mat-icon aria-hidden=\"true\">search</mat-icon>\n <input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" aria-expanded=\"true\"\n aria-controls=\"juice-page-switcher-list\" autocomplete=\"off\" spellcheck=\"false\"\n [attr.aria-activedescendant]=\"results()[selected()] ? optionId(selected()) : null\"\n [placeholder]=\"'Go to page\u2026' | translate\" [value]=\"query()\"\n (input)=\"onInput($any($event.target).value)\">\n <kbd class=\"hint\">Esc</kbd>\n </div>\n <ul #list id=\"juice-page-switcher-list\" role=\"listbox\" [attr.aria-label]=\"'Pages' | translate\">\n @for (page of results(); track page.id + page.routerLink; let i = $index) {\n <li role=\"option\" [id]=\"optionId(i)\" [attr.aria-selected]=\"i === selected()\" [class.selected]=\"i === selected()\"\n (mousemove)=\"selected.set(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"service.go(page)\">\n <mat-icon aria-hidden=\"true\">{{ page.icon }}</mat-icon>\n <span class=\"label\">{{ page.label }}</span>\n @if (page.group) {\n <span class=\"group\">{{ page.group }}</span>\n }\n @if (page.shortcut) {\n <span class=\"keys\" [attr.aria-label]=\"('Shortcut' | translate) + ' ' + page.shortcut\">\n @for (key of keys(page.shortcut); track $index) { <kbd>{{ key }}</kbd> }\n </span>\n }\n </li>\n } @empty {\n <li class=\"empty\" role=\"presentation\">{{ 'No pages match' | translate }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:block}.switcher{display:flex;flex-direction:column;max-height:70vh;color:var(--jps-text, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)))}.field{display:flex;align-items:center;gap:12px;padding:0 16px;border-bottom:1px solid var(--jps-line, var(--mat-sys-outline-variant, rgba(0, 0, 0, .12)))}.field mat-icon{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.field input{flex:1;min-width:0;height:52px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}ul{list-style:none;margin:0;padding:6px;overflow-y:auto}li{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 10px;border-radius:8px;cursor:pointer}li mat-icon{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));flex:none}li .label{flex:none}li .group{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));font-size:.85em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}li .keys{margin-left:auto;display:flex;gap:4px;flex:none}li.selected{background:var(--jps-selected, var(--mat-sys-secondary-container, rgba(0, 0, 0, .06)))}li.empty{cursor:default;color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));justify-content:center}kbd{display:inline-block;min-width:1.4em;padding:1px 6px;border:1px solid var(--jps-line, var(--mat-sys-outline-variant, rgba(0, 0, 0, .12)));border-bottom-width:2px;border-radius:4px;font:500 .75rem/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;text-align:center;color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.hint{flex:none}\n"], dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
611
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageSwitcherComponent, isStandalone: true, selector: "juice-page-switcher", viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"switcher\" (keydown)=\"onKeydown($event)\">\n <div class=\"field\">\n <juice-icon name=\"search\" [size]=\"18\" />\n <input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" aria-expanded=\"true\"\n aria-controls=\"juice-page-switcher-list\" autocomplete=\"off\" spellcheck=\"false\"\n [attr.aria-label]=\"'Go to page' | translate\"\n [attr.aria-activedescendant]=\"results()[selected()] ? optionId(selected()) : null\"\n [placeholder]=\"'Go to page\u2026' | translate\" [value]=\"query()\"\n (input)=\"onInput($any($event.target).value)\">\n <kbd class=\"hint\">Esc</kbd>\n </div>\n <ul #list id=\"juice-page-switcher-list\" role=\"listbox\" [attr.aria-label]=\"'Pages' | translate\">\n @for (page of results(); track page.id + page.routerLink; let i = $index) {\n <li role=\"option\" [id]=\"optionId(i)\" [attr.aria-selected]=\"i === selected()\" [class.selected]=\"i === selected()\"\n (mousemove)=\"selected.set(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"service.go(page)\">\n <juice-icon [name]=\"page.icon\" [size]=\"18\" />\n <span class=\"label\">{{ page.label }}</span>\n @if (page.group) {\n <span class=\"group\">{{ page.group }}</span>\n }\n @if (page.shortcut) {\n <span class=\"keys\" [attr.aria-label]=\"('Shortcut' | translate) + ' ' + page.shortcut\">\n @for (key of keys(page.shortcut); track $index) { <kbd>{{ key }}</kbd> }\n </span>\n }\n </li>\n } @empty {\n <li class=\"empty\" role=\"presentation\">{{ 'No pages match' | translate }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:block}.switcher{display:flex;flex-direction:column;max-height:70vh;color:var(--juice-color-text);font-family:var(--juice-font-sans)}.field{display:flex;align-items:center;gap:var(--juice-space-3);padding:0 var(--juice-space-4);border-bottom:1px solid var(--juice-color-border)}.field juice-icon{color:var(--juice-color-text-muted)}.field input{flex:1;min-width:0;height:52px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:var(--juice-text-md)}ul{list-style:none;margin:0;padding:6px;overflow-y:auto}li{display:flex;align-items:center;gap:var(--juice-space-3);min-height:40px;padding:0 10px;border-radius:var(--juice-radius-lg);cursor:pointer}li juice-icon{color:var(--juice-color-text-muted);flex:none}li .label{flex:none}li .group{color:var(--juice-color-text-muted);font-size:.85em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}li .keys{margin-left:auto;display:flex;gap:4px;flex:none}li.selected{background:var(--juice-color-accent-subtle)}li.empty{cursor:default;color:var(--juice-color-text-muted);justify-content:center}kbd{display:inline-block;min-width:1.4em;padding:1px 6px;border:1px solid var(--juice-color-border);border-bottom-width:2px;border-radius:var(--juice-radius-sm);font:500 var(--juice-text-xs)/1.4 var(--juice-font-mono);text-align:center;color:var(--juice-color-text-muted)}.hint{flex:none}\n"], dependencies: [{ kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
502
612
  }
503
613
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageSwitcherComponent, decorators: [{
504
614
  type: Component,
505
- args: [{ selector: 'juice-page-switcher', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"switcher\" (keydown)=\"onKeydown($event)\">\n <div class=\"field\">\n <mat-icon aria-hidden=\"true\">search</mat-icon>\n <input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" aria-expanded=\"true\"\n aria-controls=\"juice-page-switcher-list\" autocomplete=\"off\" spellcheck=\"false\"\n [attr.aria-activedescendant]=\"results()[selected()] ? optionId(selected()) : null\"\n [placeholder]=\"'Go to page\u2026' | translate\" [value]=\"query()\"\n (input)=\"onInput($any($event.target).value)\">\n <kbd class=\"hint\">Esc</kbd>\n </div>\n <ul #list id=\"juice-page-switcher-list\" role=\"listbox\" [attr.aria-label]=\"'Pages' | translate\">\n @for (page of results(); track page.id + page.routerLink; let i = $index) {\n <li role=\"option\" [id]=\"optionId(i)\" [attr.aria-selected]=\"i === selected()\" [class.selected]=\"i === selected()\"\n (mousemove)=\"selected.set(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"service.go(page)\">\n <mat-icon aria-hidden=\"true\">{{ page.icon }}</mat-icon>\n <span class=\"label\">{{ page.label }}</span>\n @if (page.group) {\n <span class=\"group\">{{ page.group }}</span>\n }\n @if (page.shortcut) {\n <span class=\"keys\" [attr.aria-label]=\"('Shortcut' | translate) + ' ' + page.shortcut\">\n @for (key of keys(page.shortcut); track $index) { <kbd>{{ key }}</kbd> }\n </span>\n }\n </li>\n } @empty {\n <li class=\"empty\" role=\"presentation\">{{ 'No pages match' | translate }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:block}.switcher{display:flex;flex-direction:column;max-height:70vh;color:var(--jps-text, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)))}.field{display:flex;align-items:center;gap:12px;padding:0 16px;border-bottom:1px solid var(--jps-line, var(--mat-sys-outline-variant, rgba(0, 0, 0, .12)))}.field mat-icon{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.field input{flex:1;min-width:0;height:52px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}ul{list-style:none;margin:0;padding:6px;overflow-y:auto}li{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 10px;border-radius:8px;cursor:pointer}li mat-icon{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));flex:none}li .label{flex:none}li .group{color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));font-size:.85em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}li .keys{margin-left:auto;display:flex;gap:4px;flex:none}li.selected{background:var(--jps-selected, var(--mat-sys-secondary-container, rgba(0, 0, 0, .06)))}li.empty{cursor:default;color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)));justify-content:center}kbd{display:inline-block;min-width:1.4em;padding:1px 6px;border:1px solid var(--jps-line, var(--mat-sys-outline-variant, rgba(0, 0, 0, .12)));border-bottom-width:2px;border-radius:4px;font:500 .75rem/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;text-align:center;color:var(--jps-muted, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, .6)))}.hint{flex:none}\n"] }]
615
+ args: [{ selector: 'juice-page-switcher', changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslatePipe, JuiceIcon], template: "<div class=\"switcher\" (keydown)=\"onKeydown($event)\">\n <div class=\"field\">\n <juice-icon name=\"search\" [size]=\"18\" />\n <input type=\"text\" role=\"combobox\" aria-autocomplete=\"list\" aria-expanded=\"true\"\n aria-controls=\"juice-page-switcher-list\" autocomplete=\"off\" spellcheck=\"false\"\n [attr.aria-label]=\"'Go to page' | translate\"\n [attr.aria-activedescendant]=\"results()[selected()] ? optionId(selected()) : null\"\n [placeholder]=\"'Go to page\u2026' | translate\" [value]=\"query()\"\n (input)=\"onInput($any($event.target).value)\">\n <kbd class=\"hint\">Esc</kbd>\n </div>\n <ul #list id=\"juice-page-switcher-list\" role=\"listbox\" [attr.aria-label]=\"'Pages' | translate\">\n @for (page of results(); track page.id + page.routerLink; let i = $index) {\n <li role=\"option\" [id]=\"optionId(i)\" [attr.aria-selected]=\"i === selected()\" [class.selected]=\"i === selected()\"\n (mousemove)=\"selected.set(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"service.go(page)\">\n <juice-icon [name]=\"page.icon\" [size]=\"18\" />\n <span class=\"label\">{{ page.label }}</span>\n @if (page.group) {\n <span class=\"group\">{{ page.group }}</span>\n }\n @if (page.shortcut) {\n <span class=\"keys\" [attr.aria-label]=\"('Shortcut' | translate) + ' ' + page.shortcut\">\n @for (key of keys(page.shortcut); track $index) { <kbd>{{ key }}</kbd> }\n </span>\n }\n </li>\n } @empty {\n <li class=\"empty\" role=\"presentation\">{{ 'No pages match' | translate }}</li>\n }\n </ul>\n</div>\n", styles: [":host{display:block}.switcher{display:flex;flex-direction:column;max-height:70vh;color:var(--juice-color-text);font-family:var(--juice-font-sans)}.field{display:flex;align-items:center;gap:var(--juice-space-3);padding:0 var(--juice-space-4);border-bottom:1px solid var(--juice-color-border)}.field juice-icon{color:var(--juice-color-text-muted)}.field input{flex:1;min-width:0;height:52px;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:var(--juice-text-md)}ul{list-style:none;margin:0;padding:6px;overflow-y:auto}li{display:flex;align-items:center;gap:var(--juice-space-3);min-height:40px;padding:0 10px;border-radius:var(--juice-radius-lg);cursor:pointer}li juice-icon{color:var(--juice-color-text-muted);flex:none}li .label{flex:none}li .group{color:var(--juice-color-text-muted);font-size:.85em;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}li .keys{margin-left:auto;display:flex;gap:4px;flex:none}li.selected{background:var(--juice-color-accent-subtle)}li.empty{cursor:default;color:var(--juice-color-text-muted);justify-content:center}kbd{display:inline-block;min-width:1.4em;padding:1px 6px;border:1px solid var(--juice-color-border);border-bottom-width:2px;border-radius:var(--juice-radius-sm);font:500 var(--juice-text-xs)/1.4 var(--juice-font-mono);text-align:center;color:var(--juice-color-text-muted)}.hint{flex:none}\n"] }]
506
616
  }], propDecorators: { list: [{ type: i0.ViewChild, args: ['list', { isSignal: true }] }] } });
507
617
 
508
- /**
509
- * Structural type guard used by the shell to detect {@link SearchablePage}.
510
- *
511
- * TypeScript interfaces are erased at runtime, so support is detected by shape
512
- * rather than by nominal type. See research.md Decision 1 for the trade-off.
513
- */
514
- function isSearchablePage(value) {
515
- return (typeof value === 'object' &&
516
- value !== null &&
517
- typeof value.onSearch === 'function');
518
- }
519
-
520
- /**
521
- * Mediates between the shell's single toolbar search box and the page on display.
522
- *
523
- * The box appears only while the displayed page implements {@link SearchablePage}.
524
- * The shell binds and unbinds the page from its own `router-outlet` lifecycle — this
525
- * service deliberately does NOT listen to router events. Revoking on `NavigationStart`
526
- * (as it once did) fires before guards run and before a reused component is rebuilt,
527
- * which silently lost the box on a cancelled navigation or a tenant switch.
528
- */
529
- class SearchService {
530
- constructor() {
531
- this._page = signal(null, /* @ts-ignore */
532
- ...(ngDevMode ? [{ debugName: "_page" }] : /* istanbul ignore next */ []));
533
- this._query = signal('', /* @ts-ignore */
534
- ...(ngDevMode ? [{ debugName: "_query" }] : /* istanbul ignore next */ []));
535
- /** Set only by the deprecated {@link enable}. */
536
- this._legacyCallback = signal(null, /* @ts-ignore */
537
- ...(ngDevMode ? [{ debugName: "_legacyCallback" }] : /* istanbul ignore next */ []));
538
- /**
539
- * Whether the toolbar should offer search — true iff a page is bound.
540
- *
541
- * Derived, with no setter: presence cannot be set independently of page support.
542
- */
543
- this.isEnabled = computed(() => this._page() !== null || this._legacyCallback() !== null, /* @ts-ignore */
544
- ...(ngDevMode ? [{ debugName: "isEnabled" }] : /* istanbul ignore next */ []));
545
- /** What the user has currently typed for the displayed page. */
546
- this.query = this._query.asReadonly();
547
- }
548
- /**
549
- * Bind the page now on display. Called by the shell on outlet activation.
550
- *
551
- * A page that does not implement {@link SearchablePage} binds nothing, leaving the
552
- * box hidden — support is opt-in.
553
- */
554
- bindPage(instance) {
555
- this._page.set(isSearchablePage(instance) ? instance : null);
556
- }
557
- /**
558
- * Release the page. Called by the shell on outlet deactivation.
559
- *
560
- * Also discards the query: the box is mounted once and shared, so a term left here
561
- * would surface on the next page, which never received it.
562
- */
563
- unbindPage() {
564
- this._page.set(null);
565
- this._legacyCallback.set(null);
566
- this._query.set('');
567
- }
568
- /** Forward what the user typed to the bound page. Called by the search box. */
569
- submit(query, event) {
570
- this._query.set(query);
571
- const page = this._page();
572
- if (page) {
573
- page.onSearch(query, event);
574
- return;
575
- }
576
- const legacy = this._legacyCallback();
577
- if (legacy) {
578
- legacy(query, event);
579
- }
580
- }
581
- /**
582
- * @deprecated Implement {@link SearchablePage} on the page component instead — it ties
583
- * the declaration to the handler, so search cannot be claimed without being served.
584
- * Still functional; scheduled for removal in the next major.
585
- */
586
- enable(callback) {
587
- this._legacyCallback.set(callback);
588
- }
589
- /**
590
- * @deprecated The shell now revokes automatically when the page changes; there is
591
- * nothing to call. Still functional; scheduled for removal in the next major.
592
- */
593
- disable() {
594
- this._page.set(null);
595
- this._legacyCallback.set(null);
596
- }
597
- /**
598
- * @deprecated Renamed to {@link submit}, which also records the query for the box.
599
- */
600
- callback(searchText, event) {
601
- this.submit(searchText ?? '', event);
602
- }
603
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
604
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, providedIn: 'root' }); }
605
- }
606
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchService, decorators: [{
607
- type: Injectable,
608
- args: [{
609
- providedIn: 'root'
610
- }]
611
- }] });
612
-
613
- class DarkModeComponent {
614
- constructor(service) {
615
- this.service = service;
616
- this.ThemeMode = ThemeMode;
617
- this.prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
618
- this.icons = new Map([
619
- [ThemeMode.Light, "light_mode"],
620
- [ThemeMode.Dark, "dark_mode"],
621
- [ThemeMode.Auto, "adjust"]
622
- ]);
623
- this.names = new Map([
624
- [ThemeMode.Light, "Light"],
625
- [ThemeMode.Dark, "Dark"],
626
- [ThemeMode.Auto, "Adaptive"]
627
- ]);
628
- this.name = "";
629
- this.icon = "light_mode";
630
- this.prefersDark.addEventListener("change", e => {
631
- this.initTheme(e.matches);
632
- });
633
- this.initTheme(this.prefersDark.matches);
634
- }
635
- toggleDarkMode() {
636
- this.service.toggleDarkMode();
637
- this.initTheme(this.prefersDark.matches);
638
- }
639
- initTheme(prefersDark = false) {
640
- var mode = this.service.getThemeMode();
641
- var scheme = mode == ThemeMode.Auto ? prefersDark ? ThemeMode.Dark : ThemeMode.Light
642
- : mode;
643
- document.body.classList.remove("dark");
644
- if (scheme == ThemeMode.Dark) {
645
- document.body.classList.add(scheme);
646
- }
647
- this.icon = this.icons.get(mode) ?? "";
648
- this.name = this.names.get(mode) ?? "";
649
- }
650
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DarkModeComponent, deps: [{ token: LayoutService }], target: i0.ɵɵFactoryTarget.Component }); }
651
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: DarkModeComponent, isStandalone: false, selector: "juice-dark-mode", ngImport: i0, template: "<button mat-icon-button (click)=\"toggleDarkMode()\" matTooltip=\"{{ name | translate }}\" matTooltipPosition=\"left\"\n [attr.aria-label]=\"('Theme' | translate) + ': ' + (name | translate)\"><mat-icon aria-hidden=\"true\">{{icon}}</mat-icon></button>\n", dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
652
- }
653
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DarkModeComponent, decorators: [{
654
- type: Component,
655
- args: [{ selector: 'juice-dark-mode', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<button mat-icon-button (click)=\"toggleDarkMode()\" matTooltip=\"{{ name | translate }}\" matTooltipPosition=\"left\"\n [attr.aria-label]=\"('Theme' | translate) + ': ' + (name | translate)\"><mat-icon aria-hidden=\"true\">{{icon}}</mat-icon></button>\n" }]
656
- }], ctorParameters: () => [{ type: LayoutService }] });
657
-
658
- /** The palette menu beside the dark mode switch: every page follows the palette picked here. Hidden with one palette. */
659
- class PaletteSwitchComponent {
660
- constructor() {
661
- this.service = inject(LayoutService);
662
- this.palettes = this.service.palettes();
663
- /** The palette in use; without a choice or a configured default, the first one (the stylesheet's default). */
664
- this.current = computed(() => this.service.palette() ?? this.palettes[0]?.id, /* @ts-ignore */
665
- ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
666
- }
667
- select(id) {
668
- this.service.setPalette(id);
669
- }
670
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PaletteSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
671
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PaletteSwitchComponent, isStandalone: false, selector: "juice-palette-switch", ngImport: i0, template: "@if (palettes.length > 1) {\n <button mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"{{ 'Colours' | translate }}\" matTooltipPosition=\"left\"\n [attr.aria-label]=\"'Colours' | translate\" data-testid=\"palette-switch\">\n <mat-icon>palette</mat-icon>\n </button>\n <mat-menu #menu=\"matMenu\" xPosition=\"before\">\n @for (p of palettes; track p.id) {\n <button mat-menu-item (click)=\"select(p.id)\" role=\"menuitemradio\" [attr.aria-checked]=\"p.id === current()\">\n <span class=\"swatch\" [class.current]=\"p.id === current()\" [style.background]=\"p.color\"></span>\n <span class=\"name\" [class.current]=\"p.id === current()\">{{ p.name | translate }}</span>\n </button>\n }\n </mat-menu>\n}\n", styles: [".swatch{display:inline-block;width:18px;height:18px;margin-right:16px;border-radius:50%;vertical-align:middle;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.swatch.current{box-shadow:0 0 0 2px var(--mat-sys-surface-container, #fff),0 0 0 4px currentColor}.name{vertical-align:middle}.name.current{font-weight:600}\n"], dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i4$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i4$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i4$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
672
- }
673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PaletteSwitchComponent, decorators: [{
674
- type: Component,
675
- args: [{ selector: 'juice-palette-switch', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@if (palettes.length > 1) {\n <button mat-icon-button [matMenuTriggerFor]=\"menu\" matTooltip=\"{{ 'Colours' | translate }}\" matTooltipPosition=\"left\"\n [attr.aria-label]=\"'Colours' | translate\" data-testid=\"palette-switch\">\n <mat-icon>palette</mat-icon>\n </button>\n <mat-menu #menu=\"matMenu\" xPosition=\"before\">\n @for (p of palettes; track p.id) {\n <button mat-menu-item (click)=\"select(p.id)\" role=\"menuitemradio\" [attr.aria-checked]=\"p.id === current()\">\n <span class=\"swatch\" [class.current]=\"p.id === current()\" [style.background]=\"p.color\"></span>\n <span class=\"name\" [class.current]=\"p.id === current()\">{{ p.name | translate }}</span>\n </button>\n }\n </mat-menu>\n}\n", styles: [".swatch{display:inline-block;width:18px;height:18px;margin-right:16px;border-radius:50%;vertical-align:middle;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.swatch.current{box-shadow:0 0 0 2px var(--mat-sys-surface-container, #fff),0 0 0 4px currentColor}.name{vertical-align:middle}.name.current{font-weight:600}\n"] }]
676
- }] });
677
-
678
618
  class TooltipComponent {
679
619
  constructor(elementRef) {
680
620
  this.elementRef = elementRef;
@@ -712,7 +652,7 @@ class TooltipComponent {
712
652
  }
713
653
  }
714
654
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
715
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TooltipComponent, isStandalone: false, selector: "tooltip", ngImport: i0, template: "@if (display) {\n <div #tooltipId class=\"tooltip\" [ngClass]=\"['tooltip--'+position]\"\n [style.left]=\"left + 'px'\" [style.top]=\"top + 'px'\">\n {{tooltip}}\n </div>\n}", styles: [".tooltip{position:fixed;background-color:#000;border-radius:4px;color:#fff;font-family:Arial;padding:3px 6px;font-size:13px;z-index:9999}.tooltip:before{content:\"\";width:0;height:0;position:absolute}.tooltip--visible{opacity:1;transition:opacity .3s}.tooltip--light{background-color:#fff;color:#000}.tooltip--light:before{border:5px solid white}.tooltip--dark{background-color:#000;color:#fff}.tooltip--dark:before{border:5px solid black}.tooltip--below{transform:translate(-50%);margin-top:7px}.tooltip--below:before{border-left-color:transparent;border-right-color:transparent;border-top:none;left:calc(50% - 5px);top:-5px}.tooltip--above{transform:translate(-50%,-100%);margin-bottom:7px}.tooltip--above:before{border-left-color:transparent;border-right-color:transparent;border-bottom:none;left:calc(50% - 5px);bottom:-5px}.tooltip--left{transform:translate(calc(-100% - 7px),-50%)}.tooltip--left:before{border-top-color:transparent;border-bottom-color:transparent;border-right:none;right:-5px;top:calc(50% - 5px)}.tooltip--right{transform:translateY(-50%);margin-left:7px}.tooltip--right:before{border-top-color:transparent;border-bottom-color:transparent;border-left:none;left:-5px;top:calc(50% - 5px)}.tooltip--dynamic{margin-left:20px}.tooltip--dynamic:before{display:none}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
655
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TooltipComponent, isStandalone: false, selector: "tooltip", ngImport: i0, template: "@if (display) {\n <div #tooltipId class=\"tooltip\" [ngClass]=\"['tooltip--'+position]\"\n [style.left]=\"left + 'px'\" [style.top]=\"top + 'px'\">\n {{tooltip}}\n </div>\n}", styles: [".tooltip{position:fixed;background-color:#000;border-radius:4px;color:#fff;font-family:Arial;padding:3px 6px;font-size:13px;z-index:9999}.tooltip:before{content:\"\";width:0;height:0;position:absolute}.tooltip--visible{opacity:1;transition:opacity .3s}.tooltip--light{background-color:#fff;color:#000}.tooltip--light:before{border:5px solid white}.tooltip--dark{background-color:#000;color:#fff}.tooltip--dark:before{border:5px solid black}.tooltip--below{transform:translate(-50%);margin-top:7px}.tooltip--below:before{border-left-color:transparent;border-right-color:transparent;border-top:none;left:calc(50% - 5px);top:-5px}.tooltip--above{transform:translate(-50%,-100%);margin-bottom:7px}.tooltip--above:before{border-left-color:transparent;border-right-color:transparent;border-bottom:none;left:calc(50% - 5px);bottom:-5px}.tooltip--left{transform:translate(calc(-100% - 7px),-50%)}.tooltip--left:before{border-top-color:transparent;border-bottom-color:transparent;border-right:none;right:-5px;top:calc(50% - 5px)}.tooltip--right{transform:translateY(-50%);margin-left:7px}.tooltip--right:before{border-top-color:transparent;border-bottom-color:transparent;border-left:none;left:-5px;top:calc(50% - 5px)}.tooltip--dynamic{margin-left:20px}.tooltip--dynamic:before{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
716
656
  }
717
657
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipComponent, decorators: [{
718
658
  type: Component,
@@ -953,23 +893,69 @@ class MenuBadgeComponent {
953
893
  ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
954
894
  }
955
895
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: MenuBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
956
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: MenuBadgeComponent, isStandalone: false, selector: "juice-menu-badge", inputs: { badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, folded: { classPropertyName: "folded", publicName: "folded", isSignal: true, isRequired: false, transformFunction: null }, menuId: { classPropertyName: "menuId", publicName: "menuId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.folded": "folded()", "hidden": "!text()", "attr.data-menu-id": "menuId() || null", "attr.title": "badge()?.hint || null", "attr.aria-label": "badge()?.hint || null" } }, ngImport: i0, template: '{{ text() }}', isInline: true, styles: [":host{display:inline-block;min-width:1.25rem;margin-left:.5rem;padding:0 .375rem;box-sizing:border-box;border-radius:999px;font-size:.75rem;font-weight:600;line-height:1.25rem;text-align:center;vertical-align:middle;background:var(--mat-sys-error, #b3261e);color:var(--mat-sys-on-error, #fff)}:host([hidden]){display:none}:host(.folded){position:absolute;left:30px;top:calc(50% - 18px);margin:0;transform:scale(.75);transform-origin:top left;pointer-events:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
896
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: MenuBadgeComponent, isStandalone: true, selector: "juice-menu-badge", inputs: { badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, folded: { classPropertyName: "folded", publicName: "folded", isSignal: true, isRequired: false, transformFunction: null }, menuId: { classPropertyName: "menuId", publicName: "menuId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.folded": "folded()", "hidden": "!text()", "attr.data-menu-id": "menuId() || null", "attr.title": "badge()?.hint || null", "attr.aria-label": "badge()?.hint || null" } }, ngImport: i0, template: '{{ text() }}', isInline: true, styles: [":host{display:inline-block;min-width:1.25rem;margin-left:var(--juice-space-2);padding:0 .375rem;box-sizing:border-box;border-radius:var(--juice-radius-full);font-size:var(--juice-text-xs);font-weight:var(--juice-weight-semibold);line-height:1.25rem;text-align:center;vertical-align:middle;background:var(--juice-color-bad);color:var(--juice-color-text-on-accent)}:host([hidden]){display:none}:host(.folded){position:absolute;left:1.75rem;top:.25rem;margin:0;transform:scale(.75);transform-origin:top left;pointer-events:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
957
897
  }
958
898
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: MenuBadgeComponent, decorators: [{
959
899
  type: Component,
960
- args: [{ selector: 'juice-menu-badge', template: '{{ text() }}', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, host: {
900
+ args: [{ selector: 'juice-menu-badge', template: '{{ text() }}', changeDetection: ChangeDetectionStrategy.OnPush, host: {
961
901
  '[class.folded]': 'folded()',
962
902
  '[hidden]': '!text()',
963
903
  '[attr.data-menu-id]': 'menuId() || null',
964
904
  '[attr.title]': 'badge()?.hint || null',
965
905
  '[attr.aria-label]': 'badge()?.hint || null',
966
- }, styles: [":host{display:inline-block;min-width:1.25rem;margin-left:.5rem;padding:0 .375rem;box-sizing:border-box;border-radius:999px;font-size:.75rem;font-weight:600;line-height:1.25rem;text-align:center;vertical-align:middle;background:var(--mat-sys-error, #b3261e);color:var(--mat-sys-on-error, #fff)}:host([hidden]){display:none}:host(.folded){position:absolute;left:30px;top:calc(50% - 18px);margin:0;transform:scale(.75);transform-origin:top left;pointer-events:none}\n"] }]
906
+ }, styles: [":host{display:inline-block;min-width:1.25rem;margin-left:var(--juice-space-2);padding:0 .375rem;box-sizing:border-box;border-radius:var(--juice-radius-full);font-size:var(--juice-text-xs);font-weight:var(--juice-weight-semibold);line-height:1.25rem;text-align:center;vertical-align:middle;background:var(--juice-color-bad);color:var(--juice-color-text-on-accent)}:host([hidden]){display:none}:host(.folded){position:absolute;left:1.75rem;top:.25rem;margin:0;transform:scale(.75);transform-origin:top left;pointer-events:none}\n"] }]
967
907
  }], propDecorators: { badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }], folded: [{ type: i0.Input, args: [{ isSignal: true, alias: "folded", required: false }] }], menuId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuId", required: false }] }] } });
968
908
 
909
+ /** The side menu's rows, shared by the menu and its groups (global: ViewEncapsulation.None, all under `.juice-nav`). */
910
+ const NAV_STYLES = `
911
+ .juice-nav, .juice-nav ul { list-style: none; margin: 0; padding: 0; }
912
+ .juice-nav { padding: var(--juice-space-2) 0; }
913
+ .juice-nav li { margin: 0; }
914
+ .juice-nav__item {
915
+ box-sizing: border-box;
916
+ position: relative;
917
+ display: flex;
918
+ align-items: center;
919
+ gap: var(--juice-space-3);
920
+ width: 100%;
921
+ min-height: var(--juice-sidebar-item-height);
922
+ padding: 0 var(--juice-space-4) 0 calc(var(--juice-space-4) + var(--juice-space-1));
923
+ border: 0;
924
+ background: transparent;
925
+ color: var(--juice-sidebar-fg);
926
+ font: inherit;
927
+ font-size: var(--juice-text-sm);
928
+ text-align: start;
929
+ text-decoration: none;
930
+ white-space: nowrap;
931
+ cursor: pointer;
932
+ }
933
+ .juice-nav__item:hover { background: var(--juice-sidebar-item-hover-bg); color: var(--juice-color-text); }
934
+ .juice-nav__item.active { background: var(--juice-sidebar-item-active-bg); color: var(--juice-sidebar-item-active-fg);
935
+ font-weight: var(--juice-weight-medium); }
936
+ .juice-nav__item.active::before { content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px;
937
+ border-radius: var(--juice-radius-full); background: var(--juice-color-accent); }
938
+ .juice-nav__item:focus-visible { outline: 2px solid var(--juice-color-focus-ring); outline-offset: -2px; }
939
+ .juice-nav__item > juice-icon { color: inherit; }
940
+ .juice-nav__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
941
+ .juice-nav__chevron { margin-left: auto; transition: transform var(--juice-duration-fast) var(--juice-ease-standard); }
942
+ .juice-nav-group--open > .juice-nav-group__header .juice-nav__chevron { transform: rotate(180deg); }
943
+ .juice-nav-group__header { display: flex; align-items: stretch; }
944
+ .juice-nav-group__header > a.juice-nav__item { flex: 1 1 auto; min-width: 0; }
945
+ .juice-nav-group__toggle { width: auto; flex: none; padding: 0 var(--juice-space-3); }
946
+ .juice-nav-group__children .juice-nav__item { font-size: var(--juice-text-sm); }
947
+ .juice-nav--expanded .juice-nav-group__children .juice-nav__item { padding-left: calc(var(--juice-space-4) * 2 + var(--juice-space-2)); }
948
+ .juice-nav-group__children[hidden] { display: none; }
949
+ .juice-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%);
950
+ white-space: nowrap; border: 0; }
951
+ `;
952
+
953
+ let nextId$1 = 0;
969
954
  /**
970
955
  * A menu item with children: a header that opens and closes them. The group opens itself whenever a navigation lands
971
956
  * on one of its pages (also one kept out of the menu, `inMenu: false`), even if it was closed by hand. A header with a
972
- * page of its own opens that page too; one without (`routerLink: ''`) only opens and closes.
957
+ * page of its own links to that page (and opens the group), with a separate button to open and close it; one without
958
+ * (`routerLink: ''`) is that button.
973
959
  */
974
960
  class ExpandableMenuComponent {
975
961
  /**
@@ -982,7 +968,7 @@ class ExpandableMenuComponent {
982
968
  this.update();
983
969
  // Outside a side menu (no MenuActiveLink), the group opens when the mark arrives on it; in one, the navigation does it.
984
970
  if (!this.menu && value !== before && this.open)
985
- this.panel()?.open();
971
+ this.setExpanded(true);
986
972
  }
987
973
  get activeLink() { return this._activeLink; }
988
974
  /** The entry on display: the menu's, current as soon as a navigation ends; else the input's. */
@@ -1002,19 +988,26 @@ class ExpandableMenuComponent {
1002
988
  /** The side menu it is in, which knows the entry on display as soon as a navigation ends. */
1003
989
  this.menu = inject(MenuActiveLink, { optional: true });
1004
990
  this.cdr = inject(ChangeDetectorRef);
1005
- this.panel = viewChild(MatExpansionPanel, /* @ts-ignore */
1006
- ...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
1007
991
  this._item = {};
1008
992
  this.badges = inject(MenuBadgeService);
1009
993
  this.itemId = signal('', /* @ts-ignore */
1010
994
  ...(ngDevMode ? [{ debugName: "itemId" }] : /* istanbul ignore next */ []));
1011
995
  this.childIds = signal([], /* @ts-ignore */
1012
996
  ...(ngDevMode ? [{ debugName: "childIds" }] : /* istanbul ignore next */ []));
997
+ this._expanded = signal(false, /* @ts-ignore */
998
+ ...(ngDevMode ? [{ debugName: "_expanded" }] : /* istanbul ignore next */ []));
999
+ /** Whether the group's pages show (opened or closed by hand, or by a navigation). */
1000
+ this.expanded = this._expanded.asReadonly();
1001
+ /** The group was opened (by hand or by a navigation). */
1002
+ this.opened = output();
1003
+ /** The id of the list of its pages (the header's `aria-controls`). */
1004
+ this.listId = `juice-nav-group-${++nextId$1}`;
1013
1005
  /** The header's own count, shown while the group is open. */
1014
1006
  this.ownBadge = computed(() => this.badges.get(this.itemId()), /* @ts-ignore */
1015
1007
  ...(ngDevMode ? [{ debugName: "ownBadge" }] : /* istanbul ignore next */ []));
1016
1008
  /** While the group is closed: its own count and its pages' together. */
1017
1009
  this.closedBadge = this.badges.total(computed(() => [this.itemId(), ...this.childIds()]));
1010
+ /** Whether labels show (the menu is unfolded). */
1018
1011
  this.isExpanded = false;
1019
1012
  this.TooltipPosition = TooltipPosition;
1020
1013
  /** The children the side menu shows. */
@@ -1032,12 +1025,24 @@ class ExpandableMenuComponent {
1032
1025
  // the same page (a filter writing the query string) leaves it as the user left it.
1033
1026
  const now = this.path();
1034
1027
  if (this.open && now !== path)
1035
- this.panel()?.open();
1028
+ this.setExpanded(true);
1036
1029
  path = now;
1037
1030
  this.cdr.markForCheck();
1038
1031
  });
1039
1032
  inject(DestroyRef).onDestroy(() => navigations.unsubscribe());
1040
1033
  }
1034
+ /** Opens or closes the group's pages. */
1035
+ setExpanded(value) {
1036
+ if (this._expanded() === value)
1037
+ return;
1038
+ this._expanded.set(value);
1039
+ if (value)
1040
+ this.opened.emit();
1041
+ this.cdr.markForCheck();
1042
+ }
1043
+ toggle() {
1044
+ this.setExpanded(!this._expanded());
1045
+ }
1041
1046
  update() {
1042
1047
  const item = this._item;
1043
1048
  const all = item?.children ?? [];
@@ -1048,9 +1053,14 @@ class ExpandableMenuComponent {
1048
1053
  this.headerActive = this.current !== undefined ? this.isMenuActive(this.headerLink) : this.isActive(this.headerLink, ExactMatch);
1049
1054
  // The header's own page opens the group with the pages under it, unless it is the home page or the tenant's root.
1050
1055
  const headerSection = !!this.headerLink && !isRoot(item.rawRouterLink);
1051
- this.open = this.headerActive || (headerSection && this.isActive(this.headerLink, SectionMatch))
1056
+ const open = this.headerActive || (headerSection && this.isActive(this.headerLink, SectionMatch))
1052
1057
  || all.some(c => this.isActive(c.routerLink, this.matching(c.routerLink, links)))
1053
1058
  || all.some(c => this.isMenuActive(c.routerLink)); // by the menu's mark: also by activePaths, also a page kept out of the menu
1059
+ // The group follows a change of `open` (as a bound [expanded] did in 2.x); in between, the user's hand wins.
1060
+ if (open !== this.open) {
1061
+ this.open = open;
1062
+ this.setExpanded(open);
1063
+ }
1054
1064
  }
1055
1065
  /** The URL's path, without query string or fragment. */
1056
1066
  path() {
@@ -1081,12 +1091,13 @@ class ExpandableMenuComponent {
1081
1091
  return !!link && this.router.isActive(this.router.parseUrl(link), options);
1082
1092
  }
1083
1093
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpandableMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1084
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ExpandableMenuComponent, isStandalone: false, selector: "juice-expandable-menu", inputs: { isExpanded: "isExpanded", activeLink: "activeLink", item: "item" }, host: { properties: { "class.menu-expanded": "isExpanded" } }, viewQueries: [{ propertyName: "panel", first: true, predicate: MatExpansionPanel, descendants: true, isSignal: true }], ngImport: i0, template: "<mat-expansion-panel #panel [expanded]=\"open\" [hideToggle]=\"!isExpanded\" [class.active]=\"open\">\n <!-- The header is the button that opens the group (and its page): Material's list item sets its own aria-current, null outside a nav list. -->\n <mat-expansion-panel-header [attr.aria-current]=\"headerActive ? 'page' : null\">\n <mat-list-item [routerLink]=\"headerLink\" [class.active]=\"headerActive\">\n <mat-icon matListItemIcon color=\"accent\">{{ item.icon }}</mat-icon>\n <!-- Closed, the header carries its pages' counts: they are hidden with them. Open, they show beside their pages. -->\n @if (isExpanded) {\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ item.label }}<juice-menu-badge [badge]=\"panel.expanded ? ownBadge() : closedBadge()\" [menuId]=\"item.id\"></juice-menu-badge></span>\n } @else {\n <juice-menu-badge [badge]=\"panel.expanded ? ownBadge() : closedBadge()\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </mat-list-item>\n </mat-expansion-panel-header>\n <!-- A navigation landmark of its own, inside the menu's: named after the group, so no two landmarks read the same (axe landmark-unique). -->\n <mat-nav-list [attr.aria-label]=\"item.label\">\n @for (subitem of children; track subitem) {\n <mat-list-item routerLink=\"{{ subitem.routerLink }}\" [class.active]=\"isChildActive(subitem)\"\n [attr.aria-current]=\"isChildActive(subitem) ? 'page' : null\">\n <mat-icon matListItemIcon color=\"accent\">{{ subitem.icon }}</mat-icon>\n @if (isExpanded) {\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ subitem.label }}<juice-menu-badge [badge]=\"badges.get(subitem.id)\" [menuId]=\"subitem.id\"></juice-menu-badge></span>\n } @else {\n <juice-menu-badge [badge]=\"badges.get(subitem.id)\" [folded]=\"true\" [menuId]=\"subitem.id\"></juice-menu-badge>\n }\n </mat-list-item>\n }\n </mat-nav-list>\n</mat-expansion-panel>\n", styles: [":host ::ng-deep .mat-expansion-panel,:host ::ng-deep .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none;background:transparent;border-radius:0;color:inherit}:host ::ng-deep .mat-expansion-panel.mat-expanded,:host ::ng-deep .mat-expansion-panel-spacing{margin:0}:host ::ng-deep .mat-expansion-panel-header{padding:0;background:transparent}:host ::ng-deep .mat-expansion-panel-header .mdc-list-item{padding:0}:host ::ng-deep .mat-expansion-panel-header .mat-expansion-indicator{position:absolute;right:0;padding:16px}:host ::ng-deep .mat-expansion-panel-body{padding:0}:host ::ng-deep .mat-content.mat-content-hide-toggle{margin-right:0}:host ::ng-deep .mat-mdc-list-item{position:relative}:host.menu-expanded ::ng-deep .mat-expansion-panel-body .mat-mdc-list-item{padding-left:32px}\n"], dependencies: [{ kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3$2.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i3$2.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "component", type: i7.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i7.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i7.MatListItemIcon, selector: "[matListItemIcon]" }, { kind: "directive", type: i7.MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "component", type: MenuBadgeComponent, selector: "juice-menu-badge", inputs: ["badge", "folded", "menuId"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1094
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ExpandableMenuComponent, isStandalone: true, selector: "juice-expandable-menu", inputs: { isExpanded: "isExpanded", activeLink: "activeLink", item: "item" }, outputs: { opened: "opened" }, host: { properties: { "class.menu-expanded": "isExpanded", "class.juice-nav--expanded": "isExpanded", "class.juice-nav-group--open": "expanded()" }, classAttribute: "juice-nav-group" }, ngImport: i0, template: "<div class=\"juice-nav-group__header\">\n @if (headerLink) {\n <!-- A header with a page of its own: the link opens the page (and the group); the button beside it only opens and closes. -->\n <a class=\"juice-nav__item\" [routerLink]=\"headerLink\" [class.active]=\"headerActive\"\n [attr.aria-current]=\"headerActive ? 'page' : null\" [attr.title]=\"isExpanded ? null : item.label\" (click)=\"setExpanded(true)\">\n <ng-container *ngTemplateOutlet=\"head\" />\n </a>\n @if (isExpanded) {\n <button type=\"button\" class=\"juice-nav__item juice-nav-group__toggle\" (click)=\"toggle()\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"listId\" [attr.aria-label]=\"item.label\">\n <juice-icon class=\"juice-nav__chevron\" name=\"chevron-down\" [size]=\"16\" />\n </button>\n }\n } @else {\n <button type=\"button\" class=\"juice-nav__item\" (click)=\"toggle()\" [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"listId\"\n [attr.title]=\"isExpanded ? null : item.label\">\n <ng-container *ngTemplateOutlet=\"head\" />\n @if (isExpanded) { <juice-icon class=\"juice-nav__chevron\" name=\"chevron-down\" [size]=\"16\" /> }\n </button>\n }\n</div>\n<ng-template #head>\n <juice-icon [name]=\"item.icon\" [size]=\"20\" />\n <!-- Closed, the header carries its pages' counts: they are hidden with them. Open, they show beside their pages. -->\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"expanded() ? ownBadge() : closedBadge()\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"expanded() ? ownBadge() : closedBadge()\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n</ng-template>\n<!-- Named after the group, so a screen reader announces where its pages belong. -->\n<ul class=\"juice-nav-group__children\" [id]=\"listId\" [hidden]=\"!expanded()\" [attr.aria-label]=\"item.label\">\n @for (subitem of children; track subitem) {\n <li>\n <a class=\"juice-nav__item\" [routerLink]=\"subitem.routerLink\" [class.active]=\"isChildActive(subitem)\"\n [attr.aria-current]=\"isChildActive(subitem) ? 'page' : null\" [attr.title]=\"isExpanded ? null : subitem.label\">\n <juice-icon [name]=\"subitem.icon\" [size]=\"18\" />\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ subitem.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(subitem.id)\" [menuId]=\"subitem.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(subitem.id)\" [folded]=\"true\" [menuId]=\"subitem.id\"></juice-menu-badge>\n }\n </a>\n </li>\n }\n</ul>\n", styles: [".juice-nav,.juice-nav ul{list-style:none;margin:0;padding:0}.juice-nav{padding:var(--juice-space-2) 0}.juice-nav li{margin:0}.juice-nav__item{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--juice-space-3);width:100%;min-height:var(--juice-sidebar-item-height);padding:0 var(--juice-space-4) 0 calc(var(--juice-space-4) + var(--juice-space-1));border:0;background:transparent;color:var(--juice-sidebar-fg);font:inherit;font-size:var(--juice-text-sm);text-align:start;text-decoration:none;white-space:nowrap;cursor:pointer}.juice-nav__item:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-nav__item.active{background:var(--juice-sidebar-item-active-bg);color:var(--juice-sidebar-item-active-fg);font-weight:var(--juice-weight-medium)}.juice-nav__item.active:before{content:\"\";position:absolute;left:0;top:20%;bottom:20%;width:3px;border-radius:var(--juice-radius-full);background:var(--juice-color-accent)}.juice-nav__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.juice-nav__item>juice-icon{color:inherit}.juice-nav__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}.juice-nav__chevron{margin-left:auto;transition:transform var(--juice-duration-fast) var(--juice-ease-standard)}.juice-nav-group--open>.juice-nav-group__header .juice-nav__chevron{transform:rotate(180deg)}.juice-nav-group__header{display:flex;align-items:stretch}.juice-nav-group__header>a.juice-nav__item{flex:1 1 auto;min-width:0}.juice-nav-group__toggle{width:auto;flex:none;padding:0 var(--juice-space-3)}.juice-nav-group__children .juice-nav__item{font-size:var(--juice-text-sm)}.juice-nav--expanded .juice-nav-group__children .juice-nav__item{padding-left:calc(var(--juice-space-4) * 2 + var(--juice-space-2))}.juice-nav-group__children[hidden]{display:none}.juice-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: MenuBadgeComponent, selector: "juice-menu-badge", inputs: ["badge", "folded", "menuId"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None }); }
1085
1095
  }
1086
1096
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpandableMenuComponent, decorators: [{
1087
1097
  type: Component,
1088
- args: [{ selector: 'juice-expandable-menu', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, host: { '[class.menu-expanded]': 'isExpanded' }, template: "<mat-expansion-panel #panel [expanded]=\"open\" [hideToggle]=\"!isExpanded\" [class.active]=\"open\">\n <!-- The header is the button that opens the group (and its page): Material's list item sets its own aria-current, null outside a nav list. -->\n <mat-expansion-panel-header [attr.aria-current]=\"headerActive ? 'page' : null\">\n <mat-list-item [routerLink]=\"headerLink\" [class.active]=\"headerActive\">\n <mat-icon matListItemIcon color=\"accent\">{{ item.icon }}</mat-icon>\n <!-- Closed, the header carries its pages' counts: they are hidden with them. Open, they show beside their pages. -->\n @if (isExpanded) {\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ item.label }}<juice-menu-badge [badge]=\"panel.expanded ? ownBadge() : closedBadge()\" [menuId]=\"item.id\"></juice-menu-badge></span>\n } @else {\n <juice-menu-badge [badge]=\"panel.expanded ? ownBadge() : closedBadge()\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </mat-list-item>\n </mat-expansion-panel-header>\n <!-- A navigation landmark of its own, inside the menu's: named after the group, so no two landmarks read the same (axe landmark-unique). -->\n <mat-nav-list [attr.aria-label]=\"item.label\">\n @for (subitem of children; track subitem) {\n <mat-list-item routerLink=\"{{ subitem.routerLink }}\" [class.active]=\"isChildActive(subitem)\"\n [attr.aria-current]=\"isChildActive(subitem) ? 'page' : null\">\n <mat-icon matListItemIcon color=\"accent\">{{ subitem.icon }}</mat-icon>\n @if (isExpanded) {\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ subitem.label }}<juice-menu-badge [badge]=\"badges.get(subitem.id)\" [menuId]=\"subitem.id\"></juice-menu-badge></span>\n } @else {\n <juice-menu-badge [badge]=\"badges.get(subitem.id)\" [folded]=\"true\" [menuId]=\"subitem.id\"></juice-menu-badge>\n }\n </mat-list-item>\n }\n </mat-nav-list>\n</mat-expansion-panel>\n", styles: [":host ::ng-deep .mat-expansion-panel,:host ::ng-deep .mat-expansion-panel:not([class*=mat-elevation-z]){box-shadow:none;background:transparent;border-radius:0;color:inherit}:host ::ng-deep .mat-expansion-panel.mat-expanded,:host ::ng-deep .mat-expansion-panel-spacing{margin:0}:host ::ng-deep .mat-expansion-panel-header{padding:0;background:transparent}:host ::ng-deep .mat-expansion-panel-header .mdc-list-item{padding:0}:host ::ng-deep .mat-expansion-panel-header .mat-expansion-indicator{position:absolute;right:0;padding:16px}:host ::ng-deep .mat-expansion-panel-body{padding:0}:host ::ng-deep .mat-content.mat-content-hide-toggle{margin-right:0}:host ::ng-deep .mat-mdc-list-item{position:relative}:host.menu-expanded ::ng-deep .mat-expansion-panel-body .mat-mdc-list-item{padding-left:32px}\n"] }]
1089
- }], ctorParameters: () => [], propDecorators: { panel: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatExpansionPanel), { isSignal: true }] }], isExpanded: [{
1098
+ args: [{ selector: 'juice-expandable-menu', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Eager, imports: [RouterLink, NgTemplateOutlet, JuiceIcon, MenuBadgeComponent], host: { 'class': 'juice-nav-group', '[class.menu-expanded]': 'isExpanded', '[class.juice-nav--expanded]': 'isExpanded',
1099
+ '[class.juice-nav-group--open]': 'expanded()' }, template: "<div class=\"juice-nav-group__header\">\n @if (headerLink) {\n <!-- A header with a page of its own: the link opens the page (and the group); the button beside it only opens and closes. -->\n <a class=\"juice-nav__item\" [routerLink]=\"headerLink\" [class.active]=\"headerActive\"\n [attr.aria-current]=\"headerActive ? 'page' : null\" [attr.title]=\"isExpanded ? null : item.label\" (click)=\"setExpanded(true)\">\n <ng-container *ngTemplateOutlet=\"head\" />\n </a>\n @if (isExpanded) {\n <button type=\"button\" class=\"juice-nav__item juice-nav-group__toggle\" (click)=\"toggle()\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"listId\" [attr.aria-label]=\"item.label\">\n <juice-icon class=\"juice-nav__chevron\" name=\"chevron-down\" [size]=\"16\" />\n </button>\n }\n } @else {\n <button type=\"button\" class=\"juice-nav__item\" (click)=\"toggle()\" [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"listId\"\n [attr.title]=\"isExpanded ? null : item.label\">\n <ng-container *ngTemplateOutlet=\"head\" />\n @if (isExpanded) { <juice-icon class=\"juice-nav__chevron\" name=\"chevron-down\" [size]=\"16\" /> }\n </button>\n }\n</div>\n<ng-template #head>\n <juice-icon [name]=\"item.icon\" [size]=\"20\" />\n <!-- Closed, the header carries its pages' counts: they are hidden with them. Open, they show beside their pages. -->\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"expanded() ? ownBadge() : closedBadge()\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"expanded() ? ownBadge() : closedBadge()\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n</ng-template>\n<!-- Named after the group, so a screen reader announces where its pages belong. -->\n<ul class=\"juice-nav-group__children\" [id]=\"listId\" [hidden]=\"!expanded()\" [attr.aria-label]=\"item.label\">\n @for (subitem of children; track subitem) {\n <li>\n <a class=\"juice-nav__item\" [routerLink]=\"subitem.routerLink\" [class.active]=\"isChildActive(subitem)\"\n [attr.aria-current]=\"isChildActive(subitem) ? 'page' : null\" [attr.title]=\"isExpanded ? null : subitem.label\">\n <juice-icon [name]=\"subitem.icon\" [size]=\"18\" />\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ subitem.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(subitem.id)\" [menuId]=\"subitem.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(subitem.id)\" [folded]=\"true\" [menuId]=\"subitem.id\"></juice-menu-badge>\n }\n </a>\n </li>\n }\n</ul>\n", styles: [".juice-nav,.juice-nav ul{list-style:none;margin:0;padding:0}.juice-nav{padding:var(--juice-space-2) 0}.juice-nav li{margin:0}.juice-nav__item{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--juice-space-3);width:100%;min-height:var(--juice-sidebar-item-height);padding:0 var(--juice-space-4) 0 calc(var(--juice-space-4) + var(--juice-space-1));border:0;background:transparent;color:var(--juice-sidebar-fg);font:inherit;font-size:var(--juice-text-sm);text-align:start;text-decoration:none;white-space:nowrap;cursor:pointer}.juice-nav__item:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-nav__item.active{background:var(--juice-sidebar-item-active-bg);color:var(--juice-sidebar-item-active-fg);font-weight:var(--juice-weight-medium)}.juice-nav__item.active:before{content:\"\";position:absolute;left:0;top:20%;bottom:20%;width:3px;border-radius:var(--juice-radius-full);background:var(--juice-color-accent)}.juice-nav__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.juice-nav__item>juice-icon{color:inherit}.juice-nav__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}.juice-nav__chevron{margin-left:auto;transition:transform var(--juice-duration-fast) var(--juice-ease-standard)}.juice-nav-group--open>.juice-nav-group__header .juice-nav__chevron{transform:rotate(180deg)}.juice-nav-group__header{display:flex;align-items:stretch}.juice-nav-group__header>a.juice-nav__item{flex:1 1 auto;min-width:0}.juice-nav-group__toggle{width:auto;flex:none;padding:0 var(--juice-space-3)}.juice-nav-group__children .juice-nav__item{font-size:var(--juice-text-sm)}.juice-nav--expanded .juice-nav-group__children .juice-nav__item{padding-left:calc(var(--juice-space-4) * 2 + var(--juice-space-2))}.juice-nav-group__children[hidden]{display:none}.juice-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"] }]
1100
+ }], ctorParameters: () => [], propDecorators: { opened: [{ type: i0.Output, args: ["opened"] }], isExpanded: [{
1090
1101
  type: Input
1091
1102
  }], activeLink: [{
1092
1103
  type: Input
@@ -1094,58 +1105,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1094
1105
  type: Input
1095
1106
  }] } });
1096
1107
 
1108
+ /**
1109
+ * The side menu: the app's menu items (MenuService), groups that open on their pages, counts (MenuBadgeService), and the
1110
+ * page on display marked. Unfolded it shows labels; folded, icons with the label as a tooltip and for screen readers.
1111
+ */
1097
1112
  class NavMenuComponent {
1098
- constructor(service, layout, tenantService, route, breakpointObserver, cdr, switcher) {
1099
- this.service = service;
1100
- this.layout = layout;
1101
- this.tenantService = tenantService;
1102
- this.route = route;
1103
- this.breakpointObserver = breakpointObserver;
1104
- this.cdr = cdr;
1105
- this.switcher = switcher;
1106
- this.isExpanded = false;
1107
- this.isMobile = false;
1113
+ /** Whether labels show: given by the shell, else on a phone or while the viewer keeps the menu open. */
1114
+ get isExpanded() {
1115
+ return this._expanded ?? (this.isMobile || this.layout.isMenuOpen());
1116
+ }
1117
+ set isExpanded(value) {
1118
+ this._expanded = value ?? null;
1119
+ }
1120
+ constructor() {
1108
1121
  this.items = [];
1109
1122
  /** The items the side menu shows: all but those marked `inMenu: false` (the page switcher still offers them). */
1110
1123
  this.menuItems = [];
1111
1124
  this.TooltipPosition = TooltipPosition;
1125
+ /** On a phone the menu is a panel over the page, always with labels. */
1126
+ this.isMobile = false;
1112
1127
  /** The counts on the entries ({@link MenuBadgeService}). */
1113
1128
  this.badges = inject(MenuBadgeService);
1129
+ this.layout = inject(LayoutService);
1130
+ this._expanded = null;
1131
+ this.router = inject(Router);
1132
+ this.cdr = inject(ChangeDetectorRef);
1114
1133
  /** The items that show as a group: they have pages the side menu shows. */
1115
1134
  this.groups = new Set();
1116
- this.router = inject(Router);
1117
1135
  /**
1118
1136
  * The path of the entry on display, across all the menu's entries (also the pages in groups): the most specific one,
1119
1137
  * so `/alerts/rules` is marked on `/alerts/rules` and `/alerts` is not.
1120
1138
  */
1121
1139
  this.activeLink = null;
1122
- if (route.snapshot.data['settingUrl']) {
1123
- this.settingUrl = route.snapshot.data['settingUrl'];
1124
- }
1125
- else {
1126
- this.settingUrl = layout.settingUrl();
1127
- }
1140
+ const service = inject(MenuService);
1141
+ const tenantService = inject(TenantService);
1142
+ const route = inject(ActivatedRoute);
1143
+ const switcher = inject(PageSwitcherService);
1144
+ this.settingUrl = route.snapshot.data['settingUrl'] || this.layout.settingUrl();
1128
1145
  // Async callbacks don't trigger change detection in zoneless apps (the Angular 22 default), so mark explicitly.
1129
1146
  tenantService.getTenantIdentifier().then(tenant => {
1130
1147
  this.settingUrl = this.settingUrl?.injectTenant(tenant);
1131
1148
  this.cdr.markForCheck();
1132
1149
  });
1133
- breakpointObserver.observe([
1134
- Breakpoints.HandsetLandscape,
1135
- Breakpoints.HandsetPortrait
1136
- ]).subscribe(result => {
1137
- this.isMobile = result.matches;
1138
- this.isExpanded = result.matches ? true : this.layout.isMenuOpen();
1139
- this.cdr.markForCheck();
1140
- });
1141
- this.service.getMenu().subscribe(items => {
1142
- console.debug('Menu items', JSON.parse(JSON.stringify(items)));
1150
+ const menu = service.getMenu().subscribe(items => {
1143
1151
  this.items = items;
1144
1152
  // A group shows while it has pages to show; one whose pages are all kept out shows as its own page, if it has one.
1145
1153
  this.groups = new Set(items.filter(i => i.menuChildren().length > 0));
1146
1154
  this.menuItems = items.filter(i => i.inMenu !== false && (this.groups.has(i) || i.hasOwnPage()));
1147
1155
  // The switcher offers the same items: one load, renewed whenever the shell (and this menu) is built again.
1148
- this.switcher.setItems(items);
1156
+ switcher.setItems(items);
1149
1157
  this.refreshActive();
1150
1158
  this.cdr.markForCheck();
1151
1159
  });
@@ -1153,7 +1161,7 @@ class NavMenuComponent {
1153
1161
  this.refreshActive();
1154
1162
  this.cdr.markForCheck();
1155
1163
  });
1156
- inject(DestroyRef).onDestroy(() => navigations.unsubscribe());
1164
+ inject(DestroyRef).onDestroy(() => { navigations.unsubscribe(); menu.unsubscribe(); });
1157
1165
  }
1158
1166
  refreshActive() {
1159
1167
  const entries = [];
@@ -1179,27 +1187,20 @@ class NavMenuComponent {
1179
1187
  isCurrent(item) {
1180
1188
  return this.activeLink !== null && !!item.routerLink && pathOf(this.router.parseUrl(item.routerLink)) === this.activeLink;
1181
1189
  }
1190
+ /** Flips the remembered open state (`IS_MENU_OPEN`). */
1182
1191
  toggle() {
1183
1192
  this.layout.toggleMenu();
1184
- this.isExpanded = this.layout.isMenuOpen();
1185
- }
1186
- mouseEnter() {
1187
- if (!this.isMobile) {
1188
- this.isExpanded = true;
1189
- }
1193
+ this._expanded = null;
1190
1194
  }
1191
- mouseLeave() {
1192
- if (!this.isMobile) {
1193
- this.isExpanded = this.layout.isMenuOpen();
1194
- }
1195
- }
1196
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NavMenuComponent, deps: [{ token: i1.MenuService }, { token: LayoutService }, { token: i1.TenantService }, { token: i3$1.ActivatedRoute }, { token: i4$2.BreakpointObserver }, { token: i0.ChangeDetectorRef }, { token: PageSwitcherService }], target: i0.ɵɵFactoryTarget.Component }); }
1197
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NavMenuComponent, isStandalone: false, selector: "juice-nav-menu", providers: [{ provide: MenuActiveLink, useExisting: forwardRef(() => NavMenuComponent) }], ngImport: i0, template: "<mat-nav-list class=\"menu-scroll\" [attr.aria-label]=\"'Menu' | translate\" (mouseenter)=\"mouseEnter()\" (mouseleave)=\"mouseLeave()\">\n @for (item of menuItems; track item) {\n @if (!groups.has(item)) {\n <mat-list-item\n routerLink=\"{{ item.routerLink }}\" [class.active]=\"isCurrent(item)\"\n [attr.aria-current]=\"isCurrent(item) ? 'page' : null\">\n <mat-icon matListItemIcon color=\"accent\">{{ item.icon }}</mat-icon>\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(item.id)\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(item.id)\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </mat-list-item>\n } @else {\n <juice-expandable-menu\n [item]=\"item\" [isExpanded]=\"isExpanded\" [activeLink]=\"activeLink\"></juice-expandable-menu>\n }\n }\n</mat-nav-list>\n<mat-divider></mat-divider>\n<mat-action-list class=\"list-horizontal bottom-menu\">\n @if (settingUrl) {\n <a mat-list-item [href]=\"settingUrl\" [attr.aria-label]=\"'Settings' | translate\"\n matTooltip=\"{{'Settings' | translate}}\" matTooltipPosition=\"right\" [matTooltipDisabled]=\"isExpanded\">\n <mat-icon>settings</mat-icon>\n </a>\n }\n @if (!isMobile) {\n <button mat-list-item (click)=\"toggle()\" [attr.aria-label]=\"(layout.isMenuOpen() ? 'Collapse menu' : 'Expand menu') | translate\"\n [attr.aria-expanded]=\"layout.isMenuOpen()\">\n <mat-icon [style.transform]= \"isExpanded ? 'rotate(-180deg)':'rotate(0)'\">double_arrow</mat-icon>\n </button>\n }\n</mat-action-list>", styles: [":host ::ng-deep{display:flex;flex-direction:column;justify-content:space-between;height:100%}:host ::ng-deep .menu-scroll{overflow-y:auto;overflow-x:hidden;flex:1}:host ::ng-deep .menu-scroll .mat-mdc-list-item{position:relative}:host ::ng-deep .menu-scroll .mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{margin-right:10px}:host ::ng-deep .list-horizontal{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end}:host ::ng-deep .list-horizontal .mat-mdc-list-item{width:auto;flex:1 auto}:host ::ng-deep .list-horizontal .mat-mdc-list-item .mdc-list-item__content{display:flex;justify-content:center}:host ::ng-deep .list-horizontal .mat-mdc-list-item .mdc-list-item__content .mat-mdc-list-item-unscoped-content{padding-top:5px}:host ::ng-deep .mat-mdc-list-base{padding:0}\n"], dependencies: [{ kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatActionList, selector: "mat-action-list", exportAs: ["matActionList"] }, { kind: "component", type: i7.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i7.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i7.MatListItemIcon, selector: "[matListItemIcon]" }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i7.MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: ExpandableMenuComponent, selector: "juice-expandable-menu", inputs: ["isExpanded", "activeLink", "item"] }, { kind: "component", type: MenuBadgeComponent, selector: "juice-menu-badge", inputs: ["badge", "folded", "menuId"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1195
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NavMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1196
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NavMenuComponent, isStandalone: true, selector: "juice-nav-menu", inputs: { isExpanded: "isExpanded" }, providers: [{ provide: MenuActiveLink, useExisting: forwardRef(() => NavMenuComponent) }], ngImport: i0, template: "<nav class=\"juice-nav\" [class.juice-nav--expanded]=\"isExpanded\" [attr.aria-label]=\"'Menu' | translate\">\n <ul>\n @for (item of menuItems; track item) {\n <li>\n @if (!groups.has(item)) {\n <a class=\"juice-nav__item\" [routerLink]=\"item.routerLink\" [class.active]=\"isCurrent(item)\"\n [attr.aria-current]=\"isCurrent(item) ? 'page' : null\" [attr.title]=\"isExpanded ? null : item.label\">\n <juice-icon [name]=\"item.icon\" [size]=\"20\" />\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(item.id)\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(item.id)\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </a>\n } @else {\n <juice-expandable-menu [item]=\"item\" [isExpanded]=\"isExpanded\" [activeLink]=\"activeLink\"></juice-expandable-menu>\n }\n </li>\n }\n </ul>\n</nav>\n", styles: [".juice-nav,.juice-nav ul{list-style:none;margin:0;padding:0}.juice-nav{padding:var(--juice-space-2) 0}.juice-nav li{margin:0}.juice-nav__item{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--juice-space-3);width:100%;min-height:var(--juice-sidebar-item-height);padding:0 var(--juice-space-4) 0 calc(var(--juice-space-4) + var(--juice-space-1));border:0;background:transparent;color:var(--juice-sidebar-fg);font:inherit;font-size:var(--juice-text-sm);text-align:start;text-decoration:none;white-space:nowrap;cursor:pointer}.juice-nav__item:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-nav__item.active{background:var(--juice-sidebar-item-active-bg);color:var(--juice-sidebar-item-active-fg);font-weight:var(--juice-weight-medium)}.juice-nav__item.active:before{content:\"\";position:absolute;left:0;top:20%;bottom:20%;width:3px;border-radius:var(--juice-radius-full);background:var(--juice-color-accent)}.juice-nav__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.juice-nav__item>juice-icon{color:inherit}.juice-nav__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}.juice-nav__chevron{margin-left:auto;transition:transform var(--juice-duration-fast) var(--juice-ease-standard)}.juice-nav-group--open>.juice-nav-group__header .juice-nav__chevron{transform:rotate(180deg)}.juice-nav-group__header{display:flex;align-items:stretch}.juice-nav-group__header>a.juice-nav__item{flex:1 1 auto;min-width:0}.juice-nav-group__toggle{width:auto;flex:none;padding:0 var(--juice-space-3)}.juice-nav-group__children .juice-nav__item{font-size:var(--juice-text-sm)}.juice-nav--expanded .juice-nav-group__children .juice-nav__item{padding-left:calc(var(--juice-space-4) * 2 + var(--juice-space-2))}.juice-nav-group__children[hidden]{display:none}.juice-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: MenuBadgeComponent, selector: "juice-menu-badge", inputs: ["badge", "folded", "menuId"] }, { kind: "component", type: ExpandableMenuComponent, selector: "juice-expandable-menu", inputs: ["isExpanded", "activeLink", "item"], outputs: ["opened"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None }); }
1198
1197
  }
1199
1198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NavMenuComponent, decorators: [{
1200
1199
  type: Component,
1201
- args: [{ selector: 'juice-nav-menu', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, providers: [{ provide: MenuActiveLink, useExisting: forwardRef(() => NavMenuComponent) }], template: "<mat-nav-list class=\"menu-scroll\" [attr.aria-label]=\"'Menu' | translate\" (mouseenter)=\"mouseEnter()\" (mouseleave)=\"mouseLeave()\">\n @for (item of menuItems; track item) {\n @if (!groups.has(item)) {\n <mat-list-item\n routerLink=\"{{ item.routerLink }}\" [class.active]=\"isCurrent(item)\"\n [attr.aria-current]=\"isCurrent(item) ? 'page' : null\">\n <mat-icon matListItemIcon color=\"accent\">{{ item.icon }}</mat-icon>\n <span matListItemTitle style=\"margin-left: 4px;\"> {{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(item.id)\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(item.id)\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </mat-list-item>\n } @else {\n <juice-expandable-menu\n [item]=\"item\" [isExpanded]=\"isExpanded\" [activeLink]=\"activeLink\"></juice-expandable-menu>\n }\n }\n</mat-nav-list>\n<mat-divider></mat-divider>\n<mat-action-list class=\"list-horizontal bottom-menu\">\n @if (settingUrl) {\n <a mat-list-item [href]=\"settingUrl\" [attr.aria-label]=\"'Settings' | translate\"\n matTooltip=\"{{'Settings' | translate}}\" matTooltipPosition=\"right\" [matTooltipDisabled]=\"isExpanded\">\n <mat-icon>settings</mat-icon>\n </a>\n }\n @if (!isMobile) {\n <button mat-list-item (click)=\"toggle()\" [attr.aria-label]=\"(layout.isMenuOpen() ? 'Collapse menu' : 'Expand menu') | translate\"\n [attr.aria-expanded]=\"layout.isMenuOpen()\">\n <mat-icon [style.transform]= \"isExpanded ? 'rotate(-180deg)':'rotate(0)'\">double_arrow</mat-icon>\n </button>\n }\n</mat-action-list>", styles: [":host ::ng-deep{display:flex;flex-direction:column;justify-content:space-between;height:100%}:host ::ng-deep .menu-scroll{overflow-y:auto;overflow-x:hidden;flex:1}:host ::ng-deep .menu-scroll .mat-mdc-list-item{position:relative}:host ::ng-deep .menu-scroll .mdc-list-item.mdc-list-item--with-one-line .mdc-list-item__start{margin-right:10px}:host ::ng-deep .list-horizontal{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end}:host ::ng-deep .list-horizontal .mat-mdc-list-item{width:auto;flex:1 auto}:host ::ng-deep .list-horizontal .mat-mdc-list-item .mdc-list-item__content{display:flex;justify-content:center}:host ::ng-deep .list-horizontal .mat-mdc-list-item .mdc-list-item__content .mat-mdc-list-item-unscoped-content{padding-top:5px}:host ::ng-deep .mat-mdc-list-base{padding:0}\n"] }]
1202
- }], ctorParameters: () => [{ type: i1.MenuService }, { type: LayoutService }, { type: i1.TenantService }, { type: i3$1.ActivatedRoute }, { type: i4$2.BreakpointObserver }, { type: i0.ChangeDetectorRef }, { type: PageSwitcherService }] });
1200
+ args: [{ selector: 'juice-nav-menu', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Eager, imports: [RouterLink, TranslatePipe, JuiceIcon, MenuBadgeComponent, ExpandableMenuComponent], providers: [{ provide: MenuActiveLink, useExisting: forwardRef(() => NavMenuComponent) }], template: "<nav class=\"juice-nav\" [class.juice-nav--expanded]=\"isExpanded\" [attr.aria-label]=\"'Menu' | translate\">\n <ul>\n @for (item of menuItems; track item) {\n <li>\n @if (!groups.has(item)) {\n <a class=\"juice-nav__item\" [routerLink]=\"item.routerLink\" [class.active]=\"isCurrent(item)\"\n [attr.aria-current]=\"isCurrent(item) ? 'page' : null\" [attr.title]=\"isExpanded ? null : item.label\">\n <juice-icon [name]=\"item.icon\" [size]=\"20\" />\n <span class=\"juice-nav__label\" [class.juice-sr-only]=\"!isExpanded\">{{ item.label }}@if (isExpanded) {<juice-menu-badge [badge]=\"badges.get(item.id)\" [menuId]=\"item.id\"></juice-menu-badge>}</span>\n @if (!isExpanded) {\n <juice-menu-badge [badge]=\"badges.get(item.id)\" [folded]=\"true\" [menuId]=\"item.id\"></juice-menu-badge>\n }\n </a>\n } @else {\n <juice-expandable-menu [item]=\"item\" [isExpanded]=\"isExpanded\" [activeLink]=\"activeLink\"></juice-expandable-menu>\n }\n </li>\n }\n </ul>\n</nav>\n", styles: [".juice-nav,.juice-nav ul{list-style:none;margin:0;padding:0}.juice-nav{padding:var(--juice-space-2) 0}.juice-nav li{margin:0}.juice-nav__item{box-sizing:border-box;position:relative;display:flex;align-items:center;gap:var(--juice-space-3);width:100%;min-height:var(--juice-sidebar-item-height);padding:0 var(--juice-space-4) 0 calc(var(--juice-space-4) + var(--juice-space-1));border:0;background:transparent;color:var(--juice-sidebar-fg);font:inherit;font-size:var(--juice-text-sm);text-align:start;text-decoration:none;white-space:nowrap;cursor:pointer}.juice-nav__item:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-nav__item.active{background:var(--juice-sidebar-item-active-bg);color:var(--juice-sidebar-item-active-fg);font-weight:var(--juice-weight-medium)}.juice-nav__item.active:before{content:\"\";position:absolute;left:0;top:20%;bottom:20%;width:3px;border-radius:var(--juice-radius-full);background:var(--juice-color-accent)}.juice-nav__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.juice-nav__item>juice-icon{color:inherit}.juice-nav__label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}.juice-nav__chevron{margin-left:auto;transition:transform var(--juice-duration-fast) var(--juice-ease-standard)}.juice-nav-group--open>.juice-nav-group__header .juice-nav__chevron{transform:rotate(180deg)}.juice-nav-group__header{display:flex;align-items:stretch}.juice-nav-group__header>a.juice-nav__item{flex:1 1 auto;min-width:0}.juice-nav-group__toggle{width:auto;flex:none;padding:0 var(--juice-space-3)}.juice-nav-group__children .juice-nav__item{font-size:var(--juice-text-sm)}.juice-nav--expanded .juice-nav-group__children .juice-nav__item{padding-left:calc(var(--juice-space-4) * 2 + var(--juice-space-2))}.juice-nav-group__children[hidden]{display:none}.juice-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}\n"] }]
1201
+ }], ctorParameters: () => [], propDecorators: { isExpanded: [{
1202
+ type: Input
1203
+ }] } });
1203
1204
 
1204
1205
  /**
1205
1206
  * The shell's single search box. Mounted once by the toolbar and shared by every page,
@@ -1219,33 +1220,63 @@ class SearchBarComponent {
1219
1220
  this.service.submit('', event);
1220
1221
  }
1221
1222
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchBarComponent, deps: [{ token: SearchService }], target: i0.ɵɵFactoryTarget.Component }); }
1222
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SearchBarComponent, isStandalone: false, selector: "juice-search-bar", ngImport: i0, template: "@if (service.isEnabled()) {\n <div @enableTrigger class=\"search-container\">\n <input type=\"search\" [value]=\"service.query()\"\n (input)=\"onSearchTextChange($event)\" placeholder=\"Search\" aria-label=\"Search\">\n @if (service.query()) {\n <mat-icon (click)=\"clear($event)\" color=\"primary\">\n close</mat-icon>\n }\n </div>\n}\n", styles: [".search-container{width:200px;min-width:150px;height:100%;margin-left:2rem;margin-right:2rem;position:relative;display:flex;align-items:center;transition:width .2s ease-in-out}.search-container input{border:none;border-radius:100px;padding:5px 3em 5px 16px;line-height:normal;font-size:1rem;width:100%;max-width:240px}.search-container input:focus{border:0;outline:none}.search-container input:focus-visible{outline:2px solid var(--juice-focus, currentcolor);outline-offset:2px}@media(max-width:599.98px){.search-container input{min-height:40px}}.search-container input[type=search]::-webkit-search-decoration,.search-container input[type=search]::-webkit-search-cancel-button,.search-container input[type=search]::-webkit-search-results-button,.search-container input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.search-container:focus-within,.search-container:has(.mat-icon){width:240px}.search-container .mat-icon{position:absolute;right:.7rem;font-size:1.4rem;cursor:pointer}@media screen and (max-width:600px){.search-container{margin-left:.5rem;margin-right:.5rem}}\n"], dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], animations: [
1223
- trigger('enableTrigger', [
1224
- transition(':enter', [
1225
- style({ opacity: 0 }),
1226
- animate('100ms', style({ opacity: 1 })),
1227
- ]),
1228
- transition(':leave', [
1229
- animate('100ms', style({ opacity: 0 }))
1230
- ])
1231
- ]),
1232
- ], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1223
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SearchBarComponent, isStandalone: true, selector: "juice-search-bar", ngImport: i0, template: "@if (service.isEnabled()) {\n <div class=\"search-container\">\n <juice-icon class=\"search-icon\" name=\"search\" [size]=\"16\" />\n <input type=\"search\" [value]=\"service.query()\"\n (input)=\"onSearchTextChange($event)\" [placeholder]=\"'Search' | translate\" [attr.aria-label]=\"'Search' | translate\">\n @if (service.query()) {\n <button type=\"button\" class=\"clear\" (click)=\"clear($event)\" [attr.aria-label]=\"'Clear search' | translate\">\n <juice-icon name=\"x\" [size]=\"16\" />\n </button>\n }\n </div>\n}\n", styles: [".search-container{width:200px;min-width:150px;height:100%;margin:0 var(--juice-space-6);position:relative;display:flex;align-items:center;transition:width var(--juice-duration-normal) var(--juice-ease-standard);animation:juice-search-in var(--juice-duration-fast) var(--juice-ease-standard)}.search-container input{box-sizing:border-box;width:100%;max-width:240px;height:var(--juice-control-height-sm);padding:0 2.25em;border:1px solid var(--juice-color-border);border-radius:var(--juice-radius-full);background:var(--juice-color-surface-sunken);color:var(--juice-color-text);font:inherit;font-size:var(--juice-text-sm)}.search-container input:focus{outline:none}.search-container input:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}@media(max-width:599.98px){.search-container input{min-height:40px}}.search-container input[type=search]::-webkit-search-decoration,.search-container input[type=search]::-webkit-search-cancel-button,.search-container input[type=search]::-webkit-search-results-button,.search-container input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.search-container:focus-within,.search-container:has(.clear){width:240px}.search-container .search-icon{position:absolute;left:.75em;color:var(--juice-color-text-muted);pointer-events:none}.search-container .clear{position:absolute;right:.25rem;display:inline-flex;padding:.25rem;border:0;border-radius:var(--juice-radius-full);background:transparent;color:var(--juice-color-text-muted);cursor:pointer}.search-container .clear:hover{color:var(--juice-color-text)}.search-container .clear:focus-visible{outline:2px solid var(--juice-color-focus-ring)}@media screen and (max-width:600px){.search-container{margin:0 var(--juice-space-2)}}@keyframes juice-search-in{0%{opacity:0}to{opacity:1}}\n"], dependencies: [{ kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1233
1224
  }
1234
1225
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SearchBarComponent, decorators: [{
1235
1226
  type: Component,
1236
- args: [{ selector: 'juice-search-bar', animations: [
1237
- trigger('enableTrigger', [
1238
- transition(':enter', [
1239
- style({ opacity: 0 }),
1240
- animate('100ms', style({ opacity: 1 })),
1241
- ]),
1242
- transition(':leave', [
1243
- animate('100ms', style({ opacity: 0 }))
1244
- ])
1245
- ]),
1246
- ], changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "@if (service.isEnabled()) {\n <div @enableTrigger class=\"search-container\">\n <input type=\"search\" [value]=\"service.query()\"\n (input)=\"onSearchTextChange($event)\" placeholder=\"Search\" aria-label=\"Search\">\n @if (service.query()) {\n <mat-icon (click)=\"clear($event)\" color=\"primary\">\n close</mat-icon>\n }\n </div>\n}\n", styles: [".search-container{width:200px;min-width:150px;height:100%;margin-left:2rem;margin-right:2rem;position:relative;display:flex;align-items:center;transition:width .2s ease-in-out}.search-container input{border:none;border-radius:100px;padding:5px 3em 5px 16px;line-height:normal;font-size:1rem;width:100%;max-width:240px}.search-container input:focus{border:0;outline:none}.search-container input:focus-visible{outline:2px solid var(--juice-focus, currentcolor);outline-offset:2px}@media(max-width:599.98px){.search-container input{min-height:40px}}.search-container input[type=search]::-webkit-search-decoration,.search-container input[type=search]::-webkit-search-cancel-button,.search-container input[type=search]::-webkit-search-results-button,.search-container input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.search-container:focus-within,.search-container:has(.mat-icon){width:240px}.search-container .mat-icon{position:absolute;right:.7rem;font-size:1.4rem;cursor:pointer}@media screen and (max-width:600px){.search-container{margin-left:.5rem;margin-right:.5rem}}\n"] }]
1227
+ args: [{ selector: 'juice-search-bar', changeDetection: ChangeDetectionStrategy.Eager, imports: [TranslatePipe, JuiceIcon], template: "@if (service.isEnabled()) {\n <div class=\"search-container\">\n <juice-icon class=\"search-icon\" name=\"search\" [size]=\"16\" />\n <input type=\"search\" [value]=\"service.query()\"\n (input)=\"onSearchTextChange($event)\" [placeholder]=\"'Search' | translate\" [attr.aria-label]=\"'Search' | translate\">\n @if (service.query()) {\n <button type=\"button\" class=\"clear\" (click)=\"clear($event)\" [attr.aria-label]=\"'Clear search' | translate\">\n <juice-icon name=\"x\" [size]=\"16\" />\n </button>\n }\n </div>\n}\n", styles: [".search-container{width:200px;min-width:150px;height:100%;margin:0 var(--juice-space-6);position:relative;display:flex;align-items:center;transition:width var(--juice-duration-normal) var(--juice-ease-standard);animation:juice-search-in var(--juice-duration-fast) var(--juice-ease-standard)}.search-container input{box-sizing:border-box;width:100%;max-width:240px;height:var(--juice-control-height-sm);padding:0 2.25em;border:1px solid var(--juice-color-border);border-radius:var(--juice-radius-full);background:var(--juice-color-surface-sunken);color:var(--juice-color-text);font:inherit;font-size:var(--juice-text-sm)}.search-container input:focus{outline:none}.search-container input:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}@media(max-width:599.98px){.search-container input{min-height:40px}}.search-container input[type=search]::-webkit-search-decoration,.search-container input[type=search]::-webkit-search-cancel-button,.search-container input[type=search]::-webkit-search-results-button,.search-container input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.search-container:focus-within,.search-container:has(.clear){width:240px}.search-container .search-icon{position:absolute;left:.75em;color:var(--juice-color-text-muted);pointer-events:none}.search-container .clear{position:absolute;right:.25rem;display:inline-flex;padding:.25rem;border:0;border-radius:var(--juice-radius-full);background:transparent;color:var(--juice-color-text-muted);cursor:pointer}.search-container .clear:hover{color:var(--juice-color-text)}.search-container .clear:focus-visible{outline:2px solid var(--juice-color-focus-ring)}@media screen and (max-width:600px){.search-container{margin:0 var(--juice-space-2)}}@keyframes juice-search-in{0%{opacity:0}to{opacity:1}}\n"] }]
1247
1228
  }], ctorParameters: () => [{ type: SearchService }] });
1248
1229
 
1230
+ /** The accent menu beside the dark mode switch: every page follows the accent picked here. Hidden with one palette. */
1231
+ class PaletteSwitchComponent {
1232
+ constructor() {
1233
+ this.service = inject(LayoutService);
1234
+ this.palettes = this.service.palettes();
1235
+ /** The accent in use; without one, the first offered. */
1236
+ this.current = computed(() => this.service.palette() ?? this.palettes[0]?.id, /* @ts-ignore */
1237
+ ...(ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []));
1238
+ }
1239
+ select(id) {
1240
+ this.service.setPalette(id);
1241
+ }
1242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PaletteSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PaletteSwitchComponent, isStandalone: true, selector: "juice-palette-switch", ngImport: i0, template: "@if (palettes.length > 1) {\n <button type=\"button\" juiceIconButton [cdkMenuTriggerFor]=\"menu\" [attr.title]=\"'Colours' | translate\"\n [attr.aria-label]=\"'Colours' | translate\" data-testid=\"palette-switch\">\n <juice-icon name=\"palette\" [size]=\"18\" />\n </button>\n <ng-template #menu>\n <div class=\"juice-menu\" cdkMenu>\n @for (p of palettes; track p.id) {\n <button type=\"button\" class=\"juice-menu__item\" cdkMenuItemRadio [cdkMenuItemChecked]=\"p.id === current()\"\n (cdkMenuItemTriggered)=\"select(p.id)\">\n <span class=\"swatch\" [class.current]=\"p.id === current()\" [style.background]=\"p.color\"></span>\n <span class=\"name\" [class.current]=\"p.id === current()\">{{ p.name | translate }}</span>\n </button>\n }\n </div>\n </ng-template>\n}\n", styles: [".juice-menu{display:flex;flex-direction:column;min-width:10rem;padding:var(--juice-space-1);border:1px solid var(--juice-color-border);border-radius:var(--juice-radius-lg);background:var(--juice-color-surface-raised);color:var(--juice-color-text);box-shadow:var(--juice-shadow-overlay);font-family:var(--juice-font-sans)}.juice-menu__item{display:flex;align-items:center;gap:var(--juice-space-3);min-height:var(--juice-control-height-md);padding:0 var(--juice-space-3);border:0;border-radius:var(--juice-radius-md);background:transparent;color:inherit;font:inherit;font-size:var(--juice-text-sm);text-align:start;cursor:pointer}.juice-menu__item:hover,.juice-menu__item:focus{background:var(--juice-color-accent-subtle);outline:none}.juice-menu__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.swatch{display:inline-block;width:18px;height:18px;border-radius:50%;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.swatch.current{box-shadow:0 0 0 2px var(--juice-color-surface-raised),0 0 0 4px currentColor}.name.current{font-weight:var(--juice-weight-semibold)}\n"], dependencies: [{ kind: "directive", type: CdkMenu, selector: "[cdkMenu]", outputs: ["closed"], exportAs: ["cdkMenu"] }, { kind: "directive", type: CdkMenuItemRadio, selector: "[cdkMenuItemRadio]", exportAs: ["cdkMenuItemRadio"] }, { kind: "directive", type: CdkMenuTrigger, selector: "[cdkMenuTriggerFor]", inputs: ["cdkMenuTriggerFor", "cdkMenuPosition", "cdkMenuTriggerData", "cdkMenuTriggerTransformOriginOn"], outputs: ["cdkMenuOpened", "cdkMenuClosed"], exportAs: ["cdkMenuTriggerFor"] }, { kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: JuiceIconButton, selector: "button[juiceIconButton]" }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1244
+ }
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PaletteSwitchComponent, decorators: [{
1246
+ type: Component,
1247
+ args: [{ selector: 'juice-palette-switch', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CdkMenu, CdkMenuItemRadio, CdkMenuTrigger, TranslatePipe, JuiceIcon, JuiceIconButton], template: "@if (palettes.length > 1) {\n <button type=\"button\" juiceIconButton [cdkMenuTriggerFor]=\"menu\" [attr.title]=\"'Colours' | translate\"\n [attr.aria-label]=\"'Colours' | translate\" data-testid=\"palette-switch\">\n <juice-icon name=\"palette\" [size]=\"18\" />\n </button>\n <ng-template #menu>\n <div class=\"juice-menu\" cdkMenu>\n @for (p of palettes; track p.id) {\n <button type=\"button\" class=\"juice-menu__item\" cdkMenuItemRadio [cdkMenuItemChecked]=\"p.id === current()\"\n (cdkMenuItemTriggered)=\"select(p.id)\">\n <span class=\"swatch\" [class.current]=\"p.id === current()\" [style.background]=\"p.color\"></span>\n <span class=\"name\" [class.current]=\"p.id === current()\">{{ p.name | translate }}</span>\n </button>\n }\n </div>\n </ng-template>\n}\n", styles: [".juice-menu{display:flex;flex-direction:column;min-width:10rem;padding:var(--juice-space-1);border:1px solid var(--juice-color-border);border-radius:var(--juice-radius-lg);background:var(--juice-color-surface-raised);color:var(--juice-color-text);box-shadow:var(--juice-shadow-overlay);font-family:var(--juice-font-sans)}.juice-menu__item{display:flex;align-items:center;gap:var(--juice-space-3);min-height:var(--juice-control-height-md);padding:0 var(--juice-space-3);border:0;border-radius:var(--juice-radius-md);background:transparent;color:inherit;font:inherit;font-size:var(--juice-text-sm);text-align:start;cursor:pointer}.juice-menu__item:hover,.juice-menu__item:focus{background:var(--juice-color-accent-subtle);outline:none}.juice-menu__item:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}.swatch{display:inline-block;width:18px;height:18px;border-radius:50%;box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.swatch.current{box-shadow:0 0 0 2px var(--juice-color-surface-raised),0 0 0 4px currentColor}.name.current{font-weight:var(--juice-weight-semibold)}\n"] }]
1248
+ }] });
1249
+
1250
+ const ICONS = { [ThemeMode.Light]: 'sun', [ThemeMode.Dark]: 'moon', [ThemeMode.Auto]: 'sun-moon' };
1251
+ const NAMES = { [ThemeMode.Light]: 'Light', [ThemeMode.Dark]: 'Dark', [ThemeMode.Auto]: 'Adaptive' };
1252
+ /** The theme button: Adaptive (follows the system), Light, Dark, in turn. ThemeService applies it to the page. */
1253
+ class DarkModeComponent {
1254
+ constructor() {
1255
+ this.service = inject(LayoutService);
1256
+ this.theme = inject(ThemeService);
1257
+ this.ThemeMode = ThemeMode;
1258
+ this.mode = computed(() => { this.theme.mode(); return this.service.getThemeMode(); }, /* @ts-ignore */
1259
+ ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1260
+ this.icon = computed(() => ICONS[this.mode()] ?? 'sun-moon', /* @ts-ignore */
1261
+ ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
1262
+ this.name = computed(() => NAMES[this.mode()] ?? '', /* @ts-ignore */
1263
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
1264
+ }
1265
+ toggleDarkMode() {
1266
+ this.service.toggleDarkMode();
1267
+ }
1268
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DarkModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1269
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: DarkModeComponent, isStandalone: true, selector: "juice-dark-mode", ngImport: i0, template: "<button type=\"button\" juiceIconButton (click)=\"toggleDarkMode()\" [attr.title]=\"name() | translate\"\n [attr.aria-label]=\"('Theme' | translate) + ': ' + (name() | translate)\"><juice-icon [name]=\"icon()\" [size]=\"18\" /></button>\n", dependencies: [{ kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: JuiceIconButton, selector: "button[juiceIconButton]" }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1270
+ }
1271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DarkModeComponent, decorators: [{
1272
+ type: Component,
1273
+ args: [{ selector: 'juice-dark-mode', changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslatePipe, JuiceIcon, JuiceIconButton], template: "<button type=\"button\" juiceIconButton (click)=\"toggleDarkMode()\" [attr.title]=\"name() | translate\"\n [attr.aria-label]=\"('Theme' | translate) + ': ' + (name() | translate)\"><juice-icon [name]=\"icon()\" [size]=\"18\" /></button>\n" }]
1274
+ }] });
1275
+
1276
+ /**
1277
+ * Opens the profile dialog when the viewer clicks their avatar. Provide your own subclass to show your own profile: inject the
1278
+ * CDK `Dialog` and pass it to `super()`; `open(imageUrl)` resolves to the `DialogRef`.
1279
+ */
1249
1280
  class ProfileDialogService extends AsyncDialog {
1250
1281
  }
1251
1282
 
@@ -1384,90 +1415,288 @@ class UserProfileComponent {
1384
1415
  hasValidToken() {
1385
1416
  return this.oauthService.hasValidAccessToken();
1386
1417
  }
1387
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileComponent, deps: [{ token: ProfileDialogService, optional: true }, { token: LayoutService }, { token: i3$3.OAuthService }, { token: i3$1.Router }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1388
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: UserProfileComponent, isStandalone: false, selector: "juice-user-profile", host: { properties: { "class.anonymous": "this.anonymous" } }, ngImport: i0, template: "@if (authenticated) {\n <button class=\"user-image\" (click)=\"onClick()\">\n @if (imageUrl && !imageFailed) {\n <img [src]=\"imageUrl\" (error)=\"onImageError()\"/>\n } @else if (initials) {\n <span class=\"user-image-initials\">{{ initials }}</span>\n } @else {\n <mat-icon class=\"user-image-fallback\">account_circle</mat-icon>\n }\n </button>\n} @else {\n <button mat-button class=\"login-button\" (click)=\"login()\">\n <mat-icon>login</mat-icon>\n {{ 'Login' | translate }}\n </button>\n}\n", styles: [":host{height:100%;aspect-ratio:1/1;display:flex;padding:3px;box-sizing:border-box}:host(.anonymous){aspect-ratio:auto;align-items:center}.user-image{flex:1 auto;border:0;padding:0;background:none;container-type:size}.user-image img{width:100%;height:100%;border-radius:50%;object-fit:cover;cursor:pointer}.user-image .user-image-fallback{width:100%;height:100%;font-size:100cqh;line-height:1;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center}.user-image .user-image-initials{width:100%;height:100%;font-size:42cqh;font-weight:600;line-height:1;text-transform:uppercase;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;color:currentColor;background:#0000001f}\n"], dependencies: [{ kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1418
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileComponent, deps: [{ token: ProfileDialogService, optional: true }, { token: LayoutService }, { token: i3.OAuthService }, { token: i4.Router }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1419
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: UserProfileComponent, isStandalone: true, selector: "juice-user-profile", host: { properties: { "class.anonymous": "this.anonymous" } }, ngImport: i0, template: "@if (authenticated) {\n <button type=\"button\" class=\"user-image\" (click)=\"onClick()\" [attr.aria-label]=\"'Profile' | translate\">\n @if (imageUrl && !imageFailed) {\n <img [src]=\"imageUrl\" alt=\"\" (error)=\"onImageError()\"/>\n } @else if (initials) {\n <span class=\"user-image-initials\">{{ initials }}</span>\n } @else {\n <juice-icon class=\"user-image-fallback\" name=\"circle-user\" size=\"100%\" />\n }\n </button>\n} @else {\n <button type=\"button\" juiceButton variant=\"ghost\" class=\"login-button\" (click)=\"login()\">\n <juice-icon name=\"log-in\" [size]=\"16\" />\n {{ 'Login' | translate }}\n </button>\n}\n", styles: [":host{height:100%;aspect-ratio:1/1;display:flex;padding:3px;box-sizing:border-box}:host(.anonymous){aspect-ratio:auto;align-items:center}.user-image{flex:1 auto;border:0;padding:0;background:none;color:inherit;border-radius:50%;cursor:pointer;container-type:size}.user-image:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.user-image img{width:100%;height:100%;border-radius:50%;object-fit:cover;cursor:pointer}.user-image .user-image-fallback{width:100%;height:100%;font-size:100cqh;line-height:1;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center}.user-image .user-image-initials{width:100%;height:100%;font-size:42cqh;font-weight:600;line-height:1;text-transform:uppercase;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--juice-color-text-on-accent);background:var(--juice-color-accent)}\n"], dependencies: [{ kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: JuiceButton, selector: "button[juiceButton], a[juiceButton]", inputs: ["variant", "size", "loading"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1389
1420
  }
1390
1421
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileComponent, decorators: [{
1391
1422
  type: Component,
1392
- args: [{ selector: 'juice-user-profile', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "@if (authenticated) {\n <button class=\"user-image\" (click)=\"onClick()\">\n @if (imageUrl && !imageFailed) {\n <img [src]=\"imageUrl\" (error)=\"onImageError()\"/>\n } @else if (initials) {\n <span class=\"user-image-initials\">{{ initials }}</span>\n } @else {\n <mat-icon class=\"user-image-fallback\">account_circle</mat-icon>\n }\n </button>\n} @else {\n <button mat-button class=\"login-button\" (click)=\"login()\">\n <mat-icon>login</mat-icon>\n {{ 'Login' | translate }}\n </button>\n}\n", styles: [":host{height:100%;aspect-ratio:1/1;display:flex;padding:3px;box-sizing:border-box}:host(.anonymous){aspect-ratio:auto;align-items:center}.user-image{flex:1 auto;border:0;padding:0;background:none;container-type:size}.user-image img{width:100%;height:100%;border-radius:50%;object-fit:cover;cursor:pointer}.user-image .user-image-fallback{width:100%;height:100%;font-size:100cqh;line-height:1;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center}.user-image .user-image-initials{width:100%;height:100%;font-size:42cqh;font-weight:600;line-height:1;text-transform:uppercase;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;color:currentColor;background:#0000001f}\n"] }]
1423
+ args: [{ selector: 'juice-user-profile', changeDetection: ChangeDetectionStrategy.Eager, imports: [TranslatePipe, JuiceIcon, JuiceButton], template: "@if (authenticated) {\n <button type=\"button\" class=\"user-image\" (click)=\"onClick()\" [attr.aria-label]=\"'Profile' | translate\">\n @if (imageUrl && !imageFailed) {\n <img [src]=\"imageUrl\" alt=\"\" (error)=\"onImageError()\"/>\n } @else if (initials) {\n <span class=\"user-image-initials\">{{ initials }}</span>\n } @else {\n <juice-icon class=\"user-image-fallback\" name=\"circle-user\" size=\"100%\" />\n }\n </button>\n} @else {\n <button type=\"button\" juiceButton variant=\"ghost\" class=\"login-button\" (click)=\"login()\">\n <juice-icon name=\"log-in\" [size]=\"16\" />\n {{ 'Login' | translate }}\n </button>\n}\n", styles: [":host{height:100%;aspect-ratio:1/1;display:flex;padding:3px;box-sizing:border-box}:host(.anonymous){aspect-ratio:auto;align-items:center}.user-image{flex:1 auto;border:0;padding:0;background:none;color:inherit;border-radius:50%;cursor:pointer;container-type:size}.user-image:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.user-image img{width:100%;height:100%;border-radius:50%;object-fit:cover;cursor:pointer}.user-image .user-image-fallback{width:100%;height:100%;font-size:100cqh;line-height:1;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center}.user-image .user-image-initials{width:100%;height:100%;font-size:42cqh;font-weight:600;line-height:1;text-transform:uppercase;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--juice-color-text-on-accent);background:var(--juice-color-accent)}\n"] }]
1393
1424
  }], ctorParameters: () => [{ type: ProfileDialogService, decorators: [{
1394
1425
  type: Optional
1395
- }] }, { type: LayoutService }, { type: i3$3.OAuthService }, { type: i3$1.Router }, { type: i0.ChangeDetectorRef }], propDecorators: { anonymous: [{
1426
+ }] }, { type: LayoutService }, { type: i3.OAuthService }, { type: i4.Router }, { type: i0.ChangeDetectorRef }], propDecorators: { anonymous: [{
1396
1427
  type: HostBinding,
1397
1428
  args: ['class.anonymous']
1398
1429
  }] } });
1399
1430
 
1400
- /** How long after the first render the shell stays without animations: the menu and the first page arrive in it. */
1401
- const SettleMs = 600;
1431
+ /**
1432
+ * The app frame: a skip link, the header (`[juiceShellHeader]`), the sidebar (`[juiceShellSidebar]`) and the content (everything
1433
+ * else). The skip link is the first tab stop and moves the focus to the content without touching the URL (the router owns it).
1434
+ *
1435
+ * ```html
1436
+ * <juice-shell>
1437
+ * <juice-header juiceShellHeader>…</juice-header>
1438
+ * <juice-sidebar juiceShellSidebar [(collapsed)]="folded">…</juice-sidebar>
1439
+ * <router-outlet />
1440
+ * </juice-shell>
1441
+ * ```
1442
+ */
1443
+ class JuiceShell {
1444
+ constructor() {
1445
+ /** The skip link's text (translate it). */
1446
+ this.skipLabel = input('Skip to content', /* @ts-ignore */
1447
+ ...(ngDevMode ? [{ debugName: "skipLabel" }] : /* istanbul ignore next */ []));
1448
+ /** The content area's id, the skip link's target. */
1449
+ this.contentId = input('main-content', /* @ts-ignore */
1450
+ ...(ngDevMode ? [{ debugName: "contentId" }] : /* istanbul ignore next */ []));
1451
+ /** Whether the content area is the page's main landmark. Set false when the pages bring their own `<main>`. */
1452
+ this.mainLandmark = input(true, { ...(ngDevMode ? { debugName: "mainLandmark" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1453
+ this.content = viewChild.required('content', /* @ts-ignore */
1454
+ ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
1455
+ }
1456
+ /** Moves the focus to the content. */
1457
+ skipToContent(event) {
1458
+ event?.preventDefault();
1459
+ const el = this.content().nativeElement;
1460
+ el.focus();
1461
+ el.scrollIntoView?.({ block: 'start' });
1462
+ }
1463
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceShell, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1464
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: JuiceShell, isStandalone: true, selector: "juice-shell", inputs: { skipLabel: { classPropertyName: "skipLabel", publicName: "skipLabel", isSignal: true, isRequired: false, transformFunction: null }, contentId: { classPropertyName: "contentId", publicName: "contentId", isSignal: true, isRequired: false, transformFunction: null }, mainLandmark: { classPropertyName: "mainLandmark", publicName: "mainLandmark", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
1465
+ <a class="juice-skip-link" [attr.href]="'#' + contentId()" (click)="skipToContent($event)">{{ skipLabel() }}</a>
1466
+ <ng-content select="[juiceShellHeader]" />
1467
+ <div class="juice-shell__body">
1468
+ <ng-content select="[juiceShellSidebar]" />
1469
+ <div #content class="juice-shell__content" [attr.id]="contentId()" tabindex="-1" [attr.role]="mainLandmark() ? 'main' : null">
1470
+ <ng-content />
1471
+ </div>
1472
+ </div>
1473
+ `, isInline: true, styles: ["juice-shell{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--juice-color-bg);color:var(--juice-color-text);font-family:var(--juice-font-sans)}juice-shell>.juice-skip-link{position:absolute;left:var(--juice-space-2);top:-100px;z-index:var(--juice-z-toast);padding:var(--juice-space-2) var(--juice-space-4);border-radius:var(--juice-radius-md);background:var(--juice-color-accent);color:var(--juice-color-text-on-accent)}juice-shell>.juice-skip-link:focus{top:var(--juice-space-2)}juice-shell>.juice-skip-link:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.juice-shell__body{display:flex;flex:1 1 auto;min-height:0}.juice-shell__content{flex:1 1 auto;min-width:0;overflow:auto}.juice-shell__content:focus{outline:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1474
+ }
1475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceShell, decorators: [{
1476
+ type: Component,
1477
+ args: [{ selector: 'juice-shell', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: `
1478
+ <a class="juice-skip-link" [attr.href]="'#' + contentId()" (click)="skipToContent($event)">{{ skipLabel() }}</a>
1479
+ <ng-content select="[juiceShellHeader]" />
1480
+ <div class="juice-shell__body">
1481
+ <ng-content select="[juiceShellSidebar]" />
1482
+ <div #content class="juice-shell__content" [attr.id]="contentId()" tabindex="-1" [attr.role]="mainLandmark() ? 'main' : null">
1483
+ <ng-content />
1484
+ </div>
1485
+ </div>
1486
+ `, styles: ["juice-shell{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--juice-color-bg);color:var(--juice-color-text);font-family:var(--juice-font-sans)}juice-shell>.juice-skip-link{position:absolute;left:var(--juice-space-2);top:-100px;z-index:var(--juice-z-toast);padding:var(--juice-space-2) var(--juice-space-4);border-radius:var(--juice-radius-md);background:var(--juice-color-accent);color:var(--juice-color-text-on-accent)}juice-shell>.juice-skip-link:focus{top:var(--juice-space-2)}juice-shell>.juice-skip-link:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.juice-shell__body{display:flex;flex:1 1 auto;min-height:0}.juice-shell__content{flex:1 1 auto;min-width:0;overflow:auto}.juice-shell__content:focus{outline:none}\n"] }]
1487
+ }], propDecorators: { skipLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "skipLabel", required: false }] }], contentId: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentId", required: false }] }], mainLandmark: [{ type: i0.Input, args: [{ isSignal: true, alias: "mainLandmark", required: false }] }], content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
1488
+
1489
+ let nextId = 0;
1490
+ /**
1491
+ * The top bar of the shell: brand, search and the toolbar's buttons, left to right. It is the page's banner landmark: a
1492
+ * custom element has no implicit role, so without it the brand and toolbar sat outside every landmark (axe `region`).
1493
+ */
1494
+ class JuiceHeader {
1495
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1496
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: JuiceHeader, isStandalone: true, selector: "juice-header", host: { attributes: { "role": "banner" }, classAttribute: "juice-header" }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".juice-header{box-sizing:border-box;display:flex;flex:0 0 auto;align-items:center;gap:var(--juice-space-2);height:var(--juice-header-height);padding:0 var(--juice-header-padding-x);border-bottom:1px solid var(--juice-header-border);background:var(--juice-header-bg);color:var(--juice-header-fg)}.juice-header :focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.juice-header .juice-header__spacer{flex:1 1 auto}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1497
+ }
1498
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceHeader, decorators: [{
1499
+ type: Component,
1500
+ args: [{ selector: 'juice-header', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-header', role: 'banner' }, template: `<ng-content />`, styles: [".juice-header{box-sizing:border-box;display:flex;flex:0 0 auto;align-items:center;gap:var(--juice-space-2);height:var(--juice-header-height);padding:0 var(--juice-header-padding-x);border-bottom:1px solid var(--juice-header-border);background:var(--juice-header-bg);color:var(--juice-header-fg)}.juice-header :focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:2px}.juice-header .juice-header__spacer{flex:1 1 auto}\n"] }]
1501
+ }] });
1502
+ /**
1503
+ * The side menu's column. Folded (`collapsed`), it shows icons only; the toggle at its foot names its state with `aria-expanded`.
1504
+ * Two-way: `[(collapsed)]`.
1505
+ */
1506
+ class JuiceSidebar {
1507
+ constructor() {
1508
+ /** Folded to icons. */
1509
+ this.collapsed = model(false, /* @ts-ignore */
1510
+ ...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
1511
+ /** Whether to draw the fold toggle. */
1512
+ this.toggle = input(true, { ...(ngDevMode ? { debugName: "toggle" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1513
+ this.collapseLabel = input('Collapse menu', /* @ts-ignore */
1514
+ ...(ngDevMode ? [{ debugName: "collapseLabel" }] : /* istanbul ignore next */ []));
1515
+ this.expandLabel = input('Expand menu', /* @ts-ignore */
1516
+ ...(ngDevMode ? [{ debugName: "expandLabel" }] : /* istanbul ignore next */ []));
1517
+ this.id = `juice-sidebar-${++nextId}`;
1518
+ }
1519
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSidebar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1520
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: JuiceSidebar, isStandalone: true, selector: "juice-sidebar", inputs: { collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, collapseLabel: { classPropertyName: "collapseLabel", publicName: "collapseLabel", isSignal: true, isRequired: false, transformFunction: null }, expandLabel: { classPropertyName: "expandLabel", publicName: "expandLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapsed: "collapsedChange" }, host: { properties: { "class.juice-sidebar--collapsed": "collapsed()", "attr.id": "id" }, classAttribute: "juice-sidebar" }, ngImport: i0, template: `
1521
+ <div class="juice-sidebar__content"><ng-content /></div>
1522
+ <div class="juice-sidebar__footer">
1523
+ <ng-content select="[juiceSidebarFooter]" />
1524
+ @if (toggle()) {
1525
+ <button type="button" class="juice-sidebar__toggle" (click)="collapsed.set(!collapsed())"
1526
+ [attr.aria-expanded]="!collapsed()" [attr.aria-controls]="id"
1527
+ [attr.aria-label]="collapsed() ? expandLabel() : collapseLabel()" [attr.title]="collapsed() ? expandLabel() : collapseLabel()">
1528
+ <juice-icon [name]="collapsed() ? 'panel-left-open' : 'panel-left-close'" [size]="18" />
1529
+ </button>
1530
+ }
1531
+ </div>
1532
+ `, isInline: true, styles: [".juice-sidebar{box-sizing:border-box;display:flex;flex:0 0 auto;flex-direction:column;width:var(--juice-sidebar-width);height:100%;overflow:hidden;border-right:1px solid var(--juice-sidebar-border);background:var(--juice-sidebar-bg);color:var(--juice-sidebar-fg);transition:width var(--juice-duration-normal) var(--juice-ease-standard)}.juice-sidebar--collapsed{width:var(--juice-sidebar-collapsed-width)}.juice-sidebar__content{flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto}.juice-sidebar__footer{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--juice-space-1);padding:var(--juice-space-2);border-top:1px solid var(--juice-sidebar-border)}.juice-sidebar--collapsed .juice-sidebar__footer{justify-content:center}.juice-sidebar__toggle,.juice-sidebar__footer a{display:inline-flex;align-items:center;justify-content:center;width:var(--juice-control-height-md);height:var(--juice-control-height-md);border:0;border-radius:var(--juice-radius-md);background:transparent;color:inherit;cursor:pointer}.juice-sidebar__toggle:hover,.juice-sidebar__footer a:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-sidebar :focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}\n"], dependencies: [{ kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1533
+ }
1534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSidebar, decorators: [{
1535
+ type: Component,
1536
+ args: [{ selector: 'juice-sidebar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [JuiceIcon], host: {
1537
+ 'class': 'juice-sidebar',
1538
+ '[class.juice-sidebar--collapsed]': 'collapsed()',
1539
+ '[attr.id]': 'id',
1540
+ }, template: `
1541
+ <div class="juice-sidebar__content"><ng-content /></div>
1542
+ <div class="juice-sidebar__footer">
1543
+ <ng-content select="[juiceSidebarFooter]" />
1544
+ @if (toggle()) {
1545
+ <button type="button" class="juice-sidebar__toggle" (click)="collapsed.set(!collapsed())"
1546
+ [attr.aria-expanded]="!collapsed()" [attr.aria-controls]="id"
1547
+ [attr.aria-label]="collapsed() ? expandLabel() : collapseLabel()" [attr.title]="collapsed() ? expandLabel() : collapseLabel()">
1548
+ <juice-icon [name]="collapsed() ? 'panel-left-open' : 'panel-left-close'" [size]="18" />
1549
+ </button>
1550
+ }
1551
+ </div>
1552
+ `, styles: [".juice-sidebar{box-sizing:border-box;display:flex;flex:0 0 auto;flex-direction:column;width:var(--juice-sidebar-width);height:100%;overflow:hidden;border-right:1px solid var(--juice-sidebar-border);background:var(--juice-sidebar-bg);color:var(--juice-sidebar-fg);transition:width var(--juice-duration-normal) var(--juice-ease-standard)}.juice-sidebar--collapsed{width:var(--juice-sidebar-collapsed-width)}.juice-sidebar__content{flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto}.juice-sidebar__footer{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--juice-space-1);padding:var(--juice-space-2);border-top:1px solid var(--juice-sidebar-border)}.juice-sidebar--collapsed .juice-sidebar__footer{justify-content:center}.juice-sidebar__toggle,.juice-sidebar__footer a{display:inline-flex;align-items:center;justify-content:center;width:var(--juice-control-height-md);height:var(--juice-control-height-md);border:0;border-radius:var(--juice-radius-md);background:transparent;color:inherit;cursor:pointer}.juice-sidebar__toggle:hover,.juice-sidebar__footer a:hover{background:var(--juice-sidebar-item-hover-bg);color:var(--juice-color-text)}.juice-sidebar :focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}\n"] }]
1553
+ }], propDecorators: { collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], toggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggle", required: false }] }], collapseLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapseLabel", required: false }] }], expandLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandLabel", required: false }] }] } });
1554
+ /** The scrolling page area, padded by the spacing tokens. */
1555
+ class JuiceContent {
1556
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceContent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1557
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: JuiceContent, isStandalone: true, selector: "juice-content", host: { classAttribute: "juice-content" }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".juice-content{box-sizing:border-box;display:block;padding:var(--juice-space-4)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1558
+ }
1559
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceContent, decorators: [{
1560
+ type: Component,
1561
+ args: [{ selector: 'juice-content', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-content' }, template: `<ng-content />`, styles: [".juice-content{box-sizing:border-box;display:block;padding:var(--juice-space-4)}\n"] }]
1562
+ }] });
1563
+
1564
+ /**
1565
+ * A panel that slides over the page from one side (`side`: start or end): a modal dialog while open. It traps the focus, closes on
1566
+ * Escape and on the backdrop, and gives the focus back to what had it. Two-way: `[(open)]`; `(closed)` fires when it closes itself.
1567
+ */
1568
+ class JuiceSidePanel {
1569
+ constructor() {
1570
+ this.open = model(false, /* @ts-ignore */
1571
+ ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
1572
+ this.side = input('start', /* @ts-ignore */
1573
+ ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
1574
+ /** The dialog's accessible name. */
1575
+ this.label = input('', /* @ts-ignore */
1576
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1577
+ /** It closed itself: Escape or the backdrop. */
1578
+ this.closed = output();
1579
+ this.doc = inject(DOCUMENT$1);
1580
+ this.traps = inject(FocusTrapFactory);
1581
+ this.panel = viewChild('panel', /* @ts-ignore */
1582
+ ...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
1583
+ this.trap = null;
1584
+ this.returnTo = null;
1585
+ effect(() => {
1586
+ const el = this.panel()?.nativeElement;
1587
+ untracked(() => (el ? this.activate(el) : this.deactivate()));
1588
+ });
1589
+ inject(DestroyRef).onDestroy(() => this.deactivate());
1590
+ }
1591
+ close() {
1592
+ if (!this.open())
1593
+ return;
1594
+ this.open.set(false);
1595
+ this.closed.emit();
1596
+ }
1597
+ onEscape(event) {
1598
+ event.stopPropagation();
1599
+ this.close();
1600
+ }
1601
+ activate(el) {
1602
+ if (this.trap)
1603
+ return;
1604
+ const active = this.doc.activeElement;
1605
+ this.returnTo = active instanceof HTMLElement && active !== this.doc.body ? active : null;
1606
+ this.trap = this.traps.create(el);
1607
+ this.trap.focusInitialElementWhenReady().then(found => { if (!found)
1608
+ el.focus(); });
1609
+ }
1610
+ deactivate() {
1611
+ if (!this.trap)
1612
+ return;
1613
+ this.trap.destroy();
1614
+ this.trap = null;
1615
+ const target = this.returnTo;
1616
+ this.returnTo = null;
1617
+ if (target?.isConnected)
1618
+ target.focus();
1619
+ }
1620
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSidePanel, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1621
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: JuiceSidePanel, isStandalone: true, selector: "juice-side-panel", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, host: { properties: { "class.juice-side-panel--end": "side() === \"end\"" }, classAttribute: "juice-side-panel" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: `
1622
+ @if (open()) {
1623
+ <div class="juice-side-panel__backdrop" (click)="close()"></div>
1624
+ <div #panel class="juice-side-panel__panel" role="dialog" aria-modal="true" tabindex="-1"
1625
+ [attr.aria-label]="label() || null" (keydown.escape)="onEscape($event)">
1626
+ <ng-content />
1627
+ </div>
1628
+ }
1629
+ `, isInline: true, styles: [".juice-side-panel__backdrop{position:fixed;inset:0;z-index:var(--juice-z-overlay);background:color-mix(in srgb,var(--juice-color-overlay, #000) 40%,transparent)}.juice-side-panel__panel{box-sizing:border-box;position:fixed;top:0;bottom:0;left:0;z-index:var(--juice-z-modal);display:flex;flex-direction:column;width:min(var(--juice-sidebar-width),calc(100vw - 3rem));overflow:auto;background:var(--juice-panel-bg);color:var(--juice-panel-fg);border-right:1px solid var(--juice-panel-border);box-shadow:var(--juice-shadow-overlay)}.juice-side-panel--end .juice-side-panel__panel{left:auto;right:0;border-right:0;border-left:1px solid var(--juice-panel-border)}.juice-side-panel__panel:focus{outline:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1630
+ }
1631
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSidePanel, decorators: [{
1632
+ type: Component,
1633
+ args: [{ selector: 'juice-side-panel', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-side-panel', '[class.juice-side-panel--end]': 'side() === "end"' }, template: `
1634
+ @if (open()) {
1635
+ <div class="juice-side-panel__backdrop" (click)="close()"></div>
1636
+ <div #panel class="juice-side-panel__panel" role="dialog" aria-modal="true" tabindex="-1"
1637
+ [attr.aria-label]="label() || null" (keydown.escape)="onEscape($event)">
1638
+ <ng-content />
1639
+ </div>
1640
+ }
1641
+ `, styles: [".juice-side-panel__backdrop{position:fixed;inset:0;z-index:var(--juice-z-overlay);background:color-mix(in srgb,var(--juice-color-overlay, #000) 40%,transparent)}.juice-side-panel__panel{box-sizing:border-box;position:fixed;top:0;bottom:0;left:0;z-index:var(--juice-z-modal);display:flex;flex-direction:column;width:min(var(--juice-sidebar-width),calc(100vw - 3rem));overflow:auto;background:var(--juice-panel-bg);color:var(--juice-panel-fg);border-right:1px solid var(--juice-panel-border);box-shadow:var(--juice-shadow-overlay)}.juice-side-panel--end .juice-side-panel__panel{left:auto;right:0;border-right:0;border-left:1px solid var(--juice-panel-border)}.juice-side-panel__panel:focus{outline:none}\n"] }]
1642
+ }], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
1643
+
1644
+ /**
1645
+ * The standard workspace: the route shell of a Juice app. The header (brand, search, page switcher, the app's toolbar items,
1646
+ * accent, theme, profile), the side menu (folded or not, remembered under `IS_MENU_OPEN`; a panel over the page on a phone) and the
1647
+ * routed page. Use it as a route's component: `{ path: '', component: PageComponent, children: [...] }`.
1648
+ */
1402
1649
  class PageComponent {
1403
- constructor(service, search,
1404
- /** The page switcher: its keys are live while the shell is, and the shell shows it (see the constructor). */
1405
- switcher, breakpointObserver, cdr) {
1406
- this.service = service;
1407
- this.search = search;
1408
- this.switcher = switcher;
1409
- this.breakpointObserver = breakpointObserver;
1650
+ constructor() {
1410
1651
  /** The app's own toolbar items ({@link LAYOUT_TOOLBAR_ITEMS}). */
1411
1652
  this.toolbarItems = inject(LAYOUT_TOOLBAR_ITEMS, { optional: true }) ?? [];
1653
+ this.service = inject(LayoutService);
1654
+ /** The page switcher: its keys are live while the shell is, and the shell shows it (see the constructor). */
1655
+ this.switcher = inject(PageSwitcherService);
1656
+ this.search = inject(SearchService);
1412
1657
  this.isMobile = false;
1658
+ /** On a phone: whether the menu panel is open. */
1413
1659
  this.isSnavOpenned = false;
1414
- /**
1415
- * True while the shell is first drawn: the sidenav's width, its mode and the menu's open groups settle with no
1416
- * animation (an animated settle on load shifts the page under the reader).
1417
- */
1418
- this.settling = true;
1660
+ const breakpointObserver = inject(BreakpointObserver);
1661
+ const cdr = inject(ChangeDetectorRef);
1419
1662
  const handset = [Breakpoints.HandsetLandscape, Breakpoints.HandsetPortrait];
1420
1663
  // The mode before the first render, from the media queries as they are now: drawn as desktop and then switched to a
1421
1664
  // phone's (the observer's answer arriving after first paint) shifted the whole page on a cold load at 390px.
1422
1665
  this.isMobile = breakpointObserver.isMatched(handset);
1423
- this.isSnavOpenned = !this.isMobile;
1424
- breakpointObserver.observe(handset).subscribe(result => {
1666
+ const sub = breakpointObserver.observe(handset).subscribe(result => {
1667
+ if (result.matches !== this.isMobile)
1668
+ this.isSnavOpenned = false;
1425
1669
  this.isMobile = result.matches;
1426
- this.isSnavOpenned = !this.isMobile;
1427
1670
  cdr.markForCheck();
1428
1671
  });
1672
+ inject(DestroyRef).onDestroy(() => sub.unsubscribe());
1429
1673
  this.hostPageSwitcher();
1430
- let settleTimer;
1431
- afterNextRender(() => {
1432
- settleTimer = setTimeout(() => {
1433
- this.settling = false;
1434
- cdr.markForCheck();
1435
- }, SettleMs);
1436
- });
1437
- inject(DestroyRef).onDestroy(() => clearTimeout(settleTimer));
1438
- }
1439
- /** The skip link: moves the focus to the page, without touching the URL (the router owns it). */
1440
- skipToContent(event) {
1441
- event.preventDefault();
1442
- const main = document.getElementById('main-content');
1443
- main?.focus();
1444
- main?.scrollIntoView?.();
1445
1674
  }
1446
1675
  /**
1447
- * Shows the page switcher in a dialog while it is open (the dialog brings the focus trap, Escape, the backdrop and
1676
+ * Shows the page switcher in a CDK dialog while it is open (the dialog brings the focus trap, Escape, the backdrop and
1448
1677
  * gives focus back), and its keys while the shell is on screen.
1449
1678
  */
1450
1679
  hostPageSwitcher() {
1451
- const dialog = inject(MatDialog);
1680
+ const dialog = inject(Dialog);
1681
+ const overlay = inject(Overlay);
1452
1682
  /** The dialog on display; `closing` once the switcher closed it (not Escape or the backdrop). */
1453
1683
  let current = null;
1454
1684
  const show = () => {
1455
1685
  const shown = {
1456
1686
  ref: dialog.open(PageSwitcherComponent, {
1457
- panelClass: 'juice-page-switcher-panel',
1687
+ panelClass: ['juice-dialog-panel', 'juice-page-switcher-panel'],
1458
1688
  width: '560px',
1459
1689
  maxWidth: 'calc(100vw - 32px)',
1460
- position: { top: '12vh' },
1690
+ positionStrategy: overlay.position().global().top('12vh').centerHorizontally(),
1461
1691
  autoFocus: 'first-tabbable',
1462
1692
  restoreFocus: true,
1463
- // Gone at once: no closing dialog left to take the keys meant for the next one (Ctrl+K again, Escape).
1464
- exitAnimationDuration: 0,
1693
+ ariaModal: true,
1465
1694
  ariaLabel: 'Go to page',
1466
1695
  }),
1467
1696
  closing: false,
1468
1697
  };
1469
1698
  current = shown;
1470
- shown.ref.afterClosed().subscribe(() => {
1699
+ shown.ref.closed.subscribe(() => {
1471
1700
  if (current !== shown)
1472
1701
  return; // a newer one is on display
1473
1702
  current = null;
@@ -1476,10 +1705,11 @@ class PageComponent {
1476
1705
  });
1477
1706
  };
1478
1707
  inject(DestroyRef).onDestroy(this.switcher.attach());
1708
+ inject(DestroyRef).onDestroy(() => current?.ref.close());
1479
1709
  effect(() => {
1480
1710
  const open = this.switcher.isOpen();
1481
1711
  if (open && (!current || current.closing)) {
1482
- untracked(show); // only isOpen drives this effect // also while the last one is still closing: at once
1712
+ untracked(show); // only isOpen drives this effect; also while the last one is closing
1483
1713
  }
1484
1714
  else if (!open && current && !current.closing) {
1485
1715
  current.closing = true;
@@ -1496,8 +1726,9 @@ class PageComponent {
1496
1726
  toggleSidenav() {
1497
1727
  this.isSnavOpenned = !this.isSnavOpenned;
1498
1728
  }
1499
- toolbarHeight() {
1500
- return "48px"; // this.isMobile ? "42px" : "48px";
1729
+ /** The side menu's fold toggle: remembered under `IS_MENU_OPEN`. */
1730
+ onCollapsedChange(collapsed) {
1731
+ this.service.setMenuOpen(!collapsed);
1501
1732
  }
1502
1733
  /**
1503
1734
  * The routed page just became visible — offer search if it supports it.
@@ -1513,176 +1744,109 @@ class PageComponent {
1513
1744
  onPageDeactivate() {
1514
1745
  this.search.unbindPage();
1515
1746
  }
1516
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageComponent, deps: [{ token: LayoutService }, { token: SearchService }, { token: PageSwitcherService }, { token: i4$2.BreakpointObserver }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1517
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageComponent, isStandalone: false, selector: "app-page", ngImport: i0, template: "<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->\n<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->\n<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * Delete the template below * * * * * * * * * * -->\n<!-- * * * * * * * to get started with your project! * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<div class=\"container\" [class.mobile]=\"isMobile\" [class.settling]=\"settling\">\n <a class=\"skip-link\" href=\"#main-content\" (click)=\"skipToContent($event)\">{{ 'Skip to content' | translate }}</a>\n <!-- Toolbar -->\n <mat-toolbar color=\"primary\" [style.height]=\"toolbarHeight()\">\n @if (isMobile) {\n <button mat-icon-button (click)=\"toggleSidenav()\" class=\"m-r\" [attr.aria-label]=\"'Menu' | translate\"\n [attr.aria-expanded]=\"isSnavOpenned\">\n <mat-icon aria-hidden=\"true\" fontIcon=\"menu\"></mat-icon>\n </button>\n }\n @if (!isMobile) {\n <a [routerLink]=\"['/',service.tenantIdentifier]\" class=\"nav-link home\" [attr.aria-label]=\"service.brandName() || ('Home' | translate)\">\n <img height=\"40\" alt=\"\" [src]=\"service.brandLogo()\" class=\"p-r\" />\n </a>\n }\n @if (!isMobile) {\n <span>{{service.brandName()}}</span>\n }\n <juice-search-bar></juice-search-bar>\n <span class=\"toolbar-spacer \"></span>\n @if (switcher.isEnabled) {\n <button mat-icon-button (click)=\"switcher.open()\" data-testid=\"page-switcher-open\"\n matTooltip=\"{{ 'Go to page' | translate }} (Ctrl+K)\" [attr.aria-label]=\"'Go to page' | translate\">\n <mat-icon>manage_search</mat-icon>\n </button>\n }\n @for (item of toolbarItems; track $index) {\n <ng-container *ngComponentOutlet=\"item\"></ng-container>\n }\n <juice-palette-switch></juice-palette-switch>\n <juice-dark-mode></juice-dark-mode>\n <juice-user-profile></juice-user-profile>\n </mat-toolbar>\n\n <mat-sidenav-container>\n <mat-sidenav [@.disabled]=\"settling\" [opened]=\"isSnavOpenned\" (closed)=\"isSnavOpenned = false\" #snav\n (navigate)=\"hideSidenavOnMobile\" (click)=\"hideSidenavOnMobile\" (swipeRight)=\"hideSidenavOnMobile\"\n [mode]=\"isMobile ? 'over': 'side' \"\n [@menuTransition]=\" menu.isExpanded ? 'expand' : 'collapsed' \" [fixedInViewport]=\"true\"\n [style.top]=\"isMobile ? toolbarHeight():0\">\n <juice-nav-menu #menu [class.menu-expanded]=\"isSnavOpenned\"\n [class.menu-collapsed]=\"!isSnavOpenned\"></juice-nav-menu>\n </mat-sidenav>\n\n <mat-sidenav-content id=\"main-content\" [attr.role]=\"service.mainLandmark() ? 'main' : null\" tabindex=\"-1\" style=\"margin-left: 0;\">\n <router-outlet (activate)=\"onPageActivate($event)\" (deactivate)=\"onPageDeactivate()\"></router-outlet>\n </mat-sidenav-content>\n\n </mat-sidenav-container>\n</div>\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->\n<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->\n<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->", styles: [":host .toolbar-spacer{flex:1 1 auto}:host .nav-link{display:flex;margin-right:.5em}:host .skip-link{position:absolute;left:8px;top:-100px;z-index:1000;padding:8px 16px;border-radius:4px;background:var(--mat-sys-primary, #005cbb);color:var(--mat-sys-on-primary, #fff)}:host .skip-link:focus{top:8px}:host #main-content:focus{outline:none}:host .container.settling .mat-sidenav,:host .container.settling .mat-sidenav-content,:host .container.settling .mat-sidenav-container,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel-content,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-indicator,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-indicator:after,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel-header,:host .container.settling .mat-sidenav ::ng-deep .mat-mdc-list-item{transition:none!important}:host .mat-sidenav-container{display:flex;flex-direction:row}:host .mat-sidenav-container .mat-drawer-side{position:relative;flex:0 auto}:host .mat-sidenav-container .mat-drawer-over{position:fixed}:host .mat-sidenav-container .mat-sidenav-content{flex:1;height:auto}:host .container{display:flex;flex-direction:column}:host .container .mat-toolbar{flex:0 0 auto}:host .container .mat-sidenav-container{flex:1 1 auto;display:flex;flex-direction:row}\n"], dependencies: [{ kind: "directive", type: i3$1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: i1$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i9.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i9.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i9.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: DarkModeComponent, selector: "juice-dark-mode" }, { kind: "component", type: PaletteSwitchComponent, selector: "juice-palette-switch" }, { kind: "component", type: NavMenuComponent, selector: "juice-nav-menu" }, { kind: "component", type: SearchBarComponent, selector: "juice-search-bar" }, { kind: "component", type: UserProfileComponent, selector: "juice-user-profile" }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], animations: [
1518
- trigger('menuTransition', [
1519
- state('expand', style({
1520
- width: '220px'
1521
- })),
1522
- state('collapsed', style({
1523
- width: '60px'
1524
- })),
1525
- transition('* => collapsed', [
1526
- animate('0.15s')
1527
- ]),
1528
- transition('* => expand', [
1529
- animate('0.15s')
1530
- ])
1531
- ]),
1532
- trigger('contentTransition', [
1533
- state('expand', style({
1534
- "margin-left": "60px"
1535
- })),
1536
- state('collapsed', style({
1537
- "margin-left": "220px"
1538
- })),
1539
- state("full", style({
1540
- "margin-left": "0"
1541
- })),
1542
- transition('* => collapsed', [
1543
- animate('0.15s')
1544
- ]),
1545
- transition('* => expand', [
1546
- animate('0.15s')
1547
- ])
1548
- ])
1549
- ], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1747
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1748
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageComponent, isStandalone: true, selector: "juice-standard-workspace, app-page", ngImport: i0, template: "<juice-shell [skipLabel]=\"'Skip to content' | translate\" [mainLandmark]=\"service.mainLandmark()\" [class.mobile]=\"isMobile\">\n <juice-header juiceShellHeader>\n @if (isMobile) {\n <button type=\"button\" juiceIconButton (click)=\"toggleSidenav()\" [attr.aria-label]=\"'Menu' | translate\"\n [attr.aria-expanded]=\"isSnavOpenned\">\n <juice-icon name=\"menu\" [size]=\"20\" />\n </button>\n } @else {\n <a [routerLink]=\"['/', service.tenantIdentifier]\" class=\"home\" [attr.aria-label]=\"service.brandName() || ('Home' | translate)\">\n <img height=\"32\" alt=\"\" [src]=\"service.brandLogo()\" />\n </a>\n <span class=\"brand\">{{ service.brandName() }}</span>\n }\n <juice-search-bar></juice-search-bar>\n <span class=\"juice-header__spacer\"></span>\n @if (switcher.isEnabled) {\n <button type=\"button\" juiceIconButton (click)=\"switcher.open()\" data-testid=\"page-switcher-open\"\n [attr.title]=\"('Go to page' | translate) + ' (Ctrl+K)'\" [attr.aria-label]=\"'Go to page' | translate\">\n <juice-icon name=\"text-search\" [size]=\"18\" />\n </button>\n }\n @for (item of toolbarItems; track $index) {\n <ng-container *ngComponentOutlet=\"item\"></ng-container>\n }\n <juice-palette-switch></juice-palette-switch>\n <juice-dark-mode></juice-dark-mode>\n <juice-user-profile></juice-user-profile>\n </juice-header>\n\n @if (!isMobile) {\n <juice-sidebar juiceShellSidebar [collapsed]=\"!service.menuOpen()\" (collapsedChange)=\"onCollapsedChange($event)\"\n [collapseLabel]=\"'Collapse menu' | translate\" [expandLabel]=\"'Expand menu' | translate\">\n <juice-nav-menu #menu [isExpanded]=\"service.menuOpen()\"></juice-nav-menu>\n @if (menu.settingUrl) {\n <a juiceSidebarFooter [href]=\"menu.settingUrl\" [attr.aria-label]=\"'Settings' | translate\" [attr.title]=\"'Settings' | translate\">\n <juice-icon name=\"settings\" [size]=\"18\" />\n </a>\n }\n </juice-sidebar>\n }\n\n <router-outlet (activate)=\"onPageActivate($event)\" (deactivate)=\"onPageDeactivate()\"></router-outlet>\n</juice-shell>\n\n@if (isMobile) {\n <juice-side-panel [(open)]=\"isSnavOpenned\" [label]=\"'Menu' | translate\">\n <juice-nav-menu #mobileMenu [isExpanded]=\"true\" (click)=\"hideSidenavOnMobile()\"></juice-nav-menu>\n @if (mobileMenu.settingUrl) {\n <a class=\"mobile-settings\" [href]=\"mobileMenu.settingUrl\">\n <juice-icon name=\"settings\" [size]=\"18\" /> {{ 'Settings' | translate }}\n </a>\n }\n </juice-side-panel>\n}\n", styles: [":host{display:block;height:100%}.home{display:flex;align-items:center;margin-right:var(--juice-space-2);border-radius:var(--juice-radius-md)}.brand{font-size:var(--juice-text-md);font-weight:var(--juice-weight-semibold);white-space:nowrap}@media(max-width:599.98px){juice-header [juiceIconButton]{width:40px;height:40px}}.mobile-settings{display:flex;align-items:center;gap:var(--juice-space-3);padding:var(--juice-space-3) var(--juice-space-5);border-top:1px solid var(--juice-color-border);color:inherit;text-decoration:none}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: JuiceIcon, selector: "juice-icon", inputs: ["name", "size", "label"] }, { kind: "component", type: JuiceIconButton, selector: "button[juiceIconButton]" }, { kind: "component", type: JuiceShell, selector: "juice-shell", inputs: ["skipLabel", "contentId", "mainLandmark"] }, { kind: "component", type: JuiceHeader, selector: "juice-header" }, { kind: "component", type: JuiceSidebar, selector: "juice-sidebar", inputs: ["collapsed", "toggle", "collapseLabel", "expandLabel"], outputs: ["collapsedChange"] }, { kind: "component", type: JuiceSidePanel, selector: "juice-side-panel", inputs: ["open", "side", "label"], outputs: ["openChange", "closed"] }, { kind: "component", type: NavMenuComponent, selector: "juice-nav-menu", inputs: ["isExpanded"] }, { kind: "component", type: SearchBarComponent, selector: "juice-search-bar" }, { kind: "component", type: PaletteSwitchComponent, selector: "juice-palette-switch" }, { kind: "component", type: DarkModeComponent, selector: "juice-dark-mode" }, { kind: "component", type: UserProfileComponent, selector: "juice-user-profile" }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1550
1749
  }
1551
1750
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageComponent, decorators: [{
1552
1751
  type: Component,
1553
- args: [{ selector: 'app-page', animations: [
1554
- trigger('menuTransition', [
1555
- state('expand', style({
1556
- width: '220px'
1557
- })),
1558
- state('collapsed', style({
1559
- width: '60px'
1560
- })),
1561
- transition('* => collapsed', [
1562
- animate('0.15s')
1563
- ]),
1564
- transition('* => expand', [
1565
- animate('0.15s')
1566
- ])
1567
- ]),
1568
- trigger('contentTransition', [
1569
- state('expand', style({
1570
- "margin-left": "60px"
1571
- })),
1572
- state('collapsed', style({
1573
- "margin-left": "220px"
1574
- })),
1575
- state("full", style({
1576
- "margin-left": "0"
1577
- })),
1578
- transition('* => collapsed', [
1579
- animate('0.15s')
1580
- ]),
1581
- transition('* => expand', [
1582
- animate('0.15s')
1583
- ])
1584
- ])
1585
- ], changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->\n<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->\n<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * Delete the template below * * * * * * * * * * -->\n<!-- * * * * * * * to get started with your project! * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<div class=\"container\" [class.mobile]=\"isMobile\" [class.settling]=\"settling\">\n <a class=\"skip-link\" href=\"#main-content\" (click)=\"skipToContent($event)\">{{ 'Skip to content' | translate }}</a>\n <!-- Toolbar -->\n <mat-toolbar color=\"primary\" [style.height]=\"toolbarHeight()\">\n @if (isMobile) {\n <button mat-icon-button (click)=\"toggleSidenav()\" class=\"m-r\" [attr.aria-label]=\"'Menu' | translate\"\n [attr.aria-expanded]=\"isSnavOpenned\">\n <mat-icon aria-hidden=\"true\" fontIcon=\"menu\"></mat-icon>\n </button>\n }\n @if (!isMobile) {\n <a [routerLink]=\"['/',service.tenantIdentifier]\" class=\"nav-link home\" [attr.aria-label]=\"service.brandName() || ('Home' | translate)\">\n <img height=\"40\" alt=\"\" [src]=\"service.brandLogo()\" class=\"p-r\" />\n </a>\n }\n @if (!isMobile) {\n <span>{{service.brandName()}}</span>\n }\n <juice-search-bar></juice-search-bar>\n <span class=\"toolbar-spacer \"></span>\n @if (switcher.isEnabled) {\n <button mat-icon-button (click)=\"switcher.open()\" data-testid=\"page-switcher-open\"\n matTooltip=\"{{ 'Go to page' | translate }} (Ctrl+K)\" [attr.aria-label]=\"'Go to page' | translate\">\n <mat-icon>manage_search</mat-icon>\n </button>\n }\n @for (item of toolbarItems; track $index) {\n <ng-container *ngComponentOutlet=\"item\"></ng-container>\n }\n <juice-palette-switch></juice-palette-switch>\n <juice-dark-mode></juice-dark-mode>\n <juice-user-profile></juice-user-profile>\n </mat-toolbar>\n\n <mat-sidenav-container>\n <mat-sidenav [@.disabled]=\"settling\" [opened]=\"isSnavOpenned\" (closed)=\"isSnavOpenned = false\" #snav\n (navigate)=\"hideSidenavOnMobile\" (click)=\"hideSidenavOnMobile\" (swipeRight)=\"hideSidenavOnMobile\"\n [mode]=\"isMobile ? 'over': 'side' \"\n [@menuTransition]=\" menu.isExpanded ? 'expand' : 'collapsed' \" [fixedInViewport]=\"true\"\n [style.top]=\"isMobile ? toolbarHeight():0\">\n <juice-nav-menu #menu [class.menu-expanded]=\"isSnavOpenned\"\n [class.menu-collapsed]=\"!isSnavOpenned\"></juice-nav-menu>\n </mat-sidenav>\n\n <mat-sidenav-content id=\"main-content\" [attr.role]=\"service.mainLandmark() ? 'main' : null\" tabindex=\"-1\" style=\"margin-left: 0;\">\n <router-outlet (activate)=\"onPageActivate($event)\" (deactivate)=\"onPageDeactivate()\"></router-outlet>\n </mat-sidenav-content>\n\n </mat-sidenav-container>\n</div>\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * The content above * * * * * * * * * * * -->\n<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->\n<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->\n<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->\n<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->", styles: [":host .toolbar-spacer{flex:1 1 auto}:host .nav-link{display:flex;margin-right:.5em}:host .skip-link{position:absolute;left:8px;top:-100px;z-index:1000;padding:8px 16px;border-radius:4px;background:var(--mat-sys-primary, #005cbb);color:var(--mat-sys-on-primary, #fff)}:host .skip-link:focus{top:8px}:host #main-content:focus{outline:none}:host .container.settling .mat-sidenav,:host .container.settling .mat-sidenav-content,:host .container.settling .mat-sidenav-container,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel-content,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-indicator,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-indicator:after,:host .container.settling .mat-sidenav ::ng-deep .mat-expansion-panel-header,:host .container.settling .mat-sidenav ::ng-deep .mat-mdc-list-item{transition:none!important}:host .mat-sidenav-container{display:flex;flex-direction:row}:host .mat-sidenav-container .mat-drawer-side{position:relative;flex:0 auto}:host .mat-sidenav-container .mat-drawer-over{position:fixed}:host .mat-sidenav-container .mat-sidenav-content{flex:1;height:auto}:host .container{display:flex;flex-direction:column}:host .container .mat-toolbar{flex:0 0 auto}:host .container .mat-sidenav-container{flex:1 1 auto;display:flex;flex-direction:row}\n"] }]
1586
- }], ctorParameters: () => [{ type: LayoutService }, { type: SearchService }, { type: PageSwitcherService }, { type: i4$2.BreakpointObserver }, { type: i0.ChangeDetectorRef }] });
1752
+ args: [{ selector: 'juice-standard-workspace, app-page', changeDetection: ChangeDetectionStrategy.Eager, imports: [RouterOutlet, RouterLink, NgComponentOutlet, TranslatePipe, JuiceIcon, JuiceIconButton, JuiceShell, JuiceHeader,
1753
+ JuiceSidebar, JuiceSidePanel, NavMenuComponent, SearchBarComponent, PaletteSwitchComponent, DarkModeComponent,
1754
+ UserProfileComponent], template: "<juice-shell [skipLabel]=\"'Skip to content' | translate\" [mainLandmark]=\"service.mainLandmark()\" [class.mobile]=\"isMobile\">\n <juice-header juiceShellHeader>\n @if (isMobile) {\n <button type=\"button\" juiceIconButton (click)=\"toggleSidenav()\" [attr.aria-label]=\"'Menu' | translate\"\n [attr.aria-expanded]=\"isSnavOpenned\">\n <juice-icon name=\"menu\" [size]=\"20\" />\n </button>\n } @else {\n <a [routerLink]=\"['/', service.tenantIdentifier]\" class=\"home\" [attr.aria-label]=\"service.brandName() || ('Home' | translate)\">\n <img height=\"32\" alt=\"\" [src]=\"service.brandLogo()\" />\n </a>\n <span class=\"brand\">{{ service.brandName() }}</span>\n }\n <juice-search-bar></juice-search-bar>\n <span class=\"juice-header__spacer\"></span>\n @if (switcher.isEnabled) {\n <button type=\"button\" juiceIconButton (click)=\"switcher.open()\" data-testid=\"page-switcher-open\"\n [attr.title]=\"('Go to page' | translate) + ' (Ctrl+K)'\" [attr.aria-label]=\"'Go to page' | translate\">\n <juice-icon name=\"text-search\" [size]=\"18\" />\n </button>\n }\n @for (item of toolbarItems; track $index) {\n <ng-container *ngComponentOutlet=\"item\"></ng-container>\n }\n <juice-palette-switch></juice-palette-switch>\n <juice-dark-mode></juice-dark-mode>\n <juice-user-profile></juice-user-profile>\n </juice-header>\n\n @if (!isMobile) {\n <juice-sidebar juiceShellSidebar [collapsed]=\"!service.menuOpen()\" (collapsedChange)=\"onCollapsedChange($event)\"\n [collapseLabel]=\"'Collapse menu' | translate\" [expandLabel]=\"'Expand menu' | translate\">\n <juice-nav-menu #menu [isExpanded]=\"service.menuOpen()\"></juice-nav-menu>\n @if (menu.settingUrl) {\n <a juiceSidebarFooter [href]=\"menu.settingUrl\" [attr.aria-label]=\"'Settings' | translate\" [attr.title]=\"'Settings' | translate\">\n <juice-icon name=\"settings\" [size]=\"18\" />\n </a>\n }\n </juice-sidebar>\n }\n\n <router-outlet (activate)=\"onPageActivate($event)\" (deactivate)=\"onPageDeactivate()\"></router-outlet>\n</juice-shell>\n\n@if (isMobile) {\n <juice-side-panel [(open)]=\"isSnavOpenned\" [label]=\"'Menu' | translate\">\n <juice-nav-menu #mobileMenu [isExpanded]=\"true\" (click)=\"hideSidenavOnMobile()\"></juice-nav-menu>\n @if (mobileMenu.settingUrl) {\n <a class=\"mobile-settings\" [href]=\"mobileMenu.settingUrl\">\n <juice-icon name=\"settings\" [size]=\"18\" /> {{ 'Settings' | translate }}\n </a>\n }\n </juice-side-panel>\n}\n", styles: [":host{display:block;height:100%}.home{display:flex;align-items:center;margin-right:var(--juice-space-2);border-radius:var(--juice-radius-md)}.brand{font-size:var(--juice-text-md);font-weight:var(--juice-weight-semibold);white-space:nowrap}@media(max-width:599.98px){juice-header [juiceIconButton]{width:40px;height:40px}}.mobile-settings{display:flex;align-items:center;gap:var(--juice-space-3);padding:var(--juice-space-3) var(--juice-space-5);border-top:1px solid var(--juice-color-border);color:inherit;text-decoration:none}\n"] }]
1755
+ }], ctorParameters: () => [] });
1756
+ /** The standard workspace preset (`<juice-standard-workspace>`): the same class as {@link PageComponent}. */
1757
+ const JuiceStandardWorkspace = PageComponent;
1587
1758
 
1588
- class PageNotfoundComponent {
1589
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageNotfoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1590
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: PageNotfoundComponent, isStandalone: false, selector: "juice-page-notfound", ngImport: i0, template: "<div class=\"container pt-4\">\n <h1>{{'Not found' | translate }}</h1>\n <p>{{ 'Your requested resource could not be found' | translate}}</p>\n </div>\n ", styles: [""], dependencies: [{ kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1591
- }
1592
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageNotfoundComponent, decorators: [{
1593
- type: Component,
1594
- args: [{ selector: 'juice-page-notfound', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<div class=\"container pt-4\">\n <h1>{{'Not found' | translate }}</h1>\n <p>{{ 'Your requested resource could not be found' | translate}}</p>\n </div>\n " }]
1595
- }] });
1759
+ /** The icons the shell itself draws; `provideJuiceLayout()` and `LayoutModule.forRoot()` register them. */
1760
+ const LAYOUT_ICONS = {
1761
+ 'menu': Menu,
1762
+ 'search': Search,
1763
+ 'text-search': TextSearch,
1764
+ 'settings': Settings,
1765
+ 'chevron-down': ChevronDown,
1766
+ 'chevron-right': ChevronRight,
1767
+ 'panel-left-close': PanelLeftClose,
1768
+ 'panel-left-open': PanelLeftOpen,
1769
+ 'sun': Sun,
1770
+ 'moon': Moon,
1771
+ 'sun-moon': SunMoon,
1772
+ 'palette': Palette,
1773
+ 'circle-user': CircleUser,
1774
+ 'log-in': LogIn,
1775
+ 'x': X,
1776
+ 'check': Check,
1777
+ };
1778
+ /**
1779
+ * Lucide icons under the Material icon names 2.x menus use (`menuIcon: 'home'`), so a menu shows icons before its routes are
1780
+ * renamed: `provideJuiceIcons(MATERIAL_ICON_ALIASES)`. Opt-in; register your own names the same way.
1781
+ */
1782
+ const MATERIAL_ICON_ALIASES = {
1783
+ 'home': House,
1784
+ 'dashboard': LayoutDashboard,
1785
+ 'security': Shield,
1786
+ 'notifications': Bell,
1787
+ 'inbox': Inbox,
1788
+ 'settings': Settings,
1789
+ 'tune': SlidersHorizontal,
1790
+ 'account_circle': CircleUser,
1791
+ 'alternate_email': AtSign,
1792
+ 'edit_note': NotebookPen,
1793
+ 'search': Search,
1794
+ 'manage_search': TextSearch,
1795
+ };
1596
1796
 
1597
- const routes = [];
1797
+ const MODES = { [ThemeMode.Light]: 'light', [ThemeMode.Dark]: 'dark', [ThemeMode.Auto]: 'system' };
1798
+ /** The theme options that follow the layout's config: its palettes as the accents, its defaults as the theme's. */
1799
+ function layoutThemeOptions(config) {
1800
+ return {
1801
+ defaultMode: MODES[config.defaultThemeMode] ?? 'system',
1802
+ defaultAccent: config.defaultPalette,
1803
+ accents: config.palettes?.length ? config.palettes.map(p => ({ ...p })) : undefined,
1804
+ legacy: true,
1805
+ };
1806
+ }
1807
+ function layoutProviders(production, options) {
1808
+ const config = new LayoutConfig(options);
1809
+ return [
1810
+ LayoutService,
1811
+ { provide: IS_PRODUCTION, useValue: production },
1812
+ { provide: LayoutConfig, useValue: config },
1813
+ // The theme (ThemeService) follows the layout's config, unless the app configures it itself with provideJuiceTheme().
1814
+ { provide: JUICE_THEME_OPTIONS, useValue: layoutThemeOptions(config) },
1815
+ ];
1816
+ }
1817
+ /**
1818
+ * The layout for a standalone app: `bootstrapApplication(App, { providers: [provideJuiceLayout(production, { brand: 'Acme' })] })`.
1819
+ * Registers the shell's icons; register your menu's icons with `provideJuiceIcons()`.
1820
+ */
1821
+ function provideJuiceLayout(production, options) {
1822
+ return makeEnvironmentProviders([...layoutProviders(production, options), provideJuiceIcons(LAYOUT_ICONS)]);
1823
+ }
1598
1824
  class LayoutModule {
1599
1825
  static forRoot(production, options) {
1600
- let config = new LayoutConfig(options);
1601
1826
  return {
1602
1827
  ngModule: LayoutModule,
1603
1828
  providers: [
1604
- LayoutService,
1605
- {
1606
- provide: IS_PRODUCTION,
1607
- useValue: production
1608
- },
1609
- {
1610
- provide: LayoutConfig,
1611
- useValue: config
1612
- }
1829
+ ...layoutProviders(production, options),
1830
+ provideJuiceIcons(LAYOUT_ICONS),
1613
1831
  ]
1614
1832
  };
1615
1833
  }
1616
1834
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1617
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, declarations: [PageComponent,
1618
- DarkModeComponent,
1619
- PaletteSwitchComponent,
1620
- NavMenuComponent,
1621
- ExpandableMenuComponent,
1622
- PageNotfoundComponent,
1623
- SearchBarComponent,
1624
- UserProfileComponent,
1625
- PageSwitcherComponent,
1626
- MenuBadgeComponent], imports: [i3$1.RouterModule, CommonModule,
1627
- TranslatePipe,
1628
- TranslateDirective,
1629
- MatIconModule,
1630
- MatToolbarModule,
1631
- MatSidenavModule,
1632
- MatButtonModule,
1633
- MatExpansionModule,
1634
- MatListModule,
1635
- MatFormFieldModule,
1636
- MatInputModule,
1637
- MatTooltipModule,
1638
- MatDialogModule,
1639
- MatMenuModule], exports: [PageComponent,
1835
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, imports: [RouterModule,
1836
+ DialogModule,
1837
+ PageComponent], exports: [PageComponent,
1640
1838
  RouterModule] }); }
1641
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, imports: [RouterModule.forChild(routes),
1642
- CommonModule,
1643
- MatIconModule,
1644
- MatToolbarModule,
1645
- MatSidenavModule,
1646
- MatButtonModule,
1647
- MatExpansionModule,
1648
- MatListModule,
1649
- MatFormFieldModule,
1650
- MatInputModule,
1651
- MatTooltipModule,
1652
- MatDialogModule,
1653
- MatMenuModule, RouterModule] }); }
1839
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, imports: [RouterModule,
1840
+ DialogModule,
1841
+ PageComponent, RouterModule] }); }
1654
1842
  }
1655
1843
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: LayoutModule, decorators: [{
1656
1844
  type: NgModule,
1657
1845
  args: [{
1658
- declarations: [
1659
- PageComponent,
1660
- DarkModeComponent,
1661
- PaletteSwitchComponent,
1662
- NavMenuComponent,
1663
- ExpandableMenuComponent,
1664
- PageNotfoundComponent,
1665
- SearchBarComponent,
1666
- UserProfileComponent,
1667
- PageSwitcherComponent,
1668
- MenuBadgeComponent,
1669
- ],
1670
1846
  imports: [
1671
- RouterModule.forChild(routes),
1672
- CommonModule,
1673
- TranslatePipe,
1674
- TranslateDirective,
1675
- MatIconModule,
1676
- MatToolbarModule,
1677
- MatSidenavModule,
1678
- MatButtonModule,
1679
- MatExpansionModule,
1680
- MatListModule,
1681
- MatFormFieldModule,
1682
- MatInputModule,
1683
- MatTooltipModule,
1684
- MatDialogModule,
1685
- MatMenuModule
1847
+ RouterModule,
1848
+ DialogModule,
1849
+ PageComponent,
1686
1850
  ],
1687
1851
  exports: [
1688
1852
  PageComponent,
@@ -1691,6 +1855,217 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1691
1855
  }]
1692
1856
  }] });
1693
1857
 
1858
+ /**
1859
+ * Two panes side by side (`orientation="horizontal"`, the default) or one above the other (`vertical`), with a separator between them
1860
+ * that resizes them: dragged, or with the arrow keys (`step` percent), Home and End. Each pane keeps at least `min` percent.
1861
+ * Two-way: `[(sizes)]`. With `storageKey`, the sizes are remembered in this browser; a stored value that is not a valid split is ignored.
1862
+ *
1863
+ * ```html
1864
+ * <juice-split-panel storageKey="orders.split" [(sizes)]="sizes">
1865
+ * <section juiceSplitStart>…</section>
1866
+ * <section juiceSplitEnd>…</section>
1867
+ * </juice-split-panel>
1868
+ * ```
1869
+ */
1870
+ class JuiceSplitPanel {
1871
+ constructor() {
1872
+ this.orientation = input('horizontal', /* @ts-ignore */
1873
+ ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
1874
+ this.sizes = model([50, 50], /* @ts-ignore */
1875
+ ...(ngDevMode ? [{ debugName: "sizes" }] : /* istanbul ignore next */ []));
1876
+ /** The smallest share of either pane, in percent (0 to 50). */
1877
+ this.min = input(10, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
1878
+ /** How far an arrow key moves the separator, in percent. */
1879
+ this.step = input(5, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
1880
+ /** Remembers the sizes in localStorage under this key. */
1881
+ this.storageKey = input(null, /* @ts-ignore */
1882
+ ...(ngDevMode ? [{ debugName: "storageKey" }] : /* istanbul ignore next */ []));
1883
+ /** The separator's accessible name. */
1884
+ this.label = input('Resize panes', /* @ts-ignore */
1885
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1886
+ this.host = inject(ElementRef).nativeElement;
1887
+ this.doc = inject(DOCUMENT$1);
1888
+ this.bounds = computed(() => {
1889
+ const min = Math.min(50, Math.max(0, Number.isFinite(this.min()) ? this.min() : 10));
1890
+ return { min, max: 100 - min };
1891
+ }, /* @ts-ignore */
1892
+ ...(ngDevMode ? [{ debugName: "bounds" }] : /* istanbul ignore next */ []));
1893
+ // The stored sizes, once the key is known (and again if it changes).
1894
+ effect(() => {
1895
+ const key = this.storageKey();
1896
+ if (!key)
1897
+ return;
1898
+ untracked(() => {
1899
+ const stored = this.readStored(key);
1900
+ if (stored)
1901
+ this.sizes.set(stored);
1902
+ });
1903
+ });
1904
+ }
1905
+ round(n) {
1906
+ return Math.round(n);
1907
+ }
1908
+ /** Sets the start pane's share (the end pane takes the rest), within the bounds, and remembers it. */
1909
+ resizeTo(start) {
1910
+ const { min, max } = this.bounds();
1911
+ const clamped = Math.min(max, Math.max(min, start));
1912
+ const next = [clamped, 100 - clamped];
1913
+ const [a] = this.sizes();
1914
+ if (a === clamped)
1915
+ return;
1916
+ this.sizes.set(next);
1917
+ const key = this.storageKey();
1918
+ if (key) {
1919
+ try {
1920
+ this.doc.defaultView?.localStorage.setItem(key, JSON.stringify(next));
1921
+ }
1922
+ catch { /* storage blocked */ }
1923
+ }
1924
+ }
1925
+ onKeydown(e) {
1926
+ const vertical = this.orientation() === 'vertical';
1927
+ const start = this.sizes()[0];
1928
+ const back = vertical ? 'ArrowUp' : 'ArrowLeft';
1929
+ const forward = vertical ? 'ArrowDown' : 'ArrowRight';
1930
+ switch (e.key) {
1931
+ case back:
1932
+ this.resizeTo(start - this.step());
1933
+ break;
1934
+ case forward:
1935
+ this.resizeTo(start + this.step());
1936
+ break;
1937
+ case 'Home':
1938
+ this.resizeTo(this.bounds().min);
1939
+ break;
1940
+ case 'End':
1941
+ this.resizeTo(this.bounds().max);
1942
+ break;
1943
+ default: return;
1944
+ }
1945
+ e.preventDefault();
1946
+ }
1947
+ onPointerDown(e) {
1948
+ if (e.button !== 0)
1949
+ return;
1950
+ e.preventDefault();
1951
+ const separator = e.currentTarget;
1952
+ separator.focus();
1953
+ const rect = this.host.getBoundingClientRect();
1954
+ const vertical = this.orientation() === 'vertical';
1955
+ const move = (ev) => {
1956
+ const length = vertical ? rect.height : rect.width;
1957
+ if (length <= 0)
1958
+ return;
1959
+ const offset = vertical ? ev.clientY - rect.top : ev.clientX - rect.left;
1960
+ this.resizeTo((offset / length) * 100);
1961
+ };
1962
+ const up = () => {
1963
+ this.doc.removeEventListener('pointermove', move);
1964
+ this.doc.removeEventListener('pointerup', up);
1965
+ this.doc.removeEventListener('pointercancel', up);
1966
+ };
1967
+ this.doc.addEventListener('pointermove', move);
1968
+ this.doc.addEventListener('pointerup', up);
1969
+ this.doc.addEventListener('pointercancel', up);
1970
+ }
1971
+ /** The stored split, when it is one: two finite numbers within the bounds that add up to 100. Anything else is ignored. */
1972
+ readStored(key) {
1973
+ let raw = null;
1974
+ try {
1975
+ raw = this.doc.defaultView?.localStorage.getItem(key) ?? null;
1976
+ }
1977
+ catch {
1978
+ return null;
1979
+ }
1980
+ if (!raw || raw.length > 64)
1981
+ return null;
1982
+ let value;
1983
+ try {
1984
+ value = JSON.parse(raw);
1985
+ }
1986
+ catch {
1987
+ return null;
1988
+ }
1989
+ if (!Array.isArray(value) || value.length !== 2)
1990
+ return null;
1991
+ const [a, b] = value;
1992
+ const { min, max } = this.bounds();
1993
+ if (typeof a !== 'number' || typeof b !== 'number' || !Number.isFinite(a) || !Number.isFinite(b))
1994
+ return null;
1995
+ if (a < min || a > max || Math.abs(a + b - 100) > 0.5)
1996
+ return null;
1997
+ return [a, 100 - a];
1998
+ }
1999
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSplitPanel, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2000
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: JuiceSplitPanel, isStandalone: true, selector: "juice-split-panel", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, sizes: { classPropertyName: "sizes", publicName: "sizes", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, storageKey: { classPropertyName: "storageKey", publicName: "storageKey", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sizes: "sizesChange" }, host: { properties: { "class.juice-split-panel--vertical": "orientation() === \"vertical\"" }, classAttribute: "juice-split-panel" }, ngImport: i0, template: `
2001
+ <div class="juice-split-panel__pane" [style.flex-basis]="'calc(' + sizes()[0] + '% - 3px)'"><ng-content select="[juiceSplitStart]" /></div>
2002
+ <div class="juice-split-panel__separator" role="separator" tabindex="0"
2003
+ [attr.aria-orientation]="orientation() === 'vertical' ? 'horizontal' : 'vertical'"
2004
+ [attr.aria-valuenow]="round(sizes()[0])" [attr.aria-valuemin]="bounds().min" [attr.aria-valuemax]="bounds().max"
2005
+ [attr.aria-label]="label()"
2006
+ (keydown)="onKeydown($event)" (pointerdown)="onPointerDown($event)"></div>
2007
+ <div class="juice-split-panel__pane" [style.flex-basis]="'calc(' + sizes()[1] + '% - 3px)'"><ng-content select="[juiceSplitEnd]" /></div>
2008
+ `, isInline: true, styles: [".juice-split-panel{display:flex;width:100%;height:100%;min-width:0;min-height:0}.juice-split-panel--vertical{flex-direction:column}.juice-split-panel__pane{flex-grow:0;flex-shrink:0;min-width:0;min-height:0;overflow:auto}.juice-split-panel__separator{flex:0 0 6px;cursor:col-resize;touch-action:none;background:linear-gradient(var(--juice-panel-resize-handle),var(--juice-panel-resize-handle)) center / 1px 100% no-repeat}.juice-split-panel--vertical>.juice-split-panel__separator{cursor:row-resize;background-size:100% 1px}.juice-split-panel__separator:hover{background-color:var(--juice-color-accent-subtle)}.juice-split-panel__separator:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2009
+ }
2010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceSplitPanel, decorators: [{
2011
+ type: Component,
2012
+ args: [{ selector: 'juice-split-panel', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-split-panel', '[class.juice-split-panel--vertical]': 'orientation() === "vertical"' }, template: `
2013
+ <div class="juice-split-panel__pane" [style.flex-basis]="'calc(' + sizes()[0] + '% - 3px)'"><ng-content select="[juiceSplitStart]" /></div>
2014
+ <div class="juice-split-panel__separator" role="separator" tabindex="0"
2015
+ [attr.aria-orientation]="orientation() === 'vertical' ? 'horizontal' : 'vertical'"
2016
+ [attr.aria-valuenow]="round(sizes()[0])" [attr.aria-valuemin]="bounds().min" [attr.aria-valuemax]="bounds().max"
2017
+ [attr.aria-label]="label()"
2018
+ (keydown)="onKeydown($event)" (pointerdown)="onPointerDown($event)"></div>
2019
+ <div class="juice-split-panel__pane" [style.flex-basis]="'calc(' + sizes()[1] + '% - 3px)'"><ng-content select="[juiceSplitEnd]" /></div>
2020
+ `, styles: [".juice-split-panel{display:flex;width:100%;height:100%;min-width:0;min-height:0}.juice-split-panel--vertical{flex-direction:column}.juice-split-panel__pane{flex-grow:0;flex-shrink:0;min-width:0;min-height:0;overflow:auto}.juice-split-panel__separator{flex:0 0 6px;cursor:col-resize;touch-action:none;background:linear-gradient(var(--juice-panel-resize-handle),var(--juice-panel-resize-handle)) center / 1px 100% no-repeat}.juice-split-panel--vertical>.juice-split-panel__separator{cursor:row-resize;background-size:100% 1px}.juice-split-panel__separator:hover{background-color:var(--juice-color-accent-subtle)}.juice-split-panel__separator:focus-visible{outline:2px solid var(--juice-color-focus-ring);outline-offset:-2px}\n"] }]
2021
+ }], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], sizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "sizes", required: false }] }, { type: i0.Output, args: ["sizesChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], storageKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "storageKey", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
2022
+
2023
+ const SPACES = ['0', '0-5', '1', '2', '3', '4', '5', '6', '8', '10', '12', '16'];
2024
+ /** The gap as a token reference; a value off the scale falls back to the default step. */
2025
+ function gapOf(value, fallback) {
2026
+ const step = String(value ?? '');
2027
+ return `var(--juice-space-${SPACES.includes(step) ? step : fallback})`;
2028
+ }
2029
+ /** Children in a column, `gap` apart (a step of the spacing scale, default 4 = 16px). */
2030
+ class JuiceStack {
2031
+ constructor() {
2032
+ this.gap = input('4', /* @ts-ignore */
2033
+ ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
2034
+ this.gapValue = computed(() => gapOf(this.gap(), '4'), /* @ts-ignore */
2035
+ ...(ngDevMode ? [{ debugName: "gapValue" }] : /* istanbul ignore next */ []));
2036
+ }
2037
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceStack, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2038
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: JuiceStack, isStandalone: true, selector: "juice-stack", inputs: { gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.gap": "gapValue()" }, classAttribute: "juice-stack" }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".juice-stack{display:flex;flex-direction:column;min-width:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2039
+ }
2040
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceStack, decorators: [{
2041
+ type: Component,
2042
+ args: [{ selector: 'juice-stack', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-stack', '[style.gap]': 'gapValue()' }, template: `<ng-content />`, styles: [".juice-stack{display:flex;flex-direction:column;min-width:0}\n"] }]
2043
+ }], propDecorators: { gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }] } });
2044
+ /** Children in a row that wraps, `gap` apart (default 2 = 8px), centred on the cross axis. */
2045
+ class JuiceCluster {
2046
+ constructor() {
2047
+ this.gap = input('2', /* @ts-ignore */
2048
+ ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
2049
+ this.gapValue = computed(() => gapOf(this.gap(), '2'), /* @ts-ignore */
2050
+ ...(ngDevMode ? [{ debugName: "gapValue" }] : /* istanbul ignore next */ []));
2051
+ }
2052
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceCluster, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2053
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: JuiceCluster, isStandalone: true, selector: "juice-cluster", inputs: { gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.gap": "gapValue()" }, classAttribute: "juice-cluster" }, ngImport: i0, template: `<ng-content />`, isInline: true, styles: [".juice-cluster{display:flex;flex-wrap:wrap;align-items:center;min-width:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
2054
+ }
2055
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceCluster, decorators: [{
2056
+ type: Component,
2057
+ args: [{ selector: 'juice-cluster', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { 'class': 'juice-cluster', '[style.gap]': 'gapValue()' }, template: `<ng-content />`, styles: [".juice-cluster{display:flex;flex-wrap:wrap;align-items:center;min-width:0}\n"] }]
2058
+ }], propDecorators: { gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }] } });
2059
+
2060
+ class PageNotfoundComponent {
2061
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageNotfoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2062
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: PageNotfoundComponent, isStandalone: true, selector: "juice-page-notfound", ngImport: i0, template: "<div class=\"notfound\">\n <h1>{{'Not found' | translate }}</h1>\n <p>{{ 'Your requested resource could not be found' | translate}}</p>\n</div>\n", styles: [".notfound{padding:var(--juice-space-6)}.notfound h1{margin:0 0 var(--juice-space-2);font-size:var(--juice-text-2xl);font-weight:var(--juice-weight-semibold)}.notfound p{margin:0;color:var(--juice-color-text-muted)}\n"], dependencies: [{ kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2063
+ }
2064
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageNotfoundComponent, decorators: [{
2065
+ type: Component,
2066
+ args: [{ selector: 'juice-page-notfound', changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslatePipe], template: "<div class=\"notfound\">\n <h1>{{'Not found' | translate }}</h1>\n <p>{{ 'Your requested resource could not be found' | translate}}</p>\n</div>\n", styles: [".notfound{padding:var(--juice-space-6)}.notfound h1{margin:0 0 var(--juice-space-2);font-size:var(--juice-text-2xl);font-weight:var(--juice-weight-semibold)}.notfound p{margin:0;color:var(--juice-color-text-muted)}\n"] }]
2067
+ }] });
2068
+
1694
2069
  /**
1695
2070
  * This module for study purpose only.
1696
2071
  * Consider using matTooltip from @angular/material
@@ -1739,6 +2114,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1739
2114
  }]
1740
2115
  }] });
1741
2116
 
2117
+ /** The built-in profile dialog's content: who is signed in, and Logout. */
1742
2118
  class UserProfileDialogComponent {
1743
2119
  constructor(auth, cdr) {
1744
2120
  this.auth = auth;
@@ -1747,6 +2123,7 @@ class UserProfileDialogComponent {
1747
2123
  this.name = '';
1748
2124
  this.email = '';
1749
2125
  this.loggedin = false;
2126
+ this.ref = inject(DialogRef, { optional: true });
1750
2127
  }
1751
2128
  ngOnInit() {
1752
2129
  if (this.auth.hasValidIdToken()) {
@@ -1756,82 +2133,76 @@ class UserProfileDialogComponent {
1756
2133
  }
1757
2134
  else {
1758
2135
  this.auth.loadUserProfile().then(info => {
1759
- var userProfile = info;
2136
+ const userProfile = info;
1760
2137
  if (userProfile) {
1761
2138
  this.setValues(userProfile.info);
1762
2139
  // Resolved outside an event: mark explicitly for zoneless apps.
1763
2140
  this.cdr.markForCheck();
1764
2141
  }
1765
- else {
1766
- console.debug('No user profile', info);
1767
- }
1768
2142
  });
1769
2143
  }
1770
2144
  }
1771
2145
  }
1772
2146
  setValues(claims) {
1773
- this.username = claims['preferred_username'];
1774
- this.name = claims['name'];
1775
- this.email = claims['email'] ?? '';
2147
+ const c = claims;
2148
+ this.username = String(c['preferred_username'] ?? '');
2149
+ this.name = String(c['name'] ?? '');
2150
+ this.email = String(c['email'] ?? '');
1776
2151
  this.loggedin = true;
1777
2152
  }
2153
+ close() {
2154
+ this.ref?.close();
2155
+ }
1778
2156
  logout() {
1779
2157
  this.auth.loadDiscoveryDocument().then(() => {
1780
2158
  this.auth.logOut();
1781
2159
  });
1782
2160
  }
1783
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogComponent, deps: [{ token: i3$3.OAuthService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1784
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: UserProfileDialogComponent, isStandalone: false, selector: "app-user-profile", ngImport: i0, template: "@if (loggedin) {\n <h3 mat-dialog-title>{{name}}</h3>\n}\n<div mat-dialog-content>\n @if (loggedin) {\n <div>\n @if (name) {\n <p>{{'Welcome' | translate}} {{name}}</p>\n }\n @if (email) {\n <p>{{ 'Email' | translate}}: {{email}}</p>\n }\n <!-- Logout -->\n </div>\n }\n @if (!loggedin) {\n <div>\n <p>{{ 'Please login to view your profile' | translate}}</p>\n </div>\n }\n</div>\n<div mat-dialog-actions>\n @if (loggedin) {\n <button mat-raised-button color=\"primary\" (click)=\"logout()\">{{ 'Logout' | translate}}</button>\n }\n <button mat-button mat-dialog-close cdkFocusInitial>{{ 'Close' | translate}}</button>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
2161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogComponent, deps: [{ token: i3.OAuthService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
2162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: UserProfileDialogComponent, isStandalone: true, selector: "juice-user-profile-dialog", ngImport: i0, template: "<div class=\"juice-dialog\">\n <h2 class=\"juice-dialog__title\" id=\"juice-profile-title\">{{ loggedin ? name : ('Profile' | translate) }}</h2>\n <div class=\"juice-dialog__content\">\n @if (loggedin) {\n @if (name) {\n <p>{{'Welcome' | translate}} {{name}}</p>\n }\n @if (email) {\n <p>{{ 'Email' | translate}}: {{email}}</p>\n }\n } @else {\n <p>{{ 'Please login to view your profile' | translate}}</p>\n }\n </div>\n <div class=\"juice-dialog__actions\">\n <button type=\"button\" juiceButton variant=\"ghost\" (click)=\"close()\">{{ 'Close' | translate}}</button>\n @if (loggedin) {\n <button type=\"button\" juiceButton variant=\"primary\" (click)=\"logout()\">{{ 'Logout' | translate}}</button>\n }\n </div>\n</div>\n", styles: [".juice-dialog{box-sizing:border-box;min-width:16rem;max-width:min(24rem,100vw - 2rem);padding:var(--juice-space-5);border:1px solid var(--juice-panel-border);border-radius:var(--juice-panel-radius);background:var(--juice-panel-bg);color:var(--juice-panel-fg);box-shadow:var(--juice-shadow-overlay);font-family:var(--juice-font-sans)}.juice-dialog__title{margin:0 0 var(--juice-space-3);font-size:var(--juice-text-lg);font-weight:var(--juice-weight-semibold)}.juice-dialog__content{font-size:var(--juice-text-sm);color:var(--juice-color-text-muted)}.juice-dialog__content p{margin:0 0 var(--juice-space-2)}.juice-dialog__actions{display:flex;justify-content:flex-end;gap:var(--juice-space-2);margin-top:var(--juice-space-4)}\n"], dependencies: [{ kind: "component", type: JuiceButton, selector: "button[juiceButton], a[juiceButton]", inputs: ["variant", "size", "loading"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
1785
2163
  }
1786
2164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogComponent, decorators: [{
1787
2165
  type: Component,
1788
- args: [{ selector: 'app-user-profile', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "@if (loggedin) {\n <h3 mat-dialog-title>{{name}}</h3>\n}\n<div mat-dialog-content>\n @if (loggedin) {\n <div>\n @if (name) {\n <p>{{'Welcome' | translate}} {{name}}</p>\n }\n @if (email) {\n <p>{{ 'Email' | translate}}: {{email}}</p>\n }\n <!-- Logout -->\n </div>\n }\n @if (!loggedin) {\n <div>\n <p>{{ 'Please login to view your profile' | translate}}</p>\n </div>\n }\n</div>\n<div mat-dialog-actions>\n @if (loggedin) {\n <button mat-raised-button color=\"primary\" (click)=\"logout()\">{{ 'Logout' | translate}}</button>\n }\n <button mat-button mat-dialog-close cdkFocusInitial>{{ 'Close' | translate}}</button>\n</div>" }]
1789
- }], ctorParameters: () => [{ type: i3$3.OAuthService }, { type: i0.ChangeDetectorRef }] });
2166
+ args: [{ selector: 'juice-user-profile-dialog', changeDetection: ChangeDetectionStrategy.Eager, imports: [TranslatePipe, JuiceButton], template: "<div class=\"juice-dialog\">\n <h2 class=\"juice-dialog__title\" id=\"juice-profile-title\">{{ loggedin ? name : ('Profile' | translate) }}</h2>\n <div class=\"juice-dialog__content\">\n @if (loggedin) {\n @if (name) {\n <p>{{'Welcome' | translate}} {{name}}</p>\n }\n @if (email) {\n <p>{{ 'Email' | translate}}: {{email}}</p>\n }\n } @else {\n <p>{{ 'Please login to view your profile' | translate}}</p>\n }\n </div>\n <div class=\"juice-dialog__actions\">\n <button type=\"button\" juiceButton variant=\"ghost\" (click)=\"close()\">{{ 'Close' | translate}}</button>\n @if (loggedin) {\n <button type=\"button\" juiceButton variant=\"primary\" (click)=\"logout()\">{{ 'Logout' | translate}}</button>\n }\n </div>\n</div>\n", styles: [".juice-dialog{box-sizing:border-box;min-width:16rem;max-width:min(24rem,100vw - 2rem);padding:var(--juice-space-5);border:1px solid var(--juice-panel-border);border-radius:var(--juice-panel-radius);background:var(--juice-panel-bg);color:var(--juice-panel-fg);box-shadow:var(--juice-shadow-overlay);font-family:var(--juice-font-sans)}.juice-dialog__title{margin:0 0 var(--juice-space-3);font-size:var(--juice-text-lg);font-weight:var(--juice-weight-semibold)}.juice-dialog__content{font-size:var(--juice-text-sm);color:var(--juice-color-text-muted)}.juice-dialog__content p{margin:0 0 var(--juice-space-2)}.juice-dialog__actions{display:flex;justify-content:flex-end;gap:var(--juice-space-2);margin-top:var(--juice-space-4)}\n"] }]
2167
+ }], ctorParameters: () => [{ type: i3.OAuthService }, { type: i0.ChangeDetectorRef }] });
1790
2168
 
2169
+ /** The built-in profile dialog: name, email and Logout, under the avatar (CDK Dialog: focus trap, Escape, focus given back). */
1791
2170
  class UserProfileDialogService extends ProfileDialogService {
1792
- constructor(matDialog) {
1793
- super(matDialog);
1794
- }
1795
- async open(data) {
1796
- return this.matDialog.open(UserProfileDialogComponent, { position: { top: '50px', right: '10px' } });
2171
+ constructor(dialog) {
2172
+ super(dialog);
2173
+ this.overlay = inject(Overlay);
2174
+ }
2175
+ async open(_data) {
2176
+ return this.matDialog.open(UserProfileDialogComponent, {
2177
+ panelClass: 'juice-dialog-panel',
2178
+ positionStrategy: this.overlay.position().global().top('56px').right('12px'),
2179
+ ariaLabelledBy: 'juice-profile-title',
2180
+ restoreFocus: true,
2181
+ ariaModal: true,
2182
+ });
1797
2183
  }
1798
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogService, deps: [{ token: i2$1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
2184
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogService, deps: [{ token: i1$1.Dialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
1799
2185
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogService }); }
1800
2186
  }
1801
2187
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogService, decorators: [{
1802
2188
  type: Injectable
1803
- }], ctorParameters: () => [{ type: i2$1.MatDialog }] });
2189
+ }], ctorParameters: () => [{ type: i1$1.Dialog }] });
1804
2190
 
2191
+ /** The built-in profile dialog behind the avatar. Standalone apps: `provideUserProfileDialog()`. */
1805
2192
  class UserProfileDialogModule {
1806
2193
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1807
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogModule, declarations: [UserProfileDialogComponent], imports: [MatDialogModule,
1808
- MatButtonModule,
1809
- TranslatePipe,
1810
- TranslateDirective,
1811
- CommonModule] }); }
2194
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogModule, imports: [DialogModule] }); }
1812
2195
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogModule, providers: [
1813
2196
  {
1814
2197
  provide: ProfileDialogService,
1815
2198
  useClass: UserProfileDialogService
1816
2199
  }
1817
- ], imports: [MatDialogModule,
1818
- MatButtonModule,
1819
- CommonModule] }); }
2200
+ ], imports: [DialogModule] }); }
1820
2201
  }
1821
2202
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: UserProfileDialogModule, decorators: [{
1822
2203
  type: NgModule,
1823
2204
  args: [{
1824
- declarations: [
1825
- UserProfileDialogComponent
1826
- ],
1827
- imports: [
1828
- MatDialogModule,
1829
- MatButtonModule,
1830
- TranslatePipe,
1831
- TranslateDirective,
1832
- CommonModule
1833
- ],
1834
- exports: [],
2205
+ imports: [DialogModule],
1835
2206
  providers: [
1836
2207
  {
1837
2208
  provide: ProfileDialogService,
@@ -1840,6 +2211,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1840
2211
  ]
1841
2212
  }]
1842
2213
  }] });
2214
+ /** The built-in profile dialog behind the avatar, for standalone apps. */
2215
+ function provideUserProfileDialog() {
2216
+ return [{ provide: ProfileDialogService, useClass: UserProfileDialogService }];
2217
+ }
1843
2218
 
1844
2219
  /**
1845
2220
  * The header of a page that isn't about one environment or time range (a module's page, the notification pages): the way back, the title as
@@ -1857,7 +2232,7 @@ class PageHeader {
1857
2232
  ...(ngDevMode ? [{ debugName: "crumbs" }] : /* istanbul ignore next */ []));
1858
2233
  }
1859
2234
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1860
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageHeader, isStandalone: true, selector: "jc-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, crumbs: { classPropertyName: "crumbs", publicName: "crumbs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.title": "null" } }, ngImport: i0, template: `<header class="jc-page-header">
2235
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PageHeader, isStandalone: true, selector: "jc-page-header, juice-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, crumbs: { classPropertyName: "crumbs", publicName: "crumbs", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.title": "null" } }, ngImport: i0, template: `<header class="jc-page-header">
1861
2236
  @for (c of crumbs(); track $index) {
1862
2237
  @if (c.link) { <a class="jc-crumb" [routerLink]="$any(c.link)">{{ c.label }}</a> } @else { <span class="jc-crumb">{{ c.label }}</span> }
1863
2238
  <span class="jc-crumb-sep" aria-hidden="true">›</span>
@@ -1871,7 +2246,7 @@ class PageHeader {
1871
2246
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PageHeader, decorators: [{
1872
2247
  type: Component,
1873
2248
  args: [{
1874
- selector: 'jc-page-header',
2249
+ selector: 'jc-page-header, juice-page-header',
1875
2250
  standalone: true,
1876
2251
  changeDetection: ChangeDetectionStrategy.OnPush,
1877
2252
  imports: [RouterLink],
@@ -1888,6 +2263,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1888
2263
  </header>`,
1889
2264
  }]
1890
2265
  }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], subtitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subtitle", required: false }] }], crumbs: [{ type: i0.Input, args: [{ isSignal: true, alias: "crumbs", required: false }] }] } });
2266
+ /** `<juice-page-header title>`: the same component as {@link PageHeader} (`jc-page-header`). */
2267
+ const JuicePageHeader = PageHeader;
1891
2268
 
1892
2269
  /*
1893
2270
  * Public API Surface of layout
@@ -1897,5 +2274,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1897
2274
  * Generated bundle index. Do not edit.
1898
2275
  */
1899
2276
 
1900
- export { DevGuard, ExpandableMenuComponent, LAYOUT_PALETTES, LAYOUT_TOOLBAR_ITEMS, LayoutModule, LayoutService, MenuBadgeComponent, MenuBadgeService, NavMenuComponent, PageComponent, PageHeader, PageNotfoundComponent, PageSwitcherComponent, PageSwitcherService, ProfileDialogService, SearchService, TooltipDirective, TooltipModule, TooltipPosition, UserProfileDialogModule, flatten, isSearchablePage };
2277
+ export { DevGuard, ExpandableMenuComponent, IS_PRODUCTION, JuiceCluster, JuiceContent, JuiceHeader, JuicePageHeader, JuiceShell, JuiceSidePanel, JuiceSidebar, JuiceSplitPanel, JuiceStack, JuiceStandardWorkspace, LAYOUT_ICONS, LAYOUT_PALETTES, LAYOUT_TOOLBAR_ITEMS, LayoutConfig, LayoutModule, LayoutService, MATERIAL_ICON_ALIASES, MenuBadgeComponent, MenuBadgeService, NavMenuComponent, PageComponent, PageHeader, PageNotfoundComponent, PageSwitcherComponent, PageSwitcherService, ProfileDialogService, SearchService, ThemeMode, TooltipDirective, TooltipModule, TooltipPosition, UserProfileDialogModule, flatten, isSearchablePage, layoutThemeOptions, provideJuiceLayout, provideUserProfileDialog };
1901
2278
  //# sourceMappingURL=juice-js-layout.mjs.map