1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
//! Derive macros for the gilt terminal formatting library.
//!
//! This crate provides the `#[derive(Table)]`, `#[derive(Panel)]`, `#[derive(Tree)]`,
//! `#[derive(Columns)]`, `#[derive(Rule)]`, `#[derive(Inspect)]`, and `#[derive(Renderable)]` macros that generate widget
//! conversion methods and trait implementations for structs.
//!
//! # Table Example
//!
//! ```ignore
//! use gilt::Table;
//!
//! #[derive(Table)]
//! #[table(title = "Employees", box_style = "ROUNDED", header_style = "bold cyan")]
//! struct Employee {
//! #[column(header = "Full Name", style = "bold")]
//! name: String,
//! #[column(justify = "right")]
//! age: u32,
//! #[column(skip)]
//! internal_id: u64,
//! #[column(header = "Dept", style = "green", min_width = 10)]
//! department: String,
//! }
//!
//! let employees = vec![
//! Employee {
//! name: "Alice".into(),
//! age: 30,
//! internal_id: 1001,
//! department: "Engineering".into(),
//! },
//! Employee {
//! name: "Bob".into(),
//! age: 25,
//! internal_id: 1002,
//! department: "Marketing".into(),
//! },
//! ];
//! let table = Employee::to_table(&employees);
//! ```
//!
//! # Panel Example
//!
//! ```ignore
//! use gilt::Panel;
//!
//! #[derive(Panel)]
//! #[panel(title = "Server Status", box_style = "ROUNDED", border_style = "blue")]
//! struct ServerStatus {
//! #[field(label = "Host", style = "bold cyan")]
//! name: String,
//! #[field(label = "CPU %", style = "yellow")]
//! cpu: f32,
//! #[field(skip)]
//! internal_id: u64,
//! #[field(label = "Memory", style = "green")]
//! memory: f32,
//! }
//!
//! let status = ServerStatus {
//! name: "web-01".into(),
//! cpu: 42.5,
//! internal_id: 1001,
//! memory: 67.3,
//! };
//! let panel = status.to_panel();
//! ```
use TokenStream;
use Span;
use ;
// ===========================================================================
// Tree derive entry point (impl moved to crate::tree in v0.11.4)
// ===========================================================================
/// Derive macro generating `to_tree(&self) -> gilt::tree::Tree`.
/// See [`crate::tree`] for full attribute schema.
// ===========================================================================
// Renderable derive entry point (impl moved to crates::renderable in v0.11.4)
// ===========================================================================
/// Derive macro that generates a `gilt::console::Renderable` implementation
/// for a struct, delegating to one of the existing widget derives.
///
/// See [`crate::renderable`] for full attribute schema and behaviour.
// ===========================================================================
// Inspect derive entry point (impl moved to crate::inspect in v0.11.4)
// ===========================================================================
/// Derive macro that generates a `to_inspect(&self) -> gilt::inspect::Inspect`
/// method for structs implementing `Debug`. See [`crate::inspect`] for the
/// full attribute schema.
// ===========================================================================
// Rule derive entry point (impl moved to crate::rule in v0.11.4)
// ===========================================================================
/// Derive macro that generates a `to_rule(&self) -> gilt::rule::Rule` method.
/// See [`crate::rule`] for the full attribute schema.
// ===========================================================================
// Columns derive entry point (impl moved to crate::columns in v0.11.4)
// ===========================================================================
/// Derive macro generating `to_columns(items: &[Self]) -> gilt::columns::Columns`.
/// See [`crate::columns`] for full attribute schema.
// ===========================================================================
// Panel derive entry point (impl moved to crate::panel in v0.11.4)
// ===========================================================================
/// Derive macro generating `to_panel(&self) -> gilt::panel::Panel`.
/// See [`crate::panel`] for full attribute schema.
// ===========================================================================
// Table derive entry point (impl moved to crate::table in v0.11.4)
// ===========================================================================
/// Derive macro generating `to_table(items: &[Self]) -> gilt::table::Table`.
/// See [`crate::table`] for full attribute schema.
// ---------------------------------------------------------------------------
// Tests (extracted to tests.rs in v1.2 cleanup)
// ---------------------------------------------------------------------------