@kikiutils/shared 11.0.0 → 13.0.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 (211) hide show
  1. package/README.md +10 -1
  2. package/dist/buffer.d.ts +7 -3
  3. package/dist/buffer.d.ts.map +1 -1
  4. package/dist/buffer.js +42 -0
  5. package/dist/buffer.js.map +1 -0
  6. package/dist/clipboard.d.ts +8 -6
  7. package/dist/clipboard.d.ts.map +1 -1
  8. package/dist/clipboard.js +86 -0
  9. package/dist/clipboard.js.map +1 -0
  10. package/dist/consola.d.ts +8 -2
  11. package/dist/consola.d.ts.map +1 -1
  12. package/dist/consola.js +32 -0
  13. package/dist/consola.js.map +1 -0
  14. package/dist/crypto-hash.d.ts +16 -26
  15. package/dist/crypto-hash.d.ts.map +1 -1
  16. package/dist/crypto-hash.js +37 -0
  17. package/dist/crypto-hash.js.map +1 -0
  18. package/dist/datetime.d.ts +13 -9
  19. package/dist/datetime.d.ts.map +1 -1
  20. package/dist/datetime.js +131 -0
  21. package/dist/datetime.js.map +1 -0
  22. package/dist/element-plus.d.ts +8 -4
  23. package/dist/element-plus.d.ts.map +1 -1
  24. package/dist/element-plus.js +37 -0
  25. package/dist/element-plus.js.map +1 -0
  26. package/dist/enum.d.ts +6 -3
  27. package/dist/enum.d.ts.map +1 -1
  28. package/dist/enum.js +108 -0
  29. package/dist/enum.js.map +1 -0
  30. package/dist/env.d.ts +12 -9
  31. package/dist/env.d.ts.map +1 -1
  32. package/dist/env.js +51 -0
  33. package/dist/env.js.map +1 -0
  34. package/dist/general.d.ts +5 -2
  35. package/dist/general.d.ts.map +1 -1
  36. package/dist/general.js +8 -0
  37. package/dist/general.js.map +1 -0
  38. package/dist/hash.d.ts +7 -4
  39. package/dist/hash.d.ts.map +1 -1
  40. package/dist/hash.js +20 -0
  41. package/dist/hash.js.map +1 -0
  42. package/dist/math.d.ts +20 -17
  43. package/dist/math.d.ts.map +1 -1
  44. package/dist/math.js +36 -0
  45. package/dist/math.js.map +1 -0
  46. package/dist/number.d.ts +7 -2
  47. package/dist/number.d.ts.map +1 -1
  48. package/dist/number.js +32 -0
  49. package/dist/number.js.map +1 -0
  50. package/dist/object.d.ts +4 -1
  51. package/dist/object.d.ts.map +1 -1
  52. package/dist/object.js +42 -0
  53. package/dist/object.js.map +1 -0
  54. package/dist/pino.d.ts +8 -2
  55. package/dist/pino.d.ts.map +1 -1
  56. package/dist/pino.js +40 -0
  57. package/dist/pino.js.map +1 -0
  58. package/dist/random.d.ts +4 -1
  59. package/dist/random.d.ts.map +1 -1
  60. package/dist/random.js +31 -0
  61. package/dist/random.js.map +1 -0
  62. package/dist/storage/enhanced/local/core.d.ts +45 -42
  63. package/dist/storage/enhanced/local/core.d.ts.map +1 -1
  64. package/dist/storage/enhanced/local/core.js +63 -0
  65. package/dist/storage/enhanced/local/core.js.map +1 -0
  66. package/dist/storage/enhanced/local/index.d.ts +3 -3
  67. package/dist/storage/enhanced/local/index.js +4 -0
  68. package/dist/storage/enhanced/local/keyed-store.d.ts +14 -11
  69. package/dist/storage/enhanced/local/keyed-store.d.ts.map +1 -1
  70. package/dist/storage/enhanced/local/keyed-store.js +36 -0
  71. package/dist/storage/enhanced/local/keyed-store.js.map +1 -0
  72. package/dist/storage/enhanced/redis/core.d.ts +64 -59
  73. package/dist/storage/enhanced/redis/core.d.ts.map +1 -1
  74. package/dist/storage/enhanced/redis/core.js +85 -0
  75. package/dist/storage/enhanced/redis/core.js.map +1 -0
  76. package/dist/storage/enhanced/redis/index.d.ts +3 -3
  77. package/dist/storage/enhanced/redis/index.js +4 -0
  78. package/dist/storage/enhanced/redis/keyed-store.d.ts +19 -14
  79. package/dist/storage/enhanced/redis/keyed-store.d.ts.map +1 -1
  80. package/dist/storage/enhanced/redis/keyed-store.js +41 -0
  81. package/dist/storage/enhanced/redis/keyed-store.js.map +1 -0
  82. package/dist/storage/lru/keyed-store.d.ts +21 -16
  83. package/dist/storage/lru/keyed-store.d.ts.map +1 -1
  84. package/dist/storage/lru/keyed-store.js +40 -0
  85. package/dist/storage/lru/keyed-store.js.map +1 -0
  86. package/dist/string.d.ts +5 -2
  87. package/dist/string.d.ts.map +1 -1
  88. package/dist/string.js +42 -0
  89. package/dist/string.js.map +1 -0
  90. package/dist/url.d.ts +4 -1
  91. package/dist/url.d.ts.map +1 -1
  92. package/dist/url.js +21 -0
  93. package/dist/url.js.map +1 -0
  94. package/dist/vue.d.ts +10 -5
  95. package/dist/vue.d.ts.map +1 -1
  96. package/dist/vue.js +58 -0
  97. package/dist/vue.js.map +1 -0
  98. package/dist/web.d.ts +5 -2
  99. package/dist/web.d.ts.map +1 -1
  100. package/dist/web.js +32 -0
  101. package/dist/web.js.map +1 -0
  102. package/package.json +108 -32
  103. package/src/hash.ts +19 -5
  104. package/src/vue.ts +1 -1
  105. package/src/web.ts +1 -1
  106. package/dist/buffer.cjs +0 -43
  107. package/dist/buffer.cjs.map +0 -1
  108. package/dist/buffer.mjs +0 -41
  109. package/dist/buffer.mjs.map +0 -1
  110. package/dist/clipboard.cjs +0 -91
  111. package/dist/clipboard.cjs.map +0 -1
  112. package/dist/clipboard.mjs +0 -88
  113. package/dist/clipboard.mjs.map +0 -1
  114. package/dist/consola.cjs +0 -35
  115. package/dist/consola.cjs.map +0 -1
  116. package/dist/consola.mjs +0 -32
  117. package/dist/consola.mjs.map +0 -1
  118. package/dist/crypto-hash.cjs +0 -61
  119. package/dist/crypto-hash.cjs.map +0 -1
  120. package/dist/crypto-hash.mjs +0 -50
  121. package/dist/crypto-hash.mjs.map +0 -1
  122. package/dist/datetime.cjs +0 -134
  123. package/dist/datetime.cjs.map +0 -1
  124. package/dist/datetime.mjs +0 -130
  125. package/dist/datetime.mjs.map +0 -1
  126. package/dist/element-plus.cjs +0 -37
  127. package/dist/element-plus.cjs.map +0 -1
  128. package/dist/element-plus.mjs +0 -35
  129. package/dist/element-plus.mjs.map +0 -1
  130. package/dist/enum.cjs +0 -112
  131. package/dist/enum.cjs.map +0 -1
  132. package/dist/enum.mjs +0 -108
  133. package/dist/enum.mjs.map +0 -1
  134. package/dist/env.cjs +0 -53
  135. package/dist/env.cjs.map +0 -1
  136. package/dist/env.mjs +0 -50
  137. package/dist/env.mjs.map +0 -1
  138. package/dist/general.cjs +0 -10
  139. package/dist/general.cjs.map +0 -1
  140. package/dist/general.mjs +0 -8
  141. package/dist/general.mjs.map +0 -1
  142. package/dist/hash.cjs +0 -28
  143. package/dist/hash.cjs.map +0 -1
  144. package/dist/hash.mjs +0 -23
  145. package/dist/hash.mjs.map +0 -1
  146. package/dist/math.cjs +0 -38
  147. package/dist/math.cjs.map +0 -1
  148. package/dist/math.mjs +0 -36
  149. package/dist/math.mjs.map +0 -1
  150. package/dist/number.cjs +0 -32
  151. package/dist/number.cjs.map +0 -1
  152. package/dist/number.mjs +0 -30
  153. package/dist/number.mjs.map +0 -1
  154. package/dist/object.cjs +0 -55
  155. package/dist/object.cjs.map +0 -1
  156. package/dist/object.mjs +0 -53
  157. package/dist/object.mjs.map +0 -1
  158. package/dist/pino.cjs +0 -42
  159. package/dist/pino.cjs.map +0 -1
  160. package/dist/pino.mjs +0 -39
  161. package/dist/pino.mjs.map +0 -1
  162. package/dist/random.cjs +0 -31
  163. package/dist/random.cjs.map +0 -1
  164. package/dist/random.mjs +0 -29
  165. package/dist/random.mjs.map +0 -1
  166. package/dist/storage/enhanced/local/core.cjs +0 -105
  167. package/dist/storage/enhanced/local/core.cjs.map +0 -1
  168. package/dist/storage/enhanced/local/core.mjs +0 -103
  169. package/dist/storage/enhanced/local/core.mjs.map +0 -1
  170. package/dist/storage/enhanced/local/index.cjs +0 -10
  171. package/dist/storage/enhanced/local/index.cjs.map +0 -1
  172. package/dist/storage/enhanced/local/index.d.ts.map +0 -1
  173. package/dist/storage/enhanced/local/index.mjs +0 -3
  174. package/dist/storage/enhanced/local/index.mjs.map +0 -1
  175. package/dist/storage/enhanced/local/keyed-store.cjs +0 -41
  176. package/dist/storage/enhanced/local/keyed-store.cjs.map +0 -1
  177. package/dist/storage/enhanced/local/keyed-store.mjs +0 -39
  178. package/dist/storage/enhanced/local/keyed-store.mjs.map +0 -1
  179. package/dist/storage/enhanced/redis/core.cjs +0 -144
  180. package/dist/storage/enhanced/redis/core.cjs.map +0 -1
  181. package/dist/storage/enhanced/redis/core.mjs +0 -142
  182. package/dist/storage/enhanced/redis/core.mjs.map +0 -1
  183. package/dist/storage/enhanced/redis/index.cjs +0 -10
  184. package/dist/storage/enhanced/redis/index.cjs.map +0 -1
  185. package/dist/storage/enhanced/redis/index.d.ts.map +0 -1
  186. package/dist/storage/enhanced/redis/index.mjs +0 -3
  187. package/dist/storage/enhanced/redis/index.mjs.map +0 -1
  188. package/dist/storage/enhanced/redis/keyed-store.cjs +0 -46
  189. package/dist/storage/enhanced/redis/keyed-store.cjs.map +0 -1
  190. package/dist/storage/enhanced/redis/keyed-store.mjs +0 -44
  191. package/dist/storage/enhanced/redis/keyed-store.mjs.map +0 -1
  192. package/dist/storage/lru/keyed-store.cjs +0 -49
  193. package/dist/storage/lru/keyed-store.cjs.map +0 -1
  194. package/dist/storage/lru/keyed-store.mjs +0 -47
  195. package/dist/storage/lru/keyed-store.mjs.map +0 -1
  196. package/dist/string.cjs +0 -45
  197. package/dist/string.cjs.map +0 -1
  198. package/dist/string.mjs +0 -43
  199. package/dist/string.mjs.map +0 -1
  200. package/dist/url.cjs +0 -21
  201. package/dist/url.cjs.map +0 -1
  202. package/dist/url.mjs +0 -19
  203. package/dist/url.mjs.map +0 -1
  204. package/dist/vue.cjs +0 -64
  205. package/dist/vue.cjs.map +0 -1
  206. package/dist/vue.mjs +0 -59
  207. package/dist/vue.mjs.map +0 -1
  208. package/dist/web.cjs +0 -35
  209. package/dist/web.cjs.map +0 -1
  210. package/dist/web.mjs +0 -32
  211. package/dist/web.mjs.map +0 -1
package/dist/string.mjs DELETED
@@ -1,43 +0,0 @@
1
- const DIGITS = '0123456789';
2
- const LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';
3
- const UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
4
- const CHARSETS = {
5
- 'alphabetic': LOWERCASE + UPPERCASE,
6
- 'alphanumeric': DIGITS + LOWERCASE + UPPERCASE,
7
- 'lowercase': LOWERCASE,
8
- 'lowercase-numeric': DIGITS + LOWERCASE,
9
- 'numeric': DIGITS,
10
- 'uppercase': UPPERCASE,
11
- 'uppercase-numeric': DIGITS + UPPERCASE,
12
- };
13
- /**
14
- * Generates a random string of a given length using a specified character set.
15
- *
16
- * @param {number} length - The length of the string to generate. Must be a positive integer
17
- * @param {RandomStringMode} [mode] - The character set to use
18
- *
19
- * @returns {string} The generated random string
20
- *
21
- * @throws {Error} If the length is not a positive integer or the mode is unsupported
22
- *
23
- * @example
24
- * ```typescript
25
- * import { randomString } from '@kikiutils/shared/string';
26
- *
27
- * console.log(randomString(8)); // e.g. 'aZbXwTyQ' (alphabetic)
28
- * console.log(randomString(6, 'numeric')); // e.g. '402398'
29
- * console.log(randomString(10, 'alphanumeric')); // e.g. 'a9Z4pQ8xY2'
30
- * ```
31
- */
32
- function randomString(length, mode = 'alphabetic') {
33
- if (!Number.isInteger(length) || length <= 0) {
34
- throw new Error(`Invalid length: ${length}. Must be a positive integer`);
35
- }
36
- const charset = CHARSETS[mode];
37
- if (!charset)
38
- throw new Error(`Unsupported mode: ${mode}`);
39
- return Array.from({ length }, () => charset[Math.floor(Math.random() * charset.length)]).join('');
40
- }
41
-
42
- export { randomString };
43
- //# sourceMappingURL=string.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.mjs","sources":["../src/string.ts"],"sourcesContent":["export type RandomStringMode =\n | 'alphabetic'\n | 'alphanumeric'\n | 'lowercase'\n | 'lowercase-numeric'\n | 'numeric'\n | 'uppercase'\n | 'uppercase-numeric';\n\nconst DIGITS = '0123456789';\nconst LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';\nconst UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst CHARSETS: Record<RandomStringMode, string> = {\n 'alphabetic': LOWERCASE + UPPERCASE,\n 'alphanumeric': DIGITS + LOWERCASE + UPPERCASE,\n 'lowercase': LOWERCASE,\n 'lowercase-numeric': DIGITS + LOWERCASE,\n 'numeric': DIGITS,\n 'uppercase': UPPERCASE,\n 'uppercase-numeric': DIGITS + UPPERCASE,\n};\n\n/**\n * Generates a random string of a given length using a specified character set.\n *\n * @param {number} length - The length of the string to generate. Must be a positive integer\n * @param {RandomStringMode} [mode] - The character set to use\n *\n * @returns {string} The generated random string\n *\n * @throws {Error} If the length is not a positive integer or the mode is unsupported\n *\n * @example\n * ```typescript\n * import { randomString } from '@kikiutils/shared/string';\n *\n * console.log(randomString(8)); // e.g. 'aZbXwTyQ' (alphabetic)\n * console.log(randomString(6, 'numeric')); // e.g. '402398'\n * console.log(randomString(10, 'alphanumeric')); // e.g. 'a9Z4pQ8xY2'\n * ```\n */\nexport function randomString(length: number, mode: RandomStringMode = 'alphabetic') {\n if (!Number.isInteger(length) || length <= 0) {\n throw new Error(`Invalid length: ${length}. Must be a positive integer`);\n }\n\n const charset = CHARSETS[mode];\n if (!charset) throw new Error(`Unsupported mode: ${mode}`);\n return Array.from({ length }, () => charset[Math.floor(Math.random() * charset.length)]).join('');\n}\n"],"names":[],"mappings":"AASA,MAAM,MAAM,GAAG,YAAY;AAC3B,MAAM,SAAS,GAAG,4BAA4B;AAC9C,MAAM,SAAS,GAAG,4BAA4B;AAC9C,MAAM,QAAQ,GAAqC;IAC/C,YAAY,EAAE,SAAS,GAAG,SAAS;AACnC,IAAA,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;AAC9C,IAAA,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,MAAM,GAAG,SAAS;AACvC,IAAA,SAAS,EAAE,MAAM;AACjB,IAAA,WAAW,EAAE,SAAS;IACtB,mBAAmB,EAAE,MAAM,GAAG,SAAS;CAC1C;AAED;;;;;;;;;;;;;;;;;;AAkBG;SACa,YAAY,CAAC,MAAc,EAAE,OAAyB,YAAY,EAAA;AAC9E,IAAA,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE;AAC1C,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,CAAA,4BAAA,CAA8B,CAAC;IAC5E;AAEA,IAAA,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC9B,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAA,CAAE,CAAC;AAC1D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACrG;;;;"}
package/dist/url.cjs DELETED
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Appends or updates the `redirect` query parameter on a given URL.
5
- *
6
- * Typically used to preserve the user's current path for post-login navigation.
7
- *
8
- * @param {string} url - The target URL to modify
9
- * @param {string} redirectPath - The path to use as the redirect destination
10
- *
11
- * @returns {string} A new URL string with the `redirect` query parameter
12
- */
13
- function appendRedirectParamToUrl(url, redirectPath) {
14
- const [base, rawQuery = ''] = url.split('?');
15
- const searchParams = new URLSearchParams(rawQuery);
16
- searchParams.set('redirect', redirectPath);
17
- return `${base}?${searchParams.toString()}`;
18
- }
19
-
20
- exports.appendRedirectParamToUrl = appendRedirectParamToUrl;
21
- //# sourceMappingURL=url.cjs.map
package/dist/url.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.cjs","sources":["../src/url.ts"],"sourcesContent":["/**\n * Appends or updates the `redirect` query parameter on a given URL.\n *\n * Typically used to preserve the user's current path for post-login navigation.\n *\n * @param {string} url - The target URL to modify\n * @param {string} redirectPath - The path to use as the redirect destination\n *\n * @returns {string} A new URL string with the `redirect` query parameter\n */\nexport function appendRedirectParamToUrl(url: string, redirectPath: string) {\n const [base, rawQuery = ''] = url.split('?');\n const searchParams = new URLSearchParams(rawQuery);\n searchParams.set('redirect', redirectPath);\n return `${base}?${searchParams.toString()}`;\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AACG,SAAU,wBAAwB,CAAC,GAAW,EAAE,YAAoB,EAAA;AACtE,IAAA,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;AAC5C,IAAA,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC;AAClD,IAAA,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC;IAC1C,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,YAAY,CAAC,QAAQ,EAAE,EAAE;AAC/C;;;;"}
package/dist/url.mjs DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Appends or updates the `redirect` query parameter on a given URL.
3
- *
4
- * Typically used to preserve the user's current path for post-login navigation.
5
- *
6
- * @param {string} url - The target URL to modify
7
- * @param {string} redirectPath - The path to use as the redirect destination
8
- *
9
- * @returns {string} A new URL string with the `redirect` query parameter
10
- */
11
- function appendRedirectParamToUrl(url, redirectPath) {
12
- const [base, rawQuery = ''] = url.split('?');
13
- const searchParams = new URLSearchParams(rawQuery);
14
- searchParams.set('redirect', redirectPath);
15
- return `${base}?${searchParams.toString()}`;
16
- }
17
-
18
- export { appendRedirectParamToUrl };
19
- //# sourceMappingURL=url.mjs.map
package/dist/url.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.mjs","sources":["../src/url.ts"],"sourcesContent":["/**\n * Appends or updates the `redirect` query parameter on a given URL.\n *\n * Typically used to preserve the user's current path for post-login navigation.\n *\n * @param {string} url - The target URL to modify\n * @param {string} redirectPath - The path to use as the redirect destination\n *\n * @returns {string} A new URL string with the `redirect` query parameter\n */\nexport function appendRedirectParamToUrl(url: string, redirectPath: string) {\n const [base, rawQuery = ''] = url.split('?');\n const searchParams = new URLSearchParams(rawQuery);\n searchParams.set('redirect', redirectPath);\n return `${base}?${searchParams.toString()}`;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AACG,SAAU,wBAAwB,CAAC,GAAW,EAAE,YAAoB,EAAA;AACtE,IAAA,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;AAC5C,IAAA,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC;AAClD,IAAA,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC;IAC1C,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,YAAY,CAAC,QAAQ,EAAE,EAAE;AAC/C;;;;"}
package/dist/vue.cjs DELETED
@@ -1,64 +0,0 @@
1
- 'use strict';
2
-
3
- const vue = require('vue');
4
- const vueRouter = require('vue-router');
5
- const url = require('./url.cjs');
6
-
7
- /**
8
- * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.
9
- *
10
- * @param {string} url - The base URL to modify
11
- *
12
- * @returns {string} A new URL with the current route fullPath as the `redirect` parameter
13
- */
14
- function appendRedirectParamFromCurrentRouteToUrl(url$1) {
15
- return url.appendRedirectParamToUrl(url$1, vueRouter.useRoute().fullPath);
16
- }
17
- /**
18
- * Clears an interval referenced by a Vue ref and sets it to null.
19
- *
20
- * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null
21
- */
22
- function clearIntervalRef(intervalRef) {
23
- if (intervalRef.value)
24
- clearInterval(intervalRef.value);
25
- intervalRef.value = null;
26
- }
27
- /**
28
- * Clears a timeout referenced by a Vue ref and sets it to null.
29
- *
30
- * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null
31
- */
32
- function clearTimeoutRef(timeoutRef) {
33
- if (timeoutRef.value)
34
- clearTimeout(timeoutRef.value);
35
- timeoutRef.value = null;
36
- }
37
- /**
38
- * A Vue composition function that remembers and restores scroll position
39
- * of a scrollable container across route changes and keep-alive activation.
40
- *
41
- * @template T - The type of the scrollable element (defaults to HTMLElement)
42
- *
43
- * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element
44
- */
45
- function usePreserveScroll(containerRef) {
46
- let scrollLeft = 0;
47
- let scrollTop = 0;
48
- vue.onActivated(() => {
49
- if (!containerRef.value)
50
- return;
51
- containerRef.value.scrollLeft = scrollLeft;
52
- containerRef.value.scrollTop = scrollTop;
53
- });
54
- vueRouter.onBeforeRouteLeave(() => {
55
- scrollLeft = containerRef.value?.scrollLeft || 0;
56
- scrollTop = containerRef.value?.scrollTop || 0;
57
- });
58
- }
59
-
60
- exports.appendRedirectParamFromCurrentRouteToUrl = appendRedirectParamFromCurrentRouteToUrl;
61
- exports.clearIntervalRef = clearIntervalRef;
62
- exports.clearTimeoutRef = clearTimeoutRef;
63
- exports.usePreserveScroll = usePreserveScroll;
64
- //# sourceMappingURL=vue.cjs.map
package/dist/vue.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"vue.cjs","sources":["../src/vue.ts"],"sourcesContent":["import { onActivated } from 'vue';\nimport type { Ref } from 'vue';\nimport {\n onBeforeRouteLeave,\n useRoute,\n} from 'vue-router';\n\nimport { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current route fullPath as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentRouteToUrl(url: string) {\n return appendRedirectParamToUrl(url, useRoute().fullPath);\n}\n\n/**\n * Clears an interval referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearIntervalRef(intervalRef: Ref<null | ReturnType<typeof setInterval>>) {\n if (intervalRef.value) clearInterval(intervalRef.value);\n intervalRef.value = null;\n}\n\n/**\n * Clears a timeout referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearTimeoutRef(timeoutRef: Ref<null | ReturnType<typeof setTimeout>>) {\n if (timeoutRef.value) clearTimeout(timeoutRef.value);\n timeoutRef.value = null;\n}\n\n/**\n * A Vue composition function that remembers and restores scroll position\n * of a scrollable container across route changes and keep-alive activation.\n *\n * @template T - The type of the scrollable element (defaults to HTMLElement)\n *\n * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element\n */\nexport function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<null | T>) {\n let scrollLeft = 0;\n let scrollTop = 0;\n onActivated(() => {\n if (!containerRef.value) return;\n containerRef.value.scrollLeft = scrollLeft;\n containerRef.value.scrollTop = scrollTop;\n });\n\n onBeforeRouteLeave(() => {\n scrollLeft = containerRef.value?.scrollLeft || 0;\n scrollTop = containerRef.value?.scrollTop || 0;\n });\n}\n"],"names":["url","appendRedirectParamToUrl","useRoute","onActivated","onBeforeRouteLeave"],"mappings":";;;;;;AASA;;;;;;AAMG;AACG,SAAU,wCAAwC,CAACA,KAAW,EAAA;IAChE,OAAOC,4BAAwB,CAACD,KAAG,EAAEE,kBAAQ,EAAE,CAAC,QAAQ,CAAC;AAC7D;AAEA;;;;AAIG;AACG,SAAU,gBAAgB,CAAC,WAAuD,EAAA;IACpF,IAAI,WAAW,CAAC,KAAK;AAAE,QAAA,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC;AACvD,IAAA,WAAW,CAAC,KAAK,GAAG,IAAI;AAC5B;AAEA;;;;AAIG;AACG,SAAU,eAAe,CAAC,UAAqD,EAAA;IACjF,IAAI,UAAU,CAAC,KAAK;AAAE,QAAA,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC;AACpD,IAAA,UAAU,CAAC,KAAK,GAAG,IAAI;AAC3B;AAEA;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAkC,YAA2B,EAAA;IAC1F,IAAI,UAAU,GAAG,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC;IACjBC,eAAW,CAAC,MAAK;QACb,IAAI,CAAC,YAAY,CAAC,KAAK;YAAE;AACzB,QAAA,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU;AAC1C,QAAA,YAAY,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS;AAC5C,IAAA,CAAC,CAAC;IAEFC,4BAAkB,CAAC,MAAK;QACpB,UAAU,GAAG,YAAY,CAAC,KAAK,EAAE,UAAU,IAAI,CAAC;QAChD,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC;AAClD,IAAA,CAAC,CAAC;AACN;;;;;;;"}
package/dist/vue.mjs DELETED
@@ -1,59 +0,0 @@
1
- import { onActivated } from 'vue';
2
- import { useRoute, onBeforeRouteLeave } from 'vue-router';
3
- import { appendRedirectParamToUrl } from './url.mjs';
4
-
5
- /**
6
- * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.
7
- *
8
- * @param {string} url - The base URL to modify
9
- *
10
- * @returns {string} A new URL with the current route fullPath as the `redirect` parameter
11
- */
12
- function appendRedirectParamFromCurrentRouteToUrl(url) {
13
- return appendRedirectParamToUrl(url, useRoute().fullPath);
14
- }
15
- /**
16
- * Clears an interval referenced by a Vue ref and sets it to null.
17
- *
18
- * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null
19
- */
20
- function clearIntervalRef(intervalRef) {
21
- if (intervalRef.value)
22
- clearInterval(intervalRef.value);
23
- intervalRef.value = null;
24
- }
25
- /**
26
- * Clears a timeout referenced by a Vue ref and sets it to null.
27
- *
28
- * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null
29
- */
30
- function clearTimeoutRef(timeoutRef) {
31
- if (timeoutRef.value)
32
- clearTimeout(timeoutRef.value);
33
- timeoutRef.value = null;
34
- }
35
- /**
36
- * A Vue composition function that remembers and restores scroll position
37
- * of a scrollable container across route changes and keep-alive activation.
38
- *
39
- * @template T - The type of the scrollable element (defaults to HTMLElement)
40
- *
41
- * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element
42
- */
43
- function usePreserveScroll(containerRef) {
44
- let scrollLeft = 0;
45
- let scrollTop = 0;
46
- onActivated(() => {
47
- if (!containerRef.value)
48
- return;
49
- containerRef.value.scrollLeft = scrollLeft;
50
- containerRef.value.scrollTop = scrollTop;
51
- });
52
- onBeforeRouteLeave(() => {
53
- scrollLeft = containerRef.value?.scrollLeft || 0;
54
- scrollTop = containerRef.value?.scrollTop || 0;
55
- });
56
- }
57
-
58
- export { appendRedirectParamFromCurrentRouteToUrl, clearIntervalRef, clearTimeoutRef, usePreserveScroll };
59
- //# sourceMappingURL=vue.mjs.map
package/dist/vue.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"vue.mjs","sources":["../src/vue.ts"],"sourcesContent":["import { onActivated } from 'vue';\nimport type { Ref } from 'vue';\nimport {\n onBeforeRouteLeave,\n useRoute,\n} from 'vue-router';\n\nimport { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current route fullPath as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentRouteToUrl(url: string) {\n return appendRedirectParamToUrl(url, useRoute().fullPath);\n}\n\n/**\n * Clears an interval referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearIntervalRef(intervalRef: Ref<null | ReturnType<typeof setInterval>>) {\n if (intervalRef.value) clearInterval(intervalRef.value);\n intervalRef.value = null;\n}\n\n/**\n * Clears a timeout referenced by a Vue ref and sets it to null.\n *\n * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null\n */\nexport function clearTimeoutRef(timeoutRef: Ref<null | ReturnType<typeof setTimeout>>) {\n if (timeoutRef.value) clearTimeout(timeoutRef.value);\n timeoutRef.value = null;\n}\n\n/**\n * A Vue composition function that remembers and restores scroll position\n * of a scrollable container across route changes and keep-alive activation.\n *\n * @template T - The type of the scrollable element (defaults to HTMLElement)\n *\n * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element\n */\nexport function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<null | T>) {\n let scrollLeft = 0;\n let scrollTop = 0;\n onActivated(() => {\n if (!containerRef.value) return;\n containerRef.value.scrollLeft = scrollLeft;\n containerRef.value.scrollTop = scrollTop;\n });\n\n onBeforeRouteLeave(() => {\n scrollLeft = containerRef.value?.scrollLeft || 0;\n scrollTop = containerRef.value?.scrollTop || 0;\n });\n}\n"],"names":[],"mappings":";;;;AASA;;;;;;AAMG;AACG,SAAU,wCAAwC,CAAC,GAAW,EAAA;IAChE,OAAO,wBAAwB,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC;AAC7D;AAEA;;;;AAIG;AACG,SAAU,gBAAgB,CAAC,WAAuD,EAAA;IACpF,IAAI,WAAW,CAAC,KAAK;AAAE,QAAA,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC;AACvD,IAAA,WAAW,CAAC,KAAK,GAAG,IAAI;AAC5B;AAEA;;;;AAIG;AACG,SAAU,eAAe,CAAC,UAAqD,EAAA;IACjF,IAAI,UAAU,CAAC,KAAK;AAAE,QAAA,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC;AACpD,IAAA,UAAU,CAAC,KAAK,GAAG,IAAI;AAC3B;AAEA;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAkC,YAA2B,EAAA;IAC1F,IAAI,UAAU,GAAG,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC;IACjB,WAAW,CAAC,MAAK;QACb,IAAI,CAAC,YAAY,CAAC,KAAK;YAAE;AACzB,QAAA,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU;AAC1C,QAAA,YAAY,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS;AAC5C,IAAA,CAAC,CAAC;IAEF,kBAAkB,CAAC,MAAK;QACpB,UAAU,GAAG,YAAY,CAAC,KAAK,EAAE,UAAU,IAAI,CAAC;QAChD,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC;AAClD,IAAA,CAAC,CAAC;AACN;;;;"}
package/dist/web.cjs DELETED
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- const url = require('./url.cjs');
4
-
5
- /**
6
- * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
7
- *
8
- * @param {string} url - The base URL to modify
9
- *
10
- * @returns {string} A new URL with the current location as the `redirect` parameter
11
- */
12
- function appendRedirectParamFromCurrentLocationToUrl(url$1) {
13
- const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
14
- return url.appendRedirectParamToUrl(url$1, currentPath);
15
- }
16
- /**
17
- * Navigates to the given URL, appending the current browser location
18
- * (path, query, and hash) as the `redirect` query parameter.
19
- *
20
- * Useful for redirecting to login or other gateways while preserving
21
- * the current location for post-auth navigation.
22
- *
23
- * @param {string} url - The destination URL to navigate to
24
- * @param {number} [delayMs] - Optional delay in milliseconds before navigation
25
- */
26
- function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
27
- if (delayMs === undefined)
28
- window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));
29
- else
30
- return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);
31
- }
32
-
33
- exports.appendRedirectParamFromCurrentLocationToUrl = appendRedirectParamFromCurrentLocationToUrl;
34
- exports.assignUrlWithRedirectParamFromCurrentLocation = assignUrlWithRedirectParamFromCurrentLocation;
35
- //# sourceMappingURL=web.cjs.map
package/dist/web.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"web.cjs","sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"names":["url","appendRedirectParamToUrl"],"mappings":";;;;AAEA;;;;;;AAMG;AACG,SAAU,2CAA2C,CAACA,KAAW,EAAA;IACnE,MAAM,WAAW,GAAG,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAOC,4BAAwB,CAACD,KAAG,EAAE,WAAW,CAAC;AACrD;AAEA;;;;;;;;;AASG;AACG,SAAU,6CAA6C,CAAC,GAAW,EAAE,OAAgB,EAAA;IACvF,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,2CAA2C,CAAC,GAAG,CAAC,CAAC;;AAC9F,QAAA,OAAO,UAAU,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,2CAA2C,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;AACnH;;;;;"}
package/dist/web.mjs DELETED
@@ -1,32 +0,0 @@
1
- import { appendRedirectParamToUrl } from './url.mjs';
2
-
3
- /**
4
- * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
5
- *
6
- * @param {string} url - The base URL to modify
7
- *
8
- * @returns {string} A new URL with the current location as the `redirect` parameter
9
- */
10
- function appendRedirectParamFromCurrentLocationToUrl(url) {
11
- const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
12
- return appendRedirectParamToUrl(url, currentPath);
13
- }
14
- /**
15
- * Navigates to the given URL, appending the current browser location
16
- * (path, query, and hash) as the `redirect` query parameter.
17
- *
18
- * Useful for redirecting to login or other gateways while preserving
19
- * the current location for post-auth navigation.
20
- *
21
- * @param {string} url - The destination URL to navigate to
22
- * @param {number} [delayMs] - Optional delay in milliseconds before navigation
23
- */
24
- function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
25
- if (delayMs === undefined)
26
- window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));
27
- else
28
- return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);
29
- }
30
-
31
- export { appendRedirectParamFromCurrentLocationToUrl, assignUrlWithRedirectParamFromCurrentLocation };
32
- //# sourceMappingURL=web.mjs.map
package/dist/web.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"web.mjs","sources":["../src/web.ts"],"sourcesContent":["import { appendRedirectParamToUrl } from './url';\n\n/**\n * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.\n *\n * @param {string} url - The base URL to modify\n *\n * @returns {string} A new URL with the current location as the `redirect` parameter\n */\nexport function appendRedirectParamFromCurrentLocationToUrl(url: string) {\n const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;\n return appendRedirectParamToUrl(url, currentPath);\n}\n\n/**\n * Navigates to the given URL, appending the current browser location\n * (path, query, and hash) as the `redirect` query parameter.\n *\n * Useful for redirecting to login or other gateways while preserving\n * the current location for post-auth navigation.\n *\n * @param {string} url - The destination URL to navigate to\n * @param {number} [delayMs] - Optional delay in milliseconds before navigation\n */\nexport function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {\n if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));\n else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);\n}\n"],"names":[],"mappings":";;AAEA;;;;;;AAMG;AACG,SAAU,2CAA2C,CAAC,GAAW,EAAA;IACnE,MAAM,WAAW,GAAG,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA,EAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAO,wBAAwB,CAAC,GAAG,EAAE,WAAW,CAAC;AACrD;AAEA;;;;;;;;;AASG;AACG,SAAU,6CAA6C,CAAC,GAAW,EAAE,OAAgB,EAAA;IACvF,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,2CAA2C,CAAC,GAAG,CAAC,CAAC;;AAC9F,QAAA,OAAO,UAAU,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,2CAA2C,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;AACnH;;;;"}