├── .editorconfig ├── .gitignore ├── .nvmrc ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── docs ├── .nojekyll ├── build │ ├── docs.js │ └── docs.js.map ├── css │ └── style.css ├── index.html └── src │ ├── demo.tsx │ └── docs.tsx ├── package-lock.json ├── package.json ├── src ├── index.ts ├── scroll.tsx ├── window-manager.ts └── window.tsx ├── tsconfig-base.json ├── tsconfig-cjs.json ├── tsconfig-demo.json └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Config helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | # We recommend you to keep these unchanged 9 | indent_style = space 10 | indent_size = 2 11 | end_of_line = lf 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | max_line_length = 120 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | node_modules 3 | dist 4 | .module-cache 5 | *.log* 6 | _nogit 7 | lib 8 | .cache 9 | .parcel-cache 10 | TODO.md 11 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v18.2.0 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### v1.0.8 4 | 5 | 05.10.2022. 6 | 7 | **Changed** 8 | 9 | - Removed outdated dev dependencies and switched to a simpler build process. 10 | - Prepared source files to add type definitions. 11 | 12 | --- 13 | 14 | ### v1.0.7 15 | 16 | 28.09.2020. 17 | 18 | **Fixed** 19 | 20 | - Moved event bindings to `componentDidMount` to fix `Can't call setState on a component that is not yet mounted` error. It might help with [Plx issue #60](https://github.com/Stanko/react-plx/issues/60) as well. 21 | 22 | --- 23 | 24 | ### v1.0.6 25 | 26 | 07.01.2019. 27 | 28 | **Fixed** 29 | 30 | - Fixed [the bug](https://github.com/Stanko/react-window-decorators/pull/3) with breakpoint data not being broadcasted properly. 31 | 32 | --- 33 | 34 | ### v1.0.5 35 | 36 | 17.12.2018. 37 | 38 | **Fixed** 39 | 40 | - Fixed [the bug](https://github.com/Stanko/react-window-decorators/pull/2) introduced in 1.0.4 that broke SSR. 41 | 42 | --- 43 | 44 | ### v1.0.4 45 | 46 | 14.12.2018. 47 | 48 | **Changed** 49 | 50 | - Changed how custom event is dispatched. 51 | 52 | --- 53 | 54 | ### v1.0.3 55 | 56 | 13.12.2018. 57 | 58 | **Changed** 59 | 60 | - Updated `window-scroll-manager` dependency. 61 | 62 | --- 63 | 64 | ### v1.0.2 65 | 66 | 30.07.2018. 67 | 68 | **Changed** 69 | 70 | - Added `scrollPosition` as an `scrollPositionY` alias for backwards compatibility 71 | 72 | --- 73 | 74 | ### v1.0.1 75 | 76 | 12.07.2018. 77 | 78 | **Updated** 79 | 80 | - Updated `window-scroll-manager` version 81 | 82 | --- 83 | 84 | ### v1.0.0 85 | 86 | 15.06.2018. 87 | 88 | **Changed** 89 | 90 | - Renamed `scrollPosition` prop to `scrollPositionY` 91 | 92 | **Added** 93 | 94 | - Enabled horizontal scroll tracking and added `scrollPositionX` prop 95 | - This changelog 96 | 97 | --- 98 | 99 | For changes prior version 1.0.0 please check the [commit list](https://github.com/Stanko/react-window-decorators/commits/dev). 100 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 - today Stanko Tadić 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Window Decorators 2 | 3 | [![npm version](https://img.shields.io/npm/v/react-window-decorators.svg?style=flat-square)](https://www.npmjs.com/package/react-window-decorators) 4 | [![npm downloads](https://img.shields.io/npm/dm/react-window-decorators.svg?style=flat-square)](https://www.npmjs.com/package/react-window-decorators) 5 | 6 | Two decorators (higher order components) that inject `window` scroll position, 7 | dimensions, orientation, breakpoint* and `isTouchDevice` to your component's props. 8 | 9 | If you are not sure what it does, play with the 10 | [demo](https://muffinman.io/react-window-decorators/). 11 | 12 | All modern browsers and IE10+. 13 | 14 | \* You need to pass breakpoint data (check below). 15 | 16 | [Changelog](CHANGELOG.md) 17 | 18 | ## Usage 19 | 20 | Library is made as ES module, and you should use it with a module bundler (tested with webpack). 21 | 22 | ### `withScroll` decorator 23 | 24 | Using decorator syntax (my preferred way). 25 | 26 | ```js 27 | import { withScroll } from 'react-window-decorators'; 28 | 29 | @withScroll 30 | export default class YourComponent extends Component { 31 | render() { 32 | return ( 33 |
34 | Vertical scroll position is: { this.props.scrollPositionY } 35 |
36 | ); 37 | } 38 | } 39 | ``` 40 | 41 | Or without decorator syntax 42 | 43 | ```js 44 | import { withScroll } from 'react-window-decorators'; 45 | 46 | class YourComponent extends Component { 47 | render() { 48 | return ( 49 |
50 | Vertical scroll position is: { this.props.scrollPositionY } 51 |
52 | ); 53 | } 54 | } 55 | 56 | export default withScroll(YourComponent); 57 | ``` 58 | 59 | 60 | If you run it on the server, `withScroll` will return `0` as the initial value. 61 | 62 | ### `withWindow` decorator 63 | 64 | `withWindow` internally uses `WindowManager` for tracking resize events. 65 | If you want to use breakpoints feature you need to set it by creating new `WindowManager` 66 | and passing it array with breakpoints data. Each breakpoint object must contain 67 | a name and media query which will be passed to 68 | [matchMedia](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia). 69 | 70 | Second argument is `debounceTime` which determines resize event's debounce time. 71 | Default is `250`. 72 | 73 | `WindowManager` is a singleton, so this should be done only once *before* using decorator. 74 | 75 | ```js 76 | import { WindowManager } from 'react-window-decorators'; 77 | 78 | // Example breakpoints data 79 | const BREAKPOINTS = [ 80 | { 81 | name: 'small', 82 | media: '(min-width: 0)', 83 | }, 84 | { 85 | name: 'medium', 86 | media: '(min-width: 600px)', 87 | }, 88 | ]; 89 | 90 | // Set breakpoints data 91 | // Somewhere in your application bootstrap 92 | new WindowManager(BREAKPOINTS); 93 | ``` 94 | 95 | If you don't pass breakpoints data, `breakpoint` prop will always be null. 96 | 97 | Using decorator syntax (my preferred way). 98 | 99 | ```js 100 | import { withWindow } from 'react-window-decorators'; 101 | 102 | @withWindow 103 | export default class YourComponent extends Component { 104 | render() { 105 | return ( 106 |
107 |
Window dimensions are: { this.props.dimensions.width }/{ this.props.dimensions.height }
108 |
Window orientation is: { this.props.orientation }
109 |
Window breakpoint is: { this.props.breakpoint }
110 |
Device is touch enabled: { this.props.isTouchDevice.toString() }
111 |
112 | ); 113 | } 114 | } 115 | ``` 116 | 117 | Or without decorator syntax 118 | 119 | ```js 120 | import { withWindow } from 'react-window-decorators'; 121 | 122 | class YourComponent extends Component { 123 | render() { 124 | return ( 125 |
126 |
Window dimensions are: { this.props.dimensions.width }/{ this.props.dimensions.height }
127 |
Window orientation is: { this.props.orientation }
128 |
Window breakpoint is: { this.props.breakpoint }
129 |
Device is touch enabled: { this.props.isTouchDevice.toString() }
130 |
131 | ); 132 | } 133 | } 134 | 135 | export default withWindow(YourComponent); 136 | ``` 137 | 138 | If you run it on the server, `withWindow` will return these initial values 139 | 140 | ```js 141 | { 142 | dimensions: { 143 | width: 0, 144 | height: 0, 145 | }, 146 | breakpoint: null, 147 | orientation: null, 148 | isTouchDevice: false, 149 | }; 150 | ``` 151 | 152 | ## Chaining Decorators 153 | 154 | ```js 155 | @withWindow 156 | @withScroll 157 | export default class YourComponent extends Component { 158 | ... 159 | } 160 | ``` 161 | 162 | or 163 | 164 | ```js 165 | class YourComponent extends Component { 166 | ... 167 | } 168 | 169 | export default withWindow(withScroll(Demo)); 170 | ``` 171 | 172 | ## License 173 | 174 | Released under [MIT License](LICENSE.md). 175 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stanko/react-window-decorators/f2e267b2c59f46926c371e9c0c48064c0b7237a5/docs/.nojekyll -------------------------------------------------------------------------------- /docs/build/docs.js: -------------------------------------------------------------------------------- 1 | "use strict";(()=>{var ef=Object.create;var Il=Object.defineProperty,nf=Object.defineProperties,tf=Object.getOwnPropertyDescriptor,rf=Object.getOwnPropertyDescriptors,lf=Object.getOwnPropertyNames,ou=Object.getOwnPropertySymbols,of=Object.getPrototypeOf,uu=Object.prototype.hasOwnProperty,uf=Object.prototype.propertyIsEnumerable;var iu=(e,n,t)=>n in e?Il(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,or=(e,n)=>{for(var t in n||(n={}))uu.call(n,t)&&iu(e,t,n[t]);if(ou)for(var t of ou(n))uf.call(n,t)&&iu(e,t,n[t]);return e},ir=(e,n)=>nf(e,rf(n));var Ue=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var sf=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of lf(n))!uu.call(e,l)&&l!==t&&Il(e,l,{get:()=>n[l],enumerable:!(r=tf(n,l))||r.enumerable});return e};var wn=(e,n,t)=>(t=e!=null?ef(of(e)):{},sf(n||!e||!e.__esModule?Il(t,"default",{value:e,enumerable:!0}):t,e));var gu=Ue(N=>{"use strict";var dt=Symbol.for("react.element"),af=Symbol.for("react.portal"),cf=Symbol.for("react.fragment"),ff=Symbol.for("react.strict_mode"),df=Symbol.for("react.profiler"),pf=Symbol.for("react.provider"),mf=Symbol.for("react.context"),hf=Symbol.for("react.forward_ref"),vf=Symbol.for("react.suspense"),yf=Symbol.for("react.memo"),gf=Symbol.for("react.lazy"),su=Symbol.iterator;function wf(e){return e===null||typeof e!="object"?null:(e=su&&e[su]||e["@@iterator"],typeof e=="function"?e:null)}var fu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},du=Object.assign,pu={};function Fn(e,n,t){this.props=e,this.context=n,this.refs=pu,this.updater=t||fu}Fn.prototype.isReactComponent={};Fn.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")};Fn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function mu(){}mu.prototype=Fn.prototype;function Rl(e,n,t){this.props=e,this.context=n,this.refs=pu,this.updater=t||fu}var jl=Rl.prototype=new mu;jl.constructor=Rl;du(jl,Fn.prototype);jl.isPureReactComponent=!0;var au=Array.isArray,hu=Object.prototype.hasOwnProperty,Ul={current:null},vu={key:!0,ref:!0,__self:!0,__source:!0};function yu(e,n,t){var r,l={},o=null,i=null;if(n!=null)for(r in n.ref!==void 0&&(i=n.ref),n.key!==void 0&&(o=""+n.key),n)hu.call(n,r)&&!vu.hasOwnProperty(r)&&(l[r]=n[r]);var u=arguments.length-2;if(u===1)l.children=t;else if(1{"use strict";wu.exports=gu()});var Tu=Ue(D=>{"use strict";function Hl(e,n){var t=e.length;e.push(n);e:for(;0>>1,l=e[r];if(0>>1;rcr(u,t))scr(c,u)?(e[r]=c,e[s]=t,r=s):(e[r]=u,e[i]=t,r=i);else if(scr(c,t))e[r]=c,e[s]=t,r=s;else break e}}return n}function cr(e,n){var t=e.sortIndex-n.sortIndex;return t!==0?t:e.id-n.id}typeof performance=="object"&&typeof performance.now=="function"?(Su=performance,D.unstable_now=function(){return Su.now()}):(Vl=Date,ku=Vl.now(),D.unstable_now=function(){return Vl.now()-ku});var Su,Vl,ku,Me=[],Ze=[],xf=1,ye=null,J=3,pr=!1,Sn=!1,mt=!1,xu=typeof setTimeout=="function"?setTimeout:null,_u=typeof clearTimeout=="function"?clearTimeout:null,Eu=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function $l(e){for(var n=xe(Ze);n!==null;){if(n.callback===null)dr(Ze);else if(n.startTime<=e)dr(Ze),n.sortIndex=n.expirationTime,Hl(Me,n);else break;n=xe(Ze)}}function Ql(e){if(mt=!1,$l(e),!Sn)if(xe(Me)!==null)Sn=!0,Kl(Yl);else{var n=xe(Ze);n!==null&&Xl(Ql,n.startTime-e)}}function Yl(e,n){Sn=!1,mt&&(mt=!1,_u(ht),ht=-1),pr=!0;var t=J;try{for($l(n),ye=xe(Me);ye!==null&&(!(ye.expirationTime>n)||e&&!zu());){var r=ye.callback;if(typeof r=="function"){ye.callback=null,J=ye.priorityLevel;var l=r(ye.expirationTime<=n);n=D.unstable_now(),typeof l=="function"?ye.callback=l:ye===xe(Me)&&dr(Me),$l(n)}else dr(Me);ye=xe(Me)}if(ye!==null)var o=!0;else{var i=xe(Ze);i!==null&&Xl(Ql,i.startTime-n),o=!1}return o}finally{ye=null,J=t,pr=!1}}var mr=!1,fr=null,ht=-1,Pu=5,Nu=-1;function zu(){return!(D.unstable_now()-Nue||125r?(e.sortIndex=t,Hl(Ze,e),xe(Me)===null&&e===xe(Ze)&&(mt?(_u(ht),ht=-1):mt=!0,Xl(Ql,t-r))):(e.sortIndex=l,Hl(Me,e),Sn||pr||(Sn=!0,Kl(Yl))),e};D.unstable_shouldYield=zu;D.unstable_wrapCallback=function(e){var n=J;return function(){var t=J;J=n;try{return e.apply(this,arguments)}finally{J=t}}}});var Du=Ue((Up,Lu)=>{"use strict";Lu.exports=Tu()});var jc=Ue(ve=>{"use strict";var Us=Rn(),me=Du();function v(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),go=Object.prototype.hasOwnProperty,_f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Mu={},Ou={};function Pf(e){return go.call(Ou,e)?!0:go.call(Mu,e)?!1:_f.test(e)?Ou[e]=!0:(Mu[e]=!0,!1)}function Nf(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zf(e,n,t,r){if(n===null||typeof n>"u"||Nf(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function oe(e,n,t,r,l,o,i){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=o,this.removeEmptyString=i}var Z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Z[e]=new oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];Z[n]=new oe(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Z[e]=new oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Z[e]=new oe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Z[e]=new oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Z[e]=new oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Z[e]=new oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Z[e]=new oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Z[e]=new oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var ci=/[\-:]([a-z])/g;function fi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(ci,fi);Z[n]=new oe(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(ci,fi);Z[n]=new oe(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(ci,fi);Z[n]=new oe(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Z[e]=new oe(e,1,!1,e.toLowerCase(),null,!1,!1)});Z.xlinkHref=new oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Z[e]=new oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function di(e,n,t,r){var l=Z.hasOwnProperty(n)?Z[n]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` 5 | `+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{Zl=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?xt(e):""}function Tf(e){switch(e.tag){case 5:return xt(e.type);case 16:return xt("Lazy");case 13:return xt("Suspense");case 19:return xt("SuspenseList");case 0:case 2:case 15:return e=Jl(e.type,!1),e;case 11:return e=Jl(e.type.render,!1),e;case 1:return e=Jl(e.type,!0),e;default:return""}}function Eo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vn:return"Fragment";case An:return"Portal";case wo:return"Profiler";case pi:return"StrictMode";case So:return"Suspense";case ko:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ws:return(e.displayName||"Context")+".Consumer";case Vs:return(e._context.displayName||"Context")+".Provider";case mi:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hi:return n=e.displayName||null,n!==null?n:Eo(e.type)||"Memo";case qe:n=e._payload,e=e._init;try{return Eo(e(n))}catch{}}return null}function Lf(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Eo(n);case 8:return n===pi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function pn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hs(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Df(e){var n=Hs(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var l=t.get,o=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function vr(e){e._valueTracker||(e._valueTracker=Df(e))}function $s(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=Hs(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function $r(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Co(e,n){var t=n.checked;return U({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Fu(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=pn(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Qs(e,n){n=n.checked,n!=null&&di(e,"checked",n,!1)}function xo(e,n){Qs(e,n);var t=pn(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?_o(e,n.type,t):n.hasOwnProperty("defaultValue")&&_o(e,n.type,pn(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Ru(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function _o(e,n,t){(n!=="number"||$r(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var _t=Array.isArray;function Jn(e,n,t,r){if(e=e.options,n){n={};for(var l=0;l"+n.valueOf().toString()+"",n=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Ut(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var zt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mf=["Webkit","ms","Moz","O"];Object.keys(zt).forEach(function(e){Mf.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),zt[n]=zt[e]})});function Gs(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||zt.hasOwnProperty(e)&&zt[e]?(""+n).trim():n+"px"}function Zs(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,l=Gs(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,l):e[t]=l}}var Of=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function zo(e,n){if(n){if(Of[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(v(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(v(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(v(61))}if(n.style!=null&&typeof n.style!="object")throw Error(v(62))}}function To(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lo=null;function vi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Do=null,qn=null,bn=null;function Au(e){if(e=tr(e)){if(typeof Do!="function")throw Error(v(280));var n=e.stateNode;n&&(n=gl(n),Do(e.stateNode,e.type,n))}}function Js(e){qn?bn?bn.push(e):bn=[e]:qn=e}function qs(){if(qn){var e=qn,n=bn;if(bn=qn=null,Au(e),n)for(e=0;e>>=0,e===0?32:31-($f(e)/Qf|0)|0}var gr=64,wr=4194304;function Pt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xr(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=t&268435455;if(i!==0){var u=i&~l;u!==0?r=Pt(u):(o&=i,o!==0&&(r=Pt(o)))}else i=t&~l,i!==0?r=Pt(i):o!==0&&(r=Pt(o));if(r===0)return 0;if(n!==0&&n!==r&&(n&l)===0&&(l=r&-r,o=n&-n,l>=o||l===16&&(o&4194240)!==0))return n;if((r&4)!==0&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function er(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Te(n),e[n]=t}function Gf(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Lt),Xu=String.fromCharCode(32),Gu=!1;function ga(e,n){switch(e){case"keyup":return Cd.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wn=!1;function _d(e,n){switch(e){case"compositionend":return wa(n);case"keypress":return n.which!==32?null:(Gu=!0,Xu);case"textInput":return e=n.data,e===Xu&&Gu?null:e;default:return null}}function Pd(e,n){if(Wn)return e==="compositionend"||!xi&&ga(e,n)?(e=va(),Fr=ki=tn=null,Wn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=qu(t)}}function Ca(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ca(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function xa(){for(var e=window,n=$r();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=$r(e.document)}return n}function _i(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Fd(e){var n=xa(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&Ca(t.ownerDocument.documentElement,t)){if(r!==null&&_i(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var l=t.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=bu(t,o);var i=bu(t,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(n=n.createRange(),n.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(n),e.extend(i.node,i.offset)):(n.setEnd(i.node,i.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Bn=null,jo=null,Mt=null,Uo=!1;function es(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Uo||Bn==null||Bn!==$r(r)||(r=Bn,"selectionStart"in r&&_i(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mt&&$t(Mt,r)||(Mt=r,r=Jr(jo,"onSelect"),0Qn||(e.current=$o[Qn],$o[Qn]=null,Qn--)}function M(e,n){Qn++,$o[Qn]=e.current,e.current=n}var mn={},ne=vn(mn),se=vn(!1),zn=mn;function lt(e,n){var t=e.type.contextTypes;if(!t)return mn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in t)l[o]=n[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=l),l}function ae(e){return e=e.childContextTypes,e!=null}function br(){I(se),I(ne)}function as(e,n,t){if(ne.current!==mn)throw Error(v(168));M(ne,n),M(se,t)}function Oa(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var l in r)if(!(l in n))throw Error(v(108,Lf(e)||"Unknown",l));return U({},t,r)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mn,zn=ne.current,M(ne,e),M(se,se.current),!0}function cs(e,n,t){var r=e.stateNode;if(!r)throw Error(v(169));t?(e=Oa(e,n,zn),r.__reactInternalMemoizedMergedChildContext=e,I(se),I(ne),M(ne,e)):I(se),M(se,t)}var Ve=null,wl=!1,so=!1;function Ia(e){Ve===null?Ve=[e]:Ve.push(e)}function Qd(e){wl=!0,Ia(e)}function yn(){if(!so&&Ve!==null){so=!0;var e=0,n=L;try{var t=Ve;for(L=1;e>=i,l-=i,We=1<<32-Te(n)+l|t<_?(Q=x,x=null):Q=x.sibling;var T=m(f,x,d[_],y);if(T===null){x===null&&(x=Q);break}e&&x&&T.alternate===null&&n(f,x),a=o(T,a,_),C===null?E=T:C.sibling=T,C=T,x=Q}if(_===d.length)return t(f,x),F&&kn(f,_),E;if(x===null){for(;__?(Q=x,x=null):Q=x.sibling;var Ge=m(f,x,T.value,y);if(Ge===null){x===null&&(x=Q);break}e&&x&&Ge.alternate===null&&n(f,x),a=o(Ge,a,_),C===null?E=Ge:C.sibling=Ge,C=Ge,x=Q}if(T.done)return t(f,x),F&&kn(f,_),E;if(x===null){for(;!T.done;_++,T=d.next())T=h(f,T.value,y),T!==null&&(a=o(T,a,_),C===null?E=T:C.sibling=T,C=T);return F&&kn(f,_),E}for(x=r(f,x);!T.done;_++,T=d.next())T=g(x,f,_,T.value,y),T!==null&&(e&&T.alternate!==null&&x.delete(T.key===null?_:T.key),a=o(T,a,_),C===null?E=T:C.sibling=T,C=T);return e&&x.forEach(function(bc){return n(f,bc)}),F&&kn(f,_),E}function V(f,a,d,y){if(typeof d=="object"&&d!==null&&d.type===Vn&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case hr:e:{for(var E=d.key,C=a;C!==null;){if(C.key===E){if(E=d.type,E===Vn){if(C.tag===7){t(f,C.sibling),a=l(C,d.props.children),a.return=f,f=a;break e}}else if(C.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===qe&&ys(E)===C.type){t(f,C.sibling),a=l(C,d.props),a.ref=St(f,C,d),a.return=f,f=a;break e}t(f,C);break}else n(f,C);C=C.sibling}d.type===Vn?(a=Nn(d.props.children,f.mode,y,d.key),a.return=f,f=a):(y=Hr(d.type,d.key,d.props,null,f.mode,y),y.ref=St(f,a,d),y.return=f,f=y)}return i(f);case An:e:{for(C=d.key;a!==null;){if(a.key===C)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){t(f,a.sibling),a=l(a,d.children||[]),a.return=f,f=a;break e}else{t(f,a);break}else n(f,a);a=a.sibling}a=yo(d,f.mode,y),a.return=f,f=a}return i(f);case qe:return C=d._init,V(f,a,C(d._payload),y)}if(_t(d))return S(f,a,d,y);if(vt(d))return k(f,a,d,y);Lr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(t(f,a.sibling),a=l(a,d),a.return=f,f=a):(t(f,a),a=vo(d,f.mode,y),a.return=f,f=a),i(f)):t(f,a)}return V}var it=Ba(!0),Ha=Ba(!1),rr={},je=vn(rr),Xt=vn(rr),Gt=vn(rr);function _n(e){if(e===rr)throw Error(v(174));return e}function Ii(e,n){switch(M(Gt,n),M(Xt,e),M(je,rr),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:No(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=No(n,e)}I(je),M(je,n)}function ut(){I(je),I(Xt),I(Gt)}function $a(e){_n(Gt.current);var n=_n(je.current),t=No(n,e.type);n!==t&&(M(Xt,e),M(je,t))}function Fi(e){Xt.current===e&&(I(je),I(Xt))}var R=vn(0);function il(e){for(var n=e;n!==null;){if(n.tag===13){var t=n.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ao=[];function Ri(){for(var e=0;et?t:4,e(!0);var r=co.transition;co.transition={};try{e(!1),n()}finally{L=t,co.transition=r}}function ic(){return Ce().memoizedState}function Gd(e,n,t){var r=fn(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},uc(e))sc(n,t);else if(t=Ua(e,n,t,r),t!==null){var l=le();Le(t,e,r,l),ac(t,n,r)}}function Zd(e,n,t){var r=fn(e),l={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(uc(e))sc(n,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=n.lastRenderedReducer,o!==null))try{var i=n.lastRenderedState,u=o(i,t);if(l.hasEagerState=!0,l.eagerState=u,De(u,i)){var s=n.interleaved;s===null?(l.next=l,Mi(n)):(l.next=s.next,s.next=l),n.interleaved=l;return}}catch{}finally{}t=Ua(e,n,l,r),t!==null&&(l=le(),Le(t,e,r,l),ac(t,n,r))}}function uc(e){var n=e.alternate;return e===j||n!==null&&n===j}function sc(e,n){Ot=ul=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function ac(e,n,t){if((t&4194240)!==0){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,gi(e,t)}}var sl={readContext:Ee,useCallback:q,useContext:q,useEffect:q,useImperativeHandle:q,useInsertionEffect:q,useLayoutEffect:q,useMemo:q,useReducer:q,useRef:q,useState:q,useDebugValue:q,useDeferredValue:q,useTransition:q,useMutableSource:q,useSyncExternalStore:q,useId:q,unstable_isNewReconciler:!1},Jd={readContext:Ee,useCallback:function(e,n){return Ie().memoizedState=[e,n===void 0?null:n],e},useContext:Ee,useEffect:ws,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,Ar(4194308,4,nc.bind(null,n,e),t)},useLayoutEffect:function(e,n){return Ar(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ar(4,2,e,n)},useMemo:function(e,n){var t=Ie();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=Ie();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=Gd.bind(null,j,e),[r.memoizedState,e]},useRef:function(e){var n=Ie();return e={current:e},n.memoizedState=e},useState:gs,useDebugValue:Wi,useDeferredValue:function(e){return Ie().memoizedState=e},useTransition:function(){var e=gs(!1),n=e[0];return e=Xd.bind(null,e[1]),Ie().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=j,l=Ie();if(F){if(t===void 0)throw Error(v(407));t=t()}else{if(t=n(),K===null)throw Error(v(349));(Ln&30)!==0||Ka(r,n,t)}l.memoizedState=t;var o={value:t,getSnapshot:n};return l.queue=o,ws(Ga.bind(null,r,o,e),[e]),r.flags|=2048,qt(9,Xa.bind(null,r,o,t,n),void 0,null),t},useId:function(){var e=Ie(),n=K.identifierPrefix;if(F){var t=Be,r=We;t=(r&~(1<<32-Te(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=Zt++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(t,{is:r.is}):(e=i.createElement(t),t==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,t),e[Fe]=n,e[Kt]=r,gc(e,n,!1,!1),n.stateNode=e;e:{switch(i=To(t,r),t){case"dialog":O("cancel",e),O("close",e),l=r;break;case"iframe":case"object":case"embed":O("load",e),l=r;break;case"video":case"audio":for(l=0;lat&&(n.flags|=128,r=!0,kt(o,!1),n.lanes=4194304)}else{if(!r)if(e=il(i),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),kt(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!F)return b(n),null}else 2*W()-o.renderingStartTime>at&&t!==1073741824&&(n.flags|=128,r=!0,kt(o,!1),n.lanes=4194304);o.isBackwards?(i.sibling=n.child,n.child=i):(t=o.last,t!==null?t.sibling=i:n.child=i,o.last=i)}return o.tail!==null?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=W(),n.sibling=null,t=R.current,M(R,r?t&1|2:t&1),n):(b(n),null);case 22:case 23:return Ki(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&(n.mode&1)!==0?(fe&1073741824)!==0&&(b(n),n.subtreeFlags&6&&(n.flags|=8192)):b(n),null;case 24:return null;case 25:return null}throw Error(v(156,n.tag))}function op(e,n){switch(Ni(n),n.tag){case 1:return ae(n.type)&&br(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ut(),I(se),I(ne),Ri(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Fi(n),null;case 13:if(I(R),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(v(340));ot()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return I(R),null;case 4:return ut(),null;case 10:return Di(n.type._context),null;case 22:case 23:return Ki(),null;case 24:return null;default:return null}}var Mr=!1,ee=!1,ip=typeof WeakSet=="function"?WeakSet:Set,w=null;function Gn(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){A(e,n,r)}else t.current=null}function ti(e,n,t){try{t()}catch(r){A(e,n,r)}}var zs=!1;function up(e,n){if(Ao=Gr,e=xa(),_i(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{t.nodeType,o.nodeType}catch{t=null;break e}var i=0,u=-1,s=-1,c=0,p=0,h=e,m=null;n:for(;;){for(var g;h!==t||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(g=h.firstChild)!==null;)m=h,h=g;for(;;){if(h===e)break n;if(m===t&&++c===l&&(u=i),m===o&&++p===r&&(s=i),(g=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=g}t=u===-1||s===-1?null:{start:u,end:s}}else t=null}t=t||{start:0,end:0}}else t=null;for(Vo={focusedElem:e,selectionRange:t},Gr=!1,w=n;w!==null;)if(n=w,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,w=e;else for(;w!==null;){n=w;try{var S=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var k=S.memoizedProps,V=S.memoizedState,f=n.stateNode,a=f.getSnapshotBeforeUpdate(n.elementType===n.type?k:Pe(n.type,k),V);f.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=n.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(v(163))}}catch(y){A(n,n.return,y)}if(e=n.sibling,e!==null){e.return=n.return,w=e;break}w=n.return}return S=zs,zs=!1,S}function It(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&ti(n,t,o)}l=l.next}while(l!==r)}}function El(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function ri(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function kc(e){var n=e.alternate;n!==null&&(e.alternate=null,kc(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[Fe],delete n[Kt],delete n[Ho],delete n[Hd],delete n[$d])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Ts(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function li(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=qr));else if(r!==4&&(e=e.child,e!==null))for(li(e,n,t),e=e.sibling;e!==null;)li(e,n,t),e=e.sibling}function oi(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(oi(e,n,t),e=e.sibling;e!==null;)oi(e,n,t),e=e.sibling}var X=null,Ne=!1;function Je(e,n,t){for(t=t.child;t!==null;)Cc(e,n,t),t=t.sibling}function Cc(e,n,t){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(ml,t)}catch{}switch(t.tag){case 5:ee||Gn(t,n);case 6:var r=X,l=Ne;X=null,Je(e,n,t),X=r,Ne=l,X!==null&&(Ne?(e=X,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):X.removeChild(t.stateNode));break;case 18:X!==null&&(Ne?(e=X,t=t.stateNode,e.nodeType===8?uo(e.parentNode,t):e.nodeType===1&&uo(e,t),Bt(e)):uo(X,t.stateNode));break;case 4:r=X,l=Ne,X=t.stateNode.containerInfo,Ne=!0,Je(e,n,t),X=r,Ne=l;break;case 0:case 11:case 14:case 15:if(!ee&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&ti(t,n,i),l=l.next}while(l!==r)}Je(e,n,t);break;case 1:if(!ee&&(Gn(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(u){A(t,n,u)}Je(e,n,t);break;case 21:Je(e,n,t);break;case 22:t.mode&1?(ee=(r=ee)||t.memoizedState!==null,Je(e,n,t),ee=r):Je(e,n,t);break;default:Je(e,n,t)}}function Ls(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new ip),n.forEach(function(r){var l=vp.bind(null,e,r);t.has(r)||(t.add(r),r.then(l,l))})}}function _e(e,n){var t=n.deletions;if(t!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=W()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ap(r/1960))-r,10e?16:e,rn===null)var r=!1;else{if(e=rn,rn=null,fl=0,(z&6)!==0)throw Error(v(331));var l=z;for(z|=4,w=e.current;w!==null;){var o=w,i=o.child;if((w.flags&16)!==0){var u=o.deletions;if(u!==null){for(var s=0;sW()-Qi?Pn(e,0):$i|=t),ce(e,n)}function Dc(e,n){n===0&&((e.mode&1)===0?n=1:(n=wr,wr<<=1,(wr&130023424)===0&&(wr=4194304)));var t=le();e=Ye(e,n),e!==null&&(er(e,n,t),ce(e,t))}function hp(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Dc(e,t)}function vp(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(t=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(v(314))}r!==null&&r.delete(n),Dc(e,t)}var Mc;Mc=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||se.current)ue=!0;else{if((e.lanes&t)===0&&(n.flags&128)===0)return ue=!1,rp(e,n,t);ue=(e.flags&131072)!==0}else ue=!1,F&&(n.flags&1048576)!==0&&Fa(n,tl,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;Vr(e,n),e=n.pendingProps;var l=lt(n,ne.current);nt(n,t),l=Ui(null,n,r,e,l,t);var o=Ai();return n.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,ae(r)?(o=!0,el(n)):o=!1,n.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Oi(n),l.updater=Sl,n.stateNode=l,l._reactInternals=n,Go(n,r,e,t),n=qo(null,n,r,!0,o,t)):(n.tag=0,F&&o&&Pi(n),re(null,n,l,t),n=n.child),n;case 16:r=n.elementType;e:{switch(Vr(e,n),e=n.pendingProps,l=r._init,r=l(r._payload),n.type=r,l=n.tag=gp(r),e=Pe(r,e),l){case 0:n=Jo(null,n,r,e,t);break e;case 1:n=_s(null,n,r,e,t);break e;case 11:n=Cs(null,n,r,e,t);break e;case 14:n=xs(null,n,r,Pe(r.type,e),t);break e}throw Error(v(306,r,""))}return n;case 0:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Pe(r,l),Jo(e,n,r,l,t);case 1:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Pe(r,l),_s(e,n,r,l,t);case 3:e:{if(hc(n),e===null)throw Error(v(387));r=n.pendingProps,o=n.memoizedState,l=o.element,Aa(e,n),ol(n,r,null,t);var i=n.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},n.updateQueue.baseState=o,n.memoizedState=o,n.flags&256){l=st(Error(v(423)),n),n=Ps(e,n,r,t,l);break e}else if(r!==l){l=st(Error(v(424)),n),n=Ps(e,n,r,t,l);break e}else for(de=sn(n.stateNode.containerInfo.firstChild),pe=n,F=!0,ze=null,t=Ha(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(ot(),r===l){n=Ke(e,n,t);break e}re(e,n,r,t)}n=n.child}return n;case 5:return $a(n),e===null&&Yo(n),r=n.type,l=n.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Wo(r,l)?i=null:o!==null&&Wo(r,o)&&(n.flags|=32),mc(e,n),re(e,n,i,t),n.child;case 6:return e===null&&Yo(n),null;case 13:return vc(e,n,t);case 4:return Ii(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=it(n,null,r,t):re(e,n,r,t),n.child;case 11:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Pe(r,l),Cs(e,n,r,l,t);case 7:return re(e,n,n.pendingProps,t),n.child;case 8:return re(e,n,n.pendingProps.children,t),n.child;case 12:return re(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,l=n.pendingProps,o=n.memoizedProps,i=l.value,M(rl,r._currentValue),r._currentValue=i,o!==null)if(De(o.value,i)){if(o.children===l.children&&!se.current){n=Ke(e,n,t);break e}}else for(o=n.child,o!==null&&(o.return=n);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=He(-1,t&-t),s.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?s.next=s:(s.next=p.next,p.next=s),c.pending=s}}o.lanes|=t,s=o.alternate,s!==null&&(s.lanes|=t),Ko(o.return,t,n),u.lanes|=t;break}s=s.next}}else if(o.tag===10)i=o.type===n.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(v(341));i.lanes|=t,u=i.alternate,u!==null&&(u.lanes|=t),Ko(i,t,n),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===n){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}re(e,n,l.children,t),n=n.child}return n;case 9:return l=n.type,r=n.pendingProps.children,nt(n,t),l=Ee(l),r=r(l),n.flags|=1,re(e,n,r,t),n.child;case 14:return r=n.type,l=Pe(r,n.pendingProps),l=Pe(r.type,l),xs(e,n,r,l,t);case 15:return dc(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Pe(r,l),Vr(e,n),n.tag=1,ae(r)?(e=!0,el(n)):e=!1,nt(n,t),Wa(n,r,l),Go(n,r,l,t),qo(null,n,r,!0,e,t);case 19:return yc(e,n,t);case 22:return pc(e,n,t)}throw Error(v(156,n.tag))};function Oc(e,n){return oa(e,n)}function yp(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Se(e,n,t,r){return new yp(e,n,t,r)}function Gi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gp(e){if(typeof e=="function")return Gi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mi)return 11;if(e===hi)return 14}return 2}function dn(e,n){var t=e.alternate;return t===null?(t=Se(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function Hr(e,n,t,r,l,o){var i=2;if(r=e,typeof e=="function")Gi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Vn:return Nn(t.children,l,o,n);case pi:i=8,l|=8;break;case wo:return e=Se(12,t,n,l|2),e.elementType=wo,e.lanes=o,e;case So:return e=Se(13,t,n,l),e.elementType=So,e.lanes=o,e;case ko:return e=Se(19,t,n,l),e.elementType=ko,e.lanes=o,e;case Bs:return xl(t,l,o,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Vs:i=10;break e;case Ws:i=9;break e;case mi:i=11;break e;case hi:i=14;break e;case qe:i=16,r=null;break e}throw Error(v(130,e==null?e:typeof e,""))}return n=Se(i,t,n,l),n.elementType=e,n.type=r,n.lanes=o,n}function Nn(e,n,t,r){return e=Se(7,e,r,n),e.lanes=t,e}function xl(e,n,t,r){return e=Se(22,e,r,n),e.elementType=Bs,e.lanes=t,e.stateNode={isHidden:!1},e}function vo(e,n,t){return e=Se(6,e,null,n),e.lanes=t,e}function yo(e,n,t){return n=Se(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function wp(e,n,t,r,l){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=bl(0),this.expirationTimes=bl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Zi(e,n,t,r,l,o,i,u,s){return e=new wp(e,n,t,u,s),n===1?(n=1,o===!0&&(n|=8)):n=0,o=Se(3,null,null,n),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oi(o),e}function Sp(e,n,t){var r=3{"use strict";function Uc(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Uc)}catch(e){console.error(e)}}Uc(),Ac.exports=jc()});var Bc=Ue(eu=>{"use strict";var Wc=Vc();eu.createRoot=Wc.createRoot,eu.hydrateRoot=Wc.hydrateRoot;var Wp});var $c=Ue((Hc,Tl)=>{"use strict";(function(){var e=null,n=0,t=!1,r="window-scroll",l=typeof window<"u";function o(){if(l&&typeof window.addEventListener=="function"){var c=!1,p=Object.defineProperty({},"passive",{get:function(){c=!0}}),h=function(){};return window.addEventListener("TEST_PASSIVE_EVENT_SUPPORT",h,p),window.removeEventListener("TEST_PASSIVE_EVENT_SUPPORT",h,p),c}return!1}var i=o(),u=l&&typeof window.CustomEvent=="function";function s(){if(typeof window>"u")return null;if(n++,e)return e;e=this,this.handleScroll=this.handleScroll.bind(this),this.eventListenerOptions=i?{passive:!0}:!0,window.addEventListener("scroll",this.handleScroll,this.eventListenerOptions)}s.prototype.removeListener=function(){n--,n===0&&this.destroy()},s.prototype.destroy=function(){window.removeEventListener("scroll",this.handleScroll,this.eventListenerOptions),e=null,n=0},s.prototype.getScrollPosition=function(){var c=window.scrollY||document.documentElement.scrollTop,p=window.scrollX||document.documentElement.scrollLeft;return c<0&&(c=0),p<0&&(p=0),{scrollPosition:c,scrollPositionY:c,scrollPositionX:p}},s.prototype.handleScroll=function(){if(!t){t=!0;var c;u?c=new CustomEvent(r,{detail:this.getScrollPosition()}):(c=document.createEvent("CustomEvent"),c.initCustomEvent(r,!1,!1,this.getScrollPosition())),window.dispatchEvent(c),window.requestAnimationFrame(function(){t=!1})}},typeof Tl<"u"&&Tl.exports?(s.default=s,Tl.exports=s):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("window-scroll-manager",[],function(){return s}):window.ScrollManager=s}).call(Hc)});var Kc=Ue((Dl,Yc)=>{Object.defineProperty(Dl,"__esModule",{value:!0});Dl.default=Pp;function Pp(){return!!(typeof window<"u"&&("ontouchstart"in window||window.DocumentTouch&&typeof document<"u"&&document instanceof window.DocumentTouch))||!!(typeof navigator<"u"&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints))}Yc.exports=Dl.default});var lr=wn(Rn()),qc=wn(Bc());var P=wn(Rn());var Ll=wn(Rn()),Qc=wn($c());var _p=e=>class extends Ll.Component{constructor(){super();let t=0,r=0;typeof window!="undefined"&&(this.scrollManager=new Qc.default,t=this.scrollManager.getScrollPosition().scrollPositionX,r=this.scrollManager.getScrollPosition().scrollPositionY,this.handleScrollChange=this.handleScrollChange.bind(this)),this.state={scrollPositionX:t,scrollPositionY:r,scrollPosition:r}}componentDidMount(){window.addEventListener("window-scroll",this.handleScrollChange)}componentWillUnmount(){window.removeEventListener("window-scroll",this.handleScrollChange),this.scrollManager.removeListener(),this.scrollManager=null}handleScrollChange(t){let{scrollPositionY:r,scrollPositionX:l}=this.state,o=t.detail.scrollPositionY,i=t.detail.scrollPositionX;(o!==r||i!==l)&&requestAnimationFrame(()=>{this.setState({scrollPositionX:i,scrollPositionY:o,scrollPosition:o})})}render(){let{scrollPositionX:t,scrollPositionY:r}=this.state;return Ll.default.createElement(e,ir(or({},this.props),{scrollPositionX:t,scrollPositionY:r,scrollPosition:r}))}},nu=_p;var Ol=wn(Rn());var Gc=wn(Kc()),Xc="window-resize",Ml=null,tu=0,Np={LANDSCAPE:"(orientation: landscape)",PORTRAIT:"(orientation: portrait)"},zp=(0,Gc.default)(),Zc=typeof window!="undefined",Tp=Zc&&typeof window.CustomEvent=="function",gn=class{constructor(n,t=250){if(!Zc)return null;if(tu++,this.breakpoints=n,this.debounceTime=t,Ml)return Ml;Ml=this,this.handleResize=this.handleResize.bind(this),window.addEventListener("resize",this.handleResize)}removeListener(){tu--,tu===0&&(Ml=null,window.removeEventListener("resize",this.handleResize))}getDimensions(){return{width:window.innerWidth,height:window.innerHeight}}getOrientation(){return window.matchMedia(Np.LANDSCAPE).matches?"landscape":"portrait"}getBreakpoint(){let n=null;if(this.breakpoints)for(let t=0;t{let n,t={breakpoint:this.getBreakpoint(),dimensions:this.getDimensions(),orientation:this.getOrientation()};Tp?n=new CustomEvent(Xc,{detail:t}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(Xc,!1,!1,t)),window.dispatchEvent(n)},this.debounceTime)}};var Lp=e=>class extends Ol.Component{constructor(){super();let t={dimensions:{width:0,height:0},breakpoint:null,orientation:null,isTouchDevice:!1};typeof window!="undefined"&&(this.windowManager=new gn,t.breakpoint=this.windowManager.getBreakpoint(),t.dimensions=this.windowManager.getDimensions(),t.orientation=this.windowManager.getOrientation(),t.isTouchDevice=this.windowManager.isTouchDevice()),this.state=t}componentDidMount(){this.handleWindowResize=this.handleWindowResize.bind(this),window.addEventListener("window-resize",this.handleWindowResize)}componentWillUnmount(){cancelAnimationFrame(this.animationFrameRef),window.removeEventListener("window-resize",this.handleWindowResize),this.windowManager.removeListener(),this.windowManager=null}handleWindowResize(t){let{breakpoint:r,dimensions:l,orientation:o}=this.state,i=t.detail.breakpoint,u=t.detail.dimensions,s=t.detail.orientation;(s!==o||i!==r||u.width!==l.width||u.height!==l.height)&&(cancelAnimationFrame(this.animationFrameRef),this.animationFrameRef=requestAnimationFrame(()=>{this.setState({breakpoint:i,dimensions:u,orientation:s})}))}render(){let{breakpoint:t,dimensions:r,orientation:l,isTouchDevice:o}=this.state;return Ol.default.createElement(e,ir(or({},this.props),{breakpoint:t,dimensions:r,orientation:l,isTouchDevice:o}))}},ru=Lp;var Dp=[{name:"small",media:"(min-width: 0)"},{name:"medium",media:"(min-width: 600px)"},{name:"large",media:"(min-width: 1000px)"},{name:"xlarge",media:"(min-width: 1500px)"},{name:"xxlarge",media:"(min-width: 2000px)"},{name:"xxxlarge",media:"(min-width: 2800px)"}];new gn(Dp);var lu=class extends P.default.Component{render(){let{breakpoint:n,dimensions:t,isTouchDevice:r,orientation:l,scrollPositionX:o,scrollPositionY:i}=this.props;return P.default.createElement("div",null,P.default.createElement("table",{className:"table table-striped table-bordered"},P.default.createElement("thead",null,P.default.createElement("tr",null,P.default.createElement("th",null,"Decorator"),P.default.createElement("th",null,"Prop"),P.default.createElement("th",null,"Value"))),P.default.createElement("tbody",null,P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withScroll")),P.default.createElement("td",null,P.default.createElement("code",null,"scrollPositionY")),P.default.createElement("td",null,i)),P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withScroll")),P.default.createElement("td",null,P.default.createElement("code",null,"scrollPositionX")),P.default.createElement("td",null,o)),P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withWindow")),P.default.createElement("td",null,P.default.createElement("code",null,"dimensions")),P.default.createElement("td",null,"width: ",t.width,", height: ",t.height)),P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withWindow")),P.default.createElement("td",null,P.default.createElement("code",null,"orientation")),P.default.createElement("td",null,l)),P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withWindow")),P.default.createElement("td",null,P.default.createElement("code",null,"breakpoint")),P.default.createElement("td",null,n)),P.default.createElement("tr",null,P.default.createElement("td",null,P.default.createElement("code",null,"withWindow")),P.default.createElement("td",null,P.default.createElement("code",null,"isTouchDevice")),P.default.createElement("td",null,r.toString())))))}},Jc=ru(nu(lu));var Mp=document.getElementById("demo"),Op=(0,qc.createRoot)(Mp);Op.render(lr.default.createElement(lr.StrictMode,null,lr.default.createElement(Jc,null)));})(); 9 | /** 10 | * @license React 11 | * react-dom.production.min.js 12 | * 13 | * Copyright (c) Facebook, Inc. and its affiliates. 14 | * 15 | * This source code is licensed under the MIT license found in the 16 | * LICENSE file in the root directory of this source tree. 17 | */ 18 | /** 19 | * @license React 20 | * react.production.min.js 21 | * 22 | * Copyright (c) Facebook, Inc. and its affiliates. 23 | * 24 | * This source code is licensed under the MIT license found in the 25 | * LICENSE file in the root directory of this source tree. 26 | */ 27 | /** 28 | * @license React 29 | * scheduler.production.min.js 30 | * 31 | * Copyright (c) Facebook, Inc. and its affiliates. 32 | * 33 | * This source code is licensed under the MIT license found in the 34 | * LICENSE file in the root directory of this source tree. 35 | */ 36 | //# sourceMappingURL=docs.js.map 37 | -------------------------------------------------------------------------------- /docs/css/style.css: -------------------------------------------------------------------------------- 1 | /* ---------- Reset ---------- */ 2 | *, 3 | *::before, 4 | *::after { 5 | box-sizing: border-box; 6 | } 7 | 8 | * { 9 | margin: 0; 10 | } 11 | 12 | html:focus-within { 13 | scroll-behavior: smooth; 14 | } 15 | 16 | @media (prefers-reduced-motion: reduce) { 17 | html:focus-within { 18 | scroll-behavior: auto; 19 | } 20 | 21 | *, 22 | *::before, 23 | *::after { 24 | transition: none !important; 25 | animation: none !important; 26 | scroll-behavior: auto !important; 27 | } 28 | } 29 | 30 | html, 31 | body { 32 | height: 100%; 33 | } 34 | 35 | body { 36 | -webkit-font-smoothing: antialiased; 37 | -moz-osx-font-smoothing: grayscale; 38 | font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Helvetica, Inter, Arial, 39 | "Noto Sans", sans-serif; 40 | } 41 | 42 | img, 43 | picture, 44 | video, 45 | canvas, 46 | svg { 47 | display: block; 48 | max-width: 100%; 49 | } 50 | 51 | input, 52 | button, 53 | textarea, 54 | select { 55 | font: inherit; 56 | color: inherit; 57 | } 58 | 59 | input { 60 | border-radius: 0; 61 | } 62 | 63 | p, 64 | h1, 65 | h2, 66 | h3, 67 | h4, 68 | h5, 69 | h6 { 70 | overflow-wrap: break-word; 71 | font-weight: 400; 72 | } 73 | 74 | button { 75 | padding: 0; 76 | background-color: transparent; 77 | border: none; 78 | border-radius: 0; 79 | cursor: pointer; 80 | } 81 | 82 | table { 83 | border-collapse: collapse; 84 | } 85 | 86 | /* ---------- Styles ---------- */ 87 | 88 | body { 89 | min-height: 200vh; 90 | } 91 | 92 | /* ---------- Styles ---------- */ 93 | 94 | body { 95 | background: #fdfdfd; 96 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 97 | min-height: 120vh; 98 | padding-bottom: 100px; 99 | } 100 | 101 | :root { 102 | --main-color: #e54d42; 103 | --main-color-dark: #c52d22; 104 | } 105 | 106 | a, 107 | a:active, 108 | a:visited, 109 | a:focus { 110 | color: var(--main-color); 111 | border-bottom: 1px solid transparent; 112 | } 113 | 114 | a:hover { 115 | color: var(--main-color-dark); 116 | border-bottom-color: #ddd; 117 | } 118 | 119 | h1 { 120 | margin: 1em 0; 121 | font-size: 32px; 122 | } 123 | 124 | h2, 125 | h3, 126 | h4, 127 | h5, 128 | h6 { 129 | margin: 1em 0 0.5em; 130 | } 131 | 132 | h2, 133 | h3, 134 | h4 { 135 | color: var(--main-color); 136 | } 137 | 138 | .container { 139 | max-width: 840px; 140 | position: relative; 141 | margin: 0 auto; 142 | padding: 0 20px; 143 | } 144 | 145 | .header { 146 | border-bottom: 1px solid #ddd; 147 | } 148 | 149 | .header a { 150 | display: inline-block; 151 | padding: 20px 0; 152 | margin-right: 20px; 153 | border: none; 154 | font-weight: 500; 155 | } 156 | 157 | .table-striped tr:nth-child(odd) > td, 158 | pre { 159 | background: #fafafa; 160 | } 161 | 162 | code { 163 | color: #346; 164 | font-size: 0.9em; 165 | padding: 0; 166 | background: none; 167 | border: none; 168 | font-weight: 500; 169 | } 170 | 171 | table code { 172 | background: none; 173 | border: 0; 174 | padding: 0; 175 | } 176 | 177 | th, 178 | td { 179 | padding: 10px 20px !important; 180 | } 181 | 182 | .demo { 183 | -webkit-overflow-scrolling: touch; 184 | overflow-x: auto; 185 | width: 100%; 186 | } 187 | 188 | pre { 189 | margin-bottom: 100px; 190 | color: #346; 191 | } 192 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | React Window Decorators 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 |
36 | My blog 37 | GitHub 38 | npm 39 |
40 |
41 | 42 |
43 |

React Window Decorators

44 |

45 | This is demo for react-window-decorators. 46 | Library includes two decorators (higher order components): 47 |

48 |
    49 |
  • 50 | withScroll - 51 | tracks window scroll and injects scrollPositionX and scrollPositionY prop to your 52 | component. 53 |
  • 54 |
  • 55 | withWindow - 56 | tracks window dimensions (width/height), orientation, breakpoint* 57 | and isTouchDevice 58 | and injects them all as props to your component. 59 |
  • 60 | * breakpoint configuration must be passed to it 61 |
62 |

63 | More detailed readme and documentation are available on GitHub. 65 |

66 |

Demo

67 |

Try scrollig or resizing your window

68 |
69 |
70 |

Breakpoints data used in this demo:

71 |
 72 | const BREAKPOINTS = [
 73 |   {
 74 |     name: 'small',
 75 |     media: '(min-width: 0)',
 76 |   },
 77 |   {
 78 |     name: 'medium',
 79 |     media: '(min-width: 600px)',
 80 |   },
 81 |   {
 82 |     name: 'large',
 83 |     media: '(min-width: 1000px)',
 84 |   },
 85 |   {
 86 |     name: 'xlarge',
 87 |     media: '(min-width: 1500px)',
 88 |   },
 89 |   {
 90 |     name: 'xxlarge',
 91 |     media: '(min-width: 2000px)',
 92 |   },
 93 |   {
 94 |     name: 'xxxlarge',
 95 |     media: '(min-width: 2800px)',
 96 |   },
 97 | ];
 98 | 
99 |
100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /docs/src/demo.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | // Loads our component from src for easier development 4 | import { withScroll, withWindow, WindowManager } from "../../src/index"; 5 | 6 | const BREAKPOINTS = [ 7 | { 8 | name: "small", 9 | media: "(min-width: 0)", 10 | }, 11 | { 12 | name: "medium", 13 | media: "(min-width: 600px)", 14 | }, 15 | { 16 | name: "large", 17 | media: "(min-width: 1000px)", 18 | }, 19 | { 20 | name: "xlarge", 21 | media: "(min-width: 1500px)", 22 | }, 23 | { 24 | name: "xxlarge", 25 | media: "(min-width: 2000px)", 26 | }, 27 | { 28 | name: "xxxlarge", 29 | media: "(min-width: 2800px)", 30 | }, 31 | ]; 32 | 33 | new WindowManager(BREAKPOINTS); 34 | 35 | class Demo extends React.Component { 36 | render() { 37 | // TODO types 38 | // @ts-ignore 39 | const { breakpoint, dimensions, isTouchDevice, orientation, scrollPositionX, scrollPositionY } = this.props; 40 | 41 | return ( 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 56 | 59 | 60 | 61 | 62 | 65 | 68 | 69 | 70 | 71 | 74 | 77 | 80 | 81 | 82 | 85 | 88 | 89 | 90 | 91 | 94 | 97 | 98 | 99 | 100 | 103 | 106 | 107 | 108 | 109 |
DecoratorPropValue
54 | withScroll 55 | 57 | scrollPositionY 58 | {scrollPositionY}
63 | withScroll 64 | 66 | scrollPositionX 67 | {scrollPositionX}
72 | withWindow 73 | 75 | dimensions 76 | 78 | width: {dimensions.width}, height: {dimensions.height} 79 |
83 | withWindow 84 | 86 | orientation 87 | {orientation}
92 | withWindow 93 | 95 | breakpoint 96 | {breakpoint}
101 | withWindow 102 | 104 | isTouchDevice 105 | {isTouchDevice.toString()}
110 |
111 | ); 112 | } 113 | } 114 | 115 | export default withWindow(withScroll(Demo)); 116 | -------------------------------------------------------------------------------- /docs/src/docs.tsx: -------------------------------------------------------------------------------- 1 | import React, { StrictMode, useEffect, useState } from "react"; 2 | import { createRoot } from "react-dom/client"; 3 | import Demo from "./demo"; 4 | 5 | const container = document.getElementById("demo") as HTMLElement; 6 | const root = createRoot(container); 7 | 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-window-decorators", 3 | "version": "1.0.8", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "react-window-decorators", 9 | "version": "1.0.8", 10 | "license": "MIT", 11 | "dependencies": { 12 | "is-touch-device": "^1.0.1", 13 | "prop-types": "^15.8.1", 14 | "window-scroll-manager": "^1.1.4" 15 | }, 16 | "devDependencies": { 17 | "@types/react": "^19.1.2", 18 | "@types/react-dom": "^19.1.3", 19 | "esbuild": "^0.25.3", 20 | "typescript": "^5.8.3" 21 | }, 22 | "peerDependencies": { 23 | "react": ">=15.5.4", 24 | "react-dom": ">=15.5.4" 25 | } 26 | }, 27 | "node_modules/@esbuild/aix-ppc64": { 28 | "version": "0.25.3", 29 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz", 30 | "integrity": "sha512-W8bFfPA8DowP8l//sxjJLSLkD8iEjMc7cBVyP+u4cEv9sM7mdUCkgsj+t0n/BWPFtv7WWCN5Yzj0N6FJNUUqBQ==", 31 | "cpu": [ 32 | "ppc64" 33 | ], 34 | "dev": true, 35 | "license": "MIT", 36 | "optional": true, 37 | "os": [ 38 | "aix" 39 | ], 40 | "engines": { 41 | "node": ">=18" 42 | } 43 | }, 44 | "node_modules/@esbuild/android-arm": { 45 | "version": "0.25.3", 46 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.3.tgz", 47 | "integrity": "sha512-PuwVXbnP87Tcff5I9ngV0lmiSu40xw1At6i3GsU77U7cjDDB4s0X2cyFuBiDa1SBk9DnvWwnGvVaGBqoFWPb7A==", 48 | "cpu": [ 49 | "arm" 50 | ], 51 | "dev": true, 52 | "license": "MIT", 53 | "optional": true, 54 | "os": [ 55 | "android" 56 | ], 57 | "engines": { 58 | "node": ">=18" 59 | } 60 | }, 61 | "node_modules/@esbuild/android-arm64": { 62 | "version": "0.25.3", 63 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.3.tgz", 64 | "integrity": "sha512-XelR6MzjlZuBM4f5z2IQHK6LkK34Cvv6Rj2EntER3lwCBFdg6h2lKbtRjpTTsdEjD/WSe1q8UyPBXP1x3i/wYQ==", 65 | "cpu": [ 66 | "arm64" 67 | ], 68 | "dev": true, 69 | "license": "MIT", 70 | "optional": true, 71 | "os": [ 72 | "android" 73 | ], 74 | "engines": { 75 | "node": ">=18" 76 | } 77 | }, 78 | "node_modules/@esbuild/android-x64": { 79 | "version": "0.25.3", 80 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.3.tgz", 81 | "integrity": "sha512-ogtTpYHT/g1GWS/zKM0cc/tIebFjm1F9Aw1boQ2Y0eUQ+J89d0jFY//s9ei9jVIlkYi8AfOjiixcLJSGNSOAdQ==", 82 | "cpu": [ 83 | "x64" 84 | ], 85 | "dev": true, 86 | "license": "MIT", 87 | "optional": true, 88 | "os": [ 89 | "android" 90 | ], 91 | "engines": { 92 | "node": ">=18" 93 | } 94 | }, 95 | "node_modules/@esbuild/darwin-arm64": { 96 | "version": "0.25.3", 97 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.3.tgz", 98 | "integrity": "sha512-eESK5yfPNTqpAmDfFWNsOhmIOaQA59tAcF/EfYvo5/QWQCzXn5iUSOnqt3ra3UdzBv073ykTtmeLJZGt3HhA+w==", 99 | "cpu": [ 100 | "arm64" 101 | ], 102 | "dev": true, 103 | "license": "MIT", 104 | "optional": true, 105 | "os": [ 106 | "darwin" 107 | ], 108 | "engines": { 109 | "node": ">=18" 110 | } 111 | }, 112 | "node_modules/@esbuild/darwin-x64": { 113 | "version": "0.25.3", 114 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.3.tgz", 115 | "integrity": "sha512-Kd8glo7sIZtwOLcPbW0yLpKmBNWMANZhrC1r6K++uDR2zyzb6AeOYtI6udbtabmQpFaxJ8uduXMAo1gs5ozz8A==", 116 | "cpu": [ 117 | "x64" 118 | ], 119 | "dev": true, 120 | "license": "MIT", 121 | "optional": true, 122 | "os": [ 123 | "darwin" 124 | ], 125 | "engines": { 126 | "node": ">=18" 127 | } 128 | }, 129 | "node_modules/@esbuild/freebsd-arm64": { 130 | "version": "0.25.3", 131 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.3.tgz", 132 | "integrity": "sha512-EJiyS70BYybOBpJth3M0KLOus0n+RRMKTYzhYhFeMwp7e/RaajXvP+BWlmEXNk6uk+KAu46j/kaQzr6au+JcIw==", 133 | "cpu": [ 134 | "arm64" 135 | ], 136 | "dev": true, 137 | "license": "MIT", 138 | "optional": true, 139 | "os": [ 140 | "freebsd" 141 | ], 142 | "engines": { 143 | "node": ">=18" 144 | } 145 | }, 146 | "node_modules/@esbuild/freebsd-x64": { 147 | "version": "0.25.3", 148 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.3.tgz", 149 | "integrity": "sha512-Q+wSjaLpGxYf7zC0kL0nDlhsfuFkoN+EXrx2KSB33RhinWzejOd6AvgmP5JbkgXKmjhmpfgKZq24pneodYqE8Q==", 150 | "cpu": [ 151 | "x64" 152 | ], 153 | "dev": true, 154 | "license": "MIT", 155 | "optional": true, 156 | "os": [ 157 | "freebsd" 158 | ], 159 | "engines": { 160 | "node": ">=18" 161 | } 162 | }, 163 | "node_modules/@esbuild/linux-arm": { 164 | "version": "0.25.3", 165 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.3.tgz", 166 | "integrity": "sha512-dUOVmAUzuHy2ZOKIHIKHCm58HKzFqd+puLaS424h6I85GlSDRZIA5ycBixb3mFgM0Jdh+ZOSB6KptX30DD8YOQ==", 167 | "cpu": [ 168 | "arm" 169 | ], 170 | "dev": true, 171 | "license": "MIT", 172 | "optional": true, 173 | "os": [ 174 | "linux" 175 | ], 176 | "engines": { 177 | "node": ">=18" 178 | } 179 | }, 180 | "node_modules/@esbuild/linux-arm64": { 181 | "version": "0.25.3", 182 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.3.tgz", 183 | "integrity": "sha512-xCUgnNYhRD5bb1C1nqrDV1PfkwgbswTTBRbAd8aH5PhYzikdf/ddtsYyMXFfGSsb/6t6QaPSzxtbfAZr9uox4A==", 184 | "cpu": [ 185 | "arm64" 186 | ], 187 | "dev": true, 188 | "license": "MIT", 189 | "optional": true, 190 | "os": [ 191 | "linux" 192 | ], 193 | "engines": { 194 | "node": ">=18" 195 | } 196 | }, 197 | "node_modules/@esbuild/linux-ia32": { 198 | "version": "0.25.3", 199 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.3.tgz", 200 | "integrity": "sha512-yplPOpczHOO4jTYKmuYuANI3WhvIPSVANGcNUeMlxH4twz/TeXuzEP41tGKNGWJjuMhotpGabeFYGAOU2ummBw==", 201 | "cpu": [ 202 | "ia32" 203 | ], 204 | "dev": true, 205 | "license": "MIT", 206 | "optional": true, 207 | "os": [ 208 | "linux" 209 | ], 210 | "engines": { 211 | "node": ">=18" 212 | } 213 | }, 214 | "node_modules/@esbuild/linux-loong64": { 215 | "version": "0.25.3", 216 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.3.tgz", 217 | "integrity": "sha512-P4BLP5/fjyihmXCELRGrLd793q/lBtKMQl8ARGpDxgzgIKJDRJ/u4r1A/HgpBpKpKZelGct2PGI4T+axcedf6g==", 218 | "cpu": [ 219 | "loong64" 220 | ], 221 | "dev": true, 222 | "license": "MIT", 223 | "optional": true, 224 | "os": [ 225 | "linux" 226 | ], 227 | "engines": { 228 | "node": ">=18" 229 | } 230 | }, 231 | "node_modules/@esbuild/linux-mips64el": { 232 | "version": "0.25.3", 233 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.3.tgz", 234 | "integrity": "sha512-eRAOV2ODpu6P5divMEMa26RRqb2yUoYsuQQOuFUexUoQndm4MdpXXDBbUoKIc0iPa4aCO7gIhtnYomkn2x+bag==", 235 | "cpu": [ 236 | "mips64el" 237 | ], 238 | "dev": true, 239 | "license": "MIT", 240 | "optional": true, 241 | "os": [ 242 | "linux" 243 | ], 244 | "engines": { 245 | "node": ">=18" 246 | } 247 | }, 248 | "node_modules/@esbuild/linux-ppc64": { 249 | "version": "0.25.3", 250 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.3.tgz", 251 | "integrity": "sha512-ZC4jV2p7VbzTlnl8nZKLcBkfzIf4Yad1SJM4ZMKYnJqZFD4rTI+pBG65u8ev4jk3/MPwY9DvGn50wi3uhdaghg==", 252 | "cpu": [ 253 | "ppc64" 254 | ], 255 | "dev": true, 256 | "license": "MIT", 257 | "optional": true, 258 | "os": [ 259 | "linux" 260 | ], 261 | "engines": { 262 | "node": ">=18" 263 | } 264 | }, 265 | "node_modules/@esbuild/linux-riscv64": { 266 | "version": "0.25.3", 267 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.3.tgz", 268 | "integrity": "sha512-LDDODcFzNtECTrUUbVCs6j9/bDVqy7DDRsuIXJg6so+mFksgwG7ZVnTruYi5V+z3eE5y+BJZw7VvUadkbfg7QA==", 269 | "cpu": [ 270 | "riscv64" 271 | ], 272 | "dev": true, 273 | "license": "MIT", 274 | "optional": true, 275 | "os": [ 276 | "linux" 277 | ], 278 | "engines": { 279 | "node": ">=18" 280 | } 281 | }, 282 | "node_modules/@esbuild/linux-s390x": { 283 | "version": "0.25.3", 284 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.3.tgz", 285 | "integrity": "sha512-s+w/NOY2k0yC2p9SLen+ymflgcpRkvwwa02fqmAwhBRI3SC12uiS10edHHXlVWwfAagYSY5UpmT/zISXPMW3tQ==", 286 | "cpu": [ 287 | "s390x" 288 | ], 289 | "dev": true, 290 | "license": "MIT", 291 | "optional": true, 292 | "os": [ 293 | "linux" 294 | ], 295 | "engines": { 296 | "node": ">=18" 297 | } 298 | }, 299 | "node_modules/@esbuild/linux-x64": { 300 | "version": "0.25.3", 301 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.3.tgz", 302 | "integrity": "sha512-nQHDz4pXjSDC6UfOE1Fw9Q8d6GCAd9KdvMZpfVGWSJztYCarRgSDfOVBY5xwhQXseiyxapkiSJi/5/ja8mRFFA==", 303 | "cpu": [ 304 | "x64" 305 | ], 306 | "dev": true, 307 | "license": "MIT", 308 | "optional": true, 309 | "os": [ 310 | "linux" 311 | ], 312 | "engines": { 313 | "node": ">=18" 314 | } 315 | }, 316 | "node_modules/@esbuild/netbsd-arm64": { 317 | "version": "0.25.3", 318 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.3.tgz", 319 | "integrity": "sha512-1QaLtOWq0mzK6tzzp0jRN3eccmN3hezey7mhLnzC6oNlJoUJz4nym5ZD7mDnS/LZQgkrhEbEiTn515lPeLpgWA==", 320 | "cpu": [ 321 | "arm64" 322 | ], 323 | "dev": true, 324 | "license": "MIT", 325 | "optional": true, 326 | "os": [ 327 | "netbsd" 328 | ], 329 | "engines": { 330 | "node": ">=18" 331 | } 332 | }, 333 | "node_modules/@esbuild/netbsd-x64": { 334 | "version": "0.25.3", 335 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.3.tgz", 336 | "integrity": "sha512-i5Hm68HXHdgv8wkrt+10Bc50zM0/eonPb/a/OFVfB6Qvpiirco5gBA5bz7S2SHuU+Y4LWn/zehzNX14Sp4r27g==", 337 | "cpu": [ 338 | "x64" 339 | ], 340 | "dev": true, 341 | "license": "MIT", 342 | "optional": true, 343 | "os": [ 344 | "netbsd" 345 | ], 346 | "engines": { 347 | "node": ">=18" 348 | } 349 | }, 350 | "node_modules/@esbuild/openbsd-arm64": { 351 | "version": "0.25.3", 352 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.3.tgz", 353 | "integrity": "sha512-zGAVApJEYTbOC6H/3QBr2mq3upG/LBEXr85/pTtKiv2IXcgKV0RT0QA/hSXZqSvLEpXeIxah7LczB4lkiYhTAQ==", 354 | "cpu": [ 355 | "arm64" 356 | ], 357 | "dev": true, 358 | "license": "MIT", 359 | "optional": true, 360 | "os": [ 361 | "openbsd" 362 | ], 363 | "engines": { 364 | "node": ">=18" 365 | } 366 | }, 367 | "node_modules/@esbuild/openbsd-x64": { 368 | "version": "0.25.3", 369 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.3.tgz", 370 | "integrity": "sha512-fpqctI45NnCIDKBH5AXQBsD0NDPbEFczK98hk/aa6HJxbl+UtLkJV2+Bvy5hLSLk3LHmqt0NTkKNso1A9y1a4w==", 371 | "cpu": [ 372 | "x64" 373 | ], 374 | "dev": true, 375 | "license": "MIT", 376 | "optional": true, 377 | "os": [ 378 | "openbsd" 379 | ], 380 | "engines": { 381 | "node": ">=18" 382 | } 383 | }, 384 | "node_modules/@esbuild/sunos-x64": { 385 | "version": "0.25.3", 386 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.3.tgz", 387 | "integrity": "sha512-ROJhm7d8bk9dMCUZjkS8fgzsPAZEjtRJqCAmVgB0gMrvG7hfmPmz9k1rwO4jSiblFjYmNvbECL9uhaPzONMfgA==", 388 | "cpu": [ 389 | "x64" 390 | ], 391 | "dev": true, 392 | "license": "MIT", 393 | "optional": true, 394 | "os": [ 395 | "sunos" 396 | ], 397 | "engines": { 398 | "node": ">=18" 399 | } 400 | }, 401 | "node_modules/@esbuild/win32-arm64": { 402 | "version": "0.25.3", 403 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.3.tgz", 404 | "integrity": "sha512-YWcow8peiHpNBiIXHwaswPnAXLsLVygFwCB3A7Bh5jRkIBFWHGmNQ48AlX4xDvQNoMZlPYzjVOQDYEzWCqufMQ==", 405 | "cpu": [ 406 | "arm64" 407 | ], 408 | "dev": true, 409 | "license": "MIT", 410 | "optional": true, 411 | "os": [ 412 | "win32" 413 | ], 414 | "engines": { 415 | "node": ">=18" 416 | } 417 | }, 418 | "node_modules/@esbuild/win32-ia32": { 419 | "version": "0.25.3", 420 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.3.tgz", 421 | "integrity": "sha512-qspTZOIGoXVS4DpNqUYUs9UxVb04khS1Degaw/MnfMe7goQ3lTfQ13Vw4qY/Nj0979BGvMRpAYbs/BAxEvU8ew==", 422 | "cpu": [ 423 | "ia32" 424 | ], 425 | "dev": true, 426 | "license": "MIT", 427 | "optional": true, 428 | "os": [ 429 | "win32" 430 | ], 431 | "engines": { 432 | "node": ">=18" 433 | } 434 | }, 435 | "node_modules/@esbuild/win32-x64": { 436 | "version": "0.25.3", 437 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.3.tgz", 438 | "integrity": "sha512-ICgUR+kPimx0vvRzf+N/7L7tVSQeE3BYY+NhHRHXS1kBuPO7z2+7ea2HbhDyZdTephgvNvKrlDDKUexuCVBVvg==", 439 | "cpu": [ 440 | "x64" 441 | ], 442 | "dev": true, 443 | "license": "MIT", 444 | "optional": true, 445 | "os": [ 446 | "win32" 447 | ], 448 | "engines": { 449 | "node": ">=18" 450 | } 451 | }, 452 | "node_modules/@types/react": { 453 | "version": "19.1.2", 454 | "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.2.tgz", 455 | "integrity": "sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==", 456 | "dev": true, 457 | "license": "MIT", 458 | "dependencies": { 459 | "csstype": "^3.0.2" 460 | } 461 | }, 462 | "node_modules/@types/react-dom": { 463 | "version": "19.1.3", 464 | "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.3.tgz", 465 | "integrity": "sha512-rJXC08OG0h3W6wDMFxQrZF00Kq6qQvw0djHRdzl3U5DnIERz0MRce3WVc7IS6JYBwtaP/DwYtRRjVlvivNveKg==", 466 | "dev": true, 467 | "license": "MIT", 468 | "peerDependencies": { 469 | "@types/react": "^19.0.0" 470 | } 471 | }, 472 | "node_modules/csstype": { 473 | "version": "3.1.1", 474 | "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz", 475 | "integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==", 476 | "dev": true 477 | }, 478 | "node_modules/esbuild": { 479 | "version": "0.25.3", 480 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.3.tgz", 481 | "integrity": "sha512-qKA6Pvai73+M2FtftpNKRxJ78GIjmFXFxd/1DVBqGo/qNhLSfv+G12n9pNoWdytJC8U00TrViOwpjT0zgqQS8Q==", 482 | "dev": true, 483 | "hasInstallScript": true, 484 | "license": "MIT", 485 | "bin": { 486 | "esbuild": "bin/esbuild" 487 | }, 488 | "engines": { 489 | "node": ">=18" 490 | }, 491 | "optionalDependencies": { 492 | "@esbuild/aix-ppc64": "0.25.3", 493 | "@esbuild/android-arm": "0.25.3", 494 | "@esbuild/android-arm64": "0.25.3", 495 | "@esbuild/android-x64": "0.25.3", 496 | "@esbuild/darwin-arm64": "0.25.3", 497 | "@esbuild/darwin-x64": "0.25.3", 498 | "@esbuild/freebsd-arm64": "0.25.3", 499 | "@esbuild/freebsd-x64": "0.25.3", 500 | "@esbuild/linux-arm": "0.25.3", 501 | "@esbuild/linux-arm64": "0.25.3", 502 | "@esbuild/linux-ia32": "0.25.3", 503 | "@esbuild/linux-loong64": "0.25.3", 504 | "@esbuild/linux-mips64el": "0.25.3", 505 | "@esbuild/linux-ppc64": "0.25.3", 506 | "@esbuild/linux-riscv64": "0.25.3", 507 | "@esbuild/linux-s390x": "0.25.3", 508 | "@esbuild/linux-x64": "0.25.3", 509 | "@esbuild/netbsd-arm64": "0.25.3", 510 | "@esbuild/netbsd-x64": "0.25.3", 511 | "@esbuild/openbsd-arm64": "0.25.3", 512 | "@esbuild/openbsd-x64": "0.25.3", 513 | "@esbuild/sunos-x64": "0.25.3", 514 | "@esbuild/win32-arm64": "0.25.3", 515 | "@esbuild/win32-ia32": "0.25.3", 516 | "@esbuild/win32-x64": "0.25.3" 517 | } 518 | }, 519 | "node_modules/is-touch-device": { 520 | "version": "1.0.1", 521 | "resolved": "https://registry.npmjs.org/is-touch-device/-/is-touch-device-1.0.1.tgz", 522 | "integrity": "sha512-LAYzo9kMT1b2p19L/1ATGt2XcSilnzNlyvq6c0pbPRVisLbAPpLqr53tIJS00kvrTkj0HtR8U7+u8X0yR8lPSw==" 523 | }, 524 | "node_modules/js-tokens": { 525 | "version": "4.0.0", 526 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 527 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" 528 | }, 529 | "node_modules/loose-envify": { 530 | "version": "1.4.0", 531 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", 532 | "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", 533 | "dependencies": { 534 | "js-tokens": "^3.0.0 || ^4.0.0" 535 | }, 536 | "bin": { 537 | "loose-envify": "cli.js" 538 | } 539 | }, 540 | "node_modules/object-assign": { 541 | "version": "4.1.1", 542 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 543 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", 544 | "engines": { 545 | "node": ">=0.10.0" 546 | } 547 | }, 548 | "node_modules/prop-types": { 549 | "version": "15.8.1", 550 | "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", 551 | "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", 552 | "dependencies": { 553 | "loose-envify": "^1.4.0", 554 | "object-assign": "^4.1.1", 555 | "react-is": "^16.13.1" 556 | } 557 | }, 558 | "node_modules/react": { 559 | "version": "18.2.0", 560 | "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", 561 | "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", 562 | "peer": true, 563 | "dependencies": { 564 | "loose-envify": "^1.1.0" 565 | }, 566 | "engines": { 567 | "node": ">=0.10.0" 568 | } 569 | }, 570 | "node_modules/react-dom": { 571 | "version": "18.2.0", 572 | "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", 573 | "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", 574 | "peer": true, 575 | "dependencies": { 576 | "loose-envify": "^1.1.0", 577 | "scheduler": "^0.23.0" 578 | }, 579 | "peerDependencies": { 580 | "react": "^18.2.0" 581 | } 582 | }, 583 | "node_modules/react-is": { 584 | "version": "16.13.1", 585 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", 586 | "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" 587 | }, 588 | "node_modules/scheduler": { 589 | "version": "0.23.0", 590 | "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", 591 | "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", 592 | "peer": true, 593 | "dependencies": { 594 | "loose-envify": "^1.1.0" 595 | } 596 | }, 597 | "node_modules/typescript": { 598 | "version": "5.8.3", 599 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 600 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 601 | "dev": true, 602 | "license": "Apache-2.0", 603 | "bin": { 604 | "tsc": "bin/tsc", 605 | "tsserver": "bin/tsserver" 606 | }, 607 | "engines": { 608 | "node": ">=14.17" 609 | } 610 | }, 611 | "node_modules/window-scroll-manager": { 612 | "version": "1.1.4", 613 | "resolved": "https://registry.npmjs.org/window-scroll-manager/-/window-scroll-manager-1.1.4.tgz", 614 | "integrity": "sha512-Oj916sD6Daigs128qtksCcBGvwXcuTuMn65m1FEp/QINBwbkval43p0qfZna2GFExXZFdoMTT3/s1of0szsG7A==" 615 | } 616 | }, 617 | "dependencies": { 618 | "@esbuild/aix-ppc64": { 619 | "version": "0.25.3", 620 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz", 621 | "integrity": "sha512-W8bFfPA8DowP8l//sxjJLSLkD8iEjMc7cBVyP+u4cEv9sM7mdUCkgsj+t0n/BWPFtv7WWCN5Yzj0N6FJNUUqBQ==", 622 | "dev": true, 623 | "optional": true 624 | }, 625 | "@esbuild/android-arm": { 626 | "version": "0.25.3", 627 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.3.tgz", 628 | "integrity": "sha512-PuwVXbnP87Tcff5I9ngV0lmiSu40xw1At6i3GsU77U7cjDDB4s0X2cyFuBiDa1SBk9DnvWwnGvVaGBqoFWPb7A==", 629 | "dev": true, 630 | "optional": true 631 | }, 632 | "@esbuild/android-arm64": { 633 | "version": "0.25.3", 634 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.3.tgz", 635 | "integrity": "sha512-XelR6MzjlZuBM4f5z2IQHK6LkK34Cvv6Rj2EntER3lwCBFdg6h2lKbtRjpTTsdEjD/WSe1q8UyPBXP1x3i/wYQ==", 636 | "dev": true, 637 | "optional": true 638 | }, 639 | "@esbuild/android-x64": { 640 | "version": "0.25.3", 641 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.3.tgz", 642 | "integrity": "sha512-ogtTpYHT/g1GWS/zKM0cc/tIebFjm1F9Aw1boQ2Y0eUQ+J89d0jFY//s9ei9jVIlkYi8AfOjiixcLJSGNSOAdQ==", 643 | "dev": true, 644 | "optional": true 645 | }, 646 | "@esbuild/darwin-arm64": { 647 | "version": "0.25.3", 648 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.3.tgz", 649 | "integrity": "sha512-eESK5yfPNTqpAmDfFWNsOhmIOaQA59tAcF/EfYvo5/QWQCzXn5iUSOnqt3ra3UdzBv073ykTtmeLJZGt3HhA+w==", 650 | "dev": true, 651 | "optional": true 652 | }, 653 | "@esbuild/darwin-x64": { 654 | "version": "0.25.3", 655 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.3.tgz", 656 | "integrity": "sha512-Kd8glo7sIZtwOLcPbW0yLpKmBNWMANZhrC1r6K++uDR2zyzb6AeOYtI6udbtabmQpFaxJ8uduXMAo1gs5ozz8A==", 657 | "dev": true, 658 | "optional": true 659 | }, 660 | "@esbuild/freebsd-arm64": { 661 | "version": "0.25.3", 662 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.3.tgz", 663 | "integrity": "sha512-EJiyS70BYybOBpJth3M0KLOus0n+RRMKTYzhYhFeMwp7e/RaajXvP+BWlmEXNk6uk+KAu46j/kaQzr6au+JcIw==", 664 | "dev": true, 665 | "optional": true 666 | }, 667 | "@esbuild/freebsd-x64": { 668 | "version": "0.25.3", 669 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.3.tgz", 670 | "integrity": "sha512-Q+wSjaLpGxYf7zC0kL0nDlhsfuFkoN+EXrx2KSB33RhinWzejOd6AvgmP5JbkgXKmjhmpfgKZq24pneodYqE8Q==", 671 | "dev": true, 672 | "optional": true 673 | }, 674 | "@esbuild/linux-arm": { 675 | "version": "0.25.3", 676 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.3.tgz", 677 | "integrity": "sha512-dUOVmAUzuHy2ZOKIHIKHCm58HKzFqd+puLaS424h6I85GlSDRZIA5ycBixb3mFgM0Jdh+ZOSB6KptX30DD8YOQ==", 678 | "dev": true, 679 | "optional": true 680 | }, 681 | "@esbuild/linux-arm64": { 682 | "version": "0.25.3", 683 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.3.tgz", 684 | "integrity": "sha512-xCUgnNYhRD5bb1C1nqrDV1PfkwgbswTTBRbAd8aH5PhYzikdf/ddtsYyMXFfGSsb/6t6QaPSzxtbfAZr9uox4A==", 685 | "dev": true, 686 | "optional": true 687 | }, 688 | "@esbuild/linux-ia32": { 689 | "version": "0.25.3", 690 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.3.tgz", 691 | "integrity": "sha512-yplPOpczHOO4jTYKmuYuANI3WhvIPSVANGcNUeMlxH4twz/TeXuzEP41tGKNGWJjuMhotpGabeFYGAOU2ummBw==", 692 | "dev": true, 693 | "optional": true 694 | }, 695 | "@esbuild/linux-loong64": { 696 | "version": "0.25.3", 697 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.3.tgz", 698 | "integrity": "sha512-P4BLP5/fjyihmXCELRGrLd793q/lBtKMQl8ARGpDxgzgIKJDRJ/u4r1A/HgpBpKpKZelGct2PGI4T+axcedf6g==", 699 | "dev": true, 700 | "optional": true 701 | }, 702 | "@esbuild/linux-mips64el": { 703 | "version": "0.25.3", 704 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.3.tgz", 705 | "integrity": "sha512-eRAOV2ODpu6P5divMEMa26RRqb2yUoYsuQQOuFUexUoQndm4MdpXXDBbUoKIc0iPa4aCO7gIhtnYomkn2x+bag==", 706 | "dev": true, 707 | "optional": true 708 | }, 709 | "@esbuild/linux-ppc64": { 710 | "version": "0.25.3", 711 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.3.tgz", 712 | "integrity": "sha512-ZC4jV2p7VbzTlnl8nZKLcBkfzIf4Yad1SJM4ZMKYnJqZFD4rTI+pBG65u8ev4jk3/MPwY9DvGn50wi3uhdaghg==", 713 | "dev": true, 714 | "optional": true 715 | }, 716 | "@esbuild/linux-riscv64": { 717 | "version": "0.25.3", 718 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.3.tgz", 719 | "integrity": "sha512-LDDODcFzNtECTrUUbVCs6j9/bDVqy7DDRsuIXJg6so+mFksgwG7ZVnTruYi5V+z3eE5y+BJZw7VvUadkbfg7QA==", 720 | "dev": true, 721 | "optional": true 722 | }, 723 | "@esbuild/linux-s390x": { 724 | "version": "0.25.3", 725 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.3.tgz", 726 | "integrity": "sha512-s+w/NOY2k0yC2p9SLen+ymflgcpRkvwwa02fqmAwhBRI3SC12uiS10edHHXlVWwfAagYSY5UpmT/zISXPMW3tQ==", 727 | "dev": true, 728 | "optional": true 729 | }, 730 | "@esbuild/linux-x64": { 731 | "version": "0.25.3", 732 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.3.tgz", 733 | "integrity": "sha512-nQHDz4pXjSDC6UfOE1Fw9Q8d6GCAd9KdvMZpfVGWSJztYCarRgSDfOVBY5xwhQXseiyxapkiSJi/5/ja8mRFFA==", 734 | "dev": true, 735 | "optional": true 736 | }, 737 | "@esbuild/netbsd-arm64": { 738 | "version": "0.25.3", 739 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.3.tgz", 740 | "integrity": "sha512-1QaLtOWq0mzK6tzzp0jRN3eccmN3hezey7mhLnzC6oNlJoUJz4nym5ZD7mDnS/LZQgkrhEbEiTn515lPeLpgWA==", 741 | "dev": true, 742 | "optional": true 743 | }, 744 | "@esbuild/netbsd-x64": { 745 | "version": "0.25.3", 746 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.3.tgz", 747 | "integrity": "sha512-i5Hm68HXHdgv8wkrt+10Bc50zM0/eonPb/a/OFVfB6Qvpiirco5gBA5bz7S2SHuU+Y4LWn/zehzNX14Sp4r27g==", 748 | "dev": true, 749 | "optional": true 750 | }, 751 | "@esbuild/openbsd-arm64": { 752 | "version": "0.25.3", 753 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.3.tgz", 754 | "integrity": "sha512-zGAVApJEYTbOC6H/3QBr2mq3upG/LBEXr85/pTtKiv2IXcgKV0RT0QA/hSXZqSvLEpXeIxah7LczB4lkiYhTAQ==", 755 | "dev": true, 756 | "optional": true 757 | }, 758 | "@esbuild/openbsd-x64": { 759 | "version": "0.25.3", 760 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.3.tgz", 761 | "integrity": "sha512-fpqctI45NnCIDKBH5AXQBsD0NDPbEFczK98hk/aa6HJxbl+UtLkJV2+Bvy5hLSLk3LHmqt0NTkKNso1A9y1a4w==", 762 | "dev": true, 763 | "optional": true 764 | }, 765 | "@esbuild/sunos-x64": { 766 | "version": "0.25.3", 767 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.3.tgz", 768 | "integrity": "sha512-ROJhm7d8bk9dMCUZjkS8fgzsPAZEjtRJqCAmVgB0gMrvG7hfmPmz9k1rwO4jSiblFjYmNvbECL9uhaPzONMfgA==", 769 | "dev": true, 770 | "optional": true 771 | }, 772 | "@esbuild/win32-arm64": { 773 | "version": "0.25.3", 774 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.3.tgz", 775 | "integrity": "sha512-YWcow8peiHpNBiIXHwaswPnAXLsLVygFwCB3A7Bh5jRkIBFWHGmNQ48AlX4xDvQNoMZlPYzjVOQDYEzWCqufMQ==", 776 | "dev": true, 777 | "optional": true 778 | }, 779 | "@esbuild/win32-ia32": { 780 | "version": "0.25.3", 781 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.3.tgz", 782 | "integrity": "sha512-qspTZOIGoXVS4DpNqUYUs9UxVb04khS1Degaw/MnfMe7goQ3lTfQ13Vw4qY/Nj0979BGvMRpAYbs/BAxEvU8ew==", 783 | "dev": true, 784 | "optional": true 785 | }, 786 | "@esbuild/win32-x64": { 787 | "version": "0.25.3", 788 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.3.tgz", 789 | "integrity": "sha512-ICgUR+kPimx0vvRzf+N/7L7tVSQeE3BYY+NhHRHXS1kBuPO7z2+7ea2HbhDyZdTephgvNvKrlDDKUexuCVBVvg==", 790 | "dev": true, 791 | "optional": true 792 | }, 793 | "@types/react": { 794 | "version": "19.1.2", 795 | "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.2.tgz", 796 | "integrity": "sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==", 797 | "dev": true, 798 | "requires": { 799 | "csstype": "^3.0.2" 800 | } 801 | }, 802 | "@types/react-dom": { 803 | "version": "19.1.3", 804 | "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.3.tgz", 805 | "integrity": "sha512-rJXC08OG0h3W6wDMFxQrZF00Kq6qQvw0djHRdzl3U5DnIERz0MRce3WVc7IS6JYBwtaP/DwYtRRjVlvivNveKg==", 806 | "dev": true, 807 | "requires": {} 808 | }, 809 | "csstype": { 810 | "version": "3.1.1", 811 | "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz", 812 | "integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==", 813 | "dev": true 814 | }, 815 | "esbuild": { 816 | "version": "0.25.3", 817 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.3.tgz", 818 | "integrity": "sha512-qKA6Pvai73+M2FtftpNKRxJ78GIjmFXFxd/1DVBqGo/qNhLSfv+G12n9pNoWdytJC8U00TrViOwpjT0zgqQS8Q==", 819 | "dev": true, 820 | "requires": { 821 | "@esbuild/aix-ppc64": "0.25.3", 822 | "@esbuild/android-arm": "0.25.3", 823 | "@esbuild/android-arm64": "0.25.3", 824 | "@esbuild/android-x64": "0.25.3", 825 | "@esbuild/darwin-arm64": "0.25.3", 826 | "@esbuild/darwin-x64": "0.25.3", 827 | "@esbuild/freebsd-arm64": "0.25.3", 828 | "@esbuild/freebsd-x64": "0.25.3", 829 | "@esbuild/linux-arm": "0.25.3", 830 | "@esbuild/linux-arm64": "0.25.3", 831 | "@esbuild/linux-ia32": "0.25.3", 832 | "@esbuild/linux-loong64": "0.25.3", 833 | "@esbuild/linux-mips64el": "0.25.3", 834 | "@esbuild/linux-ppc64": "0.25.3", 835 | "@esbuild/linux-riscv64": "0.25.3", 836 | "@esbuild/linux-s390x": "0.25.3", 837 | "@esbuild/linux-x64": "0.25.3", 838 | "@esbuild/netbsd-arm64": "0.25.3", 839 | "@esbuild/netbsd-x64": "0.25.3", 840 | "@esbuild/openbsd-arm64": "0.25.3", 841 | "@esbuild/openbsd-x64": "0.25.3", 842 | "@esbuild/sunos-x64": "0.25.3", 843 | "@esbuild/win32-arm64": "0.25.3", 844 | "@esbuild/win32-ia32": "0.25.3", 845 | "@esbuild/win32-x64": "0.25.3" 846 | } 847 | }, 848 | "is-touch-device": { 849 | "version": "1.0.1", 850 | "resolved": "https://registry.npmjs.org/is-touch-device/-/is-touch-device-1.0.1.tgz", 851 | "integrity": "sha512-LAYzo9kMT1b2p19L/1ATGt2XcSilnzNlyvq6c0pbPRVisLbAPpLqr53tIJS00kvrTkj0HtR8U7+u8X0yR8lPSw==" 852 | }, 853 | "js-tokens": { 854 | "version": "4.0.0", 855 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 856 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" 857 | }, 858 | "loose-envify": { 859 | "version": "1.4.0", 860 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", 861 | "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", 862 | "requires": { 863 | "js-tokens": "^3.0.0 || ^4.0.0" 864 | } 865 | }, 866 | "object-assign": { 867 | "version": "4.1.1", 868 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 869 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" 870 | }, 871 | "prop-types": { 872 | "version": "15.8.1", 873 | "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", 874 | "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", 875 | "requires": { 876 | "loose-envify": "^1.4.0", 877 | "object-assign": "^4.1.1", 878 | "react-is": "^16.13.1" 879 | } 880 | }, 881 | "react": { 882 | "version": "18.2.0", 883 | "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", 884 | "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", 885 | "peer": true, 886 | "requires": { 887 | "loose-envify": "^1.1.0" 888 | } 889 | }, 890 | "react-dom": { 891 | "version": "18.2.0", 892 | "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", 893 | "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", 894 | "peer": true, 895 | "requires": { 896 | "loose-envify": "^1.1.0", 897 | "scheduler": "^0.23.0" 898 | } 899 | }, 900 | "react-is": { 901 | "version": "16.13.1", 902 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", 903 | "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" 904 | }, 905 | "scheduler": { 906 | "version": "0.23.0", 907 | "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", 908 | "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", 909 | "peer": true, 910 | "requires": { 911 | "loose-envify": "^1.1.0" 912 | } 913 | }, 914 | "typescript": { 915 | "version": "5.8.3", 916 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 917 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 918 | "dev": true 919 | }, 920 | "window-scroll-manager": { 921 | "version": "1.1.4", 922 | "resolved": "https://registry.npmjs.org/window-scroll-manager/-/window-scroll-manager-1.1.4.tgz", 923 | "integrity": "sha512-Oj916sD6Daigs128qtksCcBGvwXcuTuMn65m1FEp/QINBwbkval43p0qfZna2GFExXZFdoMTT3/s1of0szsG7A==" 924 | } 925 | } 926 | } 927 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-window-decorators", 3 | "version": "1.0.8", 4 | "private": false, 5 | "license": "MIT", 6 | "main": "dist/cjs/index.js", 7 | "module": "dist/esm/index.js", 8 | "types": "dist/esm/index.d.ts", 9 | "description": "Two decorators (higher order components) that inject 'window' scroll position, dimensions, orientation and breakpoint to your component's props.", 10 | "exports": { 11 | ".": { 12 | "import": "./dist/esm/index.js", 13 | "require": "./dist/cjs/index.js" 14 | } 15 | }, 16 | "scripts": { 17 | "clean": "rm -rf dist", 18 | "build:esm": "tsc -p tsconfig.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json", 19 | "build:cjs": "tsc -p tsconfig-cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json", 20 | "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:docs", 21 | "start": "esbuild docs/src/docs.tsx --bundle --tsconfig=tsconfig-demo.json --servedir=docs --outdir=docs/build", 22 | "build:docs": "esbuild docs/src/docs.tsx --bundle --tsconfig=tsconfig-demo.json --outdir=docs/build --minify --sourcemap", 23 | "prepublishOnly": "npm run build" 24 | }, 25 | "devDependencies": { 26 | "@types/react": "^19.1.2", 27 | "@types/react-dom": "^19.1.3", 28 | "esbuild": "^0.25.3", 29 | "typescript": "^5.8.3" 30 | }, 31 | "dependencies": { 32 | "is-touch-device": "^1.0.1", 33 | "prop-types": "^15.8.1", 34 | "window-scroll-manager": "^1.1.4" 35 | }, 36 | "peerDependencies": { 37 | "react": ">=15.5.4", 38 | "react-dom": ">=15.5.4" 39 | }, 40 | "repository": { 41 | "type": "git", 42 | "url": "git+ssh://git@github.com/Stanko/react-window-decorators.git" 43 | }, 44 | "keywords": [ 45 | "react" 46 | ], 47 | "author": "Stanko", 48 | "bugs": { 49 | "url": "https://github.com/Stanko/react-window-decorators/issues" 50 | }, 51 | "homepage": "https://github.com/Stanko/react-window-decorators#readme", 52 | "files": [ 53 | "dist/", 54 | "CHANGELOG.md" 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | // TODO types 3 | import withScroll from "./scroll"; 4 | import withWindow from "./window"; 5 | import WindowManager from "./window-manager"; 6 | 7 | export { withScroll, withWindow, WindowManager }; 8 | -------------------------------------------------------------------------------- /src/scroll.tsx: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | // TODO types 3 | import React, { Component } from "react"; 4 | import ScrollManager from "window-scroll-manager"; 5 | 6 | const withScroll = (ComposedComponent) => 7 | class ScrollDecorator extends Component { 8 | constructor() { 9 | super(); 10 | 11 | let scrollPositionX = 0; 12 | let scrollPositionY = 0; 13 | 14 | // Check for universal rendering 15 | if (typeof window !== "undefined") { 16 | this.scrollManager = new ScrollManager(); 17 | 18 | // Initial scroll position 19 | scrollPositionX = this.scrollManager.getScrollPosition().scrollPositionX; 20 | scrollPositionY = this.scrollManager.getScrollPosition().scrollPositionY; 21 | 22 | this.handleScrollChange = this.handleScrollChange.bind(this); 23 | } 24 | 25 | this.state = { 26 | scrollPositionX, 27 | scrollPositionY, 28 | // Alias for scrollPositionY for backwards compatibility 29 | scrollPosition: scrollPositionY, 30 | }; 31 | } 32 | 33 | componentDidMount() { 34 | // Bind events 35 | window.addEventListener("window-scroll", this.handleScrollChange); 36 | } 37 | 38 | componentWillUnmount() { 39 | // Remove and reset interval/animationFrame 40 | window.removeEventListener("window-scroll", this.handleScrollChange); 41 | 42 | this.scrollManager.removeListener(); 43 | this.scrollManager = null; 44 | } 45 | 46 | handleScrollChange(e) { 47 | const { scrollPositionY, scrollPositionX } = this.state; 48 | const newScrollPositionY = e.detail.scrollPositionY; 49 | const newScrollPositionX = e.detail.scrollPositionX; 50 | 51 | // Update the state only when scroll position is changed 52 | if (newScrollPositionY !== scrollPositionY || newScrollPositionX !== scrollPositionX) { 53 | requestAnimationFrame(() => { 54 | this.setState({ 55 | scrollPositionX: newScrollPositionX, 56 | scrollPositionY: newScrollPositionY, 57 | // Alias for scrollPositionY for backwards compatibility 58 | scrollPosition: newScrollPositionY, 59 | }); 60 | }); 61 | } 62 | } 63 | 64 | render() { 65 | const { scrollPositionX, scrollPositionY } = this.state; 66 | 67 | return ( 68 | 75 | ); 76 | } 77 | }; 78 | 79 | export default withScroll; 80 | -------------------------------------------------------------------------------- /src/window-manager.ts: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | // TODO types 3 | import isTouchDevice from "is-touch-device"; 4 | 5 | const EVENT_NAME = "window-resize"; 6 | 7 | let instance = null; 8 | let instancesCount = 0; 9 | 10 | const orientations = { 11 | LANDSCAPE: "(orientation: landscape)", 12 | PORTRAIT: "(orientation: portrait)", 13 | }; 14 | 15 | const IS_TOUCH_DEVICE = isTouchDevice(); 16 | 17 | const isWindowDefined = typeof window !== "undefined"; 18 | 19 | // ------------------------------------------------ 20 | // Custom Event detection 21 | // ------------------------------------------------ 22 | const supportsCustomEvents = isWindowDefined && typeof window.CustomEvent === "function"; 23 | 24 | // ------------------------------------------------ 25 | // Window Manager 26 | // ------------------------------------------------ 27 | export default class WindowManager { 28 | constructor(breakpoints, debounceTime = 250) { 29 | if (!isWindowDefined) { 30 | // Silently return null if it is used on server 31 | return null; 32 | } 33 | 34 | // Increase reference count 35 | instancesCount++; 36 | 37 | // Save or update options 38 | this.breakpoints = breakpoints; 39 | this.debounceTime = debounceTime; 40 | 41 | // If singleton instance exists, return it rather than creating a new one 42 | if (instance) { 43 | return instance; 44 | } 45 | 46 | // Save singleton instance 47 | instance = this; 48 | 49 | // Bind handlers 50 | this.handleResize = this.handleResize.bind(this); 51 | 52 | // Add resize listener 53 | window.addEventListener("resize", this.handleResize); 54 | } 55 | 56 | removeListener() { 57 | instancesCount--; 58 | 59 | if (instancesCount === 0) { 60 | // Clear singleton instance 61 | instance = null; 62 | // Remove listeners 63 | window.removeEventListener("resize", this.handleResize); 64 | } 65 | } 66 | 67 | getDimensions() { 68 | return { 69 | width: window.innerWidth, 70 | height: window.innerHeight, 71 | }; 72 | } 73 | 74 | getOrientation() { 75 | return window.matchMedia(orientations.LANDSCAPE).matches ? "landscape" : "portrait"; 76 | } 77 | 78 | getBreakpoint() { 79 | let breakpoint = null; 80 | 81 | if (this.breakpoints) { 82 | for (let i = 0; i < this.breakpoints.length; i++) { 83 | if (window.matchMedia(this.breakpoints[i].media).matches) { 84 | breakpoint = this.breakpoints[i].name; 85 | } 86 | } 87 | } 88 | 89 | return breakpoint; 90 | } 91 | 92 | isTouchDevice() { 93 | return IS_TOUCH_DEVICE; 94 | } 95 | 96 | handleResize() { 97 | clearTimeout(this.timeoutID); 98 | this.timeoutID = setTimeout(() => { 99 | let event; 100 | 101 | const detail = { 102 | breakpoint: this.getBreakpoint(), 103 | dimensions: this.getDimensions(), 104 | orientation: this.getOrientation(), 105 | }; 106 | 107 | if (supportsCustomEvents) { 108 | event = new CustomEvent(EVENT_NAME, { detail }); 109 | } else { 110 | event = document.createEvent("CustomEvent"); 111 | event.initCustomEvent(EVENT_NAME, false, false, detail); 112 | } 113 | 114 | // Dispatch the event. 115 | window.dispatchEvent(event); 116 | }, this.debounceTime); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/window.tsx: -------------------------------------------------------------------------------- 1 | // @ts-nocheck 2 | // TODO types 3 | import React, { Component } from "react"; 4 | import WindowManager from "./window-manager"; 5 | 6 | const withWindow = (ComposedComponent) => 7 | class WindowDecorator extends Component { 8 | constructor() { 9 | super(); 10 | 11 | const state = { 12 | dimensions: { 13 | width: 0, 14 | height: 0, 15 | }, 16 | breakpoint: null, 17 | orientation: null, 18 | isTouchDevice: false, 19 | }; 20 | 21 | // Check for universal rendering 22 | if (typeof window !== "undefined") { 23 | this.windowManager = new WindowManager(); 24 | 25 | // Initial state 26 | state.breakpoint = this.windowManager.getBreakpoint(); 27 | state.dimensions = this.windowManager.getDimensions(); 28 | state.orientation = this.windowManager.getOrientation(); 29 | state.isTouchDevice = this.windowManager.isTouchDevice(); 30 | } 31 | 32 | this.state = state; 33 | } 34 | 35 | componentDidMount() { 36 | // Bind events 37 | this.handleWindowResize = this.handleWindowResize.bind(this); 38 | window.addEventListener("window-resize", this.handleWindowResize); 39 | } 40 | 41 | componentWillUnmount() { 42 | // Remove and reset interval/animationFrame 43 | cancelAnimationFrame(this.animationFrameRef); 44 | window.removeEventListener("window-resize", this.handleWindowResize); 45 | this.windowManager.removeListener(); 46 | this.windowManager = null; 47 | } 48 | 49 | handleWindowResize(e) { 50 | const { breakpoint, dimensions, orientation } = this.state; 51 | 52 | const newBreakpoint = e.detail.breakpoint; 53 | const newDimensions = e.detail.dimensions; 54 | const newOrientation = e.detail.orientation; 55 | 56 | // Update the state only when data has changed 57 | if ( 58 | newOrientation !== orientation || 59 | newBreakpoint !== breakpoint || 60 | newDimensions.width !== dimensions.width || 61 | newDimensions.height !== dimensions.height 62 | ) { 63 | cancelAnimationFrame(this.animationFrameRef); 64 | this.animationFrameRef = requestAnimationFrame(() => { 65 | this.setState({ 66 | breakpoint: newBreakpoint, 67 | dimensions: newDimensions, 68 | orientation: newOrientation, 69 | }); 70 | }); 71 | } 72 | } 73 | 74 | render() { 75 | const { breakpoint, dimensions, orientation, isTouchDevice } = this.state; 76 | 77 | return ( 78 | 85 | ); 86 | } 87 | }; 88 | 89 | export default withWindow; 90 | -------------------------------------------------------------------------------- /tsconfig-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "esModuleInterop": true, 5 | "declaration": true, 6 | "jsx": "react", 7 | "module": "ES2015", 8 | "moduleResolution": "node", 9 | "outDir": "dist", 10 | "pretty": true, 11 | "resolveJsonModule": true, 12 | "strict": true, 13 | "lib": ["dom", "ES2015", "ES2017"] 14 | }, 15 | "exclude": ["node_modules", "dist"], 16 | "include": ["src"] 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig-cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-base.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "dist/cjs", 6 | "target": "ES2015" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig-demo.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-base.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "docs", 6 | "target": "ES2015" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-base.json", 3 | "compilerOptions": { 4 | "module": "ES2020", 5 | "outDir": "dist/esm", 6 | "target": "ES2015" 7 | } 8 | } 9 | --------------------------------------------------------------------------------