@markuplint/ml-core 3.9.0 → 3.11.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 (44) hide show
  1. package/lib/index.d.ts +1 -11
  2. package/lib/ml-core.d.ts +11 -22
  3. package/lib/ml-dom/helper/create-node.d.ts +1 -5
  4. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  5. package/lib/ml-dom/helper/walkers.d.ts +4 -14
  6. package/lib/ml-dom/manipulations/child-node-methods.d.ts +5 -18
  7. package/lib/ml-dom/manipulations/get-children.d.ts +1 -3
  8. package/lib/ml-dom/node/attr.d.ts +90 -93
  9. package/lib/ml-dom/node/block.d.ts +31 -35
  10. package/lib/ml-dom/node/character-data.d.ts +52 -59
  11. package/lib/ml-dom/node/child-node.d.ts +2 -9
  12. package/lib/ml-dom/node/comment.d.ts +12 -15
  13. package/lib/ml-dom/node/document-fragment.d.ts +19 -22
  14. package/lib/ml-dom/node/document-type.d.ts +31 -34
  15. package/lib/ml-dom/node/document.d.ts +1583 -1600
  16. package/lib/ml-dom/node/document.js +12 -1
  17. package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
  18. package/lib/ml-dom/node/element.d.ts +1904 -1902
  19. package/lib/ml-dom/node/element.js +17 -1
  20. package/lib/ml-dom/node/named-node-map.d.ts +39 -44
  21. package/lib/ml-dom/node/node-list.d.ts +3 -9
  22. package/lib/ml-dom/node/node-store.d.ts +3 -8
  23. package/lib/ml-dom/node/node-store.js +1 -1
  24. package/lib/ml-dom/node/node.d.ts +471 -491
  25. package/lib/ml-dom/node/parent-node.d.ts +57 -66
  26. package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
  27. package/lib/ml-dom/node/text.d.ts +46 -49
  28. package/lib/ml-dom/node/types.d.ts +12 -80
  29. package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
  30. package/lib/ml-dom/token/token.d.ts +44 -44
  31. package/lib/ml-rule/create-rule.d.ts +1 -3
  32. package/lib/ml-rule/create-test-rule.d.ts +3 -5
  33. package/lib/ml-rule/ml-rule-context.d.ts +47 -55
  34. package/lib/ml-rule/ml-rule.d.ts +23 -33
  35. package/lib/ml-rule/ml-rule.js +5 -1
  36. package/lib/ml-rule/types.d.ts +13 -31
  37. package/lib/plugin/plugin.d.ts +1 -3
  38. package/lib/plugin/types.d.ts +5 -5
  39. package/lib/ruleset/index.d.ts +4 -4
  40. package/lib/test/index.d.ts +7 -19
  41. package/lib/types.d.ts +8 -8
  42. package/lib/utils/get-location-from-chars.d.ts +4 -9
  43. package/package.json +14 -14
  44. package/test/ml-dom/ml-rule/create-rule.spec.js +108 -0
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /* global StylePropertyMap, StylePropertyMapReadOnly */
2
3
  var _MLElement_attributes, _MLElement_fixedNodeName, _MLElement_getChildElementsAndTextNodeWithoutWhitespacesCache, _MLElement_localName, _MLElement_normalizedAttrs, _MLElement_normalizedString, _MLElement_tagOpenChar;
3
4
  Object.defineProperty(exports, "__esModule", { value: true });
4
5
  exports.MLElement = void 0;
@@ -465,6 +466,9 @@ class MLElement extends parent_node_1.MLParentNode {
465
466
  get assignedSlot() {
466
467
  throw new unexpected_call_error_1.default('Not supported "assignedSlot" property');
467
468
  }
469
+ get attributeStyleMap() {
470
+ throw new unexpected_call_error_1.default('Not supported "attributeStyleMap" property');
471
+ }
468
472
  /**
469
473
  * @implements DOM API: `Element`
470
474
  * @see https://dom.spec.whatwg.org/#dom-element-attributes
@@ -2070,6 +2074,15 @@ class MLElement extends parent_node_1.MLParentNode {
2070
2074
  } while (el !== null && el.is(el.ELEMENT_NODE));
2071
2075
  return null;
2072
2076
  }
2077
+ /**
2078
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
2079
+ *
2080
+ * @unsupported
2081
+ * @implements DOM API: `Element`
2082
+ */
2083
+ computedStyleMap() {
2084
+ throw new unexpected_call_error_1.default('Not supported "computedStyleMap" method');
2085
+ }
2073
2086
  fixNodeName(name) {
2074
2087
  tslib_1.__classPrivateFieldSet(this, _MLElement_fixedNodeName, name, "f");
2075
2088
  }
@@ -2317,7 +2330,10 @@ class MLElement extends parent_node_1.MLParentNode {
2317
2330
  if (attr && child.hasMutableAttributes()) {
2318
2331
  return true;
2319
2332
  }
2320
- if (child.hasMutableChildren()) {
2333
+ if (child.hasMutableChildren(attr)) {
2334
+ return true;
2335
+ }
2336
+ if (child.localName === 'slot') {
2321
2337
  return true;
2322
2338
  }
2323
2339
  }
@@ -1,47 +1,42 @@
1
1
  import type { MLAttr } from './attr';
2
2
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
3
- export declare class MLNamedNodeMap<T extends RuleConfigValue, O extends PlainData = undefined>
4
- extends Array<MLAttr<T, O>>
5
- implements NamedNodeMap
6
- {
7
- getNamedItem(qualifiedName: string): MLAttr<T, O> | null;
8
- /**
9
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
10
- *
11
- * @unsupported
12
- * @implements DOM API: `NamedNodeMap`
13
- */
14
- getNamedItemNS(namespace: string | null, localName: string): Attr | null;
15
- item(index: number): MLAttr<T, O> | null;
16
- /**
17
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
18
- *
19
- * @unsupported
20
- * @implements DOM API: `NamedNodeMap`
21
- */
22
- removeNamedItem(qualifiedName: string): MLAttr<T, O>;
23
- /**
24
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
25
- *
26
- * @unsupported
27
- * @implements DOM API: `NamedNodeMap`
28
- */
29
- removeNamedItemNS(namespace: string | null, localName: string): MLAttr<T, O>;
30
- /**
31
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
32
- *
33
- * @unsupported
34
- * @implements DOM API: `NamedNodeMap`
35
- */
36
- setNamedItem(attr: MLAttr<T, O>): MLAttr<T, O> | null;
37
- /**
38
- * **IT THROWS AN ERROR WHEN CALLING THIS.**
39
- *
40
- * @unsupported
41
- * @implements DOM API: `NamedNodeMap`
42
- */
43
- setNamedItemNS(attr: MLAttr<T, O>): MLAttr<T, O> | null;
3
+ export declare class MLNamedNodeMap<T extends RuleConfigValue, O extends PlainData = undefined> extends Array<MLAttr<T, O>> implements NamedNodeMap {
4
+ getNamedItem(qualifiedName: string): MLAttr<T, O> | null;
5
+ /**
6
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
7
+ *
8
+ * @unsupported
9
+ * @implements DOM API: `NamedNodeMap`
10
+ */
11
+ getNamedItemNS(namespace: string | null, localName: string): Attr | null;
12
+ item(index: number): MLAttr<T, O> | null;
13
+ /**
14
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
15
+ *
16
+ * @unsupported
17
+ * @implements DOM API: `NamedNodeMap`
18
+ */
19
+ removeNamedItem(qualifiedName: string): MLAttr<T, O>;
20
+ /**
21
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
22
+ *
23
+ * @unsupported
24
+ * @implements DOM API: `NamedNodeMap`
25
+ */
26
+ removeNamedItemNS(namespace: string | null, localName: string): MLAttr<T, O>;
27
+ /**
28
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
29
+ *
30
+ * @unsupported
31
+ * @implements DOM API: `NamedNodeMap`
32
+ */
33
+ setNamedItem(attr: MLAttr<T, O>): MLAttr<T, O> | null;
34
+ /**
35
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
36
+ *
37
+ * @unsupported
38
+ * @implements DOM API: `NamedNodeMap`
39
+ */
40
+ setNamedItemNS(attr: MLAttr<T, O>): MLAttr<T, O> | null;
44
41
  }
45
- export declare function toNamedNodeMap<T extends RuleConfigValue, O extends PlainData = undefined>(
46
- nodes: ReadonlyArray<MLAttr<T, O>>,
47
- ): MLNamedNodeMap<T, O>;
42
+ export declare function toNamedNodeMap<T extends RuleConfigValue, O extends PlainData = undefined>(nodes: ReadonlyArray<MLAttr<T, O>>): MLNamedNodeMap<T, O>;
@@ -1,12 +1,6 @@
1
1
  import type { MLChildNode } from './child-node';
2
2
  import type { MLElement } from './element';
3
3
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
4
- export declare function toNodeList<T extends RuleConfigValue, O extends PlainData, N extends MLChildNode<T, O>>(
5
- nodes: ReadonlyArray<N>,
6
- ): NodeListOf<N>;
7
- export declare function toHTMLCollection<T extends RuleConfigValue, O extends PlainData = undefined>(
8
- nodes: ReadonlyArray<MLElement<T, O>>,
9
- ): HTMLCollectionOf<MLElement<T, O>>;
10
- export declare function nodeListToHTMLCollection<T extends RuleConfigValue, O extends PlainData = undefined>(
11
- nodeList: NodeListOf<MLChildNode<T, O>>,
12
- ): HTMLCollectionOf<MLElement<T, O>>;
4
+ export declare function toNodeList<T extends RuleConfigValue, O extends PlainData, N extends MLChildNode<T, O>>(nodes: ReadonlyArray<N>): NodeListOf<N>;
5
+ export declare function toHTMLCollection<T extends RuleConfigValue, O extends PlainData = undefined>(nodes: ReadonlyArray<MLElement<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
6
+ export declare function nodeListToHTMLCollection<T extends RuleConfigValue, O extends PlainData = undefined>(nodeList: NodeListOf<MLChildNode<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
@@ -3,14 +3,9 @@ import type { MappedNode } from './types';
3
3
  import type { MLASTAbstractNode } from '@markuplint/ml-ast';
4
4
  import type { PlainData, RuleConfigValue } from '@markuplint/ml-config';
5
5
  declare class NodeStore {
6
- #private;
7
- getNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O extends PlainData = undefined>(
8
- astNode: N,
9
- ): MappedNode<N, T, O>;
10
- setNode<A extends MLASTAbstractNode, T extends RuleConfigValue, O extends PlainData = undefined>(
11
- astNode: A,
12
- node: MLNode<T, O, A>,
13
- ): void;
6
+ #private;
7
+ getNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O extends PlainData = undefined>(astNode: N): MappedNode<N, T, O>;
8
+ setNode<A extends MLASTAbstractNode, T extends RuleConfigValue, O extends PlainData = undefined>(astNode: A, node: MLNode<T, O, A>): void;
14
9
  }
15
10
  /**
16
11
  * `NodeStore` Singleton
@@ -20,7 +20,7 @@ class NodeStore {
20
20
  id,
21
21
  name: node.nodeName,
22
22
  })));
23
- throw new parser_utils_1.ParserError('Broke mapping nodes.', {
23
+ throw new parser_utils_1.TargetParserError('Broke mapping nodes.', {
24
24
  line: astNode.startLine,
25
25
  col: astNode.startCol,
26
26
  raw: astNode.raw,