@ids-group-ltd/ids-design-system 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +253 -13
- package/components/README.md +86 -0
- package/components.md +12 -4
- package/docs/agent/INDEX.md +1 -0
- package/docs/agent/platform/body-scroll-lock-service.md +12 -0
- package/docs/agent/platform/toast-service.md +4 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +70 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +573 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +86 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +615 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +30 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +188 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +59 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +92 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +204 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +100 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +23 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +180 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +78 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs +49 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +73 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +397 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +1231 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +51 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs +35 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +109 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +111 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +52 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +92 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +62 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +164 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +223 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs +63 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +53 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +286 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +329 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +612 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +69 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +191 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs +23 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +95 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +240 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs +41 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +235 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs +62 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +173 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +123 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +461 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +107 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +185 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +32 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +204 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +25 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +53 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +99 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs +26 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +74 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +76 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +1802 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +381 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +44 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +158 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +671 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +41 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +547 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +34 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +218 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs +18 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +153 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +48 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +1338 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +325 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +101 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs +56 -0
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs +37 -0
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +72 -14030
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.11.0.json +0 -2
- package/migrations/0.11.1.json +2 -1
- package/migrations/0.11.2.json +2 -1
- package/migrations/0.11.3.json +3 -2
- package/migrations/0.11.4.json +247 -0
- package/migrations/0.12.0.json +22 -0
- package/migrations/0.4.0.json +2 -1
- package/migrations/0.7.1.json +2 -1
- package/migrations/0.8.0.json +6 -5
- package/package.json +573 -1
- package/styles/_control-label.scss +18 -0
- package/styles/_ds-color.scss +6 -0
- package/styles/_focus.scss +16 -0
- package/styles/_skeleton-shimmer.scss +10 -26
- package/themes/README.md +4 -4
- package/themes/_semantic.scss +11 -2
- package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +48 -0
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +260 -0
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +75 -0
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +226 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +13 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +99 -0
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +25 -0
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-bottom-sheet.d.ts +61 -0
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +66 -0
- package/types/ids-group-ltd-ids-design-system-components-button-group.d.ts +10 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +90 -0
- package/types/ids-group-ltd-ids-design-system-components-calendar-day.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-card.d.ts +24 -0
- package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +79 -0
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +251 -0
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +25 -0
- package/types/ids-group-ltd-ids-design-system-components-divider.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +38 -0
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +45 -0
- package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +73 -0
- package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +36 -0
- package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +83 -0
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +56 -0
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +121 -0
- package/types/ids-group-ltd-ids-design-system-components-layout.d.ts +39 -0
- package/types/ids-group-ltd-ids-design-system-components-list.d.ts +29 -0
- package/types/ids-group-ltd-ids-design-system-components-loading-overlay.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +82 -0
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +124 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +213 -0
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +52 -0
- package/types/ids-group-ltd-ids-design-system-components-page-footer.d.ts +13 -0
- package/types/ids-group-ltd-ids-design-system-components-page-header.d.ts +21 -0
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +80 -0
- package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +48 -0
- package/types/ids-group-ltd-ids-design-system-components-progress.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +106 -0
- package/types/ids-group-ltd-ids-design-system-components-reserve-messages.d.ts +33 -0
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +82 -0
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +40 -0
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +152 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +92 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +131 -0
- package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +16 -0
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +51 -0
- package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +11 -0
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +38 -0
- package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +44 -0
- package/types/ids-group-ltd-ids-design-system-components-status-dot.d.ts +12 -0
- package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +40 -0
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +791 -0
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +118 -0
- package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +26 -0
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +85 -0
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +188 -0
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +24 -0
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +167 -0
- package/types/ids-group-ltd-ids-design-system-components-toggle-button.d.ts +18 -0
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +66 -0
- package/types/ids-group-ltd-ids-design-system-components-topbar.d.ts +8 -0
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +46 -0
- package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +18 -0
- package/types/ids-group-ltd-ids-design-system-components.d.ts +604 -0
- package/types/ids-group-ltd-ids-design-system-core.d.ts +428 -0
- package/types/ids-group-ltd-ids-design-system-icons.d.ts +52 -0
- package/types/ids-group-ltd-ids-design-system-overlay.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-theme.d.ts +29 -0
- package/types/ids-group-ltd-ids-design-system.d.ts +72 -5544
- package/LICENSE +0 -21
- package/README.md +0 -73
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
2
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, signal, DestroyRef, Injectable, input, model, booleanAttribute, viewChild, effect, afterNextRender, isDevMode, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { DOCUMENT } from '@angular/common';
|
|
7
|
+
import { fromEvent, debounceTime, filter, map, distinctUntilChanged } from 'rxjs';
|
|
8
|
+
import { Router, NavigationEnd, NavigationStart } from '@angular/router';
|
|
9
|
+
import { filter as filter$1 } from 'rxjs/operators';
|
|
10
|
+
import { nextControlId } from '@ids-group-ltd/ids-design-system/components';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Measures the native scrollbar width per device and publishes it as
|
|
14
|
+
* `--ds-scrollbar-width` on `:root` (recomputed on debounced resize).
|
|
15
|
+
* `ds-app-layout` subtracts it from the content region's right padding so the
|
|
16
|
+
* visual inset stays equal on both sides whether the scrollbar area is a real
|
|
17
|
+
* bar (classic scrollbars), a reserved gutter, or nothing (overlay
|
|
18
|
+
* scrollbars, where the measured width is 0). Internal — instantiated by
|
|
19
|
+
* `ds-app-layout`; not part of the public API.
|
|
20
|
+
*/
|
|
21
|
+
class ScrollbarWidthService {
|
|
22
|
+
document = inject(DOCUMENT);
|
|
23
|
+
window = this.document.defaultView;
|
|
24
|
+
width = signal(this.measureWidth(), ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
25
|
+
constructor() {
|
|
26
|
+
const destroyRef = inject(DestroyRef);
|
|
27
|
+
this.applyToCss(this.width());
|
|
28
|
+
fromEvent(this.window, 'resize')
|
|
29
|
+
.pipe(debounceTime(200), takeUntilDestroyed(destroyRef))
|
|
30
|
+
.subscribe(() => {
|
|
31
|
+
const value = this.measureWidth();
|
|
32
|
+
this.width.set(value);
|
|
33
|
+
this.applyToCss(value);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
measureWidth() {
|
|
37
|
+
const probe = this.document.createElement('div');
|
|
38
|
+
probe.style.cssText =
|
|
39
|
+
'overflow:scroll;width:100px;height:100px;position:absolute;top:-9999px';
|
|
40
|
+
this.document.body.appendChild(probe);
|
|
41
|
+
const inner = this.document.createElement('div');
|
|
42
|
+
inner.style.cssText = 'width:100%;height:1px';
|
|
43
|
+
probe.appendChild(inner);
|
|
44
|
+
const width = probe.getBoundingClientRect().width - inner.getBoundingClientRect().width;
|
|
45
|
+
probe.remove();
|
|
46
|
+
return width;
|
|
47
|
+
}
|
|
48
|
+
applyToCss(value) {
|
|
49
|
+
this.document.documentElement.style.setProperty('--ds-scrollbar-width', `${value}px`);
|
|
50
|
+
}
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ScrollbarWidthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
52
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ScrollbarWidthService, providedIn: 'root' });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ScrollbarWidthService, decorators: [{
|
|
55
|
+
type: Injectable,
|
|
56
|
+
args: [{ providedIn: 'root' }]
|
|
57
|
+
}], ctorParameters: () => [] });
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Emits the new path whenever navigation lands on a DIFFERENT one. A query- or
|
|
61
|
+
* fragment-only navigation is a search, sort or page step on the same screen, and
|
|
62
|
+
* everything that reacts to "went somewhere else" must agree on that — the scroll
|
|
63
|
+
* reset, the responsive rail, and now your own code — so they read one source
|
|
64
|
+
* instead of each deciding for itself.
|
|
65
|
+
*
|
|
66
|
+
* PUBLIC since 0.8.x, because consumers were re-deriving it and disagreeing: one
|
|
67
|
+
* consumer had three separate answers to "did the path change?" — route snapshots
|
|
68
|
+
* in a view-transition skip, this stream inside the layout, and a `split('?')`
|
|
69
|
+
* in a tab helper that ignored the fragment this one strips. Inject it and read
|
|
70
|
+
* `pathChanged` rather than writing a fourth:
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* private readonly navigation = inject(LayoutNavigationService);
|
|
74
|
+
* constructor() {
|
|
75
|
+
* this.navigation.pathChanged
|
|
76
|
+
* .pipe(takeUntilDestroyed())
|
|
77
|
+
* .subscribe((path) => …);
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* A PATH change is not always a page change. An app whose URL mirrors the
|
|
82
|
+
* reader's position — a docs layout rewriting `/area/section` from a scroll spy,
|
|
83
|
+
* a wizard that names its step — changes the path while staying on the screen,
|
|
84
|
+
* and resetting the scroll there fights the user: the reset moves the scroll,
|
|
85
|
+
* the spy rewrites the path again, and the page ping-pongs. Such a navigation
|
|
86
|
+
* must carry `state: { dsSamePage: true }`, which is skipped here.
|
|
87
|
+
*
|
|
88
|
+
* Root-provided, which is also what makes it safe to expose: the stream is
|
|
89
|
+
* derived from the router and holds no state, so one instance serves every
|
|
90
|
+
* reader. `LayoutScrollService` depends on it, so a consumer providing THAT
|
|
91
|
+
* outside `ds-app-layout` needs this one resolvable too.
|
|
92
|
+
*/
|
|
93
|
+
class LayoutNavigationService {
|
|
94
|
+
router = inject(Router);
|
|
95
|
+
pathChanged = this.router.events.pipe(filter((event) => event instanceof NavigationEnd), filter(() => !this.samePage()), map((event) => event.urlAfterRedirects.split(/[?#]/)[0]), distinctUntilChanged());
|
|
96
|
+
// `lastSuccessfulNavigation`, not `getCurrentNavigation()`: the latter is
|
|
97
|
+
// already cleared by the time NavigationEnd reaches a subscriber.
|
|
98
|
+
samePage() {
|
|
99
|
+
const state = this.router.lastSuccessfulNavigation()?.extras.state;
|
|
100
|
+
return state?.['dsSamePage'] === true;
|
|
101
|
+
}
|
|
102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutNavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
103
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutNavigationService, providedIn: 'root' });
|
|
104
|
+
}
|
|
105
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutNavigationService, decorators: [{
|
|
106
|
+
type: Injectable,
|
|
107
|
+
args: [{ providedIn: 'root' }]
|
|
108
|
+
}] });
|
|
109
|
+
|
|
110
|
+
const STORAGE_KEY = 'ds-app-layout:scroll';
|
|
111
|
+
// Enough for a reader's back-stack without letting one tab's history grow unbounded.
|
|
112
|
+
const MAX_ENTRIES = 20;
|
|
113
|
+
// Input events only. NOT `scroll`: our own restore writes emit one, so listening
|
|
114
|
+
// for it would cancel the restore we are performing.
|
|
115
|
+
const CANCEL_EVENTS = ['wheel', 'touchstart', 'keydown'];
|
|
116
|
+
const pathOf = (url) => url.split(/[?#]/)[0];
|
|
117
|
+
/**
|
|
118
|
+
* Owns the layout's content scroller. In the fixed-frame layout the window never
|
|
119
|
+
* scrolls, so the router's built-in window-based scrolling no-ops — this service
|
|
120
|
+
* resets the registered container to the top when navigation lands on a different
|
|
121
|
+
* PATH instead. Provided by `ds-app-layout`, so routed pages can
|
|
122
|
+
* `inject(LayoutScrollService)` and call `scrollToTop()` manually (e.g. list pages
|
|
123
|
+
* that DO want the top after a filter change).
|
|
124
|
+
*
|
|
125
|
+
* With `restoreScroll` on the layout it also restores the reader's place. Only
|
|
126
|
+
* when ARMED, which is the whole design: going BACK to a list should return to
|
|
127
|
+
* where the reader was, while following a link into a new screen should not.
|
|
128
|
+
*/
|
|
129
|
+
class LayoutScrollService {
|
|
130
|
+
navigation = inject(LayoutNavigationService);
|
|
131
|
+
router = inject(Router);
|
|
132
|
+
destroyRef = inject(DestroyRef);
|
|
133
|
+
container = signal(null, ...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
134
|
+
/**
|
|
135
|
+
* The content scroller, once the layout has rendered it. Exposed so a host that
|
|
136
|
+
* must measure or drive the scroll itself — a scroll-spy, a virtualizer — can
|
|
137
|
+
* ask the layout for it instead of guessing the layout's internal markup with
|
|
138
|
+
* `document.querySelector`.
|
|
139
|
+
*/
|
|
140
|
+
scroller = this.container.asReadonly();
|
|
141
|
+
// null = restoration off, which is the default.
|
|
142
|
+
restoreTimeoutMs = null;
|
|
143
|
+
resetStrategy = 'path';
|
|
144
|
+
armed = false;
|
|
145
|
+
pendingOffset = null;
|
|
146
|
+
endRestore = null;
|
|
147
|
+
firstNavigation = true;
|
|
148
|
+
constructor() {
|
|
149
|
+
this.navigation.pathChanged
|
|
150
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
151
|
+
// Skipped while a restore is armed for this very navigation: the reset would
|
|
152
|
+
// undo the offset we are about to apply.
|
|
153
|
+
.subscribe(() => {
|
|
154
|
+
if (this.resetStrategy === 'path' && !this.armed) {
|
|
155
|
+
this.scrollToTop();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
this.router.events
|
|
159
|
+
.pipe(filter$1((event) => event instanceof NavigationStart), takeUntilDestroyed(this.destroyRef))
|
|
160
|
+
.subscribe((event) => this.onNavigationStart(event));
|
|
161
|
+
this.router.events
|
|
162
|
+
.pipe(filter$1((event) => event instanceof NavigationEnd), takeUntilDestroyed(this.destroyRef))
|
|
163
|
+
.subscribe(() => this.onNavigationEnd());
|
|
164
|
+
this.destroyRef.onDestroy(() => this.finishRestore());
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Wiring, called by `ds-app-layout` once its content region exists. Public only
|
|
168
|
+
* because the component and the service sit in different files - a consumer has
|
|
169
|
+
* no reason to call it, and calling it points the service at the wrong element.
|
|
170
|
+
*/
|
|
171
|
+
setScrollContainer(element) {
|
|
172
|
+
this.container.set(element);
|
|
173
|
+
}
|
|
174
|
+
/** Wiring: `ds-app-layout` mirrors its `restoreScroll` inputs through here. */
|
|
175
|
+
configureRestore(timeoutMs) {
|
|
176
|
+
this.restoreTimeoutMs = timeoutMs;
|
|
177
|
+
}
|
|
178
|
+
/** Wiring: `ds-app-layout` mirrors its `scrollReset` input through here. */
|
|
179
|
+
configureReset(strategy) {
|
|
180
|
+
this.resetStrategy = strategy;
|
|
181
|
+
}
|
|
182
|
+
scrollToTop() {
|
|
183
|
+
this.scrollTo(0);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Scroll the content region to an absolute offset. Assigns `scrollTop` rather
|
|
187
|
+
* than calling `scrollTo`, so a themed `scroll-behavior: smooth` cannot turn a
|
|
188
|
+
* positioning jump into an animation.
|
|
189
|
+
*/
|
|
190
|
+
scrollTo(top) {
|
|
191
|
+
const element = this.container();
|
|
192
|
+
if (element) {
|
|
193
|
+
element.scrollTop = top;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Take the offset this navigation is going to restore, and cancel the restore.
|
|
198
|
+
*
|
|
199
|
+
* For a host that renders its own scroll position — a virtualizer needs the
|
|
200
|
+
* offset BEFORE it decides which rows to build, so letting the service assign
|
|
201
|
+
* `scrollTop` afterwards would scroll a list that has not been built yet.
|
|
202
|
+
* Returns null when nothing is pending, which is every navigation that is not a
|
|
203
|
+
* back.
|
|
204
|
+
*/
|
|
205
|
+
consumePendingOffset() {
|
|
206
|
+
const offset = this.pendingOffset;
|
|
207
|
+
if (offset === null) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
this.finishRestore();
|
|
211
|
+
return offset;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Optional accelerator: tell the layout the content for this route is in the
|
|
215
|
+
* DOM. Without it the restore still lands — it waits for the container to grow
|
|
216
|
+
* and clamps at the deadline — but a host that knows when its data arrived can
|
|
217
|
+
* end the wait early instead of paying the growth watch.
|
|
218
|
+
*/
|
|
219
|
+
contentReady() {
|
|
220
|
+
if (this.pendingOffset !== null) {
|
|
221
|
+
this.applyClamped(this.pendingOffset);
|
|
222
|
+
this.finishRestore();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
onNavigationStart(event) {
|
|
226
|
+
const wasFirst = this.firstNavigation;
|
|
227
|
+
this.firstNavigation = false;
|
|
228
|
+
if (this.restoreTimeoutMs === null) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
// Save where we are LEAVING from, while the old content is still mounted.
|
|
232
|
+
this.remember(pathOf(this.router.url), this.container()?.scrollTop ?? 0);
|
|
233
|
+
// Armed by a history traversal (back, forward, the mouse side button, Alt+←,
|
|
234
|
+
// an edge swipe — all arrive as popstate), by a host that pushes instead of
|
|
235
|
+
// traversing and says so, or by the first navigation of a reload, where the
|
|
236
|
+
// reader expects the page they left.
|
|
237
|
+
const explicit = this.router.currentNavigation()?.extras.state?.['dsRestoreScroll'] ===
|
|
238
|
+
true;
|
|
239
|
+
const offset = this.recall(pathOf(event.url));
|
|
240
|
+
this.armed =
|
|
241
|
+
offset !== null &&
|
|
242
|
+
(event.navigationTrigger === 'popstate' || explicit || wasFirst);
|
|
243
|
+
this.pendingOffset = this.armed ? offset : null;
|
|
244
|
+
}
|
|
245
|
+
onNavigationEnd() {
|
|
246
|
+
// 'always' resets on navigations `pathChanged` deliberately ignores — a query
|
|
247
|
+
// or fragment step on the same screen. Guarded by `armed` for the same reason
|
|
248
|
+
// the path reset is: a restore about to run must not be undone first.
|
|
249
|
+
if (this.resetStrategy === 'always' && !this.armed) {
|
|
250
|
+
this.scrollToTop();
|
|
251
|
+
}
|
|
252
|
+
if (!this.armed || this.pendingOffset === null) {
|
|
253
|
+
this.armed = false;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.armed = false;
|
|
257
|
+
this.beginRestore(this.pendingOffset);
|
|
258
|
+
}
|
|
259
|
+
beginRestore(target) {
|
|
260
|
+
this.finishRestore(/* keepPending */ true);
|
|
261
|
+
const element = this.container();
|
|
262
|
+
if (!element) {
|
|
263
|
+
this.pendingOffset = null;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const deadline = window.setTimeout(() => {
|
|
267
|
+
// Out of patience: land as close as the content allows rather than not at
|
|
268
|
+
// all. A list that loaded 8 of 40 rows still returns near the reader's row.
|
|
269
|
+
this.applyClamped(target);
|
|
270
|
+
this.finishRestore();
|
|
271
|
+
}, this.restoreTimeoutMs ?? 0);
|
|
272
|
+
const settle = () => {
|
|
273
|
+
if (element.scrollHeight - element.clientHeight >= target) {
|
|
274
|
+
this.scrollTo(target);
|
|
275
|
+
this.finishRestore();
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// The CONTAINER's own box does not change as content arrives — its child's
|
|
279
|
+
// does, which is what makes scrollHeight grow. No fixed frame count: native
|
|
280
|
+
// timing differs between engines, so watch for the growth instead of guessing
|
|
281
|
+
// how many frames it takes.
|
|
282
|
+
const growth = new ResizeObserver(settle);
|
|
283
|
+
growth.observe(element.firstElementChild ?? element);
|
|
284
|
+
const cancel = () => this.finishRestore();
|
|
285
|
+
for (const type of CANCEL_EVENTS) {
|
|
286
|
+
element.addEventListener(type, cancel, { passive: true });
|
|
287
|
+
}
|
|
288
|
+
// A bfcache restore brings its own scroll position back; fighting it would
|
|
289
|
+
// move the page under a reader who never asked.
|
|
290
|
+
const onPageShow = (event) => {
|
|
291
|
+
if (event.persisted) {
|
|
292
|
+
this.finishRestore();
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
window.addEventListener('pageshow', onPageShow);
|
|
296
|
+
this.endRestore = () => {
|
|
297
|
+
growth.disconnect();
|
|
298
|
+
clearTimeout(deadline);
|
|
299
|
+
for (const type of CANCEL_EVENTS) {
|
|
300
|
+
element.removeEventListener(type, cancel);
|
|
301
|
+
}
|
|
302
|
+
window.removeEventListener('pageshow', onPageShow);
|
|
303
|
+
};
|
|
304
|
+
// The content may already be tall enough — a cached list renders synchronously.
|
|
305
|
+
settle();
|
|
306
|
+
}
|
|
307
|
+
applyClamped(target) {
|
|
308
|
+
const element = this.container();
|
|
309
|
+
if (!element) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this.scrollTo(Math.min(target, element.scrollHeight - element.clientHeight));
|
|
313
|
+
}
|
|
314
|
+
finishRestore(keepPending = false) {
|
|
315
|
+
this.endRestore?.();
|
|
316
|
+
this.endRestore = null;
|
|
317
|
+
if (!keepPending) {
|
|
318
|
+
this.pendingOffset = null;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// sessionStorage, not local: a remembered scroll position is worthless in a
|
|
322
|
+
// tab that outlives the visit. Every access is guarded — Safari's private mode
|
|
323
|
+
// throws on write, and a quota error must not take the navigation down with it.
|
|
324
|
+
read() {
|
|
325
|
+
try {
|
|
326
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
327
|
+
return raw ? JSON.parse(raw) : {};
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
return {};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
remember(path, offset) {
|
|
334
|
+
const entries = this.read();
|
|
335
|
+
// Re-insert so the key moves to the end: JSON object order is insertion
|
|
336
|
+
// order, which is what makes the oldest entry droppable below.
|
|
337
|
+
delete entries[path];
|
|
338
|
+
entries[path] = Math.round(offset);
|
|
339
|
+
const keys = Object.keys(entries);
|
|
340
|
+
for (const stale of keys.slice(0, Math.max(0, keys.length - MAX_ENTRIES))) {
|
|
341
|
+
delete entries[stale];
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(entries));
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
// Full or blocked: a lost scroll position is not worth an error.
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
recall(path) {
|
|
351
|
+
const offset = this.read()[path];
|
|
352
|
+
return typeof offset === 'number' && offset > 0 ? offset : null;
|
|
353
|
+
}
|
|
354
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
355
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutScrollService });
|
|
356
|
+
}
|
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: LayoutScrollService, decorators: [{
|
|
358
|
+
type: Injectable
|
|
359
|
+
}], ctorParameters: () => [] });
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Fixed-frame application layout: the host is pinned to the viewport
|
|
363
|
+
* (`100dvh` + `overflow: hidden`) and ONLY the content region scrolls, so
|
|
364
|
+
* the sidenav rail and the topbar stay put on pages taller than the
|
|
365
|
+
* viewport. Consumers project their own chrome into the slots:
|
|
366
|
+
*
|
|
367
|
+
* ```html
|
|
368
|
+
* <ds-app-layout>
|
|
369
|
+
* <ds-sidenav sidenav>…</ds-sidenav>
|
|
370
|
+
* <ds-topbar topbar>…</ds-topbar>
|
|
371
|
+
* <router-outlet />
|
|
372
|
+
* </ds-app-layout>
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* The layout renders the `<main>` landmark itself — do not nest another
|
|
376
|
+
* `<main>` in the content. Scroll-to-top is built in (`LayoutScrollService`)
|
|
377
|
+
* and fires when navigation changes the PATH, so a URL-driven list can page
|
|
378
|
+
* and filter without losing the reader's place; inject the service and call
|
|
379
|
+
* `scrollToTop()` for the changes that do want the top. The content padding
|
|
380
|
+
* auto-compensates the native scrollbar width so the right inset always
|
|
381
|
+
* equals the left one. The layout requires the application router
|
|
382
|
+
* (`provideRouter`) because its scroll-to-top service subscribes to
|
|
383
|
+
* navigation events.
|
|
384
|
+
*
|
|
385
|
+
* Below the `lg` breakpoint the rail becomes a modal overlay driven by
|
|
386
|
+
* `[(railOpen)]`; put the burger wherever the design wants it inside your own
|
|
387
|
+
* projected topbar.
|
|
388
|
+
*/
|
|
389
|
+
class AppLayoutComponent {
|
|
390
|
+
/**
|
|
391
|
+
* `'content'` (default): the rail spans the full viewport height on the
|
|
392
|
+
* left and the topbar sits above the content column only. `'full'`: the
|
|
393
|
+
* topbar spans the full width and the rail + content sit below it.
|
|
394
|
+
*/
|
|
395
|
+
topbarSpan = input('content', ...(ngDevMode ? [{ debugName: "topbarSpan" }] : /* istanbul ignore next */ []));
|
|
396
|
+
/**
|
|
397
|
+
* Whether the rail is open as an overlay. Only meaningful below the `lg`
|
|
398
|
+
* breakpoint — above it the rail is always in the layout and this is
|
|
399
|
+
* ignored. Two-way, so a burger in your topbar can drive it.
|
|
400
|
+
*/
|
|
401
|
+
railOpen = model(false, ...(ngDevMode ? [{ debugName: "railOpen" }] : /* istanbul ignore next */ []));
|
|
402
|
+
/** Accessible name for the rail while it is a modal overlay. */
|
|
403
|
+
railLabel = input('Navigation', ...(ngDevMode ? [{ debugName: "railLabel" }] : /* istanbul ignore next */ []));
|
|
404
|
+
/**
|
|
405
|
+
* Remember the content scroll per path and restore it on the way BACK. Off by
|
|
406
|
+
* default: a layout that silently moved the scroll would surprise every existing
|
|
407
|
+
* consumer. Only a history traversal restores — following a link into a screen
|
|
408
|
+
* still lands at the top — plus a host that pushes its own "back to list" and
|
|
409
|
+
* says so with `state: { dsRestoreScroll: true }`, and the first navigation after
|
|
410
|
+
* a reload.
|
|
411
|
+
*/
|
|
412
|
+
restoreScroll = input(false, { ...(ngDevMode ? { debugName: "restoreScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
413
|
+
/**
|
|
414
|
+
* How long to wait for the restored screen's content to grow tall enough before
|
|
415
|
+
* landing as close as it allows. Only meaningful with `restoreScroll`.
|
|
416
|
+
*/
|
|
417
|
+
restoreScrollTimeout = input(2000, ...(ngDevMode ? [{ debugName: "restoreScrollTimeout" }] : /* istanbul ignore next */ []));
|
|
418
|
+
/**
|
|
419
|
+
* When the content scroll resets to the top. `'path'` (default) is what the
|
|
420
|
+
* layout has always done; `'always'` also resets on a query- or fragment-only
|
|
421
|
+
* navigation, which is what a server-paged list wants; `'never'` hands the
|
|
422
|
+
* decision to the screen, which can still call `LayoutScrollService.scrollToTop()`.
|
|
423
|
+
*
|
|
424
|
+
* It exists because the layout owning the scroll CONTAINER also meant it owned
|
|
425
|
+
* the POLICY: a screen could add a reset but had no way to suppress one.
|
|
426
|
+
*/
|
|
427
|
+
scrollReset = input('path', ...(ngDevMode ? [{ debugName: "scrollReset" }] : /* istanbul ignore next */ []));
|
|
428
|
+
/**
|
|
429
|
+
* True only while the rail is an overlay. Gates the dialog semantics: above
|
|
430
|
+
* the breakpoint the rail is an ordinary region, and a permanent
|
|
431
|
+
* `role="dialog"` there would lie to a screen reader.
|
|
432
|
+
*/
|
|
433
|
+
compact = signal(false, ...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
434
|
+
/** Whether the rail is currently an overlay rather than part of the layout. */
|
|
435
|
+
railOverlay = this.compact.asReadonly();
|
|
436
|
+
/** Id of the rail panel, for a trigger's `aria-controls`. */
|
|
437
|
+
railId = nextControlId('ds-rail');
|
|
438
|
+
layoutScroll = inject(LayoutScrollService);
|
|
439
|
+
navigation = inject(LayoutNavigationService);
|
|
440
|
+
destroyRef = inject(DestroyRef);
|
|
441
|
+
content = viewChild.required('content');
|
|
442
|
+
constructor() {
|
|
443
|
+
// Root service: instantiating it publishes --ds-scrollbar-width.
|
|
444
|
+
inject(ScrollbarWidthService);
|
|
445
|
+
effect(() => {
|
|
446
|
+
this.layoutScroll.configureRestore(this.restoreScroll() ? this.restoreScrollTimeout() : null);
|
|
447
|
+
this.layoutScroll.configureReset(this.scrollReset());
|
|
448
|
+
});
|
|
449
|
+
afterNextRender(() => {
|
|
450
|
+
this.layoutScroll.setScrollContainer(this.content().nativeElement);
|
|
451
|
+
this.watchDesktopBreakpoint();
|
|
452
|
+
});
|
|
453
|
+
// Not closeRail(): navigating is not a dismissal. The reader activated a link,
|
|
454
|
+
// so focus belongs wherever the router put it - handing it back to the burger
|
|
455
|
+
// would announce "Open navigation" instead of the page they asked for.
|
|
456
|
+
this.navigation.pathChanged
|
|
457
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
458
|
+
.subscribe(() => this.railOpen.set(false));
|
|
459
|
+
}
|
|
460
|
+
/** Dismissal: Escape or the scrim. Restores focus, which navigation must not. */
|
|
461
|
+
closeRail() {
|
|
462
|
+
if (!this.railOpen()) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
this.railOpen.set(false);
|
|
466
|
+
if (!this.compact()) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
// cdkTrapFocusAutoCapture returns focus only when the directive is DESTROYED, not when it flips
|
|
470
|
+
// off, so without this the caret stays inside the now off-canvas panel. Whatever control claims
|
|
471
|
+
// the rail through aria-controls owns it — dsRailTrigger and the DS-button forwarding both set it.
|
|
472
|
+
this.content()
|
|
473
|
+
.nativeElement.ownerDocument.querySelector(`[aria-controls="${this.railId}"]`)
|
|
474
|
+
?.focus();
|
|
475
|
+
}
|
|
476
|
+
watchDesktopBreakpoint() {
|
|
477
|
+
// Single source of truth: the stylesheet's media block and this query both
|
|
478
|
+
// resolve to `--bp-lg`. There is deliberately NO literal fallback — one here
|
|
479
|
+
// could disagree with the scale and the rail would flip at a different width
|
|
480
|
+
// than the CSS, silently. A missing value means the DS global styles were
|
|
481
|
+
// never included, which breaks far more than this component, so say so.
|
|
482
|
+
const lg = getComputedStyle(document.documentElement)
|
|
483
|
+
.getPropertyValue('--bp-lg')
|
|
484
|
+
.trim();
|
|
485
|
+
if (!lg) {
|
|
486
|
+
if (isDevMode()) {
|
|
487
|
+
console.error('[ds-app-layout] --bp-lg is not defined, so the responsive rail cannot know its breakpoint and stays in desktop layout. Include the DS global styles (@use "…/styles/ds") — or, à la carte, the partial that emits the breakpoint vars.');
|
|
488
|
+
}
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const desktop = window.matchMedia(`(width >= ${lg})`);
|
|
492
|
+
const sync = () => {
|
|
493
|
+
this.compact.set(!desktop.matches);
|
|
494
|
+
// Crossing UP drops the overlay state: leaving it set would re-open the
|
|
495
|
+
// rail unprompted the next time the viewport narrows. Set the model
|
|
496
|
+
// directly rather than calling closeRail(), whose focus restore has no
|
|
497
|
+
// business firing here - the trigger it would focus is hidden on desktop.
|
|
498
|
+
if (desktop.matches) {
|
|
499
|
+
this.railOpen.set(false);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
sync();
|
|
503
|
+
desktop.addEventListener('change', sync);
|
|
504
|
+
this.destroyRef.onDestroy(() => desktop.removeEventListener('change', sync));
|
|
505
|
+
}
|
|
506
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AppLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
507
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.22", type: AppLayoutComponent, isStandalone: true, selector: "ds-app-layout", inputs: { topbarSpan: { classPropertyName: "topbarSpan", publicName: "topbarSpan", isSignal: true, isRequired: false, transformFunction: null }, railOpen: { classPropertyName: "railOpen", publicName: "railOpen", isSignal: true, isRequired: false, transformFunction: null }, railLabel: { classPropertyName: "railLabel", publicName: "railLabel", isSignal: true, isRequired: false, transformFunction: null }, restoreScroll: { classPropertyName: "restoreScroll", publicName: "restoreScroll", isSignal: true, isRequired: false, transformFunction: null }, restoreScrollTimeout: { classPropertyName: "restoreScrollTimeout", publicName: "restoreScrollTimeout", isSignal: true, isRequired: false, transformFunction: null }, scrollReset: { classPropertyName: "scrollReset", publicName: "scrollReset", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { railOpen: "railOpenChange" }, host: { listeners: { "document:keydown.escape": "closeRail()" }, properties: { "class.app-layout": "true", "class.topbar-full": "topbarSpan() === 'full'", "class.rail-open": "railOpen()" } }, providers: [LayoutScrollService], viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- scrim; click dismisses, keyboard dismisses via Escape (host document:keydown.escape) -->\n<div\n class=\"scrim\"\n [class.open]=\"railOpen()\"\n (click)=\"closeRail()\"\n>\n</div>\n\n<div\n class=\"rail\"\n [class.open]=\"railOpen()\"\n [id]=\"railId\"\n [attr.role]=\"compact() ? 'dialog' : null\"\n [attr.aria-modal]=\"compact() ? 'true' : null\"\n [attr.aria-label]=\"compact() ? railLabel() : null\"\n [attr.inert]=\"compact() && !railOpen() ? '' : null\"\n [cdkTrapFocus]=\"compact() && railOpen()\"\n [cdkTrapFocusAutoCapture]=\"compact() && railOpen()\"\n>\n <ng-content select=\"[sidenav]\"></ng-content>\n</div>\n\n<div class=\"bar\">\n <ng-content select=\"[topbar]\"></ng-content>\n</div>\n\n<main\n #content\n class=\"content\"\n tabindex=\"-1\"\n>\n <div class=\"inner\">\n <ng-content></ng-content>\n </div>\n</main>\n", styles: [":host{--_layout-pad-x: var(--ds-app-layout-pad-x, var(--space-6));--_layout-pad-y: var(--ds-app-layout-pad-y, var(--space-6));--_layout-content-max-width: var(--ds-app-layout-content-max-width, none);--_layout-rail-bg-color: var(--ds-app-layout-rail-bg-color, var(--surface-overlay));--_layout-rail-shadow: var(--ds-app-layout-rail-shadow, var(--ds-elevation-modal));--_layout-scrim-color: var(--ds-app-layout-scrim-color, var(--scrim, hsl(220deg 20% 12% / 45%)));display:grid;grid-template-areas:\"sidenav topbar\" \"sidenav content\";grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;height:var(--ds-app-layout-height, 100dvh);position:relative;isolation:isolate;overflow:hidden}:host(.topbar-full){grid-template-areas:\"topbar topbar\" \"sidenav content\"}.rail{display:grid;grid-area:sidenav;overflow-y:auto}@media(width<1024px){.rail{position:absolute;z-index:var(--layer-drawer);top:0;bottom:0;left:0;background:var(--_layout-rail-bg-color);box-shadow:var(--_layout-rail-shadow);transform:translate(-100%);transition:transform var(--duration-base) var(--ease-standard)}.rail.open{transform:translate(0)}}.scrim{display:none}@media(width<1024px){.scrim{display:block;position:absolute;z-index:calc(var(--layer-drawer) - 1);inset:0;background:var(--_layout-scrim-color);opacity:0;transition:opacity var(--duration-base) var(--ease-standard),visibility var(--duration-base) var(--ease-standard);visibility:hidden}.scrim.open{opacity:1;visibility:visible}}.bar{display:grid;grid-area:topbar}.content{grid-area:content;padding:var(--_layout-pad-y) var(--_layout-pad-x);padding-right:calc(var(--_layout-pad-x) - var(--ds-scrollbar-width, 0px));overflow:auto;scrollbar-gutter:stable}.inner{max-width:var(--_layout-content-max-width);margin-inline:auto}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
508
|
+
}
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AppLayoutComponent, decorators: [{
|
|
510
|
+
type: Component,
|
|
511
|
+
args: [{ selector: 'ds-app-layout', standalone: true, imports: [A11yModule], encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
512
|
+
'[class.app-layout]': 'true',
|
|
513
|
+
'[class.topbar-full]': "topbarSpan() === 'full'",
|
|
514
|
+
'[class.rail-open]': 'railOpen()',
|
|
515
|
+
'(document:keydown.escape)': 'closeRail()',
|
|
516
|
+
}, providers: [LayoutScrollService], template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- scrim; click dismisses, keyboard dismisses via Escape (host document:keydown.escape) -->\n<div\n class=\"scrim\"\n [class.open]=\"railOpen()\"\n (click)=\"closeRail()\"\n>\n</div>\n\n<div\n class=\"rail\"\n [class.open]=\"railOpen()\"\n [id]=\"railId\"\n [attr.role]=\"compact() ? 'dialog' : null\"\n [attr.aria-modal]=\"compact() ? 'true' : null\"\n [attr.aria-label]=\"compact() ? railLabel() : null\"\n [attr.inert]=\"compact() && !railOpen() ? '' : null\"\n [cdkTrapFocus]=\"compact() && railOpen()\"\n [cdkTrapFocusAutoCapture]=\"compact() && railOpen()\"\n>\n <ng-content select=\"[sidenav]\"></ng-content>\n</div>\n\n<div class=\"bar\">\n <ng-content select=\"[topbar]\"></ng-content>\n</div>\n\n<main\n #content\n class=\"content\"\n tabindex=\"-1\"\n>\n <div class=\"inner\">\n <ng-content></ng-content>\n </div>\n</main>\n", styles: [":host{--_layout-pad-x: var(--ds-app-layout-pad-x, var(--space-6));--_layout-pad-y: var(--ds-app-layout-pad-y, var(--space-6));--_layout-content-max-width: var(--ds-app-layout-content-max-width, none);--_layout-rail-bg-color: var(--ds-app-layout-rail-bg-color, var(--surface-overlay));--_layout-rail-shadow: var(--ds-app-layout-rail-shadow, var(--ds-elevation-modal));--_layout-scrim-color: var(--ds-app-layout-scrim-color, var(--scrim, hsl(220deg 20% 12% / 45%)));display:grid;grid-template-areas:\"sidenav topbar\" \"sidenav content\";grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;height:var(--ds-app-layout-height, 100dvh);position:relative;isolation:isolate;overflow:hidden}:host(.topbar-full){grid-template-areas:\"topbar topbar\" \"sidenav content\"}.rail{display:grid;grid-area:sidenav;overflow-y:auto}@media(width<1024px){.rail{position:absolute;z-index:var(--layer-drawer);top:0;bottom:0;left:0;background:var(--_layout-rail-bg-color);box-shadow:var(--_layout-rail-shadow);transform:translate(-100%);transition:transform var(--duration-base) var(--ease-standard)}.rail.open{transform:translate(0)}}.scrim{display:none}@media(width<1024px){.scrim{display:block;position:absolute;z-index:calc(var(--layer-drawer) - 1);inset:0;background:var(--_layout-scrim-color);opacity:0;transition:opacity var(--duration-base) var(--ease-standard),visibility var(--duration-base) var(--ease-standard);visibility:hidden}.scrim.open{opacity:1;visibility:visible}}.bar{display:grid;grid-area:topbar}.content{grid-area:content;padding:var(--_layout-pad-y) var(--_layout-pad-x);padding-right:calc(var(--_layout-pad-x) - var(--ds-scrollbar-width, 0px));overflow:auto;scrollbar-gutter:stable}.inner{max-width:var(--_layout-content-max-width);margin-inline:auto}\n"] }]
|
|
517
|
+
}], ctorParameters: () => [], propDecorators: { topbarSpan: [{ type: i0.Input, args: [{ isSignal: true, alias: "topbarSpan", required: false }] }], railOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "railOpen", required: false }] }, { type: i0.Output, args: ["railOpenChange"] }], railLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "railLabel", required: false }] }], restoreScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "restoreScroll", required: false }] }], restoreScrollTimeout: [{ type: i0.Input, args: [{ isSignal: true, alias: "restoreScrollTimeout", required: false }] }], scrollReset: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollReset", required: false }] }], content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Wires a consumer's own burger to the layout's overlay rail: toggles
|
|
521
|
+
* `[(railOpen)]` on click and keeps `aria-expanded` / `aria-controls` in sync, so
|
|
522
|
+
* the trigger and the panel are related for a screen reader.
|
|
523
|
+
*
|
|
524
|
+
* ```html
|
|
525
|
+
* <ds-app-layout>
|
|
526
|
+
* <ds-topbar topbar>
|
|
527
|
+
* <button dsRailTrigger type="button" aria-label="Navigation">☰</button>
|
|
528
|
+
* </ds-topbar>
|
|
529
|
+
* </ds-app-layout>
|
|
530
|
+
* ```
|
|
531
|
+
*
|
|
532
|
+
* PUT IT ON THE FOCUSABLE CONTROL, not on a wrapper: the attributes go on the
|
|
533
|
+
* host element, and on `<ds-icon-button>` that is the wrapper, whose inner
|
|
534
|
+
* `<button>` is what a screen reader actually reads. With a DS button, skip this
|
|
535
|
+
* directive and bind its forwarding inputs instead —
|
|
536
|
+
* `[ariaExpanded]="layout.railOverlay() ? layout.railOpen() : null"` and
|
|
537
|
+
* `[ariaControls]="layout.railId"` off a `<ds-app-layout #layout>` template ref.
|
|
538
|
+
*
|
|
539
|
+
* Both attributes are dropped while the rail is NOT an overlay: above the
|
|
540
|
+
* breakpoint the rail is permanently in the layout, so `aria-expanded="false"`
|
|
541
|
+
* would state the opposite of what the user sees.
|
|
542
|
+
*
|
|
543
|
+
* Must sit inside a `ds-app-layout` — the injector walks the declaration tree, so
|
|
544
|
+
* anywhere in the projected chrome works. Outside one, DI fails naming
|
|
545
|
+
* `AppLayoutComponent`, which says what is missing.
|
|
546
|
+
*/
|
|
547
|
+
class RailTriggerDirective {
|
|
548
|
+
layout = inject(AppLayoutComponent);
|
|
549
|
+
toggle() {
|
|
550
|
+
this.layout.railOpen.update((open) => !open);
|
|
551
|
+
}
|
|
552
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: RailTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
553
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: RailTriggerDirective, isStandalone: true, selector: "[dsRailTrigger]", host: { listeners: { "click": "toggle()" }, properties: { "attr.aria-expanded": "layout.railOverlay() ? layout.railOpen() : null", "attr.aria-controls": "layout.railOverlay() ? layout.railId : null" } }, ngImport: i0 });
|
|
554
|
+
}
|
|
555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: RailTriggerDirective, decorators: [{
|
|
556
|
+
type: Directive,
|
|
557
|
+
args: [{
|
|
558
|
+
selector: '[dsRailTrigger]',
|
|
559
|
+
standalone: true,
|
|
560
|
+
host: {
|
|
561
|
+
'[attr.aria-expanded]': 'layout.railOverlay() ? layout.railOpen() : null',
|
|
562
|
+
'[attr.aria-controls]': 'layout.railOverlay() ? layout.railId : null',
|
|
563
|
+
'(click)': 'toggle()',
|
|
564
|
+
},
|
|
565
|
+
}]
|
|
566
|
+
}] });
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Generated bundle index. Do not edit.
|
|
570
|
+
*/
|
|
571
|
+
|
|
572
|
+
export { AppLayoutComponent, LayoutNavigationService, LayoutScrollService, RailTriggerDirective };
|
|
573
|
+
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-app-layout.mjs.map
|