@markuplint/ml-core 3.3.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/configs.js +1 -2
  2. package/lib/index.d.ts +1 -11
  3. package/lib/ml-core.d.ts +12 -23
  4. package/lib/ml-core.js +4 -4
  5. package/lib/ml-dom/helper/accname.js +15 -5
  6. package/lib/ml-dom/helper/create-node.d.ts +2 -5
  7. package/lib/ml-dom/helper/create-node.js +3 -1
  8. package/lib/ml-dom/helper/debug.js +6 -2
  9. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  10. package/lib/ml-dom/helper/getIndent.js +11 -3
  11. package/lib/ml-dom/helper/walkers.d.ts +5 -13
  12. package/lib/ml-dom/helper/walkers.js +3 -1
  13. package/lib/ml-dom/manipulations/child-node-methods.d.ts +7 -20
  14. package/lib/ml-dom/manipulations/child-node-methods.js +24 -6
  15. package/lib/ml-dom/manipulations/get-children.d.ts +2 -4
  16. package/lib/ml-dom/manipulations/get-children.js +3 -1
  17. package/lib/ml-dom/node/attr.d.ts +91 -91
  18. package/lib/ml-dom/node/attr.js +5 -1
  19. package/lib/ml-dom/node/block.d.ts +32 -32
  20. package/lib/ml-dom/node/block.js +14 -4
  21. package/lib/ml-dom/node/character-data.d.ts +53 -60
  22. package/lib/ml-dom/node/character-data.js +9 -3
  23. package/lib/ml-dom/node/child-node.d.ts +3 -8
  24. package/lib/ml-dom/node/child-node.js +3 -1
  25. package/lib/ml-dom/node/comment.d.ts +13 -16
  26. package/lib/ml-dom/node/document-fragment.d.ts +20 -23
  27. package/lib/ml-dom/node/document-type.d.ts +32 -35
  28. package/lib/ml-dom/node/document-type.js +14 -4
  29. package/lib/ml-dom/node/document.d.ts +1590 -1603
  30. package/lib/ml-dom/node/document.js +41 -7
  31. package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
  32. package/lib/ml-dom/node/dom-token-list.js +8 -6
  33. package/lib/ml-dom/node/element.d.ts +1897 -1895
  34. package/lib/ml-dom/node/element.js +58 -14
  35. package/lib/ml-dom/node/named-node-map.d.ts +40 -45
  36. package/lib/ml-dom/node/named-node-map.js +11 -4
  37. package/lib/ml-dom/node/node-list.d.ts +4 -10
  38. package/lib/ml-dom/node/node-list.js +23 -4
  39. package/lib/ml-dom/node/node-store.d.ts +4 -4
  40. package/lib/ml-dom/node/node-store.js +8 -3
  41. package/lib/ml-dom/node/node.d.ts +473 -493
  42. package/lib/ml-dom/node/node.js +46 -16
  43. package/lib/ml-dom/node/parent-node.d.ts +58 -67
  44. package/lib/ml-dom/node/parent-node.js +9 -3
  45. package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
  46. package/lib/ml-dom/node/rule-mapper.js +9 -2
  47. package/lib/ml-dom/node/text.d.ts +47 -50
  48. package/lib/ml-dom/node/types.d.ts +14 -70
  49. package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
  50. package/lib/ml-dom/token/token.d.ts +44 -44
  51. package/lib/ml-rule/create-rule.d.ts +2 -2
  52. package/lib/ml-rule/create-test-rule.d.ts +4 -6
  53. package/lib/ml-rule/ml-rule-context.d.ts +50 -58
  54. package/lib/ml-rule/ml-rule-context.js +3 -1
  55. package/lib/ml-rule/ml-rule.d.ts +26 -28
  56. package/lib/ml-rule/ml-rule.js +30 -24
  57. package/lib/ml-rule/types.d.ts +17 -23
  58. package/lib/plugin/plugin.d.ts +1 -1
  59. package/lib/plugin/types.d.ts +7 -7
  60. package/lib/ruleset/index.d.ts +4 -4
  61. package/lib/ruleset/index.js +4 -4
  62. package/lib/test/index.d.ts +8 -20
  63. package/lib/test/index.js +1 -1
  64. package/lib/types.d.ts +9 -8
  65. package/lib/utils/get-location-from-chars.d.ts +4 -9
  66. package/package.json +14 -12
@@ -9,7 +9,9 @@ const node_list_1 = require("./node-list");
9
9
  const node_store_1 = require("./node-store");
10
10
  const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
11
11
  class MLNode extends token_1.MLToken {
12
- constructor(astNode, document) {
12
+ constructor(astNode,
13
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
+ document) {
13
15
  super(astNode);
14
16
  /**
15
17
  * @implements DOM API: `Node`
@@ -187,7 +189,8 @@ class MLNode extends token_1.MLToken {
187
189
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-firstchild%E2%91%A0
188
190
  */
189
191
  get firstChild() {
190
- return this.childNodes[0] || null;
192
+ var _a;
193
+ return (_a = this.childNodes[0]) !== null && _a !== void 0 ? _a : null;
191
194
  }
192
195
  /**
193
196
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
@@ -207,7 +210,8 @@ class MLNode extends token_1.MLToken {
207
210
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-lastchild%E2%91%A0
208
211
  */
209
212
  get lastChild() {
210
- return this.childNodes[this.childNodes.length - 1] || null;
213
+ var _a;
214
+ return (_a = this.childNodes[this.childNodes.length - 1]) !== null && _a !== void 0 ? _a : null;
211
215
  }
212
216
  /**
213
217
  * @implements `@markuplint/ml-core` API: `MLNode`
@@ -409,8 +413,12 @@ class MLNode extends token_1.MLToken {
409
413
  throw new Error('Invalid call: Some rule evaluations may not be running asynchronously.');
410
414
  }
411
415
  const name = this.ownerMLDocument.currentRule.name;
412
- const rule = this.rules[name];
413
- return this.ownerMLDocument.currentRule.optimizeOption(rule);
416
+ const settingRule = this.rules[name];
417
+ const rule = this.ownerMLDocument.currentRule.optimizeOption(settingRule);
418
+ if (!rule) {
419
+ throw new Error(`Rule data "${name}" doesn't exist in rules ([${Object.keys(this.rules).map(name => `"${name}"`)}]) of ${this.nodeName}("${this.raw}")`);
420
+ }
421
+ return rule;
414
422
  }
415
423
  /**
416
424
  * Returns a syntactical parent node
@@ -475,7 +483,9 @@ class MLNode extends token_1.MLToken {
475
483
  * @implements DOM API: `EventTarget`
476
484
  * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-addeventlistener%E2%91%A2
477
485
  */
478
- addEventListener(type, callback, options = {}) {
486
+ addEventListener(type,
487
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
488
+ callback, options = {}) {
479
489
  throw new unexpected_call_error_1.default('Not supported "addEventListener" method');
480
490
  }
481
491
  /**
@@ -505,7 +515,9 @@ class MLNode extends token_1.MLToken {
505
515
  * @implements DOM API: `Node`
506
516
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-comparedocumentposition%E2%91%A0
507
517
  */
508
- compareDocumentPosition(other) {
518
+ compareDocumentPosition(
519
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
520
+ other) {
509
521
  throw new unexpected_call_error_1.default('Not supported "compareDocumentPosition" method');
510
522
  }
511
523
  /**
@@ -515,7 +527,9 @@ class MLNode extends token_1.MLToken {
515
527
  * @implements DOM API: `Node`
516
528
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-contains%E2%91%A0
517
529
  */
518
- contains(other) {
530
+ contains(
531
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
532
+ other) {
519
533
  throw new unexpected_call_error_1.default('Not supported "contains" method');
520
534
  }
521
535
  /**
@@ -525,7 +539,9 @@ class MLNode extends token_1.MLToken {
525
539
  * @implements DOM API: `EventTarget`
526
540
  * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-dispatchevent%E2%91%A2
527
541
  */
528
- dispatchEvent(event) {
542
+ dispatchEvent(
543
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
544
+ event) {
529
545
  throw new unexpected_call_error_1.default('Not supported "dispatchEvent" method');
530
546
  }
531
547
  /**
@@ -535,7 +551,9 @@ class MLNode extends token_1.MLToken {
535
551
  * @implements DOM API: `Node`
536
552
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-getrootnode%E2%91%A0
537
553
  */
538
- getRootNode(options) {
554
+ getRootNode(
555
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
556
+ options) {
539
557
  if (options) {
540
558
  throw new unexpected_call_error_1.default('Not supported options');
541
559
  }
@@ -559,7 +577,9 @@ class MLNode extends token_1.MLToken {
559
577
  * @implements DOM API: `Node`
560
578
  * @see https://dom.spec.whatwg.org/#dom-node-insertbefore
561
579
  */
562
- insertBefore(node, child) {
580
+ insertBefore(node,
581
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
582
+ child) {
563
583
  throw new unexpected_call_error_1.default('Not supported "insertBefore" method');
564
584
  }
565
585
  /**
@@ -585,7 +605,9 @@ class MLNode extends token_1.MLToken {
585
605
  * @implements DOM API: `Node`
586
606
  * @see https://dom.spec.whatwg.org/#ref-for-dom-node-isequalnode%E2%91%A0
587
607
  */
588
- isEqualNode(otherNode) {
608
+ isEqualNode(
609
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
610
+ otherNode) {
589
611
  throw new unexpected_call_error_1.default('Not supported "isEqualNode" method');
590
612
  }
591
613
  /**
@@ -601,7 +623,9 @@ class MLNode extends token_1.MLToken {
601
623
  * @implements DOM API: `Node`
602
624
  * @see https://dom.spec.whatwg.org/#dom-node-issamenode
603
625
  */
604
- isSameNode(otherNode) {
626
+ isSameNode(
627
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
628
+ otherNode) {
605
629
  throw new unexpected_call_error_1.default('Not supported "isSameNode" method');
606
630
  }
607
631
  /**
@@ -651,7 +675,9 @@ class MLNode extends token_1.MLToken {
651
675
  * @implements DOM API: `EventTarget`
652
676
  * @see https://dom.spec.whatwg.org/#ref-for-dom-eventtarget-removeeventlistener%E2%91%A1
653
677
  */
654
- removeEventListener(type, callback, options = {}) {
678
+ removeEventListener(type,
679
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
680
+ callback, options = {}) {
655
681
  throw new unexpected_call_error_1.default('Not supported "removeEventListener" method');
656
682
  }
657
683
  /**
@@ -661,13 +687,17 @@ class MLNode extends token_1.MLToken {
661
687
  * @implements DOM API: `Node`
662
688
  * @see https://dom.spec.whatwg.org/#dom-node-replacechild
663
689
  */
664
- replaceChild(node, child) {
690
+ replaceChild(
691
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
692
+ node, child) {
665
693
  throw new unexpected_call_error_1.default('Not supported "removeChild" method');
666
694
  }
667
695
  /**
668
696
  * @implements `@markuplint/ml-core` API: `MLNode`
669
697
  */
670
- resetChildren(childNodes) {
698
+ resetChildren(
699
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
700
+ childNodes) {
671
701
  tslib_1.__classPrivateFieldSet(this, _MLNode_childNodes, childNodes !== null && childNodes !== void 0 ? childNodes : tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f"), "f");
672
702
  }
673
703
  }
@@ -1,75 +1,66 @@
1
1
  import type { MLElement } from './element';
2
2
  import type { MLASTAbstractNode } from '@markuplint/ml-ast';
3
- import type { RuleConfigValue } from '@markuplint/ml-config';
3
+ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLNode } from './node';
5
5
  /**
6
6
  *
7
7
  * @see https://dom.spec.whatwg.org/#interface-parentnode
8
8
  */
9
- export declare abstract class MLParentNode<
10
- T extends RuleConfigValue,
11
- O = null,
12
- A extends MLASTAbstractNode = MLASTAbstractNode,
13
- >
14
- extends MLNode<T, O, A>
15
- implements ParentNode
16
- {
17
- #private;
18
- /**
19
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
20
- * @see https://dom.spec.whatwg.org/#dom-parentnode-childelementcount
21
- */
22
- get childElementCount(): number;
23
- /**
24
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
25
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-children%E2%91%A0
26
- */
27
- get children(): HTMLCollectionOf<MLElement<T, O>>;
28
- /**
29
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
30
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-firstelementchild%E2%91%A0
31
- */
32
- get firstElementChild(): MLElement<T, O>;
33
- /**
34
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
35
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-lastelementchild%E2%91%A0
36
- */
37
- get lastElementChild(): MLElement<T, O>;
38
- /**
39
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
40
- *
41
- * @unsupported
42
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
43
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-append%E2%91%A0
44
- */
45
- append(...nodes: (string | Node)[]): void;
46
- /**
47
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
48
- *
49
- * @unsupported
50
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
51
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-prepend%E2%91%A0
52
- */
53
- prepend(...nodes: (string | Node)[]): void;
54
- /**
55
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
56
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0
57
- */
58
- querySelector(selectors: string): MLElement<T, O> | null;
59
- /**
60
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
61
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselectorall%E2%91%A0
62
- */
63
- querySelectorAll(selectors: string): NodeListOf<MLElement<T, O>>;
64
- /**
65
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
66
- *
67
- * @unsupported
68
- * @implements DOM API: `Element`, `Document`, `DocumentFragment`
69
- * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-replacechildren%E2%91%A0
70
- */
71
- replaceChildren(...nodes: (string | Node)[]): void;
72
- protected _descendantsToArray<N extends MLNode<T, O>>(
73
- filter?: (node: MLNode<T, O>) => N | null | void,
74
- ): ReadonlyArray<N>;
9
+ export declare abstract class MLParentNode<T extends RuleConfigValue, O extends PlainData = undefined, A extends MLASTAbstractNode = MLASTAbstractNode> extends MLNode<T, O, A> implements ParentNode {
10
+ #private;
11
+ /**
12
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
13
+ * @see https://dom.spec.whatwg.org/#dom-parentnode-childelementcount
14
+ */
15
+ get childElementCount(): number;
16
+ /**
17
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
18
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-children%E2%91%A0
19
+ */
20
+ get children(): HTMLCollectionOf<MLElement<T, O>>;
21
+ /**
22
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
23
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-firstelementchild%E2%91%A0
24
+ */
25
+ get firstElementChild(): MLElement<T, O> | null;
26
+ /**
27
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
28
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-lastelementchild%E2%91%A0
29
+ */
30
+ get lastElementChild(): MLElement<T, O> | null;
31
+ /**
32
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
33
+ *
34
+ * @unsupported
35
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
36
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-append%E2%91%A0
37
+ */
38
+ append(...nodes: (string | Node)[]): void;
39
+ /**
40
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
41
+ *
42
+ * @unsupported
43
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
44
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-prepend%E2%91%A0
45
+ */
46
+ prepend(...nodes: (string | Node)[]): void;
47
+ /**
48
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
49
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselector%E2%91%A0
50
+ */
51
+ querySelector(selectors: string): MLElement<T, O> | null;
52
+ /**
53
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
54
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-queryselectorall%E2%91%A0
55
+ */
56
+ querySelectorAll(selectors: string): NodeListOf<MLElement<T, O>>;
57
+ /**
58
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
59
+ *
60
+ * @unsupported
61
+ * @implements DOM API: `Element`, `Document`, `DocumentFragment`
62
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-replacechildren%E2%91%A0
63
+ */
64
+ replaceChildren(...nodes: (string | Node)[]): void;
65
+ protected _descendantsToArray<N extends MLNode<T, O>>(filter?: (node: MLNode<T, O>) => N | null | void): ReadonlyArray<N>;
75
66
  }
@@ -64,7 +64,9 @@ class MLParentNode extends node_1.MLNode {
64
64
  * @implements DOM API: `Element`, `Document`, `DocumentFragment`
65
65
  * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-append%E2%91%A0
66
66
  */
67
- append(...nodes) {
67
+ append(
68
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
69
+ ...nodes) {
68
70
  throw new unexpected_call_error_1.default('Not supported "append" method');
69
71
  }
70
72
  /**
@@ -74,7 +76,9 @@ class MLParentNode extends node_1.MLNode {
74
76
  * @implements DOM API: `Element`, `Document`, `DocumentFragment`
75
77
  * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-prepend%E2%91%A0
76
78
  */
77
- prepend(...nodes) {
79
+ prepend(
80
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
81
+ ...nodes) {
78
82
  throw new unexpected_call_error_1.default('Not supported "prepend" method');
79
83
  }
80
84
  /**
@@ -109,7 +113,9 @@ class MLParentNode extends node_1.MLNode {
109
113
  * @implements DOM API: `Element`, `Document`, `DocumentFragment`
110
114
  * @see https://dom.spec.whatwg.org/#ref-for-dom-parentnode-replacechildren%E2%91%A0
111
115
  */
112
- replaceChildren(...nodes) {
116
+ replaceChildren(
117
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
118
+ ...nodes) {
113
119
  throw new unexpected_call_error_1.default('Not supported "replaceChildren" method');
114
120
  }
115
121
  _descendantsToArray(filter) {
@@ -4,14 +4,14 @@ import type { AnyRule } from '@markuplint/ml-config';
4
4
  import type { Specificity } from '@markuplint/selector';
5
5
  type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
6
6
  type MappingLayer = {
7
- from: RuleType;
8
- specificity: Specificity;
9
- rule: AnyRule;
7
+ readonly from: RuleType;
8
+ readonly specificity: Specificity;
9
+ readonly rule: AnyRule;
10
10
  };
11
11
  export declare class RuleMapper {
12
- #private;
13
- constructor(document: MLDocument<any, any>);
14
- apply(): void;
15
- set(node: MLNode<any, any>, ruleName: string, rule: MappingLayer): void;
12
+ #private;
13
+ constructor(document: MLDocument<any, any>);
14
+ apply(): void;
15
+ set(node: MLNode<any, any>, ruleName: string, rule: MappingLayer): void;
16
16
  }
17
17
  export {};
@@ -9,7 +9,9 @@ const ruleMapperLog = debug_1.log.extend('rule-mapper');
9
9
  const ruleMapperNodeLog = ruleMapperLog.extend('node');
10
10
  const ruleMapperNodeRuleLog = ruleMapperNodeLog.extend('rule');
11
11
  class RuleMapper {
12
- constructor(document) {
12
+ constructor(
13
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
14
+ document) {
13
15
  _RuleMapper_nodeList.set(this, void 0);
14
16
  _RuleMapper_ruleMap.set(this, new Map());
15
17
  tslib_1.__classPrivateFieldSet(this, _RuleMapper_nodeList, Object.freeze([document, ...document.nodeList]), "f");
@@ -24,12 +26,17 @@ class RuleMapper {
24
26
  ruleMapperNodeLog('<%s>', node.nodeName);
25
27
  Object.keys(rules).forEach(ruleName => {
26
28
  const rule = rules[ruleName];
29
+ if (!rule) {
30
+ return;
31
+ }
27
32
  node.rules[ruleName] = rule.rule;
28
33
  ruleMapperNodeRuleLog('[from: %s(%s)] %s: %o', rule.from, rule.specificity, ruleName, rule.rule);
29
34
  });
30
35
  });
31
36
  }
32
- set(node, ruleName, rule) {
37
+ set(
38
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
39
+ node, ruleName, rule) {
33
40
  const rules = tslib_1.__classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").get(node.uuid) || {};
34
41
  const currentRule = rules[ruleName];
35
42
  if (currentRule) {
@@ -1,54 +1,51 @@
1
1
  import type { TextNodeType } from './types';
2
2
  import type { MLASTText } from '@markuplint/ml-ast';
3
- import type { RuleConfigValue } from '@markuplint/ml-config';
3
+ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
4
  import { MLCharacterData } from './character-data';
5
- export declare class MLText<T extends RuleConfigValue, O = null>
6
- extends MLCharacterData<T, O, MLASTText>
7
- implements Text
8
- {
9
- /**
10
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
11
- *
12
- * @unsupported
13
- * @implements DOM API: `Text`
14
- */
15
- get assignedSlot(): HTMLSlotElement;
16
- /**
17
- * Returns a string appropriate for the type of node as `Text`
18
- *
19
- * @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
20
- */
21
- get nodeName(): '#text';
22
- /**
23
- * Returns a number appropriate for the type of `Text`
24
- */
25
- get nodeType(): TextNodeType;
26
- get textContent(): string | null;
27
- /**
28
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
29
- *
30
- * @unsupported
31
- * @implements DOM API: `Text`
32
- * @see https://dom.spec.whatwg.org/#ref-for-dom-text-splittext%E2%91%A0
33
- */
34
- get wholeText(): string;
35
- /**
36
- * Returns `true` if a parent element is `<script>` or `<style>`
37
- *
38
- * @implements `@markuplint/ml-core` API: `MLText`
39
- * @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
40
- */
41
- isRawTextElementContent(): boolean;
42
- /**
43
- * @implements `@markuplint/ml-core` API: `MLText`
44
- */
45
- isWhitespace(): boolean;
46
- /**
47
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
48
- *
49
- * @unsupported
50
- * @implements DOM API: `Text`
51
- * @see https://dom.spec.whatwg.org/#ref-for-dom-text-wholetext%E2%91%A0
52
- */
53
- splitText(offset: number): Text;
5
+ export declare class MLText<T extends RuleConfigValue, O extends PlainData = undefined> extends MLCharacterData<T, O, MLASTText> implements Text {
6
+ /**
7
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
8
+ *
9
+ * @unsupported
10
+ * @implements DOM API: `Text`
11
+ */
12
+ get assignedSlot(): HTMLSlotElement;
13
+ /**
14
+ * Returns a string appropriate for the type of node as `Text`
15
+ *
16
+ * @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
17
+ */
18
+ get nodeName(): "#text";
19
+ /**
20
+ * Returns a number appropriate for the type of `Text`
21
+ */
22
+ get nodeType(): TextNodeType;
23
+ get textContent(): string | null;
24
+ /**
25
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
26
+ *
27
+ * @unsupported
28
+ * @implements DOM API: `Text`
29
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-text-splittext%E2%91%A0
30
+ */
31
+ get wholeText(): string;
32
+ /**
33
+ * Returns `true` if a parent element is `<script>` or `<style>`
34
+ *
35
+ * @implements `@markuplint/ml-core` API: `MLText`
36
+ * @see https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements
37
+ */
38
+ isRawTextElementContent(): boolean;
39
+ /**
40
+ * @implements `@markuplint/ml-core` API: `MLText`
41
+ */
42
+ isWhitespace(): boolean;
43
+ /**
44
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
45
+ *
46
+ * @unsupported
47
+ * @implements DOM API: `Text`
48
+ * @see https://dom.spec.whatwg.org/#ref-for-dom-text-wholetext%E2%91%A0
49
+ */
50
+ splitText(offset: number): Text;
54
51
  }
@@ -1,4 +1,3 @@
1
- import type { MLToken } from '../token/token';
2
1
  import type { MLAttr } from './attr';
3
2
  import type { MLBlock } from './block';
4
3
  import type { MLComment } from './comment';
@@ -8,54 +7,11 @@ import type { MLDocumentType } from './document-type';
8
7
  import type { MLElement } from './element';
9
8
  import type { MLNode } from './node';
10
9
  import type { MLText } from './text';
11
- import type {
12
- MLASTAbstractNode,
13
- MLASTAttr,
14
- MLASTComment,
15
- MLASTDoctype,
16
- MLASTElement,
17
- MLASTParentNode,
18
- MLASTPreprocessorSpecificBlock,
19
- MLASTText,
20
- MLToken as MLASTToken,
21
- } from '@markuplint/ml-ast/';
22
- import type { PretenderARIA, RuleConfigValue } from '@markuplint/ml-config';
23
- export type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement
24
- ? MLElement<T, O>
25
- : N extends MLASTParentNode
26
- ? MLElement<T, O>
27
- : N extends MLASTComment
28
- ? MLComment<T, O>
29
- : N extends MLASTText
30
- ? MLText<T, O>
31
- : N extends MLASTDoctype
32
- ? MLDocumentType<T, O>
33
- : N extends MLASTPreprocessorSpecificBlock
34
- ? MLBlock<T, O>
35
- : N extends MLASTAbstractNode
36
- ? MLNode<T, O, MLASTAbstractNode>
37
- : N extends MLASTAttr
38
- ? MLAttr<T, O>
39
- : N extends MLASTToken
40
- ? MLToken
41
- : never;
42
- export type NodeTypeOf<NT extends NodeType, T extends RuleConfigValue, O = null> = NT extends ElementNodeType
43
- ? MLElement<T, O>
44
- : NT extends CommentNodeType
45
- ? MLComment<T, O>
46
- : NT extends TextNodeType
47
- ? MLText<T, O>
48
- : NT extends DocumentNodeType
49
- ? MLDocument<T, O>
50
- : NT extends DocumentTypeNodeType
51
- ? MLDocumentType<T, O>
52
- : NT extends DocumentFragmentNodeType
53
- ? MLDocumentFragment<T, O>
54
- : NT extends MarkuplintPreprocessorBlockType
55
- ? MLBlock<T, O>
56
- : NT extends AttributeNodeType
57
- ? MLAttr<T, O>
58
- : never;
10
+ import type { MLToken } from '../token/token';
11
+ import type { MLASTAbstractNode, MLASTAttr, MLASTComment, MLASTDoctype, MLASTElement, MLASTParentNode, MLASTPreprocessorSpecificBlock, MLASTText, MLToken as MLASTToken } from '@markuplint/ml-ast/';
12
+ import type { PlainData, PretenderARIA, RuleConfigValue } from '@markuplint/ml-config';
13
+ export type MappedNode<N, T extends RuleConfigValue, O extends PlainData = undefined> = N extends MLASTElement ? MLElement<T, O> : N extends MLASTParentNode ? MLElement<T, O> : N extends MLASTComment ? MLComment<T, O> : N extends MLASTText ? MLText<T, O> : N extends MLASTDoctype ? MLDocumentType<T, O> : N extends MLASTPreprocessorSpecificBlock ? MLBlock<T, O> : N extends MLASTAbstractNode ? MLNode<T, O, MLASTAbstractNode> : N extends MLASTAttr ? MLAttr<T, O> : N extends MLASTToken ? MLToken : never;
14
+ export type NodeTypeOf<NT extends NodeType, T extends RuleConfigValue, O extends PlainData = undefined> = NT extends ElementNodeType ? MLElement<T, O> : NT extends CommentNodeType ? MLComment<T, O> : NT extends TextNodeType ? MLText<T, O> : NT extends DocumentNodeType ? MLDocument<T, O> : NT extends DocumentTypeNodeType ? MLDocumentType<T, O> : NT extends DocumentFragmentNodeType ? MLDocumentFragment<T, O> : NT extends MarkuplintPreprocessorBlockType ? MLBlock<T, O> : NT extends AttributeNodeType ? MLAttr<T, O> : never;
59
15
  export type ElementNodeType = 1;
60
16
  export type AttributeNodeType = 2;
61
17
  export type TextNodeType = 3;
@@ -66,26 +22,14 @@ export type DocumentNodeType = 9;
66
22
  export type DocumentTypeNodeType = 10;
67
23
  export type DocumentFragmentNodeType = 11;
68
24
  export type MarkuplintPreprocessorBlockType = 101;
69
- export type NodeType =
70
- | ElementNodeType
71
- | AttributeNodeType
72
- | TextNodeType
73
- | CDATASectionNodeType
74
- | ProcessingInstructionNodeType
75
- | CommentNodeType
76
- | DocumentNodeType
77
- | DocumentTypeNodeType
78
- | DocumentFragmentNodeType
79
- | MarkuplintPreprocessorBlockType;
80
- export type PretenderContext<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> =
81
- | PretenderContextPretender<N, T, O>
82
- | PretenderContextPretended<N, T, O>;
83
- export type PretenderContextPretender<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
84
- readonly type: 'pretender';
85
- readonly as: N;
86
- readonly aria?: PretenderARIA;
25
+ export type NodeType = ElementNodeType | AttributeNodeType | TextNodeType | CDATASectionNodeType | ProcessingInstructionNodeType | CommentNodeType | DocumentNodeType | DocumentTypeNodeType | DocumentFragmentNodeType | MarkuplintPreprocessorBlockType;
26
+ export type PretenderContext<N extends MLElement<T, O>, T extends RuleConfigValue, O extends PlainData = undefined> = PretenderContextPretender<N, T, O> | PretenderContextPretended<N, T, O>;
27
+ export type PretenderContextPretender<N extends MLElement<T, O>, T extends RuleConfigValue, O extends PlainData = undefined> = {
28
+ readonly type: 'pretender';
29
+ readonly as: N;
30
+ readonly aria?: PretenderARIA;
87
31
  };
88
- export type PretenderContextPretended<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
89
- readonly type: 'origin';
90
- readonly origin: N;
32
+ export type PretenderContextPretended<N extends MLElement<T, O>, T extends RuleConfigValue, O extends PlainData = undefined> = {
33
+ readonly type: 'origin';
34
+ readonly origin: N;
91
35
  };
@@ -1 +1,2 @@
1
- export default class UnexpectedCallError extends Error {}
1
+ export default class UnexpectedCallError extends Error {
2
+ }