fix: make nightdrive signage reliable and legible

This commit is contained in:
2026-09-03 17:07:00 +03:00
parent 4404c07f93
commit b075041918
50 changed files with 4435 additions and 200 deletions

View File

@@ -9,6 +9,7 @@ export interface NavigationState {
epoch: number;
source: JourneySource;
destinationId: SectionId | null;
signDestinationId: SectionId | null;
}
export interface NavigationRuntime {
@@ -28,7 +29,11 @@ export interface NavigationRuntime {
}
export interface NavigationController {
navigate(id: SectionId, target: HTMLElement): number;
navigate(
id: SectionId,
target: HTMLElement,
options?: { requestSign?: boolean },
): number;
noteUserScrollIntent(): number;
notePassiveSection(id: SectionId): void;
initialize(id: SectionId, target: HTMLElement): number;
@@ -118,6 +123,7 @@ export function createNavigationController(
epoch: 0,
source: "initial",
destinationId: null,
signDestinationId: null,
};
const subscribers = new Set<(state: NavigationState) => void>();
let frameId: number | undefined;
@@ -159,12 +165,14 @@ export function createNavigationController(
const beginEpoch = (
source: JourneySource,
destinationId: SectionId | null,
signDestinationId: SectionId | null = null,
): number => {
cancelPending();
currentState = {
epoch: currentState.epoch + 1,
source,
destinationId,
signDestinationId,
};
if (TEST_BUILD)
window.__PORTFOLIO_PERFORMANCE__?.noteNavigationEpoch(currentState.epoch);
@@ -292,9 +300,13 @@ export function createNavigationController(
};
return {
navigate(id, target) {
navigate(id, target, options) {
requireTarget(id, target);
const epoch = beginEpoch("explicit-navigation", id);
const epoch = beginEpoch(
"explicit-navigation",
id,
options?.requestSign === true ? id : null,
);
if (canonicalSectionIdFromHash(runtime.getHash(), canonicalIds) !== id) {
runtime.pushHash(`#${id}`);
}