tiny-essentials 1.16.1 → 1.17.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 (139) hide show
  1. package/dist/legacy/crypto/decrypt.cjs +1 -0
  2. package/dist/legacy/crypto/decrypt.d.mts +1 -0
  3. package/dist/legacy/crypto/decrypt.mjs +1 -0
  4. package/dist/legacy/crypto/encrypt.cjs +1 -0
  5. package/dist/legacy/crypto/encrypt.d.mts +1 -0
  6. package/dist/legacy/crypto/encrypt.mjs +1 -0
  7. package/dist/legacy/get/decimalColor.cjs +1 -0
  8. package/dist/legacy/get/decimalColor.d.mts +1 -0
  9. package/dist/legacy/get/decimalColor.mjs +1 -0
  10. package/dist/legacy/get/pagination.cjs +1 -0
  11. package/dist/legacy/get/pagination.d.mts +1 -0
  12. package/dist/legacy/get/pagination.mjs +1 -0
  13. package/dist/legacy/get/queryUrlByName.cjs +1 -0
  14. package/dist/legacy/get/queryUrlByName.d.mts +1 -0
  15. package/dist/legacy/get/queryUrlByName.mjs +1 -0
  16. package/dist/legacy/get/queryUrlJSON.cjs +1 -0
  17. package/dist/legacy/get/queryUrlJSON.d.mts +1 -0
  18. package/dist/legacy/get/queryUrlJSON.mjs +1 -0
  19. package/dist/legacy/get/super_string_filter.cjs +1 -0
  20. package/dist/legacy/get/super_string_filter.d.mts +1 -0
  21. package/dist/legacy/get/super_string_filter.mjs +1 -0
  22. package/dist/legacy/get/versionCheck.cjs +1 -0
  23. package/dist/legacy/get/versionCheck.d.mts +1 -0
  24. package/dist/legacy/get/versionCheck.mjs +1 -0
  25. package/dist/legacy/http/HTTP-1.0.cjs +2 -0
  26. package/dist/legacy/http/HTTP-1.0.mjs +2 -0
  27. package/dist/legacy/http/auth.cjs +1 -0
  28. package/dist/legacy/http/auth.d.mts +1 -0
  29. package/dist/legacy/http/auth.mjs +1 -0
  30. package/dist/legacy/http/check_domain.cjs +11 -0
  31. package/dist/legacy/http/check_domain.d.mts +3 -0
  32. package/dist/legacy/http/check_domain.mjs +11 -0
  33. package/dist/legacy/http/csrfTokenAnalyze.cjs +1 -0
  34. package/dist/legacy/http/csrfTokenAnalyze.d.mts +1 -0
  35. package/dist/legacy/http/csrfTokenAnalyze.mjs +1 -0
  36. package/dist/legacy/http/domainValidator.cjs +1 -0
  37. package/dist/legacy/http/domainValidator.d.mts +1 -0
  38. package/dist/legacy/http/domainValidator.mjs +1 -0
  39. package/dist/legacy/http/errorsCallback.cjs +1 -0
  40. package/dist/legacy/http/errorsCallback.d.mts +1 -0
  41. package/dist/legacy/http/errorsCallback.mjs +1 -0
  42. package/dist/legacy/http/fetch/json.cjs +1 -0
  43. package/dist/legacy/http/fetch/json.d.mts +1 -0
  44. package/dist/legacy/http/fetch/json.mjs +1 -0
  45. package/dist/legacy/http/fetch/text.cjs +1 -0
  46. package/dist/legacy/http/fetch/text.d.mts +1 -0
  47. package/dist/legacy/http/fetch/text.mjs +1 -0
  48. package/dist/legacy/http/fileCache.cjs +1 -0
  49. package/dist/legacy/http/fileCache.d.mts +1 -0
  50. package/dist/legacy/http/fileCache.mjs +1 -0
  51. package/dist/legacy/http/getDomainURL.cjs +1 -0
  52. package/dist/legacy/http/getDomainURL.d.mts +1 -0
  53. package/dist/legacy/http/getDomainURL.mjs +1 -0
  54. package/dist/legacy/http/userIP.cjs +1 -0
  55. package/dist/legacy/http/userIP.d.mts +1 -0
  56. package/dist/legacy/http/userIP.mjs +1 -0
  57. package/dist/legacy/libs/capitalize.cjs +1 -0
  58. package/dist/legacy/libs/capitalize.d.mts +1 -0
  59. package/dist/legacy/libs/capitalize.mjs +1 -0
  60. package/dist/legacy/libs/convertBytes.cjs +2 -0
  61. package/dist/legacy/libs/convertBytes.mjs +2 -0
  62. package/dist/legacy/libs/custom_module_loader.cjs +2 -0
  63. package/dist/legacy/libs/custom_module_loader.mjs +2 -0
  64. package/dist/legacy/libs/dice.cjs +2 -0
  65. package/dist/legacy/libs/dice.mjs +2 -0
  66. package/dist/legacy/libs/markdown.cjs +1 -0
  67. package/dist/legacy/libs/markdown.mjs +1 -0
  68. package/dist/legacy/libs/percentage.cjs +1 -0
  69. package/dist/legacy/libs/percentage.mjs +1 -0
  70. package/dist/legacy/libs/regex/getLetter.cjs +2 -0
  71. package/dist/legacy/libs/regex/getLetter.d.mts +2 -0
  72. package/dist/legacy/libs/regex/getLetter.mjs +2 -0
  73. package/dist/legacy/libs/rule3.cjs +1 -0
  74. package/dist/legacy/libs/rule3.mjs +1 -0
  75. package/dist/legacy/momentjs/getAge.cjs +1 -0
  76. package/dist/legacy/momentjs/getAge.d.mts +1 -0
  77. package/dist/legacy/momentjs/getAge.mjs +1 -0
  78. package/dist/legacy/momentjs/timeDuration.cjs +1 -0
  79. package/dist/legacy/momentjs/timeDuration.d.mts +1 -0
  80. package/dist/legacy/momentjs/timeDuration.mjs +1 -0
  81. package/dist/legacy/socket.io/antiFlood/install.cjs +1 -0
  82. package/dist/legacy/socket.io/antiFlood/install.d.mts +1 -0
  83. package/dist/legacy/socket.io/antiFlood/install.mjs +1 -0
  84. package/dist/legacy/socket.io/antiFlood/verify.cjs +1 -0
  85. package/dist/legacy/socket.io/antiFlood/verify.d.mts +1 -0
  86. package/dist/legacy/socket.io/antiFlood/verify.mjs +1 -0
  87. package/dist/legacy/socket.io/cookie-session.cjs +1 -0
  88. package/dist/legacy/socket.io/cookie-session.d.mts +1 -0
  89. package/dist/legacy/socket.io/cookie-session.mjs +1 -0
  90. package/dist/legacy/socket.io/discord.cjs +1 -0
  91. package/dist/legacy/socket.io/discord.d.mts +1 -0
  92. package/dist/legacy/socket.io/discord.mjs +1 -0
  93. package/dist/v1/TinyAfterScrollWatcher.js +49 -26
  94. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  95. package/dist/v1/TinyBasicsEs.js +559 -71
  96. package/dist/v1/TinyBasicsEs.min.js +1 -1
  97. package/dist/v1/TinyDragger.js +486 -47
  98. package/dist/v1/TinyDragger.min.js +1 -1
  99. package/dist/v1/TinyEssentials.js +2545 -98
  100. package/dist/v1/TinyEssentials.min.js +1 -1
  101. package/dist/v1/TinyHtml.js +486 -47
  102. package/dist/v1/TinyHtml.min.js +1 -1
  103. package/dist/v1/TinySmartScroller.js +6230 -0
  104. package/dist/v1/TinySmartScroller.min.js +1 -0
  105. package/dist/v1/TinyUploadClicker.js +1538 -72
  106. package/dist/v1/TinyUploadClicker.min.js +1 -1
  107. package/dist/v1/UltraRandomMsgGen.js +995 -0
  108. package/dist/v1/UltraRandomMsgGen.min.js +1 -0
  109. package/dist/v1/basics/html.cjs +74 -24
  110. package/dist/v1/basics/html.d.mts +38 -15
  111. package/dist/v1/basics/html.mjs +63 -20
  112. package/dist/v1/build/TinySmartScroller.cjs +7 -0
  113. package/dist/v1/build/TinySmartScroller.d.mts +3 -0
  114. package/dist/v1/build/TinySmartScroller.mjs +2 -0
  115. package/dist/v1/build/UltraRandomMsgGen.cjs +7 -0
  116. package/dist/v1/build/UltraRandomMsgGen.d.mts +3 -0
  117. package/dist/v1/build/UltraRandomMsgGen.mjs +2 -0
  118. package/dist/v1/index.cjs +4 -0
  119. package/dist/v1/index.d.mts +3 -1
  120. package/dist/v1/index.mjs +3 -1
  121. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +49 -26
  122. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +17 -14
  123. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +50 -24
  124. package/dist/v1/libs/TinyHtml.cjs +486 -47
  125. package/dist/v1/libs/TinyHtml.d.mts +352 -139
  126. package/dist/v1/libs/TinyHtml.mjs +431 -47
  127. package/dist/v1/libs/TinySmartScroller.cjs +976 -0
  128. package/dist/v1/libs/TinySmartScroller.d.mts +458 -0
  129. package/dist/v1/libs/TinySmartScroller.mjs +856 -0
  130. package/dist/v1/libs/UltraRandomMsgGen.cjs +956 -0
  131. package/dist/v1/libs/UltraRandomMsgGen.d.mts +390 -0
  132. package/dist/v1/libs/UltraRandomMsgGen.mjs +825 -0
  133. package/docs/v1/README.md +2 -0
  134. package/docs/v1/basics/html.md +17 -2
  135. package/docs/v1/libs/TinyAfterScrollWatcher.md +54 -4
  136. package/docs/v1/libs/TinyHtml.md +197 -8
  137. package/docs/v1/libs/TinySmartScroller.md +523 -0
  138. package/docs/v1/libs/UltraRandomMsgGen.md +289 -0
  139. package/package.json +1 -1
@@ -39,6 +39,7 @@ const convertBytes = {
39
39
  * @param {number} bytes - The number of units to convert.
40
40
  * @param {SizeUnit} selected - The unit of the input value.
41
41
  * @returns {number} The equivalent size in bytes.
42
+ * @deprecated
42
43
  *
43
44
  * @example
44
45
  * convertBytes.get(5, 'mb'); // 5242880
@@ -52,6 +53,7 @@ const convertBytes = {
52
53
  * @param {number} bytes - The size in bytes.
53
54
  * @param {SizeUnit} selected - The target unit.
54
55
  * @returns {number} The equivalent size in the selected unit.
56
+ * @deprecated
55
57
  *
56
58
  * @example
57
59
  * convertBytes.convert(1048576, 'mb'); // 1
@@ -32,6 +32,7 @@ const convertBytes = {
32
32
  * @param {number} bytes - The number of units to convert.
33
33
  * @param {SizeUnit} selected - The unit of the input value.
34
34
  * @returns {number} The equivalent size in bytes.
35
+ * @deprecated
35
36
  *
36
37
  * @example
37
38
  * convertBytes.get(5, 'mb'); // 5242880
@@ -44,6 +45,7 @@ const convertBytes = {
44
45
  * @param {number} bytes - The size in bytes.
45
46
  * @param {SizeUnit} selected - The target unit.
46
47
  * @returns {number} The equivalent size in the selected unit.
48
+ * @deprecated
47
49
  *
48
50
  * @example
49
51
  * convertBytes.convert(1048576, 'mb'); // 1
@@ -13,6 +13,7 @@ const custom_module_manager = {
13
13
  * @param {Record<string, any>} custom_modules - The object containing module definitions.
14
14
  * @param {string} type - The specific type of module to validate.
15
15
  * @returns {boolean} Whether the module is valid.
16
+ * @deprecated
16
17
  *
17
18
  * @example
18
19
  * custom_module_manager.validator(myModules, 'paypal'); // true or false
@@ -37,6 +38,7 @@ const custom_module_manager = {
37
38
  * @param {Record<string, any>} [options] - Optional. Object with keys matching types in `custom_modules`.
38
39
  *
39
40
  * @returns {Promise<void>}
41
+ * @deprecated
40
42
  *
41
43
  * @example
42
44
  * await custom_module_manager.run(customModules, db, 'after', { paypal: true });
@@ -10,6 +10,7 @@ const custom_module_manager = {
10
10
  * @param {Record<string, any>} custom_modules - The object containing module definitions.
11
11
  * @param {string} type - The specific type of module to validate.
12
12
  * @returns {boolean} Whether the module is valid.
13
+ * @deprecated
13
14
  *
14
15
  * @example
15
16
  * custom_module_manager.validator(myModules, 'paypal'); // true or false
@@ -32,6 +33,7 @@ const custom_module_manager = {
32
33
  * @param {Record<string, any>} [options] - Optional. Object with keys matching types in `custom_modules`.
33
34
  *
34
35
  * @returns {Promise<void>}
36
+ * @deprecated
35
37
  *
36
38
  * @example
37
39
  * await custom_module_manager.run(customModules, db, 'after', { paypal: true });
@@ -10,6 +10,7 @@ const tinyDice = {
10
10
  * Generates a random integer between 1 and `obj`, inclusive.
11
11
  * @param {number} obj - The maximum value of the dice.
12
12
  * @returns {number} The result of the dice roll.
13
+ * @deprecated
13
14
  *
14
15
  * @example
15
16
  * const result = tinyDice.vanilla(6); // 1 to 6
@@ -23,6 +24,7 @@ const tinyDice = {
23
24
  * Useful for injecting the dice logic in client environments.
24
25
  * @param {number} obj - Unused in the function body.
25
26
  * @returns {string} The function source code of `vanilla`.
27
+ * @deprecated
26
28
  *
27
29
  * @example
28
30
  * const clientScript = tinyDice.getClientVanilla();
@@ -8,6 +8,7 @@ const tinyDice = {
8
8
  * Generates a random integer between 1 and `obj`, inclusive.
9
9
  * @param {number} obj - The maximum value of the dice.
10
10
  * @returns {number} The result of the dice roll.
11
+ * @deprecated
11
12
  *
12
13
  * @example
13
14
  * const result = tinyDice.vanilla(6); // 1 to 6
@@ -20,6 +21,7 @@ const tinyDice = {
20
21
  * Useful for injecting the dice logic in client environments.
21
22
  * @param {number} obj - Unused in the function body.
22
23
  * @returns {string} The function source code of `vanilla`.
24
+ * @deprecated
23
25
  *
24
26
  * @example
25
27
  * const clientScript = tinyDice.getClientVanilla();
@@ -73,6 +73,7 @@ const markdownManager = {
73
73
  * @param {string} markdownText - The input Markdown string.
74
74
  * @param {'result' | 'bbcode'} [type='result'] - The desired output type.
75
75
  * @returns {string} The converted string.
76
+ * @deprecated
76
77
  *
77
78
  * @example
78
79
  * markdownManager.parseMarkdown("**bold**"); // <strong>bold</strong>
@@ -70,6 +70,7 @@ const markdownManager = {
70
70
  * @param {string} markdownText - The input Markdown string.
71
71
  * @param {'result' | 'bbcode'} [type='result'] - The desired output type.
72
72
  * @returns {string} The converted string.
73
+ * @deprecated
73
74
  *
74
75
  * @example
75
76
  * markdownManager.parseMarkdown("**bold**"); // <strong>bold</strong>
@@ -10,6 +10,7 @@ const percentageBase = {
10
10
  * @param {number} preco - The base value.
11
11
  * @param {number} porcentagem - The percentage to apply.
12
12
  * @returns {number} The result of the percentage calculation.
13
+ * @deprecated
13
14
  *
14
15
  * @example
15
16
  * percentageBase.run(200, 15); // 30
@@ -8,6 +8,7 @@ const percentageBase = {
8
8
  * @param {number} preco - The base value.
9
9
  * @param {number} porcentagem - The percentage to apply.
10
10
  * @returns {number} The result of the percentage calculation.
11
+ * @deprecated
11
12
  *
12
13
  * @example
13
14
  * percentageBase.run(200, 15); // 30
@@ -4,6 +4,7 @@
4
4
  * Matches exactly one letter (lowercase or uppercase).
5
5
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
6
6
  * @returns {RegExp} The regular expression to match exactly one letter.
7
+ * @deprecated
7
8
  */
8
9
  function oneLetter(type = 'g') {
9
10
  return new RegExp('^[a-zA-Z]+$', type); // Matches exactly one letter
@@ -13,6 +14,7 @@ function oneLetter(type = 'g') {
13
14
  * Matches one or more letters (lowercase or uppercase).
14
15
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
15
16
  * @returns {RegExp} The regular expression to match one or more letters.
17
+ * @deprecated
16
18
  */
17
19
  function multiLetters(type = 'g') {
18
20
  return new RegExp('[a-zA-Z]+', type); // Matches one or more letters
@@ -2,12 +2,14 @@
2
2
  * Matches exactly one letter (lowercase or uppercase).
3
3
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
4
4
  * @returns {RegExp} The regular expression to match exactly one letter.
5
+ * @deprecated
5
6
  */
6
7
  export function oneLetter(type?: string): RegExp;
7
8
  /**
8
9
  * Matches one or more letters (lowercase or uppercase).
9
10
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
10
11
  * @returns {RegExp} The regular expression to match one or more letters.
12
+ * @deprecated
11
13
  */
12
14
  export function multiLetters(type?: string): RegExp;
13
15
  //# sourceMappingURL=getLetter.d.mts.map
@@ -2,6 +2,7 @@
2
2
  * Matches exactly one letter (lowercase or uppercase).
3
3
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
4
4
  * @returns {RegExp} The regular expression to match exactly one letter.
5
+ * @deprecated
5
6
  */
6
7
  function oneLetter(type = 'g') {
7
8
  return new RegExp('^[a-zA-Z]+$', type); // Matches exactly one letter
@@ -10,6 +11,7 @@ function oneLetter(type = 'g') {
10
11
  * Matches one or more letters (lowercase or uppercase).
11
12
  * @param {string} [type='g'] - The flag for the regular expression (default is 'g').
12
13
  * @returns {RegExp} The regular expression to match one or more letters.
14
+ * @deprecated
13
15
  */
14
16
  function multiLetters(type = 'g') {
15
17
  return new RegExp('[a-zA-Z]+', type); // Matches one or more letters
@@ -23,6 +23,7 @@ const ruleOfThree = {
23
23
  * @param {number} val3 - The third value (numerator in direct proportion, denominator in inverse).
24
24
  * @param {boolean} inverse - Whether the calculation should use inverse proportion (true for inverse, false for direct).
25
25
  * @returns {number} The result of the Rule of Three operation.
26
+ * @deprecated
26
27
  *
27
28
  * Rule of Three Formula (Direct Proportion):
28
29
  * val1 / val2 = val3 / result
@@ -20,6 +20,7 @@ const ruleOfThree = {
20
20
  * @param {number} val3 - The third value (numerator in direct proportion, denominator in inverse).
21
21
  * @param {boolean} inverse - Whether the calculation should use inverse proportion (true for inverse, false for direct).
22
22
  * @returns {number} The result of the Rule of Three operation.
23
+ * @deprecated
23
24
  *
24
25
  * Rule of Three Formula (Direct Proportion):
25
26
  * val1 / val2 = val3 / result
@@ -8,6 +8,7 @@ var moment = require('moment');
8
8
  * @param {number|string} timeData - The birth date in a format accepted by moment.js (e.g., Unix timestamp, ISO 8601 string, etc.).
9
9
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date. Defaults to the current date and time if not provided.
10
10
  * @returns {number|null} The age in years, or null if `timeData` is not provided.
11
+ * @deprecated
11
12
  */
12
13
  function getAge(timeData = 0, now = null) {
13
14
  // Number
@@ -4,6 +4,7 @@
4
4
  * @param {number|string} timeData - The birth date in a format accepted by moment.js (e.g., Unix timestamp, ISO 8601 string, etc.).
5
5
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date. Defaults to the current date and time if not provided.
6
6
  * @returns {number|null} The age in years, or null if `timeData` is not provided.
7
+ * @deprecated
7
8
  */
8
9
  export default function getAge(timeData?: number | string, now?: moment.Moment | null): number | null;
9
10
  import moment from 'moment';
@@ -5,6 +5,7 @@ import moment from 'moment';
5
5
  * @param {number|string} timeData - The birth date in a format accepted by moment.js (e.g., Unix timestamp, ISO 8601 string, etc.).
6
6
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date. Defaults to the current date and time if not provided.
7
7
  * @returns {number|null} The age in years, or null if `timeData` is not provided.
8
+ * @deprecated
8
9
  */
9
10
  export default function getAge(timeData = 0, now = null) {
10
11
  // Number
@@ -9,6 +9,7 @@ var moment = require('moment');
9
9
  * @param {string} [durationType='asSeconds'] - The type of duration to return. Default is `'asSeconds'`. Can be any valid moment.js duration type (e.g., `'asMilliseconds'`, `'asMinutes'`, `'asHours'`, etc.).
10
10
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date and time. Defaults to the current date and time if not provided.
11
11
  * @returns {number|null} The calculated duration in the specified unit (default: seconds), or `null` if `timeData` is not provided.
12
+ * @deprecated
12
13
  */
13
14
  function timeDuration(timeData = 0, durationType = 'asSeconds', now = null) {
14
15
  // Number
@@ -5,6 +5,7 @@
5
5
  * @param {string} [durationType='asSeconds'] - The type of duration to return. Default is `'asSeconds'`. Can be any valid moment.js duration type (e.g., `'asMilliseconds'`, `'asMinutes'`, `'asHours'`, etc.).
6
6
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date and time. Defaults to the current date and time if not provided.
7
7
  * @returns {number|null} The calculated duration in the specified unit (default: seconds), or `null` if `timeData` is not provided.
8
+ * @deprecated
8
9
  */
9
10
  export default function timeDuration(timeData?: number, durationType?: string, now?: moment.Moment | null): number | null;
10
11
  import moment from 'moment';
@@ -6,6 +6,7 @@ import moment from 'moment';
6
6
  * @param {string} [durationType='asSeconds'] - The type of duration to return. Default is `'asSeconds'`. Can be any valid moment.js duration type (e.g., `'asMilliseconds'`, `'asMinutes'`, `'asHours'`, etc.).
7
7
  * @param {moment.Moment|null} [now=null] - The moment object representing the current date and time. Defaults to the current date and time if not provided.
8
8
  * @returns {number|null} The calculated duration in the specified unit (default: seconds), or `null` if `timeData` is not provided.
9
+ * @deprecated
9
10
  */
10
11
  export default function timeDuration(timeData = 0, durationType = 'asSeconds', now = null) {
11
12
  // Number
@@ -12,6 +12,7 @@ var userIP = require('../../http/userIP.cjs');
12
12
  * @param {Object} ioCache - The cache object containing blocked IPs.
13
13
  * @param {Array<*>} ioCache.blocklick - The list of blocked IP addresses.
14
14
  * @returns {void} This function does not return a value, it just sets the authorization logic for socket connections.
15
+ * @deprecated
15
16
  */
16
17
  function install(io, ioCache) {
17
18
  // @ts-ignore
@@ -8,6 +8,7 @@
8
8
  * @param {Object} ioCache - The cache object containing blocked IPs.
9
9
  * @param {Array<*>} ioCache.blocklick - The list of blocked IP addresses.
10
10
  * @returns {void} This function does not return a value, it just sets the authorization logic for socket connections.
11
+ * @deprecated
11
12
  */
12
13
  export default function install(io: any, ioCache: {
13
14
  blocklick: Array<any>;
@@ -9,6 +9,7 @@ import userIp from '../../http/userIP.mjs';
9
9
  * @param {Object} ioCache - The cache object containing blocked IPs.
10
10
  * @param {Array<*>} ioCache.blocklick - The list of blocked IP addresses.
11
11
  * @returns {void} This function does not return a value, it just sets the authorization logic for socket connections.
12
+ * @deprecated
12
13
  */
13
14
  export default function install(io, ioCache) {
14
15
  // @ts-ignore
@@ -34,6 +34,7 @@ setInterval(function () {
34
34
  * @param {Object} ioCache - The cache object that holds the blocklist and flood panel data.
35
35
  * @param {Array<*>} ioCache.blocklick - The list of blocked IPs.
36
36
  * @returns {void} This function does not return anything, it modifies the floodPanel and blocklist.
37
+ * @deprecated
37
38
  */
38
39
  function verify(socket, ioCache) {
39
40
  // Get User IP
@@ -8,6 +8,7 @@
8
8
  * @param {Object} ioCache - The cache object that holds the blocklist and flood panel data.
9
9
  * @param {Array<*>} ioCache.blocklick - The list of blocked IPs.
10
10
  * @returns {void} This function does not return anything, it modifies the floodPanel and blocklist.
11
+ * @deprecated
11
12
  */
12
13
  export default function verify(socket: Record<string, any>, ioCache: {
13
14
  blocklick: Array<any>;
@@ -28,6 +28,7 @@ setInterval(function () {
28
28
  * @param {Object} ioCache - The cache object that holds the blocklist and flood panel data.
29
29
  * @param {Array<*>} ioCache.blocklick - The list of blocked IPs.
30
30
  * @returns {void} This function does not return anything, it modifies the floodPanel and blocklist.
31
+ * @deprecated
31
32
  */
32
33
  export default function verify(socket, ioCache) {
33
34
  // Get User IP
@@ -7,6 +7,7 @@
7
7
  * @param {Record<string, any>} socket - The socket object representing the connection.
8
8
  * @param {Function} sessionModule - The session module function, typically used with Express, that handles session logic.
9
9
  * @returns {Promise<Record<string, any>>} A promise that resolves with the session object once the session is processed.
10
+ * @deprecated
10
11
  */
11
12
  function cookieSession(socket, sessionModule) {
12
13
  return new Promise((resolve) => {
@@ -5,6 +5,7 @@
5
5
  * @param {Record<string, any>} socket - The socket object representing the connection.
6
6
  * @param {Function} sessionModule - The session module function, typically used with Express, that handles session logic.
7
7
  * @returns {Promise<Record<string, any>>} A promise that resolves with the session object once the session is processed.
8
+ * @deprecated
8
9
  */
9
10
  export default function cookieSession(socket: Record<string, any>, sessionModule: Function): Promise<Record<string, any>>;
10
11
  //# sourceMappingURL=cookie-session.d.mts.map
@@ -5,6 +5,7 @@
5
5
  * @param {Record<string, any>} socket - The socket object representing the connection.
6
6
  * @param {Function} sessionModule - The session module function, typically used with Express, that handles session logic.
7
7
  * @returns {Promise<Record<string, any>>} A promise that resolves with the session object once the session is processed.
8
+ * @deprecated
8
9
  */
9
10
  export default function cookieSession(socket, sessionModule) {
10
11
  return new Promise((resolve) => {
@@ -10,6 +10,7 @@ var getUser = require('../firebase/discord/api/getUser.cjs');
10
10
  * @param {Record<string, any>} ioCache - The shared cache that stores user data and connections.
11
11
  * @param {string} token - The OAuth2 token used to fetch user data from Discord.
12
12
  * @returns {Promise<Record<string, any>>} A promise that resolves with the user data and updates the cache.
13
+ * @deprecated
13
14
  */
14
15
  function discord(socket, ioCache, token) {
15
16
  return new Promise((resolve, reject) => {
@@ -6,6 +6,7 @@
6
6
  * @param {Record<string, any>} ioCache - The shared cache that stores user data and connections.
7
7
  * @param {string} token - The OAuth2 token used to fetch user data from Discord.
8
8
  * @returns {Promise<Record<string, any>>} A promise that resolves with the user data and updates the cache.
9
+ * @deprecated
9
10
  */
10
11
  export default function discord(socket: Record<string, any>, ioCache: Record<string, any>, token: string): Promise<Record<string, any>>;
11
12
  //# sourceMappingURL=discord.d.mts.map
@@ -7,6 +7,7 @@ import getUser from '../firebase/discord/api/getUser.mjs';
7
7
  * @param {Record<string, any>} ioCache - The shared cache that stores user data and connections.
8
8
  * @param {string} token - The OAuth2 token used to fetch user data from Discord.
9
9
  * @returns {Promise<Record<string, any>>} A promise that resolves with the user data and updates the cache.
10
+ * @deprecated
10
11
  */
11
12
  export default function discord(socket, ioCache, token) {
12
13
  return new Promise((resolve, reject) => {
@@ -49,8 +49,8 @@ class TinyAfterScrollWatcher {
49
49
  /** @type {Element|Window} */
50
50
  #scrollTarget;
51
51
 
52
- /** @type {number} */
53
- lastScrollTime = 0;
52
+ /** @type {null|NodeJS.Timeout} */
53
+ #lastScrollTime = null;
54
54
 
55
55
  /** @type {FnData[]} */
56
56
  #afterScrollQueue = [];
@@ -61,6 +61,9 @@ class TinyAfterScrollWatcher {
61
61
  /** @type {Set<OnScrollFunc>} */
62
62
  #externalScrollListeners = new Set();
63
63
 
64
+ /** @type {Set<FnData>} */
65
+ #onStopListeners = new Set();
66
+
64
67
  /** @type {boolean} */
65
68
  #destroyed = false;
66
69
 
@@ -74,16 +77,20 @@ class TinyAfterScrollWatcher {
74
77
  if (!(scrollTarget instanceof Element) && !(scrollTarget instanceof Window))
75
78
  throw new TypeError('scrollTarget must be an Element or the Window object.');
76
79
  this.#scrollTarget = scrollTarget;
80
+ this._checkTimer = this._checkTimer.bind(this);
77
81
 
78
- this._onScroll = this._onScroll.bind(this);
79
- this._checkQueue = this._checkQueue.bind(this);
80
-
81
- this.#scrollTarget.addEventListener('scroll', this._onScroll);
82
+ this.#scrollTarget.addEventListener('scroll', this._checkTimer);
82
83
  this.#inactivityTime = inactivityTime;
83
-
84
- requestAnimationFrame(this._checkQueue);
85
84
  }
86
85
 
86
+ _checkTimer = () => {
87
+ if (this.#lastScrollTime) clearTimeout(this.#lastScrollTime);
88
+ this.#lastScrollTime = setTimeout(() => {
89
+ this.#lastScrollTime = null;
90
+ this.#checkQueue();
91
+ }, this.#inactivityTime);
92
+ };
93
+
87
94
  /**
88
95
  * Gets the current inactivity time in milliseconds.
89
96
  * @returns {number}
@@ -104,29 +111,21 @@ class TinyAfterScrollWatcher {
104
111
  this.#inactivityTime = value;
105
112
  }
106
113
 
107
- /**
108
- * Internal handler for scroll events.
109
- * Updates the last scroll timestamp.
110
- * @private
111
- */
112
- _onScroll() {
113
- this.lastScrollTime = Date.now();
114
- }
115
-
116
114
  /**
117
115
  * Continuously checks whether the user has stopped scrolling,
118
116
  * and if so, runs all queued functions.
119
- * @private
120
117
  */
121
- _checkQueue() {
118
+ #checkQueue() {
122
119
  if (this.#destroyed) return;
123
- requestAnimationFrame(this._checkQueue);
120
+ // Runs all onStop first listeners
121
+ for (const fn of this.#onStopListeners) {
122
+ if (typeof fn === 'function') fn();
123
+ }
124
124
 
125
- if (Date.now() - this.lastScrollTime > this.#inactivityTime) {
126
- while (this.#afterScrollQueue.length) {
127
- const fn = this.#afterScrollQueue.pop();
128
- if (typeof fn === 'function') fn();
129
- }
125
+ // Then execute the queue afterScrollQueue
126
+ while (this.#afterScrollQueue.length) {
127
+ const fn = this.#afterScrollQueue.pop();
128
+ if (typeof fn === 'function') fn();
130
129
  }
131
130
  }
132
131
 
@@ -143,6 +142,29 @@ class TinyAfterScrollWatcher {
143
142
  this.#afterScrollQueue.push(fn);
144
143
  }
145
144
 
145
+ /**
146
+ * Registers a function to run once after scrolling has stopped,
147
+ * before any afterScrollQueue functions.
148
+ *
149
+ * @param {FnData} fn - A function to execute after scroll stop.
150
+ * @throws {TypeError} If the argument is not a function.
151
+ */
152
+ onStop(fn) {
153
+ if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
154
+ this.#onStopListeners.add(fn);
155
+ }
156
+
157
+ /**
158
+ * Removes a previously registered onStop function.
159
+ *
160
+ * @param {FnData} fn - The function to remove.
161
+ * @throws {TypeError} If the argument is not a function.
162
+ */
163
+ offStop(fn) {
164
+ if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
165
+ this.#onStopListeners.delete(fn);
166
+ }
167
+
146
168
  /**
147
169
  * Registers an external scroll listener on the tracked element.
148
170
  *
@@ -176,11 +198,12 @@ class TinyAfterScrollWatcher {
176
198
  if (this.#destroyed) return;
177
199
  this.#destroyed = true;
178
200
 
179
- this.#scrollTarget.removeEventListener('scroll', this._onScroll);
201
+ this.#scrollTarget.removeEventListener('scroll', this._checkTimer);
180
202
  for (const fn of this.#externalScrollListeners)
181
203
  this.#scrollTarget.removeEventListener('scroll', fn);
182
204
 
183
205
  this.#externalScrollListeners.clear();
206
+ this.#onStopListeners.clear();
184
207
  }
185
208
  }
186
209
 
@@ -1 +1 @@
1
- (()=>{"use strict";var e={d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{TinyAfterScrollWatcher:()=>r});const r=class{#e;lastScrollTime=0;#t=[];#r=100;#i=new Set;#o=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#e=e,this._onScroll=this._onScroll.bind(this),this._checkQueue=this._checkQueue.bind(this),this.#e.addEventListener("scroll",this._onScroll),this.#r=t,requestAnimationFrame(this._checkQueue)}get inactivityTime(){return this.#r}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#r=e}_onScroll(){this.lastScrollTime=Date.now()}_checkQueue(){if(!this.#o&&(requestAnimationFrame(this._checkQueue),Date.now()-this.lastScrollTime>this.#r))for(;this.#t.length;){const e=this.#t.pop();"function"==typeof e&&e()}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#t.push(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#e.addEventListener("scroll",e),this.#i.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#i.has(e)&&(this.#e.removeEventListener("scroll",e),this.#i.delete(e))}destroy(){if(!this.#o){this.#o=!0,this.#e.removeEventListener("scroll",this._onScroll);for(const e of this.#i)this.#e.removeEventListener("scroll",e);this.#i.clear()}}};window.TinyAfterScrollWatcher=t.TinyAfterScrollWatcher})();
1
+ (()=>{"use strict";var e={d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{TinyAfterScrollWatcher:()=>r});const r=class{#e;#t=null;#r=[];#i=100;#o=new Set;#n=new Set;#s=!1;constructor(e=window,t=100){if(!(e instanceof Element||e instanceof Window))throw new TypeError("scrollTarget must be an Element or the Window object.");this.#e=e,this._checkTimer=this._checkTimer.bind(this),this.#e.addEventListener("scroll",this._checkTimer),this.#i=t}_checkTimer=()=>{this.#t&&clearTimeout(this.#t),this.#t=setTimeout((()=>{this.#t=null,this.#l()}),this.#i)};get inactivityTime(){return this.#i}set inactivityTime(e){if("number"!=typeof e||e<=0||!Number.isFinite(e))throw new Error("inactivityTime must be a positive number in milliseconds.");this.#i=e}#l(){if(!this.#s){for(const e of this.#n)"function"==typeof e&&e();for(;this.#r.length;){const e=this.#r.pop();"function"==typeof e&&e()}}}doAfterScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.lastScrollTime=Date.now(),this.#r.push(e)}onStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#n.add(e)}offStop(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#n.delete(e)}onScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#e.addEventListener("scroll",e),this.#o.add(e)}offScroll(e){if("function"!=typeof e)throw new TypeError("Argument must be a function.");this.#o.has(e)&&(this.#e.removeEventListener("scroll",e),this.#o.delete(e))}destroy(){if(!this.#s){this.#s=!0,this.#e.removeEventListener("scroll",this._checkTimer);for(const e of this.#o)this.#e.removeEventListener("scroll",e);this.#o.clear(),this.#n.clear()}}};window.TinyAfterScrollWatcher=t.TinyAfterScrollWatcher})();