downshift 8.2.4-alpha.3 → 8.2.4

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.
@@ -1723,19 +1723,12 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1723
1723
  }, [propsRef]);
1724
1724
  var action = actionRef.current;
1725
1725
  React.useEffect(function () {
1726
- console.log('effect');
1727
1726
  var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1728
- console.log('passed', prevStateRef.current, state);
1729
1727
  if (shouldCallOnChangeProps) {
1730
1728
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1731
1729
  }
1732
1730
  prevStateRef.current = state;
1733
1731
  }, [state, action, isStateEqual]);
1734
- React.useEffect(function () {
1735
- if (props) {
1736
- prevStateRef.current = getState(prevStateRef.current, props);
1737
- }
1738
- }, [props]);
1739
1732
  return [state, dispatchWithProps];
1740
1733
  }
1741
1734
 
@@ -1710,19 +1710,12 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1710
1710
  }, [propsRef]);
1711
1711
  var action = actionRef.current;
1712
1712
  useEffect(function () {
1713
- console.log('effect');
1714
1713
  var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1715
- console.log('passed', prevStateRef.current, state);
1716
1714
  if (shouldCallOnChangeProps) {
1717
1715
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1718
1716
  }
1719
1717
  prevStateRef.current = state;
1720
1718
  }, [state, action, isStateEqual]);
1721
- useEffect(function () {
1722
- if (props) {
1723
- prevStateRef.current = getState(prevStateRef.current, props);
1724
- }
1725
- }, [props]);
1726
1719
  return [state, dispatchWithProps];
1727
1720
  }
1728
1721
 
@@ -1619,19 +1619,12 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1619
1619
  }, [propsRef]);
1620
1620
  var action = actionRef.current;
1621
1621
  React.useEffect(function () {
1622
- console.log('effect');
1623
1622
  var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1624
- console.log('passed', prevStateRef.current, state);
1625
1623
  if (shouldCallOnChangeProps) {
1626
1624
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1627
1625
  }
1628
1626
  prevStateRef.current = state;
1629
1627
  }, [state, action, isStateEqual]);
1630
- React.useEffect(function () {
1631
- if (props) {
1632
- prevStateRef.current = getState(prevStateRef.current, props);
1633
- }
1634
- }, [props]);
1635
1628
  return [state, dispatchWithProps];
1636
1629
  }
1637
1630
 
@@ -1718,19 +1718,12 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1718
1718
  }, [propsRef]);
1719
1719
  var action = actionRef.current;
1720
1720
  React.useEffect(function () {
1721
- console.log('effect');
1722
1721
  var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1723
- console.log('passed', prevStateRef.current, state);
1724
1722
  if (shouldCallOnChangeProps) {
1725
1723
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1726
1724
  }
1727
1725
  prevStateRef.current = state;
1728
1726
  }, [state, action, isStateEqual]);
1729
- React.useEffect(function () {
1730
- if (props) {
1731
- prevStateRef.current = getState(prevStateRef.current, props);
1732
- }
1733
- }, [props]);
1734
1727
  return [state, dispatchWithProps];
1735
1728
  }
1736
1729
 
@@ -1379,7 +1379,7 @@
1379
1379
 
1380
1380
  var reactIsExports = reactIs.exports;
1381
1381
 
1382
- const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,i,l,r,d)=>l<t&&r>e||l>t&&r<e?0:l<=t&&d<=n||r>=e&&d>=n?l-t-o:r>e&&d<n||l<t&&d>n?r-e+i:0,i=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},l=(e,l)=>{var r,d,s,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=l,m="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&m(W);){if(W=i(W),W===p){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const H=null!=(d=null==(r=window.visualViewport)?void 0:r.width)?d:innerWidth,b=null!=(h=null==(s=window.visualViewport)?void 0:s.height)?h:innerHeight,{scrollX:v,scrollY:y}=window,{height:E,width:M,top:x,right:I,bottom:C,left:R}=e.getBoundingClientRect();let T="start"===f||"nearest"===f?x:"end"===f?C:x+E/2,V="center"===u?R+M/2:"end"===u?I:R;const k=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:i,top:l,right:r,bottom:d,left:s}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&C<=b&&I<=H&&x>=l&&C<=d&&R>=s&&I<=r)return k;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),m=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let B=0,D=0;const L="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-m:0,S="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,X="offsetWidth"in e?0===e.offsetWidth?0:i/e.offsetWidth:0,Y="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(p===e)B="start"===f?T:"end"===f?T-b:"nearest"===f?o(y,y+b,b,g,W,y+T,y+T+E,E):T-b/2,D="start"===u?V:"center"===u?V-H/2:"end"===u?V-H:o(v,v+H,H,a,m,v+V,v+V+M,M),B=Math.max(0,B+y),D=Math.max(0,D+v);else {B="start"===f?T-l-g:"end"===f?T-d+W+S:"nearest"===f?o(l,d,n,g,W+S,T,T+E,E):T-(l+n/2)+S/2,D="start"===u?V-s-a:"center"===u?V-(s+i/2)+L/2:"end"===u?V-r+m+L:o(s,r,i,a,m+L,V,V+M,M);const{scrollLeft:t,scrollTop:h}=e;B=Math.max(0,Math.min(h+B/Y,e.scrollHeight-n/Y+S)),D=Math.max(0,Math.min(t+D/X,e.scrollWidth-i/X+L)),T+=h-B,V+=t-D;}k.push({el:e,top:B,left:D});}return k};
1382
+ const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return {top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:l,top:r,right:i,bottom:s,left:d}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&I<=H&&C<=b&&x>=r&&I<=s&&R>=d&&C<=i)return L;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),p=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let T=0,B=0;const F="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-p:0,V="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,S="offsetWidth"in e?0===e.offsetWidth?0:l/e.offsetWidth:0,X="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(m===e)T="start"===f?k:"end"===f?k-H:"nearest"===f?o(M,M+H,H,g,W,M+k,M+k+v,v):k-H/2,B="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o(y,y+b,b,a,p,y+D,y+D+E,E),T=Math.max(0,T+M),B=Math.max(0,B+y);else {T="start"===f?k-r-g:"end"===f?k-s+W+V:"nearest"===f?o(r,s,n,g,W+V,k,k+v,v):k-(r+n/2)+V/2,B="start"===u?D-d-a:"center"===u?D-(d+l/2)+F/2:"end"===u?D-i+p+F:o(d,i,l,a,p+F,D,D+E,E);const{scrollLeft:t,scrollTop:h}=e;T=0===X?0:Math.max(0,Math.min(h+T/X,e.scrollHeight-n/X+V)),B=0===S?0:Math.max(0,Math.min(t+B/S,e.scrollWidth-l/S+F)),k+=h-T,D+=t-B;}L.push({el:e,top:T,left:B});}return L};
1383
1383
 
1384
1384
  var idCounter = 0;
1385
1385
 
@@ -1405,7 +1405,7 @@
1405
1405
  if (!node) {
1406
1406
  return;
1407
1407
  }
1408
- var actions = l(node, {
1408
+ var actions = r(node, {
1409
1409
  boundary: menuNode,
1410
1410
  block: 'nearest',
1411
1411
  scrollMode: 'if-needed'
@@ -3076,19 +3076,12 @@
3076
3076
  }, [propsRef]);
3077
3077
  var action = actionRef.current;
3078
3078
  React.useEffect(function () {
3079
- console.log('effect');
3080
3079
  var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
3081
- console.log('passed', prevStateRef.current, state);
3082
3080
  if (shouldCallOnChangeProps) {
3083
3081
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
3084
3082
  }
3085
3083
  prevStateRef.current = state;
3086
3084
  }, [state, action, isStateEqual]);
3087
- React.useEffect(function () {
3088
- if (props) {
3089
- prevStateRef.current = getState(prevStateRef.current, props);
3090
- }
3091
- }, [props]);
3092
3085
  return [state, dispatchWithProps];
3093
3086
  }
3094
3087