Skip to content

Commit

Permalink
Remove AriaRoleRelationConceptAttributeValue
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman committed Sep 22, 2024
1 parent 4a53aba commit bd7d102
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 88 deletions.
114 changes: 33 additions & 81 deletions packages/aria-query/src/etc/roles/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::types::{
AriaAbstractRole, AriaNameFromSource, AriaProperty, AriaRole, AriaRoleDefinition,
AriaRoleDefinitionKey, AriaRoleDefinitionSuperClass, AriaRoleRelation, AriaRoleRelationConcept,
AriaRoleRelationConceptAttribute, AriaRoleRelationConceptAttributeConstraint,
AriaRoleRelationConceptAttributeValue, AriaRoleRelationConceptConstraint,
AriaRoleRelationConceptConstraint,
};

pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleDefinition>> =
Expand Down Expand Up @@ -227,9 +227,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"button".into(),
)),
value: Some("button".into()),
constraints: None,
}]),
name: "input".into(),
Expand All @@ -241,9 +239,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"image".into(),
)),
value: Some("image".into()),
constraints: None,
}]),
name: "input".into(),
Expand All @@ -255,9 +251,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"reset".into(),
)),
value: Some("reset".into()),
constraints: None,
}]),
name: "input".into(),
Expand All @@ -269,9 +263,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"submit".into(),
)),
value: Some("submit".into()),
constraints: None,
}]),
name: "input".into(),
Expand Down Expand Up @@ -394,9 +386,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"checkbox".into(),
)),
value: Some("checkbox".into()),
constraints: None,
}]),
name: "input".into(),
Expand Down Expand Up @@ -476,9 +466,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "scope".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"col".into(),
)),
value: Some("col".into()),
constraints: None,
}]),
name: "th".into(),
Expand All @@ -490,9 +478,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "scope".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"colgroup".into(),
)),
value: Some("colgroup".into()),
constraints: None,
}]),
name: "th".into(),
Expand Down Expand Up @@ -566,9 +552,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"email".into(),
)),
value: Some("email".into()),
constraints: None,
},
]),
Expand All @@ -589,9 +573,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"search".into(),
)),
value: Some("search".into()),
constraints: None,
},
]),
Expand All @@ -612,9 +594,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"tel".into(),
)),
value: Some("tel".into()),
constraints: None,
},
]),
Expand All @@ -635,9 +615,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"text".into(),
)),
value: Some("text".into()),
constraints: None,
},
]),
Expand All @@ -658,9 +636,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"url".into(),
)),
value: Some("url".into()),
constraints: None,
},
]),
Expand All @@ -681,9 +657,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"url".into(),
)),
value: Some("url".into()),
constraints: None,
},
]),
Expand Down Expand Up @@ -1216,10 +1190,10 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
AriaRoleRelation {
concept: Some(AriaRoleRelationConcept {
constraints: Some(vec![
AriaRoleRelationConceptConstraint::ScopedToTheMainElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningContentElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningRootElementOtherThanBody,
]),
AriaRoleRelationConceptConstraint::ScopedToTheMainElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningContentElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningRootElementOtherThanBody,
]),
name: "footer".into(),
attributes: None,
}),
Expand All @@ -1228,10 +1202,10 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
AriaRoleRelation {
concept: Some(AriaRoleRelationConcept {
constraints: Some(vec![
AriaRoleRelationConceptConstraint::ScopedToTheMainElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningContentElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningRootElementOtherThanBody,
]),
AriaRoleRelationConceptConstraint::ScopedToTheMainElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningContentElement,
AriaRoleRelationConceptConstraint::ScopedToASectioningRootElementOtherThanBody,
]),
name: "header".into(),
attributes: None,
}),
Expand Down Expand Up @@ -2609,9 +2583,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "alt".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"".into(),
)),
value: Some("".into()),
constraints: None,
}]),
name: "img".into(),
Expand Down Expand Up @@ -2736,9 +2708,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"radio".into(),
)),
value: Some("radio".into()),
constraints: None,
}]),
name: "input".into(),
Expand Down Expand Up @@ -2882,9 +2852,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "scope".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"row".into(),
)),
value: Some("row".into()),
constraints: None,
}]),
name: "th".into(),
Expand All @@ -2896,9 +2864,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "scope".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"rowgroup".into(),
)),
value: Some("rowgroup".into()),
constraints: None,
}]),
name: "th".into(),
Expand Down Expand Up @@ -3058,9 +3024,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"search".into(),
)),
value: Some("search".into()),
constraints: None,
},
]),
Expand Down Expand Up @@ -3164,9 +3128,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"range".into(),
)),
value: Some("range".into()),
constraints: None,
}]),
name: "input".into(),
Expand Down Expand Up @@ -3213,9 +3175,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
concept: Some(AriaRoleRelationConcept {
attributes: Some(vec![AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"number".into(),
)),
value: Some("number".into()),
constraints: None,
}]),
name: "input".into(),
Expand Down Expand Up @@ -3619,9 +3579,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"email".into(),
)),
value: Some("email".into()),
constraints: None,
},
]),
Expand All @@ -3644,9 +3602,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"tel".into(),
)),
value: Some("tel".into()),
constraints: None,
},
]),
Expand All @@ -3669,9 +3625,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"text".into(),
)),
value: Some("text".into()),
constraints: None,
},
]),
Expand All @@ -3694,9 +3648,7 @@ pub static ARIA_LITERAL_ROLES: LazyLock<HashMap<AriaRoleDefinitionKey, AriaRoleD
},
AriaRoleRelationConceptAttribute {
name: "type".into(),
value: Some(AriaRoleRelationConceptAttributeValue::String(
"url".into(),
)),
value: Some("url".into()),
constraints: None,
},
]),
Expand Down
8 changes: 1 addition & 7 deletions packages/aria-query/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2021,16 +2021,10 @@ pub struct AriaRoleRelationConcept {
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct AriaRoleRelationConceptAttribute {
pub name: String,
pub value: Option<AriaRoleRelationConceptAttributeValue>,
pub value: Option<String>,
pub constraints: Option<Vec<AriaRoleRelationConceptAttributeConstraint>>,
}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum AriaRoleRelationConceptAttributeValue {
String(String),
Number(isize),
}

#[derive(Debug, PartialEq, Eq)]
pub struct UnknownConstraintError;

Expand Down

0 comments on commit bd7d102

Please sign in to comment.