rustmotion-components 0.7.0

Component library for rustmotion (51 components)
Documentation
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
pub mod box_builder;
pub mod intrinsic;
pub mod legacy_dispatch;

pub mod arrow;
pub mod audio_spectrum;
pub mod avatar;
pub mod avatar_group;
pub mod badge;
pub mod callout;
pub mod caption;
pub mod card;
pub mod chart;
pub mod codeblock;
pub mod comparison;
pub mod connector;
pub mod container;
pub mod countdown;
pub mod counter;
pub mod cursor;
pub mod divider;
pub mod dot_map;
pub mod flex;
pub mod gauge;
pub mod gif;
pub mod gradient_text;
pub mod grid;
pub mod heatmap;
pub mod icon;
pub mod image;
pub mod kbd;
pub mod line;
pub mod list;
pub mod lottie;
pub mod marquee;
pub mod mockup;
pub mod notification;
pub mod number_wheel;
pub mod particle;
pub mod pill_nav;
pub mod pointer;
pub mod positioned;
pub mod progress;
pub mod qrcode;
pub mod rating;
pub mod rich_text;
pub mod shape;
pub mod skeleton;
pub mod slider;
pub mod sparkline;
pub mod stat;
pub mod stepper;
pub mod success_check;
pub mod svg;
pub mod switch;
pub mod table;
pub mod tag_cloud;
pub mod terminal;
pub mod text;
pub mod timeline;
pub mod tooltip;
pub mod treemap;
pub mod video;
pub mod waveform;
pub mod world_bitmap;

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use rustmotion_core::traits::{Animatable, Painter, Styled, Timed};

pub use arrow::Arrow;
pub use audio_spectrum::AudioSpectrum;
pub use avatar::Avatar;
pub use avatar_group::AvatarGroup;
pub use badge::Badge;
pub use callout::Callout;
pub use caption::Caption;
pub use card::Card;
pub use chart::Chart;
pub use codeblock::Codeblock;
pub use comparison::Comparison;
pub use connector::Connector;
pub use container::ContainerComponent;
pub use countdown::Countdown;
pub use counter::Counter;
pub use cursor::Cursor;
pub use divider::Divider;
pub use dot_map::DotMap;
pub use flex::Flex;
pub use gauge::Gauge;
pub use gif::Gif;
pub use gradient_text::GradientText;
pub use grid::Grid;
pub use heatmap::Heatmap;
pub use icon::Icon;
pub use image::Image;
pub use kbd::Kbd;
pub use line::Line;
pub use list::List;
pub use lottie::Lottie;
pub use marquee::Marquee;
pub use mockup::Mockup;
pub use notification::Notification;
pub use number_wheel::NumberWheel;
pub use particle::Particle;
pub use pill_nav::PillNav;
pub use pointer::Pointer;
pub use positioned::Positioned;
pub use progress::Progress;
pub use qrcode::QrCode;
pub use rating::Rating;
pub use rich_text::RichText;
pub use shape::Shape;
pub use skeleton::Skeleton;
pub use slider::Slider;
pub use sparkline::Sparkline;
pub use stat::Stat;
pub use stepper::Stepper;
pub use success_check::SuccessCheck;
pub use svg::Svg;
pub use switch::Switch;
pub use table::Table;
pub use tag_cloud::TagCloud;
pub use terminal::Terminal;
pub use text::Text;
pub use timeline::Timeline;
pub use tooltip::Tooltip;
pub use treemap::Treemap;
pub use video::Video;
pub use waveform::Waveform;

// --- Position mode ---

/// Constat #8: `PositionMode::Named(String)` accepts any string, but
/// [`ChildComponent::absolute_position`] only ever treats the literal
/// `"absolute"` specially — every other value (including the CSS-legitimate
/// `"relative"`/`"static"`, which an LLM reasoning in CSS terms naturally
/// reaches for) silently drops `x`/`y`: the component is taken out of flow
/// (`is_flow()` is false for any `Some(position)`) but never receives an
/// absolute offset either, since only `"absolute"` is matched. `x`/`y` are
/// top-level sibling fields on `ChildComponent`, not on `PositionMode`
/// itself, so this can't detect *whether* they were actually set — only
/// that, if they were, they are about to be silently ignored. `"absolute"`
/// stays completely silent (the common, correct case); anything else warns.
pub fn is_recognized_position_name(s: &str) -> bool {
    s == "absolute"
}

#[derive(Debug, Clone, Serialize, JsonSchema)]
#[serde(untagged)]
pub enum PositionMode {
    Absolute { x: f32, y: f32 },
    Named(String),
}

impl<'de> Deserialize<'de> for PositionMode {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        #[derive(Deserialize)]
        #[serde(untagged)]
        enum Raw {
            Absolute { x: f32, y: f32 },
            Named(String),
        }
        Ok(match Raw::deserialize(deserializer)? {
            Raw::Absolute { x, y } => PositionMode::Absolute { x, y },
            Raw::Named(s) => {
                if !is_recognized_position_name(&s) && warn_once_for(&s) {
                    eprintln!(
                        "Warning: position: \"{s}\" is not \"absolute\" — this component-level \
                         `position` shorthand only honours the literal \"absolute\" (paired with \
                         `x`/`y`); any other value, including CSS-legitimate ones like \
                         \"relative\"/\"static\", is accepted but silently drops `x`/`y` instead \
                         of positioning the element (it still removes the component from flex \
                         flow). Use `style.position` for real CSS relative/static semantics."
                    );
                }
                PositionMode::Named(s)
            }
        })
    }
}

/// True the first time this exact `position` value is seen, false afterwards.
///
/// `render_scene_frame` calls `prepare_scene` — and therefore re-runs this
/// `Deserialize` over the whole scene tree — once **per frame**. An unguarded
/// warning here would print the same line once per offending component per
/// frame: over a thousand times on a 1200-frame render, drowning out anything
/// else on stderr. Keyed by the value rather than a plain `Once` so a scenario
/// with several distinct bad values still hears about each of them.
pub(crate) fn warn_once_for(value: &str) -> bool {
    use std::collections::HashSet;
    use std::sync::{Mutex, OnceLock};
    static SEEN: OnceLock<Mutex<HashSet<String>>> = OnceLock::new();
    SEEN.get_or_init(Default::default)
        .lock()
        .map(|mut seen| seen.insert(value.to_owned()))
        .unwrap_or(false)
}

impl Default for PositionMode {
    fn default() -> Self {
        Self::Absolute { x: 0.0, y: 0.0 }
    }
}

#[cfg(test)]
mod position_mode_tests {
    use super::*;

    // ---- constat #8 (RED first) ----

    #[test]
    fn absolute_is_recognized() {
        assert!(is_recognized_position_name("absolute"));
    }

    #[test]
    fn relative_and_static_and_typos_are_not_recognized() {
        for s in ["relative", "static", "fixed", "sticky", "Absolute", "abs"] {
            assert!(
                !is_recognized_position_name(s),
                "'{s}' must not be treated as the recognised \"absolute\" value"
            );
        }
    }

    #[test]
    fn absolute_object_form_still_carries_x_y() {
        let json =
            r#"{ "position": { "x": 10.0, "y": 20.0 }, "type": "shape", "shape": "circle" }"#;
        let child: ChildComponent = serde_json::from_str(json).unwrap();
        assert_eq!(child.absolute_position(), Some((10.0, 20.0)));
    }

    #[test]
    fn absolute_string_form_with_sibling_x_y_still_carries_them() {
        let json =
            r#"{ "position": "absolute", "x": 5.0, "y": 7.0, "type": "shape", "shape": "circle" }"#;
        let child: ChildComponent = serde_json::from_str(json).unwrap();
        assert_eq!(child.absolute_position(), Some((5.0, 7.0)));
    }

    #[test]
    fn relative_still_parses_but_drops_x_y_and_the_helper_flags_it() {
        // The legitimate-CSS trap named in constat #8: an LLM writes
        // `"position": "relative"` (valid CSS) with `x`/`y` alongside it,
        // expecting a positioned element. The parse must not fail — this is
        // legitimate JSON per the schema's own untagged catch-all — but the
        // coordinates are provably dropped (`absolute_position()` is
        // `None`), and `is_recognized_position_name` is the named,
        // independently testable signal the warning path uses to detect
        // this instead of staying silent.
        let json =
            r#"{ "position": "relative", "x": 5.0, "y": 7.0, "type": "shape", "shape": "circle" }"#;
        let child: ChildComponent = serde_json::from_str(json).unwrap();
        assert!(
            !is_recognized_position_name("relative"),
            "this is exactly the case the warning fires for"
        );
        assert_eq!(
            child.absolute_position(),
            None,
            "x/y are indeed dropped for a non-\"absolute\" position — this is the silent \
             behaviour being made loud, not a new regression"
        );
        // The component is still taken out of flow, same as before.
        assert!(!child.is_flow());
    }

    /// `prepare_scene` re-runs this `Deserialize` over the whole scene tree
    /// once per frame, so the warning must be deduplicated or a 1200-frame
    /// render prints it 1200 times. Distinct values still each get a line.
    #[test]
    fn the_warning_fires_once_per_distinct_value_not_once_per_frame() {
        let value = "position-value-used-only-by-this-test";
        assert!(warn_once_for(value), "first sighting must warn");
        for _ in 0..1000 {
            assert!(
                !warn_once_for(value),
                "re-parsing the same value must stay silent"
            );
        }
        assert!(
            warn_once_for("a-different-position-value-for-this-test"),
            "a different bad value must still get its own warning"
        );
    }

    #[test]
    fn no_position_set_is_a_normal_flow_child() {
        let json = r#"{ "type": "shape", "shape": "circle" }"#;
        let child: ChildComponent = serde_json::from_str(json).unwrap();
        assert!(child.is_flow());
        assert_eq!(child.absolute_position(), None);
    }
}

// --- Child wrapper ---

#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct ChildComponent {
    #[serde(flatten)]
    pub component: Component,
    #[serde(default)]
    pub position: Option<PositionMode>,
    #[serde(default)]
    pub x: Option<f32>,
    #[serde(default)]
    pub y: Option<f32>,
    #[serde(default, rename = "z-index")]
    pub z_index: Option<i32>,
    /// Declares that this component's job is to extend past the frame edge
    /// (e.g. a radial glow used as a base layer). Top-level field, not a
    /// `style` property — `CssStyle` is `deny_unknown_fields` and belongs to
    /// no one this wave. Defaults to `false`: no existing scenario changes
    /// behaviour. Exempts only `viewport_overflow` and `animated_text_overflow`
    /// (see `crates/rustmotion/src/cli/commands/geometry.rs`); it does NOT
    /// exempt `content_overflows_box` — content larger than its own box stays
    /// a reported defect regardless of `bleed`. Applies to this component
    /// only: a bled container does not suppress checks on its children, since
    /// each child is its own `ChildComponent` with its own `bleed` flag.
    #[serde(default)]
    pub bleed: bool,
}

impl ChildComponent {
    pub fn is_flow(&self) -> bool {
        self.position.is_none()
    }

    pub fn is_decorative(&self) -> bool {
        matches!(self.component, Component::Particle(_))
    }

    pub fn absolute_position(&self) -> Option<(f32, f32)> {
        match &self.position {
            Some(PositionMode::Absolute { x, y }) => Some((*x, *y)),
            Some(PositionMode::Named(s)) if s == "absolute" => {
                Some((self.x.unwrap_or(0.0), self.y.unwrap_or(0.0)))
            }
            _ => None,
        }
    }
}

// --- Component enum ---

#[derive(Debug, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Component {
    AudioSpectrum(AudioSpectrum),
    Text(Text),
    Shape(Shape),
    Image(Image),
    Icon(Icon),
    Svg(Svg),
    Video(Video),
    Gif(Gif),
    Counter(Counter),
    Cursor(Cursor),
    Caption(Caption),
    Codeblock(Codeblock),
    Connector(Connector),
    Avatar(Avatar),
    AvatarGroup(AvatarGroup),
    Arrow(Arrow),
    Badge(Badge),
    Callout(Callout),
    Chart(Chart),
    Comparison(Comparison),
    Countdown(Countdown),
    Divider(Divider),
    DotMap(DotMap),
    Gauge(Gauge),
    GradientText(GradientText),
    Heatmap(Heatmap),
    Kbd(Kbd),
    Line(Line),
    List(List),
    Lottie(Lottie),
    Marquee(Marquee),
    Mockup(Mockup),
    Notification(Notification),
    Particle(Particle),
    PillNav(PillNav),
    #[serde(alias = "progress_bar")]
    Progress(Progress),
    QrCode(QrCode),
    NumberWheel(NumberWheel),
    SuccessCheck(SuccessCheck),
    Pointer(Pointer),
    Rating(Rating),
    Skeleton(Skeleton),
    Slider(Slider),
    Sparkline(Sparkline),
    Stat(Stat),
    Stepper(Stepper),
    Switch(Switch),
    RichText(RichText),
    Table(Table),
    TagCloud(TagCloud),
    Terminal(Terminal),
    Timeline(Timeline),
    Tooltip(Tooltip),
    Treemap(Treemap),
    Positioned(Positioned),
    Flex(Flex),
    Grid(Grid),
    Card(Card),
    #[serde(rename = "div", alias = "container")]
    Container(ContainerComponent),
    Waveform(Waveform),
}

// --- Dispatch helpers ---

impl Component {
    pub fn as_animatable(&self) -> Option<&dyn Animatable> {
        match self {
            Component::AudioSpectrum(c) => Some(c),
            Component::Waveform(c) => Some(c),
            Component::Text(c) => Some(c),
            Component::Shape(c) => Some(c),
            Component::Image(c) => Some(c),
            Component::Icon(c) => Some(c),
            Component::Svg(c) => Some(c),
            Component::Video(c) => Some(c),
            Component::Gif(c) => Some(c),
            Component::Counter(c) => Some(c),
            Component::Cursor(c) => Some(c),
            Component::Caption(c) => Some(c),
            Component::Codeblock(c) => Some(c),
            Component::Avatar(c) => Some(c),
            Component::AvatarGroup(c) => Some(c),
            Component::Arrow(c) => Some(c),
            Component::Connector(c) => Some(c),
            Component::Badge(c) => Some(c),
            Component::Callout(c) => Some(c),
            Component::Chart(c) => Some(c),
            Component::Comparison(c) => Some(c),
            Component::Countdown(c) => Some(c),
            Component::Divider(c) => Some(c),
            Component::DotMap(c) => Some(c),
            Component::Gauge(c) => Some(c),
            Component::GradientText(c) => Some(c),
            Component::Heatmap(c) => Some(c),
            Component::Kbd(c) => Some(c),
            Component::Line(c) => Some(c),
            Component::List(c) => Some(c),
            Component::Lottie(c) => Some(c),
            Component::Marquee(c) => Some(c),
            Component::Mockup(c) => Some(c),
            Component::Notification(c) => Some(c),
            Component::Particle(c) => Some(c),
            Component::PillNav(c) => Some(c),
            Component::Progress(c) => Some(c),
            Component::QrCode(c) => Some(c),
            Component::NumberWheel(c) => Some(c),
            Component::SuccessCheck(c) => Some(c),
            Component::Pointer(c) => Some(c),
            Component::Rating(c) => Some(c),
            Component::Skeleton(c) => Some(c),
            Component::Slider(c) => Some(c),
            Component::Sparkline(c) => Some(c),
            Component::Stat(c) => Some(c),
            Component::Stepper(c) => Some(c),
            Component::Switch(c) => Some(c),
            Component::RichText(c) => Some(c),
            Component::Table(c) => Some(c),
            Component::TagCloud(c) => Some(c),
            Component::Terminal(c) => Some(c),
            Component::Timeline(c) => Some(c),
            Component::Tooltip(c) => Some(c),
            Component::Treemap(c) => Some(c),
            Component::Flex(c) => Some(c),
            Component::Grid(c) => Some(c),
            Component::Card(c) => Some(c),
            Component::Container(c) => Some(c),
            Component::Positioned(c) => Some(c),
        }
    }

    pub fn as_timed(&self) -> Option<&dyn Timed> {
        match self {
            Component::AudioSpectrum(c) => Some(c),
            Component::Waveform(c) => Some(c),
            Component::Text(c) => Some(c),
            Component::Shape(c) => Some(c),
            Component::Image(c) => Some(c),
            Component::Icon(c) => Some(c),
            Component::Svg(c) => Some(c),
            Component::Video(c) => Some(c),
            Component::Gif(c) => Some(c),
            Component::Counter(c) => Some(c),
            Component::Cursor(c) => Some(c),
            Component::Codeblock(c) => Some(c),
            Component::Avatar(c) => Some(c),
            Component::AvatarGroup(c) => Some(c),
            Component::Arrow(c) => Some(c),
            Component::Connector(c) => Some(c),
            Component::Badge(c) => Some(c),
            Component::Callout(c) => Some(c),
            Component::Chart(c) => Some(c),
            Component::Comparison(c) => Some(c),
            Component::Countdown(c) => Some(c),
            Component::Divider(c) => Some(c),
            Component::DotMap(c) => Some(c),
            Component::Gauge(c) => Some(c),
            Component::GradientText(c) => Some(c),
            Component::Heatmap(c) => Some(c),
            Component::Kbd(c) => Some(c),
            Component::Line(c) => Some(c),
            Component::List(c) => Some(c),
            Component::Lottie(c) => Some(c),
            Component::Marquee(c) => Some(c),
            Component::Mockup(c) => Some(c),
            Component::Notification(c) => Some(c),
            Component::Particle(c) => Some(c),
            Component::PillNav(c) => Some(c),
            Component::Progress(c) => Some(c),
            Component::QrCode(c) => Some(c),
            Component::NumberWheel(c) => Some(c),
            Component::SuccessCheck(c) => Some(c),
            Component::Pointer(c) => Some(c),
            Component::Rating(c) => Some(c),
            Component::Skeleton(c) => Some(c),
            Component::Slider(c) => Some(c),
            Component::Sparkline(c) => Some(c),
            Component::Stat(c) => Some(c),
            Component::Stepper(c) => Some(c),
            Component::Switch(c) => Some(c),
            Component::RichText(c) => Some(c),
            Component::Table(c) => Some(c),
            Component::TagCloud(c) => Some(c),
            Component::Terminal(c) => Some(c),
            Component::Timeline(c) => Some(c),
            Component::Tooltip(c) => Some(c),
            Component::Treemap(c) => Some(c),
            Component::Flex(c) => Some(c),
            Component::Grid(c) => Some(c),
            Component::Card(c) => Some(c),
            Component::Container(c) => Some(c),
            Component::Caption(c) => Some(c),
            Component::Positioned(c) => Some(c),
        }
    }

    pub fn as_styled(&self) -> &dyn Styled {
        match self {
            Component::AudioSpectrum(c) => c,
            Component::Waveform(c) => c,
            Component::Text(c) => c,
            Component::Shape(c) => c,
            Component::Image(c) => c,
            Component::Icon(c) => c,
            Component::Svg(c) => c,
            Component::Video(c) => c,
            Component::Gif(c) => c,
            Component::Counter(c) => c,
            Component::Cursor(c) => c,
            Component::Caption(c) => c,
            Component::Codeblock(c) => c,
            Component::Avatar(c) => c,
            Component::AvatarGroup(c) => c,
            Component::Arrow(c) => c,
            Component::Connector(c) => c,
            Component::Badge(c) => c,
            Component::Callout(c) => c,
            Component::Chart(c) => c,
            Component::Comparison(c) => c,
            Component::Countdown(c) => c,
            Component::Divider(c) => c,
            Component::DotMap(c) => c,
            Component::Gauge(c) => c,
            Component::GradientText(c) => c,
            Component::Heatmap(c) => c,
            Component::Kbd(c) => c,
            Component::Line(c) => c,
            Component::List(c) => c,
            Component::Lottie(c) => c,
            Component::Marquee(c) => c,
            Component::Mockup(c) => c,
            Component::Notification(c) => c,
            Component::Particle(c) => c,
            Component::PillNav(c) => c,
            Component::Progress(c) => c,
            Component::QrCode(c) => c,
            Component::NumberWheel(c) => c,
            Component::SuccessCheck(c) => c,
            Component::Pointer(c) => c,
            Component::Rating(c) => c,
            Component::Skeleton(c) => c,
            Component::Slider(c) => c,
            Component::Sparkline(c) => c,
            Component::Stat(c) => c,
            Component::Stepper(c) => c,
            Component::Switch(c) => c,
            Component::RichText(c) => c,
            Component::Table(c) => c,
            Component::TagCloud(c) => c,
            Component::Terminal(c) => c,
            Component::Timeline(c) => c,
            Component::Tooltip(c) => c,
            Component::Treemap(c) => c,
            Component::Positioned(c) => c,
            Component::Flex(c) => c,
            Component::Grid(c) => c,
            Component::Card(c) => c,
            Component::Container(c) => c,
        }
    }

    /// Returns the Painter trait. All 51 components are migrated to the new
    /// pipeline; the dispatcher always uses Painter::paint_content.
    pub fn as_painter(&self) -> Option<&dyn Painter> {
        match self {
            Component::AudioSpectrum(c) => Some(c),
            Component::Waveform(c) => Some(c),
            Component::Card(c) => Some(c),
            Component::Container(c) => Some(c),
            Component::Flex(c) => Some(c),
            Component::Grid(c) => Some(c),
            Component::Positioned(c) => Some(c),
            Component::Divider(c) => Some(c),
            Component::Shape(c) => Some(c),
            Component::Image(c) => Some(c),
            Component::Icon(c) => Some(c),
            Component::Svg(c) => Some(c),
            Component::QrCode(c) => Some(c),
            Component::Gif(c) => Some(c),
            Component::Video(c) => Some(c),
            Component::Lottie(c) => Some(c),
            Component::Cursor(c) => Some(c),
            Component::Particle(c) => Some(c),
            Component::Mockup(c) => Some(c),
            Component::Text(c) => Some(c),
            Component::Caption(c) => Some(c),
            Component::Badge(c) => Some(c),
            Component::Kbd(c) => Some(c),
            Component::Callout(c) => Some(c),
            Component::Marquee(c) => Some(c),
            Component::TagCloud(c) => Some(c),
            Component::GradientText(c) => Some(c),
            Component::RichText(c) => Some(c),
            Component::Switch(c) => Some(c),
            Component::Slider(c) => Some(c),
            Component::NumberWheel(c) => Some(c),
            Component::SuccessCheck(c) => Some(c),
            Component::Pointer(c) => Some(c),
            Component::Rating(c) => Some(c),
            Component::Stepper(c) => Some(c),
            Component::Comparison(c) => Some(c),
            Component::Notification(c) => Some(c),
            Component::Tooltip(c) => Some(c),
            Component::PillNav(c) => Some(c),
            Component::List(c) => Some(c),
            Component::Skeleton(c) => Some(c),
            Component::Avatar(c) => Some(c),
            Component::AvatarGroup(c) => Some(c),
            Component::Timeline(c) => Some(c),
            Component::Progress(c) => Some(c),
            Component::Counter(c) => Some(c),
            Component::Countdown(c) => Some(c),
            Component::Gauge(c) => Some(c),
            Component::Sparkline(c) => Some(c),
            Component::Stat(c) => Some(c),
            Component::Heatmap(c) => Some(c),
            Component::Treemap(c) => Some(c),
            Component::DotMap(c) => Some(c),
            Component::Table(c) => Some(c),
            Component::Codeblock(c) => Some(c),
            Component::Terminal(c) => Some(c),
            Component::Chart(c) => Some(c),
            Component::Line(c) => Some(c),
            Component::Arrow(c) => Some(c),
            Component::Connector(c) => Some(c),
        }
    }
}