@redneckz/wildless-cms-uni-blocks 0.14.570 → 0.14.571

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.
@@ -0,0 +1 @@
1
+ export declare function useLocalStorage<T>(key: string): [T | null, (value: T) => void];
@@ -0,0 +1 @@
1
+ export declare function useLocalStorage<T>(key: string): [T | null, (value: T) => void];
@@ -0,0 +1,13 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.useLocalStorage = void 0;
3
+ const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
4
+ function useLocalStorage(key) {
5
+ const [storedValue, setStoredValue] = (0, hooks_1.useState)(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
6
+ const setValue = (0, hooks_1.useCallback)((value) => {
7
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
8
+ setStoredValue(value);
9
+ }, [key, globalThis.localStorage]);
10
+ return [storedValue, setValue];
11
+ }
12
+ exports.useLocalStorage = useLocalStorage;
13
+ //# sourceMappingURL=useLocalStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalStorage.js","sourceRoot":"","sources":["../../src/hooks/useLocalStorage.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,SAAgB,eAAe,CAAI,GAAW;IAC5C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAC5C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAa,CACxE,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAC1B,CAAC,KAAQ,EAAE,EAAE;QACX,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,cAAc,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,EACD,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,CAC/B,CAAC;IAEF,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACjC,CAAC;AAdD,0CAcC"}
@@ -0,0 +1 @@
1
+ export declare function useLocalStorage<T>(key: string): [T | null, (value: T) => void];
@@ -0,0 +1,10 @@
1
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ export function useLocalStorage(key) {
3
+ const [storedValue, setStoredValue] = useState(JSON.parse(globalThis.localStorage?.getItem(key) || 'null'));
4
+ const setValue = useCallback((value) => {
5
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
6
+ setStoredValue(value);
7
+ }, [key, globalThis.localStorage]);
8
+ return [storedValue, setValue];
9
+ }
10
+ //# sourceMappingURL=useLocalStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalStorage.js","sourceRoot":"","sources":["../../src/hooks/useLocalStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,UAAU,eAAe,CAAI,GAAW;IAC5C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAC5C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAa,CACxE,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAQ,EAAE,EAAE;QACX,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,cAAc,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,EACD,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,CAC/B,CAAC;IAEF,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AACjC,CAAC"}
@@ -6311,7 +6311,7 @@
6311
6311
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6312
6312
  });
6313
6313
 
6314
- const packageVersion = "0.14.569";
6314
+ const packageVersion = "0.14.570";
6315
6315
 
6316
6316
  exports.Blocks = Blocks;
6317
6317
  exports.ContentPage = ContentPage;