Skip to content

TUI - Program-scoped animation runtime - #3843

Merged
dgageot merged 1 commit into
docker:mainfrom
krissetto:tui-animation-infrastructure
Jul 27, 2026
Merged

TUI - Program-scoped animation runtime#3843
dgageot merged 1 commit into
docker:mainfrom
krissetto:tui-animation-infrastructure

Conversation

@krissetto

Copy link
Copy Markdown
Contributor

First of many TUI improvement proposals :)

This PR sets some animation-related foundations for enabling a better overall TUI UX where we can:

  • centralize spinners, durations, transitions, effects, etc for easier re-use
  • make time based animations and effects, so frame rate changes or system load doesn't affect how long animations run
  • start introducing more advanced effects more easily and robustly, e.g. fades, transitions, etc
  • improve TUI re-rendering logic to reduce cpu usage
  • facilitate integration of docker agent components into other pre-existing TUIs

Why

The current global coordinator advances animations by frame count and does not own queued ticks. Under event-loop delays, animations slow down; stale or duplicate tick chains also cannot be rejected cleanly.

What changed

  • Adds one program-owned animation runtime with a single shared tick lease.
  • Rejects stale, duplicate, and foreign ticks; stopping invalidates queued work.
  • Drives transitions and spinners from elapsed duration, so missed frames do not change animation speed.
  • Preserves the package facade during partial migration: delivered legacy ticks re-arm without Runtime.Accept, and IsCurrentGen remains a side-effect-free generation check. This matches some consumer's direct use of TickMsg, StartTick*, HasActive, and IsCurrentGen.

Component adoption of the new infra is for later PRs. The legacy facade can be removed after components and consumers have migrated.

flowchart LR
    Root["TUI root"] --> AnimationRuntime["Program animation runtime"]
    AnimationRuntime -->|shared tick| Components
    Components -->|subscribe while active| AnimationRuntime
Loading
flowchart LR
    Delivery["Tick delivery"] --> Clock["Elapsed time"]
    Clock --> Transition["progress = elapsed / duration"]
    Clock --> Spinner["frame = elapsed / cadence"]
Loading

@krissetto
krissetto requested a review from a team as a code owner July 27, 2026 11:29
@aheritier aheritier added area/tui For features/issues/fixes related to the TUI kind/refactor PR refactors code without behavior change status/needs-rebase PR has merge conflicts or is out of date with main labels Jul 27, 2026
@aheritier

Copy link
Copy Markdown
Collaborator

👋 This PR has merge conflicts with the base branch. Please rebase or merge the latest base branch and resolve them. I've moved it to draft and added status/needs-rebase; it'll be picked back up automatically once the conflicts are cleared.

@krissetto
krissetto force-pushed the tui-animation-infrastructure branch from 1fd22c3 to 6053c20 Compare July 27, 2026 11:58
@aheritier aheritier removed the status/needs-rebase PR has merge conflicts or is out of date with main label Jul 27, 2026
@krissetto
krissetto force-pushed the tui-animation-infrastructure branch from 6053c20 to fa302fd Compare July 27, 2026 12:09
@dgageot
dgageot merged commit f951dcc into docker:main Jul 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tui For features/issues/fixes related to the TUI kind/refactor PR refactors code without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants