99 OnInit ,
1010 Output ,
1111 Renderer2 ,
12- SimpleChanges ,
12+ SimpleChanges
1313} from '@angular/core' ;
1414import { DOCUMENT } from '@angular/common' ;
1515import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
@@ -40,13 +40,13 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
4040 #stateToggleSubscription! : Subscription ;
4141
4242 state : ISidebarAction = {
43- sidebar : this ,
43+ sidebar : this
4444 } ;
4545
4646 #stateInitial = {
4747 narrow : false ,
4848 visible : false ,
49- unfoldable : false ,
49+ unfoldable : false
5050 } ;
5151
5252 /**
@@ -155,11 +155,11 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
155155 }
156156 this . state = {
157157 ...this . state ,
158- ...newState ,
158+ ...newState
159159 } ;
160160 this . state . mobile && this . state . visible
161- ? this . backdropService . setBackdrop ( this )
162- : this . backdropService . clearBackdrop ( ) ;
161+ ? this . backdropService . setBackdrop ( this )
162+ : this . backdropService . clearBackdrop ( ) ;
163163 }
164164
165165 get sidebarState ( ) : ISidebarAction {
@@ -168,13 +168,8 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
168168
169169 get getMobileBreakpoint ( ) : string {
170170 const element : Element = this . document . documentElement ;
171- const mobileBreakpoint =
172- getComputedStyle ( element ) . getPropertyValue ( '--cui-mobile-breakpoint' ) ||
173- 'md' ;
174- const breakpointValue =
175- getComputedStyle ( element ) . getPropertyValue (
176- `--cui-breakpoint-${ mobileBreakpoint . trim ( ) } `
177- ) || '768px' ;
171+ const mobileBreakpoint = this . document . defaultView ?. getComputedStyle ( element ) ?. getPropertyValue ( '--cui-mobile-breakpoint' ) ?? 'md' ;
172+ const breakpointValue = this . document . defaultView ?. getComputedStyle ( element ) ?. getPropertyValue ( `--cui-breakpoint-${ mobileBreakpoint . trim ( ) } ` ) ?? '768px' ;
178173 return `${ parseFloat ( breakpointValue . trim ( ) ) - 0.02 } px` || '767.98px' ;
179174 }
180175
@@ -199,7 +194,7 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
199194 'sidebar-overlaid' : this . overlaid ,
200195 [ `sidebar-${ this . size } ` ] : ! ! this . size ,
201196 show : visible && this . #onMobile,
202- hide : ! visible ,
197+ hide : ! visible
203198 } ;
204199 }
205200
@@ -242,11 +237,11 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
242237 this . #stateInitial = {
243238 narrow : this . narrow ,
244239 visible : this . visible ,
245- unfoldable : this . unfoldable ,
240+ unfoldable : this . unfoldable
246241 } ;
247242 this . sidebarService . toggle ( {
248243 ...this . #stateInitial,
249- sidebar : this ,
244+ sidebar : this
250245 } ) ;
251246 }
252247
@@ -279,7 +274,7 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
279274 mobile : isOnMobile ,
280275 unfoldable : isUnfoldable ,
281276 visible : isOnMobile ? ! isOnMobile : this . #stateInitial. visible ,
282- sidebar : this ,
277+ sidebar : this
283278 } ) ;
284279 }
285280 }
0 commit comments