hwpforge_blueprint/lib.rs
1//! HwpForge Blueprint: YAML-based style template system.
2//!
3//! Blueprint is the **design pattern** layer in the Forge metaphor.
4//! It defines style templates (fonts, sizes, colors, spacing) in
5//! human-readable YAML that can be applied to Core documents.
6//!
7//! # Architecture
8//!
9//! ```text
10//! foundation (HwpUnit, Color, Index<T>)
11//! |
12//! v
13//! core (Document, Section, Paragraph, Run)
14//! |
15//! v
16//! blueprint (THIS CRATE: Template, StyleRegistry, CharShape, ParaShape)
17//! |
18//! v
19//! smithy-* (HWPX, HWP5, Markdown codecs)
20//! ```
21//!
22//! Core contains document **structure** with style **references** (indices).
23//! Blueprint contains style **definitions** that those indices resolve to.
24//! This separation mirrors HTML (structure) + CSS (style).
25//!
26//! # Quick Start
27//!
28//! ```rust
29//! use hwpforge_blueprint::template::Template;
30//! use hwpforge_blueprint::registry::StyleRegistry;
31//! use hwpforge_blueprint::builtins::builtin_default;
32//!
33//! // Load a built-in template
34//! let template = builtin_default().unwrap();
35//! assert_eq!(template.meta.name, "default");
36//!
37//! // Convert to indexed registry for document rendering
38//! let registry = StyleRegistry::from_template(&template).unwrap();
39//! let body = registry.get_style("body").unwrap();
40//! let char_shape = registry.char_shape(body.char_shape_id).unwrap();
41//! assert_eq!(char_shape.font, "한컴바탕");
42//! ```
43//!
44//! # Workflow
45//!
46//! ```text
47//! YAML template file
48//! -> Template::from_yaml()
49//! -> Inheritance resolution (DFS merge)
50//! -> StyleRegistry::from_template()
51//! -> Indexed CharShape/ParaShape collections
52//! ```
53
54#![deny(missing_docs)]
55#![deny(unsafe_code)]
56#![deny(clippy::all)]
57
58pub mod border_fill;
59pub mod builtins;
60pub mod error;
61pub mod inheritance;
62pub mod registry;
63pub mod schema;
64pub mod serde_helpers;
65pub mod style;
66pub mod template;
67
68// Re-export key types for convenience
69pub use border_fill::{Border, BorderFill, BorderSide, Fill, PartialBorderFill};