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.yamldescribing 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
| Feature | Adds | Typical consumer |
|---|---|---|
| (default) | manifest, compile_html, validation, pointer, typst_split | WASM app |
zip-io | In-memory ZIP read/write (pack, unpack) via miniz_oxide | WASM app, browser |
native | zip-io + Typst compilation + bundled fonts + std::fs helpers | CLI, 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
| Module | Purpose |
|---|---|
manifest | Data structures + YAML/JSON serde for manifest.yaml |
validation | Consistency checks (ordered timestamps, referenced files, durations) |
compile_html | Compile an UnpackedPresentation into a single self-contained HTML |
[pointer] | Pointer-trail logic: movement threshold, decimation, fading opacity |
player_template | Embedded HTML/CSS/JS viewer template (include_str!) |
theme | Theme tokens shared between editor and viewer |
typst_split | Split a .typ source into per-slide sections separated by ---- |
pack | Fold a source folder into a .vecslide ZIP (requires zip-io) |
unpack | Read a .vecslide ZIP into memory (requires zip-io) |
typst_render | Compile Typst sources to SVG (requires native) |
typst_fonts | Fonts 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-iopub use unpack::unpack_from_reader;zip-io
Modules§
- compile_
html - error
- manifest
- pack
zip-io - player_
template - pointer
- theme
- DaisyUI theme color extraction and conversion.
- typst_
fonts - typst_
render native - typst_
split - unpack
zip-io - validation