npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vizejs/vite-plugin-musea

v0.818.0

Published

Vite plugin for Musea - Component gallery for Vue components

Readme

@vizejs/vite-plugin-musea

Vite plugin for Musea - Vue component gallery and documentation.

Installation

Install vp once from the Vite+ install guide, then add the package:

vp install -D @vizejs/vite-plugin @vizejs/vite-plugin-musea vize

Usage

// vite.config.ts
import { defineConfig } from "vite";
import vize from "@vizejs/vite-plugin";
import { musea } from "@vizejs/vite-plugin-musea";

export default defineConfig({
  plugins: [
    vize(),
    musea({
      include: ["src/**/*.art.vue"],
      basePath: "/__musea__",
      previewCss: ["src/styles/main.css"],
      previewSetup: "musea.preview.ts",
    }),
  ],
});

Run your Vite dev server and open the gallery route:

vp dev
http://localhost:5173/__musea__

Musea middleware is intended for the local Vite dev server and trusted development networks. Do not expose /__musea__ directly on the public internet unless it is protected by your own network controls or authentication layer.

Shared defaults live in vue.musea in your existing vite.config.*. With Vite+, retain your existing options and add Vue settings through the helper:

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  musea: {
    include: ["src/**/*.art.vue"],
    exclude: ["node_modules/**", "dist/**"],
    basePath: "/__musea__",
    inlineArt: false,
    storybookCompat: false,
  },
});

Direct musea() options override shared config. Pass preview-only options such as previewCss, previewSetup, tokensPath, theme, and storybookOutDir directly to the plugin.

Art File Format

<!-- Button.art.vue -->
<script setup lang="ts">
import Button from "./Button.vue";

defineArtMeta({
  category: "UI",
  tags: ["button", "form"],
});
</script>

<art>
  <variant name="Primary" default>
    <Button variant="primary">Click me</Button>
  </variant>
  <variant name="Disabled">
    <Button disabled>Disabled</Button>
  </variant>
</art>

Musea infers the target from the imported component tag shared by the variants. defineArtMeta() is an optional compiler macro for gallery metadata; title defaults to the inferred binding name. Normal Vue template checking supplies prop, emit, slot, completion, and diagnostic types. If a composition contains multiple possible targets, use defineArt(Component, metadata?) explicitly.

The source may be a .vue, .ts, .tsx, .js, or .jsx file. For render-function components, Musea reads statically declared runtime props and emits for the analysis and props panel.

Vue 3.5.41 does not apply a component prop literally named __proto__. Retaining its raw editor value does not make it a rendered prop. Avoid this prop name; #8533 tracks explicit editor refusal and release acceptance.

TypeScript and Editor Setup

Add the client types once, usually in src/env.d.ts:

/// <reference types="@vizejs/vite-plugin-musea/client" />

If your project type-checks .art.vue files with Volar or vue-tsc, include the extension in tsconfig.json:

{
  "include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.art.vue"],
  "vueCompilerOptions": {
    "extensions": [".vue", ".art.vue"]
  }
}

Root <script setup> state is variant-local by default, so each variant gets its own refs, computed values, and composable calls:

<script setup lang="ts">
import { ref } from "vue";
import Counter from "./Counter.vue";

const count = ref(0);
</script>

<art>
  <variant name="Initial" default>
    <Counter :count="count" />
  </variant>
  <variant name="Interactive">
    <Counter :count="count" />
  </variant>
</art>

Use <script setup isolate="false"> when variants intentionally share one setup instance.

Legacy <art> metadata attributes are still supported:

| Attribute | Purpose | | ------------------- | ------------------------------------- | | title | Display name in the gallery | | component | Relative source component path | | category | Sidebar grouping | | status | Optional status badge | | tags | Search and filtering tags | | action-events | Comma-separated events to capture | | capture-mousemove | Include mousemove in captured actions |

Enable inline art when examples should live inside the component file:

musea({
  inlineArt: true,
});

Use the host component's normal inferred SFC name in inline art, for example <Button> in Button.vue.

Preview Setup

musea({
  previewCss: ["src/styles/main.css", "src/styles/musea-preview.css"],
  previewSetup: "musea.preview.ts",
});
// musea.preview.ts
import type { App } from "vue";

export default function setup(app: App) {
  // Install vue-router, vue-i18n, stores, or design-system plugins here.
}

Musea's preview scaffold styles are emitted in a low-priority cascade layer, so layered CSS from frameworks such as Tailwind v4 can still override them when loaded through previewCss.

Design Tokens

Expose a Style Dictionary-compatible token file in the gallery:

musea({
  tokensPath: "src/tokens.json",
});

Tailwind v4 theme variables can also be used as the token source:

/* src/styles/main.css */
@import "tailwindcss";

@theme {
  --color-brand: oklch(70.5% 0.213 47.604);
  --color-accent: var(--color-brand);
  --spacing-card: 1.5rem;
}
musea({
  tokensPath: "src/styles/main.css",
});

tokensPath reads tokens for the gallery and token APIs. Use previewCss separately when that CSS file should also be loaded inside component preview iframes.

Token previews are inferred from token type, path, and referenced token metadata. Spacing, opacity, radius/round, and z-index tokens render previews by default. Add custom rules when your token names use project-specific categories:

musea({
  tokensPath: "src/tokens.json",
  tokenPreviews: {
    rules: [{ pathIncludes: "elevation.overlay", kind: "zIndex" }],
    disabledKinds: ["shadow"],
  },
});

Commands

# Start dev server
vp dev

# Build gallery
vp build

# Run visual regression snapshots
vp exec musea-vrt --base-url http://localhost:5173

# Update local baselines
vp exec musea-vrt --update

# CI mode with JSON output
vp exec musea-vrt --ci --json

# Run a11y audits alongside snapshots
vp exec musea-vrt --a11y

# Approve failed snapshots
vp exec musea-vrt approve

# Remove orphaned snapshots
vp exec musea-vrt clean

# Generate an art-file draft
vp exec musea-vrt generate src/components/Button.vue

License

MIT