@markuplint/ml-core 3.10.0 → 3.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.
- package/lib/index.d.ts +1 -11
- package/lib/ml-core.d.ts +11 -22
- package/lib/ml-dom/helper/create-node.d.ts +1 -5
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/walkers.d.ts +4 -14
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +5 -18
- package/lib/ml-dom/manipulations/get-children.d.ts +1 -3
- package/lib/ml-dom/node/attr.d.ts +90 -93
- package/lib/ml-dom/node/block.d.ts +31 -35
- package/lib/ml-dom/node/character-data.d.ts +52 -59
- package/lib/ml-dom/node/child-node.d.ts +2 -9
- package/lib/ml-dom/node/comment.d.ts +12 -15
- package/lib/ml-dom/node/document-fragment.d.ts +19 -22
- package/lib/ml-dom/node/document-type.d.ts +31 -34
- package/lib/ml-dom/node/document.d.ts +1583 -1600
- package/lib/ml-dom/node/document.js +12 -1
- package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
- package/lib/ml-dom/node/element.d.ts +1904 -1902
- package/lib/ml-dom/node/element.js +17 -1
- package/lib/ml-dom/node/named-node-map.d.ts +39 -44
- package/lib/ml-dom/node/node-list.d.ts +3 -9
- package/lib/ml-dom/node/node-store.d.ts +3 -8
- package/lib/ml-dom/node/node-store.js +1 -1
- package/lib/ml-dom/node/node.d.ts +471 -491
- package/lib/ml-dom/node/parent-node.d.ts +57 -66
- package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/node/text.d.ts +46 -49
- package/lib/ml-dom/node/types.d.ts +12 -80
- package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
- package/lib/ml-dom/token/token.d.ts +44 -44
- package/lib/ml-rule/create-rule.d.ts +1 -3
- package/lib/ml-rule/create-test-rule.d.ts +3 -5
- package/lib/ml-rule/ml-rule-context.d.ts +47 -55
- package/lib/ml-rule/ml-rule.d.ts +23 -33
- package/lib/ml-rule/ml-rule.js +5 -1
- package/lib/ml-rule/types.d.ts +13 -31
- package/lib/plugin/plugin.d.ts +1 -3
- package/lib/plugin/types.d.ts +5 -5
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +7 -19
- package/lib/types.d.ts +8 -8
- package/lib/utils/get-location-from-chars.d.ts +4 -9
- package/package.json +14 -14
- package/test/ml-dom/ml-rule/create-rule.spec.js +108 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';
|
|
2
|
-
export {
|
|
3
|
-
ariaSpecs,
|
|
4
|
-
contentModelCategoryToTagNames,
|
|
5
|
-
getAttrSpecs,
|
|
6
|
-
getComputedRole,
|
|
7
|
-
getImplicitRole,
|
|
8
|
-
getPermittedRoles,
|
|
9
|
-
getRoleSpec,
|
|
10
|
-
getSpec,
|
|
11
|
-
resolveNamespace,
|
|
12
|
-
} from '@markuplint/ml-spec';
|
|
2
|
+
export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
|
|
13
3
|
export { default as Ruleset } from './ruleset';
|
|
14
4
|
export { enableDebug } from './debug';
|
|
15
5
|
export { getIndent } from './ml-dom/helper/getIndent';
|
package/lib/ml-core.d.ts
CHANGED
|
@@ -3,28 +3,17 @@ import type { PlainData, RuleConfigValue, Violation } from '@markuplint/ml-confi
|
|
|
3
3
|
import { ParserError } from '@markuplint/parser-utils';
|
|
4
4
|
import { Document } from './ml-dom';
|
|
5
5
|
export type MLCoreParams = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly sourceCode: string;
|
|
7
|
+
readonly filename: string;
|
|
8
|
+
readonly debug?: boolean;
|
|
9
9
|
} & MLFabric;
|
|
10
10
|
export declare class MLCore {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
parserOptions,
|
|
20
|
-
pretenders,
|
|
21
|
-
filename,
|
|
22
|
-
debug,
|
|
23
|
-
}: MLCoreParams);
|
|
24
|
-
get document(): ParserError | Document<RuleConfigValue, PlainData>;
|
|
25
|
-
setCode(sourceCode: string): void;
|
|
26
|
-
update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;
|
|
27
|
-
verify(fix?: boolean): Promise<Violation[]>;
|
|
28
|
-
private _createDocument;
|
|
29
|
-
private _parse;
|
|
11
|
+
#private;
|
|
12
|
+
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }: MLCoreParams);
|
|
13
|
+
get document(): ParserError | Document<RuleConfigValue, PlainData>;
|
|
14
|
+
setCode(sourceCode: string): void;
|
|
15
|
+
update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;
|
|
16
|
+
verify(fix?: boolean): Promise<Violation[]>;
|
|
17
|
+
private _createDocument;
|
|
18
|
+
private _parse;
|
|
30
19
|
}
|
|
@@ -2,8 +2,4 @@ import type { MLDocument } from '../node/document';
|
|
|
2
2
|
import type { MappedNode } from '../node/types';
|
|
3
3
|
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
5
|
-
export declare function createNode<
|
|
6
|
-
N extends MLASTAbstractNode,
|
|
7
|
-
T extends RuleConfigValue,
|
|
8
|
-
O extends PlainData = undefined,
|
|
9
|
-
>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;
|
|
5
|
+
export declare function createNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O extends PlainData = undefined>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;
|
|
@@ -7,12 +7,12 @@ import type { MLText } from '../node/text';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function getIndent(node: MLNode<any, any>): MLDOMIndentation | null;
|
|
9
9
|
declare class MLDOMIndentation {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
#private;
|
|
11
|
+
readonly line: number;
|
|
12
|
+
constructor(originTextNode: MLText<any, any>, raw: string, line: number, parentNode: MLNode<any, any>);
|
|
13
|
+
get raw(): string;
|
|
14
|
+
get type(): 'tab' | 'space' | 'mixed' | 'none';
|
|
15
|
+
get width(): number;
|
|
16
|
+
fix(raw: string): void;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import type { MLNode } from '../node/node';
|
|
2
2
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
-
export type Walker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
node: N,
|
|
8
|
-
) => void;
|
|
9
|
-
export declare function syncWalk<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
10
|
-
nodeList: ReadonlyArray<MLNode<T, O>>,
|
|
11
|
-
walker: SyncWalker<T, O>,
|
|
12
|
-
): void;
|
|
13
|
-
export declare function sequentialWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>>(
|
|
14
|
-
list: ReadonlyArray<N>,
|
|
15
|
-
walker: Walker<T, O, N>,
|
|
16
|
-
): Promise<void>;
|
|
3
|
+
export type Walker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (node: N) => void | Promise<void> | Promise<void>[];
|
|
4
|
+
export type SyncWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (node: N) => void;
|
|
5
|
+
export declare function syncWalk<T extends RuleConfigValue, O extends PlainData = undefined>(nodeList: ReadonlyArray<MLNode<T, O>>, walker: SyncWalker<T, O>): void;
|
|
6
|
+
export declare function sequentialWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>>(list: ReadonlyArray<N>, walker: Walker<T, O, N>): Promise<void>;
|
|
@@ -5,26 +5,17 @@ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-before%E2%91%A0
|
|
7
7
|
*/
|
|
8
|
-
export declare function before<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
9
|
-
node: MLNode<T, O>,
|
|
10
|
-
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
11
|
-
): void;
|
|
8
|
+
export declare function before<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
14
11
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-after%E2%91%A0
|
|
15
12
|
*/
|
|
16
|
-
export declare function after<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
17
|
-
node: MLNode<T, O>,
|
|
18
|
-
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
19
|
-
): void;
|
|
13
|
+
export declare function after<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
|
|
20
14
|
/**
|
|
21
15
|
*
|
|
22
16
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-replacewith%E2%91%A0
|
|
23
17
|
*/
|
|
24
|
-
export declare function replaceWith<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
25
|
-
node: MLNode<T, O>,
|
|
26
|
-
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
27
|
-
): void;
|
|
18
|
+
export declare function replaceWith<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
|
|
28
19
|
/**
|
|
29
20
|
*
|
|
30
21
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-remove%E2%91%A0
|
|
@@ -34,13 +25,9 @@ export declare function remove<T extends RuleConfigValue, O extends PlainData =
|
|
|
34
25
|
*
|
|
35
26
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A0
|
|
36
27
|
*/
|
|
37
|
-
export declare function previousElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
38
|
-
node: MLNode<T, O>,
|
|
39
|
-
): MLElement<T, O> | null;
|
|
28
|
+
export declare function previousElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>): MLElement<T, O> | null;
|
|
40
29
|
/**
|
|
41
30
|
*
|
|
42
31
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A0
|
|
43
32
|
*/
|
|
44
|
-
export declare function nextElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
45
|
-
node: MLNode<T, O>,
|
|
46
|
-
): MLElement<T, O> | null;
|
|
33
|
+
export declare function nextElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>): MLElement<T, O> | null;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { MLElement } from '../node/element';
|
|
2
2
|
import type { MLNode } from '../node/node';
|
|
3
3
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
|
-
export declare function getChildren<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
5
|
-
node: MLNode<T, O>,
|
|
6
|
-
): HTMLCollectionOf<MLElement<T, O>>;
|
|
4
|
+
export declare function getChildren<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>): HTMLCollectionOf<MLElement<T, O>>;
|
|
@@ -5,97 +5,94 @@ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
|
5
5
|
import { MLToken } from '../token/token';
|
|
6
6
|
import { MLDomTokenList } from './dom-token-list';
|
|
7
7
|
import { MLNode } from './node';
|
|
8
|
-
export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
99
|
-
*/
|
|
100
|
-
toNormalizeString(): string;
|
|
8
|
+
export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<T, O, MLASTAttr> implements Attr {
|
|
9
|
+
#private;
|
|
10
|
+
readonly candidate?: string;
|
|
11
|
+
readonly endQuote: MLToken | null;
|
|
12
|
+
readonly equal: MLToken | null;
|
|
13
|
+
readonly isDirective?: true;
|
|
14
|
+
readonly isDuplicatable: boolean;
|
|
15
|
+
readonly isDynamicValue?: true;
|
|
16
|
+
readonly nameNode: MLToken | null;
|
|
17
|
+
/**
|
|
18
|
+
* @implements DOM API: `Attr`
|
|
19
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
|
|
20
|
+
*/
|
|
21
|
+
readonly ownerElement: MLElement<T, O>;
|
|
22
|
+
readonly spacesAfterEqual: MLToken | null;
|
|
23
|
+
readonly spacesBeforeEqual: MLToken | null;
|
|
24
|
+
readonly spacesBeforeName: MLToken | null;
|
|
25
|
+
readonly startQuote: MLToken | null;
|
|
26
|
+
readonly valueNode: MLToken | null;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the "string" if HTML syntax. Otherwise, returns a type in its syntax.
|
|
29
|
+
*
|
|
30
|
+
* @default "string"
|
|
31
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
32
|
+
*/
|
|
33
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
34
|
+
constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
|
|
35
|
+
/**
|
|
36
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
37
|
+
*
|
|
38
|
+
* @unsupported
|
|
39
|
+
* @implements DOM API: `Attr`
|
|
40
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
|
|
41
|
+
*/
|
|
42
|
+
get localName(): string;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @implements DOM API: `Attr`
|
|
46
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-name
|
|
47
|
+
*/
|
|
48
|
+
get name(): string;
|
|
49
|
+
/**
|
|
50
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
51
|
+
*
|
|
52
|
+
* @unsupported
|
|
53
|
+
* @implements DOM API: `Attr`
|
|
54
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
|
|
55
|
+
*/
|
|
56
|
+
get namespaceURI(): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a string appropriate for the type of node as `Attr`
|
|
59
|
+
*
|
|
60
|
+
* @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
|
|
61
|
+
*/
|
|
62
|
+
get nodeName(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Returns a number appropriate for the type of `Attr`
|
|
65
|
+
*/
|
|
66
|
+
get nodeType(): AttributeNodeType;
|
|
67
|
+
get nodeValue(): string;
|
|
68
|
+
/**
|
|
69
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
70
|
+
*
|
|
71
|
+
* @unsupported
|
|
72
|
+
* @implements DOM API: `Attr`
|
|
73
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
|
|
74
|
+
*/
|
|
75
|
+
get prefix(): string | null;
|
|
76
|
+
/**
|
|
77
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
78
|
+
*/
|
|
79
|
+
get rule(): import("@markuplint/ml-config").RuleInfo<T, O>;
|
|
80
|
+
/**
|
|
81
|
+
* @implements DOM API: `Attr`
|
|
82
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-specified
|
|
83
|
+
*/
|
|
84
|
+
get specified(): true;
|
|
85
|
+
/**
|
|
86
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
87
|
+
*/
|
|
88
|
+
get tokenList(): MLDomTokenList | null;
|
|
89
|
+
/**
|
|
90
|
+
* @implements DOM API: `Attr`
|
|
91
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-value
|
|
92
|
+
*/
|
|
93
|
+
get value(): string;
|
|
94
|
+
/**
|
|
95
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
96
|
+
*/
|
|
97
|
+
toNormalizeString(): string;
|
|
101
98
|
}
|
|
@@ -4,39 +4,35 @@ import type { MarkuplintPreprocessorBlockType } from './types';
|
|
|
4
4
|
import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
|
|
5
5
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import { MLNode } from './node';
|
|
7
|
-
export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<
|
|
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
|
-
* @implements DOM API: `ChildNode`
|
|
40
|
-
*/
|
|
41
|
-
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
7
|
+
export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<T, O, MLASTPreprocessorSpecificBlock> {
|
|
8
|
+
readonly isTransparent: boolean;
|
|
9
|
+
constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
|
|
10
|
+
/**
|
|
11
|
+
* Returns a string appropriate for the type of node as `MLBlock`
|
|
12
|
+
*
|
|
13
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
14
|
+
*/
|
|
15
|
+
get nodeName(): "#ml-block";
|
|
16
|
+
/**
|
|
17
|
+
* Returns a number appropriate for the type of `MLBlock`
|
|
18
|
+
*
|
|
19
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
20
|
+
*/
|
|
21
|
+
get nodeType(): MarkuplintPreprocessorBlockType;
|
|
22
|
+
/**
|
|
23
|
+
* @implements DOM API: `ChildNode`
|
|
24
|
+
*/
|
|
25
|
+
after(...nodes: (string | MLElement<any, any>)[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* @implements DOM API: `ChildNode`
|
|
28
|
+
*/
|
|
29
|
+
before(...nodes: (string | MLElement<any, any>)[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* @implements DOM API: `ChildNode`
|
|
32
|
+
*/
|
|
33
|
+
remove(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @implements DOM API: `ChildNode`
|
|
36
|
+
*/
|
|
37
|
+
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
42
38
|
}
|
|
@@ -2,63 +2,56 @@ import type { MLElement } from './element';
|
|
|
2
2
|
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
|
|
3
3
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLNode } from './node';
|
|
5
|
-
export declare abstract class MLCharacterData<
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
remove(): void;
|
|
58
|
-
replaceData(offset: number, count: number, data: string): void;
|
|
59
|
-
/**
|
|
60
|
-
* @implements DOM API: `CharacterData`
|
|
61
|
-
*/
|
|
62
|
-
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
63
|
-
substringData(offset: number, count: number): string;
|
|
5
|
+
export declare abstract class MLCharacterData<T extends RuleConfigValue, O extends PlainData = undefined, A extends MLASTAbstractNode = MLASTAbstractNode> extends MLNode<T, O, A> implements CharacterData {
|
|
6
|
+
/**
|
|
7
|
+
* @implements DOM API: `CharacterData`
|
|
8
|
+
* @see https://dom.spec.whatwg.org/#dom-characterdata-data
|
|
9
|
+
*/
|
|
10
|
+
get data(): string;
|
|
11
|
+
/**
|
|
12
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
13
|
+
*
|
|
14
|
+
* @unsupported
|
|
15
|
+
* @implements DOM API: `CharacterData`
|
|
16
|
+
* @see https://dom.spec.whatwg.org/#dom-characterdata-length
|
|
17
|
+
*/
|
|
18
|
+
get length(): number;
|
|
19
|
+
/**
|
|
20
|
+
* The element immediately following the specified one in its parent's children list.
|
|
21
|
+
*
|
|
22
|
+
* @readonly
|
|
23
|
+
* @implements DOM API: `CharacterData`
|
|
24
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A1
|
|
25
|
+
*/
|
|
26
|
+
get nextElementSibling(): MLElement<T, O> | null;
|
|
27
|
+
get nodeValue(): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The element immediately prior the specified one in its parent's children list.
|
|
30
|
+
*
|
|
31
|
+
* @readonly
|
|
32
|
+
* @implements DOM API: `CharacterData`
|
|
33
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A1
|
|
34
|
+
*/
|
|
35
|
+
get previousElementSibling(): MLElement<T, O> | null;
|
|
36
|
+
/**
|
|
37
|
+
* @implements DOM API: `CharacterData`
|
|
38
|
+
*/
|
|
39
|
+
after(...nodes: (string | MLElement<any, any>)[]): void;
|
|
40
|
+
appendData(data: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* @implements DOM API: `CharacterData`
|
|
43
|
+
*/
|
|
44
|
+
before(...nodes: (string | MLElement<any, any>)[]): void;
|
|
45
|
+
deleteData(offset: number, count: number): void;
|
|
46
|
+
insertData(offset: number, data: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* @implements DOM API: `CharacterData`
|
|
49
|
+
*/
|
|
50
|
+
remove(): void;
|
|
51
|
+
replaceData(offset: number, count: number, data: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* @implements DOM API: `CharacterData`
|
|
54
|
+
*/
|
|
55
|
+
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
56
|
+
substringData(offset: number, count: number): string;
|
|
64
57
|
}
|
|
@@ -5,12 +5,5 @@ import type { MLElement } from './element';
|
|
|
5
5
|
import type { MLNode } from './node';
|
|
6
6
|
import type { MLText } from './text';
|
|
7
7
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
8
|
-
export type MLChildNode<T extends RuleConfigValue, O extends PlainData = undefined> =
|
|
9
|
-
|
|
10
|
-
| MLCharacterData<T, O>
|
|
11
|
-
| MLText<T, O>
|
|
12
|
-
| MLElement<T, O>
|
|
13
|
-
| MLBlock<T, O>;
|
|
14
|
-
export declare function isChildNode<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
15
|
-
node: MLNode<T, O>,
|
|
16
|
-
): node is MLChildNode<T, O>;
|
|
8
|
+
export type MLChildNode<T extends RuleConfigValue, O extends PlainData = undefined> = MLDocumentType<T, O> | MLCharacterData<T, O> | MLText<T, O> | MLElement<T, O> | MLBlock<T, O>;
|
|
9
|
+
export declare function isChildNode<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>): node is MLChildNode<T, O>;
|
|
@@ -2,19 +2,16 @@ import type { CommentNodeType } from './types';
|
|
|
2
2
|
import type { MLASTComment } from '@markuplint/ml-ast';
|
|
3
3
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import { MLCharacterData } from './character-data';
|
|
5
|
-
export declare class MLComment<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
get nodeType(): CommentNodeType;
|
|
19
|
-
get textContent(): string | null;
|
|
5
|
+
export declare class MLComment<T extends RuleConfigValue, O extends PlainData = undefined> extends MLCharacterData<T, O, MLASTComment> implements Comment {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a string appropriate for the type of node as `Attr`
|
|
8
|
+
*
|
|
9
|
+
* @see https://dom.spec.whatwg.org/#ref-for-exclusive-text-node%E2%91%A0
|
|
10
|
+
*/
|
|
11
|
+
get nodeName(): "#comment";
|
|
12
|
+
/**
|
|
13
|
+
* Returns a number appropriate for the type of `Comment`
|
|
14
|
+
*/
|
|
15
|
+
get nodeType(): CommentNodeType;
|
|
16
|
+
get textContent(): string | null;
|
|
20
17
|
}
|