# graphieros/vue-data-ui architecture

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

- Interactive diagram: https://gitdiagram.com/graphieros/vue-data-ui
- Repository: https://github.com/graphieros/vue-data-ui

## Overview

##### Project Type & Purpose
- This is a standalone Vue 3 component library (“vue-data-ui”) for data visualization.
- It ships ~60+ chart components, utility components, hooks, directives and helper functions.
- There is also a “TestingArena” sub-app (playground) and full test suite (unit tests + Cypress).

##### File Structure Analysis
- Root
– package.json, package-lock.json: declares dependencies, build & publish scripts.
– vite.config.js / vite.config.cypress.js: build and test runner configuration.
– .github, .gitignore, LICENSE, CI templates.
– documentation/: markdown docs.
– README.md: overview + usage + API.
- src/
– components/: concrete chart components (vue-ui-xy.vue, vue-ui-donut.vue, etc.).
– directives/: DOM directives (vClickOutside).
– hooks & utils: useConfig, usePanZoom, chartDetector, canvas-lib, pdf, etc.
– main.js, index.js: library entry points (exports components & utilities).
– style.css, vue-data-ui.css: core styles.
- TestingArena/
– Vue files to render each component in a demo page.
– convertModel.js: registry of models → component props.
- tests/ & cypress/
– Jest tests for utilities & core functions.
– Cypress for component E2E / visual tests.
- scripts (add-dev-dep.cjs, copy-docs.cjs, copy-types.cjs, cleanup.cjs, post-build.cjs, del-dev-dep.cjs)
– Node build helpers to produce a clean dist directory, copy type definitions, docs, remove dev deps.

##### README Insights
- Lists every component, their props and slots.
- Usage patterns: global registration vs per-component imports vs universal VueDataUi wrapper.
- Peer dependency: jspdf for PDF export.
- Themes, custom tooltips, slots, responsiveness, big data downsampling.

a. Main Components
- Source Modules
- Atoms
- Chart Components
- Directives
- Hooks & Utilities (helpers, data-formatters, pdf generator)
- Demo Playground (TestingArena)
- Build & Test Pipeline
- Vite (bundler)
- Node build scripts
- Jest (unit tests)
- Cypress (integration/component tests)
- Documentation (markdown + generated HTML)
- Distribution
- npm package (dist folder containing ES modules, CJS, types)
b. Relationships & Data Flow
1. Developer writes/maintains src modules →
2. Vite + Node scripts bundle into dist/ →
3. Tests (Jest/Cypress) verify src and build artifacts →
4. Documentation generator (copy-docs) publishes docs →
5. npm publish sends dist package to registry →
6. Consumer apps import components/utilities via “vue-data-ui”.
c. Architectural Patterns
- Atomic design for UI (atoms → components).
- Hook/composable pattern for shared logic (useConfig, usePanZoom).
- Universal wrapper pattern (VueDataUi).
- Modular build scripts for a clean dist output.
d. Key Technologies & Libraries
- Vue 3 single-file components (SFCs)
- Vite (ESM bundler)
- Node.js build scripts (CommonJS .cjs)
- Jest + Cypress
- TypeScript definitions (d.ts in types/)
- jspdf (peer)

##### Key Points to Capture
- Modular, atomic UI architecture.
- Clear separation between source, build/test, docs/demo, distribution, and consumer integration.
- Extensibility (slots, custom hooks, pattern slots).
- Peer-dependency (jspdf) and testing frameworks.
- Build scripts sequence: clean → bundle → copy-types → copy-docs → cleanup.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Source Modules
  subgraph "Source Modules"
    style SourceModules fill:#cce5ff,stroke:#005cbf
    Atoms["Atoms"]:::blue
    Components["Chart Components"]:::blue
    Directives["Directives"]:::blue
    subgraph "Hooks & Utilities"
      style HooksUtils fill:#cce5ff,stroke:#005cbf
      useConfig["useConfig"]:::blue
      usePanZoom["usePanZoom"]:::blue
      chartDetector["chartDetector"]:::blue
      canvasLib["canvas-lib"]:::blue
      pdfGen["pdf (jspdf)"]:::blue
      packCircles["packCircles"]:::blue
      treemap["treemap"]:::blue
      wordcloud["wordcloud"]:::blue
    end
    Wrapper["VueDataUi Wrapper"]:::blue
    EntryPoints["index.js & main.js"]:::blue
    Styles["style.css & vue-data-ui.css"]:::blue
  end

  %% Build & Test Pipeline
  subgraph "Build & Test Pipeline"
    style BuildPipeline fill:#d4edda,stroke:#155724
    Vite["Vite Bundler"]:::green
    subgraph "Build Scripts"
      style Scripts fill:#d4edda,stroke:#155724
      addDep["add-dev-dep.cjs"]:::green
      delDep["del-dev-dep.cjs"]:::green
      cleanup["cleanup.cjs"]:::green
      postBuild["post-build.cjs"]:::green
      copyTypes["copy-types.cjs"]:::green
      copyDocs["copy-docs.cjs"]:::green
    end
    Jest["Jest Tests"]:::green
    Cypress["Cypress Tests"]:::green
  end

  %% Documentation & Demo
  subgraph "Documentation & Demo"
    style DocsDemo fill:#ffe5b4,stroke:#e0a800
    Docs[/Documentation/]:::orange
    TestingArena["TestingArena Playground"]:::orange
  end

  %% Distribution & Consumption
  subgraph "Distribution & Consumers"
    style DistCons fill:#e2d6f3,stroke:#6f42c1
    Dist[(Dist Package)]:::purple
    Registry[(npm Registry)]:::purple
    Consumer["Consumer App"]:::purple
  end

  %% Flows
  Atoms -->|uses| Components
  Components -->|import| Wrapper
  Directives --> Components
  HooksUtils --> Components
  EntryPoints -->|exports all| Wrapper
  Styles --> EntryPoints

  Components -->|input to| Vite
  Wrapper --> Vite
  EntryPoints --> Vite
  Styles --> Vite

  Vite -->|bundles| Dist
  addDep -->|step| Dist
  delDep -->|step| Dist
  cleanup -->|step| Dist
  postBuild -->|step| Dist
  copyTypes -->|step| Dist
  copyDocs -->|step| Dist

  Jest -->|tests src| Components
  Jest -->|tests hooks| HooksUtils
  Cypress -->|E2E tests| TestingArena
  Cypress -->|component tests| Components

  TestingArena -->|renders| Components
  TestingArena -->|uses| HooksUtils
  TestingArena -->|applies| Directives

  Docs -->|generated by| copyDocs
  Docs -->|documents| Components

  Dist -->|published to| Registry
  Registry -->|installed by| Consumer
  Consumer -->|imports| Components
  Consumer -->|imports| HooksUtils
  Consumer -->|uses| pdfGen

  %% Click Events
  click Atoms "https://github.com/graphieros/vue-data-ui/tree/master/src/atoms"
  click Components "https://github.com/graphieros/vue-data-ui/tree/master/src/components"
  click Directives "https://github.com/graphieros/vue-data-ui/tree/master/src/directives"
  click useConfig "https://github.com/graphieros/vue-data-ui/blob/master/src/useConfig.js"
  click usePanZoom "https://github.com/graphieros/vue-data-ui/blob/master/src/usePanZoom.js"
  click chartDetector "https://github.com/graphieros/vue-data-ui/blob/master/src/chartDetector.js"
  click canvasLib "https://github.com/graphieros/vue-data-ui/blob/master/src/canvas-lib.js"
  click pdfGen "https://github.com/graphieros/vue-data-ui/blob/master/src/pdf.js"
  click packCircles "https://github.com/graphieros/vue-data-ui/blob/master/src/packCircles.js"
  click treemap "https://github.com/graphieros/vue-data-ui/blob/master/src/treemap.js"
  click wordcloud "https://github.com/graphieros/vue-data-ui/blob/master/src/wordcloud.js"
  click Wrapper "https://github.com/graphieros/vue-data-ui/blob/master/src/components/vue-data-ui.vue"
  click EntryPoints "https://github.com/graphieros/vue-data-ui/blob/master/src/index.js"
  click EntryPoints "https://github.com/graphieros/vue-data-ui/blob/master/src/main.js"
  click TestingArena "https://github.com/graphieros/vue-data-ui/tree/master/TestingArena"
  click Vite "https://github.com/graphieros/vue-data-ui/blob/master/vite.config.js"
  click Cypress "https://github.com/graphieros/vue-data-ui/blob/master/vite.config.cypress.js"
  click addDep "https://github.com/graphieros/vue-data-ui/blob/master/scripts/add-dev-dep.cjs"
  click delDep "https://github.com/graphieros/vue-data-ui/blob/master/scripts/del-dev-dep.cjs"
  click cleanup "https://github.com/graphieros/vue-data-ui/blob/master/scripts/cleanup.cjs"
  click postBuild "https://github.com/graphieros/vue-data-ui/blob/master/scripts/post-build.cjs"
  click copyTypes "https://github.com/graphieros/vue-data-ui/blob/master/scripts/copy-types.cjs"
  click copyDocs "https://github.com/graphieros/vue-data-ui/blob/master/scripts/copy-docs.cjs"
  click Jest "https://github.com/graphieros/vue-data-ui/tree/master/tests/"
  click Cypress "https://github.com/graphieros/vue-data-ui/tree/master/cypress/"
  click Docs "https://github.com/graphieros/vue-data-ui/tree/master/documentation/"
  click Dist "https://github.com/graphieros/vue-data-ui/blob/master/types/vue-data-ui.d.ts"

  %% Styles
  classDef blue fill:#cce5ff,stroke:#005cbf,color:#004085
  classDef green fill:#d4edda,stroke:#155724,color:#155724
  classDef orange fill:#ffe5b4,stroke:#e0a800,color:#856404
  classDef purple fill:#e2d6f3,stroke:#6f42c1,color:#382f78
```
