@markuplint/ml-core 4.8.1 → 4.8.2

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/CHANGELOG.md CHANGED
@@ -3,16 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [4.8.1](https://github.com/markuplint/markuplint/compare/@markuplint/ml-core@4.8.0...@markuplint/ml-core@4.8.1) (2024-06-09)
6
+ ## [4.8.2](https://github.com/markuplint/markuplint/compare/@markuplint/ml-core@4.8.1...@markuplint/ml-core@4.8.2) (2024-06-25)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
- * fix to export type files ([eff4bbf](https://github.com/markuplint/markuplint/commit/eff4bbfd127574809dc5e15d7cafe87699758ee0))
11
+ * **ml-core:** `localName` returns lowercase when using case-sensitive parser for tag names ([b1acadd](https://github.com/markuplint/markuplint/commit/b1acaddfd6bf939ee809f6419ce85a701033ca4f))
12
+ * **ml-core:** selector matches both pretender's name and original name ([c683711](https://github.com/markuplint/markuplint/commit/c6837114638e07b22e8b35a4f6944e400222e69e))
13
+
14
+
12
15
 
13
16
 
14
17
 
18
+ ## [4.8.1](https://github.com/markuplint/markuplint/compare/@markuplint/ml-core@4.8.0...@markuplint/ml-core@4.8.1) (2024-06-09)
19
+
20
+ ### Bug Fixes
15
21
 
22
+ - fix to export type files ([eff4bbf](https://github.com/markuplint/markuplint/commit/eff4bbfd127574809dc5e15d7cafe87699758ee0))
16
23
 
17
24
  # [4.8.0](https://github.com/markuplint/markuplint/compare/@markuplint/ml-core@4.7.2...@markuplint/ml-core@4.8.0) (2024-05-28)
18
25
 
@@ -66,6 +66,22 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
66
66
  * @implements DOM API: `Element`
67
67
  */
68
68
  get ariaAutoComplete(): string | null;
69
+ /**
70
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
71
+ *
72
+ * @deprecated
73
+ * @unsupported
74
+ * @implements DOM API: `Element`
75
+ */
76
+ get ariaBrailleLabel(): string | null;
77
+ /**
78
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
79
+ *
80
+ * @deprecated
81
+ * @unsupported
82
+ * @implements DOM API: `Element`
83
+ */
84
+ get ariaBrailleRoleDescription(): string | null;
69
85
  /**
70
86
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
71
87
  *
@@ -1927,6 +1943,14 @@ export declare class MLElement<T extends RuleConfigValue, O extends PlainData =
1927
1943
  * @see https://dom.spec.whatwg.org/#dom-element-setattributenodens
1928
1944
  */
1929
1945
  setAttributeNodeNS(attr: Attr): Attr | null;
1946
+ /**
1947
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
1948
+ *
1949
+ * @unsupported
1950
+ * @implements DOM API: `Element`
1951
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-sethtmlunsafe
1952
+ */
1953
+ setHTMLUnsafe(html: string): void;
1930
1954
  /**
1931
1955
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
1932
1956
  *
@@ -89,6 +89,26 @@ export class MLElement extends MLParentNode {
89
89
  get ariaAutoComplete() {
90
90
  throw new UnexpectedCallError('Not supported "ariaAutoComplete" property');
91
91
  }
92
+ /**
93
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
94
+ *
95
+ * @deprecated
96
+ * @unsupported
97
+ * @implements DOM API: `Element`
98
+ */
99
+ get ariaBrailleLabel() {
100
+ throw new UnexpectedCallError('Not supported "ariaBrailleLabel" property');
101
+ }
102
+ /**
103
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
104
+ *
105
+ * @deprecated
106
+ * @unsupported
107
+ * @implements DOM API: `Element`
108
+ */
109
+ get ariaBrailleRoleDescription() {
110
+ throw new UnexpectedCallError('Not supported "ariaBrailleRoleDescription" property');
111
+ }
92
112
  /**
93
113
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
94
114
  *
@@ -743,6 +763,9 @@ export class MLElement extends MLParentNode {
743
763
  if (this.isForeignElement || this.elementType !== 'html') {
744
764
  return __classPrivateFieldGet(this, _MLElement_localName, "f");
745
765
  }
766
+ if (this.ownerMLDocument.tagNameCaseSensitive) {
767
+ return __classPrivateFieldGet(this, _MLElement_localName, "f");
768
+ }
746
769
  return __classPrivateFieldGet(this, _MLElement_localName, "f").toLowerCase();
747
770
  }
748
771
  /**
@@ -2449,9 +2472,25 @@ export class MLElement extends MLParentNode {
2449
2472
  matches(selector,
2450
2473
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
2451
2474
  scope) {
2452
- return (createSelector(selector, this.ownerMLDocument.specs).match(
2453
- // Prioritize the pretender
2454
- this.pretenderContext?.type === 'pretender' ? this.pretenderContext.as : this, scope) !== false);
2475
+ let matched = false;
2476
+ const selectorMatcher = createSelector(selector, this.ownerMLDocument.specs);
2477
+ if (this.pretenderContext?.type === 'pretender') {
2478
+ matched = selectorMatcher.match(this, scope) !== false;
2479
+ }
2480
+ if (matched) {
2481
+ return true;
2482
+ }
2483
+ let _pretender = null;
2484
+ // don't expose pretenders temporarily
2485
+ if (this.pretenderContext?.type === 'pretender') {
2486
+ _pretender = this.pretenderContext;
2487
+ this.pretenderContext = null;
2488
+ }
2489
+ matched = selectorMatcher.match(this, scope) !== false;
2490
+ if (_pretender) {
2491
+ this.pretenderContext = _pretender;
2492
+ }
2493
+ return matched;
2455
2494
  }
2456
2495
  /**
2457
2496
  * Pretenders Initialization
@@ -2721,6 +2760,16 @@ export class MLElement extends MLParentNode {
2721
2760
  attr) {
2722
2761
  throw new UnexpectedCallError('Not supported "setAttributeNodeNS" method');
2723
2762
  }
2763
+ /**
2764
+ * **IT THROWS AN ERROR WHEN CALLING THIS.**
2765
+ *
2766
+ * @unsupported
2767
+ * @implements DOM API: `Element`
2768
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-sethtmlunsafe
2769
+ */
2770
+ setHTMLUnsafe(html) {
2771
+ throw new UnexpectedCallError('Not supported "setHTMLUnsafe" method');
2772
+ }
2724
2773
  /**
2725
2774
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
2726
2775
  *
@@ -2781,7 +2830,7 @@ export class MLElement extends MLParentNode {
2781
2830
  }
2782
2831
  let raw = this.raw;
2783
2832
  let offset = 0;
2784
- const overlayedCommentNodes = this.ownerMLDocument.nodeList.filter(node => {
2833
+ const overriddenCommentNodes = this.ownerMLDocument.nodeList.filter(node => {
2785
2834
  if (node.is(node.COMMENT_NODE)) {
2786
2835
  return this.startOffset < node.startOffset && node.endOffset < this.endOffset;
2787
2836
  }
@@ -2793,7 +2842,7 @@ export class MLElement extends MLParentNode {
2793
2842
  startOffset: this.startOffset,
2794
2843
  endOffset: this.startOffset + this.tagOpenChar.length + this.nodeName.length,
2795
2844
  },
2796
- ...overlayedCommentNodes,
2845
+ ...overriddenCommentNodes,
2797
2846
  ...this.attributes,
2798
2847
  ];
2799
2848
  for (const node of nodes) {
@@ -2,7 +2,7 @@ import type { MLElement } from '../ml-dom/node/element.js';
2
2
  import type { MLNode } from '../ml-dom/node/node.js';
3
3
  import type { MLToken } from '../ml-dom/token/token.js';
4
4
  import type { MLASTNode, MLASTToken, MLParser } from '@markuplint/ml-ast';
5
- import type { Config, PlainData, RuleConfigValue } from '@markuplint/ml-config';
5
+ import type { Config, PlainData, Pretender, RuleConfigValue } from '@markuplint/ml-config';
6
6
  import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
7
7
  import { MLDocument } from '../ml-dom/node/document.js';
8
8
  export type CreateTestOptions = {
@@ -11,6 +11,7 @@ export type CreateTestOptions = {
11
11
  readonly parser: Readonly<MLParser>;
12
12
  } | Readonly<MLParser>;
13
13
  readonly specs?: MLMLSpec;
14
+ readonly pretenders?: readonly Pretender[];
14
15
  };
15
16
  export declare function createTestDocument<T extends RuleConfigValue = any, O extends PlainData = any>(sourceCode: string, options?: CreateTestOptions): MLDocument<T, O>;
16
17
  export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly MLNode<any, any, MLASTNode>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
4
4
  "description": "The core module of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -28,20 +28,20 @@
28
28
  "./lib/configs.js": "./lib/configs.browser.js"
29
29
  },
30
30
  "dependencies": {
31
- "@markuplint/config-presets": "4.5.3",
32
- "@markuplint/html-parser": "4.6.4",
33
- "@markuplint/html-spec": "4.8.1",
34
- "@markuplint/i18n": "4.5.0",
35
- "@markuplint/ml-ast": "4.4.1",
36
- "@markuplint/ml-config": "4.7.1",
37
- "@markuplint/ml-spec": "4.6.2",
38
- "@markuplint/parser-utils": "4.6.4",
39
- "@markuplint/selector": "4.6.4",
40
- "@markuplint/shared": "4.4.2",
31
+ "@markuplint/config-presets": "4.5.4",
32
+ "@markuplint/html-parser": "4.6.5",
33
+ "@markuplint/html-spec": "4.8.2",
34
+ "@markuplint/i18n": "4.5.1",
35
+ "@markuplint/ml-ast": "4.4.2",
36
+ "@markuplint/ml-config": "4.7.2",
37
+ "@markuplint/ml-spec": "4.6.3",
38
+ "@markuplint/parser-utils": "4.6.5",
39
+ "@markuplint/selector": "4.6.5",
40
+ "@markuplint/shared": "4.4.3",
41
41
  "@types/debug": "4.1.12",
42
42
  "debug": "4.3.5",
43
43
  "is-plain-object": "5.0.0",
44
- "type-fest": "4.20.0"
44
+ "type-fest": "4.20.1"
45
45
  },
46
- "gitHead": "0200dc1f7b1ffa7455b889696153e25dbae8241f"
46
+ "gitHead": "05fdca254661ec335ff0cae4c6a11db164b032b9"
47
47
  }