# Node graph

> The order of operations in a grade: numbered nodes with a picture of their result, serial and parallel paths, a mixer, key and window badges, and the selected node outlined.

Source: https://kwark.space/designSystem/components/node-graph

## Usage

### What it is
A grade is a chain of operations, and order matters: a key pulled after the look sees different colours than one pulled before it. The node graph makes the order visible. Each node is numbered, named and shows a small picture of the image at that point.

The specimen is clip 04, version v3: **01 Balance** and **02 Contrast** in series, then two parallel nodes, **03 Skin** (an HSL key) and **04 Monitor** (a window), joined by a mixer, then **05 Night look v3**, the show LUT.

### When to use
- In a grading app for anything beyond one correction.

### When not to
- In a dailies tool with one look per day: a single list of three steps (*Input transform → Look → Output*) is enough and clearer.

### Behaviour
- Add serial puts a node after the selected one; Add parallel splits the path; the mixer joins it again.
- A node's badge says what is inside: *Key*, *Window*, *LUT*.
- Bypass a node with its number key toggled off (⌘ D); bypassed nodes show their picture at 40% and the word *Off*.
- Choosing a node sets what the wheels, curves and scopes act on and measure.

**Do:** Numbered nodes named for what they do (*Skin*, *Monitor*), with badges and pictures.

**Don't:** Six identical grey boxes named *Corrector 1–6* with no sign of order.

## Style

### Anatomy

1. **Canvas**: `--k-pro-lane`, pans when larger than the panel, never scales text below 11px.
2. **Node**: 96 × 72px; picture 16:9 with the number (11px, on black) top-left and a badge top-right; name 12px under it.
3. **Ports**: 8px squares at mid-height; input left, output right.
4. **Edges**: 1.5px `--k-pro-line-strong` curves; key edges dashed.
5. **Mixer**: 22px circle with a plus.
6. **Selected**: 1.5px `--k-text` outline.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-pro-lane` | #fcfcfd | #141416 |
| `--k-pro-panel` | #f6f7f9 | #19191b |
| `--k-pro-control` | #ffffff | #2a2a2e |
| `--k-pro-line` | #d3d9e0 | rgba(255, 255, 255, .09) |
| `--k-pro-line-strong` | #a9b3bf | rgba(255, 255, 255, .26) |
| `--k-text` | #0f172a | #e3e3e3 |
| `--k-text-2` | #5b6779 | #9ca3af |

### Numbers
| Part | Value |
|---|---|
| Node | 96 × 72px, 4px corners |
| Spacing | 24px between columns, 12px between parallel rows |
| Edge | 1.5px, horizontal tangents 26px |
| Canvas minimum | 660 × 200px; scrolls inside its panel |

## 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
<section class="kw-pro kw-pro-panel kw-pro-nodes" aria-label="Node graph, clip 04">
  <div class="kw-pro-bar"><strong>Nodes</strong><span class="kw-pro-dim kw-pro-ellip">Clip 04 · 12B-1 · version v3</span><span class="kw-pro-sp"></span><button class="kw-pro-btn kw-pro-btn--text" type="button">Add serial</button><button class="kw-pro-btn kw-pro-btn--text kw-pro-x" type="button">Add parallel</button><button class="kw-pro-btn" type="button" aria-pressed="false" aria-label="Bypass all nodes (Command Shift D)" title="Bypass all nodes (Command Shift D)"><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="M12 3v9M18.4 6.6a9 9 0 1 1-12.8 0"/></svg></button></div>
  <div class="kw-pro-nodes__scroll"><div class="kw-pro-nodes__canvas" role="listbox" aria-label="Nodes in processing order">
    <svg class="kw-pro-nodes__edges" viewBox="0 0 660 200" aria-hidden="true"><path d="M14 100C40 100 4 100 30 100"/><path d="M126 100C152 100 124 100 150 100"/><path d="M246 100C272 100 264 48 290 48"/><path d="M246 100C272 100 264 152 290 152"/><path d="M386 48C412 48 394 100 420 100"/><path d="M386 152C412 152 394 100 420 100"/><path d="M442 100C468 100 444 100 470 100"/><path d="M566 100C592 100 592 100 618 100"/></svg>
    <span class="kw-pro-nodes__io" style="left:2px;top:93px">In</span><span class="kw-pro-nodes__io" data-out style="left:624px;top:93px">Out</span>
    <div class="kw-pro-node" role="option" tabindex="-1" aria-selected="false" style="left:30px;top:64px" aria-label="Node 01, Balance"><span class="kw-pro-node__pic"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" data-look="log" 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><b>01</b></span><span class="kw-pro-node__label">Balance</span><i class="kw-pro-node__port" data-side="in"></i><i class="kw-pro-node__port" data-side="out"></i></div><div class="kw-pro-node" role="option" tabindex="-1" aria-selected="false" style="left:150px;top:64px" aria-label="Node 02, Contrast"><span class="kw-pro-node__pic"><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><b>02</b></span><span class="kw-pro-node__label">Contrast</span><i class="kw-pro-node__port" data-side="in"></i><i class="kw-pro-node__port" data-side="out"></i></div><div class="kw-pro-node" role="option" tabindex="0" aria-selected="true" style="left:290px;top:12px" aria-label="Node 03, Skin, Key"><span class="kw-pro-node__pic"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" data-look="warm" 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><b>03</b><em>Key</em></span><span class="kw-pro-node__label">Skin</span><i class="kw-pro-node__port" data-side="in"></i><i class="kw-pro-node__port" data-side="out"></i></div><div class="kw-pro-node" role="option" tabindex="-1" aria-selected="false" style="left:290px;top:116px" aria-label="Node 04, Monitor, Window"><span class="kw-pro-node__pic"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" data-look="cool" 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><b>04</b><em>Window</em></span><span class="kw-pro-node__label">Monitor</span><i class="kw-pro-node__port" data-side="in"></i><i class="kw-pro-node__port" data-side="out"></i></div>
    <span class="kw-pro-nodes__mix" style="left:420px;top:89px" role="option" tabindex="-1" aria-selected="false" aria-label="Parallel mixer joining nodes 03 and 04">+</span>
    <div class="kw-pro-node" role="option" tabindex="-1" aria-selected="false" style="left:470px;top:64px" aria-label="Node 05, Night look v3, LUT"><span class="kw-pro-node__pic"><svg class="kw-pro-pic" viewBox="0 0 160 90" preserveAspectRatio="xMidYMid slice" data-look="night" 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><b>05</b><em>LUT</em></span><span class="kw-pro-node__label">Night look v3</span><i class="kw-pro-node__port" data-side="in"></i><i class="kw-pro-node__port" data-side="out"></i></div>
  </div></div>
</section>
```

## Accessibility

### Keyboard
| Key | Does |
|---|---|
| ← / → | Previous / next node in processing order |
| ↑ / ↓ | Between parallel nodes |
| ⌥ S / ⌥ P | Add serial / parallel |
| ⌘ D | Bypass the selected node |
| Delete | Remove the node (Undo restores it) |

### ARIA
- The canvas is a `listbox` in processing order; each node is an `option` named *Node 03, Skin, Key*.
- Order is announced on move: *Node 03 of 5, parallel with 04*.

## For agents

### Rules

- **Must** number nodes in processing order and keep the numbers stable when the graph is tidied.
- **Must** show what each node contains with a word badge (Key, Window, LUT).
- **Always** let keyboard users walk the graph in processing order.
- **Never** scale node text down to fit; pan the canvas instead.

### AI readiness test

**Task:** Show the processing order of a dailies look for a DIT.

**Give the agent:** Node graph, Looks and LUTs, Colour grading kit.

**Constraint:** Input transform, CDL from set, show LUT; nothing else.

**A reliable answer:**
- Three numbered nodes in series
- Badges CDL and LUT
- Pictures per node
- Keyboard walk in order
- Bypass shows Off in words
