Commit Graph
11 Commits
Author SHA1 Message Date
Miguel Ángel 9106772593 fix(studio): a rotation saves through its press route; a host hook reloads only the host's way (#4961)
* fix(studio): a rotation saves through the route its press chose

* fix(studio): a host hook reloads its preview only the way the host says
2026-10-03 15:54:29 -07:00
Miguel Ángel e27cae0261 fix(studio): a resize saves through the route its press chose, as a move does (#4943) 2026-10-03 14:32:46 -07:00
Miguel Ángel 7dea1e581f fix(studio): playhead keyframe edits keep their ease, undo names its edit and never waits on videos (#4889)
* fix(studio): an edit on a GSAP-animated layer writes its value at the playhead into the file's tween

* fix(studio): undo pressed while an edit saves undoes that edit, not one started after the key

* fix(studio): an edit stays saved when the history reply after it cannot be read

* feat(studio): export ColorField and GradientField; a session style commit takes a map

* refactor(studio): name the map form instead of commenting it

* feat(studio): a host can move layers by exact film px, one undo per call

handleDomGroupMoveBy(moves) on useDomEditSession and DomEditValue moves each
selection by its delta in composition px, for Desktop's align and distribute.

It reuses the group drag's own path: a drag member per element (press-time
route, measured offset map), the delta carried to screen px through the
preview frames, then handleGsapAwareGroupPathOffsetCommit, so one shared
coalesce key gives one undo entry and GSAP members take the GSAP write.
A member that can't move refuses the call before anything is written; the
refusal rejects with its reason and shows no Studio toast (the group commit
takes refusalToast: false; telemetry stays). Zero deltas are skipped.

Tests: a pre-offset element and one under a half-scale parent move by exactly
{10,0} and {0,-5} under one group key; a half-scale parent with a 30 deg
rotated ancestor lands within the 0.001 px a translate is written with; a
GSAP member goes through the GSAP write; three refusal kinds write nothing,
leave the boxes where they were, show no toast and leave no gesture mark,
while a canvas group drag still toasts; the session hands the call to the
group commit with refusalToast: false. Each mutation (no frame mapping, no
zero skip, no restore, no teardown, no capability check, toast on refusal)
fails at least one of them.

* fix(studio): an outside change during a drag waits for the drop to show

While a gesture mark is live in the preview, refreshPlayer takes the shadow load instead of
swapping scenes in place. A swap replaced the node under the pointer mid-drag; the shadow load
is then held by the existing gesture hold and, if the drop saved, reloaded fresh by the stale
rule, so this adds no second "released" signal.

Test: an outside change during a live drag on a preview that can swap scenes leaves the dragged
node in place, shows nothing under the pointer, and after the drop loads fresh with the dropped
position. It fails on the parent without the condition ("swapped under the pointer").

Cost case, measured in a real headless preview on the edit-accuracy bench's per-frame teleport
check. Every GSAP instant patch was forced to miss and fall back to reloadPreview during its own
commit; move and rotate of a held element (gsap.set and tl.set holds), px and xPercent
placement, r0 and r30, root and nested, at 100%:
- The gesture mark was live when the fallback asked for the reload, but had always ended by the
  time refreshPlayer ran (refreshKey is consumed in an effect after the commit settles). So the
  new condition never fired there: root previews offer no scene swap and load shadow on both
  builds, and nested previews swap on both builds.
- Worst post-release frame offset, 32 cases on this build and 32 on the parent: 0.00 px over
  76-106 frames each (release to settle). No frame was off by more than 0.5 px.
- Sensitivity: a 3 px nudge injected 50 ms after the fallback reads back as 3.00 px.

* fix(studio): an edit no longer reopens the live-updates stream, and thumbnails ask one at a time

* fix(studio): an undo no longer waits behind paused preview videos for a connection

* feat(studio): a host whose API needs same-origin cookies can have Studio send them

* docs(studio-server): a host on same-origin cookies sets the Studio credentials opt-out

* test(studio): an undo is not held up by the preview's paused videos

* fix(studio): a resize inside one gesture writes a mixed tween once, in place, never beside it

* chore(studio): keep the carried fixes inside the comment ratchet; telemetry posts through studioApiFetch

* test(studio): a drag on a mixed tween is one write under the gesture key

* fix(studio): freeze-frame, loudness and peak-map requests go through studioApiFetch too

* fix(studio): an undo with no project open reloads in full instead of skipping nested files

* refactor(studio): drop the soft reload's reparse seeding, the held-element sweep covers it

* test(studio): keep the undo-restore browser test off the network and inside its timeout

* test(studio): nested composition reads expect the cookie-free request studioApiFetch sends

* fix(studio): an edit at the playhead rewrites its tween in place, so later tweens keep their times

* fix(studio): a rotate on a tween that turns another axis holds its angle and never turns early

* fix(studio): plan every group member before the first write so one refusal moves none

A group drag or nudge preflighted each member against the move refusal rule only. The value-at-playhead planner ran later, in the commit loop, after earlier members were already flushed to disk, so a tween with extras, eased keyframes or an unknown ease left the group half moved.

The group preflight now runs the commit's own route and keyframe plan for every member with its real offset, so any refusal refuses the whole group with nothing written and one toast attributed to the refusing member. The plan is not reused in the commit: earlier members' writes change the file under it, so each member re-plans against the fresh tween, from the same planValueEdit.

* chore(studio): the fetch lint rule also catches window.fetch, globalThis.fetch and self.fetch

* docs(studio-server): set the credentials flag before Studio loads; a mounting host injects it

* test(studio): the undo socket test needs six pinned videos under Vite and checks each undo restores

* fix(studio): Studio leaves cookies out of its requests only when served from loopback

* fix(studio): undo takes back the first edit, and the first save never waits on media

* fix(studio): undo of a move whose save failed stays undone and steps back no older edit

* fix(studio): a style set by its JavaScript name saves under its CSS name

* test(studio): the undo socket test holds round 0 to a full restore too

* fix(studio): the host revert keeps returning what shows the edit again

* fix(studio): an entrance rewritten at the playhead still shows its start state before it starts

* fix(studio): undo takes back the edit pending at the key even after a later edit claims

* chore(studio): lift the late-write quarantine now that undo never waits on videos; format

* test(studio): pin an entrance's start render on the written tween, not a happy-dom GSAP run

* revert(studio): leave entrances as on main, immediateRender does not render a keyframed start

This reverts commit ee9d130d3c and its written-vars test.

* revert(studio): undo goes back to the newest claim after the key, as on main

This reverts commit 5b9009a823.

* revert(studio): first-undo history opening moves to the next PR

This reverts commit 4e1e75d7f4.

* revert(studio): the undo socket test exempts round 0 again until first-undo lands

This reverts commit 1f8f97047c.

* test(studio): bank the edit accuracy cases this PR makes pass

* refactor(studio): share one project file fetch between the plain and optional reads

* test(studio): share the WebMCP host shim between the browser gates

* test(studio-server): share one stub adapter across the route tests

* refactor(studio): type the preview slot props from the NLE context

* test(studio): share the setup the new editing tests copied between files

* refactor(studio): split playhead tween picking and undo path merging into small tested helpers

* test(studio): pin when a resize at the playhead also writes the anchor move

* test(parsers): pin rewriting a tween in place as keyframes

* chore(studio): cut comments the new helper names already say

* fix(studio): composition thumbnails keep two fetches in flight, as the document lifetime fix expects

* fix(studio): a playhead edit parses a tween not yet played and matches only its own tween

* fix(parsers): a new position argument goes after the last argument, so trailing commas stay valid

* fix(studio): a second undo pressed during one save steps back to the edit before it

* test(studio): pin the slot an aborted thumbnail frees and the shared tween refusal

* refactor(studio): split the unplayed-tween parse into small helpers and name the claim release

* fix(studio): a playhead edit keeps the tween's default ease, delay timing and loop settings

* fix(studio): a group move refuses layers animated in two files and plans at the real drop

* style(studio): format two test files

* refactor(studio): check a group's files inside the preflight helper

* refactor(studio): move the group preflight checks out of the editing hook, under 600 lines

* fix(studio): read an unreached tween without redrawing other layers, and compare write files

* test(studio): use the shared selection helper in main's keyframe-at-time telemetry test

* chore(studio): fix a comment that read as a repo path and cut one added comment

* fix(studio): read a later tween's start as playback does, and count every keyframe add

* fix(studio): two undo presses during one save step back two edits, not one twice

* fix(studio): an undo that succeeds by any route retires the claim on the edit it undid

* fix(studio): a claim is never handed back to an edit another undo has already undone

* fix(studio): an undo picks its claimed edit at the press and skips it once undone

* fix(studio): a press refuses, as main did, once its edit is undone and a newer edit exists

* fix(studio): an unplayed keyframe tween clears every keyframe's channels before it is read

* fix(studio): reading an unplayed tween puts back every transform value its clear removed

* fix(studio): reading an unplayed tween restores each layer's whole style and GSAP state

* fix(studio): reading an unplayed tween skips plain-object targets and restores attributes

* fix(studio): shared tween-target filter uses GSAP's own styled-element test

* fix(studio): match a parsed tween on any target, and check a later keyframe channel's start

* docs(studio): say the unplayed-tween read restores styled elements only

* test(studio): a drag on a fromTo start shows the dropped x through the runtime seek
2026-10-03 13:10:54 -07:00
Miguel Ángel 852782bbb0 feat(studio): track completed preview editing gestures (#4916)
* feat(studio): track completed preview editing gestures

* fix(studio): preserve gesture receipts and suppress duplicate usage

* fix(studio): count semantic keyframe writes once per gesture

* fix(studio): isolate recording state during pending saves

* fix(studio): count marquee selection changes from owner receipts

* fix(studio): retain accurate empty marquee receipts

* refactor(studio): simplify recording transitions and selection tests

* refactor(studio): share recording timing and marquee fixtures

* fix(studio): preserve recording targets and batch attribution

* fix(studio): retain per-member telemetry suppression

* style(studio): format batch receipt attribution

* test(studio): match writer receipts and animation metadata

* docs(studio): clarify paused position save rejection

* fix(studio): replace telemetry route names with route identity

* style(studio): format route identity regression

* Use random tab-local route identities in Studio telemetry

* Preserve route identities inherited through session storage

* Separate route storage validation from token creation
2026-10-03 00:13:18 +00:00
Miguel Ángel 0b417cb57a refactor(studio): delete the move writer no Studio path calls (#4837) 2026-10-01 05:46:28 -07:00
Miguel Ángel 74f5013210 fix(studio): a rotate without GSAP saves where you let go, nested too (#4802)
* fix(studio): a rotate GSAP does not own saves where you let go, as the element's own CSS rotate

* fix(studio): a rotate keeps a transform-centred element in place

* fix(studio): a plain rotate shows its angle in the panel and turns inline elements too

* fix(studio): a rotate turns a mirrored or stretched centred element with the cursor

* fix(studio): keep the rotate's panel readout within the comment budget after the move landed

* fix(studio): an inline element's turn saves the inline-block it was drawn with

The overlay passes the rotate target it read at press into the commit, so the
save draws and patches exactly what the draft did instead of re-reading an
element the draft already made inline-block. The GSAP-aware commit also routes
on that press-time decision.

* test(studio): bank the 27 rotate cases a GSAP-free rotate now passes

baseline.json is the edit-accuracy-gate artifact of the CI run at cb75cc37,
copied byte for byte: 530 to 557 passing, all rotate-none cases, none
regressed.

* fix(studio): a word an older Studio turned keeps its inline-block and whole angle on a new rotate

Clearing the legacy rotation marks puts the element back to inline and drops
their turn, so the save reads the target again instead of using the one the
press read before the clear. A test also pins that a turn the press drew as CSS
stays on the CSS writer.

* test(studio): bank the edit accuracy baseline from the rebased rotate run
2026-10-01 03:38:30 -07:00
Miguel Ángel 2eb1919103 fix(studio): a move keeps the route it chose at press through drop and save (#4834)
* fix(studio): a move keeps the route it chose at press through drop and save

* fix(studio): a refused move drops the transform GSAP folded it into, so the layer goes back

* fix(studio): a group refuses a GSAP takeover before writing any member, and only a real fold refuses
2026-10-01 02:02:11 -07:00
Miguel Ángel 3e011b7e5f fix(studio): resize an element without GSAP by its own width, height and translate (#4805)
* fix(studio): resize an element without GSAP by its own width, height and translate

A corner resize of an element GSAP does not size or position now saves plain CSS:
its inline width and height, the scaled crop, and the translate that keeps its
centre where it was, in one save and one undo step, with no animation read and
no preview reload. It used to write a GSAP script into a file that had none, and
the box snapped back to its old size on release.

The anchor that keeps the centre planted is the same plain px translate a move
writes, kept to a thousandth of a pixel, and a percent translate is held as px
from the press so a growing box cannot drag it along on the first frame.

* fix(studio): a resize leaves a box to GSAP when GSAP tweens anything the CSS box writer sets

gsapWritesBox now reads its channels from BOX_SIZE_STYLE_PROPS, the writer's own
property set, instead of width and height alone. A host-level test pins the
GSAP-free resize route through useDomGeometryCommit.

* fix(studio): a GSAP scaleX or scaleY tween also keeps a resize on the GSAP route

They are GSAP's names for parts of the one CSS scale the box writer sets.

* test(studio): bank the edit accuracy cases a plain-CSS resize now passes

baseline.json is the edit-accuracy-gate artifact of the CI run at 5ae51f1d,
copied byte for byte: 494 to 530 passing, the 36 resize cases without GSAP,
none regressed.
2026-10-01 00:57:46 -07:00
Miguel Ángel 76c634dfa5 fix(studio): resizing a cropped element keeps the same part of it in view (#4743)
* fix(studio): resizing a cropped element keeps the same part of it in view

Rebased onto main as one commit (was a0a86cc1..080dfecf). Merged with the crop
release rule from main: a drag that ends where it started saves nothing.

* fix(studio): the crop follows each axis GSAP does not tween, while dragging and once saved

* fix(studio): the live-tween check reads every timeline, not only the first after a soft reload
2026-09-30 18:44:04 +00:00
Miguel Ángel 5606b31020 fix(studio): moving one word moves only that word, not every word sharing its animation (#4705)
* fix(studio): move only the dragged word, not every word sharing its tween

A drag on one element whose position tween also targets its siblings (a stagger on a
shared class) now persists that element's own offset instead of rewriting the shared
tween. The motion-path overlay leaves such a tween read-only, and every write of one
drag records as one undo step.

* fix(studio): keep the comment share flat in the word-move fix

* fix(studio): save a shared-tween word's move as left/top on that word

A CSS translate offset on an element a GSAP tween still drives gets folded into GSAP's
transform, so render, preview and a second drag disagreed. left/top is never parsed by
GSAP, adds to any offset the word already has, and is refused when it would not shift
the box exactly. The resize anchor move takes the same channel, and tweens that miss the
element or are shared with siblings no longer steer a drag that has its own tween.

* refactor(studio): drop the untested own-tween selector override in the drag

* fix(studio): keep a Layers-picked word's move and make a resize one undo step

A word picked in the Layers panel is lifted to position:relative for display only; the
move now reads the authored position, saves position:relative, and survives deselect.
An anchored resize saves its move after the size, under the same undo key, and drops it
when the size save fails. A percent left or top gets its own refusal message.

* fix(studio): give the host canvas hook the per-word left/top move

The host geometry hook now stages a shared-tween word's move with the same left/top
offset as the editor, saved through the host's patch path, so a Desktop drag of one
word moves only that word.

* fix(studio): keep host word moves saving after one failed save

The host canvas hook reset its save queue per save, as the host style hook does, so one
conflict no longer pauses every later word move. A save error the patch path already
showed is no longer covered by a generic failure toast.
2026-09-29 03:58:28 +00:00
Miguel Ángel 001d001c58 feat(studio): a host can save canvas moves, resizes and rotations with the handles (#4709)
* feat(studio): a host can save canvas moves, resizes and rotations with the handles

* fix(studio): the canvas overlay accepts commits that resolve to an outcome

* fix(studio): host resizes undo on a failed save and refuse without a timeline session

* style(studio): wrap long lines and trim a comment

* fix(studio): host geometry saves refuse until the preview has loaded
2026-09-29 01:57:44 +00:00