Skip to main content

zenith_core/
lib.rs

1//! Foundation crate for Zenith.
2//!
3//! Owns the KDL-v2 parser adapter, semantic AST types, canonical formatter,
4//! token types and resolution, validation engine with the full diagnostic set,
5//! AST-based migrations, and deterministic font and asset resolution.
6//! No other Zenith crate is a dependency.
7
8pub mod asset;
9pub mod ast;
10pub mod color;
11pub mod data;
12pub mod diag_catalog;
13pub mod diagnostics;
14pub mod error;
15pub mod font;
16pub mod format;
17pub mod markdown;
18pub mod parse;
19pub mod schema;
20pub mod theme;
21pub mod tokens;
22pub mod util;
23pub mod validate;
24
25// Curated flat re-exports for the most-used public surface.
26pub use asset::{AssetData, AssetProvider, BytesAssetProvider};
27pub use ast::brand::merge_brand_contract;
28pub use ast::{
29    ActionDef, Anchor, AnchorEdge, AssetBlock, AssetDecl, AssetKind, BLOCK_ROLE_VOCAB, BlockStyle,
30    BrandContract, ChartNode, ChartSeries, CodeNode, ComponentDef, ConnectorNode, DiagnosticPolicy,
31    Dimension, Document, DocumentBody, EllipseNode, FieldNode, FilterKind, FilterLiteral, FilterOp,
32    FootnoteNode, FrameNode, GradientKind, GradientLiteral, GradientStopRef, GroupNode, ImageNode,
33    InstanceNode, LibraryDef, LightNode, LineNode, MaskLiteral, MaskShape, MasterDef, MeshNode,
34    Node, ObjectPosition, Override, Page, PatternNode, Point, PolicyEntry, PolicyVerb, PolygonNode,
35    PolylineNode, Project, PropertyValue, ProtectedRegion, ProvenanceDef, RecipeDef, RecipeParam,
36    RectNode, STYLE_RECOGNIZED_KEYS, SafeZone, SafeZoneType, SectionDef, ShadowLayerRef,
37    ShadowLiteral, ShapeNode, Span, Style, StyleBlock, TableCell, TableColumn, TableNode, TableRow,
38    TextNode, TextSpan, TocNode, Token, TokenBlock, TokenLiteral, TokenType, TokenValue, Unit,
39    UnknownNode, UnknownProperty, UnknownStyleProp, UnknownValue, VariantDef, VariantOverride,
40    anchor_xy, canonicalize_style_key, dim_to_px, parse_anchor, parse_anchor_edge,
41};
42pub use color::{
43    Cmyk, cmyk_to_hex, cmyk_to_srgb, contrast_ratio, parse_cmyk, parse_rgb, relative_luminance,
44};
45pub use data::{DataContext, DataFormat, format_data_value};
46pub use diagnostics::{Diagnostic, Severity};
47pub use error::{FormatError, ParseError, ParseErrorCode};
48pub use font::{
49    BytesFontProvider, FontData, FontProvider, FontSource, FontStyle, LocalFontEntry,
50    default_provider, scan_font_dirs,
51};
52pub use markdown::{ListKind, MdBlock, parse_block_markdown, parse_inline_markdown};
53pub use parse::{KdlAdapter, KdlSource, parse_brand_contract, parse_diagnostic_policy};
54pub use tokens::{
55    HighlightToken, ResolvedFilter, ResolvedFilterOp, ResolvedGradient, ResolvedMask,
56    ResolvedShadow, ResolvedShadowLayer, ResolvedToken, ResolvedValue, SyntaxTheme, TokenKind,
57    TokenResolution, builtin_color, is_supported, resolve_tokens, scan, token_id_for_kind,
58};
59pub use util::hash_unit;
60pub use util::pattern::{PatternLayout, pattern_positions};
61pub use validate::{ValidationReport, apply_policy, validate, validate_with_policy};