# Source and program viewers

> Two viewers side by side: the clip on the left in its own clock, the sequence on the right; one is active at a time, and the edit buttons sit between them.

Source: https://kwark.space/designSystem/components/viewer-pair

## Usage

### What it is
The two-up every editor works in. **Source** plays one clip in its camera clock; **Program** plays the sequence. Three-point editing happens between them: mark two points on one side and one on the other, then Insert or Overwrite.

### When to use
- In an editor or assembly tool where clips are placed into a sequence.
- For match frame: from a program frame, open the same frame of its source clip.

### When not to
- In review tools (one program viewer is enough).
- On a phone: one viewer at a time with a *Source / Program* switch, and no editing.

### Rules of the pair
- Exactly one viewer is active. Keys go to it; it shows a 2px playhead-coloured line under its header. Tab or a click moves activity.
- Each viewer labels its clock. Source never shows program time and the reverse.
- In–out ranges are per viewer. The bar between them states the edit before it happens: *Source in 14:27:57:12 · Program in 01:04:17:00*.
- **Insert** pushes later clips down; **Overwrite** replaces. They are words, not glyphs.

**Do:** Source on the left, active, with its own clock; Program on the right with sequence time; *Insert* and *Overwrite* as words.

**Don't:** Two identical unlabelled viewers and two arrow icons that do different things.

## Style

### Anatomy

1. **Two viewers**: equal width, 2px gap on `--k-pro-well`.
2. **Active line**: 2px `--k-pro-playhead` under the active header.
3. **Edit bar**: 32px, centred: Insert, Overwrite, Match frame and a sentence that states the three points.
4. **Narrow**: under 560px the pair stacks; under 420px only the active viewer shows with a two-way switch.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-pro-picture` | #0b0b0c |  |
| `--k-pro-panel` | #f6f7f9 | #19191b |
| `--k-pro-playhead` | #c4502f | #f28b71 |
| `--k-pro-mark` | #23767d | #83cfd3 |
| `--k-pro-line` | #d3d9e0 | rgba(255, 255, 255, .09) |
| `--k-text-2` | #5b6779 | #9ca3af |

### Numbers
| Part | Value |
|---|---|
| Gap | 2px on `--k-pro-well` |
| Edit bar | 32px, text buttons 24px with 12px Poppins 500 |
| Stack point | container under 560px |

## Code

### React

Use the HTML below with `kwark.css`. The example shows the markup and styling. Supply any application behavior described on this page.

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<div class="kw-pro kw-pro-pair"><figure class="kw-pro kw-pro-viewer" data-active aria-label="Source viewer, 12B-4 · Mira CU">
  <div class="kw-pro-bar"><strong>Source</strong><span class="kw-pro-dim kw-pro-ellip">12B-4 · Mira CU</span><span class="kw-pro-sp"></span><button class="kw-pro-btn kw-pro-btn--menu" type="button" aria-haspopup="menu" aria-label="Zoom: Fit">Fit<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button><button class="kw-pro-btn" type="button" aria-pressed="false" aria-label="Safe area guides" title="Safe area guides"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="1"/><rect x="6.5" y="8" width="11" height="8" stroke-dasharray="2 2"/></svg></button></div>
  <div class="kw-pro-viewer__pic"><div class="kw-pro-viewer__frame"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><rect class="w" width="160" height="90"/><circle class="l" cx="26" cy="22" r="11" opacity=".35"/><circle class="l" cx="46" cy="33" r="5" opacity=".25"/><path class="b" d="M40 90c0-19 19-29 44-29s44 10 44 29z"/><rect class="s" x="76" y="52" width="16" height="14"/><ellipse class="s" cx="84" cy="40" rx="17" ry="21"/><path class="h" d="M66 42c0-17 8-25 19-25s18 8 18 23c-4-9-10-13-18-13s-14 7-19 15z"/><path class="m" d="M99 29c4 5 5 13 3 21l-3 4c2-9 2-17 0-25z" opacity=".85"/></svg><span class="kw-pro-burn" data-pos="tl">12B-4 · A003C019</span><span class="kw-pro-burn kw-tc" data-pos="bc">14:27:58:02</span></div></div>
  <div class="kw-pro-vscrub"><span class="kw-pro-vscrub__io" style="left:22%;width:36%"></span><span class="kw-pro-vscrub__ph" role="slider" tabindex="0" style="left:31%" aria-label="Source position" aria-valuemin="0" aria-valuemax="576" aria-valuenow="179" aria-valuetext="14:27:58:02"></span></div>
  <div class="kw-pro-viewer__foot"><output class="kw-pro-tc">14<i>:</i>27<i>:</i>58<i>:</i>02</output><div class="kw-pro-transport" role="toolbar" aria-label="Source transport"><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Mark in (I)" title="Mark in (I)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4H9v16h5"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Go to in (Shift I)" title="Go to in (Shift I)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 5H6v14h3M20 12h-9m3-3.5L10.5 12l3.5 3.5"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Back one frame (Left arrow)" title="Back one frame (Left arrow)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M5 5h2v14H5zM19 5v14L8.5 12z"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Play backwards (J)" title="Play backwards (J)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17 4.5v15L5 12z"/></svg></button><button class="kw-pro-btn kw-pro-btn--play" type="button" aria-label="Play (Space or L)" title="Play (Space or L)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7 4.5v15l12-7.5z"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Forward one frame (Right arrow)" title="Forward one frame (Right arrow)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17 5h2v14h-2zM5 5v14l10.5-7z"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Go to out (Shift O)" title="Go to out (Shift O)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 5h3v14h-3M4 12h9m-3-3.5 3.5 3.5-3.5 3.5"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Mark out (O)" title="Mark out (O)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 4h5v16h-5"/></svg></button></div><span class="kw-pro-tc kw-pro-dim kw-pro-x" title="In to out">00<i>:</i>00<i>:</i>03<i>:</i>14</span></div>
</figure><figure class="kw-pro kw-pro-viewer" aria-label="Program viewer, Scene 12 · cut v4">
  <div class="kw-pro-bar"><strong>Program</strong><span class="kw-pro-dim kw-pro-ellip">Scene 12 · cut v4</span><span class="kw-pro-sp"></span><button class="kw-pro-btn kw-pro-btn--menu" type="button" aria-haspopup="menu" aria-label="Zoom: Fit">Fit<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button><button class="kw-pro-btn" type="button" aria-pressed="true" aria-label="Safe area guides" title="Safe area guides"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="1"/><rect x="6.5" y="8" width="11" height="8" stroke-dasharray="2 2"/></svg></button></div>
  <div class="kw-pro-viewer__pic"><div class="kw-pro-viewer__frame"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><rect class="d" width="160" height="90"/><rect class="m" x="12" y="9" width="136" height="70"/><rect class="f" x="12" y="62" width="136" height="17" opacity=".55"/><circle class="f" cx="80" cy="34" r="9"/><path class="f" d="M62 79c0-15 8-23 18-23s18 8 18 23z"/></svg><span class="kw-pro-viewer__safe" data-k="action"></span><span class="kw-pro-viewer__safe" data-k="title"></span><span class="kw-pro-burn" data-pos="tl">12C-2 · B001C007</span><span class="kw-pro-burn kw-tc" data-pos="bc">01:04:14:10</span></div></div>
  <div class="kw-pro-vscrub"><span class="kw-pro-vscrub__io" style="left:70.8%;width:29.200000000000003%"></span><span class="kw-pro-vscrub__ph" role="slider" tabindex="0" style="left:60%" aria-label="Program position" aria-valuemin="0" aria-valuemax="576" aria-valuenow="346" aria-valuetext="01:04:14:10"></span></div>
  <div class="kw-pro-viewer__foot"><output class="kw-pro-tc">01<i>:</i>04<i>:</i>14<i>:</i>10</output><div class="kw-pro-transport" role="toolbar" aria-label="Program transport"><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Mark in (I)" title="Mark in (I)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 4H9v16h5"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Go to in (Shift I)" title="Go to in (Shift I)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 5H6v14h3M20 12h-9m3-3.5L10.5 12l3.5 3.5"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Back one frame (Left arrow)" title="Back one frame (Left arrow)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M5 5h2v14H5zM19 5v14L8.5 12z"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Play backwards (J)" title="Play backwards (J)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17 4.5v15L5 12z"/></svg></button><button class="kw-pro-btn kw-pro-btn--play" type="button" aria-label="Play (Space or L)" title="Play (Space or L)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7 4.5v15l12-7.5z"/></svg></button><button class="kw-pro-btn" type="button" aria-label="Forward one frame (Right arrow)" title="Forward one frame (Right arrow)"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17 5h2v14h-2zM5 5v14l10.5-7z"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Go to out (Shift O)" title="Go to out (Shift O)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 5h3v14h-3M4 12h9m-3-3.5 3.5 3.5-3.5 3.5"/></svg></button><button class="kw-pro-btn kw-pro-x" type="button" aria-label="Mark out (O)" title="Mark out (O)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 4h5v16h-5"/></svg></button></div><span class="kw-pro-tc kw-pro-dim kw-pro-x" title="In to out">00<i>:</i>00<i>:</i>07<i>:</i>00</span></div>
</figure></div>
<div class="kw-pro kw-pro-panel kw-pro-tbar" style="justify-content:center"><button class="kw-pro-btn kw-pro-btn--text" type="button" title="Insert (,)">Insert</button><button class="kw-pro-btn kw-pro-btn--text" type="button" title="Overwrite (.)">Overwrite</button><span class="kw-pro-sep"></span><button class="kw-pro-btn" type="button" aria-label="Match frame (F)" title="Match frame (F)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="8" height="7" rx="1"/><rect x="13" y="13" width="8" height="7" rx="1"/><path d="M11 7.5h3a3 3 0 0 1 3 3V13"/></svg></button><span class="kw-pro-dim">Source in 14:27:57:12 · Program in 01:04:17:00</span></div>
```

## Accessibility

### Keyboard
| Key | Does |
|---|---|
| Q | Toggle the active viewer (Source / Program) |
| , (comma) | Insert |
| . (full stop) | Overwrite |
| F | Match frame |

### ARIA
- Each viewer is a labelled `<figure>`; the active one also gets `aria-current="true"`.
- Insert and Overwrite announce the result: *Inserted 12B-4 at 01:04:17:00, 3 seconds 14 frames*.

## For agents

### Rules

- **Must** have exactly one active viewer and mark it.
- **Must** label each viewer's clock; never show program time in the source viewer.
- **Always** write Insert and Overwrite as words.
- **Always** state the three points before an edit lands.
- **Never** offer editing in the pair on a phone.

### AI readiness test

**Task:** Build the two-up for a dailies assembly tool.

**Give the agent:** Source and program viewers, Video player, Transport bar, Edit timeline.

**Constraint:** Three-point editing with Insert and Overwrite; one keyboard focus.

**A reliable answer:**
- Source left, Program right
- One active viewer with a visible line
- Clocks labelled
- Edit bar states points
- Q toggles
- Comma and full stop edit
