@mtkruto/node 0.1.200 → 0.1.201

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 (97) hide show
  1. package/esm/client/4_client.d.ts +5 -8
  2. package/esm/client/4_client.js +5 -14
  3. package/package.json +1 -1
  4. package/script/client/4_client.d.ts +5 -8
  5. package/script/client/4_client.js +5 -14
  6. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  7. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  8. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  9. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  10. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  11. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  12. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  13. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  14. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  15. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  16. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  17. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  18. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  19. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  20. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  21. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  22. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  23. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  24. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  25. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  26. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  27. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  28. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  29. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  30. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  31. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  32. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  33. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  34. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  35. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  36. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  37. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  38. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  39. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  40. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  41. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  42. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  43. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  44. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  45. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  46. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  47. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  48. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  49. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  50. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  51. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  52. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  53. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  54. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  55. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  56. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  57. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  58. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  59. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  60. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  61. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  62. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  63. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  64. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  65. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  66. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  67. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  68. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  69. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  70. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  71. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  72. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  73. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  74. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  75. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  76. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  77. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  78. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  79. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  80. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  81. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  82. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  83. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  84. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  85. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  86. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  87. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  88. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  89. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  90. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  91. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  92. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  93. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  94. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  95. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  96. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  97. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
@@ -1,109 +0,0 @@
1
- declare const _default: {
2
- Aacute: string;
3
- aacute: string;
4
- Acirc: string;
5
- acirc: string;
6
- acute: string;
7
- AElig: string;
8
- aelig: string;
9
- Agrave: string;
10
- agrave: string;
11
- amp: string;
12
- AMP: string;
13
- Aring: string;
14
- aring: string;
15
- Atilde: string;
16
- atilde: string;
17
- Auml: string;
18
- auml: string;
19
- brvbar: string;
20
- Ccedil: string;
21
- ccedil: string;
22
- cedil: string;
23
- cent: string;
24
- copy: string;
25
- COPY: string;
26
- curren: string;
27
- deg: string;
28
- divide: string;
29
- Eacute: string;
30
- eacute: string;
31
- Ecirc: string;
32
- ecirc: string;
33
- Egrave: string;
34
- egrave: string;
35
- ETH: string;
36
- eth: string;
37
- Euml: string;
38
- euml: string;
39
- frac12: string;
40
- frac14: string;
41
- frac34: string;
42
- gt: string;
43
- GT: string;
44
- Iacute: string;
45
- iacute: string;
46
- Icirc: string;
47
- icirc: string;
48
- iexcl: string;
49
- Igrave: string;
50
- igrave: string;
51
- iquest: string;
52
- Iuml: string;
53
- iuml: string;
54
- laquo: string;
55
- lt: string;
56
- LT: string;
57
- macr: string;
58
- micro: string;
59
- middot: string;
60
- nbsp: string;
61
- not: string;
62
- Ntilde: string;
63
- ntilde: string;
64
- Oacute: string;
65
- oacute: string;
66
- Ocirc: string;
67
- ocirc: string;
68
- Ograve: string;
69
- ograve: string;
70
- ordf: string;
71
- ordm: string;
72
- Oslash: string;
73
- oslash: string;
74
- Otilde: string;
75
- otilde: string;
76
- Ouml: string;
77
- ouml: string;
78
- para: string;
79
- plusmn: string;
80
- pound: string;
81
- quot: string;
82
- QUOT: string;
83
- raquo: string;
84
- reg: string;
85
- REG: string;
86
- sect: string;
87
- shy: string;
88
- sup1: string;
89
- sup2: string;
90
- sup3: string;
91
- szlig: string;
92
- THORN: string;
93
- thorn: string;
94
- times: string;
95
- Uacute: string;
96
- uacute: string;
97
- Ucirc: string;
98
- ucirc: string;
99
- Ugrave: string;
100
- ugrave: string;
101
- uml: string;
102
- Uuml: string;
103
- uuml: string;
104
- Yacute: string;
105
- yacute: string;
106
- yen: string;
107
- yuml: string;
108
- };
109
- export default _default;
@@ -1,108 +0,0 @@
1
- export default {
2
- Aacute: 'Á',
3
- aacute: 'á',
4
- Acirc: 'Â',
5
- acirc: 'â',
6
- acute: '´',
7
- AElig: 'Æ',
8
- aelig: 'æ',
9
- Agrave: 'À',
10
- agrave: 'à',
11
- amp: '&',
12
- AMP: '&',
13
- Aring: 'Å',
14
- aring: 'å',
15
- Atilde: 'Ã',
16
- atilde: 'ã',
17
- Auml: 'Ä',
18
- auml: 'ä',
19
- brvbar: '¦',
20
- Ccedil: 'Ç',
21
- ccedil: 'ç',
22
- cedil: '¸',
23
- cent: '¢',
24
- copy: '©',
25
- COPY: '©',
26
- curren: '¤',
27
- deg: '°',
28
- divide: '÷',
29
- Eacute: 'É',
30
- eacute: 'é',
31
- Ecirc: 'Ê',
32
- ecirc: 'ê',
33
- Egrave: 'È',
34
- egrave: 'è',
35
- ETH: 'Ð',
36
- eth: 'ð',
37
- Euml: 'Ë',
38
- euml: 'ë',
39
- frac12: '½',
40
- frac14: '¼',
41
- frac34: '¾',
42
- gt: '>',
43
- GT: '>',
44
- Iacute: 'Í',
45
- iacute: 'í',
46
- Icirc: 'Î',
47
- icirc: 'î',
48
- iexcl: '¡',
49
- Igrave: 'Ì',
50
- igrave: 'ì',
51
- iquest: '¿',
52
- Iuml: 'Ï',
53
- iuml: 'ï',
54
- laquo: '«',
55
- lt: '<',
56
- LT: '<',
57
- macr: '¯',
58
- micro: 'µ',
59
- middot: '·',
60
- nbsp: ' ',
61
- not: '¬',
62
- Ntilde: 'Ñ',
63
- ntilde: 'ñ',
64
- Oacute: 'Ó',
65
- oacute: 'ó',
66
- Ocirc: 'Ô',
67
- ocirc: 'ô',
68
- Ograve: 'Ò',
69
- ograve: 'ò',
70
- ordf: 'ª',
71
- ordm: 'º',
72
- Oslash: 'Ø',
73
- oslash: 'ø',
74
- Otilde: 'Õ',
75
- otilde: 'õ',
76
- Ouml: 'Ö',
77
- ouml: 'ö',
78
- para: '¶',
79
- plusmn: '±',
80
- pound: '£',
81
- quot: '"',
82
- QUOT: '"',
83
- raquo: '»',
84
- reg: '®',
85
- REG: '®',
86
- sect: '§',
87
- shy: '­',
88
- sup1: '¹',
89
- sup2: '²',
90
- sup3: '³',
91
- szlig: 'ß',
92
- THORN: 'Þ',
93
- thorn: 'þ',
94
- times: '×',
95
- Uacute: 'Ú',
96
- uacute: 'ú',
97
- Ucirc: 'Û',
98
- ucirc: 'û',
99
- Ugrave: 'Ù',
100
- ugrave: 'ù',
101
- uml: '¨',
102
- Uuml: 'Ü',
103
- uuml: 'ü',
104
- Yacute: 'Ý',
105
- yacute: 'ý',
106
- yen: '¥',
107
- yuml: 'ÿ',
108
- };
@@ -1,8 +0,0 @@
1
- declare const _default: {
2
- amp: string;
3
- apos: string;
4
- gt: string;
5
- lt: string;
6
- quot: string;
7
- };
8
- export default _default;
@@ -1 +0,0 @@
1
- export default { amp: '&', apos: "'", gt: '>', lt: '<', quot: '"' };
@@ -1,90 +0,0 @@
1
- /** The level of entities to support. */
2
- export declare enum EntityLevel {
3
- /** Support only XML entities. */
4
- XML = 0,
5
- /** Support HTML entities, which are a superset of XML entities. */
6
- HTML = 1
7
- }
8
- /** Determines whether some entities are allowed to be written without a trailing `;`. */
9
- export declare enum DecodingMode {
10
- /** Support legacy HTML entities. */
11
- Legacy = 0,
12
- /** Do not support legacy HTML entities. */
13
- Strict = 1
14
- }
15
- export declare enum EncodingMode {
16
- /**
17
- * The output is UTF-8 encoded. Only characters that need escaping within
18
- * HTML will be escaped.
19
- */
20
- UTF8 = 0,
21
- /**
22
- * The output consists only of ASCII characters. Characters that need
23
- * escaping within HTML, and characters that aren't ASCII characters will
24
- * be escaped.
25
- */
26
- ASCII = 1,
27
- /**
28
- * Encode all characters that have an equivalent entity, as well as all
29
- * characters that are not ASCII characters.
30
- */
31
- Extensive = 2
32
- }
33
- interface DecodingOptions {
34
- /**
35
- * The level of entities to support.
36
- * @default EntityLevel.XML
37
- */
38
- level?: EntityLevel;
39
- /**
40
- * Decoding mode. If `Legacy`, will support legacy entities not terminated
41
- * with a semicolon (`;`).
42
- *
43
- * Always `Strict` for XML. For HTML, set this to `true` if you are parsing
44
- * an attribute value.
45
- *
46
- * The deprecated `decodeStrict` function defaults this to `Strict`.
47
- *
48
- * @default DecodingMode.Legacy
49
- */
50
- mode?: DecodingMode;
51
- }
52
- /**
53
- * Decodes a string with entities.
54
- *
55
- * @param data String to decode.
56
- * @param options Decoding options.
57
- */
58
- export declare function decode(data: string, options?: DecodingOptions | EntityLevel): string;
59
- /**
60
- * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
61
- *
62
- * @param data String to decode.
63
- * @param options Decoding options.
64
- * @deprecated Use `decode` with the `mode` set to `Strict`.
65
- */
66
- export declare function decodeStrict(data: string, options?: DecodingOptions | EntityLevel): string;
67
- /**
68
- * Options for `encode`.
69
- */
70
- export interface EncodingOptions {
71
- /**
72
- * The level of entities to support.
73
- * @default EntityLevel.XML
74
- */
75
- level?: EntityLevel;
76
- /**
77
- * Output format.
78
- * @default EncodingMode.Extensive
79
- */
80
- mode?: EncodingMode;
81
- }
82
- /**
83
- * Encodes a string with entities.
84
- *
85
- * @param data String to encode.
86
- * @param options Encoding options.
87
- */
88
- export declare function encode(data: string, options?: EncodingOptions | EntityLevel): string;
89
- export { encodeXML, encodeHTML, encodeNonAsciiHTML, escape, escapeUTF8, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from './encode.js';
90
- export { decodeXML, decodeHTML, decodeHTMLStrict, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from './decode.js';
@@ -1,95 +0,0 @@
1
- import { decodeXML, decodeHTML, decodeHTMLStrict } from './decode.js';
2
- import { encodeXML, encodeHTML, encodeNonAsciiHTML } from './encode.js';
3
- /** The level of entities to support. */
4
- export var EntityLevel;
5
- (function (EntityLevel) {
6
- /** Support only XML entities. */
7
- EntityLevel[EntityLevel["XML"] = 0] = "XML";
8
- /** Support HTML entities, which are a superset of XML entities. */
9
- EntityLevel[EntityLevel["HTML"] = 1] = "HTML";
10
- })(EntityLevel || (EntityLevel = {}));
11
- /** Determines whether some entities are allowed to be written without a trailing `;`. */
12
- export var DecodingMode;
13
- (function (DecodingMode) {
14
- /** Support legacy HTML entities. */
15
- DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
16
- /** Do not support legacy HTML entities. */
17
- DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
18
- })(DecodingMode || (DecodingMode = {}));
19
- export var EncodingMode;
20
- (function (EncodingMode) {
21
- /**
22
- * The output is UTF-8 encoded. Only characters that need escaping within
23
- * HTML will be escaped.
24
- */
25
- EncodingMode[EncodingMode["UTF8"] = 0] = "UTF8";
26
- /**
27
- * The output consists only of ASCII characters. Characters that need
28
- * escaping within HTML, and characters that aren't ASCII characters will
29
- * be escaped.
30
- */
31
- EncodingMode[EncodingMode["ASCII"] = 1] = "ASCII";
32
- /**
33
- * Encode all characters that have an equivalent entity, as well as all
34
- * characters that are not ASCII characters.
35
- */
36
- EncodingMode[EncodingMode["Extensive"] = 2] = "Extensive";
37
- })(EncodingMode || (EncodingMode = {}));
38
- /**
39
- * Decodes a string with entities.
40
- *
41
- * @param data String to decode.
42
- * @param options Decoding options.
43
- */
44
- export function decode(data, options = EntityLevel.XML) {
45
- const opts = typeof options === 'number' ? { level: options } : options;
46
- if (opts.level === EntityLevel.HTML) {
47
- if (opts.mode === DecodingMode.Strict) {
48
- return decodeHTMLStrict(data);
49
- }
50
- return decodeHTML(data);
51
- }
52
- return decodeXML(data);
53
- }
54
- /**
55
- * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
56
- *
57
- * @param data String to decode.
58
- * @param options Decoding options.
59
- * @deprecated Use `decode` with the `mode` set to `Strict`.
60
- */
61
- export function decodeStrict(data, options = EntityLevel.XML) {
62
- const opts = typeof options === 'number' ? { level: options } : options;
63
- if (opts.level === EntityLevel.HTML) {
64
- if (opts.mode === DecodingMode.Legacy) {
65
- return decodeHTML(data);
66
- }
67
- return decodeHTMLStrict(data);
68
- }
69
- return decodeXML(data);
70
- }
71
- /**
72
- * Encodes a string with entities.
73
- *
74
- * @param data String to encode.
75
- * @param options Encoding options.
76
- */
77
- export function encode(data, options = EntityLevel.XML) {
78
- const opts = typeof options === 'number' ? { level: options } : options;
79
- if (opts.level === EntityLevel.HTML) {
80
- if (opts.mode === EncodingMode.ASCII) {
81
- return encodeNonAsciiHTML(data);
82
- }
83
- // TODO Support opts.mode === 'UTF8'
84
- return encodeHTML(data);
85
- }
86
- // TODO Support opts.mode === 'UTF8'
87
- // ASCII and Extensive are equivalent
88
- return encodeXML(data);
89
- }
90
- export { encodeXML, encodeHTML, encodeNonAsciiHTML, escape, escapeUTF8,
91
- // Legacy aliases (deprecated)
92
- encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from './encode.js';
93
- export { decodeXML, decodeHTML, decodeHTMLStrict,
94
- // Legacy aliases (deprecated)
95
- decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from './decode.js';
@@ -1,50 +0,0 @@
1
- import { Node } from '../Node.js';
2
- /**
3
- * Given an array of nodes, remove any member that is contained by another.
4
- *
5
- * @param nodes Nodes to filter.
6
- * @returns Remaining nodes that aren't subtrees of each other.
7
- */
8
- export declare function removeSubsets(nodes: Node[]): Node[];
9
- export declare const enum DocumentPosition {
10
- DISCONNECTED = 1,
11
- PRECEDING = 2,
12
- FOLLOWING = 4,
13
- CONTAINS = 8,
14
- CONTAINED_BY = 16
15
- }
16
- /**
17
- * Compare the position of one node against another node in any other document.
18
- * The return value is a bitmask with the following values:
19
- *
20
- * Document order:
21
- * > There is an ordering, document order, defined on all the nodes in the
22
- * > document corresponding to the order in which the first character of the
23
- * > XML representation of each node occurs in the XML representation of the
24
- * > document after expansion of general entities. Thus, the document element
25
- * > node will be the first node. Element nodes occur before their children.
26
- * > Thus, document order orders element nodes in order of the occurrence of
27
- * > their start-tag in the XML (after expansion of entities). The attribute
28
- * > nodes of an element occur after the element and before its children. The
29
- * > relative order of attribute nodes is implementation-dependent./
30
- *
31
- * Source:
32
- * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
33
- *
34
- * @param nodeA The first node to use in the comparison
35
- * @param nodeB The second node to use in the comparison
36
- * @returns A bitmask describing the input nodes' relative position.
37
- *
38
- * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
39
- * a description of these values.
40
- */
41
- export declare function compareDocumentPosition(nodeA: Node, nodeB: Node): number;
42
- /**
43
- * Sort an array of nodes based on their relative position in the document and
44
- * remove any duplicate nodes. If the array contains nodes that do not belong
45
- * to the same document, sort order is unspecified.
46
- *
47
- * @param nodes Array of DOM nodes.
48
- * @returns Collection of unique nodes, sorted in document order.
49
- */
50
- export declare function uniqueSort<T extends Node>(nodes: T[]): T[];
@@ -1,128 +0,0 @@
1
- import { hasChildren } from '../Node.js';
2
- /**
3
- * Given an array of nodes, remove any member that is contained by another.
4
- *
5
- * @param nodes Nodes to filter.
6
- * @returns Remaining nodes that aren't subtrees of each other.
7
- */
8
- export function removeSubsets(nodes) {
9
- let idx = nodes.length;
10
- /*
11
- * Check if each node (or one of its ancestors) is already contained in the
12
- * array.
13
- */
14
- while (--idx >= 0) {
15
- const node = nodes[idx];
16
- /*
17
- * Remove the node if it is not unique.
18
- * We are going through the array from the end, so we only
19
- * have to check nodes that preceed the node under consideration in the array.
20
- */
21
- if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
22
- nodes.splice(idx, 1);
23
- continue;
24
- }
25
- for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
26
- if (nodes.includes(ancestor)) {
27
- nodes.splice(idx, 1);
28
- break;
29
- }
30
- }
31
- }
32
- return nodes;
33
- }
34
- // Source: http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
35
- export var DocumentPosition;
36
- (function (DocumentPosition) {
37
- DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED";
38
- DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING";
39
- DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING";
40
- DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS";
41
- DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY";
42
- })(DocumentPosition || (DocumentPosition = {}));
43
- /**
44
- * Compare the position of one node against another node in any other document.
45
- * The return value is a bitmask with the following values:
46
- *
47
- * Document order:
48
- * > There is an ordering, document order, defined on all the nodes in the
49
- * > document corresponding to the order in which the first character of the
50
- * > XML representation of each node occurs in the XML representation of the
51
- * > document after expansion of general entities. Thus, the document element
52
- * > node will be the first node. Element nodes occur before their children.
53
- * > Thus, document order orders element nodes in order of the occurrence of
54
- * > their start-tag in the XML (after expansion of entities). The attribute
55
- * > nodes of an element occur after the element and before its children. The
56
- * > relative order of attribute nodes is implementation-dependent./
57
- *
58
- * Source:
59
- * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
60
- *
61
- * @param nodeA The first node to use in the comparison
62
- * @param nodeB The second node to use in the comparison
63
- * @returns A bitmask describing the input nodes' relative position.
64
- *
65
- * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
66
- * a description of these values.
67
- */
68
- export function compareDocumentPosition(nodeA, nodeB) {
69
- const aParents = [];
70
- const bParents = [];
71
- if (nodeA === nodeB) {
72
- return 0;
73
- }
74
- let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
75
- while (current) {
76
- aParents.unshift(current);
77
- current = current.parent;
78
- }
79
- current = hasChildren(nodeB) ? nodeB : nodeB.parent;
80
- while (current) {
81
- bParents.unshift(current);
82
- current = current.parent;
83
- }
84
- const maxIdx = Math.min(aParents.length, bParents.length);
85
- let idx = 0;
86
- while (idx < maxIdx && aParents[idx] === bParents[idx]) {
87
- idx++;
88
- }
89
- if (idx === 0) {
90
- return DocumentPosition.DISCONNECTED;
91
- }
92
- const sharedParent = aParents[idx - 1];
93
- const siblings = sharedParent.children;
94
- const aSibling = aParents[idx];
95
- const bSibling = bParents[idx];
96
- if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
97
- if (sharedParent === nodeB) {
98
- return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
99
- }
100
- return DocumentPosition.FOLLOWING;
101
- }
102
- if (sharedParent === nodeA) {
103
- return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
104
- }
105
- return DocumentPosition.PRECEDING;
106
- }
107
- /**
108
- * Sort an array of nodes based on their relative position in the document and
109
- * remove any duplicate nodes. If the array contains nodes that do not belong
110
- * to the same document, sort order is unspecified.
111
- *
112
- * @param nodes Array of DOM nodes.
113
- * @returns Collection of unique nodes, sorted in document order.
114
- */
115
- export function uniqueSort(nodes) {
116
- nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
117
- nodes.sort((a, b) => {
118
- const relative = compareDocumentPosition(a, b);
119
- if (relative & DocumentPosition.PRECEDING) {
120
- return -1;
121
- }
122
- else if (relative & DocumentPosition.FOLLOWING) {
123
- return 1;
124
- }
125
- return 0;
126
- });
127
- return nodes;
128
- }
@@ -1,46 +0,0 @@
1
- import { Node, Element } from '../Node.js';
2
- import { ElementType } from '../ElementType.js';
3
- interface TestElementOpts {
4
- tag_name?: string | ((name: string) => boolean);
5
- tag_type?: string | ((name: string) => boolean);
6
- tag_contains?: string | ((data?: string) => boolean);
7
- [attributeName: string]: undefined | string | ((attributeValue: string) => boolean);
8
- }
9
- /**
10
- * @param options An object describing nodes to look for.
11
- * @param node The element to test.
12
- * @returns Whether the element matches the description in `options`.
13
- */
14
- export declare function testElement(options: TestElementOpts, node: Node): boolean;
15
- /**
16
- * @param options An object describing nodes to look for.
17
- * @param nodes Nodes to search through.
18
- * @param recurse Also consider child nodes.
19
- * @param limit Maximum number of nodes to return.
20
- * @returns All nodes that match `options`.
21
- */
22
- export declare function getElements(options: TestElementOpts, nodes: Node | Node[], recurse: boolean, limit?: number): Node[];
23
- /**
24
- * @param id The unique ID attribute value to look for.
25
- * @param nodes Nodes to search through.
26
- * @param recurse Also consider child nodes.
27
- * @returns The node with the supplied ID.
28
- */
29
- export declare function getElementById(id: string | ((id: string) => boolean), nodes: Node | Node[], recurse?: boolean): Element | null;
30
- /**
31
- * @param tagName Tag name to search for.
32
- * @param nodes Nodes to search through.
33
- * @param recurse Also consider child nodes.
34
- * @param limit Maximum number of nodes to return.
35
- * @returns All nodes with the supplied `tagName`.
36
- */
37
- export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: Node | Node[], recurse?: boolean, limit?: number): Element[];
38
- /**
39
- * @param type Element type to look for.
40
- * @param nodes Nodes to search through.
41
- * @param recurse Also consider child nodes.
42
- * @param limit Maximum number of nodes to return.
43
- * @returns All nodes with the supplied `type`.
44
- */
45
- export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: Node | Node[], recurse?: boolean, limit?: number): Node[];
46
- export {};