@kikiutils/shared 10.0.0 → 10.1.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.
package/README.md CHANGED
@@ -90,6 +90,10 @@ Console logger integration.
90
90
  - `getDateRangeFromDate`
91
91
  - `getMidnightDateFromToday`
92
92
 
93
+ ### [element-plus](./src/element-plus.ts)
94
+
95
+ - `createElFormItemRuleWithDefaults`
96
+
93
97
  ### [enum](./src/enum.ts)
94
98
 
95
99
  - `getEnumStringValues`
package/dist/web.cjs CHANGED
@@ -13,6 +13,23 @@ function appendRedirectParamFromCurrentLocationToUrl(url$1) {
13
13
  const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
14
14
  return url.appendRedirectParamToUrl(url$1, currentPath);
15
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
+ }
16
32
 
17
33
  exports.appendRedirectParamFromCurrentLocationToUrl = appendRedirectParamFromCurrentLocationToUrl;
34
+ exports.assignUrlWithRedirectParamFromCurrentLocation = assignUrlWithRedirectParamFromCurrentLocation;
18
35
  //# sourceMappingURL=web.cjs.map
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"],"names":["url","appendRedirectParamToUrl"],"mappings":";;;;AAEA;;;;;;AAMG;AACG,SAAU,2CAA2C,CAACA,KAAW,EAAA;IACnE,MAAM,WAAW,GAAG,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAOC,4BAAwB,CAACD,KAAG,EAAE,WAAW,CAAC;AACrD;;;;"}
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,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAOC,4BAAwB,CAACD,KAAG,EAAE,WAAW,CAAC;AACrD;AAEA;;;;;;;;;AASG;AACa,SAAA,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
@@ -6,4 +6,15 @@
6
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
+ /**
10
+ * Navigates to the given URL, appending the current browser location
11
+ * (path, query, and hash) as the `redirect` query parameter.
12
+ *
13
+ * Useful for redirecting to login or other gateways while preserving
14
+ * the current location for post-auth navigation.
15
+ *
16
+ * @param {string} url - The destination URL to navigate to.
17
+ * @param {number} [delayMs] - Optional delay in milliseconds before navigation.
18
+ */
19
+ export declare function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number): NodeJS.Timeout | undefined;
9
20
  //# sourceMappingURL=web.d.ts.map
package/dist/web.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,2CAA2C,CAAC,GAAG,EAAE,MAAM,UAGtE"}
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,2CAA2C,CAAC,GAAG,EAAE,MAAM,UAGtE;AAED;;;;;;;;;GASG;AACH,wBAAgB,6CAA6C,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,8BAG1F"}
package/dist/web.mjs CHANGED
@@ -11,6 +11,22 @@ function appendRedirectParamFromCurrentLocationToUrl(url) {
11
11
  const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
12
12
  return appendRedirectParamToUrl(url, currentPath);
13
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
+ }
14
30
 
15
- export { appendRedirectParamFromCurrentLocationToUrl };
31
+ export { appendRedirectParamFromCurrentLocationToUrl, assignUrlWithRedirectParamFromCurrentLocation };
16
32
  //# sourceMappingURL=web.mjs.map
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"],"names":[],"mappings":";;AAEA;;;;;;AAMG;AACG,SAAU,2CAA2C,CAAC,GAAW,EAAA;IACnE,MAAM,WAAW,GAAG,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAO,wBAAwB,CAAC,GAAG,EAAE,WAAW,CAAC;AACrD;;;;"}
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,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAG,EAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA,CAAE;AACjG,IAAA,OAAO,wBAAwB,CAAC,GAAG,EAAE,WAAW,CAAC;AACrD;AAEA;;;;;;;;;AASG;AACa,SAAA,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.0.0",
3
+ "version": "10.1.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",
@@ -71,7 +71,7 @@
71
71
  "@kikiutils/tsconfigs": "^5.0.1",
72
72
  "@noble/hashes": "^1.8.0",
73
73
  "@types/jest": "^29.5.14",
74
- "@types/node": "^22.15.15",
74
+ "@types/node": "^22.15.16",
75
75
  "async-validator": "^4.2.5",
76
76
  "consola": "^3.4.2",
77
77
  "cross-env": "^7.0.3",
package/src/web.ts CHANGED
@@ -11,3 +11,18 @@ export function appendRedirectParamFromCurrentLocationToUrl(url: string) {
11
11
  const currentPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
12
12
  return appendRedirectParamToUrl(url, currentPath);
13
13
  }
14
+
15
+ /**
16
+ * Navigates to the given URL, appending the current browser location
17
+ * (path, query, and hash) as the `redirect` query parameter.
18
+ *
19
+ * Useful for redirecting to login or other gateways while preserving
20
+ * the current location for post-auth navigation.
21
+ *
22
+ * @param {string} url - The destination URL to navigate to.
23
+ * @param {number} [delayMs] - Optional delay in milliseconds before navigation.
24
+ */
25
+ export function assignUrlWithRedirectParamFromCurrentLocation(url: string, delayMs?: number) {
26
+ if (delayMs === undefined) window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url));
27
+ else return setTimeout(() => window.location.assign(appendRedirectParamFromCurrentLocationToUrl(url)), delayMs);
28
+ }