@reach/rect
Advanced tools
Comparing version 0.10.5 to 0.11.0
@@ -7,3 +7,3 @@ /** | ||
* @see getBoundingClientRect https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | ||
* @see Docs https://reacttraining.com/reach-ui/rect | ||
* @see Docs https://reach.tech/rect | ||
* @see Source https://github.com/reach/reach-ui/tree/main/packages/rect | ||
@@ -19,3 +19,3 @@ */ | ||
/** | ||
* @see Docs https://reacttraining.com/reach-ui/rect#rect-props | ||
* @see Docs https://reach.tech/rect#rect-props | ||
*/ | ||
@@ -35,3 +35,3 @@ export declare type RectProps = { | ||
* | ||
* @see Docs https://reacttraining.com/reach-ui/rect#rect-observe | ||
* @see Docs https://reach.tech/rect#rect-observe | ||
*/ | ||
@@ -42,3 +42,3 @@ observe?: boolean; | ||
* | ||
* @see Docs https://reacttraining.com/reach-ui/rect#rect-onchange | ||
* @see Docs https://reach.tech/rect#rect-onchange | ||
*/ | ||
@@ -54,3 +54,3 @@ onChange?: (rect: PRect) => void; | ||
* | ||
* @see Docs https://reacttraining.com/reach-ui/rect#rect-onchange | ||
* @see Docs https://reach.tech/rect#rect-onchange | ||
*/ | ||
@@ -57,0 +57,0 @@ children(args: { |
@@ -5,9 +5,12 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var react = require('react'); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
var observeRect = _interopDefault(require('@reach/observe-rect')); | ||
var PropTypes = require('prop-types'); | ||
var observeRect = require('@reach/observe-rect'); | ||
var utils = require('@reach/utils'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); | ||
var observeRect__default = /*#__PURE__*/_interopDefaultLegacy(observeRect); | ||
/** | ||
@@ -19,3 +22,3 @@ * Welcome to @reach/rect! | ||
* @see getBoundingClientRect https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | ||
* @see Docs https://reacttraining.com/reach-ui/rect | ||
* @see Docs https://reach.tech/rect | ||
* @see Source https://github.com/reach/reach-ui/tree/main/packages/rect | ||
@@ -46,5 +49,5 @@ */ | ||
Rect.propTypes = { | ||
children: PropTypes.func.isRequired, | ||
observe: PropTypes.bool, | ||
onChange: PropTypes.func | ||
children: PropTypes__default['default'].func.isRequired, | ||
observe: PropTypes__default['default'].bool, | ||
onChange: PropTypes__default['default'].func | ||
}; | ||
@@ -112,3 +115,3 @@ } //////////////////////////////////////////////////////////////////////////////// | ||
observer = observeRect(elem, function (rect) { | ||
observer = observeRect__default['default'](elem, function (rect) { | ||
onChangeRef.current && onChangeRef.current(rect); | ||
@@ -115,0 +118,0 @@ setRect(rect); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("prop-types");var r,t=(r=require("@reach/observe-rect"))&&"object"==typeof r&&"default"in r?r.default:r,u=require("@reach/utils"),n=function(r){var t=r.onChange,u=r.observe,n=void 0===u||u,o=r.children,s=e.useRef(null);return o({ref:s,rect:c(s,n,t)})};function c(r,n,c){void 0===n&&(n=!0);var o=e.useState(r.current),s=o[0],f=o[1],i=e.useRef(!1),a=e.useRef(!1),l=e.useState(null),p=l[0],v=l[1],d=e.useRef();return u.useIsomorphicLayoutEffect((function(){d.current=c,r.current!==s&&f(r.current)})),u.useIsomorphicLayoutEffect((function(){s&&!i.current&&(i.current=!0,v(s.getBoundingClientRect()))}),[s]),u.useIsomorphicLayoutEffect((function(){var e,u=s;return a.current||(a.current=!0,u=r.current),u?(e=t(u,(function(e){d.current&&d.current(e),v(e)})),n&&e.observe(),c):c;function c(){e&&e.unobserve()}}),[n,s]),p}exports.Rect=n,exports.default=n,exports.useRect=c; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("prop-types");var r=require("@reach/observe-rect"),t=require("@reach/utils");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=u(r),c=function(r){var t=r.onChange,u=r.observe,n=void 0===u||u,c=r.children,s=e.useRef(null);return c({ref:s,rect:o(s,n,t)})};function o(r,u,c){void 0===u&&(u=!0);var o=e.useState(r.current),s=o[0],f=o[1],i=e.useRef(!1),a=e.useRef(!1),l=e.useState(null),v=l[0],p=l[1],d=e.useRef();return t.useIsomorphicLayoutEffect((function(){d.current=c,r.current!==s&&f(r.current)})),t.useIsomorphicLayoutEffect((function(){s&&!i.current&&(i.current=!0,p(s.getBoundingClientRect()))}),[s]),t.useIsomorphicLayoutEffect((function(){var e,t=s;return a.current||(a.current=!0,t=r.current),t?(e=n.default(t,(function(e){d.current&&d.current(e),p(e)})),u&&e.observe(),c):c;function c(){e&&e.unobserve()}}),[u,s]),v}exports.Rect=c,exports.default=c,exports.useRect=o; | ||
//# sourceMappingURL=rect.cjs.production.min.js.map |
@@ -12,3 +12,3 @@ import { useRef, useState } from 'react'; | ||
* @see getBoundingClientRect https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | ||
* @see Docs https://reacttraining.com/reach-ui/rect | ||
* @see Docs https://reach.tech/rect | ||
* @see Source https://github.com/reach/reach-ui/tree/main/packages/rect | ||
@@ -15,0 +15,0 @@ */ |
{ | ||
"name": "@reach/rect", | ||
"version": "0.10.5", | ||
"version": "0.11.0", | ||
"description": "Measure React elements position in the DOM", | ||
@@ -13,7 +13,7 @@ "author": "React Training <hello@reacttraining.com>", | ||
"scripts": { | ||
"build": "ts-node ../../scripts/build" | ||
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name" | ||
}, | ||
"dependencies": { | ||
"@reach/observe-rect": "1.2.0", | ||
"@reach/utils": "0.10.5", | ||
"@reach/utils": "0.11.0", | ||
"prop-types": "^15.7.2", | ||
@@ -33,3 +33,3 @@ "tslib": "^2.0.0" | ||
], | ||
"gitHead": "86a046f54d53b6420e392b3fa56dd991d9d4e458" | ||
"gitHead": "7eaa66982cd17fb012c13c97e6a1770f75b6ce00" | ||
} |
@@ -5,3 +5,3 @@ # @reach/rect | ||
[Docs](https://reacttraining.com/reach-ui/rect) | [Source](https://github.com/reach/reach-ui/tree/main/packages/rect) | ||
[Docs](https://reach.tech/rect) | [Source](https://github.com/reach/reach-ui/tree/main/packages/rect) | ||
@@ -8,0 +8,0 @@ Measures DOM elements (aka. bounding client rect). See also [Element.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291
32706
+ Added@reach/utils@0.11.0(transitive)
- Removed@reach/utils@0.10.5(transitive)
Updated@reach/utils@0.11.0