@markuplint/ml-core 2.0.0-rc.1 → 2.0.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.
- package/README.md +0 -15
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/ml-core.d.ts +12 -11
- package/lib/ml-core.js +35 -14
- package/lib/ml-dom/document.d.ts +66 -49
- package/lib/ml-dom/document.js +8 -6
- package/lib/ml-dom/helper/create-node.d.ts +5 -1
- package/lib/ml-dom/helper/debug.d.ts +4 -1
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/mapped-nodes.d.ts +51 -3
- package/lib/ml-dom/helper/match-selector.d.ts +10 -6
- package/lib/ml-dom/helper/match-selector.js +2 -2
- package/lib/ml-dom/helper/node-store.d.ts +6 -3
- package/lib/ml-dom/helper/node-store.js +7 -2
- package/lib/ml-dom/helper/selector.d.ts +4 -4
- package/lib/ml-dom/helper/selector.js +30 -22
- package/lib/ml-dom/helper/walkers.d.ts +7 -2
- package/lib/ml-dom/index.d.ts +10 -1
- package/lib/ml-dom/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/tokens/abstract-element.d.ts +40 -36
- package/lib/ml-dom/tokens/attribute.d.ts +36 -36
- package/lib/ml-dom/tokens/comment.d.ts +5 -2
- package/lib/ml-dom/tokens/doctype.d.ts +10 -7
- package/lib/ml-dom/tokens/element-close-tag.d.ts +19 -16
- package/lib/ml-dom/tokens/element.d.ts +18 -15
- package/lib/ml-dom/tokens/node.d.ts +23 -16
- package/lib/ml-dom/tokens/omitted-element.d.ts +7 -4
- package/lib/ml-dom/tokens/preprocessor-specific-attribute.d.ts +20 -20
- package/lib/ml-dom/tokens/preprocessor-specific-block.d.ts +8 -5
- package/lib/ml-dom/tokens/text.d.ts +9 -6
- package/lib/ml-dom/tokens/token.d.ts +13 -13
- package/lib/ml-dom/types.d.ts +35 -13
- package/lib/ml-error/ml-parse-error.d.ts +5 -5
- package/lib/ml-rule/create-test-rule.d.ts +5 -3
- package/lib/ml-rule/ml-rule-context.d.ts +52 -44
- package/lib/ml-rule/ml-rule.d.ts +33 -23
- package/lib/ml-rule/types.d.ts +5 -5
- package/lib/plugin/types.d.ts +5 -5
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +14 -5
- package/lib/types.d.ts +6 -6
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/markuplint-recommended.json +13 -6
- package/package.json +10 -9
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _Selector_ruleset, _Ruleset_selectorGroup, _StructuredSelector_edge, _StructuredSelector_selector, _SelectorTarget_isAdded, _SelectorTarget_combinatedFrom;
|
|
2
|
+
var _Selector_ruleset, _Ruleset_selectorGroup, _StructuredSelector_edge, _StructuredSelector_selector, _SelectorTarget_tagNameCaseSensitive, _SelectorTarget_isAdded, _SelectorTarget_combinatedFrom;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.compareSpecificity = exports.createSelector = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -7,8 +7,8 @@ const postcss_selector_parser_1 = (0, tslib_1.__importDefault)(require("postcss-
|
|
|
7
7
|
const debug_1 = require("../../debug");
|
|
8
8
|
const log = debug_1.log.extend('selector');
|
|
9
9
|
const resLog = log.extend('result');
|
|
10
|
-
function createSelector(selector) {
|
|
11
|
-
return new Selector(selector);
|
|
10
|
+
function createSelector(selector, tagNameCaseSensitive) {
|
|
11
|
+
return new Selector(selector, !!tagNameCaseSensitive);
|
|
12
12
|
}
|
|
13
13
|
exports.createSelector = createSelector;
|
|
14
14
|
function compareSpecificity(a, b) {
|
|
@@ -34,9 +34,9 @@ function compareSpecificity(a, b) {
|
|
|
34
34
|
}
|
|
35
35
|
exports.compareSpecificity = compareSpecificity;
|
|
36
36
|
class Selector {
|
|
37
|
-
constructor(selector) {
|
|
37
|
+
constructor(selector, tagNameCaseSensitive) {
|
|
38
38
|
_Selector_ruleset.set(this, void 0);
|
|
39
|
-
(0, tslib_1.__classPrivateFieldSet)(this, _Selector_ruleset, Ruleset.parse(selector), "f");
|
|
39
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _Selector_ruleset, Ruleset.parse(selector, tagNameCaseSensitive), "f");
|
|
40
40
|
}
|
|
41
41
|
match(el, caller = el) {
|
|
42
42
|
const results = (0, tslib_1.__classPrivateFieldGet)(this, _Selector_ruleset, "f").match(el, caller);
|
|
@@ -50,16 +50,16 @@ class Selector {
|
|
|
50
50
|
}
|
|
51
51
|
_Selector_ruleset = new WeakMap();
|
|
52
52
|
class Ruleset {
|
|
53
|
-
constructor(selectors) {
|
|
53
|
+
constructor(selectors, tagNameCaseSensitive) {
|
|
54
54
|
_Ruleset_selectorGroup.set(this, []);
|
|
55
|
-
(0, tslib_1.__classPrivateFieldGet)(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector)));
|
|
55
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector, tagNameCaseSensitive)));
|
|
56
56
|
}
|
|
57
|
-
static parse(selector) {
|
|
57
|
+
static parse(selector, tagNameCaseSensitive) {
|
|
58
58
|
const selectors = [];
|
|
59
59
|
(0, postcss_selector_parser_1.default)(root => {
|
|
60
60
|
selectors.push(...root.nodes);
|
|
61
61
|
}).processSync(selector);
|
|
62
|
-
return new Ruleset(selectors);
|
|
62
|
+
return new Ruleset(selectors, tagNameCaseSensitive);
|
|
63
63
|
}
|
|
64
64
|
match(el, caller) {
|
|
65
65
|
log('%s', el.raw);
|
|
@@ -72,15 +72,15 @@ class Ruleset {
|
|
|
72
72
|
}
|
|
73
73
|
_Ruleset_selectorGroup = new WeakMap();
|
|
74
74
|
class StructuredSelector {
|
|
75
|
-
constructor(selector) {
|
|
75
|
+
constructor(selector, tagNameCaseSensitive) {
|
|
76
76
|
_StructuredSelector_edge.set(this, void 0);
|
|
77
77
|
_StructuredSelector_selector.set(this, void 0);
|
|
78
78
|
(0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_selector, selector, "f");
|
|
79
|
-
(0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_edge, new SelectorTarget(), "f");
|
|
79
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_edge, new SelectorTarget(tagNameCaseSensitive), "f");
|
|
80
80
|
(0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_selector, "f").nodes.forEach(node => {
|
|
81
81
|
switch (node.type) {
|
|
82
82
|
case 'combinator': {
|
|
83
|
-
const combinatedTarget = new SelectorTarget();
|
|
83
|
+
const combinatedTarget = new SelectorTarget(tagNameCaseSensitive);
|
|
84
84
|
combinatedTarget.from((0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_edge, "f"), node);
|
|
85
85
|
(0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_edge, combinatedTarget, "f");
|
|
86
86
|
break;
|
|
@@ -110,14 +110,16 @@ class StructuredSelector {
|
|
|
110
110
|
}
|
|
111
111
|
_StructuredSelector_edge = new WeakMap(), _StructuredSelector_selector = new WeakMap();
|
|
112
112
|
class SelectorTarget {
|
|
113
|
-
constructor() {
|
|
113
|
+
constructor(tagNameCaseSensitive) {
|
|
114
114
|
this.tag = null;
|
|
115
115
|
this.id = [];
|
|
116
116
|
this.class = [];
|
|
117
117
|
this.attr = [];
|
|
118
118
|
this.pseudo = [];
|
|
119
|
+
_SelectorTarget_tagNameCaseSensitive.set(this, void 0);
|
|
119
120
|
_SelectorTarget_isAdded.set(this, false);
|
|
120
121
|
_SelectorTarget_combinatedFrom.set(this, null);
|
|
122
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _SelectorTarget_tagNameCaseSensitive, tagNameCaseSensitive, "f");
|
|
121
123
|
}
|
|
122
124
|
match(el, caller) {
|
|
123
125
|
const unitCheck = this._matchWithoutCombinateChecking(el, caller);
|
|
@@ -268,7 +270,7 @@ class SelectorTarget {
|
|
|
268
270
|
}
|
|
269
271
|
specificity[1] += this.attr.length;
|
|
270
272
|
for (const pseudo of this.pseudo) {
|
|
271
|
-
const pseudoRes = pseudoMatch(pseudo, el, caller);
|
|
273
|
+
const pseudoRes = pseudoMatch(pseudo, el, caller, (0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_tagNameCaseSensitive, "f"));
|
|
272
274
|
specificity[0] += pseudoRes.specificity[0];
|
|
273
275
|
specificity[1] += pseudoRes.specificity[1];
|
|
274
276
|
specificity[2] += pseudoRes.specificity[2];
|
|
@@ -278,7 +280,13 @@ class SelectorTarget {
|
|
|
278
280
|
}
|
|
279
281
|
if (this.tag && this.tag.type === 'tag') {
|
|
280
282
|
specificity[2] += 1;
|
|
281
|
-
|
|
283
|
+
let a = this.tag.value;
|
|
284
|
+
let b = el.nodeName;
|
|
285
|
+
if (!(0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_tagNameCaseSensitive, "f")) {
|
|
286
|
+
a = a.toLowerCase();
|
|
287
|
+
b = b.toLowerCase();
|
|
288
|
+
}
|
|
289
|
+
if (a !== b) {
|
|
282
290
|
matched = false;
|
|
283
291
|
}
|
|
284
292
|
}
|
|
@@ -317,7 +325,7 @@ class SelectorTarget {
|
|
|
317
325
|
(0, tslib_1.__classPrivateFieldSet)(this, _SelectorTarget_combinatedFrom, { target, combinator }, "f");
|
|
318
326
|
}
|
|
319
327
|
}
|
|
320
|
-
_SelectorTarget_isAdded = new WeakMap(), _SelectorTarget_combinatedFrom = new WeakMap();
|
|
328
|
+
_SelectorTarget_tagNameCaseSensitive = new WeakMap(), _SelectorTarget_isAdded = new WeakMap(), _SelectorTarget_combinatedFrom = new WeakMap();
|
|
321
329
|
function attrMatch(attr, el) {
|
|
322
330
|
return el.attributes.some(attrOfEl => {
|
|
323
331
|
if (attr.attribute !== attrOfEl.getName().potential) {
|
|
@@ -372,13 +380,13 @@ function attrMatch(attr, el) {
|
|
|
372
380
|
return true;
|
|
373
381
|
});
|
|
374
382
|
}
|
|
375
|
-
function pseudoMatch(pseudo, el, caller) {
|
|
383
|
+
function pseudoMatch(pseudo, el, caller, tagNameCaseSensitive) {
|
|
376
384
|
switch (pseudo.value) {
|
|
377
385
|
/**
|
|
378
386
|
* Below, markuplint Specific Selector
|
|
379
387
|
*/
|
|
380
388
|
case ':closest': {
|
|
381
|
-
const ruleset = new Ruleset(pseudo.nodes);
|
|
389
|
+
const ruleset = new Ruleset(pseudo.nodes, tagNameCaseSensitive);
|
|
382
390
|
const specificity = getSpecificity(ruleset.match(el, caller));
|
|
383
391
|
let parent = el.getParentElement();
|
|
384
392
|
while (parent) {
|
|
@@ -399,7 +407,7 @@ function pseudoMatch(pseudo, el, caller) {
|
|
|
399
407
|
* Below, Selector Level 4
|
|
400
408
|
*/
|
|
401
409
|
case ':not': {
|
|
402
|
-
const ruleset = new Ruleset(pseudo.nodes);
|
|
410
|
+
const ruleset = new Ruleset(pseudo.nodes, tagNameCaseSensitive);
|
|
403
411
|
const resList = ruleset.match(el, caller);
|
|
404
412
|
const specificity = getSpecificity(resList);
|
|
405
413
|
const matched = resList.every(r => !r.matched);
|
|
@@ -409,7 +417,7 @@ function pseudoMatch(pseudo, el, caller) {
|
|
|
409
417
|
};
|
|
410
418
|
}
|
|
411
419
|
case ':is': {
|
|
412
|
-
const ruleset = new Ruleset(pseudo.nodes);
|
|
420
|
+
const ruleset = new Ruleset(pseudo.nodes, tagNameCaseSensitive);
|
|
413
421
|
const resList = ruleset.match(el, caller);
|
|
414
422
|
const specificity = getSpecificity(resList);
|
|
415
423
|
const matched = resList.some(r => r.matched);
|
|
@@ -419,7 +427,7 @@ function pseudoMatch(pseudo, el, caller) {
|
|
|
419
427
|
};
|
|
420
428
|
}
|
|
421
429
|
case ':has': {
|
|
422
|
-
const ruleset = new Ruleset(pseudo.nodes);
|
|
430
|
+
const ruleset = new Ruleset(pseudo.nodes, tagNameCaseSensitive);
|
|
423
431
|
const specificity = getSpecificity(ruleset.match(el, caller));
|
|
424
432
|
const descendants = getDescendants(el);
|
|
425
433
|
const matched = descendants.some(desc => ruleset.match(desc, caller).some(m => m.matched));
|
|
@@ -429,7 +437,7 @@ function pseudoMatch(pseudo, el, caller) {
|
|
|
429
437
|
};
|
|
430
438
|
}
|
|
431
439
|
case ':where': {
|
|
432
|
-
const ruleset = new Ruleset(pseudo.nodes);
|
|
440
|
+
const ruleset = new Ruleset(pseudo.nodes, tagNameCaseSensitive);
|
|
433
441
|
const resList = ruleset.match(el, caller);
|
|
434
442
|
const matched = resList.some(r => r.matched);
|
|
435
443
|
return {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { AnonymousNode } from '../types';
|
|
2
2
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
-
export declare type Walker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (
|
|
3
|
+
export declare type Walker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (
|
|
4
|
+
node: N,
|
|
5
|
+
) => void | Promise<void>;
|
|
4
6
|
export declare type SyncWalker<T extends RuleConfigValue, O = null, N = AnonymousNode<T, O>> = (node: N) => void;
|
|
5
|
-
export declare function syncWalk<T extends RuleConfigValue, O = null>(
|
|
7
|
+
export declare function syncWalk<T extends RuleConfigValue, O = null>(
|
|
8
|
+
nodeList: AnonymousNode<T, O>[],
|
|
9
|
+
walker: SyncWalker<T, O>,
|
|
10
|
+
): void;
|
package/lib/ml-dom/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export { default as Document } from './document';
|
|
2
2
|
export { AnonymousNode, NodeType } from './types';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
MLDOMAttribute as Attribute,
|
|
5
|
+
MLDOMComment as Comment,
|
|
6
|
+
MLDOMDoctype as Doctype,
|
|
7
|
+
MLDOMElement as Element,
|
|
8
|
+
MLDOMElementCloseTag as ElementCloseTag,
|
|
9
|
+
MLDOMNode as Node,
|
|
10
|
+
MLDOMOmittedElement as OmittedElement,
|
|
11
|
+
MLDOMText as Text,
|
|
12
|
+
} from './tokens';
|
|
@@ -3,14 +3,14 @@ import type { AnonymousNode } from './types';
|
|
|
3
3
|
import type { AnyRule } from '@markuplint/ml-config';
|
|
4
4
|
declare type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
|
|
5
5
|
declare type MappingLayer = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
from: RuleType;
|
|
7
|
+
specificity: Specificity;
|
|
8
|
+
rule: AnyRule;
|
|
9
9
|
};
|
|
10
10
|
export declare class RuleMapper<N extends AnonymousNode<any, any> = AnonymousNode<any, any>> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
#private;
|
|
12
|
+
constructor(nodeList: ReadonlyArray<N>);
|
|
13
|
+
set(node: N, ruleName: string, rule: MappingLayer): void;
|
|
14
|
+
apply(): void;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
@@ -5,40 +5,44 @@ import type { MLASTElement, MLASTOmittedElement } from '@markuplint/ml-ast';
|
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import type { ContentModel } from '@markuplint/ml-spec';
|
|
7
7
|
import MLDOMNode from './node';
|
|
8
|
-
export default abstract class MLDOMAbstractElement<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
8
|
+
export default abstract class MLDOMAbstractElement<
|
|
9
|
+
T extends RuleConfigValue,
|
|
10
|
+
O = null,
|
|
11
|
+
E extends MLASTElement | MLASTOmittedElement = MLASTElement | MLASTOmittedElement,
|
|
12
|
+
> extends MLDOMNode<T, O, E> {
|
|
13
|
+
#private;
|
|
14
|
+
readonly nodeName: string;
|
|
15
|
+
readonly attributes: (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
16
|
+
readonly hasSpreadAttr: boolean;
|
|
17
|
+
readonly namespaceURI: string;
|
|
18
|
+
readonly isForeignElement: boolean;
|
|
19
|
+
readonly ownModels: Set<ContentModel>;
|
|
20
|
+
readonly childModels: Set<ContentModel>;
|
|
21
|
+
readonly descendantModels: Set<ContentModel>;
|
|
22
|
+
readonly isCustomElement: boolean;
|
|
23
|
+
readonly isInFragmentDocument: boolean;
|
|
24
|
+
constructor(astNode: E, document: Document<T, O>);
|
|
25
|
+
get childNodes(): AnonymousNode<T, O>[];
|
|
26
|
+
get children(): (MLDOMElement<T, O> | MLDOMOmittedElement<T, O>)[];
|
|
27
|
+
get nextElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
28
|
+
get previousElementSibling(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
29
|
+
get ns(): string;
|
|
30
|
+
get nameWithNS(): string;
|
|
31
|
+
get classList(): string[];
|
|
32
|
+
get id(): string;
|
|
33
|
+
get fixedNodeName(): string;
|
|
34
|
+
querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
35
|
+
closest(selector: string): MLDOMAbstractElement<T, O> | null;
|
|
36
|
+
getAttributeToken(attrName: string): (MLDOMAttribute | MLDOMPreprocessorSpecificAttribute)[];
|
|
37
|
+
getAttribute(attrName: string): string | null;
|
|
38
|
+
hasAttribute(attrName: string): boolean;
|
|
39
|
+
matches(selector: string): boolean;
|
|
40
|
+
fixNodeName(name: string): void;
|
|
41
|
+
getChildElementsAndTextNodeWithoutWhitespaces(): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
42
|
+
/**
|
|
43
|
+
* This element has "Preprocessor Specific Block". In other words, Its children are potentially mutable.
|
|
44
|
+
*/
|
|
45
|
+
hasMutableChildren(): boolean;
|
|
46
|
+
isDescendantByUUIDList(uuidList: string[]): boolean;
|
|
47
|
+
toNormalizeString(): string;
|
|
44
48
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import type { MLASTHTMLAttr, MLToken } from '@markuplint/ml-ast';
|
|
2
2
|
import MLDOMToken from './token';
|
|
3
3
|
export default class MLDOMAttribute extends MLDOMToken<MLASTHTMLAttr> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
4
|
+
readonly attrType = 'html-attr';
|
|
5
|
+
readonly name: MLDOMToken<MLToken>;
|
|
6
|
+
readonly spacesBeforeName: MLDOMToken<MLToken>;
|
|
7
|
+
readonly spacesBeforeEqual: MLDOMToken<MLToken>;
|
|
8
|
+
readonly equal: MLDOMToken<MLToken>;
|
|
9
|
+
readonly spacesAfterEqual: MLDOMToken<MLToken>;
|
|
10
|
+
readonly startQuote: MLDOMToken<MLToken>;
|
|
11
|
+
readonly value: MLDOMToken<MLToken>;
|
|
12
|
+
readonly endQuote: MLDOMToken<MLToken>;
|
|
13
|
+
readonly isDynamicValue?: true;
|
|
14
|
+
readonly isDirective?: true;
|
|
15
|
+
readonly potentialName: string;
|
|
16
|
+
readonly candidate?: string;
|
|
17
|
+
readonly isDuplicatable: boolean;
|
|
18
|
+
constructor(astToken: MLASTHTMLAttr);
|
|
19
|
+
get raw(): string;
|
|
20
|
+
get startOffset(): number;
|
|
21
|
+
get endOffset(): number;
|
|
22
|
+
get startLine(): number;
|
|
23
|
+
get endLine(): number;
|
|
24
|
+
get startCol(): number;
|
|
25
|
+
get endCol(): number;
|
|
26
|
+
getName(): {
|
|
27
|
+
line: number;
|
|
28
|
+
col: number;
|
|
29
|
+
potential: string;
|
|
30
|
+
raw: string;
|
|
31
|
+
};
|
|
32
|
+
getValue(): {
|
|
33
|
+
line: number;
|
|
34
|
+
col: number;
|
|
35
|
+
potential: string;
|
|
36
|
+
raw: string;
|
|
37
|
+
};
|
|
38
|
+
toString(withSpace?: boolean): string;
|
|
39
|
+
toNormalizeString(): string;
|
|
40
40
|
}
|
|
@@ -2,6 +2,9 @@ import type { IMLDOMComment } from '../types';
|
|
|
2
2
|
import type { MLASTComment } from '@markuplint/ml-ast';
|
|
3
3
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
4
4
|
import MLDOMNode from './node';
|
|
5
|
-
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
-
|
|
5
|
+
export default class MLDOMComment<T extends RuleConfigValue, O = null>
|
|
6
|
+
extends MLDOMNode<T, O, MLASTComment>
|
|
7
|
+
implements IMLDOMComment
|
|
8
|
+
{
|
|
9
|
+
readonly type = 'Comment';
|
|
7
10
|
}
|
|
@@ -3,11 +3,14 @@ import type { IMLDOMDoctype } from '../types';
|
|
|
3
3
|
import type { MLASTDoctype, MLASTNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMNode from './node';
|
|
6
|
-
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export default class MLDOMDoctype<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMNode<T, O, MLASTNode>
|
|
8
|
+
implements IMLDOMDoctype
|
|
9
|
+
{
|
|
10
|
+
#private;
|
|
11
|
+
readonly type = 'Doctype';
|
|
12
|
+
constructor(astNode: MLASTDoctype, document: Document<T, O>);
|
|
13
|
+
get name(): string;
|
|
14
|
+
get publicId(): string;
|
|
15
|
+
get systemId(): string;
|
|
13
16
|
}
|
|
@@ -4,20 +4,23 @@ import type { MLDOMElement } from './';
|
|
|
4
4
|
import type { MLASTElementCloseTag } from '@markuplint/ml-ast';
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import MLDOMNode from './node';
|
|
7
|
-
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
export default class MLDOMElementCloseTag<T extends RuleConfigValue, O = null>
|
|
8
|
+
extends MLDOMNode<T, O, MLASTElementCloseTag>
|
|
9
|
+
implements IMLDOMElementCloseTag
|
|
10
|
+
{
|
|
11
|
+
#private;
|
|
12
|
+
readonly type = 'ElementCloseTag';
|
|
13
|
+
readonly nodeName: string;
|
|
14
|
+
readonly startTag: MLDOMElement<T, O>;
|
|
15
|
+
readonly isForeignElement: boolean;
|
|
16
|
+
readonly isCustomElement: boolean;
|
|
17
|
+
constructor(astNode: MLASTElementCloseTag, document: Document<T, O>, startTag: MLDOMElement<T, O>);
|
|
18
|
+
get raw(): string;
|
|
19
|
+
get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
|
|
20
|
+
fixNodeName(name: string): void;
|
|
21
|
+
getNameLocation(): {
|
|
22
|
+
offset: number;
|
|
23
|
+
line: number;
|
|
24
|
+
col: number;
|
|
25
|
+
};
|
|
23
26
|
}
|
|
@@ -5,19 +5,22 @@ import type { MLASTElement, MLToken } from '@markuplint/ml-ast';
|
|
|
5
5
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import MLDOMAbstractElement from './abstract-element';
|
|
7
7
|
import MLDOMToken from './token';
|
|
8
|
-
export default class MLDOMElement<T extends RuleConfigValue, O = null>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
export default class MLDOMElement<T extends RuleConfigValue, O = null>
|
|
9
|
+
extends MLDOMAbstractElement<T, O, MLASTElement>
|
|
10
|
+
implements IMLDOMElement
|
|
11
|
+
{
|
|
12
|
+
#private;
|
|
13
|
+
readonly type = 'Element';
|
|
14
|
+
readonly hasSpreadAttr: boolean;
|
|
15
|
+
readonly closeTag: MLDOMElementCloseTag<T, O> | null;
|
|
16
|
+
readonly selfClosingSolidus: MLDOMToken<MLToken> | null;
|
|
17
|
+
readonly endSpace: MLDOMToken<MLToken> | null;
|
|
18
|
+
constructor(astNode: MLASTElement, document: Document<T, O>);
|
|
19
|
+
get raw(): string;
|
|
20
|
+
querySelectorAll(selector: string): (MLDOMElement<T, O> | MLDOMText<T, O>)[];
|
|
21
|
+
getNameLocation(): {
|
|
22
|
+
offset: number;
|
|
23
|
+
line: number;
|
|
24
|
+
col: number;
|
|
25
|
+
};
|
|
23
26
|
}
|
|
@@ -5,20 +5,27 @@ import type { MLDOMElement, MLDOMOmittedElement, MLDOMPreprocessorSpecificBlock
|
|
|
5
5
|
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
|
|
6
6
|
import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
|
|
7
7
|
import MLDOMToken from './token';
|
|
8
|
-
export default abstract class MLDOMNode<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
export default abstract class MLDOMNode<
|
|
9
|
+
T extends RuleConfigValue,
|
|
10
|
+
O = null,
|
|
11
|
+
A extends MLASTAbstructNode = MLASTAbstructNode,
|
|
12
|
+
>
|
|
13
|
+
extends MLDOMToken<A>
|
|
14
|
+
implements IMLDOMNode
|
|
15
|
+
{
|
|
16
|
+
#private;
|
|
17
|
+
readonly type: NodeType;
|
|
18
|
+
readonly rules: Record<string, AnyRule>;
|
|
19
|
+
protected _astToken: A;
|
|
20
|
+
constructor(astNode: A, document: Document<T, O>);
|
|
21
|
+
get parentNode(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
|
|
22
|
+
get prevNode(): AnonymousNode<T, O> | null;
|
|
23
|
+
get nextNode(): AnonymousNode<T, O> | null;
|
|
24
|
+
get syntaxicalParentNode(): MLDOMElement<T, O> | MLDOMPreprocessorSpecificBlock<T, O> | null;
|
|
25
|
+
get prevToken(): AnonymousNode<T, O> | null;
|
|
26
|
+
get nodeStore(): import('../helper').NodeStore;
|
|
27
|
+
get rule(): RuleInfo<T, O>;
|
|
28
|
+
getParentElement(): MLDOMElement<T, O> | MLDOMOmittedElement<T, O> | null;
|
|
29
|
+
is(type: NodeType): boolean;
|
|
30
|
+
toString(): string;
|
|
24
31
|
}
|
|
@@ -3,8 +3,11 @@ import type { IMLDOMOmittedElement } from '../types';
|
|
|
3
3
|
import type { MLASTOmittedElement } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMAbstractElement from './abstract-element';
|
|
6
|
-
export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export default class MLDOMOmittedElement<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMAbstractElement<T, O, MLASTOmittedElement>
|
|
8
|
+
implements IMLDOMOmittedElement
|
|
9
|
+
{
|
|
10
|
+
readonly type = 'OmittedElement';
|
|
11
|
+
obsolete: boolean;
|
|
12
|
+
constructor(astNode: MLASTOmittedElement, document: Document<T, O>);
|
|
10
13
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { MLASTPreprocessorSpecificAttr } from '@markuplint/ml-ast';
|
|
2
2
|
import MLDOMToken from './token';
|
|
3
3
|
export default class MLDOMPreprocessorSpecificAttribute extends MLDOMToken<MLASTPreprocessorSpecificAttr> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
readonly attrType = 'ps-attr';
|
|
5
|
+
readonly potentialName: string;
|
|
6
|
+
readonly potentialValue: string;
|
|
7
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
8
|
+
readonly isDuplicatable: boolean;
|
|
9
|
+
constructor(astToken: MLASTPreprocessorSpecificAttr);
|
|
10
|
+
getName(): {
|
|
11
|
+
line: number;
|
|
12
|
+
col: number;
|
|
13
|
+
potential: string;
|
|
14
|
+
raw: string;
|
|
15
|
+
};
|
|
16
|
+
getValue(): {
|
|
17
|
+
line: number;
|
|
18
|
+
col: number;
|
|
19
|
+
potential: string;
|
|
20
|
+
raw: string;
|
|
21
|
+
};
|
|
22
|
+
toString(): string;
|
|
23
|
+
toNormalizeString(): string;
|
|
24
24
|
}
|
|
@@ -3,9 +3,12 @@ import type { IMLDOMPreprocessorSpecificBlock } from '../types';
|
|
|
3
3
|
import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
|
|
4
4
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
5
5
|
import MLDOMNode from './node';
|
|
6
|
-
export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export default class MLDOMPreprocessorSpecificBlock<T extends RuleConfigValue, O = null>
|
|
7
|
+
extends MLDOMNode<T, O, MLASTPreprocessorSpecificBlock>
|
|
8
|
+
implements IMLDOMPreprocessorSpecificBlock
|
|
9
|
+
{
|
|
10
|
+
readonly type = 'PSBlock';
|
|
11
|
+
readonly nodeName: string;
|
|
12
|
+
constructor(astNode: MLASTPreprocessorSpecificBlock, document: Document<T, O>);
|
|
13
|
+
get childNodes(): AnonymousNode<T, O>[];
|
|
11
14
|
}
|