The primary-auth feature RememberMe composes onto. Transcribed from the ontology password-auth README + .als: the full AuthState lifecycle (Idle / Submitting / Authenticated / Refreshing / LockedOut / Error), its 8 functions, and a sign-in specimen shown across those states. Adds the auth transition kinds and wraps the state-machine legend to a second row so this richer machine's kinds fit without clipping.
48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
// Registry: the single source the router and Gallery both read from. A blueprint
|
|
// appears in the app precisely when it is registered here — pairing its typed data
|
|
// with its bespoke Specimen component.
|
|
|
|
import type { Component } from "vue"
|
|
import type { Blueprint } from "./blueprint"
|
|
import { list } from "./listBlueprint"
|
|
import { grid } from "./gridBlueprint"
|
|
import { calendar } from "./calendarBlueprint"
|
|
import { rememberMe } from "./rememberMeBlueprint"
|
|
import { passwordAuth } from "./passwordAuthBlueprint"
|
|
import ListSpecimen from "@/specimens/ListSpecimen.vue"
|
|
import GridSpecimen from "@/specimens/GridSpecimen.vue"
|
|
import CalendarSpecimen from "@/specimens/CalendarSpecimen.vue"
|
|
import RememberMeSpecimen from "@/specimens/RememberMeSpecimen.vue"
|
|
import PasswordAuthSpecimen from "@/specimens/PasswordAuthSpecimen.vue"
|
|
|
|
export interface RegistryEntry {
|
|
blueprint: Blueprint
|
|
specimen: Component
|
|
}
|
|
|
|
export const REGISTRY: Record<string, RegistryEntry> = {
|
|
list: { blueprint: list, specimen: ListSpecimen },
|
|
grid: { blueprint: grid, specimen: GridSpecimen },
|
|
calendar: { blueprint: calendar, specimen: CalendarSpecimen },
|
|
"password-auth": { blueprint: passwordAuth, specimen: PasswordAuthSpecimen },
|
|
"remember-me": { blueprint: rememberMe, specimen: RememberMeSpecimen },
|
|
}
|
|
|
|
export const BLUEPRINTS: Blueprint[] = Object.values(REGISTRY).map((e) => e.blueprint)
|
|
|
|
export function entryFor(slug: string): RegistryEntry | undefined {
|
|
return REGISTRY[slug]
|
|
}
|
|
|
|
// Resolve a blueprint's display name (as used in `extendsName` / `related`) to its
|
|
// slug, so cross-references between blueprints render as live links. Returns
|
|
// undefined when the referenced blueprint is not illustrated yet — the reference
|
|
// then renders as plain text.
|
|
const slugByName: Record<string, string> = Object.fromEntries(
|
|
Object.entries(REGISTRY).map(([slug, e]) => [e.blueprint.name, slug]),
|
|
)
|
|
|
|
export function slugForName(name: string | undefined): string | undefined {
|
|
return name ? slugByName[name] : undefined
|
|
}
|