@edsis/angular 22.0.44 → 22.0.46

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,898 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, effect, Service, InjectionToken, makeEnvironmentProviders, provideEnvironmentInitializer, Injector, linkedSignal, computed, afterNextRender, input, output, Component, ElementRef, signal, DestroyRef, Directive } from '@angular/core';
3
+ import { NavigationService } from '@edsis/navigation/service';
4
+ import { LayoutService, isUiLayoutType, isUiLayoutWidth, isUiLayoutSurface, isUiLayoutStyle } from '@edsis/theme/layout';
5
+ import { ThemeStyleService, ThemeModeService, ThemeColorService, ThemeBrandService, isThemeMode, isThemeColor, isThemeBrand, themeStylePresetEntry, DEFAULT_THEME_MODE, DEFAULT_THEME_COLOR, DEFAULT_THEME_BRAND, ThemeSpaceService, ThemeRadiusService, THEME_STYLES, THEME_MODES, THEME_COLORS, THEME_BRANDS, THEME_SPACES, THEME_RADII, isThemeStyle, isThemeSpace, isThemeRadius, isThemeStyleSettingLocked } from '@edsis/theme/styles';
6
+ import { LAYOUT_DEFAULT_TYPE, LAYOUT_DEFAULT_WIDTH, LAYOUT_DEFAULT_SURFACE, LAYOUT_DEFAULT_STYLE } from '@edsis/theme/layout/types';
7
+ import { DOCUMENT } from '@angular/common';
8
+ import { SheetComponent } from '@edsis/component/sheet';
9
+ import { LayoutService as LayoutService$1 } from '@edsis/theme/layout/services';
10
+ import { ButtonComponent } from '@edsis/component/button';
11
+ import { IconComponent } from '@edsis/component/icon';
12
+ import { PageComponent, PageContentComponent, PageFooterComponent, PageHeaderComponent } from '@edsis/theme/page';
13
+ import { ToggleGroupComponent, ToggleGroupItemDirective } from '@edsis/component/toggle-group';
14
+ import { TooltipDirective } from '@edsis/component/tooltip';
15
+
16
+ const PRIMARY_NAVIGATION_ID$2 = 'main';
17
+ const NAVIGATION_TYPES = ['sidebar', 'dockbar', 'navbar', 'flyout'];
18
+ const NAVIGATION_ORIENTATIONS = ['vertical', 'horizontal'];
19
+ const NAVIGATION_POSITIONS = ['left', 'right', 'top', 'bottom'];
20
+ const NAVIGATION_DOCKBAR_MODES = ['default', 'drawer', 'sticky'];
21
+ class ThemeStylePresetService {
22
+ config = inject(APP_PREFERENCES_CONFIG, { optional: true });
23
+ themeStyle = inject(ThemeStyleService);
24
+ themeMode = inject(ThemeModeService);
25
+ themeColor = inject(ThemeColorService);
26
+ themeBrand = inject(ThemeBrandService);
27
+ layout = inject(LayoutService);
28
+ navigation = inject(NavigationService);
29
+ constructor() {
30
+ let previousStyle = this.themeStyle.style();
31
+ this.enforceLockedValues(previousStyle);
32
+ effect(() => {
33
+ const style = this.themeStyle.style();
34
+ if (style === previousStyle)
35
+ return;
36
+ previousStyle = style;
37
+ this.applyPreset(style);
38
+ });
39
+ effect(() => this.enforceLockedValues(this.themeStyle.style()));
40
+ }
41
+ applyPreset(style) {
42
+ this.applyThemeValues(style);
43
+ this.applyLayoutValues(style);
44
+ this.applyNavigationValues(style);
45
+ }
46
+ applyThemeValues(style) {
47
+ const mode = this.valueFor(style, 'theme-mode', this.defaultMode());
48
+ if (isThemeMode(mode))
49
+ this.themeMode.setMode(mode);
50
+ const color = this.valueFor(style, 'theme-color', this.defaultColor());
51
+ if (isThemeColor(color))
52
+ this.themeColor.setColor(color);
53
+ const brand = this.valueFor(style, 'theme-brand', this.defaultBrand());
54
+ if (isThemeBrand(brand))
55
+ this.themeBrand.setBrand(brand);
56
+ }
57
+ applyLayoutValues(style) {
58
+ const type = this.valueFor(style, 'layout-type', this.defaultLayoutType());
59
+ if (isUiLayoutType(type))
60
+ this.layout.setType(type);
61
+ const width = this.valueFor(style, 'layout-width', this.defaultLayoutWidth());
62
+ if (isUiLayoutWidth(width))
63
+ this.layout.setWidth(width);
64
+ const surface = this.valueFor(style, 'layout-surface', this.defaultLayoutSurface());
65
+ if (isUiLayoutSurface(surface))
66
+ this.layout.setSurface(surface);
67
+ const appearance = this.valueFor(style, 'layout-appearance', this.defaultLayoutAppearance());
68
+ if (isUiLayoutStyle(appearance))
69
+ this.layout.setAppearance(appearance);
70
+ }
71
+ applyNavigationValues(style) {
72
+ const orientation = this.valueFor(style, 'nav-orientation', this.defaultNavigationOrientation());
73
+ const type = this.valueFor(style, 'nav-type', this.defaultNavigationType());
74
+ const position = this.valueFor(style, 'nav-position', this.defaultNavigationPosition());
75
+ const typeMode = this.valueFor(style, 'nav-type-mode', 'default');
76
+ this.navigation.update(PRIMARY_NAVIGATION_ID$2, {
77
+ orientation: isNavigationOrientation(orientation)
78
+ ? orientation
79
+ : this.defaultNavigationOrientation(),
80
+ type: isNavigationType(type) ? type : this.defaultNavigationType(),
81
+ position: isNavigationPosition(position) ? position : this.defaultNavigationPosition(),
82
+ collapsed: typeMode === 'collapsed'
83
+ ? true
84
+ : typeMode === 'expanded'
85
+ ? false
86
+ : this.defaultNavigationCollapsed(),
87
+ dockbarMode: isNavigationDockbarMode(typeMode)
88
+ ? typeMode
89
+ : this.defaultNavigationDockbarMode(),
90
+ });
91
+ }
92
+ enforceLockedValues(style) {
93
+ const appearance = themeStylePresetEntry(style, 'layout-appearance');
94
+ if (appearance.control === 'fix' &&
95
+ isUiLayoutStyle(appearance.value) &&
96
+ this.layout.appearance() !== appearance.value) {
97
+ this.layout.setAppearance(appearance.value);
98
+ }
99
+ }
100
+ valueFor(style, key, fallback) {
101
+ const value = themeStylePresetEntry(style, key).value;
102
+ return value === 'default' ? fallback : value;
103
+ }
104
+ defaultMode() {
105
+ return this.config?.defaults?.theme.mode ?? DEFAULT_THEME_MODE;
106
+ }
107
+ defaultColor() {
108
+ return this.config?.defaults?.theme.color ?? DEFAULT_THEME_COLOR;
109
+ }
110
+ defaultBrand() {
111
+ return this.config?.defaults?.theme.brand ?? DEFAULT_THEME_BRAND;
112
+ }
113
+ defaultLayoutType() {
114
+ return this.config?.defaults?.layout.type ?? LAYOUT_DEFAULT_TYPE;
115
+ }
116
+ defaultLayoutWidth() {
117
+ return this.config?.defaults?.layout.width ?? LAYOUT_DEFAULT_WIDTH;
118
+ }
119
+ defaultLayoutSurface() {
120
+ return this.config?.defaults?.layout.surface ?? LAYOUT_DEFAULT_SURFACE;
121
+ }
122
+ defaultLayoutAppearance() {
123
+ return this.config?.defaults?.layout.appearance ?? LAYOUT_DEFAULT_STYLE;
124
+ }
125
+ defaultNavigationOrientation() {
126
+ return this.config?.defaults?.navigation.orientation ?? 'vertical';
127
+ }
128
+ defaultNavigationType() {
129
+ return this.config?.defaults?.navigation.type ?? 'sidebar';
130
+ }
131
+ defaultNavigationPosition() {
132
+ return this.config?.defaults?.navigation.position ?? 'left';
133
+ }
134
+ defaultNavigationCollapsed() {
135
+ return this.config?.defaults?.navigation.collapsed ?? false;
136
+ }
137
+ defaultNavigationDockbarMode() {
138
+ return this.config?.defaults?.navigation.dockbarMode ?? 'default';
139
+ }
140
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ThemeStylePresetService, deps: [], target: i0.ɵɵFactoryTarget.Service });
141
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.6", ngImport: i0, type: ThemeStylePresetService });
142
+ }
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ThemeStylePresetService, decorators: [{
144
+ type: Service
145
+ }], ctorParameters: () => [] });
146
+ function isNavigationType(value) {
147
+ return NAVIGATION_TYPES.includes(value);
148
+ }
149
+ function isNavigationOrientation(value) {
150
+ return NAVIGATION_ORIENTATIONS.includes(value);
151
+ }
152
+ function isNavigationPosition(value) {
153
+ return NAVIGATION_POSITIONS.includes(value);
154
+ }
155
+ function isNavigationDockbarMode(value) {
156
+ return NAVIGATION_DOCKBAR_MODES.includes(value);
157
+ }
158
+
159
+ const APP_PREFERENCES_CONFIG = new InjectionToken('APP_PREFERENCES_CONFIG');
160
+ function provideAppPreferences(config = {}) {
161
+ return makeEnvironmentProviders([
162
+ { provide: APP_PREFERENCES_CONFIG, useValue: config },
163
+ provideEnvironmentInitializer(() => {
164
+ inject(ThemeStylePresetService);
165
+ }),
166
+ ]);
167
+ }
168
+
169
+ const NAVIGATION_FOCUS_SELECTOR = '[data-navigation-id="main"] a[href]:not([aria-disabled="true"]), [data-navigation-id="main"] button:not(:disabled):not([aria-disabled="true"])';
170
+ const CONTENT_FOCUS_SELECTOR = '[data-block-shell-content][tabindex="-1"]';
171
+ class AppPreferencesPanelService {
172
+ document = inject(DOCUMENT, { optional: true });
173
+ injector = inject(Injector);
174
+ layout = inject(LayoutService$1);
175
+ openedState = linkedSignal({ ...(ngDevMode ? { debugName: "openedState" } : /* istanbul ignore next */ {}), source: this.layout.type,
176
+ computation: () => false });
177
+ origin = null;
178
+ previouslyOpened = false;
179
+ finalizationPending = false;
180
+ supported = computed(() => this.layout.type() === 'vertical', /* @ts-ignore */
181
+ ...(ngDevMode ? [{ debugName: "supported" }] : /* istanbul ignore next */ []));
182
+ opened = this.openedState.asReadonly();
183
+ constructor() {
184
+ effect(() => {
185
+ const opened = this.openedState();
186
+ if (this.previouslyOpened && !opened) {
187
+ this.finalizeClose();
188
+ }
189
+ this.previouslyOpened = opened;
190
+ });
191
+ }
192
+ open(trigger) {
193
+ if (!this.supported()) {
194
+ return false;
195
+ }
196
+ if (!this.openedState() && !this.origin) {
197
+ this.origin = trigger ?? this.activeElement();
198
+ }
199
+ this.openedState.set(true);
200
+ return true;
201
+ }
202
+ close() {
203
+ this.openedState.set(false);
204
+ }
205
+ toggle(trigger) {
206
+ if (this.openedState()) {
207
+ this.close();
208
+ return false;
209
+ }
210
+ return this.open(trigger);
211
+ }
212
+ finalizeClose() {
213
+ if (this.finalizationPending) {
214
+ return;
215
+ }
216
+ this.finalizationPending = true;
217
+ afterNextRender(() => {
218
+ this.finalizationPending = false;
219
+ this.restoreFocus();
220
+ this.origin = null;
221
+ }, { injector: this.injector });
222
+ }
223
+ restoreFocus() {
224
+ const document = this.document;
225
+ if (!document) {
226
+ return;
227
+ }
228
+ const candidates = [
229
+ this.origin,
230
+ ...Array.from(document.querySelectorAll(NAVIGATION_FOCUS_SELECTOR)),
231
+ document.querySelector(CONTENT_FOCUS_SELECTOR),
232
+ ];
233
+ for (const candidate of candidates) {
234
+ if (!this.canFocus(candidate)) {
235
+ continue;
236
+ }
237
+ candidate.focus({ preventScroll: true });
238
+ if (document.activeElement === candidate) {
239
+ return;
240
+ }
241
+ }
242
+ }
243
+ activeElement() {
244
+ const activeElement = this.document?.activeElement;
245
+ return activeElement instanceof HTMLElement ? activeElement : null;
246
+ }
247
+ canFocus(element) {
248
+ if (!element?.isConnected || element.matches(':disabled, [aria-disabled="true"]')) {
249
+ return false;
250
+ }
251
+ if (element.closest('[hidden], [inert], [aria-hidden="true"]')) {
252
+ return false;
253
+ }
254
+ const view = this.document?.defaultView;
255
+ return !view || element.getClientRects().length > 0;
256
+ }
257
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService, deps: [], target: i0.ɵɵFactoryTarget.Service });
258
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService });
259
+ }
260
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService, decorators: [{
261
+ type: Service
262
+ }], ctorParameters: () => [] });
263
+
264
+ class AppPreferenceSettingGroupComponent {
265
+ title = input.required(/* @ts-ignore */
266
+ ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
267
+ description = input(null, /* @ts-ignore */
268
+ ...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
269
+ activeLabel = input.required(/* @ts-ignore */
270
+ ...(ngDevMode ? [{ debugName: "activeLabel" }] : /* istanbul ignore next */ []));
271
+ options = input.required(/* @ts-ignore */
272
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
273
+ selected = input.required(/* @ts-ignore */
274
+ ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
275
+ headingId = input.required(/* @ts-ignore */
276
+ ...(ngDevMode ? [{ debugName: "headingId" }] : /* istanbul ignore next */ []));
277
+ locked = input(false, /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []));
279
+ optionSelected = output();
280
+ onValueChange(value) {
281
+ if (value !== null && !this.locked()) {
282
+ this.optionSelected.emit(value);
283
+ }
284
+ }
285
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferenceSettingGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
286
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferenceSettingGroupComponent, isStandalone: true, selector: "app-preference-setting-group", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, activeLabel: { classPropertyName: "activeLabel", publicName: "activeLabel", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: true, transformFunction: null }, headingId: { classPropertyName: "headingId", publicName: "headingId", isSignal: true, isRequired: true, transformFunction: null }, locked: { classPropertyName: "locked", publicName: "locked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { optionSelected: "optionSelected" }, ngImport: i0, template: `
287
+ <section class="border-b border-border/65 px-3 py-2.5 last:border-b-0">
288
+ <div class="flex items-start justify-between gap-3">
289
+ <div class="min-w-0">
290
+ <h3 [id]="headingId()" class="text-sm font-medium text-foreground">{{ title() }}</h3>
291
+ @if (description()) {
292
+ <p class="mt-1 text-xs leading-4 text-muted-foreground">{{ description() }}</p>
293
+ }
294
+ </div>
295
+
296
+ <span
297
+ class="flex shrink-0 items-center gap-1 font-mono text-xs text-muted-foreground"
298
+ [attr.aria-label]="locked() ? activeLabel() + ', dikunci oleh gaya tema' : null"
299
+ >
300
+ {{ activeLabel() }}
301
+ @if (locked()) {
302
+ <Icon name="lock" [size]="14" aria-hidden="true" />
303
+ }
304
+ </span>
305
+ </div>
306
+
307
+ <ToggleGroup
308
+ type="single"
309
+ variant="segmented"
310
+ [value]="selected()"
311
+ [disabled]="locked()"
312
+ [attr.aria-labelledby]="headingId()"
313
+ class="mt-2 grid w-full grid-flow-col auto-cols-fr gap-0"
314
+ (valueChange)="onValueChange($event)"
315
+ >
316
+ @for (option of options(); track option.value) {
317
+ <button
318
+ ToggleGroupItem
319
+ [value]="option.value"
320
+ [Tooltip]="option.label"
321
+ [attr.aria-label]="option.label"
322
+ [attr.title]="option.label"
323
+ class="min-h-8 min-w-0 px-1.5 py-1"
324
+ >
325
+ <Icon [name]="option.icon" [size]="16" />
326
+ </button>
327
+ }
328
+ </ToggleGroup>
329
+ </section>
330
+ `, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "Icon", inputs: ["name", "class", "size", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: ToggleGroupComponent, selector: "ToggleGroup", inputs: ["type", "value", "values", "orientation", "variant", "size", "spacing", "loop", "disabled", "dir", "class"], outputs: ["valueChange", "valuesChange"] }, { kind: "directive", type: ToggleGroupItemDirective, selector: "button[ToggleGroupItem]", inputs: ["value", "disabled", "class"] }, { kind: "directive", type: TooltipDirective, selector: "[Tooltip]", inputs: ["Tooltip", "TooltipPosition", "TooltipDisabled", "TooltipShowDelay", "TooltipHideDelay"], exportAs: ["Tooltip"] }] });
331
+ }
332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferenceSettingGroupComponent, decorators: [{
333
+ type: Component,
334
+ args: [{
335
+ selector: 'app-preference-setting-group',
336
+ imports: [IconComponent, ToggleGroupComponent, ToggleGroupItemDirective, TooltipDirective],
337
+ template: `
338
+ <section class="border-b border-border/65 px-3 py-2.5 last:border-b-0">
339
+ <div class="flex items-start justify-between gap-3">
340
+ <div class="min-w-0">
341
+ <h3 [id]="headingId()" class="text-sm font-medium text-foreground">{{ title() }}</h3>
342
+ @if (description()) {
343
+ <p class="mt-1 text-xs leading-4 text-muted-foreground">{{ description() }}</p>
344
+ }
345
+ </div>
346
+
347
+ <span
348
+ class="flex shrink-0 items-center gap-1 font-mono text-xs text-muted-foreground"
349
+ [attr.aria-label]="locked() ? activeLabel() + ', dikunci oleh gaya tema' : null"
350
+ >
351
+ {{ activeLabel() }}
352
+ @if (locked()) {
353
+ <Icon name="lock" [size]="14" aria-hidden="true" />
354
+ }
355
+ </span>
356
+ </div>
357
+
358
+ <ToggleGroup
359
+ type="single"
360
+ variant="segmented"
361
+ [value]="selected()"
362
+ [disabled]="locked()"
363
+ [attr.aria-labelledby]="headingId()"
364
+ class="mt-2 grid w-full grid-flow-col auto-cols-fr gap-0"
365
+ (valueChange)="onValueChange($event)"
366
+ >
367
+ @for (option of options(); track option.value) {
368
+ <button
369
+ ToggleGroupItem
370
+ [value]="option.value"
371
+ [Tooltip]="option.label"
372
+ [attr.aria-label]="option.label"
373
+ [attr.title]="option.label"
374
+ class="min-h-8 min-w-0 px-1.5 py-1"
375
+ >
376
+ <Icon [name]="option.icon" [size]="16" />
377
+ </button>
378
+ }
379
+ </ToggleGroup>
380
+ </section>
381
+ `,
382
+ }]
383
+ }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], activeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeLabel", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: true }] }], headingId: [{ type: i0.Input, args: [{ isSignal: true, alias: "headingId", required: true }] }], locked: [{ type: i0.Input, args: [{ isSignal: true, alias: "locked", required: false }] }], optionSelected: [{ type: i0.Output, args: ["optionSelected"] }] } });
384
+
385
+ const PRIMARY_NAVIGATION_ID$1 = 'main';
386
+ const VERTICAL_NAVIGATION_TYPES = ['sidebar', 'dockbar'];
387
+ const HORIZONTAL_NAVIGATION_TYPES = ['navbar', 'flyout'];
388
+ const NAVIGATION_LAYOUT_TYPES = ['vertical', 'horizontal'];
389
+ const DOCKBAR_MODES = ['default', 'sticky', 'drawer'];
390
+ const THEME_STYLE_OPTIONS = {
391
+ dinamic: { label: 'Dinamis', icon: 'auto_awesome' },
392
+ rail: { label: 'Rail', icon: 'view_sidebar' },
393
+ ala: { label: 'Ala', icon: 'palette' },
394
+ aye: { label: 'Aye', icon: 'visibility' },
395
+ };
396
+ const THEME_MODE_OPTIONS = {
397
+ light: { label: 'Terang', icon: 'light_mode' },
398
+ dark: { label: 'Gelap', icon: 'dark_mode' },
399
+ system: { label: 'Sistem', icon: 'contrast' },
400
+ };
401
+ const THEME_COLOR_OPTIONS = {
402
+ default: { label: 'Default', icon: 'format_color_fill' },
403
+ };
404
+ const THEME_BRAND_OPTIONS = {
405
+ default: { label: 'Default', icon: 'branding_watermark' },
406
+ };
407
+ const THEME_SPACE_OPTIONS = {
408
+ normal: { label: 'Normal', icon: 'density_large' },
409
+ compact: { label: 'Ringkas', icon: 'density_small' },
410
+ };
411
+ const THEME_RADIUS_OPTIONS = {
412
+ none: { label: 'Tanpa radius', icon: 'crop_square' },
413
+ small: { label: 'Kecil', icon: 'rounded_corner' },
414
+ medium: { label: 'Sedang', icon: 'rounded_corner' },
415
+ large: { label: 'Besar', icon: 'rounded_corner' },
416
+ };
417
+ const LAYOUT_APPEARANCE_OPTIONS = {
418
+ base: { label: 'Dasar', icon: 'crop_square' },
419
+ 'border-rail': { label: 'Border rail', icon: 'border_outer' },
420
+ ala: { label: 'Ala', icon: 'space_dashboard' },
421
+ };
422
+ const LAYOUT_SURFACE_OPTIONS = {
423
+ flat: { label: 'Datar', icon: 'crop_16_9' },
424
+ grid: { label: 'Grid', icon: 'grid_4x4' },
425
+ };
426
+ const LAYOUT_WIDTH_OPTIONS = {
427
+ full: { label: 'Penuh', icon: 'width_full' },
428
+ wide: { label: 'Lebar', icon: 'width_wide' },
429
+ container: { label: 'Container', icon: 'width_normal' },
430
+ fluid: { label: 'Fluid', icon: 'fit_screen' },
431
+ };
432
+ const LAYOUT_TYPE_OPTIONS = {
433
+ vertical: { label: 'Vertikal', icon: 'view_sidebar' },
434
+ horizontal: { label: 'Horizontal', icon: 'view_stream' },
435
+ };
436
+ const NAVIGATION_TYPE_OPTIONS = {
437
+ sidebar: { label: 'Sidebar', icon: 'left_panel_open' },
438
+ dockbar: { label: 'Dockbar', icon: 'dock_to_left' },
439
+ navbar: { label: 'Navbar', icon: 'top_panel_open' },
440
+ flyout: { label: 'Flyout', icon: 'menu_open' },
441
+ };
442
+ const NAVIGATION_POSITION_OPTIONS = {
443
+ left: { label: 'Kiri', icon: 'align_horizontal_left' },
444
+ right: { label: 'Kanan', icon: 'align_horizontal_right' },
445
+ top: { label: 'Atas', icon: 'vertical_align_top' },
446
+ bottom: { label: 'Bawah', icon: 'vertical_align_bottom' },
447
+ };
448
+ const DOCKBAR_MODE_OPTIONS = {
449
+ default: { label: 'Default', icon: 'vertical_align_center' },
450
+ sticky: { label: 'Melekat', icon: 'push_pin' },
451
+ drawer: { label: 'Drawer', icon: 'left_panel_open' },
452
+ };
453
+ function toOptions(values, options) {
454
+ return values.map((value) => ({
455
+ value,
456
+ label: options[value]?.label ?? value,
457
+ icon: options[value]?.icon ?? 'tune',
458
+ }));
459
+ }
460
+ class AppPreferencesSurfaceComponent {
461
+ config = inject(APP_PREFERENCES_CONFIG, { optional: true });
462
+ themeMode = inject(ThemeModeService);
463
+ themeSpace = inject(ThemeSpaceService);
464
+ themeRadius = inject(ThemeRadiusService);
465
+ themeStyle = inject(ThemeStyleService);
466
+ themeColor = inject(ThemeColorService);
467
+ themeBrand = inject(ThemeBrandService);
468
+ layout = inject(LayoutService);
469
+ navigation = inject(NavigationService);
470
+ host = inject((ElementRef));
471
+ closeRequested = output();
472
+ announcement = signal('', /* @ts-ignore */
473
+ ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
474
+ defaults = this.config?.defaults ?? null;
475
+ hasDefaults = computed(() => this.defaults !== null, /* @ts-ignore */
476
+ ...(ngDevMode ? [{ debugName: "hasDefaults" }] : /* istanbul ignore next */ []));
477
+ mode = this.themeMode.mode;
478
+ space = this.themeSpace.space;
479
+ radius = this.themeRadius.radius;
480
+ style = this.themeStyle.style;
481
+ color = this.themeColor.color;
482
+ brand = this.themeBrand.brand;
483
+ appearance = this.layout.appearance;
484
+ surface = this.layout.surface;
485
+ width = this.layout.width;
486
+ layoutType = this.layout.type;
487
+ navigationState = computed(() => this.navigation.state(PRIMARY_NAVIGATION_ID$1)() ?? {
488
+ id: PRIMARY_NAVIGATION_ID$1,
489
+ orientation: 'vertical',
490
+ type: 'sidebar',
491
+ position: 'left',
492
+ collapsed: false,
493
+ dockbarMode: 'default',
494
+ }, /* @ts-ignore */
495
+ ...(ngDevMode ? [{ debugName: "navigationState" }] : /* istanbul ignore next */ []));
496
+ styleOptions = toOptions(THEME_STYLES, THEME_STYLE_OPTIONS);
497
+ modeOptions = toOptions(THEME_MODES, THEME_MODE_OPTIONS);
498
+ colorOptions = toOptions(THEME_COLORS, THEME_COLOR_OPTIONS);
499
+ brandOptions = toOptions(THEME_BRANDS, THEME_BRAND_OPTIONS);
500
+ spaceOptions = toOptions(THEME_SPACES, THEME_SPACE_OPTIONS);
501
+ radiusOptions = toOptions(THEME_RADII, THEME_RADIUS_OPTIONS);
502
+ appearanceOptions = toOptions(['base', 'border-rail', 'ala'], LAYOUT_APPEARANCE_OPTIONS);
503
+ surfaceOptions = toOptions(['flat', 'grid'], LAYOUT_SURFACE_OPTIONS);
504
+ widthOptions = toOptions(['full', 'wide', 'container', 'fluid'], LAYOUT_WIDTH_OPTIONS);
505
+ layoutTypeOptions = toOptions(NAVIGATION_LAYOUT_TYPES, LAYOUT_TYPE_OPTIONS);
506
+ navigationTypeOptions = computed(() => toOptions(this.navigationState().orientation === 'vertical'
507
+ ? VERTICAL_NAVIGATION_TYPES
508
+ : HORIZONTAL_NAVIGATION_TYPES, NAVIGATION_TYPE_OPTIONS), /* @ts-ignore */
509
+ ...(ngDevMode ? [{ debugName: "navigationTypeOptions" }] : /* istanbul ignore next */ []));
510
+ navigationPositionOptions = computed(() => toOptions(this.navigationState().orientation === 'vertical' ? ['left', 'right'] : ['top', 'bottom'], NAVIGATION_POSITION_OPTIONS), /* @ts-ignore */
511
+ ...(ngDevMode ? [{ debugName: "navigationPositionOptions" }] : /* istanbul ignore next */ []));
512
+ navigationModeOptions = computed(() => this.navigationState().orientation === 'horizontal'
513
+ ? []
514
+ : this.navigationState().type === 'sidebar'
515
+ ? [
516
+ { value: 'expanded', label: 'Diperluas', icon: 'unfold_more' },
517
+ { value: 'collapsed', label: 'Dipadatkan', icon: 'compress' },
518
+ ]
519
+ : toOptions(DOCKBAR_MODES, DOCKBAR_MODE_OPTIONS), /* @ts-ignore */
520
+ ...(ngDevMode ? [{ debugName: "navigationModeOptions" }] : /* istanbul ignore next */ []));
521
+ navigationMode = computed(() => {
522
+ const state = this.navigationState();
523
+ if (state.orientation === 'horizontal')
524
+ return 'default';
525
+ return state.type === 'sidebar'
526
+ ? state.collapsed
527
+ ? 'collapsed'
528
+ : 'expanded'
529
+ : state.dockbarMode;
530
+ }, /* @ts-ignore */
531
+ ...(ngDevMode ? [{ debugName: "navigationMode" }] : /* istanbul ignore next */ []));
532
+ navigationModeLabel = computed(() => {
533
+ const state = this.navigationState();
534
+ if (state.orientation === 'horizontal')
535
+ return 'Default';
536
+ return state.type === 'sidebar'
537
+ ? state.collapsed
538
+ ? 'Dipadatkan'
539
+ : 'Diperluas'
540
+ : DOCKBAR_MODE_OPTIONS[state.dockbarMode].label;
541
+ }, /* @ts-ignore */
542
+ ...(ngDevMode ? [{ debugName: "navigationModeLabel" }] : /* istanbul ignore next */ []));
543
+ navigationTypeLabel = computed(() => NAVIGATION_TYPE_OPTIONS[this.navigationState().type].label, /* @ts-ignore */
544
+ ...(ngDevMode ? [{ debugName: "navigationTypeLabel" }] : /* istanbul ignore next */ []));
545
+ navigationPositionLabel = computed(() => NAVIGATION_POSITION_OPTIONS[this.navigationState().position].label, /* @ts-ignore */
546
+ ...(ngDevMode ? [{ debugName: "navigationPositionLabel" }] : /* istanbul ignore next */ []));
547
+ constructor() {
548
+ const host = this.host.nativeElement;
549
+ afterNextRender(() => {
550
+ const closeButton = host.querySelector('[data-app-preferences-close]');
551
+ closeButton?.focus({ preventScroll: true });
552
+ });
553
+ }
554
+ selectStyle(value) {
555
+ if (isThemeStyle(value))
556
+ this.themeStyle.setStyle(value);
557
+ }
558
+ selectMode(value) {
559
+ if (!this.isLocked('theme-mode') && isThemeMode(value))
560
+ this.themeMode.setMode(value);
561
+ }
562
+ selectColor(value) {
563
+ if (!this.isLocked('theme-color') && isThemeColor(value))
564
+ this.themeColor.setColor(value);
565
+ }
566
+ selectBrand(value) {
567
+ if (!this.isLocked('theme-brand') && isThemeBrand(value))
568
+ this.themeBrand.setBrand(value);
569
+ }
570
+ selectSpace(value) {
571
+ if (isThemeSpace(value))
572
+ this.themeSpace.setSpace(value);
573
+ }
574
+ selectRadius(value) {
575
+ if (isThemeRadius(value))
576
+ this.themeRadius.setRadius(value);
577
+ }
578
+ selectAppearance(value) {
579
+ if (!this.isLocked('layout-appearance') && isUiLayoutStyle(value)) {
580
+ this.layout.setAppearance(value);
581
+ }
582
+ }
583
+ selectSurface(value) {
584
+ if (!this.isLocked('layout-surface') && isUiLayoutSurface(value)) {
585
+ this.layout.setSurface(value);
586
+ }
587
+ }
588
+ selectWidth(value) {
589
+ if (!this.isLocked('layout-width') && isUiLayoutWidth(value))
590
+ this.layout.setWidth(value);
591
+ }
592
+ selectLayoutType(value) {
593
+ if (this.isLayoutTypeLocked() ||
594
+ !isUiLayoutType(value) ||
595
+ !NAVIGATION_LAYOUT_TYPES.includes(value)) {
596
+ return;
597
+ }
598
+ const orientation = value;
599
+ const state = this.navigationState();
600
+ const type = isNavigationTypeForOrientation(state.type, orientation)
601
+ ? state.type
602
+ : orientation === 'vertical'
603
+ ? 'sidebar'
604
+ : 'navbar';
605
+ const position = isNavigationPositionForOrientation(state.position, orientation)
606
+ ? state.position
607
+ : orientation === 'vertical'
608
+ ? 'left'
609
+ : 'top';
610
+ this.layout.setType(value);
611
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { orientation, type, position });
612
+ }
613
+ selectNavigationType(value) {
614
+ const state = this.navigationState();
615
+ if (!this.isLocked('nav-type') && isNavigationTypeForOrientation(value, state.orientation)) {
616
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { type: value });
617
+ }
618
+ }
619
+ selectNavigationMode(value) {
620
+ const state = this.navigationState();
621
+ if (this.isLocked('nav-type-mode'))
622
+ return;
623
+ if (state.type === 'sidebar' && (value === 'expanded' || value === 'collapsed')) {
624
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { collapsed: value === 'collapsed' });
625
+ }
626
+ if (state.type === 'dockbar' && DOCKBAR_MODES.includes(value)) {
627
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, {
628
+ dockbarMode: value,
629
+ });
630
+ }
631
+ }
632
+ selectNavigationPosition(value) {
633
+ const state = this.navigationState();
634
+ if (!this.isLocked('nav-position') &&
635
+ isNavigationPositionForOrientation(value, state.orientation)) {
636
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { position: value });
637
+ }
638
+ }
639
+ resetToDefaults() {
640
+ const defaults = this.defaults;
641
+ if (!defaults)
642
+ return;
643
+ let changed = false;
644
+ if (this.mode() !== defaults.theme.mode) {
645
+ this.themeMode.setMode(defaults.theme.mode);
646
+ changed = true;
647
+ }
648
+ if (this.color() !== defaults.theme.color) {
649
+ this.themeColor.setColor(defaults.theme.color);
650
+ changed = true;
651
+ }
652
+ if (this.brand() !== defaults.theme.brand) {
653
+ this.themeBrand.setBrand(defaults.theme.brand);
654
+ changed = true;
655
+ }
656
+ if (this.space() !== defaults.theme.space) {
657
+ this.themeSpace.setSpace(defaults.theme.space);
658
+ changed = true;
659
+ }
660
+ if (this.radius() !== defaults.theme.radius) {
661
+ this.themeRadius.setRadius(defaults.theme.radius);
662
+ changed = true;
663
+ }
664
+ if (this.style() !== defaults.theme.style) {
665
+ this.themeStyle.setStyle(defaults.theme.style);
666
+ changed = true;
667
+ }
668
+ if (!this.isLocked('layout-appearance') && this.appearance() !== defaults.layout.appearance) {
669
+ this.layout.setAppearance(defaults.layout.appearance);
670
+ changed = true;
671
+ }
672
+ if (this.surface() !== defaults.layout.surface) {
673
+ this.layout.setSurface(defaults.layout.surface);
674
+ changed = true;
675
+ }
676
+ if (this.width() !== defaults.layout.width) {
677
+ this.layout.setWidth(defaults.layout.width);
678
+ changed = true;
679
+ }
680
+ if (!this.isLayoutTypeLocked() && this.layoutType() !== defaults.layout.type) {
681
+ this.selectLayoutType(defaults.layout.type);
682
+ changed = true;
683
+ }
684
+ const navigation = this.navigationState();
685
+ const nextNavigation = {
686
+ orientation: this.isLocked('nav-orientation')
687
+ ? navigation.orientation
688
+ : defaults.navigation.orientation,
689
+ type: this.isLocked('nav-type') ? navigation.type : defaults.navigation.type,
690
+ position: this.isLocked('nav-position') ? navigation.position : defaults.navigation.position,
691
+ collapsed: this.isLocked('nav-type-mode')
692
+ ? navigation.collapsed
693
+ : defaults.navigation.collapsed,
694
+ dockbarMode: this.isLocked('nav-type-mode')
695
+ ? navigation.dockbarMode
696
+ : defaults.navigation.dockbarMode,
697
+ };
698
+ if (navigation.orientation !== nextNavigation.orientation ||
699
+ navigation.type !== nextNavigation.type ||
700
+ navigation.position !== nextNavigation.position ||
701
+ navigation.collapsed !== nextNavigation.collapsed ||
702
+ navigation.dockbarMode !== nextNavigation.dockbarMode) {
703
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, nextNavigation);
704
+ changed = true;
705
+ }
706
+ this.announce(changed ? 'Preferensi dikembalikan ke default.' : 'Preferensi sudah menggunakan default.');
707
+ }
708
+ announce(message) {
709
+ this.announcement.set('');
710
+ queueMicrotask(() => this.announcement.set(message));
711
+ }
712
+ isLocked(key) {
713
+ return isThemeStyleSettingLocked(this.style(), key);
714
+ }
715
+ isLayoutTypeLocked() {
716
+ return this.isLocked('layout-type') || this.isLocked('nav-orientation');
717
+ }
718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesSurfaceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
719
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferencesSurfaceComponent, isStandalone: true, selector: "app-preferences-surface", outputs: { closeRequested: "closeRequested" }, host: { classAttribute: "block h-full min-h-0 w-full" }, ngImport: i0, template: "<Page variant=\"stacked\" height=\"fix\" scroll=\"content\" class=\"bg-background\">\n <PageHeader class=\"h-11 px-3 py-0\">\n <div class=\"flex h-full items-center justify-between gap-3\">\n <h2\n id=\"app-preferences-title\"\n class=\"min-w-0 truncate text-base font-semibold text-foreground\"\n >\n Preferensi aplikasi\n </h2>\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n size=\"icon\"\n class=\"h-11 w-11 shrink-0\"\n data-app-preferences-close\n aria-label=\"Tutup preferensi aplikasi\"\n (click)=\"closeRequested.emit()\"\n >\n <Icon name=\"close\" [size]=\"20\" />\n </button>\n </div>\n </PageHeader>\n\n <PageContent class=\"overscroll-contain bg-muted/20\">\n <div class=\"space-y-5 p-3\">\n <p class=\"text-xs leading-4 text-muted-foreground\">\n Sesuaikan tampilan dan navigasi aplikasi.\n </p>\n\n <section aria-labelledby=\"app-preferences-theme\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-theme\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Tema\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-style\"\n title=\"Gaya tema\"\n [activeLabel]=\"styleOptions.find((option) => option.value === style())?.label ?? style()\"\n [options]=\"styleOptions\"\n [selected]=\"style()\"\n (optionSelected)=\"selectStyle($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-mode\"\n title=\"Mode warna\"\n description=\"Sistem mengikuti preferensi perangkat.\"\n [activeLabel]=\"modeOptions.find((option) => option.value === mode())?.label ?? mode()\"\n [options]=\"modeOptions\"\n [selected]=\"mode()\"\n [locked]=\"isLocked('theme-mode')\"\n (optionSelected)=\"selectMode($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-color\"\n title=\"Warna tema\"\n [activeLabel]=\"colorOptions.find((option) => option.value === color())?.label ?? color()\"\n [options]=\"colorOptions\"\n [selected]=\"color()\"\n [locked]=\"isLocked('theme-color')\"\n (optionSelected)=\"selectColor($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-brand\"\n title=\"Brand\"\n [activeLabel]=\"brandOptions.find((option) => option.value === brand())?.label ?? brand()\"\n [options]=\"brandOptions\"\n [selected]=\"brand()\"\n [locked]=\"isLocked('theme-brand')\"\n (optionSelected)=\"selectBrand($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-space\"\n title=\"Kerapatan\"\n [activeLabel]=\"spaceOptions.find((option) => option.value === space())?.label ?? space()\"\n [options]=\"spaceOptions\"\n [selected]=\"space()\"\n (optionSelected)=\"selectSpace($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-radius\"\n title=\"Sudut\"\n [activeLabel]=\"\n radiusOptions.find((option) => option.value === radius())?.label ?? radius()\n \"\n [options]=\"radiusOptions\"\n [selected]=\"radius()\"\n (optionSelected)=\"selectRadius($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-layout\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-layout\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Layout\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-appearance\"\n title=\"Bingkai\"\n [activeLabel]=\"\n appearanceOptions.find((option) => option.value === appearance())?.label ?? appearance()\n \"\n [options]=\"appearanceOptions\"\n [selected]=\"appearance()\"\n [locked]=\"isLocked('layout-appearance')\"\n (optionSelected)=\"selectAppearance($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-surface\"\n title=\"Latar\"\n [activeLabel]=\"\n surfaceOptions.find((option) => option.value === surface())?.label ?? surface()\n \"\n [options]=\"surfaceOptions\"\n [selected]=\"surface()\"\n [locked]=\"isLocked('layout-surface')\"\n (optionSelected)=\"selectSurface($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-layout-type\"\n title=\"Tipe layout\"\n [activeLabel]=\"\n layoutTypeOptions.find((option) => option.value === layoutType())?.label ?? layoutType()\n \"\n [options]=\"layoutTypeOptions\"\n [selected]=\"layoutType()\"\n [locked]=\"isLayoutTypeLocked()\"\n (optionSelected)=\"selectLayoutType($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-width\"\n title=\"Lebar konten\"\n [activeLabel]=\"widthOptions.find((option) => option.value === width())?.label ?? width()\"\n [options]=\"widthOptions\"\n [selected]=\"width()\"\n [locked]=\"isLocked('layout-width')\"\n (optionSelected)=\"selectWidth($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-navigation\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-navigation\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Navigasi\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-type\"\n title=\"Tipe navigation\"\n [activeLabel]=\"navigationTypeLabel()\"\n [options]=\"navigationTypeOptions()\"\n [selected]=\"navigationState().type\"\n [locked]=\"isLocked('nav-type')\"\n (optionSelected)=\"selectNavigationType($event)\"\n />\n @if (navigationState().orientation === 'vertical') {\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-mode\"\n title=\"Mode navigation\"\n [activeLabel]=\"navigationModeLabel()\"\n [options]=\"navigationModeOptions()\"\n [selected]=\"navigationMode()\"\n [locked]=\"isLocked('nav-type-mode')\"\n (optionSelected)=\"selectNavigationMode($event)\"\n />\n }\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-position\"\n title=\"Posisi navigation\"\n [activeLabel]=\"navigationPositionLabel()\"\n [options]=\"navigationPositionOptions()\"\n [selected]=\"navigationState().position\"\n [locked]=\"isLocked('nav-position')\"\n (optionSelected)=\"selectNavigationPosition($event)\"\n />\n </section>\n </div>\n </PageContent>\n\n @if (hasDefaults()) {\n <PageFooter class=\"px-3 py-0\">\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n class=\"h-full w-full justify-start\"\n (click)=\"resetToDefaults()\"\n >\n <Icon name=\"restart_alt\" [size]=\"18\" />\n Kembalikan default\n </button>\n </PageFooter>\n }\n\n <p class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</p>\n</Page>\n", dependencies: [{ kind: "component", type: AppPreferenceSettingGroupComponent, selector: "app-preference-setting-group", inputs: ["title", "description", "activeLabel", "options", "selected", "headingId", "locked"], outputs: ["optionSelected"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: IconComponent, selector: "Icon", inputs: ["name", "class", "size", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: PageComponent, selector: "Page", inputs: ["variant", "height", "scroll", "position", "sideMode", "sideOpen", "sideWidth", "class"], outputs: ["sideOpenChange"] }, { kind: "component", type: PageContentComponent, selector: "PageContent", inputs: ["class"] }, { kind: "component", type: PageFooterComponent, selector: "PageFooter", inputs: ["class"] }, { kind: "component", type: PageHeaderComponent, selector: "PageHeader", inputs: ["class"] }] });
720
+ }
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesSurfaceComponent, decorators: [{
722
+ type: Component,
723
+ args: [{ selector: 'app-preferences-surface', imports: [
724
+ AppPreferenceSettingGroupComponent,
725
+ ButtonComponent,
726
+ IconComponent,
727
+ PageComponent,
728
+ PageContentComponent,
729
+ PageFooterComponent,
730
+ PageHeaderComponent,
731
+ ], host: {
732
+ class: 'block h-full min-h-0 w-full',
733
+ }, template: "<Page variant=\"stacked\" height=\"fix\" scroll=\"content\" class=\"bg-background\">\n <PageHeader class=\"h-11 px-3 py-0\">\n <div class=\"flex h-full items-center justify-between gap-3\">\n <h2\n id=\"app-preferences-title\"\n class=\"min-w-0 truncate text-base font-semibold text-foreground\"\n >\n Preferensi aplikasi\n </h2>\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n size=\"icon\"\n class=\"h-11 w-11 shrink-0\"\n data-app-preferences-close\n aria-label=\"Tutup preferensi aplikasi\"\n (click)=\"closeRequested.emit()\"\n >\n <Icon name=\"close\" [size]=\"20\" />\n </button>\n </div>\n </PageHeader>\n\n <PageContent class=\"overscroll-contain bg-muted/20\">\n <div class=\"space-y-5 p-3\">\n <p class=\"text-xs leading-4 text-muted-foreground\">\n Sesuaikan tampilan dan navigasi aplikasi.\n </p>\n\n <section aria-labelledby=\"app-preferences-theme\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-theme\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Tema\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-style\"\n title=\"Gaya tema\"\n [activeLabel]=\"styleOptions.find((option) => option.value === style())?.label ?? style()\"\n [options]=\"styleOptions\"\n [selected]=\"style()\"\n (optionSelected)=\"selectStyle($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-mode\"\n title=\"Mode warna\"\n description=\"Sistem mengikuti preferensi perangkat.\"\n [activeLabel]=\"modeOptions.find((option) => option.value === mode())?.label ?? mode()\"\n [options]=\"modeOptions\"\n [selected]=\"mode()\"\n [locked]=\"isLocked('theme-mode')\"\n (optionSelected)=\"selectMode($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-color\"\n title=\"Warna tema\"\n [activeLabel]=\"colorOptions.find((option) => option.value === color())?.label ?? color()\"\n [options]=\"colorOptions\"\n [selected]=\"color()\"\n [locked]=\"isLocked('theme-color')\"\n (optionSelected)=\"selectColor($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-brand\"\n title=\"Brand\"\n [activeLabel]=\"brandOptions.find((option) => option.value === brand())?.label ?? brand()\"\n [options]=\"brandOptions\"\n [selected]=\"brand()\"\n [locked]=\"isLocked('theme-brand')\"\n (optionSelected)=\"selectBrand($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-space\"\n title=\"Kerapatan\"\n [activeLabel]=\"spaceOptions.find((option) => option.value === space())?.label ?? space()\"\n [options]=\"spaceOptions\"\n [selected]=\"space()\"\n (optionSelected)=\"selectSpace($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-radius\"\n title=\"Sudut\"\n [activeLabel]=\"\n radiusOptions.find((option) => option.value === radius())?.label ?? radius()\n \"\n [options]=\"radiusOptions\"\n [selected]=\"radius()\"\n (optionSelected)=\"selectRadius($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-layout\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-layout\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Layout\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-appearance\"\n title=\"Bingkai\"\n [activeLabel]=\"\n appearanceOptions.find((option) => option.value === appearance())?.label ?? appearance()\n \"\n [options]=\"appearanceOptions\"\n [selected]=\"appearance()\"\n [locked]=\"isLocked('layout-appearance')\"\n (optionSelected)=\"selectAppearance($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-surface\"\n title=\"Latar\"\n [activeLabel]=\"\n surfaceOptions.find((option) => option.value === surface())?.label ?? surface()\n \"\n [options]=\"surfaceOptions\"\n [selected]=\"surface()\"\n [locked]=\"isLocked('layout-surface')\"\n (optionSelected)=\"selectSurface($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-layout-type\"\n title=\"Tipe layout\"\n [activeLabel]=\"\n layoutTypeOptions.find((option) => option.value === layoutType())?.label ?? layoutType()\n \"\n [options]=\"layoutTypeOptions\"\n [selected]=\"layoutType()\"\n [locked]=\"isLayoutTypeLocked()\"\n (optionSelected)=\"selectLayoutType($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-width\"\n title=\"Lebar konten\"\n [activeLabel]=\"widthOptions.find((option) => option.value === width())?.label ?? width()\"\n [options]=\"widthOptions\"\n [selected]=\"width()\"\n [locked]=\"isLocked('layout-width')\"\n (optionSelected)=\"selectWidth($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-navigation\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-navigation\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Navigasi\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-type\"\n title=\"Tipe navigation\"\n [activeLabel]=\"navigationTypeLabel()\"\n [options]=\"navigationTypeOptions()\"\n [selected]=\"navigationState().type\"\n [locked]=\"isLocked('nav-type')\"\n (optionSelected)=\"selectNavigationType($event)\"\n />\n @if (navigationState().orientation === 'vertical') {\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-mode\"\n title=\"Mode navigation\"\n [activeLabel]=\"navigationModeLabel()\"\n [options]=\"navigationModeOptions()\"\n [selected]=\"navigationMode()\"\n [locked]=\"isLocked('nav-type-mode')\"\n (optionSelected)=\"selectNavigationMode($event)\"\n />\n }\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-position\"\n title=\"Posisi navigation\"\n [activeLabel]=\"navigationPositionLabel()\"\n [options]=\"navigationPositionOptions()\"\n [selected]=\"navigationState().position\"\n [locked]=\"isLocked('nav-position')\"\n (optionSelected)=\"selectNavigationPosition($event)\"\n />\n </section>\n </div>\n </PageContent>\n\n @if (hasDefaults()) {\n <PageFooter class=\"px-3 py-0\">\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n class=\"h-full w-full justify-start\"\n (click)=\"resetToDefaults()\"\n >\n <Icon name=\"restart_alt\" [size]=\"18\" />\n Kembalikan default\n </button>\n </PageFooter>\n }\n\n <p class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</p>\n</Page>\n" }]
734
+ }], ctorParameters: () => [], propDecorators: { closeRequested: [{ type: i0.Output, args: ["closeRequested"] }] } });
735
+ function isNavigationTypeForOrientation(value, orientation) {
736
+ return orientation === 'vertical'
737
+ ? VERTICAL_NAVIGATION_TYPES.includes(value)
738
+ : HORIZONTAL_NAVIGATION_TYPES.includes(value);
739
+ }
740
+ function isNavigationPositionForOrientation(value, orientation) {
741
+ return orientation === 'vertical'
742
+ ? value === 'left' || value === 'right'
743
+ : value === 'top' || value === 'bottom';
744
+ }
745
+
746
+ const PRIMARY_NAVIGATION_ID = 'main';
747
+ const NARROW_VIEWPORT_QUERY = '(max-width: 767.98px)';
748
+ class AppPreferencesComponent {
749
+ document = inject(DOCUMENT, { optional: true });
750
+ destroyRef = inject(DestroyRef);
751
+ navigation = inject(NavigationService);
752
+ preferences = inject(AppPreferencesPanelService);
753
+ narrowState = signal(this.mediaQuery()?.matches ?? false, /* @ts-ignore */
754
+ ...(ngDevMode ? [{ debugName: "narrowState" }] : /* istanbul ignore next */ []));
755
+ navigationState = computed(() => this.navigation.state(PRIMARY_NAVIGATION_ID)() ?? {
756
+ id: PRIMARY_NAVIGATION_ID,
757
+ orientation: 'vertical',
758
+ type: 'sidebar',
759
+ position: 'left',
760
+ collapsed: false,
761
+ dockbarMode: 'default',
762
+ }, /* @ts-ignore */
763
+ ...(ngDevMode ? [{ debugName: "navigationState" }] : /* istanbul ignore next */ []));
764
+ inline = computed(() => !this.narrowState() &&
765
+ this.navigationState().type === 'sidebar' &&
766
+ !this.navigationState().collapsed, /* @ts-ignore */
767
+ ...(ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []));
768
+ hostClass = computed(() => this.inline() ? 'block h-full w-76 border-r border-border' : 'relative block h-full w-16', /* @ts-ignore */
769
+ ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
770
+ constructor() {
771
+ const mediaQuery = this.mediaQuery();
772
+ const onChange = (event) => this.narrowState.set(event.matches);
773
+ mediaQuery?.addEventListener('change', onChange);
774
+ effect((onCleanup) => {
775
+ if (!this.inline() || !this.preferences.opened()) {
776
+ return;
777
+ }
778
+ const onKeydown = (event) => {
779
+ if (event.key === 'Escape' && !event.defaultPrevented) {
780
+ this.preferences.close();
781
+ }
782
+ };
783
+ this.document?.addEventListener('keydown', onKeydown);
784
+ onCleanup(() => this.document?.removeEventListener('keydown', onKeydown));
785
+ });
786
+ this.destroyRef.onDestroy(() => {
787
+ mediaQuery?.removeEventListener('change', onChange);
788
+ if (this.preferences.opened())
789
+ this.preferences.close();
790
+ });
791
+ }
792
+ onSheetOpenChange(open) {
793
+ if (!open)
794
+ this.preferences.close();
795
+ }
796
+ mediaQuery() {
797
+ return this.document?.defaultView?.matchMedia?.(NARROW_VIEWPORT_QUERY) ?? null;
798
+ }
799
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
800
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferencesComponent, isStandalone: true, selector: "app-preferences", host: { properties: { "class": "hostClass()", "attr.role": "inline() ? \"region\" : null", "attr.aria-labelledby": "inline() ? \"app-preferences-title\" : null" } }, ngImport: i0, template: `
801
+ @if (inline()) {
802
+ <section
803
+ id="app-preferences-panel"
804
+ class="h-full min-h-0 w-full"
805
+ aria-labelledby="app-preferences-title"
806
+ >
807
+ <app-preferences-surface (closeRequested)="preferences.close()" />
808
+ </section>
809
+ } @else {
810
+ <Sheet
811
+ [open]="preferences.opened()"
812
+ side="left"
813
+ [showCloseButton]="false"
814
+ [restoreFocus]="false"
815
+ aria-labelledby="app-preferences-title"
816
+ class="!w-[min(19rem,calc(100dvw-2rem))] !max-w-none !gap-0 !p-0"
817
+ (openChange)="onSheetOpenChange($event)"
818
+ >
819
+ <app-preferences-surface
820
+ id="app-preferences-panel"
821
+ (closeRequested)="preferences.close()"
822
+ />
823
+ </Sheet>
824
+ }
825
+ `, isInline: true, dependencies: [{ kind: "component", type: AppPreferencesSurfaceComponent, selector: "app-preferences-surface", outputs: ["closeRequested"] }, { kind: "component", type: SheetComponent, selector: "Sheet, Drawer", inputs: ["open", "side", "variant", "closeOnEscape", "closeOnBackdropClick", "showCloseButton", "restoreFocus", "closeButtonLabel", "aria-labelledby", "aria-describedby", "class"], outputs: ["openChange", "openedChange"] }] });
826
+ }
827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesComponent, decorators: [{
828
+ type: Component,
829
+ args: [{
830
+ selector: 'app-preferences',
831
+ imports: [AppPreferencesSurfaceComponent, SheetComponent],
832
+ host: {
833
+ '[class]': 'hostClass()',
834
+ '[attr.role]': 'inline() ? "region" : null',
835
+ '[attr.aria-labelledby]': 'inline() ? "app-preferences-title" : null',
836
+ },
837
+ template: `
838
+ @if (inline()) {
839
+ <section
840
+ id="app-preferences-panel"
841
+ class="h-full min-h-0 w-full"
842
+ aria-labelledby="app-preferences-title"
843
+ >
844
+ <app-preferences-surface (closeRequested)="preferences.close()" />
845
+ </section>
846
+ } @else {
847
+ <Sheet
848
+ [open]="preferences.opened()"
849
+ side="left"
850
+ [showCloseButton]="false"
851
+ [restoreFocus]="false"
852
+ aria-labelledby="app-preferences-title"
853
+ class="!w-[min(19rem,calc(100dvw-2rem))] !max-w-none !gap-0 !p-0"
854
+ (openChange)="onSheetOpenChange($event)"
855
+ >
856
+ <app-preferences-surface
857
+ id="app-preferences-panel"
858
+ (closeRequested)="preferences.close()"
859
+ />
860
+ </Sheet>
861
+ }
862
+ `,
863
+ }]
864
+ }], ctorParameters: () => [] });
865
+
866
+ class AppPreferencesTriggerDirective {
867
+ elementRef = inject((ElementRef));
868
+ preferences = inject(AppPreferencesPanelService);
869
+ isButton = computed(() => this.elementRef.nativeElement.localName === 'button', /* @ts-ignore */
870
+ ...(ngDevMode ? [{ debugName: "isButton" }] : /* istanbul ignore next */ []));
871
+ onClick(event) {
872
+ if (this.preferences.open(this.elementRef.nativeElement)) {
873
+ event.preventDefault();
874
+ }
875
+ }
876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
877
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AppPreferencesTriggerDirective, isStandalone: true, selector: "[appPreferencesTrigger]", host: { listeners: { "click": "onClick($event)" }, properties: { "attr.aria-expanded": "preferences.opened()", "attr.aria-controls": "preferences.opened() ? \"app-preferences-panel\" : null", "attr.aria-disabled": "isButton() && !preferences.supported() ? \"true\" : null", "attr.disabled": "isButton() && !preferences.supported() ? \"\" : null" } }, ngImport: i0 });
878
+ }
879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesTriggerDirective, decorators: [{
880
+ type: Directive,
881
+ args: [{
882
+ selector: '[appPreferencesTrigger]',
883
+ host: {
884
+ '[attr.aria-expanded]': 'preferences.opened()',
885
+ '[attr.aria-controls]': 'preferences.opened() ? "app-preferences-panel" : null',
886
+ '[attr.aria-disabled]': 'isButton() && !preferences.supported() ? "true" : null',
887
+ '[attr.disabled]': 'isButton() && !preferences.supported() ? "" : null',
888
+ '(click)': 'onClick($event)',
889
+ },
890
+ }]
891
+ }] });
892
+
893
+ /**
894
+ * Generated bundle index. Do not edit.
895
+ */
896
+
897
+ export { APP_PREFERENCES_CONFIG, AppPreferencesComponent, AppPreferencesPanelService, AppPreferencesTriggerDirective, provideAppPreferences };
898
+ //# sourceMappingURL=edsis-angular-block-themes.mjs.map