The locale lived only in LocaleProvider state, so every remount (reload, or the scope fence after a session change) started again from ko-KR. The theme already persisted through preferences.setColorScheme; the locale now uses the same path (D-5): - contracts/storage-keys.ts: LOCALE key next to COLOR_SCHEME (localStorage, public-preference, opaque-string-v1). - application preferences port: additive getLocale()/setLocale(). The application treats the tag as opaque; presentation owns the locale list and normalizes what it reads back. - LocaleProvider: optional onLocaleChange; the provider stays storage-free so standalone uses and tests are unchanged. - AppRouter mounts LocaleProvider from the stored locale and persists changes (T46 moves this above the scope fence). Verified: RED "stores the chosen locale and starts the next mount from it" failed before (nothing written to LOCALE) and passes after. check:architecture, check:types:app, check:types:test, lint, test:component pass; check:registries PASS (compatibility unchanged from baseline); test:unit passes except the pre-existing removal-fixture test (needs generated artifacts/ files absent from a fresh worktree). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
96 lines
3.2 KiB
TypeScript
96 lines
3.2 KiB
TypeScript
import type { SessionState } from "../auth-session-port.ts";
|
|
import type { ProductFeatureStatus } from "../product-features-port.ts";
|
|
import type { RuntimeCapabilitySnapshot } from "../runtime-capabilities-port.ts";
|
|
import type { StoragePort } from "../storage-port.ts";
|
|
|
|
export type { SessionState } from "../auth-session-port.ts";
|
|
export type { ProductFeatureStatus };
|
|
export type { RuntimeCapabilitySnapshot };
|
|
|
|
/**
|
|
* Features add their driving API through module augmentation. The application
|
|
* owns the registry contract without importing any concrete feature.
|
|
*/
|
|
export interface ApplicationFeatureInputs {}
|
|
|
|
export type ApplicationFeatureId = Extract<
|
|
keyof ApplicationFeatureInputs,
|
|
string
|
|
>;
|
|
|
|
export type ColorSchemePreference = "system" | "light" | "dark";
|
|
|
|
export type RenderFailureReport = Readonly<{
|
|
routeId: string;
|
|
buildId: string;
|
|
boundaryName: "route" | "feature";
|
|
}>;
|
|
|
|
export type RouteChangedReport = Readonly<{
|
|
routeId: string;
|
|
buildId: string;
|
|
}>;
|
|
|
|
export type ReleaseSummary = Readonly<{
|
|
buildId: string;
|
|
releaseId: string;
|
|
configSchemaVersion: string;
|
|
/** Legacy V1 scalar; absent once the release manifest is V2. */
|
|
apiContractVersion?: string;
|
|
/** §5.2 contract set identity for a V2 release manifest. */
|
|
contractSetDigest?: string;
|
|
}>;
|
|
|
|
export type ApplicationApi = Readonly<{
|
|
session: Readonly<{
|
|
getSnapshot(): SessionState;
|
|
subscribe(listener: () => void): () => void;
|
|
beginSignIn(returnTo?: string): Promise<void>;
|
|
signOut(): Promise<void>;
|
|
recover(): Promise<"restored" | "no-session">;
|
|
}>;
|
|
preferences: Readonly<{
|
|
getColorScheme(): ColorSchemePreference;
|
|
setColorScheme(
|
|
preference: ColorSchemePreference,
|
|
): ReturnType<StoragePort["write"]>;
|
|
/** The stored locale tag, unvalidated; presentation owns the locale list. */
|
|
getLocale(): string | undefined;
|
|
setLocale(locale: string): ReturnType<StoragePort["write"]>;
|
|
}>;
|
|
diagnostics: Readonly<{
|
|
reportRenderFailure(report: RenderFailureReport): void;
|
|
reportRouteChanged(report: RouteChangedReport): void;
|
|
}>;
|
|
runtime: Readonly<{
|
|
getReleaseSummary(): Promise<ReleaseSummary>;
|
|
/**
|
|
* §3.5. The static selection reduced by the runtime overrides. Presentation
|
|
* reads capability state here instead of importing the composition root.
|
|
*/
|
|
getCapabilitySnapshot(): RuntimeCapabilitySnapshot;
|
|
/**
|
|
* §3.5. Which product features this build contains and which of them the
|
|
* runtime document switched off. Presentation reads state here; it never
|
|
* learns how to reach a feature the build left out.
|
|
*/
|
|
getFeatureSnapshot(): readonly ProductFeatureStatus[];
|
|
isFeatureActive(featureId: string): boolean;
|
|
}>;
|
|
recovery: Readonly<{
|
|
recoverChunk(input: Readonly<{
|
|
chunkId: string;
|
|
failureKind: "CHUNK_LOAD_FAILURE" | "DEPLOY_MISMATCH";
|
|
}>): Promise<
|
|
| Readonly<{ action: "reload-once"; releasePair: string }>
|
|
| Readonly<{ action: "support"; reason: string }>
|
|
>;
|
|
}>;
|
|
features: Readonly<{
|
|
has(featureId: string): featureId is ApplicationFeatureId;
|
|
get<FeatureId extends ApplicationFeatureId>(
|
|
featureId: FeatureId,
|
|
): ApplicationFeatureInputs[FeatureId];
|
|
}>;
|
|
}>;
|