index.d.ts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import * as i0 from '@angular/core';
  2. import { OnDestroy } from '@angular/core';
  3. import { Observable } from 'rxjs';
  4. declare class LayoutModule {
  5. static ɵfac: i0.ɵɵFactoryDeclaration<LayoutModule, never>;
  6. static ɵmod: i0.ɵɵNgModuleDeclaration<LayoutModule, never, never, never>;
  7. static ɵinj: i0.ɵɵInjectorDeclaration<LayoutModule>;
  8. }
  9. /** The current state of a layout breakpoint. */
  10. interface BreakpointState {
  11. /** Whether the breakpoint is currently matching. */
  12. matches: boolean;
  13. /**
  14. * A key boolean pair for each query provided to the observe method,
  15. * with its current matched state.
  16. */
  17. breakpoints: {
  18. [key: string]: boolean;
  19. };
  20. }
  21. /** Utility for checking the matching state of `@media` queries. */
  22. declare class BreakpointObserver implements OnDestroy {
  23. private _mediaMatcher;
  24. private _zone;
  25. /** A map of all media queries currently being listened for. */
  26. private _queries;
  27. /** A subject for all other observables to takeUntil based on. */
  28. private readonly _destroySubject;
  29. constructor(...args: unknown[]);
  30. /** Completes the active subject, signalling to all other observables to complete. */
  31. ngOnDestroy(): void;
  32. /**
  33. * Whether one or more media queries match the current viewport size.
  34. * @param value One or more media queries to check.
  35. * @returns Whether any of the media queries match.
  36. */
  37. isMatched(value: string | readonly string[]): boolean;
  38. /**
  39. * Gets an observable of results for the given queries that will emit new results for any changes
  40. * in matching of the given queries.
  41. * @param value One or more media queries to check.
  42. * @returns A stream of matches for the given queries.
  43. */
  44. observe(value: string | readonly string[]): Observable<BreakpointState>;
  45. /** Registers a specific query to be listened for. */
  46. private _registerQuery;
  47. static ɵfac: i0.ɵɵFactoryDeclaration<BreakpointObserver, never>;
  48. static ɵprov: i0.ɵɵInjectableDeclaration<BreakpointObserver>;
  49. }
  50. declare const Breakpoints: {
  51. XSmall: string;
  52. Small: string;
  53. Medium: string;
  54. Large: string;
  55. XLarge: string;
  56. Handset: string;
  57. Tablet: string;
  58. Web: string;
  59. HandsetPortrait: string;
  60. TabletPortrait: string;
  61. WebPortrait: string;
  62. HandsetLandscape: string;
  63. TabletLandscape: string;
  64. WebLandscape: string;
  65. };
  66. /** A utility for calling matchMedia queries. */
  67. declare class MediaMatcher {
  68. private _platform;
  69. private _nonce;
  70. /** The internal matchMedia method to return back a MediaQueryList like object. */
  71. private _matchMedia;
  72. constructor(...args: unknown[]);
  73. /**
  74. * Evaluates the given media query and returns the native MediaQueryList from which results
  75. * can be retrieved.
  76. * Confirms the layout engine will trigger for the selector query provided and returns the
  77. * MediaQueryList for the query provided.
  78. */
  79. matchMedia(query: string): MediaQueryList;
  80. static ɵfac: i0.ɵɵFactoryDeclaration<MediaMatcher, never>;
  81. static ɵprov: i0.ɵɵInjectableDeclaration<MediaMatcher>;
  82. }
  83. export { BreakpointObserver, Breakpoints, LayoutModule, MediaMatcher };
  84. export type { BreakpointState };