@radix-ui/react-use-rect 0.1.2-rc.1 → 0.1.2-rc.10
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.map +1 -1
- package/dist/index.js +51 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +35 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";AAKA;;;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","packages/react/use-rect/src/index.ts"],"sourcesContent":[null,null,"export * from './useRect';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $KEKIw$react = require("react");
|
|
2
|
+
var $KEKIw$radixuirect = require("@radix-ui/rect");
|
|
3
|
+
|
|
4
|
+
function $parcel$exportWildcard(dest, source) {
|
|
5
|
+
Object.keys(source).forEach(function(key) {
|
|
6
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(dest, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return source[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return dest;
|
|
19
|
+
}
|
|
20
|
+
function $parcel$export(e, n, v, s) {
|
|
21
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
22
|
+
}
|
|
23
|
+
var $c64cf18f363cc04f$exports = {};
|
|
24
|
+
|
|
25
|
+
$parcel$export($c64cf18f363cc04f$exports, "useRect", () => $c64cf18f363cc04f$export$9823a655542017cd);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Use this custom hook to get access to an element's rect (getBoundingClientRect)
|
|
30
|
+
* and observe it along time.
|
|
31
|
+
*/ function $c64cf18f363cc04f$export$9823a655542017cd(measurable) {
|
|
32
|
+
const [rect, setRect] = $KEKIw$react.useState();
|
|
33
|
+
$KEKIw$react.useEffect(()=>{
|
|
34
|
+
if (measurable) {
|
|
35
|
+
const unobserve = $KEKIw$radixuirect.observeElementRect(measurable, setRect);
|
|
36
|
+
return ()=>{
|
|
37
|
+
setRect(undefined);
|
|
38
|
+
unobserve();
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}, [
|
|
43
|
+
measurable
|
|
44
|
+
]);
|
|
45
|
+
return rect;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
$parcel$exportWildcard(module.exports, $c64cf18f363cc04f$exports);
|
|
50
|
+
|
|
51
|
+
|
|
2
52
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AAKA;;;GAGA,CACA,SAASE,yCAAT,CAAiBC,UAAjB,EAAgD;IAC9C,MAAM,CAACC,IAAD,EAAOC,OAAP,CAAA,GAAkBL,qBAAA,EAAxB,AAAA;IACAA,sBAAA,CAAgB,IAAM;QACpB,IAAIG,UAAJ,EAAgB;YACd,MAAMK,SAAS,GAAGP,qCAAkB,CAACE,UAAD,EAAaE,OAAb,CAApC,AAAA;YACA,OAAO,IAAM;gBACXA,OAAO,CAACI,SAAD,CAAP,CAAAJ;gBACAG,SAAS,EAATA,CAAAA;aAFF,CAGC;SACF;QACD,OAAA;KARF,EASG;QAACL,UAAD;KATH,CASC,CAAA;IACD,OAAOC,IAAP,CAAA;CACD;;ADtBD","sources":["packages/react/use-rect/src/index.ts","packages/react/use-rect/src/useRect.tsx"],"sourcesContent":["export * from './useRect';\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":["React","observeElementRect","useRect","measurable","rect","setRect","useState","useEffect","unobserve","undefined"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import {useState as $jNFHB$useState, useEffect as $jNFHB$useEffect} from "react";
|
|
2
|
+
import {observeElementRect as $jNFHB$observeElementRect} from "@radix-ui/rect";
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
var $ccac1052a272b78b$exports = {};
|
|
8
|
+
|
|
9
|
+
$parcel$export($ccac1052a272b78b$exports, "useRect", () => $ccac1052a272b78b$export$9823a655542017cd);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Use this custom hook to get access to an element's rect (getBoundingClientRect)
|
|
14
|
+
* and observe it along time.
|
|
15
|
+
*/ function $ccac1052a272b78b$export$9823a655542017cd(measurable) {
|
|
16
|
+
const [rect, setRect] = $jNFHB$useState();
|
|
17
|
+
$jNFHB$useEffect(()=>{
|
|
18
|
+
if (measurable) {
|
|
19
|
+
const unobserve = $jNFHB$observeElementRect(measurable, setRect);
|
|
20
|
+
return ()=>{
|
|
21
|
+
setRect(undefined);
|
|
22
|
+
unobserve();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}, [
|
|
27
|
+
measurable
|
|
28
|
+
]);
|
|
29
|
+
return rect;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export {$ccac1052a272b78b$export$9823a655542017cd as useRect};
|
|
2
36
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;ACAA;;AAKA;;;GAGA,CACA,SAASE,yCAAT,CAAiBC,UAAjB,EAAgD;IAC9C,MAAM,CAACC,IAAD,EAAOC,OAAP,CAAA,GAAkBL,eAAA,EAAxB,AAAA;IACAA,gBAAA,CAAgB,IAAM;QACpB,IAAIG,UAAJ,EAAgB;YACd,MAAMK,SAAS,GAAGP,yBAAkB,CAACE,UAAD,EAAaE,OAAb,CAApC,AAAA;YACA,OAAO,IAAM;gBACXA,OAAO,CAACI,SAAD,CAAP,CAAAJ;gBACAG,SAAS,EAATA,CAAAA;aAFF,CAGC;SACF;QACD,OAAA;KARF,EASG;QAACL,UAAD;KATH,CASC,CAAA;IACD,OAAOC,IAAP,CAAA;CACD;;ADtBD","sources":["packages/react/use-rect/src/index.ts","packages/react/use-rect/src/useRect.tsx"],"sourcesContent":["export * from './useRect';\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":["React","observeElementRect","useRect","measurable","rect","setRect","useState","useEffect","unobserve","undefined"],"version":3,"file":"index.module.js.map"}
|