| 38 | styleUrls: ['./navigation.component.scss', './mini-menu.scss', './nav-item.scss'], |
| 39 | }) |
| 40 | export class Navigation { |
| 41 | private readonly document = inject(DOCUMENT); |
| 42 | private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID)); |
| 43 | private readonly navigationState = inject(NavigationState); |
| 44 | private readonly router = inject(Router); |
| 45 | private readonly location = inject(Location); |
| 46 | private readonly themeManager = inject(ThemeManager); |
| 47 | private readonly isSearchDialogOpen = inject(IS_SEARCH_DIALOG_OPEN); |
| 48 | private readonly versionManager = inject(VersionManager); |
| 49 | |
| 50 | protected PAGE_PREFIX = PAGE_PREFIX; |
| 51 | protected ngLinks = ANGULAR_LINKS; |
| 52 | protected readonly PRIMARY_NAV_ID = PRIMARY_NAV_ID; |
| 53 | protected readonly SECONDARY_NAV_ID = SECONDARY_NAV_ID; |
| 54 | protected readonly SEARCH_DIALOG_ID = SEARCH_DIALOG_ID; |
| 55 | |
| 56 | // We can't use the ActivatedRouter queryParams as we're outside the router outlet |
| 57 | protected readonly isUwu = 'location' in globalThis ? location.search.includes('uwu') : false; |
| 58 | |
| 59 | protected miniMenuPositions = [ |
| 60 | new ConnectionPositionPair( |
| 61 | {originX: 'end', originY: 'center'}, |
| 62 | {overlayX: 'start', overlayY: 'center'}, |
| 63 | ), |
| 64 | new ConnectionPositionPair( |
| 65 | {originX: 'end', originY: 'top'}, |
| 66 | {overlayX: 'start', overlayY: 'top'}, |
| 67 | ), |
| 68 | ]; |
| 69 | protected bottomMiniMenuPositions: ConnectedPosition[] = [ |
| 70 | new ConnectionPositionPair( |
| 71 | {originX: 'end', originY: 'bottom'}, |
| 72 | {overlayX: 'start', overlayY: 'bottom'}, |
| 73 | ), |
| 74 | ]; |
| 75 | |
| 76 | readonly APPLE_SEARCH_LABEL = `⌘`; |
| 77 | readonly DEFAULT_SEARCH_LABEL = `ctrl`; |
| 78 | |
| 79 | readonly activeRouteItem = this.navigationState.primaryActiveRouteItem; |
| 80 | protected readonly theme = this.themeManager.theme; |
| 81 | protected readonly openedMenu = signal<MenuType | null>(null); |
| 82 | |
| 83 | protected readonly currentDocsVersion = this.versionManager.currentDocsVersion; |
| 84 | protected readonly currentDocsVersionMode = this.versionManager.currentDocsVersionMode; |
| 85 | |
| 86 | // Set the values of the search label and title only on the client, because the label is user-agent specific. |
| 87 | protected searchLabel = this.isBrowser |
| 88 | ? isApple |
| 89 | ? this.APPLE_SEARCH_LABEL |
| 90 | : this.DEFAULT_SEARCH_LABEL |
| 91 | : ''; |
| 92 | protected searchTitle = this.isBrowser |
| 93 | ? isApple |
| 94 | ? `${COMMAND} ${SEARCH_TRIGGER_KEY.toUpperCase()}` |
| 95 | : `${CONTROL} ${SEARCH_TRIGGER_KEY.toUpperCase()}` |
| 96 | : ''; |
| 97 | protected versions = this.versionManager.versions; |
nothing calls this directly
no test coverage detected