# saikorl/calculatorjs architecture

> Architecture diagram of the GitHub repository saikorl/calculatorjs, 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/saikorl/calculatorjs
- Repository: https://github.com/saikorl/calculatorjs

## Overview

This is a small browser-based calculator. Users enter numbers and operations through the display controls or keyboard; the JavaScript handles input, performs arithmetic, and updates the display with comma-separated numbers. The supplied tree and excerpts identify the HTML and CSS files, but their contents were not shown, so the UI relationships below are grounded in the JavaScript selectors and the README’s description.

Main entry points: [`script.js`](https://github.com/saikorl/calculatorjs/blob/main/script.js) (Input and arithmetic), [`index.html`](https://github.com/saikorl/calculatorjs/blob/main/index.html) (Calculator controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_keyboard(("Keyboard"))
node_controls["Calculator controls<br/>[index.html]"]
node_calculator["Input and arithmetic<br/>[script.js]"]
node_formatting["Number formatting<br/>[script.js]"]
node_styling["Calculator styling<br/>[style.css]"]

node_user -->|"clicks"| node_controls
node_controls -->|"dispatches events"| node_calculator
node_keyboard -->|"sends keys"| node_calculator
node_calculator -->|"formats values"| node_formatting
node_calculator -->|"updates display"| node_controls

click node_controls "https://github.com/saikorl/calculatorjs/blob/main/index.html"
click node_calculator "https://github.com/saikorl/calculatorjs/blob/main/script.js"
click node_formatting "https://github.com/saikorl/calculatorjs/blob/main/script.js"
click node_styling "https://github.com/saikorl/calculatorjs/blob/main/style.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_user toneBlue
class node_keyboard toneIndigo
class node_controls,node_calculator,node_formatting,node_styling toneTeal
```

## Components

### Other components

- **User**
- **Keyboard**
- [Calculator controls](https://github.com/saikorl/calculatorjs/blob/main/index.html): `index.html`
- [Input and arithmetic](https://github.com/saikorl/calculatorjs/blob/main/script.js): `script.js`
- [Number formatting](https://github.com/saikorl/calculatorjs/blob/main/script.js): `script.js`
- [Calculator styling](https://github.com/saikorl/calculatorjs/blob/main/style.css): `style.css`

## Connections

- User → Calculator controls: clicks (evidence: `README.md`)
- Calculator controls → Input and arithmetic: dispatches events (evidence: `script.js`)
- Keyboard → Input and arithmetic: sends keys (evidence: `script.js`)
- Input and arithmetic → Number formatting: formats values (evidence: `script.js`)
- Input and arithmetic → Calculator controls: updates display (evidence: `script.js`)
