glory-render 0.9.0

Semantic rendering contracts and reference interpreter for Glory
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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::rc::Rc;

use glory_style::Style;

use crate::{Change, Error, normalize_text};
mod live;
pub use live::LiveDescriptor;
mod view;
pub use view::DescriptorView;

/// Process-local, typed mapping metadata. It is deliberately not a wire format.
#[derive(Clone, Default)]
pub struct Options(HashMap<TypeId, Rc<dyn Any>>);

impl Options {
    pub fn insert<T: 'static>(&mut self, value: T) {
        self.0.insert(TypeId::of::<T>(), Rc::new(value));
    }
    pub fn get<T: 'static>(&self) -> Option<&T> {
        self.0.get(&TypeId::of::<T>())?.downcast_ref()
    }
}

impl std::fmt::Debug for Options {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("Options")
            .field("types", &self.0.len())
            .finish()
    }
}

impl PartialEq for Options {
    fn eq(&self, other: &Self) -> bool {
        self.0.len() == other.0.len()
            && self.0.iter().all(|(key, value)| {
                other
                    .0
                    .get(key)
                    .is_some_and(|other| Rc::ptr_eq(value, other))
            })
    }
}

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum TextKind {
    #[default]
    Inline,
    Paragraph,
    Heading(u8),
    Code,
    Kbd,
    Mark,
}
impl TextKind {
    pub const fn is_inline(self) -> bool {
        matches!(self, Self::Inline | Self::Code | Self::Kbd | Self::Mark)
    }
}

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum Purpose {
    #[default]
    Text,
    Password,
    Email,
    Search,
    Url,
    Tel,
    Number,
}

/// Structural roles belong to View. Other widgets keep their intrinsic
/// control/text/image semantics rather than impersonating unrelated widgets.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Role {
    /// Interactive numeric range control; finite configuration is required.
    Slider,
    /// Intrinsic editable numeric input; use spinbutton metadata on Input.
    SpinButton,
    /// Read-only numeric or indeterminate progress, never a range input.
    ProgressBar,
    /// Passive document boundary; resizing/focus belongs to a future splitter.
    Separator,
    Group,
    Main,
    Banner,
    ContentInfo,
    Section,
    Navigation,
    List,
    ListItem,
    Status,
    Alert,
    /// Read-only tabular data; rows contain column headers or cells.
    Table,
    Grid,
    GridCell,
    Tree,
    TreeItem,
    Row,
    ColumnHeader,
    Cell,
    /// A named dialog. Modality and focus management belong to the host.
    Dialog,
    /// A modal decision with an explicit safe initial action.
    AlertDialog,
    /// Passive supplemental description; its descendants cannot be interactive.
    Tooltip,
    TabList,
    TabPanel,
    RadioGroup,
    Toolbar,
    Menu,
    Menubar,
    Listbox,
    Heading(u8),
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TextProps {
    pub content: String,
    pub kind: TextKind,
    pub selectable: bool,
}

impl Default for TextProps {
    fn default() -> Self {
        Self {
            content: String::new(),
            kind: TextKind::Inline,
            selectable: true,
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ButtonProps {
    pub label: String,
    pub enabled: bool,
}

impl Default for ButtonProps {
    fn default() -> Self {
        Self {
            label: String::new(),
            enabled: true,
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct InputProps {
    pub value: String,
    pub revision: u64,
    pub purpose: Purpose,
    pub multiline: bool,
    pub enabled: bool,
}

impl Default for InputProps {
    fn default() -> Self {
        Self {
            value: String::new(),
            revision: 0,
            purpose: Purpose::Text,
            multiline: false,
            enabled: true,
        }
    }
}

/// Finite native check semantics. Mixed preserves indeterminacy independently
/// of the stored checked bit; Switch and Radio never expose a mixed state.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum CheckMode {
    #[default]
    Checkbox,
    Mixed,
    Switch,
    Radio,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CheckProps {
    pub mode: CheckMode,
    pub checked: bool,
    pub label: String,
    pub enabled: bool,
}

impl Default for CheckProps {
    fn default() -> Self {
        Self {
            mode: CheckMode::Checkbox,
            checked: false,
            label: String::new(),
            enabled: true,
        }
    }
}

pub const MAX_IMAGE_CANDIDATES: usize = 16;
pub const MAX_IMAGE_SIZE_HINTS: usize = 8;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ImageCandidate {
    pub source: String,
    pub width: u16,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ImageSlotSize {
    Pixels(u16),
    ViewportWidth(u8),
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct ImageSizeHint {
    /// A CSS viewport-width upper bound. `None` is the required final fallback.
    pub max_viewport_width: Option<u16>,
    pub slot: ImageSlotSize,
}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ResponsiveImage {
    pub candidates: Vec<ImageCandidate>,
    pub sizes: Vec<ImageSizeHint>,
}

impl ResponsiveImage {
    pub fn validate(&self) -> Result<(), Error> {
        if self.candidates.len() > MAX_IMAGE_CANDIDATES {
            return Err(Error::InvalidProps("too many responsive image candidates"));
        }
        let mut previous_width = 0;
        for candidate in &self.candidates {
            if candidate.source.is_empty()
                || candidate.source.len() > 4096
                || candidate.source.chars().any(|character| {
                    character.is_control() || character.is_whitespace() || character == ','
                })
                || candidate.width == 0
                || candidate.width > 16_384
                || candidate.width <= previous_width
            {
                return Err(Error::InvalidProps(
                    "responsive image candidates require ordered unique 1..=16384 widths and bounded sources",
                ));
            }
            previous_width = candidate.width;
        }
        if self.sizes.len() > MAX_IMAGE_SIZE_HINTS
            || self.candidates.is_empty() != self.sizes.is_empty()
        {
            return Err(Error::InvalidProps(
                "responsive image candidates and sizes must be configured together",
            ));
        }
        let mut previous_breakpoint = 0;
        for (index, hint) in self.sizes.iter().enumerate() {
            match hint.max_viewport_width {
                Some(width)
                    if width > 0
                        && width <= 16_384
                        && width > previous_breakpoint
                        && index + 1 < self.sizes.len() =>
                {
                    previous_breakpoint = width;
                }
                None if index + 1 == self.sizes.len() => {}
                _ => {
                    return Err(Error::InvalidProps(
                        "responsive image sizes require ordered breakpoints and one final fallback",
                    ));
                }
            }
            if !matches!(
                hint.slot,
                ImageSlotSize::Pixels(1..=16_384) | ImageSlotSize::ViewportWidth(1..=100)
            ) {
                return Err(Error::InvalidProps(
                    "responsive image slot size is outside its finite range",
                ));
            }
        }
        Ok(())
    }
}

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum ImageLoading {
    #[default]
    Auto,
    Eager,
    Lazy,
}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ImageProps {
    pub source: String,
    /// Monotonic program request identity, independent of URL equality.
    pub revision: u64,
    /// None is explicitly decorative; Some("") is an empty description.
    pub alternative: Option<String>,
    pub responsive: ResponsiveImage,
    pub loading: ImageLoading,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ImageStatus {
    Loaded,
    Failed,
}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct LinkProps {
    /// Relative URL or an http, https, mailto or tel URL. Custom schemes are
    /// rejected; applications handle custom navigation through explicit host
    /// callbacks rather than putting executable or platform URLs in href.
    pub target: String,
    pub label: String,
}

impl LinkProps {
    pub fn validate(&self) -> Result<(), Error> {
        validate_link_target(&self.target)
    }
}

/// Validate before URL values reach any host. Percent-encoded colons remain
/// relative path data; a scheme is possible only before the first /, ? or #.
fn validate_link_target(target: &str) -> Result<(), Error> {
    let invalid =
        || Error::InvalidProps("link target requires a relative or http/https/mailto/tel URL");
    if target
        .chars()
        .any(|ch| ch.is_control() || ch.is_whitespace())
    {
        return Err(invalid());
    }
    let prefix = target.split(['/', '?', '#']).next().unwrap_or_default();
    if let Some((scheme, _)) = prefix.split_once(':')
        && !["http", "https", "mailto", "tel"]
            .iter()
            .any(|allowed| scheme.eq_ignore_ascii_case(allowed))
    {
        return Err(invalid());
    }
    Ok(())
}

#[derive(Clone, Debug, Default, PartialEq)]
pub enum Props {
    #[default]
    View,
    Group,
    Text(TextProps),
    Button(ButtonProps),
    Input(InputProps),
    Select(crate::SelectProps),
    File(crate::FileProps),
    RichEditor(crate::RichEditorProps),
    Check(CheckProps),
    Image(ImageProps),
    Graphic(crate::GraphicProps),
    Link(LinkProps),
}

impl Props {
    pub fn interactive(&self) -> bool {
        matches!(
            self,
            Self::Button(_)
                | Self::Input(_)
                | Self::Select(_)
                | Self::File(_)
                | Self::RichEditor(_)
                | Self::Check(_)
                | Self::Link(_)
        )
    }

    pub fn enabled(&self) -> bool {
        match self {
            Self::Button(p) => p.enabled,
            Self::Input(p) => p.enabled,
            Self::Select(p) => p.enabled,
            Self::File(p) => p.enabled,
            Self::RichEditor(p) => p.enabled,
            Self::Check(p) => p.enabled,
            _ => true,
        }
    }

    pub fn accepts_children(&self) -> bool {
        matches!(
            self,
            Self::View | Self::Group | Self::Button(_) | Self::Link(_)
        )
    }
}

#[derive(Clone, Debug, Default, PartialEq)]
pub struct Descriptor {
    pub props: Props,
    pub classes: Vec<String>,
    pub style: Style,
    pub role: Option<Role>,
    pub name: Option<String>,
    pub focus: FocusMode,
    pub item: Option<ItemPosition>,
    pub options: Options,
    pub semantics: Option<Box<crate::Semantics>>,
}

/// Host-native default, programmatic focus only, or a normal tab stop.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum FocusMode {
    #[default]
    Auto,
    Programmatic,
    TabStop,
}

/// Position in the logical collection, not in the mounted render window.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct ItemPosition {
    pub index: usize,
    /// None represents an unknown total. A known total must exceed index.
    pub count: Option<usize>,
}

impl Descriptor {
    #[inline]
    pub fn view(&self) -> DescriptorView<'_> {
        self.into()
    }
    pub fn semantic_id(&self) -> Option<&crate::SemanticId> {
        self.view().semantic_id()
    }
    pub fn hidden(&self) -> bool {
        self.view().hidden()
    }
    pub fn activation_enabled(&self) -> bool {
        self.view().activation_enabled()
    }
    pub fn readonly(&self) -> bool {
        self.view().readonly()
    }
    pub fn field_part(&self) -> Option<crate::FieldPart> {
        self.view().field_part()
    }
    pub fn document_part(&self) -> Option<crate::DocumentPart> {
        self.view().document_part()
    }
    pub fn effective_role(&self) -> Option<Role> {
        self.view().effective_role()
    }
    pub fn validate(&self) -> Result<(), Error> {
        self.view().validate()
    }

    pub fn new(props: Props) -> Self {
        Self {
            props,
            ..Self::default()
        }
    }

    /// Canonicalize stored editable text without changing a program's explicit
    /// revision. Single-line declarations retain their line-break diagnostic.
    pub fn normalize_input(&mut self) -> Result<(), Error> {
        if let Props::Input(input) = &mut self.props {
            if !input.multiline && input.value.contains(['\r', '\n']) {
                return Err(Error::InvalidProps(
                    "single-line input cannot contain line breaks",
                ));
            }
            if let std::borrow::Cow::Owned(value) = normalize_text(&input.value, input.multiline) {
                input.value = value;
            }
        }
        if let Props::Image(image) = &mut self.props
            && let std::borrow::Cow::Owned(source) = normalize_text(&image.source, true)
        {
            image.source = source;
        }
        Ok(())
    }

    fn validate_input_revision(&self, next: &Self) -> Result<(), Error> {
        if let (Some(old), Some(next)) = (
            self.semantics.as_ref().and_then(|s| s.clipboard.as_ref()),
            next.semantics.as_ref().and_then(|s| s.clipboard.as_ref()),
        ) {
            next.validate_update(old)?;
        }
        crate::swipe::revision(
            self.semantics.as_ref().and_then(|s| s.swipe_capture),
            next.semantics.as_ref().and_then(|s| s.swipe_capture),
        )?;
        crate::presence::revision(
            self.semantics.as_ref().and_then(|s| s.presence.as_deref()),
            next.semantics.as_ref().and_then(|s| s.presence.as_deref()),
        )?;
        crate::collapse::revision(
            self.semantics.as_ref().and_then(|s| s.collapse.as_ref()),
            next.semantics.as_ref().and_then(|s| s.collapse.as_ref()),
        )?;
        if let (Props::RichEditor(old), Props::RichEditor(next)) = (&self.props, &next.props) {
            next.validate_update(old)?;
        }
        if let (Props::File(old), Props::File(new)) = (&self.props, &next.props) {
            new.validate_update(old)?;
        }
        if let (Props::Graphic(old), Props::Graphic(new)) = (&self.props, &next.props) {
            new.transition_from(old)?;
        }
        crate::sheet::revision(
            self.semantics.as_ref().and_then(|s| s.layer.as_ref()),
            next.semantics.as_ref().and_then(|s| s.layer.as_ref()),
        )?;
        if let (Props::Input(old), Props::Input(next)) = (&self.props, &next.props)
            && (next.revision < old.revision
                || next.revision == old.revision
                    && normalize_text(&old.value, old.multiline).as_ref() != next.value)
        {
            return Err(Error::InputRevision {
                current: old.revision,
                incoming: next.revision,
            });
        }
        if let (Props::Select(old), Props::Select(next)) = (&self.props, &next.props)
            && (next.selection.revision < old.selection.revision
                || next.selection.revision == old.selection.revision
                    && next.selection.keys != old.selection.keys)
        {
            return Err(Error::SelectRevision {
                current: old.selection.revision,
                incoming: next.selection.revision,
            });
        }
        if let (Props::Image(old), Props::Image(next)) = (&self.props, &next.props)
            && (next.revision < old.revision
                || next.revision == old.revision
                    && normalize_text(&old.source, true).as_ref() != next.source)
        {
            return Err(Error::ImageRevision {
                current: old.revision,
                incoming: next.revision,
            });
        }
        Ok(())
    }

    /// Validate before replacing the live descriptor. An invalid patch does not
    /// partially corrupt a node even though a mutation batch is not atomic.
    pub fn patch(&mut self, patch: Patch) -> Result<(), Error> {
        *self = self.patched(patch)?;
        Ok(())
    }

    pub fn patched(&self, patch: Patch) -> Result<Self, Error> {
        let mut next = self.clone();
        next.apply_patch(patch)?;
        next.normalize_input()?;
        self.validate_input_revision(&next)?;
        next.validate()?;
        Ok(next)
    }

    /// Builder configuration is validated as a whole, so intermediate settings
    /// (e.g. purpose then multiline) do not reject an otherwise valid final node.
    pub fn patches(&mut self, patches: impl IntoIterator<Item = Patch>) -> Result<(), Error> {
        let mut next = self.clone();
        for patch in patches {
            next.apply_patch(patch)?;
        }
        next.normalize_input()?;
        self.validate_input_revision(&next)?;
        next.validate()?;
        *self = next;
        Ok(())
    }

    fn apply_patch(&mut self, patch: Patch) -> Result<(), Error> {
        match (patch, &mut self.props) {
            (Patch::Text(change), Props::Text(p)) => change.apply(&mut p.content),
            (Patch::TextKind(change), Props::Text(p)) => change.apply(&mut p.kind),
            (Patch::Selectable(change), Props::Text(p)) => change.apply_or(&mut p.selectable, true),
            (Patch::Label(change), Props::File(p)) => {
                change.apply_or(&mut p.label, "Choose file".into())
            }
            (Patch::Enabled(change), Props::RichEditor(p)) => change.apply_or(&mut p.enabled, true),
            (Patch::RichDocument { document, revision }, Props::RichEditor(p)) => {
                if !matches!(document, Change::Keep) {
                    document.apply_or(
                        &mut p.document,
                        std::rc::Rc::new(crate::RichDocument::default()),
                    );
                    p.revision = revision;
                }
            }
            (Patch::Enabled(change), Props::File(p)) => change.apply_or(&mut p.enabled, true),
            (
                Patch::File {
                    configuration,
                    revision,
                },
                Props::File(p),
            ) => {
                if !matches!(configuration, Change::Keep) {
                    match configuration {
                        Change::Set(value) => p.configuration = *value,
                        Change::Clear => p.configuration = crate::FileConfig::default(),
                        Change::Keep => {}
                    }
                    p.revision = revision;
                }
            }
            (Patch::Label(change), Props::Button(p)) => change.apply(&mut p.label),
            (Patch::Label(change), Props::Check(p)) => change.apply(&mut p.label),
            (Patch::Label(change), Props::Link(p)) => change.apply(&mut p.label),
            (Patch::Enabled(change), Props::Button(p)) => change.apply_or(&mut p.enabled, true),
            (Patch::Enabled(change), Props::Check(p)) => change.apply_or(&mut p.enabled, true),
            (Patch::Enabled(change), Props::Input(p)) => change.apply_or(&mut p.enabled, true),
            (Patch::Value { value, revision }, Props::Input(p)) => {
                if !matches!(value, Change::Keep) {
                    value.apply(&mut p.value);
                    p.revision = revision;
                }
            }
            (Patch::Enabled(change), Props::Select(p)) => change.apply_or(&mut p.enabled, true),
            (Patch::SelectSelection { keys, revision }, Props::Select(p)) => {
                if !matches!(keys, Change::Keep) {
                    keys.apply(&mut p.selection.keys);
                    p.selection.revision = revision;
                }
            }
            (Patch::Purpose(change), Props::Input(p)) => change.apply(&mut p.purpose),
            (Patch::Multiline(change), Props::Input(p)) => change.apply(&mut p.multiline),
            (Patch::Checked(change), Props::Check(p)) => change.apply(&mut p.checked),
            (Patch::CheckMode(change), Props::Check(p)) => change.apply(&mut p.mode),
            (Patch::Source { source, revision }, Props::Image(p)) => {
                if !matches!(source, Change::Keep) {
                    source.apply(&mut p.source);
                    p.revision = revision;
                }
            }
            (Patch::Alternative(change), Props::Image(p)) => change.apply(&mut p.alternative),
            (Patch::Graphic(change), Props::Graphic(p)) => match change {
                Change::Keep => {}
                Change::Clear => *p = crate::GraphicProps::default(),
                Change::Set(value) => *p = *value,
            },
            (Patch::Target(change), Props::Link(p)) => change.apply(&mut p.target),
            (Patch::Classes(change), _) => change.apply(&mut self.classes),
            (Patch::Style(change), _) => match change {
                Change::Keep => {}
                Change::Clear => self.style = Style::default(),
                Change::Set(style) => self.style = *style,
            },
            (Patch::Role(change), _) => change.apply(&mut self.role),
            (Patch::Name(change), _) => change.apply(&mut self.name),
            (Patch::Focus(change), _) => change.apply(&mut self.focus),
            (Patch::Item(change), _) => change.apply(&mut self.item),
            (Patch::Semantics(change), _) => change.apply(&mut self.semantics),
            _ => {
                return Err(Error::InvalidProps(
                    "property does not belong to this widget",
                ));
            }
        }
        Ok(())
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum Patch {
    Text(Change<String>),
    TextKind(Change<TextKind>),
    Selectable(Change<bool>),
    Label(Change<String>),
    Enabled(Change<bool>),
    Value {
        value: Change<String>,
        revision: u64,
    },
    RichDocument {
        document: Change<std::rc::Rc<crate::RichDocument>>,
        revision: u64,
    },
    SelectSelection {
        keys: Change<Vec<crate::SemanticId>>,
        revision: u64,
    },
    Purpose(Change<Purpose>),
    Multiline(Change<bool>),
    /// An explicit Set/Clear also synchronizes the host control property when
    /// the semantic value is equal (for example a rejected native toggle).
    Checked(Change<bool>),
    CheckMode(Change<CheckMode>),
    Source {
        source: Change<String>,
        revision: u64,
    },
    Alternative(Change<Option<String>>),
    Graphic(Change<Box<crate::GraphicProps>>),
    File {
        configuration: Change<Box<crate::FileConfig>>,
        revision: u64,
    },
    Target(Change<String>),
    Classes(Change<Vec<String>>),
    Style(Change<Box<Style>>),
    Role(Change<Option<Role>>),
    Name(Change<Option<String>>),
    Focus(Change<FocusMode>),
    Item(Change<Option<ItemPosition>>),
    Semantics(Change<Option<Box<crate::Semantics>>>),
}