Expand description
§vize_musea
Musea - Component gallery and documentation for Vize.
§Name Origin
Musea (plural of museum) represents a gallery space where art is
displayed and documented. Similarly, vize_musea provides a gallery
for Vue components, allowing developers to view and interact with
components in isolation - similar to Storybook.
§Concepts
- Art: A component variation/state (replaces “story”)
- Art file (
*.art.vue): File defining arts - Gallery: Display area for arts
- Palette: Interactive controls panel
§Performance
This crate is optimized for high performance:
- Zero-copy parsing: All strings are borrowed from source
- Arena allocation: Uses
vize_carton::Bumpfor fast allocation - Minimal allocations: Only allocates when absolutely necessary
- Fast byte-level parsing: Uses
memchrandmemmemfor O(n) search
§Usage
use vize_carton::Bump;
use vize_musea::{parse_art, transform_to_csf};
use vize_musea::types::ArtParseOptions;
let allocator = Bump::new();
let source = r#"
<art title="Button" component="./Button.vue">
<variant name="Primary" default>
<Button variant="primary">Click me</Button>
</variant>
<variant name="Secondary">
<Button variant="secondary">Click me</Button>
</variant>
</art>
<script setup lang="ts">
import Button from './Button.vue'
</script>
"#;
// Parse Art file with arena allocator
let art = parse_art(&allocator, source, ArtParseOptions::default()).unwrap();
// Transform to Storybook CSF
let csf = transform_to_csf(&art);
println!("Generated: {}", csf.filename);§Features
- Zero-copy parsing of
*.art.vuefiles - Type-safe variant definitions
- Storybook CSF 3.0 export
- Visual Regression Testing (VRT) support
- Interactive props palette
Re-exports§
pub use parse::parse_art;pub use transform::transform_to_csf;pub use transform::transform_to_vue;pub use types::ArtDescriptor;pub use types::ArtDescriptorOwned;pub use types::ArtMetadata;pub use types::ArtMetadataOwned;pub use types::ArtParseError;pub use types::ArtParseOptions;pub use types::ArtParseResult;pub use types::ArtScriptBlock;pub use types::ArtScriptBlockOwned;pub use types::ArtStatus;pub use types::ArtStyleBlock;pub use types::ArtStyleBlockOwned;pub use types::ArtVariant;pub use types::ArtVariantOwned;pub use types::CsfOutput;pub use types::SourceLocation;pub use types::ViewportConfig;
Modules§
- autogen
- Variant auto-generation module.
- docs
- Documentation generation for Art files.
- palette
- Props Palette - Interactive controls generation for Art components.
- parse
- Parser for Art files (*.art.vue).
- transform
- Transform module for Art files.
- types
- Type definitions for vize_musea.
- vrt
- VRT (Visual Regression Testing) configuration and types.
Structs§
- Bump
- An arena to bump allocate into.
Functions§
- serve
- Start the Musea component gallery server.