@markuplint/ml-spec 4.9.6 → 4.10.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +311 -8
  3. package/lib/algorithm/aria/aria-specs.d.ts +6 -0
  4. package/lib/{specs → algorithm/aria}/get-aria.d.ts +2 -2
  5. package/lib/{specs → algorithm/aria}/get-aria.js +2 -2
  6. package/lib/{dom-traverse → algorithm/aria}/get-computed-aria-props.d.ts +1 -1
  7. package/lib/{dom-traverse → algorithm/aria}/get-computed-aria-props.js +1 -1
  8. package/lib/{dom-traverse → algorithm/aria}/get-computed-role.d.ts +1 -1
  9. package/lib/{dom-traverse → algorithm/aria}/get-computed-role.js +4 -4
  10. package/lib/{dom-traverse → algorithm/aria}/get-explicit-role.d.ts +1 -1
  11. package/lib/{dom-traverse → algorithm/aria}/get-explicit-role.js +2 -2
  12. package/lib/algorithm/aria/get-implicit-role-spec.d.ts +2 -0
  13. package/lib/{dom-traverse → algorithm/aria}/get-implicit-role.d.ts +2 -2
  14. package/lib/{dom-traverse → algorithm/aria}/get-implicit-role.js +3 -3
  15. package/lib/algorithm/aria/get-non-presentational-ancestor.d.ts +5 -0
  16. package/lib/{dom-traverse → algorithm/aria}/get-non-presentational-ancestor.js +1 -1
  17. package/lib/{specs/get-permitted-roles.d.ts → algorithm/aria/get-permitted-roles-spec.d.ts} +1 -1
  18. package/lib/{specs/get-permitted-roles.js → algorithm/aria/get-permitted-roles-spec.js} +1 -1
  19. package/lib/{dom-traverse → algorithm/aria}/get-permitted-roles.d.ts +1 -1
  20. package/lib/{dom-traverse → algorithm/aria}/get-permitted-roles.js +1 -1
  21. package/lib/{specs → algorithm/aria}/get-role-spec.d.ts +1 -1
  22. package/lib/{dom-traverse → algorithm/aria}/has-required-owned-elements.d.ts +1 -1
  23. package/lib/{dom-traverse → algorithm/aria}/has-required-owned-elements.js +1 -1
  24. package/lib/{dom-traverse → algorithm/aria}/is-exposed.d.ts +1 -1
  25. package/lib/{dom-traverse → algorithm/aria}/is-exposed.js +4 -4
  26. package/lib/{dom-traverse → algorithm/aria}/matches-context-role.d.ts +1 -1
  27. package/lib/{specs → algorithm/html}/content-model-category-to-tag-names.d.ts +2 -2
  28. package/lib/algorithm/html/get-content-model.d.ts +4 -0
  29. package/lib/{dom-traverse → algorithm/html}/get-content-model.js +1 -1
  30. package/lib/algorithm/html/get-selectors-by-content-model-category.d.ts +3 -0
  31. package/lib/{specs → algorithm/html}/is-palpable-elements.d.ts +1 -1
  32. package/lib/{dom-traverse → algorithm/html}/may-be-focusable.d.ts +1 -1
  33. package/lib/{dom-traverse → algorithm/html}/may-be-focusable.js +1 -1
  34. package/lib/index.d.ts +26 -24
  35. package/lib/index.js +30 -24
  36. package/lib/types/attributes.d.ts +2 -2
  37. package/lib/types/index.d.ts +1 -1
  38. package/lib/{specs/get-attr-specs.js → utils/get-attr-specs-spec.js} +1 -1
  39. package/lib/{dom-traverse → utils}/get-attr-specs.js +1 -1
  40. package/lib/{specs → utils}/get-spec-by-tag-name.js +1 -1
  41. package/lib/{dom-traverse → utils}/get-spec.js +1 -1
  42. package/lib/{specs → utils}/schema-to-spec.js +1 -1
  43. package/lib/utils/validate-aria-version.js +1 -1
  44. package/package.json +12 -13
  45. package/lib/dom-traverse/get-content-model.d.ts +0 -4
  46. package/lib/dom-traverse/get-non-presentational-ancestor.d.ts +0 -5
  47. package/lib/specs/aria-specs.d.ts +0 -6
  48. package/lib/specs/get-implicit-role.d.ts +0 -2
  49. package/lib/specs/get-selectors-by-content-model-category.d.ts +0 -3
  50. /package/lib/{dom-traverse → algorithm/aria}/accname-computation.d.ts +0 -0
  51. /package/lib/{dom-traverse → algorithm/aria}/accname-computation.js +0 -0
  52. /package/lib/{specs → algorithm/aria}/aria-specs.js +0 -0
  53. /package/lib/{specs/get-implicit-role.js → algorithm/aria/get-implicit-role-spec.js} +0 -0
  54. /package/lib/{specs → algorithm/aria}/get-role-spec.js +0 -0
  55. /package/lib/{specs → algorithm/aria}/is-presentational.d.ts +0 -0
  56. /package/lib/{specs → algorithm/aria}/is-presentational.js +0 -0
  57. /package/lib/{dom-traverse → algorithm/aria}/matches-context-role.js +0 -0
  58. /package/lib/{specs → algorithm/html}/content-model-category-to-tag-names.js +0 -0
  59. /package/lib/{specs → algorithm/html}/get-selectors-by-content-model-category.js +0 -0
  60. /package/lib/{specs → algorithm/html}/is-nothing-content-model.d.ts +0 -0
  61. /package/lib/{specs → algorithm/html}/is-nothing-content-model.js +0 -0
  62. /package/lib/{specs → algorithm/html}/is-palpable-elements.js +0 -0
  63. /package/lib/{specs → algorithm/html}/is-void-element.d.ts +0 -0
  64. /package/lib/{specs → algorithm/html}/is-void-element.js +0 -0
  65. /package/lib/{constant → utils}/aria-version.d.ts +0 -0
  66. /package/lib/{constant → utils}/aria-version.js +0 -0
  67. /package/lib/{specs/get-attr-specs.d.ts → utils/get-attr-specs-spec.d.ts} +0 -0
  68. /package/lib/{dom-traverse → utils}/get-attr-specs.d.ts +0 -0
  69. /package/lib/{specs → utils}/get-spec-by-tag-name.d.ts +0 -0
  70. /package/lib/{dom-traverse → utils}/get-spec.d.ts +0 -0
  71. /package/lib/{specs → utils}/resolve-version.d.ts +0 -0
  72. /package/lib/{specs → utils}/resolve-version.js +0 -0
  73. /package/lib/{specs → utils}/schema-to-spec.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.10.0](https://github.com/markuplint/markuplint/compare/@markuplint/ml-spec@4.9.7...@markuplint/ml-spec@4.10.0) (2025-08-24)
7
+
8
+
9
+ ### Features
10
+
11
+ * **types:** add link type definitions for specific HTML elements ([7199a8e](https://github.com/markuplint/markuplint/commit/7199a8eb4eaf334855ba78064c4340e040d8614c))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.9.7](https://github.com/markuplint/markuplint/compare/@markuplint/ml-spec@4.9.6...@markuplint/ml-spec@4.9.7) (2025-08-13)
18
+
19
+ ### Bug Fixes
20
+
21
+ - ensure that each `clean` command correctly removes build files ([110b78e](https://github.com/markuplint/markuplint/commit/110b78e85379d29a84ca68325127344a87a570b6))
22
+
6
23
  ## [4.9.6](https://github.com/markuplint/markuplint/compare/@markuplint/ml-spec@4.9.5...@markuplint/ml-spec@4.9.6) (2025-04-13)
7
24
 
8
25
  **Note:** Version bump only for package @markuplint/ml-spec
package/README.md CHANGED
@@ -2,17 +2,320 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/%40markuplint%2Fml-spec.svg)](https://www.npmjs.com/package/@markuplint/ml-spec)
4
4
 
5
- ## Install
5
+ **Foundation package providing type definitions, W3C specification algorithms, and unified API for markup language specifications.**
6
6
 
7
- [`markuplint`](https://www.npmjs.com/package/markuplint) package includes this package.
7
+ This package serves as the foundational layer for markuplint's specification system, providing:
8
8
 
9
- <details>
10
- <summary>If you are installing purposely, how below:</summary>
9
+ - **Type definitions** for markup language specifications (HTML, ARIA, SVG)
10
+ - **W3C specification algorithms** (HTML Standard, WAI-ARIA 1.1/1.2/1.3 compliance)
11
+ - **JSON schemas** that define the structure of element specifications
12
+ - **Runtime utilities** for specification resolution, attribute validation, and content model checking
13
+ - **Unified API** for consuming specification data from various sources
11
14
 
12
- ```shell
13
- $ npm install @markuplint/ml-spec
15
+ The canonical HTML element specification data is provided by `@markuplint/html-spec`, which depends on this package for type definitions and algorithmic processing.
14
16
 
15
- $ yarn add @markuplint/ml-spec
17
+ ## Package Architecture
18
+
19
+ This package serves as the foundation layer in markuplint's specification system:
20
+
21
+ ```
22
+ @markuplint/ml-spec (Foundation Layer)
23
+ ↓ provides types, algorithms, schemas
24
+ @markuplint/html-spec (Data Layer)
25
+ ↓ provides HTML specification data
26
+ Framework-specific specs (Extension Layer)
27
+ ↓ provide framework extensions
28
+ Core packages (Application Layer)
29
+ ↓ consume specifications for validation
30
+ ```
31
+
32
+ ## Package Contents
33
+
34
+ ### Type Definitions
35
+
36
+ - **Core Types**: `ElementSpec`, `ExtendedSpec`, `MLMLSpec`, `ARIAVersion`
37
+ - **ARIA Types**: Complete WAI-ARIA 1.1/1.2/1.3 type definitions
38
+ - **Attribute Types**: HTML attribute definitions with validation rules
39
+ - **Content Model Types**: Permitted content structure definitions
40
+
41
+ Generated TypeScript types (do not edit directly):
42
+
43
+ - `src/types/attributes.ts` - Attribute specification types
44
+ - `src/types/aria.ts` - ARIA specification types
45
+ - `src/types/permitted-structures.ts` - Content model types
46
+
47
+ ### W3C Specification Algorithms
48
+
49
+ **HTML Standard Algorithms**:
50
+
51
+ - Focusable Area Algorithm (`src/algorithm/html/may-be-focusable.ts`)
52
+ - Interactive Content classification
53
+ - Content Model validation (`src/algorithm/html/get-content-model.ts`)
54
+
55
+ **WAI-ARIA Specification Algorithms**:
56
+
57
+ - **Accessible Name Computation** - W3C AccName 1.1 compliant (via `dom-accessibility-api`)
58
+ - **Role Computation** - Explicit/implicit role resolution with conflict handling (`src/algorithm/aria/get-computed-role.ts`)
59
+ - **Accessibility Tree Computation** - Element inclusion/exclusion logic (`src/algorithm/aria/is-exposed.ts`)
60
+ - **ARIA Property Computation** - Attribute value resolution with HTML equivalents (`src/algorithm/aria/get-computed-aria-props.ts`)
61
+ - **Required Context Validation** - Composite role validation (`src/algorithm/aria/has-required-owned-elements.ts`)
62
+
63
+ **Specification Integration**:
64
+
65
+ - Cross-specification utilities (`src/utils/get-spec-by-tag-name.ts`)
66
+ - Version-aware specification resolution (`src/utils/resolve-version.ts`)
67
+ - Schema-to-runtime conversion (`src/utils/schema-to-spec.ts`)
68
+
69
+ ### JSON Schemas (Structure Definitions)
70
+
71
+ - `schemas/element.schema.json` - Element specification schema
72
+ - `schemas/aria.schema.json` - ARIA specification schema
73
+ - `schemas/content-models.schema.json` - Content model schema
74
+ - `schemas/global-attributes.schema.json` (generated) - Global attribute categories
75
+ - `schemas/attributes.schema.json` (generated) - Attribute definition schema
76
+
77
+ ### Schema Generators
78
+
79
+ - `gen/gen.ts` - Builds generated schema files from data
80
+ - `gen/global-attribute.data.*` - Source data for global attribute categories
81
+
82
+ ### Runtime Utilities
83
+
84
+ - **Spec Resolution**: `getSpecByTagName`, `getAttrSpecs`, `getRoleSpec`
85
+ - **Content Model Utilities**: `getContentModel`, `isPalpableElements`, `isVoidElement`
86
+ - **ARIA Utilities**: `getAria`, `getPermittedRoles`, `hasRequiredOwnedElements`
87
+ - **Accessibility Utilities**: `accnameComputation`, `isExposed`, `mayBeFocusable`
88
+ - **Schema Utilities**: `schemaToSpec`, `resolveNamespace`, `validateAriaVersion`
89
+ - **Framework Extension**: Merges base HTML specs with framework-specific extensions
90
+
91
+ **Note**: Attribute value types are defined in `@markuplint/types`. The schemas here reference `@markuplint/types/types.schema.json`.
92
+
93
+ ## Relationship to @markuplint/html-spec
94
+
95
+ **@markuplint/html-spec** provides the canonical HTML element specification data:
96
+
97
+ - **Built output**: `index.json` (48K+ lines, consolidated specification data)
98
+ - **Sources**: `src/spec-*.json` (individual element specifications)
99
+ - **Build process**: `build.mjs` → `@markuplint/spec-generator` → enriched with MDN/W3C data
100
+
101
+ **@markuplint/ml-spec** (this package) provides:
102
+
103
+ - **Type definitions** that `@markuplint/html-spec` uses to structure its data
104
+ - **JSON schemas** that validate the specification format
105
+ - **Algorithms** that process and compute values from the specification data
106
+ - **Runtime utilities** that consume the consolidated specification data
107
+
108
+ This separation enables:
109
+
110
+ - **Data updates** (`@markuplint/html-spec`) without affecting type definitions
111
+ - **Algorithm improvements** (`@markuplint/ml-spec`) without regenerating data
112
+ - **Framework extensions** that can reuse both type definitions and base HTML data
113
+
114
+ ### Install
115
+
116
+ `markuplint` already bundles this package. If you need to install it explicitly:
117
+
118
+ ```bash
119
+ npm install @markuplint/ml-spec
120
+ # or
121
+ yarn add @markuplint/ml-spec
122
+ ```
123
+
124
+ ### Terminology
125
+
126
+ - "HTML Schema" and "Specs" are used interchangeably in markuplint to mean the JSON Schema that
127
+ describes HTML element specs (attributes, ARIA, content models, etc) and their TypeScript types.
128
+
129
+ ### Editing workflow (HTML Schema/Specs)
130
+
131
+ 1. Make changes to the schemas
132
+
133
+ - Attributes schema shape: update `gen/gen.ts` if you need to change the structure of
134
+ `AttributeJSON`/`GlobalAttributes` (because `attributes.schema.json` is generated).
135
+ - ARIA schema shape: edit `schemas/aria.schema.json`.
136
+ - Content model schema shape: edit `schemas/content-models.schema.json`.
137
+ - Element schema aggregator: edit `schemas/element.schema.json` (it composes refs to the above).
138
+ - Global attribute categories/sets: edit `gen/global-attribute.data.*`, then regenerate via the commands below.
139
+
140
+ If you want to change the concrete HTML element data (e.g., add/update element- or attribute-level
141
+ entries), update `@markuplint/html-spec` (and, if necessary, `@markuplint/spec-generator`).
142
+
143
+ 2. Regenerate schemas and types
144
+
145
+ From the repository root (recommended):
146
+
147
+ ```bash
148
+ yarn up:schema
149
+ ```
150
+
151
+ or only for this package:
152
+
153
+ ```bash
154
+ yarn workspace @markuplint/ml-spec run schema
16
155
  ```
17
156
 
18
- </details>
157
+ This will:
158
+
159
+ - Run `gen/gen.ts` to output `global-attributes.schema.json` and `attributes.schema.json`
160
+ - Convert JSON Schema to TypeScript via `json2ts` into `src/types/*.ts`
161
+ - Format with Prettier and ESLint
162
+
163
+ #### What `yarn up:schema` does
164
+
165
+ From the repository root, this executes schema maintenance across packages in order:
166
+
167
+ 1. `@markuplint/types`
168
+
169
+ - Run `gen/types.ts` to build `types.schema.json` from css-tree keywords/types and
170
+ `gen/specific-schema.json`
171
+ - Generate TypeScript types: `types.schema.json` → `src/types.schema.ts` (via `json2ts`)
172
+ - Format (`prettier`/`eslint`) and build the package
173
+
174
+ 2. `@markuplint/ml-spec` (this package)
175
+
176
+ - Run `gen/gen.ts` to output `schemas/global-attributes.schema.json` and `schemas/attributes.schema.json`
177
+ - Generate TypeScript types from schemas:
178
+ - `schemas/content-models.schema.json` → `src/types/permitted-structures.ts`
179
+ - `schemas/attributes.schema.json` → `src/types/attributes.ts`
180
+ - `schemas/aria.schema.json` → `src/types/aria.ts`
181
+ - Format (`prettier`/`eslint`)
182
+
183
+ Dependency note: `schemas/attributes.schema.json` references
184
+ `@markuplint/types/types.schema.json#/definitions/type`. Updating types first ensures references stay
185
+ consistent; `yarn up:schema` takes care of this order.
186
+
187
+ 3. Build (optional) and sanity-check
188
+
189
+ ```bash
190
+ yarn build
191
+ ```
192
+
193
+ ### Do not edit generated files
194
+
195
+ - Do not modify files under `src/types/*.ts` or `schemas/attributes.schema.json` directly.
196
+ Change the source schema or generator instead and re-run the generation scripts.
197
+
198
+ ### How schema merging works (Specs extension)
199
+
200
+ At runtime, markuplint can merge multiple specs. The merger in
201
+ `src/utils/schema-to-spec.ts` follows these rules:
202
+
203
+ - `def.#globalAttrs.#extends` from an extended spec augments the base `#HTMLGlobalAttrs` map.
204
+ - For a given element, if both base and extended specs define the same attribute, the extended spec
205
+ wins on conflicting fields (shallow override per attribute). Arrays like `categories` are merged.
206
+
207
+ This enables framework-specific specs (Vue/React/Svelte, etc.) to extend the HTML spec safely.
208
+
209
+ ### Relationship to @markuplint/types
210
+
211
+ - Attribute value types (CSS keywords, extended types such as `URL`, `JSON`, etc.) are defined in
212
+ `@markuplint/types` and exposed via `types.schema.json`.
213
+ - If you need a new attribute value type, modify `@markuplint/types` (e.g.
214
+ `packages/@markuplint/types/gen/specific-schema.json`) and regenerate that package first. Then
215
+ regenerate this package so references stay consistent.
216
+
217
+ ### Versioning policy
218
+
219
+ - HTML Schema/Specs are not part of the public API surface of markuplint. Changes here are treated
220
+ as a minor release. Publishing is handled by Lerna during the normal release process.
221
+
222
+ ### Common tasks (quick recipes)
223
+
224
+ - Add a new global attribute category or items
225
+ - Edit `gen/global-attribute.data.*`
226
+ - Run the generation script (see above)
227
+
228
+ - Add a new optional field to `AttributeJSON`
229
+ - Update the shape in `gen/gen.ts` under `AttributeJSON`
230
+ - Regenerate and ensure the new field appears in `schemas/attributes.schema.json` and in
231
+ `src/types/attributes.ts`
232
+
233
+ - Adjust ARIA fields (e.g., `permittedRoles` variants)
234
+ - Edit `schemas/aria.schema.json`
235
+ - Regenerate types via the schema scripts
236
+
237
+ ### Content model quick reference
238
+
239
+ Content models describe allowed children for each element. See the JSON Schema
240
+ `schemas/content-models.schema.json` and the generated TS types `src/types/permitted-structures.ts`.
241
+ Also refer to the website docs: [Rule: permitted-contents](https://markuplint.dev/rules/permitted-contents).
242
+
243
+ - Basic categories (strings): `"#flow"`, `"#phrasing"`, `"#interactive"`, …
244
+ - Model item forms:
245
+ - `require` | `optional` | `oneOrMore` | `zeroOrMore`: a string, category, or nested patterns
246
+ - `choice`: 2–5 alternative pattern arrays
247
+ - `transparent`: inherits parent model filtered by selector string
248
+
249
+ Examples:
250
+
251
+ ```json
252
+ {
253
+ "contentModel": {
254
+ "contents": [{ "require": "#phrasing" }, { "optional": [{ "oneOrMore": "#interactive" }] }]
255
+ }
256
+ }
257
+ ```
258
+
259
+ Transparent selector syntax
260
+
261
+ - A CSS-like selector string with an extra pseudo: `:model(<CATEGORY>)`
262
+ - You can combine standard selectors: type, class, id, attribute selectors, `:not(...)`, `:has(...)`,
263
+ combinators, etc.
264
+ - `:model(<CATEGORY>)` matches any element belonging to the specified content category.
265
+
266
+ Examples:
267
+
268
+ ```text
269
+ :not(:model(interactive))
270
+ :has(:model(interactive), a, [tabindex])
271
+ ```
272
+
273
+ SVG categories
274
+
275
+ The following categories are available for SVG elements (see `schemas/content-models.schema.json`):
276
+
277
+ - `#SVGAnimation`
278
+ - `#SVGBasicShapes`
279
+ - `#SVGContainer`
280
+ - `#SVGDescriptive`
281
+ - `#SVGFilterPrimitive`
282
+ - `#SVGFont`
283
+ - `#SVGGradient`
284
+ - `#SVGGraphics`
285
+ - `#SVGGraphicsReferencing`
286
+ - `#SVGLightSource`
287
+ - `#SVGNeverRendered`
288
+ - `#SVGNone`
289
+ - `#SVGPaintServer`
290
+ - `#SVGRenderable`
291
+ - `#SVGShape`
292
+ - `#SVGStructural`
293
+ - `#SVGStructurallyExternal`
294
+ - `#SVGTextContent`
295
+ - `#SVGTextContentChild`
296
+
297
+ ```json
298
+ {
299
+ "contentModel": {
300
+ "contents": [{ "choice": [[{ "oneOrMore": "#flow" }], [{ "require": "#phrasing" }]] }]
301
+ }
302
+ }
303
+ ```
304
+
305
+ ```json
306
+ {
307
+ "contentModel": {
308
+ "contents": [{ "transparent": ":not(:model(interactive))" }],
309
+ "conditional": [
310
+ {
311
+ "condition": "[type=button]",
312
+ "contents": [{ "require": "#phrasing" }]
313
+ }
314
+ ]
315
+ }
316
+ }
317
+ ```
318
+
319
+ ### License
320
+
321
+ MIT
@@ -0,0 +1,6 @@
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
+ export declare function ariaSpecs(specs: MLMLSpec, version: ARIAVersion): {
3
+ readonly roles: readonly import("../../types/index.js").ARIARoleInSchema[];
4
+ readonly graphicsRoles: readonly import("../../types/index.js").ARIARoleInSchema[];
5
+ readonly props: readonly import("../../types/index.js").ARIAProperty[];
6
+ };
@@ -1,4 +1,4 @@
1
- import type { ARIA } from '../types/aria.js';
2
- import type { ARIAVersion, Matches, MLMLSpec } from '../types/index.js';
1
+ import type { ARIA } from '../../types/aria.js';
2
+ import type { ARIAVersion, Matches, MLMLSpec } from '../../types/index.js';
3
3
  import type { ReadonlyDeep } from 'type-fest';
4
4
  export declare function getARIA(specs: MLMLSpec, localName: string, namespace: string | null, version: ARIAVersion, matches: Matches): Omit<ReadonlyDeep<ARIA>, ARIAVersion | 'conditions'> | null;
@@ -1,5 +1,5 @@
1
- import { getSpecByTagName } from './get-spec-by-tag-name.js';
2
- import { resolveVersion } from './resolve-version.js';
1
+ import { getSpecByTagName } from '../../utils/get-spec-by-tag-name.js';
2
+ import { resolveVersion } from '../../utils/resolve-version.js';
3
3
  const cache = new Map();
4
4
  export function getARIA(specs, localName, namespace, version, matches) {
5
5
  const aria = getVersionResolvedARIA(specs, localName, namespace, version);
@@ -1,4 +1,4 @@
1
- import type { ARIAVersion, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
2
  type ARIAProps = Record<string, ARIAProp>;
3
3
  type ARIAProp = {
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- import { ariaSpecs as _ariaSpecs } from '../specs/aria-specs.js';
1
+ import { ariaSpecs as _ariaSpecs } from './aria-specs.js';
2
2
  import { getComputedRole } from './get-computed-role.js';
3
3
  export function getComputedAriaProps(specs,
4
4
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -1,2 +1,2 @@
1
- import type { ARIAVersion, ComputedRole, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, ComputedRole, MLMLSpec } from '../../types/index.js';
2
2
  export declare function getComputedRole(specs: MLMLSpec, el: Element, version: ARIAVersion, assumeSingleNode?: boolean): ComputedRole;
@@ -1,13 +1,13 @@
1
- import { ariaSpecs } from '../specs/aria-specs.js';
2
- import { isPresentational } from '../specs/is-presentational.js';
1
+ import { ariaSpecs } from './aria-specs.js';
2
+ import { isPresentational } from './is-presentational.js';
3
3
  import { getAccname } from './accname-computation.js';
4
- import { getAttrSpecs } from './get-attr-specs.js';
4
+ import { getAttrSpecs } from '../../utils/get-attr-specs.js';
5
5
  import { getExplicitRole } from './get-explicit-role.js';
6
6
  import { getImplicitRole } from './get-implicit-role.js';
7
7
  import { getNonPresentationalAncestor } from './get-non-presentational-ancestor.js';
8
8
  import { isRequiredOwnedElement } from './has-required-owned-elements.js';
9
9
  import { matchesContextRole } from './matches-context-role.js';
10
- import { mayBeFocusable } from './may-be-focusable.js';
10
+ import { mayBeFocusable } from '../html/may-be-focusable.js';
11
11
  export function getComputedRole(specs,
12
12
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
13
13
  el, version, assumeSingleNode = false) {
@@ -1,2 +1,2 @@
1
- import type { ARIAVersion, ComputedRole, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, ComputedRole, MLMLSpec } from '../../types/index.js';
2
2
  export declare function getExplicitRole(specs: MLMLSpec, el: Element, version: ARIAVersion): ComputedRole;
@@ -1,5 +1,5 @@
1
- import { getRoleSpec } from '../specs/get-role-spec.js';
2
- import { resolveNamespace } from '../utils/resolve-namespace.js';
1
+ import { getRoleSpec } from './get-role-spec.js';
2
+ import { resolveNamespace } from '../../utils/resolve-namespace.js';
3
3
  import { getPermittedRoles } from './get-permitted-roles.js';
4
4
  export function getExplicitRole(specs,
5
5
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -0,0 +1,2 @@
1
+ import type { ARIAVersion, Matches, MLMLSpec } from '../../types/index.js';
2
+ export declare function getImplicitRole(specs: MLMLSpec, localName: string, namespace: string | null, version: ARIAVersion, matches: Matches): import("../../index.js").ImplicitRole;
@@ -1,4 +1,4 @@
1
- import type { ImplicitRole } from '../types/aria.js';
2
- import type { ARIAVersion, ComputedRole, MLMLSpec } from '../types/index.js';
1
+ import type { ImplicitRole } from '../../types/aria.js';
2
+ import type { ARIAVersion, ComputedRole, MLMLSpec } from '../../types/index.js';
3
3
  export declare function getImplicitRole(specs: MLMLSpec, el: Element, version: ARIAVersion): ComputedRole;
4
4
  export declare function getImplicitRoleName(el: Element, version: ARIAVersion, specs: MLMLSpec): ImplicitRole;
@@ -1,6 +1,6 @@
1
- import { getImplicitRole as _getImplicitRole } from '../specs/get-implicit-role.js';
2
- import { getRoleSpec } from '../specs/get-role-spec.js';
3
- import { resolveNamespace } from '../utils/resolve-namespace.js';
1
+ import { getImplicitRole as _getImplicitRole } from './get-implicit-role-spec.js';
2
+ import { getRoleSpec } from './get-role-spec.js';
3
+ import { resolveNamespace } from '../../utils/resolve-namespace.js';
4
4
  export function getImplicitRole(specs,
5
5
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
6
6
  el, version) {
@@ -0,0 +1,5 @@
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
+ export declare function getNonPresentationalAncestor(el: Element, specs: MLMLSpec, version: ARIAVersion): import("../../types/index.js").ComputedRole | {
3
+ el: null;
4
+ role: null;
5
+ };
@@ -1,4 +1,4 @@
1
- import { isPresentational } from '../specs/is-presentational.js';
1
+ import { isPresentational } from './is-presentational.js';
2
2
  import { getComputedRole } from './get-computed-role.js';
3
3
  export function getNonPresentationalAncestor(
4
4
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -1,4 +1,4 @@
1
- import type { ARIAVersion, Matches, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, Matches, MLMLSpec } from '../../types/index.js';
2
2
  /**
3
3
  * Getting permitted ARIA roles.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  // @ts-ignore
2
2
  import { isPlainObject } from 'is-plain-object';
3
- import { mergeArray } from '../utils/merge-array.js';
3
+ import { mergeArray } from '../../utils/merge-array.js';
4
4
  import { ariaSpecs } from './aria-specs.js';
5
5
  import { getARIA } from './get-aria.js';
6
6
  /**
@@ -1,4 +1,4 @@
1
- import type { ARIAVersion, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
2
  export declare function getPermittedRoles(el: Element, version: ARIAVersion, specs: MLMLSpec): readonly {
3
3
  readonly name: string;
4
4
  readonly deprecated?: boolean;
@@ -1,4 +1,4 @@
1
- import { getPermittedRoles as _getPermittedRoles } from '../specs/get-permitted-roles.js';
1
+ import { getPermittedRoles as _getPermittedRoles } from './get-permitted-roles-spec.js';
2
2
  export function getPermittedRoles(
3
3
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
4
4
  el, version, specs) {
@@ -1,4 +1,4 @@
1
- import type { ARIAVersion, ARIARoleInSchema, MLMLSpec, ARIARole } from '../types/index.js';
1
+ import type { ARIAVersion, ARIARoleInSchema, MLMLSpec, ARIARole } from '../../types/index.js';
2
2
  import type { NamespaceURI } from '@markuplint/ml-ast';
3
3
  export declare function getRoleSpec(specs: MLMLSpec, roleName: string, namespace: NamespaceURI, version: ARIAVersion): (ARIARole & {
4
4
  superClassRoles: ARIARoleInSchema[];
@@ -1,3 +1,3 @@
1
- import type { ARIAVersion, ComputedRole, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, ComputedRole, MLMLSpec } from '../../types/index.js';
2
2
  export declare function hasRequiredOwnedElement(el: Element, specs: MLMLSpec, version: ARIAVersion): boolean;
3
3
  export declare function isRequiredOwnedElement(el: Element, role: ComputedRole['role'], query: string, specs: MLMLSpec, version: ARIAVersion): boolean;
@@ -1,4 +1,4 @@
1
- import { isPresentational } from '../specs/is-presentational.js';
1
+ import { isPresentational } from './is-presentational.js';
2
2
  import { getComputedRole } from './get-computed-role.js';
3
3
  import { getExplicitRole } from './get-explicit-role.js';
4
4
  import { getImplicitRole } from './get-implicit-role.js';
@@ -1,4 +1,4 @@
1
- import type { ARIAVersion, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
2
  /**
3
3
  * Detect including/excluding from the Accessibility Tree
4
4
  *
@@ -1,7 +1,7 @@
1
- import { ariaSpecs } from '../specs/aria-specs.js';
2
- import { getSpecByTagName } from '../specs/get-spec-by-tag-name.js';
3
- import { isPresentational } from '../specs/is-presentational.js';
4
- import { resolveNamespace } from '../utils/resolve-namespace.js';
1
+ import { ariaSpecs } from './aria-specs.js';
2
+ import { getSpecByTagName } from '../../utils/get-spec-by-tag-name.js';
3
+ import { isPresentational } from './is-presentational.js';
4
+ import { resolveNamespace } from '../../utils/resolve-namespace.js';
5
5
  import { getComputedRole } from './get-computed-role.js';
6
6
  /**
7
7
  * Detect including/excluding from the Accessibility Tree
@@ -1,2 +1,2 @@
1
- import type { ARIAVersion, MLMLSpec } from '../types/index.js';
1
+ import type { ARIAVersion, MLMLSpec } from '../../types/index.js';
2
2
  export declare function matchesContextRole(conditions: readonly string[], ownedEl: Element, specs: MLMLSpec, version: ARIAVersion): boolean;
@@ -1,3 +1,3 @@
1
- import type { MLMLSpec } from '../types/index.js';
2
- import type { Category } from '../types/permitted-structures.js';
1
+ import type { MLMLSpec } from '../../types/index.js';
2
+ import type { Category } from '../../types/permitted-structures.js';
3
3
  export declare function contentModelCategoryToTagNames(contentModel: Category, def: MLMLSpec['def']): ReadonlyArray<string>;
@@ -0,0 +1,4 @@
1
+ import type { ElementSpec } from '../../types/index.js';
2
+ type Specs = readonly Pick<ElementSpec, 'name' | 'contentModel'>[];
3
+ export declare function getContentModel(el: Element, specs: Specs): boolean | readonly (import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentRequire> | import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentOptional> | import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentOneOrMore> | import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentZeroOrMore> | import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentChoice> | import("type-fest/source/readonly-deep.js").ReadonlyObjectDeep<import("../../types/permitted-structures.js").PermittedContentTransparent>)[] | null;
4
+ export {};
@@ -1,4 +1,4 @@
1
- import { getSpec } from './get-spec.js';
1
+ import { getSpec } from '../../utils/get-spec.js';
2
2
  const cachesBySpecs = new Map();
3
3
  export function getContentModel(
4
4
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -0,0 +1,3 @@
1
+ import type { MLMLSpec } from '../../types/index.js';
2
+ import type { Category } from '../../types/permitted-structures.js';
3
+ export declare function getSelectorsByContentModelCategory(specs: MLMLSpec, category: Category): ReadonlyArray<string>;
@@ -1,4 +1,4 @@
1
- import type { MLMLSpec } from '../types/index.js';
1
+ import type { MLMLSpec } from '../../types/index.js';
2
2
  export declare function isPalpableElement(el: Element, specs: MLMLSpec, options?: {
3
3
  readonly extendsSvg?: boolean;
4
4
  readonly extendsExposableElements?: boolean;
@@ -1,2 +1,2 @@
1
- import type { MLMLSpec } from '../types/index.js';
1
+ import type { MLMLSpec } from '../../types/index.js';
2
2
  export declare function mayBeFocusable(el: Element, specs: MLMLSpec): boolean;
@@ -1,4 +1,4 @@
1
- import { getSelectorsByContentModelCategory } from '../specs/get-selectors-by-content-model-category.js';
1
+ import { getSelectorsByContentModelCategory } from './get-selectors-by-content-model-category.js';
2
2
  export function mayBeFocusable(
3
3
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
4
4
  el, specs) {