import { InjectionToken, makeStateKey } from '@angular/core'; import type { ChangeLine } from './recent-changes.component'; /** * Each tool's newest published What's new lines, and how many published * lines came from a visitor's suggestion, as they were at the last deploy * (scripts/snapshot-changes.mjs writes recent-snapshot.json). Provided only * to the prerender pass (app.config.server.ts), so the browser bundle never * carries the whole file: what one page shows goes to the browser in that * page's TransferState. */ export interface RecentSnapshot { /** Published lines marked "Suggested by a visitor". */ suggested: number; /** Tool path to its newest lines, newest first (at most RECENT_LINES). */ tools: Record; } export const RECENT_SNAPSHOT = new InjectionToken('RECENT_SNAPSHOT'); /** Lines shown under a tool's notes. scripts/snapshot-changes.mjs keeps the same number. */ export const RECENT_LINES = 5; /** A tool's lines as prerendered, for the browser to start from. */ export const recentKey = (tool: string) => makeStateKey(`recent-changes:${tool}`);