@markuplint/ml-core 3.5.0 → 3.6.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/lib/index.d.ts +11 -1
- package/lib/ml-core.d.ts +22 -11
- package/lib/ml-dom/helper/accname.js +3 -2
- package/lib/ml-dom/helper/create-node.d.ts +5 -1
- package/lib/ml-dom/helper/debug.js +3 -2
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/getIndent.js +7 -9
- package/lib/ml-dom/helper/walkers.d.ts +14 -4
- package/lib/ml-dom/helper/walkers.js +1 -1
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +18 -5
- package/lib/ml-dom/manipulations/get-children.d.ts +3 -1
- package/lib/ml-dom/node/attr.d.ts +93 -90
- package/lib/ml-dom/node/attr.js +3 -3
- package/lib/ml-dom/node/block.d.ts +35 -31
- package/lib/ml-dom/node/character-data.d.ts +59 -52
- package/lib/ml-dom/node/child-node.d.ts +9 -2
- package/lib/ml-dom/node/comment.d.ts +15 -12
- package/lib/ml-dom/node/document-fragment.d.ts +22 -19
- package/lib/ml-dom/node/document-type.d.ts +34 -31
- package/lib/ml-dom/node/document.d.ts +1600 -1583
- package/lib/ml-dom/node/document.js +15 -12
- package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
- package/lib/ml-dom/node/dom-token-list.js +1 -1
- package/lib/ml-dom/node/element.d.ts +1902 -1896
- package/lib/ml-dom/node/element.js +18 -13
- package/lib/ml-dom/node/named-node-map.d.ts +44 -39
- package/lib/ml-dom/node/named-node-map.js +2 -1
- package/lib/ml-dom/node/node-list.d.ts +9 -3
- package/lib/ml-dom/node/node-list.js +2 -1
- package/lib/ml-dom/node/node-store.d.ts +8 -3
- package/lib/ml-dom/node/node.d.ts +491 -471
- package/lib/ml-dom/node/node.js +6 -3
- package/lib/ml-dom/node/parent-node.d.ts +66 -57
- package/lib/ml-dom/node/parent-node.js +6 -3
- package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/node/rule-mapper.js +2 -1
- package/lib/ml-dom/node/text.d.ts +49 -46
- package/lib/ml-dom/node/types.d.ts +80 -12
- package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
- package/lib/ml-dom/token/token.d.ts +44 -44
- package/lib/ml-rule/create-rule.d.ts +3 -1
- package/lib/ml-rule/create-test-rule.d.ts +5 -3
- package/lib/ml-rule/ml-rule-context.d.ts +55 -47
- package/lib/ml-rule/ml-rule.d.ts +33 -23
- package/lib/ml-rule/ml-rule.js +4 -5
- package/lib/ml-rule/types.d.ts +31 -13
- package/lib/plugin/plugin.d.ts +3 -1
- package/lib/plugin/types.d.ts +5 -5
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +19 -7
- package/lib/types.d.ts +8 -8
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/package.json +10 -11
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';
|
|
2
|
-
export {
|
|
2
|
+
export {
|
|
3
|
+
ariaSpecs,
|
|
4
|
+
contentModelCategoryToTagNames,
|
|
5
|
+
getAttrSpecs,
|
|
6
|
+
getComputedRole,
|
|
7
|
+
getImplicitRole,
|
|
8
|
+
getPermittedRoles,
|
|
9
|
+
getRoleSpec,
|
|
10
|
+
getSpec,
|
|
11
|
+
resolveNamespace,
|
|
12
|
+
} from '@markuplint/ml-spec';
|
|
3
13
|
export { default as Ruleset } from './ruleset';
|
|
4
14
|
export { enableDebug } from './debug';
|
|
5
15
|
export { getIndent } from './ml-dom/helper/getIndent';
|
package/lib/ml-core.d.ts
CHANGED
|
@@ -3,17 +3,28 @@ import type { PlainData, RuleConfigValue, Violation } from '@markuplint/ml-confi
|
|
|
3
3
|
import { ParserError } from '@markuplint/parser-utils';
|
|
4
4
|
import { Document } from './ml-dom';
|
|
5
5
|
export type MLCoreParams = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
readonly sourceCode: string;
|
|
7
|
+
readonly filename: string;
|
|
8
|
+
readonly debug?: boolean;
|
|
9
9
|
} & MLFabric;
|
|
10
10
|
export declare class MLCore {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
#private;
|
|
12
|
+
constructor({
|
|
13
|
+
parser,
|
|
14
|
+
sourceCode,
|
|
15
|
+
ruleset,
|
|
16
|
+
rules,
|
|
17
|
+
locale,
|
|
18
|
+
schemas,
|
|
19
|
+
parserOptions,
|
|
20
|
+
pretenders,
|
|
21
|
+
filename,
|
|
22
|
+
debug,
|
|
23
|
+
}: MLCoreParams);
|
|
24
|
+
get document(): ParserError | Document<RuleConfigValue, PlainData>;
|
|
25
|
+
setCode(sourceCode: string): void;
|
|
26
|
+
update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;
|
|
27
|
+
verify(fix?: boolean): Promise<Violation[]>;
|
|
28
|
+
private _createDocument;
|
|
29
|
+
private _parse;
|
|
19
30
|
}
|
|
@@ -21,11 +21,12 @@ el, version) {
|
|
|
21
21
|
if (isFromContent(el, version)) {
|
|
22
22
|
return Array.from(el.childNodes)
|
|
23
23
|
.map(child => {
|
|
24
|
+
var _a;
|
|
24
25
|
if (child.is(child.ELEMENT_NODE)) {
|
|
25
26
|
return getAccname(child, version);
|
|
26
27
|
}
|
|
27
28
|
if (child.is(child.TEXT_NODE)) {
|
|
28
|
-
return child.textContent
|
|
29
|
+
return (_a = child.textContent) !== null && _a !== void 0 ? _a : '';
|
|
29
30
|
}
|
|
30
31
|
return '';
|
|
31
32
|
})
|
|
@@ -51,7 +52,7 @@ function getAccnameFromPretender(
|
|
|
51
52
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
52
53
|
el) {
|
|
53
54
|
var _a, _b;
|
|
54
|
-
if (((_a = el.pretenderContext) === null || _a === void 0 ? void 0 : _a.type) === 'pretender' && ((_b = el.pretenderContext.aria) === null || _b === void 0 ? void 0 : _b.name)) {
|
|
55
|
+
if (((_a = el.pretenderContext) === null || _a === void 0 ? void 0 : _a.type) === 'pretender' && ((_b = el.pretenderContext.aria) === null || _b === void 0 ? void 0 : _b.name) != null) {
|
|
55
56
|
if (typeof el.pretenderContext.aria.name === 'boolean') {
|
|
56
57
|
return 'some-name(Pretender Options)';
|
|
57
58
|
}
|
|
@@ -2,4 +2,8 @@ import type { MLDocument } from '../node/document';
|
|
|
2
2
|
import type { MappedNode } from '../node/types';
|
|
3
3
|
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
|
|
4
4
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
5
|
-
export declare function createNode<
|
|
5
|
+
export declare function createNode<
|
|
6
|
+
N extends MLASTAbstractNode,
|
|
7
|
+
T extends RuleConfigValue,
|
|
8
|
+
O extends PlainData = undefined,
|
|
9
|
+
>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;
|
|
@@ -15,7 +15,7 @@ nodeList, withAttr = false) {
|
|
|
15
15
|
if (n.is(n.ELEMENT_NODE)) {
|
|
16
16
|
r.push(` namespaceURI: ${!!n.namespaceURI}`);
|
|
17
17
|
r.push(` elementType: ${n.elementType}`);
|
|
18
|
-
r.push(` isInFragmentDocument: ${
|
|
18
|
+
r.push(` isInFragmentDocument: ${n.isInFragmentDocument()}`);
|
|
19
19
|
r.push(` isForeignElement: ${!!n.isForeignElement}`);
|
|
20
20
|
if (withAttr) {
|
|
21
21
|
r.push(...attributesToDebugMaps(n.attributes)
|
|
@@ -81,7 +81,8 @@ attributes) {
|
|
|
81
81
|
.flat();
|
|
82
82
|
}
|
|
83
83
|
function tokenDebug(n, type = '') {
|
|
84
|
-
|
|
84
|
+
var _a, _b, _c, _d;
|
|
85
|
+
return `[${n.startLine}:${n.startCol}]>[${n.endLine}:${n.endCol}](${n.startOffset},${n.endOffset})${(_d = (_c = (_b = (_a = n.nodeName) !== null && _a !== void 0 ? _a : n.potentialName) !== null && _b !== void 0 ? _b : n.name) !== null && _c !== void 0 ? _c : n.type) !== null && _d !== void 0 ? _d : type}: ${visibleWhiteSpace(n.raw)}`;
|
|
85
86
|
}
|
|
86
87
|
function visibleWhiteSpace(chars) {
|
|
87
88
|
return chars.replace(/\n/g, '⏎').replace(/\t/g, '→').replace(/\s/g, '␣');
|
|
@@ -7,12 +7,12 @@ import type { MLText } from '../node/text';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function getIndent(node: MLNode<any, any>): MLDOMIndentation | null;
|
|
9
9
|
declare class MLDOMIndentation {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
#private;
|
|
11
|
+
readonly line: number;
|
|
12
|
+
constructor(originTextNode: MLText<any, any>, raw: string, line: number, parentNode: MLNode<any, any>);
|
|
13
|
+
get raw(): string;
|
|
14
|
+
get type(): 'tab' | 'space' | 'mixed' | 'none';
|
|
15
|
+
get width(): number;
|
|
16
|
+
fix(raw: string): void;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -88,16 +88,14 @@ class MLDOMIndentation {
|
|
|
88
88
|
fix(raw) {
|
|
89
89
|
const current = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
|
|
90
90
|
tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
lines[index] = lines[index].replace(current, tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f"));
|
|
98
|
-
}
|
|
99
|
-
node.fix(lines.join('\n'));
|
|
91
|
+
const node = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f");
|
|
92
|
+
const line = node.startLine;
|
|
93
|
+
const lines = node.raw.split(/\r?\n/);
|
|
94
|
+
const index = this.line - line;
|
|
95
|
+
if (lines[index] != null) {
|
|
96
|
+
lines[index] = lines[index].replace(current, tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f"));
|
|
100
97
|
}
|
|
98
|
+
node.fix(lines.join('\n'));
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
_MLDOMIndentation_fixed = new WeakMap(), _MLDOMIndentation_node = new WeakMap(), _MLDOMIndentation_parent = new WeakMap();
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { MLNode } from '../node/node';
|
|
2
2
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
3
|
-
export type Walker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
3
|
+
export type Walker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (
|
|
4
|
+
node: N,
|
|
5
|
+
) => void | Promise<void> | Promise<void>[];
|
|
6
|
+
export type SyncWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>> = (
|
|
7
|
+
node: N,
|
|
8
|
+
) => void;
|
|
9
|
+
export declare function syncWalk<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
10
|
+
nodeList: ReadonlyArray<MLNode<T, O>>,
|
|
11
|
+
walker: SyncWalker<T, O>,
|
|
12
|
+
): void;
|
|
13
|
+
export declare function sequentialWalker<T extends RuleConfigValue, O extends PlainData = undefined, N = MLNode<T, O>>(
|
|
14
|
+
list: ReadonlyArray<N>,
|
|
15
|
+
walker: Walker<T, O, N>,
|
|
16
|
+
): Promise<void>;
|
|
@@ -5,17 +5,26 @@ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-before%E2%91%A0
|
|
7
7
|
*/
|
|
8
|
-
export declare function before<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
8
|
+
export declare function before<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
9
|
+
node: MLNode<T, O>,
|
|
10
|
+
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
11
|
+
): void;
|
|
9
12
|
/**
|
|
10
13
|
*
|
|
11
14
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-after%E2%91%A0
|
|
12
15
|
*/
|
|
13
|
-
export declare function after<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
16
|
+
export declare function after<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
17
|
+
node: MLNode<T, O>,
|
|
18
|
+
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
19
|
+
): void;
|
|
14
20
|
/**
|
|
15
21
|
*
|
|
16
22
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-replacewith%E2%91%A0
|
|
17
23
|
*/
|
|
18
|
-
export declare function replaceWith<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
24
|
+
export declare function replaceWith<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
25
|
+
node: MLNode<T, O>,
|
|
26
|
+
...additionalNodes: ReadonlyArray<MLNode<T, O> | string>
|
|
27
|
+
): void;
|
|
19
28
|
/**
|
|
20
29
|
*
|
|
21
30
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-childnode-remove%E2%91%A0
|
|
@@ -25,9 +34,13 @@ export declare function remove<T extends RuleConfigValue, O extends PlainData =
|
|
|
25
34
|
*
|
|
26
35
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-previouselementsibling%E2%91%A0
|
|
27
36
|
*/
|
|
28
|
-
export declare function previousElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
37
|
+
export declare function previousElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
38
|
+
node: MLNode<T, O>,
|
|
39
|
+
): MLElement<T, O> | null;
|
|
29
40
|
/**
|
|
30
41
|
*
|
|
31
42
|
* @see https://dom.spec.whatwg.org/#ref-for-dom-nondocumenttypechildnode-nextelementsibling%E2%91%A0
|
|
32
43
|
*/
|
|
33
|
-
export declare function nextElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
44
|
+
export declare function nextElementSibling<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
45
|
+
node: MLNode<T, O>,
|
|
46
|
+
): MLElement<T, O> | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { MLElement } from '../node/element';
|
|
2
2
|
import type { MLNode } from '../node/node';
|
|
3
3
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
4
|
-
export declare function getChildren<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
4
|
+
export declare function getChildren<T extends RuleConfigValue, O extends PlainData = undefined>(
|
|
5
|
+
node: MLNode<T, O>,
|
|
6
|
+
): HTMLCollectionOf<MLElement<T, O>>;
|
|
@@ -5,94 +5,97 @@ import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
|
5
5
|
import { MLToken } from '../token/token';
|
|
6
6
|
import { MLDomTokenList } from './dom-token-list';
|
|
7
7
|
import { MLNode } from './node';
|
|
8
|
-
export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
8
|
+
export declare class MLAttr<T extends RuleConfigValue, O extends PlainData = undefined>
|
|
9
|
+
extends MLNode<T, O, MLASTAttr>
|
|
10
|
+
implements Attr
|
|
11
|
+
{
|
|
12
|
+
#private;
|
|
13
|
+
readonly candidate?: string;
|
|
14
|
+
readonly endQuote: MLToken | null;
|
|
15
|
+
readonly equal: MLToken | null;
|
|
16
|
+
readonly isDirective?: true;
|
|
17
|
+
readonly isDuplicatable: boolean;
|
|
18
|
+
readonly isDynamicValue?: true;
|
|
19
|
+
readonly nameNode: MLToken | null;
|
|
20
|
+
/**
|
|
21
|
+
* @implements DOM API: `Attr`
|
|
22
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
|
|
23
|
+
*/
|
|
24
|
+
readonly ownerElement: MLElement<T, O>;
|
|
25
|
+
readonly spacesAfterEqual: MLToken | null;
|
|
26
|
+
readonly spacesBeforeEqual: MLToken | null;
|
|
27
|
+
readonly spacesBeforeName: MLToken | null;
|
|
28
|
+
readonly startQuote: MLToken | null;
|
|
29
|
+
readonly valueNode: MLToken | null;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the "string" if HTML syntax. Otherwise, returns a type in its syntax.
|
|
32
|
+
*
|
|
33
|
+
* @default "string"
|
|
34
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
35
|
+
*/
|
|
36
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
37
|
+
constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
|
|
38
|
+
/**
|
|
39
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
40
|
+
*
|
|
41
|
+
* @unsupported
|
|
42
|
+
* @implements DOM API: `Attr`
|
|
43
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-localname
|
|
44
|
+
*/
|
|
45
|
+
get localName(): string;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @implements DOM API: `Attr`
|
|
49
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-name
|
|
50
|
+
*/
|
|
51
|
+
get name(): string;
|
|
52
|
+
/**
|
|
53
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
54
|
+
*
|
|
55
|
+
* @unsupported
|
|
56
|
+
* @implements DOM API: `Attr`
|
|
57
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-namespaceuri
|
|
58
|
+
*/
|
|
59
|
+
get namespaceURI(): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a string appropriate for the type of node as `Attr`
|
|
62
|
+
*
|
|
63
|
+
* @see https://dom.spec.whatwg.org/#ref-for-attr%E2%91%A4
|
|
64
|
+
*/
|
|
65
|
+
get nodeName(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Returns a number appropriate for the type of `Attr`
|
|
68
|
+
*/
|
|
69
|
+
get nodeType(): AttributeNodeType;
|
|
70
|
+
get nodeValue(): string;
|
|
71
|
+
/**
|
|
72
|
+
* **IT THROWS AN ERROR WHEN CALLING THIS.**
|
|
73
|
+
*
|
|
74
|
+
* @unsupported
|
|
75
|
+
* @implements DOM API: `Attr`
|
|
76
|
+
* @see https://dom.spec.whatwg.org/#ref-for-dom-attr-prefix
|
|
77
|
+
*/
|
|
78
|
+
get prefix(): string | null;
|
|
79
|
+
/**
|
|
80
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
81
|
+
*/
|
|
82
|
+
get rule(): import('@markuplint/ml-config').RuleInfo<T, O>;
|
|
83
|
+
/**
|
|
84
|
+
* @implements DOM API: `Attr`
|
|
85
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-specified
|
|
86
|
+
*/
|
|
87
|
+
get specified(): true;
|
|
88
|
+
/**
|
|
89
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
90
|
+
*/
|
|
91
|
+
get tokenList(): MLDomTokenList | null;
|
|
92
|
+
/**
|
|
93
|
+
* @implements DOM API: `Attr`
|
|
94
|
+
* @see https://dom.spec.whatwg.org/#dom-attr-value
|
|
95
|
+
*/
|
|
96
|
+
get value(): string;
|
|
97
|
+
/**
|
|
98
|
+
* @implements `@markuplint/ml-core` API: `MLAttr`
|
|
99
|
+
*/
|
|
100
|
+
toNormalizeString(): string;
|
|
98
101
|
}
|
package/lib/ml-dom/node/attr.js
CHANGED
|
@@ -14,7 +14,7 @@ class MLAttr extends node_1.MLNode {
|
|
|
14
14
|
astToken,
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
16
16
|
ownElement) {
|
|
17
|
-
var _a;
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
18
|
super(astToken, ownElement.ownerMLDocument);
|
|
19
19
|
this.endQuote = null;
|
|
20
20
|
this.equal = null;
|
|
@@ -47,8 +47,8 @@ class MLAttr extends node_1.MLNode {
|
|
|
47
47
|
this.isDynamicValue = this._astToken.isDynamicValue;
|
|
48
48
|
this.isDirective = this._astToken.isDirective;
|
|
49
49
|
this.candidate = this._astToken.candidate;
|
|
50
|
-
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName
|
|
51
|
-
tslib_1.__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.value.raw
|
|
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");
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
this.valueType = this._astToken.valueType;
|
|
@@ -4,35 +4,39 @@ import type { MarkuplintPreprocessorBlockType } from './types';
|
|
|
4
4
|
import type { MLASTPreprocessorSpecificBlock } from '@markuplint/ml-ast';
|
|
5
5
|
import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
|
|
6
6
|
import { MLNode } from './node';
|
|
7
|
-
export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<
|
|
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
|
-
|
|
7
|
+
export declare class MLBlock<T extends RuleConfigValue, O extends PlainData = undefined> extends MLNode<
|
|
8
|
+
T,
|
|
9
|
+
O,
|
|
10
|
+
MLASTPreprocessorSpecificBlock
|
|
11
|
+
> {
|
|
12
|
+
readonly isTransparent: boolean;
|
|
13
|
+
constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
|
|
14
|
+
/**
|
|
15
|
+
* Returns a string appropriate for the type of node as `MLBlock`
|
|
16
|
+
*
|
|
17
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
18
|
+
*/
|
|
19
|
+
get nodeName(): '#ml-block';
|
|
20
|
+
/**
|
|
21
|
+
* Returns a number appropriate for the type of `MLBlock`
|
|
22
|
+
*
|
|
23
|
+
* @implements `@markuplint/ml-core` API: `MLBlock`
|
|
24
|
+
*/
|
|
25
|
+
get nodeType(): MarkuplintPreprocessorBlockType;
|
|
26
|
+
/**
|
|
27
|
+
* @implements DOM API: `ChildNode`
|
|
28
|
+
*/
|
|
29
|
+
after(...nodes: (string | MLElement<any, any>)[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* @implements DOM API: `ChildNode`
|
|
32
|
+
*/
|
|
33
|
+
before(...nodes: (string | MLElement<any, any>)[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* @implements DOM API: `ChildNode`
|
|
36
|
+
*/
|
|
37
|
+
remove(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @implements DOM API: `ChildNode`
|
|
40
|
+
*/
|
|
41
|
+
replaceWith(...nodes: (string | MLElement<any, any>)[]): void;
|
|
38
42
|
}
|