Skip to content

feat: add timeline track and clip creation APIs - #154

Open
Errordog2 wants to merge 6 commits into
jbilcke-hf:mainfrom
Errordog2:codex/clapper-track-clip-creation
Open

feat: add timeline track and clip creation APIs#154
Errordog2 wants to merge 6 commits into
jbilcke-hf:mainfrom
Errordog2:codex/clapper-track-clip-creation

Conversation

@Errordog2

@Errordog2 Errordog2 commented Jun 8, 2026

Copy link
Copy Markdown

Closes #10

Summary

  • Add timeline store APIs for creating tracks and clips programmatically.
  • Materialize missing intermediate tracks when a requested track id is beyond the current track list.
  • Reuse visible same-category tracks for new clips when the target time range has room.
  • Mark existing tracks as occupied when a clip is assigned to them and update empty-track labels to the clip category.
  • Add a compact left-bar + control for creating a new empty track directly in the timeline UI.
  • Add a left-track dropdown for setting editable track categories.
  • Add a timeline UI entry point: double-clicking the empty timeline plane creates a clip at the cursor time and on the clicked track/category.
  • Add same-category clip movement support with collision rejection for timeline drag interactions.
  • Preserve the grab offset during pointer drag so clips move from the point the user picked up instead of jumping to the pointer center.
  • Capture and release the pointer during clip drags so the drag can continue while the cursor crosses clip-edge hit areas.
  • Add Bun tests for creating empty tracks, creating clips, setting track categories, moving clips, pointer-drag movement, clamping negative movement, rejecting overlap, and rejecting cross-category/category-change moves.
  • Fix the local @aitube/clap workspace entrypoint/type exports so Bun can resolve the monorepo package during tests.

Validation

  • npx --yes bun --no-install test ./packages/timeline/test/test.tsx passed on head 93bde53: 11 tests, 42 assertions.
  • git diff --check main...HEAD passed.

Scope

This adds the store/API foundation for timeline track and clip creation, a direct add-track control, a track category dropdown, double-click clip creation, same-category movement support, pointer-drag behavior that preserves the grabbed offset, and guard coverage for invalid category changes, overlap, and negative movement. Richer clip authoring controls can build on these APIs separately.

@Errordog2

Copy link
Copy Markdown
Author

Validation update after strengthening the edge-case coverage for this bounty:

  • New head: 4f5e1f6000f3481a41a616dd7ce6d02ffba7d1ba
  • Added regression coverage for three acceptance-sensitive guards:
    • occupied tracks cannot be changed to an incompatible category
    • leftward clip movement clamps at zero while preserving duration
    • same-category moves into overlapping slots are rejected
  • git diff --check passed
  • npx --yes bun --no-install test ./packages/timeline/test/test.tsx passed: 10 tests, 37 assertions

This keeps the implementation scoped to timeline track/clip authoring and makes the existing compatibility/overlap/clamp behavior easier to verify during review.

@Errordog2

Copy link
Copy Markdown
Author

Follow-up validation for the timeline drag requirements in #10:

  • Added pointer-drag handling that preserves the grabbed offset, so clips no longer jump to the pointer center when dragged.
  • Removed the requirement that the pointer remain in the clip middle hit area during an active drag, and capture/release the pointer for steadier drag behavior.
  • Added regression coverage for dragging a clip from one track to another same-category track while preserving the grabbed offset.

Validation: git diff --check passed with only CRLF normalization warnings; npx --yes bun --no-install test ./packages/timeline/test/test.tsx passed with 11 tests and 42 assertions on remote head 00d58b3.

@Errordog2
Errordog2 force-pushed the codex/clapper-track-clip-creation branch from 00d58b3 to 93bde53 Compare June 13, 2026 19:39
@Errordog2

Copy link
Copy Markdown
Author

Maintenance update for current head 93bde53:

  • Replaced the previous drag-offset fix commit with a clean patch that avoids the large line-ending churn in the prior remote head.
  • Re-ran focused validation: npx --yes bun --no-install test ./packages/timeline/test/test.tsx -> 11 tests passed, 42 assertions.
  • git diff --check main...HEAD -> passed.

No scope change from the submitted #10 implementation; this keeps the PR easier to review and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeline - Create new Tracks and Clips

1 participant