@reactuses/core 5.0.19 → 5.0.21

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/dist/index.cjs CHANGED
@@ -114,6 +114,18 @@ function useEventListener(eventName, handler, element, options = defaultOptions$
114
114
  ]);
115
115
  }
116
116
 
117
+ const useMount = (fn)=>{
118
+ if (isDev) {
119
+ if (!isFunction(fn)) {
120
+ console.error(`useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`);
121
+ }
122
+ }
123
+ React.useEffect(()=>{
124
+ fn == null ? void 0 : fn();
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps
126
+ }, []);
127
+ };
128
+
117
129
  const useActiveElement = ()=>{
118
130
  const [active, setActive] = React.useState(null);
119
131
  const listener = React.useCallback(()=>{
@@ -122,6 +134,10 @@ const useActiveElement = ()=>{
122
134
  }, []);
123
135
  useEventListener('blur', listener, ()=>window, true);
124
136
  useEventListener('focus', listener, ()=>window, true);
137
+ useMount(()=>{
138
+ var _window;
139
+ setActive((_window = window) == null ? void 0 : _window.document.activeElement);
140
+ });
125
141
  return active;
126
142
  };
127
143
 
@@ -546,7 +562,7 @@ function guessSerializerType(rawInit) {
546
562
 
547
563
  const StorageSerializers = {
548
564
  boolean: {
549
- read: (v)=>v === 'true',
565
+ read: (v)=>v === "true",
550
566
  write: (v)=>String(v)
551
567
  },
552
568
  object: {
@@ -595,14 +611,15 @@ function getInitialState$3(key, defaultValue, storage, serializer, onError) {
595
611
  }
596
612
  }
597
613
  // A default value has not been provided, and you are rendering on the server, warn of a possible hydration mismatch when defaulting to false.
598
- if (process.env.NODE_ENV !== 'production') {
599
- console.warn('`createStorage` When server side rendering, defaultValue should be defined to prevent a hydration mismatches.');
614
+ if (process.env.NODE_ENV !== "production") {
615
+ console.warn("`createStorage` When server side rendering, defaultValue should be defined to prevent a hydration mismatches.");
600
616
  }
601
617
  return null;
602
618
  }
603
619
  function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStorage : undefined, options = defaultOptions$1) {
604
620
  let storage;
605
- const { onError = defaultOnError, effectStorageValue } = options;
621
+ const { onError = defaultOnError, effectStorageValue, mountStorageValue, listenToStorageChanges = true } = options;
622
+ const storageValue = mountStorageValue != null ? mountStorageValue : effectStorageValue;
606
623
  try {
607
624
  storage = getStorage();
608
625
  } catch (err) {
@@ -614,7 +631,7 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
614
631
  const [state, setState] = React.useState(getInitialState$3(key, defaultValue, storage, serializer, onError));
615
632
  useDeepCompareEffect(()=>{
616
633
  var _ref;
617
- const data = (_ref = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue) != null ? _ref : null;
634
+ const data = (_ref = storageValue ? isFunction(storageValue) ? storageValue() : storageValue : defaultValue) != null ? _ref : null;
618
635
  const getStoredValue = ()=>{
619
636
  try {
620
637
  const raw = storage == null ? void 0 : storage.getItem(key);
@@ -634,7 +651,7 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
634
651
  serializer,
635
652
  storage,
636
653
  onError,
637
- effectStorageValue
654
+ storageValue
638
655
  ]);
639
656
  const updateState = useEvent((valOrFunc)=>{
640
657
  const currentState = isFunction(valOrFunc) ? valOrFunc(state) : valOrFunc;
@@ -649,6 +666,28 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
649
666
  }
650
667
  }
651
668
  });
669
+ const listener = useEvent(()=>{
670
+ try {
671
+ const raw = storage == null ? void 0 : storage.getItem(key);
672
+ if (raw !== undefined && raw !== null) {
673
+ updateState(serializer.read(raw));
674
+ } else {
675
+ updateState(null);
676
+ }
677
+ } catch (e) {
678
+ onError(e);
679
+ }
680
+ });
681
+ React.useEffect(()=>{
682
+ if (listenToStorageChanges) {
683
+ window.addEventListener("storage", listener);
684
+ return ()=>window.removeEventListener("storage", listener);
685
+ }
686
+ return ()=>{};
687
+ }, [
688
+ listenToStorageChanges,
689
+ listener
690
+ ]);
652
691
  return [
653
692
  state,
654
693
  updateState
@@ -661,7 +700,7 @@ const useDarkMode = (options)=>{
661
700
  return window.matchMedia('(prefers-color-scheme: dark)').matches;
662
701
  };
663
702
  const [dark, setDark] = useStorage(storageKey, defaultValue, storage, {
664
- effectStorageValue: value
703
+ mountStorageValue: value
665
704
  });
666
705
  React.useEffect(()=>{
667
706
  var _window;
@@ -1334,18 +1373,6 @@ const useFirstMountState = ()=>{
1334
1373
  return isFirst.current;
1335
1374
  };
1336
1375
 
1337
- const useMount = (fn)=>{
1338
- if (isDev) {
1339
- if (!isFunction(fn)) {
1340
- console.error(`useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`);
1341
- }
1342
- }
1343
- React.useEffect(()=>{
1344
- fn == null ? void 0 : fn();
1345
- // eslint-disable-next-line react-hooks/exhaustive-deps
1346
- }, []);
1347
- };
1348
-
1349
1376
  const useFocus = (target, initialValue = false)=>{
1350
1377
  const [focus, innerSetFocus] = React.useState(initialValue);
1351
1378
  useEventListener('focus', ()=>innerSetFocus(true), target);
package/dist/index.d.cts CHANGED
@@ -1448,19 +1448,33 @@ interface Serializer<T> {
1448
1448
  }
1449
1449
  interface UseStorageOptions<T> {
1450
1450
  /**
1451
- * Custom data serialization
1451
+ * @en Custom data serialization
1452
+ * @zh 自定义数据序列化
1452
1453
  */
1453
1454
  serializer?: Serializer<T>;
1454
1455
  /**
1455
- * On error callback
1456
- *
1457
- * Default log error to `console.error`
1456
+ * @en On error callback
1457
+ * @zh 错误回调
1458
+ * @defaultValue `console.error`
1458
1459
  */
1459
1460
  onError?: (error: unknown) => void;
1460
1461
  /**
1461
- * set to storage when nodata in effect, fallback to defaults
1462
+ * @en set to storage when nodata in first mount
1463
+ * @zh 首次挂载时没有数据时设置到 storage
1464
+ * @deprecated
1462
1465
  */
1463
1466
  effectStorageValue?: T | (() => T);
1467
+ /**
1468
+ * @en set to storage when nodata in first mount
1469
+ * @zh 首次挂载时没有数据时设置到 storage
1470
+ */
1471
+ mountStorageValue?: T | (() => T);
1472
+ /**
1473
+ * @en listen to storage changes
1474
+ * @zh 监听 storage 变化
1475
+ * @defaultValue `true`
1476
+ */
1477
+ listenToStorageChanges?: boolean;
1464
1478
  }
1465
1479
 
1466
1480
  declare function useLocalStorage(key: string, defaults: string, options?: UseStorageOptions<string>): readonly [string | null, Dispatch<SetStateAction<string | null>>];
@@ -3117,10 +3131,22 @@ interface UseLocalStorageOptions<T> {
3117
3131
  */
3118
3132
  onError?: (error: unknown) => void;
3119
3133
  /**
3120
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3121
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3134
+ * @en set to storage when nodata in first mount, deprecated
3135
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3136
+ * @deprecated
3122
3137
  */
3123
3138
  effectStorageValue?: T | (() => T);
3139
+ /**
3140
+ * @en set to storage when nodata in first mount
3141
+ * @zh 首次挂载时没有数据时设置到 storage
3142
+ */
3143
+ mountStorageValue?: T | (() => T);
3144
+ /**
3145
+ * @en listen to storage changes
3146
+ * @zh 监听 storage 变化
3147
+ * @defaultValue `true`
3148
+ */
3149
+ listenToStorageChanges?: boolean;
3124
3150
  }
3125
3151
  /**
3126
3152
  * @title UseLocalStorageSerializer
@@ -3262,10 +3288,22 @@ interface UseSessionStorageOptions<T> {
3262
3288
  */
3263
3289
  onError?: (error: unknown) => void;
3264
3290
  /**
3265
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3266
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3291
+ * @en set to storage when nodata in first mount, deprecated
3292
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3293
+ * @deprecated
3267
3294
  */
3268
3295
  effectStorageValue?: T | (() => T);
3296
+ /**
3297
+ * @en set to storage when nodata in first mount
3298
+ * @zh 首次挂载时没有数据时设置到 storage
3299
+ */
3300
+ mountStorageValue?: T | (() => T);
3301
+ /**
3302
+ * @en listen to storage changes
3303
+ * @zh 监听 storage 变化
3304
+ * @defaultValue `true`
3305
+ */
3306
+ listenToStorageChanges?: boolean;
3269
3307
  }
3270
3308
  /**
3271
3309
  * @title UseSessionStorageSerializer
package/dist/index.d.mts CHANGED
@@ -1448,19 +1448,33 @@ interface Serializer<T> {
1448
1448
  }
1449
1449
  interface UseStorageOptions<T> {
1450
1450
  /**
1451
- * Custom data serialization
1451
+ * @en Custom data serialization
1452
+ * @zh 自定义数据序列化
1452
1453
  */
1453
1454
  serializer?: Serializer<T>;
1454
1455
  /**
1455
- * On error callback
1456
- *
1457
- * Default log error to `console.error`
1456
+ * @en On error callback
1457
+ * @zh 错误回调
1458
+ * @defaultValue `console.error`
1458
1459
  */
1459
1460
  onError?: (error: unknown) => void;
1460
1461
  /**
1461
- * set to storage when nodata in effect, fallback to defaults
1462
+ * @en set to storage when nodata in first mount
1463
+ * @zh 首次挂载时没有数据时设置到 storage
1464
+ * @deprecated
1462
1465
  */
1463
1466
  effectStorageValue?: T | (() => T);
1467
+ /**
1468
+ * @en set to storage when nodata in first mount
1469
+ * @zh 首次挂载时没有数据时设置到 storage
1470
+ */
1471
+ mountStorageValue?: T | (() => T);
1472
+ /**
1473
+ * @en listen to storage changes
1474
+ * @zh 监听 storage 变化
1475
+ * @defaultValue `true`
1476
+ */
1477
+ listenToStorageChanges?: boolean;
1464
1478
  }
1465
1479
 
1466
1480
  declare function useLocalStorage(key: string, defaults: string, options?: UseStorageOptions<string>): readonly [string | null, Dispatch<SetStateAction<string | null>>];
@@ -3117,10 +3131,22 @@ interface UseLocalStorageOptions<T> {
3117
3131
  */
3118
3132
  onError?: (error: unknown) => void;
3119
3133
  /**
3120
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3121
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3134
+ * @en set to storage when nodata in first mount, deprecated
3135
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3136
+ * @deprecated
3122
3137
  */
3123
3138
  effectStorageValue?: T | (() => T);
3139
+ /**
3140
+ * @en set to storage when nodata in first mount
3141
+ * @zh 首次挂载时没有数据时设置到 storage
3142
+ */
3143
+ mountStorageValue?: T | (() => T);
3144
+ /**
3145
+ * @en listen to storage changes
3146
+ * @zh 监听 storage 变化
3147
+ * @defaultValue `true`
3148
+ */
3149
+ listenToStorageChanges?: boolean;
3124
3150
  }
3125
3151
  /**
3126
3152
  * @title UseLocalStorageSerializer
@@ -3262,10 +3288,22 @@ interface UseSessionStorageOptions<T> {
3262
3288
  */
3263
3289
  onError?: (error: unknown) => void;
3264
3290
  /**
3265
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3266
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3291
+ * @en set to storage when nodata in first mount, deprecated
3292
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3293
+ * @deprecated
3267
3294
  */
3268
3295
  effectStorageValue?: T | (() => T);
3296
+ /**
3297
+ * @en set to storage when nodata in first mount
3298
+ * @zh 首次挂载时没有数据时设置到 storage
3299
+ */
3300
+ mountStorageValue?: T | (() => T);
3301
+ /**
3302
+ * @en listen to storage changes
3303
+ * @zh 监听 storage 变化
3304
+ * @defaultValue `true`
3305
+ */
3306
+ listenToStorageChanges?: boolean;
3269
3307
  }
3270
3308
  /**
3271
3309
  * @title UseSessionStorageSerializer
package/dist/index.d.ts CHANGED
@@ -1448,19 +1448,33 @@ interface Serializer<T> {
1448
1448
  }
1449
1449
  interface UseStorageOptions<T> {
1450
1450
  /**
1451
- * Custom data serialization
1451
+ * @en Custom data serialization
1452
+ * @zh 自定义数据序列化
1452
1453
  */
1453
1454
  serializer?: Serializer<T>;
1454
1455
  /**
1455
- * On error callback
1456
- *
1457
- * Default log error to `console.error`
1456
+ * @en On error callback
1457
+ * @zh 错误回调
1458
+ * @defaultValue `console.error`
1458
1459
  */
1459
1460
  onError?: (error: unknown) => void;
1460
1461
  /**
1461
- * set to storage when nodata in effect, fallback to defaults
1462
+ * @en set to storage when nodata in first mount
1463
+ * @zh 首次挂载时没有数据时设置到 storage
1464
+ * @deprecated
1462
1465
  */
1463
1466
  effectStorageValue?: T | (() => T);
1467
+ /**
1468
+ * @en set to storage when nodata in first mount
1469
+ * @zh 首次挂载时没有数据时设置到 storage
1470
+ */
1471
+ mountStorageValue?: T | (() => T);
1472
+ /**
1473
+ * @en listen to storage changes
1474
+ * @zh 监听 storage 变化
1475
+ * @defaultValue `true`
1476
+ */
1477
+ listenToStorageChanges?: boolean;
1464
1478
  }
1465
1479
 
1466
1480
  declare function useLocalStorage(key: string, defaults: string, options?: UseStorageOptions<string>): readonly [string | null, Dispatch<SetStateAction<string | null>>];
@@ -3117,10 +3131,22 @@ interface UseLocalStorageOptions<T> {
3117
3131
  */
3118
3132
  onError?: (error: unknown) => void;
3119
3133
  /**
3120
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3121
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3134
+ * @en set to storage when nodata in first mount, deprecated
3135
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3136
+ * @deprecated
3122
3137
  */
3123
3138
  effectStorageValue?: T | (() => T);
3139
+ /**
3140
+ * @en set to storage when nodata in first mount
3141
+ * @zh 首次挂载时没有数据时设置到 storage
3142
+ */
3143
+ mountStorageValue?: T | (() => T);
3144
+ /**
3145
+ * @en listen to storage changes
3146
+ * @zh 监听 storage 变化
3147
+ * @defaultValue `true`
3148
+ */
3149
+ listenToStorageChanges?: boolean;
3124
3150
  }
3125
3151
  /**
3126
3152
  * @title UseLocalStorageSerializer
@@ -3262,10 +3288,22 @@ interface UseSessionStorageOptions<T> {
3262
3288
  */
3263
3289
  onError?: (error: unknown) => void;
3264
3290
  /**
3265
- * @en set to storage when storage doesn't has data in effect, fallback to `defaultValue`
3266
- * @zh 当副作用执行的时候没有在 storage 中获取到数据时设置,默认会设置 `defaultValue`
3291
+ * @en set to storage when nodata in first mount, deprecated
3292
+ * @zh 首次挂载时没有数据时设置到 storage, 已弃用
3293
+ * @deprecated
3267
3294
  */
3268
3295
  effectStorageValue?: T | (() => T);
3296
+ /**
3297
+ * @en set to storage when nodata in first mount
3298
+ * @zh 首次挂载时没有数据时设置到 storage
3299
+ */
3300
+ mountStorageValue?: T | (() => T);
3301
+ /**
3302
+ * @en listen to storage changes
3303
+ * @zh 监听 storage 变化
3304
+ * @defaultValue `true`
3305
+ */
3306
+ listenToStorageChanges?: boolean;
3269
3307
  }
3270
3308
  /**
3271
3309
  * @title UseSessionStorageSerializer
package/dist/index.mjs CHANGED
@@ -106,6 +106,18 @@ function useEventListener(eventName, handler, element, options = defaultOptions$
106
106
  ]);
107
107
  }
108
108
 
109
+ const useMount = (fn)=>{
110
+ if (isDev) {
111
+ if (!isFunction(fn)) {
112
+ console.error(`useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`);
113
+ }
114
+ }
115
+ useEffect(()=>{
116
+ fn == null ? void 0 : fn();
117
+ // eslint-disable-next-line react-hooks/exhaustive-deps
118
+ }, []);
119
+ };
120
+
109
121
  const useActiveElement = ()=>{
110
122
  const [active, setActive] = useState(null);
111
123
  const listener = useCallback(()=>{
@@ -114,6 +126,10 @@ const useActiveElement = ()=>{
114
126
  }, []);
115
127
  useEventListener('blur', listener, ()=>window, true);
116
128
  useEventListener('focus', listener, ()=>window, true);
129
+ useMount(()=>{
130
+ var _window;
131
+ setActive((_window = window) == null ? void 0 : _window.document.activeElement);
132
+ });
117
133
  return active;
118
134
  };
119
135
 
@@ -538,7 +554,7 @@ function guessSerializerType(rawInit) {
538
554
 
539
555
  const StorageSerializers = {
540
556
  boolean: {
541
- read: (v)=>v === 'true',
557
+ read: (v)=>v === "true",
542
558
  write: (v)=>String(v)
543
559
  },
544
560
  object: {
@@ -587,14 +603,15 @@ function getInitialState$3(key, defaultValue, storage, serializer, onError) {
587
603
  }
588
604
  }
589
605
  // A default value has not been provided, and you are rendering on the server, warn of a possible hydration mismatch when defaulting to false.
590
- if (process.env.NODE_ENV !== 'production') {
591
- console.warn('`createStorage` When server side rendering, defaultValue should be defined to prevent a hydration mismatches.');
606
+ if (process.env.NODE_ENV !== "production") {
607
+ console.warn("`createStorage` When server side rendering, defaultValue should be defined to prevent a hydration mismatches.");
592
608
  }
593
609
  return null;
594
610
  }
595
611
  function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStorage : undefined, options = defaultOptions$1) {
596
612
  let storage;
597
- const { onError = defaultOnError, effectStorageValue } = options;
613
+ const { onError = defaultOnError, effectStorageValue, mountStorageValue, listenToStorageChanges = true } = options;
614
+ const storageValue = mountStorageValue != null ? mountStorageValue : effectStorageValue;
598
615
  try {
599
616
  storage = getStorage();
600
617
  } catch (err) {
@@ -606,7 +623,7 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
606
623
  const [state, setState] = useState(getInitialState$3(key, defaultValue, storage, serializer, onError));
607
624
  useDeepCompareEffect(()=>{
608
625
  var _ref;
609
- const data = (_ref = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue) != null ? _ref : null;
626
+ const data = (_ref = storageValue ? isFunction(storageValue) ? storageValue() : storageValue : defaultValue) != null ? _ref : null;
610
627
  const getStoredValue = ()=>{
611
628
  try {
612
629
  const raw = storage == null ? void 0 : storage.getItem(key);
@@ -626,7 +643,7 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
626
643
  serializer,
627
644
  storage,
628
645
  onError,
629
- effectStorageValue
646
+ storageValue
630
647
  ]);
631
648
  const updateState = useEvent((valOrFunc)=>{
632
649
  const currentState = isFunction(valOrFunc) ? valOrFunc(state) : valOrFunc;
@@ -641,6 +658,28 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
641
658
  }
642
659
  }
643
660
  });
661
+ const listener = useEvent(()=>{
662
+ try {
663
+ const raw = storage == null ? void 0 : storage.getItem(key);
664
+ if (raw !== undefined && raw !== null) {
665
+ updateState(serializer.read(raw));
666
+ } else {
667
+ updateState(null);
668
+ }
669
+ } catch (e) {
670
+ onError(e);
671
+ }
672
+ });
673
+ useEffect(()=>{
674
+ if (listenToStorageChanges) {
675
+ window.addEventListener("storage", listener);
676
+ return ()=>window.removeEventListener("storage", listener);
677
+ }
678
+ return ()=>{};
679
+ }, [
680
+ listenToStorageChanges,
681
+ listener
682
+ ]);
644
683
  return [
645
684
  state,
646
685
  updateState
@@ -653,7 +692,7 @@ const useDarkMode = (options)=>{
653
692
  return window.matchMedia('(prefers-color-scheme: dark)').matches;
654
693
  };
655
694
  const [dark, setDark] = useStorage(storageKey, defaultValue, storage, {
656
- effectStorageValue: value
695
+ mountStorageValue: value
657
696
  });
658
697
  useEffect(()=>{
659
698
  var _window;
@@ -1326,18 +1365,6 @@ const useFirstMountState = ()=>{
1326
1365
  return isFirst.current;
1327
1366
  };
1328
1367
 
1329
- const useMount = (fn)=>{
1330
- if (isDev) {
1331
- if (!isFunction(fn)) {
1332
- console.error(`useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`);
1333
- }
1334
- }
1335
- useEffect(()=>{
1336
- fn == null ? void 0 : fn();
1337
- // eslint-disable-next-line react-hooks/exhaustive-deps
1338
- }, []);
1339
- };
1340
-
1341
1368
  const useFocus = (target, initialValue = false)=>{
1342
1369
  const [focus, innerSetFocus] = useState(initialValue);
1343
1370
  useEventListener('focus', ()=>innerSetFocus(true), target);
@@ -1,4 +1,4 @@
1
- import QRCode from 'qrcode';
1
+ import QRCode, { QRCodeToDataURLOptions } from 'qrcode';
2
2
 
3
3
  /**
4
4
  * @title UseQRCode
@@ -13,7 +13,7 @@ text: string,
13
13
  * @zh 传递给 `QRCode.toDataURL` 的选项
14
14
  * @en Options passed to `QRCode.toDataURL`
15
15
  */
16
- options?: QRCode.QRCodeToDataURLOptions) => UseQRCodeReturn;
16
+ options?: QRCodeToDataURLOptions) => UseQRCodeReturn;
17
17
  /**
18
18
  * @title UseQRCodeReturn
19
19
  */
@@ -1,4 +1,4 @@
1
- import QRCode from 'qrcode';
1
+ import QRCode, { QRCodeToDataURLOptions } from 'qrcode';
2
2
 
3
3
  /**
4
4
  * @title UseQRCode
@@ -13,7 +13,7 @@ text: string,
13
13
  * @zh 传递给 `QRCode.toDataURL` 的选项
14
14
  * @en Options passed to `QRCode.toDataURL`
15
15
  */
16
- options?: QRCode.QRCodeToDataURLOptions) => UseQRCodeReturn;
16
+ options?: QRCodeToDataURLOptions) => UseQRCodeReturn;
17
17
  /**
18
18
  * @title UseQRCodeReturn
19
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactuses/core",
3
- "version": "5.0.19",
3
+ "version": "5.0.21",
4
4
  "license": "Unlicense",
5
5
  "homepage": "https://www.reactuse.com/",
6
6
  "repository": {