@markuplint/ml-spec 5.0.0-alpha.0 → 5.0.0-alpha.2
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.
- package/ARCHITECTURE.ja.md +8 -8
- package/ARCHITECTURE.md +8 -8
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/docs/spec-resolution.ja.md +14 -7
- package/docs/spec-resolution.md +16 -8
- package/lib/algorithm/aria/accname/label-steps.js +9 -1
- package/lib/algorithm/html/content-model-category-to-tag-names.js +11 -1
- package/lib/types/aria.d.ts +3 -3
- package/lib/types/index.d.ts +2 -2
- package/lib/types/permitted-structures.d.ts +1 -1
- package/lib/utils/aria-version.d.ts +1 -1
- package/lib/utils/aria-version.js +1 -1
- package/lib/utils/get-spec-by-tag-name.d.ts +1 -1
- package/lib/utils/get-spec.d.ts +1 -1
- package/lib/utils/resolve-version.js +2 -1
- package/lib/utils/schema-to-spec.d.ts +1 -1
- package/lib/utils/schema-to-spec.js +2 -2
- package/package.json +5 -5
package/ARCHITECTURE.ja.md
CHANGED
|
@@ -146,16 +146,16 @@ flowchart TD
|
|
|
146
146
|
|
|
147
147
|
型システムは、マークアップ言語仕様・要素仕様・ARIA ロール・属性の構造を定義します。
|
|
148
148
|
|
|
149
|
-
| ファイル | 役割
|
|
150
|
-
| ------------------------------- |
|
|
151
|
-
| `types/index.ts` | 手書き型: `MLMLSpec`, `ElementSpec`, `ExtendedSpec`, `ARIARole`, `ComputedRole` 等
|
|
152
|
-
| `types/aria.ts` | 生成型: `ARIA`, `PermittedRoles`, `ImplicitRole`, `PermittedARIAProperties`, `ImplicitProperties`
|
|
153
|
-
| `types/attributes.ts` | 生成型: `AttributeType`, `GlobalAttributes`, `AttributeJSON`, `List`, `Enum`, `Number`
|
|
154
|
-
| `types/permitted-structures.ts` | 生成型: `PermittedContentPattern`, `ContentModel`, `Category`(HTML 13 + SVG 19 カテゴリ)
|
|
149
|
+
| ファイル | 役割 |
|
|
150
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `types/index.ts` | 手書き型: `MLMLSpec`, `ElementSpec`, `ExtendedSpec`, `ARIARole`, `ComputedRole` 等 |
|
|
152
|
+
| `types/aria.ts` | 生成型: `ARIA`, `PermittedRoles`, `ImplicitRole`, `PermittedARIAProperties`, `ImplicitProperties` |
|
|
153
|
+
| `types/attributes.ts` | 生成型: `AttributeType`, `GlobalAttributes`, `AttributeJSON`, `List`, `Enum`, `Number` |
|
|
154
|
+
| `types/permitted-structures.ts` | 生成型: `PermittedContentPattern`, `ContentModel`, `Category`(HTML 13 + SVG 19 + MathML 3 カテゴリ) |
|
|
155
155
|
|
|
156
156
|
### 2. ARIA アルゴリズム
|
|
157
157
|
|
|
158
|
-
ARIA アルゴリズムは WAI-ARIA, HTML-AAM, SVG-AAM, AccName 1.2 仕様に基づくロール計算とアクセシビリティツリー管理を実装します。
|
|
158
|
+
ARIA アルゴリズムは WAI-ARIA, HTML-AAM, SVG-AAM, MathML-AAM, AccName 1.2 仕様に基づくロール計算とアクセシビリティツリー管理を実装します。
|
|
159
159
|
|
|
160
160
|
| ファイル | 役割 |
|
|
161
161
|
| -------------------------------- | ------------------------------------------------------------------------------- |
|
|
@@ -183,7 +183,7 @@ HTML アルゴリズムは HTML Living Standard に基づくコンテンツモ
|
|
|
183
183
|
| `get-content-model.ts` | 条件付きパターン評価を含むコンテンツモデルの取得 |
|
|
184
184
|
| `content-model-category-to-tag-names.ts` | コンテンツモデルカテゴリをソート済みタグ名配列に変換 |
|
|
185
185
|
| `get-selectors-by-content-model-category.ts` | コンテンツモデルカテゴリを CSS セレクタにマッピング |
|
|
186
|
-
| `is-palpable-elements.ts` | SVG/露出可能要素拡張付きパルパブルコンテンツ検出
|
|
186
|
+
| `is-palpable-elements.ts` | SVG/MathML/露出可能要素拡張付きパルパブルコンテンツ検出 |
|
|
187
187
|
| `is-void-element.ts` | ボイド要素判定(13 の HTML ボイド要素) |
|
|
188
188
|
| `is-nothing-content-model.ts` | 「Nothing」コンテンツモデル判定(void + iframe + template) |
|
|
189
189
|
| `may-be-focusable.ts` | フォーカス可能性ヒューリスティック(interactive + tabindex + contenteditable) |
|
package/ARCHITECTURE.md
CHANGED
|
@@ -146,16 +146,16 @@ flowchart TD
|
|
|
146
146
|
|
|
147
147
|
The type system defines the structure of markup language specifications, element specs, ARIA roles, and attributes.
|
|
148
148
|
|
|
149
|
-
| File | Purpose
|
|
150
|
-
| ------------------------------- |
|
|
151
|
-
| `types/index.ts` | Hand-written types: `MLMLSpec`, `ElementSpec`, `ExtendedSpec`, `ARIARole`, `ComputedRole`, etc.
|
|
152
|
-
| `types/aria.ts` | Generated: `ARIA`, `PermittedRoles`, `ImplicitRole`, `PermittedARIAProperties`, `ImplicitProperties`
|
|
153
|
-
| `types/attributes.ts` | Generated: `AttributeType`, `GlobalAttributes`, `AttributeJSON`, `List`, `Enum`, `Number`
|
|
154
|
-
| `types/permitted-structures.ts` | Generated: `PermittedContentPattern`, `ContentModel`, `Category` (HTML 13 + SVG 19 categories)
|
|
149
|
+
| File | Purpose |
|
|
150
|
+
| ------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `types/index.ts` | Hand-written types: `MLMLSpec`, `ElementSpec`, `ExtendedSpec`, `ARIARole`, `ComputedRole`, etc. |
|
|
152
|
+
| `types/aria.ts` | Generated: `ARIA`, `PermittedRoles`, `ImplicitRole`, `PermittedARIAProperties`, `ImplicitProperties` |
|
|
153
|
+
| `types/attributes.ts` | Generated: `AttributeType`, `GlobalAttributes`, `AttributeJSON`, `List`, `Enum`, `Number` |
|
|
154
|
+
| `types/permitted-structures.ts` | Generated: `PermittedContentPattern`, `ContentModel`, `Category` (HTML 13 + SVG 19 + MathML 3 categories) |
|
|
155
155
|
|
|
156
156
|
### 2. ARIA Algorithms
|
|
157
157
|
|
|
158
|
-
ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, and AccName 1.2 specifications for role computation and accessibility tree management.
|
|
158
|
+
ARIA algorithms implement WAI-ARIA, HTML-AAM, SVG-AAM, MathML-AAM, and AccName 1.2 specifications for role computation and accessibility tree management.
|
|
159
159
|
|
|
160
160
|
| File | Purpose |
|
|
161
161
|
| -------------------------------- | --------------------------------------------------------------------------------- |
|
|
@@ -183,7 +183,7 @@ HTML algorithms implement content model evaluation and element classification fr
|
|
|
183
183
|
| `get-content-model.ts` | Retrieves content model with conditional pattern evaluation |
|
|
184
184
|
| `content-model-category-to-tag-names.ts` | Converts content model category to sorted tag name array |
|
|
185
185
|
| `get-selectors-by-content-model-category.ts` | Maps content model category to CSS selectors |
|
|
186
|
-
| `is-palpable-elements.ts` | Palpable content detection with SVG/exposable extensions
|
|
186
|
+
| `is-palpable-elements.ts` | Palpable content detection with SVG/MathML/exposable extensions |
|
|
187
187
|
| `is-void-element.ts` | Void element check (13 HTML void elements) |
|
|
188
188
|
| `is-nothing-content-model.ts` | "Nothing" content model check (void + iframe + template) |
|
|
189
189
|
| `may-be-focusable.ts` | Focusability heuristic (interactive + tabindex + contenteditable) |
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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
|
+
# [5.0.0-alpha.2](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-02-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **ml-spec:** add MathML content model categories and namespace support ([80f0945](https://github.com/markuplint/markuplint/commit/80f0945595aed48c9766423e83e8cd2b1c454a54))
|
|
11
|
+
|
|
12
|
+
# [5.0.0-alpha.1](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2026-02-22)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **ml-spec:** add transparent traversal fallback in collectLabelText ([d6096c1](https://github.com/markuplint/markuplint/commit/d6096c1ceba190e7799974d0c682695946f852ed))
|
|
17
|
+
|
|
18
|
+
- feat(ml-spec)!: update default ARIA version to 1.3 ([c3b56e2](https://github.com/markuplint/markuplint/commit/c3b56e2bf06a667a00aa621f2f51a082a90d4e2f))
|
|
19
|
+
|
|
20
|
+
### BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
- The default ARIA specification version used when none
|
|
23
|
+
is explicitly configured changes from 1.2 to 1.3. This may produce
|
|
24
|
+
different lint results for rules that depend on ARIA version.
|
|
25
|
+
|
|
26
|
+
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
27
|
+
|
|
6
28
|
# [5.0.0-alpha.0](https://github.com/markuplint/markuplint/compare/v4.14.1...v5.0.0-alpha.0) (2026-02-20)
|
|
7
29
|
|
|
8
30
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
This package serves as the foundational layer for markuplint's specification system, providing:
|
|
8
8
|
|
|
9
|
-
- **Type definitions** for markup language specifications (HTML, ARIA, SVG)
|
|
9
|
+
- **Type definitions** for markup language specifications (HTML, ARIA, SVG, MathML)
|
|
10
10
|
- **W3C specification algorithms** (HTML Standard, WAI-ARIA 1.1/1.2/1.3 compliance)
|
|
11
11
|
- **JSON schemas** that define the structure of element specifications
|
|
12
12
|
- **Runtime utilities** for specification resolution, attribute validation, and content model checking
|
|
@@ -155,21 +155,28 @@ result.directivePatterns = [...(result.directivePatterns ?? []), ...extendedSpec
|
|
|
155
155
|
(最初のマッチが優先)。そのため、フレームワーク spec はパターンを
|
|
156
156
|
最も具体的なものから最も一般的なものの順で定義する必要があります。
|
|
157
157
|
|
|
158
|
-
#### 6. `
|
|
158
|
+
#### 6. `acceptedAttrNames`
|
|
159
159
|
|
|
160
|
-
拡張仕様が `
|
|
161
|
-
|
|
160
|
+
拡張仕様が `acceptedAttrNames` を明示的に設定している場合、
|
|
161
|
+
現在の値を上書きします:
|
|
162
162
|
|
|
163
163
|
```ts
|
|
164
|
-
if (extendedSpec.
|
|
165
|
-
result.
|
|
164
|
+
if (extendedSpec.acceptedAttrNames != null) {
|
|
165
|
+
result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
|
|
166
166
|
}
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
これは明示的な `null` ガード付きの last-write-wins セマンティクスです。
|
|
170
170
|
プロパティを省略しても以前に設定された値はリセットされません。
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
この値は `@markuplint/ml-core` の `MLAttr` コンストラクタで使用され、
|
|
172
|
+
属性名の解決方法を制御します:
|
|
173
|
+
|
|
174
|
+
- `'idl'` -- IDL-コンテンツ属性名解決を有効化(例: `className` → `class`)し、
|
|
175
|
+
コンテンツ属性名が使用された場合にIDL名を候補として提案します
|
|
176
|
+
(例: `tabindex` → 「`tabIndex` の間違いでは?」)。Reactで使用されます。
|
|
177
|
+
- `'both'` -- IDL-コンテンツ属性名解決を有効化しますが、IDL名を候補として
|
|
178
|
+
提案**しません**。コンテンツ属性名(例: `class`)とIDLプロパティ名
|
|
179
|
+
(例: `className`)の両方が警告なしで受け入れられます。Svelteで使用されます。
|
|
173
180
|
|
|
174
181
|
#### 7. 要素仕様
|
|
175
182
|
|
package/docs/spec-resolution.md
CHANGED
|
@@ -160,21 +160,29 @@ This is simple array concatenation. The core engine evaluates patterns in order
|
|
|
160
160
|
(first match wins), so framework specs should define their patterns from most
|
|
161
161
|
specific to most general.
|
|
162
162
|
|
|
163
|
-
#### 6. `
|
|
163
|
+
#### 6. `acceptedAttrNames`
|
|
164
164
|
|
|
165
|
-
If the extended spec explicitly sets `
|
|
166
|
-
|
|
165
|
+
If the extended spec explicitly sets `acceptedAttrNames`, it overrides the
|
|
166
|
+
current value:
|
|
167
167
|
|
|
168
168
|
```ts
|
|
169
|
-
if (extendedSpec.
|
|
170
|
-
result.
|
|
169
|
+
if (extendedSpec.acceptedAttrNames != null) {
|
|
170
|
+
result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
|
|
171
171
|
}
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
This is a last-write-wins semantic with explicit `null` guard -- omitting the
|
|
175
|
-
property does not reset a previously set value.
|
|
176
|
-
`@markuplint/ml-core`'s `MLAttr` constructor
|
|
177
|
-
|
|
175
|
+
property does not reset a previously set value. The value controls how
|
|
176
|
+
`@markuplint/ml-core`'s `MLAttr` constructor resolves attribute names:
|
|
177
|
+
|
|
178
|
+
- `'idl'` -- Enables IDL-to-content attribute name resolution (e.g.,
|
|
179
|
+
`className` -> `class`) and suggests IDL names as candidates when the
|
|
180
|
+
content attribute name is used (e.g., `tabindex` -> "Did you mean
|
|
181
|
+
`tabIndex`?"). Used by React, where only IDL property names are accepted.
|
|
182
|
+
- `'both'` -- Enables IDL-to-content attribute name resolution but does
|
|
183
|
+
**not** suggest IDL names as candidates. Both content attribute names
|
|
184
|
+
(e.g., `class`) and IDL property names (e.g., `className`) are accepted
|
|
185
|
+
without warnings. Used by Svelte.
|
|
178
186
|
|
|
179
187
|
#### 7. Element Specs
|
|
180
188
|
|
|
@@ -59,7 +59,15 @@ function collectLabelText(label, labeledElement, resolver, visited, computeFn, i
|
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
61
|
const result = computeFn(childEl, resolver, inLabelledbyTraversal, visited);
|
|
62
|
-
|
|
62
|
+
if (result.name) {
|
|
63
|
+
parts.push(result.name);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Transparent traversal: when the child element has no accessible name
|
|
67
|
+
// (e.g., <span> with role="generic"), recursively collect its descendant text.
|
|
68
|
+
// This matches the behavior of resolveNameFromContent's fallback.
|
|
69
|
+
parts.push(collectLabelText(childEl, labeledElement, resolver, visited, computeFn, inLabelledbyTraversal));
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
return parts.join(' ');
|
|
@@ -13,7 +13,17 @@ export function contentModelCategoryToTagNames(contentModel, def) {
|
|
|
13
13
|
if (cached) {
|
|
14
14
|
return cached;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
let tags = def['#contentModels'][contentModel];
|
|
17
|
+
if (!tags) {
|
|
18
|
+
// Case-insensitive fallback for mixed-case categories (e.g., #MathMLPresentation, #SVGAnimation)
|
|
19
|
+
const lowerKey = contentModel.toLowerCase();
|
|
20
|
+
for (const key of Object.keys(def['#contentModels'])) {
|
|
21
|
+
if (key.toLowerCase() === lowerKey) {
|
|
22
|
+
tags = def['#contentModels'][key];
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
17
27
|
const sortedTag = Object.freeze(tags && Array.isArray(tags) ? tags.toSorted() : []);
|
|
18
28
|
cache.set(contentModel, sortedTag);
|
|
19
29
|
return sortedTag;
|
package/lib/types/aria.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export interface ARIA {
|
|
|
91
91
|
namingProhibited?: true;
|
|
92
92
|
implicitProperties?: ImplicitProperties;
|
|
93
93
|
properties?: PermittedARIAProperties;
|
|
94
|
-
conditions?: {
|
|
94
|
+
conditions?: false | {
|
|
95
95
|
/**
|
|
96
96
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
97
97
|
* via the `patternProperty` ".+".
|
|
@@ -111,7 +111,7 @@ export interface ARIA {
|
|
|
111
111
|
namingProhibited?: true;
|
|
112
112
|
implicitProperties?: ImplicitProperties;
|
|
113
113
|
properties?: PermittedARIAProperties;
|
|
114
|
-
conditions?: {
|
|
114
|
+
conditions?: false | {
|
|
115
115
|
/**
|
|
116
116
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
117
117
|
* via the `patternProperty` ".+".
|
|
@@ -130,7 +130,7 @@ export interface ARIA {
|
|
|
130
130
|
permittedRoles?: PermittedRoles;
|
|
131
131
|
implicitProperties?: ImplicitProperties;
|
|
132
132
|
properties?: PermittedARIAProperties;
|
|
133
|
-
conditions?: {
|
|
133
|
+
conditions?: false | {
|
|
134
134
|
/**
|
|
135
135
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
136
136
|
* via the `patternProperty` ".+".
|
package/lib/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface MLMLSpec {
|
|
|
12
12
|
readonly def: SpecDefs;
|
|
13
13
|
readonly specs: readonly ElementSpec[];
|
|
14
14
|
readonly directivePatterns?: readonly DirectivePattern[];
|
|
15
|
-
readonly
|
|
15
|
+
readonly acceptedAttrNames?: 'idl' | 'both';
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* An element specification for extending or overriding parts of the base spec.
|
|
@@ -32,7 +32,7 @@ export type ExtendedSpec = {
|
|
|
32
32
|
readonly def?: Partial<SpecDefs>;
|
|
33
33
|
readonly specs?: readonly ExtendedElementSpec[];
|
|
34
34
|
readonly directivePatterns?: readonly DirectivePattern[];
|
|
35
|
-
readonly
|
|
35
|
+
readonly acceptedAttrNames?: 'idl' | 'both';
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* A declarative pattern for resolving framework-specific directive
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export type PermittedContentPattern = PermittedContentRequire | PermittedContentOptional | PermittedContentOneOrMore | PermittedContentZeroOrMore | PermittedContentChoice | PermittedContentTransparent;
|
|
7
7
|
export type Model = ContentType | ContentType[];
|
|
8
8
|
export type ContentType = string | Category;
|
|
9
|
-
export type Category = '#text' | '#phrasing' | '#flow' | '#interactive' | '#heading' | '#sectioning' | '#metadata' | '#embedded' | '#palpable' | '#script-supporting' | '#SVGAnimation' | '#SVGBasicShapes' | '#SVGContainer' | '#SVGDescriptive' | '#SVGFilterPrimitive' | '#SVGFont' | '#SVGGradient' | '#SVGGraphics' | '#SVGGraphicsReferencing' | '#SVGLightSource' | '#SVGNeverRendered' | '#SVGNone' | '#SVGPaintServer' | '#SVGRenderable' | '#SVGShape' | '#SVGStructural' | '#SVGStructurallyExternal' | '#SVGTextContent' | '#SVGTextContentChild';
|
|
9
|
+
export type Category = '#text' | '#phrasing' | '#flow' | '#interactive' | '#heading' | '#sectioning' | '#metadata' | '#embedded' | '#palpable' | '#script-supporting' | '#SVGAnimation' | '#SVGBasicShapes' | '#SVGContainer' | '#SVGDescriptive' | '#SVGFilterPrimitive' | '#SVGFont' | '#SVGGradient' | '#SVGGraphics' | '#SVGGraphicsReferencing' | '#SVGLightSource' | '#SVGNeverRendered' | '#SVGNone' | '#SVGPaintServer' | '#SVGRenderable' | '#SVGShape' | '#SVGStructural' | '#SVGStructurallyExternal' | '#SVGTextContent' | '#SVGTextContentChild' | '#MathMLPresentation' | '#MathMLScript' | '#MathMLTabular';
|
|
10
10
|
export interface ContentModelsSchema {
|
|
11
11
|
__contentModel?: ContentModel;
|
|
12
12
|
}
|
|
@@ -5,4 +5,4 @@ export declare const ariaVersions: readonly ["1.1", "1.2", "1.3"];
|
|
|
5
5
|
/**
|
|
6
6
|
* The recommended default ARIA specification version to use when none is explicitly specified.
|
|
7
7
|
*/
|
|
8
|
-
export declare const ARIA_RECOMMENDED_VERSION = "1.
|
|
8
|
+
export declare const ARIA_RECOMMENDED_VERSION = "1.3";
|
|
@@ -10,4 +10,4 @@ import type { ElementSpec } from '../types/index.js';
|
|
|
10
10
|
* @param namespace - The namespace URI string, or null for HTML namespace
|
|
11
11
|
* @returns The matching element specification, or null if not found
|
|
12
12
|
*/
|
|
13
|
-
export declare function getSpecByTagName<K extends keyof ElementSpec = keyof ElementSpec>(specs: readonly Pick<ElementSpec, 'name' | K>[], localName: string, namespace: string | null): Pick<ElementSpec,
|
|
13
|
+
export declare function getSpecByTagName<K extends keyof ElementSpec = keyof ElementSpec>(specs: readonly Pick<ElementSpec, 'name' | K>[], localName: string, namespace: string | null): Pick<ElementSpec, "name" | K> | null;
|
package/lib/utils/get-spec.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ import type { ElementSpec } from '../types/index.js';
|
|
|
9
9
|
* @param specs - The array of element specifications to search
|
|
10
10
|
* @returns The matching element specification, or null if not found
|
|
11
11
|
*/
|
|
12
|
-
export declare function getSpec<K extends keyof ElementSpec>(el: Element, specs: readonly Pick<ElementSpec, 'name' | K>[]): Pick<ElementSpec,
|
|
12
|
+
export declare function getSpec<K extends keyof ElementSpec>(el: Element, specs: readonly Pick<ElementSpec, 'name' | K>[]): Pick<ElementSpec, "name" | K> | null;
|
|
@@ -15,7 +15,8 @@ export function resolveVersion(aria, version) {
|
|
|
15
15
|
const implicitProperties = aria[version]?.implicitProperties ?? aria.implicitProperties;
|
|
16
16
|
const properties = aria[version]?.properties ?? aria.properties;
|
|
17
17
|
const namingProhibited = version === '1.1' ? aria.namingProhibited : (aria[version]?.namingProhibited ?? aria.namingProhibited);
|
|
18
|
-
const
|
|
18
|
+
const versionConditions = aria[version]?.conditions;
|
|
19
|
+
const conditions = versionConditions === false ? undefined : (versionConditions ?? aria.conditions);
|
|
19
20
|
return {
|
|
20
21
|
implicitRole,
|
|
21
22
|
permittedRoles,
|
|
@@ -14,5 +14,5 @@ export declare function schemaToSpec(schemas: readonly [MLMLSpec, ...ExtendedSpe
|
|
|
14
14
|
def: import("../types/index.js").SpecDefs;
|
|
15
15
|
specs: readonly ElementSpec[];
|
|
16
16
|
directivePatterns?: readonly import("../types/index.js").DirectivePattern[];
|
|
17
|
-
|
|
17
|
+
acceptedAttrNames?: "idl" | "both";
|
|
18
18
|
};
|
|
@@ -68,8 +68,8 @@ export function schemaToSpec(schemas) {
|
|
|
68
68
|
if (extendedSpec.directivePatterns) {
|
|
69
69
|
result.directivePatterns = [...(result.directivePatterns ?? []), ...extendedSpec.directivePatterns];
|
|
70
70
|
}
|
|
71
|
-
if (extendedSpec.
|
|
72
|
-
result.
|
|
71
|
+
if (extendedSpec.acceptedAttrNames != null) {
|
|
72
|
+
result.acceptedAttrNames = extendedSpec.acceptedAttrNames;
|
|
73
73
|
}
|
|
74
74
|
if (extendedSpec.specs) {
|
|
75
75
|
const exSpecs = [...extendedSpec.specs];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-spec",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "Types and schema that specs of the Markup languages for markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"schema:prettier": "npx prettier --write \"./schemas/*.json\" \"./src/types/*.ts\" --log-level warn"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@markuplint/ml-ast": "5.0.0-alpha.
|
|
38
|
-
"@markuplint/types": "5.0.0-alpha.
|
|
37
|
+
"@markuplint/ml-ast": "5.0.0-alpha.2",
|
|
38
|
+
"@markuplint/types": "5.0.0-alpha.2",
|
|
39
39
|
"is-plain-object": "5.0.0",
|
|
40
40
|
"type-fest": "5.4.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@markuplint/test-tools": "5.0.0-alpha.
|
|
43
|
+
"@markuplint/test-tools": "5.0.0-alpha.2",
|
|
44
44
|
"json-schema-to-typescript": "15.0.4"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "31ccf1e81443ea3f93597d287595211f1823ddcf"
|
|
47
47
|
}
|