@ojiepermana/angular 22.2.14 → 22.2.18

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.
Files changed (56) hide show
  1. package/README.md +2 -2
  2. package/SUPPORT.md +23 -9
  3. package/component/composer/README.md +3 -0
  4. package/component/editor/README.md +3 -0
  5. package/fesm2022/ojiepermana-angular-chart-primitives.mjs +9 -1
  6. package/fesm2022/ojiepermana-angular-component-alert.mjs +4 -2
  7. package/fesm2022/ojiepermana-angular-component-button.mjs +1 -1
  8. package/fesm2022/ojiepermana-angular-component-composer.mjs +68 -19
  9. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +1 -1
  10. package/fesm2022/ojiepermana-angular-component-editor.mjs +68 -12
  11. package/fesm2022/ojiepermana-angular-component-form.mjs +2 -2
  12. package/fesm2022/ojiepermana-angular-component-input-group.mjs +1 -1
  13. package/fesm2022/ojiepermana-angular-component-input-otp.mjs +1 -1
  14. package/fesm2022/ojiepermana-angular-component-input.mjs +1 -1
  15. package/fesm2022/ojiepermana-angular-component-native-select.mjs +1 -1
  16. package/fesm2022/ojiepermana-angular-component-pillbox.mjs +1 -1
  17. package/fesm2022/ojiepermana-angular-component-select.mjs +2 -2
  18. package/fesm2022/ojiepermana-angular-component-textarea.mjs +1 -1
  19. package/fesm2022/ojiepermana-angular-component-utils-core.mjs +7 -1
  20. package/fesm2022/{ojiepermana-angular-navigation-navigation-badge-count.component-Bx89vXtg.mjs → ojiepermana-angular-navigation-navigation-badge-count.component-RkecLYjX.mjs} +28 -18
  21. package/fesm2022/{ojiepermana-angular-navigation-navigation-dockbar-menu.component-B2o_omfJ.mjs → ojiepermana-angular-navigation-navigation-dockbar-menu.component-Dl7VAyfV.mjs} +3 -3
  22. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-CJGBKA8c.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-2Jw-868m.mjs} +6 -4
  23. package/fesm2022/{ojiepermana-angular-navigation-navigation-flyout-menu.component-CHVjP7ew.mjs → ojiepermana-angular-navigation-navigation-flyout-menu.component-QHUdqD1N.mjs} +8 -8
  24. package/fesm2022/{ojiepermana-angular-navigation-navigation-horizontal.component-znRwi38r.mjs → ojiepermana-angular-navigation-navigation-horizontal.component-CoX6X3C2.mjs} +5 -5
  25. package/fesm2022/{ojiepermana-angular-navigation-navigation-item.component-CIy9MVBy.mjs → ojiepermana-angular-navigation-navigation-item.component-DTVh0wjc.mjs} +15 -5
  26. package/fesm2022/{ojiepermana-angular-navigation-navigation-list.component-BIQM2uf1.mjs → ojiepermana-angular-navigation-navigation-list.component-CRRaXJz4.mjs} +1 -1
  27. package/fesm2022/ojiepermana-angular-navigation.mjs +45 -23
  28. package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +17 -5
  29. package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +72 -18
  30. package/fesm2022/ojiepermana-angular-theme-page-core.mjs +160 -92
  31. package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +9 -17
  32. package/fesm2022/ojiepermana-angular-theme-page-root.mjs +16 -6
  33. package/fesm2022/ojiepermana-angular-theme-page-side.mjs +10 -18
  34. package/fesm2022/ojiepermana-angular-theme-shell.mjs +2 -0
  35. package/fesm2022/ojiepermana-angular-theme-styles.mjs +22 -3
  36. package/navigation/README.md +17 -0
  37. package/package.json +5 -5
  38. package/sdk/README.md +15 -4
  39. package/sdk/schematics/sdk/index.js +84 -12
  40. package/theme/layout/README.md +2 -1
  41. package/theme/page/README.md +5 -3
  42. package/theme/styles/css/base/components.css +90 -0
  43. package/theme/styles/css/base/prefers-dark.css +1 -0
  44. package/theme/styles/css/base/tailwind.css +6 -0
  45. package/theme/styles/css/base/theme.css +3 -0
  46. package/theme/styles/css/base/tokens.css +13 -0
  47. package/theme/styles/css/color/brand.css +16 -0
  48. package/types/ojiepermana-angular-component-composer.d.ts +5 -1
  49. package/types/ojiepermana-angular-component-editor.d.ts +4 -0
  50. package/types/ojiepermana-angular-navigation-types.d.ts +6 -0
  51. package/types/ojiepermana-angular-navigation.d.ts +13 -3
  52. package/types/ojiepermana-angular-theme-component-settings.d.ts +10 -0
  53. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +24 -1
  54. package/types/ojiepermana-angular-theme-page-core.d.ts +8 -9
  55. package/types/ojiepermana-angular-theme-page-root.d.ts +1 -0
  56. package/types/ojiepermana-angular-theme-styles.d.ts +3 -2
@@ -249,8 +249,9 @@ const THEME_SETTINGS_ICONS = [
249
249
  node: Terminal
250
250
  },
251
251
  {
252
- name: "unfold-horizontal",
252
+ name: "arrows-from-axis-dashed-vertical",
253
253
  size: 24,
254
+ aliases: ["unfold-horizontal"],
254
255
  node: UnfoldHorizontal
255
256
  }
256
257
  ];
@@ -312,6 +313,13 @@ var ThemeSettingsDefaultAdapter = class ThemeSettingsDefaultAdapter {
312
313
  constructor() {
313
314
  effect(() => this.enforceConstraints(this.layoutTypeState(), this.shell.mode()));
314
315
  }
316
+ registerDefaults(defaults) {
317
+ const { navType, navTypeMode } = defaults;
318
+ if (navType !== void 0 && !this.isStored("nav-type", NAV_TYPES) && allowedNavTypes(this.layoutTypeState(), this.shell.mode()).includes(navType)) this.navTypeState.set(navType);
319
+ if (navTypeMode !== void 0 && !this.isStored("nav-type-mode", NAV_TYPE_MODES) && allowedNavTypeModes(this.navTypeState()).includes(navTypeMode)) this.navTypeModeState.set(navTypeMode);
320
+ this.enforceNavTypeMode();
321
+ return this;
322
+ }
315
323
  setSurface(surface) {
316
324
  this.layout.setSurface(surface);
317
325
  }
@@ -353,6 +361,10 @@ var ThemeSettingsDefaultAdapter = class ThemeSettingsDefaultAdapter {
353
361
  const available = allowedNavTypeModes(this.navTypeState());
354
362
  if (!available.includes(this.navTypeModeState())) this.setNavTypeMode(available[0]);
355
363
  }
364
+ isStored(key, values) {
365
+ const stored = this.storage.read(key);
366
+ return stored !== null && values.includes(stored);
367
+ }
356
368
  readStoredNavType() {
357
369
  const stored = this.storage.read(NAV_TYPE_STORAGE_KEY);
358
370
  return stored && NAV_TYPES.includes(stored) ? stored : "dockbar";
@@ -944,7 +956,7 @@ var ThemeSettingsNavigationSectionComponent = class ThemeSettingsNavigationSecti
944
956
  icon: "list-tree"
945
957
  }, {
946
958
  value: "rail-active",
947
- label: "rail-active",
959
+ label: "Active rail",
948
960
  icon: "git-branch"
949
961
  }];
950
962
  navRailLabelId = injectUniqueId("theme-settings-nav-rail");
@@ -1717,7 +1729,7 @@ var ThemeSettingsComponent = class ThemeSettingsComponent {
1717
1729
  ...ngDevMode ? { debugName: "class" } : /* istanbul ignore next */ {},
1718
1730
  alias: "class"
1719
1731
  });
1720
- triggerClasses = computed(() => cn("inline-flex items-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none", this.trigger() === "link" ? this.triggerIconOnly() ? "size-11 p-0 text-primary underline-offset-4 hover:underline" : "min-h-11 px-1 text-primary underline-offset-4 hover:underline" : this.triggerIconOnly() ? "size-11 justify-center p-0 text-muted-foreground hover:bg-accent hover:text-foreground" : "min-h-11 justify-center px-3 text-muted-foreground hover:bg-accent hover:text-accent-foreground", this.class()), ...ngDevMode ? [{ debugName: "triggerClasses" }] : /* istanbul ignore next */ []);
1732
+ triggerClasses = computed(() => cn("inline-flex items-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none", this.trigger() === "link" ? this.triggerIconOnly() ? "size-11 p-0 text-primary-ink underline-offset-4 hover:underline" : "min-h-11 px-1 text-primary-ink underline-offset-4 hover:underline" : this.triggerIconOnly() ? "size-11 justify-center p-0 text-muted-foreground hover:bg-accent hover:text-foreground" : "min-h-11 justify-center px-3 text-muted-foreground hover:bg-accent hover:text-accent-foreground", this.class()), ...ngDevMode ? [{ debugName: "triggerClasses" }] : /* istanbul ignore next */ []);
1721
1733
  static ɵfac = i0.ɵɵngDeclareFactory({
1722
1734
  minVersion: "12.0.0",
1723
1735
  version: "22.2.6",
@@ -1840,7 +1852,7 @@ var ThemeSettingsComponent = class ThemeSettingsComponent {
1840
1852
  >
1841
1853
  <span
1842
1854
  aria-hidden="true"
1843
- class="grid size-8 shrink-0 place-items-center rounded-md bg-primary/10 text-primary ring-1 ring-primary/20"
1855
+ class="grid size-8 shrink-0 place-items-center rounded-md bg-primary/10 text-primary-ink ring-1 ring-primary/20"
1844
1856
  ><Icon name="palette" [size]="18"
1845
1857
  /></span>
1846
1858
  <div class="min-w-0 flex-1">
@@ -2019,7 +2031,7 @@ i0.ɵɵngDeclareClassMetadata({
2019
2031
  >
2020
2032
  <span
2021
2033
  aria-hidden="true"
2022
- class="grid size-8 shrink-0 place-items-center rounded-md bg-primary/10 text-primary ring-1 ring-primary/20"
2034
+ class="grid size-8 shrink-0 place-items-center rounded-md bg-primary/10 text-primary-ink ring-1 ring-primary/20"
2023
2035
  ><Icon name="palette" [size]="18"
2024
2036
  /></span>
2025
2037
  <div class="min-w-0 flex-1">
@@ -215,12 +215,18 @@ var LayoutUser = class LayoutUser {
215
215
  alias: "show-theme-settings",
216
216
  transform: optionalBooleanAttribute
217
217
  });
218
+ showLogout = input(null, {
219
+ ...ngDevMode ? { debugName: "showLogout" } : /* istanbul ignore next */ {},
220
+ alias: "show-logout",
221
+ transform: optionalBooleanAttribute
222
+ });
218
223
  logoutLabel = input(null, ...ngDevMode ? [{ debugName: "logoutLabel" }] : /* istanbul ignore next */ []);
219
224
  logoutIcon = input(null, ...ngDevMode ? [{ debugName: "logoutIcon" }] : /* istanbul ignore next */ []);
220
225
  logout = output();
221
226
  showsIdentity = computed(() => this.detailed() || this.options?.detailed === true, ...ngDevMode ? [{ debugName: "showsIdentity" }] : /* istanbul ignore next */ []);
222
227
  showsEmail = computed(() => this.showEmail() ?? this.options?.showEmail ?? true, ...ngDevMode ? [{ debugName: "showsEmail" }] : /* istanbul ignore next */ []);
223
228
  showsThemeSettings = computed(() => this.showThemeSettings() ?? this.options?.showThemeSettings ?? true, ...ngDevMode ? [{ debugName: "showsThemeSettings" }] : /* istanbul ignore next */ []);
229
+ showsLogout = computed(() => this.showLogout() ?? this.options?.showLogout ?? true, ...ngDevMode ? [{ debugName: "showsLogout" }] : /* istanbul ignore next */ []);
224
230
  resolvedLogoutLabel = computed(() => this.logoutLabel() ?? this.options?.logoutLabel ?? "Logout", ...ngDevMode ? [{ debugName: "resolvedLogoutLabel" }] : /* istanbul ignore next */ []);
225
231
  resolvedLogoutIcon = computed(() => this.logoutIcon() ?? this.options?.logoutIcon ?? "log-out", ...ngDevMode ? [{ debugName: "resolvedLogoutIcon" }] : /* istanbul ignore next */ []);
226
232
  static ɵfac = i0.ɵɵngDeclareFactory({
@@ -273,6 +279,13 @@ var LayoutUser = class LayoutUser {
273
279
  isRequired: false,
274
280
  transformFunction: null
275
281
  },
282
+ showLogout: {
283
+ classPropertyName: "showLogout",
284
+ publicName: "show-logout",
285
+ isSignal: true,
286
+ isRequired: false,
287
+ transformFunction: null
288
+ },
276
289
  logoutLabel: {
277
290
  classPropertyName: "logoutLabel",
278
291
  publicName: "logoutLabel",
@@ -313,15 +326,17 @@ var LayoutUser = class LayoutUser {
313
326
  }
314
327
 
315
328
  <NavigationFooterAction class="ml-auto">
316
- <button
317
- type="button"
318
- [attr.aria-label]="resolvedLogoutLabel()"
319
- [attr.title]="resolvedLogoutLabel()"
320
- class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
321
- (click)="logout.emit()"
322
- >
323
- <Icon [name]="resolvedLogoutIcon()" [size]="18" />
324
- </button>
329
+ @if (showsLogout()) {
330
+ <button
331
+ type="button"
332
+ [attr.aria-label]="resolvedLogoutLabel()"
333
+ [attr.title]="resolvedLogoutLabel()"
334
+ class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
335
+ (click)="logout.emit()"
336
+ >
337
+ <Icon [name]="resolvedLogoutIcon()" [size]="18" />
338
+ </button>
339
+ }
325
340
  @if (showsThemeSettings()) {
326
341
  <ThemeSettings [trigger-icon-only]="true" class="size-8! min-h-8!" />
327
342
  }
@@ -427,15 +442,17 @@ i0.ɵɵngDeclareClassMetadata({
427
442
  }
428
443
 
429
444
  <NavigationFooterAction class="ml-auto">
430
- <button
431
- type="button"
432
- [attr.aria-label]="resolvedLogoutLabel()"
433
- [attr.title]="resolvedLogoutLabel()"
434
- class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
435
- (click)="logout.emit()"
436
- >
437
- <Icon [name]="resolvedLogoutIcon()" [size]="18" />
438
- </button>
445
+ @if (showsLogout()) {
446
+ <button
447
+ type="button"
448
+ [attr.aria-label]="resolvedLogoutLabel()"
449
+ [attr.title]="resolvedLogoutLabel()"
450
+ class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
451
+ (click)="logout.emit()"
452
+ >
453
+ <Icon [name]="resolvedLogoutIcon()" [size]="18" />
454
+ </button>
455
+ }
439
456
  @if (showsThemeSettings()) {
440
457
  <ThemeSettings [trigger-icon-only]="true" class="size-8! min-h-8!" />
441
458
  }
@@ -484,6 +501,14 @@ i0.ɵɵngDeclareClassMetadata({
484
501
  required: false
485
502
  }]
486
503
  }],
504
+ showLogout: [{
505
+ type: i0.Input,
506
+ args: [{
507
+ isSignal: true,
508
+ alias: "show-logout",
509
+ required: false
510
+ }]
511
+ }],
487
512
  logoutLabel: [{
488
513
  type: i0.Input,
489
514
  args: [{
@@ -617,6 +642,7 @@ var LayoutNavSidebar = class LayoutNavSidebar {
617
642
  "show-initial",
618
643
  "show-email",
619
644
  "show-theme-settings",
645
+ "show-logout",
620
646
  "logoutLabel",
621
647
  "logoutIcon"
622
648
  ],
@@ -859,6 +885,7 @@ var LayoutNavDockbar = class LayoutNavDockbar {
859
885
  "show-initial",
860
886
  "show-email",
861
887
  "show-theme-settings",
888
+ "show-logout",
862
889
  "logoutLabel",
863
890
  "logoutIcon"
864
891
  ],
@@ -1064,6 +1091,7 @@ var LayoutNavMinidock = class LayoutNavMinidock {
1064
1091
  "show-initial",
1065
1092
  "show-email",
1066
1093
  "show-theme-settings",
1094
+ "show-logout",
1067
1095
  "logoutLabel",
1068
1096
  "logoutIcon"
1069
1097
  ],
@@ -1227,6 +1255,7 @@ var LayoutNavNavbar = class LayoutNavNavbar {
1227
1255
  "show-initial",
1228
1256
  "show-email",
1229
1257
  "show-theme-settings",
1258
+ "show-logout",
1230
1259
  "logoutLabel",
1231
1260
  "logoutIcon"
1232
1261
  ],
@@ -1409,6 +1438,7 @@ var LayoutNavFlyout = class LayoutNavFlyout {
1409
1438
  "show-initial",
1410
1439
  "show-email",
1411
1440
  "show-theme-settings",
1441
+ "show-logout",
1412
1442
  "logoutLabel",
1413
1443
  "logoutIcon"
1414
1444
  ],
@@ -1607,6 +1637,10 @@ var LayoutWrapperDefault = class LayoutWrapperDefault {
1607
1637
  ...ngDevMode ? { debugName: "navRail" } : /* istanbul ignore next */ {},
1608
1638
  alias: "nav-rail"
1609
1639
  });
1640
+ navBadgeIndicator = input("chevron", {
1641
+ ...ngDevMode ? { debugName: "navBadgeIndicator" } : /* istanbul ignore next */ {},
1642
+ alias: "nav-badge-indicator"
1643
+ });
1610
1644
  dockbarRouteContext = input(null, {
1611
1645
  ...ngDevMode ? { debugName: "dockbarRouteContext" } : /* istanbul ignore next */ {},
1612
1646
  alias: "dockbar-route-context"
@@ -1772,6 +1806,13 @@ var LayoutWrapperDefault = class LayoutWrapperDefault {
1772
1806
  isRequired: false,
1773
1807
  transformFunction: null
1774
1808
  },
1809
+ navBadgeIndicator: {
1810
+ classPropertyName: "navBadgeIndicator",
1811
+ publicName: "nav-badge-indicator",
1812
+ isSignal: true,
1813
+ isRequired: false,
1814
+ transformFunction: null
1815
+ },
1775
1816
  dockbarRouteContext: {
1776
1817
  classPropertyName: "dockbarRouteContext",
1777
1818
  publicName: "dockbar-route-context",
@@ -1936,6 +1977,7 @@ var LayoutWrapperDefault = class LayoutWrapperDefault {
1936
1977
  data-id="main"
1937
1978
  [data]="data()"
1938
1979
  [rail]="navRail()"
1980
+ [badge-indicator]="navBadgeIndicator()"
1939
1981
  [badge-context]="resolvedBadgeContext()"
1940
1982
  ariaLabel="Primary navigation"
1941
1983
  class="h-full w-full"
@@ -1964,6 +2006,7 @@ var LayoutWrapperDefault = class LayoutWrapperDefault {
1964
2006
  [data-id]="desktopDataId()"
1965
2007
  [data]="desktopData()"
1966
2008
  [rail]="navRail()"
2009
+ [badge-indicator]="navBadgeIndicator()"
1967
2010
  [badge-context]="resolvedBadgeContext()"
1968
2011
  [class]="navClass()"
1969
2012
  >
@@ -2136,6 +2179,7 @@ var LayoutWrapperDefault = class LayoutWrapperDefault {
2136
2179
  "compact",
2137
2180
  "collapse-tree",
2138
2181
  "rail",
2182
+ "badge-indicator",
2139
2183
  "class",
2140
2184
  "itemClass",
2141
2185
  "nav-group-class",
@@ -2317,6 +2361,7 @@ i0.ɵɵngDeclareClassMetadataAsync({
2317
2361
  data-id="main"
2318
2362
  [data]="data()"
2319
2363
  [rail]="navRail()"
2364
+ [badge-indicator]="navBadgeIndicator()"
2320
2365
  [badge-context]="resolvedBadgeContext()"
2321
2366
  ariaLabel="Primary navigation"
2322
2367
  class="h-full w-full"
@@ -2345,6 +2390,7 @@ i0.ɵɵngDeclareClassMetadataAsync({
2345
2390
  [data-id]="desktopDataId()"
2346
2391
  [data]="desktopData()"
2347
2392
  [rail]="navRail()"
2393
+ [badge-indicator]="navBadgeIndicator()"
2348
2394
  [badge-context]="resolvedBadgeContext()"
2349
2395
  [class]="navClass()"
2350
2396
  >
@@ -2495,6 +2541,14 @@ i0.ɵɵngDeclareClassMetadataAsync({
2495
2541
  required: false
2496
2542
  }]
2497
2543
  }],
2544
+ navBadgeIndicator: [{
2545
+ type: i0.Input,
2546
+ args: [{
2547
+ isSignal: true,
2548
+ alias: "nav-badge-indicator",
2549
+ required: false
2550
+ }]
2551
+ }],
2498
2552
  dockbarRouteContext: [{
2499
2553
  type: i0.Input,
2500
2554
  args: [{
@@ -1,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Service, computed, effect, signal } from "@angular/core";
2
+ import { ElementRef, Injectable, Service, afterRenderEffect, computed, inject, signal } from "@angular/core";
3
+ import { Overlay, OverlayContainer } from "@angular/cdk/overlay";
3
4
  const PAGE_VARIANTS = ["stacked", "side"];
4
5
  const PAGE_SIDE_POSITIONS = ["left", "right"];
5
6
  const PAGE_SIDE_MODES = [
@@ -203,113 +204,180 @@ i0.ɵɵngDeclareClassMetadata({
203
204
  args: [{ autoProvided: false }]
204
205
  }]
205
206
  });
206
- const FOCUSABLE_SELECTOR = [
207
- "a[href]",
208
- "button:not([disabled])",
209
- "input:not([disabled])",
210
- "select:not([disabled])",
211
- "textarea:not([disabled])",
212
- "[tabindex]:not([tabindex=\"-1\"])"
213
- ].join(",");
214
- const inertLocks = /* @__PURE__ */ new WeakMap();
215
- const scrollLocks = /* @__PURE__ */ new WeakMap();
207
+ const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, summary, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]";
208
+ const modalStacks = /* @__PURE__ */ new WeakMap();
209
+ function ɵisActivePageOverlay(document, id) {
210
+ return id !== null && modalStacks.get(document)?.active?.id === id;
211
+ }
216
212
  function ɵsetupOverlayFocusManagement(config) {
217
- effect((onCleanup) => {
213
+ afterRenderEffect({ mixedReadWrite: (onCleanup) => {
218
214
  if (!config.isInteractive() || !config.isOpen()) return;
219
- const document = config.document;
215
+ const { document, host } = config;
220
216
  const view = document?.defaultView;
221
- if (!document || !view) return;
217
+ if (!document || !view || !host.isConnected) return;
222
218
  const returnFocus = config.takeReturnFocus?.() ?? document.activeElement;
223
219
  const modal = config.isModal();
224
- const inertSnapshots = modal ? makeBackgroundInert(config.host) : [];
225
- if (modal) lockDocumentScroll(document);
226
- const handleKeydown = (event) => {
227
- if (!modal || event.key !== "Tab") return;
228
- const focusable = getFocusableElements(config.host);
229
- if (focusable.length === 0) {
230
- event.preventDefault();
231
- config.host.focus();
232
- return;
233
- }
234
- const active = document.activeElement;
235
- const first = focusable[0];
236
- const last = focusable.at(-1);
237
- const activeIndex = focusable.indexOf(active);
238
- if (event.shiftKey && activeIndex <= 0) {
239
- event.preventDefault();
240
- last.focus();
241
- } else if (!event.shiftKey && (activeIndex === -1 || active === last)) {
242
- event.preventDefault();
243
- first.focus();
244
- }
220
+ const stack = modal ? getModalStack(document) : void 0;
221
+ stack?.open(host);
222
+ let childEscape;
223
+ const onKeydownCapture = (event) => {
224
+ if (event.key === "Escape" && host.querySelector(".cdk-overlay-pane:not(:empty)")) childEscape = event;
245
225
  };
246
- config.host.addEventListener("keydown", handleKeydown);
226
+ const onKeydown = (event) => {
227
+ const activeModal = modalStacks.get(document)?.active;
228
+ if (event.defaultPrevented || activeModal && activeModal !== host) return;
229
+ if (event.key === "Escape" && config.closeOnEsc?.() && childEscape !== event) {
230
+ if (modal) event.preventDefault();
231
+ config.close?.();
232
+ } else if (modal && event.key === "Tab") trapTab(host, event);
233
+ };
234
+ view.addEventListener("keydown", onKeydownCapture, true);
235
+ view.addEventListener("keydown", onKeydown);
247
236
  const animationFrame = view.requestAnimationFrame(() => {
248
- (config.host.querySelector("[data-page-initial-focus], [autofocus]") ?? getFocusableElements(config.host)[0] ?? config.host).focus();
237
+ const activeModal = modalStacks.get(document)?.active;
238
+ if (!activeModal || activeModal === host) focusPanel(host);
249
239
  });
250
240
  onCleanup(() => {
251
241
  view.cancelAnimationFrame(animationFrame);
252
- config.host.removeEventListener("keydown", handleKeydown);
253
- restoreBackground(inertSnapshots);
254
- if (modal) unlockDocumentScroll(document);
255
- if (returnFocus?.isConnected && typeof returnFocus.focus === "function") view.requestAnimationFrame(() => returnFocus.focus());
242
+ view.removeEventListener("keydown", onKeydownCapture, true);
243
+ view.removeEventListener("keydown", onKeydown);
244
+ const wasTop = !stack || stack.active === host;
245
+ stack?.close(host);
246
+ if (wasTop) view.requestAnimationFrame(() => {
247
+ const active = modalStacks.get(document)?.active;
248
+ if (returnFocus instanceof HTMLElement && returnFocus.isConnected && !returnFocus.closest("[inert]") && (!active || active.contains(returnFocus))) returnFocus.focus({ preventScroll: true });
249
+ else if (active && !active.contains(document.activeElement)) focusPanel(active);
250
+ });
256
251
  });
257
- });
252
+ } });
253
+ }
254
+ function trapTab(host, event) {
255
+ const focusable = getFocusableElements(host);
256
+ const index = focusable.indexOf(host.ownerDocument.activeElement);
257
+ if (index < 0 || (event.shiftKey ? index === 0 : index === focusable.length - 1)) {
258
+ event.preventDefault();
259
+ ((event.shiftKey ? focusable.at(-1) : focusable[0]) ?? host).focus({ preventScroll: true });
260
+ }
261
+ }
262
+ function focusPanel(host) {
263
+ (host.querySelector("[data-page-initial-focus], [autofocus]") ?? getFocusableElements(host)[0] ?? host).focus({ preventScroll: true });
264
+ if (!host.contains(host.ownerDocument.activeElement)) (getFocusableElements(host)[0] ?? host).focus({ preventScroll: true });
258
265
  }
259
266
  function getFocusableElements(host) {
260
- return Array.from(host.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => !element.hidden && !element.inert && element.getAttribute("aria-hidden") !== "true");
267
+ return Array.from(host.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => !element.matches(":disabled, [tabindex=\"-1\"], input[type=\"hidden\"]") && !element.closest("[hidden], [inert], [aria-hidden=\"true\"]") && (element.checkVisibility?.({ visibilityProperty: true }) ?? host.ownerDocument.defaultView?.getComputedStyle(element).visibility !== "hidden"));
261
268
  }
262
- function makeBackgroundInert(host) {
263
- const snapshots = [];
264
- const pageRoot = host.closest("Page");
265
- if (!pageRoot) return snapshots;
266
- let branch = host;
267
- let parent = branch.parentElement;
268
- while (parent) {
269
- for (const sibling of Array.from(parent.children)) {
270
- if (sibling === branch || !(sibling instanceof HTMLElement) || sibling.hasAttribute("data-page-overlay-backdrop")) continue;
271
- const lock = inertLocks.get(sibling);
272
- if (lock) lock.count += 1;
273
- else inertLocks.set(sibling, {
274
- count: 1,
275
- initial: sibling.inert === true
276
- });
277
- snapshots.push({ element: sibling });
278
- sibling.inert = true;
279
- }
280
- if (parent === pageRoot) break;
281
- branch = parent;
282
- parent = parent.parentElement;
269
+ function getModalStack(document) {
270
+ let stack = modalStacks.get(document);
271
+ if (!stack) {
272
+ stack = new PageModalStack(document);
273
+ modalStacks.set(document, stack);
283
274
  }
284
- return snapshots;
275
+ return stack;
285
276
  }
286
- function restoreBackground(snapshots) {
287
- for (const snapshot of snapshots) {
288
- const lock = inertLocks.get(snapshot.element);
289
- if (!lock) continue;
290
- lock.count -= 1;
291
- if (lock.count === 0) {
292
- snapshot.element.inert = lock.initial;
293
- inertLocks.delete(snapshot.element);
277
+ var PageModalStack = class {
278
+ document;
279
+ panels = [];
280
+ background = /* @__PURE__ */ new Set();
281
+ ancestorOverflow = /* @__PURE__ */ new Map();
282
+ observer = new MutationObserver(() => this.isolate());
283
+ constructor(document) {
284
+ this.document = document;
285
+ }
286
+ get active() {
287
+ return this.panels.at(-1);
288
+ }
289
+ open(panel) {
290
+ this.panels.push(panel);
291
+ this.isolate();
292
+ }
293
+ close(panel) {
294
+ this.panels.splice(this.panels.indexOf(panel), 1);
295
+ this.isolate();
296
+ if (!this.active) modalStacks.delete(this.document);
297
+ }
298
+ isolate() {
299
+ this.observer.disconnect();
300
+ const keep = /* @__PURE__ */ new Set();
301
+ const host = this.active;
302
+ if (host?.isConnected) {
303
+ const backdrop = host.closest("[data-page-root]")?.querySelector(":scope > [data-page-overlay-backdrop]");
304
+ for (const node of [host, backdrop]) for (let branch = node; branch && branch !== this.document.body; branch = branch.parentElement) keep.add(branch);
305
+ }
306
+ this.lockAncestorScroll(host);
307
+ const blocked = /* @__PURE__ */ new Set();
308
+ for (const branch of keep) {
309
+ const parent = branch.parentElement;
310
+ if (parent) {
311
+ this.observer.observe(parent, { childList: true });
312
+ for (const sibling of parent.children) if (!keep.has(sibling)) blocked.add(sibling);
313
+ }
314
+ }
315
+ for (const element of this.background) if (!blocked.has(element)) {
316
+ if (!element.matches("[data-page-slot]:is([data-page-side-mode], [data-page-filter-mode])[aria-hidden=\"true\"]")) element.removeAttribute("inert");
317
+ this.background.delete(element);
318
+ }
319
+ for (const element of blocked) if (!element.hasAttribute("inert")) {
320
+ element.setAttribute("inert", "");
321
+ this.background.add(element);
294
322
  }
295
323
  }
296
- }
297
- function lockDocumentScroll(document) {
298
- const lock = scrollLocks.get(document);
299
- if (lock) lock.count += 1;
300
- else scrollLocks.set(document, {
301
- count: 1,
302
- initialOverflow: document.body.style.overflow
303
- });
304
- document.body.style.overflow = "hidden";
305
- }
306
- function unlockDocumentScroll(document) {
307
- const lock = scrollLocks.get(document);
308
- if (!lock) return;
309
- lock.count -= 1;
310
- if (lock.count === 0) {
311
- document.body.style.overflow = lock.initialOverflow;
312
- scrollLocks.delete(document);
324
+ lockAncestorScroll(host) {
325
+ for (const [element, previous] of this.ancestorOverflow) if (!host?.isConnected || !element.contains(host) || element === host) {
326
+ element.style.overflow = previous.value;
327
+ element.style.overflowX = previous.x;
328
+ element.style.overflowY = previous.y;
329
+ this.ancestorOverflow.delete(element);
330
+ }
331
+ for (let element = host?.isConnected ? host.parentElement : null; element && element !== this.document.documentElement; element = element.parentElement) {
332
+ if (this.ancestorOverflow.has(element)) continue;
333
+ const style = this.document.defaultView?.getComputedStyle(element);
334
+ if (element === this.document.body || style && /auto|scroll/.test(`${style.overflowX} ${style.overflowY}`)) {
335
+ this.ancestorOverflow.set(element, {
336
+ value: element.style.overflow,
337
+ x: element.style.overflowX,
338
+ y: element.style.overflowY
339
+ });
340
+ element.style.overflow = "hidden";
341
+ }
342
+ }
313
343
  }
314
- }
315
- export { PAGE_APPEARANCES, PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_POSITION, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PAGE_FILTER_PLACEMENTS, PAGE_HEIGHT_VALUES, PAGE_SCROLL_VALUES, PAGE_SIDE_MODES, PAGE_SIDE_POSITIONS, PAGE_VARIANTS, PageStateService, isUiPageAppearance, isUiPageFilterPlacement, isUiPageHeight, isUiPageScroll, isUiPageSideMode, isUiPageSidePosition, isUiPageVariant, ɵsetupOverlayFocusManagement };
344
+ };
345
+ var PagePanelOverlayContainer = class PagePanelOverlayContainer extends OverlayContainer {
346
+ panel = inject(ElementRef).nativeElement;
347
+ parent = inject(OverlayContainer, { skipSelf: true });
348
+ getContainerElement() {
349
+ return this.panel.getAttribute("aria-modal") === "true" ? super.getContainerElement() : this.parent.getContainerElement();
350
+ }
351
+ _createContainer() {
352
+ const container = this.panel.ownerDocument.createElement("div");
353
+ container.classList.add("cdk-overlay-container");
354
+ this.panel.append(container);
355
+ this._containerElement = container;
356
+ }
357
+ static ɵfac = i0.ɵɵngDeclareFactory({
358
+ minVersion: "12.0.0",
359
+ version: "22.2.6",
360
+ ngImport: i0,
361
+ type: PagePanelOverlayContainer,
362
+ deps: null,
363
+ target: i0.ɵɵFactoryTarget.Injectable
364
+ });
365
+ static ɵprov = i0.ɵɵngDeclareInjectable({
366
+ minVersion: "12.0.0",
367
+ version: "22.2.6",
368
+ ngImport: i0,
369
+ type: PagePanelOverlayContainer
370
+ });
371
+ };
372
+ i0.ɵɵngDeclareClassMetadata({
373
+ minVersion: "12.0.0",
374
+ version: "22.2.6",
375
+ ngImport: i0,
376
+ type: PagePanelOverlayContainer,
377
+ decorators: [{ type: Injectable }]
378
+ });
379
+ const ɵPAGE_PANEL_OVERLAY_PROVIDERS = [Overlay, {
380
+ provide: OverlayContainer,
381
+ useClass: PagePanelOverlayContainer
382
+ }];
383
+ export { PAGE_APPEARANCES, PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_POSITION, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PAGE_FILTER_PLACEMENTS, PAGE_HEIGHT_VALUES, PAGE_SCROLL_VALUES, PAGE_SIDE_MODES, PAGE_SIDE_POSITIONS, PAGE_VARIANTS, PageStateService, isUiPageAppearance, isUiPageFilterPlacement, isUiPageHeight, isUiPageScroll, isUiPageSideMode, isUiPageSidePosition, isUiPageVariant, ɵPAGE_PANEL_OVERLAY_PROVIDERS, ɵisActivePageOverlay, ɵsetupOverlayFocusManagement };
@@ -1,8 +1,8 @@
1
1
  import { DOCUMENT } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
- import { Component, ElementRef, booleanAttribute, computed, effect, inject, input, output, untracked } from "@angular/core";
3
+ import { Component, ElementRef, booleanAttribute, computed, effect, inject, input, output } from "@angular/core";
4
4
  import { cn } from "@ojiepermana/angular/component/utils/core";
5
- import { PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_SCROLL, PageStateService, ɵsetupOverlayFocusManagement } from "@ojiepermana/angular/theme/page/core";
5
+ import { PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_SCROLL, PageStateService, ɵPAGE_PANEL_OVERLAY_PROVIDERS, ɵsetupOverlayFocusManagement } from "@ojiepermana/angular/theme/page/core";
6
6
  let nextPageFilterId = 0;
7
7
  const FILTER_BG = "bg-surface/50";
8
8
  const FILTER_BG_OPAQUE = "bg-[color-mix(in_srgb,var(--color-surface)_50%,var(--color-background))]";
@@ -44,7 +44,7 @@ var PageFilterComponent = class PageFilterComponent {
44
44
  const scroll = this.resolvedScroll();
45
45
  const open = this.page.filterOpen();
46
46
  if (this.isStacked()) return cn("block shrink-0 border-b border-border text-surface-foreground", scroll === "page" ? `sticky top-0 z-10 ${FILTER_BG_OPAQUE}` : FILTER_BG, this.class(), this.isCollapsedStacked() && "hidden");
47
- return cn("block min-h-0 border-border text-surface-foreground", this.isSticky() ? FILTER_BG : FILTER_BG_OPAQUE, scroll === "content" && "h-full overflow-auto", scroll === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-filter-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-filter-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-filter-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
47
+ return cn("block min-h-0 border-border text-surface-foreground", this.isSticky() ? FILTER_BG : FILTER_BG_OPAQUE, scroll === "content" && "h-full overflow-auto", scroll === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-filter-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-filter-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "overflow-auto overscroll-contain [&:not([inert])]:z-40 [&[inert]>.cdk-overlay-container]:hidden", this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-filter-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
48
48
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
49
49
  constructor() {
50
50
  ɵsetupOverlayFocusManagement({
@@ -53,6 +53,8 @@ var PageFilterComponent = class PageFilterComponent {
53
53
  isOpen: this.page.filterOpen,
54
54
  isInteractive: this.isInteractive,
55
55
  isModal: this.isOverlay,
56
+ closeOnEsc: this.closeOnEsc,
57
+ close: () => this.page.closeFilter(),
56
58
  takeReturnFocus: () => this.page.takeFilterReturnFocus()
57
59
  });
58
60
  effect(() => {
@@ -64,20 +66,6 @@ var PageFilterComponent = class PageFilterComponent {
64
66
  id: this.resolvedId
65
67
  });
66
68
  });
67
- effect((onCleanup) => {
68
- if (!this.closeOnEsc() || this.isSticky()) return;
69
- const defaultView = this.document?.defaultView;
70
- if (!defaultView) return;
71
- const handler = (event) => {
72
- if (event.key !== "Escape") return;
73
- if (!untracked(() => this.page.filterOpen())) return;
74
- untracked(() => {
75
- this.page.closeFilter();
76
- });
77
- };
78
- defaultView.addEventListener("keydown", handler);
79
- onCleanup(() => defaultView.removeEventListener("keydown", handler));
80
- });
81
69
  }
82
70
  static ɵfac = i0.ɵɵngDeclareFactory({
83
71
  minVersion: "12.0.0",
@@ -165,8 +153,10 @@ var PageFilterComponent = class PageFilterComponent {
165
153
  "attr.aria-modal": "ariaModal()",
166
154
  "attr.aria-label": "dialogLabel()",
167
155
  "attr.tabindex": "dialogTabindex()",
156
+ "style.translate": "isOverlay() && page.filterOpen() ? \"none\" : null",
168
157
  "style.--page-filter-width": "resolvedWidth()"
169
158
  } },
159
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
170
160
  ngImport: i0,
171
161
  template: `<ng-content />`,
172
162
  isInline: true
@@ -181,6 +171,7 @@ i0.ɵɵngDeclareClassMetadata({
181
171
  type: Component,
182
172
  args: [{
183
173
  selector: "PageFilter",
174
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
184
175
  host: {
185
176
  "[class]": "classes()",
186
177
  "[attr.id]": "resolvedId",
@@ -195,6 +186,7 @@ i0.ɵɵngDeclareClassMetadata({
195
186
  "[attr.aria-modal]": "ariaModal()",
196
187
  "[attr.aria-label]": "dialogLabel()",
197
188
  "[attr.tabindex]": "dialogTabindex()",
189
+ "[style.translate]": "isOverlay() && page.filterOpen() ? \"none\" : null",
198
190
  "[style.--page-filter-width]": "resolvedWidth()"
199
191
  },
200
192
  template: `<ng-content />`