Skip to main content

Crate zenith_core

Crate zenith_core 

Source
Expand description

Foundation crate for Zenith.

Owns the KDL-v2 parser adapter, semantic AST types, canonical formatter, token types and resolution, validation engine with the full diagnostic set, AST-based migrations, and deterministic font and asset resolution. No other Zenith crate is a dependency.

Re-exports§

pub use asset::AssetData;
pub use asset::AssetProvider;
pub use asset::BytesAssetProvider;
pub use ast::brand::merge_brand_contract;
pub use ast::ActionDef;
pub use ast::Anchor;
pub use ast::AnchorEdge;
pub use ast::AssetBlock;
pub use ast::AssetDecl;
pub use ast::AssetKind;
pub use ast::BLOCK_ROLE_VOCAB;
pub use ast::BlockStyle;
pub use ast::BrandContract;
pub use ast::ChartNode;
pub use ast::ChartSeries;
pub use ast::CodeNode;
pub use ast::ComponentDef;
pub use ast::ConnectorNode;
pub use ast::DiagnosticPolicy;
pub use ast::Dimension;
pub use ast::Document;
pub use ast::DocumentBody;
pub use ast::EllipseNode;
pub use ast::FieldNode;
pub use ast::FilterKind;
pub use ast::FilterLiteral;
pub use ast::FilterOp;
pub use ast::FootnoteNode;
pub use ast::FrameNode;
pub use ast::GradientKind;
pub use ast::GradientLiteral;
pub use ast::GradientStopRef;
pub use ast::GroupNode;
pub use ast::ImageNode;
pub use ast::InstanceNode;
pub use ast::LibraryDef;
pub use ast::LineNode;
pub use ast::MaskLiteral;
pub use ast::MaskShape;
pub use ast::MasterDef;
pub use ast::Node;
pub use ast::ObjectPosition;
pub use ast::Override;
pub use ast::Page;
pub use ast::PatternNode;
pub use ast::Point;
pub use ast::PolicyEntry;
pub use ast::PolicyVerb;
pub use ast::PolygonNode;
pub use ast::PolylineNode;
pub use ast::Project;
pub use ast::PropertyValue;
pub use ast::ProtectedRegion;
pub use ast::ProvenanceDef;
pub use ast::RecipeDef;
pub use ast::RecipeParam;
pub use ast::RectNode;
pub use ast::STYLE_RECOGNIZED_KEYS;
pub use ast::SafeZone;
pub use ast::SafeZoneType;
pub use ast::SectionDef;
pub use ast::ShadowLayerRef;
pub use ast::ShadowLiteral;
pub use ast::ShapeNode;
pub use ast::Span;
pub use ast::Style;
pub use ast::StyleBlock;
pub use ast::TableCell;
pub use ast::TableColumn;
pub use ast::TableNode;
pub use ast::TableRow;
pub use ast::TextNode;
pub use ast::TextSpan;
pub use ast::TocNode;
pub use ast::Token;
pub use ast::TokenBlock;
pub use ast::TokenLiteral;
pub use ast::TokenType;
pub use ast::TokenValue;
pub use ast::Unit;
pub use ast::UnknownNode;
pub use ast::UnknownProperty;
pub use ast::UnknownStyleProp;
pub use ast::UnknownValue;
pub use ast::VariantDef;
pub use ast::VariantOverride;
pub use ast::anchor_xy;
pub use ast::canonicalize_style_key;
pub use ast::dim_to_px;
pub use ast::parse_anchor;
pub use ast::parse_anchor_edge;
pub use color::Cmyk;
pub use color::cmyk_to_hex;
pub use color::cmyk_to_srgb;
pub use color::contrast_ratio;
pub use color::parse_cmyk;
pub use color::parse_rgb;
pub use color::relative_luminance;
pub use data::DataContext;
pub use data::DataFormat;
pub use data::format_data_value;
pub use diagnostics::Diagnostic;
pub use diagnostics::Severity;
pub use error::FormatError;
pub use error::ParseError;
pub use error::ParseErrorCode;
pub use font::BytesFontProvider;
pub use font::FontData;
pub use font::FontProvider;
pub use font::FontSource;
pub use font::FontStyle;
pub use font::LocalFontEntry;
pub use font::default_provider;
pub use font::scan_font_dirs;
pub use markdown::ListKind;
pub use markdown::MdBlock;
pub use markdown::parse_block_markdown;
pub use markdown::parse_inline_markdown;
pub use parse::KdlAdapter;
pub use parse::KdlSource;
pub use parse::parse_brand_contract;
pub use parse::parse_diagnostic_policy;
pub use tokens::ResolvedFilter;
pub use tokens::ResolvedFilterOp;
pub use tokens::ResolvedGradient;
pub use tokens::ResolvedMask;
pub use tokens::ResolvedShadow;
pub use tokens::ResolvedShadowLayer;
pub use tokens::ResolvedToken;
pub use tokens::ResolvedValue;
pub use tokens::SyntaxTheme;
pub use tokens::TokenResolution;
pub use tokens::builtin_color;
pub use tokens::resolve_tokens;
pub use tokens::token_id_for_kind;
pub use util::hash_unit;
pub use util::pattern::PatternLayout;
pub use util::pattern::pattern_positions;
pub use validate::ValidationReport;
pub use validate::apply_policy;
pub use validate::validate;
pub use validate::validate_with_policy;

Modules§

asset
Asset sourcing layer: provider trait, data types, and in-memory registry.
ast
AST type re-exports for zenith-core.
color
Colour math — hex/CMYK parsing, WCAG 2.2 luminance/contrast, and the WCAG 3 candidate APCA Lc.
data
Runtime data-binding support.
diag_catalog
The single source of truth for every diagnostic code the engine can emit.
diagnostics
Shared diagnostic types used across all Zenith validation passes.
error
Parse error types for zenith-core.
font
Font sourcing layer: provider trait, data types, and the bundled default.
format
Canonical formatter for Zenith AST → .zen text.
markdown
parse
Parse layer re-exports and the KdlSource trait.
schema
Static schema metadata for the authorable node kinds and non-node surfaces.
theme
Theme synthesis — derive a complete design-token palette from a few brand colors, choosing readable foregrounds via APCA (WCAG 3) contrast.
tokens
Token resolution for zenith-token-v1.
util
Pure, platform-independent helper functions shared across Zenith.
validate
Document-level semantic validation pass for Zenith.

Structs§

HighlightToken
A token referencing a byte range in the source string.

Enums§

TokenKind
Token kind produced by scanners.

Functions§

is_supported
Check if a language is supported.
scan
Tokenize code in the given language, returning structured tokens with byte ranges.