@markuplint/ml-core 2.3.0 → 3.0.0-alpha.66
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/lib/configs.d.ts +1 -1
- package/lib/configs.js +29 -9
- package/lib/index.d.ts +8 -8
- package/lib/index.js +18 -10
- package/lib/ml-core.d.ts +3 -3
- package/lib/ml-core.js +41 -42
- package/lib/ml-dom/document.d.ts +79 -70
- package/lib/ml-dom/helper/accname.d.ts +2 -2
- package/lib/ml-dom/helper/accname.js +2 -3
- package/lib/ml-dom/helper/create-node.d.ts +3 -4
- package/lib/ml-dom/helper/create-node.js +11 -15
- package/lib/ml-dom/helper/debug.d.ts +2 -2
- package/lib/ml-dom/helper/debug.js +35 -21
- package/lib/ml-dom/helper/getIndent.d.ts +5 -5
- package/lib/ml-dom/helper/getIndent.js +14 -14
- package/lib/ml-dom/helper/mapped-nodes.d.ts +51 -3
- package/lib/ml-dom/helper/match-selector.d.ts +10 -6
- package/lib/ml-dom/helper/node-store.d.ts +6 -3
- package/lib/ml-dom/helper/selector.d.ts +4 -4
- package/lib/ml-dom/helper/walkers.d.ts +5 -4
- package/lib/ml-dom/helper/walkers.js +39 -3
- package/lib/ml-dom/index.d.ts +8 -3
- package/lib/ml-dom/index.js +3 -15
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +33 -0
- package/lib/ml-dom/manipulations/child-node-methods.js +73 -0
- package/lib/ml-dom/manipulations/get-children.d.ts +4 -0
- package/lib/ml-dom/manipulations/get-children.js +10 -0
- package/lib/ml-dom/node/attr.d.ts +98 -0
- package/lib/ml-dom/node/attr.js +151 -0
- package/lib/ml-dom/node/block.d.ts +38 -0
- package/lib/ml-dom/node/block.js +53 -0
- package/lib/ml-dom/node/character-data.d.ts +57 -0
- package/lib/ml-dom/node/character-data.js +87 -0
- package/lib/ml-dom/node/child-node.d.ts +9 -0
- package/lib/ml-dom/node/child-node.js +10 -0
- package/lib/ml-dom/node/comment.d.ts +17 -0
- package/lib/ml-dom/node/comment.js +24 -0
- package/lib/ml-dom/node/document-fragment.d.ts +24 -0
- package/lib/ml-dom/node/document-fragment.js +33 -0
- package/lib/ml-dom/node/document-type.d.ts +38 -0
- package/lib/ml-dom/node/document-type.js +52 -0
- package/lib/ml-dom/node/document.d.ts +1554 -0
- package/lib/ml-dom/node/document.js +2117 -0
- package/lib/ml-dom/node/dom-token-list.d.ts +33 -0
- package/lib/ml-dom/node/dom-token-list.js +137 -0
- package/lib/ml-dom/node/element.d.ts +1825 -0
- package/lib/ml-dom/node/element.js +2462 -0
- package/lib/ml-dom/node/named-node-map.d.ts +42 -0
- package/lib/ml-dom/node/named-node-map.js +64 -0
- package/lib/ml-dom/node/node-list.d.ts +6 -0
- package/lib/ml-dom/node/node-list.js +39 -0
- package/lib/ml-dom/node/node-store.d.ts +14 -0
- package/lib/ml-dom/node/node-store.js +32 -0
- package/lib/ml-dom/node/node.d.ts +475 -0
- package/lib/ml-dom/node/node.js +666 -0
- package/lib/ml-dom/node/parent-node.d.ts +66 -0
- package/lib/ml-dom/node/parent-node.js +131 -0
- package/lib/ml-dom/node/rule-mapper.d.ts +17 -0
- package/lib/ml-dom/node/rule-mapper.js +49 -0
- package/lib/ml-dom/node/text.d.ts +51 -0
- package/lib/ml-dom/node/text.js +76 -0
- package/lib/ml-dom/node/types.d.ts +25 -0
- package/lib/ml-dom/node/types.js +2 -0
- package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -0
- package/lib/ml-dom/node/unexpected-call-error.js +5 -0
- package/lib/ml-dom/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/token/token.d.ts +47 -0
- package/lib/ml-dom/token/token.js +89 -0
- package/lib/ml-dom/tokens/abstract-element.d.ts +47 -42
- package/lib/ml-dom/tokens/attribute.d.ts +38 -38
- package/lib/ml-dom/tokens/comment.d.ts +7 -4
- package/lib/ml-dom/tokens/doctype.d.ts +12 -9
- package/lib/ml-dom/tokens/element-close-tag.d.ts +20 -17
- package/lib/ml-dom/tokens/element.d.ts +18 -15
- package/lib/ml-dom/tokens/node.d.ts +38 -31
- package/lib/ml-dom/tokens/omitted-element.d.ts +7 -4
- package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +20 -20
- package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +8 -5
- package/lib/ml-dom/tokens/text.d.ts +13 -9
- package/lib/ml-dom/tokens/token.d.ts +13 -13
- package/lib/ml-dom/types.d.ts +35 -13
- package/lib/ml-rule/ml-rule-context.d.ts +13 -10
- package/lib/ml-rule/ml-rule-context.js +12 -6
- package/lib/ml-rule/ml-rule.d.ts +8 -8
- package/lib/ml-rule/ml-rule.js +62 -62
- package/lib/ml-rule/types.d.ts +11 -1
- package/lib/ruleset/index.d.ts +2 -2
- package/lib/selector/is-pure-html-element.d.ts +1 -0
- package/lib/selector/is-pure-html-element.js +7 -0
- package/lib/selector/match-selector.d.ts +14 -0
- package/lib/selector/match-selector.js +230 -0
- package/lib/selector/selector.d.ts +9 -0
- package/lib/selector/selector.js +561 -0
- package/lib/test/index.d.ts +2 -1
- package/lib/test/index.js +7 -2
- package/package.json +8 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/markuplint-recommended.json +0 -196
|
@@ -3,47 +3,52 @@ import type { MLDOMAttribute, MLDOMElement, MLDOMOmittedElement, MLDOMText } fro
|
|
|
3
3
|
import type MLDOMPreprocessorSpecificAttribute from './preprocessor-specific-attribute';
|
|
4
4
|
import type { MLASTElement, MLASTOmittedElement } from '@markuplint/ml-ast';
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Category } from '@markuplint/ml-spec';
|
|
7
|
+
|
|
7
8
|
import MLDOMNode from './node';
|
|
8
|
-
export default abstract class MLDOMAbstractElement<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
9
|
+
export default abstract class MLDOMAbstractElement<
|
|
10
|
+
T extends RuleConfigValue,
|
|
11
|
+
O = null,
|
|
12
|
+
E extends MLASTElement | MLASTOmittedElement = MLASTElement | MLASTOmittedElement,
|
|
13
|
+
> extends MLDOMNode<T, O, E> {
|
|
14
|
+
#private;
|
|
15
|
+
readonly nodeType = 1;
|
|
16
|
+
readonly nodeName: string;
|
|
17
|
+
readonly attributes: (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
18
|
+
readonly hasSpreadAttr: boolean;
|
|
19
|
+
readonly namespaceURI: string;
|
|
20
|
+
readonly isForeignElement: boolean;
|
|
21
|
+
readonly ownModels: Set<Category>;
|
|
22
|
+
readonly childModels: Set<Category>;
|
|
23
|
+
readonly descendantModels: Set<Category>;
|
|
24
|
+
readonly isCustomElement: boolean;
|
|
25
|
+
readonly isInFragmentDocument: boolean;
|
|
26
|
+
constructor(astNode: E, document: Document<T, O>);
|
|
27
|
+
get tagName(): string;
|
|
28
|
+
get children(): (MLDOMElement<T, O> | MLDOMOmittedElement<T, O>)[];
|
|
29
|
+
get nextElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
30
|
+
get previousElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
31
|
+
get ns(): string;
|
|
32
|
+
get nameWithNS(): string;
|
|
33
|
+
get classList(): string[];
|
|
34
|
+
get id(): string;
|
|
35
|
+
get fixedNodeName(): string;
|
|
36
|
+
get textContent(): string;
|
|
37
|
+
querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
38
|
+
closest(selector: string): MLDOMAbstractElement<T, O> | null;
|
|
39
|
+
getAttributeToken(attrName: string): (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
40
|
+
getAttributeNode(attrName: string): MLDOMAttribute | MLDOMPreprocessorSpecificAttribute;
|
|
41
|
+
getAttribute(attrName: string): string | null;
|
|
42
|
+
hasAttribute(attrName: string): boolean;
|
|
43
|
+
matches(selector: string): boolean;
|
|
44
|
+
fixNodeName(name: string): void;
|
|
45
|
+
getChildElementsAndTextNodeWithoutWhitespaces(): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
46
|
+
/**
|
|
47
|
+
* This element has "Preprocessor Specific Block". In other words, Its children are potentially mutable.
|
|
48
|
+
*/
|
|
49
|
+
hasMutableChildren(attr?: boolean): boolean;
|
|
50
|
+
hasMutableAttributes(): boolean;
|
|
51
|
+
isDescendantByUUIDList(uuidList: string[]): boolean;
|
|
52
|
+
getAccessibleName(): string;
|
|
53
|
+
toNormalizeString(): string;
|
|
49
54
|
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import type { MLASTHTMLAttr, MLToken } from '@markuplint/ml-ast';
|
|
2
2
|
import MLDOMToken from './token';
|
|
3
3
|
export default class MLDOMAttribute extends MLDOMToken<MLASTHTMLAttr> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
readonly nodeType = 2;
|
|
5
|
+
readonly attrType = 'html-attr';
|
|
6
|
+
readonly name: MLDOMToken<MLToken>;
|
|
7
|
+
readonly spacesBeforeName: MLDOMToken<MLToken>;
|
|
8
|
+
readonly spacesBeforeEqual: MLDOMToken<MLToken>;
|
|
9
|
+
readonly equal: MLDOMToken<MLToken>;
|
|
10
|
+
readonly spacesAfterEqual: MLDOMToken<MLToken>;
|
|
11
|
+
readonly startQuote: MLDOMToken<MLToken>;
|
|
12
|
+
readonly valueNode: MLDOMToken<MLToken>;
|
|
13
|
+
readonly endQuote: MLDOMToken<MLToken>;
|
|
14
|
+
readonly isDynamicValue?: true;
|
|
15
|
+
readonly isDirective?: true;
|
|
16
|
+
readonly potentialName: string;
|
|
17
|
+
readonly candidate?: string;
|
|
18
|
+
readonly isDuplicatable: boolean;
|
|
19
|
+
constructor(astToken: MLASTHTMLAttr);
|
|
20
|
+
get raw(): string;
|
|
21
|
+
get startOffset(): number;
|
|
22
|
+
get endOffset(): number;
|
|
23
|
+
get startLine(): number;
|
|
24
|
+
get endLine(): number;
|
|
25
|
+
get startCol(): number;
|
|
26
|
+
get endCol(): number;
|
|
27
|
+
get value(): string;
|
|
28
|
+
getName(): {
|
|
29
|
+
line: number;
|
|
30
|
+
col: number;
|
|
31
|
+
potential: string;
|
|
32
|
+
raw: string;
|
|
33
|
+
};
|
|
34
|
+
getValue(): {
|
|
35
|
+
line: number;
|
|
36
|
+
col: number;
|
|
37
|
+
potential: string;
|
|
38
|
+
raw: string;
|
|
39
|
+
};
|
|
40
|
+
toString(withSpace?: boolean): string;
|
|
41
|
+
toNormalizeString(): string;
|
|
42
42
|
}
|
|
@@ -2,8 +2,11 @@ import type { IMLDOMComment } from '../types';
|
|
|
2
2
|
import type { MLASTComment } from '@markuplint/ml-ast';
|
|
3
3
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import MLDOMNode from './node';
|
|
5
|
-
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
+
extends MLDOMNode<T, O, MLASTComment>
|
|
7
|
+
implements IMLDOMComment
|
|
8
|
+
{
|
|
9
|
+
readonly nodeType = 8;
|
|
10
|
+
readonly type = 'Comment';
|
|
11
|
+
get textContent(): string;
|
|
9
12
|
}
|
|
@@ -3,13 +3,16 @@ import type { IMLDOMDoctype } from '../types';
|
|
|
3
3
|
import type { MLASTDoctype, MLASTNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMNode from './node';
|
|
6
|
-
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMNode<T, O, MLASTNode>
|
|
8
|
+
implements IMLDOMDoctype
|
|
9
|
+
{
|
|
10
|
+
#private;
|
|
11
|
+
readonly nodeType = 10;
|
|
12
|
+
readonly type = 'Doctype';
|
|
13
|
+
constructor(astNode: MLASTDoctype, document: Document<T, O>);
|
|
14
|
+
get name(): string;
|
|
15
|
+
get publicId(): string;
|
|
16
|
+
get systemId(): string;
|
|
17
|
+
get textContent(): null;
|
|
15
18
|
}
|
|
@@ -4,21 +4,24 @@ import type { MLDOMElement } from './';
|
|
|
4
4
|
import type { MLASTElementCloseTag } from '@markuplint/ml-ast';
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import MLDOMNode from './node';
|
|
7
|
-
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
+
extends MLDOMNode<T, O, MLASTElementCloseTag>
|
|
9
|
+
implements IMLDOMElementCloseTag
|
|
10
|
+
{
|
|
11
|
+
#private;
|
|
12
|
+
readonly nodeType = 1;
|
|
13
|
+
readonly type = 'ElementCloseTag';
|
|
14
|
+
readonly nodeName: string;
|
|
15
|
+
readonly startTag: MLDOMElement<T, O>;
|
|
16
|
+
readonly isForeignElement: boolean;
|
|
17
|
+
readonly isCustomElement: boolean;
|
|
18
|
+
constructor(astNode: MLASTElementCloseTag, document: Document<T, O>, startTag: MLDOMElement<T, O>);
|
|
19
|
+
get raw(): string;
|
|
20
|
+
get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
|
|
21
|
+
fixNodeName(name: string): void;
|
|
22
|
+
getNameLocation(): {
|
|
23
|
+
offset: number;
|
|
24
|
+
line: number;
|
|
25
|
+
col: number;
|
|
26
|
+
};
|
|
24
27
|
}
|
|
@@ -5,19 +5,22 @@ import type { MLASTElement, MLToken } from '@markuplint/ml-ast';
|
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import MLDOMAbstractElement from './abstract-element';
|
|
7
7
|
import MLDOMToken from './token';
|
|
8
|
-
export default class MLDOMElement<T extends RuleConfigValue, O = null>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
export default class MLDOMElement<T extends RuleConfigValue, O = null>
|
|
9
|
+
extends MLDOMAbstractElement<T, O, MLASTElement>
|
|
10
|
+
implements IMLDOMElement
|
|
11
|
+
{
|
|
12
|
+
#private;
|
|
13
|
+
readonly type = 'Element';
|
|
14
|
+
readonly hasSpreadAttr: boolean;
|
|
15
|
+
readonly closeTag: MLDOMElementCloseTag<T, O> | null;
|
|
16
|
+
readonly selfClosingSolidus: MLDOMToken<MLToken> | null;
|
|
17
|
+
readonly endSpace: MLDOMToken<MLToken> | null;
|
|
18
|
+
constructor(astNode: MLASTElement, document: Document<T, O>);
|
|
19
|
+
get raw(): string;
|
|
20
|
+
querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
21
|
+
getNameLocation(): {
|
|
22
|
+
offset: number;
|
|
23
|
+
line: number;
|
|
24
|
+
col: number;
|
|
25
|
+
};
|
|
23
26
|
}
|
|
@@ -5,35 +5,42 @@ import type { MLDOMElement, MLDOMOmittedElement, MLDOMPreprocessorSpecificBlock
|
|
|
5
5
|
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
6
6
|
import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
|
|
7
7
|
import MLDOMToken from './token';
|
|
8
|
-
export default abstract class MLDOMNode<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
export default abstract class MLDOMNode<
|
|
9
|
+
T extends RuleConfigValue,
|
|
10
|
+
O = null,
|
|
11
|
+
A extends MLASTAbstructNode = MLASTAbstructNode,
|
|
12
|
+
>
|
|
13
|
+
extends MLDOMToken<A>
|
|
14
|
+
implements IMLDOMNode
|
|
15
|
+
{
|
|
16
|
+
#private;
|
|
17
|
+
readonly ELEMENT_NODE = 1;
|
|
18
|
+
readonly ATTRIBUTE_NODE = 2;
|
|
19
|
+
readonly TEXT_NODE = 3;
|
|
20
|
+
readonly CDATA_SECTION_NODE = 4;
|
|
21
|
+
readonly ENTITY_REFERENCE_NODE = 5;
|
|
22
|
+
readonly ENTITY_NODE = 6;
|
|
23
|
+
readonly PROCESSING_INSTRUCTION_NODE = 7;
|
|
24
|
+
readonly COMMENT_NODE = 8;
|
|
25
|
+
readonly DOCUMENT_NODE = 9;
|
|
26
|
+
readonly DOCUMENT_TYPE_NODE = 10;
|
|
27
|
+
readonly DOCUMENT_FRAGMENT_NODE = 11;
|
|
28
|
+
readonly NOTATION_NODE = 12;
|
|
29
|
+
readonly ownerDocument: Document<T, O>;
|
|
30
|
+
readonly type: NodeType;
|
|
31
|
+
readonly rules: Record<string, AnyRule>;
|
|
32
|
+
protected _astToken: A;
|
|
33
|
+
constructor(astNode: A, document: Document<T, O>);
|
|
34
|
+
get childNodes(): AnonymousNode<T, O>[];
|
|
35
|
+
get parentNode(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
|
|
36
|
+
get prevNode(): AnonymousNode<T, O> | null;
|
|
37
|
+
get nextNode(): AnonymousNode<T, O> | null;
|
|
38
|
+
get syntaxicalParentNode(): MLDOMElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
|
|
39
|
+
get prevToken(): AnonymousNode<T, O> | null;
|
|
40
|
+
get nodeStore(): import('../helper').NodeStore;
|
|
41
|
+
get rule(): RuleInfo<T, O>;
|
|
42
|
+
get textContent(): string | null;
|
|
43
|
+
getParentElement(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
44
|
+
is(type: NodeType): boolean;
|
|
45
|
+
toString(): string;
|
|
39
46
|
}
|
|
@@ -3,8 +3,11 @@ import type { IMLDOMOmittedElement } from '../types';
|
|
|
3
3
|
import type { MLASTOmittedElement } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMAbstractElement from './abstract-element';
|
|
6
|
-
export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMAbstractElement<T, O, MLASTOmittedElement>
|
|
8
|
+
implements IMLDOMOmittedElement
|
|
9
|
+
{
|
|
10
|
+
readonly type = 'OmittedElement';
|
|
11
|
+
obsolete: boolean;
|
|
12
|
+
constructor(astNode: MLASTOmittedElement, document: Document<T, O>);
|
|
10
13
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { MLASTPreprocessorSpecificAttr } from '@markuplint/ml-ast';
|
|
2
2
|
import MLDOMToken from './token';
|
|
3
3
|
export default class MLDOMPreprocessorSpecificAttribute extends MLDOMToken<MLASTPreprocessorSpecificAttr> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
readonly attrType = 'ps-attr';
|
|
5
|
+
readonly potentialName: string;
|
|
6
|
+
readonly potentialValue: string;
|
|
7
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
8
|
+
readonly isDuplicatable: boolean;
|
|
9
|
+
constructor(astToken: MLASTPreprocessorSpecificAttr);
|
|
10
|
+
getName(): {
|
|
11
|
+
line: number;
|
|
12
|
+
col: number;
|
|
13
|
+
potential: string;
|
|
14
|
+
raw: string;
|
|
15
|
+
};
|
|
16
|
+
getValue(): {
|
|
17
|
+
line: number;
|
|
18
|
+
col: number;
|
|
19
|
+
potential: string;
|
|
20
|
+
raw: string;
|
|
21
|
+
};
|
|
22
|
+
toString(): string;
|
|
23
|
+
toNormalizeString(): string;
|
|
24
24
|
}
|
|
@@ -3,9 +3,12 @@ import type { IMLDOMPreprocessorSpecificBlock } from '../types';
|
|
|
3
3
|
import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMNode from './node';
|
|
6
|
-
export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMNode<T, O, MLASTPreprocessorSpecificBlock>
|
|
8
|
+
implements IMLDOMPreprocessorSpecificBlock
|
|
9
|
+
{
|
|
10
|
+
readonly type = 'PSBlock';
|
|
11
|
+
readonly nodeName: string;
|
|
12
|
+
constructor(astNode: MLASTPreprocessorSpecificBlock, document: Document<T, O>);
|
|
13
|
+
get childNodes(): AnonymousNode<T, O>[];
|
|
11
14
|
}
|
|
@@ -2,14 +2,18 @@ import type { Document } from '../';
|
|
|
2
2
|
import type { IMLDOMText } from '../types';
|
|
3
3
|
import type { MLASTText } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Category } from '@markuplint/ml-spec';
|
|
6
|
+
|
|
6
7
|
import MLDOMNode from './node';
|
|
7
|
-
export default class MLDOMText<T extends RuleConfigValue, O = null>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export default class MLDOMText<T extends RuleConfigValue, O = null>
|
|
9
|
+
extends MLDOMNode<T, O, MLASTText>
|
|
10
|
+
implements IMLDOMText
|
|
11
|
+
{
|
|
12
|
+
readonly nodeType = 3;
|
|
13
|
+
readonly type = 'Text';
|
|
14
|
+
readonly isRawText: boolean;
|
|
15
|
+
readonly ownModels: Set<Category>;
|
|
16
|
+
constructor(astNode: MLASTText, document: Document<T, O>);
|
|
17
|
+
get textContent(): string;
|
|
18
|
+
isWhitespace(): boolean;
|
|
15
19
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { MLToken } from '@markuplint/ml-ast';
|
|
2
2
|
export default class MLDOMToken<A extends MLToken> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
#private;
|
|
4
|
+
readonly uuid: string;
|
|
5
|
+
protected readonly _astToken: A;
|
|
6
|
+
constructor(astToken: A);
|
|
7
|
+
get originRaw(): string;
|
|
8
|
+
get raw(): string;
|
|
9
|
+
get startOffset(): number;
|
|
10
|
+
get endOffset(): number;
|
|
11
|
+
get startLine(): number;
|
|
12
|
+
get endLine(): number;
|
|
13
|
+
get startCol(): number;
|
|
14
|
+
get endCol(): number;
|
|
15
|
+
fix(raw: string): void;
|
|
16
16
|
}
|
package/lib/ml-dom/types.d.ts
CHANGED
|
@@ -1,27 +1,49 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
MLDOMComment,
|
|
3
|
+
MLDOMDoctype,
|
|
4
|
+
MLDOMElement,
|
|
5
|
+
MLDOMElementCloseTag,
|
|
6
|
+
MLDOMOmittedElement,
|
|
7
|
+
MLDOMPreprocessorSpecificBlock,
|
|
8
|
+
MLDOMText,
|
|
9
|
+
} from './tokens';
|
|
2
10
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
11
|
export interface IMLDOMDoctype extends IMLDOMNode {
|
|
4
|
-
|
|
12
|
+
type: 'Doctype';
|
|
5
13
|
}
|
|
6
14
|
export interface IMLDOMElement extends IMLDOMNode {
|
|
7
|
-
|
|
15
|
+
type: 'Element';
|
|
8
16
|
}
|
|
9
17
|
export interface IMLDOMElementCloseTag extends IMLDOMNode {
|
|
10
|
-
|
|
18
|
+
type: 'ElementCloseTag';
|
|
11
19
|
}
|
|
12
20
|
export interface IMLDOMOmittedElement extends IMLDOMNode {
|
|
13
|
-
|
|
21
|
+
type: 'OmittedElement';
|
|
14
22
|
}
|
|
15
23
|
export interface IMLDOMComment extends IMLDOMNode {
|
|
16
|
-
|
|
24
|
+
type: 'Comment';
|
|
17
25
|
}
|
|
18
26
|
export interface IMLDOMText extends IMLDOMNode {
|
|
19
|
-
|
|
27
|
+
type: 'Text';
|
|
20
28
|
}
|
|
21
29
|
export interface IMLDOMPreprocessorSpecificBlock extends IMLDOMNode {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
export interface IMLDOMNode {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
type: 'PSBlock';
|
|
31
|
+
}
|
|
32
|
+
export interface IMLDOMNode {}
|
|
33
|
+
export declare type AnonymousNode<T extends RuleConfigValue, O = null> =
|
|
34
|
+
| MLDOMDoctype<T, O>
|
|
35
|
+
| MLDOMElement<T, O>
|
|
36
|
+
| MLDOMElementCloseTag<T, O>
|
|
37
|
+
| MLDOMOmittedElement<T, O>
|
|
38
|
+
| MLDOMComment<T, O>
|
|
39
|
+
| MLDOMPreprocessorSpecificBlock<T, O>
|
|
40
|
+
| MLDOMText<T, O>;
|
|
41
|
+
export declare type NodeType =
|
|
42
|
+
| 'Doctype'
|
|
43
|
+
| 'Element'
|
|
44
|
+
| 'ElementCloseTag'
|
|
45
|
+
| 'OmittedElement'
|
|
46
|
+
| 'Comment'
|
|
47
|
+
| 'Text'
|
|
48
|
+
| 'Node'
|
|
49
|
+
| 'PSBlock';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { MLDocument } from '../ml-dom/node/document';
|
|
2
|
+
import type { CheckerReport } from './types';
|
|
2
3
|
import type { LocaleSet, Translator } from '@markuplint/i18n';
|
|
3
|
-
import type { Report, RuleConfigValue
|
|
4
|
+
import type { Report, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
5
|
export declare class MLRuleContext<T extends RuleConfigValue, O = null> {
|
|
5
6
|
#private;
|
|
6
|
-
readonly document:
|
|
7
|
-
readonly globalRule: RuleInfo<T, O>;
|
|
8
|
-
readonly translate: Translator;
|
|
7
|
+
readonly document: MLDocument<T, O>;
|
|
9
8
|
readonly locale: string;
|
|
10
|
-
|
|
9
|
+
readonly translate: Translator;
|
|
11
10
|
get reports(): ({
|
|
12
11
|
message: string;
|
|
13
12
|
line: number;
|
|
@@ -23,12 +22,11 @@ export declare class MLRuleContext<T extends RuleConfigValue, O = null> {
|
|
|
23
22
|
col: number;
|
|
24
23
|
raw: string;
|
|
25
24
|
})[];
|
|
26
|
-
|
|
25
|
+
constructor(document: MLDocument<T, O>, locale: LocaleSet);
|
|
27
26
|
provide(): {
|
|
28
|
-
document:
|
|
27
|
+
document: MLDocument<T, O>;
|
|
29
28
|
translate: Translator;
|
|
30
29
|
t: Translator;
|
|
31
|
-
globalRule: RuleInfo<T, O>;
|
|
32
30
|
reports: ({
|
|
33
31
|
message: string;
|
|
34
32
|
line: number;
|
|
@@ -44,6 +42,11 @@ export declare class MLRuleContext<T extends RuleConfigValue, O = null> {
|
|
|
44
42
|
col: number;
|
|
45
43
|
raw: string;
|
|
46
44
|
})[];
|
|
47
|
-
report:
|
|
45
|
+
report: {
|
|
46
|
+
(report: Report<T, O>): undefined;
|
|
47
|
+
(report: CheckerReport<T, O>): boolean;
|
|
48
|
+
};
|
|
48
49
|
};
|
|
50
|
+
report(report: Report<T, O>): undefined;
|
|
51
|
+
report(report: CheckerReport<T, O>): boolean;
|
|
49
52
|
}
|