@reactuses/core 5.0.18 → 5.0.19-beta.2
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 +13 -13
- package/dist/index.cjs +251 -14
- package/dist/index.d.cts +180 -1
- package/dist/index.d.mts +180 -1
- package/dist/index.d.ts +180 -1
- package/dist/index.mjs +245 -12
- package/dist/useQRCode.cjs +95 -0
- package/dist/useQRCode.d.cts +36 -0
- package/dist/useQRCode.d.mts +36 -0
- package/dist/useQRCode.mjs +88 -0
- package/package.json +19 -1
- package/dist/index-client-DJgtg2U_.cjs +0 -30
- package/dist/index-client-Qon46B4S.js +0 -28
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
function assignRef(ref, value) {
|
|
5
|
-
if (ref == null) return;
|
|
6
|
-
if (typeof ref === 'function') {
|
|
7
|
-
ref(value);
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
ref.current = value;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function mergeRefs(...refs) {
|
|
17
|
-
return (node)=>{
|
|
18
|
-
refs.forEach((ref)=>{
|
|
19
|
-
assignRef(ref, node);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function useMergedRefs(...refs) {
|
|
24
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
-
return useMemo(()=>mergeRefs(...refs), refs);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { assignRef as a, mergeRefs as m, useMergedRefs as u };
|