# mojs/mojs-timeline-editor architecture

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

- Interactive diagram: https://gitdiagram.com/mojs/mojs-timeline-editor
- Repository: https://github.com/mojs/mojs-timeline-editor

## Overview

1. This repository is a browser-based animation editor, not a server app. Its purpose is to provide a GUI for editing `html`, custom points, and timeline data while authoring `mojs` animations. The runtime boundary is the browser; there is no backend or API layer in this repo.

2. The app is a single-page frontend packaged into `app/build/mojs-timeline-editor.js` and bootstrapped from `app/index.html`. The codebase is built from Babel/JSX and PostCSS assets, with webpack and gulp handling bundling/watch workflows.

3. The core architectural style is React-style component composition plus centralized state. UI state is managed in Redux-like reducers under `app/js/reducers`, with a store defined in `app/js/store.babel.js` and at least one action module in `app/js/actions`. The reducers split the editor into distinct domains: controls, main panel layout, points, progress, and selected spot.

4. The main UI is decomposed into functional editor regions:
   - `main-panel` for the central workspace,
   - `timeline-panel` and `timelines-panel` for time-based editing,
   - `points-panel` for point/property editing,
   - `tools-panel` for editing modes and tool buttons.
   This separation is important for drawing the architecture because each panel reads from shared state but owns a different part of the editing workflow.

5. The editor is data-driven around animation primitives such as points, segments, spots, and timelines. Helper constructors like `create-point`, `create-segment`, and `create-spot` indicate that the UI is built from structured domain objects rather than ad hoc component state. That suggests a clear flow from normalized domain data into rendered editor controls.

6. User interaction is heavily pointer-driven. Helpers such as `add-pointer-down`, `add-pointer-up`, `change`, and `clamp` imply custom drag/selection behavior for timeline handles, resize handles, and point editing. These low-level event helpers sit beneath the React components and feed state updates into reducers.

7. Persistence and selection are explicit concerns. Helpers like `persist`, `is-selected-by-connection`, and the `selected-spot` reducer indicate that selection state is tracked centrally and likely survives some form of editor refresh or session lifecycle. This is a key boundary between ephemeral UI gestures and persisted editor model state.

8. The components themselves are organized by feature, not by generic UI primitives. Examples include `curve-editor`, `easing`, `point-line`, `segment-timeline`, `timeline-handle`, and `insert-point`. These are the visual affordances used to manipulate timing curves, easing values, and point placement inside the timeline editor.

9. Styling is a first-class part of the architecture. The `app/css/blocks` and `app/css/assets` directories show a block-oriented CSS structure, with each component/region having its own PostCSS file and associated `.json` metadata. This suggests a component-to-style mapping that mirrors the UI decomposition.

10. There is a small utility/decorator layer under `app/js/helpers/decorators` for cross-cutting concerns such as refs, class names, and builder-style composition. This layer keeps the main components focused on editor behavior while standardizing repetitive wiring.

11. The external dependency that materially shapes the architecture is `mojs`. The README states the editor depends on `mojs >= 0.225.2`, with tween autoupdates available from `0.276.2`. That means the editor is not a standalone animation engine; it is an authoring interface layered on top of `mojs`’ animation model.

12. Overall data flow is: pointer/UI events in the editor components -> helper functions and actions -> reducers update centralized editor state -> components re-render the panels, handles, points, and curves from that state. That loop is the core architecture to capture in a diagram.

13. The repository also includes mockup Sketch files and a coding guide, which are design/support artifacts rather than runtime dependencies. They reinforce that this project is an interaction-heavy editor where UI layout and manipulation behavior are central to the system.

Main entry points: [`app/js/components/timeline-editor.babel.jsx`](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-editor.babel.jsx) (timeline editor), [`app/js/app.babel.jsx`](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/app.babel.jsx) (app root), [`app/js/components/timeline-panel.babel.jsx`](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-panel.babel.jsx) (timeline panel), [`app/js/reducers`](https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/reducers) (reducers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Browser runtime"]
  node_app_index["index.html<br/>entry<br/>[index.html]"]
  node_app_bundle["editor bundle"]
end

subgraph group_ui["Editor UI"]
  node_app_root["app root<br/>bootstrap<br/>[app.babel.jsx]"]
  node_timeline_editor["timeline editor<br/>shell"]
  node_main_panel["main panel<br/>workspace"]
  node_timeline_panel["timeline panel<br/>timeline ui"]
  node_timelines_panel["timelines panel<br/>timeline ui"]
  node_points_panel["points panel<br/>point ui"]
  node_tools_panel["tools panel<br/>mode ui<br/>[index.babel.jsx]"]
  node_curve_editor["curve editor<br/>curve ui"]
end

subgraph group_state["Central state"]
  node_state_store[("store<br/>state container<br/>[store.babel.js]")]
  node_reducers{{"reducers"}}
  node_actions["actions"]
end

subgraph group_domain["Domain helpers"]
  node_create_point["create point<br/>domain factory"]
  node_create_segment["create segment<br/>domain factory"]
  node_create_spot["create spot<br/>domain factory"]
  node_pointer_helpers{{"pointer helpers<br/>interaction"}}
  node_selection_persist["selection/persist<br/>selection flow<br/>[persist.babel.js]"]
end

subgraph group_build["Build system"]
  node_css_blocks["style blocks<br/>styles"]
  node_build_tools["build tools<br/>toolchain<br/>[webpack.config.js]"]
end

node_app_index -->|"bootstraps"| node_app_root
node_app_root -->|"renders"| node_timeline_editor
node_timeline_editor -->|"uses"| node_main_panel
node_timeline_editor -->|"uses"| node_timeline_panel
node_timeline_editor -->|"uses"| node_timelines_panel
node_timeline_editor -->|"uses"| node_points_panel
node_timeline_editor -->|"uses"| node_tools_panel
node_timeline_editor -->|"uses"| node_curve_editor
node_app_root -->|"connects"| node_state_store
node_state_store -->|"uses"| node_reducers
node_actions -->|"updates"| node_reducers
node_main_panel -->|"handles"| node_pointer_helpers
node_timeline_panel -->|"handles"| node_pointer_helpers
node_points_panel -->|"builds"| node_create_point
node_timeline_panel -->|"builds"| node_create_segment
node_timelines_panel -->|"builds"| node_create_spot
node_tools_panel -->|"dispatches"| node_actions
node_selection_persist -->|"tracks"| node_reducers
node_css_blocks -->|"styles"| node_timeline_editor
node_build_tools -->|"packages"| node_app_bundle
node_build_tools -->|"processes"| node_css_blocks
node_app_bundle -->|"contains"| node_timeline_editor

click node_app_index "https://github.com/mojs/mojs-timeline-editor/blob/main/app/index.html"
click node_app_bundle "https://github.com/mojs/mojs-timeline-editor/blob/main/app/build/mojs-timeline-editor.js"
click node_app_root "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/app.babel.jsx"
click node_timeline_editor "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-editor.babel.jsx"
click node_main_panel "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/main-panel/main-panel.babel.jsx"
click node_timeline_panel "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-panel.babel.jsx"
click node_timelines_panel "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timelines-panel.babel.jsx"
click node_points_panel "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/points-panel/points-panel.babel.jsx"
click node_tools_panel "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/tools-panel/index.babel.jsx"
click node_curve_editor "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/curve-editor.babel.jsx"
click node_state_store "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/store.babel.js"
click node_reducers "https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/reducers"
click node_actions "https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/actions"
click node_create_point "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-point.babel.js"
click node_create_segment "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-segment.babel.js"
click node_create_spot "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-spot.babel.jsx"
click node_pointer_helpers "https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/helpers"
click node_selection_persist "https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/persist.babel.js"
click node_css_blocks "https://github.com/mojs/mojs-timeline-editor/tree/main/app/css/blocks"
click node_build_tools "https://github.com/mojs/mojs-timeline-editor/blob/main/webpack.config.js"

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_app_index,node_app_bundle toneBlue
class node_app_root,node_timeline_editor,node_main_panel,node_timeline_panel,node_timelines_panel,node_points_panel,node_tools_panel,node_curve_editor toneAmber
class node_state_store,node_reducers,node_actions toneMint
class node_create_point,node_create_segment,node_create_spot,node_pointer_helpers,node_selection_persist toneRose
class node_css_blocks,node_build_tools toneIndigo
```

## Components

### Browser runtime

Editor UI running in the browser

- [index.html](https://github.com/mojs/mojs-timeline-editor/blob/main/app/index.html): entry · Browser entry point that mounts the editor · `app/index.html`
- [editor bundle](https://github.com/mojs/mojs-timeline-editor/blob/main/app/build/mojs-timeline-editor.js): bundle · Packaged frontend artifact delivered to the browser · `app/build/mojs-timeline-editor.js`

### Editor UI

React-style component composition for the timeline editor

- [app root](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/app.babel.jsx): bootstrap · Top-level React application wiring · `app/js/app.babel.jsx`
- [timeline editor](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-editor.babel.jsx): shell · Main editor shell coordinating panels · `app/js/components/timeline-editor.babel.jsx`
- [main panel](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/main-panel/main-panel.babel.jsx): workspace · Central workspace for the editor surface · `app/js/components/main-panel/main-panel.babel.jsx`
- [timeline panel](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timeline-panel.babel.jsx): timeline ui · Single-timeline editing surface · `app/js/components/timeline-panel.babel.jsx`
- [timelines panel](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/timelines-panel.babel.jsx): timeline ui · Multi-timeline overview and selection · `app/js/components/timelines-panel.babel.jsx`
- [points panel](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/points-panel/points-panel.babel.jsx): point ui · Point and property editing surface · `app/js/components/points-panel/points-panel.babel.jsx`
- [tools panel](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/tools-panel/index.babel.jsx): mode ui · Editing modes and tool buttons · `app/js/components/tools-panel/index.babel.jsx`
- [curve editor](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/components/curve-editor.babel.jsx): curve ui · Easing and curve manipulation · `app/js/components/curve-editor.babel.jsx`

### Central state

Redux-like state, actions, and reducers

- [store](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/store.babel.js): state container · Centralized application store · `app/js/store.babel.js`
- [reducers](https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/reducers): state reducers · Domain reducers for editor state slices · `app/js/reducers`
- [actions](https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/actions): event actions · Action creators for state updates · `app/js/actions`

### Domain helpers

Animation model objects and interaction helpers

- [create point](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-point.babel.js): domain factory · Constructs point domain objects · `app/js/helpers/create-point.babel.js`
- [create segment](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-segment.babel.js): domain factory · Constructs segment domain objects · `app/js/helpers/create-segment.babel.js`
- [create spot](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/create-spot.babel.jsx): domain factory · Constructs spot domain objects · `app/js/helpers/create-spot.babel.jsx`
- [pointer helpers](https://github.com/mojs/mojs-timeline-editor/tree/main/app/js/helpers): interaction · Custom pointer and change handling for drag/select behavior · `app/js/helpers`
- [selection/persist](https://github.com/mojs/mojs-timeline-editor/blob/main/app/js/helpers/persist.babel.js): selection flow · Selection checks and persistence boundary · `app/js/helpers/persist.babel.js`

### Build system

Bundling, transpilation, and stylesheet workflows

- [style blocks](https://github.com/mojs/mojs-timeline-editor/tree/main/app/css/blocks): styles · Block-oriented PostCSS styles mapped to UI regions · `app/css/blocks`
- [build tools](https://github.com/mojs/mojs-timeline-editor/blob/main/webpack.config.js): toolchain · Webpack and gulp workflows for bundling and watch builds · `webpack.config.js`

## Connections

- index.html → app root: bootstraps · HTML loads the application entry
- app root → timeline editor: renders · Top-level app composes the editor shell
- timeline editor → main panel: uses · Shell delegates the workspace region
- timeline editor → timeline panel: uses · Shell includes the main timeline editor
- timeline editor → timelines panel: uses · Shell includes timeline overview controls
- timeline editor → points panel: uses · Shell includes point and property editing
- timeline editor → tools panel: uses · Shell includes mode and tool controls
- timeline editor → curve editor: uses · Shell includes easing and curve editing
- app root → store: connects · App wires the component tree to centralized state
- store → reducers: uses · Store is composed from reducer slices
- actions → reducers: updates · Actions are reduced into editor state changes
- main panel → pointer helpers: handles · Workspace interactions depend on low-level pointer logic
- timeline panel → pointer helpers: handles · Timeline handles use drag and clamp behavior
- points panel → create point: builds · Point editing is driven by point domain objects
- timeline panel → create segment: builds · Timeline editing is driven by segment objects
- timelines panel → create spot: builds · Multi-timeline editing uses spot objects
- tools panel → actions: dispatches · Tool changes and mode toggles dispatch actions
- selection/persist → reducers: tracks · Selection state is centralized in reducers
- style blocks → timeline editor: styles · Block styles mirror editor regions
- build tools → editor bundle: packages · Toolchain produces the browser bundle
- build tools → style blocks: processes · Build pipeline handles stylesheet compilation
- editor bundle → timeline editor: contains · Built artifact contains the editor application
