# frontendfyi/macos-dock-animation-with-css architecture

> Architecture diagram of the GitHub repository frontendfyi/macos-dock-animation-with-css, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frontendfyi/macos-dock-animation-with-css
- Repository: https://github.com/frontendfyi/macos-dock-animation-with-css

## Overview

This is a small React/TypeScript demonstration recreating the macOS Dock hover animation. The browser mounts the dock, and pointer movement over an icon computes a bounded horizontal offset that is written to CSS custom properties for the stylesheet to animate. The README describes CSS `:has()` and variables as the animation technique. Source excerpts establish the runtime calls and data updates; the stylesheet itself was not sampled, so its specific selectors and styling behavior are represented only at the documented level.

Main entry points: [`src/App.tsx`](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/App.tsx) (Dock UI and hover handler), [`src/main.tsx`](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/main.tsx) (React mount), [`src/index.css`](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/index.css) (CSS dock animation), [`src/utils/scale.ts`](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/utils/scale.ts) (Bounded offset scaling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Browser runtime"]
  node_mount["React mount<br/>[main.tsx]"]
end

subgraph group_interaction["Dock interaction"]
  node_dock["Dock UI and hover handler<br/>[App.tsx]"]
  node_scale["Bounded offset scaling<br/>[scale.ts]"]
  node_styles["CSS dock animation<br/>[index.css]"]
end

node_visitor(("Desktop visitor"))

node_visitor -->|"opens app"| node_mount
node_mount -->|"renders"| node_dock
node_dock -->|"scales cursor position"| node_scale
node_dock -->|"sets CSS variables"| node_styles
node_dock -->|"imports styles"| node_styles

click node_mount "https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/main.tsx"
click node_dock "https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/App.tsx"
click node_scale "https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/utils/scale.ts"
click node_styles "https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/index.css"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mount toneBlue
class node_dock,node_scale,node_styles toneAmber
class node_visitor toneIndigo
```

## Components

### Browser runtime

- [React mount](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/main.tsx): `src/main.tsx`

### Dock interaction

- [Dock UI and hover handler](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/App.tsx): `src/App.tsx`
- [Bounded offset scaling](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/utils/scale.ts): `src/utils/scale.ts`
- [CSS dock animation](https://github.com/frontendfyi/macos-dock-animation-with-css/blob/main/src/index.css): `src/index.css`

### Other components

- **Desktop visitor**

## Connections

- Desktop visitor → React mount: opens app (evidence: `src/main.tsx`)
- React mount → Dock UI and hover handler: renders (evidence: `src/main.tsx`)
- Dock UI and hover handler → Bounded offset scaling: scales cursor position (evidence: `src/App.tsx`)
- Dock UI and hover handler → CSS dock animation: sets CSS variables (evidence: `src/App.tsx`)
- Dock UI and hover handler → CSS dock animation: imports styles (evidence: `src/App.tsx`)
