use alloc::vec::Vec;
use vize_l0::dump::{Dump, Error as DumpError, Mode as DumpMode};
use vize_l0::key::{KeySink, KeyedArtifact, schema};
use vize_l0::stage::Stage;
mod codec;
pub mod historical;
mod owned;
mod parse;
mod print;
pub mod provenance;
pub use crate::dump::owned::{
Attribute, Bind, Binding, Branch, Comment, Component, Contract, Element, Expr, For, ForBinding,
If, Interpolation, Model, Name, On, Op, OriginalFor, Slot, SlotContent, Text, VueCloak,
VueCssBind, VueDirective, VueHtml, VueMemo, VueOnce, VueShow, VueSlotScope, VueSync, VueText,
};
pub use crate::dump::provenance::{Page as ProvenancePage, Record as DumpProvenance};
#[must_use]
pub fn render_full_page<P: Dump>(page: &P) -> vize_l0::String {
page.print_to_string(DumpMode::Full)
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Page {
pub ops: Vec<Op>,
}
impl Dump for Page {
fn print<W: core::fmt::Write>(&self, w: &mut W, mode: DumpMode) -> core::fmt::Result {
print::print(self, w, print::Style::current(mode))
}
fn parse(input: &str) -> Result<Self, DumpError> {
parse::parse(input)
}
}
impl KeyedArtifact for Page {
const STAGE: Stage = Stage::Semantic;
const SCHEMA_VERSION: u32 = schema::L2_PAGE;
fn feed_key(&self, sink: &mut KeySink) {
let style = print::Style::keyed(sink.block_start());
let _ = print::print(self, sink, style);
}
}