@markuplint/ml-spec 3.0.0-alpha.82 → 3.0.0-dev.24

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.
Files changed (91) hide show
  1. package/README.md +8 -3
  2. package/lib/dom-traverse/get-computed-aria-props.d.ts +12 -0
  3. package/lib/dom-traverse/get-computed-aria-props.js +106 -0
  4. package/lib/dom-traverse/get-computed-role.js +13 -25
  5. package/lib/dom-traverse/get-content-model.d.ts +3 -0
  6. package/lib/dom-traverse/get-content-model.js +28 -0
  7. package/lib/dom-traverse/get-explicit-role.js +1 -1
  8. package/lib/dom-traverse/get-spec.d.ts +2 -2
  9. package/lib/dom-traverse/get-spec.js +2 -2
  10. package/lib/dom-traverse/has-required-owned-elements.js +12 -0
  11. package/lib/dom-traverse/is-exposed.d.ts +11 -0
  12. package/lib/dom-traverse/is-exposed.js +181 -0
  13. package/lib/dom-traverse/may-be-focusable.d.ts +2 -0
  14. package/lib/dom-traverse/may-be-focusable.js +22 -0
  15. package/lib/index.d.ts +8 -1
  16. package/lib/index.js +8 -1
  17. package/lib/specs/content-model-category-to-tag-names.d.ts +2 -2
  18. package/lib/specs/content-model-category-to-tag-names.js +2 -2
  19. package/lib/specs/get-aria.js +3 -3
  20. package/lib/specs/get-attr-specs.d.ts +1 -1
  21. package/lib/specs/get-selectors-by-content-model-category.d.ts +1 -1
  22. package/lib/specs/get-spec-by-tag-name.d.ts +2 -2
  23. package/lib/specs/get-spec-by-tag-name.js +1 -1
  24. package/lib/specs/is-nothing-content-model.d.ts +5 -0
  25. package/lib/specs/is-nothing-content-model.js +12 -0
  26. package/lib/specs/is-palpable-elements.d.ts +5 -0
  27. package/lib/specs/is-palpable-elements.js +47 -0
  28. package/lib/specs/is-void-element.d.ts +1 -0
  29. package/lib/specs/is-void-element.js +25 -0
  30. package/lib/specs/schema-to-spec.d.ts +1 -1
  31. package/lib/specs/schema-to-spec.js +1 -1
  32. package/lib/types/aria.d.ts +10 -4
  33. package/lib/types/attributes.d.ts +94 -39
  34. package/lib/types/index.d.ts +27 -27
  35. package/lib/types/permitted-structres.d.ts +22 -28
  36. package/lib/types/permitted-structures.d.ts +54 -0
  37. package/lib/types/permitted-structures.js +8 -0
  38. package/lib/utils/get-ns.d.ts +2 -1
  39. package/lib/utils/get-ns.js +3 -0
  40. package/lib/utils/merge-array.d.ts +1 -1
  41. package/lib/utils/resolve-namespace.d.ts +4 -4
  42. package/lib/utils/resolve-namespace.js +18 -13
  43. package/package.json +7 -7
  44. package/schema.json +6 -6
  45. package/schemas/aria.schema.json +1 -1
  46. package/schemas/content-models.schema.json +33 -49
  47. package/src/dom-traverse/accname-computation.spec.ts +6 -6
  48. package/src/dom-traverse/get-computed-aria-props.spec.ts +368 -0
  49. package/src/dom-traverse/get-computed-aria-props.ts +130 -0
  50. package/src/dom-traverse/get-computed-role.spec.ts +1 -1
  51. package/src/dom-traverse/get-computed-role.ts +13 -25
  52. package/src/dom-traverse/get-content-model.ts +32 -0
  53. package/src/dom-traverse/get-explicit-role.ts +1 -1
  54. package/src/dom-traverse/get-spec.ts +3 -3
  55. package/src/dom-traverse/has-required-owned-elements.ts +13 -0
  56. package/src/dom-traverse/is-exposed.spec.ts +50 -0
  57. package/src/dom-traverse/is-exposed.ts +196 -0
  58. package/src/dom-traverse/may-be-focusable.ts +21 -0
  59. package/src/index.ts +8 -1
  60. package/src/specs/content-model-category-to-tag-names.ts +3 -3
  61. package/src/specs/get-aria.ts +3 -3
  62. package/src/specs/get-selectors-by-content-model-category.ts +1 -1
  63. package/src/specs/get-spec-by-tag-name.spec.ts +10 -10
  64. package/src/specs/get-spec-by-tag-name.ts +9 -5
  65. package/src/specs/is-nothing-content-model.ts +9 -0
  66. package/src/specs/is-palpable-elements.ts +55 -0
  67. package/src/specs/is-void-element.ts +22 -0
  68. package/src/specs/schema-to-spec.ts +1 -1
  69. package/src/types/aria.ts +7 -1
  70. package/src/types/attributes.ts +227 -121
  71. package/src/types/index.ts +8 -8
  72. package/src/types/permitted-structres.ts +24 -32
  73. package/src/types/permitted-structures.ts +96 -0
  74. package/src/utils/get-ns.ts +6 -1
  75. package/src/utils/resolve-namespace.spec.ts +37 -0
  76. package/src/utils/resolve-namespace.ts +22 -18
  77. package/tsconfig.tsbuildinfo +1 -1
  78. package/lib/dom-traverse/focusability-computation.d.ts +0 -1
  79. package/lib/dom-traverse/focusability-computation.js +0 -8
  80. package/lib/dom-traverse/get-aria.d.ts +0 -9
  81. package/lib/dom-traverse/get-aria.js +0 -54
  82. package/lib/specs/aria-spec.d.ts +0 -5
  83. package/lib/specs/aria-spec.js +0 -12
  84. package/lib/specs/get-spec.d.ts +0 -13
  85. package/lib/specs/get-spec.js +0 -85
  86. package/lib/specs/html-spec.d.ts +0 -6
  87. package/lib/specs/html-spec.js +0 -16
  88. package/lib/specs/resolve-namespace.d.ts +0 -9
  89. package/lib/specs/resolve-namespace.js +0 -26
  90. package/lib/utils.d.ts +0 -8
  91. package/lib/utils.js +0 -50
package/lib/utils.d.ts DELETED
@@ -1,8 +0,0 @@
1
- declare type NamedDefinition =
2
- | string
3
- | {
4
- name: string;
5
- };
6
- export declare function getNS(namespaceURI: string | null): 'svg' | 'mml' | 'html';
7
- export declare function mergeArray<T extends NamedDefinition>(a: T[], b: T[] | null | undefined): T[];
8
- export {};
package/lib/utils.js DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeArray = exports.getNS = void 0;
4
- function getNS(namespaceURI) {
5
- switch (namespaceURI) {
6
- case 'http://www.w3.org/2000/svg': {
7
- return 'svg';
8
- }
9
- case 'http://www.w3.org/1998/Math/MathML': {
10
- return 'mml';
11
- }
12
- default: {
13
- return 'html';
14
- }
15
- }
16
- }
17
- exports.getNS = getNS;
18
- function mergeArray(a, b) {
19
- if (!b) {
20
- return a;
21
- }
22
- const result = a.slice();
23
- for (const bItem of b) {
24
- const bName = getName(bItem);
25
- const aIndex = result.findIndex(item => getName(item) === bName);
26
- if (aIndex === -1) {
27
- result.push(bItem);
28
- continue;
29
- }
30
- const aItem = result.splice(aIndex, 1)[0];
31
- if (typeof bItem === 'string') {
32
- continue;
33
- }
34
- if (typeof aItem === 'string') {
35
- result.push(bItem);
36
- continue;
37
- }
38
- const exItem = {
39
- ...aItem,
40
- ...bItem,
41
- };
42
- result.push(exItem);
43
- }
44
- return result;
45
- }
46
- exports.mergeArray = mergeArray;
47
- function getName(def) {
48
- const result = typeof def === 'string' ? def : def.name;
49
- return result.toLowerCase().trim();
50
- }