@markuplint/ml-core 2.3.0 → 2.3.1

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 (55) hide show
  1. package/lib/ml-core.d.ts +1 -1
  2. package/lib/ml-dom/helper/selector.d.ts +1 -1
  3. package/lib/ml-dom/manipulations/child-node-methods.d.ts +33 -0
  4. package/lib/ml-dom/manipulations/child-node-methods.js +73 -0
  5. package/lib/ml-dom/manipulations/get-children.d.ts +4 -0
  6. package/lib/ml-dom/manipulations/get-children.js +10 -0
  7. package/lib/ml-dom/node/attr.d.ts +93 -0
  8. package/lib/ml-dom/node/attr.js +144 -0
  9. package/lib/ml-dom/node/block.d.ts +38 -0
  10. package/lib/ml-dom/node/block.js +53 -0
  11. package/lib/ml-dom/node/character-data.d.ts +57 -0
  12. package/lib/ml-dom/node/character-data.js +87 -0
  13. package/lib/ml-dom/node/child-node.d.ts +9 -0
  14. package/lib/ml-dom/node/child-node.js +10 -0
  15. package/lib/ml-dom/node/comment.d.ts +17 -0
  16. package/lib/ml-dom/node/comment.js +24 -0
  17. package/lib/ml-dom/node/document-fragment.d.ts +24 -0
  18. package/lib/ml-dom/node/document-fragment.js +33 -0
  19. package/lib/ml-dom/node/document-type.d.ts +38 -0
  20. package/lib/ml-dom/node/document-type.js +52 -0
  21. package/lib/ml-dom/node/document.d.ts +1554 -0
  22. package/lib/ml-dom/node/document.js +2117 -0
  23. package/lib/ml-dom/node/dom-token-list.d.ts +15 -0
  24. package/lib/ml-dom/node/dom-token-list.js +61 -0
  25. package/lib/ml-dom/node/element.d.ts +1832 -0
  26. package/lib/ml-dom/node/element.js +2483 -0
  27. package/lib/ml-dom/node/named-node-map.d.ts +42 -0
  28. package/lib/ml-dom/node/named-node-map.js +64 -0
  29. package/lib/ml-dom/node/node-list.d.ts +6 -0
  30. package/lib/ml-dom/node/node-list.js +39 -0
  31. package/lib/ml-dom/node/node-store.d.ts +14 -0
  32. package/lib/ml-dom/node/node-store.js +32 -0
  33. package/lib/ml-dom/node/node.d.ts +475 -0
  34. package/lib/ml-dom/node/node.js +672 -0
  35. package/lib/ml-dom/node/parent-node.d.ts +66 -0
  36. package/lib/ml-dom/node/parent-node.js +131 -0
  37. package/lib/ml-dom/node/rule-mapper.d.ts +17 -0
  38. package/lib/ml-dom/node/rule-mapper.js +49 -0
  39. package/lib/ml-dom/node/text.d.ts +51 -0
  40. package/lib/ml-dom/node/text.js +76 -0
  41. package/lib/ml-dom/node/types.d.ts +25 -0
  42. package/lib/ml-dom/node/types.js +2 -0
  43. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -0
  44. package/lib/ml-dom/node/unexpected-call-error.js +5 -0
  45. package/lib/ml-dom/token/token.d.ts +47 -0
  46. package/lib/ml-dom/token/token.js +89 -0
  47. package/lib/selector/is-pure-html-element.d.ts +1 -0
  48. package/lib/selector/is-pure-html-element.js +7 -0
  49. package/lib/selector/match-selector.d.ts +14 -0
  50. package/lib/selector/match-selector.js +230 -0
  51. package/lib/selector/selector.d.ts +9 -0
  52. package/lib/selector/selector.js +561 -0
  53. package/lib/utils/get-location-from-chars.d.ts +9 -4
  54. package/package.json +3 -3
  55. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,15 @@
1
+ export declare class MLDomTokenList extends Array<string> implements DOMTokenList {
2
+ #private;
3
+ get value(): string;
4
+ constructor(tokens: string);
5
+ add(...tokens: string[]): void;
6
+ contains(token: string): boolean;
7
+ forEach(callbackfn: (value: string, index: number, parent: any) => void, thisArg?: any): void;
8
+ item(index: number): string | null;
9
+ remove(...tokens: string[]): void;
10
+ replace(token: string, newToken: string): boolean;
11
+ supports(token: string): boolean;
12
+ toggle(token: string, force?: boolean): boolean;
13
+ toString(): string;
14
+ }
15
+ export declare function toDOMTokenList(tokens: string): DOMTokenList;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var _MLDomTokenList_set;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.toDOMTokenList = exports.MLDomTokenList = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const unexpected_call_error_1 = tslib_1.__importDefault(require("./unexpected-call-error"));
7
+ class MLDomTokenList extends Array {
8
+ constructor(tokens) {
9
+ const list = tokens
10
+ .split(/\s+/)
11
+ .map(t => t.trim())
12
+ .filter(t => !!t);
13
+ super(...list);
14
+ _MLDomTokenList_set.set(this, void 0);
15
+ tslib_1.__classPrivateFieldSet(this, _MLDomTokenList_set, new Set(list), "f");
16
+ }
17
+ get value() {
18
+ return this.join(' ');
19
+ }
20
+ add(...tokens) {
21
+ for (const token of tokens) {
22
+ if (tslib_1.__classPrivateFieldGet(this, _MLDomTokenList_set, "f").has(token)) {
23
+ continue;
24
+ }
25
+ tslib_1.__classPrivateFieldGet(this, _MLDomTokenList_set, "f").add(token);
26
+ this.push(token);
27
+ }
28
+ }
29
+ contains(token) {
30
+ return tslib_1.__classPrivateFieldGet(this, _MLDomTokenList_set, "f").has(token);
31
+ }
32
+ forEach(callbackfn, thisArg) {
33
+ this.forEach.bind(this)((v, i) => callbackfn(v, i, thisArg !== null && thisArg !== void 0 ? thisArg : this));
34
+ }
35
+ item(index) {
36
+ var _a;
37
+ return (_a = this[index]) !== null && _a !== void 0 ? _a : null;
38
+ }
39
+ remove(...tokens) {
40
+ throw new unexpected_call_error_1.default('Not supported "remove" method');
41
+ }
42
+ replace(token, newToken) {
43
+ throw new unexpected_call_error_1.default('Not supported "replace" method');
44
+ }
45
+ supports(token) {
46
+ throw new unexpected_call_error_1.default('Not supported "supports" method');
47
+ }
48
+ toggle(token, force) {
49
+ throw new unexpected_call_error_1.default('Not supported "toggle" method');
50
+ }
51
+ toString() {
52
+ return this.value;
53
+ }
54
+ }
55
+ exports.MLDomTokenList = MLDomTokenList;
56
+ _MLDomTokenList_set = new WeakMap();
57
+ function toDOMTokenList(tokens) {
58
+ const tokenList = new MLDomTokenList(tokens);
59
+ return tokenList;
60
+ }
61
+ exports.toDOMTokenList = toDOMTokenList;