Expand description
Lower .crepus templates to a JSON view tree for SwiftUI, Jetpack Compose, and future
android-activity / objc2 shells.
§Crate layout
ir— serializableViewIr/ViewNode/ViewStyle(the contract with shells).style— Tailwind-like class → style hints (extend here for GPUI parity).include_expand—include→(Vec<Node>, TemplateContext)without IR cycles.render— AST lowering and publicrender_*entry points.mutations— renderer-agnostic, path-based IR mutations and diffing.hot_reload— structured hot-reload protocol + conservative AST gate.
§Sharing / codegen (bindgen, other repos)
bindgengenerates Rust FFI from C/C++ headers. It does not extract types from Rust for Swift/Kotlin, and it does not import arbitrary “other project” sources—it wraps existing native (C) APIs.- Single source of truth options that do fit native shells:
schemarsonViewIr+ JSON Schema → quicktype, OpenAPI generators, etc. for Swift/Kotlin.- A tiny build.rs that emits
fixture.jsonand optional bindings (same repo or path dependency / git submodule). - Publish
crepuscularity-nativeto crates.io and depend on it from another Rust workspace as usual.
§Coverage vs GPUI / web
Not 100% parity with GPUI styler.rs—expand style.
Re-exports§
pub use codegen::generate_native_source;pub use codegen::NativeCodegenTarget;pub use colors::resolve_rgba;pub use hot_reload::ast_shape_compatible;pub use hot_reload::plan_hot_reload;pub use hot_reload::HotReloadEnvelope;pub use hot_reload::HotReloadMessage;pub use ir::PickerOption;pub use ir::StackAxis;pub use ir::ViewIr;pub use ir::ViewNode;pub use ir::ViewStyle;pub use ir::IR_VERSION;pub use mutations::apply_mutations;pub use mutations::diff_ir;pub use mutations::IrMutation;
Modules§
- codegen
- colors
- Tailwind CSS v4 colors and CSS color resolution for native View IR.
- hot_
reload - ir
- JSON-serializable view intermediate representation (platform-neutral).
- mutations
- style
- Maps Tailwind utility classes onto
ViewStyleand stack alignment hints.
Enums§
- Crepus
Error - Primary error type for
crate::parser,crate::eval, and related core APIs.
Functions§
- render_
component_ file_ to_ ir - Lower a named component from a multi-component
.crepusfile. - render_
from_ files - Render from a virtual file map (
entrymay use#Componentsuffix). - render_
nodes_ to_ ir - Lower already-parsed nodes into a
ViewIr. - render_
template_ to_ ir - Parse and lower a template string to IR.
- to_json
- Serialize IR to JSON (compact).
- to_
json_ pretty - Serialize IR to pretty-printed JSON (fixtures / debugging).