# edgeofinnerspace/vi-_-iv architecture

> Architecture diagram of the GitHub repository edgeofinnerspace/vi-_-iv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/edgeofinnerspace/vi-_-iv
- Repository: https://github.com/edgeofinnerspace/vi-_-iv

## Overview

##### Project type and purpose
- “viv” is a client-side JavaScript library (an open-source front-end framework) for building web UIs directly in the browser without templating or a virtual DOM. It provides a minimal core (src/viv.js) plus a small helper (src/webscript.js) to parse HTML-ish constructs in JS.

##### File structure
- Top-level files: configuration (eslintrc.js, .gitignore), package.json, README.md
- src/: the core modules
- viv.js – the reactive-update engine and API surface
- webscript.js – an optional parser that turns JS-embedded HTML into real DOM nodes
- documentation/: a self-contained demo embedding viv in a browser page
- examples/: consumer apps showing viv usage (html2webscript, tictactoe)
- No backend or build pipeline—pure browser library

##### Key insights from the README
- Goals: zero dependencies, no compiler, no virtual DOM, no new syntax, fine-grained control, high performance
- Usage pattern: developer writes plain JS functions that return DOM nodes; viv tracks dependencies and calls DOM methods directly

a. User Application Code (Examples or downstream apps)
b. viv Core Module (src/viv.js)
c. Webscript Parser Module (src/webscript.js) – optional
d. Browser Runtime / DOM APIs
e. Documentation & Examples (static assets; not part of runtime)

##### Relationships and data flows
- App Code imports viv core (and webscript if needed)
→ viv exports functions to define reactive “views” and manage state
→ At runtime, viv schedules updates and calls DOM API methods (createElement, setAttribute, appendChild, removeChild)
→ If using webscript: code strings or template-style JS expressions are handed to webscript.parse() → returns DOM nodes
- viv maintains dependency graphs internally and invokes only the minimal updates
- There is no server interaction in the core library; any backend calls would be in user code

##### Architectural patterns & design principles
- Reactive Programming / Data-Driven Updates (no global re-render, only diff/patch)
- Modular ES6 structure: two small modules (core + parser)
- Zero-dependency philosophy: relies only on Browser DOM APIs
- Extensibility points: user can add custom update hooks or lifecycle events via viv API

##### Technologies & frameworks
- JavaScript ES6 modules
- Browser DOM API
- No build toolchain—author distributes via npm and raw script tags
- Examples leverage CodeMirror, Prism, Terser only as demo dependencies, not for viv’s core

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Consumer Apps"
        direction TB
        App1["html2webscript"]:::user
        App2["tictactoe"]:::user
    end

    subgraph "viv Modules"
        direction TB
        Core["viv Core (src/viv.js)"]:::viv
        Webscript["Webscript Parser (src/webscript.js)"]:::viv
    end

    Browser["Browser DOM / Runtime"]:::browser

    subgraph "Static Assets / Demos"
        direction TB
        Docs["Documentation & Demos"]:::docs
        Meta1["README.md"]:::docs
        Meta2["package.json"]:::docs
        Meta3[".eslintrc.js"]:::docs
        Meta4[".gitignore"]:::docs
    end

    App1 -->|"import/init"| Core
    App2 -->|"import/init"| Core
    App1 -->|"optional parse HTML-JS"| Webscript
    Webscript -->|"returns DOM nodes"| Core
    Core -->|"DOM mutation"| Browser

    click App1 "https://github.com/edgeofinnerspace/vi-_-iv/tree/master/examples/html2webscript/"
    click App2 "https://github.com/edgeofinnerspace/vi-_-iv/tree/master/examples/tictactoe/"
    click Core "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/src/viv.js"
    click Webscript "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/src/webscript.js"
    click Docs "https://github.com/edgeofinnerspace/vi-_-iv/tree/master/documentation/"
    click Meta1 "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/README.md"
    click Meta2 "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/package.json"
    click Meta3 "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/.eslintrc.js"
    click Meta4 "https://github.com/edgeofinnerspace/vi-_-iv/blob/master/.gitignore"

    classDef viv fill:#a0c4ff,stroke:#000,stroke-width:1px;
    classDef user fill:#a2fca0,stroke:#000,stroke-width:1px;
    classDef browser fill:#ffec99,stroke:#000,stroke-width:1px;
    classDef docs fill:#d3d3d3,stroke:#000,stroke-width:1px;
```
