Installation
Recommended package path
- Product teams: use
@varo-ui/clito install owned source; runtime packages remain stable primitives and official wrappers - H5, app, and mini-program targets share the platform-neutral state, event, and controlled-state contracts from
@varo-ui/headless - Mini-program projects use
weapp-vite+wevu+ Tailwind CSS v4 +weapp-tailwindcss
Initialize a project
pnpm dlx create-weapp-vite@latest varo-app
cd varo-app
pnpm installOfficial wrappers
pnpm add vue @varo-ui/h5 @varo-ui/theme
pnpm add vue wevu @varo-ui/weapp @varo-ui/theme
pnpm add @varo-ui/ai # only when the product needs Agent events and MarkdownPrimitives only
pnpm add @varo-ui/headlessshadcn-style install
If you want the shadcn/ui workflow, copy source into the product project first, then wrap it for business needs:
pnpm dlx @varo-ui/cli add --target weapp button select card
pnpm dlx @varo-ui/cli add --target weapp action-sheet collapse dialog list notice-bar popover skeleton steps
pnpm dlx @varo-ui/cli add --target weapp components/agent-ui
pnpm dlx @varo-ui/cli add --target weapp blocks/profile-edit
pnpm dlx @varo-ui/cli add --target h5 button select card components/agent-uiComponents land in src/components/ui/*; blocks land in src/components/blocks/*. Your product can then create UserSelect, DepartmentSelect, and ProductSelect in src/components/biz/*.
The H5 registry covers all 56 runtime component families. The mini-program registry covers 45 high-consensus families. Copy-owned mini-program renderers ship as target-specific native Wevu SFCs that compile directly to WXML/WXSS/JSON; pure adapters may re-export target primitives, and only types, pure functions, and headless primitives are shared across targets.
Third-party components do not need to be merged upstream: use add --registry <local-directory-or-http(s)-url> to install an independent registry. Authors can also use export --target h5|weapp <item> to generate JSON for shadcn-vue. See Publish an independent registry for layouts, publishing commands, and runtime boundaries.
Agent streaming
@varo-ui/ai is model-provider neutral. A backend emits message.start, text.delta, reasoning.*, tool.*, approval.*, message.end, and done events. H5 can connect Fetch/SSE; a mini program can feed wx.request({ enableChunked: true }) chunks into createAgentSseEventSource().
import { createAgentSseEventSource, createAgentStreamController } from '@varo-ui/ai'
const transport = createAgentSseEventSource()
const controller = createAgentStreamController()
requestTask.onChunkReceived(({ data }) => transport.feed(data))
await controller.connect(transport.source)connect() owns the event-iterator lifecycle: protocol done/error events settle the connection and request iterator cleanup; natural iterator exhaustion synthesizes done.
Mini-program build chain
pnpm add -D weapp-vite weapp-tailwindcss tailwindcss
pnpm add clsx @weapp-tailwindcss/mergeCopy-owned mini-program Registry components use native Wevu SFCs and consume Tailwind v4 utilities through styleIsolation: apply-shared. Rendering and lifecycle code remain target-specific; pure adapters may re-export target primitives, and cross-target sharing is limited to types, pure functions, and headless primitives. The cn() helper uses @weapp-tailwindcss/merge, preserving mini-program escaping behavior.
@varo-ui/cli only copies Registry files and prints Dependencies: / Dev dependencies:; it does not install npm packages. After each add, install every reported dependency that the project does not already contain. See the one-time Wevu Registry setup for managed registration of src/styles.css and the Registry theme at src/styles/varo.css, plus the complete Tailwind options.
Preview mini-program artifacts in a browser
The wx runtime now lives in the private @varo/weapp-web package: a Vite plugin compiles Wevu artifacts into virtual:varo-native-artifacts, and a replaceable harness owns wx APIs and native elements. The playground is only a sandbox consumer; the package is not published yet. The host runs Wevu-generated JS, JSON, WXML, and WXSS through glass-easel's DOM backend rather than substituting H5 business components. Narrow windows scale the presentation while preserving the selected native viewport width. This is not a WeChat-client or device emulator. Unsupported capabilities such as login and payment fail explicitly instead of returning fabricated success.
Build and verify the production surface:
pnpm exec turbo run build --filter=@varo/playground-weapp-preview
pnpm --filter @varo/playground-weapp-preview preview
# Run in another terminal; a local Chrome installation is required
pnpm --filter @varo/playground-weapp-preview smoke:browserThe production preview defaults to http://127.0.0.1:4182; deployable files are in apps/playground-weapp-preview/dist. The browser smoke exercises native interaction, event counts, context, stream stop/resume, layout boundaries, and error recovery, and writes screenshots to a temporary directory. Set PREVIEW_URL to test another running preview.
The repository lockfile records the SDK versions required by this pipeline. The CLI does not automatically install those dependencies into external consumer projects. WeChat-specific capabilities, device performance, and final native visuals still require validation in WeChat.
Engineering notes
- Keep docs, playgrounds, and packages in the monorepo
- Consume published package entries externally; use source aliases only for workspace development
- H5 and mini-program wrappers share primitive naming, while
@varo-ui/h5and@varo-ui/weappown the visual layer
Version strategy
- Use the current compatible toolchain; docs do not pin specific
weapp-vite,wevu, orweapp-tailwindcssversions - Production projects should follow their lockfile, package
peerDependencies, and CI build result - VitePress, Vue, and TypeScript move with the workspace upgrade policy