@markuplint/ml-core 3.11.0 → 4.0.0-alpha.1

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 (95) hide show
  1. package/lib/configs.browser.js +1 -5
  2. package/lib/configs.js +33 -30
  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 +12 -12
  7. package/lib/index.js +13 -29
  8. package/lib/ml-core.d.ts +2 -2
  9. package/lib/ml-core.js +60 -66
  10. package/lib/ml-dom/helper/accname.d.ts +1 -1
  11. package/lib/ml-dom/helper/accname.js +9 -16
  12. package/lib/ml-dom/helper/create-node.d.ts +2 -2
  13. package/lib/ml-dom/helper/create-node.js +11 -15
  14. package/lib/ml-dom/helper/debug.d.ts +1 -1
  15. package/lib/ml-dom/helper/debug.js +2 -7
  16. package/lib/ml-dom/helper/getIndent.d.ts +2 -2
  17. package/lib/ml-dom/helper/getIndent.js +15 -19
  18. package/lib/ml-dom/helper/walkers.d.ts +1 -1
  19. package/lib/ml-dom/helper/walkers.js +2 -7
  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 +2 -2
  23. package/lib/ml-dom/manipulations/child-node-methods.js +13 -25
  24. package/lib/ml-dom/manipulations/get-children.d.ts +2 -2
  25. package/lib/ml-dom/manipulations/get-children.js +3 -7
  26. package/lib/ml-dom/node/attr.d.ts +5 -5
  27. package/lib/ml-dom/node/attr.js +28 -33
  28. package/lib/ml-dom/node/block.d.ts +4 -4
  29. package/lib/ml-dom/node/block.js +7 -11
  30. package/lib/ml-dom/node/character-data.d.ts +2 -2
  31. package/lib/ml-dom/node/character-data.js +11 -16
  32. package/lib/ml-dom/node/child-node.d.ts +6 -6
  33. package/lib/ml-dom/node/child-node.js +1 -5
  34. package/lib/ml-dom/node/comment.d.ts +2 -2
  35. package/lib/ml-dom/node/comment.js +2 -6
  36. package/lib/ml-dom/node/document-fragment.d.ts +2 -2
  37. package/lib/ml-dom/node/document-fragment.js +4 -9
  38. package/lib/ml-dom/node/document-type.d.ts +4 -4
  39. package/lib/ml-dom/node/document-type.js +7 -11
  40. package/lib/ml-dom/node/document.d.ts +13 -13
  41. package/lib/ml-dom/node/document.js +233 -241
  42. package/lib/ml-dom/node/dom-token-list.d.ts +1 -1
  43. package/lib/ml-dom/node/dom-token-list.js +25 -31
  44. package/lib/ml-dom/node/element.d.ts +8 -8
  45. package/lib/ml-dom/node/element.js +278 -296
  46. package/lib/ml-dom/node/named-node-map.d.ts +1 -1
  47. package/lib/ml-dom/node/named-node-map.js +10 -18
  48. package/lib/ml-dom/node/node-list.d.ts +2 -2
  49. package/lib/ml-dom/node/node-list.js +6 -14
  50. package/lib/ml-dom/node/node-store.d.ts +2 -2
  51. package/lib/ml-dom/node/node-store.js +9 -12
  52. package/lib/ml-dom/node/node.d.ts +8 -8
  53. package/lib/ml-dom/node/node.js +58 -66
  54. package/lib/ml-dom/node/parent-node.d.ts +2 -2
  55. package/lib/ml-dom/node/parent-node.js +22 -29
  56. package/lib/ml-dom/node/rule-mapper.d.ts +2 -2
  57. package/lib/ml-dom/node/rule-mapper.js +11 -16
  58. package/lib/ml-dom/node/text.d.ts +2 -2
  59. package/lib/ml-dom/node/text.js +6 -11
  60. package/lib/ml-dom/node/types.d.ts +10 -10
  61. package/lib/ml-dom/node/types.js +1 -2
  62. package/lib/ml-dom/node/unexpected-call-error.js +1 -4
  63. package/lib/ml-dom/token/token.js +19 -23
  64. package/lib/ml-rule/create-rule.d.ts +1 -1
  65. package/lib/ml-rule/create-rule.js +1 -5
  66. package/lib/ml-rule/create-test-rule.d.ts +2 -2
  67. package/lib/ml-rule/create-test-rule.js +3 -7
  68. package/lib/ml-rule/index.d.ts +3 -3
  69. package/lib/ml-rule/index.js +3 -6
  70. package/lib/ml-rule/ml-rule-context.d.ts +2 -2
  71. package/lib/ml-rule/ml-rule-context.js +7 -11
  72. package/lib/ml-rule/ml-rule.d.ts +3 -3
  73. package/lib/ml-rule/ml-rule.js +23 -30
  74. package/lib/ml-rule/types.d.ts +2 -2
  75. package/lib/ml-rule/types.js +1 -2
  76. package/lib/plugin/index.d.ts +2 -2
  77. package/lib/plugin/index.js +2 -5
  78. package/lib/plugin/plugin.d.ts +1 -1
  79. package/lib/plugin/plugin.js +1 -5
  80. package/lib/plugin/types.d.ts +1 -1
  81. package/lib/plugin/types.js +1 -2
  82. package/lib/ruleset/index.js +4 -8
  83. package/lib/test/index.d.ts +4 -4
  84. package/lib/test/index.js +13 -23
  85. package/lib/types.d.ts +2 -2
  86. package/lib/types.js +1 -2
  87. package/lib/utils/get-location-from-chars.js +1 -5
  88. package/lib/utils/index.d.ts +1 -1
  89. package/lib/utils/index.js +1 -5
  90. package/lib/utils/string-splice.js +1 -5
  91. package/package.json +20 -15
  92. package/test/ml-dom/helper/accname.spec.js +0 -85
  93. package/test/ml-dom/helper/create-node.spec.js +0 -18
  94. package/test/ml-dom/index.spec.js +0 -680
  95. package/test/ml-dom/ml-rule/create-rule.spec.js +0 -108
@@ -1,14 +1,11 @@
1
- "use strict";
2
1
  var _MLDOMIndentation_fixed, _MLDOMIndentation_node, _MLDOMIndentation_parent;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getIndent = void 0;
5
- const tslib_1 = require("tslib");
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
6
3
  /**
7
4
  *
8
5
  * @deprecated
9
6
  * @param node
10
7
  */
11
- function getIndent(
8
+ export function getIndent(
12
9
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
13
10
  node) {
14
11
  const prevToken = node.prevToken;
@@ -51,7 +48,6 @@ node) {
51
48
  }
52
49
  return null;
53
50
  }
54
- exports.getIndent = getIndent;
55
51
  class MLDOMIndentation {
56
52
  constructor(
57
53
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
@@ -62,38 +58,38 @@ class MLDOMIndentation {
62
58
  _MLDOMIndentation_node.set(this, void 0);
63
59
  _MLDOMIndentation_parent.set(this, void 0);
64
60
  this.line = line;
65
- tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_node, originTextNode, "f");
66
- tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_parent, parentNode, "f");
67
- tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
61
+ __classPrivateFieldSet(this, _MLDOMIndentation_node, originTextNode, "f");
62
+ __classPrivateFieldSet(this, _MLDOMIndentation_parent, parentNode, "f");
63
+ __classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
68
64
  }
69
65
  get raw() {
70
- if (!tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
66
+ if (!__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== __classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
71
67
  return '';
72
68
  }
73
- return tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
69
+ return __classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
74
70
  }
75
71
  get type() {
76
- if (!tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
72
+ if (!__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== __classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
77
73
  return 'none';
78
74
  }
79
- const raw = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
75
+ const raw = __classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
80
76
  return raw === '' ? 'none' : /^\t+$/.test(raw) ? 'tab' : /^[^\t]+$/.test(raw) ? 'space' : 'mixed';
81
77
  }
82
78
  get width() {
83
- if (!tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
79
+ if (!__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").is(__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").TEXT_NODE) && this.line !== __classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
84
80
  return 0;
85
81
  }
86
- return tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f").length;
82
+ return __classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f").length;
87
83
  }
88
84
  fix(raw) {
89
- const current = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
90
- tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
91
- const node = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f");
85
+ const current = __classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
86
+ __classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
87
+ const node = __classPrivateFieldGet(this, _MLDOMIndentation_node, "f");
92
88
  const line = node.startLine;
93
89
  const lines = node.raw.split(/\r?\n/);
94
90
  const index = this.line - line;
95
91
  if (lines[index] != null) {
96
- lines[index] = lines[index].replace(current, tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f"));
92
+ lines[index] = lines[index].replace(current, __classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f"));
97
93
  }
98
94
  node.fix(lines.join('\n'));
99
95
  }
@@ -1,4 +1,4 @@
1
- import type { MLNode } from '../node/node';
1
+ import type { MLNode } from '../node/node.js';
2
2
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
3
3
  export type Walker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (node: N) => void | Promise<void> | Promise<void>[];
4
4
  export type SyncWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (node: N) => void;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sequentialWalker = exports.syncWalk = void 0;
4
- function syncWalk(
1
+ export function syncWalk(
5
2
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
6
3
  nodeList, walker) {
7
4
  for (const node of nodeList) {
@@ -11,8 +8,7 @@ nodeList, walker) {
11
8
  walker(node);
12
9
  }
13
10
  }
14
- exports.syncWalk = syncWalk;
15
- function sequentialWalker(list, walker) {
11
+ export function sequentialWalker(list, walker) {
16
12
  if (list.length === 0) {
17
13
  return Promise.resolve();
18
14
  }
@@ -51,4 +47,3 @@ function sequentialWalker(list, walker) {
51
47
  loop();
52
48
  return promise;
53
49
  }
54
- exports.sequentialWalker = sequentialWalker;
@@ -1,9 +1,9 @@
1
- export type { MLAttr as Attr } from './node/attr';
2
- export type { MLBlock as Block } from './node/block';
3
- export type { MLComment as Comment } from './node/comment';
4
- export type { MLDocumentFragment as DocumentFragment } from './node/document-fragment';
5
- export type { MLDocumentType as DocumentType } from './node/document-type';
6
- export type { MLElement as Element } from './node/element';
7
- export type { MLText as Text } from './node/text';
8
- export type { MLChildNode as ChildNode } from './node/child-node';
9
- export { MLDocument as Document } from './node/document';
1
+ export type { MLAttr as Attr } from './node/attr.js';
2
+ export type { MLBlock as Block } from './node/block.js';
3
+ export type { MLComment as Comment } from './node/comment.js';
4
+ export type { MLDocumentFragment as DocumentFragment } from './node/document-fragment.js';
5
+ export type { MLDocumentType as DocumentType } from './node/document-type.js';
6
+ export type { MLElement as Element } from './node/element.js';
7
+ export type { MLText as Text } from './node/text.js';
8
+ export type { MLChildNode as ChildNode } from './node/child-node.js';
9
+ export { MLDocument as Document } from './node/document.js';
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- var document_1 = require("./node/document");
5
- Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return document_1.MLDocument; } });
1
+ export { MLDocument as Document } from './node/document.js';
@@ -1,5 +1,5 @@
1
- import type { MLElement } from '../node/element';
2
- import type { MLNode } from '../node/node';
1
+ import type { MLElement } from '../node/element.js';
2
+ import type { MLNode } from '../node/node.js';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
4
  /**
5
5
  *
@@ -1,66 +1,57 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nextElementSibling = exports.previousElementSibling = exports.remove = exports.replaceWith = exports.after = exports.before = void 0;
4
- const tslib_1 = require("tslib");
5
- const unexpected_call_error_1 = tslib_1.__importDefault(require("../node/unexpected-call-error"));
1
+ import UnexpectedCallError from '../node/unexpected-call-error.js';
6
2
  /**
7
3
  *
8
4
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-before%E2%91%A0
9
5
  */
10
- function before(
6
+ export function before(
11
7
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
12
8
  node,
13
9
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
10
  ...additionalNodes) {
15
- throw new unexpected_call_error_1.default('Not supported "before" method');
11
+ throw new UnexpectedCallError('Not supported "before" method');
16
12
  }
17
- exports.before = before;
18
13
  /**
19
14
  *
20
15
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-after%E2%91%A0
21
16
  */
22
- function after(
17
+ export function after(
23
18
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
24
19
  node,
25
20
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
26
21
  ...additionalNodes) {
27
- throw new unexpected_call_error_1.default('Not supported "after" method');
22
+ throw new UnexpectedCallError('Not supported "after" method');
28
23
  }
29
- exports.after = after;
30
24
  /**
31
25
  *
32
26
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-replacewith%E2%91%A0
33
27
  */
34
- function replaceWith(
28
+ export function replaceWith(
35
29
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
36
30
  node,
37
31
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
38
32
  ...additionalNodes) {
39
- throw new unexpected_call_error_1.default('Not supported "replaceWith" method');
33
+ throw new UnexpectedCallError('Not supported "replaceWith" method');
40
34
  }
41
- exports.replaceWith = replaceWith;
42
35
  /**
43
36
  *
44
37
  * @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-remove%E2%91%A0
45
38
  */
46
- function remove(
39
+ export function remove(
47
40
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
48
41
  node) {
49
- throw new unexpected_call_error_1.default('Not supported "remove" method');
42
+ throw new UnexpectedCallError('Not supported "remove" method');
50
43
  }
51
- exports.remove = remove;
52
44
  /**
53
45
  *
54
46
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A0
55
47
  */
56
- function previousElementSibling(
48
+ export function previousElementSibling(
57
49
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
58
50
  node) {
59
- var _a, _b;
60
51
  let prevNode = node.prevNode;
61
52
  while (prevNode) {
62
53
  if (((node.parentNode === null && prevNode.parentNode === null) ||
63
- ((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = prevNode.parentNode) === null || _b === void 0 ? void 0 : _b.uuid)) &&
54
+ node.parentNode?.uuid === prevNode.parentNode?.uuid) &&
64
55
  prevNode.is(prevNode.ELEMENT_NODE)) {
65
56
  return prevNode;
66
57
  }
@@ -68,19 +59,17 @@ node) {
68
59
  }
69
60
  return null;
70
61
  }
71
- exports.previousElementSibling = previousElementSibling;
72
62
  /**
73
63
  *
74
64
  * @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A0
75
65
  */
76
- function nextElementSibling(
66
+ export function nextElementSibling(
77
67
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
78
68
  node) {
79
- var _a, _b;
80
69
  let nextNode = node.nextNode;
81
70
  while (nextNode) {
82
71
  if (((node.parentNode === null && nextNode.parentNode === null) ||
83
- ((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = nextNode.parentNode) === null || _b === void 0 ? void 0 : _b.uuid)) &&
72
+ node.parentNode?.uuid === nextNode.parentNode?.uuid) &&
84
73
  nextNode.is(nextNode.ELEMENT_NODE)) {
85
74
  return nextNode;
86
75
  }
@@ -88,4 +77,3 @@ node) {
88
77
  }
89
78
  return null;
90
79
  }
91
- exports.nextElementSibling = nextElementSibling;
@@ -1,4 +1,4 @@
1
- import type { MLElement } from '../node/element';
2
- import type { MLNode } from '../node/node';
1
+ import type { MLElement } from '../node/element.js';
2
+ import type { MLNode } from '../node/node.js';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
4
  export declare function getChildren<T extends RuleConfigValue, O extends PlainData = undefined>(node: MLNode<T, O>): HTMLCollectionOf<MLElement<T, O>>;
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChildren = void 0;
4
- const node_list_1 = require("../node/node-list");
5
- function getChildren(
1
+ import { toHTMLCollection } from '../node/node-list.js';
2
+ export function getChildren(
6
3
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
7
4
  node) {
8
- return (0, node_list_1.toHTMLCollection)(Array.from(node.childNodes).filter((child) => {
5
+ return toHTMLCollection(Array.from(node.childNodes).filter((child) => {
9
6
  return child.nodeType === child.ELEMENT_NODE;
10
7
  }));
11
8
  }
12
- exports.getChildren = getChildren;
@@ -1,10 +1,10 @@
1
- import type { MLElement } from './element';
2
- import type { AttributeNodeType } from './types';
1
+ import type { MLElement } from './element.js';
2
+ import type { AttributeNodeType } from './types.js';
3
3
  import type { MLASTAttr } from '@markuplint/ml-ast';
4
4
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
5
- import { MLToken } from '../token/token';
6
- import { MLDomTokenList } from './dom-token-list';
7
- import { MLNode } from './node';
5
+ import { MLToken } from '../token/token.js';
6
+ import { MLDomTokenList } from './dom-token-list.js';
7
+ import { MLNode } from './node.js';
8
8
  export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<T, O, MLASTAttr> implements Attr {
9
9
  #private;
10
10
  readonly candidate?: string;
@@ -1,20 +1,16 @@
1
- "use strict";
2
1
  var _MLAttr_localName, _MLAttr_namespaceURI, _MLAttr_potentialName, _MLAttr_potentialValue;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MLAttr = void 0;
5
- const tslib_1 = require("tslib");
6
- const ml_spec_1 = require("@markuplint/ml-spec");
7
- const token_1 = require("../token/token");
8
- const dom_token_list_1 = require("./dom-token-list");
9
- const node_1 = require("./node");
10
- const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
11
- class MLAttr extends node_1.MLNode {
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
3
+ import { resolveNamespace } from '@markuplint/ml-spec';
4
+ import { MLToken } from '../token/token.js';
5
+ import { MLDomTokenList } from './dom-token-list.js';
6
+ import { MLNode } from './node.js';
7
+ import UnexpectedCallError from './unexpected-call-error.js';
8
+ export class MLAttr extends MLNode {
12
9
  constructor(
13
10
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
11
  astToken,
15
12
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
16
13
  ownElement) {
17
- var _a, _b, _c, _d;
18
14
  super(astToken, ownElement.ownerMLDocument);
19
15
  this.endQuote = null;
20
16
  this.equal = null;
@@ -36,29 +32,29 @@ class MLAttr extends node_1.MLNode {
36
32
  */
37
33
  this.valueType = 'string';
38
34
  if (this._astToken.type === 'html-attr') {
39
- this.spacesBeforeName = new token_1.MLToken(this._astToken.spacesBeforeName);
40
- this.nameNode = new token_1.MLToken(this._astToken.name);
41
- this.spacesBeforeEqual = new token_1.MLToken(this._astToken.spacesBeforeEqual);
42
- this.equal = new token_1.MLToken(this._astToken.equal);
43
- this.spacesAfterEqual = new token_1.MLToken(this._astToken.spacesAfterEqual);
44
- this.startQuote = new token_1.MLToken(this._astToken.startQuote);
45
- this.valueNode = new token_1.MLToken(this._astToken.value);
46
- this.endQuote = new token_1.MLToken(this._astToken.endQuote);
35
+ this.spacesBeforeName = new MLToken(this._astToken.spacesBeforeName);
36
+ this.nameNode = new MLToken(this._astToken.name);
37
+ this.spacesBeforeEqual = new MLToken(this._astToken.spacesBeforeEqual);
38
+ this.equal = new MLToken(this._astToken.equal);
39
+ this.spacesAfterEqual = new MLToken(this._astToken.spacesAfterEqual);
40
+ this.startQuote = new MLToken(this._astToken.startQuote);
41
+ this.valueNode = new MLToken(this._astToken.value);
42
+ this.endQuote = new MLToken(this._astToken.endQuote);
47
43
  this.isDynamicValue = this._astToken.isDynamicValue;
48
44
  this.isDirective = this._astToken.isDirective;
49
45
  this.candidate = this._astToken.candidate;
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");
46
+ __classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName ?? this.nameNode?.raw ?? '', "f");
47
+ __classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.value.raw ?? '', "f");
52
48
  }
53
49
  else {
54
50
  this.valueType = this._astToken.valueType;
55
51
  this.isDuplicatable = this._astToken.isDuplicatable;
56
- tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName, "f");
57
- tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.potentialValue, "f");
52
+ __classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName, "f");
53
+ __classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.potentialValue, "f");
58
54
  }
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");
55
+ const ns = resolveNamespace(__classPrivateFieldGet(this, _MLAttr_potentialName, "f"), ownElement.namespaceURI);
56
+ __classPrivateFieldSet(this, _MLAttr_localName, ns.localName, "f");
57
+ __classPrivateFieldSet(this, _MLAttr_namespaceURI, ns.namespaceURI, "f");
62
58
  this.ownerElement = ownElement;
63
59
  this.isDuplicatable = this._astToken.isDuplicatable;
64
60
  }
@@ -70,7 +66,7 @@ class MLAttr extends node_1.MLNode {
70
66
  * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
71
67
  */
72
68
  get localName() {
73
- return tslib_1.__classPrivateFieldGet(this, _MLAttr_localName, "f");
69
+ return __classPrivateFieldGet(this, _MLAttr_localName, "f");
74
70
  }
75
71
  /**
76
72
  *
@@ -78,7 +74,7 @@ class MLAttr extends node_1.MLNode {
78
74
  * @see https://dom.spec.whatwg.org/#dom-attr-name
79
75
  */
80
76
  get name() {
81
- return tslib_1.__classPrivateFieldGet(this, _MLAttr_potentialName, "f");
77
+ return __classPrivateFieldGet(this, _MLAttr_potentialName, "f");
82
78
  }
83
79
  /**
84
80
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
@@ -88,7 +84,7 @@ class MLAttr extends node_1.MLNode {
88
84
  * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
89
85
  */
90
86
  get namespaceURI() {
91
- return tslib_1.__classPrivateFieldGet(this, _MLAttr_namespaceURI, "f");
87
+ return __classPrivateFieldGet(this, _MLAttr_namespaceURI, "f");
92
88
  }
93
89
  /**
94
90
  * Returns a string appropriate for the type of node as `Attr`
@@ -115,7 +111,7 @@ class MLAttr extends node_1.MLNode {
115
111
  * @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
116
112
  */
117
113
  get prefix() {
118
- throw new unexpected_call_error_1.default('Not supported "prefix" property');
114
+ throw new UnexpectedCallError('Not supported "prefix" property');
119
115
  }
120
116
  /**
121
117
  * @implements `@markuplint/ml-core` API: `MLAttr`
@@ -134,14 +130,14 @@ class MLAttr extends node_1.MLNode {
134
130
  * @implements `@markuplint/ml-core` API: `MLAttr`
135
131
  */
136
132
  get tokenList() {
137
- return this.isDynamicValue ? null : new dom_token_list_1.MLDomTokenList(this.value, [this]);
133
+ return this.isDynamicValue ? null : new MLDomTokenList(this.value, [this]);
138
134
  }
139
135
  /**
140
136
  * @implements DOM API: `Attr`
141
137
  * @see https://dom.spec.whatwg.org/#dom-attr-value
142
138
  */
143
139
  get value() {
144
- return tslib_1.__classPrivateFieldGet(this, _MLAttr_potentialValue, "f");
140
+ return __classPrivateFieldGet(this, _MLAttr_potentialValue, "f");
145
141
  }
146
142
  /**
147
143
  * @implements `@markuplint/ml-core` API: `MLAttr`
@@ -157,5 +153,4 @@ class MLAttr extends node_1.MLNode {
157
153
  return this.raw;
158
154
  }
159
155
  }
160
- exports.MLAttr = MLAttr;
161
156
  _MLAttr_localName = new WeakMap(), _MLAttr_namespaceURI = new WeakMap(), _MLAttr_potentialName = new WeakMap(), _MLAttr_potentialValue = new WeakMap();
@@ -1,9 +1,9 @@
1
- import type { MLDocument } from './document';
2
- import type { MLElement } from './element';
3
- import type { MarkuplintPreprocessorBlockType } from './types';
1
+ import type { MLDocument } from './document.js';
2
+ import type { MLElement } from './element.js';
3
+ import type { MarkuplintPreprocessorBlockType } from './types.js';
4
4
  import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
5
5
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
6
- import { MLNode } from './node';
6
+ import { MLNode } from './node.js';
7
7
  export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<T, O, MLASTPreprocessorSpecificBlock> {
8
8
  readonly isTransparent: boolean;
9
9
  constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MLBlock = void 0;
4
- const child_node_methods_1 = require("../manipulations/child-node-methods");
5
- const node_1 = require("./node");
6
- class MLBlock extends node_1.MLNode {
1
+ import { after, before, remove, replaceWith } from '../manipulations/child-node-methods.js';
2
+ import { MLNode } from './node.js';
3
+ export class MLBlock extends MLNode {
7
4
  constructor(
8
5
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
9
6
  astNode,
@@ -35,7 +32,7 @@ class MLBlock extends node_1.MLNode {
35
32
  after(
36
33
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
37
34
  ...nodes) {
38
- (0, child_node_methods_1.after)(this, ...nodes);
35
+ after(this, ...nodes);
39
36
  }
40
37
  /**
41
38
  * @implements DOM API: `ChildNode`
@@ -43,13 +40,13 @@ class MLBlock extends node_1.MLNode {
43
40
  before(
44
41
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
45
42
  ...nodes) {
46
- (0, child_node_methods_1.before)(this, ...nodes);
43
+ before(this, ...nodes);
47
44
  }
48
45
  /**
49
46
  * @implements DOM API: `ChildNode`
50
47
  */
51
48
  remove() {
52
- (0, child_node_methods_1.remove)(this);
49
+ remove(this);
53
50
  }
54
51
  /**
55
52
  * @implements DOM API: `ChildNode`
@@ -57,7 +54,6 @@ class MLBlock extends node_1.MLNode {
57
54
  replaceWith(
58
55
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
59
56
  ...nodes) {
60
- (0, child_node_methods_1.replaceWith)(this, ...nodes);
57
+ replaceWith(this, ...nodes);
61
58
  }
62
59
  }
63
- exports.MLBlock = MLBlock;
@@ -1,7 +1,7 @@
1
- import type { MLElement } from './element';
1
+ import type { MLElement } from './element.js';
2
2
  import type { MLASTAbstractNode } from '@markuplint/ml-ast';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
- import { MLNode } from './node';
4
+ import { MLNode } from './node.js';
5
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
6
  /**
7
7
  * @implements DOM API: `CharacterData`
@@ -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,9 +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 { MLDocumentType } from './document-type.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
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
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,7 +1,7 @@
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';
4
+ import { MLCharacterData } from './character-data.js';
5
5
  export declare class MLComment<T extends RuleConfigValue, O extends PlainData = undefined> extends MLCharacterData<T, O, MLASTComment> implements Comment {
6
6
  /**
7
7
  * Returns a string appropriate for the type of node as `Attr`
@@ -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;