diff --git a/docs/editing.feature b/docs/editing.feature new file mode 100644 index 00000000..d0d5f243 --- /dev/null +++ b/docs/editing.feature @@ -0,0 +1,181 @@ +@spec +Feature: Editing a video in raea: the composition is the document, every change is a change to its code, live + Shane, 2026-11-07: "right now its confusing, broken, and weird to have to make changes then confirm them? the + comments are fine but i noticed moving text doesnt really seem to apply or how does that actually effect how its + built in react. i feel like theres a lot more to explore here that we could unify and model a complete video editing + experience and timeline and how the tools work. also consolidating toolbars in the ui so its clear where my tools + are, they have tooltips and clear action states and states" + + What the editor is today (apps/app src/detail, src/compositions, host/edit.ts), read 11-07: + - A change is held in the page until "Render edit" in a "…" menu (or ⌘↵): it writes NAME-vN.tsx, renders it, and + posts it. Nothing on screen says the change isn't real yet, and the save is hidden. + - Moving text matches its words in the source and wraps that element in (sdk/video nudge.tsx). Text + from a prop, a variable, a .map() or the words can't be found ("isn't written out in the composition"); the same + words twice move the first; the picture doesn't change until the save renders (drafts, host/draft.ts, 11-07, + now render it while unsaved). + - The Properties panel offers position, scale and opacity, but the save sends x and y only: scale and opacity + are dropped without a word. + - The timeline edits the render, not the composition: cuts are frame ranges over the mp4 (Segments), parts + can be retimed, captions come from the words. A 's from and length, a clip's trim, a component's + place in time: none of them are on it. + - Tools are in three places: the player bar (play, ±5 s, comment, pick, outlines, the summary, the "…" menu), + the strip's own bar (undo, redo, split, delete, zoom), and the right panel's tabs. + - The render manifest (engine/page/src/motion.rs) records per frame the text runs and videos with their boxes, + and nothing about which JSX drew them, so the editor can only guess what a picked thing is by its words. + + The model this file sets: + 1. The composition's file is the document. An edit is an edit to its code, made the moment you make it, the + way a design tool saves: no confirm step. The first change in a sitting starts the next version + (NAME-vN.tsx, "Editing v4"); each further change rewrites that same file; undo and redo step through them. + Leaving the editor, or pausing a while, closes the version: rendered at full quality, posted once to the feed + as one line with what changed (11-07's compact row). "Discard" removes the version the sitting made. + 2. What you see is what the code draws, as you change it: the picture is the draft render of the working file + (host/draft.ts) until the engine can play the composition live in the editor (E4). + 3. Everything picked is a place in the code. Every element drawn carries its source location (file:line:col), + so picking in the frame, in Layers, or on the timeline picks the same JSX element, whatever made its words. + 4. A property is a prop. Position, scale, opacity and rotation go through one wrapper the person can read, + (one line, re-written in place on the next change); a component's props are + its props (host/props.ts); a 's time is its from and durationInFrames. + 5. The timeline is the composition's structure: a track per layer of the tree (sequences, media, components, + text), each clip a JSX element with a span; dragging, trimming, splitting and deleting a clip edits that + element. The render's own reference (thumbnails, the sound, captions) sits under it, and a cut over the whole + picture (Segments) stays for footage edits. + 6. One toolbar. Between the picture and the timeline, left to right: transport (play, ±5 s, sound, the time), + tools (Select P, Comment C, Outlines O; in the feed's player, E opens this editor), history (undo, redo), the clip tools + (Split S, Delete), the picked part's values, timeline view (zoom), and on the right the document's state + ("Saved to v4", "Rendering v4…", "Couldn't save") with Discard and Done. Every button has a + tooltip naming it and its key, a pressed look when on, and a disabled look with the reason in its tooltip. + 7. An agent edits through the same operations, on the same working version, and the person sees each change + land (editor_selection, 11-07, tells it what's picked). + + Background: + Given the editor's code is apps/app src/detail/timeline, src/compositions, and host + edit.ts, draft.ts, props.ts; and the engine's is engine/page (the manifest) and engine/bundle (TSX, oxc) + And Rust changes go through the lanes' build rules (announce, `lane build --`, no edits under a peer's build) + + Rule: E1. Changes apply as you make them, and the tools are in one bar (app only) + # Status 11-07: built and checked by hand in the composition editor (a throwaway composition in p-ides): + # the first arrow-key move wrote sit-v2.tsx with ("Saved to v2"), the scale slider re-wrote the + # same file with scale={1.01}, undo re-wrote it without, Done rendered v2 and moved the editor to it; a move after + # that started v3 and Discard removed it; leaving the editor with a change rendered v3. Since 11-07 the feed's player + # doesn't edit (Shane's call): its Edit (E) opens this editor on the piece, in the project's folder or, for a source + # kept in another raea project, that one (#/compositions///in/). Checked: i-parts' Edit opened + # "parts" from raea-feed with its three parts on the strip. host/edit.test.ts: 9 pass (scale and opacity on one Nudge; a sitting's file). Not + # run: e2e/edit.spec.ts needs the tutorial's render, which isn't on this Mac. + + Scenario: E1a. A change is saved the moment it's made + Given a composition open in the editor at v3 + When I move a title + Then promo-v4.tsx exists with the move, the bar says "Editing v4 · saved", and the picture plays the draft + When I move it again + Then promo-v4.tsx is rewritten, and no promo-v5.tsx is made + When I press Done + Then v4 renders at full quality and the feed gets one row: "You edited promo → v4 · title moved" + + Scenario: E1b. Discard takes back the sitting + Given I've made changes that started v4 + When I press Discard and confirm + Then promo-v4.tsx is gone and the editor shows v3 as it was + + Scenario: E1c. Scale and opacity are applied + When I set a title's scale to 120% and its opacity to 50% + Then the working file has around it, and the draft shows it + + Scenario: E1d. One toolbar with tooltips and states + Then the editor has one bar between the picture and the timeline, in the order the model sets + And every control in it has a tooltip with its name (and key), aria-pressed when on, and when disabled says why + And there is no "…" Edit actions menu and no second bar on the strip + + Rule: E2. Every drawn element knows its place in the code (engine) + # Status 11-07: built. engine/bundle stamp.rs (a load plugin, on when raea is asked with RAEA_SOURCE_STAMPS=1, which + # the app's host sets on its manifest renders; the bundle cache keys on it) stamps the edit's own files: an HTML + # element gets data-raea-loc="file:line:col" (the attribute named data-raea-src in E2a is the video manifest's + # media source already) and data-raea-use, the uses of the edit's components it was drawn in, nearest first, read + # from a context each use of an own component is wrapped in (not inside a package component, which may read its + # children's types). runtime/page keeps both; engine/page's manifest gives each text and video "loc" and "use". + # The editor keys a picked text by its words and place, and host/edit.ts writes a move at the first stamp in the + # composition's own file (the element, else the use of the component that drew it); a text only a component file + # draws says to move it on that component's page. Checked: two came out as two runs + # (card.tsx:4:7 used at lab.tsx:8:9 and lab.tsx:9:9); picking the second in the editor and moving it wrapped only the + # second use in . engine/bundle: 6 tests; host/edit.test.ts: 13. + + Scenario: E2a. The bundler stamps elements + Given engine/bundle compiles a composition's TSX + Then each intrinsic JSX element gets data-raea-src="::" (not for the SDK's own files) + + Scenario: E2b. The manifest carries it + Then each text and video entry in render.json has "src" from its owner or nearest stamped ancestor + + Scenario: E2c. Picking is by source + Given text made by {title} inside , used twice with different titles + When I pick the second one and move it + Then the move is written at the second use's line, and the first doesn't move + + Rule: E3. The timeline is the composition + # Status 11-07: built for (host/sequences.ts). A composition with no shows its sequences on the strip's + # Sequences track, a lane per nesting level, named by their name prop or what they hold; dragging and trimming one + # rewrites its from and durationInFrames (in its parent's time), S splits the picked one at the playhead (written + # twice, its