@markuplint/ml-core 3.0.0-alpha.66 → 3.0.0-dev.176

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 (124) hide show
  1. package/README.md +12 -3
  2. package/lib/configs.browser.d.ts +2 -0
  3. package/lib/configs.browser.js +12 -0
  4. package/lib/configs.js +4 -1
  5. package/lib/index.d.ts +11 -1
  6. package/lib/ml-core.d.ts +24 -13
  7. package/lib/ml-core.js +16 -10
  8. package/lib/ml-dom/helper/accname.d.ts +2 -1
  9. package/lib/ml-dom/helper/accname.js +62 -2
  10. package/lib/ml-dom/helper/create-node.d.ts +7 -3
  11. package/lib/ml-dom/helper/create-node.js +4 -2
  12. package/lib/ml-dom/helper/debug.js +10 -5
  13. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  14. package/lib/ml-dom/helper/getIndent.js +18 -12
  15. package/lib/ml-dom/helper/walkers.d.ts +15 -5
  16. package/lib/ml-dom/helper/walkers.js +22 -16
  17. package/lib/ml-dom/index.d.ts +1 -0
  18. package/lib/ml-dom/manipulations/child-node-methods.d.ts +20 -7
  19. package/lib/ml-dom/manipulations/child-node-methods.js +24 -6
  20. package/lib/ml-dom/manipulations/get-children.d.ts +4 -2
  21. package/lib/ml-dom/manipulations/get-children.js +3 -1
  22. package/lib/ml-dom/node/attr.d.ts +94 -91
  23. package/lib/ml-dom/node/attr.js +26 -16
  24. package/lib/ml-dom/node/block.d.ts +36 -32
  25. package/lib/ml-dom/node/block.js +14 -4
  26. package/lib/ml-dom/node/character-data.d.ts +61 -54
  27. package/lib/ml-dom/node/character-data.js +9 -3
  28. package/lib/ml-dom/node/child-node.d.ts +10 -3
  29. package/lib/ml-dom/node/child-node.js +3 -1
  30. package/lib/ml-dom/node/comment.d.ts +16 -13
  31. package/lib/ml-dom/node/document-fragment.d.ts +24 -21
  32. package/lib/ml-dom/node/document-type.d.ts +35 -32
  33. package/lib/ml-dom/node/document-type.js +14 -4
  34. package/lib/ml-dom/node/document.d.ts +1608 -1545
  35. package/lib/ml-dom/node/document.js +125 -33
  36. package/lib/ml-dom/node/dom-token-list.d.ts +27 -27
  37. package/lib/ml-dom/node/dom-token-list.js +15 -13
  38. package/lib/ml-dom/node/element.d.ts +1906 -1817
  39. package/lib/ml-dom/node/element.js +345 -75
  40. package/lib/ml-dom/node/named-node-map.d.ts +45 -40
  41. package/lib/ml-dom/node/named-node-map.js +13 -5
  42. package/lib/ml-dom/node/node-list.d.ts +10 -4
  43. package/lib/ml-dom/node/node-list.js +25 -5
  44. package/lib/ml-dom/node/node-store.d.ts +10 -5
  45. package/lib/ml-dom/node/node-store.js +19 -1
  46. package/lib/ml-dom/node/node.d.ts +494 -467
  47. package/lib/ml-dom/node/node.js +89 -47
  48. package/lib/ml-dom/node/parent-node.d.ts +68 -59
  49. package/lib/ml-dom/node/parent-node.js +15 -6
  50. package/lib/ml-dom/node/rule-mapper.d.ts +9 -9
  51. package/lib/ml-dom/node/rule-mapper.js +11 -3
  52. package/lib/ml-dom/node/text.d.ts +50 -47
  53. package/lib/ml-dom/node/types.d.ts +94 -16
  54. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
  55. package/lib/ml-dom/token/token.d.ts +44 -44
  56. package/lib/ml-rule/create-rule.d.ts +4 -2
  57. package/lib/ml-rule/create-test-rule.d.ts +6 -4
  58. package/lib/ml-rule/ml-rule-context.d.ts +58 -49
  59. package/lib/ml-rule/ml-rule-context.js +23 -4
  60. package/lib/ml-rule/ml-rule.d.ts +36 -26
  61. package/lib/ml-rule/ml-rule.js +39 -34
  62. package/lib/ml-rule/types.d.ts +35 -17
  63. package/lib/plugin/plugin.d.ts +3 -1
  64. package/lib/plugin/types.d.ts +9 -9
  65. package/lib/ruleset/index.d.ts +4 -4
  66. package/lib/ruleset/index.js +4 -4
  67. package/lib/test/index.d.ts +21 -8
  68. package/lib/test/index.js +6 -4
  69. package/lib/types.d.ts +12 -10
  70. package/lib/utils/get-location-from-chars.d.ts +9 -4
  71. package/package.json +21 -15
  72. package/test/ml-dom/helper/accname.spec.js +85 -0
  73. package/test/ml-dom/helper/create-node.spec.js +18 -0
  74. package/test/ml-dom/index.spec.js +680 -0
  75. package/lib/ml-dom/document.d.ts +0 -94
  76. package/lib/ml-dom/document.js +0 -273
  77. package/lib/ml-dom/helper/index.d.ts +0 -4
  78. package/lib/ml-dom/helper/index.js +0 -12
  79. package/lib/ml-dom/helper/mapped-nodes.d.ts +0 -52
  80. package/lib/ml-dom/helper/mapped-nodes.js +0 -2
  81. package/lib/ml-dom/helper/match-selector.d.ts +0 -20
  82. package/lib/ml-dom/helper/match-selector.js +0 -233
  83. package/lib/ml-dom/helper/node-store.d.ts +0 -12
  84. package/lib/ml-dom/helper/node-store.js +0 -28
  85. package/lib/ml-dom/helper/selector.d.ts +0 -11
  86. package/lib/ml-dom/helper/selector.js +0 -549
  87. package/lib/ml-dom/rule-mapper.d.ts +0 -16
  88. package/lib/ml-dom/rule-mapper.js +0 -57
  89. package/lib/ml-dom/tokens/abstract-element.d.ts +0 -54
  90. package/lib/ml-dom/tokens/abstract-element.js +0 -249
  91. package/lib/ml-dom/tokens/attribute.d.ts +0 -42
  92. package/lib/ml-dom/tokens/attribute.js +0 -85
  93. package/lib/ml-dom/tokens/comment.d.ts +0 -12
  94. package/lib/ml-dom/tokens/comment.js +0 -15
  95. package/lib/ml-dom/tokens/doctype.d.ts +0 -18
  96. package/lib/ml-dom/tokens/doctype.js +0 -32
  97. package/lib/ml-dom/tokens/element-close-tag.d.ts +0 -27
  98. package/lib/ml-dom/tokens/element-close-tag.js +0 -45
  99. package/lib/ml-dom/tokens/element.d.ts +0 -26
  100. package/lib/ml-dom/tokens/element.js +0 -66
  101. package/lib/ml-dom/tokens/index.d.ts +0 -10
  102. package/lib/ml-dom/tokens/index.js +0 -26
  103. package/lib/ml-dom/tokens/node.d.ts +0 -46
  104. package/lib/ml-dom/tokens/node.js +0 -126
  105. package/lib/ml-dom/tokens/omitted-element.d.ts +0 -13
  106. package/lib/ml-dom/tokens/omitted-element.js +0 -12
  107. package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +0 -24
  108. package/lib/ml-dom/tokens/preprocessor-specific-attribute.js +0 -37
  109. package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +0 -14
  110. package/lib/ml-dom/tokens/preprocessor-specific-block.js +0 -16
  111. package/lib/ml-dom/tokens/text.d.ts +0 -19
  112. package/lib/ml-dom/tokens/text.js +0 -26
  113. package/lib/ml-dom/tokens/token.d.ts +0 -16
  114. package/lib/ml-dom/tokens/token.js +0 -55
  115. package/lib/ml-dom/types.d.ts +0 -49
  116. package/lib/ml-dom/types.js +0 -2
  117. package/lib/selector/is-pure-html-element.d.ts +0 -1
  118. package/lib/selector/is-pure-html-element.js +0 -7
  119. package/lib/selector/match-selector.d.ts +0 -14
  120. package/lib/selector/match-selector.js +0 -230
  121. package/lib/selector/selector.d.ts +0 -9
  122. package/lib/selector/selector.js +0 -561
  123. package/tsconfig.test.json +0 -3
  124. package/tsconfig.tsbuildinfo +0 -1
@@ -7,7 +7,11 @@ const unexpected_call_error_1 = tslib_1.__importDefault(require("../node/unexpec
7
7
  *
8
8
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-before%E2%91%A0
9
9
  */
10
- function before(node, ...additionalNodes) {
10
+ function before(
11
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
12
+ node,
13
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
+ ...additionalNodes) {
11
15
  throw new unexpected_call_error_1.default('Not supported "before" method');
12
16
  }
13
17
  exports.before = before;
@@ -15,7 +19,11 @@ exports.before = before;
15
19
  *
16
20
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-after%E2%91%A0
17
21
  */
18
- function after(node, ...additionalNodes) {
22
+ function after(
23
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
24
+ node,
25
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
26
+ ...additionalNodes) {
19
27
  throw new unexpected_call_error_1.default('Not supported "after" method');
20
28
  }
21
29
  exports.after = after;
@@ -23,7 +31,11 @@ exports.after = after;
23
31
  *
24
32
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-replacewith%E2%91%A0
25
33
  */
26
- function replaceWith(node, ...additionalNodes) {
34
+ function replaceWith(
35
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
36
+ node,
37
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
38
+ ...additionalNodes) {
27
39
  throw new unexpected_call_error_1.default('Not supported "replaceWith" method');
28
40
  }
29
41
  exports.replaceWith = replaceWith;
@@ -31,7 +43,9 @@ exports.replaceWith = replaceWith;
31
43
  *
32
44
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-remove%E2%91%A0
33
45
  */
34
- function remove(node) {
46
+ function remove(
47
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
48
+ node) {
35
49
  throw new unexpected_call_error_1.default('Not supported "remove" method');
36
50
  }
37
51
  exports.remove = remove;
@@ -39,7 +53,9 @@ exports.remove = remove;
39
53
  *
40
54
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A0
41
55
  */
42
- function previousElementSibling(node) {
56
+ function previousElementSibling(
57
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
58
+ node) {
43
59
  var _a, _b;
44
60
  let prevNode = node.prevNode;
45
61
  while (prevNode) {
@@ -57,7 +73,9 @@ exports.previousElementSibling = previousElementSibling;
57
73
  *
58
74
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A0
59
75
  */
60
- function nextElementSibling(node) {
76
+ function nextElementSibling(
77
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
78
+ node) {
61
79
  var _a, _b;
62
80
  let nextNode = node.nextNode;
63
81
  while (nextNode) {
@@ -1,4 +1,6 @@
1
1
  import type { MLElement } from '../node/element';
2
2
  import type { MLNode } from '../node/node';
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>>;
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>>;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getChildren = void 0;
4
4
  const node_list_1 = require("../node/node-list");
5
- function getChildren(node) {
5
+ function getChildren(
6
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
7
+ node) {
6
8
  return (0, node_list_1.toHTMLCollection)(Array.from(node.childNodes).filter((child) => {
7
9
  return child.nodeType === child.ELEMENT_NODE;
8
10
  }));
@@ -1,98 +1,101 @@
1
1
  import type { MLElement } from './element';
2
2
  import type { AttributeNodeType } from './types';
3
3
  import type { MLASTAttr } from '@markuplint/ml-ast';
4
- import type { RuleConfigValue } from '@markuplint/ml-config';
4
+ 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 = 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
- /**
35
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
36
- *
37
- * @unsupported
38
- * @implements DOM API: `Attr`
39
- * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
40
- */
41
- get localName(): string;
42
- /**
43
- *
44
- * @implements DOM API: `Attr`
45
- * @see https://dom.spec.whatwg.org/#dom-attr-name
46
- */
47
- get name(): string;
48
- /**
49
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
50
- *
51
- * @unsupported
52
- * @implements DOM API: `Attr`
53
- * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
54
- */
55
- get namespaceURI(): string | null;
56
- /**
57
- * Returns a string appropriate for the type of node as `Attr`
58
- *
59
- * @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
60
- */
61
- get nodeName(): string;
62
- /**
63
- * Returns a number appropriate for the type of `Attr`
64
- */
65
- get nodeType(): AttributeNodeType;
66
- get nodeValue(): string;
67
- /**
68
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
69
- *
70
- * @unsupported
71
- * @implements DOM API: `Attr`
72
- * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
73
- */
74
- get prefix(): string | null;
75
- /**
76
- * @implements `@markuplint/ml-core` API: `MLAttr`
77
- */
78
- get rule(): import("@markuplint/ml-config").RuleInfo<T, O>;
79
- /**
80
- * @implements DOM API: `Attr`
81
- * @see https://dom.spec.whatwg.org/#dom-attr-specified
82
- */
83
- get specified(): true;
84
- /**
85
- * @implements DOM API: `Attr`
86
- * @see https://dom.spec.whatwg.org/#dom-attr-value
87
- */
88
- get value(): string;
89
- /**
90
- * @implements `@markuplint/ml-core` API: `MLAttr`
91
- */
92
- get tokenList(): MLDomTokenList | null;
93
- constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
94
- /**
95
- * @implements `@markuplint/ml-core` API: `MLAttr`
96
- */
97
- toNormalizeString(): string;
8
+ export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined>
9
+ extends MLNode<T, O, MLASTAttr>
10
+ implements Attr
11
+ {
12
+ #private;
13
+ readonly candidate?: string;
14
+ readonly endQuote: MLToken | null;
15
+ readonly equal: MLToken | null;
16
+ readonly isDirective?: true;
17
+ readonly isDuplicatable: boolean;
18
+ readonly isDynamicValue?: true;
19
+ readonly nameNode: MLToken | null;
20
+ /**
21
+ * @implements DOM API: `Attr`
22
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
23
+ */
24
+ readonly ownerElement: MLElement<T, O>;
25
+ readonly spacesAfterEqual: MLToken | null;
26
+ readonly spacesBeforeEqual: MLToken | null;
27
+ readonly spacesBeforeName: MLToken | null;
28
+ readonly startQuote: MLToken | null;
29
+ readonly valueNode: MLToken | null;
30
+ /**
31
+ * Returns the "string" if HTML syntax. Otherwise, returns a type in its syntax.
32
+ *
33
+ * @default "string"
34
+ * @implements `@markuplint/ml-core` API: `MLAttr`
35
+ */
36
+ readonly valueType: 'string' | 'number' | 'boolean' | 'code';
37
+ constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
38
+ /**
39
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
40
+ *
41
+ * @unsupported
42
+ * @implements DOM API: `Attr`
43
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
44
+ */
45
+ get localName(): string;
46
+ /**
47
+ *
48
+ * @implements DOM API: `Attr`
49
+ * @see https://dom.spec.whatwg.org/#dom-attr-name
50
+ */
51
+ get name(): string;
52
+ /**
53
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
54
+ *
55
+ * @unsupported
56
+ * @implements DOM API: `Attr`
57
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
58
+ */
59
+ get namespaceURI(): string | null;
60
+ /**
61
+ * Returns a string appropriate for the type of node as `Attr`
62
+ *
63
+ * @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
64
+ */
65
+ get nodeName(): string;
66
+ /**
67
+ * Returns a number appropriate for the type of `Attr`
68
+ */
69
+ get nodeType(): AttributeNodeType;
70
+ get nodeValue(): string;
71
+ /**
72
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
73
+ *
74
+ * @unsupported
75
+ * @implements DOM API: `Attr`
76
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
77
+ */
78
+ get prefix(): string | null;
79
+ /**
80
+ * @implements `@markuplint/ml-core` API: `MLAttr`
81
+ */
82
+ get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
83
+ /**
84
+ * @implements DOM API: `Attr`
85
+ * @see https://dom.spec.whatwg.org/#dom-attr-specified
86
+ */
87
+ get specified(): true;
88
+ /**
89
+ * @implements `@markuplint/ml-core` API: `MLAttr`
90
+ */
91
+ get tokenList(): MLDomTokenList | null;
92
+ /**
93
+ * @implements DOM API: `Attr`
94
+ * @see https://dom.spec.whatwg.org/#dom-attr-value
95
+ */
96
+ get value(): string;
97
+ /**
98
+ * @implements `@markuplint/ml-core` API: `MLAttr`
99
+ */
100
+ toNormalizeString(): string;
98
101
  }
@@ -1,21 +1,28 @@
1
1
  "use strict";
2
- var _MLAttr_potentialName, _MLAttr_potentialValue;
2
+ var _MLAttr_localName, _MLAttr_namespaceURI, _MLAttr_potentialName, _MLAttr_potentialValue;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.MLAttr = void 0;
5
5
  const tslib_1 = require("tslib");
6
+ const ml_spec_1 = require("@markuplint/ml-spec");
6
7
  const token_1 = require("../token/token");
7
8
  const dom_token_list_1 = require("./dom-token-list");
8
9
  const node_1 = require("./node");
9
10
  const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
10
11
  class MLAttr extends node_1.MLNode {
11
- constructor(astToken, ownElement) {
12
- var _a;
12
+ constructor(
13
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
+ astToken,
15
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
16
+ ownElement) {
17
+ var _a, _b, _c, _d;
13
18
  super(astToken, ownElement.ownerMLDocument);
14
- _MLAttr_potentialName.set(this, void 0);
15
- _MLAttr_potentialValue.set(this, void 0);
16
19
  this.endQuote = null;
17
20
  this.equal = null;
21
+ _MLAttr_localName.set(this, void 0);
18
22
  this.nameNode = null;
23
+ _MLAttr_namespaceURI.set(this, void 0);
24
+ _MLAttr_potentialName.set(this, void 0);
25
+ _MLAttr_potentialValue.set(this, void 0);
19
26
  this.spacesAfterEqual = null;
20
27
  this.spacesBeforeEqual = null;
21
28
  this.spacesBeforeName = null;
@@ -40,8 +47,8 @@ class MLAttr extends node_1.MLNode {
40
47
  this.isDynamicValue = this._astToken.isDynamicValue;
41
48
  this.isDirective = this._astToken.isDirective;
42
49
  this.candidate = this._astToken.candidate;
43
- tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName || ((_a = this.nameNode) === null || _a === void 0 ? void 0 : _a.raw) || '', "f");
44
- tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.value.raw || '', "f");
50
+ tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, (_c = (_a = this._astToken.potentialName) !== null && _a !== void 0 ? _a : (_b = this.nameNode) === null || _b === void 0 ? void 0 : _b.raw) !== null && _c !== void 0 ? _c : '', "f");
51
+ tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, (_d = this._astToken.value.raw) !== null && _d !== void 0 ? _d : '', "f");
45
52
  }
46
53
  else {
47
54
  this.valueType = this._astToken.valueType;
@@ -49,6 +56,9 @@ class MLAttr extends node_1.MLNode {
49
56
  tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName, "f");
50
57
  tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.potentialValue, "f");
51
58
  }
59
+ const ns = (0, ml_spec_1.resolveNamespace)(tslib_1.__classPrivateFieldGet(this, _MLAttr_potentialName, "f"), ownElement.namespaceURI);
60
+ tslib_1.__classPrivateFieldSet(this, _MLAttr_localName, ns.localName, "f");
61
+ tslib_1.__classPrivateFieldSet(this, _MLAttr_namespaceURI, ns.namespaceURI, "f");
52
62
  this.ownerElement = ownElement;
53
63
  this.isDuplicatable = this._astToken.isDuplicatable;
54
64
  }
@@ -60,7 +70,7 @@ class MLAttr extends node_1.MLNode {
60
70
  * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
61
71
  */
62
72
  get localName() {
63
- throw new unexpected_call_error_1.default('Not supported "localname" property');
73
+ return tslib_1.__classPrivateFieldGet(this, _MLAttr_localName, "f");
64
74
  }
65
75
  /**
66
76
  *
@@ -78,7 +88,7 @@ class MLAttr extends node_1.MLNode {
78
88
  * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
79
89
  */
80
90
  get namespaceURI() {
81
- throw new unexpected_call_error_1.default('Not supported "namespaceURI" property');
91
+ return tslib_1.__classPrivateFieldGet(this, _MLAttr_namespaceURI, "f");
82
92
  }
83
93
  /**
84
94
  * Returns a string appropriate for the type of node as `Attr`
@@ -120,6 +130,12 @@ class MLAttr extends node_1.MLNode {
120
130
  get specified() {
121
131
  return true;
122
132
  }
133
+ /**
134
+ * @implements `@markuplint/ml-core` API: `MLAttr`
135
+ */
136
+ get tokenList() {
137
+ return this.isDynamicValue ? null : new dom_token_list_1.MLDomTokenList(this.value, [this]);
138
+ }
123
139
  /**
124
140
  * @implements DOM API: `Attr`
125
141
  * @see https://dom.spec.whatwg.org/#dom-attr-value
@@ -127,12 +143,6 @@ class MLAttr extends node_1.MLNode {
127
143
  get value() {
128
144
  return tslib_1.__classPrivateFieldGet(this, _MLAttr_potentialValue, "f");
129
145
  }
130
- /**
131
- * @implements `@markuplint/ml-core` API: `MLAttr`
132
- */
133
- get tokenList() {
134
- return this.isDynamicValue ? null : new dom_token_list_1.MLDomTokenList(this.value, [this]);
135
- }
136
146
  /**
137
147
  * @implements `@markuplint/ml-core` API: `MLAttr`
138
148
  */
@@ -148,4 +158,4 @@ class MLAttr extends node_1.MLNode {
148
158
  }
149
159
  }
150
160
  exports.MLAttr = MLAttr;
151
- _MLAttr_potentialName = new WeakMap(), _MLAttr_potentialValue = new WeakMap();
161
+ _MLAttr_localName = new WeakMap(), _MLAttr_namespaceURI = new WeakMap(), _MLAttr_potentialName = new WeakMap(), _MLAttr_potentialValue = new WeakMap();
@@ -2,37 +2,41 @@ import type { MLDocument } from './document';
2
2
  import type { MLElement } from './element';
3
3
  import type { MarkuplintPreprocessorBlockType } from './types';
4
4
  import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
5
- import type { RuleConfigValue } from '@markuplint/ml-config';
5
+ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
6
6
  import { MLNode } from './node';
7
- export declare class MLBlock<T extends RuleConfigValue, O = null> extends MLNode<T, O, MLASTPreprocessorSpecificBlock> {
8
- readonly isTransparent: boolean;
9
- /**
10
- * Returns a string appropriate for the type of node as `MLBlock`
11
- *
12
- * @implements `@markuplint/ml-core` API: `MLBlock`
13
- */
14
- get nodeName(): "#ml-block";
15
- /**
16
- * Returns a number appropriate for the type of `MLBlock`
17
- *
18
- * @implements `@markuplint/ml-core` API: `MLBlock`
19
- */
20
- get nodeType(): MarkuplintPreprocessorBlockType;
21
- constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
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;
7
+ export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<
8
+ T,
9
+ O,
10
+ MLASTPreprocessorSpecificBlock
11
+ > {
12
+ readonly isTransparent: boolean;
13
+ constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
14
+ /**
15
+ * Returns a string appropriate for the type of node as `MLBlock`
16
+ *
17
+ * @implements `@markuplint/ml-core` API: `MLBlock`
18
+ */
19
+ get nodeName(): '#ml-block';
20
+ /**
21
+ * Returns a number appropriate for the type of `MLBlock`
22
+ *
23
+ * @implements `@markuplint/ml-core` API: `MLBlock`
24
+ */
25
+ get nodeType(): MarkuplintPreprocessorBlockType;
26
+ /**
27
+ * @implements DOM API: `ChildNode`
28
+ */
29
+ after(...nodes: (string | MLElement<any, any>)[]): void;
30
+ /**
31
+ * @implements DOM API: `ChildNode`
32
+ */
33
+ before(...nodes: (string | MLElement<any, any>)[]): void;
34
+ /**
35
+ * @implements DOM API: `ChildNode`
36
+ */
37
+ remove(): void;
38
+ /**
39
+ * @implements DOM API: `ChildNode`
40
+ */
41
+ replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
38
42
  }
@@ -4,7 +4,11 @@ exports.MLBlock = void 0;
4
4
  const child_node_methods_1 = require("../manipulations/child-node-methods");
5
5
  const node_1 = require("./node");
6
6
  class MLBlock extends node_1.MLNode {
7
- constructor(astNode, document) {
7
+ constructor(
8
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
9
+ astNode,
10
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
11
+ document) {
8
12
  super(astNode, document);
9
13
  // TODO:
10
14
  this.isTransparent = true;
@@ -28,13 +32,17 @@ class MLBlock extends node_1.MLNode {
28
32
  /**
29
33
  * @implements DOM API: `ChildNode`
30
34
  */
31
- after(...nodes) {
35
+ after(
36
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
37
+ ...nodes) {
32
38
  (0, child_node_methods_1.after)(this, ...nodes);
33
39
  }
34
40
  /**
35
41
  * @implements DOM API: `ChildNode`
36
42
  */
37
- before(...nodes) {
43
+ before(
44
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
45
+ ...nodes) {
38
46
  (0, child_node_methods_1.before)(this, ...nodes);
39
47
  }
40
48
  /**
@@ -46,7 +54,9 @@ class MLBlock extends node_1.MLNode {
46
54
  /**
47
55
  * @implements DOM API: `ChildNode`
48
56
  */
49
- replaceWith(...nodes) {
57
+ replaceWith(
58
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
59
+ ...nodes) {
50
60
  (0, child_node_methods_1.replaceWith)(this, ...nodes);
51
61
  }
52
62
  }
@@ -1,57 +1,64 @@
1
1
  import type { MLElement } from './element';
2
- import type { MLASTAbstructNode } from '@markuplint/ml-ast';
3
- import type { RuleConfigValue } from '@markuplint/ml-config';
2
+ import type { MLASTAbstractNode } from '@markuplint/ml-ast';
3
+ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLNode } from './node';
5
- export declare abstract class MLCharacterData<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> 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 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;
57
64
  }