VD3 UI Architecture Guide

VD3 UI combines design tokens, CSS, and typed Vue components. Import the components you use and one stylesheet. The layers below explain how they fit together.

1
Design tokens

DTCG-style JSON defines color scales and theme metadata. The exported JSON is a flat CSS-variable map, not a DTCG interchange document.

2
Generated color CSS

The token build generates color variables and tokens.json for tooling.

3
Component CSS

Authored layout, component, utility, and effect styles share the generated colors.

4
Vue components & composables

Typed Vue components and composables use the shared styles and manage their own listeners.

What you import

Start with named component imports and either the full or icon-free stylesheet.

Entry pointWhat it is
@vanduo-oss/vd3Named components, composables, the optional configuration plugin, and types.
@vanduo-oss/vd3/highlightOptional dependency-free highlightCode / highlight helpers.
@vanduo-oss/vd3/cssFull CSS, including icons. Import once.
@vanduo-oss/vd3/css/coreFull CSS without bundled icons. Supply your own icons.
@vanduo-oss/vd3/tokens.jsonFlat { "--vd-name": value } map for tooling.
How the package is built

Maintainers run this pipeline. Applications install its prebuilt output.

# How the package is built (you consume the prebuilt dist/)
clean-dist         # wipe dist/
build-tokens.mjs   # DTCG JSON  ->  generated color CSS + tokens.json
build-css.mjs      # inline every layer  ->  vd3.min.css (+ core, icon-free)
vite build         # SFCs + optional highlighter -> ESM/CJS entries
vue-tsc            # emit .d.ts types
check-class-coverage.mjs   # verify every documented class ships
Wiring an app

VanduoVue sets optional theme defaults. Import each component where you use it; the plugin does not register components.

// main.ts — optional theme defaults; import components in your .vue files
import { createApp } from 'vue';
import { VanduoVue } from '@vanduo-oss/vd3';
import '@vanduo-oss/vd3/css';          // choose one stylesheet
import App from './App.vue';

createApp(App).use(VanduoVue).mount('#app');
Lifecycle and shared state

Components attach listeners on mount and clean them up on unmount. Theme preferences and toast queues use module-wide state.

// Theme and toast state is currently shared within the loaded module.
import { VdToastContainer, useToast, useThemePreference } from '@vanduo-oss/vd3';

// Mount <VdToastContainer /> once (e.g. in App.vue) so toasts have somewhere to go.
const toast = useToast();
toast.success('Saved');

const theme = useThemePreference();
theme.setTheme('dark');

A storage prefix changes persistence keys; it does not isolate apps. Avoid writing request-specific theme or toast state during SSR.