Skip to main content

Crate vecslide_core

Crate vecslide_core 

Source
Expand description

§vecslide-core

Core library for the .vecslide format — vector presentations with synchronized Opus audio, playable from a single self-contained HTML file.

A .vecslide file is a ZIP archive that bundles:

  • a manifest.yaml describing slides, timestamps, animations, pointer trail,
  • one or more SVG slides (or a single Typst source split by ----),
  • an optional Opus audio track (OGG container),
  • optional author-only annotations (stripped on HTML export).

This crate is UI-free and has no hard dependency on the filesystem: the default feature set is WASM-safe and is what powers the web authoring tool. Native tooling enables extra features behind feature flags.

§Feature flags

FeatureAddsTypical consumer
(default)manifest, compile_html, validation, pointer, typst_splitWASM app
zip-ioIn-memory ZIP read/write (pack, unpack) via miniz_oxideWASM app, browser
nativezip-io + Typst compilation + bundled fonts + std::fs helpersCLI, server-side

native is a superset of zip-io. Enabling native on WASM is not supported.

§Quick start: parse a manifest

use vecslide_core::manifest::Presentation;

let yaml = r#"
title: "Cell Anatomy"
slides:
  - id: slide_01
    time_start: 0
    svg_file: vector_assets/01.svg
"#;
let p: Presentation = serde_norway::from_str(yaml)?;
assert_eq!(p.title, "Cell Anatomy");

§Quick start: unpack a .vecslide in memory (requires zip-io)

use vecslide_core::unpack_from_reader;

let bytes = std::fs::read("lesson.vecslide")?;
let unpacked = unpack_from_reader(std::io::Cursor::new(bytes))?;
println!("{} slides", unpacked.presentation.slides.len());

§Quick start: compile to a single self-contained HTML

use vecslide_core::{unpack_from_reader, compile_html::compile};

let bytes = std::fs::read("lesson.vecslide")?;
let unpacked = unpack_from_reader(std::io::Cursor::new(bytes))?;
let html: String = compile(&unpacked)?;
std::fs::write("lesson.html", html)?;

§Modules at a glance

ModulePurpose
manifestData structures + YAML/JSON serde for manifest.yaml
validationConsistency checks (ordered timestamps, referenced files, durations)
compile_htmlCompile an UnpackedPresentation into a single self-contained HTML
[pointer]Pointer-trail logic: movement threshold, decimation, fading opacity
player_templateEmbedded HTML/CSS/JS viewer template (include_str!)
themeTheme tokens shared between editor and viewer
typst_splitSplit a .typ source into per-slide sections separated by ----
packFold a source folder into a .vecslide ZIP (requires zip-io)
unpackRead a .vecslide ZIP into memory (requires zip-io)
typst_renderCompile Typst sources to SVG (requires native)
typst_fontsFonts bundled for Typst compilation (requires native)

§Companion crates

  • vecslide — thin facade re-exporting this crate under a shorter name.

§License

Licensed under either of MIT or Apache-2.0 at your option.

Re-exports§

pub use compile_html::UnpackedPresentation;
pub use error::VecslideError;
pub use pack::pack_to_writer;zip-io
pub use unpack::unpack_from_reader;zip-io

Modules§

compile_html
error
manifest
packzip-io
player_template
pointer
theme
DaisyUI theme color extraction and conversion.
typst_fonts
typst_rendernative
typst_split
unpackzip-io
validation