@mtkruto/node 0.1.191 → 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 (265) hide show
  1. package/esm/1_utilities.d.ts +1 -1
  2. package/esm/1_utilities.js +1 -1
  3. package/esm/2_tl.d.ts +6 -6
  4. package/esm/2_tl.js +6 -6
  5. package/esm/3_storage.d.ts +5 -5
  6. package/esm/3_storage.js +5 -5
  7. package/esm/3_types.d.ts +6 -5
  8. package/esm/3_types.js +6 -5
  9. package/esm/4_constants.d.ts +2 -2
  10. package/esm/4_constants.js +2 -2
  11. package/esm/5_client.d.ts +1 -1
  12. package/esm/5_client.js +1 -1
  13. package/esm/client/0_params.d.ts +7 -1
  14. package/esm/client/0_types.d.ts +1 -0
  15. package/esm/client/0_utilities.d.ts +0 -3
  16. package/esm/client/0_utilities.js +0 -20
  17. package/esm/client/1_business_connection_manager.d.ts +11 -0
  18. package/esm/client/1_business_connection_manager.js +47 -0
  19. package/esm/client/1_update_manager.d.ts +8 -1
  20. package/esm/client/1_update_manager.js +88 -8
  21. package/esm/client/2_message_manager.d.ts +7 -6
  22. package/esm/client/2_message_manager.js +48 -31
  23. package/esm/client/4_client.d.ts +426 -428
  24. package/esm/client/4_client.js +570 -530
  25. package/esm/storage/0_storage.d.ts +5 -0
  26. package/esm/storage/0_storage.js +20 -0
  27. package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
  28. package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
  29. package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
  30. package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
  31. package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
  32. package/esm/tl/2_types.d.ts +1071 -183
  33. package/esm/tl/2_types.js +2916 -464
  34. package/esm/tl/3_functions.d.ts +381 -17
  35. package/esm/tl/3_functions.js +1002 -120
  36. package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
  37. package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
  38. package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
  39. package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  40. package/esm/tl/{6_message.js → 7_message.js} +3 -3
  41. package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  42. package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
  43. package/esm/types/0_chat_photo.js +1 -1
  44. package/esm/types/0_message_entity.d.ts +1 -1
  45. package/esm/types/0_thumbnail.js +1 -1
  46. package/esm/types/1_bot_command_scope.d.ts +1 -1
  47. package/esm/types/1_photo.js +2 -2
  48. package/esm/types/1_story_privacy.d.ts +1 -1
  49. package/esm/types/2_business_connection.d.ts +11 -0
  50. package/esm/types/2_business_connection.js +12 -0
  51. package/esm/types/2_chat_member.d.ts +1 -1
  52. package/esm/types/2_chosen_inline_result.d.ts +1 -1
  53. package/esm/types/2_game.js +1 -1
  54. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  55. package/esm/types/2_inline_query.d.ts +1 -1
  56. package/esm/types/2_invite_link.d.ts +1 -1
  57. package/esm/types/2_message_reaction_count.d.ts +1 -1
  58. package/esm/types/2_message_reactions.d.ts +1 -1
  59. package/esm/types/2_story_content.js +1 -1
  60. package/esm/types/{1_story_interactive_area.d.ts → 2_story_interactive_area.d.ts} +2 -2
  61. package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
  62. package/esm/types/3_chat_member_updated.d.ts +1 -1
  63. package/esm/types/3_reply_markup.d.ts +1 -1
  64. package/esm/types/3_story.d.ts +2 -2
  65. package/esm/types/3_story.js +1 -1
  66. package/esm/types/4_inline_query_result.d.ts +1 -1
  67. package/esm/types/4_inline_query_result.js +1 -1
  68. package/esm/types/4_message.d.ts +9 -3
  69. package/esm/types/4_message.js +22 -5
  70. package/esm/types/5_callback_query.d.ts +1 -1
  71. package/esm/types/5_chat.d.ts +1 -1
  72. package/esm/types/6_update.d.ts +12 -2
  73. package/package.json +1 -1
  74. package/script/1_utilities.d.ts +1 -1
  75. package/script/1_utilities.js +1 -1
  76. package/script/2_tl.d.ts +6 -6
  77. package/script/2_tl.js +6 -6
  78. package/script/3_storage.d.ts +5 -5
  79. package/script/3_storage.js +5 -5
  80. package/script/3_types.d.ts +6 -5
  81. package/script/3_types.js +6 -5
  82. package/script/4_constants.d.ts +2 -2
  83. package/script/4_constants.js +2 -2
  84. package/script/5_client.d.ts +1 -1
  85. package/script/5_client.js +1 -1
  86. package/script/client/0_params.d.ts +7 -1
  87. package/script/client/0_types.d.ts +1 -0
  88. package/script/client/0_utilities.d.ts +0 -3
  89. package/script/client/0_utilities.js +1 -23
  90. package/script/client/1_business_connection_manager.d.ts +11 -0
  91. package/script/client/1_business_connection_manager.js +51 -0
  92. package/script/client/1_update_manager.d.ts +8 -1
  93. package/script/client/1_update_manager.js +88 -8
  94. package/script/client/2_message_manager.d.ts +7 -6
  95. package/script/client/2_message_manager.js +47 -30
  96. package/script/client/4_client.d.ts +426 -428
  97. package/script/client/4_client.js +570 -530
  98. package/script/storage/0_storage.d.ts +5 -0
  99. package/script/storage/0_storage.js +20 -0
  100. package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
  101. package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
  102. package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
  103. package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
  104. package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
  105. package/script/tl/2_types.d.ts +1071 -183
  106. package/script/tl/2_types.js +3028 -504
  107. package/script/tl/3_functions.d.ts +381 -17
  108. package/script/tl/3_functions.js +1047 -143
  109. package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
  110. package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
  111. package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
  112. package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  113. package/script/tl/{6_message.js → 7_message.js} +8 -8
  114. package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  115. package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
  116. package/script/types/0_chat_photo.js +9 -9
  117. package/script/types/0_message_entity.d.ts +1 -1
  118. package/script/types/0_thumbnail.js +6 -6
  119. package/script/types/1_bot_command_scope.d.ts +1 -1
  120. package/script/types/1_photo.js +7 -7
  121. package/script/types/1_story_privacy.d.ts +1 -1
  122. package/script/types/2_business_connection.d.ts +11 -0
  123. package/script/types/2_business_connection.js +16 -0
  124. package/script/types/2_chat_member.d.ts +1 -1
  125. package/script/types/2_chosen_inline_result.d.ts +1 -1
  126. package/script/types/2_game.js +3 -3
  127. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  128. package/script/types/2_inline_query.d.ts +1 -1
  129. package/script/types/2_invite_link.d.ts +1 -1
  130. package/script/types/2_message_reaction_count.d.ts +1 -1
  131. package/script/types/2_message_reactions.d.ts +1 -1
  132. package/script/types/2_story_content.js +4 -4
  133. package/script/types/{1_story_interactive_area.d.ts → 2_story_interactive_area.d.ts} +2 -2
  134. package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
  135. package/script/types/3_chat_member_updated.d.ts +1 -1
  136. package/script/types/3_reply_markup.d.ts +1 -1
  137. package/script/types/3_story.d.ts +2 -2
  138. package/script/types/3_story.js +2 -2
  139. package/script/types/4_inline_query_result.d.ts +1 -1
  140. package/script/types/4_inline_query_result.js +2 -2
  141. package/script/types/4_message.d.ts +9 -3
  142. package/script/types/4_message.js +37 -20
  143. package/script/types/5_callback_query.d.ts +1 -1
  144. package/script/types/5_chat.d.ts +1 -1
  145. package/script/types/6_update.d.ts +12 -2
  146. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  147. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  148. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  149. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  150. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  151. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  152. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  153. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  154. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  155. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  156. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  157. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  158. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  159. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  160. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  161. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  162. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  163. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  164. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  165. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  166. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  167. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  168. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  169. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  170. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  171. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  172. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  173. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  174. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  175. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  176. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  177. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  178. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  179. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  180. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  181. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  182. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  183. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  184. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  185. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  186. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  187. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  188. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  189. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  190. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  191. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  192. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  193. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  194. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  195. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  196. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  197. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  198. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  199. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  200. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  201. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  202. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  203. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  204. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  205. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  206. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  207. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  208. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  209. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  210. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  211. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  212. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  213. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  214. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  215. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  216. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  217. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  218. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  219. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  220. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  221. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  222. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  223. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  224. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  225. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  226. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  227. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  228. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  229. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  230. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  231. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  232. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  233. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  234. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  235. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  236. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  237. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
  238. /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  239. /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
  240. /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  241. /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  242. /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  243. /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  244. /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  245. /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  246. /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  247. /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
  248. /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  249. /package/esm/types/{0__file_id.js → _file_id.js} +0 -0
  250. /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  251. /package/esm/types/{1__getters.js → _getters.js} +0 -0
  252. /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  253. /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
  254. /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  255. /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  256. /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  257. /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  258. /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  259. /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  260. /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  261. /package/script/types/{0_venue.js → 1_venue.js} +0 -0
  262. /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  263. /package/script/types/{0__file_id.js → _file_id.js} +0 -0
  264. /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  265. /package/script/types/{1__getters.js → _getters.js} +0 -0
@@ -1,168 +0,0 @@
1
- import { ElementType } from './ElementType.js';
2
- /**
3
- * This object will be used as the prototype for Nodes when creating a
4
- * DOM-Level-1-compliant structure.
5
- */
6
- export declare class Node {
7
- type: ElementType;
8
- /** Parent of the node */
9
- parent: NodeWithChildren | null;
10
- /** Previous sibling */
11
- prev: Node | null;
12
- /** Next sibling */
13
- next: Node | null;
14
- /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
15
- startIndex: number | null;
16
- /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
17
- endIndex: number | null;
18
- /**
19
- *
20
- * @param type The type of the node.
21
- */
22
- constructor(type: ElementType);
23
- get nodeType(): number;
24
- get parentNode(): NodeWithChildren | null;
25
- set parentNode(parent: NodeWithChildren | null);
26
- get previousSibling(): Node | null;
27
- set previousSibling(prev: Node | null);
28
- get nextSibling(): Node | null;
29
- set nextSibling(next: Node | null);
30
- /**
31
- * Clone this node, and optionally its children.
32
- *
33
- * @param recursive Clone child nodes as well.
34
- * @returns A clone of the node.
35
- */
36
- cloneNode<T extends Node>(this: T, recursive?: boolean): T;
37
- }
38
- /**
39
- * A node that contains some data.
40
- */
41
- export declare class DataNode extends Node {
42
- data: string;
43
- /**
44
- * @param type The type of the node
45
- * @param data The content of the data node
46
- */
47
- constructor(type: ElementType.Comment | ElementType.Text | ElementType.Directive, data: string);
48
- get nodeValue(): string;
49
- set nodeValue(data: string);
50
- }
51
- /**
52
- * Text within the document.
53
- */
54
- export declare class Text extends DataNode {
55
- constructor(data: string);
56
- }
57
- /**
58
- * Comments within the document.
59
- */
60
- export declare class Comment extends DataNode {
61
- constructor(data: string);
62
- }
63
- /**
64
- * Processing instructions, including doc types.
65
- */
66
- export declare class ProcessingInstruction extends DataNode {
67
- name: string;
68
- constructor(name: string, data: string);
69
- 'x-name'?: string;
70
- 'x-publicId'?: string;
71
- 'x-systemId'?: string;
72
- }
73
- /**
74
- * A `Node` that can have children.
75
- */
76
- export declare class NodeWithChildren extends Node {
77
- children: Node[];
78
- /**
79
- * @param type Type of the node.
80
- * @param children Children of the node. Only certain node types can have children.
81
- */
82
- constructor(type: ElementType.Root | ElementType.CDATA | ElementType.Script | ElementType.Style | ElementType.Tag, children: Node[]);
83
- get firstChild(): Node | null;
84
- get lastChild(): Node | null;
85
- get childNodes(): Node[];
86
- set childNodes(children: Node[]);
87
- }
88
- /**
89
- * The root node of the document.
90
- */
91
- export declare class Document extends NodeWithChildren {
92
- constructor(children: Node[]);
93
- 'x-mode'?: 'no-quirks' | 'quirks' | 'limited-quirks';
94
- }
95
- /**
96
- * The description of an individual attribute.
97
- */
98
- interface Attribute {
99
- name: string;
100
- value: string;
101
- namespace?: string;
102
- prefix?: string;
103
- }
104
- /**
105
- * An element within the DOM.
106
- */
107
- export declare class Element extends NodeWithChildren {
108
- name: string;
109
- attribs: {
110
- [name: string]: string;
111
- };
112
- /**
113
- * @param name Name of the tag, eg. `div`, `span`.
114
- * @param attribs Object mapping attribute names to attribute values.
115
- * @param children Children of the node.
116
- */
117
- constructor(name: string, attribs: {
118
- [name: string]: string;
119
- }, children?: Node[], type?: ElementType.Tag | ElementType.Script | ElementType.Style);
120
- get tagName(): string;
121
- set tagName(name: string);
122
- get attributes(): Attribute[];
123
- 'x-attribsNamespace'?: Record<string, string>;
124
- 'x-attribsPrefix'?: Record<string, string>;
125
- }
126
- /**
127
- * @param node Node to check.
128
- * @returns `true` if the node is a `Element`, `false` otherwise.
129
- */
130
- export declare function isTag(node: Node): node is Element;
131
- /**
132
- * @param node Node to check.
133
- * @returns `true` if the node has the type `CDATA`, `false` otherwise.
134
- */
135
- export declare function isCDATA(node: Node): node is NodeWithChildren;
136
- /**
137
- * @param node Node to check.
138
- * @returns `true` if the node has the type `Text`, `false` otherwise.
139
- */
140
- export declare function isText(node: Node): node is Text;
141
- /**
142
- * @param node Node to check.
143
- * @returns `true` if the node has the type `Comment`, `false` otherwise.
144
- */
145
- export declare function isComment(node: Node): node is DataNode;
146
- /**
147
- * @param node Node to check.
148
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
149
- */
150
- export declare function isDirective(node: Node): node is ProcessingInstruction;
151
- /**
152
- * @param node Node to check.
153
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
154
- */
155
- export declare function isDocument(node: Node): node is Document;
156
- /**
157
- * @param node Node to check.
158
- * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.
159
- */
160
- export declare function hasChildren(node: Node): node is NodeWithChildren;
161
- /**
162
- * Clone a node, and optionally its children.
163
- *
164
- * @param recursive Clone child nodes as well.
165
- * @returns A clone of the node.
166
- */
167
- export declare function cloneNode<T extends Node>(node: T, recursive?: boolean): T;
168
- export {};
@@ -1,404 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0;
4
- const ElementType_js_1 = require("./ElementType.js");
5
- const nodeTypes = new Map([
6
- [ElementType_js_1.ElementType.Tag, 1],
7
- [ElementType_js_1.ElementType.Script, 1],
8
- [ElementType_js_1.ElementType.Style, 1],
9
- [ElementType_js_1.ElementType.Directive, 1],
10
- [ElementType_js_1.ElementType.Text, 3],
11
- [ElementType_js_1.ElementType.CDATA, 4],
12
- [ElementType_js_1.ElementType.Comment, 8],
13
- [ElementType_js_1.ElementType.Root, 9],
14
- ]);
15
- /**
16
- * This object will be used as the prototype for Nodes when creating a
17
- * DOM-Level-1-compliant structure.
18
- */
19
- class Node {
20
- /**
21
- *
22
- * @param type The type of the node.
23
- */
24
- constructor(type) {
25
- Object.defineProperty(this, "type", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: type
30
- });
31
- /** Parent of the node */
32
- Object.defineProperty(this, "parent", {
33
- enumerable: true,
34
- configurable: true,
35
- writable: true,
36
- value: null
37
- });
38
- /** Previous sibling */
39
- Object.defineProperty(this, "prev", {
40
- enumerable: true,
41
- configurable: true,
42
- writable: true,
43
- value: null
44
- });
45
- /** Next sibling */
46
- Object.defineProperty(this, "next", {
47
- enumerable: true,
48
- configurable: true,
49
- writable: true,
50
- value: null
51
- });
52
- /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
53
- Object.defineProperty(this, "startIndex", {
54
- enumerable: true,
55
- configurable: true,
56
- writable: true,
57
- value: null
58
- });
59
- /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
60
- Object.defineProperty(this, "endIndex", {
61
- enumerable: true,
62
- configurable: true,
63
- writable: true,
64
- value: null
65
- });
66
- }
67
- // Read-only aliases
68
- get nodeType() {
69
- return nodeTypes.get(this.type) ?? 1;
70
- }
71
- // Read-write aliases for properties
72
- get parentNode() {
73
- return this.parent;
74
- }
75
- set parentNode(parent) {
76
- this.parent = parent;
77
- }
78
- get previousSibling() {
79
- return this.prev;
80
- }
81
- set previousSibling(prev) {
82
- this.prev = prev;
83
- }
84
- get nextSibling() {
85
- return this.next;
86
- }
87
- set nextSibling(next) {
88
- this.next = next;
89
- }
90
- /**
91
- * Clone this node, and optionally its children.
92
- *
93
- * @param recursive Clone child nodes as well.
94
- * @returns A clone of the node.
95
- */
96
- cloneNode(recursive = false) {
97
- return cloneNode(this, recursive);
98
- }
99
- }
100
- exports.Node = Node;
101
- /**
102
- * A node that contains some data.
103
- */
104
- class DataNode extends Node {
105
- /**
106
- * @param type The type of the node
107
- * @param data The content of the data node
108
- */
109
- constructor(type, data) {
110
- super(type);
111
- Object.defineProperty(this, "data", {
112
- enumerable: true,
113
- configurable: true,
114
- writable: true,
115
- value: data
116
- });
117
- }
118
- get nodeValue() {
119
- return this.data;
120
- }
121
- set nodeValue(data) {
122
- this.data = data;
123
- }
124
- }
125
- exports.DataNode = DataNode;
126
- /**
127
- * Text within the document.
128
- */
129
- class Text extends DataNode {
130
- constructor(data) {
131
- super(ElementType_js_1.ElementType.Text, data);
132
- }
133
- }
134
- exports.Text = Text;
135
- /**
136
- * Comments within the document.
137
- */
138
- class Comment extends DataNode {
139
- constructor(data) {
140
- super(ElementType_js_1.ElementType.Comment, data);
141
- }
142
- }
143
- exports.Comment = Comment;
144
- /**
145
- * Processing instructions, including doc types.
146
- */
147
- class ProcessingInstruction extends DataNode {
148
- constructor(name, data) {
149
- super(ElementType_js_1.ElementType.Directive, data);
150
- Object.defineProperty(this, "name", {
151
- enumerable: true,
152
- configurable: true,
153
- writable: true,
154
- value: name
155
- });
156
- Object.defineProperty(this, 'x-name', {
157
- enumerable: true,
158
- configurable: true,
159
- writable: true,
160
- value: void 0
161
- });
162
- Object.defineProperty(this, 'x-publicId', {
163
- enumerable: true,
164
- configurable: true,
165
- writable: true,
166
- value: void 0
167
- });
168
- Object.defineProperty(this, 'x-systemId', {
169
- enumerable: true,
170
- configurable: true,
171
- writable: true,
172
- value: void 0
173
- });
174
- }
175
- }
176
- exports.ProcessingInstruction = ProcessingInstruction;
177
- /**
178
- * A `Node` that can have children.
179
- */
180
- class NodeWithChildren extends Node {
181
- /**
182
- * @param type Type of the node.
183
- * @param children Children of the node. Only certain node types can have children.
184
- */
185
- constructor(type, children) {
186
- super(type);
187
- Object.defineProperty(this, "children", {
188
- enumerable: true,
189
- configurable: true,
190
- writable: true,
191
- value: children
192
- });
193
- }
194
- // Aliases
195
- get firstChild() {
196
- return this.children[0] ?? null;
197
- }
198
- get lastChild() {
199
- return this.children.length > 0
200
- ? this.children[this.children.length - 1]
201
- : null;
202
- }
203
- get childNodes() {
204
- return this.children;
205
- }
206
- set childNodes(children) {
207
- this.children = children;
208
- }
209
- }
210
- exports.NodeWithChildren = NodeWithChildren;
211
- /**
212
- * The root node of the document.
213
- */
214
- class Document extends NodeWithChildren {
215
- constructor(children) {
216
- super(ElementType_js_1.ElementType.Root, children);
217
- Object.defineProperty(this, 'x-mode', {
218
- enumerable: true,
219
- configurable: true,
220
- writable: true,
221
- value: void 0
222
- });
223
- }
224
- }
225
- exports.Document = Document;
226
- /**
227
- * An element within the DOM.
228
- */
229
- class Element extends NodeWithChildren {
230
- /**
231
- * @param name Name of the tag, eg. `div`, `span`.
232
- * @param attribs Object mapping attribute names to attribute values.
233
- * @param children Children of the node.
234
- */
235
- constructor(name, attribs, children = [], type = name === 'script'
236
- ? ElementType_js_1.ElementType.Script
237
- : name === 'style'
238
- ? ElementType_js_1.ElementType.Style
239
- : ElementType_js_1.ElementType.Tag) {
240
- super(type, children);
241
- Object.defineProperty(this, "name", {
242
- enumerable: true,
243
- configurable: true,
244
- writable: true,
245
- value: name
246
- });
247
- Object.defineProperty(this, "attribs", {
248
- enumerable: true,
249
- configurable: true,
250
- writable: true,
251
- value: attribs
252
- });
253
- Object.defineProperty(this, 'x-attribsNamespace', {
254
- enumerable: true,
255
- configurable: true,
256
- writable: true,
257
- value: void 0
258
- });
259
- Object.defineProperty(this, 'x-attribsPrefix', {
260
- enumerable: true,
261
- configurable: true,
262
- writable: true,
263
- value: void 0
264
- });
265
- }
266
- // DOM Level 1 aliases
267
- get tagName() {
268
- return this.name;
269
- }
270
- set tagName(name) {
271
- this.name = name;
272
- }
273
- get attributes() {
274
- return Object.keys(this.attribs).map(name => ({
275
- name,
276
- value: this.attribs[name],
277
- namespace: this['x-attribsNamespace']?.[name],
278
- prefix: this['x-attribsPrefix']?.[name],
279
- }));
280
- }
281
- }
282
- exports.Element = Element;
283
- /**
284
- * @param node Node to check.
285
- * @returns `true` if the node is a `Element`, `false` otherwise.
286
- */
287
- function isTag(node) {
288
- return (0, ElementType_js_1.isTag)(node);
289
- }
290
- exports.isTag = isTag;
291
- /**
292
- * @param node Node to check.
293
- * @returns `true` if the node has the type `CDATA`, `false` otherwise.
294
- */
295
- function isCDATA(node) {
296
- return node.type === ElementType_js_1.ElementType.CDATA;
297
- }
298
- exports.isCDATA = isCDATA;
299
- /**
300
- * @param node Node to check.
301
- * @returns `true` if the node has the type `Text`, `false` otherwise.
302
- */
303
- function isText(node) {
304
- return node.type === ElementType_js_1.ElementType.Text;
305
- }
306
- exports.isText = isText;
307
- /**
308
- * @param node Node to check.
309
- * @returns `true` if the node has the type `Comment`, `false` otherwise.
310
- */
311
- function isComment(node) {
312
- return node.type === ElementType_js_1.ElementType.Comment;
313
- }
314
- exports.isComment = isComment;
315
- /**
316
- * @param node Node to check.
317
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
318
- */
319
- function isDirective(node) {
320
- return node.type === ElementType_js_1.ElementType.Directive;
321
- }
322
- exports.isDirective = isDirective;
323
- /**
324
- * @param node Node to check.
325
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
326
- */
327
- function isDocument(node) {
328
- return node.type === ElementType_js_1.ElementType.Root;
329
- }
330
- exports.isDocument = isDocument;
331
- /**
332
- * @param node Node to check.
333
- * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.
334
- */
335
- function hasChildren(node) {
336
- return Object.prototype.hasOwnProperty.call(node, 'children');
337
- }
338
- exports.hasChildren = hasChildren;
339
- /**
340
- * Clone a node, and optionally its children.
341
- *
342
- * @param recursive Clone child nodes as well.
343
- * @returns A clone of the node.
344
- */
345
- function cloneNode(node, recursive = false) {
346
- let result;
347
- if (isText(node)) {
348
- result = new Text(node.data);
349
- }
350
- else if (isComment(node)) {
351
- result = new Comment(node.data);
352
- }
353
- else if (isTag(node)) {
354
- const children = recursive ? cloneChildren(node.children) : [];
355
- const clone = new Element(node.name, { ...node.attribs }, children);
356
- children.forEach(child => (child.parent = clone));
357
- if (node['x-attribsNamespace']) {
358
- clone['x-attribsNamespace'] = { ...node['x-attribsNamespace'] };
359
- }
360
- if (node['x-attribsPrefix']) {
361
- clone['x-attribsPrefix'] = { ...node['x-attribsPrefix'] };
362
- }
363
- result = clone;
364
- }
365
- else if (isCDATA(node)) {
366
- const children = recursive ? cloneChildren(node.children) : [];
367
- const clone = new NodeWithChildren(ElementType_js_1.ElementType.CDATA, children);
368
- children.forEach(child => (child.parent = clone));
369
- result = clone;
370
- }
371
- else if (isDocument(node)) {
372
- const children = recursive ? cloneChildren(node.children) : [];
373
- const clone = new Document(children);
374
- children.forEach(child => (child.parent = clone));
375
- if (node['x-mode']) {
376
- clone['x-mode'] = node['x-mode'];
377
- }
378
- result = clone;
379
- }
380
- else if (isDirective(node)) {
381
- const instruction = new ProcessingInstruction(node.name, node.data);
382
- if (node['x-name'] != null) {
383
- instruction['x-name'] = node['x-name'];
384
- instruction['x-publicId'] = node['x-publicId'];
385
- instruction['x-systemId'] = node['x-systemId'];
386
- }
387
- result = instruction;
388
- }
389
- else {
390
- throw new Error(`Not implemented yet: ${node.type}`);
391
- }
392
- result.startIndex = node.startIndex;
393
- result.endIndex = node.endIndex;
394
- return result;
395
- }
396
- exports.cloneNode = cloneNode;
397
- function cloneChildren(childs) {
398
- const children = childs.map(child => cloneNode(child, true));
399
- for (let i = 1; i < children.length; i++) {
400
- children[i].prev = children[i - 1];
401
- children[i - 1].next = children[i];
402
- }
403
- return children;
404
- }