@kikiutils/shared 10.2.1 → 10.4.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 (121) hide show
  1. package/dist/buffer.cjs +43 -0
  2. package/dist/buffer.cjs.map +1 -0
  3. package/dist/buffer.d.ts +34 -0
  4. package/dist/buffer.d.ts.map +1 -0
  5. package/dist/buffer.mjs +41 -0
  6. package/dist/buffer.mjs.map +1 -0
  7. package/dist/clipboard.cjs +4 -4
  8. package/dist/clipboard.cjs.map +1 -1
  9. package/dist/clipboard.d.ts +3 -3
  10. package/dist/clipboard.mjs +4 -4
  11. package/dist/clipboard.mjs.map +1 -1
  12. package/dist/datetime.cjs +13 -13
  13. package/dist/datetime.cjs.map +1 -1
  14. package/dist/datetime.d.ts +12 -12
  15. package/dist/datetime.mjs +13 -13
  16. package/dist/datetime.mjs.map +1 -1
  17. package/dist/element-plus.cjs +6 -6
  18. package/dist/element-plus.cjs.map +1 -1
  19. package/dist/element-plus.d.ts +6 -6
  20. package/dist/element-plus.mjs +6 -6
  21. package/dist/element-plus.mjs.map +1 -1
  22. package/dist/enum.cjs +70 -25
  23. package/dist/enum.cjs.map +1 -1
  24. package/dist/enum.d.ts +61 -10
  25. package/dist/enum.d.ts.map +1 -1
  26. package/dist/enum.mjs +70 -26
  27. package/dist/enum.mjs.map +1 -1
  28. package/dist/env.cjs +4 -4
  29. package/dist/env.cjs.map +1 -1
  30. package/dist/env.d.ts +4 -4
  31. package/dist/env.mjs +4 -4
  32. package/dist/env.mjs.map +1 -1
  33. package/dist/general.cjs.map +1 -1
  34. package/dist/general.d.ts +5 -5
  35. package/dist/general.mjs.map +1 -1
  36. package/dist/math.cjs +4 -4
  37. package/dist/math.cjs.map +1 -1
  38. package/dist/math.d.ts +4 -4
  39. package/dist/math.mjs +4 -4
  40. package/dist/math.mjs.map +1 -1
  41. package/dist/number.cjs +3 -3
  42. package/dist/number.cjs.map +1 -1
  43. package/dist/number.d.ts +3 -3
  44. package/dist/number.mjs +3 -3
  45. package/dist/number.mjs.map +1 -1
  46. package/dist/object.cjs +4 -4
  47. package/dist/object.cjs.map +1 -1
  48. package/dist/object.d.ts +4 -4
  49. package/dist/object.mjs +4 -4
  50. package/dist/object.mjs.map +1 -1
  51. package/dist/random.cjs +7 -7
  52. package/dist/random.cjs.map +1 -1
  53. package/dist/random.d.ts +7 -7
  54. package/dist/random.mjs +7 -7
  55. package/dist/random.mjs.map +1 -1
  56. package/dist/storage/enhanced/local/core.cjs +11 -11
  57. package/dist/storage/enhanced/local/core.cjs.map +1 -1
  58. package/dist/storage/enhanced/local/core.d.ts +9 -9
  59. package/dist/storage/enhanced/local/core.mjs +11 -11
  60. package/dist/storage/enhanced/local/core.mjs.map +1 -1
  61. package/dist/storage/enhanced/local/keyed-store.cjs +3 -3
  62. package/dist/storage/enhanced/local/keyed-store.cjs.map +1 -1
  63. package/dist/storage/enhanced/local/keyed-store.d.ts +3 -3
  64. package/dist/storage/enhanced/local/keyed-store.mjs +3 -3
  65. package/dist/storage/enhanced/local/keyed-store.mjs.map +1 -1
  66. package/dist/storage/enhanced/redis/core.cjs +18 -18
  67. package/dist/storage/enhanced/redis/core.cjs.map +1 -1
  68. package/dist/storage/enhanced/redis/core.d.ts +16 -16
  69. package/dist/storage/enhanced/redis/core.mjs +18 -18
  70. package/dist/storage/enhanced/redis/core.mjs.map +1 -1
  71. package/dist/storage/enhanced/redis/keyed-store.cjs +4 -4
  72. package/dist/storage/enhanced/redis/keyed-store.cjs.map +1 -1
  73. package/dist/storage/enhanced/redis/keyed-store.d.ts +4 -4
  74. package/dist/storage/enhanced/redis/keyed-store.mjs +4 -4
  75. package/dist/storage/enhanced/redis/keyed-store.mjs.map +1 -1
  76. package/dist/storage/lru/keyed-store.cjs +3 -3
  77. package/dist/storage/lru/keyed-store.cjs.map +1 -1
  78. package/dist/storage/lru/keyed-store.d.ts +3 -3
  79. package/dist/storage/lru/keyed-store.mjs +3 -3
  80. package/dist/storage/lru/keyed-store.mjs.map +1 -1
  81. package/dist/string.cjs +5 -5
  82. package/dist/string.cjs.map +1 -1
  83. package/dist/string.d.ts +4 -4
  84. package/dist/string.mjs +5 -5
  85. package/dist/string.mjs.map +1 -1
  86. package/dist/url.cjs +3 -3
  87. package/dist/url.cjs.map +1 -1
  88. package/dist/url.d.ts +3 -3
  89. package/dist/url.mjs +3 -3
  90. package/dist/url.mjs.map +1 -1
  91. package/dist/vue.cjs +6 -6
  92. package/dist/vue.cjs.map +1 -1
  93. package/dist/vue.d.ts +6 -6
  94. package/dist/vue.mjs +6 -6
  95. package/dist/vue.mjs.map +1 -1
  96. package/dist/web.cjs +4 -4
  97. package/dist/web.cjs.map +1 -1
  98. package/dist/web.d.ts +4 -4
  99. package/dist/web.mjs +4 -4
  100. package/dist/web.mjs.map +1 -1
  101. package/package.json +9 -5
  102. package/src/buffer.ts +37 -0
  103. package/src/clipboard.ts +4 -4
  104. package/src/datetime.ts +13 -13
  105. package/src/element-plus.ts +6 -6
  106. package/src/enum.ts +68 -24
  107. package/src/env.ts +4 -4
  108. package/src/general.ts +5 -5
  109. package/src/math.ts +4 -4
  110. package/src/number.ts +3 -3
  111. package/src/object.ts +4 -4
  112. package/src/random.ts +7 -7
  113. package/src/storage/enhanced/local/core.ts +11 -11
  114. package/src/storage/enhanced/local/keyed-store.ts +3 -3
  115. package/src/storage/enhanced/redis/core.ts +18 -18
  116. package/src/storage/enhanced/redis/keyed-store.ts +4 -4
  117. package/src/storage/lru/keyed-store.ts +3 -3
  118. package/src/string.ts +5 -5
  119. package/src/url.ts +3 -3
  120. package/src/vue.ts +6 -6
  121. package/src/web.ts +4 -4
package/dist/string.d.ts CHANGED
@@ -2,12 +2,12 @@ export type RandomStringMode = 'alphabetic' | 'alphanumeric' | 'lowercase' | 'lo
2
2
  /**
3
3
  * Generates a random string of a given length using a specified character set.
4
4
  *
5
- * @param {number} length - The length of the string to generate. Must be a positive integer.
6
- * @param {RandomStringMode} [mode] - The character set to use.
5
+ * @param {number} length - The length of the string to generate. Must be a positive integer
6
+ * @param {RandomStringMode} [mode] - The character set to use
7
7
  *
8
- * @returns {string} The generated random string.
8
+ * @returns {string} The generated random string
9
9
  *
10
- * @throws {Error} If the length is not a positive integer or the mode is unsupported.
10
+ * @throws {Error} If the length is not a positive integer or the mode is unsupported
11
11
  *
12
12
  * @example
13
13
  * ```typescript
package/dist/string.mjs CHANGED
@@ -13,12 +13,12 @@ const CHARSETS = {
13
13
  /**
14
14
  * Generates a random string of a given length using a specified character set.
15
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.
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
18
  *
19
- * @returns {string} The generated random string.
19
+ * @returns {string} The generated random string
20
20
  *
21
- * @throws {Error} If the length is not a positive integer or the mode is unsupported.
21
+ * @throws {Error} If the length is not a positive integer or the mode is unsupported
22
22
  *
23
23
  * @example
24
24
  * ```typescript
@@ -31,7 +31,7 @@ const CHARSETS = {
31
31
  */
32
32
  function randomString(length, mode = 'alphabetic') {
33
33
  if (!Number.isInteger(length) || length <= 0) {
34
- throw new Error(`Invalid length: ${length}. Must be a positive integer.`);
34
+ throw new Error(`Invalid length: ${length}. Must be a positive integer`);
35
35
  }
36
36
  const charset = CHARSETS[mode];
37
37
  if (!charset)
@@ -1 +1 @@
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,6BAAA,CAA+B,CAAC;;AAG7E,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;;;;"}
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 CHANGED
@@ -5,10 +5,10 @@
5
5
  *
6
6
  * Typically used to preserve the user's current path for post-login navigation.
7
7
  *
8
- * @param {string} url - The target URL to modify.
9
- * @param {string} redirectPath - The path to use as the redirect destination.
8
+ * @param {string} url - The target URL to modify
9
+ * @param {string} redirectPath - The path to use as the redirect destination
10
10
  *
11
- * @returns {string} A new URL string with the `redirect` query parameter.
11
+ * @returns {string} A new URL string with the `redirect` query parameter
12
12
  */
13
13
  function appendRedirectParamToUrl(url, redirectPath) {
14
14
  const [base, rawQuery = ''] = url.split('?');
package/dist/url.cjs.map CHANGED
@@ -1 +1 @@
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;;;;"}
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.d.ts CHANGED
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * Typically used to preserve the user's current path for post-login navigation.
5
5
  *
6
- * @param {string} url - The target URL to modify.
7
- * @param {string} redirectPath - The path to use as the redirect destination.
6
+ * @param {string} url - The target URL to modify
7
+ * @param {string} redirectPath - The path to use as the redirect destination
8
8
  *
9
- * @returns {string} A new URL string with the `redirect` query parameter.
9
+ * @returns {string} A new URL string with the `redirect` query parameter
10
10
  */
11
11
  export declare function appendRedirectParamToUrl(url: string, redirectPath: string): string;
12
12
  //# sourceMappingURL=url.d.ts.map
package/dist/url.mjs CHANGED
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * Typically used to preserve the user's current path for post-login navigation.
5
5
  *
6
- * @param {string} url - The target URL to modify.
7
- * @param {string} redirectPath - The path to use as the redirect destination.
6
+ * @param {string} url - The target URL to modify
7
+ * @param {string} redirectPath - The path to use as the redirect destination
8
8
  *
9
- * @returns {string} A new URL string with the `redirect` query parameter.
9
+ * @returns {string} A new URL string with the `redirect` query parameter
10
10
  */
11
11
  function appendRedirectParamToUrl(url, redirectPath) {
12
12
  const [base, rawQuery = ''] = url.split('?');
package/dist/url.mjs.map CHANGED
@@ -1 +1 @@
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;;;;"}
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 CHANGED
@@ -7,9 +7,9 @@ const url = require('./url.cjs');
7
7
  /**
8
8
  * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.
9
9
  *
10
- * @param {string} url - The base URL to modify.
10
+ * @param {string} url - The base URL to modify
11
11
  *
12
- * @returns {string} A new URL with the current route fullPath as the `redirect` parameter.
12
+ * @returns {string} A new URL with the current route fullPath as the `redirect` parameter
13
13
  */
14
14
  function appendRedirectParamFromCurrentRouteToUrl(url$1) {
15
15
  return url.appendRedirectParamToUrl(url$1, vueRouter.useRoute().fullPath);
@@ -17,7 +17,7 @@ function appendRedirectParamFromCurrentRouteToUrl(url$1) {
17
17
  /**
18
18
  * Clears an interval referenced by a Vue ref and sets it to null.
19
19
  *
20
- * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null.
20
+ * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null
21
21
  */
22
22
  function clearIntervalRef(intervalRef) {
23
23
  if (intervalRef.value)
@@ -27,7 +27,7 @@ function clearIntervalRef(intervalRef) {
27
27
  /**
28
28
  * Clears a timeout referenced by a Vue ref and sets it to null.
29
29
  *
30
- * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null.
30
+ * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null
31
31
  */
32
32
  function clearTimeoutRef(timeoutRef) {
33
33
  if (timeoutRef.value)
@@ -38,9 +38,9 @@ function clearTimeoutRef(timeoutRef) {
38
38
  * A Vue composition function that remembers and restores scroll position
39
39
  * of a scrollable container across route changes and keep-alive activation.
40
40
  *
41
- * @template T - The type of the scrollable element (defaults to HTMLElement).
41
+ * @template T - The type of the scrollable element (defaults to HTMLElement)
42
42
  *
43
- * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element.
43
+ * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element
44
44
  */
45
45
  function usePreserveScroll(containerRef) {
46
46
  let scrollLeft = 0;
package/dist/vue.cjs.map CHANGED
@@ -1 +1 @@
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,KAAC,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,KAAC,CAAC;AACN;;;;;;;"}
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.d.ts CHANGED
@@ -2,30 +2,30 @@ import type { Ref } from 'vue';
2
2
  /**
3
3
  * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.
4
4
  *
5
- * @param {string} url - The base URL to modify.
5
+ * @param {string} url - The base URL to modify
6
6
  *
7
- * @returns {string} A new URL with the current route fullPath as the `redirect` parameter.
7
+ * @returns {string} A new URL with the current route fullPath as the `redirect` parameter
8
8
  */
9
9
  export declare function appendRedirectParamFromCurrentRouteToUrl(url: string): string;
10
10
  /**
11
11
  * Clears an interval referenced by a Vue ref and sets it to null.
12
12
  *
13
- * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null.
13
+ * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null
14
14
  */
15
15
  export declare function clearIntervalRef(intervalRef: Ref<null | ReturnType<typeof setInterval>>): void;
16
16
  /**
17
17
  * Clears a timeout referenced by a Vue ref and sets it to null.
18
18
  *
19
- * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null.
19
+ * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null
20
20
  */
21
21
  export declare function clearTimeoutRef(timeoutRef: Ref<null | ReturnType<typeof setTimeout>>): void;
22
22
  /**
23
23
  * A Vue composition function that remembers and restores scroll position
24
24
  * of a scrollable container across route changes and keep-alive activation.
25
25
  *
26
- * @template T - The type of the scrollable element (defaults to HTMLElement).
26
+ * @template T - The type of the scrollable element (defaults to HTMLElement)
27
27
  *
28
- * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element.
28
+ * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element
29
29
  */
30
30
  export declare function usePreserveScroll<T extends Element = HTMLElement>(containerRef: Ref<null | T>): void;
31
31
  //# sourceMappingURL=vue.d.ts.map
package/dist/vue.mjs CHANGED
@@ -5,9 +5,9 @@ import { appendRedirectParamToUrl } from './url.mjs';
5
5
  /**
6
6
  * Appends the current Vue Router route's fullPath as the `redirect` query parameter to the given URL.
7
7
  *
8
- * @param {string} url - The base URL to modify.
8
+ * @param {string} url - The base URL to modify
9
9
  *
10
- * @returns {string} A new URL with the current route fullPath as the `redirect` parameter.
10
+ * @returns {string} A new URL with the current route fullPath as the `redirect` parameter
11
11
  */
12
12
  function appendRedirectParamFromCurrentRouteToUrl(url) {
13
13
  return appendRedirectParamToUrl(url, useRoute().fullPath);
@@ -15,7 +15,7 @@ function appendRedirectParamFromCurrentRouteToUrl(url) {
15
15
  /**
16
16
  * Clears an interval referenced by a Vue ref and sets it to null.
17
17
  *
18
- * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null.
18
+ * @param {Ref<null | ReturnType<typeof setInterval>>} intervalRef - A Vue ref holding a NodeJS.Timeout or null
19
19
  */
20
20
  function clearIntervalRef(intervalRef) {
21
21
  if (intervalRef.value)
@@ -25,7 +25,7 @@ function clearIntervalRef(intervalRef) {
25
25
  /**
26
26
  * Clears a timeout referenced by a Vue ref and sets it to null.
27
27
  *
28
- * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null.
28
+ * @param {Ref<null | ReturnType<typeof setTimeout>>} timeoutRef - A Vue ref holding a NodeJS.Timeout or null
29
29
  */
30
30
  function clearTimeoutRef(timeoutRef) {
31
31
  if (timeoutRef.value)
@@ -36,9 +36,9 @@ function clearTimeoutRef(timeoutRef) {
36
36
  * A Vue composition function that remembers and restores scroll position
37
37
  * of a scrollable container across route changes and keep-alive activation.
38
38
  *
39
- * @template T - The type of the scrollable element (defaults to HTMLElement).
39
+ * @template T - The type of the scrollable element (defaults to HTMLElement)
40
40
  *
41
- * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element.
41
+ * @param {Ref<null | T>} containerRef - A ref to the scrollable HTML element
42
42
  */
43
43
  function usePreserveScroll(containerRef) {
44
44
  let scrollLeft = 0;
package/dist/vue.mjs.map CHANGED
@@ -1 +1 @@
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,KAAC,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,KAAC,CAAC;AACN;;;;"}
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 CHANGED
@@ -5,9 +5,9 @@ const url = require('./url.cjs');
5
5
  /**
6
6
  * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
7
7
  *
8
- * @param {string} url - The base URL to modify.
8
+ * @param {string} url - The base URL to modify
9
9
  *
10
- * @returns {string} A new URL with the current location as the `redirect` parameter.
10
+ * @returns {string} A new URL with the current location as the `redirect` parameter
11
11
  */
12
12
  function appendRedirectParamFromCurrentLocationToUrl(url$1) {
13
13
  const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
@@ -20,8 +20,8 @@ function appendRedirectParamFromCurrentLocationToUrl(url$1) {
20
20
  * Useful for redirecting to login or other gateways while preserving
21
21
  * the current location for post-auth navigation.
22
22
  *
23
- * @param {string} url - The destination URL to navigate to.
24
- * @param {number} [delayMs] - Optional delay in milliseconds before navigation.
23
+ * @param {string} url - The destination URL to navigate to
24
+ * @param {number} [delayMs] - Optional delay in milliseconds before navigation
25
25
  */
26
26
  function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
27
27
  if (delayMs === undefined)
package/dist/web.cjs.map CHANGED
@@ -1 +1 @@
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;;;;;"}
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.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
3
3
  *
4
- * @param {string} url - The base URL to modify.
4
+ * @param {string} url - The base URL to modify
5
5
  *
6
- * @returns {string} A new URL with the current location as the `redirect` parameter.
6
+ * @returns {string} A new URL with the current location as the `redirect` parameter
7
7
  */
8
8
  export declare function appendRedirectParamFromCurrentLocationToUrl(url: string): string;
9
9
  /**
@@ -13,8 +13,8 @@ export declare function appendRedirectParamFromCurrentLocationToUrl(url: string)
13
13
  * Useful for redirecting to login or other gateways while preserving
14
14
  * the current location for post-auth navigation.
15
15
  *
16
- * @param {string} url - The destination URL to navigate to.
17
- * @param {number} [delayMs] - Optional delay in milliseconds before navigation.
16
+ * @param {string} url - The destination URL to navigate to
17
+ * @param {number} [delayMs] - Optional delay in milliseconds before navigation
18
18
  */
19
19
  export declare function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number): NodeJS.Timeout | undefined;
20
20
  //# sourceMappingURL=web.d.ts.map
package/dist/web.mjs CHANGED
@@ -3,9 +3,9 @@ import { appendRedirectParamToUrl } from './url.mjs';
3
3
  /**
4
4
  * Appends the current browser URL (including path, query, and hash) as the `redirect` query parameter to the given URL.
5
5
  *
6
- * @param {string} url - The base URL to modify.
6
+ * @param {string} url - The base URL to modify
7
7
  *
8
- * @returns {string} A new URL with the current location as the `redirect` parameter.
8
+ * @returns {string} A new URL with the current location as the `redirect` parameter
9
9
  */
10
10
  function appendRedirectParamFromCurrentLocationToUrl(url) {
11
11
  const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
@@ -18,8 +18,8 @@ function appendRedirectParamFromCurrentLocationToUrl(url) {
18
18
  * Useful for redirecting to login or other gateways while preserving
19
19
  * the current location for post-auth navigation.
20
20
  *
21
- * @param {string} url - The destination URL to navigate to.
22
- * @param {number} [delayMs] - Optional delay in milliseconds before navigation.
21
+ * @param {string} url - The destination URL to navigate to
22
+ * @param {number} [delayMs] - Optional delay in milliseconds before navigation
23
23
  */
24
24
  function assignUrlWithRedirectParamFromCurrentLocation(url, delayMs) {
25
25
  if (delayMs === undefined)
package/dist/web.mjs.map CHANGED
@@ -1 +1 @@
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;;;;"}
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;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kikiutils/shared",
3
- "version": "10.2.1",
3
+ "version": "10.4.0",
4
4
  "description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
5
5
  "author": "kiki-kanri",
6
6
  "license": "MIT",
@@ -58,27 +58,30 @@
58
58
  "scripts": {
59
59
  "build": "ts-project-builder './src/**/*.ts' --clean --preserve-modules --sourcemaps",
60
60
  "bumplog": "changelogen --bump --hideAuthorEmail",
61
+ "depcheck": "depcheck",
61
62
  "lint": "eslint --max-warnings 0",
62
63
  "lint:fix": "eslint --fix --max-warnings 0",
63
64
  "prepack": "pnpm run build",
64
65
  "release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && changelogen --hideAuthorEmail --push --release && npm publish",
65
66
  "test": "cross-env TZ=UTC vitest run --coverage",
66
67
  "test:watch": "cross-env TZ=UTC vitest watch --coverage",
67
- "typecheck": "tsc --noEmit"
68
+ "typecheck": "tsc --noEmit",
69
+ "unused-exports": "ts-unused-exports ./tsconfig.json"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@kikiutils/changelogen": "^0.8.0",
71
73
  "@kikiutils/eslint-config": "^1.2.7",
72
74
  "@kikiutils/tsconfigs": "^5.0.4",
73
75
  "@noble/hashes": "^1.8.0",
74
- "@types/node": "^24.0.10",
76
+ "@types/node": "^24.0.14",
75
77
  "@vitest/coverage-v8": "^3.2.4",
76
78
  "async-validator": "^4.2.5",
77
79
  "consola": "^3.4.2",
78
80
  "cross-env": "^7.0.3",
79
81
  "date-fns": "^4.1.0",
80
- "decimal.js": "^10.5.0",
81
- "element-plus": "^2.10.2",
82
+ "decimal.js": "^10.6.0",
83
+ "depcheck": "^1.4.7",
84
+ "element-plus": "^2.10.4",
82
85
  "ioredis": "^5.6.1",
83
86
  "jsdom": "^26.1.0",
84
87
  "lru-cache": "^11.1.0",
@@ -87,6 +90,7 @@
87
90
  "pino-pretty": "^13.0.0",
88
91
  "superjson": "^2.2.2",
89
92
  "ts-project-builder": "^5.0.2",
93
+ "ts-unused-exports": "^11.0.1",
90
94
  "typescript": "^5.8.3",
91
95
  "vitest": "^3.2.4",
92
96
  "vue": "^3.5.17",
package/src/buffer.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { Buffer } from 'node:buffer';
2
+
3
+ /**
4
+ * Converts a Blob, Buffer, or File to a Buffer.
5
+ *
6
+ * This function provides a unified way to convert various binary data types
7
+ * to Node.js Buffer. If the input is already a Buffer, it returns it as-is.
8
+ * For Blob or File inputs, it converts them to Buffer via ArrayBuffer.
9
+ *
10
+ * @param {Blob | Buffer | File} input - The input to convert to Buffer
11
+ *
12
+ * @returns {Promise<Buffer>} A Promise that resolves to a Buffer
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { toBuffer } from '@kikiutils/shared/general';
17
+ *
18
+ * // Convert a Buffer (returns as-is)
19
+ * const buffer = Buffer.from('Hello World');
20
+ * const result1 = await toBuffer(buffer);
21
+ * console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>
22
+ *
23
+ * // Convert a Blob
24
+ * const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });
25
+ * const result2 = await toBuffer(blob);
26
+ * console.log(result2.toString()); // 'Hello from Blob'
27
+ *
28
+ * // Convert a File
29
+ * const file = new File(['File content'], 'test.txt', { type: 'text/plain' });
30
+ * const result3 = await toBuffer(file);
31
+ * console.log(result3.toString()); // 'File content'
32
+ * ```
33
+ */
34
+ export async function toBuffer(input: Blob | Buffer | File) {
35
+ if (Buffer.isBuffer(input)) return input;
36
+ return Buffer.from(await input.arrayBuffer());
37
+ }
package/src/clipboard.ts CHANGED
@@ -10,8 +10,8 @@ type CopyResult =
10
10
  * - Must be called **in response to a user interaction** (e.g. click, input).
11
11
  * - Not supported in Safari and some older browsers.
12
12
  *
13
- * @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content).
14
- * @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor.
13
+ * @param {Blob} blob - The Blob object to copy (e.g. from a File, image, or text content)
14
+ * @param {ClipboardItemOptions} [options] - Optional options passed to the ClipboardItem constructor
15
15
  *
16
16
  * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
17
17
  * - `{ ok: true }` if the copy succeeded
@@ -33,7 +33,7 @@ type CopyResult =
33
33
  export async function copyBlobToClipboard(blob: Blob, options?: ClipboardItemOptions): Promise<CopyResult> {
34
34
  if (!navigator.clipboard?.write) {
35
35
  return {
36
- error: new Error('Clipboard.write is not supported in this browser.'),
36
+ error: new Error('Clipboard.write is not supported in this browser'),
37
37
  ok: false,
38
38
  };
39
39
  }
@@ -58,7 +58,7 @@ export async function copyBlobToClipboard(blob: Blob, options?: ClipboardItemOpt
58
58
  * - Must be called **in response to a user interaction** (e.g. click, input).
59
59
  * - Not supported in some older browsers (especially legacy Safari).
60
60
  *
61
- * @param {string} text - The string to be copied to the clipboard.
61
+ * @param {string} text - The string to be copied to the clipboard
62
62
  *
63
63
  * @returns {Promise<CopyResult>} A promise resolving to a `CopyResult`:
64
64
  * - `{ ok: true }` if the copy succeeded
package/src/datetime.ts CHANGED
@@ -23,11 +23,11 @@ export type DateRangeType = 'lastMonth' | 'lastWeek' | 'thisMonth' | 'thisWeek'
23
23
  *
24
24
  * This function is a wrapper around `date-fns/format`.
25
25
  *
26
- * @param {DateArg<Date>} date - The input date to format. Can be a Date object, a timestamp, or a string.
27
- * @param {string} [format] - The target format string.
28
- * @param {FormatOptions} [options] - Optional formatting options passed to `date-fns/format`.
26
+ * @param {DateArg<Date>} date - The input date to format. Can be a Date object, a timestamp, or a string
27
+ * @param {string} [format] - The target format string
28
+ * @param {FormatOptions} [options] - Optional formatting options passed to `date-fns/format`
29
29
  *
30
- * @returns {string} The formatted date string.
30
+ * @returns {string} The formatted date string
31
31
  *
32
32
  * @example
33
33
  * ```typescript
@@ -54,13 +54,13 @@ export function formatDate(date: DateArg<Date> & {}, format: string = 'yyyy-MM-d
54
54
  *
55
55
  * Supports common range types like 'lastMonth', 'lastWeek', 'thisMonth', 'thisWeek', 'today', and 'yesterday'.
56
56
  *
57
- * @param {Date} date - The reference date.
58
- * @param {DateRangeType} type - The range type to compute.
59
- * @param {object} [options] - Optional settings.
60
- * @param {boolean} [options.setEndDateToNextDayStart] - If true, set `endDate` to 00:00:00.000 of the next day.
61
- * @param {Day} [options.weekStartsOn] - The start day of the week (0 = Sunday, 1 = Monday, ..., 6 = Saturday).
57
+ * @param {Date} date - The reference date
58
+ * @param {DateRangeType} type - The range type to compute
59
+ * @param {object} [options] - Optional settings
60
+ * @param {boolean} [options.setEndDateToNextDayStart] - If true, set `endDate` to 00:00:00.000 of the next day
61
+ * @param {Day} [options.weekStartsOn] - The start day of the week (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
62
62
  *
63
- * @returns {{ startDate: Date, endDate: Date }} An object with `startDate` and `endDate`.
63
+ * @returns {{ startDate: Date, endDate: Date }} An object with `startDate` and `endDate`
64
64
  *
65
65
  * @example
66
66
  * ```typescript
@@ -123,7 +123,7 @@ export function getDateRangeFromDate(
123
123
  }
124
124
 
125
125
  break;
126
- default: throw new Error(`Unsupported date range type: ${type}.`);
126
+ default: throw new Error(`Unsupported date range type: ${type}`);
127
127
  }
128
128
 
129
129
  if (options?.setEndDateToNextDayStart) endDate.setHours(24, 0, 0, 0);
@@ -136,9 +136,9 @@ export function getDateRangeFromDate(
136
136
  /**
137
137
  * Returns a `Date` object set to midnight (00:00:00) of today, with an optional day offset.
138
138
  *
139
- * @param {number} [offsetDays] - Number of days to offset from today. Can be negative.
139
+ * @param {number} [offsetDays] - Number of days to offset from today. Can be negative
140
140
  *
141
- * @returns {Date} A `Date` object at 00:00:00 of the offset day.
141
+ * @returns {Date} A `Date` object at 00:00:00 of the offset day
142
142
  *
143
143
  * @example
144
144
  * ```typescript
@@ -10,13 +10,13 @@ export type DoNotRemoveOrUseThisType = RuleType;
10
10
  * while allowing overrides via the `options` parameter. It simplifies common
11
11
  * form validation rule creation and ensures consistency across forms.
12
12
  *
13
- * @param {string} message - The validation message to display when the rule fails.
14
- * @param {FormItemRule} [options] - Optional overrides for the rule fields.
15
- * @param {boolean} [options.required] - Whether the field is required (default: `true`).
16
- * @param {string | string[]} [options.trigger] - The event(s) that trigger validation (default: `'blur'`).
17
- * @param {RuleType} [options.type] - The expected type of the field (default: `'string'`).
13
+ * @param {string} message - The validation message to display when the rule fails
14
+ * @param {FormItemRule} [options] - Optional overrides for the rule fields
15
+ * @param {boolean} [options.required] - Whether the field is required (default: `true`)
16
+ * @param {string | string[]} [options.trigger] - The event(s) that trigger validation (default: `'blur'`)
17
+ * @param {RuleType} [options.type] - The expected type of the field (default: `'string'`)
18
18
  *
19
- * @returns A `FormItemRule` object that can be used in Element Plus form validation.
19
+ * @returns A `FormItemRule` object that can be used in Element Plus form validation
20
20
  *
21
21
  * @example
22
22
  * ```typescript