Deletes the vanilla shell and mounts App.tsx on #root. main.ts and the 23 views it drove are gone; App.tsx composes the ported components — sidebar, multi-view, command bar, spawn modal, help and restart overlays, daemon link, drawer — around the catalog and layout stores. The pure parts of four deleted modules moved next to the components that still use them: the spawn-form model and spawnSimilar into components/spawn, the transcript's markdown/format helpers and the diff into components/structured, the help overlay's grouping into components/dialogs. Document-level event names now live in uiEvents.ts. Deduplicated two pairs the migration left side by side: the sidebar uses dialogs/KillDialog and common/ContextMenu. It also listens for the command bar's kill/rename events, which nothing had picked up since catalog.ts went away. styles.css stays as the token and base layer, with `#app` renamed to `#root` and the pane-body rules re-keyed off the classes the React panes actually carry. Closes #253
59 lines
2.8 KiB
TypeScript
59 lines
2.8 KiB
TypeScript
// Document-level events the shell listens for. They were declared alongside
|
|
// the vanilla views that dispatched them (catalog.ts, drawer.ts) until #253
|
|
// deleted those; the React components on both ends share them from here.
|
|
//
|
|
// Every one is dispatched on `document`, so a view deep in the tree can reach
|
|
// the shell without a callback threaded through every level between.
|
|
|
|
/** Ask the shell to open the spawn modal. Dispatched from every Spawn
|
|
* affordance; handled by App.tsx, which owns the modal. */
|
|
export const OPEN_SPAWN_EVENT = "catalog-open-spawn";
|
|
|
|
export function requestOpenSpawn(): void {
|
|
document.dispatchEvent(new CustomEvent(OPEN_SPAWN_EVENT));
|
|
}
|
|
|
|
/** Ask the shell to open the command bar with an empty query. Dispatched by
|
|
* the sidebar's search field, which is the touch entry point to the bar
|
|
* (#157, docs/COMMAND-BAR.md "Touch entry"): there is no `ctrl-k` on a phone. */
|
|
export const OPEN_COMMAND_BAR_EVENT = "catalog-open-command-bar";
|
|
|
|
export function requestOpenCommandBar(): void {
|
|
document.dispatchEvent(new CustomEvent(OPEN_COMMAND_BAR_EVENT));
|
|
}
|
|
|
|
/** Ask the shell to hand the keyboard back to the focused pane's terminal —
|
|
* what Tab in the sidebar list does. */
|
|
export const FOCUS_PANE_EVENT = "catalog-focus-pane";
|
|
|
|
/** Ask the shell to open the spawn modal seeded from an existing session
|
|
* ("Spawn similar"). Detail is the session being cloned. */
|
|
export const SPAWN_SIMILAR_EVENT = "catalog-spawn-similar";
|
|
|
|
/** Ask the sidebar to kill a session — the command bar's action page picking
|
|
* `kill` (#151). Detail is the session. Handled by the sidebar, so the kill
|
|
* goes through the same confirm-and-blockers flow the card's ✕ does
|
|
* (`docs/WORKTREES.md`); the bar never reimplements it. */
|
|
export const KILL_SESSION_EVENT = "catalog-kill-session";
|
|
|
|
/** Ask the sidebar to rename a session — the command bar's action page picking
|
|
* `rename` (#151). Detail is the session. The prompt is the card's own inline
|
|
* field, pre-filled with the session's name (`docs/SIDEBAR.md`). */
|
|
export const RENAME_SESSION_EVENT = "catalog-rename-session";
|
|
|
|
/** A session row was clicked (issue #133). The row's `href` drives normal
|
|
* hash navigation, but a split/drag can move focus without ever touching
|
|
* `location.hash` — so a click back onto a session whose hash still
|
|
* matches fires no `hashchange` and the app never hears about it. This
|
|
* event is the click-driven path that doesn't depend on the hash actually
|
|
* changing. */
|
|
export const SESSION_SELECT_EVENT = "catalog-session-select";
|
|
|
|
/** Toggling the mobile drawer from outside the shell (the pane header's ☰),
|
|
* without threading the controller through every view. */
|
|
export const TOGGLE_DRAWER_EVENT = "maestro-toggle-drawer";
|
|
|
|
export function requestToggleDrawer(): void {
|
|
document.dispatchEvent(new CustomEvent(TOGGLE_DRAWER_EVENT));
|
|
}
|