euv_ui/component/media/struct.rs
1use super::*;
2
3/// Responsive cross-platform static image component with format badge and optional caption.
4#[derive(Clone, Data, Debug, Props)]
5pub struct EuvImage {
6 /// Decoded static image asset.
7 pub(crate) asset: ImageAsset,
8 /// Visual box-fitting strategy (`Contain`, `Cover`, `Fill`, `ScaleDown`).
9 #[get(type(copy))]
10 pub(crate) fit: MediaFit,
11 /// Optional caption displayed below the image.
12 pub(crate) caption: String,
13 /// Resolved theme tokens.
14 #[get(type(copy))]
15 pub(crate) tokens: ThemeTokens,
16 /// Optional style overrides controlling viewport height (`height: Length::Px(...)`) and container appearance.
17 #[get(type(copy))]
18 pub(crate) style: Option<Style>,
19}
20
21/// Native vector SVG viewer displaying a parsed and rasterized `SvgDocument`.
22#[derive(Clone, Data, Debug, Props)]
23pub struct EuvSvgView {
24 /// Parsed and rasterized SVG document.
25 pub(crate) document: SvgDocument,
26 /// Display label.
27 pub(crate) label: String,
28 /// Resolved theme tokens.
29 #[get(type(copy))]
30 pub(crate) tokens: ThemeTokens,
31 /// Optional style overrides controlling viewport height (`height: Length::Px(...)`) and container appearance.
32 #[get(type(copy))]
33 pub(crate) style: Option<Style>,
34}
35
36/// Interactive multi-frame animated GIF player with Play/Pause and single-frame stepping.
37#[derive(Clone, Data, Debug, Props)]
38pub struct EuvGifPlayer {
39 /// Reactive GIF animation state signal.
40 #[get(type(copy))]
41 pub(crate) state: Signal<GifAnimation>,
42 /// Resolved theme tokens.
43 #[get(type(copy))]
44 pub(crate) tokens: ThemeTokens,
45 /// Optional style overrides controlling viewport height (`height: Length::Px(...)`) and container appearance.
46 #[get(type(copy))]
47 pub(crate) style: Option<Style>,
48}
49
50/// Interactive Apple/Android-style LIVE Photo viewer supporting press-and-hold and button-triggered motion bursts.
51#[derive(Clone, Data, Debug, Props)]
52pub struct EuvLivePhoto {
53 /// Reactive LIVE Photo asset signal.
54 #[get(type(copy))]
55 pub(crate) state: Signal<LivePhotoAsset>,
56 /// Resolved theme tokens.
57 #[get(type(copy))]
58 pub(crate) tokens: ThemeTokens,
59 /// Optional style overrides controlling viewport height (`height: Length::Px(...)`) and container appearance.
60 #[get(type(copy))]
61 pub(crate) style: Option<Style>,
62}
63
64/// Cross-platform interactive video player with timeline scrubbing, speed, mute, captions, and transport controls.
65#[derive(Clone, Data, Debug, Props)]
66pub struct EuvVideoPlayer {
67 /// Reactive video track signal.
68 #[get(type(copy))]
69 pub(crate) state: Signal<VideoTrack>,
70 /// Resolved theme tokens.
71 #[get(type(copy))]
72 pub(crate) tokens: ThemeTokens,
73 /// Optional style overrides controlling viewport height (`height: Length::Px(...)`) and container appearance.
74 #[get(type(copy))]
75 pub(crate) style: Option<Style>,
76}
77
78/// Studio audio player with a 48-bar reactive waveform visualizer, scrub slider, mute, and timecode readout.
79#[derive(Clone, Data, Debug, Props)]
80pub struct EuvAudioPlayer {
81 /// Reactive audio track signal.
82 #[get(type(copy))]
83 pub(crate) state: Signal<AudioTrack>,
84 /// Resolved theme tokens.
85 #[get(type(copy))]
86 pub(crate) tokens: ThemeTokens,
87}
88
89/// Multi-page native PDF document viewer with page navigation and zoom controls.
90#[derive(Clone, Data, Debug, Props)]
91pub struct EuvPdfViewer {
92 /// Reactive PDF document signal.
93 #[get(type(copy))]
94 pub(crate) state: Signal<PdfDocument>,
95 /// Resolved theme tokens.
96 #[get(type(copy))]
97 pub(crate) tokens: ThemeTokens,
98}
99
100/// Sanitized native HTML5 renderer compiling parsed `HtmlDocument` blocks directly into `euv` scene nodes.
101#[derive(Clone, CustomDebug, Data, Props)]
102pub struct EuvHtmlView {
103 /// Parsed sanitized HTML document.
104 pub(crate) document: HtmlDocument,
105 /// Optional callback invoked with the clicked `href` URL when a hyperlink is activated.
106 #[debug(skip)]
107 #[get(skip)]
108 #[prop(custom)]
109 pub(crate) on_link: Option<HtmlLinkCallback>,
110 /// Resolved theme tokens.
111 #[get(type(copy))]
112 pub(crate) tokens: ThemeTokens,
113}
114
115/// Cached live-DPR SVG vector display-list entry keyed by logical bounds, DPI scale bits, and physical pixel dimensions.
116pub(crate) struct SvgPaintCacheEntry {
117 /// Logical canvas bounds when cached.
118 pub(crate) bounds: Rect,
119 /// Display DPI scale factor raw `f32` bits when cached.
120 pub(crate) scale_bits: u32,
121 /// Resolved physical pixel width when cached.
122 pub(crate) physical_width: u32,
123 /// Resolved physical pixel height when cached.
124 pub(crate) physical_height: u32,
125 /// Cached vector draw commands.
126 pub(crate) commands: Vec<DrawCommand>,
127}