From 470c5da144e30d7adc35c1625948f448050798bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Wed, 25 Dec 2024 22:57:47 +0100 Subject: [PATCH] (temp work to move) --- src/Html/Attributes.php | 9 + src/Html/README.md | 45 ++ src/Html/data/README.md | 19 + src/Html/data/aria-1.rdf | 666 ++++++++++++++++++++++++ src/Html/src/Aria/Attribute.php | 17 + src/Html/src/Aria/AttributeType.php | 11 + src/Html/src/Aria/Attributes.php | 127 +++++ src/Html/src/Aria/Conformance.php | 11 + src/Html/src/Aria/Mapping/AAM.php | 18 + src/Html/src/Aria/Role.php | 127 +++++ src/Html/src/Aria/Role/CoreMapping.php | 12 + src/Html/src/Aria/Role/RoleCategory.php | 32 ++ src/Html/src/Aria/Role/RoleMapping.php | 12 + src/Html/src/Aria/Role/Roles.php | 87 ++++ src/Html/src/Aria/Roles.php | 14 + src/Html/src/Aria/StateAttribute.php | 11 + src/Html/src/Aria/ValueType.php | 45 ++ src/Html/src/Svg/SvgAAM.php | 36 ++ src/Html/src/Svg/SvgAttributes.php | 7 + 19 files changed, 1306 insertions(+) create mode 100644 src/Html/Attributes.php create mode 100644 src/Html/README.md create mode 100644 src/Html/data/README.md create mode 100644 src/Html/data/aria-1.rdf create mode 100644 src/Html/src/Aria/Attribute.php create mode 100644 src/Html/src/Aria/AttributeType.php create mode 100644 src/Html/src/Aria/Attributes.php create mode 100644 src/Html/src/Aria/Conformance.php create mode 100644 src/Html/src/Aria/Mapping/AAM.php create mode 100644 src/Html/src/Aria/Role.php create mode 100644 src/Html/src/Aria/Role/CoreMapping.php create mode 100644 src/Html/src/Aria/Role/RoleCategory.php create mode 100644 src/Html/src/Aria/Role/RoleMapping.php create mode 100644 src/Html/src/Aria/Role/Roles.php create mode 100644 src/Html/src/Aria/Roles.php create mode 100644 src/Html/src/Aria/StateAttribute.php create mode 100644 src/Html/src/Aria/ValueType.php create mode 100644 src/Html/src/Svg/SvgAAM.php create mode 100644 src/Html/src/Svg/SvgAttributes.php diff --git a/src/Html/Attributes.php b/src/Html/Attributes.php new file mode 100644 index 0000000000..b788fbf4a3 --- /dev/null +++ b/src/Html/Attributes.php @@ -0,0 +1,9 @@ + + + + + + +contents +author + + +``` diff --git a/src/Html/data/aria-1.rdf b/src/Html/data/aria-1.rdf new file mode 100644 index 0000000000..540dc6fdfd --- /dev/null +++ b/src/Html/data/aria-1.rdf @@ -0,0 +1,666 @@ + + + + + + + + +]> + + + This is similar to type but without + inheritance of limitations and properties. role:baseConcepts are designed as + a substitute for inheritance for external concepts. + + + + + A state that can be supported for this + Role + + + + A state that must be provided for this + Role + + + + + Context where this role is + allowed + + + + A child that must be contained by this + role + + + + How a role type name is extracted and referenced + inside a document. Values are "author": name comes from values + provided by the author in explict markup features; and "subtree": + name comes from the text value of the element node. + + + + The children are presenational. Assistive + technologies may choose to hid the children from the user. + + + + + + + author + + + + + + author + + + + + + author + + + + + + + author + + + + author + + + + + + + + contents + author + + + + + + + + + + contents + author + + + + + + + contents + author + + + + + + + + + contents + author + + + + + + + + + + + + + + + + author + + + + + author + + + + author + + + + + author + + + + author + + + + + + author + + + + author + + + + + author + + + + + + author + + + + + author + + + + + author + + + + + author + + + + + + + + + + + + author + + + + + + + + + + contents + author + + + + + + author + + + + + + contents + author + + + + + + author + + + + + author + + + + author + + + + + + + contents + author + + + + + + + + + author + + + + + + + + + + author + + + + + + + + + + + author + + + + author + + + + author + + + + author + + + + author + + + + + + + + + + + + author + + + + + + + + + author + + + + + + + + + + + contents + author + + + + + + + contents + author + + + + + + + + contents + author + + + + + author + + + + + author + + + + + + + + + + contents + author + + + + author (if role discarded by error conditions) + + + + author + + + + + + + + contents + author + + + + + + + author + + + + + + + + author + + + + + + author + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + n/a + + + + + + + + + + + + + + + + + + contents + author + + + + + + + + + + + contents + author + + + + + + + + + contents + author + + + + + + + + + author + + + + author + + + + + author + + + + + + + + n/a + + + + + contents + author + + + + + + author + + + + + + + + + + + author + + + + + + + + + + author + + + + + + + + + + + author + + + + author + + + + n/a + + + + + contents + author + + + + + + + + + contents + author + + + + + + + + + + author + + + + + + + + + author + + + + author + + + + + author + + + + + + + + + + + + + author + + + + author + + + + + author + + + + contents + author + + + + + + + + + author + + + + + + + + author + + + + + + + contents + author + + + + n/a + + + + + + author + + diff --git a/src/Html/src/Aria/Attribute.php b/src/Html/src/Aria/Attribute.php new file mode 100644 index 0000000000..5048798b14 --- /dev/null +++ b/src/Html/src/Aria/Attribute.php @@ -0,0 +1,17 @@ + [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span', 'button', 'input', 'select', 'textarea'], + ], + 'checked' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input'], + ], + 'current' => [ + 'default' => 'page', // Possible values: 'page', 'step', 'location', 'date', 'time', 'true' + 'type' => 'token list', + 'elements' => ['a', 'button', 'div', 'span', 'li', 'menuitem', 'option'], + ], + 'disabled' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button', 'input', 'select', 'textarea', 'a', 'div', 'span'], + ], + 'expanded' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button', 'div', 'span', 'li', 'menuitem', 'option', 'a'], + ], + 'grabbed' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span'], + ], + 'modal' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span'], + ], + 'multiline' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'textarea'], + ], + 'multiselectable' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['listbox', 'grid', 'treegrid'], + ], + 'pressed' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button'], + ], + 'readonly' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'textarea'], + ], + 'required' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'select', 'textarea'], + ], + 'selected' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['option', 'li', 'menuitem'], + ], + ]; + + private const array PROPERTIES = [ + 'activedescendant', + 'atomic', + 'autocomplete', + 'colcount', + 'colindex', + 'colspan', + 'controls', + 'describedby', + 'details', + 'dropeffect', + 'errormessage', + 'flowto', + 'haspopup', + 'hidden', + 'invalid', + 'keyshortcuts', + 'label', + 'labelledby', + 'level', + 'live', + 'orientation', + 'owns', + 'placeholder', + 'posinset', + 'roledescription', + 'rowcount', + 'rowindex', + 'rowspan', + 'setsize', + 'sort', + 'valuemax', + 'valuemin', + 'valuenow', + 'valuetext', + ]; +} diff --git a/src/Html/src/Aria/Conformance.php b/src/Html/src/Aria/Conformance.php new file mode 100644 index 0000000000..032e5c74d2 --- /dev/null +++ b/src/Html/src/Aria/Conformance.php @@ -0,0 +1,11 @@ + [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span', 'button', 'input', 'select', 'textarea'], + ], + 'checked' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input'], + ], + 'current' => [ + 'default' => 'page', // Possible values: 'page', 'step', 'location', 'date', 'time', 'true' + 'type' => 'token list', + 'elements' => ['a', 'button', 'div', 'span', 'li', 'menuitem', 'option'], + ], + 'disabled' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button', 'input', 'select', 'textarea', 'a', 'div', 'span'], + ], + 'expanded' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button', 'div', 'span', 'li', 'menuitem', 'option', 'a'], + ], + 'grabbed' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span'], + ], + 'modal' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['div', 'span'], + ], + 'multiline' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'textarea'], + ], + 'multiselectable' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['listbox', 'grid', 'treegrid'], + ], + 'pressed' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['button'], + ], + 'readonly' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'textarea'], + ], + 'required' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['input', 'select', 'textarea'], + ], + 'selected' => [ + 'default' => false, + 'type' => 'boolean', + 'elements' => ['option', 'li', 'menuitem'], + ], + ]; + + private const array PROPERTIES = [ + 'activedescendant', + 'atomic', + 'autocomplete', + 'colcount', + 'colindex', + 'colspan', + 'controls', + 'describedby', + 'details', + 'dropeffect', + 'errormessage', + 'flowto', + 'haspopup', + 'hidden', + 'invalid', + 'keyshortcuts', + 'label', + 'labelledby', + 'level', + 'live', + 'orientation', + 'owns', + 'placeholder', + 'posinset', + 'roledescription', + 'rowcount', + 'rowindex', + 'rowspan', + 'setsize', + 'sort', + 'valuemax', + 'valuemin', + 'valuenow', + 'valuetext', + ]; +} diff --git a/src/Html/src/Aria/Role/CoreMapping.php b/src/Html/src/Aria/Role/CoreMapping.php new file mode 100644 index 0000000000..dc7655632a --- /dev/null +++ b/src/Html/src/Aria/Role/CoreMapping.php @@ -0,0 +1,12 @@ + HTML + // https://www.w3.org/TR/wai-aria-1.1/#typemapping + + + + + public function getDefaultValue(): mixed + { + return match ($this) { + self::TrueFalse => false, + self::TriState => 'undefined', + self::TrueFalseUndefined => 'undefined', + self::IdReference => null, + self::IdReferenceList => [], + self::Integer => 0, + self::Number => 0.0, + self::String => '', + self::Token => '', + self::TokenList => [], + }; + } +} + diff --git a/src/Html/src/Svg/SvgAAM.php b/src/Html/src/Svg/SvgAAM.php new file mode 100644 index 0000000000..a7879d02df --- /dev/null +++ b/src/Html/src/Svg/SvgAAM.php @@ -0,0 +1,36 @@ +