@markuplint/ml-core 3.3.0 → 3.4.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 (45) hide show
  1. package/lib/index.d.ts +11 -1
  2. package/lib/ml-core.d.ts +22 -11
  3. package/lib/ml-dom/helper/create-node.d.ts +4 -1
  4. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  5. package/lib/ml-dom/helper/walkers.d.ts +11 -3
  6. package/lib/ml-dom/helper/walkers.js +1 -0
  7. package/lib/ml-dom/manipulations/child-node-methods.d.ts +18 -5
  8. package/lib/ml-dom/manipulations/get-children.d.ts +3 -1
  9. package/lib/ml-dom/node/attr.d.ts +89 -89
  10. package/lib/ml-dom/node/block.d.ts +30 -30
  11. package/lib/ml-dom/node/character-data.d.ts +59 -52
  12. package/lib/ml-dom/node/child-node.d.ts +6 -1
  13. package/lib/ml-dom/node/comment.d.ts +15 -12
  14. package/lib/ml-dom/node/document-fragment.d.ts +22 -19
  15. package/lib/ml-dom/node/document-type.d.ts +34 -31
  16. package/lib/ml-dom/node/document.d.ts +1600 -1586
  17. package/lib/ml-dom/node/document.js +12 -0
  18. package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
  19. package/lib/ml-dom/node/dom-token-list.js +5 -5
  20. package/lib/ml-dom/node/element.d.ts +1894 -1888
  21. package/lib/ml-dom/node/named-node-map.d.ts +44 -39
  22. package/lib/ml-dom/node/named-node-map.js +2 -1
  23. package/lib/ml-dom/node/node-list.d.ts +9 -3
  24. package/lib/ml-dom/node/node-list.js +17 -2
  25. package/lib/ml-dom/node/node-store.d.ts +3 -3
  26. package/lib/ml-dom/node/node.d.ts +492 -472
  27. package/lib/ml-dom/node/node.js +4 -2
  28. package/lib/ml-dom/node/parent-node.d.ts +66 -57
  29. package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
  30. package/lib/ml-dom/node/rule-mapper.js +3 -0
  31. package/lib/ml-dom/node/text.d.ts +49 -46
  32. package/lib/ml-dom/node/types.d.ts +67 -11
  33. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
  34. package/lib/ml-dom/token/token.d.ts +44 -44
  35. package/lib/ml-rule/create-test-rule.d.ts +5 -3
  36. package/lib/ml-rule/ml-rule-context.d.ts +56 -48
  37. package/lib/ml-rule/ml-rule.d.ts +25 -23
  38. package/lib/ml-rule/types.d.ts +19 -13
  39. package/lib/plugin/types.d.ts +5 -5
  40. package/lib/ruleset/index.d.ts +4 -4
  41. package/lib/test/index.d.ts +19 -7
  42. package/lib/test/index.js +1 -1
  43. package/lib/types.d.ts +7 -7
  44. package/lib/utils/get-location-from-chars.d.ts +9 -4
  45. package/package.json +9 -7
package/lib/index.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';
2
- export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
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';
3
13
  export { default as Ruleset } from './ruleset';
4
14
  export { enableDebug } from './debug';
5
15
  export { getIndent } from './ml-dom/helper/getIndent';
package/lib/ml-core.d.ts CHANGED
@@ -3,17 +3,28 @@ import type { RuleConfigValue, Violation } from '@markuplint/ml-config';
3
3
  import { ParserError } from '@markuplint/parser-utils';
4
4
  import { Document } from './ml-dom';
5
5
  export type MLCoreParams = {
6
- sourceCode: string;
7
- filename: string;
8
- debug?: boolean;
6
+ sourceCode: string;
7
+ filename: string;
8
+ debug?: boolean;
9
9
  } & MLFabric;
10
10
  export declare class MLCore {
11
- #private;
12
- constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }: MLCoreParams);
13
- get document(): ParserError | Document<RuleConfigValue, unknown>;
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;
11
+ #private;
12
+ constructor({
13
+ parser,
14
+ sourceCode,
15
+ ruleset,
16
+ rules,
17
+ locale,
18
+ schemas,
19
+ parserOptions,
20
+ pretenders,
21
+ filename,
22
+ debug,
23
+ }: MLCoreParams);
24
+ get document(): ParserError | Document<RuleConfigValue, unknown>;
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;
19
30
  }
@@ -2,4 +2,7 @@ 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 { RuleConfigValue } from '@markuplint/ml-config';
5
- export declare function createNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O = null>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;
5
+ export declare function createNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O = null>(
6
+ astNode: N,
7
+ document: MLDocument<T, O>,
8
+ ): 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
- #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;
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,6 +1,14 @@
1
1
  import type { MLNode } from '../node/node';
2
2
  import type { RuleConfigValue } from '@markuplint/ml-config';
3
- export type Walker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void | Promise<void> | Promise<void>[];
3
+ export type Walker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (
4
+ node: N,
5
+ ) => void | Promise<void> | Promise<void>[];
4
6
  export type SyncWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void;
5
- export declare function syncWalk<T extends RuleConfigValue, O = null>(nodeList: ReadonlyArray<MLNode<T, O>>, walker: SyncWalker<T, O>): void;
6
- export declare function sequentialWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>>(list: ReadonlyArray<N>, walker: Walker<T, O, N>): Promise<void>;
7
+ export declare function syncWalk<T extends RuleConfigValue, O = null>(
8
+ nodeList: ReadonlyArray<MLNode<T, O>>,
9
+ walker: SyncWalker<T, O>,
10
+ ): void;
11
+ export declare function sequentialWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>>(
12
+ list: ReadonlyArray<N>,
13
+ walker: Walker<T, O, N>,
14
+ ): Promise<void>;
@@ -25,6 +25,7 @@ function sequentialWalker(list, walker) {
25
25
  _reject = reject;
26
26
  });
27
27
  const loop = (index = 0) => {
28
+ // eslint-disable-next-line no-constant-condition
28
29
  while (true) {
29
30
  if (index >= list.length) {
30
31
  _resolve();
@@ -5,17 +5,26 @@ import type { 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 = null>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
8
+ export declare function before<T extends RuleConfigValue, O = null>(
9
+ node: MLNode<T, O>,
10
+ ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
11
+ ): void;
9
12
  /**
10
13
  *
11
14
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-after%E2%91%A0
12
15
  */
13
- export declare function after<T extends RuleConfigValue, O = null>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
16
+ export declare function after<T extends RuleConfigValue, O = null>(
17
+ node: MLNode<T, O>,
18
+ ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
19
+ ): void;
14
20
  /**
15
21
  *
16
22
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-replacewith%E2%91%A0
17
23
  */
18
- export declare function replaceWith<T extends RuleConfigValue, O = null>(node: MLNode<T, O>, ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>): void;
24
+ export declare function replaceWith<T extends RuleConfigValue, O = null>(
25
+ node: MLNode<T, O>,
26
+ ...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
27
+ ): void;
19
28
  /**
20
29
  *
21
30
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-remove%E2%91%A0
@@ -25,9 +34,13 @@ export declare function remove<T extends RuleConfigValue, O = null>(node: MLNode
25
34
  *
26
35
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A0
27
36
  */
28
- export declare function previousElementSibling<T extends RuleConfigValue, O = null>(node: MLNode<T, O>): MLElement<T, O> | null;
37
+ export declare function previousElementSibling<T extends RuleConfigValue, O = null>(
38
+ node: MLNode<T, O>,
39
+ ): MLElement<T, O> | null;
29
40
  /**
30
41
  *
31
42
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A0
32
43
  */
33
- export declare function nextElementSibling<T extends RuleConfigValue, O = null>(node: MLNode<T, O>): MLElement<T, O> | null;
44
+ export declare function nextElementSibling<T extends RuleConfigValue, O = null>(
45
+ node: MLNode<T, O>,
46
+ ): MLElement<T, O> | null;
@@ -1,4 +1,6 @@
1
1
  import type { MLElement } from '../node/element';
2
2
  import type { MLNode } from '../node/node';
3
3
  import type { RuleConfigValue } from '@markuplint/ml-config';
4
- export declare function getChildren<T extends RuleConfigValue, O = null>(node: MLNode<T, O>): HTMLCollectionOf<MLElement<T, O>>;
4
+ export declare function getChildren<T extends RuleConfigValue, O = null>(
5
+ node: MLNode<T, O>,
6
+ ): HTMLCollectionOf<MLElement<T, O>>;
@@ -6,93 +6,93 @@ import { MLToken } from '../token/token';
6
6
  import { MLDomTokenList } from './dom-token-list';
7
7
  import { MLNode } from './node';
8
8
  export declare class MLAttr<T extends RuleConfigValue, O = null> 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;
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;
98
98
  }
@@ -5,34 +5,34 @@ import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
5
5
  import type { RuleConfigValue } from '@markuplint/ml-config';
6
6
  import { MLNode } from './node';
7
7
  export declare class MLBlock<T extends RuleConfigValue, O = null> 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;
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;
38
38
  }
@@ -2,56 +2,63 @@ import type { MLElement } from './element';
2
2
  import type { MLASTAbstractNode } from '@markuplint/ml-ast';
3
3
  import type { RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLNode } from './node';
5
- export declare abstract class MLCharacterData<T extends RuleConfigValue, O = null, 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;
5
+ export declare abstract class MLCharacterData<
6
+ T extends RuleConfigValue,
7
+ O = null,
8
+ A extends MLASTAbstractNode = MLASTAbstractNode,
9
+ >
10
+ extends MLNode<T, O, A>
11
+ implements CharacterData
12
+ {
13
+ /**
14
+ * @implements DOM API: `CharacterData`
15
+ * @see https://dom.spec.whatwg.org/#dom-characterdata-data
16
+ */
17
+ get data(): string;
18
+ /**
19
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
20
+ *
21
+ * @unsupported
22
+ * @implements DOM API: `CharacterData`
23
+ * @see https://dom.spec.whatwg.org/#dom-characterdata-length
24
+ */
25
+ get length(): number;
26
+ /**
27
+ * The element immediately following the specified one in its parent's children list.
28
+ *
29
+ * @readonly
30
+ * @implements DOM API: `CharacterData`
31
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A1
32
+ */
33
+ get nextElementSibling(): MLElement<T, O> | null;
34
+ get nodeValue(): string | null;
35
+ /**
36
+ * The element immediately prior the specified one in its parent's children list.
37
+ *
38
+ * @readonly
39
+ * @implements DOM API: `CharacterData`
40
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A1
41
+ */
42
+ get previousElementSibling(): MLElement<T, O> | null;
43
+ /**
44
+ * @implements DOM API: `CharacterData`
45
+ */
46
+ after(...nodes: (string | MLElement<any, any>)[]): void;
47
+ appendData(data: string): void;
48
+ /**
49
+ * @implements DOM API: `CharacterData`
50
+ */
51
+ before(...nodes: (string | MLElement<any, any>)[]): void;
52
+ deleteData(offset: number, count: number): void;
53
+ insertData(offset: number, data: string): void;
54
+ /**
55
+ * @implements DOM API: `CharacterData`
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;
57
64
  }
@@ -5,5 +5,10 @@ import type { MLElement } from './element';
5
5
  import type { MLNode } from './node';
6
6
  import type { MLText } from './text';
7
7
  import type { RuleConfigValue } from '@markuplint/ml-config';
8
- export type MLChildNode<T extends RuleConfigValue, O = null> = MLDocumentType<T, O> | MLCharacterData<T, O> | MLText<T, O> | MLElement<T, O> | MLBlock<T, O>;
8
+ export type MLChildNode<T extends RuleConfigValue, O = null> =
9
+ | MLDocumentType<T, O>
10
+ | MLCharacterData<T, O>
11
+ | MLText<T, O>
12
+ | MLElement<T, O>
13
+ | MLBlock<T, O>;
9
14
  export declare function isChildNode<T extends RuleConfigValue, O = null>(node: MLNode<T, O>): node is MLChildNode<T, O>;
@@ -2,16 +2,19 @@ import type { CommentNodeType } from './types';
2
2
  import type { MLASTComment } from '@markuplint/ml-ast';
3
3
  import type { RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLCharacterData } from './character-data';
5
- export declare class MLComment<T extends RuleConfigValue, O = null> 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;
5
+ export declare class MLComment<T extends RuleConfigValue, O = null>
6
+ extends MLCharacterData<T, O, MLASTComment>
7
+ implements Comment
8
+ {
9
+ /**
10
+ * Returns a string appropriate for the type of node as `Attr`
11
+ *
12
+ * @see https://dom.spec.whatwg.org/#ref-for-exclusive-text-node%E2%91%A0
13
+ */
14
+ get nodeName(): '#comment';
15
+ /**
16
+ * Returns a number appropriate for the type of `Comment`
17
+ */
18
+ get nodeType(): CommentNodeType;
19
+ get textContent(): string | null;
17
20
  }
@@ -2,23 +2,26 @@ import type { DocumentFragmentNodeType } from './types';
2
2
  import type { MLASTAbstractNode } from '@markuplint/ml-ast';
3
3
  import type { RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLParentNode } from './parent-node';
5
- export declare class MLDocumentFragment<T extends RuleConfigValue, O = null> extends MLParentNode<T, O, MLASTAbstractNode> implements DocumentFragment {
6
- /**
7
- * Returns a string appropriate for the type of node as `DocumentFragment`
8
- *
9
- * @see https://dom.spec.whatwg.org/#ref-for-documentfragment%E2%91%A0%E2%91%A6
10
- */
11
- get nodeName(): "#document-fragment";
12
- /**
13
- * Returns a number appropriate for the type of `DocumentFragment`
14
- */
15
- get nodeType(): DocumentFragmentNodeType;
16
- /**
17
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
18
- *
19
- * @deprecated
20
- * @unsupported
21
- * @implements DOM API: `DocumentFragment`
22
- */
23
- getElementById(elementId: string): HTMLElement | null;
5
+ export declare class MLDocumentFragment<T extends RuleConfigValue, O = null>
6
+ extends MLParentNode<T, O, MLASTAbstractNode>
7
+ implements DocumentFragment
8
+ {
9
+ /**
10
+ * Returns a string appropriate for the type of node as `DocumentFragment`
11
+ *
12
+ * @see https://dom.spec.whatwg.org/#ref-for-documentfragment%E2%91%A0%E2%91%A6
13
+ */
14
+ get nodeName(): '#document-fragment';
15
+ /**
16
+ * Returns a number appropriate for the type of `DocumentFragment`
17
+ */
18
+ get nodeType(): DocumentFragmentNodeType;
19
+ /**
20
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
21
+ *
22
+ * @deprecated
23
+ * @unsupported
24
+ * @implements DOM API: `DocumentFragment`
25
+ */
26
+ getElementById(elementId: string): HTMLElement | null;
24
27
  }