AI media harness for planning, generating, and editing locally
TypeScript
Expand reference presets
Bitti431c1916df91
diff --git a/src/components/workspace/ReferencesView.test.tsx b/src/components/workspace/ReferencesView.test.tsxnew file mode 100644index 0000000..d5e1d2d--- /dev/null+++ b/src/components/workspace/ReferencesView.test.tsx@@ -0,0 +1,95 @@+// @vitest-environment jsdom++import "@testing-library/jest-dom/vitest";+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";+import { useState } from "react";+import { afterEach, describe, expect, it } from "vitest";+import { createProjectConfig, parseProjectConfig, type ProjectConfig } from "../../lib/project";+import { ReferencesView } from "./ReferencesView";++afterEach(cleanup);++const project = (): ProjectConfig => {+ const base = createProjectConfig({+ name: "Reference presets",+ prompt: "A short character film",+ aspectRatio: "16:9",+ resolution: "1080p",+ targetDurationSeconds: 20,+ });+ return parseProjectConfig({+ ...base,+ references: [{+ id: "ref-hero",+ kind: "text",+ name: "Hero",+ description: "A traveler with a weathered red coat.",+ content: "A traveler with a weathered red coat.",+ intendedUse: [],+ createdAt: base.createdAt,+ }],+ });+};++function setup() {+ let latest = project();+ function Harness() {+ const [config, setConfig] = useState(latest);+ latest = config;+ return <ReferencesView config={config} folderPath="C:\\project" onChange={setConfig} />;+ }+ render(<Harness />);+ return { latest: () => latest };+}++describe("Reference type presets", () => {+ it("shows one Type control without the old explanatory copy", () => {+ setup();+ expect(screen.getByRole("heading", { name: "Type" })).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Custom" })).toBeInTheDocument();+ expect(screen.queryByText("Intended use")).not.toBeInTheDocument();+ expect(screen.queryByText(/Select any that apply/)).not.toBeInTheDocument();+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue("A traveler with a weathered red coat.");+ });++ it("chooses one prepared character from the scalable popup", () => {+ const state = setup();+ fireEvent.click(screen.getByRole("button", { name: "Custom" }));+ const dialog = screen.getByRole("dialog", { name: "Choose a reference type" });+ fireEvent.click(within(dialog).getByRole("button", { name: "Character" }));+ const groups = within(dialog).getByRole("group", { name: "Character subcategories" });+ expect(within(groups).getByRole("button", { name: "Film" })).toBeInTheDocument();+ expect(within(groups).getByRole("button", { name: "Television" })).toBeInTheDocument();+ expect(within(groups).getByRole("button", { name: "Public figures" })).toBeInTheDocument();+ fireEvent.click(within(groups).getByRole("button", { name: "Television" }));+ expect(within(dialog).getByRole("button", { name: /Sherlock Holmes · Benedict Cumberbatch/ })).toBeInTheDocument();+ fireEvent.click(within(dialog).getByRole("button", { name: /Sherlock Holmes · Benedict Cumberbatch/ }));++ const reference = state.latest().references[0];+ expect(reference.intendedUse).toEqual(["character"]);+ expect(reference.description).toBe("Sherlock Holmes, Benedict Cumberbatch portrayal.");+ expect(screen.queryByRole("textbox", { name: "Prompt" })).not.toBeInTheDocument();+ expect(screen.getByText("Sherlock Holmes · Benedict Cumberbatch")).toBeInTheDocument();+ });++ it("searches location templates and can return to a custom prompt", () => {+ const state = setup();+ fireEvent.click(screen.getByRole("button", { name: "Custom" }));+ const dialog = screen.getByRole("dialog", { name: "Choose a reference type" });+ fireEvent.click(within(dialog).getByRole("button", { name: "Location" }));+ const groups = within(dialog).getByRole("group", { name: "Location subcategories" });+ fireEvent.click(within(groups).getByRole("button", { name: "Sci-fi" }));+ fireEvent.change(within(dialog).getByRole("textbox", { name: "Search reference options" }), { target: { value: "lunar" } });+ expect(within(dialog).getByRole("button", { name: /Lunar research base/ })).toBeInTheDocument();+ expect(within(dialog).queryByRole("button", { name: /Victorian manor/ })).not.toBeInTheDocument();+ fireEvent.click(within(dialog).getByRole("button", { name: /Lunar research base/ }));++ fireEvent.click(screen.getByRole("button", { name: "Location" }));+ const reopened = screen.getByRole("dialog", { name: "Choose a reference type" });+ fireEvent.click(within(reopened).getByRole("button", { name: "Custom" }));+ fireEvent.click(within(reopened).getByRole("button", { name: "Use Custom" }));++ expect(state.latest().references[0].intendedUse).toEqual([]);+ expect(screen.getByRole("textbox", { name: "Prompt" })).toHaveValue("White lunar base under harsh sunlight.");+ });+});diff --git a/src/components/workspace/ReferencesView.tsx b/src/components/workspace/ReferencesView.tsxindex d277d34..6bfb622 100644--- a/src/components/workspace/ReferencesView.tsx+++ b/src/components/workspace/ReferencesView.tsx@@ -1,19 +1,19 @@-import { BookOpen, Check, FileText, Image, Link2, Plus, Trash2, Upload, Users } from "lucide-react";+import { BookOpen, ChevronRight, FileText, Image, Link2, Plus, Search, Trash2, Upload, Users, X } from "lucide-react";import { invoke } from "@tauri-apps/api/core";import { useMemo, useState } from "react";import { isReferenceDescribed, type ProjectConfig, type ProjectReference } from "../../lib/project";+import {+ REFERENCE_PRESETS,+ REFERENCE_TYPES,+ referenceType,+ referenceTypeLabel,+ selectedReferencePreset,+ type ReferencePreset,+ type ReferenceType,+} from "../../lib/reference-presets";import { isTauri } from "../../lib/persistence";import { ReferenceImage } from "./ReferenceImage";-type ReferenceUse = ProjectReference["intendedUse"][number];--/* No "audio" here on purpose: references in this app are visual only. Images are- the only assets sent to the video engine, and the H3 prompt's two audio fields- (overall_soundscape, non_diegetic_music) are not reference-driven — so an- audio tag promised a route that never existed. It stays in the zod enum so- projects saved with it still load. */-const uses: readonly ReferenceUse[] = ["character", "product", "location", "style"];-/** What a reference IS, in a word. This replaced the file path in both places* it used to be printed: a path is a fact about the disk, not about the* reference, and neither the card nor the inspector does anything with it. */@@ -26,11 +26,11 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Projeconst [definitionName, setDefinitionName] = useState("Visual style reference");const [definitionDescription, setDefinitionDescription] = useState("");const [importError, setImportError] = useState<string | null>(null);+ const [presetDialog, setPresetDialog] = useState(false);+ const [pickerType, setPickerType] = useState<ReferenceType>("custom");+ const [pickerSubcategory, setPickerSubcategory] = useState("all");+ const [presetSearch, setPresetSearch] = useState("");const selected = config.references.find((ref) => ref.id === selectedId);- // A reference saved before the audio tag was withdrawn still carries it, so- // keep the chip on that one reference — it can be seen and cleared, never- // added fresh.- const useOptions: readonly ReferenceUse[] = selected?.intendedUse.includes("audio") ? [...uses, "audio"] : uses;const jobs = useMemo(() => config.generationJobs.filter((job) => job.referenceIds.includes(selectedId ?? "")), [config.generationJobs, selectedId]);const update = (id: string, patch: Partial<ProjectReference>) => onChange({ ...config, references: config.references.map((ref) => ref.id === id ? { ...ref, ...patch } : ref) });// Starts empty on purpose. Seeding it with the instruction text meant an@@ -38,7 +38,7 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje// user had written it. The guidance lives in the field's placeholder instead.const addTextReference = (name = "New definition", description = "") => {const id = `ref-${Date.now()}`;- const reference: ProjectReference = { id, kind: "text", name, description, content: description || null, intendedUse: ["style"], createdAt: new Date().toISOString() };+ const reference: ProjectReference = { id, kind: "text", name, description, content: description || null, intendedUse: [], createdAt: new Date().toISOString() };onChange({ ...config, references: [reference, ...config.references] });setSelectedId(id);};@@ -57,7 +57,7 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje// note here ("Visual reference copied into this portable project.") was// shipped to the model as if they had written it. The card says the// definition is missing instead of faking one.- const reference: ProjectReference = { id, kind: "image", name: imported.name, description: "", relativePath: imported.relativePath, intendedUse: ["style"], createdAt: new Date().toISOString() };+ const reference: ProjectReference = { id, kind: "image", name: imported.name, description: "", relativePath: imported.relativePath, intendedUse: [], createdAt: new Date().toISOString() };onChange({ ...config, references: [reference, ...config.references] });setSelectedId(id);} catch (reason) {@@ -69,6 +69,30 @@ export function ReferencesView({ config, folderPath, onChange }: { config: ProjeonChange({ ...config, references: config.references.filter((ref) => ref.id !== selected.id), generationJobs: config.generationJobs.map((job) => ({ ...job, referenceIds: job.referenceIds.filter((id) => id !== selected.id) })) });setSelectedId(config.references.find((ref) => ref.id !== selected.id)?.id);};+ const openPresetPicker = () => {+ if (!selected) return;+ setPickerType(referenceType(selected));+ setPickerSubcategory("all");+ setPresetSearch("");+ setPresetDialog(true);+ };+ const chooseCustom = () => {+ if (!selected) return;+ update(selected.id, { intendedUse: [] });+ setPresetDialog(false);+ };+ const choosePreset = (preset: ReferencePreset) => {+ if (!selected) return;+ update(selected.id, { intendedUse: [preset.type], description: preset.prompt, content: preset.prompt });+ setPresetDialog(false);+ };+ const visiblePresets = REFERENCE_PRESETS.filter((preset) => {+ if (preset.type !== pickerType) return false;+ if (pickerSubcategory !== "all" && preset.subcategory !== pickerSubcategory) return false;+ const query = presetSearch.trim().toLocaleLowerCase();+ return !query || `${preset.name} ${preset.prompt} ${preset.subcategory} ${preset.searchTerms ?? ""}`.toLocaleLowerCase().includes(query);+ });+ const subcategories = [...new Set(REFERENCE_PRESETS.filter((preset) => preset.type === pickerType).map((preset) => preset.subcategory))];return <div className="references-view"><main className="references-main">@@ -96,7 +120,7 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje? <p>{ref.description}</p>: <p className="reference-card__incomplete">{ref.kind === "image"? "Not described yet — the picture is sent, but nothing tells the engine what to keep."- : "Not described yet — it won’t be used until you add a definition."}</p>}<span className="use-tags">{ref.intendedUse.map((use) => <i key={use}>{use}</i>)}</span></span>+ : "Not described yet — it won’t be used until you add a definition."}</p>}<span className="use-tags"><i>{referenceTypeLabel(referenceType(ref))}</i></span></span></button>)}<button className="reference-add-card" onClick={() => void addImage()}><span><Plus size={22} /></span><b>Add a reference</b><small>Import an image or write a definition</small></button></div>@@ -118,12 +142,19 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje</div><div className="reference-fields"><label><span>Name</span><input value={selected.name} onChange={(event) => update(selected.id, { name: event.target.value || "Untitled reference" })} /></label>- <label><span>Definition</span><textarea value={selected.description} placeholder="Describe what should stay consistent — the traits, materials, colours, or wardrobe PolStudio should preserve across shots." onChange={(event) => update(selected.id, { description: event.target.value, content: event.target.value || null })} /></label>+ {referenceType(selected) === "custom" ? <label><span>Prompt</span><textarea value={selected.description} placeholder="Describe what should stay consistent — the traits, materials, colours, or wardrobe PolStudio should preserve across shots." onChange={(event) => update(selected.id, { description: event.target.value, content: event.target.value || null })} /></label> : <div className="reference-preset-summary">+ <span>Selection</span>+ <button onClick={openPresetPicker}>+ <span><b>{selectedReferencePreset(selected)?.name ?? `${referenceTypeLabel(referenceType(selected))} selection`}</b><small>{selected.description}</small></span>+ <ChevronRight size={17} />+ </button>+ </div>}</div>- <section className="intended-use">- <h3>Intended use</h3>- <p>These tags are your own notes for keeping the library tidy. They don’t change what is sent to the video engine. Select any that apply.</p>- <div>{useOptions.map((use) => <button key={use} className={selected.intendedUse.includes(use) ? "active" : ""} aria-pressed={selected.intendedUse.includes(use)} onClick={() => update(selected.id, { intendedUse: selected.intendedUse.includes(use) ? selected.intendedUse.filter((item) => item !== use) : [...selected.intendedUse, use] })}>{selected.intendedUse.includes(use) && <Check size={14} />}{use}</button>)}</div>+ <section className="reference-type">+ <h3>Type</h3>+ <button className="reference-type__trigger" onClick={openPresetPicker} aria-haspopup="dialog">+ <span>{referenceTypeLabel(referenceType(selected))}</span><ChevronRight size={17} />+ </button></section><section className="reference-used-by"><h3>Used by <span>{jobs.length}</span></h3>@@ -142,6 +173,37 @@ export function ReferencesView({ config, folderPath, onChange }: { config: Proje<button className="primary-button" disabled={!definitionName.trim() || !definitionDescription.trim()} onClick={() => { addTextReference(definitionName.trim(), definitionDescription.trim()); setDefinitionDialog(false); setDefinitionDescription(""); }}>Save text definition</button></div></div></div>}+ {presetDialog && selected && <div className="reference-dialog-backdrop"><div className="reference-preset-dialog" role="dialog" aria-modal="true" aria-labelledby="reference-preset-title">+ <header>+ <div><h2 id="reference-preset-title">Choose a reference type</h2><p>Pick one type and one prepared option, or keep a custom prompt.</p></div>+ <button onClick={() => setPresetDialog(false)} aria-label="Close type picker"><X size={18} /></button>+ </header>+ <div className="reference-preset-dialog__body">+ <nav aria-label="Reference types">+ {REFERENCE_TYPES.map((type) => <button key={type.id} className={pickerType === type.id ? "active" : ""} aria-pressed={pickerType === type.id} onClick={() => { setPickerType(type.id); setPickerSubcategory("all"); setPresetSearch(""); }}>{type.label}<ChevronRight size={16} /></button>)}+ </nav>+ <section>+ {pickerType === "custom" ? <div className="reference-custom-option">+ <FileText size={26} />+ <h3>Custom prompt</h3>+ <p>Keep the current prompt and edit it directly in Reference details.</p>+ <button className="primary-button" onClick={chooseCustom}>Use Custom</button>+ </div> : <>+ <label className="reference-preset-search"><Search size={17} /><input value={presetSearch} onChange={(event) => setPresetSearch(event.target.value)} placeholder={`Search ${referenceTypeLabel(pickerType).toLocaleLowerCase()} options`} aria-label="Search reference options" /></label>+ <div className="reference-subcategories" role="group" aria-label={`${referenceTypeLabel(pickerType)} subcategories`}>+ <button className={pickerSubcategory === "all" ? "active" : ""} aria-pressed={pickerSubcategory === "all"} onClick={() => setPickerSubcategory("all")}>All</button>+ {subcategories.map((subcategory) => <button key={subcategory} className={pickerSubcategory === subcategory ? "active" : ""} aria-pressed={pickerSubcategory === subcategory} onClick={() => setPickerSubcategory(subcategory)}>{subcategory}</button>)}+ </div>+ <div className="reference-preset-grid">+ {visiblePresets.map((preset) => <button key={preset.id} onClick={() => choosePreset(preset)}>+ <small>{preset.subcategory}</small><b>{preset.name}</b><span>{preset.prompt}</span>+ </button>)}+ {visiblePresets.length === 0 && <p>No options match that search.</p>}+ </div>+ </>}+ </section>+ </div>+ </div></div>}{importError && <div className="toast" role="alert"><strong>Couldn’t add image</strong><span>{importError}</span><button onClick={() => setImportError(null)}>Dismiss</button></div>}</div>;}diff --git a/src/lib/expanded-reference-options.ts b/src/lib/expanded-reference-options.tsnew file mode 100644index 0000000..68dff98--- /dev/null+++ b/src/lib/expanded-reference-options.ts@@ -0,0 +1,72 @@+export interface OptionGroup {+ subcategory: string;+ options: readonly string[];+}++export interface OptionVariant {+ name: string;+ prompt: string;+}++export const PRODUCT_GROUPS: readonly OptionGroup[] = [+ { subcategory: "Technology", options: ["Smartphone", "Laptop", "Tablet", "Smartwatch", "Wireless earbuds", "Camera", "Gaming console", "Desktop computer", "Smart speaker", "VR headset"] },+ { subcategory: "Fashion", options: ["Wristwatch", "Sneaker", "Handbag", "Sunglasses", "Jacket", "Dress", "Backpack", "Boot", "Wallet", "Headphones"] },+ { subcategory: "Beauty", options: ["Perfume bottle", "Skincare bottle", "Lipstick", "Compact mirror", "Serum dropper", "Candle", "Soap bar", "Makeup palette", "Hair dryer", "Electric shaver"] },+ { subcategory: "Vehicles", options: ["Sports car", "Electric sedan", "Motorcycle", "City bicycle", "SUV", "Pickup truck", "Scooter", "Sailboat", "Camper van", "Concept car"] },+ { subcategory: "Home", options: ["Lounge chair", "Table lamp", "Sofa", "Dining table", "Desk chair", "Floor lamp", "Bookshelf", "Side table", "Wall clock", "Ceramic vase"] },+ { subcategory: "Food & drink", options: ["Coffee bag", "Tea tin", "Chocolate box", "Wine bottle", "Soda can", "Olive oil bottle", "Juice carton", "Spice jar", "Bakery box", "Water bottle"] },+ { subcategory: "Sports", options: ["Running shoe", "Football", "Tennis racket", "Bicycle helmet", "Yoga mat", "Skateboard", "Golf club", "Basketball", "Ski goggles", "Fitness tracker"] },+ { subcategory: "Tools", options: ["Power drill", "Toolbox", "Kitchen knife", "Flashlight", "Tape measure", "Multitool", "Paint brush", "Garden shears", "Wrench", "Work gloves"] },+ { subcategory: "Toys", options: ["Robot toy", "Model car", "Building blocks", "Plush animal", "Board game", "Wooden train", "Action figure", "Puzzle box", "Toy camera", "Kite"] },+ { subcategory: "Packaging", options: ["Shipping box", "Gift box", "Paper pouch", "Glass jar", "Metal tin", "Pump bottle", "Cardboard tube", "Takeaway cup", "Resealable bag", "Display carton"] },+];++export const PRODUCT_VARIANTS: readonly OptionVariant[] = [+ { name: "Minimal", prompt: "minimal, clean" },+ { name: "Premium", prompt: "premium, refined" },+ { name: "Rugged", prompt: "rugged, durable" },+ { name: "Retro", prompt: "retro-inspired" },+ { name: "Eco", prompt: "sustainable, natural" },+];++export const LOCATION_GROUPS: readonly OptionGroup[] = [+ { subcategory: "Urban", options: ["City alley", "Downtown avenue", "Rooftop", "Subway platform", "Night market", "City square", "Parking garage", "Pedestrian bridge", "Apartment street", "Train station"] },+ { subcategory: "Interiors", options: ["Hotel lobby", "Modern kitchen", "Artist studio", "Library", "Corner café", "Penthouse", "Warehouse loft", "Recording studio", "Museum gallery", "Home office"] },+ { subcategory: "Nature", options: ["Pine forest", "Desert canyon", "Alpine lake", "Wildflower meadow", "Waterfall", "Volcanic field", "Bamboo grove", "Glacier valley", "Misty marsh", "Redwood forest"] },+ { subcategory: "Historic", options: ["Medieval market", "Victorian manor", "Roman courtyard", "Ancient temple", "Castle hall", "Old observatory", "Monastery", "Colonial street", "Art Deco ballroom", "Renaissance workshop"] },+ { subcategory: "Sci-fi", options: ["Lunar base", "Orbital station", "Mars habitat", "Starship bridge", "Cyberpunk alley", "Alien greenhouse", "Robot factory", "Spaceport", "Cryogenic bay", "Underwater laboratory"] },+ { subcategory: "Fantasy", options: ["Enchanted forest", "Wizard library", "Dragon cave", "Floating city", "Elven palace", "Ancient ruins", "Crystal cavern", "Mountain fortress", "Hidden village", "Royal throne room"] },+ { subcategory: "Coastal", options: ["Tropical beach", "Rocky cove", "Fishing harbor", "Lighthouse cliff", "Boardwalk", "Coral lagoon", "Sea cave", "Marina", "Coastal village", "Storm pier"] },+ { subcategory: "Rural", options: ["Farmhouse", "Country road", "Vineyard", "Orchard", "Windmill field", "Mountain village", "Rice terrace", "Ranch", "Lavender farm", "Remote cabin"] },+ { subcategory: "Industrial", options: ["Steel mill", "Shipyard", "Power station", "Factory floor", "Cargo terminal", "Oil refinery", "Aircraft hangar", "Mining tunnel", "Data center", "Construction site"] },+ { subcategory: "Public spaces", options: ["Airport terminal", "Concert hall", "University campus", "Sports arena", "Hospital corridor", "Shopping arcade", "Courthouse", "Community pool", "Convention center", "Botanical garden"] },+];++export const LOCATION_VARIANTS: readonly OptionVariant[] = [+ { name: "At dawn", prompt: "at dawn" },+ { name: "At night", prompt: "at night" },+ { name: "In rain", prompt: "in light rain" },+ { name: "In winter", prompt: "in winter" },+ { name: "Golden hour", prompt: "at golden hour" },+];++export const STYLE_GROUPS: readonly OptionGroup[] = [+ { subcategory: "Cinematic", options: ["Film noir", "35 mm documentary", "Epic cinema", "Indie drama", "Neo-noir", "Romantic cinema", "Action thriller", "Period drama", "Science-fiction cinema", "Naturalist cinema"] },+ { subcategory: "Photography", options: ["Editorial photography", "Street photography", "Studio portrait", "Macro photography", "Architectural photography", "Fashion photography", "Food photography", "Wildlife photography", "Travel photography", "Product photography"] },+ { subcategory: "Illustration", options: ["Storybook watercolor", "Ink drawing", "Colored pencil", "Gouache illustration", "Paper collage", "Comic illustration", "Botanical illustration", "Technical drawing", "Children's illustration", "Editorial illustration"] },+ { subcategory: "Animation", options: ["Cinematic anime", "Clay animation", "Stop motion", "Cel animation", "Cut-paper animation", "3D character animation", "Motion graphics", "Pixel animation", "Puppet animation", "Rotoscope animation"] },+ { subcategory: "Fine art", options: ["Oil painting", "Impressionism", "Expressionism", "Surrealism", "Charcoal drawing", "Pastel painting", "Fresco", "Woodcut print", "Screen print", "Sculptural relief"] },+ { subcategory: "Graphic", options: ["Swiss design", "Bauhaus poster", "Pop art", "Minimal poster", "Brutalist design", "Art Deco graphic", "Memphis design", "Risograph print", "Editorial layout", "Geometric abstraction"] },+ { subcategory: "Retro", options: ["1970s retrofuturism", "1980s neon", "1990s music video", "Silent film", "Technicolor musical", "Mid-century advertising", "VHS home video", "Vintage travel poster", "Y2K digital", "Analog television"] },+ { subcategory: "Experimental", options: ["Double exposure", "Datamosh", "Prism distortion", "Infrared image", "Long exposure", "Mixed media", "Photogram", "Glitch art", "Kaleidoscope", "Projection mapping"] },+ { subcategory: "Commercial", options: ["Luxury editorial", "Clean product ad", "Lifestyle campaign", "Beauty campaign", "Automotive campaign", "Sports campaign", "Food commercial", "Technology launch", "Travel campaign", "Fashion lookbook"] },+ { subcategory: "Digital", options: ["Photoreal 3D", "Low-poly 3D", "Voxel art", "Isometric render", "Holographic render", "Unreal environment", "Procedural texture", "Digital matte painting", "Vector art", "UI motion design"] },+];++export const STYLE_VARIANTS: readonly OptionVariant[] = [+ { name: "Moody", prompt: "moody" },+ { name: "Bright", prompt: "bright" },+ { name: "Minimal", prompt: "minimal" },+ { name: "Textured", prompt: "textured" },+ { name: "High contrast", prompt: "high-contrast" },+];diff --git a/src/lib/known-characters.ts b/src/lib/known-characters.tsnew file mode 100644index 0000000..c2379f4--- /dev/null+++ b/src/lib/known-characters.ts@@ -0,0 +1,508 @@+/* Generated from the entries marked `good` in:+ * https://huggingface.co/datasets/malcolmrey/various/blob/main/h3-center/known-characters/INDEX.md+ *+ * Keep this as compact source data. The picker derives ids, short prompts,+ * and semantic subcategories in reference-presets.ts.+ */++export const KNOWN_CHARACTERS = [+ ["Abby Sciuto","Pauley Perrette","NCIS"],+ ["Ace Ventura","Jim Carrey","Ace Ventura"],+ ["Achilles","Brad Pitt","Troy"],+ ["Adam Driver","Adam Driver","Real Person / Celebrity"],+ ["Adam Maitland","Alec Baldwin","Beetlejuice"],+ ["Adam Sandler","Adam Sandler","Real Person / Celebrity"],+ ["Adonis Creed","Michael B. Jordan","Creed"],+ ["Adrian Monk","Tony Shalhoub","Monk"],+ ["Agent J","Will Smith","Men in Black"],+ ["Aishwarya Rai","Aishwarya Rai","Real Person / Celebrity"],+ ["Alan Dutch Schaefer","Arnold Schwarzenegger","Predator"],+ ["Alan Harper","Jon Cryer","Two and a Half Men"],+ ["Alan Turing","Benedict Cumberbatch","The Imitation Game"],+ ["Aldo Raine","Brad Pitt","Inglourious Basterds"],+ ["Alec Baldwin","Alec Baldwin","Real Person / Celebrity"],+ ["Alex Munday","Lucy Liu","Charlie's Angels"],+ ["Alfred Borden","Christian Bale","The Prestige"],+ ["Alluri Sitarama Raju","Ram Charan","RRR"],+ ["Alonzo Harris","Denzel Washington","Training Day"],+ ["Alvy Singer","Woody Allen","Annie Hall"],+ ["Amy Farrah Fowler","Mayim Bialik","The Big Bang Theory"],+ ["Anakin Skywalker","Hayden Christensen","Star Wars"],+ ["Andrew Garfield","Andrew Garfield","Real Person / Celebrity"],+ ["Andy Bernard","Ed Helms","The Office"],+ ["Andy Lau","Andy Lau","Real Person / Celebrity"],+ ["Andy Sachs","Anne Hathaway","The Devil Wears Prada"],+ ["Andy Stitzer","Steve Carell","The 40-Year-Old Virgin"],+ ["Angel","David Boreanaz","Buffy the Vampire Slayer"],+ ["Angelina Jolie","Angelina Jolie","Real Person / Celebrity"],+ ["Annalise Keating","Viola Davis","How to Get Away with Murder"],+ ["Anne Hathaway","Anne Hathaway","Real Person / Celebrity"],+ ["Annette Hargrove","Reese Witherspoon","Cruel Intentions"],+ ["Anthony DiNozzo","Michael Weatherly","NCIS"],+ ["Anthony Hopkins","Anthony Hopkins","Real Person / Celebrity"],+ ["Anthony Mackie","Anthony Mackie","Real Person / Celebrity"],+ ["Ashton Kutcher","Ashton Kutcher","Real Person / Celebrity"],+ ["Axel Foley","Eddie Murphy","Beverly Hills Cop"],+ ["Barack Obama","Barack Obama","Real Person / Celebrity"],+ ["Barney Ross","Sylvester Stallone","The Expendables"],+ ["Barney Stinson","Neil Patrick Harris","How I Met Your Mother"],+ ["Barry Allen / The Flash","Grant Gustin","The Flash"],+ ["Bella Swan","Kristen Stewart","Twilight"],+ ["Ben Affleck","Ben Affleck","Real Person / Celebrity"],+ ["Ben Stiller","Ben Stiller","Real Person / Celebrity"],+ ["Benjamin Franklin Gates","Nicolas Cage","National Treasure"],+ ["Benoit Blanc","Daniel Craig","Knives Out"],+ ["Bernadette Rostenkowski","Melissa Rauch","The Big Bang Theory"],+ ["Bertie Wooster","Hugh Laurie","Jeeves and Wooster"],+ ["Beth Smith","Sarah Chalke","Rick and Morty"],+ ["Beyonce","Beyonce","Real Person / Celebrity"],+ ["Big Bird","Big Bird","Sesame Street"],+ ["Bilbo Baggins","Martin Freeman","The Hobbit"],+ ["Billy Butcher","Karl Urban","The Boys"],+ ["Billy Costigan","Leonardo DiCaprio","The Departed"],+ ["Bjorn Ironside","Alexander Ludwig","Vikings"],+ ["Black Widow","Scarlett Johansson","Marvel's Avengers"],+ ["Blake","Alec Baldwin","Glengarry Glen Ross"],+ ["Bobby Singer","Jim Beaver","Supernatural"],+ ["Brad Pitt","Brad Pitt","Real Person / Celebrity"],+ ["Brennan Huff","Will Ferrell","Step Brothers"],+ ["Brick Tamland","Steve Carell","Anchorman"],+ ["Bruce Banner","Mark Ruffalo","Marvel's Avengers"],+ ["Bruce Wayne","Christian Bale","The Dark Knight"],+ ["Bruce Wayne / Batman","Ben Affleck","Batman v Superman"],+ ["Bruce Wayne / Batman","Christian Bale","The Dark Knight"],+ ["Bruce Wayne / Batman","George Clooney","Batman & Robin"],+ ["Bruce Wayne / Batman","Robert Pattinson","The Batman"],+ ["Bryan Mills","Liam Neeson","Taken"],+ ["Buddy","Will Ferrell","Elf"],+ ["Buffy Summers","Sarah Michelle Gellar","Buffy the Vampire Slayer"],+ ["Calvin Candie","Leonardo DiCaprio","Django Unchained"],+ ["Cameron Poe","Nicolas Cage","Con Air"],+ ["Captain Ellerby","Alec Baldwin","The Departed"],+ ["Captain Jack Sparrow","Johnny Depp","Pirates of the Caribbean"],+ ["Captain John Miller","Tom Hanks","Saving Private Ryan"],+ ["Captain Raymond Holt","Andre Braugher","Brooklyn Nine-Nine"],+ ["Caroline Channing","Beth Behrs","2 Broke Girls"],+ ["Carrie Bradshaw","Sarah Jessica Parker","Sex and the City"],+ ["Carrie Mathison","Claire Danes","Homeland"],+ ["Castiel","Misha Collins","Supernatural"],+ ["Castor Troy","John Travolta","Face/Off"],+ ["Castor Troy","Nicolas Cage","Face/Off"],+ ["Catwoman / Selina Kyle","Michelle Pfeiffer","Batman Returns"],+ ["Celeste Wright","Nicole Kidman","Big Little Lies"],+ ["Chan Wing-yan","Tony Leung Chiu-wai","Infernal Affairs"],+ ["Chandler Bing","Matthew Perry","Friends"],+ ["Charlie Harper","Charlie Sheen","Two and a Half Men"],+ ["Chef Gordon Ramsay","Gordon Ramsay","Hell's Kitchen"],+ ["Chev Chelios","Jason Statham","Crank"],+ ["Chloe Decker","Lauren German","Lucifer"],+ ["Chon Wang","Jackie Chan","Shanghai Noon"],+ ["Chow Mo-wan","Tony Leung Chiu-wai","In the Mood for Love"],+ ["Chuck Bartowski","Zachary Levi","Chuck"],+ ["Chuck Noland","Tom Hanks","Cast Away"],+ ["Clara Oswald","Jenna Coleman","Doctor Who"],+ ["Clark Kent","Tom Welling","Smallville"],+ ["Cliff Booth","Brad Pitt","Once Upon a Time in Hollywood"],+ ["Clint Barton / Hawkeye","Jeremy Renner","Marvel's Avengers"],+ ["Colin Farrell","Colin Farrell","Real Person / Celebrity"],+ ["Commodus","Joaquin Phoenix","Gladiator"],+ ["Conan","Arnold Schwarzenegger","Conan the Barbarian"],+ ["Conan O'Brien","Conan O'Brien","Late Night"],+ ["Cristiano Ronaldo","Cristiano Ronaldo","Real Person / Celebrity"],+ ["Daemon Targaryen","Matt Smith","House of the Dragon"],+ ["Daenerys Targaryen","Emilia Clarke","Game of Thrones"],+ ["Dana Scully","Gillian Anderson","The X-Files"],+ ["Daniel Craig","Daniel Craig","Real Person / Celebrity"],+ ["Daniel Hillard / Mrs. Doubtfire","Robin Williams","Mrs. Doubtfire"],+ ["Danny Ocean","George Clooney","Ocean's Eleven"],+ ["Darlene Alderson","Carly Chaikin","Mr. Robot"],+ ["Darth Vader (voiced by James Earl Jones)","Darth Vader (voiced by James Earl Jones)","Star Wars"],+ ["Daryl Dixon","Norman Reedus","The Walking Dead"],+ ["Data","Brent Spiner","Star Trek: The Next Generation"],+ ["Dave Chappelle","Dave Chappelle","Chappelle's Show"],+ ["David Attenborough","David Attenborough","Real Person / Celebrity"],+ ["David Letterman","David Letterman","Late Show"],+ ["Deadpool","Ryan Reynolds","Deadpool / Marvel's Avengers"],+ ["Dean Winchester","Jensen Ackles","Supernatural"],+ ["Deckard Shaw","Jason Statham","Fast & Furious"],+ ["Denzel Washington","Denzel Washington","Real Person / Celebrity"],+ ["Derek Zoolander","Ben Stiller","Zoolander"],+ ["Detective David Mills","Brad Pitt","Se7en"],+ ["Detective Rosa Diaz","Stephanie Beatriz","Brooklyn Nine-Nine"],+ ["Dexter Morgan","Michael C. Hall","Dexter"],+ ["Diana Prince / Wonder Woman","Gal Gadot","Wonder Woman"],+ ["Django","Jamie Foxx","Django Unchained"],+ ["Django Freeman","Jamie Foxx","Django Unchained"],+ ["Doctor Stephen Strange","Benedict Cumberbatch","Doctor Strange"],+ ["Doctor Strange","Benedict Cumberbatch","Marvel's Avengers"],+ ["Dom Cobb","Leonardo DiCaprio","Inception"],+ ["Dominic Toretto","Vin Diesel","Fast & Furious"],+ ["Don Draper","Jon Hamm","Mad Men"],+ ["Donald Trump","Donald Trump","The Apprentice"],+ ["Donnie Brasco","Johnny Depp","Donnie Brasco"],+ ["Douglas Quaid","Arnold Schwarzenegger","Total Recall"],+ ["Dr. Doug Ross","George Clooney","ER"],+ ["Dr. Gregory House","Hugh Laurie","House M.D."],+ ["Dr. Hannibal Lecter","Anthony Hopkins","The Silence of the Lambs"],+ ["Dr. Hannibal Lecter","Mads Mikkelsen","Hannibal"],+ ["Dr. Jed Hill","Alec Baldwin","Malice"],+ ["Dr. John Watson","Martin Freeman","Sherlock (BBC)"],+ ["Dr. Robert Ford","Anthony Hopkins","Westworld"],+ ["Dr. Rodney McKay","David Hewlett","Stargate Atlantis"],+ ["Dr. Smolder Bravestone","Dwayne Johnson","Jumanji: Welcome to the Jungle"],+ ["Dr. Temperance Brennan","Emily Deschanel","Bones"],+ ["Dr. Walter Bishop","John Noble","Fringe"],+ ["Driver","Ryan Gosling","Drive"],+ ["Dwight Schrute","Rainn Wilson","The Office"],+ ["Dylan Sanders","Drew Barrymore","Charlie's Angels"],+ ["Eddie Brock","Tom Hardy","Venom"],+ ["Edward Cullen","Robert Pattinson","Twilight"],+ ["Edward Lewis","Richard Gere","Pretty Woman"],+ ["Edward Nygma / The Riddler","Jim Carrey","Batman Forever"],+ ["Edward Scissorhands","Johnny Depp","Edward Scissorhands"],+ ["Elaine Benes","Julia Louis-Dreyfus","Seinfeld"],+ ["Eleven","Millie Bobby Brown","Stranger Things"],+ ["Elizabeth Swann","Keira Knightley","Pirates of the Caribbean"],+ ["Elliot Alderson","Rami Malek","Mr. Robot"],+ ["Ellis Boyd 'Red' Redding","Morgan Freeman","The Shawshank Redemption"],+ ["Enola Holmes","Millie Bobby Brown","Enola Holmes"],+ ["Eric Cartman","Trey Parker","South Park"],+ ["Erik Killmonger","Michael B. Jordan","Black Panther"],+ ["Ethan Hunt","Tom Cruise","Mission: Impossible"],+ ["Eve Polastri","Sandra Oh","Killing Eve"],+ ["Fletcher Reede","Jim Carrey","Liar Liar"],+ ["Forest Whitaker","Forest Whitaker","Real Person / Celebrity"],+ ["Forrest Gump","Tom Hanks","Forrest Gump"],+ ["Fox Mulder","David Duchovny","The X-Files"],+ ["Frank Abagnale Jr.","Leonardo DiCaprio","Catch Me If You Can"],+ ["Frank Costello","Jack Nicholson","The Departed"],+ ["Frank Lucas","Denzel Washington","American Gangster"],+ ["Frank Martin","Jason Statham","The Transporter"],+ ["Frank Slade","Al Pacino","Scent of a Woman"],+ ["Frank Underwood","Kevin Spacey","House of Cards"],+ ["Gandalf","Ian McKellen","Lord of the Rings"],+ ["Gaylord Focker","Ben Stiller","Meet the Parents"],+ ["Gellert Grindelwald","Mads Mikkelsen","Fantastic Beasts"],+ ["Geordi La Forge","LeVar Burton","Star Trek: The Next Generation"],+ ["George Costanza","Jason Alexander","Seinfeld"],+ ["Glenn Rhee","Steven Yeun","The Walking Dead"],+ ["Gloria Pritchett","Sofia Vergara","Modern Family"],+ ["God","Morgan Freeman","Bruce Almighty"],+ ["Goofy","Goofy","Disney"],+ ["Gordon Gekko","Michael Douglas","Wall Street"],+ ["Gordon Ramsay","Gordon Ramsay","Real Person / Celebrity"],+ ["Gracie Hart","Sandra Bullock","Miss Congeniality"],+ ["Grant Gustin","Grant Gustin","Real Person / Celebrity"],+ ["Guy","Ryan Reynolds","Free Guy"],+ ["Hal Wilkerson","Bryan Cranston, 2000s Malcolm in the Middle era","Malcolm in the Middle"],+ ["Han Solo","Harrison Ford","Star Wars"],+ ["Hank Moody","David Duchovny","Californication"],+ ["Hansel","Owen Wilson","Zoolander"],+ ["Happy Gilmore","Adam Sandler","Happy Gilmore"],+ ["Harold Finch","Michael Emerson","Person of Interest"],+ ["Harrison Ford","Harrison Ford","Real Person / Celebrity"],+ ["Harry Callahan","Clint Eastwood","Dirty Harry"],+ ["Harry Potter","Daniel Radcliffe","Harry Potter"],+ ["Harry Tasker","Arnold Schwarzenegger","True Lies"],+ ["Heimdall","Idris Elba","Thor"],+ ["Hellboy","David Harbour","Hellboy"],+ ["Hermione Granger","Emma Watson","Harry Potter"],+ ["Homelander","Antony Starr","The Boys"],+ ["Host Neil deGrasse Tyson","Neil deGrasse Tyson","Cosmos"],+ ["Howard Ratner","Adam Sandler","Uncut Gems"],+ ["Howard Wolowitz","Simon Helberg","The Big Bang Theory"],+ ["Hugh Jackman","Hugh Jackman","Real Person / Celebrity"],+ ["Hutch Mansell","Bob Odenkirk","Nobody"],+ ["Idi Amin","Forest Whitaker","The Last King of Scotland"],+ ["Idris Elba","Idris Elba","Real Person / Celebrity"],+ ["Indiana Jones","Harrison Ford","Indiana Jones"],+ ["Inspector Lee","Jackie Chan","Rush Hour"],+ ["Iris West","Candice Patton","The Flash"],+ ["J Robert Oppenheimer","Cillian Murphy","Oppenheimer"],+ ["J.K. Simmons","J.K. Simmons","Real Person / Celebrity"],+ ["Jack Bauer","Kiefer Sutherland","24"],+ ["Jack Black","Jack Black","Real Person / Celebrity"],+ ["Jack Byrnes","Robert De Niro","Meet the Parents"],+ ["Jack Dawson","Leonardo DiCaprio","Titanic"],+ ["Jack Donaghy","Alec Baldwin","30 Rock"],+ ["Jack Nicholson","Jack Nicholson","Real Person / Celebrity"],+ ["Jack Ryan","Alec Baldwin","The Hunt for Red October"],+ ["Jack Ryan","John Krasinski","Tom Clancy's Jack Ryan"],+ ["Jack Shephard","Matthew Fox","Lost"],+ ["Jack Traven","Keanu Reeves","Speed"],+ ["Jackie Chan","Jackie Chan","Real Person / Celebrity"],+ ["Jake Gyllenhaal","Jake Gyllenhaal","Real Person / Celebrity"],+ ["Jake Peralta","Andy Samberg","Brooklyn Nine-Nine"],+ ["Jake Sully","Sam Worthington","Avatar"],+ ["James Bond","Daniel Craig","Casino Royale"],+ ["James Bond (Daniel Craig)","Daniel Craig","James Bond"],+ ["James Hunt","Chris Hemsworth","Rush"],+ ["Jamie Foxx","Jamie Foxx","Real Person / Celebrity"],+ ["Jane Smith","Angelina Jolie","Mr. & Mrs. Smith"],+ ["Jason Bourne","Matt Damon","Bourne Franchise / The Bourne Identity"],+ ["Javier Peña","Pedro Pascal","Narcos"],+ ["Jax Teller","Charlie Hunnam","Sons of Anarchy"],+ ["Jean-Luc Picard","Patrick Stewart","Star Trek: The Next Generation"],+ ["Jeff Goldblum","Jeff Goldblum","Real Person / Celebrity"],+ ["Jennifer Love Hewitt","Jennifer Love Hewitt","Real Person / Celebrity"],+ ["Jeremy Grey","Vince Vaughn","Wedding Crashers"],+ ["Jeremy Renner","Jeremy Renner","Real Person / Celebrity"],+ ["Jerry Maguire","Tom Cruise","Jerry Maguire"],+ ["Jerry Seinfeld","Jerry Seinfeld","Seinfeld"],+ ["Jesse Eisenberg","Jesse Eisenberg","Real Person / Celebrity"],+ ["Jesse Pinkman","Aaron Paul","Breaking Bad"],+ ["Jessica Chastain","Jessica Chastain","Real Person / Celebrity"],+ ["Jessica Jones","Krysten Ritter","Jessica Jones"],+ ["Jim","Cillian Murphy","28 Days Later"],+ ["Jim Carrey","Jim Carrey","Real Person / Celebrity"],+ ["Jim Halpert","John Krasinski","The Office"],+ ["Jim Hopper","David Harbour","Stranger Things"],+ ["Jimmy Conway","Robert De Niro","Goodfellas"],+ ["Jimmy Fallon","Jimmy Fallon","Real Person / Celebrity"],+ ["Joe Rogan","Joe Rogan","The Joe Rogan Experience"],+ ["Joel Miller","Pedro Pascal","The Last of Us"],+ ["Joey Tribbiani","Matt LeBlanc","Friends"],+ ["John Cena","John Cena","Real Person / Celebrity"],+ ["John Constantine","Keanu Reeves","Constantine"],+ ["John Dutton","Kevin Costner","Yellowstone"],+ ["John Locke","Terry O'Quinn","Lost"],+ ["John Luther","Idris Elba","Luther"],+ ["John Matrix","Arnold Schwarzenegger","Commando"],+ ["John McClane","Bruce Willis","Die Hard"],+ ["John Nash","Russell Crowe","A Beautiful Mind"],+ ["John Nolan","Nathan Fillion","The Rookie"],+ ["John Oliver","John Oliver","Last Week Tonight"],+ ["John Rambo","Sylvester Stallone","Rambo"],+ ["John Reese","Jim Caviezel","Person of Interest"],+ ["John Smith","Brad Pitt","Mr. & Mrs. Smith"],+ ["John Travolta","John Travolta","Real Person / Celebrity"],+ ["John Wick","Keanu Reeves","John Wick"],+ ["Johnny Blaze / Ghost Rider","Nicolas Cage","Ghost Rider"],+ ["Jon Snow","Kit Harington","Game of Thrones"],+ ["Jonathan Crane","Cillian Murphy","Batman Begins"],+ ["Jonathan Pine","Tom Hiddleston","The Night Manager"],+ ["Jordan Belfort","Leonardo DiCaprio","The Wolf of Wall Street"],+ ["Joseph Cooper","Matthew McConaughey","Interstellar"],+ ["Josh Lyman","Bradley Whitford","The West Wing"],+ ["Juan Trippe","Alec Baldwin","The Aviator"],+ ["Jude Law","Jude Law","Real Person / Celebrity"],+ ["Judge Joseph Dredd","Sylvester Stallone","Judge Dredd"],+ ["Jules Winnfield","Samuel L. Jackson","Pulp Fiction"],+ ["Julia Roberts","Julia Roberts","Real Person / Celebrity"],+ ["Kanye West","Kanye West","Real Person / Celebrity"],+ ["Kate Beckett","Stana Katic","Castle"],+ ["Kenny McCormick","Matt Stone","South Park"],+ ["Kevin Chen Ka-kui","Jackie Chan","Police Story"],+ ["Kevin Costner","Kevin Costner","Real Person / Celebrity"],+ ["Kevin Hart","Kevin Hart","Real Person / Celebrity"],+ ["Kirk Lazarus","Robert Downey Jr.","Tropic Thunder"],+ ["Kobe Bryant","Kobe Bryant","Lakers court"],+ ["Komaram Bheem","N. T. Rama Rao Jr.","RRR"],+ ["Kyle Broflovski","Matt Stone","South Park"],+ ["Kylian Mbappé","Kylian Mbappé","Real Person / Celebrity"],+ ["Kylo Ren","Adam Driver","Star Wars"],+ ["Lamont Cranston","Alec Baldwin","The Shadow"],+ ["Larry David","Larry David","Curb Your Enthusiasm"],+ ["Lau Kin-ming","Andy Lau","Infernal Affairs"],+ ["Laurence Fishburne","Laurence Fishburne","Real Person / Celebrity"],+ ["Leonard Hofstadter","Johnny Galecki","The Big Bang Theory"],+ ["Leonardo DiCaprio","Leonardo DiCaprio","Real Person / Celebrity"],+ ["Lex Luthor","Kevin Spacey","Superman Returns"],+ ["Linus Caldwell","Matt Damon","Ocean's Eleven"],+ ["Liz Lemon","Tina Fey","30 Rock"],+ ["Lloyd Christmas","Jim Carrey","Dumb and Dumber"],+ ["Loki","Tom Hiddleston","Marvel's Avengers"],+ ["Lou Bloom","Jake Gyllenhaal","Nightcrawler"],+ ["Lt. Aldo Raine","Brad Pitt","Inglourious Basterds"],+ ["Lt. Col. Jimmy Doolittle","Alec Baldwin","Pearl Harbor"],+ ["Lt. Colonel John Sheppard","Joe Flanigan","Stargate Atlantis"],+ ["Lt. Daniel Kaffee","Tom Cruise","A Few Good Men"],+ ["Lucifer Morningstar","Tom Ellis","Lucifer"],+ ["Luke Cage","Mike Colter","Luke Cage"],+ ["Luke Hobbs","Dwayne Johnson","Fast & Furious"],+ ["Mace Windu","Samuel L. Jackson","Star Wars"],+ ["Madeline Martha Mackenzie","Reese Witherspoon","Big Little Lies"],+ ["Mads Mikkelsen","Mads Mikkelsen","Real Person / Celebrity"],+ ["Major Marquis Warren","Samuel L. Jackson","The Hateful Eight"],+ ["Malcolm Crowe","Bruce Willis","The Sixth Sense"],+ ["Malcolm Reynolds","Nathan Fillion","Firefly"],+ ["Malcolm X","Denzel Washington","Malcolm X"],+ ["Maleficent","Angelina Jolie","Maleficent"],+ ["Mark Watney","Matt Damon","The Martian"],+ ["Martin Riggs","Mel Gibson","Lethal Weapon"],+ ["Martin Sheen","Martin Sheen","Real Person / Celebrity"],+ ["Marty McFly","Michael J. Fox","Back to the Future"],+ ["Mathayus","Dwayne Johnson","The Scorpion King"],+ ["Matt Damon","Matt Damon","Real Person / Celebrity"],+ ["Matt Murdock","Ben Affleck","Daredevil"],+ ["Matthew McConaughey","Matthew McConaughey","Real Person / Celebrity"],+ ["Maverick / Pete Mitchell","Tom Cruise","Top Gun"],+ ["Max Black","Kat Dennings","2 Broke Girls"],+ ["Max Rockatansky","Mel Gibson","Mad Max"],+ ["Max Rockatansky","Tom Hardy","Mad Max: Fury Road"],+ ["Maximus Decimus Meridius","Russell Crowe","Gladiator"],+ ["Melinda Gordon","Jennifer Love Hewitt","Ghost Whisperer"],+ ["Meryl Streep","Meryl Streep","Real Person / Celebrity"],+ ["Mia Thermopolis","Anne Hathaway","The Princess Diaries"],+ ["Michael B. Jordan","Michael B. Jordan","Real Person / Celebrity"],+ ["Michael Clayton","George Clooney","Michael Clayton"],+ ["Michael Corleone","Al Pacino","The Godfather"],+ ["Michael Douglas","Michael Douglas","Real Person / Celebrity"],+ ["Michael Fassbender","Michael Fassbender","Real Person / Celebrity"],+ ["Michael Kelso","Ashton Kutcher","That '70s Show"],+ ["Michael Scofield","Wentworth Miller","Prison Break"],+ ["Michael Scott","Steve Carell","The Office"],+ ["Michonne","Danai Gurira","The Walking Dead"],+ ["Miranda Priestly","Meryl Streep","The Devil Wears Prada"],+ ["Morgan Freeman","Morgan Freeman","Real Person / Celebrity"],+ ["Morpheus","Laurence Fishburne","The Matrix"],+ ["Morty Smith","Justin Roiland","Rick and Morty"],+ ["Mr. Bean","Rowan Atkinson","Mr. Bean"],+ ["Natalie Cook","Cameron Diaz","Charlie's Angels"],+ ["Natalie Portman","Natalie Portman","Real Person / Celebrity"],+ ["Natasha Romanoff","Scarlett Johansson","The Avengers"],+ ["Navin R. Johnson","Steve Martin","The Jerk"],+ ["Negan","Jeffrey Dean Morgan","The Walking Dead"],+ ["Neil deGrasse Tyson","Neil deGrasse Tyson","Real Person / Celebrity"],+ ["Neil McCauley","Robert De Niro","Heat"],+ ["Neo","Keanu Reeves","The Matrix"],+ ["Neytiri","Zoe Saldana","Avatar"],+ ["Nicholas Brody","Damian Lewis","Homeland"],+ ["Nick Fury","Samuel L. Jackson","Marvel's Avengers"],+ ["Nicolas Cage","Nicolas Cage","Real Person / Celebrity"],+ ["Noah Calhoun","Ryan Gosling","The Notebook"],+ ["Norman Osborn","Willem Dafoe","Spider-Man"],+ ["Norman Reedus","Norman Reedus","Real Person / Celebrity"],+ ["Novak Djokovic","Novak Djokovic","Real Person / Celebrity"],+ ["Odin","Anthony Hopkins","Thor"],+ ["Oscar Isaac","Oscar Isaac","Real Person / Celebrity"],+ ["Owen Grady","Chris Pratt","Jurassic World"],+ ["Owen Wilson","Owen Wilson","Real Person / Celebrity"],+ ["Pam Beesly","Jenna Fischer","The Office"],+ ["Patrick Bateman","Christian Bale","American Psycho"],+ ["Patrick Jane","Simon Baker","The Mentalist"],+ ["Paul Atreides","Timothée Chalamet","Dune"],+ ["Paul Rudd","Paul Rudd","Real Person / Celebrity"],+ ["Peacemaker","John Cena","Peacemaker"],+ ["Penny","Kaley Cuoco","The Big Bang Theory"],+ ["Pennywise","Bill Skarsgård","IT"],+ ["Pete Maverick Mitchell","Tom Cruise","Top Gun"],+ ["Peter Parker","Andrew Garfield","The Amazing Spider-Man"],+ ["Phil Wenneck","Bradley Cooper","The Hangover"],+ ["Phoebe Buffay","Lisa Kudrow","Friends"],+ ["President Josiah \"Jed\" Bartlet","Martin Sheen","The West Wing"],+ ["Prince Akeem","Eddie Murphy","Coming to America"],+ ["Professor Charles Xavier","Patrick Stewart","X-Men"],+ ["Qui-Gon Jinn","Liam Neeson","Star Wars"],+ ["Rachel Green","Jennifer Aniston","Friends"],+ ["Rafael Nadal","Rafael Nadal","Real Person / Celebrity"],+ ["Ragnar Lothbrok","Travis Fimmel","Vikings"],+ ["Raj Koothrappali","Kunal Nayyar","The Big Bang Theory"],+ ["Randy Marsh","Trey Parker","South Park"],+ ["Ransom Drysdale","Chris Evans","Knives Out"],+ ["Ray","Colin Farrell","In Bruges"],+ ["Raymond Reddington","James Spader","The Blacklist"],+ ["Richard B. Riddick","Vin Diesel","The Chronicles of Riddick"],+ ["Richard Castle","Nathan Fillion","Castle"],+ ["Richard Gere","Richard Gere","Real Person / Celebrity"],+ ["Richard Kimble","Harrison Ford","The Fugitive"],+ ["Rick Deckard","Harrison Ford","Blade Runner"],+ ["Rick Grimes","Andrew Lincoln","The Walking Dead"],+ ["Rick Sanchez","Justin Roiland","Rick and Morty"],+ ["Ricky Bobby","Will Ferrell","Talladega Nights"],+ ["Rob Lowe","Rob Lowe","Real Person / Celebrity"],+ ["Robert De Niro","Robert De Niro","Real Person / Celebrity"],+ ["Robert McCall","Denzel Washington","The Equalizer"],+ ["Robert Pattinson","Robert Pattinson","Real Person / Celebrity"],+ ["Robin Williams","Robin Williams","Real Person / Celebrity"],+ ["RoboCop","Peter Weller","RoboCop"],+ ["Rocky Balboa","Sylvester Stallone","Rocky"],+ ["Ron Burgundy","Will Ferrell","Anchorman"],+ ["Ron Weasley","Rupert Grint","Harry Potter"],+ ["Ross Geller","David Schwimmer","Friends"],+ ["Rubeus Hagrid","Robbie Coltrane","Harry Potter"],+ ["Rust Cohle","Matthew McConaughey","True Detective"],+ ["Rusty Ryan","Brad Pitt","Ocean's Eleven"],+ ["Ryan Gosling","Ryan Gosling","Real Person / Celebrity"],+ ["Ryan Reynolds","Ryan Reynolds","Real Person / Celebrity"],+ ["Sam Ace Rothstein","Robert De Niro","Casino"],+ ["Sam Seaborn","Rob Lowe","The West Wing"],+ ["Sam Winchester","Jared Padalecki","Supernatural"],+ ["Samuel L. Jackson","Samuel L. Jackson","Real Person / Celebrity"],+ ["Sandra Bullock","Sandra Bullock","Real Person / Celebrity"],+ ["Saul Berenson","Mandy Patinkin","Homeland"],+ ["Saul Goodman","Bob Odenkirk","Breaking Bad"],+ ["Scarlet Witch","Elizabeth Olsen","Marvel's Avengers"],+ ["Scott Lang / Ant-Man","Paul Rudd","Marvel's Avengers"],+ ["Sean Archer","John Travolta","Face/Off"],+ ["Sean Dignam","Mark Wahlberg","The Departed"],+ ["Sebastian Wilder","Ryan Gosling","La La Land"],+ ["Seeley Booth","David Boreanaz","Bones"],+ ["Serena Williams","Serena Williams","Real Person / Celebrity"],+ ["Sergeant Terry Jeffords","Terry Crews","Brooklyn Nine-Nine"],+ ["Seth","Jonah Hill","Superbad"],+ ["Sheldon Cooper","Jim Parsons","The Big Bang Theory"],+ ["Sherlock Holmes","Benedict Cumberbatch","Sherlock (BBC)"],+ ["Sherlock Holmes","Robert Downey Jr.","Sherlock Holmes"],+ ["Simu Liu","Simu Liu","Real Person / Celebrity"],+ ["Snoop Dogg","Snoop Dogg","Real Person / Celebrity"],+ ["Sofia Vergara","Sofia Vergara","Real Person / Celebrity"],+ ["Special Agent Leroy Jethro Gibbs","Mark Harmon","NCIS"],+ ["Spike","James Marsters","Buffy the Vampire Slayer"],+ ["Spock","Leonard Nimoy","Star Trek: The Original Series"],+ ["Stan Marsh","Trey Parker","South Park"],+ ["Stanley Ipkiss as The Mask","Jim Carrey","The Mask"],+ ["Star-Lord","Chris Pratt","Marvel's Avengers"],+ ["Stephen Colbert","Stephen Colbert","Real Person / Celebrity"],+ ["Steve Rogers","Chris Evans","Marvel's Avengers"],+ ["Stringer Bell","Idris Elba","The Wire"],+ ["Summer Smith","Spencer Grammer","Rick and Morty"],+ ["Sylvester Stallone","Sylvester Stallone","Real Person / Celebrity"],+ ["Tallahassee","Woody Harrelson","Zombieland"],+ ["Taylor Swift","Taylor Swift","Real Person / Celebrity"],+ ["Ted Mosby","Josh Radnor","How I Met Your Mother"],+ ["Thanos","Josh Brolin","Marvel's Avengers"],+ ["The Eleventh Doctor","Matt Smith","Doctor Who"],+ ["The Narrator","Edward Norton","Fight Club"],+ ["The Tenth Doctor","David Tennant","Doctor Who"],+ ["The Terminator T-800","Arnold Schwarzenegger","The Terminator"],+ ["The Twelfth Doctor","Peter Capaldi","Doctor Who"],+ ["Thor","Chris Hemsworth","Marvel's Avengers"],+ ["Tim \"The Tool Man\" Taylor","Tim Allen","Home Improvement"],+ ["Tim Allen","Tim Allen","Real Person / Celebrity"],+ ["Tom Cruise","Tom Cruise","Real Person / Celebrity"],+ ["Tom Hanks","Tom Hanks","Real Person / Celebrity"],+ ["Tom Hardy","Tom Hardy","Real Person / Celebrity"],+ ["Tom Hiddleston","Tom Hiddleston","Real Person / Celebrity"],+ ["Tom Selleck","Tom Selleck","Real Person / Celebrity"],+ ["Tommy Shelby","Cillian Murphy","Peaky Blinders"],+ ["Tony Leung Chiu-wai","Tony Leung Chiu-wai","Real Person / Celebrity"],+ ["Tony Montana","Al Pacino","Scarface"],+ ["Tony Soprano","James Gandolfini","The Sopranos"],+ ["Tony Stark","Robert Downey Jr.","Marvel's Avengers"],+ ["Travis Bickle","Robert De Niro","Taxi Driver"],+ ["Tyler Durden","Brad Pitt","Fight Club"],+ ["Tyler Rake","Chris Hemsworth","Extraction"],+ ["Tyrion Lannister","Peter Dinklage","Game of Thrones"],+ ["Venus Williams","Venus Williams","Real Person / Celebrity"],+ ["Vince Vaughn","Vince Vaughn","Real Person / Celebrity"],+ ["Vincent Hanna","Al Pacino","Heat"],+ ["Vincent Vega","John Travolta","Pulp Fiction"],+ ["Vivian Ward","Julia Roberts","Pretty Woman"],+ ["Walter White","Bryan Cranston","Breaking Bad"],+ ["Wednesday Addams","Jenna Ortega","Wednesday"],+ ["Will Ferrell","Will Ferrell","Real Person / Celebrity"],+ ["Will Hunting","Matt Damon","Good Will Hunting"],+ ["Will Smith","Will Smith","The Fresh Prince of Bel-Air"],+ ["Willem Dafoe","Willem Dafoe","Real Person / Celebrity"],+ ["William Munny","Clint Eastwood","Unforgiven"],+ ["William Riker","Jonathan Frakes","Star Trek: The Next Generation"],+ ["William Somerset","Morgan Freeman","Se7en"],+ ["Willow Rosenberg","Alyson Hannigan","Buffy the Vampire Slayer"],+ ["Willy Wonka","Johnny Depp","Charlie and the Chocolate Factory"],+ ["Wolverine","Hugh Jackman","Marvel's Avengers / X-Men"],+ ["Woody Harrelson","Woody Harrelson","Real Person / Celebrity"],+ ["Worf","Michael Dorn","Star Trek: The Next Generation"],+ ["Xu Wenwu","Tony Leung Chiu-wai","Shang-Chi and the Legend of the Ten Rings"],+ ["Ziva David","Cote de Pablo","NCIS"],+] as const;diff --git a/src/lib/reference-presets.test.ts b/src/lib/reference-presets.test.tsnew file mode 100644index 0000000..dd3cc88--- /dev/null+++ b/src/lib/reference-presets.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from "vitest";+import { REFERENCE_PRESETS, type PresetReferenceType } from "./reference-presets";++const TYPES: PresetReferenceType[] = ["character", "product", "location", "style"];++describe("reference preset catalog", () => {+ it("offers about 500 choices for every prepared type", () => {+ for (const type of TYPES) {+ const count = REFERENCE_PRESETS.filter((preset) => preset.type === type).length;+ expect(count, type).toBeGreaterThanOrEqual(499);+ expect(count, type).toBeLessThanOrEqual(520);+ }+ });++ it("organizes every prepared type into subcategories", () => {+ for (const type of TYPES) {+ const subcategories = new Set(+ REFERENCE_PRESETS.filter((preset) => preset.type === type).map((preset) => preset.subcategory),+ );+ expect(subcategories.size, type).toBeGreaterThanOrEqual(6);+ }+ });++ it("keeps identifiers unique and descriptions short", () => {+ const ids = REFERENCE_PRESETS.map((preset) => preset.id);+ expect(new Set(ids).size).toBe(ids.length);+ expect(Math.max(...REFERENCE_PRESETS.map((preset) => preset.prompt.length))).toBeLessThanOrEqual(100);+ });+});diff --git a/src/lib/reference-presets.ts b/src/lib/reference-presets.tsnew file mode 100644index 0000000..38a4e11--- /dev/null+++ b/src/lib/reference-presets.ts@@ -0,0 +1,180 @@+import { KNOWN_CHARACTERS } from "./known-characters";+import {+ LOCATION_GROUPS,+ LOCATION_VARIANTS,+ PRODUCT_GROUPS,+ PRODUCT_VARIANTS,+ STYLE_GROUPS,+ STYLE_VARIANTS,+ type OptionGroup,+ type OptionVariant,+} from "./expanded-reference-options";+import type { ProjectReference } from "./project";++export type ReferenceType = "custom" | "character" | "product" | "location" | "style";+export type PresetReferenceType = Exclude<ReferenceType, "custom">;++export interface ReferencePreset {+ id: string;+ type: PresetReferenceType;+ subcategory: string;+ name: string;+ prompt: string;+ searchTerms?: string;+}++export const REFERENCE_TYPES: ReadonlyArray<{ id: ReferenceType; label: string }> = [+ { id: "custom", label: "Custom" },+ { id: "character", label: "Character" },+ { id: "product", label: "Product" },+ { id: "location", label: "Location" },+ { id: "style", label: "Style" },+];++const PUBLIC_FIGURE = "Real Person / Celebrity";+const ANIMATED_FRANCHISES = new Set(["Disney", "Rick and Morty", "Sesame Street", "South Park"]);+const TV_FRANCHISES = new Set([+ "2 Broke Girls", "24", "30 Rock", "Battlestar Galactica", "Big Little Lies", "Bones", "Breaking Bad",+ "Brooklyn Nine-Nine", "Buffy the Vampire Slayer", "Californication", "Castle", "Chappelle's Show", "Cheers",+ "Chuck", "Curb Your Enthusiasm", "Dexter", "Doctor Who", "Downton Abbey", "ER", "Firefly", "Friends",+ "Fringe", "Game of Thrones", "Ghost Whisperer", "Gilmore Girls", "GLOW", "Hell's Kitchen", "Heroes",+ "Homeland", "Home Improvement", "House M.D.", "House of Cards", "House of the Dragon", "How I Met Your Mother",+ "How to Get Away with Murder", "Jeeves and Wooster", "Killing Eve", "Last Week Tonight", "Lost", "Lucifer",+ "Luther", "Mad Men", "Malcolm in the Middle", "Monk", "Mr. Bean", "Mr. Robot", "Modern Family", "Narcos",+ "NCIS", "Orange Is the New Black", "Parks and Recreation", "Peaky Blinders", "Person of Interest", "Prison Break",+ "Psych", "Rescue Me", "Sense8", "Seinfeld", "Sex and the City", "Sherlock (BBC)", "Smallville",+ "Sons of Anarchy", "Stargate Atlantis", "Stranger Things", "Succession", "Supernatural", "Ted Lasso",+ "The Apprentice", "The Big Bang Theory", "The Blacklist", "The Boys", "The Flash", "The Fresh Prince of Bel-Air",+ "The Golden Girls", "The Joe Rogan Experience", "The Last of Us", "The Mentalist", "The Night Manager", "The Office",+ "The Rookie", "The Sarah Silverman Program", "The Shield", "The Sopranos", "The Walking Dead", "The West Wing",+ "The Wire", "The X-Files", "True Detective", "Two and a Half Men", "Vikings", "Westworld", "Yellowstone",+]);+const SUPERHERO_PATTERN = /Avengers|Batman|Black Panther|Daredevil|Deadpool|Doctor Strange|Ghost Rider|Jessica Jones|Luke Cage|Marvel|Peacemaker|Shang-Chi|Spider-Man|Superman|Thor|Venom|Wonder Woman|X-Men/i;+const FANTASY_PATTERN = /Avatar|Conan|Dune|Fantastic Beasts|Game of Thrones|Harry Potter|Hobbit|House of the Dragon|Jumanji|Lord of the Rings|Maleficent|Pirates of the Caribbean|Scorpion King|Star Trek|Star Wars|Twilight|Witcher/i;++const characterSubcategory = (franchise: string): string => {+ if (franchise === PUBLIC_FIGURE) return "Public figures";+ if (ANIMATED_FRANCHISES.has(franchise)) return "Animation";+ if (SUPERHERO_PATTERN.test(franchise)) return "Superheroes";+ if (FANTASY_PATTERN.test(franchise)) return "Sci-fi & fantasy";+ if (TV_FRANCHISES.has(franchise)) return "Television";+ return "Film";+};++const safeId = (value: string) => value.toLocaleLowerCase().normalize("NFKD")+ .replace(/[\u0300-\u036f]/g, "")+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/(^-|-$)/g, "");++const duplicateNames = new Map<string, number>();+for (const [name] of KNOWN_CHARACTERS) duplicateNames.set(name, (duplicateNames.get(name) ?? 0) + 1);++const knownCharacterPresets: ReferencePreset[] = KNOWN_CHARACTERS.map(([name, actor, franchise], index) => ({+ id: `character-known-${safeId(name)}-${index + 1}`,+ type: "character",+ subcategory: characterSubcategory(franchise),+ name: (duplicateNames.get(name) ?? 0) > 1 ? `${name} · ${actor}` : name,+ prompt: franchise === PUBLIC_FIGURE+ ? `${name}.`+ : (duplicateNames.get(name) ?? 0) > 1 ? `${name}, ${actor} portrayal.` : `${name} from ${franchise}.`,+ searchTerms: `${actor} ${franchise}`,+}));++const expandOptions = (+ type: PresetReferenceType,+ groups: readonly OptionGroup[],+ variants: readonly OptionVariant[],+ label: (option: string, variant: OptionVariant) => string,+ prompt: (option: string, variant: OptionVariant) => string,+): ReferencePreset[] => groups.flatMap((group) => group.options.flatMap((option) => variants.map((variant) => ({+ id: `${type}-${safeId(group.subcategory)}-${safeId(option)}-${safeId(variant.name)}`,+ type,+ subcategory: group.subcategory,+ name: label(option, variant),+ prompt: prompt(option, variant),+}))));++const expandedProductPresets = expandOptions(+ "product",+ PRODUCT_GROUPS,+ PRODUCT_VARIANTS,+ (option, variant) => `${variant.name} ${option}`,+ (option, variant) => `${variant.prompt} ${option.toLocaleLowerCase()}.`,+);+const expandedLocationPresets = expandOptions(+ "location",+ LOCATION_GROUPS,+ LOCATION_VARIANTS,+ (option, variant) => `${option} · ${variant.name}`,+ (option, variant) => `${option}, ${variant.prompt}.`,+);+const expandedStylePresets = expandOptions(+ "style",+ STYLE_GROUPS,+ STYLE_VARIANTS,+ (option, variant) => `${variant.name} ${option}`,+ (option, variant) => `${variant.prompt} ${option.toLocaleLowerCase()}.`,+);++const curatedPresets: ReferencePreset[] = [+ { id: "character-alice", type: "character", subcategory: "Literature & legend", name: "Alice in Wonderland", prompt: "Alice in her blue dress and white apron." },+ { id: "character-dracula", type: "character", subcategory: "Literature & legend", name: "Count Dracula", prompt: "Count Dracula in formal black evening wear." },+ { id: "character-robin-hood", type: "character", subcategory: "Literature & legend", name: "Robin Hood", prompt: "Robin Hood in practical forest-green clothing." },+ { id: "character-peter-pan", type: "character", subcategory: "Literature & legend", name: "Peter Pan", prompt: "Peter Pan in simple green woodland clothes." },+ { id: "character-frankenstein", type: "character", subcategory: "Literature & legend", name: "Frankenstein's Creature", prompt: "Frankenstein's towering, solemn creature." },+ { id: "character-dorothy-gale", type: "character", subcategory: "Literature & legend", name: "Dorothy Gale", prompt: "Dorothy Gale in a blue gingham dress." },+ { id: "character-king-arthur", type: "character", subcategory: "Literature & legend", name: "King Arthur", prompt: "King Arthur in polished medieval armor." },++ { id: "product-watch", type: "product", subcategory: "Fashion", name: "Luxury wristwatch", prompt: "Brushed steel watch with sapphire crystal." },+ { id: "product-skincare", type: "product", subcategory: "Beauty", name: "Skincare bottle", prompt: "Minimal frosted-glass skincare bottle." },+ { id: "product-sneaker", type: "product", subcategory: "Fashion", name: "Performance sneaker", prompt: "Modern mesh sneaker with a sculpted sole." },+ { id: "product-smartphone", type: "product", subcategory: "Technology", name: "Flagship smartphone", prompt: "Slim glass smartphone with a satin frame." },+ { id: "product-car", type: "product", subcategory: "Vehicles", name: "Sports car", prompt: "Low sports car with precise LED lights." },+ { id: "product-coffee", type: "product", subcategory: "Appliances", name: "Espresso machine", prompt: "Compact brushed-steel espresso machine." },+ { id: "product-chair", type: "product", subcategory: "Furniture", name: "Designer lounge chair", prompt: "Sculptural wood and fabric lounge chair." },++ { id: "location-cyberpunk-alley", type: "location", subcategory: "Urban", name: "Neon city alley", prompt: "Rainy neon alley with reflective pavement." },+ { id: "location-victorian-manor", type: "location", subcategory: "Historic", name: "Victorian manor", prompt: "Weathered Victorian manor with dark wood." },+ { id: "location-moon-base", type: "location", subcategory: "Sci-fi", name: "Lunar research base", prompt: "White lunar base under harsh sunlight." },+ { id: "location-alpine-village", type: "location", subcategory: "Nature", name: "Alpine village", prompt: "Timber village beneath snowy mountains." },+ { id: "location-art-deco-lobby", type: "location", subcategory: "Interiors", name: "Art Deco hotel lobby", prompt: "Brass and dark-stone Art Deco lobby." },+ { id: "location-medieval-market", type: "location", subcategory: "Historic", name: "Medieval market", prompt: "Busy medieval market with canvas stalls." },+ { id: "location-tropical-beach", type: "location", subcategory: "Nature", name: "Remote tropical beach", prompt: "Secluded turquoise beach with palms." },+ { id: "location-modern-studio", type: "location", subcategory: "Interiors", name: "Modern creative studio", prompt: "Bright timber studio with large windows." },++ { id: "style-film-noir", type: "style", subcategory: "Cinematic", name: "Film noir", prompt: "High-contrast monochrome with hard shadows." },+ { id: "style-documentary", type: "style", subcategory: "Cinematic", name: "35 mm documentary", prompt: "Natural light, handheld framing, subtle grain." },+ { id: "style-watercolor", type: "style", subcategory: "Illustration", name: "Storybook watercolor", prompt: "Soft watercolor on textured paper." },+ { id: "style-stop-motion", type: "style", subcategory: "Animation", name: "Handmade stop motion", prompt: "Tactile miniatures with stepped movement." },+ { id: "style-editorial", type: "style", subcategory: "Commercial", name: "Luxury editorial", prompt: "Sculpted light and deliberate negative space." },+ { id: "style-retrofuturism", type: "style", subcategory: "Retro", name: "1970s retrofuturism", prompt: "Rounded forms and warm analog controls." },+ { id: "style-anime", type: "style", subcategory: "Animation", name: "Cinematic anime", prompt: "Clean linework with painted backgrounds." },+ { id: "style-clay", type: "style", subcategory: "Animation", name: "Clay animation", prompt: "Hand-sculpted clay with playful movement." },+];++export const REFERENCE_PRESETS: readonly ReferencePreset[] = [+ ...knownCharacterPresets,+ ...expandedProductPresets,+ ...expandedLocationPresets,+ ...expandedStylePresets,+ ...curatedPresets,+]+ .sort((left, right) => left.type.localeCompare(right.type) || left.subcategory.localeCompare(right.subcategory) || left.name.localeCompare(right.name));++export function referenceType(reference: ProjectReference): ReferenceType {+ const stored = reference.intendedUse.length === 1+ ? REFERENCE_TYPES.find((type) => type.id !== "custom" && type.id === reference.intendedUse[0])?.id+ : undefined;+ /* Existing references were all free-written prompts, even when they carried+ * one or more library tags. They stay editable as Custom. A non-custom type+ * is only claimed when its prompt is one of that type's actual presets. */+ return stored && REFERENCE_PRESETS.some((preset) => preset.type === stored && preset.prompt === reference.description)+ ? stored+ : "custom";+}++export const referenceTypeLabel = (type: ReferenceType): string =>+ REFERENCE_TYPES.find((candidate) => candidate.id === type)?.label ?? "Custom";++export const selectedReferencePreset = (reference: ProjectReference): ReferencePreset | undefined =>+ REFERENCE_PRESETS.find((preset) => preset.type === referenceType(reference) && preset.prompt === reference.description);diff --git a/src/styles/references.css b/src/styles/references.cssindex ed18784..49bf39c 100644--- a/src/styles/references.css+++ b/src/styles/references.css@@ -403,15 +403,15 @@line-height: var(--leading-normal);}-/* --- Intended use / usage list --------------------------------------------- */+/* --- Reference type / usage list ------------------------------------------- */-.intended-use,+.reference-type,.reference-used-by {padding: var(--space-4);border-bottom: 1px solid var(--line);}-.intended-use h3,+.reference-type h3,.reference-used-by h3 {margin: 0 0 var(--space-2);color: var(--text-primary);@@ -420,44 +420,66 @@line-height: var(--leading-snug);}-.intended-use p {- margin: 0 0 var(--space-3);- color: var(--text-muted);- font-size: var(--text-sm);- line-height: var(--leading-normal);-}--.intended-use > div {- display: flex;- flex-wrap: wrap;- gap: var(--space-2);-}--.intended-use button {- min-height: var(--control-sm);+.reference-type__trigger {+ width: 100%;+ min-height: var(--control-md);display: flex;align-items: center;- gap: var(--space-2);+ justify-content: space-between;padding: 0 var(--space-3);border: 1px solid var(--line-strong);border-radius: var(--radius-sm);+ color: var(--text-primary);+ background: var(--field-bg);+ font-size: var(--text-base);+ font-weight: var(--weight-semibold);+}++.reference-type__trigger:hover {+ border-color: var(--accent);+}++.reference-preset-summary > span {+ display: block;+ margin-bottom: var(--space-1);color: var(--text-secondary);- background: var(--panel-3);font-size: var(--text-sm);font-weight: var(--weight-medium);- line-height: var(--leading-snug);- text-transform: capitalize;}-.intended-use button:hover {+.reference-preset-summary > button {+ width: 100%;+ min-height: 92px;+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--space-3);+ padding: var(--space-3);+ border: 1px solid var(--line);+ border-radius: var(--radius-sm);color: var(--text-primary);- border-color: var(--accent);+ background: var(--field-bg);+ text-align: left;}-.intended-use button.active {- color: var(--accent-bright);+.reference-preset-summary > button:hover {border-color: var(--accent);- background: var(--accent-soft);+}++.reference-preset-summary b,+.reference-preset-summary small {+ display: block;+}++.reference-preset-summary small {+ display: -webkit-box;+ margin-top: var(--space-1);+ overflow: hidden;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 3;+ color: var(--text-muted);+ font-size: var(--text-sm);+ line-height: var(--leading-normal);}.reference-used-by h3 span {@@ -634,6 +656,235 @@opacity: 0.5;}+/* --- Preset picker --------------------------------------------------------- */++.reference-preset-dialog {+ width: min(920px, calc(100vw - var(--space-6)));+ height: min(680px, calc(100vh - var(--space-6)));+ display: flex;+ flex-direction: column;+ overflow: hidden;+ border: 1px solid var(--line-strong);+ border-radius: var(--radius-lg);+ background: var(--panel-2);+ box-shadow: var(--shadow);+}++.reference-preset-dialog > header {+ min-height: 82px;+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: var(--space-4);+ padding: var(--space-5);+ border-bottom: 1px solid var(--line);+}++.reference-preset-dialog h2,+.reference-preset-dialog h3,+.reference-preset-dialog p {+ margin: 0;+}++.reference-preset-dialog h2 {+ color: var(--text-primary);+ font-size: var(--text-xl);+ line-height: var(--leading-tight);+}++.reference-preset-dialog > header p {+ margin-top: var(--space-1);+ color: var(--text-muted);+ font-size: var(--text-sm);+}++.reference-preset-dialog > header > button {+ width: var(--control-sm);+ height: var(--control-sm);+ display: grid;+ flex: 0 0 auto;+ place-items: center;+ border: 1px solid var(--line);+ border-radius: var(--radius-sm);+ color: var(--text-muted);+ background: var(--panel-3);+}++.reference-preset-dialog__body {+ min-height: 0;+ flex: 1 1 auto;+ display: grid;+ grid-template-columns: 190px minmax(0, 1fr);+}++.reference-preset-dialog__body > nav {+ padding: var(--space-3);+ border-right: 1px solid var(--line);+ background: var(--panel);+}++.reference-preset-dialog__body > nav button {+ width: 100%;+ min-height: var(--control-md);+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0 var(--space-3);+ border: 0;+ border-radius: var(--radius-sm);+ color: var(--text-secondary);+ background: transparent;+ font-size: var(--text-base);+ font-weight: var(--weight-medium);+}++.reference-preset-dialog__body > nav button:hover,+.reference-preset-dialog__body > nav button.active {+ color: var(--text-primary);+ background: var(--accent-soft);+}++.reference-preset-dialog__body > nav button.active {+ box-shadow: inset 2px 0 var(--accent-bright);+}++.reference-preset-dialog__body > section {+ min-width: 0;+ min-height: 0;+ padding: var(--space-4);+ overflow-y: auto;+}++.reference-preset-search {+ height: var(--field-height);+ display: flex;+ align-items: center;+ gap: var(--space-2);+ margin-bottom: var(--space-4);+ padding: 0 var(--space-3);+ border: 1px solid var(--line);+ border-radius: var(--radius-sm);+ color: var(--text-muted);+ background: var(--field-bg);+}++.reference-preset-search:focus-within {+ border-color: var(--accent);+}++.reference-preset-search input {+ min-width: 0;+ flex: 1 1 auto;+ border: 0;+ outline: 0;+ color: var(--text-primary);+ background: transparent;+ font: inherit;+}++.reference-subcategories {+ display: flex;+ flex-wrap: wrap;+ gap: var(--space-2);+ margin-bottom: var(--space-4);+}++.reference-subcategories button {+ min-height: var(--control-sm);+ padding: 0 var(--space-3);+ border: 1px solid var(--line);+ border-radius: var(--radius-pill);+ color: var(--text-secondary);+ background: var(--panel-3);+ font-size: var(--text-sm);+ font-weight: var(--weight-medium);+}++.reference-subcategories button:hover,+.reference-subcategories button.active {+ border-color: var(--accent);+ color: var(--accent-bright);+ background: var(--accent-soft);+}++.reference-preset-grid {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: var(--space-3);+}++.reference-preset-grid > button {+ min-height: 112px;+ padding: var(--space-4);+ border: 1px solid var(--line);+ border-radius: var(--radius-md);+ color: var(--text-primary);+ background: var(--panel-3);+ text-align: left;+}++.reference-preset-grid > button:hover {+ border-color: var(--accent);+ background: var(--accent-soft);+}++.reference-preset-grid b,+.reference-preset-grid span,+.reference-preset-grid small {+ display: block;+}++.reference-preset-grid small {+ margin-bottom: var(--space-1);+ color: var(--accent-bright);+ font-size: var(--text-2xs);+ font-weight: var(--weight-semibold);+ letter-spacing: var(--tracking-label);+ text-transform: uppercase;+}++.reference-preset-grid b {+ font-size: var(--text-base);+}++.reference-preset-grid span {+ margin-top: var(--space-2);+ color: var(--text-muted);+ font-size: var(--text-sm);+ line-height: var(--leading-normal);+}++.reference-preset-grid > p {+ color: var(--text-muted);+}++.reference-custom-option {+ min-height: 100%;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: var(--space-8);+ text-align: center;+}++.reference-custom-option > svg {+ color: var(--accent-bright);+}++.reference-custom-option h3 {+ margin-top: var(--space-3);+ color: var(--text-primary);+ font-size: var(--text-lg);+}++.reference-custom-option p {+ max-width: 44ch;+ margin: var(--space-2) 0 var(--space-5);+ color: var(--text-muted);+ line-height: var(--leading-normal);+}+/* --- Responsive ------------------------------------------------------------ */@media (max-width: 1180px) {@@ -682,6 +933,14 @@.reference-grid {grid-template-columns: minmax(0, 1fr);}++ .reference-preset-dialog__body {+ grid-template-columns: 150px minmax(0, 1fr);+ }++ .reference-preset-grid {+ grid-template-columns: minmax(0, 1fr);+ }}/* A blank reference is a legitimate in-progress state, but it must be visibly