feat: gallery + generic blueprint viewer, add Grid blueprint
Refactor the List-specific screen into a data-driven, reusable viewer: - generic Blueprint type + shared LoadState machine + registry - vue-router: / (gallery) and /b/:slug (illustration) - BlueprintViewer renders any blueprint; specimens stay bespoke - add Grid blueprint (6 functions incl. Position) + GridSpecimen
This commit is contained in:
26
src/data/blueprints.ts
Normal file
26
src/data/blueprints.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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 ListSpecimen from "@/specimens/ListSpecimen.vue"
|
||||
import GridSpecimen from "@/specimens/GridSpecimen.vue"
|
||||
|
||||
export interface RegistryEntry {
|
||||
blueprint: Blueprint
|
||||
specimen: Component
|
||||
}
|
||||
|
||||
export const REGISTRY: Record<string, RegistryEntry> = {
|
||||
list: { blueprint: list, specimen: ListSpecimen },
|
||||
grid: { blueprint: grid, specimen: GridSpecimen },
|
||||
}
|
||||
|
||||
export const BLUEPRINTS: Blueprint[] = Object.values(REGISTRY).map((e) => e.blueprint)
|
||||
|
||||
export function entryFor(slug: string): RegistryEntry | undefined {
|
||||
return REGISTRY[slug]
|
||||
}
|
||||
Reference in New Issue
Block a user