# Icicle Tree

`<ixfx-icicletree-list>` — an icicle (partition) view over tree data. Each depth is a band; each node a rectangle sized by its `valueAccessor` share of its parent. Clicking a branch zooms so it becomes the visual root, with its ancestors in a breadcrumb strip.

It implements the shared `TreeComponent` interface (see [`src/tree/README.md`](./tree.md)). The [sunburst](./sunburst-tree.md) is its polar counterpart.

---

## View state

Implements the shared view-state API (`getViewState()` / `setViewState()` / `clearPendingViewState()` / `view-state-change`) — see [`docs/infra-view-state.md`](./infra-view-state.md). `kind` is `icicletree-list`.

| Field | Type | Meaning |
|---|---|---|
| `selected` | `string[]` | Selected `item.key`s |
| `zoom` | `string[]` | Key path from the root's children to the zoom node; `[]` = full tree |
| `focus` | `string` | Keyboard-cursor `item.key` (recorded only when the cursor was moved by keyboard) |
| `scroll` | `{ top, left? }` | The host's scroll offset (pixels; rects aren't a linear list, so there is no anchor) |

There is no `expanded` (expansion *is* zoom).

```typescript
const stop = bindViewState(el, {
  load: () => JSON.parse(localStorage.getItem(`org`) ?? `null`),
  save: s => localStorage.setItem(`org`, JSON.stringify(s)),
});
el.root = await fetchOrg(); // zoom + selection apply as their nodes arrive
```

- State for nodes not loaded yet stays pending and applies when they appear — whether the tree is reassigned, grown in place (then `requestUpdate()`), or lazily loaded. **Reassigning `root` keeps zoom, selection and cursor** where keys still exist; state for keys that have gone moves to pending (silently) and returns with them.
- `zoom` is a path so a lazy tree can be opened down to it: while pending, the nodes along it are loaded one at a time via `loadChildren` / `model` (set `restoreLoads = false` to only apply it as the host loads them). A zoom node that moved elsewhere in the tree is still found by its key.
- Restored selection fires `select`; a restored zoom fires `zoom` (and `expand`). Any explicit selection change drops pending selection; any explicit zoom (`zoomTo()`, `zoomOut()`, clicks, crumbs, `navigateTo()`…) drops a pending zoom.

| Property | Type | Default | Description |
|---|---|---|---|
| `restoreLoads` | `boolean` | `true` | Load nodes along a pending saved zoom path |
