@ngx-smz/layout 21.10.0-next.26 → 21.10.0-next.27

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.
@@ -0,0 +1,2058 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, computed, Injectable, InjectionToken, provideAppInitializer, inject, makeEnvironmentProviders, effect, Component, EventEmitter, Output, Input, Directive, HostBinding, ViewChild } from '@angular/core';
3
+ import * as i3 from '@angular/common';
4
+ import { CommonModule, Location } from '@angular/common';
5
+ import * as i1 from '@angular/router';
6
+ import { Router, NavigationEnd, RouterModule } from '@angular/router';
7
+ import { Subject, filter as filter$1 } from 'rxjs';
8
+ import * as i2 from '@angular/forms';
9
+ import { FormsModule } from '@angular/forms';
10
+ import { SmzThemeService, SmzSelectButtonComponent, SmzStyleClassDirective, SmzTooltipDirective, SmzMenuListComponent, SmzButtonComponent, SmzRippleDirective } from '@ngx-smz/ui-kit';
11
+ import { takeWhile, filter } from 'rxjs/operators';
12
+ import { trigger, state, style, transition, animate } from '@angular/animations';
13
+
14
+ /**
15
+ * Clones the menu tree and sets `visible: false` where the host denies access via `hasClaim`.
16
+ * Parent items with a submenu are also hidden when every child is non-visible (e.g. all denied by claims).
17
+ * Layout shells only need `visible` / `isVisible`; authorization stays in the injected callback.
18
+ */
19
+ function cloneMenuItemsWithClaimVisibility(items, hasClaim) {
20
+ if (items == null || items.length === 0) {
21
+ return [];
22
+ }
23
+ return items.map((item) => cloneMenuItemWithClaimVisibility(item, hasClaim));
24
+ }
25
+ function cloneMenuItemWithClaimVisibility(item, hasClaim) {
26
+ const source = item;
27
+ const cloned = {
28
+ ...source,
29
+ items: source.items?.map((child) => cloneMenuItemWithClaimVisibility(child, hasClaim))
30
+ };
31
+ const claims = source.claims;
32
+ if (claims != null && claims.length > 0 && hasClaim != null && !hasClaim(claims)) {
33
+ cloned.visible = false;
34
+ }
35
+ const nestedItems = cloned.items;
36
+ if (nestedItems != null && nestedItems.length > 0) {
37
+ const hasAnyVisibleChild = nestedItems.some((child) => child.visible !== false);
38
+ if (!hasAnyVisibleChild) {
39
+ cloned.visible = false;
40
+ }
41
+ }
42
+ return cloned;
43
+ }
44
+
45
+ class SmzUILayout {
46
+ /**
47
+ * Writable menu graph from the host (`SMZ_UI_LAYOUT_CONFIG.sidebar`). Mutations here trigger {@link sidebar}.
48
+ */
49
+ sidebarWritable = signal([], ...(ngDevMode ? [{ debugName: "sidebarWritable" }] : /* istanbul ignore next */ []));
50
+ /**
51
+ * Menu prepared for shells such as Hephaestus: entries denied by {@link SmzUILayoutConfigType.hasClaim}
52
+ * use `visible: false` so templates only need visibility rules.
53
+ */
54
+ sidebar = computed(() => cloneMenuItemsWithClaimVisibility(this.sidebarWritable(), this.layoutFeature?.hasClaim), ...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
55
+ layoutFeature = null;
56
+ footer = signal({}, ...(ngDevMode ? [{ debugName: "footer" }] : /* istanbul ignore next */ []));
57
+ topbar = signal({
58
+ showMenuToggle: true,
59
+ showBackButton: true,
60
+ }, ...(ngDevMode ? [{ debugName: "topbar" }] : /* istanbul ignore next */ []));
61
+ layout = signal({
62
+ preset: 'Aura',
63
+ primary: 'orange',
64
+ surface: null,
65
+ darkTheme: false,
66
+ menuMode: 'static'
67
+ }, ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
68
+ state = signal({
69
+ staticMenuDesktopInactive: false,
70
+ overlayMenuActive: false,
71
+ configSidebarVisible: false,
72
+ staticMenuMobileActive: false,
73
+ menuHoverActive: false
74
+ }, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
75
+ setConfig(config) {
76
+ const { sidebar, footer, topbar } = config || {};
77
+ this.layoutFeature = config ?? null;
78
+ if (sidebar) {
79
+ this.sidebarWritable = sidebar;
80
+ }
81
+ if (footer) {
82
+ this.footer = footer;
83
+ }
84
+ if (topbar) {
85
+ this.topbar = topbar;
86
+ }
87
+ }
88
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzUILayout, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
89
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzUILayout, providedIn: 'root' });
90
+ }
91
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzUILayout, decorators: [{
92
+ type: Injectable,
93
+ args: [{ providedIn: 'root' }]
94
+ }] });
95
+
96
+ const SMZ_UI_LAYOUT_CONFIG = new InjectionToken('SMZ_UI_LAYOUT_CONFIG');
97
+ function createSmzUILayoutEnvironmentProviders(features, resolveHasClaim) {
98
+ const providers = features?.map((feature) => ({
99
+ provide: SMZ_UI_LAYOUT_CONFIG,
100
+ useValue: feature,
101
+ multi: false
102
+ }));
103
+ const initializer = provideAppInitializer(() => {
104
+ const smzLayout = inject(SmzUILayout);
105
+ features?.forEach((feature) => {
106
+ smzLayout.setConfig(feature);
107
+ });
108
+ if (resolveHasClaim != null) {
109
+ inject(SMZ_UI_LAYOUT_CONFIG).hasClaim = resolveHasClaim();
110
+ }
111
+ return;
112
+ });
113
+ return makeEnvironmentProviders([...providers, initializer]);
114
+ }
115
+ /**
116
+ * Fluent configuration for layout provisioning.
117
+ *
118
+ * Prefer granular `.withSidebar()`, `.withFooter()`, … for readability, or `.withFeatures()`
119
+ * when you already expose an assembled {@link SmzUILayoutConfigType} (including multi-feature arrays).
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * configureSmzUILayout()
124
+ * .withSidebar(appSidebar)
125
+ * .withFooter(appFooter)
126
+ * .withTopbar(appTopbar)
127
+ * .withLayout(appLayout)
128
+ * .withLayoutState(appLayoutState)
129
+ * .withMenuAuthorization(() => {
130
+ * const access = inject(AccessControlService);
131
+ * return (claims) => access.hasClaim(claims);
132
+ * })
133
+ * .build()
134
+ * ```
135
+ */
136
+ class SmzUILayoutProvisionBuilder {
137
+ featuresFactory;
138
+ menuAuthorizationFactory;
139
+ sidebarSignal;
140
+ footerSignal;
141
+ topbarSignal;
142
+ layoutSignal;
143
+ layoutStateSignal;
144
+ hasGranularSlots() {
145
+ return (this.sidebarSignal != null ||
146
+ this.footerSignal != null ||
147
+ this.topbarSignal != null ||
148
+ this.layoutSignal != null ||
149
+ this.layoutStateSignal != null);
150
+ }
151
+ assertNotUsingFeaturesFactory(methodName) {
152
+ if (this.featuresFactory != null) {
153
+ throw new Error(`configureSmzUILayout(): ${methodName} cannot be used together with .withFeatures(...).`);
154
+ }
155
+ }
156
+ /**
157
+ * Sync factory returning one or more assembled layout feature objects (advanced / legacy).
158
+ * Cannot use `inject()` here — only plain values and module-scope signals.
159
+ * Do not combine with `.withSidebar()` / `.withFooter()` / …
160
+ */
161
+ withFeatures(factory) {
162
+ if (this.hasGranularSlots()) {
163
+ throw new Error('configureSmzUILayout(): .withFeatures(...) cannot be used together with granular .withSidebar() / .withFooter() / …');
164
+ }
165
+ this.featuresFactory = factory;
166
+ return this;
167
+ }
168
+ withSidebar(sidebar) {
169
+ this.assertNotUsingFeaturesFactory('withSidebar');
170
+ this.sidebarSignal = sidebar;
171
+ return this;
172
+ }
173
+ withFooter(footer) {
174
+ this.assertNotUsingFeaturesFactory('withFooter');
175
+ this.footerSignal = footer;
176
+ return this;
177
+ }
178
+ withTopbar(topbar) {
179
+ this.assertNotUsingFeaturesFactory('withTopbar');
180
+ this.topbarSignal = topbar;
181
+ return this;
182
+ }
183
+ /** Writable layout chrome config (preset, theme flags, menu mode, …). */
184
+ withLayout(layout) {
185
+ this.assertNotUsingFeaturesFactory('withLayout');
186
+ this.layoutSignal = layout;
187
+ return this;
188
+ }
189
+ /** Writable overlay / sidebar UI state for the Prime layout shell. */
190
+ withLayoutState(state) {
191
+ this.assertNotUsingFeaturesFactory('withLayoutState');
192
+ this.layoutStateSignal = state;
193
+ return this;
194
+ }
195
+ /**
196
+ * Runs during app bootstrap (injection context). Use `inject()` to resolve services,
197
+ * then return the predicate assigned to `SMZ_UI_LAYOUT_CONFIG.hasClaim`.
198
+ */
199
+ withMenuAuthorization(factory) {
200
+ this.menuAuthorizationFactory = factory;
201
+ return this;
202
+ }
203
+ build() {
204
+ if (this.featuresFactory != null) {
205
+ const features = this.featuresFactory();
206
+ return createSmzUILayoutEnvironmentProviders(features, this.menuAuthorizationFactory);
207
+ }
208
+ const missingSteps = [];
209
+ if (this.sidebarSignal == null) {
210
+ missingSteps.push('.withSidebar(...)');
211
+ }
212
+ if (this.footerSignal == null) {
213
+ missingSteps.push('.withFooter(...)');
214
+ }
215
+ if (this.topbarSignal == null) {
216
+ missingSteps.push('.withTopbar(...)');
217
+ }
218
+ if (this.layoutSignal == null) {
219
+ missingSteps.push('.withLayout(...)');
220
+ }
221
+ if (this.layoutStateSignal == null) {
222
+ missingSteps.push('.withLayoutState(...)');
223
+ }
224
+ if (missingSteps.length > 0) {
225
+ throw new Error(`configureSmzUILayout(): provide layout signals or call .withFeatures(...). Missing: ${missingSteps.join(', ')}`);
226
+ }
227
+ const feature = {
228
+ sidebar: this.sidebarSignal,
229
+ footer: this.footerSignal,
230
+ topbar: this.topbarSignal,
231
+ layout: this.layoutSignal,
232
+ state: this.layoutStateSignal
233
+ };
234
+ return createSmzUILayoutEnvironmentProviders([feature], this.menuAuthorizationFactory);
235
+ }
236
+ }
237
+ /** Starts a fluent {@link SmzUILayoutProvisionBuilder}; finish with `.build()`. */
238
+ function configureSmzUILayout() {
239
+ return new SmzUILayoutProvisionBuilder();
240
+ }
241
+ /**
242
+ * Registers layout feature objects and applies them on bootstrap.
243
+ *
244
+ * Prefer {@link configureSmzUILayout} with granular `.withSidebar()` / … for readability.
245
+ *
246
+ * @param resolveHasClaim Optional factory run **during app initialization** (injection context).
247
+ */
248
+ function provideSmzUILayout(initializers, resolveHasClaim) {
249
+ const builder = configureSmzUILayout().withFeatures(initializers);
250
+ return resolveHasClaim != null
251
+ ? builder.withMenuAuthorization(resolveHasClaim).build()
252
+ : builder.build();
253
+ }
254
+
255
+ class LayoutService {
256
+ config = inject(SMZ_UI_LAYOUT_CONFIG);
257
+ layoutConfig = this.config.layout;
258
+ layoutState = this.config.state;
259
+ configUpdate = new Subject();
260
+ overlayOpen = new Subject();
261
+ menuSource = new Subject();
262
+ resetSource = new Subject();
263
+ menuSource$ = this.menuSource.asObservable();
264
+ resetSource$ = this.resetSource.asObservable();
265
+ configUpdate$ = this.configUpdate.asObservable();
266
+ overlayOpen$ = this.overlayOpen.asObservable();
267
+ theme = computed(() => (this.layoutConfig()?.darkTheme ? 'light' : 'dark'), ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
268
+ isSidebarActive = computed(() => this.layoutState().overlayMenuActive || this.layoutState().staticMenuMobileActive, ...(ngDevMode ? [{ debugName: "isSidebarActive" }] : /* istanbul ignore next */ []));
269
+ isDarkTheme = computed(() => this.layoutConfig().darkTheme, ...(ngDevMode ? [{ debugName: "isDarkTheme" }] : /* istanbul ignore next */ []));
270
+ getPrimary = computed(() => this.layoutConfig().primary, ...(ngDevMode ? [{ debugName: "getPrimary" }] : /* istanbul ignore next */ []));
271
+ getSurface = computed(() => this.layoutConfig().surface, ...(ngDevMode ? [{ debugName: "getSurface" }] : /* istanbul ignore next */ []));
272
+ isOverlay = computed(() => this.layoutConfig().menuMode === 'overlay', ...(ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []));
273
+ transitionComplete = signal(false, ...(ngDevMode ? [{ debugName: "transitionComplete" }] : /* istanbul ignore next */ []));
274
+ initialized = false;
275
+ constructor() {
276
+ effect(() => {
277
+ const config = this.layoutConfig();
278
+ if (config) {
279
+ this.onConfigUpdate();
280
+ }
281
+ });
282
+ effect(() => {
283
+ const config = this.layoutConfig();
284
+ if (!this.initialized || !config) {
285
+ this.initialized = true;
286
+ return;
287
+ }
288
+ this.handleDarkModeTransition(config);
289
+ });
290
+ }
291
+ handleDarkModeTransition(config) {
292
+ if (typeof document.startViewTransition === 'function') {
293
+ this.startViewTransition(config);
294
+ }
295
+ else {
296
+ this.toggleDarkMode(config);
297
+ this.onTransitionEnd();
298
+ }
299
+ }
300
+ startViewTransition(config) {
301
+ const transition = document.startViewTransition(() => {
302
+ this.toggleDarkMode(config);
303
+ });
304
+ transition.ready
305
+ .then(() => {
306
+ this.onTransitionEnd();
307
+ })
308
+ .catch(() => { });
309
+ }
310
+ toggleDarkMode(config) {
311
+ const effectiveConfig = config || this.layoutConfig();
312
+ if (effectiveConfig.darkTheme) {
313
+ document.documentElement.classList.add('app-dark');
314
+ }
315
+ else {
316
+ document.documentElement.classList.remove('app-dark');
317
+ }
318
+ }
319
+ onTransitionEnd() {
320
+ this.transitionComplete.set(true);
321
+ setTimeout(() => {
322
+ this.transitionComplete.set(false);
323
+ });
324
+ }
325
+ onMenuToggle() {
326
+ if (this.isOverlay()) {
327
+ this.layoutState.update((prev) => ({ ...prev, overlayMenuActive: !this.layoutState().overlayMenuActive }));
328
+ if (this.layoutState().overlayMenuActive) {
329
+ this.overlayOpen.next(null);
330
+ }
331
+ }
332
+ if (this.isDesktop()) {
333
+ this.layoutState.update((prev) => ({ ...prev, staticMenuDesktopInactive: !this.layoutState().staticMenuDesktopInactive }));
334
+ }
335
+ else {
336
+ this.layoutState.update((prev) => ({ ...prev, staticMenuMobileActive: !this.layoutState().staticMenuMobileActive }));
337
+ if (this.layoutState().staticMenuMobileActive) {
338
+ this.overlayOpen.next(null);
339
+ }
340
+ }
341
+ }
342
+ isDesktop() {
343
+ return window.innerWidth > 991;
344
+ }
345
+ isMobile() {
346
+ return !this.isDesktop();
347
+ }
348
+ onConfigUpdate() {
349
+ this.configUpdate.next(this.layoutConfig());
350
+ }
351
+ onMenuStateChange(event) {
352
+ this.menuSource.next(event);
353
+ }
354
+ reset() {
355
+ this.resetSource.next(true);
356
+ }
357
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LayoutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
358
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LayoutService, providedIn: 'root' });
359
+ }
360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LayoutService, decorators: [{
361
+ type: Injectable,
362
+ args: [{
363
+ providedIn: 'root'
364
+ }]
365
+ }], ctorParameters: () => [] });
366
+
367
+ /* Paletas do Tailwind usadas pelo seletor de cor primaria do configurador. */
368
+ const PRIMARY_PALETTES = {
369
+ emerald: { 50: '#ecfdf5', 100: '#d1fae5', 200: '#a7f3d0', 300: '#6ee7b7', 400: '#34d399', 500: '#10b981', 600: '#059669', 700: '#047857', 800: '#065f46', 900: '#064e3b', 950: '#022c22' },
370
+ green: { 50: '#f0fdf4', 100: '#dcfce7', 200: '#bbf7d0', 300: '#86efac', 400: '#4ade80', 500: '#22c55e', 600: '#16a34a', 700: '#15803d', 800: '#166534', 900: '#14532d', 950: '#052e16' },
371
+ lime: { 50: '#f7fee7', 100: '#ecfccb', 200: '#d9f99d', 300: '#bef264', 400: '#a3e635', 500: '#84cc16', 600: '#65a30d', 700: '#4d7c0f', 800: '#3f6212', 900: '#365314', 950: '#1a2e05' },
372
+ orange: { 50: '#fff7ed', 100: '#ffedd5', 200: '#fed7aa', 300: '#fdba74', 400: '#fb923c', 500: '#f97316', 600: '#ea580c', 700: '#c2410c', 800: '#9a3412', 900: '#7c2d12', 950: '#431407' },
373
+ amber: { 50: '#fffbeb', 100: '#fef3c7', 200: '#fde68a', 300: '#fcd34d', 400: '#fbbf24', 500: '#f59e0b', 600: '#d97706', 700: '#b45309', 800: '#92400e', 900: '#78350f', 950: '#451a03' },
374
+ yellow: { 50: '#fefce8', 100: '#fef9c3', 200: '#fef08a', 300: '#fde047', 400: '#facc15', 500: '#eab308', 600: '#ca8a04', 700: '#a16207', 800: '#854d0e', 900: '#713f12', 950: '#422006' },
375
+ teal: { 50: '#f0fdfa', 100: '#ccfbf1', 200: '#99f6e4', 300: '#5eead4', 400: '#2dd4bf', 500: '#14b8a6', 600: '#0d9488', 700: '#0f766e', 800: '#115e59', 900: '#134e4a', 950: '#042f2e' },
376
+ cyan: { 50: '#ecfeff', 100: '#cffafe', 200: '#a5f3fc', 300: '#67e8f9', 400: '#22d3ee', 500: '#06b6d4', 600: '#0891b2', 700: '#0e7490', 800: '#155e75', 900: '#164e63', 950: '#083344' },
377
+ sky: { 50: '#f0f9ff', 100: '#e0f2fe', 200: '#bae6fd', 300: '#7dd3fc', 400: '#38bdf8', 500: '#0ea5e9', 600: '#0284c7', 700: '#0369a1', 800: '#075985', 900: '#0c4a6e', 950: '#082f49' },
378
+ blue: { 50: '#eff6ff', 100: '#dbeafe', 200: '#bfdbfe', 300: '#93c5fd', 400: '#60a5fa', 500: '#3b82f6', 600: '#2563eb', 700: '#1d4ed8', 800: '#1e40af', 900: '#1e3a8a', 950: '#172554' },
379
+ indigo: { 50: '#eef2ff', 100: '#e0e7ff', 200: '#c7d2fe', 300: '#a5b4fc', 400: '#818cf8', 500: '#6366f1', 600: '#4f46e5', 700: '#4338ca', 800: '#3730a3', 900: '#312e81', 950: '#1e1b4b' },
380
+ violet: { 50: '#f5f3ff', 100: '#ede9fe', 200: '#ddd6fe', 300: '#c4b5fd', 400: '#a78bfa', 500: '#8b5cf6', 600: '#7c3aed', 700: '#6d28d9', 800: '#5b21b6', 900: '#4c1d95', 950: '#2e1065' },
381
+ purple: { 50: '#faf5ff', 100: '#f3e8ff', 200: '#e9d5ff', 300: '#d8b4fe', 400: '#c084fc', 500: '#a855f7', 600: '#9333ea', 700: '#7e22ce', 800: '#6b21a8', 900: '#581c87', 950: '#3b0764' },
382
+ fuchsia: { 50: '#fdf4ff', 100: '#fae8ff', 200: '#f5d0fe', 300: '#f0abfc', 400: '#e879f9', 500: '#d946ef', 600: '#c026d3', 700: '#a21caf', 800: '#86198f', 900: '#701a75', 950: '#4a044e' },
383
+ pink: { 50: '#fdf2f8', 100: '#fce7f3', 200: '#fbcfe8', 300: '#f9a8d4', 400: '#f472b6', 500: '#ec4899', 600: '#db2777', 700: '#be185d', 800: '#9d174d', 900: '#831843', 950: '#500724' },
384
+ rose: { 50: '#fff1f2', 100: '#ffe4e6', 200: '#fecdd3', 300: '#fda4af', 400: '#fb7185', 500: '#f43f5e', 600: '#e11d48', 700: '#be123c', 800: '#9f1239', 900: '#881337', 950: '#4c0519' },
385
+ };
386
+
387
+ class AppConfigurator {
388
+ router = inject(Router);
389
+ layoutService = inject(LayoutService);
390
+ theme = inject(SmzThemeService);
391
+ showMenuModeButton = signal(!this.router.url.includes('auth'), ...(ngDevMode ? [{ debugName: "showMenuModeButton" }] : /* istanbul ignore next */ []));
392
+ menuModeOptions = [
393
+ { label: 'Static', value: 'static' },
394
+ { label: 'Overlay', value: 'overlay' }
395
+ ];
396
+ constructor() {
397
+ // Reaplica cor primaria e superficie quando o modo claro/escuro muda (as sobrescritas inline vencem o CSS do tema).
398
+ effect(() => {
399
+ // Reading the signal registers the dependency: any config change (dark theme, primary, surface) re-applies the colors.
400
+ this.layoutService.layoutConfig();
401
+ queueMicrotask(() => this.applyCurrent());
402
+ });
403
+ }
404
+ surfaces = [
405
+ {
406
+ name: 'slate',
407
+ palette: {
408
+ 0: '#ffffff',
409
+ 50: '#f8fafc',
410
+ 100: '#f1f5f9',
411
+ 200: '#e2e8f0',
412
+ 300: '#cbd5e1',
413
+ 400: '#94a3b8',
414
+ 500: '#64748b',
415
+ 600: '#475569',
416
+ 700: '#334155',
417
+ 800: '#1e293b',
418
+ 900: '#0f172a',
419
+ 950: '#020617'
420
+ }
421
+ },
422
+ {
423
+ name: 'gray',
424
+ palette: {
425
+ 0: '#ffffff',
426
+ 50: '#f9fafb',
427
+ 100: '#f3f4f6',
428
+ 200: '#e5e7eb',
429
+ 300: '#d1d5db',
430
+ 400: '#9ca3af',
431
+ 500: '#6b7280',
432
+ 600: '#4b5563',
433
+ 700: '#374151',
434
+ 800: '#1f2937',
435
+ 900: '#111827',
436
+ 950: '#030712'
437
+ }
438
+ },
439
+ {
440
+ name: 'zinc',
441
+ palette: {
442
+ 0: '#ffffff',
443
+ 50: '#fafafa',
444
+ 100: '#f4f4f5',
445
+ 200: '#e4e4e7',
446
+ 300: '#d4d4d8',
447
+ 400: '#a1a1aa',
448
+ 500: '#71717a',
449
+ 600: '#52525b',
450
+ 700: '#3f3f46',
451
+ 800: '#27272a',
452
+ 900: '#18181b',
453
+ 950: '#09090b'
454
+ }
455
+ },
456
+ {
457
+ name: 'neutral',
458
+ palette: {
459
+ 0: '#ffffff',
460
+ 50: '#fafafa',
461
+ 100: '#f5f5f5',
462
+ 200: '#e5e5e5',
463
+ 300: '#d4d4d4',
464
+ 400: '#a3a3a3',
465
+ 500: '#737373',
466
+ 600: '#525252',
467
+ 700: '#404040',
468
+ 800: '#262626',
469
+ 900: '#171717',
470
+ 950: '#0a0a0a'
471
+ }
472
+ },
473
+ {
474
+ name: 'stone',
475
+ palette: {
476
+ 0: '#ffffff',
477
+ 50: '#fafaf9',
478
+ 100: '#f5f5f4',
479
+ 200: '#e7e5e4',
480
+ 300: '#d6d3d1',
481
+ 400: '#a8a29e',
482
+ 500: '#78716c',
483
+ 600: '#57534e',
484
+ 700: '#44403c',
485
+ 800: '#292524',
486
+ 900: '#1c1917',
487
+ 950: '#0c0a09'
488
+ }
489
+ },
490
+ {
491
+ name: 'soho',
492
+ palette: {
493
+ 0: '#ffffff',
494
+ 50: '#ececec',
495
+ 100: '#dedfdf',
496
+ 200: '#c4c4c6',
497
+ 300: '#adaeb0',
498
+ 400: '#97979b',
499
+ 500: '#7f8084',
500
+ 600: '#6a6b70',
501
+ 700: '#55565b',
502
+ 800: '#3f4046',
503
+ 900: '#2c2c34',
504
+ 950: '#16161d'
505
+ }
506
+ },
507
+ {
508
+ name: 'viva',
509
+ palette: {
510
+ 0: '#ffffff',
511
+ 50: '#f3f3f3',
512
+ 100: '#e7e7e8',
513
+ 200: '#cfd0d0',
514
+ 300: '#b7b8b9',
515
+ 400: '#9fa1a1',
516
+ 500: '#87898a',
517
+ 600: '#6e7173',
518
+ 700: '#565a5b',
519
+ 800: '#3e4244',
520
+ 900: '#262b2c',
521
+ 950: '#0e1315'
522
+ }
523
+ },
524
+ {
525
+ name: 'ocean',
526
+ palette: {
527
+ 0: '#ffffff',
528
+ 50: '#fbfcfc',
529
+ 100: '#F7F9F8',
530
+ 200: '#EFF3F2',
531
+ 300: '#DADEDD',
532
+ 400: '#B1B7B6',
533
+ 500: '#828787',
534
+ 600: '#5F7274',
535
+ 700: '#415B61',
536
+ 800: '#29444E',
537
+ 900: '#183240',
538
+ 950: '#0c1920'
539
+ }
540
+ }
541
+ ];
542
+ selectedPrimaryColor = computed(() => this.layoutService.layoutConfig().primary, ...(ngDevMode ? [{ debugName: "selectedPrimaryColor" }] : /* istanbul ignore next */ []));
543
+ selectedSurfaceColor = computed(() => this.layoutService.layoutConfig().surface, ...(ngDevMode ? [{ debugName: "selectedSurfaceColor" }] : /* istanbul ignore next */ []));
544
+ menuMode = computed(() => this.layoutService.layoutConfig().menuMode, ...(ngDevMode ? [{ debugName: "menuMode" }] : /* istanbul ignore next */ []));
545
+ primaryColors = computed(() => {
546
+ const palettes = [{ name: 'noir', palette: {} }];
547
+ Object.entries(PRIMARY_PALETTES).forEach(([name, palette]) => palettes.push({ name, palette }));
548
+ return palettes;
549
+ }, ...(ngDevMode ? [{ debugName: "primaryColors" }] : /* istanbul ignore next */ []));
550
+ updateColors(event, type, color) {
551
+ if (type === 'primary') {
552
+ this.layoutService.layoutConfig.update((state) => ({ ...state, primary: color.name }));
553
+ }
554
+ else if (type === 'surface') {
555
+ this.layoutService.layoutConfig.update((state) => ({ ...state, surface: color.name }));
556
+ }
557
+ event.stopPropagation();
558
+ }
559
+ onMenuModeChange(event) {
560
+ this.layoutService.layoutConfig.update((prev) => ({ ...prev, menuMode: event }));
561
+ }
562
+ applyCurrent() {
563
+ const config = this.layoutService.layoutConfig();
564
+ const dark = !!config.darkTheme;
565
+ this.theme.reset();
566
+ const primary = this.primaryColors().find((c) => c.name === config.primary);
567
+ if (primary?.name === 'noir') {
568
+ this.theme.setPrimaryPalette(dark ? { 500: '#f8fafc', 400: '#f8fafc', 300: '#e2e8f0', 200: '#cbd5e1', 600: '#1e293b', 700: '#334155' } : { 500: '#0f172a', 600: '#1e293b', 700: '#334155' }, dark);
569
+ }
570
+ else if (primary?.palette && Object.keys(primary.palette).length) {
571
+ this.theme.setPrimaryPalette(primary.palette, dark);
572
+ }
573
+ const surface = this.surfaces.find((s) => s.name === config.surface)?.palette;
574
+ if (surface) {
575
+ const p = surface;
576
+ this.theme.setColors(dark
577
+ ? { 'surface-0': p[950], 'surface-1': p[900], 'surface-2': p[800], 'surface-3': p[700], fg: p[50], 'fg-muted': p[300], 'fg-subtle': p[400], line: p[700], 'line-strong': p[600] }
578
+ : { 'surface-0': p[50], 'surface-1': p[0], 'surface-2': p[0], 'surface-3': p[100], fg: p[900], 'fg-muted': p[600], 'fg-subtle': p[400], line: p[200], 'line-strong': p[300] });
579
+ }
580
+ }
581
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppConfigurator, deps: [], target: i0.ɵɵFactoryTarget.Component });
582
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppConfigurator, isStandalone: true, selector: "app-configurator", host: { classAttribute: "hidden absolute top-[3.25rem] right-0 w-72 p-4 bg-surface-0 dark:bg-surface-900 border border-surface rounded-border origin-top shadow-[0px_3px_5px_rgba(0,0,0,0.02),0px_0px_2px_rgba(0,0,0,0.05),0px_1px_4px_rgba(0,0,0,0.08)]" }, ngImport: i0, template: `
583
+ <div class="flex flex-col gap-4">
584
+ <div>
585
+ <span class="text-sm text-muted-color font-semibold">Primary</span>
586
+ <div class="pt-2 flex gap-2 flex-wrap justify-start">
587
+ @for (primaryColor of primaryColors(); track primaryColor.name) {
588
+ <button
589
+ type="button"
590
+ [title]="primaryColor.name"
591
+ (click)="updateColors($event, 'primary', primaryColor)"
592
+ [ngClass]="{ 'outline-primary': primaryColor.name === selectedPrimaryColor() }"
593
+ class="border-none w-5 h-5 rounded-full p-0 cursor-pointer outline-none outline-offset-1"
594
+ [style]="{
595
+ 'background-color': primaryColor?.name === 'noir' ? 'var(--text-color)' : primaryColor?.palette?.['500']
596
+ }"
597
+ ></button>
598
+ }
599
+ </div>
600
+ </div>
601
+ <div>
602
+ <span class="text-sm text-muted-color font-semibold">Surface</span>
603
+ <div class="pt-2 flex gap-2 flex-wrap justify-start">
604
+ @for (surface of surfaces; track surface.name) {
605
+ <button
606
+ type="button"
607
+ [title]="surface.name"
608
+ (click)="updateColors($event, 'surface', surface)"
609
+ [ngClass]="{ 'outline-primary': selectedSurfaceColor() ? selectedSurfaceColor() === surface.name : layoutService.layoutConfig().darkTheme ? surface.name === 'zinc' : surface.name === 'slate' }"
610
+ class="border-none w-5 h-5 rounded-full p-0 cursor-pointer outline-none outline-offset-1"
611
+ [style]="{
612
+ 'background-color': surface?.name === 'noir' ? 'var(--text-color)' : surface?.palette?.['500']
613
+ }"
614
+ ></button>
615
+ }
616
+ </div>
617
+ </div>
618
+ @if (showMenuModeButton()) {
619
+ <div class="flex flex-col gap-2">
620
+ <span class="text-sm text-muted-color font-semibold">Menu Mode</span>
621
+ <ui-select-button [ngModel]="menuMode()" (ngModelChange)="onMenuModeChange($event)" [options]="menuModeOptions" [allowEmpty]="false" size="small"></ui-select-button>
622
+ </div>
623
+ }
624
+ </div>
625
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SmzSelectButtonComponent, selector: "ui-select-button", inputs: ["options", "optionLabel", "optionValue", "optionDisabled", "dataKey", "multiple", "allowEmpty", "size", "styleClass", "appendTo"], outputs: ["changed"] }] });
626
+ }
627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppConfigurator, decorators: [{
628
+ type: Component,
629
+ args: [{
630
+ selector: 'app-configurator',
631
+ standalone: true,
632
+ imports: [CommonModule, FormsModule, SmzSelectButtonComponent],
633
+ template: `
634
+ <div class="flex flex-col gap-4">
635
+ <div>
636
+ <span class="text-sm text-muted-color font-semibold">Primary</span>
637
+ <div class="pt-2 flex gap-2 flex-wrap justify-start">
638
+ @for (primaryColor of primaryColors(); track primaryColor.name) {
639
+ <button
640
+ type="button"
641
+ [title]="primaryColor.name"
642
+ (click)="updateColors($event, 'primary', primaryColor)"
643
+ [ngClass]="{ 'outline-primary': primaryColor.name === selectedPrimaryColor() }"
644
+ class="border-none w-5 h-5 rounded-full p-0 cursor-pointer outline-none outline-offset-1"
645
+ [style]="{
646
+ 'background-color': primaryColor?.name === 'noir' ? 'var(--text-color)' : primaryColor?.palette?.['500']
647
+ }"
648
+ ></button>
649
+ }
650
+ </div>
651
+ </div>
652
+ <div>
653
+ <span class="text-sm text-muted-color font-semibold">Surface</span>
654
+ <div class="pt-2 flex gap-2 flex-wrap justify-start">
655
+ @for (surface of surfaces; track surface.name) {
656
+ <button
657
+ type="button"
658
+ [title]="surface.name"
659
+ (click)="updateColors($event, 'surface', surface)"
660
+ [ngClass]="{ 'outline-primary': selectedSurfaceColor() ? selectedSurfaceColor() === surface.name : layoutService.layoutConfig().darkTheme ? surface.name === 'zinc' : surface.name === 'slate' }"
661
+ class="border-none w-5 h-5 rounded-full p-0 cursor-pointer outline-none outline-offset-1"
662
+ [style]="{
663
+ 'background-color': surface?.name === 'noir' ? 'var(--text-color)' : surface?.palette?.['500']
664
+ }"
665
+ ></button>
666
+ }
667
+ </div>
668
+ </div>
669
+ @if (showMenuModeButton()) {
670
+ <div class="flex flex-col gap-2">
671
+ <span class="text-sm text-muted-color font-semibold">Menu Mode</span>
672
+ <ui-select-button [ngModel]="menuMode()" (ngModelChange)="onMenuModeChange($event)" [options]="menuModeOptions" [allowEmpty]="false" size="small"></ui-select-button>
673
+ </div>
674
+ }
675
+ </div>
676
+ `,
677
+ host: {
678
+ class: 'hidden absolute top-[3.25rem] right-0 w-72 p-4 bg-surface-0 dark:bg-surface-900 border border-surface rounded-border origin-top shadow-[0px_3px_5px_rgba(0,0,0,0.02),0px_0px_2px_rgba(0,0,0,0.05),0px_1px_4px_rgba(0,0,0,0.08)]'
679
+ }
680
+ }]
681
+ }], ctorParameters: () => [] });
682
+
683
+ class InjectComponentService {
684
+ componentRefs = new Map();
685
+ setComponent(key, ref) {
686
+ this.componentRefs.set(key, ref);
687
+ }
688
+ updateComponent(key, input, value) {
689
+ const component = this.componentRefs.get(key);
690
+ if (component) {
691
+ component.instance[input] = value;
692
+ }
693
+ }
694
+ deleteComponent(key) {
695
+ this.componentRefs.delete(key);
696
+ }
697
+ getComponent(key) {
698
+ return this.componentRefs.get(key);
699
+ }
700
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: InjectComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
701
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: InjectComponentService, providedIn: 'root' });
702
+ }
703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: InjectComponentService, decorators: [{
704
+ type: Injectable,
705
+ args: [{
706
+ providedIn: 'root'
707
+ }]
708
+ }] });
709
+
710
+ class ComponentInjectorDirective {
711
+ viewContainerRef;
712
+ service;
713
+ componentInjector;
714
+ context;
715
+ componentCreated = new EventEmitter();
716
+ isActive = true;
717
+ constructor(viewContainerRef, service) {
718
+ this.viewContainerRef = viewContainerRef;
719
+ this.service = service;
720
+ }
721
+ ngAfterContentInit() {
722
+ if (this.componentInjector != null && this.componentInjector.component != null) {
723
+ setTimeout(() => {
724
+ this.addComp();
725
+ }, 0);
726
+ }
727
+ }
728
+ addComp() {
729
+ const componentRef = this.viewContainerRef.createComponent(this.componentInjector.component, {});
730
+ if (this.componentInjector.styleClass != null) {
731
+ componentRef.location.nativeElement.classList.add(...this.componentInjector.styleClass.split(' '));
732
+ }
733
+ this.componentInjector.inputs.forEach((i) => {
734
+ Reflect.set(componentRef.instance, i.key, i.data);
735
+ });
736
+ if (this.componentInjector.outputs != null) {
737
+ this.componentInjector.outputs.forEach((output) => {
738
+ const instance = componentRef.instance;
739
+ const instanceOutput = Reflect.get(instance, output.key);
740
+ if (instanceOutput != null) {
741
+ instanceOutput
742
+ .pipe(takeWhile(() => this.isActive))
743
+ .subscribe((event) => {
744
+ if (output.callback != null)
745
+ output.callback(event);
746
+ });
747
+ }
748
+ });
749
+ }
750
+ this.componentInjector.ref = { componentRef: componentRef };
751
+ this.service.setComponent(this.componentInjector.componentId ?? '', componentRef);
752
+ componentRef.hostView.detectChanges();
753
+ this.componentCreated.emit(componentRef);
754
+ }
755
+ removeComp() {
756
+ this.isActive = false;
757
+ this.viewContainerRef.remove();
758
+ }
759
+ ngOnDestroy() {
760
+ this.removeComp();
761
+ }
762
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ComponentInjectorDirective, deps: [{ token: i0.ViewContainerRef }, { token: InjectComponentService }], target: i0.ɵɵFactoryTarget.Directive });
763
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.5", type: ComponentInjectorDirective, isStandalone: true, selector: "ng-template[componentInjector]", inputs: { componentInjector: "componentInjector", context: "context" }, outputs: { componentCreated: "componentCreated" }, ngImport: i0 });
764
+ }
765
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ComponentInjectorDirective, decorators: [{
766
+ type: Directive,
767
+ args: [{
768
+ // eslint-disable-next-line @angular-eslint/directive-selector -- public attribute selector; renaming it would break consumer templates
769
+ selector: 'ng-template[componentInjector]',
770
+ standalone: true,
771
+ }]
772
+ }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: InjectComponentService }], propDecorators: { componentInjector: [{
773
+ type: Input
774
+ }], context: [{
775
+ type: Input
776
+ }], componentCreated: [{
777
+ type: Output
778
+ }] } });
779
+
780
+ class SmzLayoutLogging {
781
+ logging = signal({
782
+ enabled: false,
783
+ production: false,
784
+ level: 'debug',
785
+ restrictedScopes: []
786
+ }, ...(ngDevMode ? [{ debugName: "logging" }] : /* istanbul ignore next */ []));
787
+ setConfig(config) {
788
+ const { logging } = config || {};
789
+ if (logging) {
790
+ this.logging = logging;
791
+ }
792
+ }
793
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzLayoutLogging, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
794
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzLayoutLogging, providedIn: 'root' });
795
+ }
796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SmzLayoutLogging, decorators: [{
797
+ type: Injectable,
798
+ args: [{ providedIn: 'root' }]
799
+ }] });
800
+
801
+ const SMZ_LAYOUT_LOGGING_CONFIG = new InjectionToken('SMZ_LAYOUT_LOGGING_CONFIG');
802
+ function provideSmzLayoutLogging(initializers) {
803
+ const features = initializers();
804
+ const providers = features?.map((feature) => ({
805
+ provide: SMZ_LAYOUT_LOGGING_CONFIG,
806
+ useValue: feature,
807
+ multi: false
808
+ }));
809
+ const initializer = provideAppInitializer(() => {
810
+ const SmzLayoutLoggingConfig = inject(SmzLayoutLogging);
811
+ features?.forEach((feature) => SmzLayoutLoggingConfig.setConfig(feature));
812
+ return;
813
+ });
814
+ return makeEnvironmentProviders([...providers, initializer]);
815
+ }
816
+
817
+ // logging.service.ts
818
+ /* eslint-disable no-console -- LoggingService is the console wrapper; forwarding to console is its purpose */
819
+ class LoggingService {
820
+ configFn = inject(SMZ_LAYOUT_LOGGING_CONFIG).logging;
821
+ enabled = signal(this.configFn().enabled, ...(ngDevMode ? [{ debugName: "enabled" }] : /* istanbul ignore next */ []));
822
+ // nível de each log: debug=0, info=1, warn=2, error=3
823
+ levelRank = { debug: 0, info: 1, warn: 2, error: 3 };
824
+ /** expose current settings */
825
+ isEnabled = computed(() => this.enabled(), ...(ngDevMode ? [{ debugName: "isEnabled" }] : /* istanbul ignore next */ []));
826
+ currentLevel = computed(() => this.configFn().level ?? 'debug', ...(ngDevMode ? [{ debugName: "currentLevel" }] : /* istanbul ignore next */ []));
827
+ activeScopes = computed(() => this.configFn().restrictedScopes ?? [], ...(ngDevMode ? [{ debugName: "activeScopes" }] : /* istanbul ignore next */ []));
828
+ /** toggle logging global */
829
+ enable() { this.enabled.set(true); }
830
+ disable() { this.enabled.set(false); }
831
+ toggle() { this.enabled.update(e => !e); }
832
+ shouldLog(method, owner) {
833
+ if (!this.enabled()) {
834
+ return false;
835
+ }
836
+ const cfg = this.configFn();
837
+ // nunca log de debug em produção
838
+ if (cfg.production && method === 'debug') {
839
+ return false;
840
+ }
841
+ // respeita nivel configurado
842
+ const cfgLevel = cfg.level ?? 'debug';
843
+ if (this.levelRank[method] < this.levelRank[cfgLevel]) {
844
+ return false;
845
+ }
846
+ // respeita scopes se fornecido
847
+ const scopes = cfg.restrictedScopes;
848
+ if (scopes && scopes.length > 0 && owner) {
849
+ if (!(scopes.includes('*') || scopes.includes(owner))) {
850
+ return false;
851
+ }
852
+ }
853
+ return true;
854
+ }
855
+ log(message, ...optionalParams) {
856
+ if (!this.shouldLog('info'))
857
+ return;
858
+ console.log(message, ...optionalParams);
859
+ }
860
+ warn(message, ...optionalParams) {
861
+ if (!this.shouldLog('warn'))
862
+ return;
863
+ console.warn(message, ...optionalParams);
864
+ }
865
+ error(message, ...optionalParams) {
866
+ if (!this.shouldLog('error'))
867
+ return;
868
+ console.error(message, ...optionalParams);
869
+ }
870
+ debug(message, ...optionalParams) {
871
+ if (!this.shouldLog('debug'))
872
+ return;
873
+ console.debug(message, ...optionalParams);
874
+ }
875
+ /**
876
+ * Retorna um logger com prefixo [owner] e restringe pelos scopes do config
877
+ * owner agora é um LoggingScope ou string
878
+ */
879
+ scoped(owner) {
880
+ const prefix = `[${owner}]`;
881
+ return {
882
+ log: (msg, ...params) => {
883
+ if (!this.shouldLog('info', owner))
884
+ return;
885
+ console.log(prefix, msg, ...params);
886
+ },
887
+ warn: (msg, ...params) => {
888
+ if (!this.shouldLog('warn', owner))
889
+ return;
890
+ console.warn(prefix, msg, ...params);
891
+ },
892
+ error: (msg, ...params) => {
893
+ if (!this.shouldLog('error', owner))
894
+ return;
895
+ console.error(prefix, msg, ...params);
896
+ },
897
+ debug: (msg, ...params) => {
898
+ if (!this.shouldLog('debug', owner))
899
+ return;
900
+ console.debug(prefix, msg, ...params);
901
+ }
902
+ };
903
+ }
904
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LoggingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
905
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LoggingService, providedIn: 'root' });
906
+ }
907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: LoggingService, decorators: [{
908
+ type: Injectable,
909
+ args: [{ providedIn: 'root' }]
910
+ }] });
911
+
912
+ // Definição de scopes possíveis como enum
913
+ var LoggingScope;
914
+ (function (LoggingScope) {
915
+ LoggingScope["NavigationService"] = "NavigationService";
916
+ LoggingScope["PageTitleService"] = "PageTitleService";
917
+ })(LoggingScope || (LoggingScope = {}));
918
+
919
+ // navigation.service.ts
920
+ class NavigationService {
921
+ router = inject(Router);
922
+ location = inject(Location);
923
+ history = signal(['/'], ...(ngDevMode ? [{ debugName: "history" }] : /* istanbul ignore next */ []));
924
+ isPopping = signal(false, ...(ngDevMode ? [{ debugName: "isPopping" }] : /* istanbul ignore next */ []));
925
+ canGoBack = computed(() => this.history().length > 1, ...(ngDevMode ? [{ debugName: "canGoBack" }] : /* istanbul ignore next */ []));
926
+ loggingService = inject(LoggingService);
927
+ logger = this.loggingService.scoped(LoggingScope.NavigationService);
928
+ constructor() {
929
+ this.router.events
930
+ .pipe(filter(evt => evt instanceof NavigationEnd))
931
+ .subscribe((evt) => {
932
+ const raw = evt.url;
933
+ const finalUrl = evt.urlAfterRedirects;
934
+ const hist = this.history();
935
+ this.logger.log(`🔔 NavigationEnd raw="${raw}", final="${finalUrl}"`);
936
+ this.logger.log(` isPopping=${this.isPopping()}, history=[${hist.join(' → ')}]`);
937
+ // 1) Caso goBack()
938
+ if (this.isPopping()) {
939
+ this.logger.log(' → Caso goBack(): limpando flag isPopping');
940
+ this.isPopping.set(false);
941
+ return;
942
+ }
943
+ // 2) Primeira navegação, history === ['/']
944
+ if (hist.length === 1 && hist[0] === '/') {
945
+ // 2.a) redirect "/" -> "/home" (ou outro default)
946
+ if (raw === '/' && finalUrl !== '/') {
947
+ this.logger.log(` → Detectado redirect "/" → "${finalUrl}", ajustando history`);
948
+ this.history.set([finalUrl]);
949
+ return;
950
+ }
951
+ // 2.b) entrou direto em sub-rota sem passar por "/"
952
+ if (raw === finalUrl && raw !== '/') {
953
+ this.logger.log(` → Entrada direta em sub-rota "${finalUrl}", iniciando history ["/", "${finalUrl}"]`);
954
+ this.history.set(['/']);
955
+ this.history.update(h => [...h, finalUrl]);
956
+ return;
957
+ }
958
+ // 2.c) navegação inicial em "/" sem redirect
959
+ if (finalUrl === '/') {
960
+ this.logger.log(' → Navegação inicial em "/", mantendo history');
961
+ return;
962
+ }
963
+ }
964
+ // 3) Demais navegações internas
965
+ this.logger.log(` → Navegação normal para "${finalUrl}", adicionando ao history`);
966
+ this.history.update(h => [...h, finalUrl]);
967
+ });
968
+ }
969
+ /** Para template: [disabled]="!navigationService.canGoBackSignal()" */
970
+ canGoBackSignal() {
971
+ const c = this.canGoBack();
972
+ this.logger.log(`canGoBackSignal() → ${c}`);
973
+ return c;
974
+ }
975
+ /** Volta um passo: remove do history e chama Location.back() */
976
+ goBack() {
977
+ this.logger.log('goBack() chamado');
978
+ if (!this.canGoBack()) {
979
+ this.logger.log(' → Não há para onde voltar, abortando');
980
+ return;
981
+ }
982
+ this.logger.log(' → isPopping=true e removendo último item do history');
983
+ this.isPopping.set(true);
984
+ this.history.update(h => {
985
+ const newHist = h.slice(0, -1);
986
+ this.logger.log(` novo history = [${newHist.join(' → ')}]`);
987
+ return newHist;
988
+ });
989
+ this.location.back();
990
+ }
991
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
992
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: NavigationService, providedIn: 'root' });
993
+ }
994
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: NavigationService, decorators: [{
995
+ type: Injectable,
996
+ args: [{ providedIn: 'root' }]
997
+ }], ctorParameters: () => [] });
998
+
999
+ class PageTitleService {
1000
+ router = inject(Router);
1001
+ loggingService = inject(LoggingService);
1002
+ logger = this.loggingService.scoped(LoggingScope.PageTitleService);
1003
+ // signal que guarda o título (ou null)
1004
+ titleSignal = signal(null, ...(ngDevMode ? [{ debugName: "titleSignal" }] : /* istanbul ignore next */ []));
1005
+ // string pura para template ('' quando null)
1006
+ title = computed(() => this.titleSignal() ?? '', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1007
+ // boolean para visibilidade (false quando null)
1008
+ hasTitle = computed(() => this.titleSignal() !== null, ...(ngDevMode ? [{ debugName: "hasTitle" }] : /* istanbul ignore next */ []));
1009
+ constructor() {
1010
+ // toda vez que uma navegação termina, atualiza o título
1011
+ this.router.events
1012
+ .pipe(filter(evt => evt instanceof NavigationEnd))
1013
+ .subscribe(() => this.updateTitle());
1014
+ // atualiza de cara no load
1015
+ this.updateTitle();
1016
+ }
1017
+ /** Percorre recursivamente o snapshot até a rota mais interna */
1018
+ getDeepestSnapshot(route) {
1019
+ return route.firstChild
1020
+ ? this.getDeepestSnapshot(route.firstChild)
1021
+ : route;
1022
+ }
1023
+ /** Lê o title do data da rota mais interna */
1024
+ updateTitle() {
1025
+ const routerState = this.router.routerState.snapshot;
1026
+ const rootSnapshot = routerState.root;
1027
+ const deepest = this.getDeepestSnapshot(rootSnapshot);
1028
+ const title = typeof deepest.data['title'] === 'string'
1029
+ ? deepest.data['title']
1030
+ : null;
1031
+ this.titleSignal.set(title);
1032
+ }
1033
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: PageTitleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1034
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: PageTitleService, providedIn: 'root' });
1035
+ }
1036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: PageTitleService, decorators: [{
1037
+ type: Injectable,
1038
+ args: [{ providedIn: 'root' }]
1039
+ }], ctorParameters: () => [] });
1040
+
1041
+ class AppTopbar {
1042
+ data = inject(SMZ_UI_LAYOUT_CONFIG).topbar;
1043
+ layoutService = inject(LayoutService);
1044
+ navigationService = inject(NavigationService);
1045
+ pageTitleService = inject(PageTitleService);
1046
+ toggleDarkMode() {
1047
+ this.layoutService.layoutConfig.update((state) => ({ ...state, darkTheme: !state.darkTheme }));
1048
+ }
1049
+ handleMissingImage(event, placeholder) {
1050
+ event.target.src = placeholder;
1051
+ }
1052
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppTopbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1053
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppTopbar, isStandalone: true, selector: "app-topbar", ngImport: i0, template: `
1054
+ @if (data(); as topbar) {
1055
+ <div class="layout-topbar">
1056
+ <div class="layout-topbar-logo-container">
1057
+ @if (topbar.showMenuToggle) {
1058
+ <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1059
+ <i class="fa-solid fa-bars"></i>
1060
+ </button>
1061
+ }
1062
+ <a class="layout-topbar-logo" routerLink="/">
1063
+ @if (topbar.logoPath?.light && !layoutService.isDarkTheme()) {
1064
+ <img [src]="topbar.logoPath?.light" [alt]="topbar.logoPath?.light" class="max-h-9 min-h-8" />
1065
+ }
1066
+ @if (topbar.logoPath?.dark && layoutService.isDarkTheme()) {
1067
+ <img [src]="topbar.logoPath?.dark" [alt]="topbar.logoPath?.dark" class="max-h-9 min-h-8" />
1068
+ }
1069
+ </a>
1070
+ @if (topbar.appName) {
1071
+ <span class="layout-topbar-app-name">{{ topbar.appName }}</span>
1072
+ }
1073
+ </div>
1074
+ <div class="layout-topbar-left-actions">
1075
+ @if (topbar.showBackButton || pageTitleService.hasTitle()) {
1076
+ <span class="topbar-separator"></span>
1077
+ }
1078
+ @if (topbar.showBackButton && navigationService.canGoBackSignal()) {
1079
+ <button class="layout-menu-button layout-topbar-action" (click)="navigationService.goBack()">
1080
+ <i class="fa-solid fa-arrow-left"></i>
1081
+ </button>
1082
+ }
1083
+ @if (pageTitleService.hasTitle()) {
1084
+ <span class="layout-topbar-page-title">
1085
+ <span>{{ pageTitleService.title() }}</span>
1086
+ </span>
1087
+ }
1088
+ </div>
1089
+ <div class="layout-topbar-right-actions">
1090
+ <button class="layout-topbar-menu-button layout-topbar-action" smzStyleClass="@next" enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true">
1091
+ <i class="fa-solid fa-ellipsis-vertical"></i>
1092
+ </button>
1093
+ <div class="layout-topbar-menu hidden lg:block">
1094
+ <div class="layout-topbar-menu-content">
1095
+ @for (item of topbar.menuItems; track item) {
1096
+ @if (item.component != null) {
1097
+ <ng-template [componentInjector]="item.component"></ng-template>
1098
+ }
1099
+ @else {
1100
+ <button type="button" class="layout-topbar-action" (click)="item.callback()" [routerLink]="item.routerLink" [smzTooltip]="item.tooltip">
1101
+ <i [ngClass]="item.icon"></i>
1102
+ <span>{{ item.label }}</span>
1103
+ </button>
1104
+ }
1105
+ }
1106
+ </div>
1107
+ </div>
1108
+ <div class="layout-config-menu">
1109
+ @if (topbar.showDarkModeToggle) {
1110
+ <button type="button" class="layout-topbar-action" (click)="toggleDarkMode()" smzTooltip="Dark/Light">
1111
+ <i [ngClass]="{ 'fa-solid': true, 'fa-moon': layoutService.isDarkTheme(), 'fa-sun': !layoutService.isDarkTheme() }"></i>
1112
+ </button>
1113
+ }
1114
+ @if (topbar.showConfigurator) {
1115
+ <div class="relative">
1116
+ <button class="layout-topbar-action layout-topbar-action-highlight" smzTooltip="Configurações"
1117
+ smzStyleClass="@next" enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true">
1118
+ <i class="fa-solid fa-palette"></i>
1119
+ </button>
1120
+ <app-configurator></app-configurator>
1121
+ </div>
1122
+ }
1123
+ @if (topbar.showProfileMenu !== false) {
1124
+ @for (feature of topbar.features; track feature) {
1125
+ <ui-menu #menu [model]="feature.menuItems" [popup]="true"></ui-menu>
1126
+ @if (feature.avatar && feature.avatar() != null) {
1127
+ <img [src]="feature.avatar()" [alt]="feature.label" class="layout-topbar-action w-8 h-8 rounded-full" (click)="menu.toggle($event)" [smzTooltip]="feature.tooltip" (error)="handleMissingImage($event, feature.placeholder)"/>
1128
+ }
1129
+ @else {
1130
+ <button type="button" class="layout-topbar-action" (click)="menu.toggle($event)" [smzTooltip]="feature.tooltip">
1131
+ <i [ngClass]="feature.icon()"></i>
1132
+ </button>
1133
+ }
1134
+ }
1135
+ }
1136
+ </div>
1137
+ </div>
1138
+ </div>
1139
+ }`, isInline: true, dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: SmzStyleClassDirective, selector: "[smzStyleClass]", inputs: ["smzStyleClass", "enterFromClass", "enterActiveClass", "enterToClass", "leaveFromClass", "leaveActiveClass", "leaveToClass", "hideOnOutsideClick", "toggleClass"] }, { kind: "component", type: AppConfigurator, selector: "app-configurator" }, { kind: "directive", type: ComponentInjectorDirective, selector: "ng-template[componentInjector]", inputs: ["componentInjector", "context"], outputs: ["componentCreated"] }, { kind: "directive", type: SmzTooltipDirective, selector: "[smzTooltip]", inputs: ["smzTooltip", "tooltipPosition", "showDelay", "hideDelay", "tooltipEvent", "escape", "tooltipStyleClass", "tooltipZIndex", "tooltipDisabled", "tooltipTitle", "tooltipShortcut", "tooltipVariant", "tooltipSeverity", "tooltipArrow", "tooltipOnOverflow", "tooltipOptions", "appendTo"] }, { kind: "component", type: SmzMenuListComponent, selector: "ui-menu", inputs: ["model", "popup", "style", "styleClass", "autoZIndex", "appendTo", "baseZIndex"], outputs: ["shown", "hidden"] }] });
1140
+ }
1141
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppTopbar, decorators: [{
1142
+ type: Component,
1143
+ args: [{
1144
+ selector: 'app-topbar',
1145
+ standalone: true,
1146
+ imports: [RouterModule, CommonModule, SmzStyleClassDirective, AppConfigurator, ComponentInjectorDirective, SmzTooltipDirective, SmzMenuListComponent, SmzButtonComponent],
1147
+ template: `
1148
+ @if (data(); as topbar) {
1149
+ <div class="layout-topbar">
1150
+ <div class="layout-topbar-logo-container">
1151
+ @if (topbar.showMenuToggle) {
1152
+ <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1153
+ <i class="fa-solid fa-bars"></i>
1154
+ </button>
1155
+ }
1156
+ <a class="layout-topbar-logo" routerLink="/">
1157
+ @if (topbar.logoPath?.light && !layoutService.isDarkTheme()) {
1158
+ <img [src]="topbar.logoPath?.light" [alt]="topbar.logoPath?.light" class="max-h-9 min-h-8" />
1159
+ }
1160
+ @if (topbar.logoPath?.dark && layoutService.isDarkTheme()) {
1161
+ <img [src]="topbar.logoPath?.dark" [alt]="topbar.logoPath?.dark" class="max-h-9 min-h-8" />
1162
+ }
1163
+ </a>
1164
+ @if (topbar.appName) {
1165
+ <span class="layout-topbar-app-name">{{ topbar.appName }}</span>
1166
+ }
1167
+ </div>
1168
+ <div class="layout-topbar-left-actions">
1169
+ @if (topbar.showBackButton || pageTitleService.hasTitle()) {
1170
+ <span class="topbar-separator"></span>
1171
+ }
1172
+ @if (topbar.showBackButton && navigationService.canGoBackSignal()) {
1173
+ <button class="layout-menu-button layout-topbar-action" (click)="navigationService.goBack()">
1174
+ <i class="fa-solid fa-arrow-left"></i>
1175
+ </button>
1176
+ }
1177
+ @if (pageTitleService.hasTitle()) {
1178
+ <span class="layout-topbar-page-title">
1179
+ <span>{{ pageTitleService.title() }}</span>
1180
+ </span>
1181
+ }
1182
+ </div>
1183
+ <div class="layout-topbar-right-actions">
1184
+ <button class="layout-topbar-menu-button layout-topbar-action" smzStyleClass="@next" enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true">
1185
+ <i class="fa-solid fa-ellipsis-vertical"></i>
1186
+ </button>
1187
+ <div class="layout-topbar-menu hidden lg:block">
1188
+ <div class="layout-topbar-menu-content">
1189
+ @for (item of topbar.menuItems; track item) {
1190
+ @if (item.component != null) {
1191
+ <ng-template [componentInjector]="item.component"></ng-template>
1192
+ }
1193
+ @else {
1194
+ <button type="button" class="layout-topbar-action" (click)="item.callback()" [routerLink]="item.routerLink" [smzTooltip]="item.tooltip">
1195
+ <i [ngClass]="item.icon"></i>
1196
+ <span>{{ item.label }}</span>
1197
+ </button>
1198
+ }
1199
+ }
1200
+ </div>
1201
+ </div>
1202
+ <div class="layout-config-menu">
1203
+ @if (topbar.showDarkModeToggle) {
1204
+ <button type="button" class="layout-topbar-action" (click)="toggleDarkMode()" smzTooltip="Dark/Light">
1205
+ <i [ngClass]="{ 'fa-solid': true, 'fa-moon': layoutService.isDarkTheme(), 'fa-sun': !layoutService.isDarkTheme() }"></i>
1206
+ </button>
1207
+ }
1208
+ @if (topbar.showConfigurator) {
1209
+ <div class="relative">
1210
+ <button class="layout-topbar-action layout-topbar-action-highlight" smzTooltip="Configurações"
1211
+ smzStyleClass="@next" enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true">
1212
+ <i class="fa-solid fa-palette"></i>
1213
+ </button>
1214
+ <app-configurator></app-configurator>
1215
+ </div>
1216
+ }
1217
+ @if (topbar.showProfileMenu !== false) {
1218
+ @for (feature of topbar.features; track feature) {
1219
+ <ui-menu #menu [model]="feature.menuItems" [popup]="true"></ui-menu>
1220
+ @if (feature.avatar && feature.avatar() != null) {
1221
+ <img [src]="feature.avatar()" [alt]="feature.label" class="layout-topbar-action w-8 h-8 rounded-full" (click)="menu.toggle($event)" [smzTooltip]="feature.tooltip" (error)="handleMissingImage($event, feature.placeholder)"/>
1222
+ }
1223
+ @else {
1224
+ <button type="button" class="layout-topbar-action" (click)="menu.toggle($event)" [smzTooltip]="feature.tooltip">
1225
+ <i [ngClass]="feature.icon()"></i>
1226
+ </button>
1227
+ }
1228
+ }
1229
+ }
1230
+ </div>
1231
+ </div>
1232
+ </div>
1233
+ }`
1234
+ }]
1235
+ }] });
1236
+
1237
+ class AppMenuitem {
1238
+ router;
1239
+ layoutService;
1240
+ item;
1241
+ index;
1242
+ root;
1243
+ parentKey;
1244
+ active = false;
1245
+ menuSourceSubscription;
1246
+ menuResetSubscription;
1247
+ key = '';
1248
+ constructor(router, layoutService) {
1249
+ this.router = router;
1250
+ this.layoutService = layoutService;
1251
+ this.menuSourceSubscription = this.layoutService.menuSource$.subscribe((value) => {
1252
+ Promise.resolve(null).then(() => {
1253
+ if (value.routeEvent) {
1254
+ this.active = value.key === this.key || value.key.startsWith(this.key + '-') ? true : false;
1255
+ }
1256
+ else {
1257
+ if (value.key !== this.key && !value.key.startsWith(this.key + '-')) {
1258
+ this.active = false;
1259
+ }
1260
+ }
1261
+ });
1262
+ });
1263
+ this.menuResetSubscription = this.layoutService.resetSource$.subscribe(() => {
1264
+ this.active = false;
1265
+ });
1266
+ this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
1267
+ if (this.item.routerLink) {
1268
+ this.updateActiveStateFromRoute();
1269
+ }
1270
+ });
1271
+ }
1272
+ ngOnInit() {
1273
+ this.key = this.parentKey ? this.parentKey + '-' + this.index : String(this.index);
1274
+ if (this.item.routerLink) {
1275
+ this.updateActiveStateFromRoute();
1276
+ }
1277
+ }
1278
+ updateActiveStateFromRoute() {
1279
+ const activeRoute = this.router.isActive(this.item.routerLink[0], { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' });
1280
+ if (activeRoute) {
1281
+ this.layoutService.onMenuStateChange({ key: this.key, routeEvent: true });
1282
+ }
1283
+ }
1284
+ itemClick(event) {
1285
+ // avoid processing disabled items
1286
+ if (this.item.disabled) {
1287
+ event.preventDefault();
1288
+ return;
1289
+ }
1290
+ // execute command
1291
+ if (this.item.command) {
1292
+ this.item.command({ originalEvent: event, item: this.item });
1293
+ }
1294
+ // toggle active state
1295
+ if (this.item.items) {
1296
+ this.active = !this.active;
1297
+ }
1298
+ this.layoutService.onMenuStateChange({ key: this.key });
1299
+ }
1300
+ get submenuAnimation() {
1301
+ return this.root ? 'expanded' : this.active ? 'expanded' : 'collapsed';
1302
+ }
1303
+ get activeClass() {
1304
+ return this.active && !this.root;
1305
+ }
1306
+ ngOnDestroy() {
1307
+ if (this.menuSourceSubscription) {
1308
+ this.menuSourceSubscription.unsubscribe();
1309
+ }
1310
+ if (this.menuResetSubscription) {
1311
+ this.menuResetSubscription.unsubscribe();
1312
+ }
1313
+ }
1314
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppMenuitem, deps: [{ token: i1.Router }, { token: LayoutService }], target: i0.ɵɵFactoryTarget.Component });
1315
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppMenuitem, isStandalone: true, selector: "[app-menuitem]", inputs: { item: "item", index: "index", root: "root", parentKey: "parentKey" }, host: { properties: { "class.layout-root-menuitem": "this.root", "class.active-menuitem": "this.activeClass" } }, ngImport: i0, template: `
1316
+ <ng-container>
1317
+ @if (root && item.visible !== false) {
1318
+ <div class="layout-menuitem-root-text">{{ item.label }}</div>
1319
+ }
1320
+ @if ((!item.routerLink || item.items) && item.visible !== false) {
1321
+ <a [attr.href]="item.url" (click)="itemClick($event)" [ngClass]="item.styleClass" [attr.target]="item.target" tabindex="0" smzRipple>
1322
+ <i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
1323
+ <span class="layout-menuitem-text">{{ item.label }}</span>
1324
+ @if (item.items) {
1325
+ <i class="fa-solid fa-fw fa-angle-down layout-submenu-toggler"></i>
1326
+ }
1327
+ </a>
1328
+ }
1329
+ @if (item.routerLink && !item.items && item.visible !== false) {
1330
+ <a
1331
+ (click)="itemClick($event)"
1332
+ [ngClass]="item.styleClass"
1333
+ [routerLink]="item.routerLink"
1334
+ routerLinkActive="active-route"
1335
+ [routerLinkActiveOptions]="item.routerLinkActiveOptions || { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
1336
+ [fragment]="item.fragment"
1337
+ [queryParamsHandling]="item.queryParamsHandling"
1338
+ [preserveFragment]="item.preserveFragment"
1339
+ [skipLocationChange]="item.skipLocationChange"
1340
+ [replaceUrl]="item.replaceUrl"
1341
+ [state]="item.state"
1342
+ [queryParams]="item.queryParams"
1343
+ [attr.target]="item.target"
1344
+ tabindex="0"
1345
+ smzRipple
1346
+ >
1347
+ <i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
1348
+ <span class="layout-menuitem-text">{{ item.label }}</span>
1349
+ @if (item.items) {
1350
+ <i class="fa-solid fa-fw fa-angle-down layout-submenu-toggler"></i>
1351
+ }
1352
+ </a>
1353
+ }
1354
+
1355
+ @if (item.items && item.visible !== false) {
1356
+ <ul [@children]="submenuAnimation">
1357
+ @for (child of item.items; track child; let i = $index) {
1358
+ @if (child.visible !== false) {
1359
+ <li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child['badgeClass']"></li>
1360
+ }
1361
+ }
1362
+ </ul>
1363
+ }
1364
+ </ng-container>
1365
+ `, isInline: true, dependencies: [{ kind: "component", type: AppMenuitem, selector: "[app-menuitem]", inputs: ["item", "index", "root", "parentKey"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: SmzRippleDirective, selector: "[smzRipple]" }], animations: [
1366
+ trigger('children', [
1367
+ state('collapsed', style({
1368
+ height: '0'
1369
+ })),
1370
+ state('expanded', style({
1371
+ height: '*'
1372
+ })),
1373
+ transition('collapsed <=> expanded', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
1374
+ ])
1375
+ ] });
1376
+ }
1377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppMenuitem, decorators: [{
1378
+ type: Component,
1379
+ args: [{
1380
+ // eslint-disable-next-line @angular-eslint/component-selector
1381
+ selector: '[app-menuitem]',
1382
+ imports: [CommonModule, RouterModule, SmzRippleDirective],
1383
+ template: `
1384
+ <ng-container>
1385
+ @if (root && item.visible !== false) {
1386
+ <div class="layout-menuitem-root-text">{{ item.label }}</div>
1387
+ }
1388
+ @if ((!item.routerLink || item.items) && item.visible !== false) {
1389
+ <a [attr.href]="item.url" (click)="itemClick($event)" [ngClass]="item.styleClass" [attr.target]="item.target" tabindex="0" smzRipple>
1390
+ <i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
1391
+ <span class="layout-menuitem-text">{{ item.label }}</span>
1392
+ @if (item.items) {
1393
+ <i class="fa-solid fa-fw fa-angle-down layout-submenu-toggler"></i>
1394
+ }
1395
+ </a>
1396
+ }
1397
+ @if (item.routerLink && !item.items && item.visible !== false) {
1398
+ <a
1399
+ (click)="itemClick($event)"
1400
+ [ngClass]="item.styleClass"
1401
+ [routerLink]="item.routerLink"
1402
+ routerLinkActive="active-route"
1403
+ [routerLinkActiveOptions]="item.routerLinkActiveOptions || { paths: 'exact', queryParams: 'ignored', matrixParams: 'ignored', fragment: 'ignored' }"
1404
+ [fragment]="item.fragment"
1405
+ [queryParamsHandling]="item.queryParamsHandling"
1406
+ [preserveFragment]="item.preserveFragment"
1407
+ [skipLocationChange]="item.skipLocationChange"
1408
+ [replaceUrl]="item.replaceUrl"
1409
+ [state]="item.state"
1410
+ [queryParams]="item.queryParams"
1411
+ [attr.target]="item.target"
1412
+ tabindex="0"
1413
+ smzRipple
1414
+ >
1415
+ <i [ngClass]="item.icon" class="layout-menuitem-icon"></i>
1416
+ <span class="layout-menuitem-text">{{ item.label }}</span>
1417
+ @if (item.items) {
1418
+ <i class="fa-solid fa-fw fa-angle-down layout-submenu-toggler"></i>
1419
+ }
1420
+ </a>
1421
+ }
1422
+
1423
+ @if (item.items && item.visible !== false) {
1424
+ <ul [@children]="submenuAnimation">
1425
+ @for (child of item.items; track child; let i = $index) {
1426
+ @if (child.visible !== false) {
1427
+ <li app-menuitem [item]="child" [index]="i" [parentKey]="key" [class]="child['badgeClass']"></li>
1428
+ }
1429
+ }
1430
+ </ul>
1431
+ }
1432
+ </ng-container>
1433
+ `,
1434
+ animations: [
1435
+ trigger('children', [
1436
+ state('collapsed', style({
1437
+ height: '0'
1438
+ })),
1439
+ state('expanded', style({
1440
+ height: '*'
1441
+ })),
1442
+ transition('collapsed <=> expanded', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)'))
1443
+ ])
1444
+ ],
1445
+ // providers: [LayoutService]
1446
+ }]
1447
+ }], ctorParameters: () => [{ type: i1.Router }, { type: LayoutService }], propDecorators: { item: [{
1448
+ type: Input
1449
+ }], index: [{
1450
+ type: Input
1451
+ }], root: [{
1452
+ type: Input
1453
+ }, {
1454
+ type: HostBinding,
1455
+ args: ['class.layout-root-menuitem']
1456
+ }], parentKey: [{
1457
+ type: Input
1458
+ }], activeClass: [{
1459
+ type: HostBinding,
1460
+ args: ['class.active-menuitem']
1461
+ }] } });
1462
+
1463
+ class AppMenu {
1464
+ model = inject(SmzUILayout).sidebar;
1465
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
1466
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppMenu, isStandalone: true, selector: "app-menu", ngImport: i0, template: `<ul class="layout-menu">
1467
+ @for (item of model(); track item; let i = $index) {
1468
+ @if (!item.separator && item.visible !== false) {
1469
+ <li app-menuitem [item]="item" [index]="i" [root]="true"></li>
1470
+ }
1471
+ @if (item.separator) {
1472
+ <li class="menu-separator"></li>
1473
+ }
1474
+ }
1475
+ </ul>`, isInline: true, dependencies: [{ kind: "component", type: AppMenuitem, selector: "[app-menuitem]", inputs: ["item", "index", "root", "parentKey"] }, { kind: "ngmodule", type: RouterModule }] });
1476
+ }
1477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppMenu, decorators: [{
1478
+ type: Component,
1479
+ args: [{
1480
+ selector: 'app-menu',
1481
+ standalone: true,
1482
+ imports: [AppMenuitem, RouterModule],
1483
+ template: `<ul class="layout-menu">
1484
+ @for (item of model(); track item; let i = $index) {
1485
+ @if (!item.separator && item.visible !== false) {
1486
+ <li app-menuitem [item]="item" [index]="i" [root]="true"></li>
1487
+ }
1488
+ @if (item.separator) {
1489
+ <li class="menu-separator"></li>
1490
+ }
1491
+ }
1492
+ </ul>`
1493
+ }]
1494
+ }] });
1495
+
1496
+ class AppSidebar {
1497
+ el;
1498
+ constructor(el) {
1499
+ this.el = el;
1500
+ }
1501
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppSidebar, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1502
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: AppSidebar, isStandalone: true, selector: "app-sidebar", ngImport: i0, template: ` <div class="layout-sidebar">
1503
+ <app-menu></app-menu>
1504
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: AppMenu, selector: "app-menu" }] });
1505
+ }
1506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppSidebar, decorators: [{
1507
+ type: Component,
1508
+ args: [{
1509
+ selector: 'app-sidebar',
1510
+ standalone: true,
1511
+ imports: [AppMenu],
1512
+ template: ` <div class="layout-sidebar">
1513
+ <app-menu></app-menu>
1514
+ </div>`
1515
+ }]
1516
+ }], ctorParameters: () => [{ type: i0.ElementRef }] });
1517
+
1518
+ class AppFooter {
1519
+ data = inject(SMZ_UI_LAYOUT_CONFIG).footer;
1520
+ layoutService = inject(LayoutService);
1521
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppFooter, deps: [], target: i0.ɵɵFactoryTarget.Component });
1522
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppFooter, isStandalone: true, selector: "app-footer", ngImport: i0, template: `
1523
+ @if (data(); as footer) {
1524
+ <div class="flex items-center justify-between px-0 py-4 gap-4 border-t border-surface-border">
1525
+ @if (footer.leftLogoPath?.light && !layoutService.isDarkTheme()) {
1526
+ <img [src]="footer.leftLogoPath?.light" [alt]="footer.leftLogoPath?.light" class="max-h-7" />
1527
+ }
1528
+ @if (footer.leftLogoPath?.dark && layoutService.isDarkTheme()) {
1529
+ <img [src]="footer.leftLogoPath?.dark" [alt]="footer.leftLogoPath?.dark" class="max-h-7" />
1530
+ }
1531
+ <div class="flex-1"></div>
1532
+ @if (footer.rightLogoPath?.light && !layoutService.isDarkTheme()) {
1533
+ <img [src]="footer.rightLogoPath?.light" [alt]="footer.rightLogoPath?.light" class="max-h-7" />
1534
+ }
1535
+ @if (footer.rightLogoPath?.dark && layoutService.isDarkTheme()) {
1536
+ <img [src]="footer.rightLogoPath?.dark" [alt]="footer.rightLogoPath?.dark" class="max-h-7" />
1537
+ }
1538
+ @if (footer.version) {
1539
+ <span class="font-medium text-sm">{{ footer.version }}</span>
1540
+ }
1541
+ @if (footer.copyright) {
1542
+ <span class="font-medium text-sm">{{ footer.copyright }}</span>
1543
+ }
1544
+ </div>
1545
+ }
1546
+ `, isInline: true });
1547
+ }
1548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppFooter, decorators: [{
1549
+ type: Component,
1550
+ args: [{
1551
+ standalone: true,
1552
+ selector: 'app-footer',
1553
+ imports: [],
1554
+ template: `
1555
+ @if (data(); as footer) {
1556
+ <div class="flex items-center justify-between px-0 py-4 gap-4 border-t border-surface-border">
1557
+ @if (footer.leftLogoPath?.light && !layoutService.isDarkTheme()) {
1558
+ <img [src]="footer.leftLogoPath?.light" [alt]="footer.leftLogoPath?.light" class="max-h-7" />
1559
+ }
1560
+ @if (footer.leftLogoPath?.dark && layoutService.isDarkTheme()) {
1561
+ <img [src]="footer.leftLogoPath?.dark" [alt]="footer.leftLogoPath?.dark" class="max-h-7" />
1562
+ }
1563
+ <div class="flex-1"></div>
1564
+ @if (footer.rightLogoPath?.light && !layoutService.isDarkTheme()) {
1565
+ <img [src]="footer.rightLogoPath?.light" [alt]="footer.rightLogoPath?.light" class="max-h-7" />
1566
+ }
1567
+ @if (footer.rightLogoPath?.dark && layoutService.isDarkTheme()) {
1568
+ <img [src]="footer.rightLogoPath?.dark" [alt]="footer.rightLogoPath?.dark" class="max-h-7" />
1569
+ }
1570
+ @if (footer.version) {
1571
+ <span class="font-medium text-sm">{{ footer.version }}</span>
1572
+ }
1573
+ @if (footer.copyright) {
1574
+ <span class="font-medium text-sm">{{ footer.copyright }}</span>
1575
+ }
1576
+ </div>
1577
+ }
1578
+ `
1579
+ }]
1580
+ }] });
1581
+
1582
+ class AppLayout {
1583
+ layoutService;
1584
+ renderer;
1585
+ router;
1586
+ overlayMenuOpenSubscription;
1587
+ menuOutsideClickListener;
1588
+ appSidebar;
1589
+ appTopBar;
1590
+ constructor(layoutService, renderer, router) {
1591
+ this.layoutService = layoutService;
1592
+ this.renderer = renderer;
1593
+ this.router = router;
1594
+ this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
1595
+ if (!this.menuOutsideClickListener) {
1596
+ this.menuOutsideClickListener = this.renderer.listen('document', 'click', (event) => {
1597
+ if (this.isOutsideClicked(event)) {
1598
+ this.hideMenu();
1599
+ }
1600
+ });
1601
+ }
1602
+ if (this.layoutService.layoutState().staticMenuMobileActive) {
1603
+ this.blockBodyScroll();
1604
+ }
1605
+ });
1606
+ this.router.events.pipe(filter$1((event) => event instanceof NavigationEnd)).subscribe(() => {
1607
+ this.hideMenu();
1608
+ });
1609
+ }
1610
+ isOutsideClicked(event) {
1611
+ const sidebarEl = document.querySelector('.layout-sidebar');
1612
+ const topbarEl = document.querySelector('.layout-menu-button');
1613
+ const eventTarget = event.target;
1614
+ return !(sidebarEl?.isSameNode(eventTarget) || sidebarEl?.contains(eventTarget) || topbarEl?.isSameNode(eventTarget) || topbarEl?.contains(eventTarget));
1615
+ }
1616
+ hideMenu() {
1617
+ this.layoutService.layoutState.update((prev) => ({ ...prev, overlayMenuActive: false, staticMenuMobileActive: false, menuHoverActive: false }));
1618
+ if (this.menuOutsideClickListener) {
1619
+ this.menuOutsideClickListener();
1620
+ this.menuOutsideClickListener = null;
1621
+ }
1622
+ this.unblockBodyScroll();
1623
+ }
1624
+ blockBodyScroll() {
1625
+ if (document.body.classList) {
1626
+ document.body.classList.add('blocked-scroll');
1627
+ }
1628
+ else {
1629
+ document.body.className += ' blocked-scroll';
1630
+ }
1631
+ }
1632
+ unblockBodyScroll() {
1633
+ if (document.body.classList) {
1634
+ document.body.classList.remove('blocked-scroll');
1635
+ }
1636
+ else {
1637
+ document.body.className = document.body.className.replace(new RegExp('(^|\\b)' + 'blocked-scroll'.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
1638
+ }
1639
+ }
1640
+ get containerClass() {
1641
+ return {
1642
+ 'layout-overlay': this.layoutService.layoutConfig().menuMode === 'overlay',
1643
+ 'layout-static': this.layoutService.layoutConfig().menuMode === 'static',
1644
+ 'layout-static-inactive': this.layoutService.layoutState().staticMenuDesktopInactive && this.layoutService.layoutConfig().menuMode === 'static',
1645
+ 'layout-overlay-active': this.layoutService.layoutState().overlayMenuActive,
1646
+ 'layout-mobile-active': this.layoutService.layoutState().staticMenuMobileActive,
1647
+ 'layout-sidebar-hidden': this.layoutService.layoutConfig().showSidebar === false
1648
+ };
1649
+ }
1650
+ ngOnDestroy() {
1651
+ if (this.overlayMenuOpenSubscription) {
1652
+ this.overlayMenuOpenSubscription.unsubscribe();
1653
+ }
1654
+ if (this.menuOutsideClickListener) {
1655
+ this.menuOutsideClickListener();
1656
+ }
1657
+ }
1658
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppLayout, deps: [{ token: LayoutService }, { token: i0.Renderer2 }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Component });
1659
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AppLayout, isStandalone: true, selector: "app-layout", viewQueries: [{ propertyName: "appSidebar", first: true, predicate: AppSidebar, descendants: true }, { propertyName: "appTopBar", first: true, predicate: AppTopbar, descendants: true }], ngImport: i0, template: `<div class="layout-wrapper" [ngClass]="containerClass">
1660
+ <app-topbar></app-topbar>
1661
+ @if (layoutService.layoutConfig().showSidebar !== false) {
1662
+ <app-sidebar></app-sidebar>
1663
+ }
1664
+ <div class="layout-main-container">
1665
+ <div class="layout-main relative">
1666
+ <router-outlet></router-outlet>
1667
+ </div>
1668
+ <app-footer></app-footer>
1669
+ </div>
1670
+ <div class="layout-mask animate-fadein"></div>
1671
+ </div> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: AppTopbar, selector: "app-topbar" }, { kind: "component", type: AppSidebar, selector: "app-sidebar" }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: AppFooter, selector: "app-footer" }] });
1672
+ }
1673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppLayout, decorators: [{
1674
+ type: Component,
1675
+ args: [{
1676
+ selector: 'app-layout',
1677
+ standalone: true,
1678
+ imports: [CommonModule, AppTopbar, AppSidebar, RouterModule, AppFooter],
1679
+ template: `<div class="layout-wrapper" [ngClass]="containerClass">
1680
+ <app-topbar></app-topbar>
1681
+ @if (layoutService.layoutConfig().showSidebar !== false) {
1682
+ <app-sidebar></app-sidebar>
1683
+ }
1684
+ <div class="layout-main-container">
1685
+ <div class="layout-main relative">
1686
+ <router-outlet></router-outlet>
1687
+ </div>
1688
+ <app-footer></app-footer>
1689
+ </div>
1690
+ <div class="layout-mask animate-fadein"></div>
1691
+ </div> `
1692
+ }]
1693
+ }], ctorParameters: () => [{ type: LayoutService }, { type: i0.Renderer2 }, { type: i1.Router }], propDecorators: { appSidebar: [{
1694
+ type: ViewChild,
1695
+ args: [AppSidebar]
1696
+ }], appTopBar: [{
1697
+ type: ViewChild,
1698
+ args: [AppTopbar]
1699
+ }] } });
1700
+
1701
+ class AppFloatingConfigurator {
1702
+ LayoutService = inject(LayoutService);
1703
+ isDarkTheme = computed(() => this.LayoutService.layoutConfig().darkTheme, ...(ngDevMode ? [{ debugName: "isDarkTheme" }] : /* istanbul ignore next */ []));
1704
+ toggleDarkMode() {
1705
+ this.LayoutService.layoutConfig.update((state) => ({ ...state, darkTheme: !state.darkTheme }));
1706
+ }
1707
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppFloatingConfigurator, deps: [], target: i0.ɵɵFactoryTarget.Component });
1708
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.5", type: AppFloatingConfigurator, isStandalone: true, selector: "app-floating-configurator", ngImport: i0, template: `
1709
+ <div class="fixed flex gap-4 top-8 right-8">
1710
+ <button smzButton type="button" (click)="toggleDarkMode()" [rounded]="true" [icon]="isDarkTheme() ? 'fa-solid fa-moon' : 'fa-solid fa-sun'" severity="secondary"></button>
1711
+ <div class="relative">
1712
+ <button smzButton icon="fa-solid fa-palette" smzStyleClass="@next"
1713
+ enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true" type="button" rounded></button>
1714
+ <app-configurator />
1715
+ </div>
1716
+ </div>
1717
+ `, isInline: true, dependencies: [{ kind: "component", type: SmzButtonComponent, selector: "button[smzButton], a[smzButton]", inputs: ["label", "icon", "iconPosition", "severity", "variant", "size", "text", "outlined", "rounded", "loading", "styleClass"] }, { kind: "directive", type: SmzStyleClassDirective, selector: "[smzStyleClass]", inputs: ["smzStyleClass", "enterFromClass", "enterActiveClass", "enterToClass", "leaveFromClass", "leaveActiveClass", "leaveToClass", "hideOnOutsideClick", "toggleClass"] }, { kind: "component", type: AppConfigurator, selector: "app-configurator" }] });
1718
+ }
1719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppFloatingConfigurator, decorators: [{
1720
+ type: Component,
1721
+ args: [{
1722
+ selector: 'app-floating-configurator',
1723
+ imports: [SmzButtonComponent, SmzStyleClassDirective, AppConfigurator],
1724
+ template: `
1725
+ <div class="fixed flex gap-4 top-8 right-8">
1726
+ <button smzButton type="button" (click)="toggleDarkMode()" [rounded]="true" [icon]="isDarkTheme() ? 'fa-solid fa-moon' : 'fa-solid fa-sun'" severity="secondary"></button>
1727
+ <div class="relative">
1728
+ <button smzButton icon="fa-solid fa-palette" smzStyleClass="@next"
1729
+ enterFromClass="hidden" enterActiveClass="animate-scalein" leaveToClass="hidden" leaveActiveClass="animate-fadeout" [hideOnOutsideClick]="true" type="button" rounded></button>
1730
+ <app-configurator />
1731
+ </div>
1732
+ </div>
1733
+ `
1734
+ }]
1735
+ }] });
1736
+
1737
+ class ErrorPagesConfigService {
1738
+ // Criando um signal com a configuração padrão inicial
1739
+ config = signal({
1740
+ notfound: {
1741
+ code: 404,
1742
+ title: 'Página não encontrada',
1743
+ message: 'A página que você está procurando não foi encontrada.',
1744
+ backgroundPath: 'assets/images/pages/bg-404.jpg',
1745
+ links: [],
1746
+ buttons: [
1747
+ {
1748
+ label: 'Voltar para a home',
1749
+ url: '/',
1750
+ command: () => { },
1751
+ severity: 'warn'
1752
+ }
1753
+ ]
1754
+ },
1755
+ access: {
1756
+ icon: 'fa-solid fa-fw fa-lock',
1757
+ title: 'Acesso restrito',
1758
+ message: 'Acesso restrito',
1759
+ imagePath: 'assets/images/asset-access.svg',
1760
+ backgroundPath: 'assets/images/pages/bg-access.jpg',
1761
+ buttons: [
1762
+ {
1763
+ label: 'Voltar para a home',
1764
+ url: '/',
1765
+ command: () => { },
1766
+ severity: 'warn'
1767
+ }
1768
+ ]
1769
+ },
1770
+ error: {
1771
+ icon: 'fa-solid fa-fw fa-circle-exclamation',
1772
+ title: 'Ocorreu um erro',
1773
+ message: 'Ocorreu um erro ao carregar a página.',
1774
+ imagePath: 'assets/images/asset-error.svg',
1775
+ backgroundPath: 'assets/images/pages/bg-error.jpg',
1776
+ buttons: [
1777
+ {
1778
+ label: 'Voltar para a home',
1779
+ url: '/',
1780
+ command: () => { },
1781
+ severity: 'danger'
1782
+ },
1783
+ ]
1784
+ }
1785
+ }, ...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
1786
+ // Método para atualizar dinamicamente a configuração de forma merge
1787
+ updateConfig(newConfig) {
1788
+ this.config.update((currentConfig) => ({
1789
+ ...currentConfig,
1790
+ ...newConfig,
1791
+ // Faz merge interno para cada seção, preservando os valores não alterados
1792
+ notfound: { ...currentConfig.notfound, ...newConfig.notfound },
1793
+ access: { ...currentConfig.access, ...newConfig.access },
1794
+ error: { ...currentConfig.error, ...newConfig.error }
1795
+ }));
1796
+ }
1797
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorPagesConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1798
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorPagesConfigService, providedIn: 'root' });
1799
+ }
1800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorPagesConfigService, decorators: [{
1801
+ type: Injectable,
1802
+ args: [{ providedIn: 'root' }]
1803
+ }] });
1804
+
1805
+ class AccessPageComponent {
1806
+ config = inject(ErrorPagesConfigService).config();
1807
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AccessPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1808
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: AccessPageComponent, isStandalone: true, selector: "app-access", ngImport: i0, template: `
1809
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1810
+
1811
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1812
+ <div class="flex flex-wrap w-8/12 flex-none items-center -mt-2 -mx-2">
1813
+ <div class="w-full flex-none p-0 text-[5em] font-bold leading-tight text-text-color">{{ config.access.title }}</div>
1814
+ <div class="w-4/12 flex-none mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0"></div>
1815
+ <div class="w-full flex-none mb-[2em] max-w-prose p-0 text-[1.4em] font-medium leading-relaxed text-text-color">{{ config.access.message }}</div>
1816
+ <div class="flex flex-wrap items-center justify-start gap-2">
1817
+ @for (button of config.access.buttons; track button) {
1818
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
1819
+ }
1820
+ </div>
1821
+ </div>
1822
+ </div>
1823
+
1824
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
1825
+ <img class="m-0 h-screen w-full object-cover p-0" [src]="config.access.backgroundPath" alt="" />
1826
+ </div>
1827
+ </div>
1828
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: SmzButtonComponent, selector: "button[smzButton], a[smzButton]", inputs: ["label", "icon", "iconPosition", "severity", "variant", "size", "text", "outlined", "rounded", "loading", "styleClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
1829
+ }
1830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AccessPageComponent, decorators: [{
1831
+ type: Component,
1832
+ args: [{
1833
+ selector: 'app-access',
1834
+ standalone: true,
1835
+ imports: [CommonModule, SmzButtonComponent, RouterModule, SmzRippleDirective, SmzButtonComponent],
1836
+ template: `
1837
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1838
+
1839
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1840
+ <div class="flex flex-wrap w-8/12 flex-none items-center -mt-2 -mx-2">
1841
+ <div class="w-full flex-none p-0 text-[5em] font-bold leading-tight text-text-color">{{ config.access.title }}</div>
1842
+ <div class="w-4/12 flex-none mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0"></div>
1843
+ <div class="w-full flex-none mb-[2em] max-w-prose p-0 text-[1.4em] font-medium leading-relaxed text-text-color">{{ config.access.message }}</div>
1844
+ <div class="flex flex-wrap items-center justify-start gap-2">
1845
+ @for (button of config.access.buttons; track button) {
1846
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
1847
+ }
1848
+ </div>
1849
+ </div>
1850
+ </div>
1851
+
1852
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
1853
+ <img class="m-0 h-screen w-full object-cover p-0" [src]="config.access.backgroundPath" alt="" />
1854
+ </div>
1855
+ </div>
1856
+ `
1857
+ }]
1858
+ }] });
1859
+
1860
+ class ErrorPageComponent {
1861
+ config = inject(ErrorPagesConfigService).config();
1862
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1863
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: ErrorPageComponent, isStandalone: true, selector: "app-error", ngImport: i0, template: `
1864
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1865
+
1866
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1867
+ <div class="flex flex-wrap w-8/12 flex-none items-center -mt-2 -mx-2">
1868
+ <div class="w-full flex-none p-0 text-[5em] font-bold leading-tight text-text-color">{{ config.error.title }}</div>
1869
+ <div class="w-4/12 flex-none mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0"></div>
1870
+ <div class="w-full flex-none mb-[2em] max-w-prose p-0 text-[1.4em] font-medium leading-relaxed text-text-color">{{ config.error.message }}</div>
1871
+ <div class="flex flex-wrap items-center justify-start gap-2">
1872
+ @for (button of config.error.buttons; track button) {
1873
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
1874
+ }
1875
+ </div>
1876
+ </div>
1877
+ </div>
1878
+
1879
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
1880
+ <img class="m-0 h-screen w-full object-cover p-0" [src]="config.error.backgroundPath" alt="" />
1881
+ </div>
1882
+ </div>
1883
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: SmzButtonComponent, selector: "button[smzButton], a[smzButton]", inputs: ["label", "icon", "iconPosition", "severity", "variant", "size", "text", "outlined", "rounded", "loading", "styleClass"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }] });
1884
+ }
1885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: ErrorPageComponent, decorators: [{
1886
+ type: Component,
1887
+ args: [{
1888
+ selector: 'app-error',
1889
+ imports: [CommonModule, SmzButtonComponent, SmzRippleDirective, RouterModule, SmzButtonComponent],
1890
+ standalone: true,
1891
+ template: `
1892
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1893
+
1894
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1895
+ <div class="flex flex-wrap w-8/12 flex-none items-center -mt-2 -mx-2">
1896
+ <div class="w-full flex-none p-0 text-[5em] font-bold leading-tight text-text-color">{{ config.error.title }}</div>
1897
+ <div class="w-4/12 flex-none mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0"></div>
1898
+ <div class="w-full flex-none mb-[2em] max-w-prose p-0 text-[1.4em] font-medium leading-relaxed text-text-color">{{ config.error.message }}</div>
1899
+ <div class="flex flex-wrap items-center justify-start gap-2">
1900
+ @for (button of config.error.buttons; track button) {
1901
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
1902
+ }
1903
+ </div>
1904
+ </div>
1905
+ </div>
1906
+
1907
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
1908
+ <img class="m-0 h-screen w-full object-cover p-0" [src]="config.error.backgroundPath" alt="" />
1909
+ </div>
1910
+ </div>
1911
+ `
1912
+ }]
1913
+ }] });
1914
+
1915
+ class NotfoundPageComponent {
1916
+ config = inject(ErrorPagesConfigService).config();
1917
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: NotfoundPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1918
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: NotfoundPageComponent, isStandalone: true, selector: "app-notfound", ngImport: i0, template: `
1919
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1920
+
1921
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1922
+ <div class="grid grid-cols-12 w-8/12 flex-none items-center gap-4 pb-2">
1923
+ <div class="col-span-12 p-0 text-[5em] font-bold leading-tight text-text-color min-w-0">{{ config.notfound.code }}</div>
1924
+ <div class="col-span-4 mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0 min-w-0"></div>
1925
+ <div class="col-span-12 mb-2 p-0 text-[1.4em] font-medium leading-relaxed text-text-color min-w-0">{{ config.notfound.title }}</div>
1926
+ <div class="col-span-12 mb-8 max-w-prose p-0 text-base font-medium leading-relaxed text-text-color min-w-0">{{ config.notfound.message }}</div>
1927
+
1928
+ @for (link of config.notfound.links; track link.url) {
1929
+ <a
1930
+ [routerLink]="link.url"
1931
+ class="col-span-12 flex w-full items-center border-0 border-b border-solid border-surface-border py-6 last:border-b-0 no-underline min-w-0"
1932
+ >
1933
+ <span
1934
+ class="flex h-14 w-14 shrink-0 items-center justify-center rounded-lg border-2 border-solid border-primary-color text-primary-color"
1935
+ >
1936
+ <i class="text-2xl" [class]="link.icon"></i>
1937
+ </span>
1938
+
1939
+ <span class="ml-6 flex min-w-0 flex-col">
1940
+ <span class="mb-0 block font-medium text-text-color lg:text-xl">{{ link.title }}</span>
1941
+ <span class="text-text-color-secondary lg:text-xl">{{ link.description }}</span>
1942
+ </span>
1943
+ </a>
1944
+ }
1945
+
1946
+ <div class="col-span-12 flex flex-wrap items-center justify-start min-w-0 gap-2">
1947
+ @for (button of config.notfound.buttons; track button.url) {
1948
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
1949
+ }
1950
+ </div>
1951
+ </div>
1952
+ </div>
1953
+
1954
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
1955
+ <img
1956
+ class="m-0 h-screen w-full object-cover p-0"
1957
+ [src]="config.notfound.backgroundPath"
1958
+ alt=""
1959
+ />
1960
+ </div>
1961
+ </div>
1962
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: SmzButtonComponent, selector: "button[smzButton], a[smzButton]", inputs: ["label", "icon", "iconPosition", "severity", "variant", "size", "text", "outlined", "rounded", "loading", "styleClass"] }] });
1963
+ }
1964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: NotfoundPageComponent, decorators: [{
1965
+ type: Component,
1966
+ args: [{
1967
+ selector: 'app-notfound',
1968
+ standalone: true,
1969
+ imports: [CommonModule, RouterModule, SmzButtonComponent, SmzRippleDirective],
1970
+ template: `
1971
+ <div class="relative m-0 flex flex-wrap h-screen w-screen items-center justify-center overflow-hidden p-0">
1972
+
1973
+ <div class="flex flex-wrap justify-center items-center w-full flex-none lg:w-6/12 h-full bg-surface-ground p-2">
1974
+ <div class="grid grid-cols-12 w-8/12 flex-none items-center gap-4 pb-2">
1975
+ <div class="col-span-12 p-0 text-[5em] font-bold leading-tight text-text-color min-w-0">{{ config.notfound.code }}</div>
1976
+ <div class="col-span-4 mb-[2em] w-[30%] rounded border-b-4 border-solid border-b-[#f44336] p-0 min-w-0"></div>
1977
+ <div class="col-span-12 mb-2 p-0 text-[1.4em] font-medium leading-relaxed text-text-color min-w-0">{{ config.notfound.title }}</div>
1978
+ <div class="col-span-12 mb-8 max-w-prose p-0 text-base font-medium leading-relaxed text-text-color min-w-0">{{ config.notfound.message }}</div>
1979
+
1980
+ @for (link of config.notfound.links; track link.url) {
1981
+ <a
1982
+ [routerLink]="link.url"
1983
+ class="col-span-12 flex w-full items-center border-0 border-b border-solid border-surface-border py-6 last:border-b-0 no-underline min-w-0"
1984
+ >
1985
+ <span
1986
+ class="flex h-14 w-14 shrink-0 items-center justify-center rounded-lg border-2 border-solid border-primary-color text-primary-color"
1987
+ >
1988
+ <i class="text-2xl" [class]="link.icon"></i>
1989
+ </span>
1990
+
1991
+ <span class="ml-6 flex min-w-0 flex-col">
1992
+ <span class="mb-0 block font-medium text-text-color lg:text-xl">{{ link.title }}</span>
1993
+ <span class="text-text-color-secondary lg:text-xl">{{ link.description }}</span>
1994
+ </span>
1995
+ </a>
1996
+ }
1997
+
1998
+ <div class="col-span-12 flex flex-wrap items-center justify-start min-w-0 gap-2">
1999
+ @for (button of config.notfound.buttons; track button.url) {
2000
+ <button smzButton [label]="button.label" [routerLink]="button.url" (click)="button.command()" class="mt-8" [severity]="button.severity"></button>
2001
+ }
2002
+ </div>
2003
+ </div>
2004
+ </div>
2005
+
2006
+ <div class="w-full flex-none m-0 p-0 lg:w-6/12">
2007
+ <img
2008
+ class="m-0 h-screen w-full object-cover p-0"
2009
+ [src]="config.notfound.backgroundPath"
2010
+ alt=""
2011
+ />
2012
+ </div>
2013
+ </div>
2014
+ `
2015
+ }]
2016
+ }] });
2017
+
2018
+ const ErrorsRoutes = [
2019
+ { path: 'access', data: { layout: { mode: 'none', contentPadding: '0em' } }, component: AccessPageComponent },
2020
+ { path: 'error', data: { layout: { mode: 'none', contentPadding: '0em' } }, component: ErrorPageComponent },
2021
+ { path: 'notfound', data: { layout: { mode: 'none', contentPadding: '0em' } }, component: NotfoundPageComponent }
2022
+ ];
2023
+
2024
+ /** Manifesto das entradas de `@ngx-smz/layout` na galeria do Design System: dado puro (o import acima é só de tipo). */
2025
+ const LAYOUT_GALLERY_MANIFEST = [
2026
+ { id: 'layout-shell', label: 'Layout: shell', group: 'layout', scenes: ['static-inactive', 'overlay', 'overlay-active', 'no-sidebar'] },
2027
+ { id: 'layout-topbar', label: 'Layout: topbar', group: 'layout' },
2028
+ { id: 'layout-menu', label: 'Layout: menu lateral', group: 'layout' },
2029
+ { id: 'layout-footer', label: 'Layout: rodapé', group: 'layout' },
2030
+ { id: 'layout-errors', label: 'Layout: páginas de erro', group: 'layout', scenes: ['error-buttons', 'access', 'notfound', 'notfound-links'] },
2031
+ ];
2032
+
2033
+ const LAYOUT_GALLERY_LOADERS = {
2034
+ 'layout-shell': () => import('./ngx-smz-layout-layout-shell.entry-CWxnFneU.mjs').then((m) => m.LayoutShellGalleryEntryComponent),
2035
+ 'layout-topbar': () => import('./ngx-smz-layout-layout-topbar.entry-CfSpHt5E.mjs').then((m) => m.LayoutTopbarGalleryEntryComponent),
2036
+ 'layout-menu': () => import('./ngx-smz-layout-layout-menu.entry-BAzglN_V.mjs').then((m) => m.LayoutMenuGalleryEntryComponent),
2037
+ 'layout-footer': () => import('./ngx-smz-layout-layout-footer.entry-CbNgTe0l.mjs').then((m) => m.LayoutFooterGalleryEntryComponent),
2038
+ 'layout-errors': () => import('./ngx-smz-layout-layout-errors.entry-Bpp0Hw8y.mjs').then((m) => m.LayoutErrorsGalleryEntryComponent),
2039
+ };
2040
+ /**
2041
+ * Entradas de `@ngx-smz/layout` para a galeria do Design System. Registro no app:
2042
+ * `{ provide: SMZ_GALLERY_ENTRIES, multi: true, useValue: SMZ_LAYOUT_GALLERY_ENTRIES }`.
2043
+ */
2044
+ const SMZ_LAYOUT_GALLERY_ENTRIES = LAYOUT_GALLERY_MANIFEST.map((entry) => ({
2045
+ ...entry,
2046
+ load: LAYOUT_GALLERY_LOADERS[entry.id],
2047
+ }));
2048
+
2049
+ /*
2050
+ * Public API Surface of ngx-smz-ui-layout
2051
+ */
2052
+
2053
+ /**
2054
+ * Generated bundle index. Do not edit.
2055
+ */
2056
+
2057
+ export { AccessPageComponent as A, ErrorPageComponent as E, LayoutService as L, NotfoundPageComponent as N, PageTitleService as P, SMZ_UI_LAYOUT_CONFIG as S, AppFooter as a, AppSidebar as b, AppTopbar as c, AppLayout as d, SmzUILayout as e, NavigationService as f, ErrorPagesConfigService as g, AppFloatingConfigurator as h, ErrorsRoutes as i, LAYOUT_GALLERY_MANIFEST as j, LoggingScope as k, LoggingService as l, SMZ_LAYOUT_GALLERY_ENTRIES as m, SMZ_LAYOUT_LOGGING_CONFIG as n, SmzLayoutLogging as o, SmzUILayoutProvisionBuilder as p, configureSmzUILayout as q, provideSmzLayoutLogging as r, provideSmzUILayout as s };
2058
+ //# sourceMappingURL=ngx-smz-layout-ngx-smz-layout-BEHAEWgI.mjs.map