Skip to main content

zenith_core/ast/node/
effect.rs

1//! Effect-producing node structs.
2//!
3//! These nodes are authored as ordinary page/container children and emit ink,
4//! but they live outside the geometric-shape family so future scene effects can
5//! share a coherent AST home.
6
7use std::collections::BTreeMap;
8
9use crate::ast::Span;
10use crate::ast::value::{Dimension, PropertyValue};
11
12use super::common::UnknownProperty;
13
14/// A soft light source rendered as ambient scene ink.
15#[derive(Debug, Clone, PartialEq)]
16pub struct LightNode {
17    pub id: String,
18    pub name: Option<String>,
19    pub role: Option<String>,
20    /// Light family. Recognized values are validated, but the string is kept
21    /// open for forward-compatible authoring.
22    pub kind: Option<String>,
23    /// Center X, page/container-relative.
24    pub x: Option<PropertyValue>,
25    /// Center Y, page/container-relative.
26    pub y: Option<PropertyValue>,
27    /// Radial falloff radius.
28    pub radius: Option<PropertyValue>,
29    /// Inner light color; token refs must resolve to color tokens.
30    pub color: Option<PropertyValue>,
31    pub opacity: Option<f64>,
32    pub visible: Option<bool>,
33    pub locked: Option<bool>,
34    /// Source declaration span, when available.
35    pub source_span: Option<Span>,
36    /// Unknown properties preserved for forward-compat.
37    pub unknown_props: BTreeMap<String, UnknownProperty>,
38    /// Reserved for future focused/angled light families.
39    pub angle: Option<Dimension>,
40}
41
42/// A procedural grid/perspective mesh rendered as generated stroke ink.
43#[derive(Debug, Clone, PartialEq)]
44pub struct MeshNode {
45    pub id: String,
46    pub name: Option<String>,
47    pub role: Option<String>,
48    /// Mesh family. `None` is interpreted as `orthographic`.
49    pub kind: Option<String>,
50    pub x: Option<PropertyValue>,
51    pub y: Option<PropertyValue>,
52    pub w: Option<PropertyValue>,
53    pub h: Option<PropertyValue>,
54    /// Number of cells on the horizontal axis. Emits `columns + 1` vertical lines.
55    pub columns: Option<u32>,
56    /// Number of cells on the vertical axis. Emits `rows + 1` horizontal lines.
57    pub rows: Option<u32>,
58    /// One-point perspective vanishing point X. Required when kind is `perspective`.
59    pub vanishing_x: Option<PropertyValue>,
60    /// One-point perspective vanishing point Y. Required when kind is `perspective`.
61    pub vanishing_y: Option<PropertyValue>,
62    /// Intentional extension beyond the authored bbox for bleed/overscan.
63    pub extend: Option<PropertyValue>,
64    pub stroke: Option<PropertyValue>,
65    pub stroke_width: Option<PropertyValue>,
66    pub stroke_dash: Option<PropertyValue>,
67    pub stroke_gap: Option<PropertyValue>,
68    pub stroke_linecap: Option<String>,
69    pub opacity: Option<f64>,
70    pub visible: Option<bool>,
71    pub locked: Option<bool>,
72    pub source_span: Option<Span>,
73    pub unknown_props: BTreeMap<String, UnknownProperty>,
74}