# greghub/vue-funnel-graph-js architecture

> Architecture diagram of the GitHub repository greghub/vue-funnel-graph-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/greghub/vue-funnel-graph-js
- Repository: https://github.com/greghub/vue-funnel-graph-js

## Overview

##### Project type and purpose
- This is an open-source, front-end UI component library (“vue-funnel-graph-js”) built for Vue.js. It provides a reusable Funnel Graph component that renders SVG charts (vertical or horizontal) with labels, sub-labels, percentages and animations.

##### File structure
- Top-level files:
- package.json / package-lock.json – npm package metadata and lockfile
- README.md, LICENSE, CHANGELOG.md – docs and licensing
- .gitignore, .eslintrc.js – tooling config
- build/rollup.config.js – Rollup configuration for bundling the library into different module formats
- src/ – authoring area:
- entry.js – public entrypoint that imports and registers the Vue component
- example.vue – a standalone demo of the component
- lib-components/ – actual component implementation
– index.js – re-exports `vue-funnel-graph.vue`
– vue-funnel-graph.vue – core Vue single-file component, handles props, SVG rendering, animations
- dist/ – output directory containing the built bundles:
- vue-funnel-graph.esm.js – ES module build
- vue-funnel-graph.umd.js – UMD build for direct browser inclusion

##### Extract architectural insights from the README
- The README clarifies it’s a Vue component library.
- Usage patterns: installed via npm or CDN, imported into a Vue app, used as a custom element `<vue-funnel-graph>` with prop bindings.
- No back-end or database; it’s purely client-side.

##### Main components and interactions
a. Source Code Layer
- `vue-funnel-graph.vue` (component logic + template)
- `entry.js` (entrypoint that exposes the component)
b. Build & Packaging Layer
- Rollup (build orchestration)
- Babel / plugins (transpilation if any)
- Output bundles (ESM + UMD) in `dist/`
c. Distribution & Consumption Layer
- npm registry (developers install via `npm i vue-funnel-graph-js`)
- CDNs (unpkg, jsdelivr) serve the UMD bundle for direct `<script>` inclusion
d. Runtime Layer (Vue Application)
- Vue App imports or globally registers `<vue-funnel-graph>`
- Component processes data, calculates percentages, builds SVG nodes, applies gradients/animations
- DOM/SVG rendering in user’s browser
e. External Services
- npm registry, CDN endpoints (unpkg/jsdelivr), GitHub for source hosting

##### Architectural patterns & design principles
- Component-based design: separation of concerns between API surface (props) and rendering logic
- Module bundler pattern: one source → multiple target module formats
- Prop-driven data flow: parent Vue app → funnel component → SVG output
- Single Responsibility: build config isolated from component code

- Source Code (`.vue` + `entry.js`)
- Rollup Build System (with plugins)
- Dist Artifacts (ESM module, UMD bundle)
- npm Registry & CDNs (unpkg/jsdelivr)
- Consumer Vue Application
- Browser Runtime / SVG Renderer
c. Design principles:
d. Technologies & frameworks:

##### Final recommendations
- Be granular: separate source files, build tools, distribution targets, and runtime roles
- End-to-end path: from authoring the component to seeing the funnel graph in the browser

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Source Code Layer"
        VueComp["vue-funnel-graph.vue"]:::code
        Entrypoint["entry.js"]:::code
        Demo["example.vue"]:::code
    end

    subgraph "Build & Packaging Layer"
        Rollup["Rollup Build (rollup.config.js)\n- Tree-shaking\n- Transpilation"]:::process
    end

    subgraph "Distribution Artifacts"
        ESM["vue-funnel-graph.esm.js"]:::code
        UMD["vue-funnel-graph.umd.js"]:::code
    end

    subgraph "Distribution Channels"
        NPM["npm Registry"]:::external
        CDN["CDNs (unpkg/jsdelivr)"]:::external
    end

    subgraph "Runtime Layer"
        VueApp["Consumer Vue App\n(Vue.js)"]:::runtime
        Browser["Browser Runtime"]:::runtime
        SVG["SVG Renderer"]:::runtime
    end

    subgraph "Documentation & Config"
        PKG["package.json"]:::code
        ESLint[".eslintrc.js"]:::code
        README["README.md"]:::code
        CHANGELOG["CHANGELOG.md"]:::code
        LICENSE["LICENSE"]:::code
        GITIGNORE[".gitignore"]:::code
    end

    VueComp -->|source| Rollup
    Entrypoint -->|source| Rollup
    Demo -->|example| Rollup
    Rollup -->|bundles| ESM
    Rollup -->|bundles| UMD
    ESM -->|publish| NPM
    UMD -->|publish| NPM
    UMD -->|serve| CDN
    ESM -->|serve| CDN
    VueApp -->|install| NPM
    VueApp -->|script tag| CDN
    VueApp -->|mount| Browser
    Browser -->|renders| SVG

    classDef code fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef process fill:#90EE90,stroke:#000,stroke-width:1px
    classDef runtime fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px

    click VueComp "https://github.com/greghub/vue-funnel-graph-js/blob/master/src/lib-components/vue-funnel-graph.vue"
    click Entrypoint "https://github.com/greghub/vue-funnel-graph-js/blob/master/src/entry.js"
    click Demo "https://github.com/greghub/vue-funnel-graph-js/blob/master/src/example.vue"
    click Rollup "https://github.com/greghub/vue-funnel-graph-js/blob/master/build/rollup.config.js"
    click ESM "https://github.com/greghub/vue-funnel-graph-js/blob/master/dist/vue-funnel-graph.esm.js"
    click UMD "https://github.com/greghub/vue-funnel-graph-js/blob/master/dist/vue-funnel-graph.umd.js"
    click PKG "https://github.com/greghub/vue-funnel-graph-js/blob/master/package.json"
    click ESLint "https://github.com/greghub/vue-funnel-graph-js/blob/master/.eslintrc.js"
    click README "https://github.com/greghub/vue-funnel-graph-js/blob/master/README.md"
    click CHANGELOG "https://github.com/greghub/vue-funnel-graph-js/blob/master/CHANGELOG.md"
    click LICENSE "https://github.com/greghub/vue-funnel-graph-js/tree/master/LICENSE"
    click GITIGNORE "https://github.com/greghub/vue-funnel-graph-js/blob/master/.gitignore"
```
