feat(website): schema-sidebar cast + Ctrl-O/Esc cast keys
Add a `schema-sidebar` cast that reveals the ADR-0046 sidebar with Ctrl-O (the only way to show it at 90 cols) and steps through the Tables and Relationships panels. Teach the generator the CtrlO/Esc control codes; quote control codes so `^[`/`^]` stay valid YAML.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* { wait: ms } — pause (shown in the recording)
|
||||
* { type: 'text', after: ms } — type the text + press Enter, then pause
|
||||
* { type: 'text', enter: false } — type without pressing Enter
|
||||
* { key: 'Tab'|'Enter'|'CtrlC', after } — press a single named key
|
||||
* { key: 'Tab'|'Enter'|'CtrlC'|'CtrlO'|'Esc', after } — press a single named key
|
||||
*
|
||||
* Every cast must end by quitting the app so the driver returns to the shell
|
||||
* prompt — use `{ key: 'CtrlC' }` (Ctrl-C → quit), NOT a typed `quit`: Ctrl-C
|
||||
@@ -19,6 +19,35 @@
|
||||
|
||||
/** The shared library narrative, trimmed per cast. */
|
||||
export const casts = [
|
||||
{
|
||||
name: 'schema-sidebar',
|
||||
title: 'Bring up the schema sidebar and step through tables and relationships',
|
||||
width: 90,
|
||||
height: 26,
|
||||
typeSpeed: '45ms',
|
||||
steps: [
|
||||
{ wait: 1000 },
|
||||
// A small two-table schema with one relationship, so both sidebar
|
||||
// panels have something to show.
|
||||
{ type: 'create table authors with pk author_id(serial)', after: 650 },
|
||||
{ type: 'add column to authors: name (text)', after: 650 },
|
||||
{ type: 'create table books with pk book_id(serial)', after: 650 },
|
||||
{ type: 'add column to books: title (text)', after: 650 },
|
||||
{ type: 'add column to books: author_id (int)', after: 700 },
|
||||
{
|
||||
type: 'add 1:n relationship as books_author from authors.author_id to books.author_id on delete cascade',
|
||||
after: 1400,
|
||||
},
|
||||
// The sidebar is hidden at 90 cols; Ctrl-O reveals it and focuses the
|
||||
// Tables panel (the [CTRL-O] badge shows the otherwise-invisible key).
|
||||
{ key: 'CtrlO', after: 2600 },
|
||||
// Ctrl-O again moves focus to the Relationships panel.
|
||||
{ key: 'CtrlO', after: 2800 },
|
||||
// Esc leaves navigation mode — the sidebar re-hides.
|
||||
{ key: 'Esc', after: 1300 },
|
||||
{ key: 'CtrlC' }, // quit invisibly (Ctrl-C) — cast ends on the last content frame
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'projects',
|
||||
title: 'Save a project, start fresh, then load it back',
|
||||
|
||||
@@ -43,6 +43,12 @@ const NAMED_KEYS = {
|
||||
// `quit` command typed into the input — so the recording ends on the last
|
||||
// content frame rather than a dangling, payoff-less `quit`.
|
||||
CtrlC: '^C',
|
||||
// Ctrl-O cycles the ADR-0046 schema-sidebar navigation focus
|
||||
// (Input → Tables → Relationships → Input); the only way to reveal the
|
||||
// sidebar in a 90-column cast (it auto-hides at that width).
|
||||
CtrlO: '^O',
|
||||
// Esc leaves navigation mode directly (back to the input field).
|
||||
Esc: '^[',
|
||||
};
|
||||
|
||||
/** Build the autocast `keys:` list (one entry per line) for a cast's steps. */
|
||||
@@ -56,7 +62,9 @@ function keysFor(steps) {
|
||||
if (step.key != null) {
|
||||
const code = NAMED_KEYS[step.key];
|
||||
if (!code) throw new Error(`unknown key: ${step.key}`);
|
||||
keys.push(code);
|
||||
// Quote the control code so YAML-special bytes (`^[` ESC, `^]`) stay
|
||||
// valid scalars; `^M`/`^I`/`^C` are unaffected by the quoting.
|
||||
keys.push(JSON.stringify(code));
|
||||
if (step.after != null) keys.push(`${step.after}ms`);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user