frontend: the board glides and the editor grows from its card (task 1914)
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 6s
CI & Build / Python tests (push) Successful in 10s
CI & Build / Build & push image (push) Successful in 1m0s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m30s
Android (Tauri) / Android APK (debug) (push) Successful in 4m25s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 6m8s
Desktop (Tauri) / Update manifest (push) Successful in 4s
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 6s
CI & Build / Python tests (push) Successful in 10s
CI & Build / Build & push image (push) Successful in 1m0s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m30s
Android (Tauri) / Android APK (debug) (push) Successful in 4m25s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 6m8s
Desktop (Tauri) / Update manifest (push) Successful in 4s
Two of M7's motion targets. prefers-reduced-motion was already in place from the 1999 pass and gates both of these for free. FILTERED REFLOW. The three card grids become TransitionGroups sharing one transition name, so "how the board moves" is defined once in CSS rather than three times in markup. Vue's TransitionGroup does the FLIP itself — measure before, measure after, transition the difference away — so no animation dependency, which the task called for. Leavers are deliberately NOT pulled out of flow with position:absolute, the usual TransitionGroup trick. This masonry is CSS multi-column, and an absolutely positioned child escapes its column to the container's origin: a note would fly diagonally across the board on its way out. Keeping leavers in flow costs a small settle when the element is finally removed, so the leave is the shortest of the three durations. EDITOR CONTINUITY. useNoteEditor.open() is the one place that knows which card was clicked, so that is where the card's on-screen centre is captured; the editor panel then scales from that point. Deliberately not a true shared-element morph: scaling by the real card-to-panel ratio distorts the text on the way, and a card is often a third of the modal, so an honest ratio reads as a zoom rather than a transition. The task sanctioned a good-enough scale/position tween; this is that. A point rather than a rect, because nothing needs the card's size and a point survives the card being filtered away while the editor is open. Consumed on read, so a compose — which has no card — cannot inherit the origin of whatever was edited before it and grow from an arbitrary corner. The animation lives inside NoteEditor rather than in the five views that render it: the leave has to finish BEFORE the host unmounts, so the component owns its own visibility and tells the host when it is done. visible starts true with `appear`, because the panel lives inside that v-if and would not exist to measure otherwise. The origin is measured with offsetLeft/offsetTop rather than getBoundingClientRect — enter-from has already applied scale(0.94) by then, so the bounding rect is of the shrunken panel and the origin would land off by a few pixels. Offsets are layout geometry and ignore transforms. Durations are 140-220ms. The brief is continuity, so a card should read as having moved, not as having performed. NOT verified: motion is a visual property and there is no frontend test lane, no device, and no app run here. vue-tsc proves it compiles. Whether it FEELS right is an operator live pass, which is what M7's own verification section asks for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Where the editor should appear to grow from.
|
||||
*
|
||||
* The brief is continuity of the same object: opening a note shouldn't read as a
|
||||
* modal cutting in over the board, it should read as THAT card becoming the editor.
|
||||
* The cheap, robust way to say that is to scale the panel from the point the card
|
||||
* occupies rather than from its own centre — the eye reads the origin and infers
|
||||
* the rest.
|
||||
*
|
||||
* Deliberately NOT a true shared-element morph. Scaling the panel by the real
|
||||
* card→panel ratio distorts the text inside it on the way, and a card is often a
|
||||
* third of the modal's size, so an honest ratio reads as a zoom rather than as a
|
||||
* transition. The task sanctions "a good-enough scale/position tween"; this is that.
|
||||
*
|
||||
* A viewport POINT, not a rect, for the same reason — nothing downstream needs the
|
||||
* card's dimensions, and a point survives the card being filtered away or reflowed
|
||||
* while the editor is open.
|
||||
*/
|
||||
let origin: { x: number; y: number } | null = null;
|
||||
|
||||
/** Record the on-screen centre of the card being opened, if it is on screen. */
|
||||
export function captureMorphOrigin(noteId: string): void {
|
||||
const el = document.querySelector<HTMLElement>(`[data-note-id="${CSS.escape(noteId)}"]`);
|
||||
if (!el) {
|
||||
origin = null;
|
||||
return;
|
||||
}
|
||||
const rect = el.getBoundingClientRect();
|
||||
origin = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the origin and clear it.
|
||||
*
|
||||
* Consume-on-read so a compose (which has no card, and so captures nothing) can't
|
||||
* inherit the origin of whatever note was edited before it and grow from a
|
||||
* seemingly arbitrary corner.
|
||||
*/
|
||||
export function takeMorphOrigin(): { x: number; y: number } | null {
|
||||
const taken = origin;
|
||||
origin = null;
|
||||
return taken;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ref } from "vue";
|
||||
import { useNotesStore, type Note } from "../stores/notes";
|
||||
import { captureMorphOrigin } from "./useEditorMorph";
|
||||
|
||||
// Shared controller for hosting the NoteEditor modal. Every view that opens the
|
||||
// editor used to re-declare the same editing/open/close/navigate glue; this is the
|
||||
@@ -15,6 +16,10 @@ export function useNoteEditor(options: { onClose?: () => void; list?: () => Note
|
||||
const editing = ref<Note | null>(null);
|
||||
|
||||
function open(note: Note): void {
|
||||
// Every view opens the editor through here, so this is the one place that knows
|
||||
// which card the user actually clicked — and therefore the only place the
|
||||
// grow-from-the-card animation can be told where to start (M7).
|
||||
captureMorphOrigin(note.id);
|
||||
editing.value = note;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user