How graphieros/vue-data-ui works
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.