@markuplint/ml-core 3.15.0 → 4.0.0-alpha.10

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 (105) hide show
  1. package/LICENSE +1 -1
  2. package/lib/configs.browser.js +11 -11
  3. package/lib/convert-ruleset.d.ts +1 -1
  4. package/lib/convert-ruleset.js +3 -8
  5. package/lib/debug.js +9 -14
  6. package/lib/index.d.ts +13 -23
  7. package/lib/index.js +12 -29
  8. package/lib/ml-core.d.ts +5 -5
  9. package/lib/ml-core.js +94 -76
  10. package/lib/ml-dom/helper/accname.d.ts +1 -1
  11. package/lib/ml-dom/helper/accname.js +12 -19
  12. package/lib/ml-dom/helper/create-node.d.ts +4 -8
  13. package/lib/ml-dom/helper/create-node.js +38 -17
  14. package/lib/ml-dom/helper/debug.d.ts +1 -1
  15. package/lib/ml-dom/helper/debug.js +13 -22
  16. package/lib/ml-dom/helper/get-indent.d.ts +18 -0
  17. package/lib/ml-dom/helper/get-indent.js +112 -0
  18. package/lib/ml-dom/helper/walkers.d.ts +5 -15
  19. package/lib/ml-dom/helper/walkers.js +3 -8
  20. package/lib/ml-dom/index.d.ts +9 -9
  21. package/lib/ml-dom/index.js +1 -5
  22. package/lib/ml-dom/manipulations/child-node-methods.d.ts +7 -20
  23. package/lib/ml-dom/manipulations/child-node-methods.js +13 -25
  24. package/lib/ml-dom/manipulations/get-children.d.ts +3 -5
  25. package/lib/ml-dom/manipulations/get-children.js +3 -7
  26. package/lib/ml-dom/node/attr.d.ts +113 -98
  27. package/lib/ml-dom/node/attr.js +93 -50
  28. package/lib/ml-dom/node/block.d.ts +35 -39
  29. package/lib/ml-dom/node/block.js +8 -14
  30. package/lib/ml-dom/node/character-data.d.ts +55 -62
  31. package/lib/ml-dom/node/character-data.js +11 -16
  32. package/lib/ml-dom/node/child-node.d.ts +8 -15
  33. package/lib/ml-dom/node/child-node.js +1 -5
  34. package/lib/ml-dom/node/comment.d.ts +14 -17
  35. package/lib/ml-dom/node/comment.js +2 -6
  36. package/lib/ml-dom/node/document-fragment.d.ts +22 -25
  37. package/lib/ml-dom/node/document-fragment.js +4 -9
  38. package/lib/ml-dom/node/document-type.d.ts +35 -38
  39. package/lib/ml-dom/node/document-type.js +8 -14
  40. package/lib/ml-dom/node/document.d.ts +1598 -1614
  41. package/lib/ml-dom/node/document.js +330 -275
  42. package/lib/ml-dom/node/dom-token-list.d.ts +27 -27
  43. package/lib/ml-dom/node/dom-token-list.js +36 -32
  44. package/lib/ml-dom/node/element-close-tag.d.ts +20 -0
  45. package/lib/ml-dom/node/element-close-tag.js +39 -0
  46. package/lib/ml-dom/node/element.d.ts +1957 -1951
  47. package/lib/ml-dom/node/element.js +364 -348
  48. package/lib/ml-dom/node/named-node-map.d.ts +40 -45
  49. package/lib/ml-dom/node/named-node-map.js +10 -18
  50. package/lib/ml-dom/node/node-list.d.ts +5 -11
  51. package/lib/ml-dom/node/node-list.js +8 -16
  52. package/lib/ml-dom/node/node-store.d.ts +6 -11
  53. package/lib/ml-dom/node/node-store.js +14 -13
  54. package/lib/ml-dom/node/node.d.ts +480 -500
  55. package/lib/ml-dom/node/node.js +83 -73
  56. package/lib/ml-dom/node/parent-node.d.ts +60 -69
  57. package/lib/ml-dom/node/parent-node.js +32 -29
  58. package/lib/ml-dom/node/rule-mapper.d.ts +9 -9
  59. package/lib/ml-dom/node/rule-mapper.js +26 -21
  60. package/lib/ml-dom/node/text.d.ts +48 -51
  61. package/lib/ml-dom/node/text.js +8 -13
  62. package/lib/ml-dom/node/types.d.ts +42 -90
  63. package/lib/ml-dom/node/types.js +1 -2
  64. package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
  65. package/lib/ml-dom/node/unexpected-call-error.js +1 -4
  66. package/lib/ml-dom/token/token.d.ts +45 -45
  67. package/lib/ml-dom/token/token.js +32 -26
  68. package/lib/ml-rule/create-rule.d.ts +2 -4
  69. package/lib/ml-rule/create-rule.js +1 -5
  70. package/lib/ml-rule/create-test-rule.d.ts +5 -7
  71. package/lib/ml-rule/create-test-rule.js +3 -7
  72. package/lib/ml-rule/index.d.ts +3 -3
  73. package/lib/ml-rule/index.js +3 -6
  74. package/lib/ml-rule/ml-rule-context.d.ts +49 -57
  75. package/lib/ml-rule/ml-rule-context.js +11 -11
  76. package/lib/ml-rule/ml-rule.d.ts +26 -36
  77. package/lib/ml-rule/ml-rule.js +34 -31
  78. package/lib/ml-rule/types.d.ts +18 -33
  79. package/lib/ml-rule/types.js +1 -2
  80. package/lib/plugin/index.d.ts +2 -2
  81. package/lib/plugin/index.js +2 -5
  82. package/lib/plugin/plugin.d.ts +2 -4
  83. package/lib/plugin/plugin.js +1 -5
  84. package/lib/plugin/types.d.ts +6 -6
  85. package/lib/plugin/types.js +1 -2
  86. package/lib/ruleset/index.d.ts +5 -5
  87. package/lib/ruleset/index.js +4 -8
  88. package/lib/test/index.d.ts +11 -21
  89. package/lib/test/index.js +18 -24
  90. package/lib/types.d.ts +11 -11
  91. package/lib/types.js +1 -2
  92. package/lib/utils/get-location-from-chars.d.ts +4 -9
  93. package/lib/utils/get-location-from-chars.js +4 -8
  94. package/lib/utils/index.d.ts +1 -1
  95. package/lib/utils/index.js +1 -5
  96. package/lib/utils/string-splice.js +1 -5
  97. package/package.json +19 -15
  98. package/lib/configs.d.ts +0 -2
  99. package/lib/configs.js +0 -34
  100. package/lib/ml-dom/helper/getIndent.d.ts +0 -18
  101. package/lib/ml-dom/helper/getIndent.js +0 -106
  102. package/test/ml-dom/helper/accname.spec.js +0 -85
  103. package/test/ml-dom/helper/create-node.spec.js +0 -18
  104. package/test/ml-dom/index.spec.js +0 -680
  105. package/test/ml-dom/ml-rule/create-rule.spec.js +0 -108
@@ -1,64 +1,57 @@
1
- import type { MLElement } from './element';
2
- import type { MLASTAbstractNode } from '@markuplint/ml-ast';
1
+ import type { MLElement } from './element.js';
2
+ import type { MLASTNode } from '@markuplint/ml-ast';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
- import { MLNode } from './node';
5
- export declare abstract class MLCharacterData<
6
- T extends RuleConfigValue,
7
- O extends PlainData = undefined,
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;
4
+ import { MLNode } from './node.js';
5
+ export declare abstract class MLCharacterData<T extends RuleConfigValue, O extends PlainData = undefined, A extends MLASTNode = MLASTNode> 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
  }
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MLCharacterData = void 0;
4
- const tslib_1 = require("tslib");
5
- const child_node_methods_1 = require("../manipulations/child-node-methods");
6
- const node_1 = require("./node");
7
- const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
8
- class MLCharacterData extends node_1.MLNode {
1
+ import { after, before, nextElementSibling, previousElementSibling, remove, replaceWith, } from '../manipulations/child-node-methods.js';
2
+ import { MLNode } from './node.js';
3
+ import { UnexpectedCallError } from './unexpected-call-error.js';
4
+ export class MLCharacterData extends MLNode {
9
5
  /**
10
6
  * @implements DOM API: `CharacterData`
11
7
  * @see https://dom.spec.whatwg.org/#dom-characterdata-data
@@ -22,7 +18,7 @@ class MLCharacterData extends node_1.MLNode {
22
18
  * @see https://dom.spec.whatwg.org/#dom-characterdata-length
23
19
  */
24
20
  get length() {
25
- throw new unexpected_call_error_1.default('Not supported "length" property');
21
+ throw new UnexpectedCallError('Not supported "length" property');
26
22
  }
27
23
  /**
28
24
  * The element immediately following the specified one in its parent's children list.
@@ -32,7 +28,7 @@ class MLCharacterData extends node_1.MLNode {
32
28
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A1
33
29
  */
34
30
  get nextElementSibling() {
35
- return (0, child_node_methods_1.nextElementSibling)(this);
31
+ return nextElementSibling(this);
36
32
  }
37
33
  get nodeValue() {
38
34
  return this.data;
@@ -45,7 +41,7 @@ class MLCharacterData extends node_1.MLNode {
45
41
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A1
46
42
  */
47
43
  get previousElementSibling() {
48
- return (0, child_node_methods_1.previousElementSibling)(this);
44
+ return previousElementSibling(this);
49
45
  }
50
46
  /**
51
47
  * @implements DOM API: `CharacterData`
@@ -53,7 +49,7 @@ class MLCharacterData extends node_1.MLNode {
53
49
  after(
54
50
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
55
51
  ...nodes) {
56
- (0, child_node_methods_1.after)(this, ...nodes);
52
+ after(this, ...nodes);
57
53
  }
58
54
  // TODO
59
55
  appendData(data) { }
@@ -63,7 +59,7 @@ class MLCharacterData extends node_1.MLNode {
63
59
  before(
64
60
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
65
61
  ...nodes) {
66
- (0, child_node_methods_1.before)(this, ...nodes);
62
+ before(this, ...nodes);
67
63
  }
68
64
  // TODO
69
65
  deleteData(offset, count) { }
@@ -73,7 +69,7 @@ class MLCharacterData extends node_1.MLNode {
73
69
  * @implements DOM API: `CharacterData`
74
70
  */
75
71
  remove() {
76
- (0, child_node_methods_1.remove)(this);
72
+ remove(this);
77
73
  }
78
74
  // TODO
79
75
  replaceData(offset, count, data) { }
@@ -83,11 +79,10 @@ class MLCharacterData extends node_1.MLNode {
83
79
  replaceWith(
84
80
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
85
81
  ...nodes) {
86
- (0, child_node_methods_1.replaceWith)(this, ...nodes);
82
+ replaceWith(this, ...nodes);
87
83
  }
88
84
  // TODO
89
85
  substringData(offset, count) {
90
86
  return '';
91
87
  }
92
88
  }
93
- exports.MLCharacterData = MLCharacterData;
@@ -1,16 +1,9 @@
1
- import type { MLBlock } from './block';
2
- import type { MLCharacterData } from './character-data';
3
- import type { MLDocumentType } from './document-type';
4
- import type { MLElement } from './element';
5
- import type { MLNode } from './node';
6
- import type { MLText } from './text';
1
+ import type { MLBlock } from './block.js';
2
+ import type { MLCharacterData } from './character-data.js';
3
+ import type { MLComment } from './comment.js';
4
+ import type { MLElement } from './element.js';
5
+ import type { MLNode } from './node.js';
6
+ import type { MLText } from './text.js';
7
7
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
8
- export type MLChildNode<T extends RuleConfigValue, O extends PlainData = undefined> =
9
- | MLDocumentType<T, O>
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> = MLCharacterData<T, O> | MLComment<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>;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isChildNode = void 0;
4
- function isChildNode(
1
+ export function isChildNode(
5
2
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
6
3
  node) {
7
4
  return (node.is(node.DOCUMENT_TYPE_NODE) ||
@@ -9,4 +6,3 @@ node) {
9
6
  node.is(node.ELEMENT_NODE) ||
10
7
  node.is(node.MARKUPLINT_PREPROCESSOR_BLOCK));
11
8
  }
12
- exports.isChildNode = isChildNode;
@@ -1,20 +1,17 @@
1
- import type { CommentNodeType } from './types';
1
+ import type { CommentNodeType } from './types.js';
2
2
  import type { MLASTComment } from '@markuplint/ml-ast';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
- import { MLCharacterData } from './character-data';
5
- export declare class MLComment<T extends RuleConfigValue, O extends PlainData = undefined>
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;
4
+ import { MLCharacterData } from './character-data.js';
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
  }
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MLComment = void 0;
4
- const character_data_1 = require("./character-data");
5
- class MLComment extends character_data_1.MLCharacterData {
1
+ import { MLCharacterData } from './character-data.js';
2
+ export class MLComment extends MLCharacterData {
6
3
  /**
7
4
  * Returns a string appropriate for the type of node as `Attr`
8
5
  *
@@ -21,4 +18,3 @@ class MLComment extends character_data_1.MLCharacterData {
21
18
  return this.nodeValue;
22
19
  }
23
20
  }
24
- exports.MLComment = MLComment;
@@ -1,27 +1,24 @@
1
- import type { DocumentFragmentNodeType } from './types';
2
- import type { MLASTAbstractNode } from '@markuplint/ml-ast';
1
+ import type { DocumentFragmentNodeType } from './types.js';
2
+ import type { MLASTNode } from '@markuplint/ml-ast';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
- import { MLParentNode } from './parent-node';
5
- export declare class MLDocumentFragment<T extends RuleConfigValue, O extends PlainData = undefined>
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;
4
+ import { MLParentNode } from './parent-node.js';
5
+ export declare class MLDocumentFragment<T extends RuleConfigValue, O extends PlainData = undefined> extends MLParentNode<T, O, MLASTNode> 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;
27
24
  }
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MLDocumentFragment = void 0;
4
- const tslib_1 = require("tslib");
5
- const parent_node_1 = require("./parent-node");
6
- const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
7
- class MLDocumentFragment extends parent_node_1.MLParentNode {
1
+ import { MLParentNode } from './parent-node.js';
2
+ import { UnexpectedCallError } from './unexpected-call-error.js';
3
+ export class MLDocumentFragment extends MLParentNode {
8
4
  /**
9
5
  * Returns a string appropriate for the type of node as `DocumentFragment`
10
6
  *
@@ -27,7 +23,6 @@ class MLDocumentFragment extends parent_node_1.MLParentNode {
27
23
  * @implements DOM API: `DocumentFragment`
28
24
  */
29
25
  getElementById(elementId) {
30
- throw new unexpected_call_error_1.default('Not supported "getElementById" method');
26
+ throw new UnexpectedCallError('Not supported "getElementById" method');
31
27
  }
32
28
  }
33
- exports.MLDocumentFragment = MLDocumentFragment;
@@ -1,41 +1,38 @@
1
- import type { MLDocument } from './document';
2
- import type { MLElement } from './element';
3
- import type { DocumentTypeNodeType } from './types';
1
+ import type { MLDocument } from './document.js';
2
+ import type { MLElement } from './element.js';
3
+ import type { DocumentTypeNodeType } from './types.js';
4
4
  import type { MLASTDoctype } from '@markuplint/ml-ast';
5
5
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
6
- import { MLNode } from './node';
7
- export declare class MLDocumentType<T extends RuleConfigValue, O extends PlainData = undefined>
8
- extends MLNode<T, O, MLASTDoctype>
9
- implements DocumentType
10
- {
11
- readonly name: string;
12
- readonly publicId: string;
13
- readonly systemId: string;
14
- constructor(astNode: MLASTDoctype, document: MLDocument<T, O>);
15
- /**
16
- * Returns a string appropriate for the type of node as `DocumentType`
17
- *
18
- * @see https://dom.spec.whatwg.org/#ref-for-documenttype%E2%91%A0%E2%93%AA
19
- */
20
- get nodeName(): string;
21
- /**
22
- * Returns a number appropriate for the type of `DocumentType`
23
- */
24
- get nodeType(): DocumentTypeNodeType;
25
- /**
26
- * @implements DOM API: `CharacterData`
27
- */
28
- after(...nodes: (string | MLElement<any, any>)[]): void;
29
- /**
30
- * @implements DOM API: `CharacterData`
31
- */
32
- before(...nodes: (string | MLElement<any, any>)[]): void;
33
- /**
34
- * @implements DOM API: `CharacterData`
35
- */
36
- remove(): void;
37
- /**
38
- * @implements DOM API: `CharacterData`
39
- */
40
- replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
6
+ import { MLNode } from './node.js';
7
+ export declare class MLDocumentType<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<T, O, MLASTDoctype> implements DocumentType {
8
+ readonly name: string;
9
+ readonly publicId: string;
10
+ readonly systemId: string;
11
+ constructor(astNode: MLASTDoctype, document: MLDocument<T, O>);
12
+ /**
13
+ * Returns a string appropriate for the type of node as `DocumentType`
14
+ *
15
+ * @see https://dom.spec.whatwg.org/#ref-for-documenttype%E2%91%A0%E2%93%AA
16
+ */
17
+ get nodeName(): string;
18
+ /**
19
+ * Returns a number appropriate for the type of `DocumentType`
20
+ */
21
+ get nodeType(): DocumentTypeNodeType;
22
+ /**
23
+ * @implements DOM API: `CharacterData`
24
+ */
25
+ after(...nodes: (string | MLElement<any, any>)[]): void;
26
+ /**
27
+ * @implements DOM API: `CharacterData`
28
+ */
29
+ before(...nodes: (string | MLElement<any, any>)[]): void;
30
+ /**
31
+ * @implements DOM API: `CharacterData`
32
+ */
33
+ remove(): void;
34
+ /**
35
+ * @implements DOM API: `CharacterData`
36
+ */
37
+ replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
41
38
  }
@@ -1,12 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MLDocumentType = void 0;
4
- const child_node_methods_1 = require("../manipulations/child-node-methods");
5
- const node_1 = require("./node");
6
- class MLDocumentType extends node_1.MLNode {
7
- constructor(
8
- // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
9
- astNode,
1
+ import { after, before, remove, replaceWith } from '../manipulations/child-node-methods.js';
2
+ import { MLNode } from './node.js';
3
+ export class MLDocumentType extends MLNode {
4
+ constructor(astNode,
10
5
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
11
6
  document) {
12
7
  super(astNode, document);
@@ -34,7 +29,7 @@ class MLDocumentType extends node_1.MLNode {
34
29
  after(
35
30
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
36
31
  ...nodes) {
37
- (0, child_node_methods_1.after)(this, ...nodes);
32
+ after(this, ...nodes);
38
33
  }
39
34
  /**
40
35
  * @implements DOM API: `CharacterData`
@@ -42,13 +37,13 @@ class MLDocumentType extends node_1.MLNode {
42
37
  before(
43
38
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
44
39
  ...nodes) {
45
- (0, child_node_methods_1.before)(this, ...nodes);
40
+ before(this, ...nodes);
46
41
  }
47
42
  /**
48
43
  * @implements DOM API: `CharacterData`
49
44
  */
50
45
  remove() {
51
- (0, child_node_methods_1.remove)(this);
46
+ remove(this);
52
47
  }
53
48
  /**
54
49
  * @implements DOM API: `CharacterData`
@@ -56,7 +51,6 @@ class MLDocumentType extends node_1.MLNode {
56
51
  replaceWith(
57
52
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
58
53
  ...nodes) {
59
- (0, child_node_methods_1.replaceWith)(this, ...nodes);
54
+ replaceWith(this, ...nodes);
60
55
  }
61
56
  }
62
- exports.MLDocumentType = MLDocumentType;