minimal-shared 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. package/dist/hooks/index.cjs +1 -0
  2. package/dist/hooks/index.d.cts +19 -0
  3. package/dist/hooks/index.js +1 -17
  4. package/dist/hooks/use-back-to-top/index.cjs +1 -0
  5. package/dist/hooks/use-back-to-top/index.d.cts +2 -0
  6. package/dist/hooks/use-back-to-top/index.js +1 -1
  7. package/dist/hooks/use-back-to-top/use-back-to-top.cjs +1 -0
  8. package/dist/hooks/use-back-to-top/use-back-to-top.d.cts +33 -0
  9. package/dist/hooks/use-boolean/index.cjs +1 -0
  10. package/dist/hooks/use-boolean/index.d.cts +2 -0
  11. package/dist/hooks/use-boolean/index.js +1 -1
  12. package/dist/hooks/use-boolean/use-boolean.cjs +1 -0
  13. package/dist/hooks/use-boolean/use-boolean.d.cts +29 -0
  14. package/dist/hooks/use-client-rect/index.cjs +1 -0
  15. package/dist/hooks/use-client-rect/index.d.cts +2 -0
  16. package/dist/hooks/use-client-rect/index.js +1 -1
  17. package/dist/hooks/use-client-rect/use-client-rect.cjs +1 -0
  18. package/dist/hooks/use-client-rect/use-client-rect.d.cts +29 -0
  19. package/dist/hooks/use-cookies/index.cjs +1 -0
  20. package/dist/hooks/use-cookies/index.d.cts +2 -0
  21. package/dist/hooks/use-cookies/index.js +1 -1
  22. package/dist/hooks/use-cookies/use-cookies.cjs +1 -0
  23. package/dist/hooks/use-cookies/use-cookies.d.cts +40 -0
  24. package/dist/hooks/use-copy-to-clipboard/index.cjs +1 -0
  25. package/dist/hooks/use-copy-to-clipboard/index.d.cts +1 -0
  26. package/dist/hooks/use-copy-to-clipboard/index.js +1 -1
  27. package/dist/hooks/use-copy-to-clipboard/use-copy-to-clipboard.cjs +1 -0
  28. package/dist/hooks/use-copy-to-clipboard/use-copy-to-clipboard.d.cts +26 -0
  29. package/dist/hooks/use-countdown-date/index.cjs +1 -0
  30. package/dist/hooks/use-countdown-date/index.d.cts +1 -0
  31. package/dist/hooks/use-countdown-date/index.js +1 -1
  32. package/dist/hooks/use-countdown-date/use-countdown-date.cjs +1 -0
  33. package/dist/hooks/use-countdown-date/use-countdown-date.d.cts +29 -0
  34. package/dist/hooks/use-countdown-seconds/index.cjs +1 -0
  35. package/dist/hooks/use-countdown-seconds/index.d.cts +2 -0
  36. package/dist/hooks/use-countdown-seconds/index.js +1 -1
  37. package/dist/hooks/use-countdown-seconds/use-countdown-seconds.cjs +1 -0
  38. package/dist/hooks/use-countdown-seconds/use-countdown-seconds.d.cts +35 -0
  39. package/dist/hooks/use-debounce/index.cjs +1 -0
  40. package/dist/hooks/use-debounce/index.d.cts +1 -0
  41. package/dist/hooks/use-debounce/index.js +1 -1
  42. package/dist/hooks/use-debounce/use-debounce.cjs +1 -0
  43. package/dist/hooks/use-debounce/use-debounce.d.cts +21 -0
  44. package/dist/hooks/use-double-click/index.cjs +1 -0
  45. package/dist/hooks/use-double-click/index.d.cts +2 -0
  46. package/dist/hooks/use-double-click/index.js +1 -1
  47. package/dist/hooks/use-double-click/use-double-click.cjs +1 -0
  48. package/dist/hooks/use-double-click/use-double-click.d.cts +28 -0
  49. package/dist/hooks/use-is-client/index.cjs +1 -0
  50. package/dist/hooks/use-is-client/index.d.cts +1 -0
  51. package/dist/hooks/use-is-client/index.js +1 -1
  52. package/dist/hooks/use-is-client/use-is-client.cjs +1 -0
  53. package/dist/hooks/use-is-client/use-is-client.d.cts +18 -0
  54. package/dist/hooks/use-local-storage/index.cjs +1 -0
  55. package/dist/hooks/use-local-storage/index.d.cts +1 -0
  56. package/dist/hooks/use-local-storage/index.js +1 -1
  57. package/dist/hooks/use-local-storage/use-local-storage.cjs +1 -0
  58. package/dist/hooks/use-local-storage/use-local-storage.d.cts +38 -0
  59. package/dist/hooks/use-multi-select/index.cjs +1 -0
  60. package/dist/hooks/use-multi-select/index.d.cts +2 -0
  61. package/dist/hooks/use-multi-select/index.js +1 -1
  62. package/dist/hooks/use-multi-select/use-multi-select.cjs +1 -0
  63. package/dist/hooks/use-multi-select/use-multi-select.d.cts +55 -0
  64. package/dist/hooks/use-popover/index.cjs +1 -0
  65. package/dist/hooks/use-popover/index.d.cts +2 -0
  66. package/dist/hooks/use-popover/index.js +1 -1
  67. package/dist/hooks/use-popover/use-popover.cjs +1 -0
  68. package/dist/hooks/use-popover/use-popover.d.cts +35 -0
  69. package/dist/hooks/use-popover-hover/index.cjs +1 -0
  70. package/dist/hooks/use-popover-hover/index.d.cts +2 -0
  71. package/dist/hooks/use-popover-hover/index.js +1 -1
  72. package/dist/hooks/use-popover-hover/use-popover-hover.cjs +1 -0
  73. package/dist/hooks/use-popover-hover/use-popover-hover.d.cts +41 -0
  74. package/dist/hooks/use-scroll-offset-top/index.cjs +1 -0
  75. package/dist/hooks/use-scroll-offset-top/index.d.cts +2 -0
  76. package/dist/hooks/use-scroll-offset-top/index.js +1 -1
  77. package/dist/hooks/use-scroll-offset-top/use-scroll-offset-top.cjs +1 -0
  78. package/dist/hooks/use-scroll-offset-top/use-scroll-offset-top.d.cts +28 -0
  79. package/dist/hooks/use-set-state/index.cjs +1 -0
  80. package/dist/hooks/use-set-state/index.d.cts +1 -0
  81. package/dist/hooks/use-set-state/index.js +1 -1
  82. package/dist/hooks/use-set-state/use-set-state.cjs +1 -0
  83. package/dist/hooks/use-set-state/use-set-state.d.cts +32 -0
  84. package/dist/hooks/use-tabs/index.cjs +1 -0
  85. package/dist/hooks/use-tabs/index.d.cts +2 -0
  86. package/dist/hooks/use-tabs/index.js +1 -1
  87. package/dist/hooks/use-tabs/use-tabs.cjs +1 -0
  88. package/dist/hooks/use-tabs/use-tabs.d.cts +30 -0
  89. package/dist/index.cjs +9 -0
  90. package/dist/index.d.cts +28 -0
  91. package/dist/index.js +9 -2
  92. package/dist/utils/active-link/active-link.cjs +1 -0
  93. package/dist/utils/active-link/active-link.d.cts +16 -0
  94. package/dist/utils/active-link/index.cjs +1 -0
  95. package/dist/utils/active-link/index.d.cts +1 -0
  96. package/dist/utils/active-link/index.js +1 -1
  97. package/dist/utils/classes/classes.cjs +1 -0
  98. package/dist/utils/classes/classes.d.cts +25 -0
  99. package/dist/utils/classes/index.cjs +1 -0
  100. package/dist/utils/classes/index.d.cts +1 -0
  101. package/dist/utils/classes/index.js +1 -1
  102. package/dist/utils/color/color.cjs +9 -0
  103. package/dist/utils/color/color.d.cts +67 -0
  104. package/dist/utils/color/index.cjs +9 -0
  105. package/dist/utils/color/index.d.cts +1 -0
  106. package/dist/utils/color/index.js +9 -1
  107. package/dist/utils/cookies/cookies.cjs +1 -0
  108. package/dist/utils/cookies/cookies.d.cts +42 -0
  109. package/dist/utils/cookies/index.cjs +1 -0
  110. package/dist/utils/cookies/index.d.cts +1 -0
  111. package/dist/utils/cookies/index.js +1 -1
  112. package/dist/utils/font/font.cjs +1 -0
  113. package/dist/utils/font/font.d.cts +37 -0
  114. package/dist/utils/font/index.cjs +1 -0
  115. package/dist/utils/font/index.d.cts +1 -0
  116. package/dist/utils/font/index.js +1 -1
  117. package/dist/utils/index.cjs +9 -0
  118. package/dist/utils/index.d.cts +10 -0
  119. package/dist/utils/index.js +9 -10
  120. package/dist/utils/local-storage/index.cjs +1 -0
  121. package/dist/utils/local-storage/index.d.cts +1 -0
  122. package/dist/utils/local-storage/index.js +1 -1
  123. package/dist/utils/local-storage/local-storage.cjs +1 -0
  124. package/dist/utils/local-storage/local-storage.d.cts +43 -0
  125. package/dist/utils/object/index.cjs +1 -0
  126. package/dist/utils/object/index.d.cts +1 -0
  127. package/dist/utils/object/index.js +1 -1
  128. package/dist/utils/object/object.cjs +1 -0
  129. package/dist/utils/object/object.d.cts +26 -0
  130. package/dist/utils/transform-number/index.cjs +1 -0
  131. package/dist/utils/transform-number/index.d.cts +1 -0
  132. package/dist/utils/transform-number/index.js +1 -1
  133. package/dist/utils/transform-number/transform-number.cjs +1 -0
  134. package/dist/utils/transform-number/transform-number.d.cts +31 -0
  135. package/dist/utils/url/index.cjs +1 -0
  136. package/dist/utils/url/index.d.cts +1 -0
  137. package/dist/utils/url/index.js +1 -1
  138. package/dist/utils/url/url.cjs +1 -0
  139. package/dist/utils/url/url.d.cts +54 -0
  140. package/dist/utils/uuidv4/index.cjs +1 -0
  141. package/dist/utils/uuidv4/index.d.cts +1 -0
  142. package/dist/utils/uuidv4/index.js +1 -1
  143. package/dist/utils/uuidv4/uuidv4.cjs +1 -0
  144. package/dist/utils/uuidv4/uuidv4.d.cts +12 -0
  145. package/package.json +1 -1
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Converts a hex color to RGB channels.
3
+ *
4
+ * @param {string} hexColor - The hex color string.
5
+ * @returns {string} - The RGB channels string.
6
+ * @throws {Error} - Throws an error if the hex color is invalid.
7
+ *
8
+ * @example
9
+ * const rgbChannel = hexToRgbChannel("#C8FAD6");
10
+ * console.log(rgbChannel); // "200 250 214"
11
+ */
12
+ declare function hexToRgbChannel(hexColor: string): string;
13
+ /**
14
+ * Converts a hex palette color to RGB channels palette.
15
+ *
16
+ * @typedef {Object} InputPalette - The input palette object with hex color strings.
17
+ * @property {string} lighter - The lighter hex color.
18
+ * @property {string} light - The light hex color.
19
+ * @property {string} main - The main hex color.
20
+ *
21
+ * @typedef {Object} ChannelPalette - The output palette object with RGB channels.
22
+ * @property {string} lighterChannel - The lighter RGB channels.
23
+ * @property {string} lightChannel - The light RGB channels.
24
+ * @property {string} mainChannel - The main RGB channels.
25
+ *
26
+ * @param {InputPalette} hexPalette - The input palette object.
27
+ * @returns {ChannelPalette} - The output palette object with RGB channels.
28
+ *
29
+ * @example
30
+ * const palette = createPaletteChannel({
31
+ * lighter: "#C8FAD6",
32
+ * light: "#5BE49B",
33
+ * main: "#00A76F",
34
+ * });
35
+ * console.log(palette);
36
+ * // {
37
+ * // lighter: "#C8FAD6",
38
+ * // light: "#5BE49B",
39
+ * // main: "#00A76F",
40
+ * // lighterChannel: "200 250 214",
41
+ * // lightChannel: "91 228 155",
42
+ * // mainChannel: "0 167 111",
43
+ * // }
44
+ */
45
+ type InputPalette = Record<string, string | undefined>;
46
+ type ChannelPalette<T extends InputPalette> = T & {
47
+ [K in keyof T as `${string & K}Channel`]: string;
48
+ };
49
+ declare function createPaletteChannel<T extends InputPalette>(hexPalette: T): ChannelPalette<T>;
50
+ /**
51
+ * Adds an alpha channel to a color.
52
+ *
53
+ * @param {string} color - The color string in RGB channels or CSS variable format.
54
+ * @param {number} [opacity=1] - The opacity value.
55
+ * @returns {string} - The color string with alpha channel.
56
+ * @throws {Error} - Throws an error if the color format is unsupported.
57
+ *
58
+ * @example
59
+ * const rgbaColor = varAlpha('200 250 214', 0.8);
60
+ * console.log(rgbaColor); // "rgba(200 250 214 / 0.8)"
61
+ *
62
+ * const rgbaVarColor = varAlpha('var(--palette-primary-lighterChannel)', 0.8);
63
+ * console.log(rgbaVarColor); // "rgba(var(--palette-primary-lighterChannel) / 0.8)"
64
+ */
65
+ declare function varAlpha(color: string, opacity?: number): string;
66
+
67
+ export { type ChannelPalette, type InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha };
@@ -0,0 +1,9 @@
1
+ "use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var d=(t,n)=>{for(var e in n)a(t,e,{get:n[e],enumerable:!0})},g=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of u(n))!o.call(t,s)&&s!==e&&a(t,s,{get:()=>n[s],enumerable:!(r=p(n,s))||r.enumerable});return t};var h=t=>g(a({},"__esModule",{value:!0}),t);var c={};d(c,{createPaletteChannel:()=>f,hexToRgbChannel:()=>i,varAlpha:()=>l});module.exports=h(c);function i(t){if(!t)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(t))throw new Error(`Invalid hex color: ${t}`);let n=parseInt(t.substring(1,3),16),e=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return`${n} ${e} ${r}`}function f(t){let n={};return Object.entries(t).forEach(([e,r])=>{r&&(n[`${e}Channel`]=i(r))}),{...t,...n}}function l(t,n=1){if(!t)throw new Error("[Alpha]: Color is undefined!");if(t.startsWith("#")||t.startsWith("rgb")||t.startsWith("rgba")||!t.includes("var")&&t.includes("Channel"))throw new Error(`[Alpha]: Unsupported color format "${t}".
2
+ Supported formats are:
3
+ - RGB channels: "0 184 217".
4
+ - CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)".
5
+ Unsupported formats are:
6
+ - Hex: "#00B8D9".
7
+ - RGB: "rgb(0, 184, 217)".
8
+ - RGBA: "rgba(0, 184, 217, 1)".
9
+ `);return`rgba(${t} / ${n})`}0&&(module.exports={createPaletteChannel,hexToRgbChannel,varAlpha});
@@ -0,0 +1 @@
1
+ export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './color.cjs';
@@ -1 +1,9 @@
1
- export * from './color';
1
+ function s(t){if(!t)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(t))throw new Error(`Invalid hex color: ${t}`);let n=parseInt(t.substring(1,3),16),e=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return`${n} ${e} ${r}`}function a(t){let n={};return Object.entries(t).forEach(([e,r])=>{r&&(n[`${e}Channel`]=s(r))}),{...t,...n}}function i(t,n=1){if(!t)throw new Error("[Alpha]: Color is undefined!");if(t.startsWith("#")||t.startsWith("rgb")||t.startsWith("rgba")||!t.includes("var")&&t.includes("Channel"))throw new Error(`[Alpha]: Unsupported color format "${t}".
2
+ Supported formats are:
3
+ - RGB channels: "0 184 217".
4
+ - CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)".
5
+ Unsupported formats are:
6
+ - Hex: "#00B8D9".
7
+ - RGB: "rgb(0, 184, 217)".
8
+ - RGBA: "rgba(0, 184, 217, 1)".
9
+ `);return`rgba(${t} / ${n})`}export{a as createPaletteChannel,s as hexToRgbChannel,i as varAlpha};
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(e,o)=>{for(var t in o)a(e,t,{get:o[t],enumerable:!0})},g=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of k(o))!m.call(e,r)&&r!==t&&a(e,r,{get:()=>o[r],enumerable:!(i=u(o,r))||i.enumerable});return e};var h=e=>g(a({},"__esModule",{value:!0}),e);var x={};f(x,{getCookie:()=>y,removeCookie:()=>S,setCookie:()=>C});module.exports=h(x);function y(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let o=`${e}=`,r=decodeURIComponent(document.cookie).split("; ").find(c=>c.startsWith(o));if(!r)return null;let n=r.substring(o.length);try{return JSON.parse(n)}catch{return n}}catch(o){return console.error("Error retrieving cookie:",o),null}}function C(e,o,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:i=0,sameSite:r="Strict",secure:n=!1,path:c="/",domain:d}=t??{};try{let s=encodeURIComponent(typeof o=="string"?o:JSON.stringify(o)),p=[`${e}=${s}`,`path=${c}`,r&&`SameSite=${r}`,n&&"Secure",d&&`domain=${d}`];if(i>0){let l=new Date(Date.now()+i*24*60*60*1e3);p.push(`expires=${l.toUTCString()}`)}document.cookie=p.filter(Boolean).join("; ")}catch(s){console.error("Error setting cookie:",s)}}function S(e,o){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:i}=o??{};try{let r=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,i&&`domain=${i}`,"Secure"];document.cookie=r.filter(Boolean).join("; ")}catch(r){console.error("Error removing cookie:",r)}}0&&(module.exports={getCookie,removeCookie,setCookie});
@@ -0,0 +1,42 @@
1
+ type CookieOptions = {
2
+ secure?: boolean;
3
+ daysUntilExpiration?: number;
4
+ sameSite?: 'Strict' | 'Lax' | 'None';
5
+ domain?: string;
6
+ path?: string;
7
+ };
8
+ /**
9
+ * Retrieves a cookie value by key.
10
+ *
11
+ * @param {string} key - The key of the cookie to retrieve.
12
+ * @returns {T | null} - The parsed value of the cookie, or null if not found or an error occurs.
13
+ *
14
+ * @example
15
+ * const user = getCookie<{ name: string, age: number }>('user');
16
+ * console.log(user); // { name: 'John', age: 30 }
17
+ */
18
+ declare function getCookie<T>(key: string): T | null;
19
+ /**
20
+ * Sets a cookie with a specified key, value, and options.
21
+ *
22
+ * @template T
23
+ * @param {string} key - The key of the cookie to set.
24
+ * @param {T} value - The value of the cookie to set.
25
+ * @param {CookieOptions} [options] - The options for the cookie.
26
+ *
27
+ * @example
28
+ * setCookie('user', { name: 'John', age: 30 }, { daysUntilExpiration: 7, sameSite: 'Lax', secure: true });
29
+ */
30
+ declare function setCookie<T>(key: string, value: T, options?: CookieOptions): void;
31
+ /**
32
+ * Removes a cookie by key.
33
+ *
34
+ * @param {string} key - The key of the cookie to remove.
35
+ * @param {Pick<CookieOptions, 'path' | 'domain'>} [options] - The options for the cookie removal.
36
+ *
37
+ * @example
38
+ * removeCookie('user');
39
+ */
40
+ declare function removeCookie(key: string, options?: Pick<CookieOptions, 'path' | 'domain'>): void;
41
+
42
+ export { type CookieOptions, getCookie, removeCookie, setCookie };
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(e,o)=>{for(var t in o)a(e,t,{get:o[t],enumerable:!0})},g=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of k(o))!m.call(e,r)&&r!==t&&a(e,r,{get:()=>o[r],enumerable:!(i=u(o,r))||i.enumerable});return e};var h=e=>g(a({},"__esModule",{value:!0}),e);var S={};f(S,{getCookie:()=>y,removeCookie:()=>x,setCookie:()=>C});module.exports=h(S);function y(e){if(!e||typeof e!="string")return console.warn("Invalid cookie key provided"),null;try{let o=`${e}=`,r=decodeURIComponent(document.cookie).split("; ").find(c=>c.startsWith(o));if(!r)return null;let n=r.substring(o.length);try{return JSON.parse(n)}catch{return n}}catch(o){return console.error("Error retrieving cookie:",o),null}}function C(e,o,t){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:i=0,sameSite:r="Strict",secure:n=!1,path:c="/",domain:d}=t??{};try{let s=encodeURIComponent(typeof o=="string"?o:JSON.stringify(o)),p=[`${e}=${s}`,`path=${c}`,r&&`SameSite=${r}`,n&&"Secure",d&&`domain=${d}`];if(i>0){let l=new Date(Date.now()+i*24*60*60*1e3);p.push(`expires=${l.toUTCString()}`)}document.cookie=p.filter(Boolean).join("; ")}catch(s){console.error("Error setting cookie:",s)}}function x(e,o){if(!e||typeof e!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:i}=o??{};try{let r=[`${e}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,i&&`domain=${i}`,"Secure"];document.cookie=r.filter(Boolean).join("; ")}catch(r){console.error("Error removing cookie:",r)}}0&&(module.exports={getCookie,removeCookie,setCookie});
@@ -0,0 +1 @@
1
+ export { CookieOptions, getCookie, removeCookie, setCookie } from './cookies.cjs';
@@ -1 +1 @@
1
- export * from './cookies';
1
+ function l(o){if(!o||typeof o!="string")return console.warn("Invalid cookie key provided"),null;try{let e=`${o}=`,r=decodeURIComponent(document.cookie).split("; ").find(c=>c.startsWith(e));if(!r)return null;let n=r.substring(e.length);try{return JSON.parse(n)}catch{return n}}catch(e){return console.error("Error retrieving cookie:",e),null}}function u(o,e,i){if(!o||typeof o!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:t=0,sameSite:r="Strict",secure:n=!1,path:c="/",domain:a}=i??{};try{let s=encodeURIComponent(typeof e=="string"?e:JSON.stringify(e)),d=[`${o}=${s}`,`path=${c}`,r&&`SameSite=${r}`,n&&"Secure",a&&`domain=${a}`];if(t>0){let p=new Date(Date.now()+t*24*60*60*1e3);d.push(`expires=${p.toUTCString()}`)}document.cookie=d.filter(Boolean).join("; ")}catch(s){console.error("Error setting cookie:",s)}}function k(o,e){if(!o||typeof o!="string"){console.error("Invalid cookie key provided");return}let{path:i="/",domain:t}=e??{};try{let r=[`${o}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${i}`,t&&`domain=${t}`,"Secure"];document.cookie=r.filter(Boolean).join("; ")}catch(r){console.error("Error removing cookie:",r)}}export{l as getCookie,k as removeCookie,u as setCookie};
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var l=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},a=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of p(o))!u.call(e,r)&&r!==t&&n(e,r,{get:()=>o[r],enumerable:!(i=m(o,r))||i.enumerable});return e};var c=e=>a(n({},"__esModule",{value:!0}),e);var b={};l(b,{pxToRem:()=>F,remToPx:()=>x,setFont:()=>g});module.exports=c(b);var s='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function g(e){return e?`"${e}", ${s}`:s}function x(e){let o=parseFloat(e);return Math.round(o*16)}function F(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}0&&(module.exports={pxToRem,remToPx,setFont});
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Sets the font family.
3
+ *
4
+ * @param {string} [fontName] - The name of the font to set.
5
+ * @returns {string} - The complete font family string.
6
+ *
7
+ * @example
8
+ * const fontFamily = setFont('CustomFont');
9
+ * console.log(fontFamily); // "CustomFont, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol""
10
+ */
11
+ declare function setFont(fontName?: string): string;
12
+ /**
13
+ * Converts rem to px.
14
+ *
15
+ * @param {string} value - The rem value to convert.
16
+ * @returns {number} - The equivalent value in pixels.
17
+ * @throws {Error} - Throws an error if the rem value is invalid.
18
+ *
19
+ * @example
20
+ * const pixels = remToPx('1.5rem');
21
+ * console.log(pixels); // 24
22
+ */
23
+ declare function remToPx(value: string): number;
24
+ /**
25
+ * Converts px to rem.
26
+ *
27
+ * @param {number} value - The pixel value to convert.
28
+ * @returns {string} - The equivalent value in rem.
29
+ * @throws {Error} - Throws an error if the pixel value is invalid.
30
+ *
31
+ * @example
32
+ * const remValue = pxToRem(24);
33
+ * console.log(remValue); // "1.5rem"
34
+ */
35
+ declare function pxToRem(value: number): string;
36
+
37
+ export { pxToRem, remToPx, setFont };
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var l=(e,o)=>{for(var t in o)n(e,t,{get:o[t],enumerable:!0})},a=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of p(o))!u.call(e,r)&&r!==t&&n(e,r,{get:()=>o[r],enumerable:!(i=m(o,r))||i.enumerable});return e};var c=e=>a(n({},"__esModule",{value:!0}),e);var F={};l(F,{pxToRem:()=>g,remToPx:()=>f,setFont:()=>x});module.exports=c(F);var s='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function x(e){return e?`"${e}", ${s}`:s}function f(e){let o=parseFloat(e);return Math.round(o*16)}function g(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}0&&(module.exports={pxToRem,remToPx,setFont});
@@ -0,0 +1 @@
1
+ export { pxToRem, remToPx, setFont } from './font.cjs';
@@ -1 +1 @@
1
- export * from './font';
1
+ var o='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function t(e){return e?`"${e}", ${o}`:o}function n(e){let r=parseFloat(e);return Math.round(r*16)}function i(e){if(typeof e!="number"||isNaN(e))throw new Error(`Invalid pixel value: ${e}`);return`${e/16}rem`}export{i as pxToRem,n as remToPx,t as setFont};
@@ -0,0 +1,9 @@
1
+ "use strict";var p=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var $=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!I.call(r,n)&&n!==t&&p(r,n,{get:()=>e[n],enumerable:!(o=T(e,n))||o.enumerable});return r};var v=r=>C(p({},"__esModule",{value:!0}),r);var G={};$(G,{createPaletteChannel:()=>V,getCookie:()=>B,getStorage:()=>D,hasKeys:()=>O,hasParams:()=>g,hexToRgbChannel:()=>h,isActiveLink:()=>F,isEqualPath:()=>A,isExternalLink:()=>d,localStorageAvailable:()=>y,mergeClasses:()=>R,pxToRem:()=>N,remToPx:()=>E,removeCookie:()=>j,removeLastSlash:()=>s,removeParams:()=>f,removeStorage:()=>J,setCookie:()=>L,setFont:()=>P,setStorage:()=>W,transformNumber:()=>M,transformValue:()=>x,transformValueOnBlur:()=>S,transformValueOnChange:()=>b,uuidv4:()=>U,varAlpha:()=>_});module.exports=v(G);var g=r=>{let e=r.split("?")[1];return e?new URLSearchParams(e).toString().length>0:!1};function s(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function A(r,e){return s(r)===s(e)}function f(r){try{let e=new URL(r,window.location.origin);return s(e.pathname)}catch{return r}}function d(r){return r.startsWith("http")}var m='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function P(r){return r?`"${r}", ${m}`:m}function E(r){let e=parseFloat(r);return Math.round(e*16)}function N(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function h(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let e=parseInt(r.substring(1,3),16),t=parseInt(r.substring(3,5),16),o=parseInt(r.substring(5,7),16);return`${e} ${t} ${o}`}function V(r){let e={};return Object.entries(r).forEach(([t,o])=>{o&&(e[`${t}Channel`]=h(o))}),{...r,...e}}function _(r,e=1){if(!r)throw new Error("[Alpha]: Color is undefined!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error(`[Alpha]: Unsupported color format "${r}".
2
+ Supported formats are:
3
+ - RGB channels: "0 184 217".
4
+ - CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)".
5
+ Unsupported formats are:
6
+ - Hex: "#00B8D9".
7
+ - RGB: "rgb(0, 184, 217)".
8
+ - RGBA: "rgba(0, 184, 217, 1)".
9
+ `);return`rgba(${r} / ${e})`}function O(r,e){return!r||!e.length||typeof r!="object"?!1:e.every(t=>t in r)}function U(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function R(r,e){let t=r?Array.isArray(r)?r:[r]:[],o=Object.entries(e||{}).filter(([n,i])=>i!==void 0&&i!==!1).map(([n,i])=>Array.isArray(i)?i[0]?i[1]:"":i?n:"").filter(Boolean);return[...t.filter(Boolean),...o].join(" ")}function B(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let e=`${r}=`,n=decodeURIComponent(document.cookie).split("; ").find(c=>c.startsWith(e));if(!n)return null;let i=n.substring(e.length);try{return JSON.parse(i)}catch{return i}}catch(e){return console.error("Error retrieving cookie:",e),null}}function L(r,e,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:o=0,sameSite:n="Strict",secure:i=!1,path:c="/",domain:u}=t??{};try{let a=encodeURIComponent(typeof e=="string"?e:JSON.stringify(e)),l=[`${r}=${a}`,`path=${c}`,n&&`SameSite=${n}`,i&&"Secure",u&&`domain=${u}`];if(o>0){let k=new Date(Date.now()+o*24*60*60*1e3);l.push(`expires=${k.toUTCString()}`)}document.cookie=l.filter(Boolean).join("; ")}catch(a){console.error("Error setting cookie:",a)}}function j(r,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:o}=e??{};try{let n=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,o&&`domain=${o}`,"Secure"];document.cookie=n.filter(Boolean).join("; ")}catch(n){console.error("Error removing cookie:",n)}}function F(r,e,t=!0){let o=s(r),n=g(e);if(e.startsWith("#")||d(e))return!1;if(t||n){let u=o.includes(e),a=f(e);return u||n&&a===o}return o===e}function D(r,e){if(!y())return e??null;let t=localStorage.getItem(r);if(t!=="undefined"){if(t)try{return JSON.parse(t)}catch{return t??e??null}return e??null}}function W(r,e){try{let t=JSON.stringify(e);window.localStorage.setItem(r,t)}catch(t){console.error("Error while setting storage:",t)}}function J(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function y(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function x(r,e=""){return r==null||typeof r=="number"&&Number.isNaN(r)?e:r.toString()}function b(r){let t=x(r).replace(/[^0-9.]/g,""),[o,...n]=t.split(".");return n.length>0?`${o}.${n.join("")}`:o}function S(r,e=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return e;let t=parseFloat(r.toString());return Number.isNaN(t)?e:t}var M={onChange:b,onBlur:S,value:x};0&&(module.exports={createPaletteChannel,getCookie,getStorage,hasKeys,hasParams,hexToRgbChannel,isActiveLink,isEqualPath,isExternalLink,localStorageAvailable,mergeClasses,pxToRem,remToPx,removeCookie,removeLastSlash,removeParams,removeStorage,setCookie,setFont,setStorage,transformNumber,transformValue,transformValueOnBlur,transformValueOnChange,uuidv4,varAlpha});
@@ -0,0 +1,10 @@
1
+ export { hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url/url.cjs';
2
+ export { pxToRem, remToPx, setFont } from './font/font.cjs';
3
+ export { ChannelPalette, InputPalette, createPaletteChannel, hexToRgbChannel, varAlpha } from './color/color.cjs';
4
+ export { hasKeys } from './object/object.cjs';
5
+ export { uuidv4 } from './uuidv4/uuidv4.cjs';
6
+ export { StateProps, mergeClasses } from './classes/classes.cjs';
7
+ export { CookieOptions, getCookie, removeCookie, setCookie } from './cookies/cookies.cjs';
8
+ export { isActiveLink } from './active-link/active-link.cjs';
9
+ export { getStorage, localStorageAvailable, removeStorage, setStorage } from './local-storage/local-storage.cjs';
10
+ export { InputValue, transformNumber, transformValue, transformValueOnBlur, transformValueOnChange } from './transform-number/transform-number.cjs';
@@ -1,10 +1,9 @@
1
- export * from './url';
2
- export * from './font';
3
- export * from './color';
4
- export * from './object';
5
- export * from './uuidv4';
6
- export * from './classes';
7
- export * from './cookies';
8
- export * from './active-link';
9
- export * from './local-storage';
10
- export * from './transform-number';
1
+ var p=r=>{let e=r.split("?")[1];return e?new URLSearchParams(e).toString().length>0:!1};function a(r){return r!=="/"&&r.endsWith("/")?r.slice(0,-1):r}function k(r,e){return a(r)===a(e)}function g(r){try{let e=new URL(r,window.location.origin);return a(e.pathname)}catch{return r}}function f(r){return r.startsWith("http")}var d='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';function w(r){return r?`"${r}", ${d}`:d}function I(r){let e=parseFloat(r);return Math.round(e*16)}function $(r){if(typeof r!="number"||isNaN(r))throw new Error(`Invalid pixel value: ${r}`);return`${r/16}rem`}function h(r){if(!r)throw new Error("Hex color is undefined!");if(!/^#[0-9A-F]{6}$/i.test(r))throw new Error(`Invalid hex color: ${r}`);let e=parseInt(r.substring(1,3),16),t=parseInt(r.substring(3,5),16),n=parseInt(r.substring(5,7),16);return`${e} ${t} ${n}`}function v(r){let e={};return Object.entries(r).forEach(([t,n])=>{n&&(e[`${t}Channel`]=h(n))}),{...r,...e}}function A(r,e=1){if(!r)throw new Error("[Alpha]: Color is undefined!");if(r.startsWith("#")||r.startsWith("rgb")||r.startsWith("rgba")||!r.includes("var")&&r.includes("Channel"))throw new Error(`[Alpha]: Unsupported color format "${r}".
2
+ Supported formats are:
3
+ - RGB channels: "0 184 217".
4
+ - CSS variables with "Channel" prefix: "var(--palette-common-blackChannel, #000000)".
5
+ Unsupported formats are:
6
+ - Hex: "#00B8D9".
7
+ - RGB: "rgb(0, 184, 217)".
8
+ - RGBA: "rgba(0, 184, 217, 1)".
9
+ `);return`rgba(${r} / ${e})`}function E(r,e){return!r||!e.length||typeof r!="object"?!1:e.every(t=>t in r)}function V(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function O(r,e){let t=r?Array.isArray(r)?r:[r]:[],n=Object.entries(e||{}).filter(([o,i])=>i!==void 0&&i!==!1).map(([o,i])=>Array.isArray(i)?i[0]?i[1]:"":i?o:"").filter(Boolean);return[...t.filter(Boolean),...n].join(" ")}function R(r){if(!r||typeof r!="string")return console.warn("Invalid cookie key provided"),null;try{let e=`${r}=`,o=decodeURIComponent(document.cookie).split("; ").find(c=>c.startsWith(e));if(!o)return null;let i=o.substring(e.length);try{return JSON.parse(i)}catch{return i}}catch(e){return console.error("Error retrieving cookie:",e),null}}function B(r,e,t){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{daysUntilExpiration:n=0,sameSite:o="Strict",secure:i=!1,path:c="/",domain:u}=t??{};try{let s=encodeURIComponent(typeof e=="string"?e:JSON.stringify(e)),l=[`${r}=${s}`,`path=${c}`,o&&`SameSite=${o}`,i&&"Secure",u&&`domain=${u}`];if(n>0){let m=new Date(Date.now()+n*24*60*60*1e3);l.push(`expires=${m.toUTCString()}`)}document.cookie=l.filter(Boolean).join("; ")}catch(s){console.error("Error setting cookie:",s)}}function L(r,e){if(!r||typeof r!="string"){console.error("Invalid cookie key provided");return}let{path:t="/",domain:n}=e??{};try{let o=[`${r}=`,"expires=Thu, 01 Jan 1970 00:00:00 GMT",`path=${t}`,n&&`domain=${n}`,"Secure"];document.cookie=o.filter(Boolean).join("; ")}catch(o){console.error("Error removing cookie:",o)}}function D(r,e,t=!0){let n=a(r),o=p(e);if(e.startsWith("#")||f(e))return!1;if(t||o){let u=n.includes(e),s=g(e);return u||o&&s===n}return n===e}function J(r,e){if(!y())return e??null;let t=localStorage.getItem(r);if(t!=="undefined"){if(t)try{return JSON.parse(t)}catch{return t??e??null}return e??null}}function M(r,e){try{let t=JSON.stringify(e);window.localStorage.setItem(r,t)}catch(t){console.error("Error while setting storage:",t)}}function G(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function y(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}function x(r,e=""){return r==null||typeof r=="number"&&Number.isNaN(r)?e:r.toString()}function b(r){let t=x(r).replace(/[^0-9.]/g,""),[n,...o]=t.split(".");return o.length>0?`${n}.${o.join("")}`:n}function S(r,e=""){if(r==null||typeof r=="number"&&Number.isNaN(r))return e;let t=parseFloat(r.toString());return Number.isNaN(t)?e:t}var K={onChange:b,onBlur:S,value:x};export{v as createPaletteChannel,R as getCookie,J as getStorage,E as hasKeys,p as hasParams,h as hexToRgbChannel,D as isActiveLink,k as isEqualPath,f as isExternalLink,y as localStorageAvailable,O as mergeClasses,$ as pxToRem,I as remToPx,L as removeCookie,a as removeLastSlash,g as removeParams,G as removeStorage,B as setCookie,w as setFont,M as setStorage,K as transformNumber,x as transformValue,S as transformValueOnBlur,b as transformValueOnChange,V as uuidv4,A as varAlpha};
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},u=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!c.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(a=l(e,t))||a.enumerable});return r};var d=r=>u(n({},"__esModule",{value:!0}),r);var w={};g(w,{getStorage:()=>m,localStorageAvailable:()=>i,removeStorage:()=>_,setStorage:()=>f});module.exports=d(w);function m(r,e){if(!i())return e??null;let o=localStorage.getItem(r);if(o!=="undefined"){if(o)try{return JSON.parse(o)}catch{return o??e??null}return e??null}}function f(r,e){try{let o=JSON.stringify(e);window.localStorage.setItem(r,o)}catch(o){console.error("Error while setting storage:",o)}}function _(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function i(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}0&&(module.exports={getStorage,localStorageAvailable,removeStorage,setStorage});
@@ -0,0 +1 @@
1
+ export { getStorage, localStorageAvailable, removeStorage, setStorage } from './local-storage.cjs';
@@ -1 +1 @@
1
- export * from './local-storage';
1
+ function n(r,o){if(!t())return o??null;let e=localStorage.getItem(r);if(e!=="undefined"){if(e)try{return JSON.parse(e)}catch{return e??o??null}return o??null}}function a(r,o){try{let e=JSON.stringify(o);window.localStorage.setItem(r,e)}catch(e){console.error("Error while setting storage:",e)}}function i(r){try{window.localStorage.removeItem(r)}catch(o){console.error("Error while removing from storage:",o)}}function t(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}export{n as getStorage,t as localStorageAvailable,i as removeStorage,a as setStorage};
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},u=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of s(e))!c.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(a=l(e,t))||a.enumerable});return r};var d=r=>u(n({},"__esModule",{value:!0}),r);var w={};g(w,{getStorage:()=>m,localStorageAvailable:()=>i,removeStorage:()=>f,setStorage:()=>_});module.exports=d(w);function m(r,e){if(!i())return e??null;let o=localStorage.getItem(r);if(o!=="undefined"){if(o)try{return JSON.parse(o)}catch{return o??e??null}return e??null}}function _(r,e){try{let o=JSON.stringify(e);window.localStorage.setItem(r,o)}catch(o){console.error("Error while setting storage:",o)}}function f(r){try{window.localStorage.removeItem(r)}catch(e){console.error("Error while removing from storage:",e)}}function i(){try{let r="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(r,r),window.localStorage.removeItem(r),!0}catch{return!1}}0&&(module.exports={getStorage,localStorageAvailable,removeStorage,setStorage});
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Retrieves a value from local storage by key.
3
+ *
4
+ * @param {string} key - The key of the item to retrieve.
5
+ * @returns {any | null} - The parsed value of the item, or null if not found or an error occurs.
6
+ *
7
+ * @example
8
+ * const user = getStorage('user');
9
+ * console.log(user); // { name: 'John', age: 30 }
10
+ */
11
+ declare function getStorage<T>(key: string, defaultValue?: T): T | null | undefined;
12
+ /**
13
+ * Sets a value in local storage with a specified key.
14
+ *
15
+ * @template T
16
+ * @param {string} key - The key of the item to set.
17
+ * @param {T} value - The value of the item to set.
18
+ *
19
+ * @example
20
+ * setStorage('user', { name: 'John', age: 30 });
21
+ */
22
+ declare function setStorage<T>(key: string, value: T): void;
23
+ /**
24
+ * Removes an item from local storage by key.
25
+ *
26
+ * @param {string} key - The key of the item to remove.
27
+ *
28
+ * @example
29
+ * removeStorage('user');
30
+ */
31
+ declare function removeStorage(key: string): void;
32
+ /**
33
+ * Checks if local storage is available.
34
+ *
35
+ * @returns {boolean} - True if local storage is available, false otherwise.
36
+ *
37
+ * @example
38
+ * const isAvailable = localStorageAvailable();
39
+ * console.log(isAvailable); // true or false
40
+ */
41
+ declare function localStorageAvailable(): boolean;
42
+
43
+ export { getStorage, localStorageAvailable, removeStorage, setStorage };
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},p=(n,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!u.call(n,t)&&t!==r&&f(n,t,{get:()=>e[t],enumerable:!(o=i(e,t))||o.enumerable});return n};var s=n=>p(f({},"__esModule",{value:!0}),n);var T={};a(T,{hasKeys:()=>y});module.exports=s(T);function y(n,e){return!n||!e.length||typeof n!="object"?!1:e.every(r=>r in n)}0&&(module.exports={hasKeys});
@@ -0,0 +1 @@
1
+ export { hasKeys } from './object.cjs';
@@ -1 +1 @@
1
- export * from './object';
1
+ function t(e,n){return!e||!n.length||typeof e!="object"?!1:n.every(r=>r in e)}export{t as hasKeys};
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(n,e)=>{for(var t in e)f(n,t,{get:e[t],enumerable:!0})},s=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!u.call(n,r)&&r!==t&&f(n,r,{get:()=>e[r],enumerable:!(i=l(e,r))||i.enumerable});return n};var y=n=>s(f({},"__esModule",{value:!0}),n);var c={};a(c,{hasKeys:()=>T});module.exports=y(c);function T(n,e){return!n||!e.length||typeof n!="object"?!1:e.every(t=>t in n)}0&&(module.exports={hasKeys});
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Checks if the given object contains all the specified keys.
3
+ *
4
+ * @template T - The type of the object.
5
+ * @param {T} obj - The object to check.
6
+ * @param {Array<keyof T>} keys - An array of keys to check for in the object.
7
+ * @returns {boolean} - Returns true if the object contains all the specified keys, otherwise false.
8
+ *
9
+ * @example
10
+ * const settings = {
11
+ * fontFamily: 'Arial',
12
+ * compactLayout: true,
13
+ * direction: 'ltr',
14
+ * colorScheme: 'light',
15
+ * contrast: 'default',
16
+ * navColor: 'integrate',
17
+ * navLayout: 'vertical',
18
+ * primaryColor: 'blue',
19
+ *};
20
+ *
21
+ * console.log(hasKeys(settings, ['fontFamily', 'direction'])); // true
22
+ * console.log(hasKeys(settings, ['test'])); // false
23
+ */
24
+ declare function hasKeys<T>(obj: T | null | undefined, keys: (keyof T | string)[]): boolean;
25
+
26
+ export { hasKeys };
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var t in r)i(n,t,{get:r[t],enumerable:!0})},p=(n,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of f(r))!g.call(n,e)&&e!==t&&i(n,e,{get:()=>r[e],enumerable:!(u=m(r,e))||u.enumerable});return n};var c=n=>p(i({},"__esModule",{value:!0}),n);var N={};l(N,{transformNumber:()=>b,transformValue:()=>o,transformValueOnBlur:()=>a,transformValueOnChange:()=>s});module.exports=c(N);function o(n,r=""){return n==null||typeof n=="number"&&Number.isNaN(n)?r:n.toString()}function s(n){let t=o(n).replace(/[^0-9.]/g,""),[u,...e]=t.split(".");return e.length>0?`${u}.${e.join("")}`:u}function a(n,r=""){if(n==null||typeof n=="number"&&Number.isNaN(n))return r;let t=parseFloat(n.toString());return Number.isNaN(t)?r:t}var b={onChange:s,onBlur:a,value:o};0&&(module.exports={transformNumber,transformValue,transformValueOnBlur,transformValueOnChange});
@@ -0,0 +1 @@
1
+ export { InputValue, transformNumber, transformValue, transformValueOnBlur, transformValueOnChange } from './transform-number.cjs';
@@ -1 +1 @@
1
- export * from './transform-number';
1
+ function i(n,r=""){return n==null||typeof n=="number"&&Number.isNaN(n)?r:n.toString()}function o(n){let t=i(n).replace(/[^0-9.]/g,""),[e,...u]=t.split(".");return u.length>0?`${e}.${u.join("")}`:e}function s(n,r=""){if(n==null||typeof n=="number"&&Number.isNaN(n))return r;let t=parseFloat(n.toString());return Number.isNaN(t)?r:t}var a={onChange:o,onBlur:s,value:i};export{a as transformNumber,i as transformValue,s as transformValueOnBlur,o as transformValueOnChange};
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var c=(n,r)=>{for(var t in r)i(n,t,{get:r[t],enumerable:!0})},f=(n,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of g(r))!l.call(n,e)&&e!==t&&i(n,e,{get:()=>r[e],enumerable:!(u=m(r,e))||u.enumerable});return n};var p=n=>f(i({},"__esModule",{value:!0}),n);var N={};c(N,{transformNumber:()=>b,transformValue:()=>o,transformValueOnBlur:()=>a,transformValueOnChange:()=>s});module.exports=p(N);function o(n,r=""){return n==null||typeof n=="number"&&Number.isNaN(n)?r:n.toString()}function s(n){let t=o(n).replace(/[^0-9.]/g,""),[u,...e]=t.split(".");return e.length>0?`${u}.${e.join("")}`:u}function a(n,r=""){if(n==null||typeof n=="number"&&Number.isNaN(n))return r;let t=parseFloat(n.toString());return Number.isNaN(t)?r:t}var b={onChange:s,onBlur:a,value:o};0&&(module.exports={transformNumber,transformValue,transformValueOnBlur,transformValueOnChange});
@@ -0,0 +1,31 @@
1
+ type InputValue = string | number | null | undefined;
2
+ /**
3
+ * Transforms the input value to a string.
4
+ *
5
+ * @param {InputValue} value - The value to transform.
6
+ * @param {string} [defaultValue=''] - The default value to return if the input value is null, undefined, or NaN.
7
+ * @returns {string} - The transformed string value.
8
+ */
9
+ declare function transformValue(value: InputValue, defaultValue?: string): string;
10
+ /**
11
+ * Transforms the output value on change event.
12
+ *
13
+ * @param {string | number} value - The value to transform.
14
+ * @returns {string} - The cleaned and transformed value.
15
+ */
16
+ declare function transformValueOnChange(value: string | number): string;
17
+ /**
18
+ * Transforms the output value on blur event.
19
+ *
20
+ * @param {InputValue} value - The value to transform.
21
+ * @param {string | number} [defaultValue=''] - The default value to return if the input value is null, undefined, or NaN.
22
+ * @returns {string | number} - The transformed numeric value or the default value.
23
+ */
24
+ declare function transformValueOnBlur(value: InputValue, defaultValue?: string | number): string | number;
25
+ declare const transformNumber: {
26
+ onChange: typeof transformValueOnChange;
27
+ onBlur: typeof transformValueOnBlur;
28
+ value: typeof transformValue;
29
+ };
30
+
31
+ export { type InputValue, transformNumber, transformValue, transformValueOnBlur, transformValueOnChange };
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},l=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of u(r))!c.call(t,n)&&n!==e&&i(t,n,{get:()=>r[n],enumerable:!(s=a(r,n))||s.enumerable});return t};var f=t=>l(i({},"__esModule",{value:!0}),t);var m={};g(m,{hasParams:()=>h,isEqualPath:()=>x,isExternalLink:()=>b,removeLastSlash:()=>o,removeParams:()=>p});module.exports=f(m);var h=t=>{let r=t.split("?")[1];return r?new URLSearchParams(r).toString().length>0:!1};function o(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function x(t,r){return o(t)===o(r)}function p(t){try{let r=new URL(t,window.location.origin);return o(r.pathname)}catch{return t}}function b(t){return t.startsWith("http")}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams});
@@ -0,0 +1 @@
1
+ export { hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams } from './url.cjs';
@@ -1 +1 @@
1
- export * from './url';
1
+ var e=t=>{let r=t.split("?")[1];return r?new URLSearchParams(r).toString().length>0:!1};function n(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function o(t,r){return n(t)===n(r)}function i(t){try{let r=new URL(t,window.location.origin);return n(r.pathname)}catch{return t}}function s(t){return t.startsWith("http")}export{e as hasParams,o as isEqualPath,s as isExternalLink,n as removeLastSlash,i as removeParams};
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(t,r)=>{for(var e in r)o(t,e,{get:r[e],enumerable:!0})},l=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of u(r))!c.call(t,n)&&n!==e&&o(t,n,{get:()=>r[n],enumerable:!(s=a(r,n))||s.enumerable});return t};var h=t=>l(o({},"__esModule",{value:!0}),t);var w={};g(w,{hasParams:()=>f,isEqualPath:()=>x,isExternalLink:()=>b,removeLastSlash:()=>i,removeParams:()=>p});module.exports=h(w);var f=t=>{let r=t.split("?")[1];return r?new URLSearchParams(r).toString().length>0:!1};function i(t){return t!=="/"&&t.endsWith("/")?t.slice(0,-1):t}function x(t,r){return i(t)===i(r)}function p(t){try{let r=new URL(t,window.location.origin);return i(r.pathname)}catch{return t}}function b(t){return t.startsWith("http")}0&&(module.exports={hasParams,isEqualPath,isExternalLink,removeLastSlash,removeParams});
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Checks if a URL has query parameters.
3
+ *
4
+ * @param {string} url - The URL to check.
5
+ * @returns {boolean} - True if the URL has query parameters, false otherwise.
6
+ *
7
+ * @example
8
+ * const hasQueryParams = hasParams('https://example.com?page=1');
9
+ * console.log(hasQueryParams); // true
10
+ */
11
+ declare const hasParams: (url: string) => boolean;
12
+ /**
13
+ * Removes the trailing slash from a pathname if it exists.
14
+ *
15
+ * @param {string} pathname - The pathname to process.
16
+ * @returns {string} - The pathname without the trailing slash.
17
+ *
18
+ * @example
19
+ * const cleanPathname = removeLastSlash('/dashboard/calendar/');
20
+ * console.log(cleanPathname); // '/dashboard/calendar'
21
+ */
22
+ declare function removeLastSlash(pathname: string): string;
23
+ /**
24
+ * Checks if two URLs have the same path.
25
+ *
26
+ * @param {string} targetUrl - The target URL to compare.
27
+ * @param {string} pathname - The pathname to compare.
28
+ * @returns {boolean} - True if the paths are equal, false otherwise.
29
+ */
30
+ declare function isEqualPath(targetUrl: string, pathname: string): boolean;
31
+ /**
32
+ * Removes query parameters from a URL.
33
+ *
34
+ * @param {string} url - The URL to process.
35
+ * @returns {string} - The URL without query parameters.
36
+ *
37
+ * @example
38
+ * const cleanUrl = removeParams('https://example.com/page?param=value');
39
+ * console.log(cleanUrl); // 'https://example.com/page'
40
+ */
41
+ declare function removeParams(url: string): string;
42
+ /**
43
+ * Checks if a URL is an external link.
44
+ *
45
+ * @param {string} url - The URL to check.
46
+ * @returns {boolean} - True if the URL is an external link, false otherwise.
47
+ *
48
+ * @example
49
+ * const isExternal = isExternalLink('https://example.com');
50
+ * console.log(isExternal); // true
51
+ */
52
+ declare function isExternalLink(url: string): boolean;
53
+
54
+ export { hasParams, isEqualPath, isExternalLink, removeLastSlash, removeParams };
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var a=(r,x)=>{for(var t in x)o(r,t,{get:x[t],enumerable:!0})},g=(r,x,t,e)=>{if(x&&typeof x=="object"||typeof x=="function")for(let n of c(x))!i.call(r,n)&&n!==t&&o(r,n,{get:()=>x[n],enumerable:!(e=u(x,n))||e.enumerable});return r};var p=r=>g(o({},"__esModule",{value:!0}),r);var v={};a(v,{uuidv4:()=>s});module.exports=p(v);function s(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let x=Math.random()*16|0;return(r==="x"?x:x&3|8).toString(16)})}0&&(module.exports={uuidv4});
@@ -0,0 +1 @@
1
+ export { uuidv4 } from './uuidv4.cjs';
@@ -1 +1 @@
1
- export * from './uuidv4';
1
+ function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let x=Math.random()*16|0;return(r==="x"?x:x&3|8).toString(16)})}export{n as uuidv4};
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var a=(r,x)=>{for(var t in x)o(r,t,{get:x[t],enumerable:!0})},g=(r,x,t,e)=>{if(x&&typeof x=="object"||typeof x=="function")for(let n of c(x))!i.call(r,n)&&n!==t&&o(r,n,{get:()=>x[n],enumerable:!(e=u(x,n))||e.enumerable});return r};var s=r=>g(o({},"__esModule",{value:!0}),r);var d={};a(d,{uuidv4:()=>v});module.exports=s(d);function v(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let x=Math.random()*16|0;return(r==="x"?x:x&3|8).toString(16)})}0&&(module.exports={uuidv4});
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates a UUID (version 4).
3
+ *
4
+ * @returns {string} - A randomly generated UUID.
5
+ *
6
+ * @example
7
+ * const id = uuidv4();
8
+ * console.log(id); // '3b12f1df-1c3a-4f3b-8f3d-3f3b1c3a4f3b'
9
+ */
10
+ declare function uuidv4(): string;
11
+
12
+ export { uuidv4 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "minimal-shared",
3
3
  "author": "Minimals",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "Shared hooks and utils used by Mnimal UI and Zone UI.",
6
6
  "keywords": [
7
7
  "typescript",