# guillermolg00/morphicons architecture

> Architecture diagram of the GitHub repository guillermolg00/morphicons, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guillermolg00/morphicons
- Repository: https://github.com/guillermolg00/morphicons

## Overview

morphicons is a zero-dependency icon-morphing library. An application changes an icon-data prop, supplies a controlled progress value, or calls an imperative handle; a framework binding initializes SVG output and delegates animation to the shared DOM driver. The core parses and normalizes paths, resamples them, computes correspondence and alignment, interpolates with spring timing, then serializes frames. It also offers vanilla/custom-element and canvas, mask, and SVG adapter capabilities. README documents Astro SSR; its implementation is not identified in the sampled tree. Edges are limited to relationships shown by excerpts, SOURCE INDEX references, or README; unsampled adapter and binding details are not inferred.

Main entry points: [`src/dom/index.ts`](https://github.com/guillermolg00/morphicons/blob/main/src/dom/index.ts) (DOM animation driver), [`src/dom/controller.ts`](https://github.com/guillermolg00/morphicons/blob/main/src/dom/controller.ts) (Morph controller), [`src/core/normalize.ts`](https://github.com/guillermolg00/morphicons/blob/main/src/core/normalize.ts) (Path normalization), [`src/core/resample.ts`](https://github.com/guillermolg00/morphicons/blob/main/src/core/resample.ts) (Arc-length sampling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Framework bindings"]
  node_react["React binding<br/>[index.tsx]"]
  node_vue["Vue binding<br/>[index.ts]"]
  node_svelte["Svelte binding<br/>[MorphIcon.svelte]"]
  node_svelte_shared["Svelte driver glue<br/>[shared.ts]"]
  node_native["React Native binding<br/>[index.tsx]"]
  node_element["Custom element<br/>[index.ts]"]
  node_vanilla["Vanilla API<br/>[controller.ts]"]
  node_astro["Astro SSR shell"]
end

subgraph group_engine["Morph engine"]
  node_controller["Morph controller<br/>[controller.ts]"]
  node_driver["DOM animation driver<br/>[index.ts]"]
  node_parse["Path parser<br/>[parse.ts]"]
  node_normalize["Path normalization<br/>[normalize.ts]"]
  node_resample["Arc-length sampling<br/>[resample.ts]"]
  node_plan["Match and align<br/>[plan.ts]"]
  node_interpolate["Polar interpolation<br/>[interpolate.ts]"]
  node_spring["Spring timing<br/>[spring.ts]"]
  node_serialize["Path serialization<br/>[serialize.ts]"]
end

subgraph group_adapters["Rendering adapters"]
  node_canvas["Canvas adapter<br/>[canvas.ts]"]
  node_mask["Mask adapter<br/>[mask.ts]"]
  node_svg["SVG adapter<br/>[svg.ts]"]
end

node_app(("Application"))

node_app -->|"sets icon"| node_react
node_app -->|"sets icon"| node_vue
node_app -->|"sets icon"| node_svelte
node_app -->|"sets icon"| node_native
node_react -->|"creates morph"| node_driver
node_vue -->|"uses driver"| node_driver
node_svelte -->|"uses shared logic"| node_svelte_shared
node_svelte_shared -->|"uses controller"| node_controller
node_native -->|"creates morph"| node_driver
node_element -->|"uses controller"| node_controller
node_vanilla -->|"uses driver"| node_driver
node_controller -->|"creates morph"| node_driver
node_driver -->|"normalizes icon"| node_normalize
node_normalize -->|"parses path"| node_parse
node_driver -->|"samples shapes"| node_resample
node_resample -->|"converts to cubics"| node_normalize
node_driver -->|"builds plan"| node_plan
node_driver -->|"interpolates frames"| node_interpolate
node_driver -->|"advances progress"| node_spring
node_driver -->|"serializes frames"| node_serialize
node_controller -->|"builds frozen output"| node_plan
node_controller -->|"interpolates frozen output"| node_interpolate
node_controller -->|"samples endpoints"| node_resample
node_controller -->|"serializes output"| node_serialize
node_canvas -->|"uses driver"| node_driver
node_mask -->|"uses driver"| node_driver
node_svg -->|"normalizes paths"| node_normalize

click node_react "https://github.com/guillermolg00/morphicons/blob/main/src/react/index.tsx"
click node_vue "https://github.com/guillermolg00/morphicons/blob/main/src/vue/index.ts"
click node_svelte "https://github.com/guillermolg00/morphicons/blob/main/src/svelte/MorphIcon.svelte"
click node_svelte_shared "https://github.com/guillermolg00/morphicons/blob/main/src/svelte/shared.ts"
click node_native "https://github.com/guillermolg00/morphicons/blob/main/src/react-native/index.tsx"
click node_element "https://github.com/guillermolg00/morphicons/blob/main/src/element/index.ts"
click node_vanilla "https://github.com/guillermolg00/morphicons/blob/main/src/dom/controller.ts"
click node_controller "https://github.com/guillermolg00/morphicons/blob/main/src/dom/controller.ts"
click node_driver "https://github.com/guillermolg00/morphicons/blob/main/src/dom/index.ts"
click node_parse "https://github.com/guillermolg00/morphicons/blob/main/src/core/parse.ts"
click node_normalize "https://github.com/guillermolg00/morphicons/blob/main/src/core/normalize.ts"
click node_resample "https://github.com/guillermolg00/morphicons/blob/main/src/core/resample.ts"
click node_plan "https://github.com/guillermolg00/morphicons/blob/main/src/core/plan.ts"
click node_interpolate "https://github.com/guillermolg00/morphicons/blob/main/src/core/interpolate.ts"
click node_spring "https://github.com/guillermolg00/morphicons/blob/main/src/core/spring.ts"
click node_serialize "https://github.com/guillermolg00/morphicons/blob/main/src/core/serialize.ts"
click node_canvas "https://github.com/guillermolg00/morphicons/blob/main/src/adapters/canvas.ts"
click node_mask "https://github.com/guillermolg00/morphicons/blob/main/src/adapters/mask.ts"
click node_svg "https://github.com/guillermolg00/morphicons/blob/main/src/adapters/svg.ts"
click node_astro "https://github.com/guillermolg00/morphicons/tree/main/src"

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_react,node_vue,node_svelte,node_svelte_shared,node_native,node_element,node_vanilla,node_astro toneBlue
class node_controller,node_driver,node_parse,node_normalize,node_resample,node_plan,node_interpolate,node_spring,node_serialize toneAmber
class node_canvas,node_mask,node_svg toneMint
class node_app toneIndigo
```

## Components

### Framework bindings

- [React binding](https://github.com/guillermolg00/morphicons/blob/main/src/react/index.tsx): `src/react/index.tsx`
- [Vue binding](https://github.com/guillermolg00/morphicons/blob/main/src/vue/index.ts): `src/vue/index.ts`
- [Svelte binding](https://github.com/guillermolg00/morphicons/blob/main/src/svelte/MorphIcon.svelte): `src/svelte/MorphIcon.svelte`
- [Svelte driver glue](https://github.com/guillermolg00/morphicons/blob/main/src/svelte/shared.ts): `src/svelte/shared.ts`
- [React Native binding](https://github.com/guillermolg00/morphicons/blob/main/src/react-native/index.tsx): `src/react-native/index.tsx`
- [Custom element](https://github.com/guillermolg00/morphicons/blob/main/src/element/index.ts): `src/element/index.ts`
- [Vanilla API](https://github.com/guillermolg00/morphicons/blob/main/src/dom/controller.ts): `src/dom/controller.ts`
- [Astro SSR shell](https://github.com/guillermolg00/morphicons/tree/main/src): `src`

### Morph engine

- [Morph controller](https://github.com/guillermolg00/morphicons/blob/main/src/dom/controller.ts): `src/dom/controller.ts`
- [DOM animation driver](https://github.com/guillermolg00/morphicons/blob/main/src/dom/index.ts): `src/dom/index.ts`
- [Path parser](https://github.com/guillermolg00/morphicons/blob/main/src/core/parse.ts): `src/core/parse.ts`
- [Path normalization](https://github.com/guillermolg00/morphicons/blob/main/src/core/normalize.ts): `src/core/normalize.ts`
- [Arc-length sampling](https://github.com/guillermolg00/morphicons/blob/main/src/core/resample.ts): `src/core/resample.ts`
- [Match and align](https://github.com/guillermolg00/morphicons/blob/main/src/core/plan.ts): `src/core/plan.ts`
- [Polar interpolation](https://github.com/guillermolg00/morphicons/blob/main/src/core/interpolate.ts): `src/core/interpolate.ts`
- [Spring timing](https://github.com/guillermolg00/morphicons/blob/main/src/core/spring.ts): `src/core/spring.ts`
- [Path serialization](https://github.com/guillermolg00/morphicons/blob/main/src/core/serialize.ts): `src/core/serialize.ts`

### Rendering adapters

- [Canvas adapter](https://github.com/guillermolg00/morphicons/blob/main/src/adapters/canvas.ts): `src/adapters/canvas.ts`
- [Mask adapter](https://github.com/guillermolg00/morphicons/blob/main/src/adapters/mask.ts): `src/adapters/mask.ts`
- [SVG adapter](https://github.com/guillermolg00/morphicons/blob/main/src/adapters/svg.ts): `src/adapters/svg.ts`

### Other components

- **Application**

## Connections

- Application → React binding: sets icon
- Application → Vue binding: sets icon
- Application → Svelte binding: sets icon
- Application → React Native binding: sets icon
- React binding → DOM animation driver: creates morph (evidence: `src/react/index.tsx`)
- Vue binding → DOM animation driver: uses driver (evidence: `src/vue/index.ts`)
- Svelte binding → Svelte driver glue: uses shared logic (evidence: `src/svelte/MorphIcon.svelte`)
- Svelte driver glue → Morph controller: uses controller (evidence: `src/svelte/shared.ts`)
- React Native binding → DOM animation driver: creates morph (evidence: `src/react-native/index.tsx`)
- Custom element → Morph controller: uses controller (evidence: `src/element/index.ts`)
- Vanilla API → DOM animation driver: uses driver (evidence: `src/dom/controller.ts`)
- Morph controller → DOM animation driver: creates morph (evidence: `src/dom/controller.ts`)
- DOM animation driver → Path normalization: normalizes icon (evidence: `src/dom/index.ts`)
- Path normalization → Path parser: parses path (evidence: `src/core/normalize.ts`)
- DOM animation driver → Arc-length sampling: samples shapes (evidence: `src/dom/index.ts`)
- Arc-length sampling → Path normalization: converts to cubics (evidence: `src/core/resample.ts`)
- DOM animation driver → Match and align: builds plan (evidence: `src/dom/index.ts`)
- DOM animation driver → Polar interpolation: interpolates frames (evidence: `src/dom/index.ts`)
- DOM animation driver → Spring timing: advances progress (evidence: `src/dom/index.ts`)
- DOM animation driver → Path serialization: serializes frames (evidence: `src/dom/index.ts`)
- Morph controller → Match and align: builds frozen output (evidence: `src/dom/controller.ts`)
- Morph controller → Polar interpolation: interpolates frozen output (evidence: `src/dom/controller.ts`)
- Morph controller → Arc-length sampling: samples endpoints (evidence: `src/dom/controller.ts`)
- Morph controller → Path serialization: serializes output (evidence: `src/dom/controller.ts`)
- Canvas adapter → DOM animation driver: uses driver (evidence: `src/adapters/canvas.ts`)
- Mask adapter → DOM animation driver: uses driver (evidence: `src/adapters/mask.ts`)
- SVG adapter → Path normalization: normalizes paths (evidence: `src/adapters/svg.ts`)
