"use client"; import { createContext, useContext } from "react"; // --------------------------------------------------------------------------- // THE WORKSPACE'S ONE READ-ONLY RULE (umtool redesign L7b): a saved version shown in the workspace (`?take=`, its // review pass or present mode) is read-only -- nothing reachable from the screen writes the DRAFT while it shows // another cut. Derived ONCE (Workspace.tsx: `workspaceReadOnly(view)`), then handed down: as a prop to the // workspace's own parts, and through this context to anything mounted under it (the inspector's panels, the // strip's menus). Every draft writer refuses while it is true: the timeline writes (move, undo, redo), E, the // inspector, the review pass's marks. // --------------------------------------------------------------------------- /** The rule: a version (a take) on screen is read-only. */ export function workspaceReadOnly(view: { take?: unknown }): boolean { return !!view.take; } export const WorkspaceReadOnly = createContext(false); /** True while the workspace shows a saved version: a writer under it refuses. */ export const useWorkspaceReadOnly = () => useContext(WorkspaceReadOnly); /** What a refused write says. */ export const READ_ONLY_SAID = "a saved version is read-only: Open in draft to change it";