@zydon/common 2.0.21 → 2.0.22

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.
@@ -4,6 +4,6 @@ type ReturnType = {
4
4
  copy: CopyFn;
5
5
  copiedText: CopiedValue;
6
6
  };
7
- declare function useCopyToClipboard(): ReturnType;
7
+ declare const useCopyToClipboard: () => ReturnType;
8
8
 
9
9
  export { useCopyToClipboard as default };
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react';
2
2
 
3
- function p(){let[o,e]=useState(null);return {copiedText:o,copy:async t=>{if(!navigator?.clipboard)return !1;try{return await navigator.clipboard.writeText(t),e(t),!0}catch{return e(null),!1}}}}var u=p;
3
+ var p=()=>{let[o,e]=useState(null);return {copiedText:o,copy:async t=>{if(!navigator?.clipboard)return !1;try{return await navigator.clipboard.writeText(t),e(t),!0}catch{return e(null),!1}}}},l=p;
4
4
 
5
- export { u as default };
5
+ export { l as default };
@@ -10,6 +10,6 @@ type UseLocalStorageOptions<T> = {
10
10
  deserializer?: (value: string) => T;
11
11
  initializeWithValue?: boolean;
12
12
  };
13
- declare function useLocalStorage<T>(key: string, initialValue: T | (() => T), options?: UseLocalStorageOptions<T>): [T, Dispatch<SetStateAction<T>>, () => void];
13
+ declare const useLocalStorage: <T>(key: string, initialValue: T | (() => T), options?: UseLocalStorageOptions<T>) => [T, Dispatch<SetStateAction<T>>, () => void];
14
14
 
15
15
  export { useLocalStorage as default };
@@ -3,6 +3,6 @@ import '../chunk-3APKMSVD.js';
3
3
  import { a as a$1 } from '../chunk-4INDXVIX.js';
4
4
  import { useCallback, useState, useEffect } from 'react';
5
5
 
6
- var h=typeof window>"u";function p(r,t,o={}){let{initializeWithValue:g=!0}=o,S=useCallback(e=>o.serializer?o.serializer(e):JSON.stringify(e),[o]),d=useCallback(e=>{if(o.deserializer)return o.deserializer(e);if(e==="undefined")return;let n=t instanceof Function?t():t,f;try{f=JSON.parse(e);}catch{return n}return f},[o,t]),a$2=useCallback(()=>{let e=t instanceof Function?t():t;if(h)return e;try{let n=window.localStorage.getItem(r);return n?d(n):e}catch{return e}},[t,r,d]),[w,s]=useState(()=>g?a$2():t instanceof Function?t():t),T=a(e=>{try{let n=e instanceof Function?e(a$2()):e;window.localStorage.setItem(r,S(n)),s(n),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));}catch{}})||(()=>null),m=a(()=>{let e=t instanceof Function?t():t;window.localStorage.removeItem(r),s(e),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));})||(()=>null);useEffect(()=>{s(a$2());},[r]);let l=useCallback(e=>{e.key&&e.key!==r||s(a$2());},[r,a$2]);return a$1("storage",l),a$1("local-storage",l),[w,T,m]}
6
+ var h=typeof window>"u",p=(r,t,o={})=>{let{initializeWithValue:l=!0}=o,S=useCallback(e=>o.serializer?o.serializer(e):JSON.stringify(e),[o]),d=useCallback(e=>{if(o.deserializer)return o.deserializer(e);if(e==="undefined")return;let n=t instanceof Function?t():t,g;try{g=JSON.parse(e);}catch{return n}return g},[o,t]),a$2=useCallback(()=>{let e=t instanceof Function?t():t;if(h)return e;try{let n=window.localStorage.getItem(r);return n?d(n):e}catch{return e}},[t,r,d]),[w,s]=useState(()=>l?a$2():t instanceof Function?t():t),T=a(e=>{try{let n=e instanceof Function?e(a$2()):e;window.localStorage.setItem(r,S(n)),s(n),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));}catch{}}),m=a(()=>{let e=t instanceof Function?t():t;window.localStorage.removeItem(r),s(e),window.dispatchEvent(new StorageEvent("local-storage",{key:r}));});useEffect(()=>{s(a$2());},[r]);let f=useCallback(e=>{e.key&&e.key!==r||s(a$2());},[r,a$2]);return a$1("storage",f),a$1("local-storage",f),[w,T,m]},I=p;
7
7
 
8
- export { p as default };
8
+ export { I as default };
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
 
3
- declare function useTabs(defaultValue?: string | number): {
3
+ declare const useTabs: (defaultValue?: string | number) => {
4
4
  currentTab: string | number;
5
5
  onChangeTab: (_: React.SyntheticEvent<Element, Event>, newValue: string) => void;
6
6
  setCurrentTab: react.Dispatch<react.SetStateAction<string | number>>;
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react';
2
2
 
3
- function u(e=""){let[n,t]=useState(e);return {currentTab:n,onChangeTab:(s,r)=>{t(r);},setCurrentTab:t}}
3
+ var s=(e="")=>{let[n,t]=useState(e);return {currentTab:n,onChangeTab:(u,r)=>{t(r);},setCurrentTab:t}},b=s;
4
4
 
5
- export { u as default };
5
+ export { b as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.0.21",
3
+ "version": "2.0.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",