Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkli committed Aug 7, 2024
2 parents f09585c + 0f13273 commit 0f433b8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 1 addition & 3 deletions libs/ngx-breakpoint-observer/src/lib/observe-breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { computed, type Signal } from '@angular/core';
import { observeMediaQuery } from './observe-media-query';
import {
Breakpoints,
defaultWindow,
MaybeSignalOrGetter,
ObserveBreakpointsOptions,
} from './types';
import { increaseWithUnit } from './utils/increase-with-unit';
import { toValue } from './utils/to-value';
import { defaultWindow, increaseWithUnit, toValue } from './utils';

/**
* Reactive viewport breakpoints
Expand Down
8 changes: 2 additions & 6 deletions libs/ngx-breakpoint-observer/src/lib/observe-media-query.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { effect, type Signal, signal, untracked } from '@angular/core';
import {
ConfigurableWindow,
defaultWindow,
MaybeSignalOrGetter,
} from './types';
import { toValue } from './utils/to-value';
import { ConfigurableWindow, MaybeSignalOrGetter } from './types';
import { defaultWindow, toValue } from './utils';

/**
* Reactive Media Query.
Expand Down
9 changes: 4 additions & 5 deletions libs/ngx-breakpoint-observer/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { Signal } from '@angular/core';

export type Breakpoints<K extends string = string> = Record<K, number | string>;

/**
* Maybe it's a signal, or a plain value, or a getter function
*/
export type MaybeSignalOrGetter<T> = T | Signal<T> | (() => T);

export interface ConfigurableWindow {
/*
/**
* Specify a custom `window` instance, e.g. working with iframes or in testing environments.
*/
window?: Window;
Expand All @@ -22,7 +25,3 @@ export interface ObserveBreakpointsOptions extends ConfigurableWindow {
*/
strategy?: 'min-width' | 'max-width';
}

export const isClient =
typeof window !== 'undefined' && typeof document !== 'undefined';
export const defaultWindow = isClient ? window : undefined;
3 changes: 3 additions & 0 deletions libs/ngx-breakpoint-observer/src/lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './increase-with-unit';
export * from './to-value';
export * from './utils';
3 changes: 3 additions & 0 deletions libs/ngx-breakpoint-observer/src/lib/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const isClient =
typeof window !== 'undefined' && typeof document !== 'undefined';
export const defaultWindow = isClient ? window : undefined;

0 comments on commit 0f433b8

Please sign in to comment.