html-validate 8.10.0 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,9 +93,15 @@
93
93
  "implicitRole": {
94
94
  "title": "Implicit ARIA role for this element",
95
95
  "description": "Some elements have implicit ARIA roles.",
96
+ "deprecated": true,
96
97
  "function": true
97
98
  },
98
99
 
100
+ "aria": {
101
+ "title": "WAI-ARIA properties for this element",
102
+ "$ref": "#/definitions/Aria"
103
+ },
104
+
99
105
  "scriptSupporting": {
100
106
  "title": "Mark element as script-supporting",
101
107
  "description": "Script-supporting elements are elements which can be inserted where othersise not permitted to assist in templating",
@@ -184,6 +190,22 @@
184
190
  },
185
191
 
186
192
  "definitions": {
193
+ "Aria": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "implicitRole": {
198
+ "title": "Implicit ARIA role for this element",
199
+ "description": "Some elements have implicit ARIA roles.",
200
+ "anyOf": [{ "type": "string" }, { "function": true }]
201
+ },
202
+ "naming": {
203
+ "title": "Prohibit or allow this element to be named by aria-label or aria-labelledby",
204
+ "anyOf": [{ "type": "string", "enum": ["prohibited", "allowed"] }, { "function": true }]
205
+ }
206
+ }
207
+ },
208
+
187
209
  "contentCategory": {
188
210
  "anyOf": [{ "type": "boolean" }, { "$ref": "#/definitions/expression" }]
189
211
  },
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.40.4"
8
+ "packageVersion": "7.40.6"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,6 +1,22 @@
1
1
  import { ErrorObject } from 'ajv';
2
2
  import { SchemaObject } from 'ajv';
3
3
 
4
+ /**
5
+ * Returns the normalized metadata property `aria.naming`.
6
+ *
7
+ * - Returns `allowed` if this element allows naming.
8
+ * - Returns `prohibited` if this element does not allow naming.
9
+ * - If the element doesn't have metadata `allowed` is returned.
10
+ *
11
+ * If the element contains an explicit `role` the role is used to determine
12
+ * whenever the element allows naming or not. Otherwise it uses metadata to
13
+ * determine.
14
+ *
15
+ * @public
16
+ * @param element - Element to get `aria.naming` from.
17
+ */
18
+ export declare function ariaNaming(element: HtmlElement): "allowed" | "prohibited";
19
+
4
20
  /**
5
21
  * DOM Attribute.
6
22
  *
@@ -1346,6 +1362,35 @@ export declare interface Message {
1346
1362
  context?: any;
1347
1363
  }
1348
1364
 
1365
+ /**
1366
+ * Element ARIA metadata.
1367
+ *
1368
+ * @public
1369
+ * @since 8.11.0
1370
+ */
1371
+ export declare interface MetaAria {
1372
+ /**
1373
+ * Implicit ARIA role.
1374
+ *
1375
+ * Can be set either to a string (element unconditionally has given role) or a
1376
+ * callback (role depends on the context the element is used in).
1377
+ *
1378
+ * @since 8.11.0
1379
+ */
1380
+ implicitRole?: string | MetaImplicitRoleCallback;
1381
+ /**
1382
+ * If set to `"prohibited"` this element may not specify an accessible name
1383
+ * with `aria-label` or `aria-labelledby`. Defaults to `"allowed"` if unset.
1384
+ *
1385
+ * Note: if the element overrides the `role` (i.e. the `role` attribute is set to
1386
+ * something other than the implicit role) naming may or may not be allowed
1387
+ * depending on the given role instead.
1388
+ *
1389
+ * @since 8.11.0
1390
+ */
1391
+ naming?: "allowed" | "prohibited" | ((node: HtmlElementLike) => "allowed" | "prohibited");
1392
+ }
1393
+
1349
1394
  /**
1350
1395
  * @public
1351
1396
  */
@@ -1428,7 +1473,10 @@ export declare interface MetaData {
1428
1473
  /** Mark element as a form-associated element */
1429
1474
  formAssociated?: Partial<FormAssociated>;
1430
1475
  labelable?: boolean | PropertyExpression;
1476
+ /** @deprecated use {@link MetaAria.implicitRole} instead */
1431
1477
  implicitRole?: MetaImplicitRoleCallback;
1478
+ /** WAI-ARIA attributes */
1479
+ aria?: MetaAria;
1432
1480
  deprecatedAttributes?: string[];
1433
1481
  requiredAttributes?: string[];
1434
1482
  attributes?: PermittedAttribute;
@@ -1480,7 +1528,10 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1480
1528
  tagName: string;
1481
1529
  focusable: boolean | MetaFocusableCallback;
1482
1530
  formAssociated?: FormAssociated;
1531
+ /** @deprecated Use {@link MetaAria.implicitRole} instead */
1483
1532
  implicitRole: MetaImplicitRoleCallback;
1533
+ /** WAI-ARIA attributes */
1534
+ aria: NormalizedMetaAria;
1484
1535
  attributes: Record<string, MetaAttribute>;
1485
1536
  textContent?: TextContent;
1486
1537
  }
@@ -1497,7 +1548,7 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1497
1548
  export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1498
1549
 
1499
1550
  /**
1500
- * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1551
+ * Callback for the `implicitRole` property of `MetaAria`. It takes a node and
1501
1552
  * returns the implicit ARIA role, if any.
1502
1553
  *
1503
1554
  * @public
@@ -1602,6 +1653,32 @@ export declare enum NodeType {
1602
1653
  DOCUMENT_NODE = 9
1603
1654
  }
1604
1655
 
1656
+ /**
1657
+ * Element ARIA metadata.
1658
+ *
1659
+ * @public
1660
+ * @since 8.11.0
1661
+ */
1662
+ export declare interface NormalizedMetaAria {
1663
+ /**
1664
+ *
1665
+ * Normalized version of {@link MetaAria.implicitRole}. Always a callback
1666
+ * returning the role.
1667
+ *
1668
+ * @since 8.11.0
1669
+ * @returns string with role or null if no corresponding role.
1670
+ */
1671
+ implicitRole(node: HtmlElementLike): string | null;
1672
+ /**
1673
+ *
1674
+ * Normalized version of {@link MetaAria.naming}. Always a callback
1675
+ * returning `"allowed"` or `"prohibited"`.
1676
+ *
1677
+ * @since 8.11.0
1678
+ */
1679
+ naming(node: HtmlElementLike): "allowed" | "prohibited";
1680
+ }
1681
+
1605
1682
  /* Excluded from this release type: ParseBeginEvent */
1606
1683
 
1607
1684
  /* Excluded from this release type: ParseEndEvent */
@@ -1,6 +1,22 @@
1
1
  import { ErrorObject } from 'ajv';
2
2
  import { SchemaObject } from 'ajv';
3
3
 
4
+ /**
5
+ * Returns the normalized metadata property `aria.naming`.
6
+ *
7
+ * - Returns `allowed` if this element allows naming.
8
+ * - Returns `prohibited` if this element does not allow naming.
9
+ * - If the element doesn't have metadata `allowed` is returned.
10
+ *
11
+ * If the element contains an explicit `role` the role is used to determine
12
+ * whenever the element allows naming or not. Otherwise it uses metadata to
13
+ * determine.
14
+ *
15
+ * @public
16
+ * @param element - Element to get `aria.naming` from.
17
+ */
18
+ export declare function ariaNaming(element: HtmlElement): "allowed" | "prohibited";
19
+
4
20
  /**
5
21
  * DOM Attribute.
6
22
  *
@@ -1571,6 +1587,35 @@ export declare interface Message {
1571
1587
  context?: any;
1572
1588
  }
1573
1589
 
1590
+ /**
1591
+ * Element ARIA metadata.
1592
+ *
1593
+ * @public
1594
+ * @since 8.11.0
1595
+ */
1596
+ export declare interface MetaAria {
1597
+ /**
1598
+ * Implicit ARIA role.
1599
+ *
1600
+ * Can be set either to a string (element unconditionally has given role) or a
1601
+ * callback (role depends on the context the element is used in).
1602
+ *
1603
+ * @since 8.11.0
1604
+ */
1605
+ implicitRole?: string | MetaImplicitRoleCallback;
1606
+ /**
1607
+ * If set to `"prohibited"` this element may not specify an accessible name
1608
+ * with `aria-label` or `aria-labelledby`. Defaults to `"allowed"` if unset.
1609
+ *
1610
+ * Note: if the element overrides the `role` (i.e. the `role` attribute is set to
1611
+ * something other than the implicit role) naming may or may not be allowed
1612
+ * depending on the given role instead.
1613
+ *
1614
+ * @since 8.11.0
1615
+ */
1616
+ naming?: "allowed" | "prohibited" | ((node: HtmlElementLike) => "allowed" | "prohibited");
1617
+ }
1618
+
1574
1619
  /**
1575
1620
  * @public
1576
1621
  */
@@ -1653,7 +1698,10 @@ export declare interface MetaData {
1653
1698
  /** Mark element as a form-associated element */
1654
1699
  formAssociated?: Partial<FormAssociated>;
1655
1700
  labelable?: boolean | PropertyExpression;
1701
+ /** @deprecated use {@link MetaAria.implicitRole} instead */
1656
1702
  implicitRole?: MetaImplicitRoleCallback;
1703
+ /** WAI-ARIA attributes */
1704
+ aria?: MetaAria;
1657
1705
  deprecatedAttributes?: string[];
1658
1706
  requiredAttributes?: string[];
1659
1707
  attributes?: PermittedAttribute;
@@ -1705,7 +1753,10 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1705
1753
  tagName: string;
1706
1754
  focusable: boolean | MetaFocusableCallback;
1707
1755
  formAssociated?: FormAssociated;
1756
+ /** @deprecated Use {@link MetaAria.implicitRole} instead */
1708
1757
  implicitRole: MetaImplicitRoleCallback;
1758
+ /** WAI-ARIA attributes */
1759
+ aria: NormalizedMetaAria;
1709
1760
  attributes: Record<string, MetaAttribute>;
1710
1761
  textContent?: TextContent;
1711
1762
  }
@@ -1722,7 +1773,7 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1722
1773
  export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1723
1774
 
1724
1775
  /**
1725
- * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1776
+ * Callback for the `implicitRole` property of `MetaAria`. It takes a node and
1726
1777
  * returns the implicit ARIA role, if any.
1727
1778
  *
1728
1779
  * @public
@@ -1852,6 +1903,32 @@ export declare enum NodeType {
1852
1903
  DOCUMENT_NODE = 9
1853
1904
  }
1854
1905
 
1906
+ /**
1907
+ * Element ARIA metadata.
1908
+ *
1909
+ * @public
1910
+ * @since 8.11.0
1911
+ */
1912
+ export declare interface NormalizedMetaAria {
1913
+ /**
1914
+ *
1915
+ * Normalized version of {@link MetaAria.implicitRole}. Always a callback
1916
+ * returning the role.
1917
+ *
1918
+ * @since 8.11.0
1919
+ * @returns string with role or null if no corresponding role.
1920
+ */
1921
+ implicitRole(node: HtmlElementLike): string | null;
1922
+ /**
1923
+ *
1924
+ * Normalized version of {@link MetaAria.naming}. Always a callback
1925
+ * returning `"allowed"` or `"prohibited"`.
1926
+ *
1927
+ * @since 8.11.0
1928
+ */
1929
+ naming(node: HtmlElementLike): "allowed" | "prohibited";
1930
+ }
1931
+
1855
1932
  /* Excluded from this release type: ParseBeginEvent */
1856
1933
 
1857
1934
  /* Excluded from this release type: ParseEndEvent */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "8.10.0",
3
+ "version": "8.11.0",
4
4
  "description": "Offline html5 validator",
5
5
  "keywords": [
6
6
  "html",
@@ -168,6 +168,7 @@
168
168
  "!src/vitest/vitest.ts",
169
169
  "!src/utils/compatibility-check.browser.ts",
170
170
  "!src/utils/compatibility-check.nodejs.ts",
171
+ "!**/*.d.ts",
171
172
  "!**/__fixtures__/**"
172
173
  ],
173
174
  "moduleNameMapper": {
@@ -205,10 +206,10 @@
205
206
  "@html-validate/eslint-config-jest": "5.13.2",
206
207
  "@html-validate/eslint-config-typescript": "5.13.1",
207
208
  "@html-validate/eslint-config-typescript-typeinfo": "5.13.1",
208
- "@html-validate/jest-config": "3.8.0",
209
+ "@html-validate/jest-config": "3.9.0",
209
210
  "@html-validate/prettier-config": "2.4.12",
210
211
  "@html-validate/release-scripts": "6.2.0",
211
- "@microsoft/api-extractor": "7.40.4",
212
+ "@microsoft/api-extractor": "7.40.6",
212
213
  "@rollup/plugin-commonjs": "25.0.7",
213
214
  "@rollup/plugin-json": "6.1.0",
214
215
  "@rollup/plugin-node-resolve": "15.2.3",
@@ -218,9 +219,9 @@
218
219
  "@types/babel__code-frame": "7.0.6",
219
220
  "@types/jest": "29.5.12",
220
221
  "@types/minimist": "1.2.5",
221
- "@types/node": "16.18.82",
222
+ "@types/node": "16.18.83",
222
223
  "@types/prompts": "2.4.9",
223
- "@types/semver": "7.5.7",
224
+ "@types/semver": "7.5.8",
224
225
  "@types/stream-buffers": "3.0.7",
225
226
  "babar": "0.2.3",
226
227
  "husky": "9.0.11",
@@ -229,8 +230,9 @@
229
230
  "jest-diff": "29.7.0",
230
231
  "jest-environment-jsdom": "29.7.0",
231
232
  "jest-snapshot": "29.7.0",
233
+ "jsdom": "20.0.3",
232
234
  "marked": "12.0.0",
233
- "memfs": "4.7.6",
235
+ "memfs": "4.7.7",
234
236
  "npm-pkg-lint": "2.1.0",
235
237
  "npm-run-all2": "6.1.2",
236
238
  "rollup": "4.12.0",