@radix-ui/react-use-rect 0.0.3 → 0.0.7
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.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import { Measurable } from "@radix-ui/rect";
|
|
3
2
|
/**
|
|
4
3
|
* Use this custom hook to get access to an element's rect (getBoundingClientRect)
|
|
5
4
|
* and observe it along time.
|
|
6
5
|
*/
|
|
7
|
-
export function useRect(
|
|
8
|
-
/** A reference to the element whose rect to observe */
|
|
9
|
-
refToObserve: React.RefObject<Measurable>): ClientRect | undefined;
|
|
6
|
+
export function useRect(measurable: Measurable | null): ClientRect | undefined;
|
|
10
7
|
|
|
11
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;
|
|
1
|
+
{"mappings":"A;AAKA;A;A;GAGG;AACH,wBAAiB,UAAU,EAAE,UAAU,GAAG,IAAI,0BAa7C","sources":["./packages/react/use-rect/src/packages/react/use-rect/src/useRect.tsx","./packages/react/use-rect/src/packages/react/use-rect/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,
|
|
1
|
+
var e,t,r=require("@radix-ui/rect").observeElementRect,u=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e);exports.useRect=function(e){const[t,n]=u.useState();return u.useEffect((()=>{if(e){const t=r(e,n);return()=>{n(void 0),t()}}}),[e]),t};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"IAYgCA,EAAMC,oDAAND,KAAMC,mBACpCC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,mBCjBT,SAAiBS,GACf,MAAOC,EAAMC,GAAWC,EAAMC,WAW9B,OAVAD,EAAME,WAAU,KACd,GAAIL,EAAY,CACd,MAAMM,EAAYC,EAAmBP,EAAYE,GACjD,MAAO,KACLA,OAAQM,GACRF,QAIH,CAACN,IACGC","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/use-rect/src/useRect.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { observeElementRect } from '@radix-ui/rect';\n\nimport type { Measurable } from '@radix-ui/rect';\n\n/**\n * Use this custom hook to get access to an element's rect (getBoundingClientRect)\n * and observe it along time.\n */\nfunction useRect(measurable: Measurable | null) {\n const [rect, setRect] = React.useState<ClientRect>();\n React.useEffect(() => {\n if (measurable) {\n const unobserve = observeElementRect(measurable, setRect);\n return () => {\n setRect(undefined);\n unobserve();\n };\n }\n return;\n }, [measurable]);\n return rect;\n}\n\nexport { useRect };\n"],"names":["dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","measurable","rect","setRect","React","useState","useEffect","unobserve","observeElementRect","undefined"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{observeElementRect as t}from"@radix-ui/rect";import*as r from"react";export function useRect(e){const[o,c]=r.useState();return r.useEffect((()=>{if(e){const r=t(e,c);return()=>{c(void 0),r()}}}),[e]),o}
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"mFASA,SAASA,QAAQC,GACf,MAAOC,EAAMC,GAAWC,EAAMC,WAW9B,OAVAD,EAAME,WAAU,KACd,GAAIL,EAAY,CACd,MAAMM,EAAYC,EAAmBP,EAAYE,GACjD,MAAO,KACLA,OAAQM,GACRF,QAIH,CAACN,IACGC","sources":["./packages/react/use-rect/src/useRect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { observeElementRect } from '@radix-ui/rect';\n\nimport type { Measurable } from '@radix-ui/rect';\n\n/**\n * Use this custom hook to get access to an element's rect (getBoundingClientRect)\n * and observe it along time.\n */\nfunction useRect(measurable: Measurable | null) {\n const [rect, setRect] = React.useState<ClientRect>();\n React.useEffect(() => {\n if (measurable) {\n const unobserve = observeElementRect(measurable, setRect);\n return () => {\n setRect(undefined);\n unobserve();\n };\n }\n return;\n }, [measurable]);\n return rect;\n}\n\nexport { useRect };\n"],"names":["useRect","measurable","rect","setRect","React","useState","useEffect","unobserve","observeElementRect","undefined"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-use-rect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.13.10",
|
|
21
|
-
"@radix-ui/
|
|
22
|
-
"@radix-ui/rect": "0.0.2"
|
|
21
|
+
"@radix-ui/rect": "0.0.5"
|
|
23
22
|
},
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"react": "^16.8 || ^17.0"
|