@radix-ui/react-use-callback-ref 1.0.0-rc.1 → 1.0.1-rc.1
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.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
3
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
4
|
+
*/
|
|
5
|
+
export function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T;
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;ACAA;AAEA;;;GAGA,CACA,SAASA,yCAAT,CAA2DE,QAA3D,EAAuF;IACrF,MAAMC,WAAW,GAAGF,aAAA,CAAaC,QAAb,CAApB,AAAA;IAEAD,gBAAA,CAAgB,IAAM;QACpBE,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB,CAAAC;KADF,CAAA,CAHqF,CAOrF,iDAFC;IAGD,OAAOF,cAAA,CAAc,IAAO,CAAIO,GAAAA,IAAJ,GAA5B;YAA4B,IAAA,oBAAA,AAAA;YAAA,OAAA,AAAA,CAAA,oBAAA,GAAaL,WAAW,CAACG,OAAzB,CAAA,KAAA,IAAA,IAAA,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAa,oBAAA,CAAA,IAAA,CAAAH,WAAW,KAAcK,IAAd,CAAxB,CAAA;SAArB;IAAA,EAAwE,EAAxE,CAAP,CAA4B;CAC7B;;ADfD","sources":["packages/react/use-callback-ref/src/index.ts","packages/react/use-callback-ref/src/useCallbackRef.tsx"],"sourcesContent":["export { useCallbackRef } from './useCallbackRef';\n","import * as React from 'react';\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nfunction useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T {\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n\nexport { useCallbackRef };\n"],"names":["useCallbackRef","React","callback","callbackRef","useRef","useEffect","current","useMemo","args"],"version":3,"file":"index.
|
|
1
|
+
{"mappings":";;ACAA;AAEA;;;GAGA,CACA,SAASA,yCAAT,CAA2DE,QAA3D,EAAuF;IACrF,MAAMC,WAAW,GAAGF,aAAA,CAAaC,QAAb,CAApB,AAAA;IAEAD,gBAAA,CAAgB,IAAM;QACpBE,WAAW,CAACG,OAAZ,GAAsBJ,QAAtB,CAAAC;KADF,CAAA,CAHqF,CAOrF,iDAFC;IAGD,OAAOF,cAAA,CAAc,IAAO,CAAIO,GAAAA,IAAJ,GAA5B;YAA4B,IAAA,oBAAA,AAAA;YAAA,OAAA,AAAA,CAAA,oBAAA,GAAaL,WAAW,CAACG,OAAzB,CAAA,KAAA,IAAA,IAAA,oBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAa,oBAAA,CAAA,IAAA,CAAAH,WAAW,KAAcK,IAAd,CAAxB,CAAA;SAArB;IAAA,EAAwE,EAAxE,CAAP,CAA4B;CAC7B;;ADfD","sources":["packages/react/use-callback-ref/src/index.ts","packages/react/use-callback-ref/src/useCallbackRef.tsx"],"sourcesContent":["export { useCallbackRef } from './useCallbackRef';\n","import * as React from 'react';\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nfunction useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T {\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n\nexport { useCallbackRef };\n"],"names":["useCallbackRef","React","callback","callbackRef","useRef","useEffect","current","useMemo","args"],"version":3,"file":"index.mjs.map"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-use-callback-ref",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": {
|
|
8
|
+
"types": "./dist/index.d.mts",
|
|
9
|
+
"default": "./dist/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"require": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"source": "./src/index.ts",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
9
21
|
"files": [
|
|
10
22
|
"dist",
|
|
11
23
|
"README.md"
|
|
@@ -29,5 +41,5 @@
|
|
|
29
41
|
"dependencies": {
|
|
30
42
|
"@babel/runtime": "^7.13.10"
|
|
31
43
|
},
|
|
32
|
-
"stableVersion": "
|
|
44
|
+
"stableVersion": "1.0.0"
|
|
33
45
|
}
|